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 #include <vector> 00029 00030 // Forward declare ticpp::Node, so it can be made a friend of TiCppRC 00031 namespace ticpp 00032 { 00033 class Base; 00034 } 00035 00036 // Forward declare TiCppRCImp so TiCppRC can hold a pointer to it 00037 class TiCppRCImp; 00038 00042 class TiCppRC 00043 { 00044 // Allow ticpp::Node to directly modify reference count 00045 friend class ticpp::Base; 00046 00047 private: 00048 00049 TiCppRCImp* m_tiRC; 00051 public: 00052 00057 TiCppRC(); 00058 00064 virtual ~TiCppRC(); 00065 00066 std::vector< ticpp::Base* > m_spawnedWrappers; 00071 void DeleteSpawnedWrappers(); 00072 }; 00073 00074 class TiCppRCImp 00075 { 00076 private: 00077 00078 int m_count; 00080 TiCppRC* m_tiCppRC; 00082 public: 00083 00087 TiCppRCImp( TiCppRC* tiCppRC ); 00088 00092 void Nullify(); 00093 00097 void IncRef(); 00098 00102 void DecRef(); 00103 00107 void InitRef(); 00108 00112 TiCppRC* Get(); 00113 00117 bool IsNull(); 00118 }; 00119 00120 #endif // TICPP_INCLUDED 00121 00122 #endif // TIXML_USE_TICPP