MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / FieldRef

Class FieldRef

include/hx/FieldRef.h:34–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 { return this->operator ::Dynamic() op inA.operator ::Dynamic(); } \
33
34class FieldRef
35{
36public:
37 explicit FieldRef(hx::Object *inObj,const String &inName) : mObject(inObj), mName(inName)
38 {
39 }
40
41 hx::Val operator=(const hx::Val &inRHS)
42 {
43 return mObject->__SetField(mName,inRHS, HX_PROP_DYNAMIC );
44 }
45 inline operator hx::Val() const { return mObject ? mObject->__Field(mName, HX_PROP_DYNAMIC) : null(); }
46 inline operator Dynamic() const { return mObject ? Dynamic(mObject->__Field(mName, HX_PROP_DYNAMIC)) : null(); }
47 inline operator double() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
48 inline operator float() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
49 inline operator int() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
50 inline operator cpp::UInt64() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
51 inline operator cpp::Int64() const { return mObject->__Field(mName, HX_PROP_DYNAMIC); }
52
53
54 // post-increment
55 inline double operator++(int)
56 {
57 double d = mObject->__Field(mName, HX_PROP_DYNAMIC);
58 mObject->__SetField(mName,d+1, HX_PROP_DYNAMIC);
59 return d;
60 }
61 // pre-increment
62 inline double operator++()
63 {
64 double d = ((double)mObject->__Field(mName, HX_PROP_DYNAMIC)) + 1;
65 mObject->__SetField(mName,d, HX_PROP_DYNAMIC);
66 return d;
67 }
68 // post-decrement
69 inline double operator--(int)
70 {
71 double d = mObject->__Field(mName, HX_PROP_DYNAMIC);
72 mObject->__SetField(mName,d-1, HX_PROP_DYNAMIC);
73 return d;
74 }
75 // pre-decrement
76 inline double operator--()
77 {
78 double d = (double)(mObject->__Field(mName, HX_PROP_DYNAMIC)) - 1;
79 mObject->__SetField(mName,d, HX_PROP_DYNAMIC);
80 return d;
81 }
82 bool operator !() { return ! ((int)(mObject->__Field(mName, HX_PROP_DYNAMIC))); }
83 int operator ~() { return ~ ((int)mObject->__Field(mName, HX_PROP_DYNAMIC)); }
84
85 inline bool operator==(const null &) const { return !mObject; }
86 inline bool operator!=(const null &) const { return mObject; }
87
88 double operator -() { return - (double)(mObject->__Field(mName, HX_PROP_DYNAMIC)); }
89
90 bool HasPointer() const { return mObject; }
91

Callers 1

FieldRefMethod · 0.70

Calls 3

nullClass · 0.50
DynamicClass · 0.50
__FieldMethod · 0.45

Tested by

no test coverage detected