]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - include/irefcount.h
eol style
[xonotic/netradiant.git] / include / irefcount.h
index 2fc495adcb40a609f857b9749137c9ba23e650b5..e49e80d75f0f2e9fa79c2e9a2da3071bed9204f8 100644 (file)
@@ -1,62 +1,62 @@
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#ifndef __IREFCOUNT_H__\r
-#define __IREFCOUNT_H__\r
-\r
-/*!\r
-\class IRefCounted\r
-\brief reference counted objects\r
-\r
-general hints: how to use ref count properly\r
-  we consider ref counting as an extension of new and delete operators\r
-  the main issue is 'when to incref' 'when to decref'\r
-  in most cases connected to function calls\r
-  the general thinking about that:\r
-    - if you get a pointer to a refcounted object through a call to a function, assume that this object has been 'reserved' for you\r
-    already (i.e. allocated if you think this the new/delete way). so if you keep the object, you don't need to incref it, and if\r
-    you don't keep it you need to decref it.\r
-    - if you are called in a function and a refcounted object passed as parameter, then you should assume that this is an optional\r
-    object given to you FYI, which you don't need to decref if you don't keep / need to incref if you keep\r
-    \r
-  refcount is initialized to 1 in constructor. that serves for static objects and memory allocator\r
-  when you allocate in memory a ref counted object, it's default ref count will be 1, you should never delete it but just call DecRef on it\r
-  \r
-define an interface and an implementation macro to make things easier\r
-NOTE: we may have to provide a static library to go with that\r
-  in case we would move irecount.h out of here into libs/\r
-  \r
-\todo functionality needed:\r
-mostly enable/disable some features with compile time flags (independently from each other as much as possible)\r
-- log the destructor calls with != 0 ref count\r
-- log all incref/decref (with module info, and maybe even file/line number etc.?)\r
-*/\r
-class IRefCounted\r
-{\r
-  int refCount;\r
-public:\r
-  IRefCounted() { refCount = 1; }\r
-  virtual ~IRefCounted() { }\r
-  void IncRef() { refCount++; }\r
-  void DecRef() { refCount--; if (refCount <= 0) delete this; }\r
-};\r
-  \r
-#endif // __ISYNAPSE_H__\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef __IREFCOUNT_H__
+#define __IREFCOUNT_H__
+
+/*!
+\class IRefCounted
+\brief reference counted objects
+
+general hints: how to use ref count properly
+  we consider ref counting as an extension of new and delete operators
+  the main issue is 'when to incref' 'when to decref'
+  in most cases connected to function calls
+  the general thinking about that:
+    - if you get a pointer to a refcounted object through a call to a function, assume that this object has been 'reserved' for you
+    already (i.e. allocated if you think this the new/delete way). so if you keep the object, you don't need to incref it, and if
+    you don't keep it you need to decref it.
+    - if you are called in a function and a refcounted object passed as parameter, then you should assume that this is an optional
+    object given to you FYI, which you don't need to decref if you don't keep / need to incref if you keep
+    
+  refcount is initialized to 1 in constructor. that serves for static objects and memory allocator
+  when you allocate in memory a ref counted object, it's default ref count will be 1, you should never delete it but just call DecRef on it
+  
+define an interface and an implementation macro to make things easier
+NOTE: we may have to provide a static library to go with that
+  in case we would move irecount.h out of here into libs/
+  
+\todo functionality needed:
+mostly enable/disable some features with compile time flags (independently from each other as much as possible)
+- log the destructor calls with != 0 ref count
+- log all incref/decref (with module info, and maybe even file/line number etc.?)
+*/
+class IRefCounted
+{
+  int refCount;
+public:
+  IRefCounted() { refCount = 1; }
+  virtual ~IRefCounted() { }
+  void IncRef() { refCount++; }
+  void DecRef() { refCount--; if (refCount <= 0) delete this; }
+};
+  
+#endif // __ISYNAPSE_H__