summaryrefslogtreecommitdiff
path: root/src/resource.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-29 17:20:56 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-29 17:20:56 +0200
commit0746bbd252fe13ce3c4ae523fc28b0cf27314c05 (patch)
tree323b3406c6f893f21c7c7820532c0df2a61881cc /src/resource.cpp
parent27c45e867533ad43bc2b2e64fe577a503b2d05a8 (diff)
Refactored Resource into multiple classes
Diffstat (limited to 'src/resource.cpp')
-rw-r--r--src/resource.cpp56
1 files changed, 21 insertions, 35 deletions
diff --git a/src/resource.cpp b/src/resource.cpp
index 72ac24e..8207b66 100644
--- a/src/resource.cpp
+++ b/src/resource.cpp
@@ -2,44 +2,21 @@
using namespace ResourcePolicy;
-Resource::Resource(enum ResourceType type)
- : resourceType(type), optional(false), shared(false)
-{
-}
-
-Resource::~Resource()
+Resource::Resource()
+ : optional(false), shared(false),
+ identifier(0), granted(false)
{
+ identifier = (quint32)this;
}
Resource::Resource(const Resource &other)
- : resourceType(other.resourceType), optional(other.optional),
- shared(other.shared)
-{
-}
-
-Resource & Resource::operator=(const Resource &other)
-{
- resourceType = other.resourceType;
- optional = other.optional;
- shared = other.shared;
-
- return *this;
-}
-
-ResourceType Resource::type() const
+ : optional(other.optional), shared(other.shared),
+ identifier(other.identifier), granted(other.granted)
{
- return resourceType;
}
-bool Resource::setType(ResourceType type)
+Resource::~Resource()
{
- if(type != InvalidResource) {
- resourceType = type;
- return true;
- }
- else {
- return false;
- }
}
bool Resource::isOptional() const
@@ -62,10 +39,19 @@ void Resource::setShared(bool shared)
this->shared = shared;
}
-bool Resource::operator==(const Resource &other) const
+bool Resource::isGranted() const
+{
+ return granted;
+}
+
+void Resource::setGranted()
{
- if(resourceType != other.resourceType) {
- return false;
- }
- return true;
+ granted = true;
}
+
+void Resource::unsetGranted()
+{
+ granted = false;
+}
+
+