libvot  0.1.3
A C++11 multithread library for image retrieval
Static Public Member Functions | List of all members
tw::IO Class Reference

To safely read and write files. More...

#include <io_utils.h>

Static Public Member Functions

template<class charType >
static void TrimLeft (std::basic_string< charType > &str, const char *chars2remove=NULL)
 trim the left of a string More...
 
template<class charType >
static void TrimRight (std::basic_string< charType > &str, const char *chars2remove=NULL)
 trim the right of a string More...
 
template<class charType >
static void Trim (std::basic_string< charType > &str, const char *chars2remove=NULL)
 
static bool IsEmptyString (const std::string &str)
 
static int ExtractLines (const char *input_file_path, std::vector< std::string > &lines)
 extract lines from a text file More...
 
static bool IsFileExist (const char *filename)
 judge whether the file exists More...
 
static std::string JoinPath (std::string folder, std::string filename)
 join a filename with a directory name More...
 
static std::pair< std::string, std::string > SplitPath (std::string path)
 separate the folder from the filename More...
 
static std::pair< std::string, std::string > SplitPathExt (std::string path)
 separate the basename from the file type (extension) More...
 
static std::string GetFilename (std::string path)
 get filename without folder path and suffix file format More...
 
static bool Mkdir (const std::string path)
 make a directory More...
 
static size_t GetAvailMem ()
 return the total availbale memory that can be used More...
 

Detailed Description

To safely read and write files.

IO class contains a set of utility function for dealing with file read/write. It also has some utility function related to operating system, such as getting the maximum available memory.

Member Function Documentation

int tw::IO::ExtractLines ( const char *  input_file_path,
std::vector< std::string > &  lines 
)
static

extract lines from a text file

size_t tw::IO::GetAvailMem ( )
static

return the total availbale memory that can be used

std::string tw::IO::GetFilename ( std::string  path)
static

get filename without folder path and suffix file format

bool tw::IO::IsEmptyString ( const std::string &  str)
static
bool tw::IO::IsFileExist ( const char *  filename)
static

judge whether the file exists

std::string tw::IO::JoinPath ( std::string  folder,
std::string  filename 
)
static

join a filename with a directory name

bool tw::IO::Mkdir ( const std::string  path)
static

make a directory

std::pair< std::string, std::string > tw::IO::SplitPath ( std::string  path)
static

separate the folder from the filename

std::pair< std::string, std::string > tw::IO::SplitPathExt ( std::string  path)
static

separate the basename from the file type (extension)

template<class charType >
void tw::IO::Trim ( std::basic_string< charType > &  str,
const char *  chars2remove = NULL 
)
static
template<class charType >
void tw::IO::TrimLeft ( std::basic_string< charType > &  str,
const char *  chars2remove = NULL 
)
static

trim the left of a string

template<class charType >
void tw::IO::TrimRight ( std::basic_string< charType > &  str,
const char *  chars2remove = NULL 
)
static

trim the right of a string


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