1 #ifndef PASSWORD_FILE_IO_ENTRY_H 2 #define PASSWORD_FILE_IO_ENTRY_H 6 #include <c++utilities/conversion/types.h> 38 const std::string &label()
const;
39 void setLabel(
const std::string &label);
40 void makeLabelUnique();
42 void setParent(
NodeEntry *parent,
int index = -1);
44 bool isIndirectChildOf(
const NodeEntry *entry)
const;
45 std::list<std::string> path()
const;
46 void path(std::list<std::string> &res)
const;
47 virtual void make(std::ostream &stream)
const = 0;
48 virtual Entry *clone()
const = 0;
51 static Entry *parse(std::istream &stream);
52 static bool denotesNodeEntry(byte version);
53 static constexpr
EntryType denotedEntryType(byte version);
56 Entry(
const std::string &label = std::string(),
NodeEntry *parent =
nullptr);
126 const std::vector<Entry *> &children()
const;
127 void deleteChildren(
int begin,
int end);
128 void replaceChild(std::size_t at,
Entry *newChild);
129 Entry *entryByPath(std::list<std::string> &path,
bool includeThis =
true,
const EntryType *creationType =
nullptr);
130 bool isExpandedByDefault()
const;
131 void setExpandedByDefault(
bool expandedByDefault);
132 void make(std::ostream &stream)
const override;
137 std::vector<Entry *> m_children;
138 bool m_expandedByDefault;
153 return m_expandedByDefault;
158 m_expandedByDefault = expandedByDefault;
163 return (version & 0x80) == 0;
180 const std::vector<Field> &fields()
const;
181 std::vector<Field> &fields();
182 void make(std::ostream &stream)
const override;
187 std::vector<Field> m_fields;
206 #endif // PASSWORD_FILE_IO_ENTRY_H
NodeEntry * parent() const
Returns the parent entry.
The NodeEntry class acts as parent for other entries.
const std::string & label() const
Returns the label.
void setLabel(const std::string &label)
Sets the label.
EntryStatistics computeStatistics() const
Computes statistics for this entry.
static constexpr EntryType denotedEntryType(byte version)
bool isExpandedByDefault() const
Contains all IO related classes.
int index() const
Returns the index of the entry within its parent.
std::string m_extendedData
The exception that is thrown when a parsing error occurs.
#define PASSWORD_FILE_EXPORT
Marks the symbol to be exported by the passwordfile library.
virtual void accumulateStatistics(EntryStatistics &stats) const =0
EntryType type() const override
Returns the type of the entry.
static bool denotesNodeEntry(byte version)
const std::vector< Entry * > & children() const
EntryType type() const override
Returns the type of the entry.
void makeLabelUnique()
Internally called to make the entry's label unique within the parent.
const std::vector< Field > & fields() const
EntryType
Specifies the entry type.
void setExpandedByDefault(bool expandedByDefault)
Instances of the Entry class form a hierarchic data strucutre used to store account information...