strusAnalyzer  0.17
Public Member Functions | List of all members
strus::SegmenterMarkupContextInterface Class Referenceabstract

Defines the context for inserting markups into one document. More...

#include <segmenterMarkupContextInterface.hpp>

Public Member Functions

virtual ~SegmenterMarkupContextInterface ()
 Destructor. More...
 
virtual bool getNext (SegmenterPosition &segpos, const char *&segment, std::size_t &segmentsize)=0
 Get the next content segment. More...
 
virtual unsigned int segmentSize (const SegmenterPosition &segpos)=0
 Get the size in bytes of a segment converted to UTF-8. More...
 
virtual std::string tagName (const SegmenterPosition &segpos) const =0
 Get the (tag) name of a segment specified by its position in the original source. More...
 
virtual int tagLevel (const SegmenterPosition &segpos) const =0
 Get the (tag) hierarchy level of a segment specified by its position in the original source. More...
 
virtual void putOpenTag (const SegmenterPosition &segpos, std::size_t ofs, const std::string &name)=0
 Define an open tag markup in the text. More...
 
virtual void putAttribute (const SegmenterPosition &segpos, std::size_t ofs, const std::string &name, const std::string &value)=0
 Define an attribute markup in the text. More...
 
virtual void putCloseTag (const SegmenterPosition &segpos, std::size_t ofs, const std::string &name)=0
 Define a close tag markup in the text. More...
 
virtual std::string getContent () const =0
 Get the original document content with all markups declared inserted. More...
 

Detailed Description

Defines the context for inserting markups into one document.

Constructor & Destructor Documentation

virtual strus::SegmenterMarkupContextInterface::~SegmenterMarkupContextInterface ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual std::string strus::SegmenterMarkupContextInterface::getContent ( ) const
pure virtual

Get the original document content with all markups declared inserted.

Returns
the marked up document content
virtual bool strus::SegmenterMarkupContextInterface::getNext ( SegmenterPosition segpos,
const char *&  segment,
std::size_t &  segmentsize 
)
pure virtual

Get the next content segment.

Parameters
[out]segpossegment position returned
[out]segmentpointer to start of segment
[out]segmentsizesize of segment in bytes
Returns
true, on success, false on eof or error
Note
this method allows to iterate on content segments for implementing markups covering multiple content segments
virtual void strus::SegmenterMarkupContextInterface::putAttribute ( const SegmenterPosition segpos,
std::size_t  ofs,
const std::string &  name,
const std::string &  value 
)
pure virtual

Define an attribute markup in the text.

Parameters
[in]segpossegment position
[in]ofsoffset ot the attribute in the text
[in]namename of the attribute to insert (as UTF-8)
[in]valueof the attribute to insert (as UTF-8)
virtual void strus::SegmenterMarkupContextInterface::putCloseTag ( const SegmenterPosition segpos,
std::size_t  ofs,
const std::string &  name 
)
pure virtual

Define a close tag markup in the text.

Parameters
[in]segpossegment position returned by the method getNext of the segmenter context created by the same instance as this and fed with the same content
[in]ofsbyte position offset of the parsed content (UTF-8) in the segment where we want to insert the markup into
[in]nametag name closed to put as markup into the content (as UTF-8)
virtual void strus::SegmenterMarkupContextInterface::putOpenTag ( const SegmenterPosition segpos,
std::size_t  ofs,
const std::string &  name 
)
pure virtual

Define an open tag markup in the text.

Parameters
[in]segpossegment position returned by the method getNext of the segmenter context created by the same instance as this and fed with the same content
[in]ofsbyte position offset of the parsed content (UTF-8) in the segment where we want to insert the markup into
[in]nametag name to put as markup into the content (as UTF-8)
virtual unsigned int strus::SegmenterMarkupContextInterface::segmentSize ( const SegmenterPosition segpos)
pure virtual

Get the size in bytes of a segment converted to UTF-8.

Parameters
[in]segpossegment position
Returns
the size of the segment as UTF-8 in bytes
virtual int strus::SegmenterMarkupContextInterface::tagLevel ( const SegmenterPosition segpos) const
pure virtual

Get the (tag) hierarchy level of a segment specified by its position in the original source.

Parameters
[in]segpossegment position
Returns
the (tag) hierarchy level of the segment
virtual std::string strus::SegmenterMarkupContextInterface::tagName ( const SegmenterPosition segpos) const
pure virtual

Get the (tag) name of a segment specified by its position in the original source.

Parameters
[in]segpossegment position
Returns
the (tag) name of the segment

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