fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::RegMatch Class Reference

A class to contain regex matches using RegExp. More...

#include <f8utils.hpp>

Public Member Functions

 RegMatch ()
 Ctor. More...
 
virtual ~RegMatch ()
 Ctor. More...
 
unsigned SubCnt () const
 
size_t SubSize (const int which=0) const
 
unsigned SubPos (const int which=0) const
 

Private Types

enum  { SubLimit_ = 32 }
 Maximum number of sub-expressions. More...
 

Private Attributes

regmatch_t subexprs_ [SubLimit_]
 
int subCnt_
 

Friends

class RegExp
 

Detailed Description

A class to contain regex matches using RegExp.

Definition at line 308 of file f8utils.hpp.

Member Enumeration Documentation

anonymous enum
private

Maximum number of sub-expressions.

Enumerator
SubLimit_ 

Definition at line 312 of file f8utils.hpp.

Constructor & Destructor Documentation

FIX8::RegMatch::RegMatch ( )
inline

Ctor.

Definition at line 321 of file f8utils.hpp.

323  : subexprs_(), subCnt_()
324 #endif
325  {}
regmatch_t subexprs_[SubLimit_]
Definition: f8utils.hpp:313
virtual FIX8::RegMatch::~RegMatch ( )
inlinevirtual

Ctor.

Definition at line 328 of file f8utils.hpp.

328 {}

Member Function Documentation

unsigned FIX8::RegMatch::SubCnt ( ) const
inline

Get the number of sub-expressions found.

Returns
number of sub-expression

Definition at line 332 of file f8utils.hpp.

References subCnt_.

Referenced by FIX8::RegExp::Erase(), FIX8::RegExp::Replace(), and FIX8::RegExp::SubExpr().

333  {
334 #if FIX8_REGEX_SYSTEM == FIX8_REGEX_REGEX_H
335  return subCnt_;
336 #elif FIX8_REGEX_SYSTEM == FIX8_REGEX_POCO
337  return static_cast<unsigned>(_matchVec.size());
338 #endif
339  }
unsigned FIX8::RegMatch::SubPos ( const int  which = 0) const
inline

Get the starting offset of the specified sub-expression.

Parameters
whichsub-expression index (0 based)
Returns
offset of the sub-expression, -1 if not found

Definition at line 356 of file f8utils.hpp.

Referenced by FIX8::RegExp::Erase(), FIX8::RegExp::Replace(), and FIX8::RegExp::SubExpr().

357  {
358 #if FIX8_REGEX_SYSTEM == FIX8_REGEX_REGEX_H
359  return which < subCnt_ ? subexprs_[which].rm_so : -1;
360 #elif FIX8_REGEX_SYSTEM == FIX8_REGEX_POCO
361  return which < static_cast<int>(_matchVec.size()) ? static_cast<int>(_matchVec[which].offset) : -1;
362 #endif
363  }
regmatch_t subexprs_[SubLimit_]
Definition: f8utils.hpp:313
size_t FIX8::RegMatch::SubSize ( const int  which = 0) const
inline

Get the size (length) of the specified sub-expression.

Parameters
whichsub-expression index (0 based)
Returns
size of sub-expression, -1 if not found

Definition at line 344 of file f8utils.hpp.

Referenced by FIX8::RegExp::Erase(), FIX8::RegExp::Replace(), and FIX8::RegExp::SubExpr().

345  {
346 #if FIX8_REGEX_SYSTEM == FIX8_REGEX_REGEX_H
347  return which < subCnt_ ? subexprs_[which].rm_eo - subexprs_[which].rm_so : -1;
348 #elif FIX8_REGEX_SYSTEM == FIX8_REGEX_POCO
349  return which < static_cast<int>(_matchVec.size()) ? _matchVec[which].length : -1;
350 #endif
351  }
regmatch_t subexprs_[SubLimit_]
Definition: f8utils.hpp:313

Friends And Related Function Documentation

friend class RegExp
friend

Definition at line 365 of file f8utils.hpp.

Member Data Documentation

int FIX8::RegMatch::subCnt_
private
regmatch_t FIX8::RegMatch::subexprs_[SubLimit_]
private

The documentation for this class was generated from the following file: