[asterisk-scf-commits] asterisk-scf/integration/slice-plugins.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jan 4 13:16:53 UTC 2011


branch "master" has been updated
       via  d3f29246702159f4ca0dea9950b5701da027ec6a (commit)
      from  4640e586f45e3fe06c33e0972f1bad13db8efb78 (commit)

Summary of changes:
 src/SliceVisitorPattern.cpp |   80 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 71 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit d3f29246702159f4ca0dea9950b5701da027ec6a
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Tue Jan 4 07:16:06 2011 -0600

    Add framework for additional languages.
    
    Add error handling for unsupported languages.

diff --git a/src/SliceVisitorPattern.cpp b/src/SliceVisitorPattern.cpp
index 96d950a..3f45e8a 100644
--- a/src/SliceVisitorPattern.cpp
+++ b/src/SliceVisitorPattern.cpp
@@ -243,19 +243,35 @@ VisitorPatternVisitor::visitClassDefStart(const ClassDefPtr& p)
 	return false;
 }
 
-class ICE_DECLSPEC_EXPORT CPPVisitorPatternVisitor : public VisitorPatternVisitor
+class ICE_DECLSPEC_EXPORT CPPVisitor : public VisitorPatternVisitor
+{
+protected:
+        StringList generateVisitFunctionBody(const std::string&, const ClassDefPtr&, const ClassDefPtr&, const std::string&);
+};
+
+class ICE_DECLSPEC_EXPORT CSVisitor : public VisitorPatternVisitor
+{
+protected:
+        StringList generateVisitFunctionBody(const std::string&, const ClassDefPtr&, const ClassDefPtr&, const std::string&);
+};
+
+class ICE_DECLSPEC_EXPORT JavaVisitor : public VisitorPatternVisitor
+{
+protected:
+        StringList generateVisitFunctionBody(const std::string&, const ClassDefPtr&, const ClassDefPtr&, const std::string&);
+};
+
+class ICE_DECLSPEC_EXPORT PythonVisitor : public VisitorPatternVisitor
 {
 protected:
         StringList generateVisitFunctionBody(const std::string&, const ClassDefPtr&, const ClassDefPtr&, const std::string&);
 };
 
-// This function is fairly straightforward; see VisitorPatternVisitor above for a description
-// of its parameters and return value.
 StringList
-CPPVisitorPatternVisitor::generateVisitFunctionBody(const string& paramName,
-						    const ClassDefPtr& baseVisitor,
-						    const ClassDefPtr& derivedVisitor,
-						    const string& operationName)
+CPPVisitor::generateVisitFunctionBody(const string& paramName,
+				      const ClassDefPtr& baseVisitor,
+				      const ClassDefPtr& derivedVisitor,
+				      const string& operationName)
 {
     ostringstream ostr;
     StringList body;
@@ -284,13 +300,59 @@ CPPVisitorPatternVisitor::generateVisitFunctionBody(const string& paramName,
     return body;
 }
 
+StringList
+JavaVisitor::generateVisitFunctionBody(const string& paramName,
+				       const ClassDefPtr& baseVisitor,
+				       const ClassDefPtr& derivedVisitor,
+				       const string& operationName)
+{
+	return StringList();
+}
+
+StringList
+CSVisitor::generateVisitFunctionBody(const string& paramName,
+					 const ClassDefPtr& baseVisitor,
+					 const ClassDefPtr& derivedVisitor,
+					 const string& operationName)
+{
+	return StringList();
+}
+
+StringList
+PythonVisitor::generateVisitFunctionBody(const string& paramName,
+					 const ClassDefPtr& baseVisitor,
+					 const ClassDefPtr& derivedVisitor,
+					 const string& operationName)
+{
+	return StringList();
+}
+
 extern "C"
 {
 	ICE_DECLSPEC_EXPORT PluginVisitorList*
-	create(Plugin::Language language)
+	create(Language language)
 	{
 		PluginVisitorList* result = new PluginVisitorList();
-		result->push_back(new CPPVisitorPatternVisitor);
+		switch(language)
+		{
+		case LanguageCXX:
+			result->push_back(new CPPVisitor);
+			break;
+		case LanguageCS:
+			result->push_back(new CSVisitor);
+			break;
+		case LanguageJava:
+			result->push_back(new JavaVisitor);
+			break;
+		case LanguagePython:
+			result->push_back(new PythonVisitor);
+			break;
+		default:
+			cerr << "SliceVisitorPattern plugin does not support language " << language << "." << endl;
+			delete result;
+			result = 0;
+			break;
+		}
 		return result;
 	}
 }

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


-- 
asterisk-scf/integration/slice-plugins.git



More information about the asterisk-scf-commits mailing list