merge latest object store

This commit is contained in:
Ari Lazier 2016-01-19 10:51:43 -08:00
commit fc5ed389e1
8 changed files with 30 additions and 10 deletions

15
README.md Normal file
View File

@ -0,0 +1,15 @@
# Realm Object Store
Cross-platform code used accross bindings. Binding developers can choose to use some or all the included functionality
- `object_store`/`schema`/`object_schema`/`property` - contains the structures and logic used to setup and modify realm files and their schema.
- `shared_realm` - wraps the object_store apis to provide transactions, notifications, realm caching, migrations, and other higher level functionality.
- `object_accessor`/`results`/`list` - accessor classes, object creation/update pipeline, and helpers for creating platform specific property getters and setters.
- `parser`/`query_builder` - cross platform query parser and query builder - requires and object_accessor specialization for argument support. Depends on https://github.com/ColinH/PEGTL
## Building
TBD
## Testing
TBD

View File

@ -334,7 +334,7 @@ Predicate parse(const std::string &query)
return std::move(out_predicate);
}
void analyzeGrammar()
void analyze_grammar()
{
analyze<pred>();
}

View File

@ -79,8 +79,8 @@ struct Predicate
Predicate parse(const std::string &query);
void analyzeGrammar();
bool testGrammar();
void analyze_grammar();
bool test_grammar();
}
}

View File

@ -382,7 +382,7 @@ auto value_of_type_for_query(TableGetter&& tables, Value&& value, Arguments &arg
{
const bool isColumn = std::is_same<PropertyExpression, typename std::remove_reference<Value>::type>::value;
using helper = std::conditional_t<isColumn, ColumnGetter<RetType, TableGetter>, ValueGetter<RetType, TableGetter>>;
return helper::convert(std::forward<TableGetter>(tables), std::forward<Value>(value), args);
return helper::convert(tables, value, args);
}
template <typename A, typename B>

View File

@ -134,7 +134,7 @@ static std::vector<std::string> invalid_queries = {
namespace realm {
namespace parser {
bool testGrammar()
bool test_grammar()
{
bool success = true;
for (auto &query : valid_queries) {

View File

@ -36,19 +36,19 @@ using namespace realm;
Results::Results(SharedRealm r, const ObjectSchema &o, Query q, SortOrder s)
: m_realm(std::move(r))
, m_object_schema(&o)
, m_query(std::move(q))
, m_table(m_query.get_table().get())
, m_sort(std::move(s))
, m_mode(Mode::Query)
, m_object_schema(&o)
{
}
Results::Results(SharedRealm r, const ObjectSchema &o, Table& table)
: m_realm(std::move(r))
, m_object_schema(&o)
, m_table(&table)
, m_mode(Mode::Table)
, m_object_schema(&o)
{
}

View File

@ -135,9 +135,10 @@ public:
// The input index parameter was out of bounds
struct OutOfBoundsIndexException : public std::out_of_range
{
OutOfBoundsIndexException(size_t r, size_t c) : requested(r), valid_count(c),
OutOfBoundsIndexException(size_t r, size_t c) :
std::out_of_range((std::string)"Requested index " + to_string(r) +
" greater than max " + to_string(c)) {}
" greater than max " + to_string(c)),
requested(r), valid_count(c) {}
const size_t requested;
const size_t valid_count;
};
@ -150,7 +151,7 @@ public:
// The input Row object belongs to a different table
struct IncorrectTableException : public std::runtime_error {
IncorrectTableException(StringData e, StringData a, const std::string &error) :
expected(e), actual(a), std::runtime_error(error) {}
std::runtime_error(error), expected(e), actual(a) {}
const StringData expected;
const StringData actual;
};

View File

@ -87,6 +87,10 @@ Realm::Realm(Config config)
throw RealmFileException(RealmFileException::Kind::Exists, ex.get_path(),
"File at path '" + ex.get_path() + "' already exists.");
}
catch (util::File::NotFound const& ex) {
throw RealmFileException(RealmFileException::Kind::NotFound, ex.get_path(),
"File at path '" + ex.get_path() + "' does not exist.");
}
catch (util::File::AccessError const& ex) {
throw RealmFileException(RealmFileException::Kind::AccessError, ex.get_path(),
"Unable to open a realm at path '" + ex.get_path() + "'");