summaryrefslogtreecommitdiffstats
path: root/common/bufferadaptor.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
commit4d9746c828558c9f872e0aed52442863affb25d5 (patch)
tree507d7c2ba67f47d3cbbcf01a722236ff1b48426b /common/bufferadaptor.h
parent9cea920b7dd51867a0be0fed2f461b6be73c103e (diff)
downloadsink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz
sink-4d9746c828558c9f872e0aed52442863affb25d5.zip
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'common/bufferadaptor.h')
-rw-r--r--common/bufferadaptor.h54
1 files changed, 37 insertions, 17 deletions
diff --git a/common/bufferadaptor.h b/common/bufferadaptor.h
index 892635f..0087643 100644
--- a/common/bufferadaptor.h
+++ b/common/bufferadaptor.h
@@ -30,44 +30,64 @@ namespace ApplicationDomain {
30/** 30/**
31 * This class has to be implemented by resources and can be used as generic interface to access the buffer properties 31 * This class has to be implemented by resources and can be used as generic interface to access the buffer properties
32 */ 32 */
33class BufferAdaptor { 33class BufferAdaptor
34{
34public: 35public:
35 virtual ~BufferAdaptor() {} 36 virtual ~BufferAdaptor()
36 virtual QVariant getProperty(const QByteArray &key) const { return QVariant(); } 37 {
37 virtual void setProperty(const QByteArray &key, const QVariant &value) {} 38 }
38 virtual QList<QByteArray> availableProperties() const { return QList<QByteArray>(); } 39 virtual QVariant getProperty(const QByteArray &key) const
40 {
41 return QVariant();
42 }
43 virtual void setProperty(const QByteArray &key, const QVariant &value)
44 {
45 }
46 virtual QList<QByteArray> availableProperties() const
47 {
48 return QList<QByteArray>();
49 }
39}; 50};
40 51
41class MemoryBufferAdaptor : public BufferAdaptor { 52class MemoryBufferAdaptor : public BufferAdaptor
53{
42public: 54public:
43 MemoryBufferAdaptor() 55 MemoryBufferAdaptor() : BufferAdaptor()
44 : BufferAdaptor()
45 { 56 {
46 } 57 }
47 58
48 MemoryBufferAdaptor(const BufferAdaptor &buffer, const QList<QByteArray> &properties) 59 MemoryBufferAdaptor(const BufferAdaptor &buffer, const QList<QByteArray> &properties) : BufferAdaptor()
49 : BufferAdaptor()
50 { 60 {
51 if (properties.isEmpty()) { 61 if (properties.isEmpty()) {
52 for(const auto &property : buffer.availableProperties()) { 62 for (const auto &property : buffer.availableProperties()) {
53 mValues.insert(property, buffer.getProperty(property)); 63 mValues.insert(property, buffer.getProperty(property));
54 } 64 }
55 } else { 65 } else {
56 for(const auto &property : properties) { 66 for (const auto &property : properties) {
57 mValues.insert(property, buffer.getProperty(property)); 67 mValues.insert(property, buffer.getProperty(property));
58 } 68 }
59 } 69 }
60 } 70 }
61 71
62 virtual ~MemoryBufferAdaptor() {} 72 virtual ~MemoryBufferAdaptor()
73 {
74 }
63 75
64 virtual QVariant getProperty(const QByteArray &key) const { return mValues.value(key); } 76 virtual QVariant getProperty(const QByteArray &key) const
65 virtual void setProperty(const QByteArray &key, const QVariant &value) { mValues.insert(key, value); } 77 {
66 virtual QByteArrayList availableProperties() const { return mValues.keys(); } 78 return mValues.value(key);
79 }
80 virtual void setProperty(const QByteArray &key, const QVariant &value)
81 {
82 mValues.insert(key, value);
83 }
84 virtual QByteArrayList availableProperties() const
85 {
86 return mValues.keys();
87 }
67 88
68private: 89private:
69 QHash<QByteArray, QVariant> mValues; 90 QHash<QByteArray, QVariant> mValues;
70}; 91};
71
72} 92}
73} 93}