1//===-- SBProcessInfoList.cpp ---------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/API/SBProcessInfoList.h"
10#include "lldb/API/SBProcessInfo.h"
11#include "lldb/Utility/Instrumentation.h"
12#include "lldb/Utility/ProcessInfo.h"
13
14#include "Utils.h"
15
16using namespace lldb;
17using namespace lldb_private;
18
19SBProcessInfoList::SBProcessInfoList() = default;
20
21SBProcessInfoList::~SBProcessInfoList() = default;
22
23SBProcessInfoList::SBProcessInfoList(const ProcessInfoList &impl)
24 : m_opaque_up(std::make_unique<ProcessInfoList>(args: impl)) {
25 LLDB_INSTRUMENT_VA(this, impl);
26}
27
28SBProcessInfoList::SBProcessInfoList(const lldb::SBProcessInfoList &rhs) {
29
30 LLDB_INSTRUMENT_VA(this, rhs);
31
32 m_opaque_up = clone(src: rhs.m_opaque_up);
33}
34
35const lldb::SBProcessInfoList &
36SBProcessInfoList::operator=(const lldb::SBProcessInfoList &rhs) {
37
38 LLDB_INSTRUMENT_VA(this, rhs);
39
40 if (this != &rhs)
41 m_opaque_up = clone(src: rhs.m_opaque_up);
42 return *this;
43}
44
45uint32_t SBProcessInfoList::GetSize() const {
46 LLDB_INSTRUMENT_VA(this);
47
48 if (m_opaque_up)
49 return m_opaque_up->GetSize();
50
51 return 0;
52}
53
54void SBProcessInfoList::Clear() {
55 LLDB_INSTRUMENT_VA(this);
56
57 if (m_opaque_up)
58 m_opaque_up->Clear();
59}
60
61bool SBProcessInfoList::GetProcessInfoAtIndex(uint32_t idx,
62 SBProcessInfo &info) {
63 LLDB_INSTRUMENT_VA(this, idx, info);
64
65 if (m_opaque_up) {
66 lldb_private::ProcessInstanceInfo process_instance_info;
67 if (m_opaque_up->GetProcessInfoAtIndex(idx, info&: process_instance_info)) {
68 info.SetProcessInfo(process_instance_info);
69 return true;
70 }
71 }
72
73 return false;
74}
75

source code of lldb/source/API/SBProcessInfoList.cpp