#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 | |
char *const | global_defaultlocale = "default" |
|
|
|
ACCEPTONCE = never overwrite existing data, tags with same name but with locale do not match returns REJECTED_FULL if data is already set
|
|
SINGLE = data ends at end of line |
|
|
|
NORMAL = just append locale to endtag |
|
Constructor
|
|
if REJECTED_NOENDTAG is returned, stream and parser are in an undefined state |
|
clears only data, not behavior nor tag names |
|
compare tagname with str2 ignoring locale |
|
|
|
|
|
|
|
|
|
return end position of data in stream |
|
return start position of data in stream |
|
|
|
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
|
|
set Encoding, currently unused
|
|
define an end tag
|
|
set the preferred tag locale e.g de_DE.
|
|
if type == ACCEPTLOCALEONLY then _defaultlocale is set to "default", use setDefaultLocale to change that |
|
the actual data for a SINGLE type |
|
|
|
normally "default", see setDefaultLocale |
|
|
|
end position of data in stream |
|
name of the endtag |
|
|
|
which locale is currently stored |
|
|
|
the actual data for a MULTI type |
|
name of the tag |
|
which locale is to be preferred, e.g. DE |
|
which locale is to be preferred, e.g. de |
|
starting position of data in stream |
|
|
|
|