LTFileSpec Class Reference

Represents a file or directory path. More...

#include <lt_fileSpec.h>

List of all members.

Public Types

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

Public Member Functions

 LTFileSpec (void)
 default constructor
 ~LTFileSpec (void)
 destructor
 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
 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.
 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
bool operator!= (const LTFileSpec &fs) const
 inequality operator
bool operator== (const LTFileSpec &fs) const
 equality operator
bool empty (void) const
const char * utf8 (void) const
 Function to convert the path to a UTF8 format.
const char * n_str (void) const
 Function to convert the path to native format.
const wchar_t * w_str (void) const
 Function to convert the path to Wide format.
LTFileSpec dirname (void) const
 Return the parent directory.
const char * basename (void) const
 Return the base filename.
const char * getSuffix () const
 returns suffix (in utf8)
LTFileSpec replaceSuffix (const char *ext) const
 replaces suffix (extension)
LTFileSpec removeSuffix () const
 remove the suffix (extension)
bool absolute () const
 returns true if path is absolute, false if relative

Protected Member Functions

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


Detailed Description

Examples:

DecodeJP2ToBBB.cpp, DecodeJP2ToJPG.cpp, DecodeJP2ToMemory.cpp, DecodeMrSIDBandSelection.cpp, DecodeMrSIDToMemory.cpp, DecodeMrSIDToRaw.cpp, DecodeMrSIDToTIFF.cpp, DerivedImageFilter.cpp, DerivedImageReader.cpp, DerivedImageWriter.cpp, ErrorHandling.cpp, GeoScene.cpp, ImageInfo.cpp, InterruptDelegate.cpp, MetadataDump.cpp, ProgressDelegate.cpp, and SceneBuffer.cpp.

Definition at line 33 of file lt_fileSpec.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
fSlash 
bSlash 
platformSlash 

Definition at line 36 of file lt_fileSpec.h.

Parameters:
path first 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 67 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

LTFileSpec& LTFileSpec::operator= ( const LTFileSpec that  ) 

bool LTFileSpec::operator!= ( const LTFileSpec fs  )  const

bool LTFileSpec::operator== ( const LTFileSpec fs  )  const

bool LTFileSpec::empty ( void   )  const

const char* LTFileSpec::utf8 ( void   )  const

const char* LTFileSpec::n_str ( void   )  const

Note:
On Win32 this returns a multi-byte string.

On Unix this returns a UTF8 string.

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.

LTFileSpec LTFileSpec::dirname ( void   )  const

The semantics are similar to the standard Unix dirname.

Examples:

  • "/usr/lib" -> "/usr"
  • "/usr/" -> "/"
  • "usr" -> "."
  • "/" -> "/"
  • "C:/" -> "C:/"
  • "." -> "."
  • ".." -> "."

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:/"
  • "." -> "."
  • ".." -> ".."

const char* LTFileSpec::getSuffix (  )  const

Examples:

  • "foo.bar" -> "bar"
  • "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"

LTFileSpec LTFileSpec::removeSuffix (  )  const

Note this also removes the ".".

Examples:

  • "foo.bar" -> "foo"
  • "foo." -> "foo"
  • "foo" -> "foo"

bool LTFileSpec::absolute (  )  const

void LTFileSpec::init ( const char *  p1,
const char *  p2,
const char *  p3 
) [protected]

size_t LTFileSpec::getPrefixLength ( void   )  const [protected]


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

LizardTech