zypp::parser::TagParser Class Reference

Basic SUSEtags parser. More...

#include <TagParser.h>

Inheritance diagram for zypp::parser::TagParser:
[legend]

List of all members.

Public Types

typedef shared_ptr
< SingleTag
SingleTagPtr
typedef shared_ptr
< MultiTag
MultiTagPtr

Public Member Functions

 TagParser ()
 Default ctor.
virtual ~TagParser ()
 Dtor.
virtual void parse (const InputStream &input_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
 Parse the stream.

Protected Member Functions

virtual void beginParse ()
 Called when start parsing.
virtual void consume (const SingleTagPtr &tag_r)
 Called when a single-tag is found.
virtual void consume (const MultiTagPtr &tag_r)
 Called when a multi-tag is found.
virtual void endParse ()
 Called when the parse is done.
virtual void userRequestedAbort (unsigned lineNo_r)
 Called when user(callback) request to abort.
std::string errPrefix (unsigned lineNo_r, const std::string &msg_r=std::string()) const
 Prefix exception message with line and tag information.
std::string errPrefix (const SingleTagPtr &tag_r, const std::string &msg_r=std::string()) const
 Prefix exception message with line and tag information.
std::string errPrefix (const MultiTagPtr &tag_r, const std::string &msg_r=std::string()) const
 Prefix exception message with line and tag information.
const std::string & inputname () const
 Name of the current InputStream.

Private Attributes

std::string _inputname

Classes

struct  MultiTag
struct  SingleTag
struct  Tag


Detailed Description

Basic SUSEtags parser.

Will replace parser/tagfile/ and parser/taggedfile/ stuff.

Definition at line 39 of file TagParser.h.


Member Typedef Documentation

typedef shared_ptr<SingleTag> zypp::parser::TagParser::SingleTagPtr

Definition at line 76 of file TagParser.h.

typedef shared_ptr<MultiTag> zypp::parser::TagParser::MultiTagPtr

Definition at line 77 of file TagParser.h.


Constructor & Destructor Documentation

zypp::parser::TagParser::TagParser (  ) 

Default ctor.

Definition at line 78 of file TagParser.cc.

zypp::parser::TagParser::~TagParser (  )  [virtual]

Dtor.

Definition at line 86 of file TagParser.cc.


Member Function Documentation

void zypp::parser::TagParser::parse ( const InputStream input_r,
const ProgressData::ReceiverFnc fnc_r = ProgressData::ReceiverFnc() 
) [virtual]

Parse the stream.

Exceptions:
ParseException on errors.
AbortRequestException on user request. Invokes consume for each tag. consume might throw other exceptions as well.

Definition at line 199 of file TagParser.cc.

References _inputname, beginParse(), consume(), endParse(), errPrefix(), zypp::str::hasPrefix(), zypp::parser::helperParseStartTag(), zypp::iostr::EachLine::lineNo(), zypp::iostr::EachLine::lineStart(), zypp::makeProgressData(), MIL, zypp::InputStream::name(), zypp::iostr::EachLine::next(), zypp::ProgressData::sendTo(), zypp::ProgressData::set(), zypp::InputStream::stream(), ticks, zypp::ProgressData::toMax(), zypp::ProgressData::toMin(), userRequestedAbort(), and ZYPP_THROW.

Referenced by zypp::parser::susetags::RepoParser::Impl::parse(), and zypp::parser::susetags::RepoParser::Impl::parseLocaleIf().

void zypp::parser::TagParser::beginParse (  )  [protected, virtual]

Called when start parsing.

Reimplemented in zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesLangFileReader, and zypp::parser::susetags::PatternFileReader.

Definition at line 89 of file TagParser.cc.

Referenced by parse().

void zypp::parser::TagParser::consume ( const SingleTagPtr tag_r  )  [protected, virtual]

Called when a single-tag is found.

Reimplemented in zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesLangFileReader, zypp::parser::susetags::PackagesLangFileReader, zypp::parser::susetags::PatternFileReader, and zypp::parser::susetags::PatternFileReader.

Definition at line 91 of file TagParser.cc.

Referenced by parse().

virtual void zypp::parser::TagParser::consume ( const MultiTagPtr tag_r  )  [protected, virtual]

Called when a multi-tag is found.

Reimplemented in zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesLangFileReader, zypp::parser::susetags::PackagesLangFileReader, zypp::parser::susetags::PatternFileReader, and zypp::parser::susetags::PatternFileReader.

void zypp::parser::TagParser::endParse (  )  [protected, virtual]

Called when the parse is done.

Reimplemented in zypp::parser::susetags::PackagesDuFileReader, zypp::parser::susetags::PackagesFileReader, zypp::parser::susetags::PackagesLangFileReader, and zypp::parser::susetags::PatternFileReader.

Definition at line 95 of file TagParser.cc.

Referenced by parse().

void zypp::parser::TagParser::userRequestedAbort ( unsigned  lineNo_r  )  [protected, virtual]

Called when user(callback) request to abort.

Exceptions:
AbortRequestException unless overloaded.

Definition at line 98 of file TagParser.cc.

References errPrefix(), and ZYPP_THROW.

Referenced by parse().

std::string zypp::parser::TagParser::errPrefix ( unsigned  lineNo_r,
const std::string &  msg_r = std::string() 
) const [protected]

Prefix exception message with line and tag information.

Definition at line 106 of file TagParser.cc.

References _inputname, and zypp::str::form().

Referenced by zypp::parser::susetags::PatternFileReader::consume(), zypp::parser::susetags::PackagesLangFileReader::consume(), zypp::parser::susetags::PackagesFileReader::consume(), zypp::parser::susetags::PackagesDuFileReader::consume(), zypp::parser::susetags::FileReaderBase::BaseImpl::error(), parse(), and userRequestedAbort().

std::string zypp::parser::TagParser::errPrefix ( const SingleTagPtr tag_r,
const std::string &  msg_r = std::string() 
) const [protected]

Prefix exception message with line and tag information.

Definition at line 115 of file TagParser.cc.

References _inputname, and zypp::str::form().

std::string zypp::parser::TagParser::errPrefix ( const MultiTagPtr tag_r,
const std::string &  msg_r = std::string() 
) const [protected]

Prefix exception message with line and tag information.

const std::string& zypp::parser::TagParser::inputname (  )  const [inline, protected]

Name of the current InputStream.

Definition at line 120 of file TagParser.h.

References _inputname.


Member Data Documentation

std::string zypp::parser::TagParser::_inputname [private]

Definition at line 124 of file TagParser.h.

Referenced by errPrefix(), inputname(), and parse().


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 19:23:22 2007 for libzypp by  doxygen 1.5.3