MiKTeX 26.5-next
A scalable TeX distribution
Loading...
Searching...
No Matches
MiKTeX::Util::PathName Class Reference

Instances of this class can be used to store path names. More...

#include <miktex/Util/PathName.h>

Inheritance diagram for MiKTeX::Util::PathName:
Collaboration diagram for MiKTeX::Util::PathName:

Public Member Functions

 PathName (const PathName &other)=default
PathName & operator= (const PathName &other)=default
 PathName (PathName &&other) noexcept=default
PathName & operator= (PathName &&other) noexcept=default
 PathName (const char *path)
 PathName (const wchar_t *path)
 PathName (const std::string &path)
 PathName (const std::wstring &path)
 PathName (size_t n)=delete
PathName & operator= (const char *path)
PathName & operator= (const wchar_t *path)
PathName & operator= (const std::string &path)
PathName & operator= (const std::wstring &path)
 MIKTEXUTILTHISAPI (std::size_t) GetHash() const
PathName GetDirectoryName () const
PathName GetFileName () const
PathName GetFileNameWithoutExtension () const
PathName & RemoveFileSpec ()
PathName & RemoveDirectorySpec ()
 MIKTEXUTILTHISAPI (PathName &) SetToHomeDirectory()
 MIKTEXUTILTHISAPI (PathName &) SetToLockDirectory()
 MIKTEXUTILTHISAPI (PathName &) SetToCurrentDirectory()
 MIKTEXUTILTHISAPI (PathName &) SetToTempDirectory()
 MIKTEXUTILTHISAPI (PathName &) SetToTempFile()
 MIKTEXUTILTHISAPI (PathName &) SetToTempFile(const PathName &directory)
 MIKTEXUTILTHISAPI (PathName) GetMountPoint() const
 MIKTEXUTILTHISAPI (PathName &) Convert(ConvertPathNameOptions options)
PathName & Clean ()
PathName & ConvertToUnix ()
PathName ToUnix () const
PathName & ConvertToDos ()
PathName ToDos () const
PathName ToExtendedLengthPathName () const
std::wstring ToWideCharString () const
std::wstring ToNativeString () const
 MIKTEXUTILTHISAPI (std::string) ToDisplayString(DisplayPathNameOptions options
PathName & TransformForComparison ()
bool IsFullyQualified () const
bool IsAbsolute () const
PathName & Canonicalize ()
PathName & MakeFullyQualified ()
bool HasExtension () const
bool HasExtension (const std::string &extension_) const
 MIKTEXUTILTHISAPI (std::string) GetExtension() const
PathName & AppendExtension (const std::string &extension)
bool EndsWithDirectoryDelimiter () const
PathName & Append (const std::string &s, bool appendDirectoryDelimiter)
PathName & AppendComponent (const std::string &component)
PathName & operator/= (const std::string &component)
 MIKTEXUTILTHISAPI (PathName &) CutOffLastComponent(bool allowSelfCutting)
PathName & CutOffLastComponent ()
 MIKTEXUTILTHISAPI (PathName &) AppendDirectoryDelimiter()
 MIKTEXUTILTHISAPI (PathName &) AppendAltDirectoryDelimiter()
bool IsExplicitlyRelative () const
Public Member Functions inherited from MiKTeX::Util::CharBuffer< char, MIKTEX_UTIL_PATHNAME_SIZE >
 CharBuffer (const CharBuffer &other)
 CharBuffer (CharBuffer &&other) noexcept
CharBuffer & operator= (const CharBuffer &other)
CharBuffer & operator= (CharBuffer &&other) noexcept
 CharBuffer (const char *s)
 CharBuffer (const char16_t *s)
 CharBuffer (const wchar_t *s)
 CharBuffer (const std::basic_string< char > &other)
 CharBuffer (const std::basic_string< char16_t > &other)
 CharBuffer (const std::basic_string< wchar_t > &other)
 CharBuffer (std::size_t n)
void Set (const CharBuffer &other)
void Set (const OtherCharType *s)
void Set (const std::basic_string< OtherCharType > &s)
void Append (const std::basic_string< char > &s)
void Append (const char *s)
void Append (const char *s, std::size_t len)
void Append (char ch)
void Clear ()
bool Empty () const
void Reset ()
void Reserve (std::size_t newSize)
std::basic_string< char > ToString () const
const char * GetData () const
char * GetData ()
std::size_t GetLength () const
std::size_t GetCapacity () const
const char & operator[] (std::size_t idx) const
char & operator[] (std::size_t idx)
CharBuffer & operator= (const OtherCharType *s)
CharBuffer & operator= (const std::basic_string< OtherCharType > &s)
CharBuffer & operator+= (const char *s)
CharBuffer & operator+= (const std::basic_string< char > &s)
CharBuffer & operator+= (char ch)

Static Public Member Functions

static std::vector< std::string > Split (const PathName &path)
static int ComparePrefixes (const PathName &path1, const PathName &path2, std::size_t count)
static int Compare (const PathName &path1, const PathName &path2)
static bool Equals (const PathName &path1, const PathName &path2)
static bool Match (const std::string &pattern, const PathName &path)

Public Attributes

MIKTEXUTILTHISAPI(PathName &) SetExtension(const std PathName SetExtension )(const std::string &extension)

Protected Types

typedef CharBuffer< char, MIKTEX_UTIL_PATHNAME_SIZE > Base

Detailed Description

Instances of this class can be used to store path names.

Constructor & Destructor Documentation

◆ PathName() [1/4]

MiKTeX::Util::PathName::PathName ( const char * path)
inlineexplicit

Copies a character string into a new PathName object.

Parameters
rhsNull-terminated character string.

◆ PathName() [2/4]

MiKTeX::Util::PathName::PathName ( const wchar_t * path)
inlineexplicit

Copies a wide character string into a new PathName object.

Parameters
rhsNull-terminated character string.

◆ PathName() [3/4]

MiKTeX::Util::PathName::PathName ( const std::string & path)
inlineexplicit

Copies a string object into a new PathName object.

Parameters
rhsString object.

◆ PathName() [4/4]

MiKTeX::Util::PathName::PathName ( const std::wstring & path)
inlineexplicit

Copies a string object into a new PathName object.

Parameters
rhsString object.

Member Function Documentation

◆ Append()

PathName & MiKTeX::Util::PathName::Append ( const std::string & s,
bool appendDirectoryDelimiter )
inline

Appends a string to this path name.

Parameters
sThe string to add.
appendDirectoryDelimiterIndicates whether a directory delimiter shall be appended before the string.
Returns
Returns a reference to this object.

◆ AppendComponent()

PathName & MiKTeX::Util::PathName::AppendComponent ( const std::string & component)
inline

Appends a path name component to this path name.

Parameters
componentThe component to add.
Returns
Returns a reference to this object.

◆ Clean()

PathName & MiKTeX::Util::PathName::Clean ( )
inline

Cleans up this path name.

Returns
Returns a reference to this object.

◆ Compare()

int MiKTeX::Util::PathName::Compare ( const PathName & path1,
const PathName & path2 )
static

Compares two path names.

Parameters
path1The first path name.
path1The second path name.
Returns
Returns -1, if the first path name compares lesser than the second. Returns 0, if both path names compare equal. Returns 1, if the first path name compares greater than the second.

◆ ComparePrefixes()

int MiKTeX::Util::PathName::ComparePrefixes ( const PathName & path1,
const PathName & path2,
std::size_t count )
static

Compares the prefixes of two path names.

Parameters
path1The first path name.
path1The second path name.
countNumber of characters to compare.
Returns
Returns -1, if the first prefix compares lesser than the second. Returns 0, if both prefixes compare equal. Returns 1, if the first prefix compares greater than the second.

◆ ConvertToDos()

PathName & MiKTeX::Util::PathName::ConvertToDos ( )
inline

Replaces normal slashes with backslashes.

Returns
Returns a reference to this object.

◆ ConvertToUnix()

PathName & MiKTeX::Util::PathName::ConvertToUnix ( )
inline

Replaces backslashes with normal slashes.

Returns
Returns a reference to this object.

◆ CutOffLastComponent()

PathName & MiKTeX::Util::PathName::CutOffLastComponent ( )
inline

Cuts off the last component from the path name.

Returns
Returns a reference to this object.

◆ EndsWithDirectoryDelimiter()

bool MiKTeX::Util::PathName::EndsWithDirectoryDelimiter ( ) const
inline

Checks to see whether this path name ends with a directory delimiter.

Returns
Returns true if the last character is a directory delimiter.

◆ HasExtension()

bool MiKTeX::Util::PathName::HasExtension ( const std::string & extension_) const
inline

Checks to see whether this path name has the specified extension.

Parameters
extensionFile name extension.
Returns
Returns true, if this path name has the specified extension.

◆ MakeFullyQualified()

PathName & MiKTeX::Util::PathName::MakeFullyQualified ( )
inline

Converts this path name into a fully qualified path name.

Returns
Returns a reference to this object.

◆ Match()

bool MiKTeX::Util::PathName::Match ( const std::string & pattern,
const PathName & path )
static

Matches a path name against a wildcard pattern.

Parameters
patternThe wildcard pattern.
pathThe path name to test.
Returns
Returns true, if the pattern matches.

◆ MIKTEXUTILTHISAPI() [1/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & )

Makes sure that this path name ends with a directory delimiter.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [2/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & )

Cuts off the last component from the path name.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [3/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & )

Sets this PathName object equal to the current (working) directory.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [4/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & )

Sets this PathName object equal to the temporary directory.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [5/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & )

Sets this PathName object equal to the name of a temporary file.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [6/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName & ) const &

Sets this PathName object equal to the name of a temporary file in the specified directory.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [7/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( PathName ) const

Get the mount point of this PathName.

Returns
Returns the mount point as a new PathName.

◆ MIKTEXUTILTHISAPI() [8/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( std::size_t ) const

Calculates the hash value of this PathName object.

Returns
Returns the hash value.

◆ MIKTEXUTILTHISAPI() [9/9]

MiKTeX::Util::PathName::MIKTEXUTILTHISAPI ( std::string ) const

Gets the file name extension.

Returns
Returns the file name extension. Returns 0, if the path name has no file name extension.

◆ operator/=()

PathName & MiKTeX::Util::PathName::operator/= ( const std::string & component)
inline

Appends a path name component to this path name.

Parameters
componentThe component to add.
Returns
Returns a reference to this object.

◆ RemoveDirectorySpec()

PathName & MiKTeX::Util::PathName::RemoveDirectorySpec ( )
inline

Removes the directory component from this path name.

Returns
Returns a reference to this object.

◆ RemoveFileSpec()

PathName & MiKTeX::Util::PathName::RemoveFileSpec ( )
inline

Removes the file name component from this path name.

Returns
Returns a reference to this object.

◆ TransformForComparison()

PathName & MiKTeX::Util::PathName::TransformForComparison ( )
inline

Transform this path for comparison purposes.

Returns
Returns a reference to this object.

Member Data Documentation

◆ SetExtension

MIKTEXUTILTHISAPI(PathName &) SetExtension(const std PathName MiKTeX::Util::PathName::SetExtension) (const std::string &extension)
inline

Sets the file name extension.

Parameters
extensionThe file name extension to set.
overrideIndicates whether an existing file name extension shall be overridden.
Returns
Returns a reference to this object. Sets the file name extension.
Parameters
extensionThe file name extension to set. Can be 0, if the extension is to be removed.
Returns
Returns a reference to this object.

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