FormatAnnotation(3)

FormatAnnotation(3) Library Functions Manual FormatAnnotation(3)

NAME

FormatAnnotation - The FormatAnnotation class.

SYNOPSIS

#include <FormatAnnotation.h>

Public Member Functions


FormatAnnotation (const std::shared_ptr< MLBookProc > &mlbp)
FormatAnnotation constructor. void removeEscapeSequences (std::string &annotation)
Removes escape sequences from annotation. void replaceTags (std::string &annotation)
Replaces XML tags. void finalCleaning (std::string &annotation)
Cleans some sequences from annotation. void removeAllTags (std::string &annotation)
Simply removes all XML tags. void setTagReplacementTable (const std::vector< ReplaceTagItem > &replacement_table, const std::vector< std::tuple< std::string, std::string > > &symbols_replacement)
Sets tag replacement table.

Detailed Description

The FormatAnnotation class.

This class contains methods for annotation processing.

Constructor & Destructor Documentation

FormatAnnotation::FormatAnnotation (const std::shared_ptr< MLBookProc > & mlbp)

FormatAnnotation constructor.

Parameters

mlbp Smart pointer to MLBookProc object.

Member Function Documentation

void FormatAnnotation::finalCleaning (std::string & annotation)

Cleans some sequences from annotation. Replaces "three spaces" by "two spaces" at the annotation beginning, removes "\n" from annotation beginning, removes 0 - 32 ASCII symbols from the annotation end. Also replaces "\n\n\n" sequences by "\n\n" in whole annotation.

Parameters

annotation UTF-8 annotation content string.

void FormatAnnotation::removeAllTags (std::string & annotation)

Simply removes all XML tags. In case of errors, this method does nothing.

Parameters

annotation UTF-8 annotation content string.

void FormatAnnotation::removeEscapeSequences (std::string & annotation)

Removes escape sequences from annotation. Removes ASCII symbols 0 to 31 (inclusive) from annotation. Only exception is symbol 9 (horizontal tab). It will be replaced by 32 (space). Also removes extra spaces from annotation beginning.

Parameters

annotation UTF-8 annotation content string.

void FormatAnnotation::replaceTags (std::string & annotation)

Replaces XML tags. It is highly recommended to call setTagReplacementTable() method before this method call (but it is not compulsory). If tag replacement table is empty, all tags will be just removed. In case of errors, this method does nothing.

Parameters

annotation UTF-8 annotation content string.

void FormatAnnotation::setTagReplacementTable (const std::vector< ReplaceTagItem > & replacement_table, const std::vector< std::tuple< std::string, std::string > > & symbols_replacement)

Sets tag replacement table. If you need to replace XML tags by your own tags or text, you should call this method before replaceTags() call to set replacement table.

Parameters

replacement_table vector containing ReplaceTagItem objects.
symbols_replacement Vector of tuples. First element of tuple is string to be replaced in tag content, second element is replacement string.

Author

Generated automatically by Doxygen for MLBookProc from the source code.

Version 2.1 MLBookProc