CFugue
Public Member Functions | Static Public Member Functions | List of all members
CFugue::Chords Class Reference

Maniuplates Chord definitions for Western Music More...

#include <Chords.h>

Public Member Functions

 Chords ()
 Initialize the Chords with default definitions.
 
 Chords (const ChordDef *pChords, int nSize)
 
void LoadDefinitions (const ChordDef *pChords=NULL, int nSize=0)
 
void AddDefinitions (const ChordDef *pChords, int nSize)
 
unsigned int ExtractMatchingChord (const TCHAR *szToken, ChordDef *retVal) const
 

Static Public Member Functions

static unsigned int GetDefaultMatchingChord (const TCHAR *szToken, ChordDef *retVal)
 

Detailed Description

Maniuplates Chord definitions for Western Music

Definition at line 31 of file Chords.h.

Constructor & Destructor Documentation

CFugue::Chords::Chords ( const ChordDef pChords,
int  nSize 
)

Initialize the Chords with custom Chord definitions. If supplied array is empty, default values will be loaded. Only references to the ChordDef are stored in the Chords class. So ensure that the supplied pChords is not freed till this Chords object is released.

Parameters
pChordsArray of Chord definitions.
nSizeSize of the pChords Array

Definition at line 140 of file Chords.cpp.

References LoadDefinitions().

Member Function Documentation

void CFugue::Chords::AddDefinitions ( const ChordDef pChords,
int  nSize 
)

Adds the supplied definitions to the existing ones. Caller has to ensure that the new values do not add duplicates to existing ones. The input array should not be freed before this Chords object is freed.

Parameters
pChordsArray of Chord definitions.
nSizeSize of the pChords Array

Definition at line 156 of file Chords.cpp.

unsigned int CFugue::Chords::ExtractMatchingChord ( const TCHAR *  szToken,
ChordDef retVal 
) const

Retrieves the chord that suits the first part of the given string. If you have not added any custom definitions with AddDefinitions(), then you might find the static GetDefaultMatchingChord() method more convenient.

Parameters
szTokenthe string that has any Chord name at its start
retValthe ChordDef object that has a Chord with its name present in the szToken
Returns
the number of characters correctly matched. Zero, if no match found

Definition at line 163 of file Chords.cpp.

Referenced by GetDefaultMatchingChord().

unsigned int CFugue::Chords::GetDefaultMatchingChord ( const TCHAR *  szToken,
ChordDef retVal 
)
static

Retrieves the chord that suits the first part of the given string. Same as ExtractMatchingChord, except that this method is static and uses only the in-built default chord definitions for the search. For custom chord definitions, you need to create a Chords object and use ExtractMatchingChord.

Parameters
szTokenthe string that has any Chord name at its start
retValthe ChordDef object that has a Chord with its name present in the szToken
Returns
the number of characters correctly matched. Zero, if no match found

Definition at line 168 of file Chords.cpp.

References ExtractMatchingChord().

void CFugue::Chords::LoadDefinitions ( const ChordDef pChords = NULL,
int  nSize = 0 
)

Overrides the existing definitions with the supplied values. If supplied array is empty, default values will be loaded. The supplied array should not be freed before this Chords object is freed.

Parameters
pChordsArray of Chord definitions. Use NULL to load the default values
nSizeSize of the pChords Array

Definition at line 145 of file Chords.cpp.

Referenced by Chords().


The documentation for this class was generated from the following files:

CFugue, the C++ Music Programming Library © Copyright 2009 Cenacle Research India Private Limited Gopalakrishna Palem