diff --git a/Doxyfile b/Doxyfile index d836a3e3..c1aa43e8 100644 --- a/Doxyfile +++ b/Doxyfile @@ -353,7 +353,7 @@ TYPEDEF_HIDES_STRUCT = NO # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. -SYMBOL_CACHE_SIZE = 0 +SYMBOL_CACHE_SIZE = 4 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given diff --git a/Sources/Plasma/CoreLib/plString.cpp b/Sources/Plasma/CoreLib/plString.cpp index 54719892..fd74326e 100644 --- a/Sources/Plasma/CoreLib/plString.cpp +++ b/Sources/Plasma/CoreLib/plString.cpp @@ -929,7 +929,7 @@ plFileName plFileName::StripFileName() const if (end < 0) return *this; - return Left(end + 1); + return Left(end); } plFileName plFileName::StripFileExt() const diff --git a/Sources/Plasma/CoreLib/plString.h b/Sources/Plasma/CoreLib/plString.h index 8aa8e0c5..c1adbc45 100644 --- a/Sources/Plasma/CoreLib/plString.h +++ b/Sources/Plasma/CoreLib/plString.h @@ -665,29 +665,70 @@ size_t ustrlen(const UniChar *ustr, size_t max = plString::kSizeAuto); # define PATH_SEPARATOR_STR "/" #endif -/* plFileName - custom extension of plString for manipulating filenames */ +/** Subclass of plString with specific methods to help deal with common + * filename manipulation tasks. + */ class plFileName : public plString { public: + /** Construct an empty filename. */ plFileName() { } + + /** Construct a filename from the UTF-8 character data in \a cstr. */ plFileName(const char *cstr) : plString(cstr) { } + + /** Construct a filename from the plString argument \a copy. */ plFileName(const plString ©) : plString(copy) { } + + /** Copy constructor. */ plFileName(const plFileName ©) : plString(copy) { } + /** Return the name portion of the path (including extension). + * For example: + *
plFileName("C:\\Path\\Filename.ext") => "Filename.ext"
+ */ plString GetFileName() const; + + /** Return the file extension from the filename. + * For example: + *
plFileName("C:\\Path\\Filename.ext") => "ext"
+ */ plString GetFileExt() const; + + /** Return the name portion of the path, excluding its extension. + * For example: + *
plFileName("C:\\Path\\Filename.ext") => "Filename"
+ */ plString GetFileNameNoExt() const; + /** Return the path with the filename portion stripped off. + * For example: + *
plFileName("C:\\Path\\Filename.ext") => "C:\\Path"
+ */ plFileName StripFileName() const; + + /** Return the filename with the extension stripped off. + * For example: + *
plFileName("C:\\Path\\Filename.ext") => "C:\\Path\\Filename"
+ */ plFileName StripFileExt() const; + /** Join two path components together with the correct path separator. + * For example: + *
plFileName::Join("C:\\Path", "Filename.ext") => "C:\\Path\\Filename.ext"
+ */ static plFileName Join(const plFileName &base, const plFileName &path); - // TODO: Make this more efficient + /** Join three path components together with the correct path separator. + * \todo Make this more efficient. + */ static plFileName Join(const plFileName &base, const plFileName &path, const plFileName& path2) { return Join(Join(base, path), path2); } + /** Join four path components together with the correct path separator. + * \todo Make this more efficient. + */ static plFileName Join(const plFileName &base, const plFileName &path, const plFileName& path2, const plFileName &path3) { return Join(Join(Join(base, path), path2), path3); }