CommonPkdParser::Tag Class Reference

#include <CommonPkdParser.h>

List of all members.

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


Detailed Description

A Tag has a starttag, probably and endtag as well as data and the start and end positions in the stream

Member Enumeration Documentation

enum CommonPkdParser::Tag::assignstatus

Enumerator:
ACCEPTED 
REJECTED_NOMATCH 
REJECTED_FULL 
REJECTED_NOENDTAG 

enum CommonPkdParser::Tag::assigntype

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

See also:
setDefaultLocale
Enumerator:
ACCEPTONCE 
ACCEPTPREFERREDLOCALE 
ACCEPTLOCALEONLY 

enum CommonPkdParser::Tag::datatype

SINGLE = data ends at end of line
MULTI = data ends at special end tag

Enumerator:
SINGLE 
MULTI 

enum CommonPkdParser::Tag::endtagtype

NORMAL = just append locale to endtag
COMPLETELYREVERSED = prepend reversed locale

Enumerator:
ENDTAG_NORMAL 
ENDTAG_COMPLETELYREVERSED 

enum CommonPkdParser::Tag::encodingtype

Enumerator:
LATIN1 
LATIN2 
UTF8 


Constructor & Destructor Documentation

CommonPkdParser::Tag::Tag ( const std::string &  name,
assigntype  type = ACCEPTONCE 
) [inline]

Constructor

Parameters:
name Name of Tag
type how to handle multiple assignments of the same tag


Member Function Documentation

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

Parameters:
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

Parameters:
defaultlocale locale to use

void CommonPkdParser::Tag::setPreferredLocale ( const std::string &  preflocale  ) 

set the preferred tag locale e.g de_DE.

Parameters:
preflocale locale to use

void CommonPkdParser::Tag::setEndTag ( const std::string &  endtag,
endtagtype  etype = ENDTAG_NORMAL 
)

define an end tag

Parameters:
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]


Member Data Documentation

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]

encodingtype CommonPkdParser::Tag::_encodingtype [private]

char* const CommonPkdParser::Tag::global_defaultlocale [static, private]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 22:35:03 2007 for liby2util by  doxygen 1.5.3