#include <CommonPkdParser.h>
Public Types | |
| enum | assignstatus { ACCEPTED, REJECTED_NOMATCH, REJECTED_FULL, REJECTED_NOENDTAG } |
| enum | assigntype { ACCEPTONCE, ACCEPTPREFERREDLOCALE, ACCEPTLOCALEONLY } |
| enum | datatype { SINGLE, MULTI } |
| enum | endtagtype { ENDTAG_NORMAL, ENDTAG_COMPLETELYREVERSED } |
| enum | encodingtype { LATIN1, LATIN2, UTF8 } |
Public Member Functions | |
| Tag (const std::string &name, assigntype type=ACCEPTONCE) | |
| const std::string & | Name () const |
| const std::string & | Data () const |
| const std::list < std::string > & | MultiData () const |
| bool | operator== (const Tag &t2) |
| void | setType (assigntype type) |
| void | setEncoding (encodingtype etype) |
| void | setDefaultLocale (const std::string &defaultlocale) |
| void | setPreferredLocale (const std::string &preflocale) |
| void | setEndTag (const std::string &endtag, endtagtype etype=ENDTAG_NORMAL) |
| void | clear () |
| assignstatus | assign (const std::string &starttag, TagParser &parser, std::istream &istr) |
| std::streamoff | posDataStart () |
| std::streamoff | posDataEnd () |
| void | print (std::ostream &os) |
Private Member Functions | |
| bool | comparebeforedot (const std::string &str2) |
Private Attributes | |
| std::string | _name |
| std::string | _endtag |
| std::streamoff | _startpos |
| std::streamoff | _endpos |
| std::string | _data |
| std::list< std::string > | _multidata |
| std::string | _prefmainlocale |
| std::string | _prefsublocale |
| std::string | _lastmainlocale |
| std::string | _lastsublocale |
| assigntype | _type |
| std::string | _defaultlocale |
| datatype | _datatype |
| endtagtype | _endtagtype |
| encodingtype | _encodingtype |
Static Private Attributes | |
| static char *const | global_defaultlocale |
ACCEPTONCE = never overwrite existing data, tags with same name but with locale do not match returns REJECTED_FULL if data is already set
ACCEPTPREFERREDLOCALE = overwrite data only if tag has an additional preferred locale
ACCEPTLOCALEONLY = match only tags which have a locale
| CommonPkdParser::Tag::Tag | ( | const std::string & | name, | |
| assigntype | type = ACCEPTONCE | |||
| ) | [inline] |
Constructor
| name | Name of Tag | |
| type | how to handle multiple assignments of the same tag |
| bool CommonPkdParser::Tag::comparebeforedot | ( | const std::string & | str2 | ) | [private] |
compare tagname with str2 ignoring locale
| const std::string& CommonPkdParser::Tag::Name | ( | ) | const [inline] |
| const std::string& CommonPkdParser::Tag::Data | ( | ) | const [inline] |
| const std::list<std::string>& CommonPkdParser::Tag::MultiData | ( | ) | const [inline] |
| bool CommonPkdParser::Tag::operator== | ( | const Tag & | t2 | ) | [inline] |
| void CommonPkdParser::Tag::setType | ( | assigntype | type | ) | [inline] |
if type == ACCEPTLOCALEONLY then _defaultlocale is set to "default", use setDefaultLocale to change that
| void CommonPkdParser::Tag::setEncoding | ( | encodingtype | etype | ) | [inline] |
set Encoding, currently unused
| etype | encoding to use |
| void CommonPkdParser::Tag::setDefaultLocale | ( | const std::string & | defaultlocale | ) | [inline] |
set which locale to use if tag is available in multiple languages but no tag without locale is available (this is the case e.g in selections and YOU Patches). _ (like in de_DE) is not considered here so use two letter locales or "default"/"C" only
| defaultlocale | locale to use |
| void CommonPkdParser::Tag::setPreferredLocale | ( | const std::string & | preflocale | ) |
set the preferred tag locale e.g de_DE.
| preflocale | locale to use |
| void CommonPkdParser::Tag::setEndTag | ( | const std::string & | endtag, | |
| endtagtype | etype = ENDTAG_NORMAL | |||
| ) |
define an end tag
| endtag | which end tag to set or an empty string to undefine it | |
| etype | type of endtag, default is normal which means reversed plus probably added locale |
| void CommonPkdParser::Tag::clear | ( | ) | [inline] |
clears only data, not behavior nor tag names
| assignstatus CommonPkdParser::Tag::assign | ( | const std::string & | starttag, | |
| TagParser & | parser, | |||
| std::istream & | istr | |||
| ) |
if REJECTED_NOENDTAG is returned, stream and parser are in an undefined state
| std::streamoff CommonPkdParser::Tag::posDataStart | ( | ) | [inline] |
return start position of data in stream
| std::streamoff CommonPkdParser::Tag::posDataEnd | ( | ) | [inline] |
return end position of data in stream
| void CommonPkdParser::Tag::print | ( | std::ostream & | os | ) | [inline] |
std::string CommonPkdParser::Tag::_name [private] |
name of the tag
std::string CommonPkdParser::Tag::_endtag [private] |
name of the endtag
std::streamoff CommonPkdParser::Tag::_startpos [private] |
starting position of data in stream
std::streamoff CommonPkdParser::Tag::_endpos [private] |
end position of data in stream
std::string CommonPkdParser::Tag::_data [private] |
the actual data for a SINGLE type
std::list<std::string> CommonPkdParser::Tag::_multidata [private] |
the actual data for a MULTI type
std::string CommonPkdParser::Tag::_prefmainlocale [private] |
which locale is to be preferred, e.g. DE
std::string CommonPkdParser::Tag::_prefsublocale [private] |
which locale is to be preferred, e.g. de
std::string CommonPkdParser::Tag::_lastmainlocale [private] |
which locale is currently stored
std::string CommonPkdParser::Tag::_lastsublocale [private] |
assigntype CommonPkdParser::Tag::_type [private] |
std::string CommonPkdParser::Tag::_defaultlocale [private] |
normally "default", see setDefaultLocale
datatype CommonPkdParser::Tag::_datatype [private] |
endtagtype CommonPkdParser::Tag::_endtagtype [private] |
char* const CommonPkdParser::Tag::global_defaultlocale [static, private] |
1.5.3