1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
15 inline std::vector<std::string>& split(const std::string& s, char delim, std::vector<std::string>& elems) {
16 std::istringstream ss(s);
18 while (std::getline(ss, item, delim)) {
19 elems.push_back(item);
24 inline std::vector<std::string> split(const std::string& s, char delim) {
25 std::vector<std::string> elems;
26 return split(s, delim, elems);
29 inline void findFallbackInstanceIdMapping(const std::string& instanceId,
30 std::string& connectionName,
31 std::string& objectPath) {
32 connectionName = instanceId;
33 objectPath = '/' + instanceId;
34 std::replace(objectPath.begin(), objectPath.end(), '.', '/');
37 inline std::string findCommonAPIAddressForDBusAddress(const std::string& conName,
38 const std::string& objName,
39 const std::string& intName) {
41 return "local:" + intName + ":" + conName;
44 inline std::string findFallbackInstanceIdMapping(const std::string& connectionName, const std::string& objectPath) {
45 return connectionName;
48 template<typename _FutureWaitType>
49 inline bool checkReady(_FutureWaitType&);
52 inline bool checkReady<bool>(bool& returnedValue) {
57 inline bool checkReady<std::future_status>(std::future_status& returnedValue) {
58 return returnedValue == std::future_status::ready;
64 #endif /* DBUSUTILS_H_ */