libxcks
0.1.0.1
|
An element of the directory structure for XCKS files. More...
Public Member Functions | |
Element ()=delete | |
Deleted default constructor. More... | |
Element (const Element &)=delete | |
Deleted copy constructor. More... | |
Element & | operator= (const Element &)=delete |
Deleted assignment operator. More... | |
Element (const string &elementName, Element *parentElement, Element *previousElement) | |
Constructor. More... | |
virtual | ~Element () |
Destructor. More... | |
virtual bool | hasChild () const |
Does the element have a child? More... | |
virtual bool | hasPrevious () const final |
Does the element have a previous element? More... | |
virtual bool | hasNext () const final |
Does the element have a following element? More... | |
virtual bool | hasParent () const final |
Does the element have a parent? More... | |
virtual bool | isAFile () const =0 |
Does the element is a file? More... | |
virtual bool | hasElement (const string &elementName) const final |
Does an element exist with the given name in the current level? More... | |
virtual string | getName () const final |
Gets the name of the element. More... | |
virtual Element * | getChild () const |
Gets the child of the element. More... | |
virtual void | setChild (Element *newChild) |
Sets the child of the element. More... | |
virtual Element * | getPrevious () const final |
Gets the previous element of the element. More... | |
virtual void | setPrevious (Element *newPrevious) final |
Sets the previous element of the element. More... | |
virtual Element * | getNext () const final |
Gets the following element of the element. More... | |
virtual void | setNext (Element *newNext) final |
Sets the following element of the element. More... | |
virtual Element * | getParent () const final |
Gets the parent element of the element. More... | |
virtual void | getParent (Element *newParent) final |
Sets the parent element of the element. More... | |
virtual void * | getData () const |
Gets the data associated with the element. More... | |
virtual void | setData (void *newData) |
Sets the data associated with the element. More... | |
virtual Element * | getElement (const string &elementName, Element **lastElement=nullptr) const final |
Gets the element with the given name in the current level. More... | |
bool | addFile (const ArrayString &dirs, const size_t cur, const string &filename, void *data=nullptr) |
Adds a new file in the directory structure. More... | |
XCKSDirStruct::File * | getNextFile () const |
Gets the next file in the directory structure. More... | |
Protected Member Functions | |
Element * | createDirsAndAddFile (const ArrayString &dirs, const size_t cur, const string &filename, void *data=nullptr) |
Creates directories and adds a new file in the directory structure. More... | |
XCKSDirStruct::File * | getNextFileRec () const |
Gets the next file in the directory structure (recursive). More... | |
XCKSDirStruct::File * | getNextFile (const bool calledFromChild) const |
Gets the next file in the directory structure. More... | |
Protected Attributes | |
string | name |
The name of the element. More... | |
Element * | parent |
Address of the parent. More... | |
Element * | previous |
Address of the previous element at the same level. More... | |
Element * | next |
Address of the next element at the same level. More... | |
Friends | |
class | XCKSDirStruct::const_file_iterator |
An element of the directory structure for XCKS files.
It could be a directory or a file.
Definition at line 102 of file xcksfilewriter.cpp.
|
delete |
Deleted default constructor.
|
delete |
Deleted copy constructor.
libxcks::XCKSDirStruct::Element::Element | ( | const string & | elementName, |
XCKSDirStruct::Element * | parentElement, | ||
XCKSDirStruct::Element * | previousElement | ||
) |
Constructor.
elementName | Name of the element (file or directory). |
parentElement | Parent of the element. |
previousElement | Address of the previous element (can be nullptr if is the first element of the level). |
Definition at line 557 of file xcksfilewriter.cpp.
|
virtual |
Destructor.
Definition at line 572 of file xcksfilewriter.cpp.
bool libxcks::XCKSDirStruct::Element::addFile | ( | const ArrayString & | dirs, |
const size_t | cur, | ||
const string & | filename, | ||
void * | data = nullptr |
||
) |
Adds a new file in the directory structure.
dirs | The array of directories where the file is. |
cur | The current directory. |
filename | The name of the file to add. |
data | The data associated with the file. |
true
is the file has been created in the structure, false
otherwise. Definition at line 654 of file xcksfilewriter.cpp.
|
protected |
Creates directories and adds a new file in the directory structure.
dirs | The array of directories where the file is. |
cur | The current directory. |
filename | The name of the file to add. |
data | The data associated with the file. |
Definition at line 718 of file xcksfilewriter.cpp.
|
inlinevirtual |
Gets the child of the element.
nullptr
if the element hasn't a child. Reimplemented in libxcks::XCKSDirStruct::Directory.
Definition at line 180 of file xcksfilewriter.cpp.
|
inlinevirtual |
Gets the data associated with the element.
Reimplemented in libxcks::XCKSDirStruct::File.
Definition at line 244 of file xcksfilewriter.cpp.
|
finalvirtual |
Gets the element with the given name in the current level.
[in] | elementName | Name of the element to search in the current level. |
[out] | lastElement | If not nullptr and the given element isn't found, it will contains the address of the last element in the level. |
nullptr
if an element with the given name doesn't exist in the current level. Definition at line 617 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Gets the name of the element.
Definition at line 172 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Gets the following element of the element.
nullptr
if the element hasn't a following element. Definition at line 215 of file xcksfilewriter.cpp.
XCKSDirStruct::File * libxcks::XCKSDirStruct::Element::getNextFile | ( | ) | const |
Gets the next file in the directory structure.
nullptr
if there is no more files in it. Definition at line 842 of file xcksfilewriter.cpp.
|
protected |
Gets the next file in the directory structure.
calledFromChild | Must be true if called from a child, false otherwise. |
nullptr
if there is no more files in it. Definition at line 787 of file xcksfilewriter.cpp.
|
protected |
Gets the next file in the directory structure (recursive).
nullptr
if there is no more files in it. Definition at line 746 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Gets the parent element of the element.
nullptr
if the element hasn't a parent element. Definition at line 230 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Sets the parent element of the element.
newParent | The parent element of the element. |
Definition at line 237 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Gets the previous element of the element.
nullptr
if the element hasn't a previous element. Definition at line 200 of file xcksfilewriter.cpp.
|
inlinevirtual |
Does the element have a child?
true
if the element has a child, false
otherwise. Reimplemented in libxcks::XCKSDirStruct::Directory.
Definition at line 134 of file xcksfilewriter.cpp.
|
finalvirtual |
Does an element exist with the given name in the current level?
elementName | Name of the element to search in the current level. |
true
if an element with the given name exists in the current level, false
otherwise. Definition at line 589 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Does the element have a following element?
true
if the element has a following element, false
otherwise. Definition at line 148 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Does the element have a parent?
true
if the element has a parent, false
otherwise. Definition at line 155 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Does the element have a previous element?
true
if the element has a previous element, false
otherwise. Definition at line 141 of file xcksfilewriter.cpp.
|
pure virtual |
Does the element is a file?
true
if the element is a file, false
otherwise. Implemented in libxcks::XCKSDirStruct::Directory, and libxcks::XCKSDirStruct::File.
Deleted assignment operator.
|
inlinevirtual |
Sets the child of the element.
newChild | The new child of the element. |
Reimplemented in libxcks::XCKSDirStruct::Directory.
Definition at line 192 of file xcksfilewriter.cpp.
|
inlinevirtual |
Sets the data associated with the element.
newData | The data associated with the element. |
Reimplemented in libxcks::XCKSDirStruct::File.
Definition at line 259 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Sets the following element of the element.
newNext | The following element of the element. |
Definition at line 222 of file xcksfilewriter.cpp.
|
inlinefinalvirtual |
Sets the previous element of the element.
newPrevious | The previous element of the element. |
Definition at line 207 of file xcksfilewriter.cpp.
|
protected |
The name of the element.
Definition at line 108 of file xcksfilewriter.cpp.
|
protected |
Address of the next element at the same level.
Definition at line 111 of file xcksfilewriter.cpp.
|
protected |
Address of the parent.
Definition at line 109 of file xcksfilewriter.cpp.
|
protected |
Address of the previous element at the same level.
Definition at line 110 of file xcksfilewriter.cpp.