X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdbus%2Fcodecs.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdbus%2Fcodecs.h;h=4a8459ed940943e80d91dde0dedad158454c5624;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/codecs.h b/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/codecs.h new file mode 100644 index 0000000..4a8459e --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/codecs.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 Simon Fels + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ + +#ifndef ANBOX_DBUS_CODECS_H_ +#define ANBOX_DBUS_CODECS_H_ + +#include "anbox/wm/stack.h" + +#include + +#include + +namespace core { +namespace dbus { +template<> +struct Codec { + inline static void encode_argument(Message::Writer &out, const anbox::wm::Stack::Id &stack) { + std::stringstream ss; + ss << stack; + auto s = ss.str(); + out.push_stringn(s.c_str(), s.length()); + } + + inline static void decode_argument(Message::Reader &in, anbox::wm::Stack::Id &stack) { + std::stringstream ss; + ss << in.pop_string(); + ss >> stack; + } +}; +} // namespace dbus +} // namespace core + +#endif