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
627d3b9d
Commit
627d3b9d
authored
Jan 25, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export by default, fixes for MSVC
parent
ba28ade4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
181 additions
and
184 deletions
+181
-184
CMakeLists.txt
+2
-2
include/cif++/atom_type.hpp
+3
-3
include/cif++/category.hpp
+2
-2
include/cif++/compound.hpp
+5
-5
include/cif++/condition.hpp
+19
-19
include/cif++/datablock.hpp
+1
-1
include/cif++/dictionary_parser.hpp
+1
-1
include/cif++/file.hpp
+1
-1
include/cif++/format.hpp
+5
-5
include/cif++/forward_decl.hpp
+9
-8
include/cif++/item.hpp
+4
-4
include/cif++/model.hpp
+8
-8
include/cif++/parser.hpp
+4
-4
include/cif++/pdb/tls.hpp
+0
-4
include/cif++/point.hpp
+10
-10
include/cif++/row.hpp
+3
-3
include/cif++/symmetry.hpp
+7
-7
include/cif++/text.hpp
+21
-21
include/cif++/utilities.hpp
+7
-7
include/cif++/validate.hpp
+8
-8
src/atom_type.cpp
+0
-0
src/category.cpp
+3
-3
src/model.cpp
+3
-3
src/point.cpp
+1
-1
src/utilities.cpp
+3
-3
test/unit-3d-test.cpp
+25
-25
test/unit-v2-test.cpp
+26
-26
No files found.
CMakeLists.txt
View file @
627d3b9d
...
...
@@ -40,8 +40,8 @@ include(GenerateExportHeader)
set
(
CXX_EXTENSIONS OFF
)
set
(
CMAKE_CXX_STANDARD 20
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_VISIBILITY_PRESET hidden
)
set
(
CMAKE_VISIBILITY_INLINES_HIDDEN 1
)
#
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
#
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers"
)
...
...
include/cif++/atom_type.hpp
View file @
627d3b9d
...
...
@@ -194,7 +194,7 @@ enum class ionic_radius_type
effective
,
crystal
};
struct
CIFPP_EXPORT
atom_type_info
struct
atom_type_info
{
atom_type
type
;
std
::
string
name
;
...
...
@@ -204,12 +204,12 @@ struct CIFPP_EXPORT atom_type_info
float
radii
[
kRadiusTypeCount
];
};
CIFPP_EXPORT
extern
const
atom_type_info
kKnownAtoms
[];
extern
CIFPP_EXPORT
const
atom_type_info
kKnownAtoms
[];
// --------------------------------------------------------------------
// AtomTypeTraits
class
CIFPP_EXPORT
atom_type_traits
class
atom_type_traits
{
public
:
atom_type_traits
(
atom_type
a
);
...
...
include/cif++/category.hpp
View file @
627d3b9d
...
...
@@ -45,7 +45,7 @@ namespace cif
// --------------------------------------------------------------------
// special exception
class
CIFPP_EXPORT
duplicate_key_error
:
public
std
::
runtime_error
class
duplicate_key_error
:
public
std
::
runtime_error
{
public
:
duplicate_key_error
(
const
std
::
string
&
msg
)
...
...
@@ -54,7 +54,7 @@ class CIFPP_EXPORT duplicate_key_error : public std::runtime_error
// --------------------------------------------------------------------
class
CIFPP_EXPORT
category
class
category
{
public
:
friend
class
row_handle
;
...
...
include/cif++/compound.hpp
View file @
627d3b9d
...
...
@@ -67,7 +67,7 @@ bond_type from_string(const std::string &bondType);
/// \brief struct containing information about an atom in a chemical compound.
/// This is a subset of the available information. Contact the author if you need more fields.
struct
CIFPP_EXPORT
compound_atom
struct
compound_atom
{
std
::
string
id
;
atom_type
type_symbol
;
...
...
@@ -86,7 +86,7 @@ struct CIFPP_EXPORT compound_atom
/// --------------------------------------------------------------------
/// \brief struct containing information about the bonds
struct
CIFPP_EXPORT
compound_bond
struct
compound_bond
{
std
::
string
atom_id
[
2
];
bond_type
type
;
...
...
@@ -101,7 +101,7 @@ struct CIFPP_EXPORT compound_bond
/// compound definitions by calling the addExtraComponents function and
/// pass it a valid CCD formatted file.
class
CIFPP_EXPORT
compound
class
compound
{
public
:
// accessors
...
...
@@ -149,7 +149,7 @@ class CIFPP_EXPORT compound
// --------------------------------------------------------------------
// Factory class for compound and Link objects
class
CIFPP_EXPORT
compound_factory
class
compound_factory
{
public
:
/// \brief Initialise a singleton instance.
...
...
@@ -180,7 +180,7 @@ class CIFPP_EXPORT compound_factory
~
compound_factory
();
static
const
std
::
map
<
std
::
string
,
char
>
kAAMap
,
kBaseMap
;
static
CIFPP_EXPORT
const
std
::
map
<
std
::
string
,
char
>
kAAMap
,
kBaseMap
;
private
:
compound_factory
();
...
...
include/cif++/condition.hpp
View file @
627d3b9d
...
...
@@ -40,16 +40,16 @@ namespace cif
// --------------------------------------------------------------------
// let's make life easier
CIFPP_EXPORT
iset
get_category_fields
(
const
category
&
cat
);
CIFPP_EXPORT
uint16_t
get_column_ix
(
const
category
&
cat
,
std
::
string_view
col
);
CIFPP_EXPORT
bool
is_column_type_uchar
(
const
category
&
cat
,
std
::
string_view
col
);
iset
get_category_fields
(
const
category
&
cat
);
uint16_t
get_column_ix
(
const
category
&
cat
,
std
::
string_view
col
);
bool
is_column_type_uchar
(
const
category
&
cat
,
std
::
string_view
col
);
// --------------------------------------------------------------------
// some more templates to be able to do querying
namespace
detail
{
struct
CIFPP_EXPORT
condition_impl
struct
condition_impl
{
virtual
~
condition_impl
()
{}
...
...
@@ -61,7 +61,7 @@ namespace detail
virtual
bool
equals
(
const
condition_impl
*
rhs
)
const
{
return
false
;
}
};
struct
CIFPP_EXPORT
all_condition_impl
:
public
condition_impl
struct
all_condition_impl
:
public
condition_impl
{
bool
test
(
row_handle
)
const
override
{
return
true
;
}
void
str
(
std
::
ostream
&
os
)
const
override
{
os
<<
"*"
;
}
...
...
@@ -72,7 +72,7 @@ namespace detail
struct
not_condition_impl
;
}
// namespace detail
class
CIFPP_EXPORT
condition
class
condition
{
public
:
using
condition_impl
=
detail
::
condition_impl
;
...
...
@@ -155,7 +155,7 @@ class CIFPP_EXPORT condition
namespace
detail
{
struct
CIFPP_EXPORT
key_is_empty_condition_impl
:
public
condition_impl
struct
key_is_empty_condition_impl
:
public
condition_impl
{
key_is_empty_condition_impl
(
const
std
::
string
&
item_tag
)
:
m_item_tag
(
item_tag
)
...
...
@@ -182,7 +182,7 @@ namespace detail
uint16_t
m_item_ix
=
0
;
};
struct
CIFPP_EXPORT
key_equals_condition_impl
:
public
condition_impl
struct
key_equals_condition_impl
:
public
condition_impl
{
key_equals_condition_impl
(
item
&&
i
)
:
m_item_tag
(
i
.
name
())
...
...
@@ -228,7 +228,7 @@ namespace detail
std
::
optional
<
row_handle
>
m_single_hit
;
};
struct
CIFPP_EXPORT
key_equals_or_empty_condition_impl
:
public
condition_impl
struct
key_equals_or_empty_condition_impl
:
public
condition_impl
{
key_equals_or_empty_condition_impl
(
key_equals_condition_impl
*
equals
)
:
m_item_tag
(
equals
->
m_item_tag
)
...
...
@@ -286,7 +286,7 @@ namespace detail
std
::
optional
<
row_handle
>
m_single_hit
;
};
struct
CIFPP_EXPORT
key_compare_condition_impl
:
public
condition_impl
struct
key_compare_condition_impl
:
public
condition_impl
{
template
<
typename
COMP
>
key_compare_condition_impl
(
const
std
::
string
&
item_tag
,
COMP
&&
comp
,
const
std
::
string
&
s
)
...
...
@@ -320,7 +320,7 @@ namespace detail
std
::
string
m_str
;
};
struct
CIFPP_EXPORT
key_matches_condition_impl
:
public
condition_impl
struct
key_matches_condition_impl
:
public
condition_impl
{
key_matches_condition_impl
(
const
std
::
string
&
item_tag
,
const
std
::
regex
&
rx
)
:
m_item_tag
(
item_tag
)
...
...
@@ -352,7 +352,7 @@ namespace detail
};
template
<
typename
T
>
struct
CIFPP_EXPORT
any_is_condition_impl
:
public
condition_impl
struct
any_is_condition_impl
:
public
condition_impl
{
typedef
T
valueType
;
...
...
@@ -392,7 +392,7 @@ namespace detail
valueType
mValue
;
};
struct
CIFPP_EXPORT
any_matches_condition_impl
:
public
condition_impl
struct
any_matches_condition_impl
:
public
condition_impl
{
any_matches_condition_impl
(
const
std
::
regex
&
rx
)
:
mRx
(
rx
)
...
...
@@ -434,7 +434,7 @@ namespace detail
// TODO: Optimize and_condition by having a list of sub items.
// That way you can also collapse multiple _is_ conditions in
// case they make up an indexed tuple.
struct
CIFPP_EXPORT
and_condition_impl
:
public
condition_impl
struct
and_condition_impl
:
public
condition_impl
{
and_condition_impl
()
=
default
;
...
...
@@ -537,7 +537,7 @@ namespace detail
std
::
vector
<
condition_impl
*>
m_sub
;
};
struct
CIFPP_EXPORT
or_condition_impl
:
public
condition_impl
struct
or_condition_impl
:
public
condition_impl
{
or_condition_impl
(
condition
&&
a
,
condition
&&
b
)
{
...
...
@@ -628,7 +628,7 @@ namespace detail
std
::
vector
<
condition_impl
*>
m_sub
;
};
struct
CIFPP_EXPORT
not_condition_impl
:
public
condition_impl
struct
not_condition_impl
:
public
condition_impl
{
not_condition_impl
(
condition
&&
a
)
:
mA
(
nullptr
)
...
...
@@ -705,7 +705,7 @@ inline condition operator or(condition &&a, condition &&b)
return
condition
(
std
::
move
(
b
));
}
struct
CIFPP_EXPORT
empty_type
struct
empty_type
{
};
...
...
@@ -713,7 +713,7 @@ struct CIFPP_EXPORT empty_type
inline
constexpr
empty_type
null
=
empty_type
();
struct
CIFPP_EXPORT
key
struct
key
{
explicit
key
(
const
std
::
string
&
itemTag
)
:
m_item_tag
(
itemTag
)
...
...
@@ -829,7 +829,7 @@ inline condition operator not(condition &&rhs)
return
condition
(
new
detail
::
not_condition_impl
(
std
::
move
(
rhs
)));
}
struct
CIFPP_EXPORT
any_type
struct
any_type
{
};
...
...
include/cif++/datablock.hpp
View file @
627d3b9d
...
...
@@ -34,7 +34,7 @@ namespace cif
// --------------------------------------------------------------------
class
CIFPP_EXPORT
datablock
:
public
std
::
list
<
category
>
class
datablock
:
public
std
::
list
<
category
>
{
public
:
datablock
()
=
default
;
...
...
include/cif++/dictionary_parser.hpp
View file @
627d3b9d
...
...
@@ -31,6 +31,6 @@
namespace
cif
{
CIFPP_EXPORT
validator
parse_dictionary
(
std
::
string_view
name
,
std
::
istream
&
is
);
validator
parse_dictionary
(
std
::
string_view
name
,
std
::
istream
&
is
);
}
// namespace cif
include/cif++/file.hpp
View file @
627d3b9d
...
...
@@ -37,7 +37,7 @@ namespace cif
// --------------------------------------------------------------------
class
CIFPP_EXPORT
file
:
public
std
::
list
<
datablock
>
class
file
:
public
std
::
list
<
datablock
>
{
public
:
file
()
=
default
;
...
...
include/cif++/format.hpp
View file @
627d3b9d
...
...
@@ -39,7 +39,7 @@ namespace cif
namespace
detail
{
template
<
typename
T
>
struct
CIFPP_EXPORT
to_varg
struct
to_varg
{
using
type
=
T
;
...
...
@@ -54,7 +54,7 @@ namespace detail
};
template
<>
struct
CIFPP_EXPORT
to_varg
<
const
char
*>
struct
to_varg
<
const
char
*>
{
using
type
=
const
char
*
;
...
...
@@ -69,7 +69,7 @@ namespace detail
};
template
<>
struct
CIFPP_EXPORT
to_varg
<
std
::
string
>
struct
to_varg
<
std
::
string
>
{
using
type
=
const
char
*
;
...
...
@@ -86,7 +86,7 @@ namespace detail
}
// namespace
template
<
typename
...
Args
>
class
CIFPP_EXPORT
format_plus_arg
class
format_plus_arg
{
public
:
using
args_vector_type
=
std
::
tuple
<
detail
::
to_varg
<
Args
>
...
>
;
...
...
@@ -141,7 +141,7 @@ constexpr auto format(std::string_view fmt, Args... args)
// --------------------------------------------------------------------
/// A streambuf that fills out lines with spaces up until a specified width
class
CIFPP_EXPORT
fill_out_streambuf
:
public
std
::
streambuf
class
fill_out_streambuf
:
public
std
::
streambuf
{
public
:
using
base_type
=
std
::
streambuf
;
...
...
include/cif++/forward_decl.hpp
View file @
627d3b9d
...
...
@@ -34,15 +34,15 @@
namespace
cif
{
class
CIFPP_EXPORT
category
;
class
CIFPP_EXPORT
datablock
;
class
CIFPP_EXPORT
file
;
class
CIFPP_EXPORT
parser
;
class
category
;
class
datablock
;
class
file
;
class
parser
;
class
CIFPP_EXPORT
row
;
class
CIFPP_EXPORT
row_handle
;
class
row
;
class
row_handle
;
class
CIFPP_EXPORT
item
;
struct
CIFPP_EXPORT
item_handle
;
class
item
;
struct
item_handle
;
}
//
namespace
cif
\ No newline at end of file
include/cif++/item.hpp
View file @
627d3b9d
...
...
@@ -51,7 +51,7 @@ namespace cif
// --------------------------------------------------------------------
/// \brief item is a transient class that is used to pass data into rows
/// but it also takes care of formatting data.
class
CIFPP_EXPORT
item
class
item
{
public
:
/// \brief Default constructor, empty item
...
...
@@ -188,7 +188,7 @@ class CIFPP_EXPORT item
/// Typically, more than 99% of the strings in an mmCIF file are less
/// than 8 bytes in length.
struct
CIFPP_EXPORT
item_value
struct
item_value
{
item_value
()
=
default
;
...
...
@@ -265,7 +265,7 @@ struct CIFPP_EXPORT item_value
/// \brief This is item_handle, it is used to access the data stored in item_value.
struct
CIFPP_EXPORT
item_handle
struct
item_handle
{
public
:
// conversion helper class
...
...
@@ -354,7 +354,7 @@ struct CIFPP_EXPORT item_handle
{
}
CIFPP_EXPORT
static
const
item_handle
s_null_item
;
static
CIFPP_EXPORT
const
item_handle
s_null_item
;
friend
void
swap
(
item_handle
a
,
item_handle
b
)
{
...
...
include/cif++/model.hpp
View file @
627d3b9d
...
...
@@ -45,7 +45,7 @@ class structure;
// --------------------------------------------------------------------
class
CIFPP_EXPORT
atom
class
atom
{
private
:
struct
atom_impl
:
public
std
::
enable_shared_from_this
<
atom_impl
>
...
...
@@ -388,7 +388,7 @@ enum class EntityType
// --------------------------------------------------------------------
class
CIFPP_EXPORT
residue
class
residue
{
public
:
friend
class
structure
;
...
...
@@ -499,7 +499,7 @@ class CIFPP_EXPORT residue
// --------------------------------------------------------------------
// a monomer models a single residue in a protein chain
class
CIFPP_EXPORT
monomer
:
public
residue
class
monomer
:
public
residue
{
public
:
// monomer();
...
...
@@ -570,7 +570,7 @@ class CIFPP_EXPORT monomer : public residue
// --------------------------------------------------------------------
class
CIFPP_EXPORT
polymer
:
public
std
::
vector
<
monomer
>
class
polymer
:
public
std
::
vector
<
monomer
>
{
public
:
polymer
(
structure
&
s
,
const
std
::
string
&
entityID
,
const
std
::
string
&
asymID
,
const
std
::
string
&
auth_asym_id
);
...
...
@@ -599,9 +599,9 @@ class CIFPP_EXPORT polymer : public std::vector<monomer>
// --------------------------------------------------------------------
// sugar and branch, to describe glycosylation sites
class
CIFPP_EXPORT
branch
;
class
branch
;
class
CIFPP_EXPORT
sugar
:
public
residue
class
sugar
:
public
residue
{
public
:
sugar
(
branch
&
branch
,
const
std
::
string
&
compoundID
,
...
...
@@ -638,7 +638,7 @@ class CIFPP_EXPORT sugar : public residue
atom
m_link
;
};
class
CIFPP_EXPORT
branch
:
public
std
::
vector
<
sugar
>
class
branch
:
public
std
::
vector
<
sugar
>
{
public
:
branch
(
structure
&
structure
,
const
std
::
string
&
asym_id
,
const
std
::
string
&
entity_id
);
...
...
@@ -724,7 +724,7 @@ inline bool operator&(StructureOpenOptions a, StructureOpenOptions b)
// --------------------------------------------------------------------
class
CIFPP_EXPORT
structure
class
structure
{
public
:
structure
(
file
&
p
,
size_t
modelNr
=
1
,
StructureOpenOptions
options
=
{});
...
...
include/cif++/parser.hpp
View file @
627d3b9d
...
...
@@ -36,7 +36,7 @@ namespace cif
// --------------------------------------------------------------------
class
CIFPP_EXPORT
parse_error
:
public
std
::
runtime_error
class
parse_error
:
public
std
::
runtime_error
{
public
:
parse_error
(
uint32_t
line_nr
,
const
std
::
string
&
message
)
...
...
@@ -49,7 +49,7 @@ class CIFPP_EXPORT parse_error : public std::runtime_error
// TODO: Need to implement support for transformed long lines
class
CIFPP_EXPORT
sac_parser
class
sac_parser
{
public
:
using
datablock_index
=
std
::
map
<
std
::
string
,
std
::
size_t
>
;
...
...
@@ -94,7 +94,7 @@ class CIFPP_EXPORT sac_parser
static
bool
is_unquoted_string
(
std
::
string_view
text
)
{
bool
result
=
is_ordinary
(
text
.
front
());
bool
result
=
text
.
empty
()
or
is_ordinary
(
text
.
front
());
if
(
result
)
{
...
...
@@ -267,7 +267,7 @@ class CIFPP_EXPORT sac_parser
// --------------------------------------------------------------------
class
CIFPP_EXPORT
parser
:
public
sac_parser
class
parser
:
public
sac_parser
{
public
:
parser
(
std
::
istream
&
is
,
file
&
file
)
...
...
include/cif++/pdb/tls.hpp
View file @
627d3b9d
...
...
@@ -35,10 +35,6 @@
namespace
cif
{
extern
const
int
kResidueNrWildcard
,
kNoSeqNum
;
struct
tls_selection
;
struct
tls_residue
;
...
...
include/cif++/point.hpp
View file @
627d3b9d
...
...
@@ -51,7 +51,7 @@ const double
// We use quaternions to do rotations in 3d space
template
<
typename
T
>
class
CIFPP_EXPORT
quaternion_type
class
quaternion_type
{
public
:
using
value_type
=
T
;
...
...
@@ -355,7 +355,7 @@ using quaternion = quaternion_type<float>;
// tie(x, y, z) = atom.loc();
template
<
typename
F
>
struct
CIFPP_EXPORT
point_type
struct
point_type
{
using
value_type
=
F
;
...
...
@@ -682,21 +682,21 @@ constexpr auto distance_point_to_line(const point_type<F> &l1, const point_type<
// a random direction with a distance randomly chosen from a normal
// distribution with a stddev of offset.
CIFPP_EXPORT
point
nudge
(
point
p
,
float
offset
);
point
nudge
(
point
p
,
float
offset
);
// --------------------------------------------------------------------
CIFPP_EXPORT
quaternion
construct_from_angle_axis
(
float
angle
,
point
axis
);
CIFPP_EXPORT
std
::
tuple
<
double
,
point
>
quaternion_to_angle_axis
(
quaternion
q
);
quaternion
construct_from_angle_axis
(
float
angle
,
point
axis
);
std
::
tuple
<
double
,
point
>
quaternion_to_angle_axis
(
quaternion
q
);
/// @brief Given four points and an angle, return the quaternion required to rotate
/// point p4 along the p2-p3 axis and around point p3 to obtain the required within
/// an accuracy of esd
CIFPP_EXPORT
quaternion
construct_for_dihedral_angle
(
point
p1
,
point
p2
,
point
p3
,
point
p4
,
quaternion
construct_for_dihedral_angle
(
point
p1
,
point
p2
,
point
p3
,
point
p4
,
float
angle
,
float
esd
);
CIFPP_EXPORT
point
centroid
(
const
std
::
vector
<
point
>
&
Points
);
CIFPP_EXPORT
point
center_points
(
std
::
vector
<
point
>
&
Points
);
point
centroid
(
const
std
::
vector
<
point
>
&
Points
);
point
center_points
(
std
::
vector
<
point
>
&
Points
);
/// \brief Returns how the two sets of points \a a and \b b can be aligned
///
...
...
@@ -704,10 +704,10 @@ CIFPP_EXPORT point center_points(std::vector<point> &Points);
/// \param b The second set of points
/// \result The quaternion which should be applied to the points in \a a to
/// obtain the best superposition.
CIFPP_EXPORT
quaternion
align_points
(
const
std
::
vector
<
point
>
&
a
,
const
std
::
vector
<
point
>
&
b
);
quaternion
align_points
(
const
std
::
vector
<
point
>
&
a
,
const
std
::
vector
<
point
>
&
b
);
/// \brief The RMSd for the points in \a a and \a b
CIFPP_EXPORT
double
RMSd
(
const
std
::
vector
<
point
>
&
a
,
const
std
::
vector
<
point
>
&
b
);
double
RMSd
(
const
std
::
vector
<
point
>
&
a
,
const
std
::
vector
<
point
>
&
b
);
// --------------------------------------------------------------------
// Helper class to generate evenly divided points on a sphere
...
...
include/cif++/row.hpp
View file @
627d3b9d
...
...
@@ -103,7 +103,7 @@ auto tie(Ts &...v)
// --------------------------------------------------------------------
/// \brief the row class, this one is not directly accessible from the outside
class
CIFPP_EXPORT
row
:
public
std
::
vector
<
item_value
>
class
row
:
public
std
::
vector
<
item_value
>
{
public
:
row
()
=
default
;
...
...
@@ -145,7 +145,7 @@ class CIFPP_EXPORT row : public std::vector<item_value>
// --------------------------------------------------------------------
/// \brief row_handle is the way to access data stored in rows
class
CIFPP_EXPORT
row_handle
class
row_handle
{
public
:
friend
struct
item_handle
;
...
...
@@ -265,7 +265,7 @@ class CIFPP_EXPORT row_handle
// --------------------------------------------------------------------
class
CIFPP_EXPORT
row_initializer
:
public
std
::
vector
<
item
>
class
row_initializer
:
public
std
::
vector
<
item
>
{
public
:
friend
class
category
;
...
...
include/cif++/symmetry.hpp
View file @
627d3b9d
...
...
@@ -44,7 +44,7 @@ enum class space_group_name
Hall
};
struct
CIFPP_EXPORT
space_group
struct
space_group
{
const
char
*
name
;
const
char
*
xHM
;
...
...
@@ -57,7 +57,7 @@ extern CIFPP_EXPORT const std::size_t kNrOfSpaceGroups;
// --------------------------------------------------------------------
struct
CIFPP_EXPORT
symop_data
struct
symop_data
{
constexpr
symop_data
(
const
std
::
array
<
int
,
15
>
&
data
)
:
m_packed
((
data
[
0
]
&
0x03ULL
)
<<
34
bitor
...
...
@@ -122,7 +122,7 @@ struct CIFPP_EXPORT symop_data
uint64_t
m_packed
;
};
struct
CIFPP_EXPORT
symop_datablock
struct
symop_datablock
{
constexpr
symop_datablock
(
int
spacegroup
,
int
rotational_number
,
const
std
::
array
<
int
,
15
>
&
rt_data
)
:
m_v
((
spacegroup
&
0xffffULL
)
<<
48
bitor
...
...
@@ -141,12 +141,12 @@ struct CIFPP_EXPORT symop_datablock
static_assert
(
sizeof
(
symop_datablock
)
==
sizeof
(
uint64_t
),
"Size of symop_data is wrong"
);
CIFPP_EXPORT
extern
const
symop_datablock
kSymopNrTable
[];
CIFPP_EXPORT
extern
const
std
::
size_t
kSymopNrTableSize
;
extern
CIFPP_EXPORT
const
symop_datablock
kSymopNrTable
[];
extern
CIFPP_EXPORT
const
std
::
size_t
kSymopNrTableSize
;
// --------------------------------------------------------------------
CIFPP_EXPORT
int
get_space_group_number
(
std
::
string
spacegroup
);
// alternative for clipper's parsing code, using space_group_name::full
CIFPP_EXPORT
int
get_space_group_number
(
std
::
string
spacegroup
,
space_group_name
type
);
// alternative for clipper's parsing code
int
get_space_group_number
(
std
::
string
spacegroup
);
// alternative for clipper's parsing code, using space_group_name::full
int
get_space_group_number
(
std
::
string
spacegroup
,
space_group_name
type
);
// alternative for clipper's parsing code
}
// namespace cif
include/cif++/text.hpp
View file @
627d3b9d
...
...
@@ -109,16 +109,16 @@ namespace cif
// some basic utilities: Since we're using ASCII input only, we define for optimisation
// our own case conversion routines.
CIFPP_EXPORT
bool
iequals
(
std
::
string_view
a
,
std
::
string_view
b
);
CIFPP_EXPORT
int
icompare
(
std
::
string_view
a
,
std
::
string_view
b
);
bool
iequals
(
std
::
string_view
a
,
std
::
string_view
b
);
int
icompare
(
std
::
string_view
a
,
std
::
string_view
b
);
CIFPP_EXPORT
bool
iequals
(
const
char
*
a
,
const
char
*
b
);
CIFPP_EXPORT
int
icompare
(
const
char
*
a
,
const
char
*
b
);
bool
iequals
(
const
char
*
a
,
const
char
*
b
);
int
icompare
(
const
char
*
a
,
const
char
*
b
);
CIFPP_EXPORT
void
to_lower
(
std
::
string
&
s
);
CIFPP_EXPORT
std
::
string
to_lower_copy
(
std
::
string_view
s
);
void
to_lower
(
std
::
string
&
s
);
std
::
string
to_lower_copy
(
std
::
string_view
s
);
CIFPP_EXPORT
void
to_upper
(
std
::
string
&
s
);
void
to_upper
(
std
::
string
&
s
);
// std::string toUpperCopy(const std::string &s);
template
<
typename
IterType
>
...
...
@@ -181,7 +181,7 @@ std::vector<StringType> split(std::string_view s, std::string_view separators, b
return
result
;
}
CIFPP_EXPORT
void
replace_all
(
std
::
string
&
s
,
std
::
string_view
what
,
std
::
string_view
with
=
{});
void
replace_all
(
std
::
string
&
s
,
std
::
string_view
what
,
std
::
string_view
with
=
{});
#if defined(__cpp_lib_starts_ends_with)
...
...
@@ -225,15 +225,15 @@ inline bool contains(std::string_view s, std::string_view q)
#endif
CIFPP_EXPORT
bool
icontains
(
std
::
string_view
s
,
std
::
string_view
q
);
bool
icontains
(
std
::
string_view
s
,
std
::
string_view
q
);
CIFPP_EXPORT
void
trim_left
(
std
::
string
&
s
);
CIFPP_EXPORT
void
trim_right
(
std
::
string
&
s
);
CIFPP_EXPORT
void
trim
(
std
::
string
&
s
);
void
trim_left
(
std
::
string
&
s
);
void
trim_right
(
std
::
string
&
s
);
void
trim
(
std
::
string
&
s
);
CIFPP_EXPORT
std
::
string
trim_left_copy
(
std
::
string_view
s
);
CIFPP_EXPORT
std
::
string
trim_right_copy
(
std
::
string_view
s
);
CIFPP_EXPORT
std
::
string
trim_copy
(
std
::
string_view
s
);
std
::
string
trim_left_copy
(
std
::
string_view
s
);
std
::
string
trim_right_copy
(
std
::
string_view
s
);
std
::
string
trim_copy
(
std
::
string_view
s
);
// To make life easier, we also define iless and iset using iequals
...
...
@@ -250,7 +250,7 @@ typedef std::set<std::string, iless> iset;
// --------------------------------------------------------------------
// This really makes a difference, having our own tolower routines
extern
const
uint8_t
kCharToLowerMap
[
256
];
extern
CIFPP_EXPORT
const
uint8_t
kCharToLowerMap
[
256
];
inline
char
tolower
(
int
ch
)
{
...
...
@@ -259,17 +259,17 @@ inline char tolower(int ch)
// --------------------------------------------------------------------
CIFPP_EXPORT
std
::
tuple
<
std
::
string
,
std
::
string
>
split_tag_name
(
std
::
string_view
tag
);
std
::
tuple
<
std
::
string
,
std
::
string
>
split_tag_name
(
std
::
string_view
tag
);
// --------------------------------------------------------------------
// generate a cif name, mainly used to generate asym_id's
CIFPP_EXPORT
std
::
string
cif_id_for_number
(
int
number
);
std
::
string
cif_id_for_number
(
int
number
);
// --------------------------------------------------------------------
// custom wordwrapping routine
CIFPP_EXPORT
std
::
vector
<
std
::
string
>
word_wrap
(
const
std
::
string
&
text
,
size_t
width
);
std
::
vector
<
std
::
string
>
word_wrap
(
const
std
::
string
&
text
,
size_t
width
);
// --------------------------------------------------------------------
/// std::from_chars for floating point types.
...
...
@@ -449,8 +449,8 @@ std::to_chars_result to_chars(char *first, char *last, FloatType &value, chars_f
template
<
typename
FloatType
,
std
::
enable_if_t
<
std
::
is_floating_point_v
<
FloatType
>
,
int
>
=
0
>
std
::
to_chars_result
to_chars
(
char
*
first
,
char
*
last
,
FloatType
&
value
,
chars_format
fmt
,
int
precision
)
{
int
size
=
last
-
first
;
int
r
;
int
size
=
static_cast
<
int
>
(
last
-
first
)
;
int
r
=
0
;
switch
(
fmt
)
{
...
...
include/cif++/utilities.hpp
View file @
627d3b9d
...
...
@@ -55,18 +55,18 @@ namespace cif
extern
CIFPP_EXPORT
int
VERBOSE
;
// the git 'build' number
CIFPP_EXPORT
std
::
string
get_version_nr
();
std
::
string
get_version_nr
();
// std::string get_version_date();
// --------------------------------------------------------------------
// Code helping with terminal i/o
CIFPP_EXPORT
uint32_t
get_terminal_width
();
uint32_t
get_terminal_width
();
// --------------------------------------------------------------------
// Path of the current executable
CIFPP_EXPORT
std
::
string
get_executable_path
();
std
::
string
get_executable_path
();
// --------------------------------------------------------------------
// some manipulators to write coloured text to terminals
...
...
@@ -157,7 +157,7 @@ inline auto coloured(std::basic_string<CharT, Traits, Alloc> &s, StringColour fo
// --------------------------------------------------------------------
// A progress bar
class
CIFPP_EXPORT
Progress
class
Progress
{
public
:
Progress
(
int64_t
inMax
,
const
std
::
string
&
inAction
);
...
...
@@ -178,8 +178,8 @@ class CIFPP_EXPORT Progress
// --------------------------------------------------------------------
// Resources
CIFPP_EXPORT
std
::
unique_ptr
<
std
::
istream
>
load_resource
(
std
::
filesystem
::
path
name
);
CIFPP_EXPORT
void
add_file_resource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
);
CIFPP_EXPORT
void
add_data_directory
(
std
::
filesystem
::
path
dataDir
);
std
::
unique_ptr
<
std
::
istream
>
load_resource
(
std
::
filesystem
::
path
name
);
void
add_file_resource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
);
void
add_data_directory
(
std
::
filesystem
::
path
dataDir
);
}
// namespace cif
include/cif++/validate.hpp
View file @
627d3b9d
...
...
@@ -40,7 +40,7 @@ struct category_validator;
// --------------------------------------------------------------------
class
CIFPP_EXPORT
validation_error
:
public
std
::
exception
class
validation_error
:
public
std
::
exception
{
public
:
validation_error
(
const
std
::
string
&
msg
);
...
...
@@ -59,11 +59,11 @@ enum class DDL_PrimitiveType
Numb
};
CIFPP_EXPORT
DDL_PrimitiveType
map_to_primitive_type
(
std
::
string_view
s
);
DDL_PrimitiveType
map_to_primitive_type
(
std
::
string_view
s
);
struct
regex_impl
;
struct
CIFPP_EXPORT
type_validator
struct
type_validator
{
std
::
string
m_name
;
DDL_PrimitiveType
m_primitive_type
;
...
...
@@ -100,7 +100,7 @@ struct CIFPP_EXPORT type_validator
int
compare
(
std
::
string_view
a
,
std
::
string_view
b
)
const
;
};
struct
CIFPP_EXPORT
item_validator
struct
item_validator
{
std
::
string
m_tag
;
bool
m_mandatory
;
...
...
@@ -133,7 +133,7 @@ struct CIFPP_EXPORT item_validator
void
operator
()(
std
::
string_view
value
)
const
;
};
struct
CIFPP_EXPORT
category_validator
struct
category_validator
{
std
::
string
m_name
;
std
::
vector
<
std
::
string
>
m_keys
;
...
...
@@ -156,7 +156,7 @@ struct CIFPP_EXPORT category_validator
}
};
struct
CIFPP_EXPORT
link_validator
struct
link_validator
{
int
m_link_group_id
;
std
::
string
m_parent_category
;
...
...
@@ -168,7 +168,7 @@ struct CIFPP_EXPORT link_validator
// --------------------------------------------------------------------
class
CIFPP_EXPORT
validator
class
validator
{
public
:
validator
(
std
::
string_view
name
)
...
...
@@ -217,7 +217,7 @@ class CIFPP_EXPORT validator
};
// --------------------------------------------------------------------
class
CIFPP_EXPORT
validator_factory
class
validator_factory
{
public
:
static
validator_factory
&
instance
()
...
...
src/atom_type.cpp
View file @
627d3b9d
This diff is collapsed.
Click to expand it.
src/category.cpp
View file @
627d3b9d
...
...
@@ -1241,10 +1241,10 @@ size_t category::erase(condition &&cond, std::function<void(row_handle)> &&visit
for
(
auto
&&
[
childCat
,
link
]
:
m_child_links
)
{
auto
cond
=
get_children_condition
(
*
ri
,
*
childCat
);
if
(
not
cond
)
auto
c
c
ond
=
get_children_condition
(
*
ri
,
*
childCat
);
if
(
not
c
c
ond
)
continue
;
potential_orphans
[
childCat
]
=
std
::
move
(
potential_orphans
[
childCat
])
or
std
::
move
(
cond
);
potential_orphans
[
childCat
]
=
std
::
move
(
potential_orphans
[
childCat
])
or
std
::
move
(
c
c
ond
);
}
save_value
sv
(
m_validator
);
...
...
src/model.cpp
View file @
627d3b9d
...
...
@@ -1153,7 +1153,7 @@ branch::branch(structure &structure, const std::string &asym_id, const std::stri
auto
&
branch_scheme
=
db
[
"pdbx_branch_scheme"
];
auto
&
branch_link
=
db
[
"pdbx_entity_branch_link"
];
for
(
const
auto
&
entity_id
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
for
(
const
auto
&
asym_
entity_id
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
{
for
(
const
auto
&
[
comp_id
,
num
]
:
branch_scheme
.
find
<
std
::
string
,
int
>
(
"asym_id"
_key
==
asym_id
,
"mon_id"
,
"pdb_seq_num"
))
...
...
@@ -1162,7 +1162,7 @@ branch::branch(structure &structure, const std::string &asym_id, const std::stri
}
for
(
const
auto
&
[
num1
,
num2
,
atom1
,
atom2
]
:
branch_link
.
find
<
size_t
,
size_t
,
std
::
string
,
std
::
string
>
(
"entity_id"
_key
==
entity_id
,
"entity_branch_list_num_1"
,
"entity_branch_list_num_2"
,
"atom_id_1"
,
"atom_id_2"
))
"entity_id"
_key
==
asym_
entity_id
,
"entity_branch_list_num_1"
,
"entity_branch_list_num_2"
,
"atom_id_1"
,
"atom_id_2"
))
{
// if (not iequals(atom1, "c1"))
// throw std::runtime_error("invalid pdbx_entity_branch_link");
...
...
@@ -1236,7 +1236,7 @@ sugar &branch::construct_sugar(const std::string &compound_id)
{
"type"
,
compound
->
type
()}});
}
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
s
ize
()
+
1
);
sugar
&
result
=
emplace_back
(
*
this
,
compound_id
,
m_asym_id
,
s
tatic_cast
<
int
>
(
size
()
+
1
)
);
db
[
"pdbx_branch_scheme"
].
emplace
({
{
"asym_id"
,
result
.
get_asym_id
()},
...
...
src/point.cpp
View file @
627d3b9d
...
...
@@ -369,7 +369,7 @@ quaternion construct_for_dihedral_angle(point p1, point p2, point p3, point p4,
float
dh
=
dihedral_angle
(
p1
,
p2
,
p3
,
p4
);
for
(
int
iteration
=
0
;
iteration
<
100
;
++
iteration
)
{
float
delta
=
std
::
fmod
(
angle
-
dh
,
360
);
float
delta
=
std
::
fmod
(
angle
-
dh
,
360
.0
f
);
if
(
delta
<
-
180
)
delta
+=
360
;
...
...
src/utilities.cpp
View file @
627d3b9d
...
...
@@ -407,9 +407,9 @@ struct rsrc_imp
#if _MSC_VER
extern
"C"
const
mrsrc
::
rsrc_imp
*
gResourceIndexDefault
[
1
]
=
{};
extern
"C"
const
char
*
gResourceDataDefault
[
1
]
=
{};
extern
"C"
const
char
*
gResourceNameDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
mrsrc
::
rsrc_imp
*
gResourceIndexDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
char
*
gResourceDataDefault
[
1
]
=
{};
extern
"C"
CIFPP_EXPORT
const
char
*
gResourceNameDefault
[
1
]
=
{};
extern
"C"
const
mrsrc
::
rsrc_imp
gResourceIndex
[];
extern
"C"
const
char
gResourceData
[];
...
...
test/unit-3d-test.cpp
View file @
627d3b9d
...
...
@@ -93,13 +93,13 @@ BOOST_AUTO_TEST_CASE(t1)
const
auto
&&
[
angle0
,
axis0
]
=
cif
::
quaternion_to_angle_axis
(
q
);
std
::
vector
<
cif
::
point
>
p1
{
{
16.979
,
13.301
,
44.555
},
{
18.150
,
13.525
,
43.680
},
{
18.656
,
14.966
,
43.784
},
{
17.890
,
15.889
,
44.078
},
{
17.678
,
13.270
,
42.255
},
{
16.248
,
13.734
,
42.347
},
{
15.762
,
13.216
,
43.724
}
{
16.979
f
,
13.301
f
,
44.555
f
},
{
18.150
f
,
13.525
f
,
43.680
f
},
{
18.656
f
,
14.966
f
,
43.784
f
},
{
17.890
f
,
15.889
f
,
44.078
f
},
{
17.678
f
,
13.270
f
,
42.255
f
},
{
16.248
f
,
13.734
f
,
42.347
f
},
{
15.762
f
,
13.216
f
,
43.724
f
}
};
auto
p2
=
p1
;
...
...
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(t1)
for
(
auto
&
p
:
p1
)
p
.
rotate
(
q2
);
float
rmsd
=
cif
::
RMSd
(
p1
,
p2
);
auto
rmsd
=
cif
::
RMSd
(
p1
,
p2
);
BOOST_TEST
(
rmsd
<
1e-5
);
...
...
@@ -175,27 +175,27 @@ BOOST_AUTO_TEST_CASE(dh_q_1)
float
angle
;
cif
::
point
pts
[
4
];
}
tests
[]
=
{
{
-
97.5
,
{
{
68.8649979
,
-
7.34800005
,
54.3769989
},
{
68.1350021
,
-
8.18700027
,
53.6489983
},
{
68.7760239
,
-
9.07335377
,
52.7140236
},
{
68.9000015
,
-
10.3944235
,
53.2217026
}
}
},
{
80.3
,
{
{
0.304512024
,
0.531184196
,
2.25860214
},
{
0.956512451
,
0.0321846008
,
1.07460022
},
{
-
97.5
f
,
{
{
68.8649979
f
,
-
7.34800005
f
,
54.3769989
f
},
{
68.1350021
f
,
-
8.18700027
f
,
53.6489983
f
},
{
68.7760239
f
,
-
9.07335377
f
,
52.7140236
f
},
{
68.9000015
f
,
-
10.3944235
f
,
53.2217026
f
}
}
},
{
80.3
f
,
{
{
0.304512024
f
,
0.531184196
f
,
2.25860214
f
},
{
0.956512451
f
,
0.0321846008
f
,
1.07460022
f
},
{
0
,
0
,
0
},
{
0.21336633
,
-
1.09552193
,
-
0.878999829
}
}
},
{
-
97.5
,
{
{
0.088973999
,
1.72535372
,
1.66297531
},
{
-
0.641021729
,
0.886353493
,
0.93497467
},
{
0.21336633
f
,
-
1.09552193
f
,
-
0.878999829
f
}
}
},
{
-
97.5
f
,
{
{
0.088973999
f
,
1.72535372
f
,
1.66297531
f
},
{
-
0.641021729
f
,
0.886353493
f
,
0.93497467
f
},
{
0
,
0
,
0
},
{
1.29433727
,
-
0.395142615
,
0.432300746
}
}
},
{
-
97.5
,
{
1.29433727
f
,
-
0.395142615
f
,
0.432300746
f
}
}
},
{
-
97.5
f
,
{
{
0.088973999
,
1.72535372
,
1.66297531
},
{
-
0.641021729
,
0.886353493
,
0.93497467
},
{
0.088973999
f
,
1.72535372
f
,
1.66297531
f
},
{
-
0.641021729
f
,
0.886353493
f
,
0.93497467
f
},
{
0
,
0
,
0
},
{
1.33983064
,
0.384027064
,
-
0.275154471
},
{
1.33983064
f
,
0.384027064
f
,
-
0.275154471
f
},
}
}
};
...
...
test/unit-v2-test.cpp
View file @
627d3b9d
...
...
@@ -78,23 +78,23 @@ bool init_unit_test()
BOOST_AUTO_TEST_CASE
(
cc_1
)
{
std
::
tuple
<
std
::
string_view
,
float
,
char
>
tests
[]
=
{
{
"1.0"
,
1.0
,
0
},
{
"1.0e10"
,
1.0e10
,
0
},
{
"-1.1e10"
,
-
1.1e10
,
0
},
{
"-.2e11"
,
-
.2e11
,
0
},
{
"1.3e-10"
,
1.3e-10
,
0
},
{
"1.0 "
,
1.0
,
' '
},
{
"1.0e10 "
,
1.0e10
,
' '
},
{
"-1.1e10 "
,
-
1.1e10
,
' '
},
{
"-.2e11 "
,
-
.2e11
,
' '
},
{
"1.3e-10 "
,
1.3e-10
,
' '
},
{
"3.0"
,
3.0
,
0
},
{
"3.0 "
,
3.0
,
' '
},
{
"3.000000"
,
3.0
,
0
},
{
"3.000000 "
,
3.0
,
' '
},
{
"1.0"
,
1.0
f
,
0
},
{
"1.0e10"
,
1.0e10
f
,
0
},
{
"-1.1e10"
,
-
1.1e10
f
,
0
},
{
"-.2e11"
,
-
.2e11
f
,
0
},
{
"1.3e-10"
,
1.3e-10
f
,
0
},
{
"1.0 "
,
1.0
f
,
' '
},
{
"1.0e10 "
,
1.0e10
f
,
' '
},
{
"-1.1e10 "
,
-
1.1e10
f
,
' '
},
{
"-.2e11 "
,
-
.2e11
f
,
' '
},
{
"1.3e-10 "
,
1.3e-10
f
,
' '
},
{
"3.0"
,
3.0
f
,
0
},
{
"3.0 "
,
3.0
f
,
' '
},
{
"3.000000"
,
3.0
f
,
0
},
{
"3.000000 "
,
3.0
f
,
' '
},
};
for
(
const
auto
&
[
txt
,
val
,
ch
]
:
tests
)
...
...
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(cc_1)
BOOST_AUTO_TEST_CASE
(
cc_2
)
{
std
::
tuple
<
float
,
int
,
std
::
string_view
>
tests
[]
=
{
{
1.1
,
1
,
"1.1"
}
{
1.1
f
,
1
,
"1.1"
}
};
for
(
const
auto
&
[
val
,
prec
,
test
]
:
tests
)
...
...
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(item_1)
using
namespace
cif
;
item
i1
(
"1"
,
"1"
);
item
i2
(
"2"
,
2.0
);
item
i2
(
"2"
,
2.0
f
);
item
i3
(
"3"
,
'3'
);
item
ci1
(
i1
);
...
...
@@ -163,23 +163,23 @@ BOOST_AUTO_TEST_CASE(r_1)
c
.
emplace
({
{
"f-1"
,
1
},
{
"f-2"
,
"two"
},
{
"f-3"
,
3.0
,
3
},
{
"f-3"
,
3.0
f
,
3
},
});
auto
row
=
c
.
front
();
BOOST_CHECK_EQUAL
(
row
[
"f-1"
].
compare
(
1
),
0
);
BOOST_CHECK_EQUAL
(
row
[
"f-2"
].
compare
(
"two"
),
0
);
BOOST_CHECK_EQUAL
(
row
[
"f-3"
].
compare
(
3.0
),
0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
row
[
"f-3"
].
compare
(
3.0
f
),
0
);
// This fails when running in valgrind... sigh
const
auto
&
[
f1
,
f2
,
f3
]
=
row
.
get
<
int
,
std
::
string
,
float
>
(
"f-1"
,
"f-2"
,
"f-3"
);
BOOST_CHECK_EQUAL
(
f1
,
1
);
BOOST_CHECK_EQUAL
(
f2
,
"two"
);
BOOST_CHECK_EQUAL
(
f3
,
3.0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
f3
,
3.0
f
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
row
.
get
<
int
>
(
"f-1"
),
1
);
BOOST_CHECK_EQUAL
(
row
.
get
<
std
::
string
>
(
"f-2"
),
"two"
);
BOOST_CHECK_EQUAL
(
row
.
get
<
float
>
(
"f-3"
),
3.0
);
BOOST_CHECK_EQUAL
(
row
.
get
<
float
>
(
"f-3"
),
3.0
f
);
int
f_1
;
std
::
string
f_2
;
...
...
@@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(r_1)
BOOST_CHECK_EQUAL
(
f_1
,
1
);
BOOST_CHECK_EQUAL
(
f_2
,
"two"
);
BOOST_CHECK_EQUAL
(
f_3
,
3.0
);
// This fails when running in valgrind... sigh
BOOST_CHECK_EQUAL
(
f_3
,
3.0
f
);
// This fails when running in valgrind... sigh
}
BOOST_AUTO_TEST_CASE
(
r_2
)
...
...
@@ -486,14 +486,14 @@ _test.value
BOOST_CHECK_EQUAL
(
++
n
,
1
);
BOOST_CHECK_EQUAL
(
r
[
"id"
].
as
<
int
>
(),
1
);
BOOST_CHECK_EQUAL
(
r
[
"name"
].
as
<
std
::
string
>
(),
"aap"
);
BOOST_CHECK_EQUAL
(
r
[
"value"
].
as
<
float
>
(),
1.0
);
BOOST_CHECK_EQUAL
(
r
[
"value"
].
as
<
float
>
(),
1.0
f
);
}
auto
t
=
test
.
find
(
cif
::
key
(
"id"
)
==
1
);
BOOST_CHECK
(
not
t
.
empty
());
BOOST_CHECK_EQUAL
(
t
.
front
()[
"name"
].
as
<
std
::
string
>
(),
"aap"
);
auto
t2
=
test
.
find
(
cif
::
key
(
"value"
)
==
1.2
);
auto
t2
=
test
.
find
(
cif
::
key
(
"value"
)
==
1.2
f
);
BOOST_CHECK
(
not
t2
.
empty
());
BOOST_CHECK_EQUAL
(
t2
.
front
()[
"name"
].
as
<
std
::
string
>
(),
"mies"
);
}
...
...
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