Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
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.
 
bool parsePosix (StringView input)
 Parses all components on posix input path.
 

Public Attributes

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

Detailed Description

Holds the various parsed components of a path.

Member Function Documentation

◆ parsePosix()

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

Parses all components on posix input path.

For example:

path.parsePosix("/123/456");
path.root == "/";
path.directory == "/123";
path.base == "456";
path.endsWithSeparator == false;
Holds the various parsed components of a path.
Definition Path.h:35
StringView root
Ex. "C:\\"</tt> on windows - <tt>"/" on posix.
Definition Path.h:41
StringView base
Ex. "base" for "C:\\dir\\base" on windows or "/dir/base" on posix.
Definition Path.h:43
StringView directory
Ex. "C:\\dir" on windows - "/dir" on posix.
Definition Path.h:42
bool parsePosix(StringView input)
Parses all components on posix input path.
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)
nodiscard

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:\\"</tt> on windows - <tt>"/" 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: