Skip to content

Commit

Permalink
#5127: Add interfaces for managing favourite resources in a central m…
Browse files Browse the repository at this point in the history
…anager class
  • Loading branch information
codereader committed Dec 26, 2020
1 parent a96f518 commit a487747
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/idecltypes.h
@@ -0,0 +1,12 @@
#pragma once

namespace decl
{

// Enumeration of declaration types supported by DarkRadiant
enum class Type
{
Material,
};

}
39 changes: 39 additions & 0 deletions include/ifavourites.h
@@ -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;
}

2 changes: 2 additions & 0 deletions tools/msvc/include.vcxproj
Expand Up @@ -109,13 +109,15 @@
<ClInclude Include="..\..\include\icounter.h" />
<ClInclude Include="..\..\include\icurve.h" />
<ClInclude Include="..\..\include\idatastream.h" />
<ClInclude Include="..\..\include\idecltypes.h" />
<ClInclude Include="..\..\include\idialogmanager.h" />
<ClInclude Include="..\..\include\ieclass.h" />
<ClInclude Include="..\..\include\ieclasscolours.h" />
<ClInclude Include="..\..\include\ieditstopwatch.h" />
<ClInclude Include="..\..\include\ientity.h" />
<ClInclude Include="..\..\include\ientityinspector.h" />
<ClInclude Include="..\..\include\ieventmanager.h" />
<ClInclude Include="..\..\include\ifavourites.h" />
<ClInclude Include="..\..\include\ifilechooser.h" />
<ClInclude Include="..\..\include\ifilesystem.h" />
<ClInclude Include="..\..\include\ifiletypes.h" />
Expand Down

0 comments on commit a487747

Please sign in to comment.