1// Copyright (c) Benjamin Kietzman (github.com/bkietz)
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef DBUS_IMPL_MESSAGE_ITERATOR_IPP
7#define DBUS_IMPL_MESSAGE_ITERATOR_IPP
8
9#include <dbus/impl/message_iterator.hpp>
10
11namespace dbus {
12namespace impl {
13
14inline void message_iterator::init_append(message& m, message_iterator& i)
15{
16  dbus_message_iter_init_append(m, &i.DBusMessageIter_);
17}
18inline bool message_iterator::append_basic(int code, const void *value)
19{
20  // returns false if not enough memory- throw bad_alloc
21  return dbus_message_iter_append_basic(&DBusMessageIter_, code, value);
22}
23inline bool message_iterator::open_container(int code, const char *signature, message_iterator& sub)
24{
25  // returns false if not enough memory- throw bad_alloc
26  return dbus_message_iter_open_container(&DBusMessageIter_, code, signature, &sub.DBusMessageIter_);
27}
28
29inline bool message_iterator::close_container(message_iterator& sub)
30{
31  // returns false if not enough memory- throw bad_alloc
32  return dbus_message_iter_close_container(&DBusMessageIter_, &sub.DBusMessageIter_);
33}
34
35inline void message_iterator::abandon_container(message_iterator& sub)
36{
37  dbus_message_iter_abandon_container(&DBusMessageIter_, &sub.DBusMessageIter_);
38}
39
40inline bool message_iterator::append_fixed_array(int code, const void *value, int n_elements)
41{
42  // returns false if not enough memory- throw bad_alloc
43  return dbus_message_iter_append_fixed_array(&DBusMessageIter_, code, value, n_elements);
44}
45
46inline bool message_iterator::init(message& m, message_iterator& i)
47{
48  return dbus_message_iter_init(m, &i.DBusMessageIter_);
49}
50
51inline bool message_iterator::next()
52{
53  return dbus_message_iter_next(&DBusMessageIter_);
54}
55
56inline bool message_iterator::has_next()
57{
58  return dbus_message_iter_has_next(&DBusMessageIter_);
59}
60
61inline int message_iterator::get_element_count()
62{
63  return dbus_message_iter_get_element_count(&DBusMessageIter_);
64}
65
66inline char message_iterator::get_arg_type()
67{
68  return dbus_message_iter_get_arg_type(&DBusMessageIter_);
69}
70
71inline void message_iterator::get_basic(void *value)
72{
73  dbus_message_iter_get_basic(&DBusMessageIter_, value);
74}
75
76inline void message_iterator::recurse(message_iterator& sub)
77{
78  dbus_message_iter_recurse(&DBusMessageIter_, &sub.DBusMessageIter_);
79}
80
81inline int message_iterator::get_element_type()
82{
83  return dbus_message_iter_get_element_type(&DBusMessageIter_);
84}
85
86inline void message_iterator::get_fixed_array(void *value, int *n_elements)
87{
88  dbus_message_iter_get_fixed_array(&DBusMessageIter_, value, n_elements);
89}
90
91} // namespace impl
92} // namespace dbus
93
94#endif // DBUS_IMPL_MESSAGE_ITERATOR_IPP
95