Remoto - VFS
|
The type registry for file extensions. More...
#include <VFS_node_type.h>
Static Public Member Functions | |
static QString | getType (QString _path, QString _default="unknownType") |
Fetch the type of a file, based on path/filename.ext. More... | |
static QMap< QString, bool > | initJsons () |
Initialize the jsons library. More... | |
static QMap< QString, QString > | initTypes () |
Initialize the type library. More... | |
static bool | isJsonType (QString _type) |
Check if a type is known to be json. More... | |
static bool | registerType (QString type, QString handler, bool json=true) |
Add a type to the registry. More... | |
static bool | unregisterType (QString type) |
Remove a type from the registry. More... | |
Static Private Attributes | |
static QMap< QString, bool > | jsonMap = VFS_node_type::initJsons() |
The extension:isjson map. More... | |
static QMap< QString, QString > | typeMap = VFS_node_type::initTypes() |
The extension:type map. More... | |
The type registry for file extensions.
Because a traditional filesystem doesn't usually have a concept of metadata, some form of type detection must occur to display in a user interface. This is generally only for use with nodes like VFS_HD.
Basic types are provided and mapped to gui types, however this list is not extensive. Types can be added using the registerType() function. Duplicate types are an error.
Definition at line 8 of file VFS_node_type.h.
|
static |
Fetch the type of a file, based on path/filename.ext.
_path | The path to examine |
_default | A default type to return if the type cannot be determined. |
This will parse the incoming path and search for a matching file extension.
Definition at line 99 of file VFS_node_type.cpp.
|
static |
Initialize the jsons library.
This is used when the executable starts, and populates the static private typeMap.
Definition at line 73 of file VFS_node_type.cpp.
|
static |
Initialize the type library.
This is used when the executable starts, and populates the static private typeMap.
Definition at line 34 of file VFS_node_type.cpp.
|
static |
Check if a type is known to be json.
_type | The path to examine. |
Definition at line 122 of file VFS_node_type.cpp.
|
static |
Add a type to the registry.
type | The type to add. |
handler | A handler type, probably in the code form: nodename:libname |
json | The json-ness of the type |
Definition at line 139 of file VFS_node_type.cpp.
|
static |
Remove a type from the registry.
type | The type to remove |
Definition at line 156 of file VFS_node_type.cpp.
|
staticprivate |
The extension:isjson map.
Definition at line 22 of file VFS_node_type.h.
|
staticprivate |
The extension:type map.
Definition at line 21 of file VFS_node_type.h.