1#ifndef PASSWORD_FILE_IO_ENTRY_H
2#define PASSWORD_FILE_IO_ENTRY_H
37 const std::string &label()
const;
38 void setLabel(
const std::string &label);
39 void makeLabelUnique();
41 void setParent(
NodeEntry *parent,
int index = -1);
43 bool isIndirectChildOf(
const NodeEntry *entry)
const;
44 std::list<std::string> path()
const;
45 void path(std::list<std::string> &res)
const;
46 virtual void make(std::ostream &stream)
const = 0;
50 static Entry *parse(std::istream &stream);
51 static bool denotesNodeEntry(std::uint8_t version);
52 static constexpr EntryType denotedEntryType(std::uint8_t version);
55 Entry(
const std::string &label = std::string(),
NodeEntry *parent =
nullptr);
125 const std::vector<Entry *> &children()
const;
126 void deleteChildren(
int begin,
int end);
127 void replaceChild(std::size_t at,
Entry *newChild);
128 Entry *entryByPath(std::list<std::string> &path,
bool includeThis =
true,
const EntryType *creationType =
nullptr);
129 bool isExpandedByDefault()
const;
130 void setExpandedByDefault(
bool expandedByDefault);
131 void make(std::ostream &stream)
const override;
136 std::vector<Entry *> m_children;
137 bool m_expandedByDefault;
152 return m_expandedByDefault;
157 m_expandedByDefault = expandedByDefault;
162 return (version & 0x80) == 0;
179 const std::vector<Field> &fields()
const;
180 std::vector<Field> &fields();
181 void make(std::ostream &stream)
const override;
186 std::vector<Field> m_fields;
The exception that is thrown when a parsing error occurs.
const std::vector< Field > & fields() const
EntryType type() const override
Returns the type of the entry.
Instances of the Entry class form a hierarchic data structure used to store account information.
virtual void accumulateStatistics(EntryStatistics &stats) const =0
int index() const
Returns the index of the entry within its parent.
static constexpr EntryType denotedEntryType(std::uint8_t version)
void makeLabelUnique()
Internally called to make the entry's label unique within the parent.
NodeEntry * parent() const
Returns the parent entry.
static bool denotesNodeEntry(std::uint8_t version)
void setLabel(const std::string &label)
Sets the label.
virtual void make(std::ostream &stream) const =0
Serializes the entry to the specified stream.
EntryStatistics computeStatistics() const
Computes statistics for this entry.
std::string m_extendedData
const std::string & label() const
Returns the label.
virtual Entry * clone() const =0
Clones the entry.
virtual EntryType type() const =0
Returns the type of the entry.
Entry & operator=(const Entry &other)=delete
The NodeEntry class acts as parent for other entries.
void setExpandedByDefault(bool expandedByDefault)
EntryType type() const override
Returns the type of the entry.
bool isExpandedByDefault() const
const std::vector< Entry * > & children() const
#define PASSWORD_FILE_EXPORT
Marks the symbol to be exported by the passwordfile library.
Contains all IO related classes.
EntryType
Specifies the entry type.