68 prefix = prefix.substr(1);
71 prefix = prefix.substr(0, prefix.length() - 1);
74 prefix = prefix.substr(0, prefix.length() - 6);
76 prefix = prefix.substr(0, prefix.length() - 4);
105 if ((*it)->IsSetData() && (*it)->GetData().IsStr()
106 && (*it)->IsSetLabel() && (*it)->GetLabel().IsStr()
109 prefix = (*it)->GetData().GetStr();
122 string prefix = root;
124 prefix =
"##" + prefix +
"-START##";
131 string suffix = root;
133 suffix =
"##" + suffix +
"-END##";
141 {
"GSC:MIGS:2.1",
"MIGS-Data"},
142 {
"GSC:MIMS:2.1",
"MIMS-Data"},
143 {
"GSC:MIENS:2.1",
"MIENS-Data"},
144 {
"GSC:MIxS;MIGS:3.0",
"MIGS:3.0-Data"},
145 {
"GSC:MIxS;MIMS:3.0",
"MIMS:3.0-Data"},
146 {
"GSC:MIxS;MIMARKS:3.0",
"MIMARKS:3.0-Data"} };
153 string compare = prefix;
180 vector<string> keywords;
195 if (
NStr::Equal(p_field_rule->GetField_name(), field_name)) {
207 "Structured Comment contains field without label"));
250 if (!field_rule->DoesStringMatchRuleExpression(
value)) {
256 }
else if (
NStr::EqualNocase(field_rule->GetField_name(),
"Current Finishing Status")
260 errors.push_back(
TError(sev,
value +
" is not a valid value for " + field_rule->GetField_name()));
290 CField_set::Tdata::const_iterator field_rule =
GetFields().
Get().begin();
291 CUser_object::TData::const_iterator field = user.
GetData().begin();
293 && field != user.
GetData().end()) {
295 if ((*field)->IsSetLabel()) {
296 if ((*field)->GetLabel().IsStr()) {
297 encountered_field = (*field)->GetLabel().GetStr();
303 if (
NStr::Equal(encountered_field,
"StructuredCommentPrefix")
304 ||
NStr::Equal(encountered_field,
"StructuredCommentSuffix")) {
312 const string & expected_field = (*field_rule)->GetField_name();
313 if (
NStr::Equal(expected_field, encountered_field)) {
322 if( ! p_other_field ) {
323 if ((*field_rule)->IsSetRequired() && (*field_rule)->GetRequired()) {
324 errors.push_back(
TError((*field_rule)->GetSeverity(),
325 "Required field " + (*field_rule)->GetField_name() +
" is missing"));
330 errors.push_back(
TError((*field_rule)->GetSeverity(),
331 expected_field +
" field is out of order"));
340 if (!real_field_rule) {
344 encountered_field +
" is not a valid field name"));
353 if ((*field_rule)->IsSetRequired() && (*field_rule)->GetRequired()) {
354 errors.push_back(
TError((*field_rule)->GetSeverity(),
355 "Required field " + (*field_rule)->GetField_name() +
" is missing"));
360 while (field != user.
GetData().end()) {
362 if ((*field)->IsSetLabel()) {
364 if ((*field)->GetLabel().IsStr()) {
365 label = (*field)->GetLabel().GetStr();
380 if( p_field_rule && p_other_field ) {
382 errors.push_back(
TError(p_field_rule->GetSeverity(),
383 "Multiple values for " +
label +
" field"));
389 label +
" is not a valid field name"));
402 if( ! (*depend_rule)->IsSetMatch_name() ) {
405 const string & depend_field_name = (*depend_rule)->GetMatch_name();
407 if( ! p_depend_field ) {
417 bool is_invert_match = (*depend_rule)->IsSetInvert_match() && (*depend_rule)->GetInvert_match();
418 bool does_match_rule_expression = (*depend_rule)->DoesStringMatchRuleExpression(
value);
419 if ( is_invert_match != does_match_rule_expression) {
421 if ((*depend_rule)->IsSetOther_fields()) {
424 const string & other_field_name = (*other_rule)->GetField_name();
426 if( ! p_other_field ) {
428 if ((*other_rule)->IsSetRequired() && (*other_rule)->GetRequired()) {
429 errors.push_back(
TError((*other_rule)->GetSeverity(),
430 "Required field " + (*other_rule)->GetField_name() +
" is missing when "
431 + depend_field_name +
" has value '" +
value +
"'"));
436 string other_value =
"";
442 if (!(*other_rule)->DoesStringMatchRuleExpression(other_value)) {
444 errors.push_back(
TError((*other_rule)->GetSeverity(),
445 other_value +
" is not a valid value for " + other_field_name
446 +
" when " + depend_field_name +
" has value '" +
value +
"'"));
450 if ((*depend_rule)->IsSetDisallowed_fields()) {
452 if( (*other_rule)->IsSetField_name() ) {
453 const string & other_field_name = (*other_rule)->GetField_name();
455 errors.push_back(
TError((*other_rule)->GetSeverity(),
456 other_field_name +
" is not a valid field name when " + depend_field_name +
" has value '" +
value +
"'"));
473 bool any_change =
false;
474 CField_set::Tdata::const_iterator field_rule =
GetFields().
Get().begin();
475 CUser_object::TData::iterator unchecked_fields = user.
SetData().begin();
476 while (field_rule !=
GetFields().
Get().end() && unchecked_fields != user.
SetData().end()) {
477 CUser_object::TData::iterator field = unchecked_fields;
478 while (field != user.
SetData().end()) {
479 if ((*field)->IsSetLabel()
480 && (*field)->GetLabel().IsStr()) {
481 string label = (*field)->GetLabel().GetStr();
484 if (field == user.
SetData().begin()) {
490 new_field->
Assign(**field);
493 unchecked_fields = user.
SetData().begin();
495 field = unchecked_fields;
502 if (*field == user.
SetData().back()) {
507 new_field->
Assign(**field);
509 user.
SetData().push_back(new_field);
510 unchecked_fields = user.
SetData().begin();
511 field = unchecked_fields;
516 if (field == unchecked_fields) {
522 new_field->
Assign(**field);
524 user.
SetData().insert(unchecked_fields, new_field);
525 unchecked_fields = user.
SetData().begin();
526 field = unchecked_fields;
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
@ eNocase
Case insensitive compare.
static const char label[]
const TStr & GetStr(void) const
Get the variant data.
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetType(void) const
type of object within class Check if a value has been assigned to Type data member.
const TData & GetData(void) const
Get the Data member data.
bool IsInt(void) const
Check if variant Int is selected.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetLabel(void) const
field label Check if a value has been assigned to Label data member.
TData & SetData(void)
Assign a value to Data data member.
const TStr & GetStr(void) const
Get the variant data.
TInt GetInt(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TLabel & GetLabel(void) const
Get the Label member data.
const TType & GetType(void) const
Get the Type member data.
vector< CRef< CUser_field > > TData
TId GetId(void) const
Get the variant data.
const TYPE & Get(const CNamedParameterList *param)
const GenericPointer< typename T::ValueType > T2 value
Generic utility macros and templates for exploring NCBI objects.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...