Yate: ClientDir Class Reference

Yate

Public Member Functions | Protected Attributes | List of all members
ClientDir Class Reference

A directory. More...

`#include <yatecbase.h>`

Inheritance diagram for ClientDir:

## Public Member Functions
| ClientDir (const char *name)
| ClientDir (const ClientDir &other)
ObjList & | children ()
bool | updated () const
void | updated (bool on)
bool | treeUpdated () const
ClientDir * | addDir (const String &name)
ClientDir * | addDirPath (const String &path, const char *sep="/")
void | copyChildren (const ObjList &list)
void | addChildren (ObjList &list)
bool | addChild (ClientFileItem *item)
ClientFileItem * | findChild (const String &path, const char *sep="/")
ClientFileItem * | findChildName (const String &name)
virtual ClientDir * | directory ()
Public Member Functions inherited from ClientFileItem
| ClientFileItem (const char *name)
const String & | name () const
virtual ClientFile * | file ()
virtual const String & | toString () const
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | traceId () const
virtual void * | getObject (const String &name) const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (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 NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Detailed Description

A directory.

This class holds directory info

## Constructor & Destructor Documentation

## ◆ ClientDir() [1/2]

ClientDir | ( | const char * | name | ) |
| inline

Constructor

Parameters

  name | Directory name

## ◆ ClientDir() [2/2]

ClientDir | ( | const ClientDir & | other | ) |
| inline

Copy constructor. Copy known children types

Parameters

  other | Source 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

  item | Item to add

Returns
  True on success

## ◆ addChildren()

void addChildren | ( | ObjList & | list | ) |

Add a list of children, consume the objects

Parameters

  list | List 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

  name | Directory name

Returns
  ClientDir pointer or 0 on failure

## ◆ addDirPath()

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

Build sub directories from path

Parameters

  path | Directory path
  sep | Path 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

  list | List 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

  path | Item path
  sep | Path separator

Returns
  ClientFileItem pointer or 0

## ◆ findChildName()

ClientFileItem * findChildName | ( | const String & | name | ) |
| inline

Find a child by name

Parameters

  name | Item 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:

- yatecbase.h