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
a4680f7d
Unverified
Commit
a4680f7d
authored
Mar 09, 2024
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error_code should be checked differently?
parent
da8a72a8
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
32 additions
and
31 deletions
+32
-31
include/cif++/category.hpp
+1
-0
include/cif++/item.hpp
+5
-5
include/cif++/model.hpp
+1
-1
include/cif++/text.hpp
+2
-2
src/category.cpp
+1
-1
src/model.cpp
+2
-2
src/pdb/cif2pdb.cpp
+3
-3
src/pdb/pdb2cif.cpp
+3
-3
src/pdb/reconstruct.cpp
+2
-2
src/pdb/validate-pdbx.cpp
+2
-2
src/symmetry.cpp
+2
-2
src/symop-map-generator.cpp
+1
-1
src/validate.cpp
+4
-4
test/reconstruction-test.cpp
+1
-1
test/unit-v2-test.cpp
+2
-2
No files found.
include/cif++/category.hpp
View file @
a4680f7d
...
@@ -1263,6 +1263,7 @@ class category
...
@@ -1263,6 +1263,7 @@ class category
{
{
}
}
#pragma warning("NEED TO FIX THIS!")
category
*
linked
;
category
*
linked
;
const
link_validator
*
v
;
const
link_validator
*
v
;
};
};
...
...
include/cif++/item.hpp
View file @
a4680f7d
...
@@ -117,7 +117,7 @@ class item
...
@@ -117,7 +117,7 @@ class item
char
buffer
[
32
];
char
buffer
[
32
];
auto
r
=
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
,
chars_format
::
fixed
,
precision
);
auto
r
=
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
,
chars_format
::
fixed
,
precision
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"Could not format number"
);
throw
std
::
runtime_error
(
"Could not format number"
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
...
@@ -136,7 +136,7 @@ class item
...
@@ -136,7 +136,7 @@ class item
char
buffer
[
32
];
char
buffer
[
32
];
auto
r
=
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
,
chars_format
::
general
);
auto
r
=
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
,
chars_format
::
general
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"Could not format number"
);
throw
std
::
runtime_error
(
"Could not format number"
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
...
@@ -151,7 +151,7 @@ class item
...
@@ -151,7 +151,7 @@ class item
char
buffer
[
32
];
char
buffer
[
32
];
auto
r
=
std
::
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
);
auto
r
=
std
::
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
)
-
1
,
value
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"Could not format number"
);
throw
std
::
runtime_error
(
"Could not format number"
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
m_value
.
assign
(
buffer
,
r
.
ptr
-
buffer
);
...
@@ -560,7 +560,7 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_arithmetic_v<T> an
...
@@ -560,7 +560,7 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_arithmetic_v<T> an
std
::
from_chars_result
r
=
(
b
+
1
<
e
and
*
b
==
'+'
and
std
::
isdigit
(
b
[
1
]))
?
selected_charconv
<
value_type
>::
from_chars
(
b
+
1
,
e
,
result
)
:
selected_charconv
<
value_type
>::
from_chars
(
b
,
e
,
result
);
std
::
from_chars_result
r
=
(
b
+
1
<
e
and
*
b
==
'+'
and
std
::
isdigit
(
b
[
1
]))
?
selected_charconv
<
value_type
>::
from_chars
(
b
+
1
,
e
,
result
)
:
selected_charconv
<
value_type
>::
from_chars
(
b
,
e
,
result
);
if
(
r
.
ec
!=
std
::
errc
()
or
r
.
ptr
!=
e
)
if
(
(
bool
)
r
.
ec
or
r
.
ptr
!=
e
)
{
{
result
=
{};
result
=
{};
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
...
@@ -595,7 +595,7 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_arithmetic_v<T> an
...
@@ -595,7 +595,7 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_arithmetic_v<T> an
std
::
from_chars_result
r
=
(
b
+
1
<
e
and
*
b
==
'+'
and
std
::
isdigit
(
b
[
1
]))
?
selected_charconv
<
value_type
>::
from_chars
(
b
+
1
,
e
,
v
)
:
selected_charconv
<
value_type
>::
from_chars
(
b
,
e
,
v
);
std
::
from_chars_result
r
=
(
b
+
1
<
e
and
*
b
==
'+'
and
std
::
isdigit
(
b
[
1
]))
?
selected_charconv
<
value_type
>::
from_chars
(
b
+
1
,
e
,
v
)
:
selected_charconv
<
value_type
>::
from_chars
(
b
,
e
,
v
);
if
(
r
.
ec
!=
std
::
errc
()
or
r
.
ptr
!=
e
)
if
(
(
bool
)
r
.
ec
or
r
.
ptr
!=
e
)
{
{
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
{
{
...
...
include/cif++/model.hpp
View file @
a4680f7d
...
@@ -741,7 +741,7 @@ class sugar : public residue
...
@@ -741,7 +741,7 @@ class sugar : public residue
{
{
int
result
;
int
result
;
auto
r
=
std
::
from_chars
(
m_auth_seq_id
.
data
(),
m_auth_seq_id
.
data
()
+
m_auth_seq_id
.
length
(),
result
);
auto
r
=
std
::
from_chars
(
m_auth_seq_id
.
data
(),
m_auth_seq_id
.
data
()
+
m_auth_seq_id
.
length
(),
result
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"The auth_seq_id should be a number for a sugar"
);
throw
std
::
runtime_error
(
"The auth_seq_id should be a number for a sugar"
);
return
result
;
return
result
;
}
}
...
...
include/cif++/text.hpp
View file @
a4680f7d
...
@@ -383,7 +383,7 @@ std::from_chars_result from_chars(const char *first, const char *last, FloatType
...
@@ -383,7 +383,7 @@ std::from_chars_result from_chars(const char *first, const char *last, FloatType
int
exponent
=
0
;
int
exponent
=
0
;
bool
done
=
false
;
bool
done
=
false
;
while
(
not
done
and
result
.
ec
==
std
::
errc
()
)
while
(
not
done
and
not
(
bool
)
result
.
ec
)
{
{
char
ch
=
result
.
ptr
!=
last
?
*
result
.
ptr
:
0
;
char
ch
=
result
.
ptr
!=
last
?
*
result
.
ptr
:
0
;
++
result
.
ptr
;
++
result
.
ptr
;
...
@@ -467,7 +467,7 @@ std::from_chars_result from_chars(const char *first, const char *last, FloatType
...
@@ -467,7 +467,7 @@ std::from_chars_result from_chars(const char *first, const char *last, FloatType
}
}
}
}
if
(
result
.
ec
==
std
::
errc
()
)
if
(
not
(
bool
)
result
.
ec
)
{
{
long
double
v
=
f
*
vi
*
sign
;
long
double
v
=
f
*
vi
*
sign
;
if
(
exponent
!=
0
)
if
(
exponent
!=
0
)
...
...
src/category.cpp
View file @
a4680f7d
...
@@ -791,7 +791,7 @@ bool category::is_valid() const
...
@@ -791,7 +791,7 @@ bool category::is_valid() const
iv
->
validate_value
(
vi
->
text
(),
ec
);
iv
->
validate_value
(
vi
->
text
(),
ec
);
if
(
ec
!=
std
::
errc
()
)
if
(
(
bool
)
ec
)
{
{
m_validator
->
report_error
(
ec
,
m_name
,
m_items
[
cix
].
m_name
,
false
);
m_validator
->
report_error
(
ec
,
m_name
,
m_items
[
cix
].
m_name
,
false
);
continue
;
continue
;
...
...
src/model.cpp
View file @
a4680f7d
...
@@ -74,7 +74,7 @@ int atom::atom_impl::get_property_int(std::string_view name) const
...
@@ -74,7 +74,7 @@ int atom::atom_impl::get_property_int(std::string_view name) const
auto
s
=
get_property
(
name
);
auto
s
=
get_property
(
name
);
std
::
from_chars_result
r
=
std
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
result
);
std
::
from_chars_result
r
=
std
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
result
);
if
(
r
.
ec
!=
std
::
errc
()
and
VERBOSE
>
0
)
if
(
(
bool
)
r
.
ec
and
VERBOSE
>
0
)
std
::
cerr
<<
"Error converting "
<<
s
<<
" to number for property "
<<
name
<<
'\n'
;
std
::
cerr
<<
"Error converting "
<<
s
<<
" to number for property "
<<
name
<<
'\n'
;
}
}
return
result
;
return
result
;
...
@@ -88,7 +88,7 @@ float atom::atom_impl::get_property_float(std::string_view name) const
...
@@ -88,7 +88,7 @@ float atom::atom_impl::get_property_float(std::string_view name) const
auto
s
=
get_property
(
name
);
auto
s
=
get_property
(
name
);
std
::
from_chars_result
r
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
result
);
std
::
from_chars_result
r
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
result
);
if
(
r
.
ec
!=
std
::
errc
()
and
VERBOSE
>
0
)
if
(
(
bool
)
r
.
ec
and
VERBOSE
>
0
)
std
::
cerr
<<
"Error converting "
<<
s
<<
" to number for property "
<<
name
<<
'\n'
;
std
::
cerr
<<
"Error converting "
<<
s
<<
" to number for property "
<<
name
<<
'\n'
;
}
}
return
result
;
return
result
;
...
...
src/pdb/cif2pdb.cpp
View file @
a4680f7d
...
@@ -681,7 +681,7 @@ class Fi : public FBase
...
@@ -681,7 +681,7 @@ class Fi : public FBase
{
{
long
l
=
0
;
long
l
=
0
;
auto
r
=
std
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
l
);
auto
r
=
std
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
l
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
{
{
if
(
VERBOSE
>
0
)
if
(
VERBOSE
>
0
)
std
::
cerr
<<
"Failed to write '"
<<
s
<<
"' as a long from field "
<<
mField
<<
", this indicates an error in the code for writing PDB files
\n
"
;
std
::
cerr
<<
"Failed to write '"
<<
s
<<
"' as a long from field "
<<
mField
<<
", this indicates an error in the code for writing PDB files
\n
"
;
...
@@ -719,7 +719,7 @@ class Ff : public FBase
...
@@ -719,7 +719,7 @@ class Ff : public FBase
double
d
=
0
;
double
d
=
0
;
auto
r
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
d
);
auto
r
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
d
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
{
{
if
(
VERBOSE
>
0
)
if
(
VERBOSE
>
0
)
std
::
cerr
<<
"Failed to write '"
<<
s
<<
"' as a double from field "
<<
mField
<<
", this indicates an error in the code for writing PDB files
\n
"
;
std
::
cerr
<<
"Failed to write '"
<<
s
<<
"' as a double from field "
<<
mField
<<
", this indicates an error in the code for writing PDB files
\n
"
;
...
@@ -3393,7 +3393,7 @@ std::tuple<int, int> WriteCoordinatesForModel(std::ostream &pdbFile, const datab
...
@@ -3393,7 +3393,7 @@ std::tuple<int, int> WriteCoordinatesForModel(std::ostream &pdbFile, const datab
{
{
int
nr
=
0
;
int
nr
=
0
;
auto
r
=
std
::
from_chars
(
modelNum
.
data
(),
modelNum
.
data
()
+
modelNum
.
length
(),
nr
);
auto
r
=
std
::
from_chars
(
modelNum
.
data
(),
modelNum
.
data
()
+
modelNum
.
length
(),
nr
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
{
{
if
(
VERBOSE
>
0
)
if
(
VERBOSE
>
0
)
std
::
cerr
<<
"Model number '"
<<
modelNum
<<
"' is not a valid integer
\n
"
;
std
::
cerr
<<
"Model number '"
<<
modelNum
<<
"' is not a valid integer
\n
"
;
...
...
src/pdb/pdb2cif.cpp
View file @
a4680f7d
...
@@ -1132,7 +1132,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
...
@@ -1132,7 +1132,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
if
(
not
cs
.
empty
())
if
(
not
cs
.
empty
())
{
{
auto
r
=
std
::
from_chars
(
cs
.
data
(),
cs
.
data
()
+
cs
.
length
(),
result
);
auto
r
=
std
::
from_chars
(
cs
.
data
(),
cs
.
data
()
+
cs
.
length
(),
result
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"Continuation std::string '"
+
cs
+
"' is not valid"
);
throw
std
::
runtime_error
(
"Continuation std::string '"
+
cs
+
"' is not valid"
);
}
}
...
@@ -1397,7 +1397,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
...
@@ -1397,7 +1397,7 @@ void PDBFileParser::PreParseInput(std::istream &is)
{
{
auto
f
=
cur
->
vF
(
74
,
78
);
auto
f
=
cur
->
vF
(
74
,
78
);
auto
r
=
cif
::
from_chars
(
f
.
data
(),
f
.
data
()
+
f
.
length
(),
link
.
distance
);
auto
r
=
cif
::
from_chars
(
f
.
data
(),
f
.
data
()
+
f
.
length
(),
link
.
distance
);
if
(
r
.
ec
!=
std
::
errc
()
and
cif
::
VERBOSE
>
0
)
if
(
(
bool
)
r
.
ec
and
cif
::
VERBOSE
>
0
)
std
::
cerr
<<
"Error parsing link distance at line "
<<
cur
->
mLineNr
<<
'\n'
;
std
::
cerr
<<
"Error parsing link distance at line "
<<
cur
->
mLineNr
<<
'\n'
;
}
}
// 74 – 78 Real(5.2) Length Link distance
// 74 – 78 Real(5.2) Length Link distance
...
@@ -5306,7 +5306,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
...
@@ -5306,7 +5306,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
double
d
;
double
d
;
auto
r
=
cif
::
from_chars
(
distance
.
data
(),
distance
.
data
()
+
distance
.
length
(),
d
);
auto
r
=
cif
::
from_chars
(
distance
.
data
(),
distance
.
data
()
+
distance
.
length
(),
d
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
{
{
if
(
cif
::
VERBOSE
>
0
)
if
(
cif
::
VERBOSE
>
0
)
std
::
cerr
<<
"Distance value '"
<<
distance
<<
"' is not a valid float in LINK record
\n
"
;
std
::
cerr
<<
"Distance value '"
<<
distance
<<
"' is not a valid float in LINK record
\n
"
;
...
...
src/pdb/reconstruct.cpp
View file @
a4680f7d
...
@@ -514,14 +514,14 @@ void checkAtomRecords(datablock &db)
...
@@ -514,14 +514,14 @@ void checkAtomRecords(datablock &db)
float
v
;
float
v
;
auto
s
=
row
.
get
<
std
::
string
>
(
item_name
);
auto
s
=
row
.
get
<
std
::
string
>
(
item_name
);
if
(
auto
[
ptr
,
ec
]
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
v
);
ec
!=
std
::
errc
()
)
if
(
auto
[
ptr
,
ec
]
=
cif
::
from_chars
(
s
.
data
(),
s
.
data
()
+
s
.
length
(),
v
);
(
bool
)
ec
)
continue
;
continue
;
if
(
s
.
length
()
<
prec
+
1
or
s
[
s
.
length
()
-
prec
-
1
]
!=
'.'
)
if
(
s
.
length
()
<
prec
+
1
or
s
[
s
.
length
()
-
prec
-
1
]
!=
'.'
)
{
{
char
b
[
12
];
char
b
[
12
];
if
(
auto
[
ptr
,
ec
]
=
cif
::
to_chars
(
b
,
b
+
sizeof
(
b
),
v
,
cif
::
chars_format
::
fixed
,
prec
);
ec
==
std
::
errc
()
)
if
(
auto
[
ptr
,
ec
]
=
cif
::
to_chars
(
b
,
b
+
sizeof
(
b
),
v
,
cif
::
chars_format
::
fixed
,
prec
);
(
bool
)
ec
)
row
.
assign
(
item_name
,
{
b
,
static_cast
<
std
::
string
::
size_type
>
(
ptr
-
b
)
},
false
,
false
);
row
.
assign
(
item_name
,
{
b
,
static_cast
<
std
::
string
::
size_type
>
(
ptr
-
b
)
},
false
,
false
);
}
}
}
}
...
...
src/pdb/validate-pdbx.cpp
View file @
a4680f7d
...
@@ -71,7 +71,7 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary)
...
@@ -71,7 +71,7 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary)
{
{
std
::
error_code
ec
;
std
::
error_code
ec
;
bool
result
=
is_valid_pdbx_file
(
file
,
dictionary
,
ec
);
bool
result
=
is_valid_pdbx_file
(
file
,
dictionary
,
ec
);
return
result
and
ec
==
std
::
errc
()
;
return
result
and
not
(
bool
)
ec
;
}
}
bool
is_valid_pdbx_file
(
const
file
&
file
,
std
::
error_code
&
ec
)
bool
is_valid_pdbx_file
(
const
file
&
file
,
std
::
error_code
&
ec
)
...
@@ -326,7 +326,7 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary, std::erro
...
@@ -326,7 +326,7 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary, std::erro
ec
=
make_error_code
(
validation_error
::
not_valid_pdbx
);
ec
=
make_error_code
(
validation_error
::
not_valid_pdbx
);
}
}
if
(
not
result
and
ec
==
std
::
errc
()
)
if
(
not
result
and
(
bool
)
ec
)
ec
=
make_error_code
(
validation_error
::
not_valid_pdbx
);
ec
=
make_error_code
(
validation_error
::
not_valid_pdbx
);
return
result
;
return
result
;
...
...
src/symmetry.cpp
View file @
a4680f7d
...
@@ -111,7 +111,7 @@ sym_op::sym_op(std::string_view s)
...
@@ -111,7 +111,7 @@ sym_op::sym_op(std::string_view s)
m_tb
=
r
.
ptr
[
2
]
-
'0'
;
m_tb
=
r
.
ptr
[
2
]
-
'0'
;
m_tc
=
r
.
ptr
[
3
]
-
'0'
;
m_tc
=
r
.
ptr
[
3
]
-
'0'
;
if
(
r
.
ec
!=
std
::
errc
()
or
rnri
>
192
or
r
.
ptr
[
0
]
!=
'_'
or
m_ta
>
9
or
m_tb
>
9
or
m_tc
>
9
)
if
(
(
bool
)
r
.
ec
or
rnri
>
192
or
r
.
ptr
[
0
]
!=
'_'
or
m_ta
>
9
or
m_tb
>
9
or
m_tc
>
9
)
throw
std
::
invalid_argument
(
"Could not convert string into sym_op"
);
throw
std
::
invalid_argument
(
"Could not convert string into sym_op"
);
}
}
...
@@ -119,7 +119,7 @@ std::string sym_op::string() const
...
@@ -119,7 +119,7 @@ std::string sym_op::string() const
{
{
char
b
[
9
];
char
b
[
9
];
auto
r
=
std
::
to_chars
(
b
,
b
+
sizeof
(
b
),
m_nr
);
auto
r
=
std
::
to_chars
(
b
,
b
+
sizeof
(
b
),
m_nr
);
if
(
r
.
ec
!=
std
::
errc
()
or
r
.
ptr
>
b
+
4
)
if
(
(
bool
)
r
.
ec
or
r
.
ptr
>
b
+
4
)
throw
std
::
runtime_error
(
"Could not write out symmetry operation to string"
);
throw
std
::
runtime_error
(
"Could not write out symmetry operation to string"
);
*
r
.
ptr
++
=
'_'
;
*
r
.
ptr
++
=
'_'
;
...
...
src/symop-map-generator.cpp
View file @
a4680f7d
...
@@ -280,7 +280,7 @@ int main(int argc, char* const argv[])
...
@@ -280,7 +280,7 @@ int main(int argc, char* const argv[])
if
(
std
::
isdigit
(
line
[
0
]))
// start of new spacegroup
if
(
std
::
isdigit
(
line
[
0
]))
// start of new spacegroup
{
{
auto
r
=
std
::
from_chars
(
line
.
data
(),
line
.
data
()
+
line
.
length
(),
sgnr
);
auto
r
=
std
::
from_chars
(
line
.
data
(),
line
.
data
()
+
line
.
length
(),
sgnr
);
if
(
r
.
ec
!=
std
::
errc
()
)
if
(
(
bool
)
r
.
ec
)
throw
std
::
runtime_error
(
"Error parsing symop.lib file"
);
throw
std
::
runtime_error
(
"Error parsing symop.lib file"
);
rnr
=
1
;
rnr
=
1
;
continue
;
continue
;
...
...
src/validate.cpp
View file @
a4680f7d
...
@@ -138,7 +138,7 @@ int type_validator::compare(std::string_view a, std::string_view b) const
...
@@ -138,7 +138,7 @@ int type_validator::compare(std::string_view a, std::string_view b) const
ra
=
selected_charconv
<
double
>::
from_chars
(
a
.
data
(),
a
.
data
()
+
a
.
length
(),
da
);
ra
=
selected_charconv
<
double
>::
from_chars
(
a
.
data
(),
a
.
data
()
+
a
.
length
(),
da
);
rb
=
selected_charconv
<
double
>::
from_chars
(
b
.
data
(),
b
.
data
()
+
b
.
length
(),
db
);
rb
=
selected_charconv
<
double
>::
from_chars
(
b
.
data
(),
b
.
data
()
+
b
.
length
(),
db
);
if
(
ra
.
ec
==
std
::
errc
()
and
rb
.
ec
==
std
::
errc
()
)
if
(
not
(
bool
)
ra
.
ec
and
not
(
bool
)
rb
.
ec
)
{
{
auto
d
=
da
-
db
;
auto
d
=
da
-
db
;
if
(
std
::
abs
(
d
)
>
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
std
::
abs
(
d
)
>
std
::
numeric_limits
<
double
>::
epsilon
())
...
@@ -149,7 +149,7 @@ int type_validator::compare(std::string_view a, std::string_view b) const
...
@@ -149,7 +149,7 @@ int type_validator::compare(std::string_view a, std::string_view b) const
result
=
-
1
;
result
=
-
1
;
}
}
}
}
else
if
(
ra
.
ec
==
std
::
errc
()
)
else
if
(
(
bool
)
ra
.
ec
)
result
=
1
;
result
=
1
;
else
else
result
=
-
1
;
result
=
-
1
;
...
@@ -222,7 +222,7 @@ void item_validator::operator()(std::string_view value) const
...
@@ -222,7 +222,7 @@ void item_validator::operator()(std::string_view value) const
bool
item_validator
::
validate_value
(
std
::
string_view
value
,
std
::
error_code
&
ec
)
const
noexcept
bool
item_validator
::
validate_value
(
std
::
string_view
value
,
std
::
error_code
&
ec
)
const
noexcept
{
{
ec
=
{}
;
ec
.
clear
()
;
if
(
not
value
.
empty
()
and
value
!=
"?"
and
value
!=
"."
)
if
(
not
value
.
empty
()
and
value
!=
"?"
and
value
!=
"."
)
{
{
...
@@ -232,7 +232,7 @@ bool item_validator::validate_value(std::string_view value, std::error_code &ec)
...
@@ -232,7 +232,7 @@ bool item_validator::validate_value(std::string_view value, std::error_code &ec)
ec
=
make_error_code
(
validation_error
::
value_is_not_in_enumeration_list
);
ec
=
make_error_code
(
validation_error
::
value_is_not_in_enumeration_list
);
}
}
return
ec
==
std
::
errc
()
;
return
not
(
bool
)
ec
;
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
...
test/reconstruction-test.cpp
View file @
a4680f7d
...
@@ -54,7 +54,7 @@ TEST_CASE("reconstruct")
...
@@ -54,7 +54,7 @@ TEST_CASE("reconstruct")
std
::
error_code
ec
;
std
::
error_code
ec
;
CHECK_FALSE
(
cif
::
pdb
::
is_valid_pdbx_file
(
f
,
ec
));
CHECK_FALSE
(
cif
::
pdb
::
is_valid_pdbx_file
(
f
,
ec
));
CHECK
(
ec
!=
std
::
errc
{}
);
CHECK
(
(
bool
)
ec
);
CHECK
(
cif
::
pdb
::
reconstruct_pdbx
(
f
));
CHECK
(
cif
::
pdb
::
reconstruct_pdbx
(
f
));
}
}
...
...
test/unit-v2-test.cpp
View file @
a4680f7d
...
@@ -101,7 +101,7 @@ TEST_CASE("cc_1")
...
@@ -101,7 +101,7 @@ TEST_CASE("cc_1")
float
tv
;
float
tv
;
const
auto
&
[
ptr
,
ec
]
=
cif
::
from_chars
(
txt
.
data
(),
txt
.
data
()
+
txt
.
length
(),
tv
);
const
auto
&
[
ptr
,
ec
]
=
cif
::
from_chars
(
txt
.
data
(),
txt
.
data
()
+
txt
.
length
(),
tv
);
REQUIRE
(
ec
==
std
::
errc
()
);
CHECK_FALSE
((
bool
)
ec
);
REQUIRE
(
tv
==
val
);
REQUIRE
(
tv
==
val
);
if
(
ch
!=
0
)
if
(
ch
!=
0
)
REQUIRE
(
*
ptr
==
ch
);
REQUIRE
(
*
ptr
==
ch
);
...
@@ -119,7 +119,7 @@ TEST_CASE("cc_2")
...
@@ -119,7 +119,7 @@ TEST_CASE("cc_2")
char
buffer
[
64
];
char
buffer
[
64
];
const
auto
&
[
ptr
,
ec
]
=
cif
::
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
),
val
,
cif
::
chars_format
::
fixed
,
prec
);
const
auto
&
[
ptr
,
ec
]
=
cif
::
to_chars
(
buffer
,
buffer
+
sizeof
(
buffer
),
val
,
cif
::
chars_format
::
fixed
,
prec
);
REQUIRE
(
ec
==
std
::
errc
()
);
CHECK_FALSE
((
bool
)
ec
);
REQUIRE
(
buffer
==
test
);
REQUIRE
(
buffer
==
test
);
}
}
...
...
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