1254721Semaste//===-- BreakpointIDList.h --------------------------------------*- C++ -*-===//
2254721Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6254721Semaste//
7254721Semaste//===----------------------------------------------------------------------===//
8254721Semaste
9254721Semaste#ifndef liblldb_BreakpointIDList_h_
10254721Semaste#define liblldb_BreakpointIDList_h_
11254721Semaste
12314564Sdim#include <utility>
13254721Semaste#include <vector>
14254721Semaste
15254721Semaste
16327952Sdim#include "lldb/lldb-enumerations.h"
17314564Sdim#include "lldb/Breakpoint/BreakpointID.h"
18327952Sdim#include "lldb/Breakpoint/BreakpointName.h"
19254721Semaste#include "lldb/lldb-private.h"
20254721Semaste
21254721Semastenamespace lldb_private {
22254721Semaste
23254721Semaste// class BreakpointIDList
24254721Semaste
25314564Sdimclass BreakpointIDList {
26254721Semastepublic:
27314564Sdim  // TODO: Convert this class to StringRef.
28314564Sdim  typedef std::vector<BreakpointID> BreakpointIDArray;
29254721Semaste
30314564Sdim  BreakpointIDList();
31254721Semaste
32314564Sdim  virtual ~BreakpointIDList();
33254721Semaste
34314564Sdim  size_t GetSize() const;
35254721Semaste
36314564Sdim  const BreakpointID &GetBreakpointIDAtIndex(size_t index) const;
37254721Semaste
38314564Sdim  bool RemoveBreakpointIDAtIndex(size_t index);
39254721Semaste
40314564Sdim  void Clear();
41254721Semaste
42314564Sdim  bool AddBreakpointID(BreakpointID bp_id);
43254721Semaste
44314564Sdim  bool AddBreakpointID(const char *bp_id);
45254721Semaste
46314564Sdim  // TODO: This should take a const BreakpointID.
47314564Sdim  bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const;
48254721Semaste
49314564Sdim  bool FindBreakpointID(const char *bp_id, size_t *position) const;
50254721Semaste
51341825Sdim  void InsertStringArray(llvm::ArrayRef<const char *> string_array,
52314564Sdim                         CommandReturnObject &result);
53254721Semaste
54314564Sdim  // Returns a pair consisting of the beginning and end of a breakpoint
55314564Sdim  // ID range expression.  If the input string is not a valid specification,
56314564Sdim  // returns an empty pair.
57314564Sdim  static std::pair<llvm::StringRef, llvm::StringRef>
58314564Sdim  SplitIDRangeExpression(llvm::StringRef in_string);
59254721Semaste
60314564Sdim  static void FindAndReplaceIDRanges(Args &old_args, Target *target,
61314564Sdim                                     bool allow_locations,
62327952Sdim                                     BreakpointName::Permissions
63327952Sdim                                       ::PermissionKinds purpose,
64314564Sdim                                     CommandReturnObject &result,
65314564Sdim                                     Args &new_args);
66254721Semaste
67254721Semasteprivate:
68314564Sdim  BreakpointIDArray m_breakpoint_ids;
69314564Sdim  BreakpointID m_invalid_id;
70254721Semaste
71314564Sdim  DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
72254721Semaste};
73254721Semaste
74254721Semaste} // namespace lldb_private
75254721Semaste
76314564Sdim#endif // liblldb_BreakpointIDList_h_
77