LCOV - code coverage report
Current view: top level - eq/client - version.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 12 22 54.5 %
Date: 2014-06-18 Functions: 3 8 37.5 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com> 
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *  
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  * 
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include <eq/client/version.h>
      19             : #include <sstream>
      20             : 
      21             : #define QUOTE( string ) STRINGIFY( string )
      22             : #define STRINGIFY( foo ) #foo
      23             : 
      24             : namespace eq
      25             : {
      26             : 
      27           0 : uint32_t Version::getMajor() 
      28             : {
      29           0 :     return EQ_VERSION_MAJOR; 
      30             : }
      31           0 : uint32_t Version::getMinor()
      32             : {
      33           0 :     return EQ_VERSION_MINOR; 
      34             : }
      35           0 : uint32_t Version::getPatch() 
      36             : {
      37           0 :     return EQ_VERSION_PATCH; 
      38             : }
      39           9 : std::string Version::getRevision() 
      40             : {
      41           9 :     return std::string( QUOTE( EQ_VERSION_REVISION ));
      42             : }
      43           9 : uint32_t Version::getABI() 
      44             : {
      45           9 :     return EQ_VERSION_ABI; 
      46             : }
      47             : 
      48           0 : uint32_t Version::getInt()
      49             : {
      50             :     return ( EQ_VERSION_MAJOR * 10000 +
      51             :              EQ_VERSION_MINOR * 100   +
      52           0 :              EQ_VERSION_PATCH ); 
      53             : }
      54           0 : float Version::getFloat() 
      55             : {
      56             :     return ( EQ_VERSION_MAJOR +
      57             :              .01f   * EQ_VERSION_MINOR   +
      58           0 :              .0001f * EQ_VERSION_PATCH ); 
      59             : }
      60           9 : std::string Version::getString()
      61             : {
      62           9 :     std::ostringstream  version;
      63           9 :     version << EQ_VERSION_MAJOR << '.' << EQ_VERSION_MINOR << '.'
      64           9 :             << EQ_VERSION_PATCH;
      65             : 
      66          18 :     const std::string revision = getRevision();
      67           9 :     if( revision != "0" )
      68           9 :         version << '.' << revision;
      69             : 
      70          18 :     return version.str();
      71             : }
      72             : 
      73             : }

Generated by: LCOV version 1.10