activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r507044 - /activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
Date Tue, 13 Feb 2007 15:22:21 GMT
Author: tabish
Date: Tue Feb 13 07:22:20 2007
New Revision: 507044

URL: http://svn.apache.org/viewvc?view=rev&rev=507044
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java

Modified: activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java?view=diff&rev=507044&r1=507043&r2=507044
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppClassesGenerator.java
Tue Feb 13 07:22:20 2007
@@ -374,7 +374,70 @@
 out.println("        return false;");
 out.println("    }");
 
-out.println("    return false;" );
+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 = "";
+    String getter = property.getGetter().getSimpleName();
+    String setter = property.getSetter().getSimpleName();
+
+    if( property.getType().getSimpleName().equals("ByteSequence") ) {
+
+out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " < this->"+getter+"().size();
++i" + parameterName + " ) {");
+out.println("        if( "+propertyName+"[i" + parameterName+"] != this->"+getter+"()[i"+parameterName+"]
) {" );
+out.println("            return false;" );
+out.println("        }" );
+out.println("    }" );
+
+    } else if( property.getType().isPrimitiveType() ||
+               type.equals("std::string") ){
+
+out.println("    if( "+propertyName+" != valuePtr->"+getter+"() ) {");
+out.println("        return false;" );
+out.println("    }" );
+
+    } else if( property.getType().isArrayType() &&
+               !property.getType().getArrayComponentType().isPrimitiveType() ) {
+
+        String arrayType = property.getType().getArrayComponentType().getSimpleName();
+
+out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " < this->"+getter+"().size();
++i" + parameterName + " ) {");
+out.println("        if( this->"+getter+"()[i"+parameterName+"] != NULL )" );
+out.println("            if( !( this->"+getter+"()[i"+parameterName+"]->equals( valuePtr->"+getter+"()[i"+parameterName+"]
) ) {" );
+out.println("                return false;");
+out.println("            }");
+out.println("        } else if( valuePtr->"+getter+"()[i"+parameterName+"] != NULL ) {");
+out.println("            return false;");
+out.println("        }");
+out.println("    }");
+    } else if( property.getType().isArrayType() &&
+               property.getType().getArrayComponentType().isPrimitiveType() ) {
+out.println("    for( size_t i" + parameterName + " = 0; i" + parameterName + " < this->"+getter+"().size();
++i" + parameterName + " ) {");
+out.println("        if( "+propertyName+"[i"+parameterName+"] != valuePtr->"+getter+"()[i"+parameterName+"]
) {");
+out.println("            return false;");
+out.println("        }");
+out.println("    }");
+    } else {
+out.println("    if( this->"+getter+"() != NULL ) {");
+out.println("        if( !( this->"+getter+"()[i"+parameterName+"]->equals( valuePtr->"+getter+"()[i"+parameterName+"]
) ) {" );
+out.println("            return false;");
+out.println("        }");
+out.println("    } else if( valuePtr->"+getter+"()[i"+parameterName+"] != NULL ) {");
+out.println("        return false;");
+out.println("    }");
+    }
+}
+
+    if( baseClass != null ) {
+out.println("    // Copy the data of the base class or classes");
+out.println("    if( !"+getProperBaseClassName( className, baseClass )+"::equals( value )
) {");
+out.println("        return false;");
+out.println("    }");
+    }
+
+out.println("    return true;" );
 out.println("}");
 
        for( Iterator iter = properties.iterator(); iter.hasNext(); ) {



Mime
View raw message