commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
164
include/engine/script/script_variant.cpp
Normal file
164
include/engine/script/script_variant.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "script/script_variant.h"
|
||||
#include "script/script_object.h"
|
||||
#include "script/script_vm.h"
|
||||
|
||||
using namespace GS::Script;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Variant::operator == (const Variant &b) const
|
||||
{
|
||||
return
|
||||
(
|
||||
(type == b.type) &&
|
||||
(variant == b.variant) &&
|
||||
(object_owner == b.object_owner) &&
|
||||
(object == b.object) &&
|
||||
(ptr == b.ptr) &&
|
||||
(typetag == b.typetag)
|
||||
);
|
||||
}
|
||||
bool Variant::operator != (const Variant &b) const
|
||||
{ return !(*this == b); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Variant::Set()
|
||||
{
|
||||
type = Type_None;
|
||||
if (object_owner)
|
||||
_safe_delete(object);
|
||||
object = NULL;
|
||||
}
|
||||
void Variant::Set(bool v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
}
|
||||
void Variant::Set(int v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
}
|
||||
void Variant::Set(uint v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = (int)v;
|
||||
}
|
||||
void Variant::Set(float v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
}
|
||||
void Variant::Set(const char *v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
}
|
||||
void Variant::Set(const GS::Variant &v)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
}
|
||||
void Variant::Set(Object *o, bool own)
|
||||
{
|
||||
Set();
|
||||
type = Type_ScriptObject;
|
||||
object_owner = own;
|
||||
object = o;
|
||||
}
|
||||
void Variant::Set(const void *p, size_t size)
|
||||
{
|
||||
Set();
|
||||
type = Type_Variant;
|
||||
variant.SetBinary(p, size);
|
||||
}
|
||||
void Variant::Set(void *_ptr, uint _ptr_id)
|
||||
{
|
||||
Set();
|
||||
type = Type_UserObject;
|
||||
ptr = _ptr;
|
||||
typetag = _ptr_id;
|
||||
object = NULL;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Variant::Variant()
|
||||
{
|
||||
type = Type_None;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(const GS::Variant &v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(bool v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(int v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(uint v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = (int)v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(float v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(const char *v)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant = v;
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(Object *o, bool own)
|
||||
{
|
||||
type = Type_ScriptObject;
|
||||
object_owner = own;
|
||||
object = o;
|
||||
}
|
||||
Variant::Variant(const void *_ptr, size_t size)
|
||||
{
|
||||
type = Type_Variant;
|
||||
variant.SetBinary(_ptr, size);
|
||||
object = NULL;
|
||||
}
|
||||
Variant::Variant(void *_ptr, uint _ptr_id)
|
||||
{
|
||||
type = Type_UserObject;
|
||||
ptr = _ptr;
|
||||
typetag = _ptr_id;
|
||||
object = NULL;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Variant::~Variant()
|
||||
{ Set(); }
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user