diff options
Diffstat (limited to 'generator/pronunciation.h')
| -rw-r--r-- | generator/pronunciation.h | 82 |
1 files changed, 82 insertions, 0 deletions
| diff --git a/generator/pronunciation.h b/generator/pronunciation.h new file mode 100644 index 0000000..81be6c4 --- /dev/null +++ b/generator/pronunciation.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | #ifndef PRONUNCIATION_H_584A08DD | ||
| 2 | #define PRONUNCIATION_H_584A08DD | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | #include <cassert> | ||
| 6 | |||
| 7 | namespace verbly { | ||
| 8 | namespace generator { | ||
| 9 | |||
| 10 | class database; | ||
| 11 | |||
| 12 | class pronunciation { | ||
| 13 | public: | ||
| 14 | |||
| 15 | // Constructor | ||
| 16 | |||
| 17 | explicit pronunciation(std::string phonemes); | ||
| 18 | |||
| 19 | // Accessors | ||
| 20 | |||
| 21 | int getId() const | ||
| 22 | { | ||
| 23 | return id_; | ||
| 24 | } | ||
| 25 | |||
| 26 | std::string getPhonemes() const | ||
| 27 | { | ||
| 28 | return phonemes_; | ||
| 29 | } | ||
| 30 | |||
| 31 | bool hasRhyme() const | ||
| 32 | { | ||
| 33 | return !rhyme_.empty(); | ||
| 34 | } | ||
| 35 | |||
| 36 | std::string getRhymePhonemes() const | ||
| 37 | { | ||
| 38 | // Calling code should always call hasRhyme first. | ||
| 39 | assert(!rhyme_.empty()); | ||
| 40 | |||
| 41 | return rhyme_; | ||
| 42 | } | ||
| 43 | |||
| 44 | std::string getPrerhyme() const | ||
| 45 | { | ||
| 46 | // Calling code should always call hasRhyme first. | ||
| 47 | assert(!rhyme_.empty()); | ||
| 48 | |||
| 49 | return prerhyme_; | ||
| 50 | } | ||
| 51 | |||
| 52 | int getSyllables() const | ||
| 53 | { | ||
| 54 | return syllables_; | ||
| 55 | } | ||
| 56 | |||
| 57 | std::string getStress() const | ||
| 58 | { | ||
| 59 | return stress_; | ||
| 60 | } | ||
| 61 | |||
| 62 | private: | ||
| 63 | |||
| 64 | static int nextId_; | ||
| 65 | |||
| 66 | const int id_; | ||
| 67 | const std::string phonemes_; | ||
| 68 | std::string rhyme_; | ||
| 69 | std::string prerhyme_; | ||
| 70 | int syllables_ = 0; | ||
| 71 | std::string stress_; | ||
| 72 | |||
| 73 | }; | ||
| 74 | |||
| 75 | // Serializer | ||
| 76 | |||
| 77 | database& operator<<(database& db, const pronunciation& arg); | ||
| 78 | |||
| 79 | }; | ||
| 80 | }; | ||
| 81 | |||
| 82 | #endif /* end of include guard: PRONUNCIATION_H_584A08DD */ | ||
