1#ifndef PASSWORD_FILE_IO_ENTRY_H
2#define PASSWORD_FILE_IO_ENTRY_H
37 const std::string &
label()
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;
125 const std::vector<Entry *> &
children()
const;
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;
const std::vector< Field > & fields() const
void accumulateStatistics(EntryStatistics &stats) const override
Accumulates the statistics for this account entry and its fields.
AccountEntry * clone() const override
Clones the entry.
void make(std::ostream &stream) const override
Serializes the entry to the specified stream.
EntryType type() const override
Returns the type of the entry.
virtual void accumulateStatistics(EntryStatistics &stats) const =0
int index() const
Returns the index of the entry within its parent.
static Entry * parse(std::istream &stream)
Parses an entry from the specified stream.
Entry(const std::string &label=std::string(), NodeEntry *parent=nullptr)
Constructs a new entry with the specified label and parent.
static constexpr EntryType denotedEntryType(std::uint8_t version)
void makeLabelUnique()
Internally called to make the entry's label unique within the parent.
bool isIndirectChildOf(const NodeEntry *entry) const
Returns an indication whether the instance is an indirect child of the specified entry.
void setParent(NodeEntry *parent, int index=-1)
Sets the parent for the entry.
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.
std::list< std::string > path() const
Returns the path of the entry.
Entry & operator=(const Entry &other)=delete
The NodeEntry class acts as parent for other entries.
Entry * entryByPath(std::list< std::string > &path, bool includeThis=true, const EntryType *creationType=nullptr)
Returns an entry specified by the provided path.
void replaceChild(std::size_t at, Entry *newChild)
Replaces the child at the specified index with the specified newChild.
void setExpandedByDefault(bool expandedByDefault)
EntryType type() const override
Returns the type of the entry.
bool isExpandedByDefault() const
void accumulateStatistics(EntryStatistics &stats) const override
Accumulates the statistics for this node entry and its children.
NodeEntry * clone() const override
Clones the entry.
NodeEntry()
Constructs a new node entry.
void deleteChildren(int begin, int end)
Deletes children from the node entry.
const std::vector< Entry * > & children() const
void make(std::ostream &stream) const override
Serializes the entry to the specified stream.
#define PASSWORD_FILE_EXPORT
Marks the symbol to be exported by the passwordfile library.
Contains all IO related classes.
EntryType
Specifies the entry type.