LightWrap++
AC++wrapperfortheLightWave3DSDK
lwpp::FileName Class Reference

Manages file names that are content directory aware. More...

#include <file_request.h>

+ Inheritance diagram for lwpp::FileName:
+ Collaboration diagram for lwpp::FileName:

List of all members.

Public Member Functions

 FileName (const char *_baseDir=LWFTYPE_CONTENT, bool base=false)
 FileName (const std::string name, bool base=false)
bool Exists ()
std::string getAbsoluteName ()
std::string getFileExtension ()
std::string getFileName (void)
 return the file name only
const char * getFullName ()
 create the full path if needed
std::string getFullPath (void)
 return full Path
std::string getPath (void)
 return the relative Path only
std::string getRelativeName ()
 Get the file name relative to the base dir.
const char * getRelativeNameC ()
LWError Load (const LoadState &ls)
 Read Instance data.
FileNameoperator= (const char *name)
FileNameoperator= (const std::string name)
LWError Save (const SaveState &ss)
 Write Instance data.
void setExtractedExtension (const char *source)
 Extract the extension from a string that includes "(.ext)" - such as the names of image savers.
void setFileExtension (const char *extension="")
 Set the extension of the filename.
void setFileName (const std::string name)
 Set the file name only.
void setFullName (const std::string name)
 Set to a full name. This splits the components and stores them.
void stripNumberTrail (void)

Static Public Member Functions

static bool Exists (const std::string &name)
 Check if a file exists.
static std::string extractImageExtension (const char *source)

Detailed Description

Manages file names that are content directory aware.

A filename consists of three components:

  • a basePath as defined by LWs content directory system
  • a relativePath that is appended to the basePath
  • a fileName that is the actual name of the file

The fullPath is the basePath + relativePath.

The fully qualified name of the file is fullPath + fileName.

Note:
The basePath may be void, in which case the relative path is the fully qualified path already.
Todo:

Rework this for other operating systems.

Change this into a more generic disk asset manager


Constructor & Destructor Documentation

lwpp::FileName::FileName ( const char *  _baseDir = LWFTYPE_CONTENT,
bool  base = false 
)
inline
Parameters:
*_baseDirLWFTYPE_* style content directory description
baseSet to true if the base name should be taken into account
lwpp::FileName::FileName ( const std::string  name,
bool  base = false 
)
inline

Member Function Documentation

bool lwpp::FileName::Exists ( const std::string &  name)
static

Check if a file exists.

bool lwpp::FileName::Exists ( )
inline
std::string lwpp::FileName::extractImageExtension ( const char *  source)
static
std::string lwpp::FileName::getAbsoluteName ( )
inline
std::string lwpp::FileName::getFileExtension ( )
inline
std::string lwpp::FileName::getFileName ( void  )

return the file name only

const char* lwpp::FileName::getFullName ( void  )
inline

create the full path if needed

std::string lwpp::FileName::getFullPath ( void  )

return full Path

std::string lwpp::FileName::getPath ( void  )

return the relative Path only

std::string lwpp::FileName::getRelativeName ( )

Get the file name relative to the base dir.

const char * lwpp::FileName::getRelativeNameC ( )
LWError lwpp::FileName::Load ( const LoadState ls)
virtual

Read Instance data.

Reimplemented from lwpp::Storeable.

FileName& lwpp::FileName::operator= ( const char *  name)
inline
FileName& lwpp::FileName::operator= ( const std::string  name)
inline
LWError lwpp::FileName::Save ( const SaveState ss)
virtual

Write Instance data.

Reimplemented from lwpp::Storeable.

void lwpp::FileName::setExtractedExtension ( const char *  source)
inline

Extract the extension from a string that includes "(.ext)" - such as the names of image savers.

void lwpp::FileName::setFileExtension ( const char *  extension = "")
inline

Set the extension of the filename.

void lwpp::FileName::setFileName ( const std::string  name)
inline

Set the file name only.

void lwpp::FileName::setFullName ( const std::string  name)
inline

Set to a full name. This splits the components and stores them.

void lwpp::FileName::stripNumberTrail ( void  )

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