[ooo-build-commit] scratch/mso-dumper
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Oct 8 22:03:24 PDT 2009
scratch/mso-dumper/src/xlsrecord.py | 40 +-----------------------------------
1 file changed, 2 insertions(+), 38 deletions(-)
New commits:
commit cc029c24986f02a8e20802863174052e9fe3cbf9
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Oct 9 01:01:47 2009 -0400
[xls-dump] Have BaseRecordHandler derive from ByteStream.
By doing this, I can remove those duplicated data members and methods.
* scratch/mso-dumper/src/xlsrecord.py:
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index b677d44..4d27dd2 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -5,15 +5,12 @@ import globals, formula
# -------------------------------------------------------------------
# record handler classes
-class BaseRecordHandler(object):
+class BaseRecordHandler(globals.ByteStream):
def __init__ (self, header, size, bytes, strmData):
+ globals.ByteStream.__init__(self, bytes)
self.header = header
- self.size = size
- self.bytes = bytes
self.lines = []
- self.pos = 0 # current byte position
-
self.strmData = strmData
def parseBytes (self):
@@ -56,25 +53,6 @@ append a line to be displayed.
text = "cell position: (col: %d; row: %d)"%(col, row)
self.appendLine(text)
- def readBytes (self, length):
- r = self.bytes[self.pos:self.pos+length]
- self.pos += length
- return r
-
- def readRemainingBytes (self):
- r = self.bytes[self.pos:]
- self.pos = self.size
- return r
-
- def getCurrentPos (self):
- return self.pos
-
- def setCurrentPos (self, pos):
- self.pos = pos
-
- def isEndOfRecord (self):
- return (self.pos == self.size)
-
def getYesNo (self, boolVal):
if boolVal:
return 'yes'
@@ -87,20 +65,6 @@ append a line to be displayed.
else:
return 'false'
- def readUnsignedInt (self, length):
- bytes = self.readBytes(length)
- return globals.getUnsignedInt(bytes)
-
- def readSignedInt (self, length):
- bytes = self.readBytes(length)
- return globals.getSignedInt(bytes)
-
- def readDouble (self):
- # double is always 8 bytes.
- bytes = self.readBytes(8)
- return globals.getDouble(bytes)
-
-# --------------------------------------------------------------------
class BOF(BaseRecordHandler):
More information about the ooo-build-commit
mailing list