Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5127: Add interfaces for managing favourite resources in a central m…
…anager class
- Loading branch information
1 parent
a96f518
commit a487747
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
namespace decl | ||
{ | ||
|
||
// Enumeration of declaration types supported by DarkRadiant | ||
enum class Type | ||
{ | ||
Material, | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <set> | ||
#include "imodule.h" | ||
#include "idecltypes.h" | ||
|
||
namespace decl | ||
{ | ||
|
||
class IFavouritesManager : | ||
public RegisterableModule | ||
{ | ||
public: | ||
virtual ~IFavouritesManager() {} | ||
|
||
// Adds the given declaration (as identified by the given path) to | ||
// the set of favourites | ||
virtual void addFavourite(decl::Type type, const std::string& path) = 0; | ||
|
||
// Removes the given declaration from the favourites set | ||
virtual void removeFavourite(decl::Type type, const std::string& path) = 0; | ||
|
||
// Returns true if the given declaration is listed as favourite | ||
virtual bool isFavourite(decl::Type type, const std::string& path) = 0; | ||
|
||
// Returns the whole set of favourites for the given declaration type | ||
virtual std::set<std::string> getFavourites(decl::Type type) = 0; | ||
}; | ||
|
||
} | ||
|
||
const char* const MODULE_FAVOURITES_MANAGER("FavouritesManager"); | ||
|
||
inline decl::IFavouritesManager& GlobalFavouritesManager() | ||
{ | ||
static module::InstanceReference<decl::IFavouritesManager> _reference(MODULE_FAVOURITES_MANAGER); | ||
return _reference; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters