Public Types | Public Member Functions | Private Attributes | List of all members
dai::Path Class Reference

Represents paths on a filesystem; accepts utf-8, Windows utf-16 wchar_t, or std::filesystem::path. More...

#include <Path.hpp>

Public Types

using string_type = std::basic_string< value_type >
 
using value_type = char
 character used by native-encoding of filesystem More...
 

Public Member Functions

bool empty () const noexcept
 Observes if path is empty (contains no string/folders/filename) More...
 
const string_typenative () const noexcept
 Returns native-encoding string by const reference, suitable for use with OS APIs. More...
 
 operator string_type () const noexcept
 Implicitly convert to native-encoding string, suitable for use with OS APIs. More...
 
Pathoperator= (const Path &)=default
 
Pathoperator= (Path &&)=default
 
 Path ()=default
 
 Path (const Path &)=default
 
 Path (const string_type &source)
 Construct Path object from source. More...
 
 Path (const value_type *source)
 Construct Path object from source. More...
 
 Path (Path &&)=default
 
 Path (string_type &&source) noexcept
 Construct Path object from source. More...
 
std::string string () const
 Get path in native-encoding string; no conversion. More...
 
std::string u8string () const
 Get path in utf-8. More...
 
 ~Path ()=default
 

Private Attributes

string_type _nativePath
 

Detailed Description

Represents paths on a filesystem; accepts utf-8, Windows utf-16 wchar_t, or std::filesystem::path.

It is suitable for direct use with OS APIs. Features are limited to character-set conversion of paths. It is not intended as a full replacement for std::filesystem::path

Definition at line 27 of file Path.hpp.

Member Typedef Documentation

◆ string_type

using dai::Path::string_type = std::basic_string<value_type>

Definition at line 34 of file Path.hpp.

◆ value_type

using dai::Path::value_type = char

character used by native-encoding of filesystem

Definition at line 32 of file Path.hpp.

Constructor & Destructor Documentation

◆ Path() [1/6]

dai::Path::Path ( )
default

◆ ~Path()

dai::Path::~Path ( )
default

◆ Path() [2/6]

dai::Path::Path ( const Path )
default

◆ Path() [3/6]

dai::Path::Path ( Path &&  )
default

◆ Path() [4/6]

dai::Path::Path ( string_type &&  source)
inlinenoexcept

Construct Path object from source.

Parameters
sourcenative-encoding character sequence; no conversion

Definition at line 48 of file Path.hpp.

◆ Path() [5/6]

dai::Path::Path ( const string_type source)
inline

Construct Path object from source.

Parameters
sourcenative-encoding character sequence; no conversion

Definition at line 55 of file Path.hpp.

◆ Path() [6/6]

dai::Path::Path ( const value_type source)
inline

Construct Path object from source.

Parameters
sourcepointer to null-terminated native-encoding character sequence; no conversion

Definition at line 62 of file Path.hpp.

Member Function Documentation

◆ empty()

bool dai::Path::empty ( ) const
inlinenoexcept

Observes if path is empty (contains no string/folders/filename)

Returns
bool true if the path is empty, false otherwise

Definition at line 194 of file Path.hpp.

◆ native()

const string_type& dai::Path::native ( ) const
inlinenoexcept

Returns native-encoding string by const reference, suitable for use with OS APIs.

Returns
const std::string& of utf-8 on most OSs, const std::wstring& of utf-16 on Windows

Definition at line 184 of file Path.hpp.

◆ operator string_type()

dai::Path::operator string_type ( ) const
inlinenoexcept

Implicitly convert to native-encoding string, suitable for use with OS APIs.

Returns
std::string of utf-8 on most OSs, std::wstring of utf-16 on Windows

Definition at line 175 of file Path.hpp.

◆ operator=() [1/2]

Path& dai::Path::operator= ( const Path )
default

◆ operator=() [2/2]

Path& dai::Path::operator= ( Path &&  )
default

◆ string()

std::string dai::Path::string ( ) const
inline

Get path in native-encoding string; no conversion.

Returns
std::string

Definition at line 145 of file Path.hpp.

◆ u8string()

std::string dai::Path::u8string ( ) const
inline

Get path in utf-8.

Returns
std::string in utf-8

Definition at line 164 of file Path.hpp.

Member Data Documentation

◆ _nativePath

string_type dai::Path::_nativePath
private

Definition at line 199 of file Path.hpp.


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


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:20