当前位置: 首页>>代码示例>>C++>>正文


C++ Arguments::getConfigurationDirectory方法代码示例

本文整理汇总了C++中Arguments::getConfigurationDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ Arguments::getConfigurationDirectory方法的具体用法?C++ Arguments::getConfigurationDirectory怎么用?C++ Arguments::getConfigurationDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arguments的用法示例。


在下文中一共展示了Arguments::getConfigurationDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestCasesHandler

TestCases::TestCases(const string &outputFile)
: m_testValidation(false),
  m_outputFile(outputFile),
  m_testFileAdded(false),
  m_aimlFileAdded(false),
  m_aimlGraphCreated(false),
  m_builder(m_aimlFacade.getGraphBuilder())
{

   /* Give the address to Rebecca for usesage.
	* Rebecca DOES NOT delete it.  
	*/
	m_builder.setCallBacks(&m_callback);

   /*
    * Get a handle to our global instance
    * of our arguments
    */
    Arguments *arguments = Arguments::getInstance();



   /* 
	* Set the schemas for the AIML XML (AIML.xsd)
	* and for Rebecca's own configuration files.
	* The schema's have to be relative to where the files
	* you are going to parse are going to be at.
	*/
    m_builder.setAIMLSchema(arguments->getAimlSchemaPath().c_str());
    m_builder.setCommonTypesSchema(arguments->getCommonTypesSchemaPath().c_str());
    m_builder.setBotConfigurationSchema(arguments->getBotConfigurationSchemaPath().c_str());

   /* 
	* Set that "yes" we do want to do XML validation on
	* both the AIML XML and Rebecca's own configuration 
	* files.
	*/
	m_builder.setAIMLValidation();
	m_builder.setBotConfigurationValidation();
	
   /*
	* Parse Rebecca's configuration files to setup 
	* Rebecca's ability to handle input subsitutions, 
	* what a sentence splitter is, and what bot properties
	* she should have.
	*/
    string substitutions_xml = arguments->getConfigurationDirectory() + "/substitutions.xml";
    m_builder.parseSubstitutionFile(substitutions_xml.c_str());

    string sentence_splitters_xml = arguments->getConfigurationDirectory() + "/sentence-splitters.xml";
    m_builder.parseSentenceSplitterFile(sentence_splitters_xml.c_str());

    string properties_xml = arguments->getConfigurationDirectory() + "/properties.xml";
    m_builder.parsePropertiesFile(properties_xml.c_str());

	m_testParser.reset(new SAXParser);
	m_testDocumentHandler.reset(new TestCasesHandler(m_outputFile, m_builder));
	
///@todo make this into its own error class
//	m_testErrorHandler.reset(new TestCasesHandler(m_outputFile, m_builder));
//	m_testParser->setErrorHandler(m_testErrorHandler.get());

	m_testParser->setDocumentHandler(m_testDocumentHandler.get());
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:64,代码来源:TestCases.cpp

示例2: initAIML

void AIMLEngine::initAIML()
{
    try
    {
        //Create a new AIML engine
        m_aiml = new AimlFacade;

        /*
        * Get the GraphBuilder concrete class that
        * was created inside of AimlFacade.
        * DO NOT try to delete GraphBuilder.  Let
        * AimlFacade handle that when it falls out
        * of scope.
        */
        GraphBuilder &builder = m_aiml->getGraphBuilder();

        /*
         * Give the address to Rebecca for usesage.
        * Rebecca DOES NOT delete it.
        */
        builder.setCallBacks(&m_callback);

        /*
        * Get a handle to our global instance
        * of our arguments
        */
        Arguments *arguments = Arguments::getInstance();

        /*
        * Set the schemas for the AIML XML (AIML.xsd)
        * and for Rebecca's own configuration files.
        * The schema's have to be relative to where the files
        * you are going to parse are going to be at.
        */
        builder.setAIMLSchema(arguments->getAimlSchemaPath().c_str());
        builder.setCommonTypesSchema(arguments->getCommonTypesSchemaPath().c_str());
        builder.setBotConfigurationSchema(arguments->getBotConfigurationSchemaPath().c_str());

        /*
        * Set that "yes" we do want to do XML validation on
        * both the AIML XML and Rebecca's own configuration
        * files.
        */
        builder.setAIMLValidation();
        builder.setBotConfigurationValidation();

        /*
        * Parse Rebecca's configuration files to setup
        * Rebecca's ability to handle input subsitutions,
        * what a sentence splitter is, and what bot properties
        * she should have.
        */
        string substitutions_xml = arguments->getConfigurationDirectory() + "/substitutions.xml";
        builder.parseSubstitutionFile(substitutions_xml.c_str());

        string sentence_splitters_xml = arguments->getConfigurationDirectory() + "/sentence-splitters.xml";
        builder.parseSentenceSplitterFile(sentence_splitters_xml.c_str());

        string properties_xml = arguments->getConfigurationDirectory() + "/properties.xml";
        builder.parsePropertiesFile(properties_xml.c_str());

        /*
         * Get the botName which should be Rebecca since that is
         * the name give in the configuration file properties.xml
         * which we parsed above.
         */
        string botName = builder.getBotPredicate("name").c_str();

        //Emit what the bot name is
        emit addBotName(botName.c_str());
    }
    /*
    * All the exceptions are grouped here but you
    * might not want this since it's a bit harder
    * to determine where they came from.
    */
    catch(DirectoryNotFoundException &e)
    {
        emit addText("[A Directory Was Not Found Terminating]");
        QString exception("[");
        exception += e.what();
        exception += "]";
        emit addText(exception);
    }
    catch(FileNotFoundException &e)
    {
        emit addText("[A File Was Not Found Terminating]");
        QString exception("[");
        exception += e.what();
        exception += "]";
        emit addText(exception);
    }
    catch(IllegalArgumentException &e)
    {
        emit addText("[IllegalArgument Found Terminating]");
        QString exception("[");
        exception += e.what();
        exception += "]";
        emit addText(exception);
    }
//.........这里部分代码省略.........
开发者ID:sleimanf,项目名称:aibot,代码行数:101,代码来源:AIMLEngine.cpp


注:本文中的Arguments::getConfigurationDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。