drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzled::CachedDirectory Class Reference

#include <cached_directory.h>

Collaboration diagram for drizzled::CachedDirectory:
[legend]

Classes

class  Entry

Public Types

enum  FILTER { NONE , DIRECTORY , FILE , MAX }
typedef std::vector< Entry * > Entries

Public Member Functions

 CachedDirectory ()
 CachedDirectory (const std::string &in_path)
 CachedDirectory (const std::string &in_path, std::set< std::string > &allowed_exts)
 CachedDirectory (const std::string &in_path, CachedDirectory::FILTER filter, bool use_full_path=false)
 ~CachedDirectory ()
bool fail () const
int getError () const
const char * getPath () const
const Entries & getEntries () const

Private Member Functions

bool open (const std::string &in_path)
bool open (const std::string &in_path, std::set< std::string > &allowable_exts)
bool open (const std::string &in_path, std::set< std::string > &allowed_exts, CachedDirectory::FILTER filter)

Private Attributes

std::string path
 Path to the directory.
int error
 Error code stored from various syscalls.
bool use_full_path
Entries entries
 Entries in the directory.

Friends

std::ostream & operator<< (std::ostream &output, const CachedDirectory &directory)

Detailed Description

A utility class to handle processing the entries/files within a directory.

This class will allow the user to either get a list of the entry names within a given directory.

Definition at line 45 of file cached_directory.h.

Member Typedef Documentation

◆ Entries

typedef std::vector<Entry *> drizzled::CachedDirectory::Entries

Definition at line 65 of file cached_directory.h.

Member Enumeration Documentation

◆ FILTER

enum drizzled::CachedDirectory::FILTER

Definition at line 48 of file cached_directory.h.

Constructor & Destructor Documentation

◆ CachedDirectory() [1/4]

drizzled::CachedDirectory::CachedDirectory ( )

Empty Constructor.

Definition at line 50 of file cached_directory.cc.

◆ CachedDirectory() [2/4]

drizzled::CachedDirectory::CachedDirectory ( const std::string & in_path)

Constructor taking full directory path as sole parameter.

Parameters
[in]Pathto the directory to open
[in]Fileextensions to allow

Definition at line 56 of file cached_directory.cc.

◆ CachedDirectory() [3/4]

drizzled::CachedDirectory::CachedDirectory ( const std::string & in_path,
std::set< std::string > & allowed_exts )

Constructor taking full directory path as sole parameter.

Parameters
[in]Pathto the directory to open
[in]Fileextensions to allow

Definition at line 65 of file cached_directory.cc.

◆ CachedDirectory() [4/4]

drizzled::CachedDirectory::CachedDirectory ( const std::string & in_path,
CachedDirectory::FILTER filter,
bool use_full_path = false )

Definition at line 73 of file cached_directory.cc.

◆ ~CachedDirectory()

drizzled::CachedDirectory::~CachedDirectory ( )

Destructor. Cleans up any resources we've taken

Definition at line 83 of file cached_directory.cc.

Member Function Documentation

◆ fail()

bool drizzled::CachedDirectory::fail ( ) const
inline

Returns whether the CachedDirectory object is in a failed state

Definition at line 96 of file cached_directory.h.

◆ getEntries()

const Entries & drizzled::CachedDirectory::getEntries ( ) const
inline

Return the list of entries read from the directory

Returns
A vector of strings containing the directory entry names.

Definition at line 124 of file cached_directory.h.

◆ getError()

int drizzled::CachedDirectory::getError ( ) const
inline

Returns the stored error code of the last action the directory object took (open, read, etc)

Definition at line 105 of file cached_directory.h.

◆ getPath()

const char * drizzled::CachedDirectory::getPath ( ) const
inline

Returns the current path for the cached directory

Definition at line 113 of file cached_directory.h.

◆ open() [1/3]

bool drizzled::CachedDirectory::open ( const std::string & in_path)
private

Encapsulate the logic to open the directory.

Parameters
[in]Thepath to the directory to open and read
Return values
trueSuccess
falseFailure

Definition at line 89 of file cached_directory.cc.

◆ open() [2/3]

bool drizzled::CachedDirectory::open ( const std::string & in_path,
std::set< std::string > & allowable_exts )
private

Encapsulate the logic to open the directory with a set of allowed file extensions to filter for.

Parameters
[in]Thepath to the directory to open and read
[in]Fileextensions to allow
Return values
trueSuccess
falseFailure

Definition at line 95 of file cached_directory.cc.

◆ open() [3/3]

bool drizzled::CachedDirectory::open ( const std::string & in_path,
std::set< std::string > & allowed_exts,
CachedDirectory::FILTER filter )
private

Definition at line 100 of file cached_directory.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream & output,
const CachedDirectory & directory )
friend

Definition at line 195 of file cached_directory.cc.

Member Data Documentation

◆ entries

Entries drizzled::CachedDirectory::entries
private

Entries in the directory.

Definition at line 132 of file cached_directory.h.

◆ error

int drizzled::CachedDirectory::error
private

Error code stored from various syscalls.

Definition at line 130 of file cached_directory.h.

◆ path

std::string drizzled::CachedDirectory::path
private

Path to the directory.

Definition at line 129 of file cached_directory.h.

◆ use_full_path

bool drizzled::CachedDirectory::use_full_path
private

Definition at line 131 of file cached_directory.h.


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