BuildRequires: pkgconfig(deviced)
BuildRequires: pkgconfig(capi-system-runtime-info)
BuildRequires: pkgconfig(cert-svc)
+BuildRequires: pkgconfig(uuid)
BuildRequires: boost-devel
%if %{with x}
BuildRequires: pkgconfig(ecore-x)
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+PKG_CHECK_MODULES(TARGET_COMMON_STATIC_DEPS
+ uuid
+ dlog
+ REQUIRED
+)
+
SET(TARGET_COMMON_STATIC_INCS
${BASE_SRCDIR}
+ ${TARGET_COMMON_STATIC_DEPS_INCLUDE_DIRS}
)
SET(TARGET_COMMON_STATIC_SRCS
${BASE_SRCDIR}/common/file_utils.cc
${BASE_SRCDIR}/common/message_types.cc
+ ${BASE_SRCDIR}/common/string_utils.cc
${BASE_SRCDIR}/common/command_line.cc
)
INCLUDE_DIRECTORIES(${TARGET_COMMON_STATIC_INCS})
ADD_LIBRARY(${TARGET_COMMON_STATIC} STATIC
${TARGET_COMMON_STATIC_SRCS}
-)
\ No newline at end of file
+)
--- /dev/null
+// Copyright 2015 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "common/string_utils.h"
+
+#include <uuid/uuid.h>
+#include <string>
+#include <algorithm>
+
+namespace wrt {
+namespace utils {
+
+std::string GenerateUUID() {
+ char tmp[37];
+ uuid_t uuid;
+ uuid_generate(uuid);
+ uuid_unparse(uuid, tmp);
+ return std::string(tmp);
+}
+
+bool StartsWith(const std::string& str, const std::string& sub) {
+ if (sub.size() > str.size()) return false;
+ return std::equal(sub.begin(), sub.end(), str.begin());
+}
+
+bool EndsWith(const std::string& str, const std::string& sub) {
+ if (sub.size() > str.size()) return false;
+ return std::equal(sub.rbegin(), sub.rend(), str.rbegin());
+}
+
+} // namespace utils
+} // namespace wrt
--- /dev/null
+// Copyright 2015 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WRT_COMMON_STRING_UTILS_H_
+#define WRT_COMMON_STRING_UTILS_H_
+
+#include <string>
+
+namespace wrt {
+namespace utils {
+
+std::string GenerateUUID();
+bool StartsWith(const std::string& str, const std::string& sub);
+bool EndsWith(const std::string& str, const std::string& sub);
+
+} // namespace utils
+} // namespace wrt
+
+#endif // WRT_COMMON_STRING_UTILS_H_
ENDIF(WAYLAND_SUPPORT)
PKG_CHECK_MODULES(TARGET_RUNTIME_DEPS
+ uuid
appsvc
bundle
dlog