strusAnalyzer  0.17
Public Member Functions | List of all members
strus::PatternResultFormatMap Class Reference

Result format for the output of pattern match results with names of members as variables in curly brackets '{' '}'. More...

#include <pattern_resultformat.hpp>

Public Member Functions

 PatternResultFormatMap (const char *src_, ErrorBufferInterface *errorhnd_)
 Constructor. More...
 
 ~PatternResultFormatMap ()
 Destructor. More...
 
std::string map (const analyzer::PatternMatcherResult &res) const
 Map a result to a string in a format to be decoded with PatternResultFormatChunk::parseNext. More...
 

Detailed Description

Result format for the output of pattern match results with names of members as variables in curly brackets '{' '}'.

Constructor & Destructor Documentation

strus::PatternResultFormatMap::PatternResultFormatMap ( const char *  src_,
ErrorBufferInterface *  errorhnd_ 
)

Constructor.

Remarks
Does not throw, check error buffer passed for errors
Parameters
[in]src_source with format string with three parts separated by '|'. The first part is the format string for the result, the second part is the format string for the result items, the third part is the separator of result items if there are more than one. The format strings (first and second part) can contain some of the following variables to be substituted {ordpos}: ordinal (count) position {ordlen}: ordinal (count) length {ordend}: ordinal (count) end position, first position after the match {startseg}: position of the segment the match started {startpos}: offset of the match in the matching segment {endseg}: position of the segment the match ends (first byte after the match) {endpos}: bytes offset of the match in the matching segment {abspos}: startseg and startofs added together, if this makes sense {abslen}: absolute difference (endseg+endofs) - (startseg+startofs), if this makes sense {name}: name of the matched variable or pattern {value}: value of the matched variable or pattern, either defined by format string or the matching chunk from the original source encoded as PatternResultFormatChunk
[in]errorhnd_error buffer interface to report errors (to be checked after this constructor call)
strus::PatternResultFormatMap::~PatternResultFormatMap ( )

Destructor.

Member Function Documentation

std::string strus::PatternResultFormatMap::map ( const analyzer::PatternMatcherResult res) const

Map a result to a string in a format to be decoded with PatternResultFormatChunk::parseNext.

Parameters
[in]resresult to map
Returns
result of the mapping

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