X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftest-trace-call-stack.h;h=8cb592286daf04b2b02c7f67d44d8aa182475755;hb=528aa3699cd51dab5115bca1aaebb65d4bc67c15;hp=e1882ea0ee44b399ecbbe6ca23bc7f3d83c59d48;hpb=b81c20064def5a5017e77876effd01ddc5bb39d6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h index e1882ea..8cb5922 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.h @@ -2,7 +2,7 @@ #define TEST_TRACE_CALL_STACK_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,19 @@ * */ -#include -#include #include #include +#include +#include namespace Dali { +template +std::string ToString(const T& x) +{ + return "undefined"; +} + std::string ToString(int x); std::string ToString(unsigned int x); std::string ToString(float x); @@ -35,9 +41,8 @@ std::string ToString(float x); class TraceCallStack { public: - /// Typedef for passing and storing named parameters - typedef std::map< std::string, std::string > NamedParams; + typedef std::map NamedParams; /** * Constructor @@ -79,6 +84,14 @@ public: bool FindMethod(std::string method) const; /** + * Search for a method in the stack and return its parameters if found + * @param[in] method The name of the method + * @param[out] params of the method + * @return true if the method was in the stack + */ + bool FindMethodAndGetParameters(std::string method, std::string& params) const; + + /** * Count how many times a method was called * @param[in] method The name of the method * @return The number of times it was called @@ -112,7 +125,7 @@ public: * calls can search for methods occuring after this one. * @return True if the method was in the stack */ - bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const; + bool FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const; /** * Search for a method in the stack with the given parameter list @@ -150,10 +163,10 @@ public: std::string GetTraceString() { std::stringstream traceStream; - int functionCount = mCallStack.size(); - for( int i = 0; i < functionCount; ++i ) + std::size_t functionCount = mCallStack.size(); + for(std::size_t i = 0; i < functionCount; ++i) { - Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ]; + Dali::TraceCallStack::FunctionCall functionCall = mCallStack[i]; traceStream << "StackTrace: Index:" << i << ", Function:" << functionCall.method << ", ParamList:" << functionCall.paramList << std::endl; } @@ -168,19 +181,22 @@ private: std::string method; std::string paramList; NamedParams namedParams; - FunctionCall( const std::string& aMethod, const std::string& aParamList ) - : method( aMethod ), paramList( aParamList ) + FunctionCall(const std::string& aMethod, const std::string& aParamList) + : method(aMethod), + paramList(aParamList) { } - FunctionCall( const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams ) - : method( aMethod ), paramList( aParamList ), namedParams( altParams ) + FunctionCall(const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams) + : method(aMethod), + paramList(aParamList), + namedParams(altParams) { } }; - std::vector< FunctionCall > mCallStack; ///< The call stack + std::vector mCallStack; ///< The call stack }; -} // namespace dali +} // namespace Dali #endif // TEST_TRACE_CALL_STACK_H