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
5fde0507
Unverified
Commit
5fde0507
authored
Aug 10, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging
parent
a855f880
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
include/cif++/CifUtils.hpp
+3
-2
src/CifUtils.cpp
+3
-0
src/PDB2CifRemark3.cpp
+0
-2
test/unit-v2-test.cpp
+18
-0
No files found.
include/cif++/CifUtils.hpp
View file @
5fde0507
...
@@ -90,12 +90,13 @@ std::string join(IterType b, IterType e, std::string_view sep)
...
@@ -90,12 +90,13 @@ std::string join(IterType b, IterType e, std::string_view sep)
for
(;;)
for
(;;)
{
{
s
<<
*
ai
;
s
<<
*
ai
;
ai
=
ni
;
ni
=
std
::
next
(
ai
);
if
(
ni
==
e
)
if
(
ni
==
e
)
break
;
break
;
ai
=
ni
;
ni
=
std
::
next
(
ai
);
s
<<
sep
;
s
<<
sep
;
}
}
}
}
...
...
src/CifUtils.cpp
View file @
5fde0507
...
@@ -167,7 +167,10 @@ void toUpper(std::string &s)
...
@@ -167,7 +167,10 @@ void toUpper(std::string &s)
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
)
{
{
for
(
std
::
string
::
size_type
p
=
s
.
find
(
what
);
p
!=
std
::
string
::
npos
;
p
=
s
.
find
(
what
,
p
))
for
(
std
::
string
::
size_type
p
=
s
.
find
(
what
);
p
!=
std
::
string
::
npos
;
p
=
s
.
find
(
what
,
p
))
{
s
.
replace
(
p
,
what
.
length
(),
with
);
s
.
replace
(
p
,
what
.
length
(),
with
);
p
+=
with
.
length
();
}
}
}
bool
icontains
(
std
::
string_view
s
,
std
::
string_view
q
)
bool
icontains
(
std
::
string_view
s
,
std
::
string_view
q
)
...
...
src/PDB2CifRemark3.cpp
View file @
5fde0507
...
@@ -29,8 +29,6 @@
...
@@ -29,8 +29,6 @@
#include <map>
#include <map>
#include <set>
#include <set>
#include <boost/format.hpp>
#include <cif++/AtomType.hpp>
#include <cif++/AtomType.hpp>
#include <cif++/Compound.hpp>
#include <cif++/Compound.hpp>
#include <cif++/PDB2CifRemark3.hpp>
#include <cif++/PDB2CifRemark3.hpp>
...
...
test/unit-v2-test.cpp
View file @
5fde0507
...
@@ -2160,3 +2160,20 @@ BOOST_AUTO_TEST_CASE(split_test)
...
@@ -2160,3 +2160,20 @@ BOOST_AUTO_TEST_CASE(split_test)
BOOST_CHECK
(
v
==
t
);
BOOST_CHECK
(
v
==
t
);
}
}
BOOST_AUTO_TEST_CASE
(
join_test
)
{
BOOST_CHECK_EQUAL
(
cif
::
join
(
std
::
vector
<
std
::
string
>
{
"aap"
},
", "
),
"aap"
);
BOOST_CHECK_EQUAL
(
cif
::
join
(
std
::
vector
<
std
::
string
>
{
"aap"
,
"noot"
},
", "
),
"aap, noot"
);
BOOST_CHECK_EQUAL
(
cif
::
join
(
std
::
vector
<
std
::
string
>
{
"aap"
,
"noot"
,
"mies"
},
", "
),
"aap, noot, mies"
);
}
BOOST_AUTO_TEST_CASE
(
replace_all_test
)
{
std
::
string
s
(
"aap, noot, mies"
);
cif
::
replace_all
(
s
,
", "
,
","
);
BOOST_CHECK_EQUAL
(
s
,
"aap,noot,mies"
);
cif
::
replace_all
(
s
,
","
,
", "
);
BOOST_CHECK_EQUAL
(
s
,
"aap, noot, mies"
);
}
\ No newline at end of file
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