1 /* 2 * Copyright (c) 2023 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 ECMASCRIPT_TOOLING_CLIENT_MANAGER_BREAKPOINT_MANAGER_H 16 #define ECMASCRIPT_TOOLING_CLIENT_MANAGER_BREAKPOINT_MANAGER_H 17 18 #include <functional> 19 #include <iostream> 20 #include <map> 21 #include <memory> 22 #include <string> 23 #include <vector> 24 25 #include "tooling/base/pt_json.h" 26 #include "tooling/base/pt_types.h" 27 28 namespace OHOS::ArkCompiler::Toolchain { 29 using PtJson = panda::ecmascript::tooling::PtJson; 30 using Result = panda::ecmascript::tooling::Result; 31 struct Breaklocation { 32 std::string breakpointId; 33 std::string url; 34 std::string lineNumber; 35 std::string columnNumber; 36 }; 37 class BreakPointManager { 38 public: BreakPointManager(int32_t sessionId)39 BreakPointManager(int32_t sessionId) : sessionId_(sessionId) {} 40 41 void Createbreaklocation(const std::unique_ptr<PtJson> json); 42 void Show(); 43 void Deletebreaklist(unsigned int num); 44 std::vector<Breaklocation> Getbreaklist() const; 45 46 private: 47 [[maybe_unused]] int32_t sessionId_; 48 std::vector<Breaklocation> breaklist_ {}; 49 BreakPointManager(const BreakPointManager&) = delete; 50 BreakPointManager& operator=(const BreakPointManager&) = delete; 51 }; 52 } 53 #endif