Yate
ClientDir Class Reference

A directory. More...

#include <yatecbase.h>

Inheritance diagram for ClientDir:
ClientFileItem GenObject

Public Member Functions

 ClientDir (const char *name)
 
 ClientDir (const ClientDir &other)
 
ObjListchildren ()
 
bool updated () const
 
void updated (bool on)
 
bool treeUpdated () const
 
ClientDiraddDir (const String &name)
 
ClientDiraddDirPath (const String &path, const char *sep="/")
 
void copyChildren (const ObjList &list)
 
void addChildren (ObjList &list)
 
bool addChild (ClientFileItem *item)
 
ClientFileItemfindChild (const String &path, const char *sep="/")
 
ClientFileItemfindChildName (const String &name)
 
virtual ClientDirdirectory ()
 
- Public Member Functions inherited from ClientFileItem
 ClientFileItem (const char *name)
 
const Stringname () const
 
virtual ClientFilefile ()
 
virtual const StringtoString () const
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Protected Attributes

ObjList m_children
 
bool m_updated
 

Additional Inherited Members

- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Detailed Description

A directory.

This class holds directory info

Constructor & Destructor Documentation

◆ ClientDir() [1/2]

ClientDir ( const char * name)
inline

Constructor

Parameters
nameDirectory name

◆ ClientDir() [2/2]

ClientDir ( const ClientDir & other)
inline

Copy constructor. Copy known children types

Parameters
otherSource object

References ClientDir::copyChildren().

Member Function Documentation

◆ addChild()

bool addChild ( ClientFileItem * item)

Add an item. Remove another item with the same name if exists

Parameters
itemItem to add
Returns
True on success

◆ addChildren()

void addChildren ( ObjList & list)

Add a list of children, consume the objects

Parameters
listList of ClientFileItem objects to add

◆ addDir()

ClientDir * addDir ( const String & name)

Build and add a sub-directory if not have one already Replace an existing file with the same name

Parameters
nameDirectory name
Returns
ClientDir pointer or 0 on failure

◆ addDirPath()

ClientDir * addDirPath ( const String & path,
const char * sep = "/" )

Build sub directories from path

Parameters
pathDirectory path
sepPath separator
Returns
ClientDir pointer or 0 on failure

◆ children()

ObjList & children ( )
inline

Retrieve the children list

Returns
Children list

◆ copyChildren()

void copyChildren ( const ObjList & list)

Add a copy of known children types

Parameters
listList of ClientFileItem objects to copy

Referenced by ClientDir::ClientDir().

◆ directory()

virtual ClientDir * directory ( )
inlinevirtual

Check if this item is a directory

Returns
ClientDir pointer

Reimplemented from ClientFileItem.

◆ findChild()

ClientFileItem * findChild ( const String & path,
const char * sep = "/" )

Find a child by path

Parameters
pathItem path
sepPath separator
Returns
ClientFileItem pointer or 0

◆ findChildName()

ClientFileItem * findChildName ( const String & name)
inline

Find a child by name

Parameters
nameItem name
Returns
ClientFileItem pointer or 0

References ObjList::find(), ObjList::get(), and ClientFileItem::name().

◆ treeUpdated()

bool treeUpdated ( ) const

Recursively check if all (sub)directores were updated

Returns
True if all (sub)directores were updated

◆ updated() [1/2]

bool updated ( ) const
inline

Check if children were updated

Returns
True if children list was updated

◆ updated() [2/2]

void updated ( bool on)
inline

Set children updated flag

Returns
New value for children updated flag

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