results should store const ObjectSchema

This commit is contained in:
Ari Lazier 2015-12-17 17:32:51 -08:00
parent dc67be30fc
commit 143564d0b9
4 changed files with 13 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace realm {
public: public:
List(SharedRealm &r, const ObjectSchema &s, LinkViewRef l) : m_realm(r), object_schema(s), m_link_view(l) {} List(SharedRealm &r, const ObjectSchema &s, LinkViewRef l) : m_realm(r), object_schema(s), m_link_view(l) {}
const ObjectSchema object_schema; const ObjectSchema &object_schema;
SharedRealm realm() { return m_realm; } SharedRealm realm() { return m_realm; }
size_t size(); size_t size();

View File

@ -27,7 +27,7 @@ namespace realm {
template<typename ValueType, typename ContextType> template<typename ValueType, typename ContextType>
static inline Object create(ContextType ctx, SharedRealm realm, const ObjectSchema &object_schema, ValueType value, bool try_update); static inline Object create(ContextType ctx, SharedRealm realm, const ObjectSchema &object_schema, ValueType value, bool try_update);
const ObjectSchema object_schema; const ObjectSchema &object_schema;
SharedRealm realm() { return m_realm; } SharedRealm realm() { return m_realm; }
Row row() { return m_row; } Row row() { return m_row; }

View File

@ -38,6 +38,15 @@ Results::Results(SharedRealm r, const ObjectSchema &o, Table& table)
{ {
} }
Results& Results::operator=(Results const& r)
{
m_realm = r.m_realm;
const_cast<ObjectSchema &>(object_schema) = r.object_schema;
m_query = r.get_query();
m_sort = r.get_sort();
return *this;
}
void Results::validate_read() const void Results::validate_read() const
{ {
if (m_realm) if (m_realm)

View File

@ -38,14 +38,14 @@ public:
// Results is copyable and moveable // Results is copyable and moveable
Results(Results const&) = default; Results(Results const&) = default;
Results(Results&&) = default; Results(Results&&) = default;
Results& operator=(Results const&) = default;
Results& operator=(Results&&) = default; Results& operator=(Results&&) = default;
Results& operator=(Results const&);
// Get the Realm // Get the Realm
SharedRealm get_realm() const { return m_realm; } SharedRealm get_realm() const { return m_realm; }
// Object schema describing the vendored object type // Object schema describing the vendored object type
ObjectSchema object_schema; const ObjectSchema &object_schema;
// Get a query which will match the same rows as is contained in this Results // Get a query which will match the same rows as is contained in this Results
// Returned query will not be valid if the current mode is Empty // Returned query will not be valid if the current mode is Empty