CFugue
|
Base class that represents a Parser Object. More...
#include <Parser.h>
Inherits OIL::CEventSource.
Inherited by CFugue::MusicStringParser.
Classes | |
struct | ErrorEventHandlerArgs |
struct | TraceEventHandlerArgs |
Public Member Functions | |
void | AddListener (CParserListener *pListener) |
Subscribes a Listener object for all events | |
void | RemoveListener (CParserListener *pListener) |
UnSubscribes the Listener Object from the events | |
void | SetUserData (void *pData) |
const void * | GetUserData () const |
Public Attributes | |
OIL::CEventT< const CParser, const ControllerEvent > | evController |
Event Raised when Parser encounters a MIDI Controller Event. | |
OIL::CEventT< const CParser, const Instrument > | evInstrument |
Event Raised when Parser encounters an Instrument command. | |
OIL::CEventT< const CParser, const KeySignature > | evKeySignature |
Event Raised when Parser encounters a Key Signature command. | |
OIL::CEventT< const CParser, const Layer > | evLayer |
Event Raised when Parser encounters a Layer command. | |
OIL::CEventT< const CParser > | evMeasure |
Event Raised when Parser encounters a Measure bar. | |
OIL::CEventT< const CParser, const ChannelPressure > | evChannelPressure |
Event Raised when Parser encounters a Channel Pressure command. | |
OIL::CEventT< const CParser, const PolyphonicPressure > | evPolyphonicPressure |
Event Raised when Parser encounters a Key Pressure command. | |
OIL::CEventT< const CParser, const PitchBend > | evPitchBend |
Event Raised when Parser encounters a PitchBend command. | |
OIL::CEventT< const CParser, const Tempo > | evTempo |
Event Raised when Parser encounters a Tempo command. | |
OIL::CEventT< const CParser, const Time > | evTime |
Event Raised when Parser encounters a Time command. | |
OIL::CEventT< const CParser, const Voice > | evVoice |
Event Raised when Parser encounters a Voice command. | |
OIL::CEventT< const CParser, const Note > | evNote |
Event Raised when Parser encounters a Note. | |
OIL::CEventT< const CParser > | evSequentialNote |
Encountered a Sequential note after a first note. | |
OIL::CEventT< const CParser > | evParalleNote |
Encountered a Parallel note after a first note. | |
void * | m_pUserData |
OIL::CEventT< const CParser, ErrorEventHandlerArgs > | evError |
Raised when a parse error happens. | |
OIL::CEventT< const CParser, TraceEventHandlerArgs > | evTrace |
Raised by Parser during the Parsing. | |
Protected Member Functions | |
virtual bool | Error (ErrorCode argErrCode, const TCHAR *szTraceMsg, const TCHAR *szToken) |
Protected Member Functions inherited from OIL::CEventSource | |
template<typename TEventSource , typename TEventHandlerArgs > | |
void | RaiseEvent (CEventT< TEventSource, TEventHandlerArgs > *pEvent, TEventHandlerArgs *pArgs) |
template<typename TEventSource , typename TEventHandlerArgs > | |
void | RaiseEvent (CEventT< TEventSource, const TEventHandlerArgs > *pEvent, const TEventHandlerArgs *pArgs) |
Base class that represents a Parser Object.
Parsers are implemented using an event subscription model. For each token encountered during the parsing, Parsers raise the appropriate event, which will be handled by the listeners. This event model allows any CParser based object to be connected with any CParserListener based object. For example, a MIDIParser can be connected to a Sheet Music generator, or a MusicString parser can be connected to a MIDI Renderer.
A listener interested in the Parse events can subscribe to all events at once using the CParser::AddListener method, or subscribe to only few selected events using the event's Subscribe method.
Multiple listeners can be connected to a single Parser object. However, the order in which the listeners are notified about the events is not guaranteed to be sequential.
Error code values used by ErrorEventHandlerArgs
Enumerator | |
---|---|
CRITICAL_ERROR_MEMORY_ALLOCATION |
Memory allocation failed. |
PARSE_ERROR_MISSING_ASSIGNMENT |
No Assignment symbol found. |
PARSE_ERROR_CPRESSURE_MACRO_END |
MACRO_END missing while parsing a Controller Index Macro. |
PARSE_ERROR_CPRESSURE_VALUE |
Failure while converting/retrieving a Controller Value number. |
PARSE_ERROR_CONTROLLER_MACRO_END |
MACRO_END missing while parsing a Controller Index Macro. |
PARSE_ERROR_CONTROLLER_VALUE |
Failure while converting/retrieving a Controller Value number. |
PARSE_ERROR_INSTRUMENT_MACRO_END |
MACRO_END missing while parsing a Instrument Macro. |
PARSE_ERROR_INSTRUMENT_VALUE |
Failure while converting/retrieving a Instrument number. |
PARSE_ERROR_KEYPRESSURE_MACRO_END |
MACRO_END missing while parsing a Polyphonic Pressure Macro. |
PARSE_ERROR_KEYPRESSURE_VALUE |
Failure while converting/retrieving a Polyphonic Pressure number. |
PARSE_ERROR_KEYSIGNATURE_MACRO_END |
MACRO_END missing while parsing a Key Signature Macro. |
PARSE_ERROR_KEYSIGNATURE_VALUE |
Failure while converting/retrieving a Key Signature number. |
PARSE_ERROR_KEYSIGNATURE_MAXLIMIT |
Specified a KeySignature beyond permitted range [0, 14] , [64, 78], [129, 200]. |
PARSE_ERROR_PITCHBEND_MACRO_END |
MACRO_END missing while parsing a PitchBend Macro. |
PARSE_ERROR_PITCHBEND_VALUE |
Failure while converting/retrieving a PitchBend number. |
PARSE_ERROR_TALAM_MACRO_END |
MACRO_END missing while parsing a Talam Macro. |
PARSE_ERROR_TALAM_VALUE |
Failure while converting/retrieving a Talam number. |
PARSE_ERROR_TALAM_MAXLIMIT |
Specified a Talam beyond permitted range [0, 35]. |
PARSE_ERROR_SPEED_MACRO_END |
MACRO_END missing while parsing a Speed Macro. |
PARSE_ERROR_SPEED_VALUE |
Failure while converting/retrieving a Speed number. |
PARSE_ERROR_SPEED_MAXLIMIT |
Specified a Speed beyond permitted range [1, 6]. |
PARSE_ERROR_LAYER_MACRO_END |
MACRO_END missing while parsing a Layer Macro. |
PARSE_ERROR_LAYER_VALUE |
Failure while converting/retrieving a Layer number. |
PARSE_ERROR_TEMPO_MACRO_END |
MACRO_END missing while parsing a Tempo Macro. |
PARSE_ERROR_TEMPO_VALUE |
Failure while converting/retrieving a Tempo number. |
PARSE_ERROR_TIME_MACRO_END |
MACRO_END missing while parsing a Time Macro. |
PARSE_ERROR_TIME_VALUE |
Failure while converting/retrieving a Time number. |
PARSE_ERROR_VOICE_MACRO_END |
MACRO_END missing while parsing a Voice Macro. |
PARSE_ERROR_VOICE_VALUE |
Failure while converting/retrieving a Voice number. |
PARSE_ERROR_VOICE_MAXLIMIT |
Specified a voice that is beyond the permitted range [0, 15]. |
PARSE_ERROR_NUMERIC_NOTE_END |
MACRO_END missing while parsing a numeric note. |
PARSE_ERROR_NUMERIC_NOTE_VALUE |
Failure while converting/retrieving a numeric note number. |
PARSE_ERROR_LETTER_NOTE |
Invalid Alphabet encountering while trying to read a Note Symbol. |
PARSE_ERROR_CHORDINV_MACRO_END |
MACRO_END missing while parsing a Chord Inversion. |
PARSE_ERROR_CHORDINV_VALUE |
Failure while converting/retrieving a Chord Inversion Root Note number. |
PARSE_ERROR_CHORDINV_MAXLIMIT |
Specified an inversion root note that is not with in acceptable range of values. |
PARSE_ERROR_OCTAVE_MACRO_END |
MACRO_END missing while parsing an Octave Macro. |
PARSE_ERROR_OCTAVE_VALUE |
Failure while conveting/retrieving an Octave macro number. |
PARSE_ERROR_OCTAVE_MAXLIMIT |
Specified an octave that is beyond the permitted range [0, 10]. |
PARSE_ERROR_DURATION_MACRO_END |
MACRO_END missing while parsing an Duration Macro. |
PARSE_ERROR_DURATION_VALUE |
Failure while conveting/retrieving a Duration number. |
PARSE_ERROR_TUPLET_NUMERATOR |
Failure while conveting/retrieving the Numerator of Tuplet fraction. |
PARSE_ERROR_TUPLET_DENOMINATOR |
Failure while conveting/retrieving the Denominator of Tuplet fraction. |
PARSE_ERROR_VELOCITY_MACRO_END |
MACRO_END missing while parsing a Velocity Macro. |
PARSE_ERROR_VELOCITY_VALUE |
Failure while conveting/retrieving a Velocity number. |
PARSE_ERROR_NOTEVALUE_MAXLIMIT |
Computed Note Value is going beyond the permitted range [0, 127]. |
|
protectedvirtual |
Error method is called whenever there is a parse error. This method will raise events through the CParser::evError event variable. Listeners can subscribe to it to get to know about the parse errors.
You can override this method in derived classes if you wish to modify this error reporting implementation.
argErrCode | the Error code |
szTraceMsg | Error message details |
szToken | The token that is being parsed when the error happened |
Definition at line 196 of file Parser.h.
References CFugue::CParser::ErrorEventHandlerArgs::bShouldStopParsing, evError, and OIL::CEventSource::RaiseEvent().
CFugue, the C++ Music Programming Library | © Copyright 2009 Cenacle Research India Private Limited | Gopalakrishna Palem |