[asterisk-scf-commits] asterisk-scf/release/ice.git branch "visitor-generators" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Dec 31 18:49:26 UTC 2010


branch "visitor-generators" has been updated
       via  86e0d94479321d8190143e11b9d9be877d3b84dc (commit)
       via  2ffa38beaabe151df379e79a3bed3fb301aab1c3 (commit)
      from  afc50c7afdd97dd35aac69569927e8778921b69b (commit)

Summary of changes:
 cpp/include/Slice/Parser.h              |    2 +-
 cpp/src/Slice/Parser.cpp                |   15 ++++++++++++++
 cpp/src/Slice/VisitorPatternVisitor.cpp |   32 +++++++++++++++++++++---------
 3 files changed, 38 insertions(+), 11 deletions(-)


- Log -----------------------------------------------------------------
commit 86e0d94479321d8190143e11b9d9be877d3b84dc
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Fri Dec 31 12:48:43 2010 -0600

    Implement Slice::ClassDef::generatedOperations().

diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index 8087615..27a4693 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -652,7 +652,7 @@ public:
     ClassList allBases() const;
     OperationList operations() const;
     OperationList allOperations() const;
-    GeneratedOperationList localOperations() const;
+    GeneratedOperationList generatedOperations() const;
     DataMemberList dataMembers() const;
     DataMemberList allDataMembers() const;
     DataMemberList classDataMembers() const;
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 56e07ac..3257d2f 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -3348,6 +3348,21 @@ Slice::ClassDef::allClassDataMembers() const
     return result;
 }
 
+GeneratedOperationList
+Slice::ClassDef::generatedOperations() const
+{
+    GeneratedOperationList result;
+    for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+    {
+        GeneratedOperationPtr q = GeneratedOperationPtr::dynamicCast(*p);
+        if(q)
+        {
+            result.push_back(q);
+        }
+    }
+    return result;
+}
+
 bool
 Slice::ClassDef::canBeCyclic() const
 {

commit 2ffa38beaabe151df379e79a3bed3fb301aab1c3
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Fri Dec 31 12:48:14 2010 -0600

    Don't insert generated operations for definitions brought
    in from included Slice files.

diff --git a/cpp/src/Slice/VisitorPatternVisitor.cpp b/cpp/src/Slice/VisitorPatternVisitor.cpp
index eb0a533..a722edc 100644
--- a/cpp/src/Slice/VisitorPatternVisitor.cpp
+++ b/cpp/src/Slice/VisitorPatternVisitor.cpp
@@ -75,11 +75,17 @@ Slice::VisitorPatternVisitor::visitClassDefStart(const ClassDefPtr& p)
 					ClassDefPtr baseVisitor = it->second, derivedVisitor;
 					findVisitableBase(_visitableBases, p, baseVisitor, derivedVisitor);
 					_visitableBases[p->scoped()] = make_pair(baseVisitor, it->second);
-					GeneratedOperationPtr gop = it->second->createGeneratedOperation("visit" + p->name(), 0, StringList());
-					gop->createParamDecl("item", p->declaration(), false);
-					gop = p->createGeneratedOperation("visit", 0,
-									  generateVisitFunctionBody("visitor", baseVisitor, it->second, "visit" + p->name()));
-					gop->createParamDecl("visitor", baseVisitor->declaration(), false);
+					if(it->second->includeLevel() == 0)
+					{
+						GeneratedOperationPtr gop = it->second->createGeneratedOperation("visit" + p->name(), 0, StringList());
+						gop->createParamDecl("item", p->declaration(), false);
+					}
+					if(p->includeLevel() == 0)
+					{
+						GeneratedOperationPtr gop = p->createGeneratedOperation("visit", 0,
+										  generateVisitFunctionBody("visitor", baseVisitor, it->second, "visit" + p->name()));
+						gop->createParamDecl("visitor", baseVisitor->declaration(), false);
+					}
 					return false;
 				}
 				else
@@ -99,11 +105,17 @@ Slice::VisitorPatternVisitor::visitClassDefStart(const ClassDefPtr& p)
 		visitableBase = findVisitableBase(_visitableBases, p, baseVisitor, derivedVisitor);
 		if(visitableBase)
 		{
-			GeneratedOperationPtr gop = derivedVisitor->createGeneratedOperation("visit" + p->name(), 0, StringList());
-			gop->createParamDecl("item", p->declaration(), false);
-			gop = p->createGeneratedOperation("visit", 0,
-							  generateVisitFunctionBody("visitor", baseVisitor, derivedVisitor, "visit" + p->name()));
-			gop->createParamDecl("visitor", baseVisitor->declaration(), false);
+			if(derivedVisitor->includeLevel() == 0)
+			{
+				GeneratedOperationPtr gop = derivedVisitor->createGeneratedOperation("visit" + p->name(), 0, StringList());
+				gop->createParamDecl("item", p->declaration(), false);
+			}
+			if(p->includeLevel() == 0)
+			{
+				GeneratedOperationPtr gop = p->createGeneratedOperation("visit", 0,
+											generateVisitFunctionBody("visitor", baseVisitor, derivedVisitor, "visit" + p->name()));
+				gop->createParamDecl("visitor", baseVisitor->declaration(), false);
+			}
 			return false;
 		}
 	}

-----------------------------------------------------------------------


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list