[gjs/master.windows: 2/9] gi/*.h: Be clear about the templates used with friend classes



commit c6849a99a66392e4cef9f47fa50411f2ec8b0675
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 12:45:17 2019 +0800

    gi/*.h: Be clear about the templates used with friend classes
    
    Some compilers (such as Visual Studio) want us to be clear about the
    templates that we use for the templatized friend classes of the
    various (templatized) classes that we use.  This makes those friend
    classes clear about the templates.
    
    See: 
https://stackoverflow.com/questions/54754742/non-class-template-has-already-been-declared-as-a-class-template

 gi/boxed.h       | 11 ++++++-----
 gi/fundamental.h | 15 ++++++++++-----
 gi/gerror.h      | 13 ++++++++-----
 gi/interface.h   | 15 ++++++++++-----
 gi/object.h      | 11 ++++++-----
 gi/union.h       | 12 +++++++-----
 6 files changed, 47 insertions(+), 30 deletions(-)
---
diff --git a/gi/boxed.h b/gi/boxed.h
index 5b2c348b..acb69a47 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -55,7 +55,7 @@ class BoxedInstance;
 
 class BoxedBase
     : public GIWrapperBase<BoxedBase, BoxedPrototype, BoxedInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<BoxedBase, BoxedPrototype, BoxedInstance>;
 
  protected:
     explicit BoxedBase(BoxedPrototype* proto = nullptr)
@@ -89,8 +89,9 @@ class BoxedBase
 
 class BoxedPrototype : public GIWrapperPrototype<BoxedBase, BoxedPrototype,
                                                  BoxedInstance, GIStructInfo> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<BoxedBase, BoxedPrototype,
+                                    BoxedInstance, GIStructInfo>;
+    friend class GIWrapperBase<BoxedBase, BoxedPrototype, BoxedInstance>;
 
     using FieldMap =
         JS::GCHashMap<JS::Heap<JSString*>, GjsAutoFieldInfo,
@@ -155,8 +156,8 @@ class BoxedPrototype : public GIWrapperPrototype<BoxedBase, BoxedPrototype,
 
 class BoxedInstance
     : public GIWrapperInstance<BoxedBase, BoxedPrototype, BoxedInstance> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<BoxedBase, BoxedPrototype, BoxedInstance>;
+    friend class GIWrapperBase<BoxedBase, BoxedPrototype, BoxedInstance>;
     friend class BoxedBase;  // for field_getter, etc.
 
     bool m_allocated_directly : 1;
diff --git a/gi/fundamental.h b/gi/fundamental.h
index 44d9850b..5c04558b 100644
--- a/gi/fundamental.h
+++ b/gi/fundamental.h
@@ -45,7 +45,8 @@ class FundamentalInstance;
 class FundamentalBase
     : public GIWrapperBase<FundamentalBase, FundamentalPrototype,
                            FundamentalInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<FundamentalBase, FundamentalPrototype,
+                               FundamentalInstance>;
 
  protected:
     explicit FundamentalBase(FundamentalPrototype* proto = nullptr)
@@ -66,8 +67,10 @@ class FundamentalBase
 class FundamentalPrototype
     : public GIWrapperPrototype<FundamentalBase, FundamentalPrototype,
                                 FundamentalInstance> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<FundamentalBase, FundamentalPrototype,
+                                    FundamentalInstance>;
+    friend class GIWrapperBase<FundamentalBase, FundamentalPrototype,
+                               FundamentalInstance>;
 
     GIObjectInfoRefFunction m_ref_function;
     GIObjectInfoUnrefFunction m_unref_function;
@@ -122,8 +125,10 @@ class FundamentalPrototype
 class FundamentalInstance
     : public GIWrapperInstance<FundamentalBase, FundamentalPrototype,
                                FundamentalInstance> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<FundamentalBase, FundamentalPrototype,
+                                   FundamentalInstance>;
+    friend class GIWrapperBase<FundamentalBase, FundamentalPrototype,
+                               FundamentalInstance>;
 
     explicit FundamentalInstance(JSContext* cx, JS::HandleObject obj);
     ~FundamentalInstance(void);
diff --git a/gi/gerror.h b/gi/gerror.h
index c516a2b0..352b948f 100644
--- a/gi/gerror.h
+++ b/gi/gerror.h
@@ -51,7 +51,7 @@ class ErrorInstance;
 
 class ErrorBase
     : public GIWrapperBase<ErrorBase, ErrorPrototype, ErrorInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<ErrorBase, ErrorPrototype, ErrorInstance>;
 
  protected:
     explicit ErrorBase(ErrorPrototype* proto = nullptr)
@@ -93,8 +93,9 @@ class ErrorBase
 
 class ErrorPrototype : public GIWrapperPrototype<ErrorBase, ErrorPrototype,
                                                  ErrorInstance, GIEnumInfo> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<ErrorBase, ErrorPrototype,
+                                    ErrorInstance, GIEnumInfo>;
+    friend class GIWrapperBase<ErrorBase, ErrorPrototype, ErrorInstance>;
 
     GQuark m_domain;
 
@@ -110,8 +111,10 @@ class ErrorPrototype : public GIWrapperPrototype<ErrorBase, ErrorPrototype,
 
 class ErrorInstance : public GIWrapperInstance<ErrorBase, ErrorPrototype,
                                                ErrorInstance, GError> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<ErrorBase, ErrorPrototype,
+                                   ErrorInstance, GError>;
+    friend class GIWrapperBase<ErrorBase, ErrorPrototype,
+                               ErrorInstance>;
 
     explicit ErrorInstance(JSContext* cx, JS::HandleObject obj);
     ~ErrorInstance(void);
diff --git a/gi/interface.h b/gi/interface.h
index e91197ef..7d100e90 100644
--- a/gi/interface.h
+++ b/gi/interface.h
@@ -50,7 +50,8 @@ class InterfaceInstance;
 
 class InterfaceBase : public GIWrapperBase<InterfaceBase, InterfacePrototype,
                                            InterfaceInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<InterfaceBase, InterfacePrototype,
+                               InterfaceInstance>;
 
  protected:
     explicit InterfaceBase(InterfacePrototype* proto = nullptr)
@@ -83,8 +84,10 @@ class InterfaceBase : public GIWrapperBase<InterfaceBase, InterfacePrototype,
 class InterfacePrototype
     : public GIWrapperPrototype<InterfaceBase, InterfacePrototype,
                                 InterfaceInstance, GIInterfaceInfo> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<InterfaceBase, InterfacePrototype,
+                                    InterfaceInstance, GIInterfaceInfo>;
+    friend class GIWrapperBase<InterfaceBase, InterfacePrototype,
+                               InterfaceInstance>;
     friend class InterfaceBase;  // for has_instance_impl
 
     // the GTypeInterface vtable wrapped by this JS object
@@ -108,8 +111,10 @@ class InterfacePrototype
 class InterfaceInstance
     : public GIWrapperInstance<InterfaceBase, InterfacePrototype,
                                InterfaceInstance> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<InterfaceBase, InterfacePrototype,
+                                   InterfaceInstance>;
+    friend class GIWrapperBase<InterfaceBase, InterfacePrototype,
+                               InterfaceInstance>;
 
     G_GNUC_NORETURN InterfaceInstance(JSContext* cx, JS::HandleObject obj)
         : GIWrapperInstance(cx, obj) {
diff --git a/gi/object.h b/gi/object.h
index 5c34f70e..b0cfe85a 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -79,7 +79,7 @@ class ObjectPrototype;
  */
 class ObjectBase
     : public GIWrapperBase<ObjectBase, ObjectPrototype, ObjectInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<ObjectBase, ObjectPrototype, ObjectInstance>;
 
  protected:
     /* a list of all GClosures installed on this object (from
@@ -167,8 +167,8 @@ class ObjectBase
 
 class ObjectPrototype
     : public GIWrapperPrototype<ObjectBase, ObjectPrototype, ObjectInstance> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<ObjectBase, ObjectPrototype, ObjectInstance>;
+    friend class GIWrapperBase<ObjectBase, ObjectPrototype, ObjectInstance>;
 
     using PropertyCache =
         JS::GCHashMap<JS::Heap<JSString*>, GjsAutoParam,
@@ -250,8 +250,9 @@ class ObjectPrototype
 
 class ObjectInstance : public GIWrapperInstance<ObjectBase, ObjectPrototype,
                                                 ObjectInstance, GObject> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<ObjectBase, ObjectPrototype,
+                                   ObjectInstance, GObject>;
+    friend class GIWrapperBase<ObjectBase, ObjectPrototype, ObjectInstance>;
     friend class ObjectBase;  // for add_property, prop_getter, etc.
 
     // GIWrapperInstance::m_ptr may be null in ObjectInstance.
diff --git a/gi/union.h b/gi/union.h
index 2d1665e6..1b6bba90 100644
--- a/gi/union.h
+++ b/gi/union.h
@@ -37,7 +37,7 @@ class UnionInstance;
 
 class UnionBase
     : public GIWrapperBase<UnionBase, UnionPrototype, UnionInstance> {
-    friend class GIWrapperBase;
+    friend class GIWrapperBase<UnionBase, UnionPrototype, UnionInstance>;
 
  protected:
     explicit UnionBase(UnionPrototype* proto = nullptr)
@@ -55,8 +55,10 @@ class UnionBase
 
 class UnionPrototype : public GIWrapperPrototype<UnionBase, UnionPrototype,
                                                  UnionInstance, GIUnionInfo> {
-    friend class GIWrapperPrototype;
-    friend class GIWrapperBase;
+    friend class GIWrapperPrototype<UnionBase, UnionPrototype,
+                                    UnionInstance, GIUnionInfo>;
+    friend class GIWrapperBase<UnionBase, UnionPrototype,
+                               UnionInstance>;
 
     explicit UnionPrototype(GIUnionInfo* info, GType gtype);
     ~UnionPrototype(void);
@@ -71,8 +73,8 @@ class UnionPrototype : public GIWrapperPrototype<UnionBase, UnionPrototype,
 
 class UnionInstance
     : public GIWrapperInstance<UnionBase, UnionPrototype, UnionInstance> {
-    friend class GIWrapperInstance;
-    friend class GIWrapperBase;
+    friend class GIWrapperInstance<UnionBase, UnionPrototype, UnionInstance>;
+    friend class GIWrapperBase<UnionBase, UnionPrototype, UnionInstance>;
 
     explicit UnionInstance(JSContext* cx, JS::HandleObject obj);
     ~UnionInstance(void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]