10#define LLDB_HOST_XML_H
12#include "lldb/Host/Config.h"
14#if LLDB_ENABLE_LIBXML2
15#include <libxml/xmlreader.h>
22#include "llvm/ADT/StringRef.h"
30#if LLDB_ENABLE_LIBXML2
42typedef std::function<bool(
const llvm::StringRef &name,
43 const llvm::StringRef &value)>
54 explicit operator bool()
const {
return IsValid(); }
62 llvm::StringRef
GetName()
const;
71 bool NameIs(
const char *name)
const;
80 const char *fail_value =
nullptr)
const;
83 uint64_t fail_value = 0,
int base = 0)
const;
119 explicit operator bool()
const {
return IsValid(); }
127 bool ParseMemory(
const char *xml,
size_t xml_length,
128 const char *url =
"untitled.xml");
136 static void ErrorCallback(
void *ctx,
const char *format, ...);
157 explicit operator bool()
const {
return IsValid(); }
static bool ExtractStringFromValueNode(const XMLNode &node, std::string &value)
XMLNode GetValueNode(const char *key) const
bool GetValueAsString(const char *key, std::string &value) const
bool ParseFile(const char *path)
StructuredData::ObjectSP GetStructuredData()
llvm::StringRef GetErrors() const
std::shared_ptr< Object > ObjectSP
bool ParseFile(const char *path)
llvm::StringRef GetErrors() const
XMLNode GetRootElement(const char *required_name=nullptr)
bool ParseMemory(const char *xml, size_t xml_length, const char *url="untitled.xml")
static void ErrorCallback(void *ctx, const char *format,...)
XMLDocumentImpl m_document
void ForEachChildElement(NodeCallback const &callback) const
llvm::StringRef GetName() const
void ForEachChildNode(NodeCallback const &callback) const
XMLNode GetParent() const
XMLNode GetSibling() const
bool GetElementText(std::string &text) const
std::string GetAttributeValue(const char *name, const char *fail_value=nullptr) const
void ForEachSiblingNode(NodeCallback const &callback) const
XMLNode GetElementForPath(const NamePath &path)
void ForEachSiblingElement(NodeCallback const &callback) const
bool GetElementTextAsUnsigned(uint64_t &value, uint64_t fail_value=0, int base=0) const
bool GetAttributeValueAsUnsigned(const char *name, uint64_t &value, uint64_t fail_value=0, int base=0) const
bool NameIs(const char *name) const
void ForEachChildElementWithName(const char *name, NodeCallback const &callback) const
void ForEachSiblingElementWithName(const char *name, NodeCallback const &callback) const
XMLNode FindFirstChildElementWithName(const char *name) const
bool GetElementTextAsFloat(double &value, double fail_value=0.0) const
void ForEachAttribute(AttributeCallback const &callback) const
A class that represents a running process on the host machine.
std::function< bool(const XMLNode &node)> NodeCallback
std::vector< std::string > NamePath
std::function< bool(const llvm::StringRef &name, const llvm::StringRef &value)> AttributeCallback