Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

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

char *const  global_defaultlocale = "default"


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
 

Enumeration values:
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
Enumeration values:
ACCEPTONCE 
ACCEPTPREFERREDLOCALE 
ACCEPTLOCALEONLY 

enum CommonPkdParser::Tag::datatype
 

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

Enumeration values:
SINGLE 
MULTI 

enum CommonPkdParser::Tag::encodingtype
 

Enumeration values:
LATIN1 
LATIN2 
UTF8 

enum CommonPkdParser::Tag::endtagtype
 

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

Enumeration values:
ENDTAG_NORMAL 
ENDTAG_COMPLETELYREVERSED 


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

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

void CommonPkdParser::Tag::clear  )  [inline]
 

clears only data, not behavior nor tag names

bool CommonPkdParser::Tag::comparebeforedot const std::string &  str2  )  [private]
 

compare tagname with str2 ignoring locale

const std::string& CommonPkdParser::Tag::Data  )  const [inline]
 

const std::list<std::string>& CommonPkdParser::Tag::MultiData  )  const [inline]
 

const std::string& CommonPkdParser::Tag::Name  )  const [inline]
 

bool CommonPkdParser::Tag::operator== const Tag t2  )  [inline]
 

std::streamoff CommonPkdParser::Tag::posDataEnd  )  [inline]
 

return end position of data in stream

std::streamoff CommonPkdParser::Tag::posDataStart  )  [inline]
 

return start position of data in stream

void CommonPkdParser::Tag::print std::ostream &  os  )  [inline]
 

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::setEncoding encodingtype  etype  )  [inline]
 

set Encoding, currently unused

Parameters:
etype encoding 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::setPreferredLocale const std::string &  preflocale  ) 
 

set the preferred tag locale e.g de_DE.

Parameters:
preflocale locale to use

void CommonPkdParser::Tag::setType assigntype  type  )  [inline]
 

if type == ACCEPTLOCALEONLY then _defaultlocale is set to "default", use setDefaultLocale to change that


Member Data Documentation

std::string CommonPkdParser::Tag::_data [private]
 

the actual data for a SINGLE type

datatype CommonPkdParser::Tag::_datatype [private]
 

std::string CommonPkdParser::Tag::_defaultlocale [private]
 

normally "default", see setDefaultLocale

encodingtype CommonPkdParser::Tag::_encodingtype [private]
 

std::streamoff CommonPkdParser::Tag::_endpos [private]
 

end position of data in stream

std::string CommonPkdParser::Tag::_endtag [private]
 

name of the endtag

endtagtype CommonPkdParser::Tag::_endtagtype [private]
 

std::string CommonPkdParser::Tag::_lastmainlocale [private]
 

which locale is currently stored

std::string CommonPkdParser::Tag::_lastsublocale [private]
 

std::list<std::string> CommonPkdParser::Tag::_multidata [private]
 

the actual data for a MULTI type

std::string CommonPkdParser::Tag::_name [private]
 

name of the tag

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::streamoff CommonPkdParser::Tag::_startpos [private]
 

starting position of data in stream

assigntype CommonPkdParser::Tag::_type [private]
 

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


The documentation for this class was generated from the following files:
Generated on Thu Feb 23 23:56:11 2006 for liby2util by doxygen 1.3.6