turbo::Path Class Referencefinal
Path class is used to simplify the edition of paths. More...
#include <Path.hpp>
Public Member Functions | |
Path (const char *path) | |
Construct a new Path object. More... | |
const char * | get_drive () const |
Get the drive of the path. | |
int | get_num_components () const |
Get the number of components in the path. | |
const char * | get_component (int i) const |
Get the component at a choosen position. More... | |
const char * | get_tail () const |
Get the last component of the path. | |
const char * | get_filename () const |
Get the filename of the path (can be null if there is no file) | |
const char * | get_basename () const |
Get the basename of the file (can be null if there is no file) | |
const char * | get_file_extension () const |
Get the file extension of the path (can be null if there is no file) | |
void | set_drive (const char *drive) |
Set the drive of the path. More... | |
void | append_component (const char *component) |
Add a component to the path (add a folder to the end of the path) More... | |
void | insert_component (int i, const char *component) |
Insert a component at a specified position. More... | |
void | replace_component (int i, const char *component) |
Replace a component at a specified position. More... | |
void | remove_component (int i) |
Remove a compoent at a specified position. More... | |
void | drop_tail () |
Removes the last component of the path. | |
void | set_filename (const char *filename) |
Set the filename of the path. More... | |
void | set_file_extension (const char *ext) |
Set the file extension of the path file. More... | |
void | absolute () |
Make the path canonical removes the .. and . component and make it absolute. | |
const char * | c_str () const |
Get the path string. More... | |
operator const char * () const | |
operator std::string () const | |
Static Public Member Functions | |
static Path * | get_resources_path () |
Get the standard resource path. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &output, const Path &path) |
Detailed Description
Path class is used to simplify the edition of paths.
Constructor & Destructor Documentation
◆ Path()
turbo::Path::Path | ( | const char * | path | ) |
Member Function Documentation
◆ append_component()
void turbo::Path::append_component | ( | const char * | component | ) |
Add a component to the path (add a folder to the end of the path)
Example: myPath.append_component("src");
- Parameters
-
component component to add
◆ c_str()
const char * turbo::Path::c_str | ( | ) | const |
Get the path string.
- Returns
- const char* path string
◆ get_component()
const char * turbo::Path::get_component | ( | int | i | ) | const |
Get the component at a choosen position.
- Parameters
-
i position
◆ get_resources_path()
|
static |
Get the standard resource path.
- Returns
- Path* new path that needs to be deleted after usage
◆ insert_component()
void turbo::Path::insert_component | ( | int | i, |
const char * | component | ||
) |
Insert a component at a specified position.
- Parameters
-
i posiiton component component to insert
◆ remove_component()
void turbo::Path::remove_component | ( | int | i | ) |
Remove a compoent at a specified position.
- Parameters
-
i position
◆ replace_component()
void turbo::Path::replace_component | ( | int | i, |
const char * | component | ||
) |
Replace a component at a specified position.
- Parameters
-
i position component component to insert
◆ set_drive()
void turbo::Path::set_drive | ( | const char * | drive | ) |
Set the drive of the path.
Example: myPath.set_drive("C:");
- Parameters
-
drive target drive
◆ set_file_extension()
void turbo::Path::set_file_extension | ( | const char * | ext | ) |
Set the file extension of the path file.
Example: myPath.set_file_extension("png");
- Parameters
-
ext extension
◆ set_filename()
void turbo::Path::set_filename | ( | const char * | filename | ) |
Set the filename of the path.
- Parameters
-
filename file name
The documentation for this class was generated from the following files:
- include/turbo/Path.hpp
- src/Path.cpp