X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fandroid%2Fintent.cpp;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fandroid%2Fintent.cpp;h=1b7b0e3effcbf54a2e3611460e8695e4b2076140;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/android/intent.cpp b/src/type3_AndroidCloud/anbox-master/src/anbox/android/intent.cpp new file mode 100644 index 0000000..1b7b0e3 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/android/intent.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + */ + +#include "anbox/android/intent.h" + +#include + +namespace anbox { +namespace android { +bool Intent::valid() const { + // At the moment we only support component+package for intents + // (see android/service/android_api_skeleton.cpp for more details) + return !(component.empty() && package.empty()); +} + +std::ostream &operator<<(std::ostream &out, const Intent &intent) { + out << "["; + if (!intent.action.empty()) + out << " " << "action=" << intent.action << " "; + if (!intent.uri.empty()) + out << " " << "uri=" << intent.uri << " "; + if (!intent.type.empty()) + out << " " << "type=" << intent.type << " "; + if (intent.flags > 0) + out << " " << "flags=" << intent.flags << " "; + if (!intent.package.empty()) + out << " " << "package=" << intent.package << " "; + if (!intent.component.empty()) + out << "component=" << intent.component << " "; + if (intent.categories.size() > 0) { + out << "categories=[ "; + for (const auto &category : intent.categories) out << category << " "; + out << "] "; + } + out << "]"; + return out; +} +} // namespace android +} // namespace anbox