53 return (!
str || *
str ==
'\0');
90 while ( (pos =
m_Pattern.find(
'\\')) != string::npos )
102 # ifdef NCBI_OS_MSWIN
104 while ( (pos = lstr.find(
'\\')) != string::npos )
109 if (pos == string::npos)
113 if ( !(pos > 2 && lstr.substr(pos-3, 3) ==
"src" ) &&
114 !(pos > 6 && lstr.substr(pos-7, 7) ==
"include" ) )
122 return (lstr.find(
'/', pos +
m_Pattern.size()) == string::npos);
136 string code, subcode;
144 string first, second;
146 if (!
first.empty() && !second.empty()) {
166 list<string>::iterator it_loc;
167 for (it_loc = loc.begin(); it_loc != loc.end(); ++it_loc) {
168 string first, second;
169 const string& sloc = *it_loc;
171 if (sloc[0] ==
'-') {
175 if (!
first.empty()) {
181 if (!second.empty()) {
184 pattern.push_back( make_pair(from,to) );
196 return pattern.empty();
206 if (c->first != c->second) {
207 out << c->first <<
'-' << c->second;
221 const char*
function)
const
296 : m_NotMatchersNum(0)
323 message <<
"Syntax error in string \"" << filter_string
325 << err_info.second <<
" - " << err_info.first << ends;
333 string new_filter =
m_Filter +
" " + filter_string;
334 Fill(new_filter.c_str());
366 if (!(*i)->IsErrCodeMatcher()) {
400 size_t not_matchers_processed = 0;
411 ++not_matchers_processed;
413 if (
int(sev) <
int((*i)->GetSeverity())) {
423 if (
int(sev) <
int((*i)->GetSeverity())) {
430 ++not_matchers_processed;
440 ++not_matchers_processed;
451 size_t not_matchers_processed = 0;
465 ++not_matchers_processed;
467 if (
int(sev) <
int((*i)->GetSeverity())) {
476 if (
int(sev) <
int((*i)->GetSeverity())) {
485 ++not_matchers_processed;
498 ++not_matchers_processed;
510 const char*
function,
513 size_t not_matchers_processed = 0;
527 ++not_matchers_processed;
529 if (
int(sev) <
int((*i)->GetSeverity()) ) {
538 if (
int(sev) <
int((*i)->GetSeverity()) ) {
547 ++not_matchers_processed;
560 ++not_matchers_processed;
574 out <<
"\tFilter " <<
count++ <<
" - ";
624 state = eExpectColon;
627 state = eExpectClosePar;
631 state = eExpectCloseBracket;
639 if (
isspace((
unsigned char) symbol) )
644 if ( !
isalpha((
unsigned char) symbol) && symbol !=
'_' )
651 if ( !
isspace((
unsigned char) symbol) ) {
652 if ( symbol ==
'[' ||
657 in.putback( symbol );
662 in.putback( symbol );
668 if(
isspace((
unsigned char) symbol) )
673 (
"wrong symbol, expected :",
m_Pos );
674 case eExpectClosePar :
675 if(
isspace((
unsigned char) symbol) )
679 if( symbol ==
'+' || symbol ==
'-' ||
681 isdigit((
unsigned char) symbol)) {
682 state = eInsideErrCode;
687 (
"wrong symbol, expected )",
m_Pos );
688 case eExpectCloseBracket:
692 if(
isspace((
unsigned char) symbol) )
697 if(
isalpha((
unsigned char) symbol) ||
698 isdigit((
unsigned char) symbol) || symbol ==
'_') {
702 in.putback( symbol );
706 if(
isspace((
unsigned char) symbol) )
711 if( symbol ==
'+' || symbol ==
'-' ||
712 symbol ==
'.' || symbol ==
',' ||
713 isdigit((
unsigned char) symbol)) {
726 (
"unexpected end of input, ':' expected",
m_Pos );
727 case eExpectClosePar :
729 (
"unexpected end of input, ')' expected",
m_Pos );
730 case eExpectCloseBracket:
732 (
"unexpected end of input, ']' expected",
m_Pos );
878 eGotModuleOrFunction,
911 state = eGotModuleOrFunction;
944 state = eGotModuleOrFunction;
971 state = eGotClassOrFunction;
978 case eGotModuleOrFunction :
981 state = eGotFunction;
1000 case eGotClassOrFunction :
1003 state = eGotFunction;
1020 state = eReadyForFunction;
1027 case eReadyForFunction :
1030 state = eGotFunction;
void Fill(const char *filter_string)
Fill the filter from a string.
EDiagFilterAction Check(const CNcbiDiag &msg, const CException *ex=NULL) const
Check if the filter accepts message.
void InsertNegativeMatcher(CDiagMatcher *matcher)
EDiagFilterAction x_CheckLocation(const char *module, const char *nclass, const char *function, EDiagSev sev) const
EDiagFilterAction x_CheckFile(const char *file, EDiagSev sev) const
Check if the filter accepts path.
deque< AutoPtr< CDiagMatcher > > TMatchers
EDiagFilterAction x_CheckErrCode(int code, int subcode, EDiagSev sev) const
Check if the filter accepts errcode.
void Append(const char *filter_string)
void Print(ostream &out) const
Print state.
void InsertMatcher(CDiagMatcher *matcher)
ESymbol Parse(istream &in)
const string & GetId() const
CDiagLexParser()
CDiagLexParser::
AutoPtr< CDiagStrMatcher > m_Module
AutoPtr< CDiagStrMatcher > m_Function
AutoPtr< CDiagStrMatcher > m_ErrCode
EDiagFilterAction MatchFile(const char *file) const
EDiagFilterAction Match(const char *module, const char *nclass, const char *function) const
void Print(ostream &out) const
void SetSeverity(EDiagSev sev)
EDiagFilterAction MatchErrCode(int code, int subcode) const
AutoPtr< CDiagStrMatcher > m_File
AutoPtr< CDiagStrMatcher > m_Class
EDiagFilterAction m_Action
virtual bool Match(const char *str) const
Return true if str is empty.
virtual void Print(ostream &out) const
CDiagStrErrCodeMatcher –.
static void x_Parse(TPattern &pattern, const string &str)
CDiagStrErrCodeMatcher(const string &pattern)
static bool x_Match(const TPattern &pattern, TCode code)
virtual bool Match(const char *str) const
Return true if str matches pattern str ::= errcode ':' subcode.
static void x_Print(const TPattern &pattern, ostream &out)
virtual void Print(ostream &out) const
vector< pair< TCode, TCode > > TPattern
virtual void Print(ostream &out) const =0
virtual ~CDiagStrMatcher()
virtual bool Match(const char *str) const =0
Return true if str matches for this object.
virtual void Print(ostream &out) const
virtual bool Match(const char *str) const
Return true if str is equal to pattern.
CDiagStrPathMatcher(const string &pattern)
virtual bool Match(const char *str) const
Return true if str is equal to pattern.
virtual void Print(ostream &out) const
CDiagSyntaxParser()
CDiagSyntaxParser::
EDiagSev x_GetDiagSeverity(const string &sev_str)
"Info", "Warning", etc converted to enum value Throws an excpetion if incorrect value passed
pair< const char *, int > TErrorInfo
AutoPtr< CDiagStrErrCodeMatcher > m_ErrCodeMatcher
void Parse(istream &in, CDiagFilter &to)
AutoPtr< CDiagStrMatcher > m_FileMatcher
static CDiagStrMatcher * x_CreateMatcher(const string &str)
void x_PutIntoFilter(CDiagFilter &to, EInto into)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * release(void)
Release will release ownership of pointer to caller.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
const string & GetModule(void) const
Get module name used for reporting.
const string & GetFile(void) const
Get file name used for reporting.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetClass(void) const
Get class name used for reporting.
const string & GetFunction(void) const
Get function name used for reporting.
const CException * GetPredecessor(void) const
Get "previous" exception from the backlog.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
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 string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Defines NCBI C++ diagnostic APIs, classes, and macros.
void s_PrintMatcher(ostream &out, const AutoPtr< CDiagStrMatcher > &matcher, const string &desc)
Defines NCBI C++ service classes and functions for diagnostic APIs, classes, and macros.
std::istream & in(std::istream &in_, double &x_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)