mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Preliminary Poco::Data bindings.
This commit is contained in:
18
module/PocoLib/Crypto.cpp
Normal file
18
module/PocoLib/Crypto.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/Crypto.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_Crypto(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
RootTable(vm).Bind(_SC("SqCrypto"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/Crypto.hpp
Normal file
11
module/PocoLib/Crypto.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
324
module/PocoLib/Data.cpp
Normal file
324
module/PocoLib/Data.cpp
Normal file
@ -0,0 +1,324 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/Data.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifdef SQMOD_POCO_HAS_SQLITE
|
||||
#include <Poco/Data/SQLite/Connector.h>
|
||||
#endif
|
||||
#ifdef SQMOD_POCO_HAS_MYSQL
|
||||
#include <Poco/Data/MySQL/Connector.h>
|
||||
#endif
|
||||
#ifdef SQMOD_POCO_HAS_POSTGRESQL
|
||||
#include <Poco/Data/PostgreSQL/Connector.h>
|
||||
#endif
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqIntegerBinding, _SC("SqIntegerBinding"))
|
||||
SQMOD_DECL_TYPENAME(SqStringBinding, _SC("SqStringBinding"))
|
||||
SQMOD_DECL_TYPENAME(SqFloatBinding, _SC("SqFloatBinding"))
|
||||
SQMOD_DECL_TYPENAME(SqBoolBinding, _SC("SqBoolBinding"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqPcDataSession, _SC("SqDataSession"))
|
||||
SQMOD_DECL_TYPENAME(SqPcDataStatement, _SC("SqDataStatement"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const Poco::Data::NullData g_NullData{Poco::NULL_GENERIC};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void InitializePocoDataConnectors()
|
||||
{
|
||||
#ifdef SQMOD_POCO_HAS_SQLITE
|
||||
Poco::Data::SQLite::Connector::registerConnector();
|
||||
#endif
|
||||
#ifdef SQMOD_POCO_HAS_MYSQL
|
||||
Poco::Data::MySQL::Connector::registerConnector();
|
||||
#endif
|
||||
#ifdef SQMOD_POCO_HAS_POSTGRESQL
|
||||
Poco::Data::PostgreSQL::Connector::registerConnector();
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SqDataSession::SetProperty(const LightObj & value, StackStrF & name)
|
||||
{
|
||||
switch (value.GetType())
|
||||
{
|
||||
case OT_NULL: {
|
||||
setProperty(name.ToStr(), Poco::Any(nullptr));
|
||||
} break;
|
||||
case OT_INTEGER: {
|
||||
setProperty(name.ToStr(), Poco::Any(value.Cast<SQInteger>()));
|
||||
} break;
|
||||
case OT_FLOAT: {
|
||||
setProperty(name.ToStr(), Poco::Any(value.Cast<SQFloat>()));
|
||||
} break;
|
||||
case OT_BOOL: {
|
||||
setProperty(name.ToStr(), Poco::Any(value.Cast<bool>()));
|
||||
} break;
|
||||
case OT_STRING: {
|
||||
setProperty(name.ToStr(), Poco::Any(value.Cast<std::string>()));
|
||||
} break;
|
||||
default: STHROWF("Unsupported property value type");
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj SqDataSession::GetProperty(StackStrF & name) const
|
||||
{
|
||||
HSQUIRRELVM vm = name.mVM;
|
||||
// Preserve stack
|
||||
const StackGuard sg(vm);
|
||||
// Retrieve the property value
|
||||
Poco::Any a = getProperty(name.ToStr());
|
||||
// Retrieve the value type
|
||||
const auto & ti = a.type();
|
||||
// Identify the stored value
|
||||
if (a.empty() || ti == typeid(void) || ti == typeid(nullptr)) sq_pushnull(vm);
|
||||
else if (ti == typeid(bool)) sq_pushbool(vm, Poco::AnyCast< bool >(a));
|
||||
else if (ti == typeid(char)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< char >(a)));
|
||||
else if (ti == typeid(wchar_t)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< wchar_t >(a)));
|
||||
else if (ti == typeid(signed char)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< signed char >(a)));
|
||||
else if (ti == typeid(unsigned char)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< unsigned char >(a)));
|
||||
else if (ti == typeid(short int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< short int >(a)));
|
||||
else if (ti == typeid(unsigned short int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< unsigned short int >(a)));
|
||||
else if (ti == typeid(int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< int >(a)));
|
||||
else if (ti == typeid(unsigned int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< unsigned int >(a)));
|
||||
else if (ti == typeid(long int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< long int >(a)));
|
||||
else if (ti == typeid(unsigned long int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< unsigned long int >(a)));
|
||||
else if (ti == typeid(long long int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< long long int >(a)));
|
||||
else if (ti == typeid(unsigned long long int)) sq_pushinteger(vm, ConvTo< SQInteger >::From(Poco::AnyCast< unsigned long long int >(a)));
|
||||
else if (ti == typeid(float)) sq_pushfloat(vm, ConvTo< SQFloat >::From(Poco::AnyCast< float >(a)));
|
||||
else if (ti == typeid(double)) sq_pushfloat(vm, ConvTo< SQFloat >::From(Poco::AnyCast< double >(a)));
|
||||
else if (ti == typeid(long double)) sq_pushfloat(vm, ConvTo< SQFloat >::From(Poco::AnyCast< long double >(a)));
|
||||
else if (ti == typeid(std::string)) {
|
||||
const auto & s = Poco::RefAnyCast< std::string >(a);
|
||||
sq_pushstring(vm, s.data(), ConvTo< SQFloat >::From(s.size()));
|
||||
} else {
|
||||
sq_throwerrorf(vm, "Unable to convert value of type (%s) to squirrel.", a.type().name());
|
||||
sq_pushnull(vm);
|
||||
}
|
||||
// Return the object from the stack
|
||||
return Var< LightObj >(vm, -1).value;
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SqDataStatement SqDataSession::GetStatement(StackStrF & data)
|
||||
{
|
||||
return SqDataStatement(*this, data);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SqDataStatement & SqDataStatement::UseEx(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir)
|
||||
{
|
||||
//
|
||||
switch (obj.GetType())
|
||||
{
|
||||
case OT_NULL: addBind(new Poco::Data::Binding<Poco::Data::NullData>(const_cast<Poco::Data::NullData&>(g_NullData), name, dir)); break;
|
||||
case OT_INTEGER:
|
||||
case OT_FLOAT:
|
||||
case OT_BOOL:
|
||||
case OT_STRING: STHROWF("Use Bind(...) for non-reference types."); break;
|
||||
case OT_INSTANCE: {
|
||||
auto type = static_cast< AbstractStaticClassData * >(obj.GetTypeTag());
|
||||
// Integer reference?
|
||||
if (type == StaticClassTypeTag< SqDataBinding< SQInteger > >::Get())
|
||||
{
|
||||
addBind(new Poco::Data::ReferenceBinding< SQInteger >(obj.CastI< SqDataBinding< SQInteger > >()->mV, name, dir)); break;
|
||||
} // Float reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< SQFloat > >::Get())
|
||||
{
|
||||
addBind(new Poco::Data::ReferenceBinding< SQFloat >(obj.CastI< SqDataBinding< SQFloat > >()->mV, name, dir)); break;
|
||||
} // String reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< String > >::Get())
|
||||
{
|
||||
addBind(new Poco::Data::ReferenceBinding< String >(obj.CastI< SqDataBinding< String > >()->mV, name, dir)); break;
|
||||
} // Bool reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< bool > >::Get())
|
||||
{
|
||||
addBind(new Poco::Data::ReferenceBinding< bool >(obj.CastI< SqDataBinding< bool > >()->mV, name, dir)); break;
|
||||
} // Unknown!
|
||||
else
|
||||
{
|
||||
Var< LightObj >::push(SqVM(), obj);
|
||||
String type_name = SqTypeName(SqVM(), -1);
|
||||
sq_poptop(SqVM());
|
||||
STHROWF("Can't use (%s) values", type_name.c_str()); break;
|
||||
}
|
||||
|
||||
} break;
|
||||
default: STHROWF("Can't use (%s) values", SqTypeName(obj.GetType())); break;
|
||||
}
|
||||
//
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SqDataStatement & SqDataStatement::BindEx(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir)
|
||||
{
|
||||
//
|
||||
switch (obj.GetType())
|
||||
{
|
||||
case OT_NULL: {
|
||||
addBind(new Poco::Data::Binding<Poco::Data::NullData>(const_cast<Poco::Data::NullData&>(g_NullData), name, dir));
|
||||
} break;
|
||||
case OT_INTEGER: {
|
||||
auto v = obj.Cast<SQInteger>();
|
||||
addBind(new Poco::Data::CopyBinding<SQInteger>(v, name, dir));
|
||||
} break;
|
||||
case OT_FLOAT: {
|
||||
auto v = obj.Cast<SQFloat>();
|
||||
addBind(new Poco::Data::CopyBinding<SQFloat>(v, name, dir));
|
||||
} break;
|
||||
case OT_BOOL: {
|
||||
auto v = obj.Cast<bool>();
|
||||
addBind(new Poco::Data::CopyBinding<bool>(v, name, dir));
|
||||
} break;
|
||||
case OT_STRING: {
|
||||
Var< LightObj >::push(SqVM(), obj);
|
||||
StackStrF str(SqVM(), -1);
|
||||
str.Proc(false);
|
||||
sq_poptop(SqVM());
|
||||
addBind(new Poco::Data::CopyBinding<const char *>(str.mPtr, name, dir));
|
||||
} break;
|
||||
case OT_INSTANCE: {
|
||||
auto type = static_cast< AbstractStaticClassData * >(obj.GetTypeTag());
|
||||
// Integer reference?
|
||||
if (type == StaticClassTypeTag< SqDataBinding< SQInteger > >::Get())
|
||||
{
|
||||
//addBind(new Poco::Data::ReferenceBinding< SQInteger >(obj.CastI< SqDataBinding< SQInteger > >()->mV, name, dir)); break;
|
||||
} // Float reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< SQFloat > >::Get())
|
||||
{
|
||||
//addBind(new Poco::Data::ReferenceBinding< SQFloat >(obj.CastI< SqDataBinding< SQFloat > >()->mV, name, dir)); break;
|
||||
} // String reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< String > >::Get())
|
||||
{
|
||||
//addBind(new Poco::Data::ReferenceBinding< String >(obj.CastI< SqDataBinding< String > >()->mV, name, dir)); break;
|
||||
} // Bool reference?
|
||||
else if (type == StaticClassTypeTag< SqDataBinding< bool > >::Get())
|
||||
{
|
||||
//addBind(new Poco::Data::ReferenceBinding< bool >(obj.CastI< SqDataBinding< bool > >()->mV, name, dir)); break;
|
||||
} // Unknown!
|
||||
else
|
||||
{
|
||||
Var< LightObj >::push(SqVM(), obj);
|
||||
String type_name = SqTypeName(SqVM(), -1);
|
||||
sq_poptop(SqVM());
|
||||
STHROWF("Can't use (%s) values", type_name.c_str()); break;
|
||||
}
|
||||
|
||||
} break;
|
||||
default: STHROWF("Can't use (%s) values", SqTypeName(obj.GetType())); break;
|
||||
}
|
||||
//
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < class T, class U >
|
||||
static void Register_POCO_Data_Binding(HSQUIRRELVM vm, Table & ns, const SQChar * name)
|
||||
{
|
||||
using Binding = SqDataBinding< T >;
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(name,
|
||||
Class< Binding, NoCopy< Binding > >(vm, U::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.template Ctor()
|
||||
.template Ctor< typename Binding::OptimalArg >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &U::Fn)
|
||||
// Properties
|
||||
.Prop(_SC("V"), &Binding::Get, &Binding::Set)
|
||||
.Prop(_SC("Value"), &Binding::Get, &Binding::Set)
|
||||
// Member Methods
|
||||
.Func(_SC("Set"), &Binding::SetEx)
|
||||
.Func(_SC("Bind"), &Binding::Bind)
|
||||
.Func(_SC("BindAs"), &Binding::BindAs)
|
||||
);
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_Data(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Session"),
|
||||
Class< SqDataSession >(vm, SqPcDataSession::Str)
|
||||
// Constructors
|
||||
.Ctor< StackStrF &, SQInteger >()
|
||||
.Ctor< StackStrF &, StackStrF &, SQInteger >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqPcDataSession::Fn)
|
||||
// Properties
|
||||
.Prop(_SC("IsConnected"), &SqDataSession::IsConnected)
|
||||
.Prop(_SC("IsGood"), &SqDataSession::IsGood)
|
||||
.Prop(_SC("LoginTimeout"), &SqDataSession::GetLoginTimeout, &SqDataSession::SetLoginTimeout)
|
||||
.Prop(_SC("ConnectionTimeout"), &SqDataSession::GetConnectionTimeout, &SqDataSession::SetConnectionTimeout)
|
||||
.Prop(_SC("CanTransact"), &SqDataSession::CanTransact)
|
||||
.Prop(_SC("IsTransaction"), &SqDataSession::IsTransaction)
|
||||
.Prop(_SC("TransactionIsolation"), &SqDataSession::GetTransactionIsolation, &SqDataSession::SetTransactionIsolation)
|
||||
.Prop(_SC("Connector"), &SqDataSession::GetConnector)
|
||||
.Prop(_SC("URI"), &SqDataSession::GetURI)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("Open"), &SqDataSession::Open)
|
||||
.Func(_SC("Close"), &SqDataSession::Close)
|
||||
.Func(_SC("Reconnect"), &SqDataSession::Reconnect)
|
||||
.Func(_SC("Statement"), &SqDataSession::GetStatement)
|
||||
.Func(_SC("Begin"), &SqDataSession::Begin)
|
||||
.Func(_SC("Commit"), &SqDataSession::Commit)
|
||||
.Func(_SC("Rollback"), &SqDataSession::Rollback)
|
||||
.Func(_SC("HasTransactionIsolation"), &SqDataSession::HasTransactionIsolation)
|
||||
.Func(_SC("IsTransactionIsolation"), &SqDataSession::IsTransactionIsolation)
|
||||
.FmtFunc(_SC("SetFeature"), &SqDataSession::SetFeature)
|
||||
.FmtFunc(_SC("GetFeature"), &SqDataSession::GetFeature)
|
||||
.FmtFunc(_SC("SetProperty"), &SqDataSession::SetProperty)
|
||||
.FmtFunc(_SC("GetProperty"), &SqDataSession::GetProperty)
|
||||
// Static Functions
|
||||
.StaticFunc(_SC("GetURI"), &SqDataSession::BuildURI)
|
||||
// Static Values
|
||||
.SetStaticValue(_SC("LoginTimeoutDefault"), static_cast< SQInteger >(Session::LOGIN_TIMEOUT_DEFAULT))
|
||||
.SetStaticValue(_SC("TransactionReadUncommitted"), static_cast< SQInteger >(Session::TRANSACTION_READ_UNCOMMITTED))
|
||||
.SetStaticValue(_SC("TransactionReadCommitted"), static_cast< SQInteger >(Session::TRANSACTION_READ_COMMITTED))
|
||||
.SetStaticValue(_SC("TransactionRepeatableRead"), static_cast< SQInteger >(Session::TRANSACTION_REPEATABLE_READ))
|
||||
.SetStaticValue(_SC("TransactionSerializable"), static_cast< SQInteger >(Session::TRANSACTION_SERIALIZABLE))
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Statement"),
|
||||
Class< SqDataStatement >(vm, SqPcDataStatement::Str)
|
||||
// Constructors
|
||||
.Ctor< SqDataSession & >()
|
||||
.Ctor< SqDataSession &, StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqPcDataStatement::Fn)
|
||||
// Properties
|
||||
.Prop(_SC("Async"), &SqDataStatement::GetAsync, &SqDataStatement::SetAsync)
|
||||
.Prop(_SC("Initialized"), &SqDataStatement::Initialized)
|
||||
.Prop(_SC("Paused"), &SqDataStatement::Paused)
|
||||
.Prop(_SC("Done"), &SqDataStatement::Done)
|
||||
// Member Methods
|
||||
.Func(_SC("Add"), &SqDataStatement::Add)
|
||||
.Func(_SC("Execute"), &SqDataStatement::Execute)
|
||||
.Func(_SC("ExecuteAsync"), &SqDataStatement::ExecuteAsync)
|
||||
.Func(_SC("SetAsync"), &SqDataStatement::SetAsync)
|
||||
.Func(_SC("Reset"), &SqDataStatement::Reset)
|
||||
.Func(_SC("Use"), &SqDataStatement::Use)
|
||||
.Func(_SC("UseAs"), &SqDataStatement::UseAs)
|
||||
.Func(_SC("Bind"), &SqDataStatement::Bind)
|
||||
.Func(_SC("BindAs"), &SqDataStatement::BindAs)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_POCO_Data_Binding< SQInteger, SqIntegerBinding >(vm, ns, _SC("IntBind"));
|
||||
Register_POCO_Data_Binding< String, SqStringBinding >(vm, ns, _SC("StrBind"));
|
||||
Register_POCO_Data_Binding< SQFloat, SqFloatBinding >(vm, ns, _SC("FloatBind"));
|
||||
Register_POCO_Data_Binding< bool, SqBoolBinding >(vm, ns, _SC("BoolBind"));
|
||||
|
||||
RootTable(vm).Bind(_SC("SqData"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
640
module/PocoLib/Data.hpp
Normal file
640
module/PocoLib/Data.hpp
Normal file
@ -0,0 +1,640 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <Poco/Data/Session.h>
|
||||
#include <Poco/Data/Statement.h>
|
||||
#include <Poco/Data/RecordSet.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace std { // NOLINT(cert-dcl58-cpp)
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Allows the StackStrF to write its data into a std::ostream type.
|
||||
*/
|
||||
inline std::ostream & operator << (std::ostream & out, const ::Sqrat::StackStrF & str)
|
||||
{
|
||||
if (str.mLen)
|
||||
{
|
||||
out.write(str.mPtr, str.mLen);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Allows the StackStrF to write its data into a std::ostringstream type.
|
||||
*/
|
||||
inline std::ostringstream & operator << (std::ostringstream & out, const ::Sqrat::StackStrF & str)
|
||||
{
|
||||
if (str.mLen)
|
||||
{
|
||||
out.write(str.mPtr, str.mLen);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
} // Namespace:: std
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace Poco { // NOLINT(modernize-concat-nested-namespaces)
|
||||
namespace Data {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Implementation of AbstractBinding for shared ownership binding of values.
|
||||
* Because we cannot take references to script variables, we use this as a proxy.
|
||||
*/
|
||||
template <class T> struct ReferenceBinding : public AbstractBinding
|
||||
{
|
||||
using ValType = T;
|
||||
using ValPtr = SharedPtr<ValType>;
|
||||
using Type = ReferenceBinding<ValType>;
|
||||
using Ptr = SharedPtr<Type>;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Base constructor.
|
||||
*/
|
||||
explicit ReferenceBinding(const ValPtr& val, const std::string& name = "", Direction direction = PD_IN)
|
||||
: AbstractBinding(name, direction), m_Value(val), m_Bound(false)
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~ReferenceBinding() override = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve columns occupied.
|
||||
*/
|
||||
SQMOD_NODISCARD std::size_t numOfColumnsHandled() const override
|
||||
{
|
||||
return TypeHandler<T>::size();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve rows occupied.
|
||||
*/
|
||||
SQMOD_NODISCARD std::size_t numOfRowsHandled() const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if binding is available.
|
||||
*/
|
||||
SQMOD_NODISCARD bool canBind() const override
|
||||
{
|
||||
return !m_Bound;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Bind the value.
|
||||
*/
|
||||
void bind(std::size_t pos) override
|
||||
{
|
||||
poco_assert_dbg(!getBinder().isNull());
|
||||
TypeHandler<T>::bind(pos, *m_Value, getBinder(), getDirection());
|
||||
m_Bound = true;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reset the binding.
|
||||
*/
|
||||
void reset () override
|
||||
{
|
||||
m_Bound = false;
|
||||
AbstractBinder::Ptr pBinder = getBinder();
|
||||
poco_assert_dbg (!pBinder.isNull());
|
||||
pBinder->reset();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
ValPtr m_Value;
|
||||
bool m_Bound;
|
||||
};
|
||||
|
||||
} // Namespace:: Data
|
||||
} // Namespace:: Poco
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
using namespace Poco::Data::Keywords;
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
using Poco::Data::Session;
|
||||
using Poco::Data::Statement;
|
||||
using Poco::Data::RecordSet;
|
||||
using Poco::Data::ReferenceBinding;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct SqDataSession;
|
||||
struct SqDataStatement;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Utility used to transform optimal argument type to stored type.
|
||||
*/
|
||||
template < class T > struct SqDataBindingOpt
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Optimal argument type. Unchanged when not specialized.
|
||||
*/
|
||||
using Type = T;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Convert the optimal type to the stored type. Does nothing special in this case.
|
||||
*/
|
||||
inline static Type & Get(Type & v) { return v; }
|
||||
inline static const Type & Get(const Type & v) { return v; }
|
||||
// --------------------------------------------------------------------------------------------
|
||||
inline static void Put(T & o, Type & v) { o = v; }
|
||||
inline static void Put(T & o, const Type & v) { o = v; }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Specialization of SqDataBindingOpt for std::string type.
|
||||
*/
|
||||
template < > struct SqDataBindingOpt< String >
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Optimal argument type.
|
||||
*/
|
||||
using Type = StackStrF;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Convert the optimal type to the stored type.
|
||||
*/
|
||||
inline static String Get(Type & v) { return v.ToStr(); }
|
||||
inline static String Get(const Type & v) { return v.ToStr(); }
|
||||
// --------------------------------------------------------------------------------------------
|
||||
inline static void Put(String & o, Type & v) { o.assign(v.mPtr, v.GetSize()); }
|
||||
inline static void Put(String & o, const Type & v) { o.assign(v.mPtr, v.GetSize()); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Wrapper around values that must be passed as reference. Manual lifetime management!
|
||||
*/
|
||||
template < class T > struct SqDataBinding
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference binding type.
|
||||
*/
|
||||
using Binding = ReferenceBinding< T >;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Optimal type to receive a value of this type as function argument. Mainly for strings.
|
||||
*/
|
||||
using OptimalType = typename SqDataBindingOpt< T >::Type;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Same as OptimalType but preferably with a reference qualifier to avoid copies.
|
||||
*/
|
||||
using OptimalArg = typename std::conditional< std::is_same< T, OptimalType >::value, T, OptimalType & >::type;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Reference value.
|
||||
*/
|
||||
typename Binding::ValPtr mV{};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor. Initializes to a default value.
|
||||
*/
|
||||
SqDataBinding()
|
||||
: mV(new T())
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor. Initializes to a specific value.
|
||||
*/
|
||||
explicit SqDataBinding(OptimalArg v)
|
||||
: mV(new T())
|
||||
{
|
||||
SqDataBindingOpt< T >::Put(*mV, v);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
SqDataBinding(const SqDataBinding &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
SqDataBinding(SqDataBinding &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destroys the Statement.
|
||||
*/
|
||||
~SqDataBinding() = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Assignment operator.
|
||||
*/
|
||||
SqDataBinding & operator = (const SqDataBinding &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment.
|
||||
*/
|
||||
SqDataBinding & operator = (SqDataBinding &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a value from the instance.
|
||||
*/
|
||||
SQMOD_NODISCARD const T & Get() const { return *mV; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify a value from the instance.
|
||||
*/
|
||||
void Set(OptimalArg v) { SqDataBindingOpt< T >::Put(*mV, v); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify a value from the instance.
|
||||
*/
|
||||
SqDataBinding & SetEx(OptimalArg v) { SqDataBindingOpt< T >::Put(*mV, v); return *this; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Bind the value to a statement.
|
||||
*/
|
||||
SqDataBinding & Bind(SqDataStatement & stmt);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Bind the value to a statement with a specific name.
|
||||
*/
|
||||
SqDataBinding & BindAs(SqDataStatement & stmt, StackStrF & name);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* A Session holds a connection to a Database and creates Statement objects.
|
||||
*/
|
||||
struct SqDataSession : public Session
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates a new session, using the given connection (must be in "connection:///info" format).
|
||||
*/
|
||||
SqDataSession(StackStrF & conn, SQInteger timeout)
|
||||
: Session(conn.ToStr(), ConvTo< size_t >::From(timeout))
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates a new session, using the given connector, and connection information.
|
||||
*/
|
||||
SqDataSession(StackStrF & conn, StackStrF & info, SQInteger timeout)
|
||||
: Session(conn.ToStr(), info.ToStr(), ConvTo< size_t >::From(timeout))
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates a session by copying another one.
|
||||
*/
|
||||
SqDataSession(const SqDataSession &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates a session by moving another one.
|
||||
*/
|
||||
SqDataSession(SqDataSession &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destroys the Session.
|
||||
*/
|
||||
~SqDataSession() = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Assignment operator.
|
||||
*/
|
||||
SqDataSession & operator = (const SqDataSession &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment.
|
||||
*/
|
||||
SqDataSession & operator = (SqDataSession &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Opens the session using the supplied string.
|
||||
* Can also be used with default empty string to reconnect a disconnected session.
|
||||
*/
|
||||
void Open(StackStrF & connect) { open(connect.ToStr()); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Closes the session.
|
||||
*/
|
||||
void Close() { close(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if session is connected, false otherwise.
|
||||
*/
|
||||
bool IsConnected() { return isConnected(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Closes the session and opens it.
|
||||
*/
|
||||
void Reconnect() { return reconnect(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the session is good and can be used, false otherwise.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsGood() { return isGood(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the session login timeout value.
|
||||
*/
|
||||
void SetLoginTimeout(SQInteger timeout) { setLoginTimeout(ConvTo< size_t >::From(timeout)); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the session login timeout value.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetLoginTimeout() const { return static_cast< SQInteger >(getLoginTimeout()); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the session connection timeout value.
|
||||
*/
|
||||
void SetConnectionTimeout(SQInteger timeout) { setConnectionTimeout(ConvTo< size_t >::From(timeout)); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the session connection timeout value.
|
||||
*/
|
||||
SQInteger GetConnectionTimeout() { return static_cast< SQInteger >(getConnectionTimeout()); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Starts a transaction.
|
||||
*/
|
||||
void Begin() { begin(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Commits and ends a transaction.
|
||||
*/
|
||||
void Commit() { commit(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Rolls back and ends a transaction.
|
||||
*/
|
||||
void Rollback() { rollback(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if session has transaction capabilities.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanTransact() { return canTransact(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if a transaction is in progress, false otherwise.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsTransaction() { return isTransaction(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the transaction isolation level.
|
||||
*/
|
||||
void SetTransactionIsolation(SQInteger ti) { setTransactionIsolation(static_cast< uint32_t >(ti)); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the transaction isolation level.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetTransactionIsolation() { return static_cast< SQInteger >(getTransactionIsolation()); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the transaction isolation level corresponding to the supplied bitmask is supported.
|
||||
*/
|
||||
bool HasTransactionIsolation(SQInteger ti) { return hasTransactionIsolation(static_cast< uint32_t >(ti)); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the transaction isolation level corresponds to the supplied bitmask.
|
||||
*/
|
||||
bool IsTransactionIsolation(SQInteger ti) { return isTransactionIsolation(static_cast< uint32_t >(ti)); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the connector name for this session.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetConnector() const { return connector(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the URI for this session.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetURI() const { return uri(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Utility function that teturns the URI formatted from supplied arguments as "connector:///info".
|
||||
*/
|
||||
SQMOD_NODISCARD static std::string BuildURI(StackStrF & connector, StackStrF & info)
|
||||
{
|
||||
return uri(connector.ToStr(), info.ToStr());
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the state of a feature.
|
||||
*/
|
||||
void SetFeature(bool state, StackStrF & name) { setFeature(name.ToStr(), state); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Look up the state of a feature.
|
||||
*/
|
||||
SQMOD_NODISCARD bool GetFeature(StackStrF & name) const { return getFeature(name.ToStr()); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the value of a property.
|
||||
*/
|
||||
void SetProperty(const LightObj & value, StackStrF & name);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Look up the value of a property.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj GetProperty(StackStrF & name) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Look up the value of a property.
|
||||
*/
|
||||
SQMOD_NODISCARD SqDataStatement GetStatement(StackStrF & data);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Statement is used to execute SQL statements.
|
||||
*/
|
||||
struct SqDataStatement : public Statement
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates the Statement for the given Session.
|
||||
*/
|
||||
explicit SqDataStatement(SqDataSession & session)
|
||||
: Statement(session)
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Creates the Statement for the given Session and adds initial SQL code.
|
||||
*/
|
||||
explicit SqDataStatement(SqDataSession & session, StackStrF & data)
|
||||
: Statement(session)
|
||||
{
|
||||
Add(data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor. If the statement has been executed asynchronously and has not been
|
||||
* synchronized prior to copy operation (i.e. is copied while executing), this constructor shall synchronize it.
|
||||
*/
|
||||
SqDataStatement(const SqDataStatement &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
SqDataStatement(SqDataStatement &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destroys the Statement.
|
||||
*/
|
||||
~SqDataStatement() = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Assignment operator.
|
||||
*/
|
||||
SqDataStatement & operator = (const SqDataStatement &) = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment.
|
||||
*/
|
||||
SqDataStatement & operator = (SqDataStatement &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Concatenates data with the SQL statement string.
|
||||
*/
|
||||
SqDataStatement & Add(StackStrF & data)
|
||||
{
|
||||
Statement::operator<<(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if statement was marked for asynchronous execution.
|
||||
*/
|
||||
bool GetAsync()
|
||||
{
|
||||
return isAsync();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the statement was initialized (i.e. not executed yet).
|
||||
*/
|
||||
bool Initialized()
|
||||
{
|
||||
return initialized();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the statement was paused (a range limit stopped it and there is more work to do).
|
||||
*/
|
||||
bool Paused()
|
||||
{
|
||||
return paused();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns true if the statement was completely executed or false if a range limit stopped it
|
||||
* and there is more work to do. When no limit is set, it will always return true after calling execute().
|
||||
*/
|
||||
bool Done()
|
||||
{
|
||||
return done();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Sets the asynchronous flag. This setting does not affect the statement's capability
|
||||
* to be executed synchronously by directly calling Execute().
|
||||
*/
|
||||
SqDataStatement & SetAsync(bool async)
|
||||
{
|
||||
setAsync(async);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Executes the statement synchronously or asynchronously.
|
||||
*/
|
||||
SQInteger Execute(bool reset)
|
||||
{
|
||||
return static_cast< SQInteger >(execute(reset));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Executes the statement asynchronously.
|
||||
*/
|
||||
SqDataStatement & ExecuteAsync(bool reset)
|
||||
{
|
||||
executeAsync(reset);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Waits for the execution completion for asynchronous statements or returns immediately for synchronous ones.
|
||||
*/
|
||||
SQInteger Wait(SQInteger milliseconds)
|
||||
{
|
||||
return static_cast< SQInteger >(wait(static_cast< long >(milliseconds)));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Resets the Statement so that it can be filled with a new SQL command.
|
||||
*/
|
||||
SqDataStatement & Reset(SqDataSession & session)
|
||||
{
|
||||
reset(session);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & Use(LightObj & obj)
|
||||
{
|
||||
return UseEx(obj, String(), Poco::Data::AbstractBinding::PD_IN);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & UseAs(LightObj & obj, StackStrF & name)
|
||||
{
|
||||
return UseEx(obj, String(name.mPtr, name.GetSize()), Poco::Data::AbstractBinding::PD_IN);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & UseEx(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & Bind(LightObj & obj)
|
||||
{
|
||||
return BindEx(obj, String(), Poco::Data::AbstractBinding::PD_IN);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & BindAs(LightObj & obj, StackStrF & name)
|
||||
{
|
||||
return BindEx(obj, String(name.mPtr, name.GetSize()), Poco::Data::AbstractBinding::PD_IN);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SqDataStatement & BindEx(LightObj & obj, const std::string & name, Poco::Data::AbstractBinding::Direction dir);
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < class T > inline SqDataBinding< T > & SqDataBinding< T >::Bind(SqDataStatement & stmt)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template < class T > inline SqDataBinding< T > & SqDataBinding< T >::BindAs(SqDataStatement & stmt, StackStrF & name)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
18
module/PocoLib/Foundation.cpp
Normal file
18
module/PocoLib/Foundation.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/Foundation.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_Foundation(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
RootTable(vm).Bind(_SC("SqPOCO"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/Foundation.hpp
Normal file
11
module/PocoLib/Foundation.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
18
module/PocoLib/JSON.cpp
Normal file
18
module/PocoLib/JSON.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/JSON.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_JSON(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
RootTable(vm).Bind(_SC("SqJSON"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/JSON.hpp
Normal file
11
module/PocoLib/JSON.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
18
module/PocoLib/Net.cpp
Normal file
18
module/PocoLib/Net.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/Net.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_Net(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
RootTable(vm).Bind(_SC("SqNet"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/Net.hpp
Normal file
11
module/PocoLib/Net.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
16
module/PocoLib/Util.cpp
Normal file
16
module/PocoLib/Util.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/Util.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_Util(HSQUIRRELVM vm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/Util.hpp
Normal file
11
module/PocoLib/Util.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
18
module/PocoLib/XML.cpp
Normal file
18
module/PocoLib/XML.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "PocoLib/XML.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ================================================================================================
|
||||
void Register_POCO_XML(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
|
||||
RootTable(vm).Bind(_SC("SqXML"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
11
module/PocoLib/XML.hpp
Normal file
11
module/PocoLib/XML.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Common.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
Reference in New Issue
Block a user