MrSID Decode SDK for Raster Reference Manual  9.5.1.4427
LTFileSpec Class Reference

Represents a file or directory path. More...

#include <lt_fileSpec.h>

Public Types

enum  { fSlash = '/', bSlash = '\\', platformSlash = '/' }
 
enum  EncodingType { NATIVE, UTF8 }
 native constructor More...
 

Public Member Functions

 LTFileSpec (void)
 default constructor More...
 
 ~LTFileSpec (void)
 destructor More...
 
 LTFileSpec (const char *p1, EncodingType encoding=NATIVE)
 
 LTFileSpec (const char *p1, const char *p2, EncodingType encoding=NATIVE)
 
 LTFileSpec (const char *p1, const char *p2, const char *p3, EncodingType encoding=NATIVE)
 
 LTFileSpec (const wchar_t *p1)
 wchar constructor More...
 
 LTFileSpec (const wchar_t *p1, const wchar_t *p2)
 
 LTFileSpec (const wchar_t *p1, const wchar_t *p2, const wchar_t *p3)
 
 LTFileSpec (const lt_uint16 *path)
 UTF16 constructor. More...
 
 LTFileSpec (const lt_uint16 *p1, const lt_uint16 *p2)
 
 LTFileSpec (const lt_uint16 *p1, const lt_uint16 *p2, const lt_uint16 *p3)
 
 LTFileSpec (const LTFileSpec &p1)
 
 LTFileSpec (const LTFileSpec &p1, const LTFileSpec &p2)
 
 LTFileSpec (const LTFileSpec &p1, const LTFileSpec &p2, const LTFileSpec &p3)
 
 LTFileSpec (const LTFileSpec &p1, const char *p2, EncodingType encoding)
 
 LTFileSpec (const LTFileSpec &p1, const char *p2, const char *p3, EncodingType encoding)
 
 LTFileSpec (const LTFileSpec &p1, const LTFileSpec &p2, const char *p3, EncodingType encoding)
 
 LTFileSpec (const LTFileSpec &p1, const wchar_t *p2)
 
 LTFileSpec (const LTFileSpec &p1, const wchar_t *p2, const wchar_t *p3)
 
 LTFileSpec (const LTFileSpec &p1, const LTFileSpec &p2, const wchar_t *p3)
 
 LTFileSpec (const LTFileSpec &p1, const lt_uint16 *p2)
 
 LTFileSpec (const LTFileSpec &p1, const lt_uint16 *p2, const lt_uint16 *p3)
 
 LTFileSpec (const LTFileSpec &p1, const LTFileSpec &p2, const lt_uint16 *p3)
 
LTFileSpecoperator= (const LTFileSpec &that)
 assignment operator More...
 
bool operator!= (const LTFileSpec &fs) const
 inequality operator More...
 
bool operator== (const LTFileSpec &fs) const
 equality operator More...
 
bool empty (void) const
 
const char * utf8 (void) const
 Function to convert the path to a UTF8 format. More...
 
const char * n_str (void) const
 Function to convert the path to native format. More...
 
const wchar_t * w_str (void) const
 Function to convert the path to Wide format. More...
 
LTFileSpec dirname (void) const
 Return the parent directory. More...
 
const char * basename (void) const
 Return the base filename. More...
 
const char * getSuffix () const
 returns suffix (in utf8) More...
 
LTFileSpec replaceSuffix (const char *ext) const
 replaces suffix (extension) More...
 
LTFileSpec removeSuffix () const
 remove the suffix (extension) More...
 
bool absolute () const
 returns true if path is absolute, false if relative More...
 

Protected Member Functions

void init (const char *p1, const char *p2, const char *p3)
 Initialization from UTF8 strings. More...
 
size_t getPrefixLength (void) const
 

Detailed Description

Member Enumeration Documentation

anonymous enum
Enumerator
fSlash 
bSlash 
platformSlash 

Definition at line 36 of file lt_fileSpec.h.

Parameters
pathfirst part of the path could be directory or filename
Note
On Win32 the file system treats a (char *) as a multibyte string On Unix/Linux the file system treats a (char *) as a utf8 string
Enumerator
NATIVE 
UTF8 

Definition at line 68 of file lt_fileSpec.h.

Constructor & Destructor Documentation

LTFileSpec::LTFileSpec ( void  )
LTFileSpec::~LTFileSpec ( void  )
LTFileSpec::LTFileSpec ( const char *  p1,
EncodingType  encoding = NATIVE 
)
LTFileSpec::LTFileSpec ( const char *  p1,
const char *  p2,
EncodingType  encoding = NATIVE 
)
LTFileSpec::LTFileSpec ( const char *  p1,
const char *  p2,
const char *  p3,
EncodingType  encoding = NATIVE 
)
LTFileSpec::LTFileSpec ( const wchar_t *  p1)
explicit
Note
See native constructor for arguments
On Win32 wchar_t is a UTF16 string. On unix it is UTF32
LTFileSpec::LTFileSpec ( const wchar_t *  p1,
const wchar_t *  p2 
)
LTFileSpec::LTFileSpec ( const wchar_t *  p1,
const wchar_t *  p2,
const wchar_t *  p3 
)
LTFileSpec::LTFileSpec ( const lt_uint16 path)
explicit
Note
See native constructor for arguments
LTFileSpec::LTFileSpec ( const lt_uint16 p1,
const lt_uint16 p2 
)
LTFileSpec::LTFileSpec ( const lt_uint16 p1,
const lt_uint16 p2,
const lt_uint16 p3 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const LTFileSpec p2 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const LTFileSpec p2,
const LTFileSpec p3 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const char *  p2,
EncodingType  encoding 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const char *  p2,
const char *  p3,
EncodingType  encoding 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const LTFileSpec p2,
const char *  p3,
EncodingType  encoding 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const wchar_t *  p2 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const wchar_t *  p2,
const wchar_t *  p3 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const LTFileSpec p2,
const wchar_t *  p3 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const lt_uint16 p2 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const lt_uint16 p2,
const lt_uint16 p3 
)
LTFileSpec::LTFileSpec ( const LTFileSpec p1,
const LTFileSpec p2,
const lt_uint16 p3 
)

Member Function Documentation

bool LTFileSpec::absolute ( ) const
const char* LTFileSpec::basename ( void  ) const

The semantics are similar to the standard Unix basename.

Examples:

  • "/usr/lib" -> "lib"
  • "/usr/" -> "usr/" (not the same as the unix basename)
  • "usr" -> "usr"
  • "/" -> "/"
  • "C:/" -> "C:/"
  • "." -> "."
  • ".." -> ".."
LTFileSpec LTFileSpec::dirname ( void  ) const

The semantics are similar to the standard Unix dirname.

Examples:

  • "/usr/lib" -> "/usr"
  • "/usr/" -> "/"
  • "usr" -> "."
  • "/" -> "/"
  • "C:/" -> "C:/"
  • "." -> "."
  • ".." -> "."
bool LTFileSpec::empty ( void  ) const
size_t LTFileSpec::getPrefixLength ( void  ) const
protected
const char* LTFileSpec::getSuffix ( ) const

Examples:

  • "foo.bar" -> "bar"
  • "foo." -> ""
  • "foo" -> ""
void LTFileSpec::init ( const char *  p1,
const char *  p2,
const char *  p3 
)
protected
const char* LTFileSpec::n_str ( void  ) const
Note
On Win32 this returns a multi-byte string.
On Unix this returns a UTF8 string.
bool LTFileSpec::operator!= ( const LTFileSpec fs) const
LTFileSpec& LTFileSpec::operator= ( const LTFileSpec that)
bool LTFileSpec::operator== ( const LTFileSpec fs) const
LTFileSpec LTFileSpec::removeSuffix ( ) const

Note this also removes the ".".

Examples:

  • "foo.bar" -> "foo"
  • "foo." -> "foo"
  • "foo" -> "foo"
LTFileSpec LTFileSpec::replaceSuffix ( const char *  ext) const

Note that ext should not include the ".". If ext is null, the suffix is removed.

Examples:

  • "foo.bar" with "baz" -> "foo.baz"
  • "foo.bar" with ".baz" -> "foo..baz"
  • "foo.bar" with "" -> "foo."
  • "foo" with "baz" -> "foo.baz"
const char* LTFileSpec::utf8 ( void  ) const
const wchar_t* LTFileSpec::w_str ( void  ) const
Note
On Win32 this returns a 16bit UTF16 string.
On Unix this returns a 32bit UTF32 string.

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

LizardTech