1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef SRC_TRACE_BASE_STRINGHELP_H 16 #define SRC_TRACE_BASE_STRINGHELP_H 17 18 #include <cstdint> 19 #include <cxxabi.h> 20 #include <sys/types.h> 21 #include <string> 22 #include <vector> 23 #if !is_mingw 24 int32_t memcpy_s(void* dest, uint32_t destSize, const void* src, size_t srcSize); 25 int32_t sscanf_s(const char* buffer, const char* format, ...); 26 int32_t strncpy_s(char* strDest, size_t destMax, const char* strSrc, size_t count); 27 int32_t sprintf_s(char* strDest, size_t destMax, const char* format, ...); 28 #endif 29 void* memset_s(void* dest, size_t destSize, int32_t ch, size_t n); 30 int32_t snprintf_s(char* strDest, size_t destMax, size_t count, const char* format, ...); 31 const char* GetDemangleSymbolIndex(const char* mangled); 32 int GetProcessorNumFromString(char* str); 33 std::vector<std::string> SplitStringToVec(const std::string& str, const std::string& pat); 34 bool StartWith(const std::string& str, const std::string& res); 35 bool EndWith(const std::string& str, const std::string& res); 36 37 #endif // SRC_TRACE_BASE_STRINGHELP_H 38