xoreos
0.0.5
|
#include <util.h>
Classes | |
struct | Type |
File type <-> extension mapping. More... | |
Public Member Functions | |
FileTypeManager () | |
~FileTypeManager () | |
FileType | getFileType (const Common::UString &path) |
Return the file type of a file name, detected by its extension. More... | |
FileType | getFileType (Common::HashAlgo algo, uint64 hashedExtension) |
Return the file type of a file name, detected by its hashed extension. More... | |
Common::UString | addFileType (const Common::UString &path, FileType type) |
Return the file name with an added extensions according to the specified file type. More... | |
Common::UString | setFileType (const Common::UString &path, FileType type) |
Return the file name with a swapped extensions according to the specified file type. More... | |
Private Types | |
typedef std::map< Common::UString, const Type * > | ExtensionLookup |
typedef std::map< FileType, const Type * > | TypeLookup |
typedef std::map< uint64, const Type * > | HashLookup |
Private Member Functions | |
void | buildExtensionLookup () |
void | buildTypeLookup () |
void | buildHashLookup (Common::HashAlgo algo) |
Private Attributes | |
ExtensionLookup | _extensionLookup |
TypeLookup | _typeLookup |
HashLookup | _hashLookup [Common::kHashMAX] |
Static Private Attributes | |
static const Type | types [] |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< FileTypeManager > | |
static FileTypeManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< FileTypeManager > | |
typedef FileTypeManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< FileTypeManager > | |
Singleton () | |
virtual | ~Singleton () |
|
private |
|
private |
|
private |
Common::UString Aurora::FileTypeManager::addFileType | ( | const Common::UString & | path, |
FileType | type | ||
) |
Return the file name with an added extensions according to the specified file type.
Definition at line 373 of file util.cpp.
References setFileType().
|
private |
Definition at line 401 of file util.cpp.
References _extensionLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::extension, and types.
Referenced by getFileType().
|
private |
Definition at line 417 of file util.cpp.
References _hashLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::extension, Common::hashString(), and types.
Referenced by getFileType().
|
private |
Definition at line 409 of file util.cpp.
References _typeLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::type, and types.
Referenced by setFileType().
FileType Aurora::FileTypeManager::getFileType | ( | const Common::UString & | path | ) |
Return the file type of a file name, detected by its extension.
Definition at line 361 of file util.cpp.
References _extensionLookup, buildExtensionLookup(), Common::FilePath::getExtension(), Aurora::kFileTypeNone, and Common::UString::toLower().
FileType Aurora::FileTypeManager::getFileType | ( | Common::HashAlgo | algo, |
uint64 | hashedExtension | ||
) |
Return the file type of a file name, detected by its hashed extension.
Definition at line 388 of file util.cpp.
References _hashLookup, buildHashLookup(), Aurora::kFileTypeNone, and Common::kHashMAX.
Common::UString Aurora::FileTypeManager::setFileType | ( | const Common::UString & | path, |
FileType | type | ||
) |
Return the file name with a swapped extensions according to the specified file type.
Definition at line 377 of file util.cpp.
References _typeLookup, buildTypeLookup(), and Common::FilePath::changeExtension().
Referenced by addFileType().
|
private |
Definition at line 72 of file util.h.
Referenced by buildExtensionLookup(), and getFileType().
|
private |
Definition at line 74 of file util.h.
Referenced by buildHashLookup(), and getFileType().
|
private |
Definition at line 73 of file util.h.
Referenced by buildTypeLookup(), and setFileType().
|
staticprivate |
Definition at line 66 of file util.h.
Referenced by buildExtensionLookup(), buildHashLookup(), and buildTypeLookup().