innertemplateaimltags.h
来自「AIML的实现」· C头文件 代码 · 共 1,701 行 · 第 1/3 页
H
1,701 行
*/ CustomGet(GraphBuilderFramework &builder) throw() : Get(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomGet"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<get name=\"" + m_value + "\"/>"); return returnString.c_str(); } /** * Sets the attribute to a value. * * This is overriden to gain access to the attribute. * * \param name The name of the AIML XML attribute * * \param value The value of the AIML XML attribute * * \throw Does not throw anything */ virtual void setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &) { m_value = value.c_str(); } private: /** * Name of the attribute */ string m_name; /** * Value of the attribute */ string m_value;};/** * The Custom Id class that overrides * the regular Id AIML XML Tag */class CustomId : public Id{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomId(GraphBuilderFramework &builder) : Id(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomId"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<id/>"); return returnString.c_str(); }};/** * The Custom Input class that overrides * the regular Input AIML XML Tag */class CustomInput : public Input{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomInput(GraphBuilderFramework &builder) : Input(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomInput"); } /** * Sets the attribute to a value. * * This is overriden to gain access to the attribute. * * \param name The name of the AIML XML attribute * * \param value The value of the AIML XML attribute * * \throw Does not throw anything */ virtual void setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &) { string stringValue(value.c_str()); m_value = stringValue; } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { if(!m_value.empty()) { string returnString("<input"); returnString += " index=\"" + m_value + "\"/>"; return returnString.c_str(); } else { string returnString("<input/>"); return returnString.c_str(); } } private: /** * Value of the attribute */ string m_value;};/** * The Custom LowerCase class that overrides * the regular LowerCase AIML XML Tag */class CustomLowerCase : public LowerCase{ public: /** * Default constructor to * call Tag::addInstanceOf() */ CustomLowerCase() throw() { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomLowerCase"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<lowercase>"); returnString += InnerTemplateListImpl::getString().c_str(); returnString += "</lowercase>"; return returnString.c_str(); }};/** * The Custom Person class that overrides * the regular Person AIML XML Tag */class CustomPerson : public Person{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomPerson(GraphBuilderFramework &builder) throw() : Person(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomPerson"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<person>"); returnString += InnerTemplateListImpl::getString().c_str(); returnString += "</person>"; return returnString.c_str(); }};/** * The Custom Person2 class that overrides * the regular Person2 AIML XML Tag */class CustomPerson2 : public Person2{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomPerson2(GraphBuilderFramework &builder) throw() : Person2(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomPerson2"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<person2>"); returnString += InnerTemplateListImpl::getString().c_str(); returnString += "</person2>"; return returnString.c_str(); }};/** * The Custom Random class that overrides * the regular Random AIML XML Tag */class CustomRandom : public Random{ public: /** * Default constructor to * call Tag::addInstanceOf() */ CustomRandom() throw() { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomRandom"); } /** * Add the tag to the internal data structure * * \param tag The tag to add * * \throw Does not throw anything */ virtual void add(const shared_ptr<InnerTemplate> &tag) throw(InternalProgrammerErrorException &) { m_list.add(tag); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<random>"); returnString += m_list.getString().c_str(); returnString += "</random>"; return returnString.c_str(); } private: /** * Use this for the internal data structure * hold values for when add is called on this * class */ InnerTemplateListImpl m_list;};/** * The Custom Sentence class that overrides * the regular Sentence AIML XML Tag */class CustomSentence : public Sentence{ public: /** * Default constructor to * call Tag::addInstanceOf() */ CustomSentence() throw() { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomSentence"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<sentence>"); returnString += InnerTemplateListImpl::getString().c_str(); returnString += "</sentence>"; return returnString.c_str(); }};/** * The Custom Set class that overrides * the regular Set AIML XML Tag */class CustomSet : public Set{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomSet(GraphBuilderFramework &builder) throw() : Set(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomSet"); } /** * Sets the attribute to a value. * * This is overriden to gain access to the attribute. * * \param name The name of the AIML XML attribute * * \param value The value of the AIML XML attribute * * \throw Does not throw anything */ virtual void setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &) { string stringValue(value.c_str()); m_value = stringValue; } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<set"); returnString += " name=\"" + m_value + "\">"; returnString += InnerTemplateListImpl::getString().c_str(); returnString += "</set>"; return returnString.c_str(); } private: /** * The value of the attribute */ string m_value;};/** * The Custom Size class that overrides * the regular Size AIML XML Tag */class CustomSize : public Size{ public: /** * Default constructor to * call Tag::addInstanceOf() and * to set the builder reference * * \param builder A reference * to the graph builder framework that * can be used to set and get information * from the AIML engine. */ CustomSize(GraphBuilderFramework &builder) throw() : Size(builder) { /* * Add the name of this class. Otherwise if I * didn't do this I could not call Tag::instanceOf() * this an instance of this class and get back a true. */ addInstanceOf("CustomSize"); } /** * Returns the html string name of * the AIML XML name of this class * and any AIML XML tags that are * inside of this AIML XML Tag * * \return the htm string name of the * AIML XML Tag and any inner tags * * \throw Does not throw anything */ virtual StringPimpl getString() const throw(InternalProgrammerErrorException &) { string returnString("<size/>"); return returnString.c_str(); }};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?