1 /*
2  *  Created by Phil on 14/11/2012.
3  *  Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 
9 #include "catch_version.h"
10 #include <ostream>
11 
12 namespace Catch {
13 
Version(unsigned int _majorVersion,unsigned int _minorVersion,unsigned int _patchNumber,char const * const _branchName,unsigned int _buildNumber)14     Version::Version
15         (   unsigned int _majorVersion,
16             unsigned int _minorVersion,
17             unsigned int _patchNumber,
18             char const * const _branchName,
19             unsigned int _buildNumber )
20     :   majorVersion( _majorVersion ),
21         minorVersion( _minorVersion ),
22         patchNumber( _patchNumber ),
23         branchName( _branchName ),
24         buildNumber( _buildNumber )
25     {}
26 
operator <<(std::ostream & os,Version const & version)27     std::ostream& operator << ( std::ostream& os, Version const& version ) {
28         os  << version.majorVersion << '.'
29             << version.minorVersion << '.'
30             << version.patchNumber;
31         // branchName is never null -> 0th char is \0 if it is empty
32         if (version.branchName[0]) {
33             os << '-' << version.branchName
34                << '.' << version.buildNumber;
35         }
36         return os;
37     }
38 
libraryVersion()39     Version const& libraryVersion() {
40         static Version version( 2, 11, 2, "", 0 );
41         return version;
42     }
43 
44 }
45