The FormatAnnotation class. More...
#include <FormatAnnotation.h>
Public Member Functions | |
FormatAnnotation (const std::shared_ptr< AuxFunc > &af) | |
FormatAnnotation constructor. | |
void | remove_escape_sequences (std::string &annotation) |
Removes escape sequences from annotation. | |
void | replace_tags (std::string &annotation) |
Replaces XML tags. | |
void | final_cleaning (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) |
Sets tag replacement table. | |
The FormatAnnotation class.
This class contains different methods for annotation processing.
FormatAnnotation::FormatAnnotation | ( | const std::shared_ptr< AuxFunc > & | af | ) |
FormatAnnotation constructor.
af | smart pointer to AuxFunc object. |
void FormatAnnotation::final_cleaning | ( | 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.
annotation | UTF-8 annotation content string. |
void FormatAnnotation::remove_escape_sequences | ( | 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.
annotation | UTF-8 annotation content string. |
void FormatAnnotation::removeAllTags | ( | std::string & | annotation | ) |
Simply removes all XML tags.
annotation | UTF-8 annotation content string. |
void FormatAnnotation::replace_tags | ( | 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.
annotation | UTF-8 annotation content string. |
void FormatAnnotation::setTagReplacementTable | ( | const std::vector< ReplaceTagItem > & | replacement_table | ) |
Sets tag replacement table.
If you need to replace XML tags by your own tags or text, you should call this method before replace_tags() call to set replacement table.
replacement_table | vector containing ReplaceTagItem objects. |