1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-08 09:57:10 +02:00

Miscellaneous code cleanup in the MaxmindDB module.

This commit is contained in:
Sandu Liviu Catalin
2016-11-14 14:44:01 +02:00
parent b9bc8ce2ad
commit fb5a5b0090
13 changed files with 214 additions and 105 deletions

View File

@ -94,22 +94,6 @@ public:
*/
Metadata & operator = (Metadata &&) = default;
/* --------------------------------------------------------------------------------------------
* Retrieve the internal result structure reference.
*/
Pointer GetHandle()
{
return m_Metadata;
}
/* --------------------------------------------------------------------------------------------
* Retrieve the internal result structure reference.
*/
ConstPtr GetHandle() const
{
return m_Metadata;
}
/* --------------------------------------------------------------------------------------------
* Used by the script engine to convert an instance of this type to a string.
*/
@ -124,11 +108,33 @@ public:
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* See whether this instance references a valid database and result structure.
* See whether this instance references a valid database and meta-data pointer.
*/
bool IsValid() const
{
return m_Handle && m_Metadata;
return m_Handle; // If there's a database handle then there's a meta-data too
}
/* --------------------------------------------------------------------------------------------
* Release the manages handles/pointers and become a null instance.
*/
void Release()
{
m_Handle.Reset();
m_Metadata = nullptr;
}
/* --------------------------------------------------------------------------------------------
* Retrieve the database associated with the managed handle/pointer.
*/
Database GetDatabase() const;
/* --------------------------------------------------------------------------------------------
* Return the number of active references to the managed database instance.
*/
Uint32 GetRefCount() const
{
return m_Handle.Count();
}
/* --------------------------------------------------------------------------------------------
@ -254,7 +260,6 @@ public:
// Return the requested description language
return m_Metadata->description.descriptions[idx]->language;
}
};
} // Namespace:: SqMod