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
43cb3122
Unverified
Commit
43cb3122
authored
Apr 14, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addFileResource added
parent
ce28cb7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
include/cif++/CifUtils.hpp
+1
-0
src/CifUtils.cpp
+16
-2
src/Compound.cpp
+1
-1
No files found.
include/cif++/CifUtils.hpp
View file @
43cb3122
...
...
@@ -202,6 +202,7 @@ class Progress
// Resources
std
::
unique_ptr
<
std
::
istream
>
loadResource
(
std
::
filesystem
::
path
name
);
void
addFileResource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
);
}
...
...
src/CifUtils.cpp
View file @
43cb3122
...
...
@@ -1184,14 +1184,28 @@ namespace cif
// --------------------------------------------------------------------
std
::
map
<
std
::
string
,
std
::
filesystem
::
path
>
gLocalResources
;
void
addFileResource
(
const
std
::
string
&
name
,
std
::
filesystem
::
path
dataFile
)
{
gLocalResources
[
name
]
=
dataFile
;
}
std
::
unique_ptr
<
std
::
istream
>
loadResource
(
std
::
filesystem
::
path
name
)
{
std
::
unique_ptr
<
std
::
istream
>
result
;
fs
::
path
p
=
name
;
if
(
gLocalResources
.
count
(
name
.
string
()))
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
gLocalResources
[
name
.
string
()],
std
::
ios
::
binary
));
if
(
file
->
is_open
())
result
.
reset
(
file
.
release
());
}
#if defined(CACHE_DIR) and defined(DATA_DIR)
if
(
not
fs
::
exists
(
p
))
if
(
not
result
and
not
fs
::
exists
(
p
))
{
for
(
const
char
*
dir
:
{
CACHE_DIR
,
DATA_DIR
})
{
...
...
@@ -1205,7 +1219,7 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
}
#endif
if
(
fs
::
exists
(
p
))
if
(
not
result
and
fs
::
exists
(
p
))
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
p
,
std
::
ios
::
binary
));
if
(
file
->
is_open
())
...
...
src/Compound.cpp
View file @
43cb3122
...
...
@@ -126,7 +126,7 @@ Compound::Compound(cif::Datablock &db)
CompoundAtom
atom
;
std
::
string
typeSymbol
;
cif
::
tie
(
atom
.
id
,
typeSymbol
,
atom
.
charge
,
atom
.
aromatic
,
atom
.
leavingAtom
,
atom
.
stereoConfig
,
atom
.
x
,
atom
.
y
,
atom
.
z
)
=
row
.
get
(
"id"
,
"type_symbol"
,
"charge"
,
"pdbx_aromatic_flag"
,
"pdbx_leaving_atom_flag"
,
"pdbx_stereo_config"
,
row
.
get
(
"
atom_
id"
,
"type_symbol"
,
"charge"
,
"pdbx_aromatic_flag"
,
"pdbx_leaving_atom_flag"
,
"pdbx_stereo_config"
,
"model_Cartn_x"
,
"model_Cartn_y"
,
"model_Cartn_z"
);
atom
.
typeSymbol
=
AtomTypeTraits
(
typeSymbol
).
type
();
mAtoms
.
push_back
(
std
::
move
(
atom
));
...
...
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