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
e853cd1c
Unverified
Commit
e853cd1c
authored
Jul 01, 2024
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set_validator changes
parent
b9544033
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
src/datablock.cpp
+1
-0
src/file.cpp
+24
-2
No files found.
src/datablock.cpp
View file @
e853cd1c
...
@@ -49,6 +49,7 @@ void datablock::set_validator(const validator *v)
...
@@ -49,6 +49,7 @@ void datablock::set_validator(const validator *v)
}
}
catch
(
const
std
::
exception
&
)
catch
(
const
std
::
exception
&
)
{
{
m_validator
=
nullptr
;
throw_with_nested
(
std
::
runtime_error
(
"Error while setting validator in datablock "
+
m_name
));
throw_with_nested
(
std
::
runtime_error
(
"Error while setting validator in datablock "
+
m_name
));
}
}
}
}
...
...
src/file.cpp
View file @
e853cd1c
...
@@ -31,11 +31,32 @@ namespace cif
...
@@ -31,11 +31,32 @@ namespace cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// TODO: This is wrong. A validator should be assigned to datablocks,
// not to a file. Since audit_conform is a category specifying the
// content of a datablock. Not the entire file.
void
file
::
set_validator
(
const
validator
*
v
)
void
file
::
set_validator
(
const
validator
*
v
)
{
{
m_validator
=
v
;
m_validator
=
v
;
for
(
auto
&
db
:
*
this
)
for
(
bool
first
=
true
;
auto
&
db
:
*
this
)
{
try
{
db
.
set_validator
(
v
);
db
.
set_validator
(
v
);
}
catch
(
const
std
::
exception
&
e
)
{
if
(
first
)
throw
;
// Accept failure on secondary datablocks
// now that many mmCIF files have invalid
// restraint data concatenated.
std
::
cerr
<<
e
.
what
()
<<
'\n'
;
}
first
=
false
;
}
}
}
bool
file
::
is_valid
()
const
bool
file
::
is_valid
()
const
...
@@ -125,7 +146,8 @@ void file::load_dictionary(std::string_view name)
...
@@ -125,7 +146,8 @@ void file::load_dictionary(std::string_view name)
bool
file
::
contains
(
std
::
string_view
name
)
const
bool
file
::
contains
(
std
::
string_view
name
)
const
{
{
return
std
::
find_if
(
begin
(),
end
(),
[
name
](
const
datablock
&
db
)
{
return
iequals
(
db
.
name
(),
name
);
})
!=
end
();
return
std
::
find_if
(
begin
(),
end
(),
[
name
](
const
datablock
&
db
)
{
return
iequals
(
db
.
name
(),
name
);
})
!=
end
();
}
}
datablock
&
file
::
operator
[](
std
::
string_view
name
)
datablock
&
file
::
operator
[](
std
::
string_view
name
)
...
...
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