Changeset 8593
- Timestamp:
- 07/15/08 21:24:22
- Files:
-
- OpenSceneGraph/trunk/include/osgWidget/Version (modified) (1 diff)
- OpenSceneGraph/trunk/src/osgWidget/Version.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph/trunk/include/osgWidget/Version
r8588 r8593 9 9 extern "C" { 10 10 11 OSGWIDGET_EXPORT unsigned int osgWidgetGetMajorVersion (); 12 OSGWIDGET_EXPORT unsigned int osgWidgetGetMinorVersion (); 13 OSGWIDGET_EXPORT unsigned int osgWidgetGetPatchVersion (); 14 OSGWIDGET_EXPORT const char* osgWidgetGetExtraText (); 15 OSGWIDGET_EXPORT const char* osgWidgetGetVersion (); 16 OSGWIDGET_EXPORT const char* osgWidgetGetLibraryName (); 17 OSGWIDGET_EXPORT bool osgWidgetVersionMinimum (unsigned int, unsigned int, unsigned int); 18 OSGWIDGET_EXPORT bool osgWidgetVersionMaximum (unsigned int, unsigned int, unsigned int); 19 OSGWIDGET_EXPORT bool osgWidgetVersionRequired (unsigned int, unsigned int, unsigned int); 11 /** 12 * osgWidgetGetVersion() returns the library version number. 13 * Numbering convention : OpenSceneGraph-1.0 will return 1.0 from osgWidgetGetVersion. 14 * 15 * This C function can be also used to check for the existence of the OpenSceneGraph 16 * library using autoconf and its m4 macro AC_CHECK_LIB. 17 * 18 * Here is the code to add to your configure.in: 19 \verbatim 20 # 21 # Check for the OpenSceneGraph (OSG) Util library 22 # 23 AC_CHECK_LIB(osg, osgWidgetGetVersion, , 24 [AC_MSG_ERROR(OpenSceneGraph Util library not found. See http://www.openscenegraph.org)],) 25 \endverbatim 26 */ 27 extern OSGWIDGET_EXPORT const char* osgWidgetGetVersion(); 28 29 /** 30 * osgWidgetGetLibraryName() returns the library name in human friendly form. 31 */ 32 extern OSGWIDGET_EXPORT const char* osgWidgetGetLibraryName(); 20 33 21 34 } OpenSceneGraph/trunk/src/osgWidget/Version.cpp
r8588 r8593 2 2 // $Id: Version.cpp 64 2008-06-30 21:32:00Z cubicool $ 3 3 4 #include <sstream>5 4 #include <osgWidget/Version> 5 #include <osg/Version> 6 6 7 7 extern "C" { 8 8 9 const unsigned int OSGWIDGET_MAJOR_VERSION = 0; 10 const unsigned int OSGWIDGET_MINOR_VERSION = 1; 11 const unsigned int OSGWIDGET_PATCH_VERSION = 8; 12 const char* OSGWIDGET_EXTRA_TEXT = "(pre-merge)"; 13 14 unsigned int osgWidgetGetMajorVersion() { 15 return OSGWIDGET_MAJOR_VERSION; 9 const char* osgWidgetGetVersion() 10 { 11 return osgGetVersion(); 16 12 } 17 13 18 unsigned int osgWidgetGetMinorVersion() { 19 return OSGWIDGET_MINOR_VERSION; 20 } 21 22 unsigned int osgWidgetGetPatchVersion() { 23 return OSGWIDGET_PATCH_VERSION; 24 } 25 26 const char* osgWidgetGetExtraText() { 27 return OSGWIDGET_EXTRA_TEXT; 28 } 29 30 const char* osgWidgetGetVersion() { 31 static std::string version; 32 static bool versionInit = true; 33 34 if(versionInit) { 35 std::stringstream stream; 36 37 stream.str(std::string()); 38 39 stream 40 << OSGWIDGET_MAJOR_VERSION << "." 41 << OSGWIDGET_MINOR_VERSION << "." 42 << OSGWIDGET_PATCH_VERSION << " " 43 << OSGWIDGET_EXTRA_TEXT 44 ; 45 46 version = stream.str(); 47 versionInit = false; 48 } 49 50 return version.c_str(); 51 } 52 53 const char* osgWidgetGetLibraryName() { 54 static std::string name("OpenSceneGraph Widget Library"); 55 56 return name.c_str(); 57 } 58 59 bool osgWidgetVersionMinimum(unsigned int major, unsigned int minor, unsigned int patch) { 60 return 61 OSGWIDGET_MAJOR_VERSION >= major && 62 OSGWIDGET_MINOR_VERSION >= minor && 63 OSGWIDGET_PATCH_VERSION >= patch 64 ; 65 } 66 67 bool osgWidgetVersionMaximum(unsigned int major, unsigned int minor, unsigned int patch) { 68 return 69 // OSGWIDGET_MAJOR_VERSION <= major && 70 OSGWIDGET_MINOR_VERSION <= minor && 71 OSGWIDGET_PATCH_VERSION <= patch 72 ; 73 } 74 75 bool osgWidgetVersionRequired(unsigned int major, unsigned int minor, unsigned int patch) { 76 return 77 OSGWIDGET_MAJOR_VERSION == major && 78 OSGWIDGET_MINOR_VERSION == minor && 79 OSGWIDGET_PATCH_VERSION == patch 80 ; 14 const char* osgWidgetGetLibraryName() 15 { 16 return "OpenSceneGraph Widget Library"; 81 17 } 82 18
