[opengtl-commits] [232] * split Macros in to two files |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 232
Author: cyrille
Date: 2008-06-25 21:44:41 +0200 (Wed, 25 Jun 2008)
Log Message:
-----------
* split Macros in to two files
* add STATIC_DELETER
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/Macros.h
Added Paths:
-----------
trunk/OpenGTL/OpenGTL/GTLCore/Macros_p.h
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Macros.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Macros.h 2008-06-25 19:43:30 UTC (rev 231)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Macros.h 2008-06-25 19:44:41 UTC (rev 232)
@@ -20,6 +20,33 @@
#ifndef _GTLCORE_MACROS_H_
#define _GTLCORE_MACROS_H_
+/**
+ * The GTL_DEPRECATED macro can be used to trigger compile-time warnings when a deprecated
+ * functions are used.
+ *
+ * For non-inline functions, the macro has to be inserted at the end of the declaration like in :
+ * @code
+ * DeprecatedConstructor() GTL_DEPRECATED;
+ * void deprecatedFunction() const GTL_DEPRECATED;
+ * @endcode
+ *
+ * For inline functions, the macro has to be inserted before the declartion but after virtual or
+ * static keywoard, like in :
+ * @code
+ * GTL_DEPRECATED void deprecatedInline() { ... }
+ * virtual GTL_DEPRECATED int depreactedInline() { ... }
+ * static GTL_DEPRECATED char* deprecatedInline() { ... }
+ * @endcode
+ *
+ * You can declare a class or struct to be deprecated :
+ * @code
+ * class GTL_DEPRECATED deprecatedClass { };
+ * struct GTL_DEPRECATED deprecatedStruct { };
+ * @endcode
+ *
+ * @ingroup GTLCore
+ */
+
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2))
# define GTL_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
@@ -28,28 +55,4 @@
# define GTL_DEPRECATED
#endif
-/**
- * Allows to execute code at library initialisation.
- *
- * @code
- * class CoolObject {};
- * static std::vector\<CoolObject*\> staticCoolInstances;
- * STATIC_INITIALISATION( CoolObjects )
- * {
- * for(int i =0; i < 10; ++i)
- * staticCoolInstances.push_back( new CoolObject() );
- * }
- * @endcode
- *
- * This will create a CoolObjectsFactory that you can use
- * to declare a friend class.
- */
-#define STATIC_INITIALISATION(_name_) \
- class _name_##Factory { \
- public: \
- _name_##Factory(); \
- }; \
- _name_##Factory instance##_name_ ; \
- _name_##Factory::_name_##Factory()
-
#endif
Copied: trunk/OpenGTL/OpenGTL/GTLCore/Macros_p.h (from rev 188, trunk/OpenGTL/OpenGTL/GTLCore/Macros.h)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Macros_p.h (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Macros_p.h 2008-06-25 19:44:41 UTC (rev 232)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GTLCORE_MACROS_P_H_
+#define _GTLCORE_MACROS_P_H_
+
+/**
+ * @internal
+ *
+ * Allows to execute code at library initialisation.
+ *
+ * @code
+ * class CoolObject {};
+ * static std::vector\<CoolObject*\> staticCoolInstances;
+ * STATIC_INITIALISATION( CoolObjects )
+ * {
+ * for(int i =0; i < 10; ++i)
+ * staticCoolInstances.push_back( new CoolObject() );
+ * }
+ * @endcode
+ *
+ * This will create a CoolObjectsFactory that you can use
+ * to declare a friend class.
+ *
+ * @ingroup GTLCore
+ */
+#define STATIC_INITIALISATION(_name_) \
+ class _name_##Factory { \
+ public: \
+ _name_##Factory(); \
+ }; \
+ _name_##Factory instance##_name_ ; \
+ _name_##Factory::_name_##Factory()
+
+
+/**
+ * @internal
+ *
+ * Allows to execute code at library deletion.
+ *
+ * @code
+ * class CoolObject {};
+ * static std::vector\<CoolObject*\> staticCoolInstances;
+ * STATIC_DELETER( CoolObjects )
+ * {
+ * for(int i =0; i \< staticCoolInstances.size(); ++i)
+ * delete staticCoolInstances[i];
+ * }
+ * @endcode
+ *
+ * This will create a CoolObjectsDeleter that you can use
+ * to declare a friend class.
+ *
+ * @ingroup GTLCore
+ */
+#define STATIC_DELETER( _name_ ) \
+ class _name_##Deleter { \
+ public: \
+ _name_##Deleter() {} \
+ ~_name_##Deleter(); \
+ }; \
+ _name_##Deleter instance##_name_ ; \
+ _name_##Deleter::~_name_##Deleter()
+
+
+#endif