|
|
A list of Phrases within a certain Song.
Use the following command classes to manipute this object in a undo/redo environment.
See also: Phrase, Song
static const std::string newPhraseString | newPhraseString |
static const std::string importedString | importedString |
static const std::string mergedPhraseString | mergedPhraseString |
static const std::string explodedPhraseString | explodedPhraseString |
PhraseList ()
| PhraseList |
Creates an empty PhraseList
~PhraseList ()
| ~PhraseList |
[virtual]
The destructor: all Phrases contained in the PhraseList will also be deleted.
size_t size ()
| size |
[const]
Returns the number of Phrases in the PhraseList.
Returns: Number of Phrases
Phrase * operator[] (size_t n)
| operator[] |
[const]
Returns the Phrase at positon n
The value returned for an index that is out of range is undefined. The size method describes the valid values.
Parameters:
n | Index |
Returns: Phrase at index n
Phrase * phrase (const std::string &title)
| phrase |
[const]
Returns the Phrase with the given title.
Parameters:
title | Unique Phrase reference title |
Returns: Phrase with given name
size_t index (const Phrase *phrase)
| index |
[const]
Returns the index of the given Phrase. If the Phrase is no in the PhraseList, returns the value of size().
Parameters:
phrase | Phrase to search for |
Returns: index of Phraes in PhraseList, or size()
void erase (Phrase *phrase)
| erase |
Deletes the Phrase (consequently removing it from the PhraseList). If the Phrase is not in the PhraseList no error is raised.
It is also safe to just delete a Phrase through a pointer to it. However, that's a little 'unconventional'.
Parameters:
phrase | The Phrase to delete |
void remove (Phrase *phrase)
| remove |
Removes the Phrase from the PhraseList but does not delete it.
Note that this leaves you with a pretty useless Phrase. You cannot use it in a Part. Any Part objects that were using the Phrase will reset their Phrase reference.
The only way to make the Phrase useful again is to insert it back into a PhraseList.
Once you have removed a Phrase from the PhraseList it is no longer owned by the PhraseList, and it is your responsibility to delete it.
If the specified Phrase is not in the PhraseList then no error is raised.
Parameters:
phrase | The Phrase to remove |
See also: insert
void insert (Phrase *phrase)
| insert |
Inserts an unparented Phrase back into the PhraseList.
Throws PhraseNameExists if there is already a Phrase with that name in the PhraseList.
You cannot insert a Phrase with no title - the same exception will be thrown.
This causes the Phrase to be 'owned' by the PhraseList, it will be deleted when the PhraseList is deleted.
Parameters:
phrase | The Phrase to insert |
Throws: PhraseListError
std::string newPhraseTitle (const std::string &baseName = newPhraseString)
| newPhraseTitle |
Returns a Phrase name based on the given base string that is guaranteed to not be used by any Phrase in this PhraseList.
If the base name already exists in the PhraseList, a unique variant of it will be returned (by appending a number).
Parameters:
baseName | The base name string |
Returns: A new unused Phrase name string
See also: newPhraseString, importedString, mergedPhraseString, explodedPhraseString
void Phrase_TitleAltered (Phrase *)
| Phrase_TitleAltered |
[virtual]
void Notifier_Deleted (Phrase *)
| Notifier_Deleted |
[virtual]
Reimplemented from Listener for internal purposes..
void save (std::ostream &o, int i)
| save |
[const virtual]
Reimplemented from Serializable for internal purposes..
void load (std::istream &i, SerializableLoadInfo &info)
| load |
[virtual]
NOTE: The PhraseList actually loads the Phrase object chunks.
Reimplemented from Serializable for internal purposes..
friend class Phrase | Phrase |