summaryrefslogtreecommitdiff
path: root/src/resource.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-21 09:56:07 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-21 09:56:38 +0200
commitdef881f37f26d6f3b9bf1a9c077dae4916717157 (patch)
tree6b378f9c7de325ad8d3bfb57b1e5d354d7e529fa /src/resource.cpp
parentf482f4e2ebdff76d1818822fd98f7941787745d8 (diff)
downloadlibresourceqt-def881f37f26d6f3b9bf1a9c077dae4916717157.tar.gz
Refactored Resource
Diffstat (limited to 'src/resource.cpp')
-rw-r--r--src/resource.cpp136
1 files changed, 38 insertions, 98 deletions
diff --git a/src/resource.cpp b/src/resource.cpp
index bc03847..3f529b6 100644
--- a/src/resource.cpp
+++ b/src/resource.cpp
@@ -1,140 +1,80 @@
#include "resource.h"
-Resource::Resource(enum ResourceClass requestedClass, quint16 requestedResources,
- QObject *parent)
- : QObject(parent), resourceClass(requestedClass),
- resourceType(requestedResources), resourceState(UnknownState)
+Resource::Resource() : name(QString()), optional(false), shared(false)
{
+ identifier = (quint32)this;
}
Resource::~Resource()
{
}
-bool Resource::initialize(ResourceLibrary *library)
+Resource::Resource(const Resource &other)
+ : name(other.name), optional(other.optional),
+ shared(other.shared), identifier(other.identifier)
{
- qDebug("Resource::initialize");
- resourceLibrary = library;
- return resourceLibrary->initialize();
}
-bool Resource::connectToServer()
+Resource & Resource::operator=(const Resource &other)
{
- if(resourceLibrary == NULL)
- return false;
- return resourceLibrary->connectToServer();
-}
-
-quint16 Resource::resources() const
-{
- return resourceType;
-}
+ name = other.name;
+ optional = other.optional;
+ shared = other.shared;
+ identifier = other.identifier;
-enum ResourceClass Resource::applicationClass() const
-{
- return resourceClass;
+ return *this;
}
-bool Resource::hasResource(enum ResourceType resourceType) const
+QString Resource::type() const
{
- if((this->resourceType & resourceType) == resourceType)
- return true;
- else
- return false;
-}
-
-bool Resource::isReserved() const
-{
- if(resourceState == OwnedState)
- return true;
- else
- return false;
+ return name;
}
-void Resource::handleStateChange(enum ResourceState newState)
-{
- if(resourceState == UnknownState) {
- resourceState = newState;
- emit connectedToServer();
- }
- else {
- resourceState = newState;
- emit stateChanged(resourceState);
- }
-}
-
-void Resource::emitReservable()
-{
- emit reservable();
-}
-
-bool Resource::reserve()
-{
- return false;
-}
-
-bool Resource::release()
+void Resource::setType(const QString type)
{
- return false;
+ name = type;
}
-bool Resource::requestState()
+bool Resource::isOptional() const
{
- return false;
+ return optional;
}
-bool Resource::setMute()
+void Resource::setOptional(bool resourceIsOptional)
{
- return false;
+ optional = resourceIsOptional;
}
-bool Resource::unsetMute()
+bool Resource::isShared() const
{
- return false;
+ return shared;
}
-bool Resource::requestMute()
+void Resource::setShared(bool shared)
{
- return false;
+ this->shared = shared;
}
-bool Resource::setPrivacyOverride()
+quint32 Resource::id() const
{
- return false;
+ return identifier;
}
-bool Resource::unsetPrivacyOverride()
+void Resource::setId(quint32 newId)
{
- return false;
+ identifier = newId;
}
-bool Resource::requestPrivacyOverride()
+bool Resource::operator==(const Resource &other)
{
- return false;
-}
-
-bool Resource::setBluetoothOverride()
-{
- return false;
-}
-
-bool Resource::unsetBluetoothOverride()
-{
- return false;
-}
-
-bool Resource::requestBluetoothOverride()
-{
- return false;
-}
-
-bool Resource::setPid(quint32 pid)
-{
- return false;
-}
-
-bool Resource::setStreamName(const QString & name)
-{
- return false;
+ if(name != other.name) {
+ return false;
+ }
+ if((identifier != other.identifier) or
+ (shared != other.shared) or
+ (optional != other.optional))
+ {
+ return false;
+ }
+ return true;
}
-