Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
JDATABASE::JDBAPIVersion Struct Reference

Auxiliary data structure for I/O of database API versions. More...

#include <JDBSupportkit.hh>

Inheritance diagram for JDATABASE::JDBAPIVersion:
JEEP::JVersion JLANG::JComparable< JFirst_t, JSecond_t > JLANG::JComparable< JFirst_t, JSecond_t >

Public Member Functions

 JDBAPIVersion ()
 Default constructor. More...
 
 JDBAPIVersion (const int major, const int minor, const int patch)
 Constructor. More...
 
bool is_valid () const
 Check validity. More...
 
int getMajorVersion () const
 Get major version. More...
 
int getMinorVersion () const
 Get minor version. More...
 
int getPatchVersion () const
 Get patch version. More...
 
bool less (const JVersion &object) const
 Compare database API version. More...
 

Static Public Attributes

static const char SEPARATOR = '.'
 

Protected Attributes

unsigned int majorVersion
 API major version. More...
 
unsigned int minorVersion
 API minor version. More...
 
unsigned int patchVersion
 API patch version. More...
 

Detailed Description

Auxiliary data structure for I/O of database API versions.

Definition at line 135 of file JDBSupportkit.hh.

Constructor & Destructor Documentation

JDATABASE::JDBAPIVersion::JDBAPIVersion ( )
inline

Default constructor.

Definition at line 142 of file JDBSupportkit.hh.

142  :
143  JVersion()
144  {}
JVersion()
Default constructor.
JDATABASE::JDBAPIVersion::JDBAPIVersion ( const int  major,
const int  minor,
const int  patch 
)
inline

Constructor.

Parameters
majormajor version
minorminor version
patchpatch version

Definition at line 154 of file JDBSupportkit.hh.

156  :
157  JVersion(major, minor, patch)
158  {}
JVersion()
Default constructor.

Member Function Documentation

bool JDATABASE::JDBAPIVersion::is_valid ( ) const
inline

Check validity.

Returns
true if valid; else false

Definition at line 166 of file JDBSupportkit.hh.

167  {
168  using namespace std;
169 
170  static const set<JVersion> versions{ JVersion(1, 0, 0),
171  JVersion(2, 0, 0) };
172 
173  for (set<JVersion>::const_iterator i = versions.cbegin(); i != versions.cend(); ++i) {
174 
175  if (i->getMajorVersion() == this->getMajorVersion() &&
176  i->getMinorVersion() == this->getMinorVersion() &&
177  i->getPatchVersion() == this->getPatchVersion()) {
178 
179  return true;
180  }
181  }
182 
183  return false;
184  }
int getMajorVersion() const
Get major version.
int getPatchVersion() const
Get patch version.
int getMinorVersion() const
Get minor version.
JVersion()
Default constructor.
int JEEP::JVersion::getMajorVersion ( ) const
inlineinherited

Get major version.

Returns
major version.

Definition at line 68 of file Jeep/JVersion.hh.

69  {
70  return majorVersion;
71  }
unsigned int majorVersion
API major version.
int JEEP::JVersion::getMinorVersion ( ) const
inlineinherited

Get minor version.

Returns
minor version.

Definition at line 79 of file Jeep/JVersion.hh.

80  {
81  return minorVersion;
82  }
unsigned int minorVersion
API minor version.
int JEEP::JVersion::getPatchVersion ( ) const
inlineinherited

Get patch version.

Returns
patch version.

Definition at line 90 of file Jeep/JVersion.hh.

91  {
92  return patchVersion;
93  }
unsigned int patchVersion
API patch version.
bool JEEP::JVersion::less ( const JVersion object) const
inlineinherited

Compare database API version.

Parameters
objecttrue if this version is less than given version; else false

Definition at line 101 of file Jeep/JVersion.hh.

102  {
103  if (this->majorVersion == object.majorVersion) {
104 
105  if (this->minorVersion == object.minorVersion) {
106 
107  return this->patchVersion < object.patchVersion;
108 
109  } else {
110 
111  return this->minorVersion < object.minorVersion;
112  }
113 
114  } else {
115 
116  return this->majorVersion < object.majorVersion;
117  }
118  }
unsigned int majorVersion
API major version.
unsigned int minorVersion
API minor version.
unsigned int patchVersion
API patch version.

Member Data Documentation

const char JEEP::JVersion::SEPARATOR = '.'
staticinherited

Definition at line 35 of file Jeep/JVersion.hh.

unsigned int JEEP::JVersion::majorVersion
protectedinherited

API major version.

Definition at line 174 of file Jeep/JVersion.hh.

unsigned int JEEP::JVersion::minorVersion
protectedinherited

API minor version.

Definition at line 175 of file Jeep/JVersion.hh.

unsigned int JEEP::JVersion::patchVersion
protectedinherited

API patch version.

Definition at line 176 of file Jeep/JVersion.hh.


The documentation for this struct was generated from the following file: