Browse Source

add Space::to_float(...), to_double(...) and to_long_double(...) methods

master
Tomasz Sowa 5 months ago
parent
commit
a524dfa2a7
  1. 21
      src/space/space.cpp
  2. 4
      src/space/space.h

21
src/space/space.cpp

@ -1277,6 +1277,27 @@ unsigned long long Space::to_ulong_long(const wchar_t * field, unsigned long lon
return space ? space->to_ulong_long() : default_value;
}
float Space::to_float(const wchar_t * field, float default_value) const
{
const Space * space = get_space(field);
return space ? space->to_float() : default_value;
}
double Space::to_double(const wchar_t * field, double default_value) const
{
const Space * space = get_space(field);
return space ? space->to_double() : default_value;
}
long double Space::to_long_double(const wchar_t * field, long double default_value) const
{
const Space * space = get_space(field);
return space ? space->to_long_double() : default_value;
}
std::string Space::to_str(const wchar_t * field, const char * default_value) const
{
const Space * space = get_space(field);

4
src/space/space.h

@ -387,6 +387,10 @@ public:
unsigned long to_ulong(const wchar_t * field, unsigned long default_value = 0) const;
unsigned long long to_ullong(const wchar_t * field, unsigned long long default_value = 0) const;
unsigned long long to_ulong_long(const wchar_t * field, unsigned long long default_value = 0) const;
float to_float(const wchar_t * field, float default_value = 0.0f) const;
double to_double(const wchar_t * field, double default_value = 0.0) const;
long double to_long_double(const wchar_t * field, long double default_value = 0.0L) const;
std::string to_str(const wchar_t * field, const char * default_value = nullptr) const;
std::string to_str(const wchar_t * field, const std::string & default_value) const;
std::wstring to_wstr(const wchar_t * field, const wchar_t * default_value = nullptr) const;

Loading…
Cancel
Save