activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r465075 - /incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java
Date Tue, 17 Oct 2006 22:11:52 GMT
Author: tabish
Date: Tue Oct 17 15:11:50 2006
New Revision: 465075

URL: http://svn.apache.org/viewvc?view=rev&rev=465075
Log:
Store in progress openwire generator scripts here for now

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java?view=diff&rev=465075&r1=465074&r2=465075
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/temp-scripts/AmqCppClassesGenerator.java
Tue Oct 17 15:11:50 2006
@@ -281,10 +281,9 @@
 out.println("////////////////////////////////////////////////////////////////////////////////");
 out.println(className+"* "+className+"::clone() const {");
 
-    String newInstance = decapitalize(className);
+    String newInstance = decapitalize( className );
 
-out.println("    "+className+"* "+newInstance+" = ");
-out.println("        new "+className+"();");
+out.println("    "+className+"* "+newInstance+" = new "+className+"();");
 out.println("");
 
     for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
@@ -299,10 +298,10 @@
             !type.startsWith("std::vector") ) {
 
 out.println("    "+newInstance+"->"+parameterName+" = this->get"+propertyName+"();");
-        } else if( property.getType().getSimpleName().startsWith("std::vector") &&
-                   type.contains( "*" ) ) {
+        } else if( property.getType().isArrayType() &&
+                !property.getType().getArrayComponentType().isPrimitiveType() ) {
 out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " < " +
parameterName + ".size(); ++i" + parameterName + " ) {");
-out.println("        "+newInstance+"->"+parameterName+".psuh_back( ");
+out.println("        "+newInstance+"->get"+propertyName+"().push_back( ");
 out.println("            this->"+parameterName+"[i"+parameterName+"]->clone();"); 
          
 out.println("    }");
         } else {
@@ -310,12 +309,38 @@
         }
     }
 
+out.println("");
+out.println("    return "+newInstance);
 out.println("}");
 
 out.println("");
 out.println("////////////////////////////////////////////////////////////////////////////////");
 out.println("void "+className+"::copy( "+className+"* dest ) const {");
 out.println("");
+
+    for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
+        JProperty property = (JProperty) iter.next();
+        String type = toCppType(property.getType());
+        String propertyName = property.getSimpleName();
+        String parameterName = decapitalize(propertyName);
+        String constNess = "";
+    
+        if( !property.getType().isPrimitiveType() &&
+            !property.getType().getSimpleName().equals("ByteSequence") && 
+            !type.startsWith("std::vector") ) {
+    
+    out.println("    dest->set"+propertyName+"( this->get"+propertyName+"() );");
+        } else if( property.getType().isArrayType() &&
+                   !property.getType().getArrayComponentType().isPrimitiveType() ) {
+    out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " <
" + parameterName + ".size(); ++i" + parameterName + " ) {");
+    out.println("        dest->get"+propertyName+"().push_back( ");
+    out.println("            this->"+parameterName+"[i"+parameterName+"]->clone() );");
           
+    out.println("    }");
+        } else {
+    out.println("    dest->set"+propertyName+"( this->get"+propertyName+"()->clone()
);");
+        }
+    }
+
 out.println("}");
 
 



Mime
View raw message