Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
98ff7943
Unverified
Commit
98ff7943
authored
Aug 02, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup
parent
24fa80ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
93 deletions
+79
-93
include/cif++/v2/file.hpp
+1
-1
include/cif++/v2/parser.hpp
+77
-92
include/cif++/v2/row.hpp
+1
-0
No files found.
include/cif++/v2/file.hpp
View file @
98ff7943
...
@@ -139,7 +139,7 @@ class file_t
...
@@ -139,7 +139,7 @@ class file_t
// setValidator(nullptr);
// setValidator(nullptr);
parser_type
p
(
is
,
*
this
);
parser_type
p
(
is
,
*
this
);
p
.
parse
F
ile
();
p
.
parse
_f
ile
();
// if (saved != nullptr)
// if (saved != nullptr)
// {
// {
...
...
include/cif++/v2/parser.hpp
View file @
98ff7943
...
@@ -48,16 +48,16 @@ class parse_error : public std::runtime_error
...
@@ -48,16 +48,16 @@ class parse_error : public std::runtime_error
class
sac_parser
class
sac_parser
{
{
public
:
public
:
using
DatablockI
ndex
=
std
::
map
<
std
::
string
,
std
::
size_t
>
;
using
datablock_i
ndex
=
std
::
map
<
std
::
string
,
std
::
size_t
>
;
sac_parser
(
std
::
istream
&
is
)
sac_parser
(
std
::
istream
&
is
,
bool
init
=
true
)
:
m
Data
(
is
)
:
m
_source
(
is
)
{
{
m_validate
=
true
;
m_validate
=
true
;
m_line_nr
=
1
;
m_line_nr
=
1
;
m_bol
=
true
;
m_bol
=
true
;
//
if (init)
if
(
init
)
m_lookahead
=
get_next_token
();
m_lookahead
=
get_next_token
();
}
}
...
@@ -157,6 +157,7 @@ class sac_parser
...
@@ -157,6 +157,7 @@ class sac_parser
case
CIFToken
:
:
STOP
:
return
"STOP"
;
case
CIFToken
:
:
STOP
:
return
"STOP"
;
case
CIFToken
:
:
Tag
:
return
"Tag"
;
case
CIFToken
:
:
Tag
:
return
"Tag"
;
case
CIFToken
:
:
Value
:
return
"Value"
;
case
CIFToken
:
:
Value
:
return
"Value"
;
default:
return
"Invalid token parameter"
;
}
}
}
}
...
@@ -182,41 +183,42 @@ class sac_parser
...
@@ -182,41 +183,42 @@ class sac_parser
case
CIFValue
:
:
TextField
:
return
"TextField"
;
case
CIFValue
:
:
TextField
:
return
"TextField"
;
case
CIFValue
:
:
Inapplicable
:
return
"Inapplicable"
;
case
CIFValue
:
:
Inapplicable
:
return
"Inapplicable"
;
case
CIFValue
:
:
Unknown
:
return
"Unknown"
;
case
CIFValue
:
:
Unknown
:
return
"Unknown"
;
default:
return
"Invalid type parameter"
;
}
}
}
}
// get
NextC
har takes a char from the buffer, or if it is empty
// get
_next_c
har takes a char from the buffer, or if it is empty
// from the istream. This function also does carriage/linefeed
// from the istream. This function also does carriage/linefeed
// translation.
// translation.
int
get
NextC
har
()
int
get
_next_c
har
()
{
{
int
result
;
int
result
;
if
(
m
B
uffer
.
empty
())
if
(
m
_b
uffer
.
empty
())
result
=
m
Data
.
get
();
result
=
m
_source
.
get
();
else
else
{
{
result
=
m
B
uffer
.
top
();
result
=
m
_b
uffer
.
top
();
m
B
uffer
.
pop
();
m
_b
uffer
.
pop
();
}
}
// very simple CR/LF translation into LF
// very simple CR/LF translation into LF
if
(
result
==
'\r'
)
if
(
result
==
'\r'
)
{
{
int
lookahead
=
m
Data
.
get
();
int
lookahead
=
m
_source
.
get
();
if
(
lookahead
!=
'\n'
)
if
(
lookahead
!=
'\n'
)
m
B
uffer
.
push
(
lookahead
);
m
_b
uffer
.
push
(
lookahead
);
result
=
'\n'
;
result
=
'\n'
;
}
}
m
TokenV
alue
+=
static_cast
<
char
>
(
result
);
m
_token_v
alue
+=
static_cast
<
char
>
(
result
);
if
(
result
==
'\n'
)
if
(
result
==
'\n'
)
++
m_line_nr
;
++
m_line_nr
;
if
(
VERBOSE
>=
6
)
if
(
VERBOSE
>=
6
)
{
{
std
::
cerr
<<
"get
NextC
har => "
;
std
::
cerr
<<
"get
_next_c
har => "
;
if
(
iscntrl
(
result
)
or
not
isprint
(
result
))
if
(
iscntrl
(
result
)
or
not
isprint
(
result
))
std
::
cerr
<<
int
(
result
)
<<
std
::
endl
;
std
::
cerr
<<
int
(
result
)
<<
std
::
endl
;
else
else
...
@@ -228,21 +230,21 @@ class sac_parser
...
@@ -228,21 +230,21 @@ class sac_parser
void
retract
()
void
retract
()
{
{
assert
(
not
m
TokenV
alue
.
empty
());
assert
(
not
m
_token_v
alue
.
empty
());
char
ch
=
m
TokenV
alue
.
back
();
char
ch
=
m
_token_v
alue
.
back
();
if
(
ch
==
'\n'
)
if
(
ch
==
'\n'
)
--
m_line_nr
;
--
m_line_nr
;
m
B
uffer
.
push
(
ch
);
m
_b
uffer
.
push
(
ch
);
m
TokenV
alue
.
pop_back
();
m
_token_v
alue
.
pop_back
();
}
}
int
restart
(
int
start
)
int
restart
(
int
start
)
{
{
int
result
=
0
;
int
result
=
0
;
while
(
not
m
TokenV
alue
.
empty
())
while
(
not
m
_token_v
alue
.
empty
())
retract
();
retract
();
switch
(
start
)
switch
(
start
)
...
@@ -277,12 +279,12 @@ class sac_parser
...
@@ -277,12 +279,12 @@ class sac_parser
int
state
=
State
::
Start
,
start
=
State
::
Start
;
int
state
=
State
::
Start
,
start
=
State
::
Start
;
m_bol
=
false
;
m_bol
=
false
;
m
TokenV
alue
.
clear
();
m
_token_v
alue
.
clear
();
mTokenType
=
CIFValue
::
Unknown
;
mTokenType
=
CIFValue
::
Unknown
;
while
(
result
==
CIFToken
::
Unknown
)
while
(
result
==
CIFToken
::
Unknown
)
{
{
auto
ch
=
get
NextC
har
();
auto
ch
=
get
_next_c
har
();
switch
(
state
)
switch
(
state
)
{
{
...
@@ -318,7 +320,7 @@ class sac_parser
...
@@ -318,7 +320,7 @@ class sac_parser
{
{
state
=
State
::
Start
;
state
=
State
::
Start
;
retract
();
retract
();
m
TokenV
alue
.
clear
();
m
_token_v
alue
.
clear
();
}
}
else
else
m_bol
=
(
ch
==
'\n'
);
m_bol
=
(
ch
==
'\n'
);
...
@@ -329,7 +331,7 @@ class sac_parser
...
@@ -329,7 +331,7 @@ class sac_parser
{
{
state
=
State
::
Start
;
state
=
State
::
Start
;
m_bol
=
true
;
m_bol
=
true
;
m
TokenV
alue
.
clear
();
m
_token_v
alue
.
clear
();
}
}
else
if
(
ch
==
kEOF
)
else
if
(
ch
==
kEOF
)
result
=
CIFToken
::
Eof
;
result
=
CIFToken
::
Eof
;
...
@@ -351,8 +353,8 @@ class sac_parser
...
@@ -351,8 +353,8 @@ class sac_parser
state
=
State
::
TextField
;
state
=
State
::
TextField
;
else
if
(
ch
==
';'
)
else
if
(
ch
==
';'
)
{
{
assert
(
m
TokenV
alue
.
length
()
>=
2
);
assert
(
m
_token_v
alue
.
length
()
>=
2
);
m
TokenValue
=
mTokenValue
.
substr
(
1
,
mTokenV
alue
.
length
()
-
3
);
m
_token_value
=
m_token_value
.
substr
(
1
,
m_token_v
alue
.
length
()
-
3
);
mTokenType
=
CIFValue
::
TextField
;
mTokenType
=
CIFValue
::
TextField
;
result
=
CIFToken
::
Value
;
result
=
CIFToken
::
Value
;
}
}
...
@@ -378,10 +380,10 @@ class sac_parser
...
@@ -378,10 +380,10 @@ class sac_parser
result
=
CIFToken
::
Value
;
result
=
CIFToken
::
Value
;
mTokenType
=
CIFValue
::
String
;
mTokenType
=
CIFValue
::
String
;
if
(
m
TokenV
alue
.
length
()
<
2
)
if
(
m
_token_v
alue
.
length
()
<
2
)
error
(
"Invalid quoted string token"
);
error
(
"Invalid quoted string token"
);
m
TokenValue
=
mTokenValue
.
substr
(
1
,
mTokenV
alue
.
length
()
-
2
);
m
_token_value
=
m_token_value
.
substr
(
1
,
m_token_v
alue
.
length
()
-
2
);
}
}
else
if
(
ch
==
quoteChar
)
else
if
(
ch
==
quoteChar
)
;
;
...
@@ -493,7 +495,7 @@ class sac_parser
...
@@ -493,7 +495,7 @@ class sac_parser
case
State
:
:
Value
:
case
State
:
:
Value
:
if
(
ch
==
'_'
)
if
(
ch
==
'_'
)
{
{
std
::
string
s
=
toLowerCopy
(
m
TokenV
alue
);
std
::
string
s
=
toLowerCopy
(
m
_token_v
alue
);
if
(
s
==
"global_"
)
if
(
s
==
"global_"
)
result
=
CIFToken
::
GLOBAL
;
result
=
CIFToken
::
GLOBAL
;
...
@@ -518,12 +520,12 @@ class sac_parser
...
@@ -518,12 +520,12 @@ class sac_parser
retract
();
retract
();
result
=
CIFToken
::
Value
;
result
=
CIFToken
::
Value
;
if
(
m
TokenV
alue
==
"."
)
if
(
m
_token_v
alue
==
"."
)
mTokenType
=
CIFValue
::
Inapplicable
;
mTokenType
=
CIFValue
::
Inapplicable
;
else
if
(
m
TokenV
alue
==
"?"
)
else
if
(
m
_token_v
alue
==
"?"
)
{
{
mTokenType
=
CIFValue
::
Unknown
;
mTokenType
=
CIFValue
::
Unknown
;
m
TokenV
alue
.
clear
();
m
_token_v
alue
.
clear
();
}
}
}
}
break
;
break
;
...
@@ -539,7 +541,7 @@ class sac_parser
...
@@ -539,7 +541,7 @@ class sac_parser
else
else
result
=
CIFToken
::
SAVE
;
result
=
CIFToken
::
SAVE
;
m
TokenValue
.
erase
(
mTokenValue
.
begin
(),
mTokenV
alue
.
begin
()
+
5
);
m
_token_value
.
erase
(
m_token_value
.
begin
(),
m_token_v
alue
.
begin
()
+
5
);
}
}
break
;
break
;
...
@@ -556,7 +558,7 @@ class sac_parser
...
@@ -556,7 +558,7 @@ class sac_parser
if
(
mTokenType
!=
CIFValue
::
Unknown
)
if
(
mTokenType
!=
CIFValue
::
Unknown
)
std
::
cerr
<<
' '
<<
get_value_name
(
mTokenType
);
std
::
cerr
<<
' '
<<
get_value_name
(
mTokenType
);
if
(
result
!=
CIFToken
::
Eof
)
if
(
result
!=
CIFToken
::
Eof
)
std
::
cerr
<<
" "
<<
std
::
quoted
(
m
TokenV
alue
);
std
::
cerr
<<
" "
<<
std
::
quoted
(
m
_token_v
alue
);
std
::
cerr
<<
std
::
endl
;
std
::
cerr
<<
std
::
endl
;
}
}
...
@@ -572,10 +574,10 @@ class sac_parser
...
@@ -572,10 +574,10 @@ class sac_parser
}
}
public
:
public
:
bool
parse
SingleD
atablock
(
const
std
::
string
&
datablock
)
bool
parse
_single_d
atablock
(
const
std
::
string
&
datablock
)
{
{
// first locate the start, as fast as we can
// first locate the start, as fast as we can
auto
&
sb
=
*
m
Data
.
rdbuf
();
auto
&
sb
=
*
m
_source
.
rdbuf
();
enum
enum
{
{
...
@@ -653,20 +655,20 @@ class sac_parser
...
@@ -653,20 +655,20 @@ class sac_parser
if
(
found
)
if
(
found
)
{
{
produce
D
atablock
(
datablock
);
produce
_d
atablock
(
datablock
);
m_lookahead
=
get_next_token
();
m_lookahead
=
get_next_token
();
parse
DataB
lock
();
parse
_datab
lock
();
}
}
return
found
;
return
found
;
}
}
DatablockIndex
indexD
atablocks
()
datablock_index
index_d
atablocks
()
{
{
DatablockI
ndex
index
;
datablock_i
ndex
index
;
// first locate the start, as fast as we can
// first locate the start, as fast as we can
auto
&
sb
=
*
m
Data
.
rdbuf
();
auto
&
sb
=
*
m
_source
.
rdbuf
();
enum
enum
{
{
...
@@ -748,7 +750,7 @@ class sac_parser
...
@@ -748,7 +750,7 @@ class sac_parser
else
if
(
isspace
(
ch
))
else
if
(
isspace
(
ch
))
{
{
if
(
not
datablock
.
empty
())
if
(
not
datablock
.
empty
())
index
[
datablock
]
=
m
Data
.
tellg
();
index
[
datablock
]
=
m
_source
.
tellg
();
state
=
start
;
state
=
start
;
}
}
...
@@ -763,18 +765,18 @@ class sac_parser
...
@@ -763,18 +765,18 @@ class sac_parser
return
index
;
return
index
;
}
}
bool
parse
SingleDatablock
(
const
std
::
string
&
datablock
,
const
DatablockI
ndex
&
index
)
bool
parse
_single_datablock
(
const
std
::
string
&
datablock
,
const
datablock_i
ndex
&
index
)
{
{
bool
result
=
false
;
bool
result
=
false
;
auto
i
=
index
.
find
(
datablock
);
auto
i
=
index
.
find
(
datablock
);
if
(
i
!=
index
.
end
())
if
(
i
!=
index
.
end
())
{
{
m
Data
.
seekg
(
i
->
second
);
m
_source
.
seekg
(
i
->
second
);
produce
D
atablock
(
datablock
);
produce
_d
atablock
(
datablock
);
m_lookahead
=
get_next_token
();
m_lookahead
=
get_next_token
();
parse
DataB
lock
();
parse
_datab
lock
();
result
=
true
;
result
=
true
;
}
}
...
@@ -782,21 +784,21 @@ class sac_parser
...
@@ -782,21 +784,21 @@ class sac_parser
return
result
;
return
result
;
}
}
void
parse
F
ile
()
void
parse
_f
ile
()
{
{
while
(
m_lookahead
!=
CIFToken
::
Eof
)
while
(
m_lookahead
!=
CIFToken
::
Eof
)
{
{
switch
(
m_lookahead
)
switch
(
m_lookahead
)
{
{
case
CIFToken
:
:
GLOBAL
:
case
CIFToken
:
:
GLOBAL
:
parse
G
lobal
();
parse
_g
lobal
();
break
;
break
;
case
CIFToken
:
:
DATA
:
case
CIFToken
:
:
DATA
:
produce
Datablock
(
mTokenV
alue
);
produce
_datablock
(
m_token_v
alue
);
match
(
CIFToken
::
DATA
);
match
(
CIFToken
::
DATA
);
parse
DataB
lock
();
parse
_datab
lock
();
break
;
break
;
default
:
default
:
...
@@ -807,7 +809,7 @@ class sac_parser
...
@@ -807,7 +809,7 @@ class sac_parser
}
}
protected
:
protected
:
void
parse
G
lobal
()
void
parse
_g
lobal
()
{
{
match
(
CIFToken
::
GLOBAL
);
match
(
CIFToken
::
GLOBAL
);
while
(
m_lookahead
==
CIFToken
::
Tag
)
while
(
m_lookahead
==
CIFToken
::
Tag
)
...
@@ -817,7 +819,7 @@ class sac_parser
...
@@ -817,7 +819,7 @@ class sac_parser
}
}
}
}
void
parse
DataB
lock
()
void
parse
_datab
lock
()
{
{
std
::
string
cat
;
std
::
string
cat
;
...
@@ -836,11 +838,11 @@ class sac_parser
...
@@ -836,11 +838,11 @@ class sac_parser
while
(
m_lookahead
==
CIFToken
::
Tag
)
while
(
m_lookahead
==
CIFToken
::
Tag
)
{
{
std
::
string
catName
,
itemName
;
std
::
string
catName
,
itemName
;
std
::
tie
(
catName
,
itemName
)
=
splitTagName
(
m
TokenV
alue
);
std
::
tie
(
catName
,
itemName
)
=
splitTagName
(
m
_token_v
alue
);
if
(
cat
.
empty
())
if
(
cat
.
empty
())
{
{
produce
C
ategory
(
catName
);
produce
_c
ategory
(
catName
);
cat
=
catName
;
cat
=
catName
;
}
}
else
if
(
not
iequals
(
cat
,
catName
))
else
if
(
not
iequals
(
cat
,
catName
))
...
@@ -853,11 +855,11 @@ class sac_parser
...
@@ -853,11 +855,11 @@ class sac_parser
while
(
m_lookahead
==
CIFToken
::
Value
)
while
(
m_lookahead
==
CIFToken
::
Value
)
{
{
produce
R
ow
();
produce
_r
ow
();
for
(
auto
tag
:
tags
)
for
(
auto
tag
:
tags
)
{
{
produce
Item
(
cat
,
tag
,
mTokenV
alue
);
produce
_item
(
cat
,
tag
,
m_token_v
alue
);
match
(
CIFToken
::
Value
);
match
(
CIFToken
::
Value
);
}
}
}
}
...
@@ -869,25 +871,25 @@ class sac_parser
...
@@ -869,25 +871,25 @@ class sac_parser
case
CIFToken
:
:
Tag
:
case
CIFToken
:
:
Tag
:
{
{
std
::
string
catName
,
itemName
;
std
::
string
catName
,
itemName
;
std
::
tie
(
catName
,
itemName
)
=
splitTagName
(
m
TokenV
alue
);
std
::
tie
(
catName
,
itemName
)
=
splitTagName
(
m
_token_v
alue
);
if
(
not
iequals
(
cat
,
catName
))
if
(
not
iequals
(
cat
,
catName
))
{
{
produce
C
ategory
(
catName
);
produce
_c
ategory
(
catName
);
cat
=
catName
;
cat
=
catName
;
produce
R
ow
();
produce
_r
ow
();
}
}
match
(
CIFToken
::
Tag
);
match
(
CIFToken
::
Tag
);
produce
Item
(
cat
,
itemName
,
mTokenV
alue
);
produce
_item
(
cat
,
itemName
,
m_token_v
alue
);
match
(
CIFToken
::
Value
);
match
(
CIFToken
::
Value
);
break
;
break
;
}
}
case
CIFToken
:
:
SAVE
:
case
CIFToken
:
:
SAVE
:
parse
SaveF
rame
();
parse
_save_f
rame
();
break
;
break
;
default
:
default
:
...
@@ -897,7 +899,7 @@ class sac_parser
...
@@ -897,7 +899,7 @@ class sac_parser
}
}
}
}
virtual
void
parse
SaveF
rame
()
virtual
void
parse
_save_f
rame
()
{
{
error
(
"A regular CIF file should not contain a save frame"
);
error
(
"A regular CIF file should not contain a save frame"
);
}
}
...
@@ -914,10 +916,10 @@ class sac_parser
...
@@ -914,10 +916,10 @@ class sac_parser
// production methods, these are pure virtual here
// production methods, these are pure virtual here
virtual
void
produce
D
atablock
(
const
std
::
string
&
name
)
=
0
;
virtual
void
produce
_d
atablock
(
const
std
::
string
&
name
)
=
0
;
virtual
void
produce
C
ategory
(
const
std
::
string
&
name
)
=
0
;
virtual
void
produce
_c
ategory
(
const
std
::
string
&
name
)
=
0
;
virtual
void
produce
R
ow
()
=
0
;
virtual
void
produce
_r
ow
()
=
0
;
virtual
void
produce
I
tem
(
const
std
::
string
&
category
,
const
std
::
string
&
item
,
const
std
::
string
&
value
)
=
0
;
virtual
void
produce
_i
tem
(
const
std
::
string
&
category
,
const
std
::
string
&
item
,
const
std
::
string
&
value
)
=
0
;
protected
:
protected
:
enum
State
enum
State
...
@@ -939,16 +941,16 @@ class sac_parser
...
@@ -939,16 +941,16 @@ class sac_parser
SAVE
SAVE
};
};
std
::
istream
&
m
Data
;
std
::
istream
&
m
_source
;
// Parser state
// Parser state
bool
m_validate
;
bool
m_validate
;
uint32_t
m_line_nr
;
uint32_t
m_line_nr
;
bool
m_bol
;
bool
m_bol
;
CIFToken
m_lookahead
;
CIFToken
m_lookahead
;
std
::
string
m
TokenV
alue
;
std
::
string
m
_token_v
alue
;
CIFValue
mTokenType
;
CIFValue
mTokenType
;
std
::
stack
<
int
>
m
B
uffer
;
std
::
stack
<
int
>
m
_b
uffer
;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -971,12 +973,12 @@ class parser_t : public sac_parser
...
@@ -971,12 +973,12 @@ class parser_t : public sac_parser
{
{
}
}
void
produce
D
atablock
(
const
std
::
string
&
name
)
override
void
produce
_d
atablock
(
const
std
::
string
&
name
)
override
{
{
std
::
tie
(
m_datablock
,
std
::
ignore
)
=
m_file
.
emplace
(
name
);
std
::
tie
(
m_datablock
,
std
::
ignore
)
=
m_file
.
emplace
(
name
);
}
}
void
produce
C
ategory
(
const
std
::
string
&
name
)
override
void
produce
_c
ategory
(
const
std
::
string
&
name
)
override
{
{
if
(
VERBOSE
>=
4
)
if
(
VERBOSE
>=
4
)
std
::
cerr
<<
"producing category "
<<
name
<<
std
::
endl
;
std
::
cerr
<<
"producing category "
<<
name
<<
std
::
endl
;
...
@@ -984,7 +986,7 @@ class parser_t : public sac_parser
...
@@ -984,7 +986,7 @@ class parser_t : public sac_parser
std
::
tie
(
m_category
,
std
::
ignore
)
=
m_datablock
->
emplace
(
name
);
std
::
tie
(
m_category
,
std
::
ignore
)
=
m_datablock
->
emplace
(
name
);
}
}
void
produce
R
ow
()
override
void
produce
_r
ow
()
override
{
{
if
(
VERBOSE
>=
4
)
if
(
VERBOSE
>=
4
)
std
::
cerr
<<
"producing row for category "
<<
m_category
->
name
()
<<
std
::
endl
;
std
::
cerr
<<
"producing row for category "
<<
m_category
->
name
()
<<
std
::
endl
;
...
@@ -994,7 +996,7 @@ class parser_t : public sac_parser
...
@@ -994,7 +996,7 @@ class parser_t : public sac_parser
// m_row.lineNr(m_line_nr);
// m_row.lineNr(m_line_nr);
}
}
void
produce
I
tem
(
const
std
::
string
&
category
,
const
std
::
string
&
item
,
const
std
::
string
&
value
)
override
void
produce
_i
tem
(
const
std
::
string
&
category
,
const
std
::
string
&
item
,
const
std
::
string
&
value
)
override
{
{
if
(
VERBOSE
>=
4
)
if
(
VERBOSE
>=
4
)
std
::
cerr
<<
"producing _"
<<
category
<<
'.'
<<
item
<<
" -> "
<<
value
<<
std
::
endl
;
std
::
cerr
<<
"producing _"
<<
category
<<
'.'
<<
item
<<
" -> "
<<
value
<<
std
::
endl
;
...
@@ -1002,7 +1004,7 @@ class parser_t : public sac_parser
...
@@ -1002,7 +1004,7 @@ class parser_t : public sac_parser
if
(
not
iequals
(
category
,
m_category
->
name
()))
if
(
not
iequals
(
category
,
m_category
->
name
()))
error
(
"inconsistent categories in loop_"
);
error
(
"inconsistent categories in loop_"
);
m_row
[
item
]
=
m
TokenV
alue
;
m_row
[
item
]
=
m
_token_v
alue
;
}
}
protected
:
protected
:
...
@@ -1012,24 +1014,7 @@ class parser_t : public sac_parser
...
@@ -1012,24 +1014,7 @@ class parser_t : public sac_parser
row_handle_type
m_row
;
row_handle_type
m_row
;
};
};
// class Parser : public SacParser
// --------------------------------------------------------------------
// {
// public:
// Parser(std::istream &is, File &f, bool init = true);
// virtual void produceDatablock(const std::string &name);
// virtual void produceCategory(const std::string &name);
// virtual void produceRow();
// virtual void produceItem(const std::string &category, const std::string &item, const std::string &value);
// protected:
// File &mFile;
// Datablock *mDataBlock;
// Datablock::iterator m_category;
// Row mRow;
// };
// // --------------------------------------------------------------------
// class DictParser : public Parser
// class DictParser : public Parser
// {
// {
...
@@ -1040,7 +1025,7 @@ class parser_t : public sac_parser
...
@@ -1040,7 +1025,7 @@ class parser_t : public sac_parser
// void loadDictionary();
// void loadDictionary();
// private:
// private:
// virtual void parse
SaveF
rame();
// virtual void parse
_save_f
rame();
// bool collectItemTypes();
// bool collectItemTypes();
// void linkItems();
// void linkItems();
...
...
include/cif++/v2/row.hpp
View file @
98ff7943
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#pragma once
#pragma once
#include <cif++/v2/item.hpp>
#include <cif++/v2/item.hpp>
#include <cif++/v2/condition.hpp>
namespace
cif
::
v2
namespace
cif
::
v2
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment