-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchordtext.h
112 lines (98 loc) · 4.1 KB
/
chordtext.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/////////////////////////////////////////////////////////////////////////////
// Name: chordtext.h
// Purpose: Stores and renders chord text
// Author: Brad Larsen
// Modified by:
// Created: Jan 3, 2005
// RCS-ID:
// Copyright: (c) Brad Larsen
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __CHORDTEXT_H__
#define __CHORDTEXT_H__
#include "chordname.h"
/// Stores and renders chord text
class ChordText : public PowerTabObject
{
friend class ChordTextTestSuite;
// Constants
public:
// Default Constants
static const wxByte DEFAULT_POSITION; ///< Default value for the position member variable
// Member Variables
protected:
wxByte m_position; ///< Zero-based index of the position within the system where the chord text is anchored
ChordName m_chordName; ///< Chord name data (see ChordName class for details)
// Constructor/Destructor
public:
ChordText();
ChordText(wxUint32 position, const ChordName& chordName);
ChordText(const ChordText& chordText);
~ChordText();
// Creation Functions
/// Creates an exact duplicate of the object
/// @return The duplicate object
PowerTabObject* CloneObject() const
{return (new ChordText(*this));}
// Operators
const ChordText& operator=(const ChordText& chordText);
bool operator==(const ChordText& chordText) const;
bool operator!=(const ChordText& chordText) const;
// Serialization functions
protected:
bool DoSerialize(PowerTabOutputStream& stream);
bool DoDeserialize(PowerTabInputStream& stream, wxWord version);
// MFC Class Functions
public:
/// Gets the MFC Class Name for the object
/// @return The MFC Class Name
wxString GetMFCClassName() const
{return (wxT("CChordText"));}
/// Gets the MFC Class Schema for the object
/// @return The MFC Class Schema
wxWord GetMFCClassSchema() const
{return ((wxWord)1);}
// Position Functions
/// Determines whether a position is valid
/// @param position Position to validate
/// @return True if the position is valid, false if not
static bool IsValidPosition(wxUint32 position)
{return ((position >= 0) && (position <= 255));}
/// Sets the position within the system where the chord text is anchored
/// @param position Zero-based index within the system where the chord text
/// is anchored
/// @return True if the position was set, false if not
bool SetPosition(wxUint32 position)
{
wxCHECK(IsValidPosition(position), false);
m_position = (wxByte)position;
return (true);
}
/// Gets the position within the system where the chord text is anchored
/// @return The position within the system where the chord text is anchored
wxUint32 GetPosition() const
{return (m_position);}
// Chord Name Functions
/// Sets the chord name
void SetChordName(const ChordName& chordName)
{m_chordName = chordName;}
/// Gets the chord name
/// @return The chord name
ChordName GetChordName() const
{return (m_chordName);}
/// Gets a referenced to the chord name
/// @return A reference to the chord name
ChordName& GetChordNameRef()
{return (m_chordName);}
/// Gets a constant reference to the chord name
/// @return A constant reference to the chord name
const ChordName& GetChordNameConstRef() const
{return (m_chordName);}
/// Gets a pointer to the chord name
/// @return A pointer to the chord name
ChordName* GetChordNamePtr()
{return (&m_chordName);}
};
// Array Declarations
WX_DEFINE_POWERTABARRAY(ChordText*, ChordTextArray);
#endif