xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Aurora::FileTypeManager Class Reference

#include <util.h>

Inheritance diagram for Aurora::FileTypeManager:
Inheritance graph
[legend]
Collaboration diagram for Aurora::FileTypeManager:
Collaboration graph
[legend]

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 ()
 

Detailed Description

Definition at line 42 of file util.h.

Member Typedef Documentation

◆ ExtensionLookup

Definition at line 68 of file util.h.

◆ HashLookup

typedef std::map<uint64 , const Type *> Aurora::FileTypeManager::HashLookup
private

Definition at line 70 of file util.h.

◆ TypeLookup

typedef std::map<FileType , const Type *> Aurora::FileTypeManager::TypeLookup
private

Definition at line 69 of file util.h.

Constructor & Destructor Documentation

◆ FileTypeManager()

Aurora::FileTypeManager::FileTypeManager ( )

Definition at line 355 of file util.cpp.

◆ ~FileTypeManager()

Aurora::FileTypeManager::~FileTypeManager ( )

Definition at line 358 of file util.cpp.

Member Function Documentation

◆ addFileType()

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().

Here is the call graph for this function:

◆ buildExtensionLookup()

void Aurora::FileTypeManager::buildExtensionLookup ( )
private

Definition at line 401 of file util.cpp.

References _extensionLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::extension, and types.

Referenced by getFileType().

Here is the caller graph for this function:

◆ buildHashLookup()

void Aurora::FileTypeManager::buildHashLookup ( Common::HashAlgo  algo)
private

Definition at line 417 of file util.cpp.

References _hashLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::extension, Common::hashString(), and types.

Referenced by getFileType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildTypeLookup()

void Aurora::FileTypeManager::buildTypeLookup ( )
private

Definition at line 409 of file util.cpp.

References _typeLookup, ARRAYSIZE, Aurora::FileTypeManager::Type::type, and types.

Referenced by setFileType().

Here is the caller graph for this function:

◆ getFileType() [1/2]

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().

Here is the call graph for this function:

◆ getFileType() [2/2]

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.

Here is the call graph for this function:

◆ setFileType()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _extensionLookup

ExtensionLookup Aurora::FileTypeManager::_extensionLookup
private

Definition at line 72 of file util.h.

Referenced by buildExtensionLookup(), and getFileType().

◆ _hashLookup

HashLookup Aurora::FileTypeManager::_hashLookup[Common::kHashMAX]
private

Definition at line 74 of file util.h.

Referenced by buildHashLookup(), and getFileType().

◆ _typeLookup

TypeLookup Aurora::FileTypeManager::_typeLookup
private

Definition at line 73 of file util.h.

Referenced by buildTypeLookup(), and setFileType().

◆ types

const FileTypeManager::Type Aurora::FileTypeManager::types
staticprivate

Definition at line 66 of file util.h.

Referenced by buildExtensionLookup(), buildHashLookup(), and buildTypeLookup().


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