42 #include "transform.h" 46 #include "simple_type.h" 47 #include "os/input_event.h" 53 #include "io/ip_address.h" 54 #include "dictionary.h" 138 _FORCE_INLINE_ ObjData& _get_obj();
139 _FORCE_INLINE_
const ObjData& _get_obj()
const;
154 #ifdef USE_QUAD_VECTORS 155 uint8_t _mem[
sizeof(ObjData) > (
sizeof(real_t)*5) ?
sizeof(ObjData) : (
sizeof(real_t)*5)];
157 uint8_t _mem[
sizeof(ObjData) > (
sizeof(real_t)*4) ?
sizeof(ObjData) : (
sizeof(real_t)*4)];
162 void reference(
const Variant& p_variant);
166 _FORCE_INLINE_ Type get_type()
const {
return type; }
167 static String get_type_name(Variant::Type p_type);
168 static bool can_convert(Type p_type_from, Type p_type_to);
169 static bool can_convert_strict(Type p_type_from, Type p_type_to);
174 static Type get_type_for() {
178 Type r = v.get_type();
184 _FORCE_INLINE_
bool is_num()
const {
return type==INT || type==REAL; };
185 _FORCE_INLINE_
bool is_array()
const {
return type>=ARRAY; };
186 bool is_shared()
const;
187 bool is_zero()
const;
190 operator bool()
const;
191 operator signed int()
const;
192 operator unsigned int()
const;
193 operator signed short()
const;
194 operator unsigned short()
const;
195 operator signed char()
const;
196 operator unsigned char()
const;
198 operator int64_t()
const;
199 operator uint64_t()
const;
201 operator signed long()
const;
202 operator unsigned long()
const;
205 #ifndef CHARTYPE_16BITS 206 operator CharType()
const;
208 operator float()
const;
209 operator double()
const;
213 operator Rect2()
const;
215 operator Plane()
const;
216 operator AABB()
const;
217 operator Quat()
const;
222 operator Color()
const;
223 operator Image()
const;
226 operator RID()
const;
229 operator Node*()
const;
233 operator Array()
const;
258 operator Margin()
const;
259 operator Orientation()
const;
273 Variant(
unsigned short p_short);
282 Variant(
const char *
const p_cstring);
283 Variant(
const CharType * p_wstring);
300 Variant(
const Dictionary& p_dictionary);
365 static String get_operator_name(Operator p_op);
366 static void evaluate(
const Operator& p_op,
const Variant& p_a,
const Variant& p_b,
Variant &r_ret,
bool &r_valid);
367 static _FORCE_INLINE_
Variant evaluate(
const Operator& p_op,
const Variant& p_a,
const Variant& p_b) {
371 evaluate(p_op,p_a,p_b,res,valid);
382 CALL_ERROR_INVALID_METHOD,
383 CALL_ERROR_INVALID_ARGUMENT,
384 CALL_ERROR_TOO_MANY_ARGUMENTS,
385 CALL_ERROR_TOO_FEW_ARGUMENTS,
386 CALL_ERROR_INSTANCE_IS_NULL,
398 static Variant construct(
const Variant::Type,
const Variant** p_args,
int p_argcount,
CallError &r_error,
bool p_strict=
true);
401 bool has_method(
const StringName& p_method)
const;
403 void set_named(
const StringName& p_index,
const Variant& p_value,
bool *r_valid=NULL);
406 void set(
const Variant& p_index,
const Variant& p_value,
bool *r_valid=NULL);
408 bool in(
const Variant& p_index,
bool *r_valid=NULL)
const;
410 bool iter_init(
Variant& r_iter,
bool &r_valid)
const;
411 bool iter_next(
Variant& r_iter,
bool &r_valid)
const;
418 bool operator==(
const Variant& p_variant)
const;
419 bool operator!=(
const Variant& p_variant)
const;
420 bool operator<(
const Variant& p_variant)
const;
421 uint32_t hash()
const;
423 bool booleanize(
bool &valid)
const;
425 void static_assign(
const Variant& p_variant);
426 static void get_constructor_list(Variant::Type p_type,
List<MethodInfo> *p_list);
427 static void get_numeric_constants_for_type(Variant::Type p_type,
List<StringName> *p_constants);
428 static bool has_numeric_constant(Variant::Type p_type,
const StringName& p_value);
429 static int get_numeric_constant_value(Variant::Type p_type,
const StringName& p_value);
431 typedef String (*ObjectDeConstruct)(
const Variant& p_object,
void *ud);
432 typedef void (*ObjectConstruct)(
const String& p_text,
void *ud,
Variant& r_value);
434 String get_construct_string()
const;
435 static void construct_from_string(
const String& p_string,
Variant& r_value,ObjectConstruct p_obj_construct=NULL,
void *p_construct_ud=NULL);
437 void operator=(
const Variant& p_variant);
439 _FORCE_INLINE_
Variant() { type=NIL; }
440 _FORCE_INLINE_ ~
Variant() {
if (type!=Variant::NIL) clear(); }
458 static _FORCE_INLINE_ uint32_t hash(
const Variant &p_variant) {
return p_variant.hash(); }
462 Variant::ObjData& Variant::_get_obj() {
464 return *
reinterpret_cast<ObjData*
>(&_data._mem[0]);
467 const Variant::ObjData& Variant::_get_obj()
const {
469 return *
reinterpret_cast<const ObjData*
>(&_data._mem[0]);
Definition: math_2d.h:204
Definition: variant.h:456
Definition: string_db.h:48
Definition: dictionary.h:42
Definition: math_2d.h:554
Definition: ip_address.h:34
Definition: simple_type.h:35
Definition: variant_call.cpp:42
Definition: variant.h:379