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) | |
GAMSPath & | operator= (const GAMSPath &other) |
GAMSPath & | operator<< (const std::string &append) |
GAMSPath & | operator+= (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]
|
inline |
Standard constructor.
Definition at line 38 of file gamspath.h.
◆ GAMSPath() [2/6]
|
inline |
Constructs a GAMSPath based on a path or file.
- Parameters
-
file Path or file.
Definition at line 42 of file gamspath.h.
◆ GAMSPath() [3/6]
|
inline |
Constructs a GAMSPath based on a path or file.
- Parameters
-
file Path or file.
Definition at line 46 of file gamspath.h.
◆ GAMSPath() [4/6]
|
inline |
Constructs a GAMSPath based on a path or file.
- Parameters
-
file File.
Definition at line 50 of file gamspath.h.
◆ GAMSPath() [5/6]
|
inline |
Constructs a GAMSPath based on a path or file.
- Parameters
-
dir Path. file File.
Definition at line 55 of file gamspath.h.
◆ GAMSPath() [6/6]
|
inline |
Constructs a GAMSPath based on a path or file.
- Parameters
-
gpath Another 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; otherwisefalse
.
◆ exists() [2/3]
|
static |
Checks if the file exists.
- Parameters
-
file The file name.
- Returns
- Returns
true
if the file exists; otherwisefalse
.
◆ exists() [3/3]
|
static |
Checks if the file exists.
- Parameters
-
file The file name.
- Returns
- Returns
true
if the file exists; otherwisefalse
.
◆ 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
-
append The 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
-
append The 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
-
append The 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
-
append The path to append.
- Returns
- Returns the GAMSPath with the path appended.
◆ operator/() [2/3]
Appends a path to the GAMSPath.
- Parameters
-
append The 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
-
append The 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
-
append The string to append.
- Returns
- Returns the GAMSPath with the string appended.
◆ operator=()
Assigns a GAMSPath.
- Parameters
-
other Another 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; otherwisefalse
.
◆ rename() [1/2]
bool gams::GAMSPath::rename | ( | const char * | newFileName | ) |
Rename the already set file.
- Parameters
-
newFileName The new file name.
- Returns
- Returns
true
if the rename was successfull; otherwisefalse
.
◆ rename() [2/2]
bool gams::GAMSPath::rename | ( | const std::string & | newFileName | ) |
Rename the already set file.
- Parameters
-
newFileName The new file name.
- Returns
- Returns
true
if the rename was successfull; otherwisefalse
.
◆ rmDirRecurse()
bool gams::GAMSPath::rmDirRecurse | ( | ) |
Removes the direcotry recursively.
- Returns
- Returns
true
if the removal was successfull; otherwisefalse
.
◆ setSuffix() [1/2]
void gams::GAMSPath::setSuffix | ( | const char * | suffix | ) |
Add a suffix to the GAMSPath.
- Parameters
-
suffix The suffix to add.
◆ setSuffix() [2/2]
void gams::GAMSPath::setSuffix | ( | const std::string & | suffix | ) |
Add a suffix to the GAMSPath.
- Parameters
-
suffix The 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
-
suffix The 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
-
suffix The 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
-
tempPath Template 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
-
tempName Template 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.