1 #ifndef EPT_APT_RECORDPARSER_H 2 #define EPT_APT_RECORDPARSER_H 44 std::vector<size_t> ends;
47 std::vector<size_t> sorted;
54 void scan(
const std::string& str);
61 size_t index(
const std::string& str)
const;
64 std::string
field(
size_t idx)
const;
67 std::string
name(
size_t idx)
const;
70 std::string
lookup(
size_t idx)
const;
82 const std::string&
record()
const {
return buffer; }
85 std::string
record() {
return buffer; }
88 size_t size()
const {
return ends.size(); }
void scan(const std::string &str)
Index a new record.
Definition: recordparser.cc:45
std::string operator[](size_t idx) const
Return the content of a field by its index.
Definition: recordparser.h:76
String functions.
Definition: apt.cc:38
std::string lookup(const std::string &name) const
Return the content of a field by its name.
Definition: recordparser.h:73
std::string lookup(size_t idx) const
Return the content of a field by its index.
Definition: recordparser.cc:129
RecordParser()
Definition: recordparser.h:50
Access the fields of a package record contained inside a std::string.
Definition: recordparser.h:38
std::string name(size_t idx) const
Return the name of a field by its index.
Definition: recordparser.cc:120
std::string record()
Return the entire record.
Definition: recordparser.h:85
std::string operator[](const std::string &name) const
Return the content of a field by its name.
Definition: recordparser.h:79
const std::string & record() const
Return the entire record.
Definition: recordparser.h:82
std::string field(size_t idx) const
Return the field by its index.
Definition: recordparser.cc:110
RecordParser(const std::string &str)
Definition: recordparser.h:51
size_t index(const std::string &str) const
Get the index of the field with the given name.
Definition: recordparser.cc:145
size_t size() const
Return the number of fields in the record.
Definition: recordparser.h:88