Previous: Expression Language, Up: Music Regular Expressions



7.2.2 Music Details class

The music_details class allows the specification of music via a regular expression to the music class. Although functions are provided to return the score, they are mainly intended for use by the music class itself. It should be noted that the music class takes a copy of the music_details object rather than a pointer.

— Constructor: music_details (const string &e = "", const int &s = 1);
— Constructor: music_details (const char *e, const int &s = 1);

Creates the object and sets the initial expression to e and the score to use to s. By default the score is 1. If the specified expression is invalid, the class will throw an music_details::invalid_regex exception (if they are enabled) or reset the expression to "".

— Destructor: ~music_details ();

Destructor. Doesn't do much in this case.

— Function: void set (const string &e, const int &s = 1);
— Function: void set (const char *e, const int &s = 1);

Sets the expression to e and the score to s. It will also reset the counts of rows matched.

— Function: string get () const;

Returns the currently stored expression.

— Function: unsigned int possible_matches (const unsigned int &bells) const;

Returns the maximum number of possible matches (in one true extent) for the currently specified expression. bells must be specified as the music_details class has no knowledge of this under normal circumstances.

— Function: int possible_score (const unsigned int &bells) const;

Returns the maximum possible score (based on one true extent) for the currently specified expression. bells must be specified as the music_details class has no knowledge of this under normal circumstances.

— Function: unsigned int count (const EStroke& = eBoth) const;

Returns the number of rows matched based on the stroke that is passed in. If eBoth is passed, then the result will be the handstroke count plus the backstroke count.

— Function: int total (const EStroke& = eBoth) const;

Returns the total score based on the stroke that is passed in. If eBoth is passed, then the result will be the handstroke score plus the backstroke score.

— Function: int raw_score const;

Returns the score previously specified to the object.