MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for MiKTeX::Util::PathName:
Collaboration graph
[legend]

Public Member Functions

 PathName (const PathName &other)=default
 
PathNameoperator= (const PathName &other)=default
 
 PathName (PathName &&other) noexcept=default
 
PathNameoperator= (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 (const char *component1, const char *component2)
 
 PathName (const PathName &component1, const PathName &component2)
 
PathNameoperator= (const char *path)
 
PathNameoperator= (const wchar_t *path)
 
PathNameoperator= (const std::string &path)
 
PathNameoperator= (const std::wstring &path)
 
 MIKTEXUTILTHISAPI (std::size_t) GetHash() const
 
PathName GetDirectoryName () const
 
PathName GetFileName () const
 
PathName GetFileNameWithoutExtension () const
 
PathNameRemoveFileSpec ()
 
PathNameRemoveDirectorySpec ()
 
 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)
 
PathNameConvertToUnix ()
 
PathName ToUnix () const
 
PathNameConvertToDos ()
 
PathName ToDos () const
 
PathName ToExtendedLengthPathName () const
 
std::wstring ToWideCharString () const
 
std::wstring ToNativeString () const
 
 MIKTEXUTILTHISAPI (std::string) ToDisplayString(DisplayPathNameOptions options
 
PathNameTransformForComparison ()
 
bool IsFullyQualified () const
 
bool IsAbsolute () const
 
bool IsComparable () const
 
PathNameCanonicalize ()
 
PathNameMakeFullyQualified ()
 
bool HasExtension () const
 
bool HasExtension (const char *extension) const
 
 MIKTEXUTILTHISAPI (std::string) GetExtension() const
 
 MIKTEXUTILTHISAPI (PathName &) SetExtension(const char *extension
 
PathNameSetExtension (const char *extension)
 
PathNameSetExtension (const std::string &extension)
 
PathNameAppendExtension (const char *extension)
 
PathNameAppendExtension (const std::string &extension)
 
bool EndsWithDirectoryDelimiter () const
 
PathNameAppend (const char *lpsz, bool appendDirectoryDelimiter)
 
PathNameAppend (const std::string &str, bool appendDirectoryDelimiter)
 
PathNameAppendComponent (const char *component)
 
PathNameoperator/= (const char *component)
 
PathNameoperator/= (const PathName &component)
 
PathNameoperator/= (const std::string &component)
 
 MIKTEXUTILTHISAPI (PathName &) CutOffLastComponent(bool allowSelfCutting)
 
PathNameCutOffLastComponent ()
 
 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 (const char *lpsz)
 
 CharBuffer (const char16_t *lpsz)
 
 CharBuffer (const wchar_t *lpsz)
 
 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)
 
CharBufferoperator= (const CharBuffer &other)
 
CharBufferoperator= (CharBuffer &&other) noexcept
 
CharBufferoperator= (const OtherCharType *lpsz)
 
CharBufferoperator= (const std::basic_string< OtherCharType > &s)
 
void Set (const CharBuffer &other)
 
void Set (const OtherCharType *lpsz)
 
void Set (const std::basic_string< OtherCharType > &s)
 
void Append (const std::basic_string< char > &s)
 
void Append (const char *lpsz)
 
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)
 
CharBufferoperator+= (const char *lpsz)
 
CharBufferoperator+= (const std::basic_string< char > &s)
 
CharBufferoperator+= (char ch)
 

Static Public Member Functions

static std::vector< std::string > Split (const PathName &path)
 
static int Compare (const char *lpszPath1, const char *lpszPath2, std::size_t count)
 
static int Compare (const PathName &path1, const PathName &path2, std::size_t count)
 
static int Compare (const char *lpszPath1, const char *lpszPath2)
 
static int Compare (const PathName &path1, const PathName &path2)
 
static int Compare (const std::string &path1, const std::string &path2)
 
static bool Equals (const PathName &path1, const PathName &path2)
 
static bool Match (const char *lpszPattern, const char *lpszPath)
 
static bool Match (const char *lpszPattern, const PathName &path)
 

Public Attributes

bool override
 

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/6]

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

Copies a character string into a new PathName object.

Parameters
rhsNull-terminated character string.

◆ PathName() [2/6]

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/6]

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

Copies a string object into a new PathName object.

Parameters
rhsString object.

◆ PathName() [4/6]

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

Copies a string object into a new PathName object.

Parameters
rhsString object.

◆ PathName() [5/6]

MiKTeX::Util::PathName::PathName ( const char *  component1,
const char *  component2 
)
inline

Combines path name components into a new PathName object.

Parameters
component1The first component (fully qualified directory path).
component2The second component (relative file name path).

◆ PathName() [6/6]

MiKTeX::Util::PathName::PathName ( const PathName component1,
const PathName component2 
)
inline

Combines path name components into a new PathName object.

Parameters
component1The first component (fully qualified directory path).
component2The second component (relative file name path).

Member Function Documentation

◆ Append()

PathName & MiKTeX::Util::PathName::Append ( const char *  lpsz,
bool  appendDirectoryDelimiter 
)
inline

Appends a character string to this path name.

Parameters
lpszThe null-terminated character 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 char *  component)
inline

Appends a path name component to this path name.

Parameters
lpszComponentThe null-terminated component to add.
Returns
Returns a reference to this object.

◆ Compare() [1/4]

static int MiKTeX::Util::PathName::Compare ( const char *  lpszPath1,
const char *  lpszPath2 
)
static

Compares two path names.

Parameters
lpszPath1The first path name.
lpszPath1The 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.

◆ Compare() [2/4]

static int MiKTeX::Util::PathName::Compare ( const char *  lpszPath1,
const char *  lpszPath2,
std::size_t  count 
)
static

Compares the prefixes of two path names.

Parameters
lpszPath1The first path name.
lpszPath1The 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.

◆ Compare() [3/4]

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

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.

◆ Compare() [4/4]

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

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.

◆ 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 char *  extension) const
inline

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

Parameters
lpszExtensionFile 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()

static bool MiKTeX::Util::PathName::Match ( const char *  lpszPattern,
const char *  lpszPath 
)
static

Matches a path name against a wildcard pattern.

Parameters
lpszPatternThe wildcard pattern.
lpszPathThe path name to test.
Returns
Returns true, if the pattern matches.

◆ MIKTEXUTILTHISAPI() [1/10]

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/10]

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

Cuts off the last component from the path name.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [3/10]

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

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.

◆ MIKTEXUTILTHISAPI() [4/10]

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

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

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [5/10]

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

Sets this PathName object equal to the temporary directory.

Returns
Returns a reference to this object.

◆ MIKTEXUTILTHISAPI() [6/10]

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() [7/10]

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() [8/10]

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

Get the mount point of this PathName.

Returns
Returns the mount point as a new PathName.

◆ MIKTEXUTILTHISAPI() [9/10]

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

Calculates the hash value of this PathName object.

Returns
Returns the hash value.

◆ MIKTEXUTILTHISAPI() [10/10]

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/=() [1/3]

PathName & MiKTeX::Util::PathName::operator/= ( const char *  component)
inline

Appends a path name component to this path name.

Parameters
lpszComponentThe null-terminated component to add.
Returns
Returns a reference to this object.

◆ operator/=() [2/3]

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

Appends a path name component to this path name.

Parameters
componentThe component to be appended.
Returns
Returns a reference to this object.

◆ operator/=() [3/3]

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

Appends a path name component to this path name.

Parameters
componentThe component to be appended.
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.

◆ SetExtension() [1/2]

PathName & MiKTeX::Util::PathName::SetExtension ( const char *  extension)
inline

Sets the file name extension.

Parameters
lpszExtensionThe file name extension to set. Can be 0, if the extension is to be removed.
Returns
Returns a reference to this object.

◆ SetExtension() [2/2]

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

Sets the file name extension.

Parameters
lpszExtensionThe file name extension to set. Can be 0, if the extension is to be removed.
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.

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