forked from RaptDept/ptparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowertabinputstream.h
73 lines (62 loc) · 2.82 KB
/
powertabinputstream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/////////////////////////////////////////////////////////////////////////////
// Name: powertabinputstream.h
// Purpose: Input stream used to deserialize MFC based Power Tab data
// Author: Brad Larsen
// Modified by:
// Created: Dec 19, 2004
// RCS-ID:
// Copyright: (c) Brad Larsen
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __POWERTABINPUTSTREAM_H__
#define __POWERTABINPUTSTREAM_H__
class PowerTabObject;
WX_DECLARE_STRING_HASH_MAP(wxUint32, ClassIdHashMap);
WX_DECLARE_HASH_MAP(wxUint32, wxString, wxIntegerHash, wxIntegerEqual, ClassIdIdHashMap);
/// Input stream used to deserialize MFC based Power Tab data
class PowerTabInputStream :
public wxDataInputStream
{
friend class PowerTabFileHeader;
friend class PowerTabObject;
// Member Variables
protected:
bool m_mapsInitialized; ///< Determines whether or not the maps have been initialized
wxUint32 m_mapCount; ///< Internal count of mapped objects
PowerTabStreamError m_lastPowerTabError; ///< Last Power Tab specific error
ClassIdHashMap m_classIdHashMap; ///< Map of class Ids to the id of the class id
ClassIdIdHashMap m_classIdIdHashMap; ///< Map of Id of the class Id to the class id (opposite of above map)
wxArrayPtrVoid m_loadArray; ///< Array of pointers to loaded objects and tags
// Constructor/Destructor
public:
PowerTabInputStream(wxInputStream& stream);
~PowerTabInputStream();
// Read Functions
wxUint32 ReadCount();
bool ReadAnsiText(wxUint32 length, wxString& text);
bool ReadMFCString(wxString& string);
bool ReadWin32ColorRef(wxColor& color);
bool ReadMFCRect(wxRect& rect);
PowerTabObject* ReadObject(wxWord version);
protected:
bool ReadClassInformation(wxWord version, wxString& classId,
wxUint32& objectTag);
wxUint32 ReadMFCStringLength(wxUint32& charSize);
// Error Checking Functions
public:
/// Checks the current state of the stream
/// @return True if the stream is OK, false if an error has occurred
bool CheckState()
{return (IsOk() && (m_lastPowerTabError == POWERTABSTREAM_NO_ERROR));}
wxString GetLastErrorMessage();
protected:
bool CheckCount();
// Operations
bool MapObject(const PowerTabObject* object);
public:
/// Gets the current stream position, in bytes
/// @return The current stream position, in bytes
off_t TellI() const
{wxCHECK(m_input != NULL, 0); return (m_input->TellI());}
};
#endif