-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpowertabobject.h
78 lines (70 loc) · 3.08 KB
/
powertabobject.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
74
75
76
77
78
/////////////////////////////////////////////////////////////////////////////
// Name: powertabobject.h
// Purpose: Provides support for polymorphic reading/writing of Power Tab objects
// Author: Brad Larsen
// Modified by:
// Created: Dec 18, 2004
// RCS-ID:
// Copyright: (c) Brad Larsen
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __POWERTABOBJECT_H__
#define __POWERTABOBJECT_H__
class PowerTabOutputStream;
class PowerTabInputStream;
/// Provides support for polymorphic reading/writing of Power Tab objects
class PowerTabObject
{
// Constructor/Destructor
public:
PowerTabObject();
virtual ~PowerTabObject();
// Creation Functions
static PowerTabObject* CreateObject(const wxString& classId);
virtual PowerTabObject* CloneObject() const = 0;
// MFC Class Functions
/// Gets the MFC class id associated with the object
/// @return The MFC class id associated with the object
virtual wxString GetMFCClassId() const
{
return (wxString::Format(wxT("%s-%d"), GetMFCClassName().c_str(),
GetMFCClassSchema()));
}
/// Gets the MFC Class Name for the object
/// @return The MFC Class Name
virtual wxString GetMFCClassName() const
{return (wxT(""));}
/// Gets the MFC Class Schema for the object
/// @return The MFC Class Schema
virtual wxWord GetMFCClassSchema() const
{return ((wxWord)0);}
bool WriteMFCClassInformation(wxOutputStream& stream) const;
bool WriteMFCClassInformation(PowerTabOutputStream& stream) const;
static bool ReadMFCClassInformation(wxInputStream& stream, wxWord version,
wxString& classId);
static bool ReadMFCClassInformation(PowerTabInputStream& stream,
wxWord version, wxString& classId);
// Serialization Functions
bool Serialize(wxOutputStream& stream);
bool Serialize(PowerTabOutputStream& stream);
bool Deserialize(wxInputStream& stream, wxWord version);
bool Deserialize(PowerTabInputStream& stream, wxWord version);
// Note: DoSerialize/DoDeserialize are needed because of name function
// hiding problem
// (see wxWidgets Programmer Style Guide - Avoid Overloaded Virtual
// Functions topic)
protected:
/// Performs serialization for the class
/// @param stream Power Tab output stream to serialize to
/// @return True if the object was serialized, false if not
virtual bool DoSerialize(PowerTabOutputStream& WXUNUSED(stream))
{wxASSERT(false); return (false);}
/// Performs deserialization for the class
/// @param stream Power Tab input stream to deserialize from
/// @param version File version
/// @return True if the object was deserialized, false if not
virtual bool DoDeserialize(PowerTabInputStream& WXUNUSED(stream),
wxWord WXUNUSED(version))
{wxASSERT(false); return (false);}
};
#endif