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 "vtkStringScanner.h" // for vtk::from_chars
19 
20 #include <string>
21 
23 {
25 
28 const std::string FILE_SERIES_VERSION = "1.0";
29 constexpr int FILE_SERIES_VERSION_MAJ = 1;
30 constexpr int FILE_SERIES_VERSION_MIN = 0;
32 
37 inline bool CheckVersion(const std::string& version)
38 {
39  size_t pos = version.find('.');
40  if (pos == std::string::npos)
41  {
42  return false;
43  }
44  int major, minor;
45  VTK_FROM_CHARS_IF_ERROR_RETURN(version.substr(0, pos), major, false);
46  if (major > FILE_SERIES_VERSION_MAJ)
47  {
48  return false;
49  }
50  if (version.size() < pos)
51  {
52  return false;
53  }
54  VTK_FROM_CHARS_IF_ERROR_RETURN(version.substr(pos + 1), minor, false);
55  if (minor > FILE_SERIES_VERSION_MIN)
56  {
57  return false;
58  }
59  return true;
60 }
61 }
62 
63 #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...