WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
WXP::FileTool Class Reference

This class has a set of file tools. More...

#include "../include/FileTool.h"

Static Public Member Functions

static bool isFullPath (const char *filename)
 
static int addPath (const char *path, const char *file, String &filename)
 
static int checkPath (const char *path, const char *file)
 
static int addOutPath (const char *path, const char *file, String &filename)
 
static int numPath (const char *path)
 
static int getPath (const char *path, int ind, String &spath)
 
static int addPathDelim (String &path)
 
static int addUserPath (const char *file, String &filename)
 
static bool exist (const char *file)
 
static bool isStdio (const char *file)
 
static bool isDir (const char *file)
 
static bool isFile (const char *file)
 
static bool isFifo (const char *file)
 
static bool isDevice (const char *file)
 
static off_t getSize (const char *file)
 
static int getModTime (const char *file)
 
static int remove (const char *file)
 
static int makeDir (const char *dir, int flag)
 

Detailed Description

This class has a set of file tools.

Author
Dan Vietor

Member Function Documentation

◆ addOutPath()

int FileTool::addOutPath ( const char *  path,
const char *  file,
String filename 
)
static

Adds a path to the output filename. Won't add path if full path already or special file. File not assumed to exist.

Parameters
pathPath to add
fileFilename
Return values
filenameOutput filename

References addPathDelim(), WXP::String::append(), WXP::String::copy(), exist(), WXP::String::get(), getPath(), isFullPath(), isStdio(), numPath(), and WXP::StrLib::valid().

Referenced by WXP::RawPlot::draw(), WXP::GridCont::getDomain(), and WXP::GridVect::getDomain().

◆ addPath()

int FileTool::addPath ( const char *  path,
const char *  file,
String filename 
)
static

◆ addPathDelim()

int FileTool::addPathDelim ( String path)
static

Adds operating system specific path delimiter (/, )

Return values
pathPath to add delimiter to, appends to end of path

References WXP::String::append(), WXP::String::get(), WXP::String::getChar(), and WXP::String::length().

Referenced by addOutPath(), addPath(), checkPath(), and WXP::ResrcFile::open().

◆ addUserPath()

int FileTool::addUserPath ( const char *  file,
String filename 
)
static

Adds user path (~user). Check filename to see if user name specified and add user's home directory to path

Parameters
fileInput filename to check
Return values
filenameOutput filename with user name replaced

References WXP::String::append(), and WXP::String::copy().

Referenced by exist(), getModTime(), getSize(), isDevice(), isDir(), isFifo(), isFile(), WXP::File::open(), and remove().

◆ checkPath()

int FileTool::checkPath ( const char *  path,
const char *  file 
)
static

Checks path to the filename. Adds path and checks for existence.

Parameters
pathPath to add
fileFilename
Returns
1 if file exists

References addPathDelim(), WXP::String::append(), WXP::String::copy(), exist(), WXP::String::get(), getPath(), isFullPath(), isStdio(), numPath(), and WXP::StrLib::valid().

Referenced by WXP::RadPlot::init(), WXP::RcmPlot::init(), and WXP::SatPlot::init().

◆ exist()

bool FileTool::exist ( const char *  file)
static

◆ getModTime()

int FileTool::getModTime ( const char *  file)
static

Returns the modification time

Parameters
fileFilename to query

References addUserPath().

Referenced by WXP::RedbookFile::open().

◆ getPath()

int FileTool::getPath ( const char *  path,
int  ind,
String spath 
)
static

Gets a path from a path list (path:path:...)

Parameters
pathPath list
indIndex of path to get
Return values
spathOutput path

References WXP::String::clear(), WXP::String::copy(), WXP::StrLib::equal(), and WXP::StrLib::index().

Referenced by addOutPath(), addPath(), checkPath(), WXP::NameConv::encode(), WXP::Filename::listFile(), and WXP::License::valid().

◆ getSize()

off_t FileTool::getSize ( const char *  file)
static

Returns the size in bytes of a file

Parameters
fileFilename to query

References addUserPath(), and WXP::Wxp::outDebug().

Referenced by WXP::SfcWxpFile::checkType(), WXP::CityFile::open(), WXP::SfcWxpFile::open(), WXP::NameConv::setFile(), and WXP::NameConv::setLatest().

◆ isDevice()

bool FileTool::isDevice ( const char *  file)
static

Checks to see if file is a device

Parameters
fileFilename to check

References addUserPath(), and WXP::StrLib::iequal().

◆ isDir()

bool FileTool::isDir ( const char *  file)
static

Checks to see if file is a directory

Parameters
fileFilename to check

References addUserPath().

Referenced by WXP::ResrcFile::open().

◆ isFifo()

bool FileTool::isFifo ( const char *  file)
static

Checks to see if the file is a FIFO/queue

Parameters
fileFilename to check

References addUserPath().

◆ isFile()

bool FileTool::isFile ( const char *  file)
static

Checks to see if filename a regular file

Parameters
fileFilename to check

References addUserPath().

◆ isFullPath()

bool FileTool::isFullPath ( const char *  filename)
static

Returns if filename a full path

Returns
0=relative path, 1=full path

Referenced by addOutPath(), addPath(), WXP::Filename::checkFile(), and checkPath().

◆ isStdio()

bool FileTool::isStdio ( const char *  file)
static

◆ makeDir()

int FileTool::makeDir ( const char *  dir,
int  flag 
)
static

Create a directory and its subdirectories (recursive create)

Parameters
dirDirectory to create.
flagNumber to create (0=create all subdirectories)

References WXP::StrLib::copy(), WXP::StrLib::length(), and WXP::StrLib::replace().

Referenced by WXP::File::open().

◆ numPath()

int FileTool::numPath ( const char *  path)
static

Finds the number of valid paths in a multipath string

Parameters
pathPath to check

References WXP::StrLib::equal(), and WXP::StrLib::index().

Referenced by addOutPath(), addPath(), checkPath(), WXP::NameConv::encode(), WXP::Filename::listFile(), and WXP::License::valid().

◆ remove()

int FileTool::remove ( const char *  file)
static

Deletes the specified file

Parameters
fileFilename to delete

References addUserPath(), and WXP::String::get().


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