From: Bartlomiej Grzelewski Date: Wed, 1 Jul 2015 14:02:45 +0000 (+0200) Subject: Update implementation of Stringify. X-Git-Tag: accepted/tizen/mobile/20150804.235652~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fsecurity%2Fkey-manager.git;a=commitdiff_plain;h=f459c3382caf8fff147c5ca9623c09432a21f530 Update implementation of Stringify. Change-Id: Id237fe33a435be9ab7b28ad223e00bca23a95fc9 --- diff --git a/src/manager/common/exception.h b/src/manager/common/exception.h index c174085..de4123a 100644 --- a/src/manager/common/exception.h +++ b/src/manager/common/exception.h @@ -78,7 +78,7 @@ class COMMON_API DefineException : public Exception { public: template DefineException(const char *path, const char *function, int line, const Args&... args) - : Exception(path, function, line, Stringify()(args...)) + : Exception(path, function, line, Stringify::Merge(args...)) { Before(m_path, m_function, m_line, DefineException::error(), m_message); } diff --git a/src/manager/common/stringify.h b/src/manager/common/stringify.h index d989f44..fbe2245 100644 --- a/src/manager/common/stringify.h +++ b/src/manager/common/stringify.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,35 +31,38 @@ class StringifyBasic; template <> class StringifyBasic { + StringifyBasic() = delete; public: - std::string operator()() { + static std::string Merge() { return std::string(); } template - std::string operator()(const Args&...){ + static std::string Merge(const Args&...){ return std::string(); } }; template <> class StringifyBasic { - void concatenate(std::ostringstream&) {} + StringifyBasic() = delete; + + static void Concatenate(std::ostringstream&) {} template - void concatenate(std::ostringstream& stream, const t& arg1, const Args&... args) { + static void Concatenate(std::ostringstream& stream, const t& arg1, const Args&... args) { stream << arg1; - concatenate(stream, args...); + Concatenate(stream, args...); } public: - std::string operator()() { + static std::string Merge() { return std::string(); } template - std::string operator()(const T& arg1, const Args&... args){ + static std::string Merge(const T& arg1, const Args&... args) { std::ostringstream stream; - concatenate(stream, arg1, args...); + Concatenate(stream, arg1, args...); return stream.str(); } }; diff --git a/src/manager/service/file-lock.cpp b/src/manager/service/file-lock.cpp index 41ce574..3bc6e38 100644 --- a/src/manager/service/file-lock.cpp +++ b/src/manager/service/file-lock.cpp @@ -41,7 +41,7 @@ namespace { template std::runtime_error io_exception(const Args&... args) { - return std::runtime_error(Stringify()(args...)); + return std::runtime_error(Stringify::Merge(args...)); }; } // namespace anonymous