9#ifndef __COMPOSITE_FILEDIRENTRY_H__
10#define __COMPOSITE_FILEDIRENTRY_H__
14#include "helpers/DateTime.h"
180 for (FileDirEntryList::iterator entryIter = std::begin(
_children);
184 length += (*entryIter)->Length();
Represents a Directory entry.
FileDirEntryList _children
FileDirEntryList Children()
Retrieve the children of this node.
DirEntry(std::string entryName, DateTime modDate, FileDirEntryList children)
Construct a DirEntry instance.
long Length()
Retrieve the size of all children of this directory. The length is calculated on the first call and c...
Base class representing a File or Directory entry.
virtual FileDirTypes FileDirType()
The type of this entry as represented by a value from the FileDirTypes enumeration.
virtual std::string Name()
The name of this entry.
FileDirEntry()
Default constructor.
virtual DateTime WhenModified()
When this entry was last modified.
virtual long Length()
The length in bytes of this entry. Directory entries are the sum of the length of all children.
FileDirEntry(FileDirTypes type, std::string entryName, long size, DateTime modDate)
Constructor.
virtual FileDirEntryList Children()
The children of this entry. Is empty if the entry can never have any children (that is,...
FileEntry(std::string entryName, long size, DateTime modDate)
Constructor.
Represents a timestamp composed of a date and a time encoded in a time_t value. Provides ways of gett...
The namespace containing all Design Pattern Examples implemented in C++.
FileDirTypes
Represents the type of entries allowed in the hierarchy for the Composite design pattern example.
@ Directory
Represents a directory entry that can contain other FileDirEntry components.
@ File
Represents a file entry.
std::vector< std::shared_ptr< FileDirEntry > > FileDirEntryList
Makes it easier to refer to a list of child nodes.
Structure representing a File (FileEntry) or Directory (DirEntry) entry. This is included as the firs...