Adding, Deleting, and Searching for Currencies
In the Currency Module library, you can add individual currencies to a currency book using function RWCurrencyBook::insert(). The insert() function attempts to insert a currency object by seeing whether it already exists in the currency book, and, if it does not, inserting it, then returning true. If a currency object with the same mnemonic as the currency you are trying to insert already exists, the insert() function will simply return a value of false.
You can delete individual currencies from the currency book using function RWCurrencyBook::remove(). The remove() function searches the currency book for a provided mnemonic, then, if it finds it, removes its associated currency and returns true. If remove() does not find the mnemonic, it returns false.
To remove all currencies from the currency book, use function RWCurrencyBook::clear().
Several functions can be used to determine whether a given currency exists in a currency book.
Function contains() simply returns true if the currency book contains the currency with the given mnemonic.
Function find() finds the currency indicated by a given mnemonic, places it in a provided currency object, then returns true. If no such currency exists, the currency object remains unchanged and the function returns false.
The getAllCurrencies() and getAllCurrencyMnemonics classes provide a list of all the currencies or a list of all the mnemonics in a given currency book object.