00001 #ifndef LANGUAGE_HH_ 00002 # define LANGUAGE_HH_ 00003 00004 # include "dictionary.hh" 00005 00006 # include <string> 00007 # include <map> 00008 # include <set> 00009 # include <vector> 00010 00011 namespace language 00012 { 00013 class Language; 00014 class Namable; 00015 00016 class Namable 00017 { 00018 }; 00019 00020 class Language 00021 { 00022 public: 00023 typedef std::set<std::string> Synonyms; 00024 typedef std::map<int, Synonyms> Words; 00025 typedef dictionary::Dictionary<const Namable> NamableDictionary; 00026 typedef std::map<int, std::string> Parameters; 00027 00028 public: 00029 enum WordType 00030 { 00031 wt_yes, 00032 wt_no, 00033 wt_hello, 00034 wt_it_is, 00035 wt_smile, 00036 wt_going_to, 00037 wt_acknowledge, 00038 wt_laught 00039 }; 00040 00041 enum SentenceType 00042 { 00043 st_yes, 00044 st_no, 00045 st_hello, 00046 st_it_is, 00047 st_going_to, 00048 st_acknowledge 00049 }; 00050 00051 protected: 00052 Language(); 00053 ~Language(); 00054 00055 public: 00056 virtual std::string make_sentence(int type) = 0; 00057 const Namable *find(const std::string &s, std::string *res = NULL); 00058 00059 void set_parameter(int index, const std::string &s); 00060 const std::string &get_parameter(int index); 00061 00062 protected: 00063 Words _words; 00064 NamableDictionary _namables; 00065 Parameters _parameters; 00066 00067 void add_word(int type, const std::string &s); 00068 const std::string &pick_word(int type) const; 00069 void add_namable(const std::string &s, const Namable &n); 00070 }; 00071 } 00072 00073 # include "language.hxx" 00074 00075 #endif