From 42cb078a8c9097921440f86f9a03156eb0bb1fb0 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Fri, 4 Mar 2016 07:09:49 -0800 Subject: [PATCH] use core to_string --- src/object-store/src/list.cpp | 7 +++---- src/object-store/src/object_store.cpp | 5 +++-- src/object-store/src/object_store.hpp | 7 ------- src/object-store/src/parser/query_builder.hpp | 3 ++- src/object-store/src/results.hpp | 6 +++--- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/object-store/src/list.cpp b/src/object-store/src/list.cpp index 47036c70..78464125 100644 --- a/src/object-store/src/list.cpp +++ b/src/object-store/src/list.cpp @@ -17,10 +17,9 @@ //////////////////////////////////////////////////////////////////////////// #include "list.hpp" - #include "results.hpp" -#include "shared_realm.hpp" +#include #include 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) + "."); } } diff --git a/src/object-store/src/object_store.cpp b/src/object-store/src/object_store.cpp index 66a1b62e..8e9cbf95 100644 --- a/src/object-store/src/object_store.cpp +++ b/src/object-store/src/object_store.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -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) + "'."; } } diff --git a/src/object-store/src/object_store.hpp b/src/object-store/src/object_store.hpp index d762674b..b5596ffc 100644 --- a/src/object-store/src/object_store.hpp +++ b/src/object-store/src/object_store.hpp @@ -233,13 +233,6 @@ namespace realm { private: std::string m_primary_key; }; - - template - std::string to_string(T value) { - std::ostringstream oss; - oss << value; - return oss.str(); - } } #endif /* defined(REALM_OBJECT_STORE_HPP) */ diff --git a/src/object-store/src/parser/query_builder.hpp b/src/object-store/src/parser/query_builder.hpp index f6738b47..87043ee2 100644 --- a/src/object-store/src/parser/query_builder.hpp +++ b/src/object-store/src/parser/query_builder.hpp @@ -20,6 +20,7 @@ #define REALM_QUERY_BUILDER_HPP #include +#include #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]; } diff --git a/src/object-store/src/results.hpp b/src/object-store/src/results.hpp index 91784cde..fc761130 100644 --- a/src/object-store/src/results.hpp +++ b/src/object-store/src/results.hpp @@ -20,12 +20,12 @@ #define REALM_RESULTS_HPP #include "shared_realm.hpp" -#include "object_store.hpp" #include "util/atomic_shared_ptr.hpp" #include #include #include +#include namespace realm { template 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;