18#include <zypp-core/base/Logger.h>
19#include <zypp-core/base/String.h>
20#include <zypp-core/base/IOStream.h>
21#include <zypp-core/base/UserRequestException>
23#include <zypp-core/parser/ParseException>
24#include <zypp-core/ui/ProgressData>
36 inline const std::string & keyGarbage()
38 static const std::string & _val(
":/?|,\\" );
74 std::string msg =
str::form(
"%s: Section [%s]: Line %d contains garbage (no '=' or '%s' in key)",
104 std::string::size_type
pos =
trimmed.rfind(
']');
105 if (
pos != std::string::npos )
119 std::string::size_type
pos =
trimmed.find(
'=');
133 if ( ! ticks.
set(
input_r.stream().tellg() ) )
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.
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 garbageLine(const std::string §ion, const std::string &line)
Called whenever a garbage line is found.
virtual ~IniParser()
Dtor.
virtual void beginParse()
Called when start parsing.
std::string _current_section
virtual void consume(const std::string §ion)
Called when a section is found.
virtual void endParse()
Called when the parse is done.
void parse(const InputStream &imput_r, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Parse the stream.
std::string rtrim(const std::string &s)
std::string ltrim(const std::string &s)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string trim(const std::string &s, const Trim trim_r)
Easy-to use interface to the ZYPP dependency resolver.
ProgressData makeProgressData(const InputStream &input_r)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.