ObjectClass -> ClassDefinition

This commit is contained in:
Ari Lazier 2016-04-15 10:50:15 -07:00
parent c817ac7eac
commit e8ca5ff92e
9 changed files with 18 additions and 18 deletions

View File

@ -69,17 +69,17 @@ template<typename T>
using PropertyMap = std::map<std::string, PropertyType<T>>;
template<typename T, typename U>
struct ObjectClass {
struct ClassDefinition {
// Every specialization *must* at least have a name.
std::string name;
};
template<typename T, typename U = void>
struct BaseObjectClass {
struct BaseClassDefinition {
// This pointer does not need to be set.
ObjectClass<T, U>* superclass;
ClassDefinition<T, U>* superclass;
// ObjectClass specializations should inherit from this class and override what's needed below.
// ClassDefinition specializations should inherit from this class and override what's needed below.
ConstructorType<T>* constructor;
MethodMap<T> static_methods;
PropertyMap<T> static_properties;

View File

@ -27,7 +27,7 @@ namespace js {
class Collection {};
template<typename T>
struct ObjectClass<T, Collection> : BaseObjectClass<T> {
struct ClassDefinition<T, Collection> : BaseClassDefinition<T> {
std::string const name = "Collection";
};

View File

@ -58,7 +58,7 @@ struct List {
};
template<typename T>
struct ObjectClass<T, realm::List> : BaseObjectClass<T, Collection> {
struct ClassDefinition<T, realm::List> : BaseClassDefinition<T, Collection> {
using List = List<T>;
std::string const name = "List";

View File

@ -48,7 +48,7 @@ struct RealmObject {
};
template<typename T>
struct ObjectClass<T, realm::Object> : BaseObjectClass<T> {
struct ClassDefinition<T, realm::Object> : BaseClassDefinition<T> {
using RealmObject = RealmObject<T>;
const std::string name = "RealmObject";

View File

@ -186,7 +186,7 @@ class Realm {
};
template<typename T>
struct ObjectClass<T, SharedRealm> : BaseObjectClass<T> {
struct ClassDefinition<T, SharedRealm> : BaseClassDefinition<T> {
using Realm = Realm<T>;
std::string const name = "Realm";

View File

@ -58,7 +58,7 @@ struct Results {
};
template<typename T>
struct ObjectClass<T, realm::Results> : BaseObjectClass<T, Collection> {
struct ClassDefinition<T, realm::Results> : BaseClassDefinition<T, Collection> {
using Results = Results<T>;
std::string const name = "Results";

View File

@ -26,9 +26,9 @@ namespace realm {
namespace jsc {
template<typename T>
using ObjectClass = js::ObjectClass<Types, T>;
using ClassDefinition = js::ClassDefinition<Types, T>;
using BaseObjectClass = js::BaseObjectClass<Types>;
using BaseClassDefinition = js::BaseClassDefinition<Types>;
using ConstructorType = js::ConstructorType<Types>;
using MethodType = js::MethodType<Types>;
using PropertyType = js::PropertyType<Types>;
@ -39,7 +39,7 @@ using PropertyMap = js::PropertyMap<Types>;
template<typename T>
class ObjectWrap {
static ObjectClass<T> s_class;
static ClassDefinition<T> s_class;
std::unique_ptr<T> m_object;
@ -147,7 +147,7 @@ class ObjectWrap {
}
template<typename U>
static JSClassRef get_superclass(ObjectClass<U>*) {
static JSClassRef get_superclass(ClassDefinition<U>*) {
return ObjectWrap<U>::get_class();
}
@ -289,7 +289,7 @@ inline JSClassRef ObjectWrap<void>::get_class() {
}
// The declared static variables must be defined as well.
template<typename T> ObjectClass<T> ObjectWrap<T>::s_class;
template<typename T> ClassDefinition<T> ObjectWrap<T>::s_class;
} // jsc

View File

@ -30,7 +30,7 @@ namespace jsc {
struct Types {
using Context = JSContextRef;
using GlobalContext = JSGlobalContextRef;
using ObjectClass = JSClassRef;
using ClassDefinition = JSClassRef;
using Value = JSValueRef;
using Object = JSObjectRef;
using String = JSStringRef;

View File

@ -25,7 +25,7 @@ namespace realm {
namespace node {
template<typename T>
using ObjectClass = js::ObjectClass<Types, T>;
using ClassDefinition = js::ClassDefinition<Types, T>;
using ConstructorType = js::ConstructorType<Types>;
using MethodType = js::MethodType<Types>;
@ -69,7 +69,7 @@ static inline void setup_property(v8::Local<v8::ObjectTemplate> tpl, const std::
template<typename T>
class ObjectWrap : public Nan::ObjectWrap {
static ObjectClass<T> s_class;
static ClassDefinition<T> s_class;
static Nan::Persistent<v8::Function> s_constructor;
static Nan::Persistent<v8::FunctionTemplate> s_template;
@ -165,7 +165,7 @@ class ObjectWrap : public Nan::ObjectWrap {
};
// The declared static variables must be defined as well.
template<typename T> ObjectClass<T> ObjectWrap<T>::s_class;
template<typename T> ClassDefinition<T> ObjectWrap<T>::s_class;
template<typename T> Nan::Persistent<v8::Function> ObjectWrap<T>::s_constructor;
template<typename T> Nan::Persistent<v8::FunctionTemplate> ObjectWrap<T>::s_template;