diff options
author | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-01-29 17:20:56 +0200 |
---|---|---|
committer | Wolf Bergenheim <ext-wolf.2.bergenheim@nokia.com> | 2010-01-29 17:20:56 +0200 |
commit | 0746bbd252fe13ce3c4ae523fc28b0cf27314c05 (patch) | |
tree | 323b3406c6f893f21c7c7820532c0df2a61881cc /src/resource.cpp | |
parent | 27c45e867533ad43bc2b2e64fe577a503b2d05a8 (diff) |
Refactored Resource into multiple classes
Diffstat (limited to 'src/resource.cpp')
-rw-r--r-- | src/resource.cpp | 56 |
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; +} + + |