acoliver    02/05/14 17:56:18

  Modified:    src/scratchpad/src/org/apache/poi/generator
                        FieldIterator.java RecordUtil.java
  Log:
  Support test expression
  
  Revision  Changes    Path
  1.7       +11 -4     
jakarta-poi/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java
  
  Index: FieldIterator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FieldIterator.java        19 Apr 2002 10:48:25 -0000      1.6
  +++ FieldIterator.java        15 May 2002 00:56:18 -0000      1.7
  @@ -74,6 +74,12 @@
           offset = 0;
       }
   
  +    /** 
  +     * This utility function returns a fill method entry for a given field
  +     *
  +     * @param size - how big of an "int" or the name of the size field for a string
  +     * @param type - int or string
  +     */    
       public String fillDecoder(String size, String type)
       {
           String javaType = RecordUtil.getType(size, type, 0);
  @@ -89,8 +95,8 @@
               result = "data[ 0x" + Integer.toHexString(offset) + " + offset ]";
           else if (javaType.equals("double"))
               result = "LittleEndian.getDouble(data, 0x" + 
Integer.toHexString(offset) + " + offset)";
  -        else if (javaType.equals("ExcelString"))
  -            result = "ExcelStringUtil.decodeExcelString(data, 0x" + 
Integer.toHexString(offset) + " + offset)";
  +        else if (javaType.equals("String"))
  +            result = "StringUtil.getFromUnicode(data, 0x" + 
Integer.toHexString(offset) + " + offset,"+ size + ")";
   
           try
           {
  @@ -101,6 +107,7 @@
           }
           return result;
       }
  +    
   
       //position(),@name,@size,@type
       public String serialiseEncoder( int fieldNumber, String fieldName, String size, 
String type)
  @@ -120,7 +127,7 @@
           else if (javaType.equals("double"))
               result = "LittleEndian.putDouble(data, " + (offset+4) + " + offset, " + 
javaFieldName + ");";
           else if (javaType.equals("ExcelString"))
  -            result = "StringUtil.putUncompressedUnicode(getFontName(), data, 20 + 
offset);";
  +            result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, 
20 + offset);";
   
           try
           {
  @@ -139,7 +146,7 @@
           if ("var".equals(size))
           {
               String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
  -            return result + javaFieldName + ".sizeInBytes()";
  +            return result + " ("+javaFieldName + ".length() *2)";
           }
           else if ("varword".equals(size))
           {
  
  
  
  1.10      +2 -2      
jakarta-poi/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java
  
  Index: RecordUtil.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RecordUtil.java   14 May 2002 18:13:33 -0000      1.9
  +++ RecordUtil.java   15 May 2002 00:56:18 -0000      1.10
  @@ -136,7 +136,7 @@
           else if (type.equals("float") && "8".equals(size))
               return pad(new StringBuffer("double"), padTo).toString();
           else if (type.equals("string"))
  -            return pad(new StringBuffer("ExcelString"), padTo).toString();
  +            return pad(new StringBuffer("String"), padTo).toString();
   
           return "short";   // if we don't know, default to short
       }
  @@ -152,7 +152,7 @@
           else if (numeric && "2".equals(size))
               result = pad(new StringBuffer("short"), padTo);
           else if (type.equals("string"))
  -            result = pad(new StringBuffer("ExcelString"), padTo);
  +            result = pad(new StringBuffer("String"), padTo);
           else
               return "";
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to