From 1a6236c184d7ffe3551d417b656aee31b15d1948 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 25 Jan 2015 18:55:19 +0100 Subject: Added functions for dealing with ResourceTypes --- src/core/resource/Resource.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/core/resource/Resource.hpp') diff --git a/src/core/resource/Resource.hpp b/src/core/resource/Resource.hpp index 1934029..63ed591 100644 --- a/src/core/resource/Resource.hpp +++ b/src/core/resource/Resource.hpp @@ -30,6 +30,7 @@ #include #include +#include #include namespace ousia { @@ -169,8 +170,35 @@ public: * a resource. */ const std::string &getLocation() const { return location; } + + /** + * Returns the name of the given resource type. + * + * @param resourceType is the ResourceType of which the human readable name + * should be returned. + * @return the human readable name of the ResourceType. + */ + static std::string getResourceTypeName(ResourceType resourceType); + + /** + * Returns a resourceType by its name or ResourceType::UNKNOWN if the name + * is invalid. + * + * @param name is the name of the resource type. The name is converted to + * lowercase. + */ + static ResourceType getResourceTypeByName(const std::string &name); }; +/** + * Operator used for streaming the name of ResourceType instances. + * + * @param os is the output stream. + * @param resourceType is the type that should be serialized. + * @return the output stream. + */ +std::ostream& operator<<(std::ostream &os, ResourceType resourceType); + /** * Invalid resource instance. */ -- cgit v1.2.3