mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 14:54:33 +00:00
RJSArray -> RJSList
This commit is contained in:
parent
385f387332
commit
f6e0d34022
@ -21,8 +21,8 @@
|
||||
02601F121BA10228007C91FF /* transact_log_handler.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 02601F101BA10228007C91FF /* transact_log_handler.hpp */; };
|
||||
0270BC4C1B7CFC0D00010E03 /* RealmJS.h in Headers */ = {isa = PBXBuildFile; fileRef = 0270BC3E1B7CFC0D00010E03 /* RealmJS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0270BC4D1B7CFC0D00010E03 /* RealmJS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0270BC3F1B7CFC0D00010E03 /* RealmJS.mm */; };
|
||||
0270BC4E1B7CFC0D00010E03 /* RJSArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0270BC401B7CFC0D00010E03 /* RJSArray.cpp */; };
|
||||
0270BC4F1B7CFC0D00010E03 /* RJSArray.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0270BC411B7CFC0D00010E03 /* RJSArray.hpp */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
0270BC4E1B7CFC0D00010E03 /* RJSList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0270BC401B7CFC0D00010E03 /* RJSList.cpp */; };
|
||||
0270BC4F1B7CFC0D00010E03 /* RJSList.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0270BC411B7CFC0D00010E03 /* RJSList.hpp */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
0270BC501B7CFC0D00010E03 /* RJSObject.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0270BC421B7CFC0D00010E03 /* RJSObject.hpp */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
0270BC511B7CFC0D00010E03 /* RJSObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0270BC431B7CFC0D00010E03 /* RJSObject.mm */; };
|
||||
0270BC521B7CFC0D00010E03 /* RJSRealm.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0270BC441B7CFC0D00010E03 /* RJSRealm.hpp */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
@ -144,8 +144,8 @@
|
||||
02601F101BA10228007C91FF /* transact_log_handler.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = transact_log_handler.hpp; path = "src/object-store/transact_log_handler.hpp"; sourceTree = "<group>"; };
|
||||
0270BC3E1B7CFC0D00010E03 /* RealmJS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RealmJS.h; path = src/RealmJS.h; sourceTree = "<group>"; };
|
||||
0270BC3F1B7CFC0D00010E03 /* RealmJS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RealmJS.mm; path = src/RealmJS.mm; sourceTree = "<group>"; };
|
||||
0270BC401B7CFC0D00010E03 /* RJSArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RJSArray.cpp; path = src/RJSArray.cpp; sourceTree = "<group>"; };
|
||||
0270BC411B7CFC0D00010E03 /* RJSArray.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RJSArray.hpp; path = src/RJSArray.hpp; sourceTree = "<group>"; };
|
||||
0270BC401B7CFC0D00010E03 /* RJSList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RJSList.cpp; path = src/RJSList.cpp; sourceTree = "<group>"; };
|
||||
0270BC411B7CFC0D00010E03 /* RJSList.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RJSList.hpp; path = src/RJSList.hpp; sourceTree = "<group>"; };
|
||||
0270BC421B7CFC0D00010E03 /* RJSObject.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RJSObject.hpp; path = src/RJSObject.hpp; sourceTree = "<group>"; };
|
||||
0270BC431B7CFC0D00010E03 /* RJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RJSObject.mm; path = src/RJSObject.mm; sourceTree = "<group>"; };
|
||||
0270BC441B7CFC0D00010E03 /* RJSRealm.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = RJSRealm.hpp; path = src/RJSRealm.hpp; sourceTree = "<group>"; };
|
||||
@ -246,8 +246,8 @@
|
||||
0270BC3F1B7CFC0D00010E03 /* RealmJS.mm */,
|
||||
02258FB11BC6E2D00075F13A /* RealmRPC.h */,
|
||||
02258FB21BC6E2D00075F13A /* RealmRPC.mm */,
|
||||
0270BC401B7CFC0D00010E03 /* RJSArray.cpp */,
|
||||
0270BC411B7CFC0D00010E03 /* RJSArray.hpp */,
|
||||
0270BC401B7CFC0D00010E03 /* RJSList.cpp */,
|
||||
0270BC411B7CFC0D00010E03 /* RJSList.hpp */,
|
||||
0270BC421B7CFC0D00010E03 /* RJSObject.hpp */,
|
||||
0270BC431B7CFC0D00010E03 /* RJSObject.mm */,
|
||||
0270BC441B7CFC0D00010E03 /* RJSRealm.hpp */,
|
||||
@ -340,7 +340,7 @@
|
||||
files = (
|
||||
0270BC4C1B7CFC0D00010E03 /* RealmJS.h in Headers */,
|
||||
02258FB31BC6E2D00075F13A /* RealmRPC.h in Headers */,
|
||||
0270BC4F1B7CFC0D00010E03 /* RJSArray.hpp in Headers */,
|
||||
0270BC4F1B7CFC0D00010E03 /* RJSList.hpp in Headers */,
|
||||
0270BC541B7CFC0D00010E03 /* RJSResults.hpp in Headers */,
|
||||
0270BC581B7CFC0D00010E03 /* RJSUtil.hpp in Headers */,
|
||||
0270BC561B7CFC0D00010E03 /* RJSSchema.hpp in Headers */,
|
||||
@ -571,7 +571,7 @@
|
||||
02601F031BA0F0C4007C91FF /* external_commit_helper.cpp in Sources */,
|
||||
0270BC6B1B7CFC1C00010E03 /* object_store.cpp in Sources */,
|
||||
0270BC701B7CFC1C00010E03 /* shared_realm.cpp in Sources */,
|
||||
0270BC4E1B7CFC0D00010E03 /* RJSArray.cpp in Sources */,
|
||||
0270BC4E1B7CFC0D00010E03 /* RJSList.cpp in Sources */,
|
||||
0270BC531B7CFC0D00010E03 /* RJSRealm.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -16,7 +16,7 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RJSArray.hpp"
|
||||
#include "RJSList.hpp"
|
||||
#include "RJSObject.hpp"
|
||||
#include "RJSUtil.hpp"
|
||||
#include "object_accessor.hpp"
|
||||
@ -210,11 +210,11 @@ JSValueRef ArraySplice(JSContextRef ctx, JSObjectRef function, JSObjectRef thisO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JSObjectRef RJSArrayCreate(JSContextRef ctx, realm::List &list) {
|
||||
return RJSWrapObject<List *>(ctx, RJSArrayClass(), new List(list));
|
||||
JSObjectRef RJSListCreate(JSContextRef ctx, realm::List &list) {
|
||||
return RJSWrapObject<List *>(ctx, RJSListClass(), new List(list));
|
||||
}
|
||||
|
||||
const JSStaticFunction RJSArrayFuncs[] = {
|
||||
const JSStaticFunction RJSListFuncs[] = {
|
||||
{"push", ArrayPush, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
|
||||
{"pop", ArrayPop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
|
||||
{"shift", ArrayShift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete},
|
||||
@ -223,7 +223,7 @@ const JSStaticFunction RJSArrayFuncs[] = {
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
JSClassRef RJSArrayClass() {
|
||||
static JSClassRef s_arrayClass = RJSCreateWrapperClass<Object>("RealmArray", ArrayGetProperty, ArraySetProperty, RJSArrayFuncs, NULL, ArrayPropertyNames);
|
||||
JSClassRef RJSListClass() {
|
||||
static JSClassRef s_arrayClass = RJSCreateWrapperClass<Object>("RealmList", ArrayGetProperty, ArraySetProperty, RJSListFuncs, NULL, ArrayPropertyNames);
|
||||
return s_arrayClass;
|
||||
}
|
@ -20,8 +20,8 @@
|
||||
#import "shared_realm.hpp"
|
||||
#import "list.hpp"
|
||||
|
||||
extern const JSStaticFunction RJSArrayFuncs[];
|
||||
JSClassRef RJSArrayClass();
|
||||
JSObjectRef RJSArrayCreate(JSContextRef ctx, realm::List &list);
|
||||
extern const JSStaticFunction RJSListFuncs[];
|
||||
JSClassRef RJSListClass();
|
||||
JSObjectRef RJSListCreate(JSContextRef ctx, realm::List &list);
|
||||
|
||||
JSValueRef ArrayGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* jsException);
|
@ -20,7 +20,7 @@
|
||||
#import "RJSObject.hpp"
|
||||
#import "RJSResults.hpp"
|
||||
#import "RJSSchema.hpp"
|
||||
#import "RJSArray.hpp"
|
||||
#import "RJSList.hpp"
|
||||
|
||||
#import "object_store.hpp"
|
||||
#import "object_accessor.hpp"
|
||||
@ -192,5 +192,5 @@ template<> JSValueRef RJSAccessor::list_value_at_index(JSContextRef ctx, JSValue
|
||||
return RJSValidatedObjectAtIndex(ctx, RJSValidatedValueToObject(ctx, val), (unsigned int)index);
|
||||
}
|
||||
template<> JSValueRef RJSAccessor::from_list(JSContextRef ctx, List list) {
|
||||
return RJSArrayCreate(ctx, list);
|
||||
return RJSListCreate(ctx, list);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#import "RJSRealm.hpp"
|
||||
#import "RJSObject.hpp"
|
||||
#import "RJSResults.hpp"
|
||||
#import "RJSArray.hpp"
|
||||
#import "RJSList.hpp"
|
||||
#import "RJSSchema.hpp"
|
||||
|
||||
#import "shared_realm.hpp"
|
||||
@ -280,7 +280,7 @@ JSValueRef RealmDelete(JSContextRef ctx, JSObjectRef function, JSObjectRef thisO
|
||||
|
||||
if (RJSIsValueArray(ctx, arguments[0]) ||
|
||||
JSValueIsObjectOfClass(ctx, arguments[0], RJSResultsClass()) ||
|
||||
JSValueIsObjectOfClass(ctx, arguments[0], RJSArrayClass()))
|
||||
JSValueIsObjectOfClass(ctx, arguments[0], RJSListClass()))
|
||||
{
|
||||
JSObjectRef array = RJSValidatedValueToObject(ctx, arguments[0]);
|
||||
size_t length = RJSValidatedListLength(ctx, array);
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "RealmJS.h"
|
||||
#include "RJSObject.hpp"
|
||||
#include "RJSResults.hpp"
|
||||
#include "RJSArray.hpp"
|
||||
#include "RJSList.hpp"
|
||||
#include "RJSRealm.hpp"
|
||||
#include "RJSUtil.hpp"
|
||||
|
||||
@ -166,7 +166,7 @@ using RPCRequest = std::function<NSDictionary *(NSDictionary *dictionary)>;
|
||||
_requests["/call_list_method"] = [=](NSDictionary *dict) {
|
||||
NSString *name = dict[@"name"];
|
||||
return [self performObjectMethod:name.UTF8String
|
||||
classMethods:RJSArrayFuncs
|
||||
classMethods:RJSListFuncs
|
||||
args:dict[@"arguments"]
|
||||
objectId:[dict[@"listId"] unsignedLongValue]];
|
||||
};
|
||||
@ -249,7 +249,7 @@ using RPCRequest = std::function<NSDictionary *(NSDictionary *dictionary)>;
|
||||
@"schema": [self objectSchemaToJSONObject:object->object_schema]
|
||||
};
|
||||
}
|
||||
else if (JSValueIsObjectOfClass(_context, value, RJSArrayClass())) {
|
||||
else if (JSValueIsObjectOfClass(_context, value, RJSListClass())) {
|
||||
realm::List *list = RJSGetInternal<realm::List *>(jsObject);
|
||||
RPCObjectID oid = [self storeObject:jsObject];
|
||||
return @{
|
||||
|
@ -243,9 +243,9 @@ static JSClassRef s_globalClass;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface RJSArrayTests : RealmJSTests
|
||||
@interface RJSListTests : RealmJSTests
|
||||
@end
|
||||
@implementation RJSArrayTests
|
||||
@implementation RJSListTests
|
||||
+ (NSString *)jsSuiteName {
|
||||
return @"ArrayTests";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user