NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CRegexp_loc Class Reference

Search Toolkit Book for CRegexp_loc

Class used to convert a PCRE match to a char* sequence into a CSeq_loc. More...

#include <algo/sequence/regexp_loc.hpp>

Public Member Functions

 CRegexp_loc (const string &pat, CRegexp::TCompile flags=0)
 Constructor for CRegexp_loc. More...
 
virtual ~CRegexp_loc ()
 
void Set (const string &pat, CRegexp::TCompile flags=0)
 Sets PCRE pattern. More...
 
TSeqPos GetLoc (const char *seq, CSeq_loc *loc, TSeqPos offset=0, CRegexp::TMatch flags=0)
 Gets a CSeq_loc for PCRE match to char* sequence. More...
 

Private Member Functions

 CRegexp_loc (const CRegexp_loc &)
 
void operator= (const CRegexp_loc &)
 

Private Attributes

unique_ptr< CRegexpm_regexp
 PCRE used to match against char* sequence passed as argument to GetLoc. More...
 

Detailed Description

Class used to convert a PCRE match to a char* sequence into a CSeq_loc.

Definition at line 54 of file regexp_loc.hpp.

Constructor & Destructor Documentation

◆ CRegexp_loc() [1/2]

CRegexp_loc::CRegexp_loc ( const string pat,
CRegexp::TCompile  flags = 0 
)

Constructor for CRegexp_loc.

Compiles the Perl Compatible Regular Expression (PCRE) pat, and sets compiled pattern options. See CRegexp.hpp for more information.

Definition at line 38 of file regexp_loc.cpp.

◆ ~CRegexp_loc()

CRegexp_loc::~CRegexp_loc ( )
virtual

Definition at line 43 of file regexp_loc.cpp.

◆ CRegexp_loc() [2/2]

CRegexp_loc::CRegexp_loc ( const CRegexp_loc )
private

Member Function Documentation

◆ GetLoc()

TSeqPos CRegexp_loc::GetLoc ( const char *  seq,
CSeq_loc loc,
TSeqPos  offset = 0,
CRegexp::TMatch  flags = 0 
)

Gets a CSeq_loc for PCRE match to char* sequence.

Gets a CSeq_loc (loc) of match between currently set regular expression and seq. Returned loc is of type CPacked_seqint. The first CSeq_interval in the CPacked_seqint is the overall match. Subsequent CSeq_intervals are matches to sub-patterns. Begins search of seq at 0 based offset. Returns 0 based position of first character in seq of match. If no match found, returns kInvalidSeqPos and loc is set to an empty packed-int type CSeq_loc. See CRegexp.hpp for information about flags.

Definition at line 52 of file regexp_loc.cpp.

References flags, i, kInvalidSeqPos, m_regexp, offset, CPacked_seqint_Base::Set(), CSeq_loc::SetPacked_int(), and si.

Referenced by GetLoc().

◆ operator=()

void CRegexp_loc::operator= ( const CRegexp_loc )
private

◆ Set()

void CRegexp_loc::Set ( const string pat,
CRegexp::TCompile  flags = 0 
)

Sets PCRE pattern.

Sets and compiles Perl Compatible Regular Expression (PCRE) pat, and sets compiled pattern options. See CRegexp.hpp for more information.

Definition at line 47 of file regexp_loc.cpp.

References flags, and m_regexp.

Member Data Documentation

◆ m_regexp

unique_ptr<CRegexp> CRegexp_loc::m_regexp
private

PCRE used to match against char* sequence passed as argument to GetLoc.

Definition at line 93 of file regexp_loc.hpp.

Referenced by GetLoc(), and Set().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:03 2024 by modify_doxy.py rev. 669887