Passwordfile library: Io::NodeEntry Class Reference

Passwordfile library 5.2.0 C++ library to read/write passwords from/to encrypted files

Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
Io::NodeEntry Class Reference

The NodeEntry class acts as parent for other entries. More...

`#include <entry.h>`

Inheritance diagram for Io::NodeEntry:
[legend]
Collaboration diagram for Io::NodeEntry:
[legend]

## Public Member Functions
| NodeEntry ()
| Constructs a new node entry.
| NodeEntry (const std::string &label, NodeEntry *parent=nullptr)
| Constructs a new node entry with the specified label and parent.
| NodeEntry (std::istream &stream)
| Constructs a new node entry which is deserialized from the specified stream.
| NodeEntry (const NodeEntry &other)
| Constructs a copy of the another entry.
| ~NodeEntry () override
| Destroys the entry.
EntryType | type () const override
| Returns the type of the entry.
const std::vector< Entry * > & | children () const
void | deleteChildren (int begin, int end)
| Deletes children from the node entry.
void | replaceChild (std::size_t at, Entry *newChild)
| Replaces the child at the specified index with the specified newChild.
Entry * | entryByPath (std::list< std::string > &path, bool includeThis=true, const EntryType *creationType=nullptr)
| Returns an entry specified by the provided path.
bool | isExpandedByDefault () const
void | setExpandedByDefault (bool expandedByDefault)
void | make (std::ostream &stream) const override
| Serializes the entry to the specified stream.
NodeEntry * | clone () const override
| Clones the entry.
void | accumulateStatistics (EntryStatistics &stats) const override
| Accumulates the statistics for this node entry and its children.
Public Member Functions inherited from Io::Entry
virtual | ~Entry ()
| Destroys the entry.
Entry & | operator= (const Entry &other)=delete
const std::string & | label () const
| Returns the label.
void | setLabel (const std::string &label)
| Sets the label.
void | makeLabelUnique ()
| Internally called to make the entry's label unique within the parent.
NodeEntry * | parent () const
| Returns the parent entry.
void | setParent (NodeEntry *parent, int index=-1)
| Sets the parent for the entry.
int | index () const
| Returns the index of the entry within its parent.
bool | isIndirectChildOf (const NodeEntry *entry) const
| Returns an indication whether the instance is an indirect child of the specified entry.
std::list< std::string > | path () const
| Returns the path of the entry.
void | path (std::list< std::string > &res) const
| Stores to path of the entry in the specified list of string.
EntryStatistics | computeStatistics () const
| Computes statistics for this entry.

## Friends
class | Entry

## Additional Inherited Members
Static Public Member Functions inherited from Io::Entry
static Entry * | parse (std::istream &stream)
| Parses an entry from the specified stream.
static bool | denotesNodeEntry (std::uint8_t version)
static constexpr EntryType | denotedEntryType (std::uint8_t version)
Protected Member Functions inherited from Io::Entry
| Entry (const std::string &label={}, NodeEntry *parent=nullptr)
| Constructs a new entry with the specified label and parent.
| Entry (const Entry &other)
| Constructs a copy of another entry.
Protected Attributes inherited from Io::Entry
std::string | m_extendedData

## Detailed Description

The NodeEntry class acts as parent for other entries.

Definition at line 114 of file entry.h.

## Constructor & Destructor Documentation

## ◆ NodeEntry() [1/4]

Io::NodeEntry::NodeEntry | ( |  | ) |

Constructs a new node entry.

Definition at line 208 of file entry.cpp.

## ◆ NodeEntry() [2/4]

Io::NodeEntry::NodeEntry | ( | const std::string & | label,
|  | NodeEntry * | parent = nullptr )

Constructs a new node entry with the specified label and parent.

Definition at line 217 of file entry.cpp.

## ◆ NodeEntry() [3/4]

Io::NodeEntry::NodeEntry | ( | std::istream & | stream | ) |

Constructs a new node entry which is deserialized from the specified stream.

Definition at line 226 of file entry.cpp.

## ◆ NodeEntry() [4/4]

Io::NodeEntry::NodeEntry | ( | const NodeEntry & | other | ) |

Constructs a copy of the another entry.

Remarks
  The copy will be parentless and thus not be embedded in the hierarchy of other. Child entries will be copied as well.

Definition at line 259 of file entry.cpp.

## ◆ ~NodeEntry()

Io::NodeEntry::~NodeEntry | ( |  | ) |
| override

Destroys the entry.

Definition at line 273 of file entry.cpp.

## Member Function Documentation

## ◆ accumulateStatistics()

void Io::NodeEntry::accumulateStatistics | ( | EntryStatistics & | stats | ) | const
| overridevirtual

Accumulates the statistics for this node entry and its children.

Implements Io::Entry.

Definition at line 420 of file entry.cpp.

## ◆ children()

const std::vector< Entry * > & Io::NodeEntry::children | ( |  | ) | const
| inline

Definition at line 145 of file entry.h.

## ◆ clone()

NodeEntry * Io::NodeEntry::clone | ( |  | ) | const
| overridevirtual

Clones the entry.

Remarks
  The copy will be parentless and thus not be embedded in the hierarchy of other. Child entries will be copied as well.

Implements Io::Entry.

Definition at line 412 of file entry.cpp.

## ◆ deleteChildren()

void Io::NodeEntry::deleteChildren | ( | int | begin,
|  | int | end )

Deletes children from the node entry.

Parameters

  begin | Specifies the index of the first children to delete.
  end | Specifies the index after the last children to delete.

Remarks
  The children are actually destructed and deallocated.

Definition at line 287 of file entry.cpp.

## ◆ entryByPath()

Entry * Io::NodeEntry::entryByPath | ( | std::list< std::string > & | path,
|  | bool | includeThis = true,
|  | const EntryType * | creationType = nullptr )

Returns an entry specified by the provided path.

Parameters

  path | Specifies the path of the entry to be returned.
  includeThis | Specifies whether the current instance should be included.
  creationType | Specifies a pointer which dereferenced value determines what kind of entry should be created if the entry specified by the provided path does not exist. The parent of the entry to be created must exist. Specify nullptr if no entries should be created (default).

Returns
  Returns the entry if found (or created); otherwise nullptr is returned.

Definition at line 347 of file entry.cpp.

## ◆ isExpandedByDefault()

bool Io::NodeEntry::isExpandedByDefault | ( |  | ) | const
| inline

Definition at line 150 of file entry.h.

## ◆ make()

void Io::NodeEntry::make | ( | std::ostream & | stream | ) | const
| overridevirtual

Serializes the entry to the specified stream.

Implements Io::Entry.

Definition at line 392 of file entry.cpp.

## ◆ replaceChild()

void Io::NodeEntry::replaceChild | ( | std::size_t | at,
|  | Entry * | newChild )

Replaces the child at the specified index with the specified newChild.

Remarks
  The current child at the specified index is not destroyed and remains without a parent.

Deprecated
  Since this leaves a parentless entry leading to potential memory leaks, this method will be removed in future releases (in its current form).

Definition at line 314 of file entry.cpp.

## ◆ setExpandedByDefault()

void Io::NodeEntry::setExpandedByDefault | ( | bool | expandedByDefault | ) |
| inline

Definition at line 155 of file entry.h.

## ◆ type()

EntryType Io::NodeEntry::type | ( |  | ) | const
| inlineoverridevirtual

Returns the type of the entry.

Implements Io::Entry.

Definition at line 140 of file entry.h.

## Friends And Related Symbol Documentation

## ◆ Entry

friend class Entry
| friend

Definition at line 115 of file entry.h.

The documentation for this class was generated from the following files:

- io/entry.h
- io/entry.cpp