Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:42

0001 //===-- SBStructuredData.h --------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_API_SBSTRUCTUREDDATA_H
0010 #define LLDB_API_SBSTRUCTUREDDATA_H
0011 
0012 #include "lldb/API/SBCommandReturnObject.h"
0013 #include "lldb/API/SBDefines.h"
0014 #include "lldb/API/SBModule.h"
0015 #include "lldb/API/SBScriptObject.h"
0016 
0017 namespace lldb_private {
0018 namespace python {
0019 class SWIGBridge;
0020 }
0021 namespace lua {
0022 class SWIGBridge;
0023 }
0024 } // namespace lldb_private
0025 
0026 namespace lldb {
0027 
0028 class SBStructuredData {
0029 public:
0030   SBStructuredData();
0031 
0032   SBStructuredData(const lldb::SBStructuredData &rhs);
0033 
0034   SBStructuredData(const lldb::SBScriptObject obj,
0035                    const lldb::SBDebugger &debugger);
0036 
0037   ~SBStructuredData();
0038 
0039   lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
0040 
0041   explicit operator bool() const;
0042 
0043   bool IsValid() const;
0044 
0045   lldb::SBError SetFromJSON(lldb::SBStream &stream);
0046 
0047   lldb::SBError SetFromJSON(const char *json);
0048 
0049   void Clear();
0050 
0051   lldb::SBError GetAsJSON(lldb::SBStream &stream) const;
0052 
0053   lldb::SBError GetDescription(lldb::SBStream &stream) const;
0054 
0055   /// Return the type of data in this data structure
0056   lldb::StructuredDataType GetType() const;
0057 
0058   /// Return the size (i.e. number of elements) in this data structure
0059   /// if it is an array or dictionary type. For other types, 0 will be
0060   //  returned.
0061   size_t GetSize() const;
0062 
0063   /// Fill keys with the keys in this object and return true if this data
0064   /// structure is a dictionary.  Returns false otherwise.
0065   bool GetKeys(lldb::SBStringList &keys) const;
0066 
0067   /// Return the value corresponding to a key if this data structure
0068   /// is a dictionary type.
0069   lldb::SBStructuredData GetValueForKey(const char *key) const;
0070 
0071   /// Return the value corresponding to an index if this data structure
0072   /// is array.
0073   lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
0074 
0075   /// Return the integer value if this data structure is an integer type.
0076   uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0) const;
0077   /// Return the integer value if this data structure is an integer type.
0078   int64_t GetSignedIntegerValue(int64_t fail_value = 0) const;
0079 
0080   LLDB_DEPRECATED_FIXME(
0081       "Specify if the value is signed or unsigned",
0082       "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
0083   uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
0084 
0085   /// Return the floating point value if this data structure is a floating
0086   /// type.
0087   double GetFloatValue(double fail_value = 0.0) const;
0088 
0089   /// Return the boolean value if this data structure is a boolean type.
0090   bool GetBooleanValue(bool fail_value = false) const;
0091 
0092   /// Provides the string value if this data structure is a string type.
0093   ///
0094   /// \param[out] dst
0095   ///     pointer where the string value will be written. In case it is null,
0096   ///     nothing will be written at \a dst.
0097   ///
0098   /// \param[in] dst_len
0099   ///     max number of characters that can be written at \a dst. In case it is
0100   ///     zero, nothing will be written at \a dst. If this length is not enough
0101   ///     to write the complete string value, (\a dst_len - 1) bytes of the
0102   ///     string value will be written at \a dst followed by a null character.
0103   ///
0104   /// \return
0105   ///     Returns the byte size needed to completely write the string value at
0106   ///     \a dst in all cases.
0107   size_t GetStringValue(char *dst, size_t dst_len) const;
0108 
0109   /// Return the generic pointer if this data structure is a generic type.
0110   lldb::SBScriptObject GetGenericValue() const;
0111 
0112 protected:
0113   friend class SBAttachInfo;
0114   friend class SBCommandReturnObject;
0115   friend class SBLaunchInfo;
0116   friend class SBDebugger;
0117   friend class SBFrame;
0118   friend class SBError;
0119   friend class SBTarget;
0120   friend class SBProcess;
0121   friend class SBThread;
0122   friend class SBThreadPlan;
0123   friend class SBBreakpoint;
0124   friend class SBBreakpointLocation;
0125   friend class SBBreakpointName;
0126   friend class SBTrace;
0127   friend class lldb_private::python::SWIGBridge;
0128   friend class lldb_private::lua::SWIGBridge;
0129   friend class SBCommandInterpreter;
0130 
0131   SBStructuredData(const lldb_private::StructuredDataImpl &impl);
0132 
0133   SBStructuredData(const lldb::EventSP &event_sp);
0134 
0135   StructuredDataImplUP m_impl_up;
0136 };
0137 } // namespace lldb
0138 
0139 #endif // LLDB_API_SBSTRUCTUREDDATA_H