forked from martinhaefner/simppl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2330b5
commit 4764f5c
Showing
40 changed files
with
808 additions
and
1,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,60 @@ | ||
|
||
|
||
|
||
inline | ||
Serializer& write(bool b) | ||
#ifndef __SIMPPL_DBUS_BOOL_H__ | ||
#define __SIMPPL_DBUS_BOOL_H__ | ||
|
||
|
||
#include "simppl/serialization.h" | ||
|
||
|
||
namespace simppl | ||
{ | ||
|
||
namespace dbus | ||
{ | ||
|
||
|
||
// forward decl | ||
template<typename T> | ||
struct Codec; | ||
|
||
|
||
template<> | ||
struct Codec<bool> | ||
{ | ||
// FIXME can this be removed? | ||
enum { dbus_type_code = DBUS_TYPE_BOOLEAN }; | ||
|
||
|
||
static inline | ||
void encode(DBusMessageIter& iter, bool b) | ||
{ | ||
dbus_bool_t _b = b; | ||
dbus_message_iter_append_basic(iter_, dbus_type_code<bool>::value, &_b); | ||
return *this; | ||
dbus_message_iter_append_basic(&iter, dbus_type_code, &_b); | ||
} | ||
|
||
|
||
|
||
Deserializer& read(bool& t) | ||
// FIXME move to impl file | ||
static inline | ||
void decode(DBusMessageIter& iter, bool& t) | ||
{ | ||
dbus_bool_t b; | ||
dbus_message_iter_get_basic(iter_, &b); | ||
dbus_message_iter_next(iter_); | ||
dbus_message_iter_get_basic(&iter, &b); | ||
dbus_message_iter_next(&iter); | ||
|
||
t = b; | ||
return *this; | ||
} | ||
|
||
|
||
static inline | ||
std::ostream& make_type_signature(std::ostream& os) | ||
{ | ||
return os << DBUS_TYPE_BOOLEAN_AS_STRING; | ||
} | ||
}; | ||
|
||
|
||
} // namespace dbus | ||
|
||
} // namespace simppl | ||
|
||
|
||
template<> struct dbus_type_code<bool> { enum { value = DBUS_TYPE_BOOLEAN }; }; | ||
#endif // __SIMPPL_DBUS_BOOL_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.