Minor llxmlnode updated. Tracks line numbers and ostream format is a bit nicer.
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#define LL_LLXMLNODE_H
|
||||
|
||||
#ifndef XML_STATIC
|
||||
#define XML_STATIC 1
|
||||
#define XML_STATIC
|
||||
#endif
|
||||
#ifdef LL_STANDALONE
|
||||
#include <expat.h>
|
||||
@@ -44,10 +44,11 @@
|
||||
#include <map>
|
||||
|
||||
#include "indra_constants.h"
|
||||
#include "llmemory.h"
|
||||
#include "llthread.h"
|
||||
#include "llpointer.h"
|
||||
#include "llthread.h" // LLThreadSafeRefCount
|
||||
#include "llstring.h"
|
||||
#include "llstringtable.h"
|
||||
#include "llfile.h"
|
||||
|
||||
|
||||
class LLVector3;
|
||||
@@ -141,7 +142,7 @@ public:
|
||||
LLXMLNodePtr& node,
|
||||
LLXMLNode* defaults_tree);
|
||||
static bool parseBuffer(
|
||||
const char *buffer,
|
||||
U8* buffer,
|
||||
U32 length,
|
||||
LLXMLNodePtr& node,
|
||||
LLXMLNode* defaults);
|
||||
@@ -153,9 +154,18 @@ public:
|
||||
LLXMLNodePtr& node,
|
||||
LLXMLNodePtr& update_node);
|
||||
static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node);
|
||||
static void writeHeaderToFile(LLFILE *fOut);
|
||||
void writeToFile(LLFILE *fOut, const std::string& indent = std::string());
|
||||
void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string());
|
||||
|
||||
static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths);
|
||||
|
||||
|
||||
// Write standard XML file header:
|
||||
// <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
static void writeHeaderToFile(LLFILE *out_file);
|
||||
|
||||
// Write XML to file with one attribute per line.
|
||||
// XML escapes values as they are written.
|
||||
void writeToFile(LLFILE *out_file, const std::string& indent = std::string(), bool use_type_decorations=true);
|
||||
void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string(), bool use_type_decorations=true);
|
||||
|
||||
// Utility
|
||||
void findName(const std::string& name, LLXMLNodeList &results);
|
||||
@@ -207,6 +217,7 @@ public:
|
||||
U32 getLength() const { return mLength; }
|
||||
U32 getPrecision() const { return mPrecision; }
|
||||
const std::string& getValue() const { return mValue; }
|
||||
std::string getSanitizedValue() const;
|
||||
std::string getTextContents() const;
|
||||
const LLStringTableEntry* getName() const { return mName; }
|
||||
BOOL hasName(const char* name) const { return mName == gStringTable.checkStringEntry(name); }
|
||||
@@ -227,6 +238,8 @@ public:
|
||||
bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
|
||||
bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
|
||||
|
||||
S32 getLineNumber();
|
||||
|
||||
// The following skip over attributes
|
||||
LLXMLNodePtr getFirstChild() const;
|
||||
LLXMLNodePtr getNextSibling() const;
|
||||
@@ -262,6 +275,8 @@ public:
|
||||
void setName(const std::string& name);
|
||||
void setName(LLStringTableEntry* name);
|
||||
|
||||
void setLineNumber(S32 line_number);
|
||||
|
||||
// Escapes " (quot) ' (apos) & (amp) < (lt) > (gt)
|
||||
static std::string escapeXML(const std::string& xml);
|
||||
|
||||
@@ -300,6 +315,7 @@ public:
|
||||
U32 mPrecision; // The number of BITS per array item
|
||||
ValueType mType; // The value type
|
||||
Encoding mEncoding; // The value encoding
|
||||
S32 mLineNumber; // line number in source file, if applicable
|
||||
|
||||
LLXMLNode* mParent; // The parent node
|
||||
LLXMLChildrenPtr mChildren; // The child nodes
|
||||
|
||||
Reference in New Issue
Block a user