aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew C. Oliver <acoliver@apache.org>2002-05-18 15:57:43 +0000
committerAndrew C. Oliver <acoliver@apache.org>2002-05-18 15:57:43 +0000
commit7b158ebef0d135bc7e894453c99a62982e2bde77 (patch)
treeb46d15e020b4c73d05d923cd72144f8107b07cee
parent9c5fdfbf9ec83e5c24c7f4a83465de73d9f035d0 (diff)
downloadpoi-7b158ebef0d135bc7e894453c99a62982e2bde77.tar.gz
poi-7b158ebef0d135bc7e894453c99a62982e2bde77.zip
fixes to handle new string type
PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352626 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/scratchpad/src/org/apache/poi/generator/FieldIterator.java17
-rw-r--r--src/scratchpad/src/org/apache/poi/generator/RecordUtil.java6
2 files changed, 17 insertions, 6 deletions
diff --git a/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java b/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java
index 4badc9afd0..74e0592191 100644
--- a/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java
+++ b/src/scratchpad/src/org/apache/poi/generator/FieldIterator.java
@@ -95,8 +95,10 @@ public class FieldIterator
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("String"))
- result = "StringUtil.getFromUnicode(data, 0x" + Integer.toHexString(offset) + " + offset,"+ size + ")";
+ else if (javaType.equals("String") && !type.equals("hbstring"))
+ result = "StringUtil.getFromUnicode(data, 0x" + Integer.toHexString(offset) + " + offset,("+ size + "-1)/2)";
+ else if (javaType.equals("String") && type.equals("hbstring"))
+ result = "StringUtil.getFromUnicodeHigh(data, 0x" + Integer.toHexString(offset) + " + offset, ("+ size+"/2))";
try
{
@@ -126,8 +128,11 @@ public class FieldIterator
result = "data[ " + (offset+4) + " + offset ] = " + javaFieldName + ";";
else if (javaType.equals("double"))
result = "LittleEndian.putDouble(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
- else if (javaType.equals("ExcelString"))
- result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, 20 + offset);";
+ else if (javaType.equals("String") && !type.equals("hbstring"))
+ result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, offset+4);";
+ else if (javaType.equals("String") && type.equals("hbstring"))
+ result = "StringUtil.putUncompressedUnicodeHigh("+ javaFieldName +", data, "+(offset+4)+" + offset);";
+
try
{
@@ -152,12 +157,12 @@ public class FieldIterator
{
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
return result + javaFieldName + ".length * 2 + 2";
- }
- else
+ } else
{
return result + size;
}
}
+
}
diff --git a/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java b/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java
index 84416346a1..b5c0a594ce 100644
--- a/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java
+++ b/src/scratchpad/src/org/apache/poi/generator/RecordUtil.java
@@ -137,6 +137,9 @@ public class RecordUtil
return pad(new StringBuffer("double"), padTo).toString();
else if (type.equals("string"))
return pad(new StringBuffer("String"), padTo).toString();
+ else if (type.equals("hbstring"))
+ return pad(new StringBuffer("String"), padTo).toString();
+
return "short"; // if we don't know, default to short
}
@@ -153,6 +156,9 @@ public class RecordUtil
result = pad(new StringBuffer("short"), padTo);
else if (type.equals("string"))
result = pad(new StringBuffer("String"), padTo);
+ else if (type.equals("hbstring"))
+ result = pad(new StringBuffer("HighByteString"), padTo);
+
else
return "";