Gorgon Game Engine
URIPath Class Reference

Helps to manage URIPaths. More...

Public Member Functions

 URIPath ()=default
 Empty constructor. More...
 
 URIPath (const char *path)
 Parses the given path. More...
 
 URIPath (const std::string &path)
 Parses the given path. More...
 
 URIPath (std::initializer_list< std::string > init)
 Initializes the path by the given segments. More...
 
void Combine (const URIPath &another)
 Combines another URIPath using this one as the root. More...
 
std::string Convert () const
 Converts the path to string properly escaping for URI. More...
 
std::string Get (int ind) const
 Returns the segment at the given index. Index 0 will never cause an error, if does not exists, it will be empty string. More...
 
int GetSize () const
 
void Normalize ()
 Normalizes any relative references in the path. May throw URIError. More...
 
 operator std::string () const
 Converts the path to string properly escaping for URI. More...
 
bool operator!= (const URIPath &other) const
 Compares two paths after normalization. More...
 
URIPath operator+ (const URIPath &another) const
 Combines this path with another, using this path as the root. More...
 
URIPathoperator+= (const URIPath &another)
 Combines another URIPath into this one, using this path as the root. More...
 
bool operator== (const URIPath &other) const
 Compares two paths after normalization. More...
 
std::string & operator[] (int ind)
 Returns the segment at the given index. More...
 
const std::string & operator[] (int ind) const
 Returns the segment at the given index. More...
 
std::string StripFirst ()
 Returns the first segment and removes it from the list of segments. More...
 

Public Attributes

std::vector< std::string > segments
 List of segments. More...
 

Detailed Description

Helps to manage URIPaths.

Note that the URI paths are always absolute. Allows normalization as well as remapping, which would be useful to convert URI paths to file system paths.

Constructor & Destructor Documentation

◆ URIPath() [1/4]

URIPath ( )
default

Empty constructor.

◆ URIPath() [2/4]

URIPath ( std::initializer_list< std::string >  init)

Initializes the path by the given segments.

◆ URIPath() [3/4]

URIPath ( const std::string &  path)

Parses the given path.

References URIPath::segments.

◆ URIPath() [4/4]

URIPath ( const char *  path)

Parses the given path.

Member Function Documentation

◆ Combine()

void Combine ( const URIPath another)

Combines another URIPath using this one as the root.

References URIPath::segments.

◆ Convert()

std::string Convert ( ) const

Converts the path to string properly escaping for URI.

◆ Get()

std::string Get ( int  ind) const

Returns the segment at the given index. Index 0 will never cause an error, if does not exists, it will be empty string.

References URIPath::segments.

◆ GetSize()

int GetSize ( ) const

References URIPath::segments.

◆ Normalize()

void Normalize ( )

Normalizes any relative references in the path. May throw URIError.

References URIPath::segments.

◆ operator std::string()

operator std::string ( ) const

Converts the path to string properly escaping for URI.

◆ operator!=()

bool operator!= ( const URIPath other) const

Compares two paths after normalization.

◆ operator+()

URIPath operator+ ( const URIPath another) const

Combines this path with another, using this path as the root.

References URIPath::Combine().

◆ operator+=()

URIPath& operator+= ( const URIPath another)

Combines another URIPath into this one, using this path as the root.

References URIPath::Combine().

◆ operator==()

bool operator== ( const URIPath other) const

Compares two paths after normalization.

References URIPath::Normalize().

◆ operator[]() [1/2]

std::string& operator[] ( int  ind)

Returns the segment at the given index.

References URIPath::segments.

◆ operator[]() [2/2]

const std::string& operator[] ( int  ind) const

Returns the segment at the given index.

References URIPath::segments.

◆ StripFirst()

std::string StripFirst ( )

Returns the first segment and removes it from the list of segments.

This function will never fire error. If there are no segments it will return empty string

References URIPath::segments.

Member Data Documentation

◆ segments

std::vector<std::string> segments

List of segments.


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