45 #include "validrules.inc"
64 string search = prefix;
98 return NStr::Compare(p1->GetField_name(), p2->GetField_name()) < 0;
108 if ( !
file.empty() ) {
109 unique_ptr<CObjectIStream>
in;
111 string header =
in->ReadFileHeader();
113 if (getenv(
"NCBI_DEBUG")) {
114 LOG_POST(
"Reading from " +
file +
" for structured comment rules.");
117 if (!s_CommentRules->IsSet()) {
118 if (getenv(
"NCBI_DEBUG")) {
119 LOG_POST(
"Falling back on built-in data for structured comment rules");
121 size_t num_lines =
sizeof (s_Defaultvalidrules) /
sizeof (
char *);
122 string all_rules =
"";
123 for (
size_t i = 0;
i < num_lines;
i++) {
124 all_rules += s_Defaultvalidrules[
i];
129 if (s_CommentRules->IsSet()) {
130 for(
auto& rule: s_CommentRules->Set()) {
131 if (!rule->GetRequire_order() && rule->IsSetFields()) {
138 return s_CommentRules;
151 vector<string> options;
163 options.push_back((*it)->GetField_name());
174 list<string> keywords;
187 if (errors.size() == 0) {
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define MSerial_AsnText
I/O stream manipulators –.
@ eSerial_AsnText
ASN.1 text.
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
std::istream & in(std::istream &in_, double &x_)
string g_FindDataFile(const CTempString &name, CDirEntry::EType type=CDirEntry::eFile)
Look for an NCBI application data file or directory of the given name and type; in general,...