#include "XMLAttributeValueView.h"
#include "FromChars.h"
#include <numeric>
Go to the source code of this file.
|
template<typename ResultType > |
bool | CheckInteger (ResultType &output, int64_t value) noexcept |
|
template<typename ResultType > |
bool | CheckInteger (ResultType &output, uint64_t value) noexcept |
|
◆ CheckInteger() [1/2]
template<typename ResultType >
bool CheckInteger |
( |
ResultType & |
output, |
|
|
int64_t |
value |
|
) |
| |
|
noexcept |
Definition at line 288 of file XMLAttributeValueView.cpp.
289{
291 constexpr int64_t maxValue = std::numeric_limits<ResultType>::max();
292
293 if (minValue <= value && value <= maxValue)
294 {
295 output = static_cast<ResultType>(value);
296 return true;
297 }
298
299 return false;
300}
References min().
Referenced by XMLAttributeValueView::TryGetInteger().
◆ CheckInteger() [2/2]
template<typename ResultType >
bool CheckInteger |
( |
ResultType & |
output, |
|
|
uint64_t |
value |
|
) |
| |
|
noexcept |
Definition at line 303 of file XMLAttributeValueView.cpp.
304{
305 constexpr uint64_t maxValue = std::numeric_limits<ResultType>::max();
306 const uint64_t unsignedValue = static_cast<uint64_t>(value);
307
308 if (unsignedValue <= maxValue)
309 {
310 output = static_cast<ResultType>(unsignedValue);
311 return true;
312 }
313
314 return false;
315}