summaryrefslogtreecommitdiff
path: root/src/core/resource/Resource.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-25 18:55:19 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-25 18:55:19 +0100
commit1a6236c184d7ffe3551d417b656aee31b15d1948 (patch)
tree30d7a3a8b6101b5060ecd7f704c70f0c72bd5e27 /src/core/resource/Resource.hpp
parentbfafa64765de7a6002c2e84daefc84811278a51a (diff)
Added functions for dealing with ResourceTypes
Diffstat (limited to 'src/core/resource/Resource.hpp')
-rw-r--r--src/core/resource/Resource.hpp28
1 files changed, 28 insertions, 0 deletions
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 <map>
#include <memory>
+#include <ostream>
#include <string>
namespace ousia {
@@ -169,9 +170,36 @@ 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.
*/
extern const Resource NullResource;