00001 /* 00002 http://code.google.com/p/ticpp/ 00003 Copyright (c) 2006 Ryan Pusztai, Ryan Mulder 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 00009 the Software, and to permit persons to whom the Software is furnished to do so, 00010 subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 00017 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 00018 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 00019 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00021 */ 00022 00023 #ifdef TIXML_USE_TICPP 00024 00025 #ifndef TICPPRC_INCLUDED 00026 #define TICPPRC_INCLUDED 00027 00028 00029 // Forward declare ticpp::Node, so it can be made a friend of TiCppRC 00030 namespace ticpp 00031 { 00032 class Base; 00033 } 00034 00035 // Forward declare TiCppRCImp so TiCppRC can hold a pointer to it 00036 class TiCppRCImp; 00037 00041 class TiCppRC 00042 { 00043 // Allow ticpp::Node to directly modify reference count 00044 friend class ticpp::Base; 00045 00046 private: 00047 00048 TiCppRCImp* m_tiRC; 00050 public: 00051 00056 TiCppRC(); 00057 00063 virtual ~TiCppRC(); 00064 }; 00065 00066 class TiCppRCImp 00067 { 00068 private: 00069 00070 int m_count; 00072 TiCppRC* m_tiCppRC; 00074 public: 00075 00079 TiCppRCImp( TiCppRC* tiCppRC ); 00080 00084 void Nullify(); 00085 00089 void IncRef(); 00090 00094 void DecRef(); 00095 00099 void InitRef(); 00100 00104 TiCppRC* Get(); 00105 00109 bool IsNull(); 00110 }; 00111 00112 #endif // TICPP_INCLUDED 00113 00114 #endif // TIXML_USE_TICPP