Skip to content

Commit

Permalink
Refactor: Renamed fileclass_t to resourceclass_t
Browse files Browse the repository at this point in the history
This component should not have been renamed along with the rest of
of the old resource-level components - it belongs at resource level.
  • Loading branch information
danij-deng committed Nov 19, 2012
1 parent c932224 commit cd7e577
Show file tree
Hide file tree
Showing 65 changed files with 358 additions and 358 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_types.h
Expand Up @@ -100,7 +100,7 @@ struct surface_s;
struct material_s;

#include <de/str.h>
#include "fileclass.h"
#include "resourceclass.h"
#include "filetype.h"
#include "uri.h" // C wrapper for de::Uri

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/doomsday.h
Expand Up @@ -171,7 +171,7 @@ gameid_t DD_GameIdForKey(char const* identityKey);
* For package resources this may be C-String containing a
* semicolon delimited list of identity keys.
*/
void DD_AddGameResource(gameid_t game, fileclassid_t classId, int fFlags,
void DD_AddGameResource(gameid_t game, resourceclassid_t classId, int fFlags,
const char* names, void* params);

/**
Expand Down
12 changes: 6 additions & 6 deletions doomsday/engine/api/filetype.h
Expand Up @@ -33,7 +33,7 @@
#include <de/String>
#include "filehandle.h"

enum fileclassid_e;
enum resourceclassid_e;

namespace de
{
Expand All @@ -48,7 +48,7 @@ namespace de
class FileType
{
public:
FileType(String _name, fileclassid_e _defaultClass)
FileType(String _name, resourceclassid_e _defaultClass)
: name_(_name), defaultClass_(_defaultClass)
{}

Expand All @@ -61,7 +61,7 @@ namespace de
}

/// Return the unique identifier of the default class for this type of file.
fileclassid_e defaultClass() const
resourceclassid_e defaultClass() const
{
return defaultClass_;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ namespace de
String name_;

/// Default class attributed to files of this type.
fileclassid_e defaultClass_;
resourceclassid_e defaultClass_;

/// List of known extensions for this file type.
QStringList knownFileNameExtensions_;
Expand All @@ -126,7 +126,7 @@ namespace de
class NullFileType : public FileType
{
public:
NullFileType() : FileType("FT_NONE", FC_UNKNOWN)
NullFileType() : FileType("FT_NONE", RC_UNKNOWN)
{}
};

Expand All @@ -141,7 +141,7 @@ namespace de
class NativeFileType : public FileType
{
public:
NativeFileType(String name, fileclassid_t rclassId)
NativeFileType(String name, resourceclassid_t rclassId)
: FileType(name, rclassId)
{}

Expand Down
@@ -1,7 +1,7 @@
/**
* @file fileclass.h
* @file resourceclass.h
*
* File Class. @ingroup fs
* Resource Class. @ingroup resource
*
* @author Copyright &copy; 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @author Copyright &copy; 2006-2012 Daniel Swanson <danij@dengine.net>
Expand All @@ -21,35 +21,35 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_FILECLASS_H
#define LIBDENG_FILECLASS_H
#ifndef LIBDENG_RESOURCECLASS_H
#define LIBDENG_RESOURCECLASS_H

#ifdef __cplusplus
extern "C" {
#endif

/**
* File Class Identifier.
* Resource Class Identifier.
*
* @ingroup base
*
* @todo Refactor away. These identifiers are no longer needed.
*/
typedef enum fileclassid_e {
FC_NONE = -2, ///< Not a real class.
FC_UNKNOWN = -1, ///< Attempt to guess the class through evaluation of the path.
FILECLASS_FIRST = 0,
FC_PACKAGE = FILECLASS_FIRST,
FC_DEFINITION,
FC_GRAPHIC,
FC_MODEL,
FC_SOUND,
FC_MUSIC,
FC_FONT,
FILECLASS_COUNT
} fileclassid_t;

#define VALID_FILECLASSID(n) ((n) >= FILECLASS_FIRST && (n) < FILECLASS_COUNT)
typedef enum resourceclassid_e {
RC_NULL = -2, ///< Not a real class.
RC_UNKNOWN = -1, ///< Attempt to guess the class through evaluation of the path.
RESOURCECLASS_FIRST = 0,
RC_PACKAGE = RESOURCECLASS_FIRST,
RC_DEFINITION,
RC_GRAPHIC,
RC_MODEL,
RC_SOUND,
RC_MUSIC,
RC_FONT,
RESOURCECLASS_COUNT
} resourceclassid_t;

#define VALID_RESOURCECLASSID(n) ((n) >= RESOURCECLASS_FIRST && (n) < RESOURCECLASS_COUNT)

#ifdef __cplusplus
} // extern "C"
Expand All @@ -65,48 +65,48 @@ typedef enum fileclassid_e {
namespace de
{
/**
* FileClass encapsulates the properties and logics belonging to a logical
* class of resource file (e.g., Graphic, Model, Sound, etc...)
* ResourceClass encapsulates the properties and logics belonging to a logical
* class of resource (e.g., Graphic, Model, Sound, etc...)
*
* @ingroup base
*/
struct FileClass
struct ResourceClass
{
public:
typedef QList<FileType*> Types;

public:
FileClass(String _name, String _defaultNamespace)
ResourceClass(String _name, String _defaultNamespace)
: name_(_name), defaultNamespace_(_defaultNamespace)
{}

virtual ~FileClass() {};
virtual ~ResourceClass() {};

/// Return the symbolic name of this file class.
/// Return the symbolic name of this resource class.
String const& name() const
{
return name_;
}

/// Return the symbolic name of the default namespace for this class of file.
/// Return the symbolic name of the default namespace for this class of resource.
String const& defaultNamespace() const
{
return defaultNamespace_;
}

/// Return the number of file types for this class.
/// Return the number of file types for this class of resource.
int fileTypeCount() const
{
return searchTypeOrder.count();
}

/**
* Add a new type of file to this class. Earlier types have priority.
* Add a new file type to this resource class. Earlier types have priority.
*
* @param ftype File type to add.
* @return This instance.
*/
FileClass& addFileType(FileType* ftype)
ResourceClass& addFileType(FileType* ftype)
{
searchTypeOrder.push_back(ftype);
return *this;
Expand All @@ -115,7 +115,7 @@ namespace de
/**
* Provides access to the file type list for efficient iteration.
*
* @return List of file types of this class.
* @return List of file types for this class of resource.
*/
Types const& fileTypes() const
{
Expand All @@ -134,23 +134,23 @@ namespace de
};

/**
* The special "null" FileClass object.
* The special "null" ResourceClass object.
*
* @ingroup core
*/
struct NullFileClass : public FileClass
struct NullResourceClass : public ResourceClass
{
NullFileClass() : FileClass("FC_NONE", "")
NullResourceClass() : ResourceClass("FC_NONE", "")
{}
};

/// @return @c true= @a fclass is a "null-fileclass" object (not a real class).
inline bool isNullFileClass(FileClass const& fclass) {
return !!dynamic_cast<NullFileClass const*>(&fclass);
/// @return @c true= @a rclass is a "null-resourceclass" object (not a real class).
inline bool isNullResourceClass(ResourceClass const& rclass) {
return !!dynamic_cast<NullResourceClass const*>(&rclass);
}

} // namespace de
#endif // DENG2_C_API_ONLY
#endif // __cplusplus

#endif /* LIBDENG_FILECLASS_H */
#endif /* LIBDENG_RESOURCECLASS_H */
10 changes: 5 additions & 5 deletions doomsday/engine/api/uri.h
Expand Up @@ -82,10 +82,10 @@ Uri* Uri_New(void);
* Uri_Delete() once it is no longer needed.
*
* @param path Path to be parsed. Assumed to be in percent-encoded representation.
* @param defaultFileClass If no scheme is defined in @a path and this is not @c FC_NULL,
* @param defaultResourceClasslasslass If no scheme is defined in @a path and this is not @c FC_NULL,
* look for an appropriate default scheme for this class of resource.
*/
Uri* Uri_NewWithPath2(char const* path, fileclassid_t defaultFileClass);
Uri* Uri_NewWithPath2(char const* path, resourceclassid_t defResourceClasslasslasslass);
Uri* Uri_NewWithPath(char const* path);

/**
Expand Down Expand Up @@ -169,14 +169,14 @@ Uri* Uri_SetPath(Uri* uri, char const* path);
*
* @param uri Uri instance.
* @param path Path to be parsed. Assumed to be in percent-encoded representation.
* @param defaultFileClass If no scheme is defined in @a path and this is not
* @param defaultResourceClasslasslass If no scheme is defined in @a path and this is not
* @c FC_NULL, look for an appropriate default scheme for this class
* of resource.
*
* @return Same as @a uri, for caller convenience.
*/
Uri* Uri_SetUri2(Uri* uri, char const* path, fileclassid_t defaultFileClass);
Uri* Uri_SetUri(Uri* uri, char const* path/* defaultFileClass = FC_UNKNOWN*/);
Uri* Uri_SetUri2(Uri* uri, char const* path, resourceclassid_t defResourceClasslasslasslass);
Uri* Uri_SetUri(Uri* uri, char const* path/* defaultResourceClasslasslass = RC_UNKNOWN*/);

Uri* Uri_SetUriStr(Uri* uri, ddstring_t const* path);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/engine.pro
Expand Up @@ -108,10 +108,10 @@ DENG_API_HEADERS = \
api/def_share.h \
api/dengproject.h \
api/doomsday.h \
api/fileclass.h \
api/filehandle.h \
api/filetype.h \
api/materialarchive.h \
api/resourceclass.h \
api/sys_audiod.h \
api/sys_audiod_mus.h \
api/sys_audiod_sfx.h \
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/include/dd_main.h
Expand Up @@ -161,7 +161,7 @@ void DD_DestroyGames(void);

boolean DD_GameInfo(struct gameinfo_s* info);

void DD_AddGameResource(gameid_t game, fileclassid_t classId, int rflags, char const* names, void* params);
void DD_AddGameResource(gameid_t game, resourceclassid_t classId, int rflags, char const* names, void* params);

gameid_t DD_DefineGame(struct gamedef_s const* def);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/include/de_filesys.h
Expand Up @@ -25,7 +25,7 @@

#include "dd_types.h"

#include "fileclass.h"
#include "resourceclass.h"
#include "filetype.h"

#include "filesys/filehandlebuilder.h"
Expand Down
24 changes: 12 additions & 12 deletions doomsday/engine/include/filesys/locator.h
Expand Up @@ -92,24 +92,24 @@ void F_ResetAllFileNamespaces(void);
*
* @return @c true iff a resource was found.
*/
boolean F_Find4(fileclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath, int flags, char const* optionalSuffix);
boolean F_Find3(fileclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath, int flags/*, optionalSuffix = NULL*/);
boolean F_Find2(fileclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath/*, flags = RLF_DEFAULT*/);
boolean F_Find(fileclassid_t classId, struct uri_s const* searchPath/*, foundPath = NULL*/);
boolean F_Find4(resourceclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath, int flags, char const* optionalSuffix);
boolean F_Find3(resourceclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath, int flags/*, optionalSuffix = NULL*/);
boolean F_Find2(resourceclassid_t classId, struct uri_s const* searchPath, ddstring_t* foundPath/*, flags = RLF_DEFAULT*/);
boolean F_Find(resourceclassid_t classId, struct uri_s const* searchPath/*, foundPath = NULL*/);

/**
* @return If a resource is found, the index + 1 of the path from @a searchPaths
* that was used to find it; otherwise @c 0.
*/
uint F_FindFromList(fileclassid_t classId, char const* searchPaths,
uint F_FindFromList(resourceclassid_t classId, char const* searchPaths,
ddstring_t* foundPath, int flags, char const* optionalSuffix);

#ifdef __cplusplus
} // extern "C"

namespace de {

typedef QList<FileClass*> FileClasses;
typedef QList<ResourceClass*> ResourceClasses;
typedef QList<FileType*> FileTypes;
typedef QList<FileNamespace*> FileNamespaces;

Expand All @@ -128,22 +128,22 @@ de::FileTypes const& F_FileTypes();
de::FileNamespaces const& F_FileNamespaces();

/**
* Lookup a FileClass by id.
* Lookup a ResourceClass by id.
*
* @todo Refactor away.
*
* @param classId Unique identifier of the class.
* @return FileClass associated with @a id.
* @return ResourceClass associated with @a id.
*/
de::FileClass& F_FileClassById(fileclassid_t classId);
de::ResourceClass& F_ResourceClassById(resourceclassid_t classId);

/**
* Lookup a FileClass by symbolic name.
* Lookup a ResourceClass by symbolic name.
*
* @param name Symbolic name of the class.
* @return FileClass associated with @a name; otherwise @c 0 (not found).
* @return ResourceClass associated with @a name; otherwise @c 0 (not found).
*/
de::FileClass& F_FileClassByName(de::String name);
de::ResourceClass& F_ResourceClassByName(de::String name);

/**
* Lookup a FileType by symbolic name.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/include/filesys/metafile.h
Expand Up @@ -46,11 +46,11 @@ namespace de
* @param fFlags @ref fileFlags
* @param name An expected name for the associated file.
*/
MetaFile(fileclassid_t fClass, int fFlags, String* name = 0);
MetaFile(resourceclassid_t fClass, int fFlags, String* name = 0);
~MetaFile();

/// @return Class of file.
fileclassid_t fileClass() const;
resourceclassid_t fileClass() const;

/// @return Flags for this file.
int fileFlags() const;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/include/game.h
Expand Up @@ -70,7 +70,7 @@ class GameCollection;
class Game
{
public:
typedef QMultiMap<fileclassid_t, MetaFile*> MetaFiles;
typedef QMultiMap<resourceclassid_t, MetaFile*> MetaFiles;

public:
/**
Expand Down Expand Up @@ -205,7 +205,7 @@ class NullGame : public Game
return true; // Always.
}

struct metafile_s* const* metafiles(fileclassid_t /*classId*/, int* /*count*/) const {
struct metafile_s* const* metafiles(resourceclassid_t /*classId*/, int* /*count*/) const {
return 0;
}

Expand Down

0 comments on commit cd7e577

Please sign in to comment.