2
2
* Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
3
3
* Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
4
* Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
5
6
* This library is free software; you can redistribute it and/or
6
7
* modify it under the terms of the GNU Lesser General Public
35
36
// returns the part if it successfully creates the part, returns NULL if it can't
36
37
// throws an exception if there is an error
37
38
// precondition: readVal us between 0x80 and 0xFF
38
WP6Part * WP6Part::constructPart(WPXInputStream *input, uint8_t readVal)
39
WP6Part * WP6Part::constructPart(WPXInputStream *input, const uint8_t readVal)
40
41
WPD_DEBUG_MSG(("WordPerfect: ConstructPart\n"));
42
43
if (readVal >= (uint8_t)0x80 && readVal <= (uint8_t)0xCF)
44
WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n"));
45
WPD_DEBUG_MSG(("WordPerfect: constructSingleByteFunction(input, val=0x%.2x)\n", readVal));
45
46
return WP6SingleByteFunction::constructSingleByteFunction(input, readVal);
47
48
else if (readVal >= (uint8_t)0xD0 && readVal <= (uint8_t)0xEF)
49
WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val)\n"));
50
if (!WP6VariableLengthGroup::isGroupConsistent(input, readVal))
52
WPD_DEBUG_MSG(("WordPerfect: Consistency Check (variable length) failed; ignoring this byte\n"));
55
WPD_DEBUG_MSG(("WordPerfect: constructVariableLengthGroup(input, val=0x%.2x)\n", readVal));
50
56
return WP6VariableLengthGroup::constructVariableLengthGroup(input, readVal);
53
59
else if (readVal >= (uint8_t)0xF0)
55
WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val)\n"));
61
if (!WP6FixedLengthGroup::isGroupConsistent(input, readVal))
63
WPD_DEBUG_MSG(("WordPerfect: Consistency Check (fixed length) failed; ignoring this byte\n"));
66
WPD_DEBUG_MSG(("WordPerfect: constructFixedLengthGroup(input, val=0x%.2x)\n", readVal));
56
67
return WP6FixedLengthGroup::constructFixedLengthGroup(input, readVal);