25 #undef ZYPP_BASE_LOGGER_LOGGROUP
26 #define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
69 bool setFileCheckSum( std::map<std::string, CheckSum> & map_r,
const std::string & value )
const
72 std::vector<std::string> words;
73 if (
str::split( value, std::back_inserter( words ) ) == 3 )
75 map_r[words[2]] =
CheckSum( words[0], words[1] );
124 _pimpl->repoindex().descrdir =
"suse/setup/descr";
125 _pimpl->repoindex().datadir =
"suse";
136 if (
_pimpl->hasRepoIndex() )
142 MIL <<
"[Content]" << endl;
162 const std::string & msg_r,
163 const std::string & line_r )
const
166 _pimpl->_inputname.c_str(),
180 MIL <<
"Start parsing content repoindex" << input_r << endl;
183 std::ostringstream s;
184 s <<
"Can't read bad stream: " << input_r;
192 if ( ! ticks.
toMin() )
196 for( ; line; line.
next() )
199 std::string value( *line );
202 if ( key.empty() || *key.c_str() ==
'#' )
208 std::string modifier;
210 if ( pos != std::string::npos )
212 modifier = key.substr( pos+1 );
219 else if ( key ==
"DESCRDIR" )
221 _pimpl->repoindex().descrdir = value;
223 else if ( key ==
"DATADIR" )
225 _pimpl->repoindex().datadir = value;
227 else if ( key ==
"KEY" )
229 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().signingKeys, value ) )
234 else if ( key ==
"META" )
236 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().metaFileChecksums, value ) )
241 else if ( key ==
"HASH" )
243 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().mediaFileChecksums, value ) )
254 if ( ! ticks.
set( input_r.
stream().tellg() ) )
261 if ( ! ticks.
toMax() )
265 MIL <<
"Done parsing " << input_r << endl;
ProgressData makeProgressData(const InputStream &input_r)
bool setFileCheckSum(std::map< std::string, CheckSum > &map_r, const std::string &value) const
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
bool next()
Advance to next line.
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
ContentFileReader implementation.
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
bool toMax()
Set counter value to current max value (unless no range).
unsigned lineNo() const
Return the current line number.
Simple lineparser: Traverse each line in a file.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
std::string errPrefix(unsigned lineNo_r, const std::string &msg_r=std::string(), const std::string &line_r="-") const
Prefix exception message with line information.
virtual void userRequestedAbort(unsigned lineNo_r)
Called when user(callback) request to abort.
bool hasRepoIndex() const
bool toMin()
Set counter value to current min value.
RepoIndex_Ptr handoutRepoIndex()
std::string stripFirstWord(std::string &line, const bool ltrim_first)
RepoIndexConsumer _repoIndexConsumer
Parse repoindex part from a content file.
Maintain [min,max] and counter (value) for progress counting.
virtual void beginParse()
Called when start parsing.
std::string form(const char *format,...)
Printf style construction of std::string.
ContentFileReader()
Default ctor.
const ContentFileReader & _parent
virtual void endParse()
Called when the parse is done.
bool set(value_type val_r)
Set new counter value.
virtual ~ContentFileReader()
Dtor.
virtual void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
Parse the stream.
Impl(const ContentFileReader &parent_r)