Loading...
Searching...
No Matches

Represents the GAMS path to a specific file. More...

#include <gamspath.h>

Inherits std::filesystem::path.

Public Member Functions

 GAMSPath ()
 Standard constructor.
 
 GAMSPath (const char *file)
 
 GAMSPath (const std::string &file)
 
 GAMSPath (const std::filesystem::path &file)
 
 GAMSPath (const std::filesystem::path &dir, const std::string &file)
 
 GAMSPath (const GAMSPath &gpath)
 
GAMSPathoperator= (const GAMSPath &other)
 
GAMSPathoperator<< (const std::string &append)
 
GAMSPathoperator+= (const std::string &append)
 
GAMSPath operator+ (const std::string &append)
 
GAMSPath operator+ (const char *append)
 
GAMSPath operator/ (const GAMSPath &append)
 
GAMSPath operator/ (const std::string &append)
 
GAMSPath operator/ (const char *append)
 
 operator std::string ()
 Converts a std::string to GAMSPath.
 
std::string toStdString () const
 Get the path or file as std::string.
 
const char * c_str () const
 
GAMSPath tempDir (const std::string &tempPath=std::string())
 
GAMSPath tempFile (const std::string &tempName="XXXXXX.tmp")
 
void setSuffix (const char *suffix)
 
void setSuffix (const std::string &suffix)
 
GAMSPath suffix (const std::string &suffix) const
 
GAMSPath suffix (const char *suffix) const
 
GAMSPath up () const
 
std::string suffix () const
 Path suffix.
 
GAMSPath path () const
 Get the GAMSPath.
 
bool mkDir () const
 Create the directory.
 
bool rmDirRecurse ()
 
void pack ()
 Normalizes the Path to make it comparable by converting it to it's shortest absolute representation.
 
bool remove ()
 
bool rename (const std::string &newFileName)
 
bool rename (const char *newFileName)
 
bool exists () const
 

Static Public Member Functions

static bool exists (const std::string &file)
 
static bool exists (const char *file)
 

Detailed Description

Represents the GAMS path to a specific file.

Definition at line 34 of file gamspath.h.

Constructor & Destructor Documentation

◆ GAMSPath() [1/6]

gams::GAMSPath::GAMSPath ( )
inline

Standard constructor.

Definition at line 38 of file gamspath.h.

◆ GAMSPath() [2/6]

gams::GAMSPath::GAMSPath ( const char *  file)
inline

Constructs a GAMSPath based on a path or file.

Parameters
filePath or file.

Definition at line 42 of file gamspath.h.

◆ GAMSPath() [3/6]

gams::GAMSPath::GAMSPath ( const std::string &  file)
inline

Constructs a GAMSPath based on a path or file.

Parameters
filePath or file.

Definition at line 46 of file gamspath.h.

◆ GAMSPath() [4/6]

gams::GAMSPath::GAMSPath ( const std::filesystem::path &  file)
inline

Constructs a GAMSPath based on a path or file.

Parameters
fileFile.

Definition at line 50 of file gamspath.h.

◆ GAMSPath() [5/6]

gams::GAMSPath::GAMSPath ( const std::filesystem::path &  dir,
const std::string &  file 
)
inline

Constructs a GAMSPath based on a path or file.

Parameters
dirPath.
fileFile.

Definition at line 55 of file gamspath.h.

◆ GAMSPath() [6/6]

gams::GAMSPath::GAMSPath ( const GAMSPath gpath)
inline

Constructs a GAMSPath based on a path or file.

Parameters
gpathAnother GAMSPath used as data source.

Definition at line 59 of file gamspath.h.

Member Function Documentation

◆ c_str()

const char * gams::GAMSPath::c_str ( ) const

Get the path or file as character string. Warning: This function may behave differently than path::c_str()

◆ exists() [1/3]

bool gams::GAMSPath::exists ( ) const

Checks if the path exists.

Returns
Returns true if the path exists; otherwise false.

◆ exists() [2/3]

static bool gams::GAMSPath::exists ( const char *  file)
static

Checks if the file exists.

Parameters
fileThe file name.
Returns
Returns true if the file exists; otherwise false.

◆ exists() [3/3]

static bool gams::GAMSPath::exists ( const std::string &  file)
static

Checks if the file exists.

Parameters
fileThe file name.
Returns
Returns true if the file exists; otherwise false.

◆ mkDir()

bool gams::GAMSPath::mkDir ( ) const

Create the directory.

◆ operator std::string()

gams::GAMSPath::operator std::string ( )

Converts a std::string to GAMSPath.

◆ operator+() [1/2]

GAMSPath gams::GAMSPath::operator+ ( const char *  append)

Appends the string to the GAMSPath.

Parameters
appendThe string to append.
Returns
Returns the GAMSPath with the string appended.

◆ operator+() [2/2]

GAMSPath gams::GAMSPath::operator+ ( const std::string &  append)

Appends the string to the GAMSPath.

Parameters
appendThe string to append.
Returns
Returns the GAMSPath with the string appended.

◆ operator+=()

GAMSPath & gams::GAMSPath::operator+= ( const std::string &  append)

Appends the string to the GAMSPath.

Parameters
appendThe string to append.
Returns
Returns the GAMSPath with the string appended.

◆ operator/() [1/3]

GAMSPath gams::GAMSPath::operator/ ( const char *  append)

Appends a path to the GAMSPath.

Parameters
appendThe path to append.
Returns
Returns the GAMSPath with the path appended.

◆ operator/() [2/3]

GAMSPath gams::GAMSPath::operator/ ( const GAMSPath append)

Appends a path to the GAMSPath.

Parameters
appendThe path to append.
Returns
Returns the GAMSPath with the path appended.

◆ operator/() [3/3]

GAMSPath gams::GAMSPath::operator/ ( const std::string &  append)

Appends a path to the GAMSPath.

Parameters
appendThe path to append.
Returns
Returns the GAMSPath with the path appended.

◆ operator<<()

GAMSPath & gams::GAMSPath::operator<< ( const std::string &  append)

Appends the string to the GAMSPath.

Parameters
appendThe string to append.
Returns
Returns the GAMSPath with the string appended.

◆ operator=()

GAMSPath & gams::GAMSPath::operator= ( const GAMSPath other)

Assigns a GAMSPath.

Parameters
otherAnother GAMSPath used as data source.
Returns
Returns the assigned GAMSPath (*this).

◆ pack()

void gams::GAMSPath::pack ( )

Normalizes the Path to make it comparable by converting it to it's shortest absolute representation.

◆ path()

GAMSPath gams::GAMSPath::path ( ) const

Get the GAMSPath.

◆ remove()

bool gams::GAMSPath::remove ( )

Removes the file.

Returns
Returns true if the removal was successfull; otherwise false.

◆ rename() [1/2]

bool gams::GAMSPath::rename ( const char *  newFileName)

Rename the already set file.

Parameters
newFileNameThe new file name.
Returns
Returns true if the rename was successfull; otherwise false.

◆ rename() [2/2]

bool gams::GAMSPath::rename ( const std::string &  newFileName)

Rename the already set file.

Parameters
newFileNameThe new file name.
Returns
Returns true if the rename was successfull; otherwise false.

◆ rmDirRecurse()

bool gams::GAMSPath::rmDirRecurse ( )

Removes the direcotry recursively.

Returns
Returns true if the removal was successfull; otherwise false.

◆ setSuffix() [1/2]

void gams::GAMSPath::setSuffix ( const char *  suffix)

Add a suffix to the GAMSPath.

Parameters
suffixThe suffix to add.

◆ setSuffix() [2/2]

void gams::GAMSPath::setSuffix ( const std::string &  suffix)

Add a suffix to the GAMSPath.

Parameters
suffixThe suffix to add.

◆ suffix() [1/3]

std::string gams::GAMSPath::suffix ( ) const

Path suffix.

◆ suffix() [2/3]

GAMSPath gams::GAMSPath::suffix ( const char *  suffix) const

Constructs a new file path using the current file's basename and adding the given suffix to it.

Parameters
suffixThe suffix of the file to get.
Returns
Returns a GAMSPath to a new file of the same name but with a replaced suffix.

◆ suffix() [3/3]

GAMSPath gams::GAMSPath::suffix ( const std::string &  suffix) const

Constructs a new file path using the current file's basename and adding the given suffix to it.

Parameters
suffixThe suffix of the file to get.
Returns
Returns a GAMSPath to a new file of the same name but with a replaced suffix.

◆ tempDir()

GAMSPath gams::GAMSPath::tempDir ( const std::string &  tempPath = std::string())

Create a GAMSPath to a temporary directory.

Parameters
tempPathTemplate temporary directory.
Returns
Returns a GAMSPath to the temporary directory.

◆ tempFile()

GAMSPath gams::GAMSPath::tempFile ( const std::string &  tempName = "XXXXXX.tmp")

Create a GAMSPath to a temporary file.

Parameters
tempNameTemplate for temporary file name.
Returns
Returns a GAMSPath to the temporary file.

◆ toStdString()

std::string gams::GAMSPath::toStdString ( ) const

Get the path or file as std::string.

◆ up()

GAMSPath gams::GAMSPath::up ( ) const

Get the GAMS path as optimized path.

Returns
Returns a new GAMSPath object.