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

Class Pointer

include/cpp/Pointer.h:203–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202template<typename T>
203class Pointer
204{
205public:
206 typedef T elementType;
207
208 T *ptr;
209
210 inline Pointer( ) : ptr(0) { }
211 inline Pointer( const Pointer &inRHS ) : ptr(inRHS.ptr) { }
212 inline Pointer( const Dynamic &inRHS) { ptr = inRHS==null()?0: (T*)inRHS->__GetHandle(); }
213 inline Pointer( const null &inRHS ) : ptr(0) { }
214 inline Pointer( const cpp::Variant &inVariant ) {
215 hx::Object *obj = inVariant.asObject();
216 ptr = obj ? (T*)inVariant.valObject->__GetHandle() : 0;
217 }
218 inline Pointer(const ::cpp::marshal::PointerReference<T>);
219
220 template<typename O>
221 inline Pointer( const O *inValue ) : ptr( (T*) inValue) { }
222 //inline Pointer( T *inValue ) : ptr(inValue) { }
223 inline Pointer( AutoCast inValue ) : ptr( (T*)inValue.value) { }
224
225 template<typename H>
226 inline Pointer( const Struct<T,H> &structVal ) : ptr( &structVal.value ) { }
227
228 template<typename O>
229 inline void setRaw(const O *inValue ) { ptr = (T*) inValue; }
230
231
232 inline Pointer operator=( const Pointer &inRHS ) { return ptr = inRHS.ptr; }
233 inline Dynamic operator=( Dynamic &inValue )
234 {
235 ptr = inValue==null() ? 0 : (T*) inValue->__GetHandle();
236 return inValue;
237 }
238 inline Dynamic operator=( null &inValue ) { ptr=0; return inValue; }
239
240 template<typename O>
241 inline Pointer operator=( const Pointer<O> &inValue ) { ptr = (T*) inValue.ptr; return *this; }
242
243 template<typename O>
244 inline Pointer operator=( const O *inValue ) { ptr = (T*) inValue; return *this; }
245
246 template<typename H>
247 inline Pointer operator=( const Struct<T,H> &structVal ) { ptr = &structVal.value; return *this; }
248
249
250
251 inline AutoCast reinterpret() { return AutoCast(ptr); }
252 inline RawAutoCast rawCast() { return RawAutoCast(ptr); }
253
254 inline bool operator==( const null &inValue ) const { return ptr==0; }
255 inline bool operator!=( const null &inValue ) const { return ptr!=0; }
256
257 // Allow '->' syntax
258 inline Pointer *operator->() { return this; }
259 inline Pointer inc() { return ++ptr; }
260 inline Pointer dec() { return --ptr; }

Callers

nothing calls this directly

Calls 1

CreateDynamicPointerFunction · 0.85

Tested by

no test coverage detected