RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UDirectory Class Reference

#include <UDirectory.h>

Public Member Functions

 UDirectory (const std::string &path="", const std::string &extensions="")
 
 UDirectory (const UDirectory &dir)
 
UDirectoryoperator= (const UDirectory &dir)
 
void setPath (const std::string &path, const std::string &extensions="")
 
void update ()
 
bool isValid ()
 
std::string getNextFileName ()
 
std::string getNextFilePath ()
 
const std::list< std::string > & getFileNames () const
 
void rewind ()
 

Static Public Member Functions

static bool exists (const std::string &dirPath)
 
static std::string getDir (const std::string &filePath)
 
static std::string currentDir (bool trailingSeparator=false)
 
static bool makeDir (const std::string &dirPath)
 
static bool removeDir (const std::string &dirPath)
 
static std::string homeDir ()
 
static std::string separator ()
 

Detailed Description

Class UDirectory.

This class can be used to get file names in a directory.

Definition at line 34 of file UDirectory.h.

Constructor & Destructor Documentation

◆ UDirectory()

UDirectory::UDirectory ( const std::string &  path = "",
const std::string &  extensions = "" 
)

Create a UDirectory object with path initialized to an existing "path" and with filter "extensions".

Parameters
paththe path to an existing directory
extensionsfilter to get only file names with the extensions specified, format is a list of extensions separated by a space: "jpg bmp" get only file names finishing by jpg or bmp.

Member Function Documentation

◆ exists()

static bool UDirectory::exists ( const std::string &  dirPath)
static

Check if a directory exists.

Parameters
dirPaththe directory path
Returns
true if the directory exists

◆ getDir()

static std::string UDirectory::getDir ( const std::string &  filePath)
static

Get the directory path of a file path.

Parameters
filePaththe file path
Returns
the directory path of the file

◆ currentDir()

static std::string UDirectory::currentDir ( bool  trailingSeparator = false)
static

Get the current directory.

Parameters
trailingSeparatorIf true, a '/' is added to the path.
Returns
the current directory

◆ makeDir()

static bool UDirectory::makeDir ( const std::string &  dirPath)
static

Make a directory.

Parameters
dirPaththe directory path
Returns
true on success, false otherwise.

◆ removeDir()

static bool UDirectory::removeDir ( const std::string &  dirPath)
static

Remove a directory.

Parameters
dirPaththe directory path
Returns
true on success, false otherwise.

◆ homeDir()

static std::string UDirectory::homeDir ( )
static

Return the "home" directory.

Returns
the directory path.

◆ separator()

static std::string UDirectory::separator ( )
static

Return \ (Win32) or / (Unix) depending of the platform.

◆ setPath()

void UDirectory::setPath ( const std::string &  path,
const std::string &  extensions = "" 
)

Set path of the directory.

Parameters
paththe new directory path.

◆ update()

void UDirectory::update ( )

Update indexed file names (if the directory changed).

◆ isValid()

bool UDirectory::isValid ( )

Check is the directory exists.

Returns
if directory exists.

◆ getNextFileName()

std::string UDirectory::getNextFileName ( )

Get the next file name.

Returns
the next file name

◆ getNextFilePath()

std::string UDirectory::getNextFilePath ( )

Get the next file path.

Returns
the next file path

◆ getFileNames()

const std::list< std::string > & UDirectory::getFileNames ( ) const
inline

Get all file names.

See also
UDirectory()
Returns
all the file names in directory matching the set extensions.

Definition at line 129 of file UDirectory.h.

◆ rewind()

void UDirectory::rewind ( )

Return the pointer of file names to beginning.


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