Remove list.hpp's dependency on shared_realm.hpp

This commit is contained in:
Thomas Goyne 2016-01-26 12:02:59 -08:00
parent 07c40b4517
commit 356c17ba11
2 changed files with 19 additions and 9 deletions

View File

@ -18,10 +18,21 @@
#include "list.hpp"
#include "shared_realm.hpp"
#include <stdexcept>
using namespace realm;
List::List(std::shared_ptr<Realm> r, const ObjectSchema& s, LinkViewRef l)
: m_realm(std::move(r))
, m_object_schema(&s)
, m_link_view(std::move(l))
{
}
List::~List() = default;
size_t List::size()
{
verify_attached();

View File

@ -19,22 +19,21 @@
#ifndef REALM_LIST_HPP
#define REALM_LIST_HPP
#include "shared_realm.hpp"
#include <realm/link_view.hpp>
#include <memory>
namespace realm {
class ObjectSchema;
class Realm;
class List {
public:
List(SharedRealm& r, const ObjectSchema& s, LinkViewRef l)
: m_realm(r)
, m_object_schema(&s)
, m_link_view(l)
{
}
List(std::shared_ptr<Realm> r, const ObjectSchema& s, LinkViewRef l);
~List();
const ObjectSchema& get_object_schema() const { return *m_object_schema; }
SharedRealm realm() { return m_realm; }
const std::shared_ptr<Realm>& realm() { return m_realm; }
size_t size();
Row get(std::size_t row_ndx);
@ -60,7 +59,7 @@ public:
void verify_in_tranaction();
private:
SharedRealm m_realm;
std::shared_ptr<Realm> m_realm;
const ObjectSchema* m_object_schema;
LinkViewRef m_link_view;
};