use core to_string

This commit is contained in:
Ari Lazier 2016-03-04 07:09:49 -08:00
parent eb7f213c93
commit f7927f189c
5 changed files with 11 additions and 17 deletions

View File

@ -17,10 +17,9 @@
////////////////////////////////////////////////////////////////////////////
#include "list.hpp"
#include "results.hpp"
#include "shared_realm.hpp"
#include <realm/util/to_string.hpp>
#include <stdexcept>
using namespace realm;
@ -45,8 +44,8 @@ void List::verify_valid_row(size_t row_ndx, bool insertion) const
{
size_t size = m_link_view->size();
if (row_ndx > size || (!insertion && row_ndx == size)) {
throw std::out_of_range("Index " + to_string(row_ndx) + " is outside of range 0..." +
to_string(size) + ".");
throw std::out_of_range("Index " + util::to_string(row_ndx) + " is outside of range 0..." +
util::to_string(size) + ".");
}
}

View File

@ -25,6 +25,7 @@
#include <realm/table.hpp>
#include <realm/table_view.hpp>
#include <realm/util/assert.hpp>
#include <realm/util/to_string.hpp>
#include <string.h>
@ -504,7 +505,7 @@ bool ObjectStore::is_empty(const Group *group) {
InvalidSchemaVersionException::InvalidSchemaVersionException(uint64_t old_version, uint64_t new_version) :
m_old_version(old_version), m_new_version(new_version)
{
m_what = "Provided schema version " + to_string(old_version) + " is less than last set version " + to_string(new_version) + ".";
m_what = "Provided schema version " + util::to_string(old_version) + " is less than last set version " + util::to_string(new_version) + ".";
}
DuplicatePrimaryKeyValueException::DuplicatePrimaryKeyValueException(std::string const& object_type, Property const& property) :
@ -573,7 +574,7 @@ MismatchedPropertiesException::MismatchedPropertiesException(std::string const&
m_what = "Target object type for property '" + old_property.name + "' do not match. Old type '" + old_property.object_type + "', new type '" + new_property.object_type + "'";
}
else if (new_property.is_nullable != old_property.is_nullable) {
m_what = "Nullability for property '" + old_property.name + "' has changed from '" + to_string(old_property.is_nullable) + "' to '" + to_string(new_property.is_nullable) + "'.";
m_what = "Nullability for property '" + old_property.name + "' has changed from '" + util::to_string(old_property.is_nullable) + "' to '" + util::to_string(new_property.is_nullable) + "'.";
}
}

View File

@ -233,13 +233,6 @@ namespace realm {
private:
std::string m_primary_key;
};
template<typename T>
std::string to_string(T value) {
std::ostringstream oss;
oss << value;
return oss.str();
}
}
#endif /* defined(REALM_OBJECT_STORE_HPP) */

View File

@ -20,6 +20,7 @@
#define REALM_QUERY_BUILDER_HPP
#include <string>
#include <realm/util/to_string.hpp>
#include "parser.hpp"
#include "object_accessor.hpp"
@ -69,7 +70,7 @@ class ArgumentConverter : public Arguments
ValueType &argument_at(size_t index) {
if (index >= m_arguments.size()) {
throw std::out_of_range((std::string)"Argument index " + to_string(index) + " out of range 0.." + to_string(m_arguments.size()-1));
throw std::out_of_range((std::string)"Argument index " + util::to_string(index) + " out of range 0.." + util::to_string(m_arguments.size()-1));
}
return m_arguments[index];
}

View File

@ -20,12 +20,12 @@
#define REALM_RESULTS_HPP
#include "shared_realm.hpp"
#include "object_store.hpp"
#include "util/atomic_shared_ptr.hpp"
#include <realm/table_view.hpp>
#include <realm/table.hpp>
#include <realm/util/optional.hpp>
#include <realm/util/to_string.hpp>
namespace realm {
template<typename T> class BasicRowExpr;
@ -162,8 +162,8 @@ public:
struct OutOfBoundsIndexException : public std::out_of_range
{
OutOfBoundsIndexException(size_t r, size_t c) :
std::out_of_range((std::string)"Requested index " + to_string(r) +
" greater than max " + to_string(c)),
std::out_of_range((std::string)"Requested index " + util::to_string(r) +
" greater than max " + util::to_string(c)),
requested(r), valid_count(c) {}
const size_t requested;
const size_t valid_count;