/* * Copyright 2019 by its authors. See AUTHORS. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ELDBUS_CXX_ELDBUS_MESSAGE_ARGUMENTS_HH #define ELDBUS_CXX_ELDBUS_MESSAGE_ARGUMENTS_HH #include #include #include namespace efl { namespace eldbus { namespace _detail { template bool _init_raw_tuple(Eldbus_Message_Iter*, Tuple const&, std::true_type) { return true; } template bool _init_raw_tuple(Eldbus_Message_Iter* iterator, Tuple const& tuple, std::false_type) { typedef signature_traits::type> traits; typedef typename traits::value_type element_type; char* c = eldbus_message_iter_signature_get(iterator); if(c[0] != signature_traits::sig) { return false; } eldbus_message_iter_get_and_next(iterator, *c, &std::get(tuple)); return _init_raw_tuple (iterator, tuple, std::integral_constant::value)>()); } template bool _append_tuple(Eldbus_Message*, Tuple const&, std::true_type) { return true; } template bool _append_tuple(Eldbus_Message* message, Tuple const& tuple, std::false_type) { typedef signature_traits::type> traits; char signature[2] = {traits::sig, 0}; if(!eldbus_message_arguments_append(message, signature, traits::to_raw(std::get(tuple)))) return false; return _append_tuple (message, tuple, std::integral_constant::value)>()); } } } } #endif