aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-12 03:17:47 +0000
committerDavid Robillard <d@drobilla.net>2013-01-12 03:17:47 +0000
commite1a63732f796c8057751cb7f8ac98a595b91692e (patch)
tree764392d055901118ee285dd20f233ff33e0cd04a /src/client
parentbb62bf2c23ba84f547e37b70b3ef31b51ba987ab (diff)
downloadmachina-e1a63732f796c8057751cb7f8ac98a595b91692e.tar.gz
machina-e1a63732f796c8057751cb7f8ac98a595b91692e.tar.bz2
machina-e1a63732f796c8057751cb7f8ac98a595b91692e.zip
Bulk reformat.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4929 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientModel.cpp15
-rw-r--r--src/client/ClientModel.hpp11
-rw-r--r--src/client/ClientObject.cpp13
-rw-r--r--src/client/ClientObject.hpp17
4 files changed, 34 insertions, 22 deletions
diff --git a/src/client/ClientModel.cpp b/src/client/ClientModel.cpp
index 4af3a37..c945de7 100644
--- a/src/client/ClientModel.cpp
+++ b/src/client/ClientModel.cpp
@@ -24,11 +24,12 @@ SharedPtr<ClientObject>
ClientModel::find(uint64_t id)
{
SharedPtr<ClientObject> key(new ClientObjectKey(id));
- Objects::iterator i = _objects.find(key);
- if (i != _objects.end())
+ Objects::iterator i = _objects.find(key);
+ if (i != _objects.end()) {
return *i;
- else
+ } else {
return SharedPtr<ClientObject>();
+ }
}
void
@@ -42,9 +43,10 @@ void
ClientModel::erase_object(uint64_t id)
{
SharedPtr<ClientObject> key(new ClientObjectKey(id));
- Objects::iterator i = _objects.find(key);
- if (i == _objects.end())
+ Objects::iterator i = _objects.find(key);
+ if (i == _objects.end()) {
return;
+ }
signal_erase_object.emit(*i);
(*i)->set_view(SharedPtr<ClientObject::View>());
@@ -55,8 +57,9 @@ void
ClientModel::property(uint64_t id, URIInt key, const Raul::Atom& value)
{
SharedPtr<ClientObject> object = find(id);
- if (object)
+ if (object) {
object->set(key, value);
+ }
}
}
diff --git a/src/client/ClientModel.hpp b/src/client/ClientModel.hpp
index de3b8ea..07500db 100644
--- a/src/client/ClientModel.hpp
+++ b/src/client/ClientModel.hpp
@@ -24,12 +24,15 @@
#include "ClientObject.hpp"
-namespace Raul { class Atom; }
+namespace Raul {
+class Atom;
+}
namespace Machina {
namespace Client {
-class ClientModel {
+class ClientModel
+{
public:
void new_object(SharedPtr<ClientObject> object);
void erase_object(uint64_t id);
@@ -42,9 +45,11 @@ public:
private:
struct ClientObjectComparator {
- inline bool operator()(SharedPtr<ClientObject> lhs, SharedPtr<ClientObject> rhs) const {
+ inline bool operator()(SharedPtr<ClientObject> lhs,
+ SharedPtr<ClientObject> rhs) const {
return lhs->id() < rhs->id();
}
+
};
typedef std::set<SharedPtr<ClientObject>, ClientObjectComparator> Objects;
diff --git a/src/client/ClientObject.cpp b/src/client/ClientObject.cpp
index c6d254b..7f7eb9e 100644
--- a/src/client/ClientObject.cpp
+++ b/src/client/ClientObject.cpp
@@ -24,14 +24,12 @@ namespace Client {
ClientObject::ClientObject(uint64_t id)
: _id(id)
-{
-}
+{}
ClientObject::ClientObject(const ClientObject& copy, uint64_t id)
: _id(id)
, _properties(copy._properties)
-{
-}
+{}
void
ClientObject::set(URIInt key, const Raul::Atom& value)
@@ -43,12 +41,13 @@ ClientObject::set(URIInt key, const Raul::Atom& value)
const Raul::Atom&
ClientObject::get(URIInt key) const
{
- static const Raul::Atom null_atom;
+ static const Raul::Atom null_atom;
Properties::const_iterator i = _properties.find(key);
- if (i != _properties.end())
+ if (i != _properties.end()) {
return i->second;
- else
+ } else {
return null_atom;
+ }
}
}
diff --git a/src/client/ClientObject.hpp b/src/client/ClientObject.hpp
index 658d603..994a5ba 100644
--- a/src/client/ClientObject.hpp
+++ b/src/client/ClientObject.hpp
@@ -30,7 +30,8 @@
namespace Machina {
namespace Client {
-class ClientObject {
+class ClientObject
+{
public:
ClientObject(uint64_t id);
ClientObject(const ClientObject& copy, uint64_t id);
@@ -42,7 +43,8 @@ public:
sigc::signal<void, URIInt, Raul::Atom> signal_property;
- class View {
+ class View
+ {
public:
virtual ~View() {}
};
@@ -50,8 +52,8 @@ public:
typedef std::map<URIInt, Raul::Atom> Properties;
const Properties& properties() { return _properties; }
- SharedPtr<View> view() const { return _view; }
- void set_view(SharedPtr<View> view) { _view = view; }
+ SharedPtr<View> view() const { return _view; }
+ void set_view(SharedPtr<View> view) { _view = view; }
private:
uint64_t _id;
@@ -60,9 +62,12 @@ private:
Properties _properties;
};
-class ClientObjectKey : public ClientObject {
+class ClientObjectKey
+ : public ClientObject
+{
public:
- ClientObjectKey(uint64_t id) : ClientObject(id) {}
+ ClientObjectKey(uint64_t id)
+ : ClientObject(id) {}
};
}