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
a12acaa5
Unverified
Commit
a12acaa5
authored
Aug 11, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving from namespace cif::v2 to cif
parent
ff62efe7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
92 additions
and
96 deletions
+92
-96
examples/example.cpp
+9
-12
include/cif++/cif/category.hpp
+3
-3
include/cif++/cif/condition.hpp
+3
-3
include/cif++/cif/datablock.hpp
+3
-3
include/cif++/cif/dictionary_parser.hpp
+2
-2
include/cif++/cif/file.hpp
+3
-3
include/cif++/cif/forward_decl.hpp
+3
-3
include/cif++/cif/item.hpp
+2
-2
include/cif++/cif/iterator.hpp
+3
-3
include/cif++/cif/list.hpp
+2
-2
include/cif++/cif/parser.hpp
+2
-2
include/cif++/cif/row.hpp
+3
-3
include/cif++/cif/validate.hpp
+3
-4
include/cif++/structure/Compound.hpp
+2
-2
include/cif++/structure/Structure.hpp
+20
-20
src/cif/category.cpp
+4
-4
src/cif/condition.cpp
+2
-2
src/cif/datablock.cpp
+1
-1
src/cif/dictionary_parser.cpp
+10
-10
src/cif/file.cpp
+3
-3
src/cif/item.cpp
+1
-1
src/cif/parser.cpp
+3
-3
src/cif/row.cpp
+3
-3
src/cif/validate.cpp
+2
-2
test/unit-v2-test.cpp
+0
-0
No files found.
examples/example.cpp
View file @
a12acaa5
#include <iostream>
#include <iostream>
#include <filesystem>
#include <filesystem>
#include <cif++/
Cif++
.hpp>
#include <cif++/
cif
.hpp>
namespace
fs
=
std
::
filesystem
;
namespace
fs
=
std
::
filesystem
;
int
main
()
int
main
()
{
{
fs
::
path
in
(
"1cbs.cif.gz"
);
cif
::
file
file
;
file
.
load_dictionary
(
"mmcif_pdbx_v50"
);
cif
::
File
file
;
file
.
loadDictionary
(
"mmcif_pdbx_v50"
);
file
.
load
(
"1cbs.cif.gz"
);
file
.
load
(
"1cbs.cif.gz"
);
auto
&
db
=
file
.
firstDatablock
()[
"atom_site"
];
auto
&
db
=
file
.
front
();
auto
n
=
db
.
find
(
cif
::
Key
(
"label_atom_id"
)
==
"OXT"
).
size
();
auto
&
atom_site
=
db
[
"atom_site"
];
auto
n
=
atom_site
.
find
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
).
size
();
std
::
cout
<<
"File contains "
<<
db
.
size
()
<<
" atoms of which "
<<
n
<<
(
n
==
1
?
" is"
:
" are"
)
<<
" OXT"
<<
std
::
endl
std
::
cout
<<
"File contains "
<<
atom_site
.
size
()
<<
" atoms of which "
<<
n
<<
(
n
==
1
?
" is"
:
" are"
)
<<
" OXT"
<<
std
::
endl
<<
"residues with an OXT are:"
<<
std
::
endl
;
<<
"residues with an OXT are:"
<<
std
::
endl
;
for
(
const
auto
&
[
asym
,
comp
,
seqnr
]
:
db
.
find
<
std
::
string
,
std
::
string
,
int
>
(
for
(
const
auto
&
[
asym
,
comp
,
seqnr
]
:
atom_site
.
find
<
std
::
string
,
std
::
string
,
int
>
(
cif
::
K
ey
(
"label_atom_id"
)
==
"OXT"
,
"label_asym_id"
,
"label_comp_id"
,
"label_seq_id"
))
cif
::
k
ey
(
"label_atom_id"
)
==
"OXT"
,
"label_asym_id"
,
"label_comp_id"
,
"label_seq_id"
))
{
{
std
::
cout
<<
asym
<<
' '
<<
comp
<<
' '
<<
seqnr
<<
std
::
endl
;
std
::
cout
<<
asym
<<
' '
<<
comp
<<
' '
<<
seqnr
<<
std
::
endl
;
}
}
...
...
include/cif++/cif/category.hpp
View file @
a12acaa5
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
// https://en.cppreference.com/w/cpp/named_req/SequenceContainer
// https://en.cppreference.com/w/cpp/named_req/SequenceContainer
// and more?
// and more?
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -660,4 +660,4 @@ class category
...
@@ -660,4 +660,4 @@ class category
row
*
m_head
=
nullptr
,
*
m_tail
=
nullptr
;
row
*
m_head
=
nullptr
,
*
m_tail
=
nullptr
;
};
};
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/condition.hpp
View file @
a12acaa5
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#include <cif++/cif/row.hpp>
#include <cif++/cif/row.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -612,4 +612,4 @@ namespace literals
...
@@ -612,4 +612,4 @@ namespace literals
}
}
}
// namespace literals
}
// namespace literals
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/datablock.hpp
View file @
a12acaa5
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include <cif++/cif/category.hpp>
#include <cif++/cif/category.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -86,4 +86,4 @@ class datablock : public std::list<category>
...
@@ -86,4 +86,4 @@ class datablock : public std::list<category>
const
validator
*
m_validator
=
nullptr
;
const
validator
*
m_validator
=
nullptr
;
};
};
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/dictionary_parser.hpp
View file @
a12acaa5
...
@@ -28,9 +28,9 @@
...
@@ -28,9 +28,9 @@
#include <cif++/cif/validate.hpp>
#include <cif++/cif/validate.hpp>
namespace
cif
::
v2
namespace
cif
{
{
validator
parse_dictionary
(
std
::
string_view
name
,
std
::
istream
&
is
);
validator
parse_dictionary
(
std
::
string_view
name
,
std
::
istream
&
is
);
}
// namespace cif
::v2
}
// namespace cif
include/cif++/cif/file.hpp
View file @
a12acaa5
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <cif++/cif/datablock.hpp>
#include <cif++/cif/datablock.hpp>
#include <cif++/cif/parser.hpp>
#include <cif++/cif/parser.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -83,4 +83,4 @@ class file : public std::list<datablock>
...
@@ -83,4 +83,4 @@ class file : public std::list<datablock>
const
validator
*
m_validator
=
nullptr
;
const
validator
*
m_validator
=
nullptr
;
};
};
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/forward_decl.hpp
View file @
a12acaa5
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <string>
#include <string>
#include <vector>
#include <vector>
namespace
cif
::
v2
namespace
cif
{
{
class
category
;
class
category
;
...
@@ -43,4 +43,4 @@ class row_handle;
...
@@ -43,4 +43,4 @@ class row_handle;
class
item
;
class
item
;
class
item_handle
;
class
item_handle
;
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/item.hpp
View file @
a12acaa5
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#include <cif++/cif/forward_decl.hpp>
#include <cif++/cif/forward_decl.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -458,4 +458,4 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, std::str
...
@@ -458,4 +458,4 @@ struct item_handle::item_value_as<T, std::enable_if_t<std::is_same_v<T, std::str
}
}
};
};
}
// namespace cif
::v2
}
// namespace cif
include/cif++/cif/iterator.hpp
View file @
a12acaa5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include <cif++/cif/row.hpp>
#include <cif++/cif/row.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -466,4 +466,4 @@ void conditional_iterator_proxy<Category, Ts...>::swap(conditional_iterator_prox
...
@@ -466,4 +466,4 @@ void conditional_iterator_proxy<Category, Ts...>::swap(conditional_iterator_prox
std
::
swap
(
mCix
,
rhs
.
mCix
);
std
::
swap
(
mCix
,
rhs
.
mCix
);
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/list.hpp
View file @
a12acaa5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include <memory>
#include <memory>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -76,4 +76,4 @@ class list
...
@@ -76,4 +76,4 @@ class list
};
};
}
// namespace cif
::v2
}
// namespace cif
include/cif++/cif/parser.hpp
View file @
a12acaa5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include <cif++/cif/row.hpp>
#include <cif++/cif/row.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -284,4 +284,4 @@ class parser : public sac_parser
...
@@ -284,4 +284,4 @@ class parser : public sac_parser
row_handle
m_row
;
row_handle
m_row
;
};
};
}
// namespace cif
::v2
}
// namespace cif
include/cif++/cif/row.hpp
View file @
a12acaa5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include <cif++/cif/item.hpp>
#include <cif++/cif/item.hpp>
namespace
cif
::
v2
namespace
cif
{
{
namespace
detail
namespace
detail
...
@@ -266,4 +266,4 @@ class row_initializer
...
@@ -266,4 +266,4 @@ class row_initializer
std
::
vector
<
item
>
m_items
;
std
::
vector
<
item
>
m_items
;
};
};
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
include/cif++/cif/validate.hpp
View file @
a12acaa5
...
@@ -35,11 +35,10 @@
...
@@ -35,11 +35,10 @@
#include <cif++/utilities.hpp>
#include <cif++/utilities.hpp>
namespace
cif
::
v2
namespace
cif
{
{
struct
category_validator
;
struct
category_validator
;
class
validator_factory
;
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -68,7 +67,7 @@ struct type_validator
...
@@ -68,7 +67,7 @@ struct type_validator
{
{
std
::
string
m_name
;
std
::
string
m_name
;
DDL_PrimitiveType
m_primitive_type
;
DDL_PrimitiveType
m_primitive_type
;
// std::regex
mR
x;
// std::regex
m_r
x;
boost
::
regex
m_rx
;
boost
::
regex
m_rx
;
bool
operator
<
(
const
type_validator
&
rhs
)
const
bool
operator
<
(
const
type_validator
&
rhs
)
const
...
@@ -218,4 +217,4 @@ class validator_factory
...
@@ -218,4 +217,4 @@ class validator_factory
std
::
list
<
validator
>
m_validators
;
std
::
list
<
validator
>
m_validators
;
};
};
}
// namespace cif
::v2
}
// namespace cif
include/cif++/structure/Compound.hpp
View file @
a12acaa5
...
@@ -130,8 +130,8 @@ class Compound
...
@@ -130,8 +130,8 @@ class Compound
friend
class
CCDCompoundFactoryImpl
;
friend
class
CCDCompoundFactoryImpl
;
friend
class
CCP4CompoundFactoryImpl
;
friend
class
CCP4CompoundFactoryImpl
;
Compound
(
cif
::
v2
::
datablock
&
db
);
Compound
(
cif
::
datablock
&
db
);
Compound
(
cif
::
v2
::
datablock
&
db
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
type
,
const
std
::
string
&
group
);
Compound
(
cif
::
datablock
&
db
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
type
,
const
std
::
string
&
group
);
std
::
string
mID
;
std
::
string
mID
;
std
::
string
mName
;
std
::
string
mName
;
...
...
include/cif++/structure/Structure.hpp
View file @
a12acaa5
...
@@ -63,7 +63,7 @@ class Atom
...
@@ -63,7 +63,7 @@ class Atom
private
:
private
:
struct
AtomImpl
:
public
std
::
enable_shared_from_this
<
AtomImpl
>
struct
AtomImpl
:
public
std
::
enable_shared_from_this
<
AtomImpl
>
{
{
AtomImpl
(
cif
::
v2
::
datablock
&
db
,
const
std
::
string
&
id
,
cif
::
v2
::
row_handle
row
);
AtomImpl
(
cif
::
datablock
&
db
,
const
std
::
string
&
id
,
cif
::
row_handle
row
);
// constructor for a symmetry copy of an atom
// constructor for a symmetry copy of an atom
AtomImpl
(
const
AtomImpl
&
impl
,
const
Point
&
loc
,
const
std
::
string
&
sym_op
);
AtomImpl
(
const
AtomImpl
&
impl
,
const
Point
&
loc
,
const
std
::
string
&
sym_op
);
...
@@ -85,7 +85,7 @@ class Atom
...
@@ -85,7 +85,7 @@ class Atom
const
std
::
string
get_property
(
const
std
::
string_view
name
)
const
;
const
std
::
string
get_property
(
const
std
::
string_view
name
)
const
;
void
set_property
(
const
std
::
string_view
name
,
const
std
::
string
&
value
);
void
set_property
(
const
std
::
string_view
name
,
const
std
::
string
&
value
);
const
cif
::
v2
::
datablock
&
mDb
;
const
cif
::
datablock
&
mDb
;
std
::
string
mID
;
std
::
string
mID
;
AtomType
mType
;
AtomType
mType
;
...
@@ -98,7 +98,7 @@ class Atom
...
@@ -98,7 +98,7 @@ class Atom
Point
mLocation
;
Point
mLocation
;
int
mRefcount
;
int
mRefcount
;
cif
::
v2
::
row_handle
mRow
;
cif
::
row_handle
mRow
;
// mutable std::vector<std::tuple<std::string, cif::detail::ItemReference>> mCachedRefs;
// mutable std::vector<std::tuple<std::string, cif::detail::ItemReference>> mCachedRefs;
...
@@ -123,7 +123,7 @@ class Atom
...
@@ -123,7 +123,7 @@ class Atom
{
{
}
}
Atom
(
cif
::
v2
::
datablock
&
db
,
cif
::
v2
::
row_handle
&
row
);
Atom
(
cif
::
datablock
&
db
,
cif
::
row_handle
&
row
);
// a special constructor to create symmetry copies
// a special constructor to create symmetry copies
Atom
(
const
Atom
&
rhs
,
const
Point
&
symmmetry_location
,
const
std
::
string
&
symmetry_operation
);
Atom
(
const
Atom
&
rhs
,
const
Point
&
symmmetry_location
,
const
std
::
string
&
symmetry_operation
);
...
@@ -180,8 +180,8 @@ class Atom
...
@@ -180,8 +180,8 @@ class Atom
void
translateRotateAndTranslate
(
Point
t1
,
Quaternion
q
,
Point
t2
);
void
translateRotateAndTranslate
(
Point
t1
,
Quaternion
q
,
Point
t2
);
// for direct access to underlying data, be careful!
// for direct access to underlying data, be careful!
const
cif
::
v2
::
row_handle
getRow
()
const
{
return
impl
().
mRow
;
}
const
cif
::
row_handle
getRow
()
const
{
return
impl
().
mRow
;
}
const
cif
::
v2
::
row_handle
getRowAniso
()
const
;
const
cif
::
row_handle
getRowAniso
()
const
;
bool
isSymmetryCopy
()
const
{
return
impl
().
mSymmetryCopy
;
}
bool
isSymmetryCopy
()
const
{
return
impl
().
mSymmetryCopy
;
}
std
::
string
symmetry
()
const
{
return
impl
().
mSymmetryOperator
;
}
std
::
string
symmetry
()
const
{
return
impl
().
mSymmetryOperator
;
}
...
@@ -513,7 +513,7 @@ class Polymer : public std::vector<Monomer>
...
@@ -513,7 +513,7 @@ class Polymer : public std::vector<Monomer>
Structure
*
mStructure
;
Structure
*
mStructure
;
std
::
string
mEntityID
;
std
::
string
mEntityID
;
std
::
string
mAsymID
;
std
::
string
mAsymID
;
// cif::
v2::
row_handleSet mPolySeq;
// cif::row_handleSet mPolySeq;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -578,7 +578,7 @@ class Branch : public std::vector<Sugar>
...
@@ -578,7 +578,7 @@ class Branch : public std::vector<Sugar>
// file is a reference to the data stored in e.g. the cif file.
// file is a reference to the data stored in e.g. the cif file.
// This object is not copyable.
// This object is not copyable.
class
File
:
public
cif
::
v2
::
file
class
File
:
public
cif
::
file
{
{
public
:
public
:
File
()
{}
File
()
{}
...
@@ -599,10 +599,10 @@ class File : public cif::v2::file
...
@@ -599,10 +599,10 @@ class File : public cif::v2::file
// void load(const std::filesystem::path &p) override;
// void load(const std::filesystem::path &p) override;
// void save(const std::filesystem::path &p) override;
// void save(const std::filesystem::path &p) override;
// using cif::
v2::
file::load;
// using cif::file::load;
// using cif::
v2::
file::save;
// using cif::file::save;
cif
::
v2
::
datablock
&
data
()
{
return
front
();
}
cif
::
datablock
&
data
()
{
return
front
();
}
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -622,12 +622,12 @@ inline bool operator&(StructureOpenOptions a, StructureOpenOptions b)
...
@@ -622,12 +622,12 @@ inline bool operator&(StructureOpenOptions a, StructureOpenOptions b)
class
Structure
class
Structure
{
{
public
:
public
:
Structure
(
cif
::
v2
::
file
&
p
,
size_t
modelNr
=
1
,
StructureOpenOptions
options
=
{})
Structure
(
cif
::
file
&
p
,
size_t
modelNr
=
1
,
StructureOpenOptions
options
=
{})
:
Structure
(
p
.
front
(),
modelNr
,
options
)
:
Structure
(
p
.
front
(),
modelNr
,
options
)
{
{
}
}
Structure
(
cif
::
v2
::
datablock
&
db
,
size_t
modelNr
=
1
,
StructureOpenOptions
options
=
{});
Structure
(
cif
::
datablock
&
db
,
size_t
modelNr
=
1
,
StructureOpenOptions
options
=
{});
Structure
(
Structure
&&
s
)
=
default
;
Structure
(
Structure
&&
s
)
=
default
;
...
@@ -756,12 +756,12 @@ class Structure
...
@@ -756,12 +756,12 @@ class Structure
/// This method creates new atom records filled with info from the info.
/// This method creates new atom records filled with info from the info.
///
///
/// \param entity_id The entity ID of the new nonpoly
/// \param entity_id The entity ID of the new nonpoly
/// \param atoms The array of sets of cif::
v2::
item data containing the data for the atoms.
/// \param atoms The array of sets of cif::item data containing the data for the atoms.
/// \return The newly create asym ID
/// \return The newly create asym ID
std
::
string
createNonpoly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
std
::
vector
<
cif
::
v2
::
item
>>
&
atom_info
);
std
::
string
createNonpoly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
std
::
vector
<
cif
::
item
>>
&
atom_info
);
/// \brief Create a new (sugar) branch with one first NAG containing atoms constructed from \a nag_atom_info
/// \brief Create a new (sugar) branch with one first NAG containing atoms constructed from \a nag_atom_info
Branch
&
createBranch
(
std
::
vector
<
std
::
vector
<
cif
::
v2
::
item
>>
&
nag_atom_info
);
Branch
&
createBranch
(
std
::
vector
<
std
::
vector
<
cif
::
item
>>
&
nag_atom_info
);
/// \brief Extend an existing (sugar) branch identified by \a asymID with one sugar containing atoms constructed from \a atom_info
/// \brief Extend an existing (sugar) branch identified by \a asymID with one sugar containing atoms constructed from \a atom_info
///
///
...
@@ -769,7 +769,7 @@ class Structure
...
@@ -769,7 +769,7 @@ class Structure
/// \param atom_info Array containing the info for the atoms to construct for the new sugar
/// \param atom_info Array containing the info for the atoms to construct for the new sugar
/// \param link_sugar The sugar to link to, note: this is the sugar number (1 based)
/// \param link_sugar The sugar to link to, note: this is the sugar number (1 based)
/// \param link_atom The atom id of the atom linked in the sugar
/// \param link_atom The atom id of the atom linked in the sugar
Branch
&
extendBranch
(
const
std
::
string
&
asym_id
,
std
::
vector
<
std
::
vector
<
cif
::
v2
::
item
>>
&
atom_info
,
Branch
&
extendBranch
(
const
std
::
string
&
asym_id
,
std
::
vector
<
std
::
vector
<
cif
::
item
>>
&
atom_info
,
int
link_sugar
,
const
std
::
string
&
link_atom
);
int
link_sugar
,
const
std
::
string
&
link_atom
);
/// \brief Remove \a branch
/// \brief Remove \a branch
...
@@ -797,12 +797,12 @@ class Structure
...
@@ -797,12 +797,12 @@ class Structure
void
cleanupEmptyCategories
();
void
cleanupEmptyCategories
();
/// \brief Direct access to underlying data
/// \brief Direct access to underlying data
cif
::
v2
::
category
&
category
(
std
::
string_view
name
)
const
cif
::
category
&
category
(
std
::
string_view
name
)
const
{
{
return
mDb
[
name
];
return
mDb
[
name
];
}
}
cif
::
v2
::
datablock
&
datablock
()
const
cif
::
datablock
&
datablock
()
const
{
{
return
mDb
;
return
mDb
;
}
}
...
@@ -832,7 +832,7 @@ class Structure
...
@@ -832,7 +832,7 @@ class Structure
void
removeAtom
(
Atom
&
a
,
bool
removeFromResidue
);
void
removeAtom
(
Atom
&
a
,
bool
removeFromResidue
);
void
removeSugar
(
Sugar
&
sugar
);
void
removeSugar
(
Sugar
&
sugar
);
cif
::
v2
::
datablock
&
mDb
;
cif
::
datablock
&
mDb
;
size_t
mModelNr
;
size_t
mModelNr
;
AtomView
mAtoms
;
AtomView
mAtoms
;
std
::
vector
<
size_t
>
mAtomIndex
;
std
::
vector
<
size_t
>
mAtomIndex
;
...
...
src/cif/category.cpp
View file @
a12acaa5
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
// is inconsistent. It all depends whether a link is satified if a field taking part in the
// is inconsistent. It all depends whether a link is satified if a field taking part in the
// set of linked items is null at one side and not null in the other.
// set of linked items is null at one side and not null in the other.
namespace
cif
::
v2
namespace
cif
{
{
const
uint32_t
kMaxLineLength
=
132
;
const
uint32_t
kMaxLineLength
=
132
;
...
@@ -1119,7 +1119,7 @@ void category::erase_orphans(condition &&cond)
...
@@ -1119,7 +1119,7 @@ void category::erase_orphans(condition &&cond)
std
::
string
category
::
get_unique_id
(
std
::
function
<
std
::
string
(
int
)
>
generator
)
std
::
string
category
::
get_unique_id
(
std
::
function
<
std
::
string
(
int
)
>
generator
)
{
{
using
namespace
cif
::
v2
::
literals
;
using
namespace
cif
::
literals
;
std
::
string
id_tag
=
"id"
;
std
::
string
id_tag
=
"id"
;
if
(
m_cat_validator
!=
nullptr
and
m_cat_validator
->
m_keys
.
size
()
==
1
)
if
(
m_cat_validator
!=
nullptr
and
m_cat_validator
->
m_keys
.
size
()
==
1
)
...
@@ -1875,4 +1875,4 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
...
@@ -1875,4 +1875,4 @@ void category::write(std::ostream &os, const std::vector<uint16_t> &order, bool
os
<<
"# "
<<
'\n'
;
os
<<
"# "
<<
'\n'
;
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
src/cif/condition.cpp
View file @
a12acaa5
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include <cif++/cif/category.hpp>
#include <cif++/cif/category.hpp>
#include <cif++/cif/condition.hpp>
#include <cif++/cif/condition.hpp>
namespace
cif
::
v2
namespace
cif
{
{
iset
get_category_fields
(
const
category
&
cat
)
iset
get_category_fields
(
const
category
&
cat
)
...
@@ -58,4 +58,4 @@ bool is_column_type_uchar(const category &cat, std::string_view col)
...
@@ -58,4 +58,4 @@ bool is_column_type_uchar(const category &cat, std::string_view col)
return
result
;
return
result
;
}
}
}
// namespace cif
::v2
}
// namespace cif
src/cif/datablock.cpp
View file @
a12acaa5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <cif++/cif/datablock.hpp>
#include <cif++/cif/datablock.hpp>
namespace
cif
::
v2
namespace
cif
{
{
void
datablock
::
set_validator
(
const
validator
*
v
)
void
datablock
::
set_validator
(
const
validator
*
v
)
...
...
src/cif/dictionary_parser.cpp
View file @
a12acaa5
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <cif++/cif/file.hpp>
#include <cif++/cif/file.hpp>
#include <cif++/cif/parser.hpp>
#include <cif++/cif/parser.hpp>
namespace
cif
::
v2
namespace
cif
{
{
using
namespace
literals
;
using
namespace
literals
;
...
@@ -194,7 +194,7 @@ class dictionary_parser : public parser
...
@@ -194,7 +194,7 @@ class dictionary_parser : public parser
if
(
isCategorySaveFrame
)
if
(
isCategorySaveFrame
)
{
{
std
::
string
category
;
std
::
string
category
;
cif
::
v2
::
tie
(
category
)
=
dict
[
"category"
].
front
().
get
(
"id"
);
cif
::
tie
(
category
)
=
dict
[
"category"
].
front
().
get
(
"id"
);
std
::
vector
<
std
::
string
>
keys
;
std
::
vector
<
std
::
string
>
keys
;
for
(
auto
k
:
dict
[
"category_key"
])
for
(
auto
k
:
dict
[
"category_key"
])
...
@@ -210,7 +210,7 @@ class dictionary_parser : public parser
...
@@ -210,7 +210,7 @@ class dictionary_parser : public parser
{
{
// if the type code is missing, this must be a pointer, just skip it
// if the type code is missing, this must be a pointer, just skip it
std
::
string
typeCode
;
std
::
string
typeCode
;
cif
::
v2
::
tie
(
typeCode
)
=
dict
[
"item_type"
].
front
().
get
(
"code"
);
cif
::
tie
(
typeCode
)
=
dict
[
"item_type"
].
front
().
get
(
"code"
);
const
type_validator
*
tv
=
nullptr
;
const
type_validator
*
tv
=
nullptr
;
if
(
not
(
typeCode
.
empty
()
or
typeCode
==
"?"
))
if
(
not
(
typeCode
.
empty
()
or
typeCode
==
"?"
))
...
@@ -221,7 +221,7 @@ class dictionary_parser : public parser
...
@@ -221,7 +221,7 @@ class dictionary_parser : public parser
ess
.
insert
(
e
[
"value"
].
as
<
std
::
string
>
());
ess
.
insert
(
e
[
"value"
].
as
<
std
::
string
>
());
std
::
string
defaultValue
;
std
::
string
defaultValue
;
cif
::
v2
::
tie
(
defaultValue
)
=
dict
[
"item_default"
].
front
().
get
(
"value"
);
cif
::
tie
(
defaultValue
)
=
dict
[
"item_default"
].
front
().
get
(
"value"
);
bool
defaultIsNull
=
false
;
bool
defaultIsNull
=
false
;
if
(
defaultValue
.
empty
())
if
(
defaultValue
.
empty
())
{
{
...
@@ -238,7 +238,7 @@ class dictionary_parser : public parser
...
@@ -238,7 +238,7 @@ class dictionary_parser : public parser
{
{
std
::
string
tagName
,
category
,
mandatory
;
std
::
string
tagName
,
category
,
mandatory
;
cif
::
v2
::
tie
(
tagName
,
category
,
mandatory
)
=
i
.
get
(
"name"
,
"category_id"
,
"mandatory_code"
);
cif
::
tie
(
tagName
,
category
,
mandatory
)
=
i
.
get
(
"name"
,
"category_id"
,
"mandatory_code"
);
std
::
string
catName
,
item_name
;
std
::
string
catName
,
item_name
;
std
::
tie
(
catName
,
item_name
)
=
splitTagName
(
tagName
);
std
::
tie
(
catName
,
item_name
)
=
splitTagName
(
tagName
);
...
@@ -297,7 +297,7 @@ class dictionary_parser : public parser
...
@@ -297,7 +297,7 @@ class dictionary_parser : public parser
{
{
std
::
string
childTagName
,
parentTagName
;
std
::
string
childTagName
,
parentTagName
;
cif
::
v2
::
tie
(
childTagName
,
parentTagName
)
=
i
.
get
(
"child_name"
,
"parent_name"
);
cif
::
tie
(
childTagName
,
parentTagName
)
=
i
.
get
(
"child_name"
,
"parent_name"
);
mLinkedItems
.
emplace
(
childTagName
,
parentTagName
);
mLinkedItems
.
emplace
(
childTagName
,
parentTagName
);
}
}
...
@@ -347,7 +347,7 @@ class dictionary_parser : public parser
...
@@ -347,7 +347,7 @@ class dictionary_parser : public parser
{
{
std
::
string
child
,
parent
;
std
::
string
child
,
parent
;
int
link_group_id
;
int
link_group_id
;
cif
::
v2
::
tie
(
child
,
parent
,
link_group_id
)
=
gl
.
get
(
"child_name"
,
"parent_name"
,
"link_group_id"
);
cif
::
tie
(
child
,
parent
,
link_group_id
)
=
gl
.
get
(
"child_name"
,
"parent_name"
,
"link_group_id"
);
auto
civ
=
m_validator
.
get_validator_for_item
(
child
);
auto
civ
=
m_validator
.
get_validator_for_item
(
child
);
if
(
civ
==
nullptr
)
if
(
civ
==
nullptr
)
...
@@ -441,7 +441,7 @@ class dictionary_parser : public parser
...
@@ -441,7 +441,7 @@ class dictionary_parser : public parser
for
(
auto
t
:
dict
[
"item_type_list"
])
for
(
auto
t
:
dict
[
"item_type_list"
])
{
{
std
::
string
code
,
primitiveCode
,
construct
;
std
::
string
code
,
primitiveCode
,
construct
;
cif
::
v2
::
tie
(
code
,
primitiveCode
,
construct
)
=
t
.
get
(
"code"
,
"primitive_code"
,
"construct"
);
cif
::
tie
(
code
,
primitiveCode
,
construct
)
=
t
.
get
(
"code"
,
"primitive_code"
,
"construct"
);
replace_all
(
construct
,
"
\\
n"
,
"
\n
"
);
replace_all
(
construct
,
"
\\
n"
,
"
\n
"
);
replace_all
(
construct
,
"
\\
t"
,
"
\t
"
);
replace_all
(
construct
,
"
\\
t"
,
"
\t
"
);
...
@@ -494,4 +494,4 @@ validator parse_dictionary(std::string_view name, std::istream &is)
...
@@ -494,4 +494,4 @@ validator parse_dictionary(std::string_view name, std::istream &is)
return
result
;
return
result
;
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
src/cif/file.cpp
View file @
a12acaa5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include <cif++/cif/file.hpp>
#include <cif++/cif/file.hpp>
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -165,4 +165,4 @@ void file::save(std::ostream &os) const
...
@@ -165,4 +165,4 @@ void file::save(std::ostream &os) const
db
.
write
(
os
);
db
.
write
(
os
);
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
src/cif/item.cpp
View file @
a12acaa5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <cif++/cif/row.hpp>
#include <cif++/cif/row.hpp>
namespace
cif
::
v2
namespace
cif
{
{
std
::
string_view
item_handle
::
text
()
const
std
::
string_view
item_handle
::
text
()
const
...
...
src/cif/parser.cpp
View file @
a12acaa5
...
@@ -41,7 +41,7 @@ namespace cif
...
@@ -41,7 +41,7 @@ namespace cif
extern
int
VERBOSE
;
extern
int
VERBOSE
;
}
}
namespace
cif
::
v2
namespace
cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -817,4 +817,4 @@ void parser::produce_item(const std::string &category, const std::string &item,
...
@@ -817,4 +817,4 @@ void parser::produce_item(const std::string &category, const std::string &item,
m_row
[
item
]
=
m_token_value
;
m_row
[
item
]
=
m_token_value
;
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
src/cif/row.cpp
View file @
a12acaa5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <cif++/cif/category.hpp>
#include <cif++/cif/category.hpp>
namespace
cif
::
v2
namespace
cif
{
{
void
row_handle
::
assign
(
size_t
column
,
std
::
string_view
value
,
bool
updateLinked
,
bool
validate
)
void
row_handle
::
assign
(
size_t
column
,
std
::
string_view
value
,
bool
updateLinked
,
bool
validate
)
...
@@ -60,4 +60,4 @@ row_initializer::row_initializer(row_handle rh)
...
@@ -60,4 +60,4 @@ row_initializer::row_initializer(row_handle rh)
m_items
.
emplace_back
(
cat
.
get_column_name
(
i
->
m_column_ix
),
i
->
text
());
m_items
.
emplace_back
(
cat
.
get_column_name
(
i
->
m_column_ix
),
i
->
text
());
}
}
}
//
namespace
cif
::
v2
}
//
namespace
cif
\ No newline at end of file
\ No newline at end of file
src/cif/validate.cpp
View file @
a12acaa5
...
@@ -40,7 +40,7 @@ namespace cif
...
@@ -40,7 +40,7 @@ namespace cif
extern
int
VERBOSE
;
extern
int
VERBOSE
;
}
}
namespace
cif
::
v2
namespace
cif
{
{
using
cif
::
VERBOSE
;
using
cif
::
VERBOSE
;
...
@@ -430,4 +430,4 @@ void validator_factory::construct_validator(std::string_view name, std::istream
...
@@ -430,4 +430,4 @@ void validator_factory::construct_validator(std::string_view name, std::istream
parse_dictionary
(
name
,
is
);
parse_dictionary
(
name
,
is
);
}
}
}
// namespace cif
::v2
}
// namespace cif
test/unit-v2-test.cpp
View file @
a12acaa5
This diff is collapsed.
Click to expand it.
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