create -> create_instance
This commit is contained in:
parent
84559316d8
commit
c817ac7eac
|
@ -41,7 +41,7 @@ struct List {
|
|||
using Value = Value<T>;
|
||||
using ReturnValue = ReturnValue<T>;
|
||||
|
||||
static TObject create(TContext, realm::List &);
|
||||
static TObject create_instance(TContext, realm::List &);
|
||||
|
||||
static void GetLength(TContext, TObject, ReturnValue &);
|
||||
static void GetIndex(TContext, TObject, uint32_t, ReturnValue &);
|
||||
|
@ -82,7 +82,7 @@ struct ObjectClass<T, realm::List> : BaseObjectClass<T, Collection> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
typename T::Object List<T>::create(TContext ctx, realm::List &list) {
|
||||
typename T::Object List<T>::create_instance(TContext ctx, realm::List &list) {
|
||||
return create_object<T, realm::List>(ctx, new realm::List(list));
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void List<T>::GetIndex(TContext ctx, TObject object, uint32_t index, ReturnValue
|
|||
auto list = get_internal<T, realm::List>(object);
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
return_value.set(RealmObject<T>::create(ctx, realm_object));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -133,7 +133,7 @@ void List<T>::Pop(TContext ctx, TObject this_object, size_t argc, const TValue a
|
|||
size_t index = size - 1;
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
return_value.set(RealmObject<T>::create(ctx, realm_object));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
list->remove(index);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void List<T>::Shift(TContext ctx, TObject this_object, size_t argc, const TValue
|
|||
else {
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(0));
|
||||
|
||||
return_value.set(RealmObject<T>::create(ctx, realm_object));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
list->remove(0);
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void List<T>::Splice(TContext ctx, TObject this_object, size_t argc, const TValu
|
|||
for (size_t i = 0; i < remove; i++) {
|
||||
auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index));
|
||||
|
||||
removed_objects.push_back(RealmObject<T>::create(ctx, realm_object));
|
||||
removed_objects.push_back(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
list->remove(index);
|
||||
}
|
||||
for (size_t i = 2; i < argc; i++) {
|
||||
|
@ -208,7 +208,7 @@ void List<T>::StaticResults(TContext ctx, TObject this_object, size_t argc, cons
|
|||
validate_argument_count(argc, 0);
|
||||
|
||||
auto list = get_internal<T, realm::List>(this_object);
|
||||
return_value.set(Results<T>::create(ctx, *list, false));
|
||||
return_value.set(Results<T>::create_instance(ctx, *list, false));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -40,7 +40,7 @@ struct RealmObject {
|
|||
using Function = Function<T>;
|
||||
using ReturnValue = ReturnValue<T>;
|
||||
|
||||
static TObject create(TContext, realm::Object &);
|
||||
static TObject create_instance(TContext, realm::Object &);
|
||||
|
||||
static void GetProperty(TContext, TObject, const String &, ReturnValue &);
|
||||
static bool SetProperty(TContext, TObject, const String &, TValue);
|
||||
|
@ -61,7 +61,7 @@ struct ObjectClass<T, realm::Object> : BaseObjectClass<T> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
typename T::Object RealmObject<T>::create(TContext ctx, realm::Object &realm_object) {
|
||||
typename T::Object RealmObject<T>::create_instance(TContext ctx, realm::Object &realm_object) {
|
||||
static String s_prototype = "prototype";
|
||||
|
||||
auto delegate = get_delegate<T>(realm_object.realm().get());
|
||||
|
|
|
@ -122,7 +122,7 @@ struct NativeAccessor {
|
|||
throw std::runtime_error("object is not a Realm Object");
|
||||
}
|
||||
static TValue from_object(TContext ctx, realm::Object realm_object) {
|
||||
return RealmObject<T>::create(ctx, realm_object);
|
||||
return RealmObject<T>::create_instance(ctx, realm_object);
|
||||
}
|
||||
|
||||
static size_t list_size(TContext ctx, TValue &value) {
|
||||
|
@ -132,7 +132,7 @@ struct NativeAccessor {
|
|||
return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index);
|
||||
}
|
||||
static TValue from_list(TContext ctx, realm::List list) {
|
||||
return List<T>::create(ctx, list);
|
||||
return List<T>::create_instance(ctx, list);
|
||||
}
|
||||
|
||||
static Mixed to_mixed(TContext ctx, TValue &val) {
|
||||
|
|
|
@ -347,7 +347,7 @@ void Realm<T>::Objects(TContext ctx, TObject this_object, size_t argc, const TVa
|
|||
SharedRealm realm = *get_internal<T, SharedRealm>(this_object);
|
||||
std::string type = validated_object_type_for_value(realm, ctx, arguments[0]);
|
||||
|
||||
return_value.set(Results<T>::create(ctx, realm, type));
|
||||
return_value.set(Results<T>::create_instance(ctx, realm, type));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -374,7 +374,7 @@ void Realm<T>::Create(TContext ctx, TObject this_object, size_t argc, const TVal
|
|||
}
|
||||
|
||||
auto realm_object = realm::Object::create<TValue>(ctx, sharedRealm, *object_schema, object, update);
|
||||
return_value.set(RealmObject<T>::create(ctx, realm_object));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -38,10 +38,10 @@ struct Results {
|
|||
using Value = Value<T>;
|
||||
using ReturnValue = ReturnValue<T>;
|
||||
|
||||
static TObject create(TContext, const realm::Results &, bool live = true);
|
||||
static TObject create(TContext, const realm::List &, bool live = true);
|
||||
static TObject create(TContext, SharedRealm, const std::string &type, bool live = true);
|
||||
static TObject create(TContext, SharedRealm, const ObjectSchema &, Query, bool live = true);
|
||||
static TObject create_instance(TContext, const realm::Results &, bool live = true);
|
||||
static TObject create_instance(TContext, const realm::List &, bool live = true);
|
||||
static TObject create_instance(TContext, SharedRealm, const std::string &type, bool live = true);
|
||||
static TObject create_instance(TContext, SharedRealm, const ObjectSchema &, Query, bool live = true);
|
||||
|
||||
template<typename U>
|
||||
static TObject create_filtered(TContext, const U &, size_t, const TValue[]);
|
||||
|
@ -77,7 +77,7 @@ struct ObjectClass<T, realm::Results> : BaseObjectClass<T, Collection> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
typename T::Object Results<T>::create(TContext ctx, const realm::Results &results, bool live) {
|
||||
typename T::Object Results<T>::create_instance(TContext ctx, const realm::Results &results, bool live) {
|
||||
auto new_results = new realm::Results(results);
|
||||
new_results->set_live(live);
|
||||
|
||||
|
@ -85,12 +85,12 @@ typename T::Object Results<T>::create(TContext ctx, const realm::Results &result
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
typename T::Object Results<T>::create(TContext ctx, const realm::List &list, bool live) {
|
||||
return create(ctx, list.get_realm(), list.get_object_schema(), list.get_query(), live);
|
||||
typename T::Object Results<T>::create_instance(TContext ctx, const realm::List &list, bool live) {
|
||||
return create_instance(ctx, list.get_realm(), list.get_object_schema(), list.get_query(), live);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename T::Object Results<T>::create(TContext ctx, SharedRealm realm, const std::string &type, bool live) {
|
||||
typename T::Object Results<T>::create_instance(TContext ctx, SharedRealm realm, const std::string &type, bool live) {
|
||||
auto table = ObjectStore::table_for_object_type(realm->read_group(), type);
|
||||
auto &schema = realm->config().schema;
|
||||
auto object_schema = schema->find(type);
|
||||
|
@ -106,7 +106,7 @@ typename T::Object Results<T>::create(TContext ctx, SharedRealm realm, const std
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
typename T::Object Results<T>::create(TContext ctx, SharedRealm realm, const ObjectSchema &object_schema, Query query, bool live) {
|
||||
typename T::Object Results<T>::create_instance(TContext ctx, SharedRealm realm, const ObjectSchema &object_schema, Query query, bool live) {
|
||||
auto results = new realm::Results(realm, object_schema, std::move(query));
|
||||
results->set_live(live);
|
||||
|
||||
|
@ -132,7 +132,7 @@ typename T::Object Results<T>::create_filtered(TContext ctx, const U &collection
|
|||
query_builder::ArgumentConverter<TValue, TContext> converter(ctx, args);
|
||||
query_builder::apply_predicate(query, predicate, converter, *realm->config().schema, object_schema.name);
|
||||
|
||||
return create(ctx, realm, object_schema, std::move(query));
|
||||
return create_instance(ctx, realm, object_schema, std::move(query));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -211,7 +211,7 @@ void Results<T>::GetIndex(TContext ctx, TObject object, uint32_t index, ReturnVa
|
|||
}
|
||||
|
||||
auto realm_object = realm::Object(results->get_realm(), results->get_object_schema(), results->get(index));
|
||||
return_value.set(RealmObject<T>::create(ctx, realm_object));
|
||||
return_value.set(RealmObject<T>::create_instance(ctx, realm_object));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -219,7 +219,7 @@ void Results<T>::StaticResults(TContext ctx, TObject this_object, size_t argc, c
|
|||
validate_argument_count(argc, 0);
|
||||
|
||||
auto results = get_internal<T, realm::Results>(this_object);
|
||||
return_value.set(Results<T>::create(ctx, *results, false));
|
||||
return_value.set(Results<T>::create_instance(ctx, *results, false));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -220,7 +220,7 @@ struct Object {
|
|||
static TObject create_date(TContext, double);
|
||||
|
||||
template<typename U>
|
||||
static TObject create(TContext, U*);
|
||||
static TObject create_instance(TContext, U*);
|
||||
|
||||
template<typename U>
|
||||
static bool is_instance(TContext, const TObject &);
|
||||
|
@ -282,7 +282,7 @@ struct ReturnValue {
|
|||
|
||||
template<typename T, typename U>
|
||||
REALM_JS_INLINE typename T::Object create_object(typename T::Context ctx, U* internal = nullptr) {
|
||||
return Object<T>::template create<U>(ctx, internal);
|
||||
return Object<T>::template create_instance<U>(ctx, internal);
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
|
|
|
@ -51,7 +51,7 @@ class ObjectWrap {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
JSObjectRef this_object = ObjectWrap<T>::create(ctx);
|
||||
JSObjectRef this_object = ObjectWrap<T>::create_instance(ctx);
|
||||
try {
|
||||
s_class.constructor(ctx, this_object, argc, arguments);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class ObjectWrap {
|
|||
return js_class;
|
||||
}
|
||||
|
||||
static JSObjectRef create(JSContextRef ctx, T* internal = nullptr) {
|
||||
static JSObjectRef create_instance(JSContextRef ctx, T* internal = nullptr) {
|
||||
return JSObjectMake(ctx, get_class(), new ObjectWrap<T>(internal));
|
||||
}
|
||||
|
||||
|
|
|
@ -482,8 +482,8 @@ inline JSObjectRef jsc::Object::create_date(JSContextRef ctx, double time) {
|
|||
|
||||
template<>
|
||||
template<typename U>
|
||||
inline JSObjectRef jsc::Object::create(JSContextRef ctx, U* internal) {
|
||||
return jsc::ObjectWrap<U>::create(ctx, internal);
|
||||
inline JSObjectRef jsc::Object::create_instance(JSContextRef ctx, U* internal) {
|
||||
return jsc::ObjectWrap<U>::create_instance(ctx, internal);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -88,7 +88,7 @@ class ObjectWrap : public Nan::ObjectWrap {
|
|||
return *this;
|
||||
}
|
||||
|
||||
static v8::Local<v8::Object> create(v8::Isolate* isolate, T* internal = nullptr) {
|
||||
static v8::Local<v8::Object> create_instance(v8::Isolate* isolate, T* internal = nullptr) {
|
||||
Nan::EscapableHandleScope scope;
|
||||
|
||||
// TODO: Figure out why this template ends up being empty here.
|
||||
|
|
|
@ -441,8 +441,8 @@ inline v8::Local<v8::Object> node::Object::create_date(v8::Isolate* isolate, dou
|
|||
|
||||
template<>
|
||||
template<typename U>
|
||||
inline v8::Local<v8::Object> node::Object::create(v8::Isolate* isolate, U* internal) {
|
||||
return node::ObjectWrap<U>::create(isolate, internal);
|
||||
inline v8::Local<v8::Object> node::Object::create_instance(v8::Isolate* isolate, U* internal) {
|
||||
return node::ObjectWrap<U>::create_instance(isolate, internal);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Reference in New Issue