18#include <zypp-core/base/UserRequestException>
19#include <zypp-core/parser/ParseException>
25#undef ZYPP_BASE_LOGGER_LOGGROUP
26#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
71 std::vector<std::string>
words;
122 _pimpl->repoindex().descrdir =
"suse/setup/descr";
123 _pimpl->repoindex().datadir =
"suse";
134 if (
_pimpl->hasRepoIndex() )
140 MIL <<
"[Content]" << endl;
160 const std::string &
msg_r,
161 const std::string &
line_r )
const
164 _pimpl->_inputname.c_str(),
178 MIL <<
"Start parsing content repoindex" <<
input_r << endl;
181 std::ostringstream
s;
182 s <<
"Can't read bad stream: " <<
input_r;
190 if ( ! ticks.
toMin() )
197 std::string value( *
line );
200 if ( key.empty() || *key.c_str() ==
'#' )
207 std::string::size_type pos = key.rfind(
'.' );
208 if ( pos != std::string::npos )
217 else if ( key ==
"DESCRDIR" )
219 _pimpl->repoindex().descrdir = value;
221 else if ( key ==
"DATADIR" )
223 _pimpl->repoindex().datadir = value;
225 else if ( key ==
"KEY" )
227 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().signingKeys, value ) )
232 else if ( key ==
"META" )
234 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().metaFileChecksums, value ) )
239 else if ( key ==
"HASH" )
241 if (
_pimpl->setFileCheckSum(
_pimpl->repoindex().mediaFileChecksums, value ) )
252 if ( ! ticks.
set(
input_r.stream().tellg() ) )
259 if ( ! ticks.
toMax() )
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
void swap(AutoDispose &rhs) noexcept
Exchange the contents of two AutoDispose objects.
void reset()
Reset to default Ctor values.
Maintain [min,max] and counter (value) for progress counting.
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
bool toMax()
Set counter value to current max value (unless no range).
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
bool toMin()
Set counter value to current min value.
bool set(value_type val_r)
Set new counter value.
Simple lineparser: Traverse each line in a file.
virtual void userRequestedAbort(unsigned lineNo_r)
Called when user(callback) request to abort.
virtual void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &fnc_r=ProgressData::ReceiverFnc())
Parse the stream.
ContentFileReader()
Default ctor.
virtual void endParse()
Called when the parse is done.
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.
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
virtual ~ContentFileReader()
Dtor.
RepoIndexConsumer _repoIndexConsumer
virtual void beginParse()
Called when start parsing.
std::string stripFirstWord(std::string &line, const bool ltrim_first)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Easy-to use interface to the ZYPP dependency resolver.
ProgressData makeProgressData(const InputStream &input_r)
ContentFileReader implementation.
RepoIndex_Ptr handoutRepoIndex()
bool hasRepoIndex() const
bool setFileCheckSum(std::map< std::string, CheckSum > &map_r, const std::string &value) const
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.