vtkFileSeriesUtilities.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
3 
15 #ifndef vtkFileSeriesUtilities_h
16 #define vtkFileSeriesUtilities_h
17 
18 #include <string>
19 
21 {
23 
26 const std::string FILE_SERIES_VERSION = "1.0";
27 constexpr int FILE_SERIES_VERSION_MAJ = 1;
28 constexpr int FILE_SERIES_VERSION_MIN = 0;
30 
35 inline bool CheckVersion(const std::string& version)
36 {
37  size_t pos = version.find('.');
38  if (pos == std::string::npos)
39  {
40  return false;
41  }
42  if (std::atoi(version.substr(0, pos).c_str()) > FILE_SERIES_VERSION_MAJ)
43  {
44  return false;
45  }
46  if (version.size() < pos)
47  {
48  return false;
49  }
50  if (std::atoi(version.substr(pos + 1).c_str()) > FILE_SERIES_VERSION_MIN)
51  {
52  return false;
53  }
54  return true;
55 }
56 }
57 
58 #endif
const std::string FILE_SERIES_VERSION
Const variable describing the file series version currently in use.
constexpr int FILE_SERIES_VERSION_MAJ
Const variable describing the file series version currently in use.
constexpr int FILE_SERIES_VERSION_MIN
Const variable describing the file series version currently in use.
bool CheckVersion(const std::string &version)
Inline method to check a provided version against current version in use Return true if current versi...