MCPcopy Create free account
hub / github.com/anjo76/angelscript / CObj

Class CObj

sdk/tests/test_feature/source/test_constobject.cpp:13–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class CObj
14{
15public:
16 CObj() {refCount = 1; val = 0; next = 0;}
17 ~CObj() {if( next ) next->Release();}
18
19 CObj &operator=(CObj &other)
20 {
21 val = other.val;
22 if( next )
23 next->Release();
24 next = other.next;
25 if( next )
26 next->AddRef();
27 return *this;
28 };
29
30 void AddRef() {refCount++;}
31 void Release() {if( --refCount == 0 ) delete this;}
32
33 void SetVal(int _val) {this->val = _val;}
34 int GetVal() const {return val;}
35
36 int &operator[](int) {return val;}
37 const int &operator[](int) const {return val;}
38
39 int refCount;
40
41 int val;
42
43 CObj *next;
44};
45
46CObj *CObj_Factory()
47{

Callers

nothing calls this directly

Calls 2

ReleaseMethod · 0.45
AddRefMethod · 0.45

Tested by

no test coverage detected