activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r505767 - in /activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts: AmqCppHeadersGenerator.java AmqCppMarshallingClassesGenerator.java
Date Sat, 10 Feb 2007 21:24:00 GMT
Author: tabish
Date: Sat Feb 10 13:23:59 2007
New Revision: 505767

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
    activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java

Modified: activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java?view=diff&rev=505767&r1=505766&r2=505767
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppHeadersGenerator.java
Sat Feb 10 13:23:59 2007
@@ -35,8 +35,8 @@
         return ".h";
     }
 
-	protected void generateFile(PrintWriter out) {
-		generateLicence(out);
+    protected void generateFile(PrintWriter out) {
+        generateLicence(out);
 
 out.println("");
 out.println("#ifndef _ACTIVEMQ_CONNECTOR_OPENWIRE_COMMANDS_"+className.toUpperCase()+"_H_");
@@ -100,47 +100,47 @@
             String name = decapitalize(property.getSimpleName());
 
             if( !property.getType().isPrimitiveType() &&
-                !property.getType().getSimpleName().equals("ByteSequence") && 
+                !property.getType().getSimpleName().equals("ByteSequence") &&
                 !property.getType().getSimpleName().equals("String") &&
                 !type.startsWith("std::vector") ) {
-                   
+
                 type = type + "*";
             }
-            
+
             out.println("        "+type+" "+name+";");
 
        }
-    
+
         String typeName = className.toUpperCase();
-    
+
 out.println("");
 out.println("    public:");
-out.println("");    
+out.println("");
 out.println("        const static unsigned char ID_"+typeName+" = "+getOpenWireOpCode(jclass)+";");
-out.println("");    
+out.println("");
 out.println("    public:");
-out.println("");    
+out.println("");
 out.println("        "+className+"();");
 out.println("        virtual ~"+className+"();");
-out.println("");    
+out.println("");
 out.println("        /**");
-out.println("         * Get the unique identifier that this object and its own");      
+out.println("         * Get the unique identifier that this object and its own");
 out.println("         * Marshaller share.");
 out.println("         * @returns new DataStructure type copy.");
 out.println("         */");
 out.println("        virtual unsigned char getDataStructureType() const;");
 out.println("");
 out.println("        /**");
-out.println("         * Clone this object and return a new instance that the");      
+out.println("         * Clone this object and return a new instance that the");
 out.println("         * caller now owns, this will be an exact copy of this one");
 out.println("         * @returns new copy of this object.");
 out.println("         */");
 out.println("        virtual DataStructure* cloneDataStructure() const;");
 out.println("");
 out.println("        /**");
-out.println("         * Copy the contents of the passed object into this objects");
+out.println("         * Copy the contents of the passed object into this object's");
 out.println("         * members, overwriting any existing data.");
-out.println("         * @return src - Source Object");
+out.println("         * @param src - Source Object");
 out.println("         */");
 out.println("        virtual void copyDataStructure( const DataStructure* src );");
 out.println("");
@@ -153,15 +153,15 @@
             String constness = "";
 
             if( !property.getType().isPrimitiveType() &&
-                !property.getType().getSimpleName().equals("ByteSequence") && 
+                !property.getType().getSimpleName().equals("ByteSequence") &&
                 !property.getType().getSimpleName().equals("String") &&
                 !type.startsWith("std::vector") ) {
-                    
+
                     type = type + "*";
             } else if( property.getType().getSimpleName().equals("String") ||
-            		   type.startsWith("std::vector") ) {
+                       type.startsWith("std::vector") ) {
 
-            	type = type + "&";
+                type = type + "&";
                 constness = "const ";
             }
 
@@ -183,6 +183,6 @@
 out.println("#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_COMMANDS_"+className.toUpperCase()+"_H_*/");
 out.println("");
 
-    }    
+    }
 
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java?view=diff&rev=505767&r1=505766&r2=505767
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/openwire-scripts/AmqCppMarshallingClassesGenerator.java
Sat Feb 10 13:23:59 2007
@@ -44,66 +44,66 @@
         if( className.equals( "BaseCommand") ) {
             return "transport::Command";
         }
-        
+
         return className;
     }
-    
+
     /**
      * Checks if the tightMarshal1 method needs an casted version of its
      * dataStructure argument and then returns true or false to indicate this
-     * to the caller.  
+     * to the caller.
      * @returns true if the tightMarshal1 method needs an info pointer.
      */
     protected boolean checkNeedsInfoPointerTM1() {
-        
+
         if( isMarshallerAware() ){
             return true;
         }
-        
+
         List properties = getProperties();
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
             JClass propertyType = property.getType();
             String type = propertyType.getSimpleName();
-            
+
             if( !( type.equals("byte") ) &&
                 !( type.equals("char") ) &&
                 !( type.equals("short") ) &&
                 !( type.equals("int") ) ) {
-                
+
                 return true;
             }
-            
+
         }
-        
+
         return false;
     }
-    
+
     /**
      * Checks if the tightMarshal2 method needs an casted version of its
      * dataStructure argument and then returns true or false to indicate this
-     * to the caller.  
+     * to the caller.
      * @returns true if the tightMarshal2 method needs an info pointer.
      */
     protected boolean checkNeedsInfoPointerTM2() {
-        
+
         if( isMarshallerAware() ){
             return true;
         }
-        
+
         List properties = getProperties();
         for (Iterator iter = properties.iterator(); iter.hasNext();) {
             JProperty property = (JProperty) iter.next();
             JClass propertyType = property.getType();
             String type = propertyType.getSimpleName();
-            
+
             if( !type.equals("boolean") ) {
-                
+
                 return true;
             }
-            
+
         }
-        
+
         return false;
     }
 
@@ -190,7 +190,7 @@
             out.println("    }");
         }
     }
-    
+
     protected int generateTightMarshal1Body(PrintWriter out) {
         List properties = getProperties();
         int baseSize = 0;
@@ -201,7 +201,7 @@
             JClass propertyType = property.getType();
             String type = propertyType.getSimpleName();
             String getter = "info->" + property.getGetter().getSimpleName() + "()";
-            
+
             if (type.equals("boolean")) {
                 out.println("    bs->writeBoolean( " + getter + " );");
             }
@@ -227,7 +227,7 @@
             else if (type.equals("byte[]") || type.equals("ByteSequence")) {
                 if (size == null) {
                     out.println("    bs->writeBoolean( " + getter + ".size() != 0 );"
);
-                    out.println("    rc += " + getter + ".size() == 0 ? 0 : " + getter +
".size() + 4;");
+                    out.println("    rc += " + getter + ".size() == 0 ? 0 : (int)" + getter
+ ".size() + 4;");
                 }
                 else {
                     baseSize += size.asInt();
@@ -321,11 +321,11 @@
             }
         }
     }
-    
+
     //////////////////////////////////////////////////////////////////////////////////////
     // This section is for the loose wire format encoding generator
     //////////////////////////////////////////////////////////////////////////////////////
-    
+
     protected void generateLooseUnmarshalBodyForProperty(PrintWriter out, JProperty property,
JAnnotationValue size) {
 
         String propertyName = property.getSimpleName();
@@ -382,7 +382,7 @@
         String propertyName = property.getSimpleName();
         String setter = property.getSetter().getSimpleName();
         String getter = property.getGetter().getSimpleName();
-        
+
         out.println();
         if (size != null) {
             out.println("    {");
@@ -473,11 +473,11 @@
             }
         }
     }
-    
-    
-	protected void generateFile(PrintWriter out) throws Exception {
-		generateLicence(out);
-		
+
+
+    protected void generateFile(PrintWriter out) throws Exception {
+        generateLicence(out);
+
 out.println("");
 out.println("#include <activemq/connector/openwire/marshal/v"+getOpenwireVersion()+"/"+className+".h>");
 out.println("");
@@ -509,29 +509,29 @@
 out.println("}");
 out.println("");
 out.println("///////////////////////////////////////////////////////////////////////////////");
-out.println("unsigned char "+className+"::getDataStructureType() const {"); 
+out.println("unsigned char "+className+"::getDataStructureType() const {");
 out.println("    return "+jclass.getSimpleName()+"::ID_"+typeName+";");
 out.println("}");
 out.println("");
     }
-    
+
 out.println("///////////////////////////////////////////////////////////////////////////////");
 out.println("void "+className+"::tightUnmarshal( OpenWireFormat* wireFormat, DataStructure*
dataStructure, DataInputStream* dataIn, BooleanStream* bs ) throw( io::IOException ) {");
 out.println("");
 out.println("    "+baseClass+"::tightUnmarshal( wireFormat, dataStructure, dataIn, bs );");
 out.println("");
- 
+
     List properties = getProperties();
     boolean marshallerAware = isMarshallerAware();
     if( !properties.isEmpty() || marshallerAware ) {
 
         String properClassName = getProperClassName( jclass.getSimpleName() );
-out.println("    "+properClassName+"* info ="); 
+out.println("    "+properClassName+"* info =");
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
     }
 
     if( marshallerAware ) {
-out.println("    info->beforeUnmarshal( wireFormat );");     
+out.println("    info->beforeUnmarshal( wireFormat );");
 out.println("");
     }
 
@@ -541,7 +541,7 @@
 out.println("");
 out.println("    info->afterUnmarshal( wireFormat );");
     }
-    
+
 out.println("}");
 out.println("");
 out.println("///////////////////////////////////////////////////////////////////////////////");
@@ -550,11 +550,11 @@
 
     if( checkNeedsInfoPointerTM1() ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
-out.println("    "+properClassName+"* info ="); 
+out.println("    "+properClassName+"* info =");
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
 out.println("");
     }
-        
+
     if( marshallerAware ) {
 out.println("    info->beforeMarshal( wireFormat );");
     }
@@ -562,7 +562,7 @@
 out.println("    int rc = "+baseClass+"::tightMarshal1( wireFormat, dataStructure, bs );");
 
     int baseSize = generateTightMarshal1Body(out);
-    
+
 out.println("");
 out.println("    return rc + "+baseSize+";");
 out.println("}");
@@ -575,7 +575,7 @@
 
     if( checkNeedsInfoPointerTM2() ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
-out.println("    "+properClassName+"* info ="); 
+out.println("    "+properClassName+"* info =");
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
     }
 
@@ -591,10 +591,10 @@
 out.println("void "+className+"::looseUnmarshal( OpenWireFormat* wireFormat, DataStructure*
dataStructure, DataInputStream* dataIn ) throw( io::IOException ) {");
 out.println("");
 out.println("    "+baseClass+"::looseUnmarshal( wireFormat, dataStructure, dataIn );");
- 
+
     if( !properties.isEmpty() || marshallerAware ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
-out.println("    "+properClassName+"* info ="); 
+out.println("    "+properClassName+"* info =");
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
     }
 
@@ -616,7 +616,7 @@
 
     if( !properties.isEmpty() || marshallerAware ) {
         String properClassName = getProperClassName( jclass.getSimpleName() );
-out.println("    "+properClassName+"* info ="); 
+out.println("    "+properClassName+"* info =");
 out.println("        dynamic_cast<"+properClassName+"*>( dataStructure );");
     }
 
@@ -636,10 +636,10 @@
 out.println("}");
 out.println("");
 }
-    
+
     public void generateFactory(PrintWriter out) {
-		generateLicence(out);
-        
+        generateLicence(out);
+
 out.println("#include <activemq/connector/openwire/marshal/v"+getOpenwireVersion()+"/MarshallerFactory.h>");
 
     List list = new ArrayList(getConcreteClasses());
@@ -649,11 +649,11 @@
             JClass c2 = (JClass) o2;
             return c1.getSimpleName().compareTo(c2.getSimpleName());
     }});
-    
+
     for (Iterator iter = list.iterator(); iter.hasNext();) {
         JClass jclass = (JClass) iter.next();
 out.println("#include <activemq/connector/openwire/marshal/v"+getOpenwireVersion()+"/"+jclass.getSimpleName()+"Marshaller.h>");
-    }        
+    }
 
 out.println("");
 out.println("/*");
@@ -680,7 +680,7 @@
     for (Iterator iter = list.iterator(); iter.hasNext();) {
         JClass jclass = (JClass) iter.next();
 out.println("    format->addMarshaller( new "+jclass.getSimpleName()+"Marshaller() );");
-}        
+}
 
 out.println("}");
 out.println("");



Mime
View raw message