A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/regexp__template__tester_8cpp_source.html below:

NCBI C++ ToolKit: src/util/xregexp/regexp_template_tester.cpp Source File

51 #define FILE_NAME(name) \ 52  (name.empty() ? string("(stream)"

) : name)

54 #define ERROR_FILE(errcode, message, file) \ 55  NCBI_THROW(CRegexpTemplateTesterException, errcode, \ 56  FILE_NAME(file) + " -- "

+ message)

58 #define ERROR_TEMPLATE(errcode, message) \ 59  NCBI_THROW(CRegexpTemplateTesterException, errcode, "\n"

+ \

60

FILE_NAME(m_FileName) + "(" + \

61

NStr::NumericToString(m_FileLineNum) + ")\n" + \

62

FILE_NAME(m_TemplateName) + "(" + \

63

NStr::NumericToString(m_TemplateLineNum) + ")\n-- " + \

79

m_CommentStart(

"//"

),

132  ERROR_TEMPLATE

(eVarNotFound,

string

(

"variable '"

) + name +

"' is not defined"

);

166  if

(!file_stm.good()) {

167  ERROR_FILE

(eOpenFile,

"cannot open file"

, file_path);

170  if

(!template_stm.good()) {

171  ERROR_FILE

(eOpenFile,

"cannot open file"

, template_path);

179  ERROR_TEMPLATE

(eMismatchLength,

"file/template length mismatch"

);

193  ERROR_TEMPLATE

(eMismatchLength,

"stream/template length mismatch"

);

214  if

(

str

==

"stop"

) {

250  ERROR_TEMPLATE

(eMismatchLength,

"file/template length mismatch"

);

267  bool

skip_empty =

false

;;

286  if

(!skip_empty || !

str

->empty()) {

307  if

( !re.

IsMatch

(file_line) ) {

354  if

(!

isalpha

((

unsigned char

)

str

[pos])) {

355  ERROR_TEMPLATE

(eVarErr,

"variable name should start with alphabetic symbol"

);

360

(

isalnum

((

unsigned char

)

str

[pos]) ||

str

[pos] ==

'-'

||

str

[pos] ==

'_'

) ) ++pos;

368  if

(start ==

NPOS

) {

372  bool

out_have_value =

false

;

376  if

(end ==

NPOS

|| end == start) {

377  ERROR_TEMPLATE

(eVarErr,

"cannot find closing tag for variable definition"

);

389  if

(inline_vars || (!inline_vars && eqpos ==

NPOS

)) {

393

out_have_value =

true

;

397  if

(eqpos ==

NPOS

) {

401

out_have_value =

true

;

408  if

( !

n

|| (inline_name.

length

() != eqpos)) {

412  if

(inline_val.

empty

()) {

413  ERROR_TEMPLATE

(eVarErr,

"variable definition cannot have empty value"

);

417  out

.append(

"("

+ s +

")"

);

418

out_have_value =

true

;

419

inline_vars->push_back(inline_name);

424  while

( start !=

NPOS

);

426  if

(

out

.empty() && !out_have_value) {

439 #define SKIP_SPACES \ 440  while (i < len && isspace((unsigned char)str[i])) ++i 454  string

name =

str

.substr(

i

,

n

);

456  if

(

str

[

i

] !=

'='

) {

460  ERROR_TEMPLATE

(eOpErr,

"SET: variable cannot have empty value"

);

508  string

sop =

str

.substr(pop, 2);

527

res = (op == eNotMatch);

533  ERROR_TEMPLATE

(eOpTest,

"TEST: result of comparison is FALSE: '"

+

554  if

(!template_stm.good()) {

599

op_name = op_str.

substr

(0, 5);

601  if

(

str

[

i

] ==

' '

) {

603

re_str =

str

.substr(

i

);

610

op_name = op_str.

substr

(0, 5);

612  if

(

str

[

i

] ==

' '

) {

614

re_str =

str

.substr(

i

);

621

op_num = NStr::StringToNumeric<SIZE_TYPE>(op_str);

632  if

(op == eWhile || op == eUntil) {

634  if

(re_str.

empty

()) {

635  ERROR_TEMPLATE

(eOpErr,

"SKIP: expected regular expression after '"

+

636

(

string

)op_name +

"'"

);

644  bool

matched =

false

;

651  if

(num_lines == op_num) {

669  if

(num_lines != op_num) {

676

(

string

)op_name +

" '"

+

701  case eVarErr

:

return "eVarErr"

;

703  case eOpErr

:

return "eOpErr"

;

704  case eOpTest

:

return "eOpTest"

;

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

container_type::const_iterator const_iterator

const_iterator end() const

const_iterator find(const key_type &key) const

std::ofstream out("events_result.xml")

main entry point for tests

static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)

static const char * str(char *buf, int n)

void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)

Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

TErrCode GetErrCode(void) const

virtual const char * GetErrCodeString(void) const

Get error code interpreted as text.

static string ConcatPath(const string &first, const string &second)

Concatenate two parts of the path for the current OS.

static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)

Split a path string into its basic components.

string m_EOLs

Lines delimiters.

virtual const char * GetErrCodeString(void) const override

CRegexpTemplateTesterException –.

void SetCommentStart(string &str)

Change string defining start of comments line in templates.

ESource

Processing source.

bool IsMatch(CTempString str, TMatch flags=fMatch_default)

Check existence substring which match a specified pattern.

CRegexpTemplateTester(TFlags flags=0)

Default constructor.

CTempString GetSub(CTempString str, size_t idx=0) const

Get pattern/subpattern from previous GetMatch().

string m_FileName

Current file name (if any)

EResult

The reason of stopping x_Compare(), if no error.

EResult x_Compare(istream &file_stream, istream &template_stream)

Main compare method, compare streams.

string GetVar(const string &name) const

SIZE_TYPE m_TemplateLineNum

Current template line number.

string m_OpStart

Start of the template command line.

void x_Op_Include(CTempString str, istream &file_stm)

void x_Reset(void)

Reset object state.

SIZE_TYPE x_ParseVarName(CTempString str, SIZE_TYPE pos) const

Parse/check variable name from string, return its length.

void SetVarScope(string &start, string &end)

Change strings defining start/end of variables.

SIZE_TYPE x_ParseVar(CTempString str, SIZE_TYPE pos) const

Parse variable from string, return its length.

void x_Op_Test(CTempString str)

void x_Op_Set(CTempString str)

bool m_ReprocessFileLine

TRUE if m_FileLine should be reprocessed with next template data line.

int NumFound() const

Get number of patterns + subpatterns.

void x_Op_Skip(CTempString str, istream &file_stm)

void Compare(const string &file_path, const string &template_path)

Compare file against template (file version).

string m_TemplateName

Current template name.

string m_FileLine

Currently processing file line.

string m_TemplateLine

Currently processing template line.

unsigned int TFlags

Binary OR of "EFlags".

string m_VarEnd

Variable definition end.

TVarMap m_Vars

Map of variables/values.

istream & x_GetLine(istream &is, ESource src)

Get line from the stream 'is'.

void SetCommandStart(string &str)

Change string defining start of template commands and operations.

string x_SubstituteVars(CTempString str, TVarList *inline_vars) const

Replace all variables in the string with corresponding values.

string m_CommentStart

Start of the comment line.

const TVarMap & GetVars(void) const

void PrintVar(const string &name) const

SIZE_TYPE m_FileLineNum

Current file/stream line number.

string m_VarStart

Variable definition start.

TFlags m_Flags

Processing flags.

void SetDelimiters(string &str)

Change delimiters string, used for comparing data and templates.

void x_Op_Echo(CTempString str)

void PrintVars(void) const

void x_CompareLines(CTempString file_line, CTempString template_line)

Process/compare lines.

@ eVarNotFound

variable not found

@ eOpTest

'test' operation return FALSE

@ eOpUnknown

unknown operation

@ eVarErr

variable definition error

@ eMismatchContent

file/template lines do not match

@ eMismatchLength

file/template line number mismatch

@ eOpenFile

file open error

@ eOpErr

operation definition error

@ eFile

source file/stream

@ fSkipEmptySourceLines

Skip empty lines in the source.

@ fSkipEmptyTemplateLines

Skip empty lines in the template.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

CNcbiIstream & NcbiGetline(CNcbiIstream &is, string &str, char delim, string::size_type *count=NULL)

Read from "is" to "str" up to the delimiter symbol "delim" (or EOF)

IO_PREFIX::ifstream CNcbiIfstream

Portable alias for ifstream.

NCBI_NS_STD::string::size_type SIZE_TYPE

static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)

Get a printable version of the specified string.

static CTempString TruncateSpaces_Unsafe(const CTempString str, ETrunc where=eTrunc_Both)

Truncate whitespace in a 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.

bool empty(void) const

Return true if the represented string is empty (i.e., the length is zero)

static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)

Check if a string starts with a specified prefix value.

size_type length(void) const

Return the length of the represented array.

CTempString substr(size_type pos) const

Obtain a substring from this string, beginning at a given offset.

static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)

Convert numeric value to string.

size_type find(const CTempString match, size_type pos=0) const

Find the first instance of the entire matching string within the current string, beginning at an opti...

static int CompareCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-sensitive compare of a substring with another string.

const GenericPointer< typename T::ValueType > T2 value

Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...

#define ERROR_FILE(errcode, message, file)

#define ERROR_TEMPLATE(errcode, message)

Regexp template tester based on the Perl Compatible Regular Expression (pcre) library.

C++ wrappers for the Perl-compatible regular expression (PCRE) library.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4