1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-05-02 00:57:13 +02:00

Updated the XML module to include the location for C++ exceptions in source code for debug builds.

This commit is contained in:
Sandu Liviu Catalin 2016-03-23 00:26:35 +02:00
parent a8edb37733
commit 3a06fe6048
7 changed files with 24 additions and 24 deletions

View File

@ -21,7 +21,7 @@ void Attribute::Validate() const
{ {
// Validate the document handle // Validate the document handle
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -35,7 +35,7 @@ Object Attribute::AsLong(Object & def) const
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Push a long integer instance with the requested value on the stack // Push a long integer instance with the requested value on the stack
_SqMod->PushSLongObject(_SqVM, m_Attr.as_llong(longint)); _SqMod->PushSLongObject(_SqVM, m_Attr.as_llong(longint));
// Obtain the object from the stack and return it // Obtain the object from the stack and return it
@ -53,7 +53,7 @@ Object Attribute::AsUlong(Object & def) const
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Push a long integer instance with the requested value on the stack // Push a long integer instance with the requested value on the stack
_SqMod->PushULongObject(_SqVM, m_Attr.as_ullong(longint)); _SqMod->PushULongObject(_SqVM, m_Attr.as_ullong(longint));
// Obtain the object from the stack and return it // Obtain the object from the stack and return it
@ -71,7 +71,7 @@ bool Attribute::ApplyLong(Object & value)
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value and return the result // Assign the obtained value and return the result
return m_Attr.set_value(longint); return m_Attr.set_value(longint);
} }
@ -87,7 +87,7 @@ bool Attribute::ApplyUlong(Object & value)
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value and return the result // Assign the obtained value and return the result
return m_Attr.set_value(longint); return m_Attr.set_value(longint);
} }
@ -114,7 +114,7 @@ void Attribute::SetLong(Object & value)
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value // Assign the obtained value
m_Attr = longint; m_Attr = longint;
} }
@ -141,7 +141,7 @@ void Attribute::SetUlong(Object & value)
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value // Assign the obtained value
m_Attr = longint; m_Attr = longint;
} }

View File

@ -150,7 +150,7 @@ public:
void SetName(CSStr name) void SetName(CSStr name)
{ {
if (!m_Attr.set_name(name)) if (!m_Attr.set_name(name))
SqThrowF("Unable to set xml attribute name"); STHROWF("Unable to set xml attribute name");
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -175,7 +175,7 @@ public:
void SetValue(CSStr name) void SetValue(CSStr name)
{ {
if (!m_Attr.set_value(name)) if (!m_Attr.set_value(name))
SqThrowF("Unable to set xml attribute value"); STHROWF("Unable to set xml attribute value");
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------

View File

@ -82,14 +82,14 @@ void ParseResult::Validate() const
{ {
// Is the documen handle valid? // Is the documen handle valid?
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ParseResult::Check() const void ParseResult::Check() const
{ {
if (m_Result.status != status_ok) if (m_Result.status != status_ok)
SqThrowF("XML parse error [%s]", m_Result.description()); STHROWF("XML parse error [%s]", m_Result.description());
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -19,7 +19,7 @@ void Document::Validate() const
{ {
// Validate the document handle // Validate the document handle
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -27,11 +27,11 @@ void Document::CanLoad() const
{ {
// Is the document even valid? // Is the document even valid?
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
// Are there any other references? // Are there any other references?
else if (m_Doc.Count() > 1) else if (m_Doc.Count() > 1)
// To load new values now, would mean to cause undefined behavior in existing references // To load new values now, would mean to cause undefined behavior in existing references
SqThrowF("Loading is disabled while document is referenced"); STHROWF("Loading is disabled while document is referenced");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@ void Node::Validate() const
{ {
// Validate the document handle // Validate the document handle
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -167,7 +167,7 @@ public:
void SetName(CSStr name) void SetName(CSStr name)
{ {
if (!m_Node.set_name(name)) if (!m_Node.set_name(name))
SqThrowF("Unable to set XML node name"); STHROWF("Unable to set XML node name");
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -192,7 +192,7 @@ public:
void SetValue(CSStr name) void SetValue(CSStr name)
{ {
if (!m_Node.set_value(name)) if (!m_Node.set_value(name))
SqThrowF("Unable to set XML node value"); STHROWF("Unable to set XML node value");
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------

View File

@ -23,7 +23,7 @@ void Text::Validate() const
{ {
// Validate the document handle // Validate the document handle
if (!m_Doc) if (!m_Doc)
SqThrowF("Invalid XML document reference"); STHROWF("Invalid XML document reference");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -48,7 +48,7 @@ Object Text::AsLong(Object & def) const
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Push a long integer instance with the requested value on the stack // Push a long integer instance with the requested value on the stack
_SqMod->PushSLongObject(_SqVM, m_Text.as_llong(longint)); _SqMod->PushSLongObject(_SqVM, m_Text.as_llong(longint));
// Obtain the object from the stack and return it // Obtain the object from the stack and return it
@ -66,7 +66,7 @@ Object Text::AsUlong(Object & def) const
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Push a long integer instance with the requested value on the stack // Push a long integer instance with the requested value on the stack
_SqMod->PushULongObject(_SqVM, m_Text.as_ullong(longint)); _SqMod->PushULongObject(_SqVM, m_Text.as_ullong(longint));
// Obtain the object from the stack and return it // Obtain the object from the stack and return it
@ -84,7 +84,7 @@ bool Text::ApplyLong(Object & value)
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value and return the result // Assign the obtained value and return the result
return m_Text.set(longint); return m_Text.set(longint);
} }
@ -100,7 +100,7 @@ bool Text::ApplyUlong(Object & value)
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value and return the result // Assign the obtained value and return the result
return m_Text.set(longint); return m_Text.set(longint);
} }
@ -127,7 +127,7 @@ void Text::SetLong(Object & value)
Int64 longint = 0; Int64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetSLongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value // Assign the obtained value
m_Text = longint; m_Text = longint;
} }
@ -154,7 +154,7 @@ void Text::SetUlong(Object & value)
Uint64 longint = 0; Uint64 longint = 0;
// Attempt to get the numeric value inside the specified object // Attempt to get the numeric value inside the specified object
if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint))) if (SQ_FAILED(_SqMod->GetULongValue(_SqVM, -1, &longint)))
SqThrowF("Invalid long integer specified"); STHROWF("Invalid long integer specified");
// Assign the obtained value // Assign the obtained value
m_Text = longint; m_Text = longint;
} }