libcamgm
ValueIntCheck.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | core library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: ValueIntCheck.hpp
15 
16  Author: Marius Tomaschewski
17  Maintainer: Marius Tomaschewski
18 
19  Purpose:
20 
21 /-*/
33 #ifndef CA_MGM_VALUE_INT_CHECK_HPP
34 #define CA_MGM_VALUE_INT_CHECK_HPP
35 
36 #include <ca-mgm/config.h>
37 #include <ca-mgm/CommonData.hpp>
38 #include <ca-mgm/ValueCheck.hpp>
39 #include <ca-mgm/String.hpp>
40 
41 
42 namespace CA_MGM_NAMESPACE
43 {
44 
45 // -------------------------------------------------------------------
53 {
54 public:
63  ValueIntCheck(uint64_t minValue,
64  uint64_t maxValue,
65  bool inclusiveRange = true);
66 
75  ValueIntCheck(int64_t minValue,
76  int64_t maxValue,
77  bool inclusiveRange = true);
78 
100  ValueIntCheck(int minValue,
101  int maxValue,
102  bool inclusiveRange = true);
103 
113  virtual bool
114  isValid(const std::string &value) const;
115 
122  virtual std::string
123  explain(const std::string &value) const;
124 
125 private:
126  bool m_sign;
127  bool m_incl;
128  union {
129  int64_t s;
130  uint64_t u;
131  } m_min;
132  union {
133  int64_t s;
134  uint64_t u;
135  } m_max;
136 };
137 
138 
139 } // End of CA_MGM_NAMESPACE
140 
141 #endif // CA_MGM_VALUE_INT_CHECK_HPP
142 // vim: set ts=8 sts=8 sw=8 ai noet:
int64_t s
Definition: ValueIntCheck.hpp:129
uint64_t u
Definition: ValueIntCheck.hpp:130
Integer range value check.
Definition: ValueIntCheck.hpp:52
bool m_sign
Definition: ValueIntCheck.hpp:126
Utility classes to check a string value.
bool m_incl
Definition: ValueIntCheck.hpp:127
Base class to check a value.
Definition: ValueCheck.hpp:54