FreeNOS
Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
FileSystemPath Class Reference

Simple filesystem path parser. More...

#include <FileSystemPath.h>

Public Member Functions

 FileSystemPath (const char *path, const char separator=DefaultSeparator)
 Constructor using char pointer. More...
 
const Stringparent () const
 Retrieve the full path of our parent. More...
 
const Stringbase () const
 The name of the last element in the path. More...
 
const Stringfull () const
 Get the full path as a String. More...
 
const List< String > & split () const
 Returns a List of separate path elements. More...
 
Size length () const
 Get Length of our full path. More...
 

Static Public Attributes

static const Size MaximumLength = 64u
 Maximum length of a filesystem path in bytes. More...
 

Private Attributes

const char m_separator
 Separator character. More...
 
const String m_full
 Full input path. More...
 
const List< Stringm_path
 The path split in pieces by the separator. More...
 
const String m_base
 Last element in the full path. More...
 
String m_parent
 Full path to our parent. More...
 

Static Private Attributes

static const char DefaultSeparator = '/'
 The default path separator character. More...
 

Detailed Description

Simple filesystem path parser.

Definition at line 37 of file FileSystemPath.h.

Constructor & Destructor Documentation

◆ FileSystemPath()

FileSystemPath::FileSystemPath ( const char *  path,
const char  separator = DefaultSeparator 
)

Constructor using char pointer.

Parameters
pathThe input path to parse.
separatorPathname separator.

Definition at line 22 of file FileSystemPath.cpp.

References List< T >::head(), m_parent, m_path, m_separator, and ZERO.

Member Function Documentation

◆ base()

const String & FileSystemPath::base ( ) const

The name of the last element in the path.

Returns
Name of the base.

Definition at line 53 of file FileSystemPath.cpp.

References m_base.

Referenced by FileSystemServer::insertFileCache(), and FileSystemServer::registerFile().

◆ full()

const String & FileSystemPath::full ( ) const

Get the full path as a String.

Returns
String instance.

Definition at line 58 of file FileSystemPath.cpp.

References m_full.

Referenced by FileSystemServer::processRequest().

◆ length()

Size FileSystemPath::length ( ) const

Get Length of our full path.

Returns
Length.

Definition at line 68 of file FileSystemPath.cpp.

References String::length(), and m_full.

Referenced by FileSystemServer::findFileCache().

◆ parent()

const String & FileSystemPath::parent ( ) const

Retrieve the full path of our parent.

Returns
Path of our parent.

Definition at line 48 of file FileSystemPath.cpp.

References m_parent.

Referenced by FileSystemServer::findFileCache(), FileSystemServer::getParentDirectory(), and FileSystemServer::insertFileCache().

◆ split()

const List< String > & FileSystemPath::split ( ) const

Returns a List of separate path elements.

Returns
Pointer to a List.

Definition at line 63 of file FileSystemPath.cpp.

References m_path.

Referenced by chdir(), FileSystemServer::findFileCache(), and FileSystemServer::lookupFile().

Field Documentation

◆ DefaultSeparator

const char FileSystemPath::DefaultSeparator = '/'
staticprivate

The default path separator character.

Definition at line 42 of file FileSystemPath.h.

◆ m_base

const String FileSystemPath::m_base
private

Last element in the full path.

Definition at line 107 of file FileSystemPath.h.

Referenced by base().

◆ m_full

const String FileSystemPath::m_full
private

Full input path.

Definition at line 101 of file FileSystemPath.h.

Referenced by full(), and length().

◆ m_parent

String FileSystemPath::m_parent
private

Full path to our parent.

Definition at line 110 of file FileSystemPath.h.

Referenced by FileSystemPath(), and parent().

◆ m_path

const List<String> FileSystemPath::m_path
private

The path split in pieces by the separator.

Definition at line 104 of file FileSystemPath.h.

Referenced by FileSystemPath(), and split().

◆ m_separator

const char FileSystemPath::m_separator
private

Separator character.

Definition at line 98 of file FileSystemPath.h.

Referenced by FileSystemPath().

◆ MaximumLength

const Size FileSystemPath::MaximumLength = 64u
static

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