Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation
The ZipArchive Library

#include <ZipPathComponent.h>

Public Types

enum  PrefixType { ptNone = 0 , ptUnc = 2 , ptUnicode = 4 , ptUncWin = 8 }

Public Member Functions

 CZipPathComponent (LPCTSTR lpszFullPath)
CZipString GetFileDrive () const
CZipString GetFileExt () const
CZipString GetFileName () const
CZipString GetFilePath () const
CZipString GetFileTitle () const
CZipString GetFullPath () const
CZipString GetNoDrive () const
void SetExtension (LPCTSTR lpszExt)
void SetFileTitle (LPCTSTR lpszFileTitle)
void SetFullPath (LPCTSTR lpszFullPath)

Static Public Member Functions

static void AddPrefix (CZipString &path, bool isFolder=true, bool checkLength=true)
static CZipString AddPrefix (LPCTSTR path, bool isFolder=true)
static void AppendSeparator (CZipString &szPath)
static void Combine (CZipString &szPath, LPCTSTR lpszName)
static bool HasEndingSeparator (const CZipString &szPath)
static int IsPrefixed (const CZipString &path)
static bool IsSeparator (TCHAR c)
static void RemoveSeparators (CZipString &szPath)
static void RemoveSeparatorsLeft (CZipString &szPath)

Static Public Attributes

static const TCHAR m_cSeparator
 A system specific default path separator.
static const CZipString PathPrefix

Protected Attributes

Path parts.
CZipString m_szDirectory
 The path without the filename and without path separators at the end and the beginning.
CZipString m_szFileTitle
 The filename without the extension.
CZipString m_szFileExt
 The file extension without the dot character.
CZipString m_szDrive
 The drive (if the system path standard uses it). It does not include a path separator at the end.
CZipString m_szPrefix
 The prefix (e.g. for the UNC path or Unicode path under Windows).

Detailed Description

Splits a file path into components.

Member Enumeration Documentation

◆ PrefixType

The type of the prefix in path.

Enumerator
ptNone 

There is no prefix present.

ptUnc 

UNC path.

ptUnicode 

Unicode path.

ptUncWin 

Windows UNC path.

Constructor & Destructor Documentation

◆ CZipPathComponent()

CZipPathComponent::CZipPathComponent ( LPCTSTR lpszFullPath)
inline

Initializes a new instance of the CZipPathComponent class.

Parameters
lpszFullPathThe full path to the file.
See also
SetFullPath

Member Function Documentation

◆ AddPrefix() [1/2]

void CZipPathComponent::AddPrefix ( CZipString & path,
bool isFolder = true,
bool checkLength = true )
static

Adds an UNC prefix to the paths on Windows.

Parameters
pathThe path to add a prefix to.
isFoldertrue if the path points to a folder; false otherwise.
checkLengthtrue the prefix will be inserted only if the length of the path is large enough; false - the prefix is always inserted

◆ AddPrefix() [2/2]

CZipString CZipPathComponent::AddPrefix ( LPCTSTR path,
bool isFolder = true )
static

Adds an UNC prefix to the paths on Windows.

Parameters
pathThe path to add a prefix to.
isFoldertrue if the path points to a folder; false otherwise.
Returns
The prefixed path.

◆ AppendSeparator()

void CZipPathComponent::AppendSeparator ( CZipString & szPath)
inlinestatic

Appends a path separator to szPath, if it is not already appended.

Parameters
szPathThe path to have a separator appended.

◆ Combine()

void CZipPathComponent::Combine ( CZipString & szPath,
LPCTSTR lpszName )
inlinestatic

Combines a path information with a file name information.

Parameters
szPathProvides the path information and retrieves the result.
lpszNameThe filename to be appended to the path.

◆ GetFileDrive()

CZipString CZipPathComponent::GetFileDrive ( ) const
inline

Returns the drive of the file.

Returns
The drive without a path separator at the end.

◆ GetFileExt()

CZipString CZipPathComponent::GetFileExt ( ) const
inline

Returns the extension of the file.

Returns
The extension without the dot character.

◆ GetFileName()

CZipString CZipPathComponent::GetFileName ( ) const
inline

Returns the filename.

Returns
The filename including the extension and without the path.

◆ GetFilePath()

CZipString CZipPathComponent::GetFilePath ( ) const
inline

Returns the path part only.

Returns
The file path without the filename and without a path separator at the end.

◆ GetFileTitle()

CZipString CZipPathComponent::GetFileTitle ( ) const
inline

Returns the name of the file without the extension (and without the path).

Returns
The title of the file.

◆ GetFullPath()

CZipString CZipPathComponent::GetFullPath ( ) const
inline

Returns the full path to the file.

Returns
The full path information including the filename.

◆ GetNoDrive()

CZipString CZipPathComponent::GetNoDrive ( ) const

Returns the full path to the file without the drive.

Returns
The path without the drive and without a path separator at the beginning.

◆ HasEndingSeparator()

bool CZipPathComponent::HasEndingSeparator ( const CZipString & szPath)
inlinestatic

Checks if szPath has a path separator appended.

Parameters
szPathThe path to be tested.
Returns
true, if szPath has a path separator at the end; false otherwise.

◆ IsPrefixed()

int CZipPathComponent::IsPrefixed ( const CZipString & path)
static

Returns the length of the path prefix detected.

Parameters
pathThe path to examine.
Returns
The length of the path prefix or 0, if no prefix was detected.

◆ IsSeparator()

bool CZipPathComponent::IsSeparator ( TCHAR c)
inlinestatic

Returns the value indicating whether the given character is a path separator.

Parameters
cThe character to test.
Returns
true, if c is a path separator; false otherwise.

◆ RemoveSeparators()

void CZipPathComponent::RemoveSeparators ( CZipString & szPath)
inlinestatic

Removes path separators from the end of szPath

Parameters
szPathThe path to have path separators removed.

◆ RemoveSeparatorsLeft()

void CZipPathComponent::RemoveSeparatorsLeft ( CZipString & szPath)
inlinestatic

Removes path separators from the beginning of szPath.

Parameters
szPathThe path to have path separators removed.

◆ SetExtension()

void CZipPathComponent::SetExtension ( LPCTSTR lpszExt)
inline

Sets the extension.

Parameters
lpszExtThe extension to set. May contain the dot character at the beginning, but doesn't have to.

◆ SetFileTitle()

void CZipPathComponent::SetFileTitle ( LPCTSTR lpszFileTitle)
inline

Sets the file title (the name without the extension and without the path).

Parameters
lpszFileTitleThe title to set.

◆ SetFullPath()

void CZipPathComponent::SetFullPath ( LPCTSTR lpszFullPath)

Sets the full path to the file.

Parameters
lpszFullPathThe full path to the file including a filename. The last element in the path is assumed to be the filename.

Member Data Documentation

◆ m_cSeparator

const TCHAR CZipPathComponent::m_cSeparator
static

A system specific default path separator.

◆ m_szDirectory

CZipString CZipPathComponent::m_szDirectory
protected

The path without the filename and without path separators at the end and the beginning.

◆ m_szDrive

CZipString CZipPathComponent::m_szDrive
protected

The drive (if the system path standard uses it). It does not include a path separator at the end.

◆ m_szFileExt

CZipString CZipPathComponent::m_szFileExt
protected

The file extension without the dot character.

◆ m_szFileTitle

CZipString CZipPathComponent::m_szFileTitle
protected

The filename without the extension.

◆ m_szPrefix

CZipString CZipPathComponent::m_szPrefix
protected

The prefix (e.g. for the UNC path or Unicode path under Windows).

◆ PathPrefix

const CZipString CZipPathComponent::PathPrefix
static

The path prefix string for Windows long paths (\?).


The documentation for this class was generated from the following file:
Back To Top Up