1 /* 2 * Copyright (c) 2021-2022 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 DFX_FRAME_FORMATTER_H 16 #define DFX_FRAME_FORMATTER_H 17 18 #include <memory> 19 #include <string> 20 #include <vector> 21 #include "dfx_frame.h" 22 23 namespace OHOS { 24 namespace HiviewDFX { 25 class DfxFrameFormatter { 26 public: 27 DfxFrameFormatter() = default; 28 29 /** 30 * @brief Get the Frame Str object 31 * 32 * @param frame native frame object 33 * @return std::string native frame string 34 */ 35 static std::string GetFrameStr(const DfxFrame& frame); 36 37 /** 38 * @brief Get the Frame Str object 39 * 40 * @param frame native frame pointer object 41 * @return std::string native frame string 42 */ 43 static std::string GetFrameStr(const std::shared_ptr<DfxFrame>& frame); 44 45 /** 46 * @brief Get the Frames Str object 47 * 48 * @param frames native frame object list 49 * @return std::string native frames string 50 */ 51 static std::string GetFramesStr(const std::vector<DfxFrame>& frames); 52 }; 53 } // namespace HiviewDFX 54 } // namespace OHOS 55 #endif 56