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
dfff8c95
Unverified
Commit
dfff8c95
authored
Aug 16, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
condition work (children, parents)
parent
cc5d52bb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
59 deletions
+18
-59
include/cif++/cif/category.hpp
+8
-50
include/cif++/cif/condition.hpp
+3
-1
src/cif/category.cpp
+0
-0
src/dssp/DSSP.cpp
+4
-6
test/unit-v2-test.cpp
+3
-2
No files found.
include/cif++/cif/category.hpp
View file @
dfff8c95
...
...
@@ -381,18 +381,7 @@ class category
return
insert_impl
(
cend
(),
r
);
}
void
clear
()
{
auto
i
=
m_head
;
while
(
i
!=
nullptr
)
{
auto
t
=
i
;
i
=
i
->
m_next
;
delete_row
(
t
);
}
m_head
=
m_tail
=
nullptr
;
}
void
clear
();
// --------------------------------------------------------------------
/// \brief generate a new, unique ID. Pass it an ID generating function
...
...
@@ -497,7 +486,6 @@ class category
void
update_value
(
row
*
row
,
size_t
column
,
std
::
string_view
value
,
bool
updateLinked
,
bool
validate
=
true
);
private
:
bool
is_orphan
(
row_handle
r
)
const
;
void
erase_orphans
(
condition
&&
cond
);
using
allocator_type
=
std
::
allocator
<
void
>
;
...
...
@@ -580,44 +568,9 @@ class category
return
p
;
}
row
*
clone_row
(
const
row
&
r
)
{
row
*
result
=
create_row
();
row
*
clone_row
(
const
row
&
r
);
try
{
for
(
auto
i
=
r
.
m_head
;
i
!=
nullptr
;
i
=
i
->
m_next
)
{
item_value
*
v
=
create_item
(
i
->
m_column_ix
,
i
->
text
());
result
->
append
(
v
);
}
}
catch
(...)
{
delete_row
(
result
);
throw
;
}
return
result
;
}
void
delete_row
(
row
*
r
)
{
if
(
r
!=
nullptr
)
{
auto
i
=
r
->
m_head
;
while
(
i
!=
nullptr
)
{
auto
t
=
i
;
i
=
i
->
m_next
;
delete_item
(
t
);
}
row_allocator_type
ra
(
get_allocator
());
row_allocator_traits
::
destroy
(
ra
,
r
);
row_allocator_traits
::
deallocate
(
ra
,
r
,
1
);
}
}
void
delete_row
(
row
*
r
);
row_handle
create_copy
(
row_handle
r
);
...
...
@@ -651,6 +604,11 @@ class category
// --------------------------------------------------------------------
condition
get_parents_condition
(
row_handle
rh
,
const
category
&
parentCat
)
const
;
condition
get_children_condition
(
row_handle
rh
,
const
category
&
childCat
)
const
;
// --------------------------------------------------------------------
std
::
string
m_name
;
std
::
vector
<
item_column
>
m_columns
;
const
validator
*
m_validator
=
nullptr
;
...
...
include/cif++/cif/condition.hpp
View file @
dfff8c95
...
...
@@ -77,7 +77,8 @@ class condition
:
m_impl
(
nullptr
)
{
}
condition
(
condition_impl
*
impl
)
explicit
condition
(
condition_impl
*
impl
)
:
m_impl
(
impl
)
{
}
...
...
@@ -118,6 +119,7 @@ class condition
return
m_impl
?
m_impl
->
test
(
r
)
:
false
;
}
explicit
operator
bool
()
{
return
not
empty
();
}
bool
empty
()
const
{
return
m_impl
==
nullptr
;
}
friend
condition
operator
||
(
condition
&&
a
,
condition
&&
b
);
...
...
src/cif/category.cpp
View file @
dfff8c95
This diff is collapsed.
Click to expand it.
src/dssp/DSSP.cpp
View file @
dfff8c95
...
...
@@ -1537,21 +1537,19 @@ std::string cif2pdbDate(const std::string &d)
};
std
::
smatch
m
;
std
::
string
result
;
std
::
ostringstream
os
;
if
(
std
::
regex_match
(
d
,
m
,
rx
))
{
int
year
=
std
::
stoi
(
m
[
1
].
str
());
int
month
=
std
::
stoi
(
m
[
2
].
str
());
std
::
ostringstream
os
;
if
(
m
[
3
].
matched
)
os
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
stoi
(
m
[
3
].
str
())
<<
'-'
;
os
<<
kMonths
[
month
-
1
]
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
(
year
%
100
);
os
<<
kMonths
[
month
-
1
]
<<
'-'
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
(
year
%
100
);
}
return
result
;
return
os
.
str
()
;
}
std
::
string
cif2pdbAuth
(
std
::
string
name
)
...
...
@@ -1616,7 +1614,7 @@ std::string DSSP_impl::GetPDBHEADERLine()
std
::
copy
(
id
.
begin
(),
id
.
end
(),
header
+
62
);
return
header
;
return
FixStringLength
(
header
)
;
}
std
::
string
DSSP_impl
::
GetPDBCOMPNDLine
()
...
...
test/unit-v2-test.cpp
View file @
dfff8c95
...
...
@@ -949,12 +949,12 @@ _cat_2.desc
cat1
.
erase
(
cif
::
key
(
"id"
)
==
10
);
BOOST_CHECK_EQUAL
(
cat1
.
size
(),
2
);
BOOST_CHECK_EQUAL
(
cat2
.
size
(),
2
);
BOOST_CHECK_EQUAL
(
cat2
.
size
(),
3
);
// TODO: Is this really what we want?
cat1
.
erase
(
cif
::
key
(
"id"
)
==
20
);
BOOST_CHECK_EQUAL
(
cat1
.
size
(),
1
);
BOOST_CHECK_EQUAL
(
cat2
.
size
(),
1
);
BOOST_CHECK_EQUAL
(
cat2
.
size
(),
2
);
// TODO: Is this really what we want?
}
// --------------------------------------------------------------------
...
...
@@ -1341,6 +1341,7 @@ _cat_2.parent_id3
BOOST_CHECK_EQUAL
(
PR2
[
"id"
].
as
<
int
>
(),
2
);
auto
CR2set
=
cat1
.
get_children
(
PR2
,
cat2
);
BOOST_CHECK_EQUAL
(
CR2set
.
size
(),
3
);
BOOST_ASSERT
(
CR2set
.
size
()
==
3
);
std
::
vector
<
int
>
CRids
;
...
...
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