TarzaNN
TarzaNN neural network simulator
|
A simple interface to retrieve the contents of a directory. More...
#include <Directory.h>
Public Member Functions | |
Directory (char *path=NULL, int flags=0) | |
~Directory () | |
int | size () |
Number of entries in the directory. | |
char * | getPath () |
Retrieve the current path. | |
bool | setPath (char *path) |
Set the current path. | |
int | getFlags () |
Retrieve the current flags. | |
bool | setFlags (int flags) |
Set the current flags. | |
char * | getName (int i) |
Get the name of the i'th entry. | |
char * | getFullPath (int i) |
Get the full path of the i'th entry. | |
int | getType (int i) |
Get the type of the i'th entry. | |
Static Public Member Functions | |
static int | pathType (char *path) |
static char * | get_basename (char *path) |
static char * | get_dirname (char *path) |
static int | matches_sequence (char *file, char *prefix, char *suffix, long *seqno_r) |
static char * | copystr (const char *s) |
Static Public Attributes | |
static const int | F_HIDDEN = (1<<0) |
static const int | T_FILE = 0 |
static const int | T_DIR = 1 |
static const int | T_OTHER = 2 |
A simple interface to retrieve the contents of a directory.
Known system entries (e.g. '.' and '..') are automatically omitted from the listing.
Directory::Directory | ( | char * | path = NULL , |
int | flags = 0 |
||
) |
Directory::~Directory | ( | ) |
static char* Directory::copystr | ( | const char * | s | ) | [inline, static] |
static char* Directory::get_basename | ( | char * | path | ) | [inline, static] |
static char* Directory::get_dirname | ( | char * | path | ) | [inline, static] |
int Directory::getFlags | ( | ) |
Retrieve the current flags.
char* Directory::getFullPath | ( | int | i | ) |
Get the full path of the i'th entry.
Return value is dynamically allocated and must be disposed of with "delete" by the calling function.
char * Directory::getName | ( | int | i | ) |
Get the name of the i'th entry.
Return value is valid until object is destroyed or read(), setFlags() or setPath() is called.
char * Directory::getPath | ( | ) |
Retrieve the current path.
int Directory::getType | ( | int | i | ) |
Get the type of the i'th entry.
static int Directory::matches_sequence | ( | char * | file, |
char * | prefix, | ||
char * | suffix, | ||
long * | seqno_r | ||
) | [inline, static] |
static int Directory::pathType | ( | char * | path | ) | [static] |
bool Directory::setFlags | ( | int | flags | ) |
Set the current flags.
As a side-effect this will also call read(). The result is the result of the read() operation.
bool Directory::setPath | ( | char * | path | ) |
Set the current path.
As a side-effect this will also call read(). The result is the result of the read() operation.
NULL implies the current working directory.
int Directory::size | ( | ) |
Number of entries in the directory.
const int Directory::F_HIDDEN = (1<<0) [static] |
const int Directory::T_DIR = 1 [static] |
const int Directory::T_FILE = 0 [static] |
const int Directory::T_OTHER = 2 [static] |