Strip all trailing whitespace from files

This commit is contained in:
Thomas Goyne 2016-03-07 11:24:35 -08:00
parent d163d68b83
commit af0db71187
6 changed files with 22 additions and 22 deletions

View File

@ -65,10 +65,10 @@ public:
// Should only be called in test code, as continuing to use the previously
// cached instances will have odd results
static void clear_cache();
// Clears all caches on existing coordinators
static void clear_all_caches();
// Explicit constructor/destructor needed for the unique_ptrs to forward-declared types
RealmCoordinator();
~RealmCoordinator();

View File

@ -52,7 +52,7 @@ namespace realm {
// determines if a realm with the given old schema needs non-migration
// changes to make it compatible with the given target schema
static bool needs_update(Schema const& old_schema, Schema const& schema);
// updates a Realm from old_schema to the given target schema, creating and updating tables as needed
// passed in target schema is updated with the correct column mapping
// optionally runs migration function if schema is out of date

View File

@ -112,7 +112,7 @@ struct ParserState
{
return group_stack.back();
}
Predicate *last_predicate()
{
Predicate *pred = current_group();
@ -121,12 +121,12 @@ struct ParserState
}
return pred;
}
void add_predicate_to_current_group(Predicate::Type type)
{
current_group()->cpnd.sub_predicates.emplace_back(type, negate_next);
negate_next = false;
if (current_group()->cpnd.sub_predicates.size() > 1) {
if (next_type == Predicate::Type::Or) {
apply_or();
@ -136,10 +136,10 @@ struct ParserState
}
}
}
bool negate_next = false;
Predicate::Type next_type = Predicate::Type::And;
void add_expression(Expression && exp)
{
Predicate *current = last_predicate();
@ -151,32 +151,32 @@ struct ParserState
last_predicate()->cmpr.expr[0] = std::move(exp);
}
}
void apply_or()
{
Predicate *group = current_group();
if (group->type == Predicate::Type::Or) {
return;
}
// convert to OR
group->type = Predicate::Type::Or;
if (group->cpnd.sub_predicates.size() > 2) {
// split the current group into an AND group ORed with the last subpredicate
Predicate new_sub(Predicate::Type::And);
new_sub.cpnd.sub_predicates = std::move(group->cpnd.sub_predicates);
group->cpnd.sub_predicates = { new_sub, std::move(new_sub.cpnd.sub_predicates.back()) };
group->cpnd.sub_predicates[0].cpnd.sub_predicates.pop_back();
}
}
void apply_and()
{
if (current_group()->type == Predicate::Type::And) {
return;
}
auto &sub_preds = current_group()->cpnd.sub_predicates;
auto second_last = sub_preds.end() - 2;
if (second_last->type == Predicate::Type::And && !second_last->negate) {

View File

@ -462,7 +462,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
if (pred.negate) {
query.Not();
}
switch (pred.type) {
case Predicate::Type::And:
query.group();
@ -474,7 +474,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
}
query.end_group();
break;
case Predicate::Type::Or:
query.group();
for (auto &sub : pred.cpnd.sub_predicates) {
@ -486,7 +486,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
}
query.end_group();
break;
case Predicate::Type::Comparison: {
add_comparison_to_query(query, pred, arguments, schema, type);
break;
@ -494,11 +494,11 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
case Predicate::Type::True:
query.and_query(std::unique_ptr<realm::Expression>(new TrueExpression));
break;
case Predicate::Type::False:
query.and_query(std::unique_ptr<realm::Expression>(new FalseExpression));
break;
default:
throw std::runtime_error("Invalid predicate type");
}
@ -507,7 +507,7 @@ void update_query_with_predicate(Query &query, const Predicate &pred, Arguments
void apply_predicate(Query &query, const Predicate &predicate, Arguments &arguments, const Schema &schema, const std::string &objectType)
{
update_query_with_predicate(query, predicate, arguments, schema, objectType);
// Test the constructed query in core
std::string validateMessage = query.validate();
precondition(validateMessage.empty(), validateMessage.c_str());

View File

@ -83,10 +83,10 @@ public:
// Get the Realm
SharedRealm get_realm() const { return m_realm; }
// Object schema describing the vendored object type
const ObjectSchema &get_object_schema() const { return *m_object_schema; }
// 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
Query get_query() const;

View File

@ -231,7 +231,7 @@ namespace realm {
public:
UnitializedRealmException(std::string message) : std::runtime_error(message) {}
};
class InvalidEncryptionKeyException : public std::runtime_error {
public:
InvalidEncryptionKeyException() : std::runtime_error("Encryption key must be 64 bytes.") {}