nomlib
Loading...
Searching...
No Matches
nom::Path Class Reference

Platform-agnostic handling of directory paths. More...

#include <Path.hpp>

Public Types

typedef std::string value_type

Public Member Functions

void init (void)
 Initialize the platform's native path delimiter.
 Path (void)
 Default constructor; initialize the native path delimiter.
 ~Path (void)
 Destructor; nothing to clean up (automatic clean up).
 Path (const std::string &p)
 Construct a complete object.
const value_typenative (void) const
const std::string & path (void) const
 Obtain assigned pathname.
Pathoperator= (const Path &rhs)
 Assignment operator.
std::string prepend (const std::string &path) const
 Add the set object's file path to the beginning of a file path.

Private Attributes

value_type path_separator
std::string pathname

Detailed Description

Platform-agnostic handling of directory paths.

Inspired by Boost::Filesystem

See also
http://www.boost.org/doc/libs/1_55_0/libs/filesystem/doc/reference.html#class-path

Definition at line 41 of file Path.hpp.

Member Typedef Documentation

◆ value_type

typedef std::string nom::Path::value_type

Platform-dependent data typedef used for defining the preferred file path separator.

See also
::init.

Definition at line 48 of file Path.hpp.

Constructor & Destructor Documentation

◆ Path()

nom::Path::Path ( const std::string & p)

Construct a complete object.

Parameters
pThe relative or absolute path to a file or directory.

Member Function Documentation

◆ native()

const value_type & nom::Path::native ( void ) const

Obtain native path (directory) separator; the value returned is dependent upon the platform and is determined at compile-time, not run-time.

◆ prepend()

std::string nom::Path::prepend ( const std::string & path) const

Add the set object's file path to the beginning of a file path.

Returns
If the set file path does not end with a backslash character, one is appended beforehand, otherwise the object's file path is appended to the specified file path.
Todo
Rename to append.

Member Data Documentation

◆ path_separator

value_type nom::Path::path_separator
private

Definition at line 85 of file Path.hpp.

◆ pathname

std::string nom::Path::pathname
private

Definition at line 86 of file Path.hpp.


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