diff --git a/README.md b/README.md new file mode 100644 index 00000000..30ae7900 --- /dev/null +++ b/README.md @@ -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 diff --git a/parser/parser.cpp b/parser/parser.cpp index 2753fbd8..0ed84b5e 100644 --- a/parser/parser.cpp +++ b/parser/parser.cpp @@ -334,7 +334,7 @@ Predicate parse(const std::string &query) return std::move(out_predicate); } -void analyzeGrammar() +void analyze_grammar() { analyze(); } diff --git a/parser/parser.hpp b/parser/parser.hpp index 92f7ebea..5c82175e 100644 --- a/parser/parser.hpp +++ b/parser/parser.hpp @@ -79,8 +79,8 @@ struct Predicate Predicate parse(const std::string &query); -void analyzeGrammar(); -bool testGrammar(); +void analyze_grammar(); +bool test_grammar(); } } diff --git a/parser/query_builder.cpp b/parser/query_builder.cpp index 9a14bd4e..7a6b179a 100644 --- a/parser/query_builder.cpp +++ b/parser/query_builder.cpp @@ -382,7 +382,7 @@ auto value_of_type_for_query(TableGetter&& tables, Value&& value, Arguments &arg { const bool isColumn = std::is_same::type>::value; using helper = std::conditional_t, ValueGetter>; - return helper::convert(std::forward(tables), std::forward(value), args); + return helper::convert(tables, value, args); } template diff --git a/parser/test.cpp b/parser/test.cpp index ce290474..f834c505 100644 --- a/parser/test.cpp +++ b/parser/test.cpp @@ -134,7 +134,7 @@ static std::vector invalid_queries = { namespace realm { namespace parser { -bool testGrammar() +bool test_grammar() { bool success = true; for (auto &query : valid_queries) { diff --git a/results.cpp b/results.cpp index c5334652..91a4cc22 100644 --- a/results.cpp +++ b/results.cpp @@ -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) { } diff --git a/results.hpp b/results.hpp index acb797a0..f3f8d313 100644 --- a/results.hpp +++ b/results.hpp @@ -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; }; diff --git a/shared_realm.cpp b/shared_realm.cpp index 380553a9..52233f04 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -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() + "'");