|
@@ -20,10 +20,6 @@
|
|
// IN THE SOFTWARE.
|
|
// IN THE SOFTWARE.
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////////////////
|
|
|
|
-// XML Document Object
|
|
|
|
-////////////////////////////////////////////////////////////////////////////////
|
|
|
|
-
|
|
|
|
#include "persistence/SimXMLDocument.h"
|
|
#include "persistence/SimXMLDocument.h"
|
|
#include "memory/frameAllocator.h"
|
|
#include "memory/frameAllocator.h"
|
|
#include "sim/simBase.h"
|
|
#include "sim/simBase.h"
|
|
@@ -31,6 +27,8 @@
|
|
#include "io/resource/resourceManager.h"
|
|
#include "io/resource/resourceManager.h"
|
|
#include "io/fileStream.h"
|
|
#include "io/fileStream.h"
|
|
|
|
|
|
|
|
+#include "SimXMLDocument_ScriptBinding.h"
|
|
|
|
+
|
|
IMPLEMENT_CONOBJECT(SimXMLDocument);
|
|
IMPLEMENT_CONOBJECT(SimXMLDocument);
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
@@ -112,12 +110,6 @@ void SimXMLDocument::reset(void)
|
|
m_paNode.clear();
|
|
m_paNode.clear();
|
|
m_CurrentAttribute = 0;
|
|
m_CurrentAttribute = 0;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, reset, void, 2, 2,
|
|
|
|
- "() Set this to default state at construction.\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->reset();
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if file loads successfully.
|
|
// Get true if file loads successfully.
|
|
@@ -128,12 +120,6 @@ S32 SimXMLDocument::loadFile(const char* rFileName)
|
|
|
|
|
|
return m_qDocument->LoadFile(rFileName);
|
|
return m_qDocument->LoadFile(rFileName);
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, loadFile, S32, 3, 3, "(string fileName) Load file from given filename.\n"
|
|
|
|
- "@param fileName The name of the desired file\n"
|
|
|
|
- "@return Returns 1 on success and 0 otherwise")
|
|
|
|
-{
|
|
|
|
- return object->loadFile( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if file saves successfully.
|
|
// Get true if file saves successfully.
|
|
@@ -160,12 +146,6 @@ S32 SimXMLDocument::saveFile(const char* rFileName)
|
|
|
|
|
|
return retVal;
|
|
return retVal;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, saveFile, S32, 3, 3, "(string fileName) Save file to given filename.\n"
|
|
|
|
- "@param fileName A string presenting the filename to save the XML document as\n"
|
|
|
|
- "@return Returns 1 on success, and 0 otherwise")
|
|
|
|
-{
|
|
|
|
- return object->saveFile( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if XML text parses correctly.
|
|
// Get true if XML text parses correctly.
|
|
@@ -176,12 +156,6 @@ S32 SimXMLDocument::parse(const char* rText)
|
|
m_qDocument->Parse( rText );
|
|
m_qDocument->Parse( rText );
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, parse, S32, 3, 3, "(string txtXML) Create document from XML string.\n"
|
|
|
|
- "@param txtXML The text of the XML document\n"
|
|
|
|
- "@return Returns 1 on success")
|
|
|
|
-{
|
|
|
|
- return object->parse( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Clear contents of XML document.
|
|
// Clear contents of XML document.
|
|
@@ -190,11 +164,6 @@ void SimXMLDocument::clear(void)
|
|
{
|
|
{
|
|
reset();
|
|
reset();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, clear, void, 2, 2, "() Clear contents of XML document.\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->clear();
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get error description of XML document.
|
|
// Get error description of XML document.
|
|
@@ -207,17 +176,6 @@ const char* SimXMLDocument::getErrorDesc(void) const
|
|
}
|
|
}
|
|
return m_qDocument->ErrorDesc();
|
|
return m_qDocument->ErrorDesc();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, getErrorDesc, const char*, 2, 2,
|
|
|
|
- "() Get current error description.\n"
|
|
|
|
- "@return Returns a string with the error description")
|
|
|
|
-{
|
|
|
|
- // Create Returnable Buffer (duration of error description is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(256);
|
|
|
|
- // Format Buffer.
|
|
|
|
- dSprintf(pBuffer, 256, "%s", object->getErrorDesc());
|
|
|
|
- // Return Velocity.
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Clear error description of this.
|
|
// Clear error description of this.
|
|
@@ -226,12 +184,6 @@ void SimXMLDocument::clearError(void)
|
|
{
|
|
{
|
|
m_qDocument->ClearError();
|
|
m_qDocument->ClearError();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, clearError, void, 2, 2,
|
|
|
|
- "() Clear error description.\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->clearError();
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if first child element was successfully pushed onto stack.
|
|
// Get true if first child element was successfully pushed onto stack.
|
|
@@ -269,13 +221,6 @@ bool SimXMLDocument::pushFirstChildElement(const char* rName)
|
|
m_paNode.push_back(pElement);
|
|
m_paNode.push_back(pElement);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, pushFirstChildElement, bool, 3, 3,
|
|
|
|
- "(string name) Push first child element with given name onto stack.\n"
|
|
|
|
- "@param name The name of the child element"
|
|
|
|
- "@return returns true on success, false otherwise.")
|
|
|
|
-{
|
|
|
|
- return object->pushFirstChildElement( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if first child element was successfully pushed onto stack.
|
|
// Get true if first child element was successfully pushed onto stack.
|
|
@@ -327,13 +272,6 @@ bool SimXMLDocument::pushChildElement(S32 index)
|
|
m_paNode.push_back(pElement);
|
|
m_paNode.push_back(pElement);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, pushChildElement, bool, 3, 3,
|
|
|
|
- "(int index) Push the child element at the given index onto stack.\n"
|
|
|
|
- "@param index A nonnegative integer representing the index of the child element\n"
|
|
|
|
- "@return Returns true on success, and false otherwise")
|
|
|
|
-{
|
|
|
|
- return object->pushChildElement( dAtoi( argv[2] ) );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Convert top stack element into its next sibling element.
|
|
// Convert top stack element into its next sibling element.
|
|
@@ -363,13 +301,6 @@ bool SimXMLDocument::nextSiblingElement(const char* rName)
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, nextSiblingElement, bool, 3, 3,
|
|
|
|
- "(string name) Set top element on stack to next element with given name.\n"
|
|
|
|
- "@param name The name of the element.\n"
|
|
|
|
- "@return Returns true on success, false otherwise")
|
|
|
|
-{
|
|
|
|
- return object->nextSiblingElement( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get element value if it exists. Used to extract a text node from the element.
|
|
// Get element value if it exists. Used to extract a text node from the element.
|
|
@@ -390,15 +321,6 @@ const char* SimXMLDocument::elementValue()
|
|
|
|
|
|
return pNode->Value();
|
|
return pNode->Value();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, elementValue, const char*, 2, 2,
|
|
|
|
- "() Get element value if it exists.\n"
|
|
|
|
- "@return A string with the desired value, or empty if not found.")
|
|
|
|
-{
|
|
|
|
- // Create Returnable Buffer (because duration of value is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(256);
|
|
|
|
- dSprintf(pBuffer, 256, "%s", object->elementValue());
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Pop last element off of stack.
|
|
// Pop last element off of stack.
|
|
@@ -407,12 +329,7 @@ void SimXMLDocument::popElement(void)
|
|
{
|
|
{
|
|
m_paNode.pop_back();
|
|
m_paNode.pop_back();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, popElement, void, 2, 2,
|
|
|
|
- "() Pop last element off of stack.\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->popElement();
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get attribute value if it exists.
|
|
// Get attribute value if it exists.
|
|
@@ -437,32 +354,6 @@ const char* SimXMLDocument::attribute(const char* rAttribute)
|
|
|
|
|
|
return pNode->Attribute(rAttribute);
|
|
return pNode->Attribute(rAttribute);
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, attribute, const char*, 3, 3,
|
|
|
|
- "(string attribute) Get attribute value if it exists.\n"
|
|
|
|
- "@param attribute The desired SimXMLDocument attribute\n"
|
|
|
|
- "@return Returns the value of the attribute as a string, or an empty string on failure")
|
|
|
|
-{
|
|
|
|
- // Create Returnable Buffer (because duration of attribute is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(256);
|
|
|
|
- // Format Buffer.
|
|
|
|
- dSprintf(pBuffer, 256, "%s", object->attribute( argv[2] ));
|
|
|
|
- // Return Velocity.
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
-ConsoleMethod(SimXMLDocument, attributeF32, F32, 3, 3,
|
|
|
|
- "(string attribute) Get attribute value if it exists.\n"
|
|
|
|
- "@param attribute The desired SimXMLDocument attribute\n"
|
|
|
|
- "@return Returns the value of the attribute converted to 32-bit floating-point value from string")
|
|
|
|
-{
|
|
|
|
- return dAtof( object->attribute( argv[2] ) );
|
|
|
|
-}
|
|
|
|
-ConsoleMethod(SimXMLDocument, attributeS32, S32, 3, 3,
|
|
|
|
- "(string attribute) Get attribute value if it exists.\n"
|
|
|
|
- "@param attribute The desired SimXMLDocument attribute\n"
|
|
|
|
- "@return Returns the value of the attribute converted to 32-bit integer value from string")
|
|
|
|
-{
|
|
|
|
- return dAtoi( object->attribute( argv[2] ) );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get true if given attribute exists.
|
|
// Get true if given attribute exists.
|
|
@@ -487,13 +378,7 @@ bool SimXMLDocument::attributeExists(const char* rAttribute)
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, attributeExists, bool, 3, 3,
|
|
|
|
- "(string attribute) Get true if named attribute exists.\n"
|
|
|
|
- "@param attribute The desired attribute's name\n"
|
|
|
|
- "@return Returns true if attribute exists and false otherwise")
|
|
|
|
-{
|
|
|
|
- return object->attributeExists( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Obtain the name of the current element's first attribute
|
|
// Obtain the name of the current element's first attribute
|
|
@@ -521,17 +406,6 @@ const char* SimXMLDocument::firstAttribute()
|
|
|
|
|
|
return m_CurrentAttribute->Name();
|
|
return m_CurrentAttribute->Name();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, firstAttribute, const char*, 2, 2,
|
|
|
|
- "() Obtain the name of the current element's first attribute.\n"
|
|
|
|
- "@return A string with the name of the first attribute")
|
|
|
|
-{
|
|
|
|
- const char* name = object->firstAttribute();
|
|
|
|
-
|
|
|
|
- // Create Returnable Buffer (because duration of attribute is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen(name)+1);
|
|
|
|
- dStrcpy(pBuffer, name);
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Obtain the name of the current element's last attribute
|
|
// Obtain the name of the current element's last attribute
|
|
@@ -559,17 +433,6 @@ const char* SimXMLDocument::lastAttribute()
|
|
|
|
|
|
return m_CurrentAttribute->Name();
|
|
return m_CurrentAttribute->Name();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, lastAttribute, const char*, 2, 2,
|
|
|
|
- "() Obtain the name of the current element's last attribute.\n"
|
|
|
|
- "@return A string with the name of the last attribute")
|
|
|
|
-{
|
|
|
|
- const char* name = object->lastAttribute();
|
|
|
|
-
|
|
|
|
- // Create Returnable Buffer (because duration of attribute is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen(name)+1);
|
|
|
|
- dStrcpy(pBuffer, name);
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get the name of the next attribute for the current element after a call
|
|
// Get the name of the next attribute for the current element after a call
|
|
@@ -591,17 +454,7 @@ const char* SimXMLDocument::nextAttribute()
|
|
|
|
|
|
return m_CurrentAttribute->Name();
|
|
return m_CurrentAttribute->Name();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, nextAttribute, const char*, 2, 2,
|
|
|
|
- "() Get the name of the next attribute for the current element after a call to firstAttribute().\n"
|
|
|
|
- "@return A string with the name of the next attribute")
|
|
|
|
-{
|
|
|
|
- const char* name = object->nextAttribute();
|
|
|
|
|
|
|
|
- // Create Returnable Buffer (because duration of attribute is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen(name)+1);
|
|
|
|
- dStrcpy(pBuffer, name);
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Get the name of the previous attribute for the current element after a call
|
|
// Get the name of the previous attribute for the current element after a call
|
|
@@ -623,17 +476,7 @@ const char* SimXMLDocument::prevAttribute()
|
|
|
|
|
|
return m_CurrentAttribute->Name();
|
|
return m_CurrentAttribute->Name();
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, prevAttribute, const char*, 2, 2,
|
|
|
|
- "() Get the name of the previous attribute for the current element after a call to lastAttribute().\n"
|
|
|
|
- "@return A string with the name of the previous attribute")
|
|
|
|
-{
|
|
|
|
- const char* name = object->prevAttribute();
|
|
|
|
|
|
|
|
- // Create Returnable Buffer (because duration of attribute is unknown).
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen(name)+1);
|
|
|
|
- dStrcpy(pBuffer, name);
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Set attribute of top stack element to given value.
|
|
// Set attribute of top stack element to given value.
|
|
@@ -653,14 +496,7 @@ void SimXMLDocument::setAttribute(const char* rAttribute, const char* rVal)
|
|
}
|
|
}
|
|
pElement->SetAttribute(rAttribute, rVal);
|
|
pElement->SetAttribute(rAttribute, rVal);
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, setAttribute, void, 4, 4,
|
|
|
|
- "(string attributeName, string attributeValue) Set attribute of top stack element to given value.\n"
|
|
|
|
- "@param attributeName The name of the attribute of the element you wish to set\n"
|
|
|
|
- "@param attributeValue The value you wish to set the given attribute to\n"
|
|
|
|
- "@return No return value.")
|
|
|
|
-{
|
|
|
|
- object->setAttribute(argv[2], argv[3]);
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Set attribute of top stack element to given value.
|
|
// Set attribute of top stack element to given value.
|
|
@@ -782,13 +618,6 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
|
|
//}
|
|
//}
|
|
|
|
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, setObjectAttributes, void, 3, 3,
|
|
|
|
- "(string attributeValue) Set attribute of top stack element to given value.\n"
|
|
|
|
- "@param attributeValue The value you wish to set the given attribute to\n"
|
|
|
|
- "@return No return value.")
|
|
|
|
-{
|
|
|
|
- object->setObjectAttributes(argv[2]);
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Create a new element and set to child of current stack element.
|
|
// Create a new element and set to child of current stack element.
|
|
@@ -820,14 +649,6 @@ void SimXMLDocument::pushNewElement(const char* rName)
|
|
}
|
|
}
|
|
m_paNode.push_back(pStackTop);
|
|
m_paNode.push_back(pStackTop);
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, pushNewElement, void, 3, 3,
|
|
|
|
- "(string name) Create new element as child of current stack element "
|
|
|
|
- "and push new element on to stack.\n"
|
|
|
|
- "@param name The anme of the new element\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->pushNewElement( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Create a new element and set to child of current stack element.
|
|
// Create a new element and set to child of current stack element.
|
|
@@ -881,14 +702,6 @@ void SimXMLDocument::addNewElement(const char* rName)
|
|
//pNode = pStackTop;
|
|
//pNode = pStackTop;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, addNewElement, void, 3, 3,
|
|
|
|
- "(string name) Create new element as child of current stack element "
|
|
|
|
- "and push new element on to stack.\n"
|
|
|
|
- "@param name The anme of the new element\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->addNewElement( argv[2] );
|
|
|
|
-}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------
|
|
// Write XML document declaration.
|
|
// Write XML document declaration.
|
|
@@ -898,11 +711,6 @@ void SimXMLDocument::addHeader(void)
|
|
TiXmlDeclaration cDeclaration("1.0", "utf-8", "yes");
|
|
TiXmlDeclaration cDeclaration("1.0", "utf-8", "yes");
|
|
m_qDocument->InsertEndChild(cDeclaration);
|
|
m_qDocument->InsertEndChild(cDeclaration);
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, addHeader, void, 2, 2, "() Add XML header to document.\n"
|
|
|
|
- "@return No return value.")
|
|
|
|
-{
|
|
|
|
- object->addHeader();
|
|
|
|
-}
|
|
|
|
|
|
|
|
void SimXMLDocument::addComment(const char* comment)
|
|
void SimXMLDocument::addComment(const char* comment)
|
|
{
|
|
{
|
|
@@ -923,12 +731,6 @@ void SimXMLDocument::addComment(const char* comment)
|
|
}
|
|
}
|
|
pNode->InsertEndChild( cComment );
|
|
pNode->InsertEndChild( cComment );
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, addComment, void, 3, 3, "(string comment) Add the given comment as a child of current stack element.\n"
|
|
|
|
- "@param comment The desired comment to add\n"
|
|
|
|
- "@return No return value.")
|
|
|
|
-{
|
|
|
|
- object->addComment(argv[2]);
|
|
|
|
-}
|
|
|
|
|
|
|
|
const char* SimXMLDocument::readComment( S32 index )
|
|
const char* SimXMLDocument::readComment( S32 index )
|
|
{
|
|
{
|
|
@@ -984,12 +786,6 @@ const char* SimXMLDocument::readComment( S32 index )
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
-ConsoleMethod(SimXMLDocument, readComment, const char*, 3, 3, "(S32 index) Returns the comment at the specified index.\n"
|
|
|
|
- "@param index The index of the desired comment as a nonnegative integer value\n"
|
|
|
|
- "@return The comment as a string")
|
|
|
|
-{
|
|
|
|
- return object->readComment( dAtoi( argv[2] ) );
|
|
|
|
-}
|
|
|
|
|
|
|
|
void SimXMLDocument::addText(const char* text)
|
|
void SimXMLDocument::addText(const char* text)
|
|
{
|
|
{
|
|
@@ -1005,13 +801,6 @@ void SimXMLDocument::addText(const char* text)
|
|
pNode->InsertEndChild( cText );
|
|
pNode->InsertEndChild( cText );
|
|
}
|
|
}
|
|
|
|
|
|
-ConsoleMethod(SimXMLDocument, addText, void, 3, 3, "(string text) Add the given text as a child of current stack element.\n"
|
|
|
|
- "@param text The desired text to add\n"
|
|
|
|
- "@return No return value.")
|
|
|
|
-{
|
|
|
|
- object->addText(argv[2]);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
const char* SimXMLDocument::getText()
|
|
const char* SimXMLDocument::getText()
|
|
{
|
|
{
|
|
if(m_paNode.empty())
|
|
if(m_paNode.empty())
|
|
@@ -1029,18 +818,6 @@ const char* SimXMLDocument::getText()
|
|
return text->Value();
|
|
return text->Value();
|
|
}
|
|
}
|
|
|
|
|
|
-ConsoleMethod(SimXMLDocument, getText, const char*, 2, 2, "() Gets the text from the current stack element.\n"
|
|
|
|
- "@return Returns the desired text, or empty string on failure")
|
|
|
|
-{
|
|
|
|
- const char* text = object->getText();
|
|
|
|
- if( !text )
|
|
|
|
- return "";
|
|
|
|
-
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen( text ) + 1);
|
|
|
|
- dStrcpy( pBuffer, text );
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void SimXMLDocument::removeText()
|
|
void SimXMLDocument::removeText()
|
|
{
|
|
{
|
|
if(m_paNode.empty())
|
|
if(m_paNode.empty())
|
|
@@ -1058,12 +835,6 @@ void SimXMLDocument::removeText()
|
|
pNode->RemoveChild(text);
|
|
pNode->RemoveChild(text);
|
|
}
|
|
}
|
|
|
|
|
|
-ConsoleMethod(SimXMLDocument, removeText, void, 2, 2, "() Remove any text on the current stack element.\n"
|
|
|
|
- "@return No return value\n")
|
|
|
|
-{
|
|
|
|
- object->removeText();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void SimXMLDocument::addData(const char* text)
|
|
void SimXMLDocument::addData(const char* text)
|
|
{
|
|
{
|
|
if(m_paNode.empty())
|
|
if(m_paNode.empty())
|
|
@@ -1078,12 +849,6 @@ void SimXMLDocument::addData(const char* text)
|
|
pNode->InsertEndChild( cText );
|
|
pNode->InsertEndChild( cText );
|
|
}
|
|
}
|
|
|
|
|
|
-ConsoleMethod(SimXMLDocument, addData, void, 3, 3, "(string text) Add the given text as a child of current stack element.\n"
|
|
|
|
- "@param The desired text to add\n"
|
|
|
|
- "@return No return value")
|
|
|
|
-{
|
|
|
|
- object->addData(argv[2]);
|
|
|
|
-}
|
|
|
|
|
|
|
|
const char* SimXMLDocument::getData()
|
|
const char* SimXMLDocument::getData()
|
|
{
|
|
{
|
|
@@ -1101,17 +866,3 @@ const char* SimXMLDocument::getData()
|
|
|
|
|
|
return text->Value();
|
|
return text->Value();
|
|
}
|
|
}
|
|
-
|
|
|
|
-ConsoleMethod(SimXMLDocument, getData, const char*, 2, 2, "() Gets the text from the current stack element.\n"
|
|
|
|
- "@return Returns the desired text or empty string if failed (no text)")
|
|
|
|
-{
|
|
|
|
- const char* text = object->getData();
|
|
|
|
- if( !text )
|
|
|
|
- return "";
|
|
|
|
-
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(dStrlen( text ) + 1);
|
|
|
|
- dStrcpy( pBuffer, text );
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-////EOF/////////////////////////////////////////////////////////////////////////
|
|
|