1 #ifndef INC_RefCount_hpp__
2 #define INC_RefCount_hpp__
12 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
23 Ref(T* p) : ptr(p), count(1) {}
34 : ref(p ? new
Ref(p) : 0)
38 : ref(other.ref ? other.ref->increment() : 0)
43 if (ref && ref->decrement())
49 if (ref && ref->decrement())
57 return ref ? ref->
ptr : 0;
62 return ref ? ref->ptr : 0;
67 return ref ? ref->ptr : 0;
76 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
Definition: RefCount.hpp:17
struct RefCount::Ref * ref
~RefCount()
Definition: RefCount.hpp:41
RefCount(T *p=0)
Definition: RefCount.hpp:33
RefCount< T > & operator=(const RefCount< T > &other)
Definition: RefCount.hpp:46
RefCount(const RefCount< T > &other)
Definition: RefCount.hpp:37
T * operator->() const
Definition: RefCount.hpp:60
T * get() const
Definition: RefCount.hpp:65
#define ANTLR_API
Definition: config.hpp:22
Definition: ANTLRException.hpp:15
Definition: RefCount.hpp:19
bool decrement()
Definition: RefCount.hpp:26
Ref(T *p)
Definition: RefCount.hpp:23
T *const ptr
Definition: RefCount.hpp:20
Ref * increment()
Definition: RefCount.hpp:25
Ref & operator=(const Ref &)
~Ref()
Definition: RefCount.hpp:24
unsigned int count
Definition: RefCount.hpp:21