make all string arguments const references
This commit is contained in:
parent
3c6ecf6b65
commit
73b1dd549b
|
@ -22,7 +22,7 @@
|
||||||
using namespace realm;
|
using namespace realm;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ObjectSchema::ObjectSchema(realm::Group *group, std::string name) : name(name) {
|
ObjectSchema::ObjectSchema(realm::Group *group, const std::string &name) : name(name) {
|
||||||
TableRef table = ObjectStore::table_for_object_type(group, name);
|
TableRef table = ObjectStore::table_for_object_type(group, name);
|
||||||
size_t count = table->get_column_count();
|
size_t count = table->get_column_count();
|
||||||
for (size_t col = 0; col < count; col++) {
|
for (size_t col = 0; col < count; col++) {
|
||||||
|
@ -55,7 +55,7 @@ ObjectSchema::ObjectSchema(realm::Group *group, std::string name) : name(name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Property *ObjectSchema::property_for_name(std::string name) {
|
Property *ObjectSchema::property_for_name(const std::string &name) {
|
||||||
for (auto& prop:properties) {
|
for (auto& prop:properties) {
|
||||||
if (prop.name == name) {
|
if (prop.name == name) {
|
||||||
return ∝
|
return ∝
|
||||||
|
|
|
@ -29,13 +29,13 @@ namespace realm {
|
||||||
class ObjectSchema {
|
class ObjectSchema {
|
||||||
public:
|
public:
|
||||||
ObjectSchema() {}
|
ObjectSchema() {}
|
||||||
ObjectSchema(Group *group, std::string name);
|
ObjectSchema(Group *group, const std::string &name);
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::vector<Property> properties;
|
std::vector<Property> properties;
|
||||||
std::string primary_key;
|
std::string primary_key;
|
||||||
|
|
||||||
Property *property_for_name(std::string name);
|
Property *property_for_name(const std::string &name);
|
||||||
Property *primary_key_property() {
|
Property *primary_key_property() {
|
||||||
return property_for_name(primary_key);
|
return property_for_name(primary_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,14 +109,14 @@ void ObjectStore::set_primary_key_for_object(realm::Group *group, StringData obj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string ObjectStore::object_type_for_table_name(string table_name) {
|
string ObjectStore::object_type_for_table_name(const string &table_name) {
|
||||||
if (table_name.compare(0, 6, c_object_table_name_prefix) == 0) {
|
if (table_name.compare(0, 6, c_object_table_name_prefix) == 0) {
|
||||||
return table_name.substr(6, table_name.length()-6);
|
return table_name.substr(6, table_name.length()-6);
|
||||||
}
|
}
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
string ObjectStore::table_name_for_object_type(string object_type) {
|
string ObjectStore::table_name_for_object_type(const string &object_type) {
|
||||||
return c_object_table_name_prefix + object_type;
|
return c_object_table_name_prefix + object_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ realm::TableRef ObjectStore::table_for_object_type(realm::Group *group, StringDa
|
||||||
return group->get_table(table_name_for_object_type(object_type));
|
return group->get_table(table_name_for_object_type(object_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
realm::TableRef ObjectStore::table_for_object_type_create_if_needed(realm::Group *group, StringData object_type, bool &created) {
|
realm::TableRef ObjectStore::table_for_object_type_create_if_needed(realm::Group *group, const StringData &object_type, bool &created) {
|
||||||
return group->get_or_add_table(table_name_for_object_type(object_type), &created);
|
return group->get_or_add_table(table_name_for_object_type(object_type), &created);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,9 @@ namespace realm {
|
||||||
// must be in write transaction to set
|
// must be in write transaction to set
|
||||||
static void set_primary_key_for_object(Group *group, StringData object_type, StringData primary_key);
|
static void set_primary_key_for_object(Group *group, StringData object_type, StringData primary_key);
|
||||||
|
|
||||||
static TableRef table_for_object_type_create_if_needed(Group *group, StringData object_type, bool &created);
|
static TableRef table_for_object_type_create_if_needed(Group *group, const StringData &object_type, bool &created);
|
||||||
static std::string table_name_for_object_type(std::string class_name);
|
static std::string table_name_for_object_type(const std::string &class_name);
|
||||||
static std::string object_type_for_table_name(std::string table_name);
|
static std::string object_type_for_table_name(const std::string &table_name);
|
||||||
|
|
||||||
// returns if any indexes were changed
|
// returns if any indexes were changed
|
||||||
static bool update_indexes(Group *group, Schema &schema);
|
static bool update_indexes(Group *group, Schema &schema);
|
||||||
|
|
Loading…
Reference in New Issue