Browse Source

Rename @fakeref to @nocount (#2833)

1vanK 4 years ago
parent
commit
2bb682d2c2

+ 17 - 17
Source/Tools/BindingGenerator/ASClassBinder.cpp

@@ -41,11 +41,11 @@ namespace ASBindingGenerator
 static void RegisterObjectType(const ClassAnalyzer& classAnalyzer, ProcessedClass& inoutProcessedClass)
 {
     string className = classAnalyzer.GetClassName();
-    bool isFakeRef = classAnalyzer.IsFakeRef();
-    if (classAnalyzer.IsRefCounted() || isFakeRef)
+    bool isNoCount = classAnalyzer.IsNoCount();
+    if (classAnalyzer.IsRefCounted() || isNoCount)
     {
         inoutProcessedClass.objectTypeRegistration_ = "engine->RegisterObjectType(\"" + className + "\", 0, asOBJ_REF" +
-            (isFakeRef ? " | asOBJ_NOCOUNT" : "") + ");";
+            (isNoCount ? " | asOBJ_NOCOUNT" : "") + ");";
     }
     else // Value type
     {
@@ -70,7 +70,7 @@ static bool IsConstructorRequired(const ClassAnalyzer& classAnalyzer)
     if (classAnalyzer.IsRefCounted())
         return false;
 
-    if (classAnalyzer.IsFakeRef())
+    if (classAnalyzer.IsNoCount())
         return false;
 
     if (classAnalyzer.IsPod())
@@ -84,7 +84,7 @@ static bool IsDestructorRequired(const ClassAnalyzer& classAnalyzer)
     if (classAnalyzer.IsRefCounted())
         return false;
 
-    if (classAnalyzer.IsFakeRef())
+    if (classAnalyzer.IsNoCount())
         return false;
 
     if (classAnalyzer.IsPod())
@@ -152,13 +152,13 @@ static void RegisterConstructor(const MethodAnalyzer& methodAnalyzer, ProcessedC
     string cppClassName = classAnalyzer.GetClassName();
     vector<ParamAnalyzer> params = methodAnalyzer.GetParams();
 
-    bool isFakeRef = classAnalyzer.IsFakeRef();
+    bool isNoCount = classAnalyzer.IsNoCount();
 
     if (params.empty()) // Default constructor
     {
-        if (classAnalyzer.IsRefCounted() || isFakeRef)
+        if (classAnalyzer.IsRefCounted() || isNoCount)
             result.registration_ = "engine->RegisterObjectBehaviour(\"" + asClassName + "\", asBEHAVE_FACTORY, \"" +
-                                   asClassName + "@" + (isFakeRef ? "" : "+") +
+                                   asClassName + "@" + (isNoCount ? "" : "+") +
                                    " f()\", asFUNCTION(ASCompatibleFactory<" + cppClassName + ">), AS_CALL_CDECL);";
         else
             result.registration_ = "engine->RegisterObjectBehaviour(\"" + asClassName + "\", asBEHAVE_CONSTRUCT, \"void f()\", asFUNCTION(ASCompatibleConstructor<" + cppClassName + ">), AS_CALL_CDECL_OBJFIRST);";
@@ -198,9 +198,9 @@ static void RegisterConstructor(const MethodAnalyzer& methodAnalyzer, ProcessedC
             needWrapper = true;
     }
 
-    if (classAnalyzer.IsRefCounted() || classAnalyzer.IsFakeRef())
+    if (classAnalyzer.IsRefCounted() || isNoCount)
     {
-        string asDeclaration = asClassName + "@" + (isFakeRef ? "" : "+") + " f(" + JoinASDeclarations(convertedParams) + ")";
+        string asDeclaration = asClassName + "@" + (isNoCount ? "" : "+") + " f(" + JoinASDeclarations(convertedParams) + ")";
         result.registration_ = result.registration_ =
             "engine->RegisterObjectBehaviour(\"" + asClassName + "\", asBEHAVE_FACTORY, \"" + asDeclaration + "\", AS_FUNCTION("
             + GenerateWrapperName(methodAnalyzer) + ") , AS_CALL_CDECL);";
@@ -224,7 +224,7 @@ static void RegisterDestructor(const ClassAnalyzer& classAnalyzer, ProcessedClas
     if (classAnalyzer.IsRefCounted())
         return;
 
-    if (classAnalyzer.IsFakeRef())
+    if (classAnalyzer.IsNoCount())
         return;
 
     string className = classAnalyzer.GetClassName();
@@ -1300,9 +1300,9 @@ static void ProcessClass(const ClassAnalyzer& classAnalyzer)
     processedClass.hiddenFields_ = classAnalyzer.GetHiddenFields();
     processedClass.hiddenStaticFields_ = classAnalyzer.GetHiddenStaticFields();*/
 
-    bool isFakeRef = classAnalyzer.IsFakeRef();
+    bool isNoCount = classAnalyzer.IsNoCount();
 
-    if (classAnalyzer.IsAbstract() && !(classAnalyzer.IsRefCounted() || isFakeRef))
+    if (classAnalyzer.IsAbstract() && !(classAnalyzer.IsRefCounted() || isNoCount))
     {
         processedClass.objectTypeRegistration_ = "// Not registered because value types can not be abstract";
         processedClass.noBind_ = true;
@@ -1330,12 +1330,12 @@ static void ProcessClass(const ClassAnalyzer& classAnalyzer)
 
     RegisterObjectType(classAnalyzer, processedClass);
 
-    if (classAnalyzer.IsRefCounted() || isFakeRef)
+    if (classAnalyzer.IsRefCounted() || isNoCount)
     {
         vector<ClassAnalyzer> baseClasses = classAnalyzer.GetAllBaseClasses();
         for (ClassAnalyzer baseClass : baseClasses)
         {
-            if (baseClass.IsRefCounted() || baseClass.IsFakeRef())
+            if (baseClass.IsRefCounted() || baseClass.IsNoCount())
             {
                 string cppBaseClassName = baseClass.GetClassName();
                 string asBaseClassName = cppBaseClassName;
@@ -1368,9 +1368,9 @@ static void ProcessClass(const ClassAnalyzer& classAnalyzer)
         string cppClassName = classAnalyzer.GetClassName();
         string asClassName = classAnalyzer.GetClassName();
 
-        if (classAnalyzer.IsRefCounted() || isFakeRef)
+        if (classAnalyzer.IsRefCounted() || isNoCount)
             result->registration_ = "engine->RegisterObjectBehaviour(\"" + asClassName + "\", asBEHAVE_FACTORY, \"" +
-                                    asClassName + "@" + (isFakeRef ? "" : "+") + " f()\", asFUNCTION(ASCompatibleFactory<" + cppClassName + ">), AS_CALL_CDECL);";
+                                    asClassName + "@" + (isNoCount ? "" : "+") + " f()\", asFUNCTION(ASCompatibleFactory<" + cppClassName + ">), AS_CALL_CDECL);";
         else
             result->registration_ = "engine->RegisterObjectBehaviour(\"" + asClassName + "\", asBEHAVE_CONSTRUCT, \"void f()\", asFUNCTION(ASCompatibleConstructor<" + cppClassName + ">), AS_CALL_CDECL_OBJFIRST);";
 

+ 5 - 5
Source/Tools/BindingGenerator/ASUtils.cpp

@@ -458,7 +458,7 @@ ConvertedVariable CppVariableToAS(const TypeAnalyzer& type, VariableUsage usage,
     if (analyzer && Contains(analyzer->GetComment(), "NO_BIND"))
         throw Exception("Error: type \"" + cppTypeName + "\" can not automatically bind bacause have @nobind mark");
 
-    if (analyzer && analyzer->IsAbstract() && !(analyzer->IsRefCounted() || Contains(analyzer->GetComment(), "FAKE_REF")))
+    if (analyzer && analyzer->IsAbstract() && !(analyzer->IsRefCounted() || analyzer->IsNoCount()))
         throw Exception("Error: type \"" + cppTypeName + "\" can not bind bacause abstract value");
 
     // analyzer can be null for simple types (int, float) or if type "using VariantVector = Vector<Variant>"
@@ -513,8 +513,8 @@ ConvertedVariable CppVariableToAS(const TypeAnalyzer& type, VariableUsage usage,
     {
         shared_ptr<ClassAnalyzer> analyzer = FindClassByName(cppTypeName);
 
-        if (analyzer && (analyzer->IsRefCounted() || analyzer->IsFakeRef()))
-            result.asDeclaration_ = result.asDeclaration_  + "@" + (analyzer->IsFakeRef() ? "" : "+");
+        if (analyzer && (analyzer->IsRefCounted() || analyzer->IsNoCount()))
+            result.asDeclaration_ = result.asDeclaration_  + "@" + (analyzer->IsNoCount() ? "" : "+");
         else
             throw Exception("Error: type \"" + type.ToString() + "\" can not automatically bind");
     }
@@ -597,8 +597,8 @@ string CppTypeToAS(const TypeAnalyzer& type, TypeUsage typeUsage)
     {
         shared_ptr<ClassAnalyzer> analyzer = FindClassByName(type.GetNameWithTemplateParams());
 
-        if (analyzer && (analyzer->IsRefCounted() || analyzer->IsFakeRef()))
-            result = result + "@" + (analyzer->IsFakeRef() ? "" : "+");
+        if (analyzer && (analyzer->IsRefCounted() || analyzer->IsNoCount()))
+            result = result + "@" + (analyzer->IsNoCount() ? "" : "+");
         else
             throw Exception("Error: type \"" + type.ToString() + "\" can not automatically bind");
     }

+ 1 - 1
Source/Tools/BindingGenerator/Doxyfile.in

@@ -127,7 +127,7 @@ ALIASES += manualbind="MANUAL_BIND"
 ALIASES += nobind="NO_BIND"
 ALIASES += nobindtemp="NO_BIND"
 ALIASES += nobindfile="NO_BIND_FILE"
-ALIASES += fakeref="FAKE_REF"
+ALIASES += nocount="NO_COUNT"
 ALIASES += pod="IS_POD"
 ALIASES += templateversion="TEMPLATE_VERSION"
 ALIASES += allints="ALL_INTS"

+ 1 - 1
Source/Tools/BindingGenerator/XmlAnalyzer.h

@@ -304,7 +304,7 @@ public:
     bool AllFloats() const;
     bool AllInts() const;
     bool IsPod() const;
-    bool IsFakeRef() const { return Contains(GetComment(), "FAKE_REF"); }
+    bool IsNoCount() const { return Contains(GetComment(), "NO_COUNT"); } // Have @nocount in comment -> asOBJ_NOCOUNT
     shared_ptr<ClassAnalyzer> GetBaseClass() const;
     vector<ClassAnalyzer> GetBaseClasses() const;
     vector<ClassAnalyzer> GetAllBaseClasses() const;

+ 1 - 1
Source/Urho3D/Graphics/Animation.h

@@ -63,7 +63,7 @@ struct AnimationKeyFrame
 };
 
 /// Skeletal animation track, stores keyframes of a single bone.
-/// @fakeref
+/// @nocount
 struct URHO3D_API AnimationTrack
 {
     /// Construct.

+ 1 - 1
Source/Urho3D/Graphics/AnimationController.h

@@ -34,7 +34,7 @@ class Animation;
 struct Bone;
 
 /// Control data for an animation.
-/// @fakeref
+/// @nocount
 struct URHO3D_API AnimationControl
 {
     /// Construct with defaults.

+ 1 - 1
Source/Urho3D/Graphics/BillboardSet.h

@@ -35,7 +35,7 @@ class IndexBuffer;
 class VertexBuffer;
 
 /// One billboard in the billboard set.
-/// @fakeref
+/// @nocount
 struct URHO3D_API Billboard
 {
     /// Position.

+ 1 - 1
Source/Urho3D/Graphics/CustomGeometry.h

@@ -28,7 +28,7 @@ namespace Urho3D
 {
 
 /// Custom geometry vertex.
-/// @fakeref
+/// @nocount
 struct CustomGeometryVertex
 {
     /// Position.

+ 2 - 2
Source/Urho3D/Graphics/ParticleEffect.h

@@ -41,7 +41,7 @@ enum EmitterType
 };
 
 /// %Color animation frame definition.
-/// @fakeref
+/// @nocount
 struct ColorFrame
 {
     /// Construct with default values.
@@ -84,7 +84,7 @@ struct ColorFrame
 };
 
 /// %Texture animation frame definition.
-/// @fakeref
+/// @nocount
 struct TextureFrame
 {
     /// Construct with default values.

+ 2 - 2
Source/Urho3D/Graphics/Skeleton.h

@@ -43,7 +43,7 @@ class ResourceCache;
 class Serializer;
 
 /// %Bone in a skeleton.
-/// @fakeref
+/// @nocount
 struct Bone
 {
     /// Construct with defaults.
@@ -84,7 +84,7 @@ struct Bone
 };
 
 /// Hierarchical collection of bones.
-/// @fakeref
+/// @nocount
 class URHO3D_API Skeleton
 {
 public:

+ 1 - 1
Source/Urho3D/IO/Deserializer.h

@@ -30,7 +30,7 @@ namespace Urho3D
 {
 
 /// Abstract stream for reading.
-/// @fakeref
+/// @nocount
 class URHO3D_API Deserializer
 {
 public:

+ 1 - 1
Source/Urho3D/IO/Serializer.h

@@ -41,7 +41,7 @@ class Vector3;
 class Vector4;
 
 /// Abstract stream for writing.
-/// @fakeref
+/// @nocount
 class URHO3D_API Serializer
 {
 public:

+ 2 - 2
Source/Urho3D/Input/Input.h

@@ -54,7 +54,7 @@ class XMLFile;
 const IntVector2 MOUSE_POSITION_OFFSCREEN = IntVector2(M_MIN_INT, M_MIN_INT);
 
 /// %Input state for a finger touch.
-/// @fakeref
+/// @nocount
 struct TouchState
 {
     /// Return last touched UI element, used by scripting integration.
@@ -76,7 +76,7 @@ struct TouchState
 };
 
 /// %Input state for a joystick.
-/// @fakeref
+/// @nocount
 struct JoystickState
 {
     /// Initialize the number of buttons, axes and hats and set them to neutral state.

+ 1 - 1
Source/Urho3D/Urho2D/TileMapDefs2D.h

@@ -46,7 +46,7 @@ enum Orientation2D
 };
 
 /// Tile map information.
-/// @fakeref
+/// @nocount
 struct URHO3D_API TileMapInfo2D
 {
     /// Orientation.