From 2af2c45e7a0dc11335891d1ce923ef03253466ba Mon Sep 17 00:00:00 2001 From: fancy <258828110.@qq.com> Date: Sat, 11 Nov 2023 19:32:49 -0800 Subject: [PATCH] Remove files. --- utils/ReturnCode/CMakeLists.txt | 24 ------------ utils/ReturnCode/include/ReturnCode.h | 32 --------------- utils/ReturnCode/include/VReturnCode.h | 54 -------------------------- utils/ReturnCode/src/ReturnCode.c | 35 ----------------- utils/ReturnCode/src/VReturnCode.cpp | 44 --------------------- 5 files changed, 189 deletions(-) delete mode 100644 utils/ReturnCode/CMakeLists.txt delete mode 100644 utils/ReturnCode/include/ReturnCode.h delete mode 100644 utils/ReturnCode/include/VReturnCode.h delete mode 100644 utils/ReturnCode/src/ReturnCode.c delete mode 100644 utils/ReturnCode/src/VReturnCode.cpp diff --git a/utils/ReturnCode/CMakeLists.txt b/utils/ReturnCode/CMakeLists.txt deleted file mode 100644 index 28cc6129..00000000 --- a/utils/ReturnCode/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ - -include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake) -set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH}) -set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH}) - -include_directories( - ./src - ./include - ${UTILS_SOURCE_PATH}/ReturnCode/include - ${UTILS_SOURCE_PATH}/Log/include -) -#do not rely on any other library -#link_directories( -#) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -aux_source_directory(./src SRC_FILES) - -set(TARGET_NAME ReturnCode) -add_library(${TARGET_NAME} STATIC ${SRC_FILES}) -target_link_libraries(${TARGET_NAME} Log) - diff --git a/utils/ReturnCode/include/ReturnCode.h b/utils/ReturnCode/include/ReturnCode.h deleted file mode 100644 index 7f54183e..00000000 --- a/utils/ReturnCode/include/ReturnCode.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef RETURN_CODE_H -#define RETURN_CODE_H -/* -** Make sure we can call this stuff from C++. -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - enum C_RETURN_CODE - { - C_RETURN_CODE_OK = 0, - C_RETURN_CODE_NOT_OK, - C_RETURN_CODE_VIRTUAL_FUNCTION, - C_RETURN_CODE_INVALID_PARAMENTER, - C_RETURN_CODE_END - }; - typedef struct returnCodeC RETURN_CODE_C; - typedef struct returnCodeC - { - const char *(*printStringCode)(const RETURN_CODE_C); - const long int mCode; - } RETURN_CODE_C; - const RETURN_CODE_C CreateReturnCode(const long int code); - static inline const char *GetStringCode(const RETURN_CODE_C code) - { - return 0; - } -#ifdef __cplusplus -} -#endif -#endif \ No newline at end of file diff --git a/utils/ReturnCode/include/VReturnCode.h b/utils/ReturnCode/include/VReturnCode.h deleted file mode 100644 index 91786745..00000000 --- a/utils/ReturnCode/include/VReturnCode.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef V_RETURN_CODE_H -#define V_RETURN_CODE_H -#include -#include -/** - * @brief - * The base return code. - * Attention: VReturnCOdeDefineStr must be added one item when define one new code. - */ -enum class VReturnCodeDefine -{ - OK = 0, - NOT_OK_UNDEFINE_REASON, - NOT_OK_VIRTUAL_FUNCTION, - MAKE_SHARED_PTR_FAILED, - END -}; -class VReturnCode -{ -protected: - VReturnCode(const int &code) : mCode(code) - { - } - -public: - virtual ~VReturnCode() = default; - virtual const int GetIntCode() { return mCode; } - bool IsCodeOK(); - /** - * @brief - * Print the code translate into a readable string. - * @return int - */ - virtual std::string PrintStringCode(); - void SetTips(const std::string &tips) { mTips = tips; } - const std::string &GetTips() { return mTips; } - /** - * @brief - * Create a new return code, which is the only way to create a code shared ptr. - * @param code - * @return std::make_shared - */ - static std::shared_ptr NewCode(const VReturnCodeDefine &code); - -private: - const int mCode; // Can't be reset. - std::string mTips; // Give some tips for return code, such as the not OK detail. -}; -/** - * @brief - * Define the VReturnCode as shared ptr, which other modules can redefine VReturnCode. - */ -using RETURN_CODE = std::shared_ptr; -#endif \ No newline at end of file diff --git a/utils/ReturnCode/src/ReturnCode.c b/utils/ReturnCode/src/ReturnCode.c deleted file mode 100644 index dba1442b..00000000 --- a/utils/ReturnCode/src/ReturnCode.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "ReturnCode.h" -#include "Log.h" -#include -static const char *RETRUN_CODE_STRING[C_RETURN_CODE_END + 1]={ - "C_RETURN_CODE_OK", - "C_RETURN_CODE_NOT_OK", - "C_RETURN_CODE_INVALID_PARAMENTER", - "C_RETURN_CODE_END" -}; -static const char *PrintStringCode(const RETURN_CODE_C this) -{ - if (C_RETURN_CODE_OK <= this.mCode && this.mCode <= C_RETURN_CODE_END) - { - LogInfo("Return code = [ %s ]\n", RETRUN_CODE_STRING[this.mCode]); - return RETRUN_CODE_STRING[this.mCode]; - } - LogError("Return code = [ %s ]\n", RETRUN_CODE_STRING[C_RETURN_CODE_INVALID_PARAMENTER]); - return RETRUN_CODE_STRING[C_RETURN_CODE_INVALID_PARAMENTER]; -} -const RETURN_CODE_C CreateReturnCode(const long int code) -{ - if (C_RETURN_CODE_OK <= code && code <= C_RETURN_CODE_END) - { - RETURN_CODE_C result = {NULL, code}; - result.printStringCode = PrintStringCode; - return result; - } - else - { - LogError("undefined code.\n"); - RETURN_CODE_C result = {NULL, C_RETURN_CODE_INVALID_PARAMENTER}; - result.printStringCode = PrintStringCode; - return result; - } -} \ No newline at end of file diff --git a/utils/ReturnCode/src/VReturnCode.cpp b/utils/ReturnCode/src/VReturnCode.cpp deleted file mode 100644 index bf687cb8..00000000 --- a/utils/ReturnCode/src/VReturnCode.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "VReturnCode.h" -#include "Log.h" -const std::string VReturnCOdeDefineStr[static_cast(VReturnCodeDefine::END) + 1] = { - "OK", - "NOT_OK_UNDEFINE_REASON, undefine reason", - "NOT_OK_VIRTUAL_FUNCTION, do nothing function", - "MAKE_SHARED_PTR_FAILED, std::make_shared failed", - "END"}; -std::shared_ptr VReturnCode::NewCode(const VReturnCodeDefine &code) -{ - // return std::make_shared(static_cast(code)); - class MakeShared : public VReturnCode - { - public: - MakeShared(const int &code) : VReturnCode(code) {} - }; - return std::make_shared(static_cast(code)); -} -bool VReturnCode::IsCodeOK() -{ - bool result = mCode == static_cast(VReturnCodeDefine::OK) ? true : false; - // if (!result) - // { - // PrintStringCode(); // Don't print code when run ok. - // } - return result; -} -std::string VReturnCode::PrintStringCode() -{ - if (mCode < static_cast(VReturnCodeDefine::OK) || mCode > static_cast(VReturnCodeDefine::END)) - { - LogError("Illegal code, cross the border.\n"); - return "Illegal code."; - } - if (mCode > static_cast(VReturnCodeDefine::OK)) - { - LogError("Return code:[ %s ]\n", VReturnCOdeDefineStr[mCode].c_str()); - } - else - { - LogInfo("Return code:[ %s %s]\n", VReturnCOdeDefineStr[mCode].c_str(), GetTips().c_str()); - } - return VReturnCOdeDefineStr[mCode]; -} \ No newline at end of file