mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Fix PropertyStream overloads
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "../intrusive/List.h"
|
||||
#include "../threads/SharedData.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -51,6 +52,11 @@ protected:
|
||||
|
||||
virtual void add (std::string const& key, std::string const& value) = 0;
|
||||
|
||||
void add (std::string const& key, char const* value)
|
||||
{
|
||||
add (key, std::string (value));
|
||||
}
|
||||
|
||||
template <typename Value>
|
||||
void lexical_add (std::string const &key, Value value)
|
||||
{
|
||||
@@ -58,11 +64,27 @@ protected:
|
||||
ss << value;
|
||||
add (key, ss.str());
|
||||
}
|
||||
virtual void add (std::string const& key, int32 value);
|
||||
virtual void add (std::string const& key, uint32 value);
|
||||
virtual void add (std::string const& key, int64 value);
|
||||
virtual void add (std::string const& key, uint64 value);
|
||||
virtual void add (std::string const& key, double value);
|
||||
|
||||
virtual void add (std::string const& key, bool value);
|
||||
virtual void add (std::string const& key, char value);
|
||||
virtual void add (std::string const& key, signed char value);
|
||||
virtual void add (std::string const& key, unsigned char value);
|
||||
virtual void add (std::string const& key, wchar_t value);
|
||||
#if 0
|
||||
virtual void add (std::string const& key, char16_t value);
|
||||
virtual void add (std::string const& key, char32_t value);
|
||||
#endif
|
||||
virtual void add (std::string const& key, short value);
|
||||
virtual void add (std::string const& key, unsigned short value);
|
||||
virtual void add (std::string const& key, int value);
|
||||
virtual void add (std::string const& key, unsigned int value);
|
||||
virtual void add (std::string const& key, long value);
|
||||
virtual void add (std::string const& key, unsigned long value);
|
||||
virtual void add (std::string const& key, long long value);
|
||||
virtual void add (std::string const& key, unsigned long long value);
|
||||
virtual void add (std::string const& key, float value);
|
||||
virtual void add (std::string const& key, double value);
|
||||
virtual void add (std::string const& key, long double value);
|
||||
|
||||
virtual void array_begin () = 0;
|
||||
virtual void array_begin (std::string const& key) = 0;
|
||||
@@ -70,6 +92,11 @@ protected:
|
||||
|
||||
virtual void add (std::string const& value) = 0;
|
||||
|
||||
void add (char const* value)
|
||||
{
|
||||
add (std::string (value));
|
||||
}
|
||||
|
||||
template <typename Value>
|
||||
void lexical_add (Value value)
|
||||
{
|
||||
@@ -77,10 +104,27 @@ protected:
|
||||
ss << value;
|
||||
add (ss.str());
|
||||
}
|
||||
virtual void add ( int32 value);
|
||||
virtual void add (uint32 value);
|
||||
virtual void add ( int64 value);
|
||||
virtual void add (uint64 value);
|
||||
|
||||
virtual void add (bool value);
|
||||
virtual void add (char value);
|
||||
virtual void add (signed char value);
|
||||
virtual void add (unsigned char value);
|
||||
virtual void add (wchar_t value);
|
||||
#if 0
|
||||
virtual void add (char16_t value);
|
||||
virtual void add (char32_t value);
|
||||
#endif
|
||||
virtual void add (short value);
|
||||
virtual void add (unsigned short value);
|
||||
virtual void add (int value);
|
||||
virtual void add (unsigned int value);
|
||||
virtual void add (long value);
|
||||
virtual void add (unsigned long value);
|
||||
virtual void add (long long value);
|
||||
virtual void add (unsigned long long value);
|
||||
virtual void add (float value);
|
||||
virtual void add (double value);
|
||||
virtual void add (long double value);
|
||||
|
||||
private:
|
||||
class Item;
|
||||
|
||||
@@ -414,27 +414,89 @@ PropertyStream::~PropertyStream ()
|
||||
{
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, int32 value)
|
||||
void PropertyStream::add (std::string const& key, bool value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, uint32 value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, int64 value)
|
||||
{
|
||||
if (value <= std::numeric_limits <int32>::max() &&
|
||||
value >= std::numeric_limits <int32>::min())
|
||||
{
|
||||
add (key, int32(value));
|
||||
}
|
||||
if (value)
|
||||
add (key, "true");
|
||||
else
|
||||
{
|
||||
lexical_add(key, value);
|
||||
}
|
||||
add (key, "false");
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, char value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, signed char value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, unsigned char value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, wchar_t value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void PropertyStream::add (std::string const& key, char16_t value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, char32_t value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void PropertyStream::add (std::string const& key, short value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, unsigned short value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, int value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, unsigned int value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, long value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, unsigned long value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, long long value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, unsigned long long value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, float value)
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, double value)
|
||||
@@ -442,53 +504,104 @@ void PropertyStream::add (std::string const& key, double value)
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (std::string const& key, uint64 value)
|
||||
void PropertyStream::add (std::string const& key, long double value)
|
||||
{
|
||||
if (value <= std::numeric_limits <uint32>::max() &&
|
||||
value >= std::numeric_limits <uint32>::min())
|
||||
{
|
||||
add (key, uint32(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
lexical_add (key, value);
|
||||
}
|
||||
lexical_add (key, value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (int32 value)
|
||||
void PropertyStream::add (bool value)
|
||||
{
|
||||
if (value)
|
||||
add ("true");
|
||||
else
|
||||
add ("false");
|
||||
}
|
||||
|
||||
void PropertyStream::add (char value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (uint32 value)
|
||||
void PropertyStream::add (signed char value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (int64 value)
|
||||
void PropertyStream::add (unsigned char value)
|
||||
{
|
||||
if (value <= std::numeric_limits <int32>::max() &&
|
||||
value >= std::numeric_limits <int32>::min())
|
||||
{
|
||||
add (int32(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (uint64 value)
|
||||
void PropertyStream::add (wchar_t value)
|
||||
{
|
||||
if (value <= std::numeric_limits <uint32>::max() &&
|
||||
value >= std::numeric_limits <uint32>::min())
|
||||
{
|
||||
add (uint32(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void PropertyStream::add (char16_t value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (char32_t value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void PropertyStream::add (short value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (unsigned short value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (int value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (unsigned int value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (long value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (unsigned long value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (long long value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (unsigned long long value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (float value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (double value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
void PropertyStream::add (long double value)
|
||||
{
|
||||
lexical_add (value);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user