Audacity 3.2.0
Functions
XMLAttributeValueView.cpp File Reference
#include "XMLAttributeValueView.h"
#include "FromChars.h"
#include <numeric>
Include dependency graph for XMLAttributeValueView.cpp:

Go to the source code of this file.

Functions

template<typename ResultType >
bool CheckInteger (ResultType &output, int64_t value) noexcept
 
template<typename ResultType >
bool CheckInteger (ResultType &output, uint64_t value) noexcept
 

Function Documentation

◆ CheckInteger() [1/2]

template<typename ResultType >
bool CheckInteger ( ResultType &  output,
int64_t  value 
)
noexcept

Definition at line 288 of file XMLAttributeValueView.cpp.

289{
290 constexpr int64_t minValue = std::numeric_limits<ResultType>::min();
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}
int min(int a, int b)

References min().

Referenced by XMLAttributeValueView::TryGetInteger().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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}