Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::Path::ParsedView Struct Reference

Holds the various parsed components of a path. More...

#include <Path.h>

Public Member Functions

bool parseWindows (StringView input)
 Parses all components on windows input path. More...
 
bool parsePosix (StringView input)
 Parses all components on posix input path. More...
 

Public Attributes

bool endsWithSeparator = false
 
Type type = AsPosix
 Indicates if this is a windows or posix path. More...
 
StringView root
 Ex. "C:\\" on windows - "/" on posix. More...
 
StringView directory
 Ex. "C:\\dir" on windows - "/dir" on posix. More...
 
StringView base
 Ex. "base" for "C:\\dir\\base" on windows or "/dir/base" on posix. More...
 
StringView name
 Ex. "name" for "C:\\dir\\name.ext" on windows or "/dir/name.ext" on posix. More...
 
StringView ext
 Ex. "ext" for "C:\\dir\\name.ext" on windows or "/dir/name.ext" on posix. More...
 

Detailed Description

Holds the various parsed components of a path.

Member Function Documentation

◆ parsePosix()

bool SC::Path::ParsedView::parsePosix ( StringView  input)

Parses all components on posix input path.

For example:

Path::ParsedView path;
path.parsePosix("/123/456");
path.root == "/";
path.directory == "/123";
path.base == "456";
path.endsWithSeparator == false;
Parameters
inputA path in posix form (ex "/directory/name.ext")
Returns
false if both name and extension will be empty after parsing or if parsing name/extension fails

◆ parseWindows()

bool SC::Path::ParsedView::parseWindows ( StringView  input)

Parses all components on windows input path.

For example:

path.parseWindows("C:\\ASD\\bbb\\name.ext");
path.root == "C:\\";
path.directory == "C:\\ASD\\bbb";
path.base == "name.ext";
path.name == "name";
path.ext == "ext";
path.endsWithSeparator == false;
Parameters
inputA path in windows form (ex "C:\\directory\name.ext")
Returns
false if both name and extension will be empty after parsing or if parsing name/extension fails

Member Data Documentation

◆ base

StringView SC::Path::ParsedView::base

Ex. "base" for "C:\\dir\\base" on windows or "/dir/base" on posix.

◆ directory

StringView SC::Path::ParsedView::directory

Ex. "C:\\dir" on windows - "/dir" on posix.

◆ ext

StringView SC::Path::ParsedView::ext

Ex. "ext" for "C:\\dir\\name.ext" on windows or "/dir/name.ext" on posix.

◆ name

StringView SC::Path::ParsedView::name

Ex. "name" for "C:\\dir\\name.ext" on windows or "/dir/name.ext" on posix.

◆ root

StringView SC::Path::ParsedView::root

Ex. "C:\\" on windows - "/" on posix.

◆ type

Type SC::Path::ParsedView::type = AsPosix

Indicates if this is a windows or posix path.


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