Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
UFile Class Reference

#include <UFile.h>

Public Member Functions

void copy (const std::string &to)
 
bool exists ()
 
std::string getExtension ()
 
std::string getName ()
 
bool isValid ()
 
long length ()
 
int rename (const std::string &newName)
 
 UFile (const std::string &path)
 
 ~UFile ()
 

Static Public Member Functions

static void copy (const std::string &from, const std::string &to)
 
static int erase (const std::string &filePath)
 
static bool exists (const std::string &filePath)
 
static std::string getExtension (const std::string &filePath)
 
static std::string getName (const std::string &filePath)
 
static long length (const std::string &filePath)
 
static int rename (const std::string &oldFilePath, const std::string &newFilePath)
 

Private Attributes

std::string path_
 

Detailed Description

Class UFile.

This class can be used to modify/erase files on hard drive.

Definition at line 33 of file UFile.h.

Constructor & Destructor Documentation

◆ UFile()

UFile::UFile ( const std::string path)
inline

Create a UFile object with path initialized to an existing file .

Parameters
paththe path to an existing file

Definition at line 91 of file UFile.h.

◆ ~UFile()

UFile::~UFile ( )
inline

Definition at line 92 of file UFile.h.

Member Function Documentation

◆ copy() [1/2]

void UFile::copy ( const std::string from,
const std::string to 
)
static

Copy a file.

Parameters
fromthe file path
todestination file path

Definition at line 97 of file UFile.cpp.

◆ copy() [2/2]

void UFile::copy ( const std::string to)
inline

Copy a file.

Parameters
todestination file path

Definition at line 146 of file UFile.h.

◆ erase()

int UFile::erase ( const std::string filePath)
static

Erase a file.

Parameters
filePaththe file path
Returns
0 if success.

Definition at line 58 of file UFile.cpp.

◆ exists() [1/2]

bool UFile::exists ( )
inline

Check if the file exists.

Returns
true if the path exits

Definition at line 104 of file UFile.h.

◆ exists() [2/2]

bool UFile::exists ( const std::string filePath)
static

Check if a file exists.

Parameters
filePaththe file path
Returns
true if the file exists, otherwise false.

Definition at line 25 of file UFile.cpp.

◆ getExtension() [1/2]

std::string UFile::getExtension ( )
inline

Get the file extension.

Returns
the file extension

Definition at line 140 of file UFile.h.

◆ getExtension() [2/2]

std::string UFile::getExtension ( const std::string filePath)
static

Get the file extension.

Returns
the file extension

Definition at line 87 of file UFile.cpp.

◆ getName() [1/2]

std::string UFile::getName ( )
inline

Get the file name without the path.

Returns
the file name

Definition at line 135 of file UFile.h.

◆ getName() [2/2]

std::string UFile::getName ( const std::string filePath)
static

Get the file name from a file path (with extension).

Parameters
filePaththe file path
Returns
the file name.

Definition at line 69 of file UFile.cpp.

◆ isValid()

bool UFile::isValid ( )
inline

Check if the file exists. Same as exists().

Returns
true if the path exits

Definition at line 98 of file UFile.h.

◆ length() [1/2]

long UFile::length ( )
inline

Get the length of the file.

Returns
long the length of the file in bytes. Return -1 if the file doesn't exist.

Definition at line 110 of file UFile.h.

◆ length() [2/2]

long UFile::length ( const std::string filePath)
static

Get the file length.

Parameters
filePaththe file path
Returns
long the length of the file in bytes. Return -1 if the file doesn't exist.

Definition at line 37 of file UFile.cpp.

◆ rename() [1/2]

int UFile::rename ( const std::string newName)
inline

Rename the file name. The path stays the same.

Parameters
thenew name

Definition at line 116 of file UFile.h.

◆ rename() [2/2]

int UFile::rename ( const std::string oldFilePath,
const std::string newFilePath 
)
static

Rename a file.

Parameters
oldFilePaththe old file path
newFilePaththe new file path
Returns
0 if success.

Definition at line 63 of file UFile.cpp.

Member Data Documentation

◆ path_

std::string UFile::path_
private

Definition at line 149 of file UFile.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:26