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


C++ StringPimpl类代码示例

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


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

示例1: while

void DatabaseManager::printEntireDB()
{
	Dbc *cursor = NULL;
	try 
	{
		Dbt dbKey;
		Dbt dbData;

		m_pimpl->checkTSSInit();
		m_pimpl->m_database->cursor(&(**m_pimpl->m_transaction), &cursor, m_pimpl->m_cursorFlags);
		int ret = cursor->get(&dbKey, &dbData, DB_SET_RANGE);
		while(ret != DB_NOTFOUND)
		{
			StringPimpl dataString = StringPimpl((char *) dbData.get_data());
			StringPimpl keyString = StringPimpl((char *) dbKey.get_data());
			cout << "key :" << keyString.c_str() << endl << "data:" << dataString.c_str() << endl << endl;
			ret = cursor->get(&dbKey, &dbData, DB_NEXT);
		}
		cursor->close();
	}
	catch (DbException &e) 
	{
		std::cerr << "Error in deleteRecordRange: "
				   << e.what() << e.get_errno() << std::endl;
		if(cursor != NULL)
		{
			cursor->close();
		}
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:30,代码来源:DatabaseManager.cpp

示例2: throw

void ThatStar::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{

    LOG_BOT_METHOD("void ThatStar::setAttribute(const StringPimpl &name, const StringPimpl &value)");
    String nameString(name.c_str());
    String valueString(value.c_str());

    logging("<Input> name:" + nameString);
    logging("<Input> value:" + valueString);

    try
    {
        if(nameString == "index" && (!valueString.empty()))
        {
            m_pimpl->m_index = lexical_cast<int>(valueString);
        }
    }
    catch(bad_lexical_cast &)
    {
        String msg("Index string is not numeric");
        msg += valueString;
        m_pimpl->m_builder.getCallBacks().thatStarTagNumericConversionError(msg.c_str());
        logging("Error, the cast to a numeric value failed");
    }

}
开发者ID:sleimanf,项目名称:aibot,代码行数:26,代码来源:ThatStar.cpp

示例3: recordExists

bool DatabaseManager::recordExists(const StringPimpl &key)
{
	Dbt dbKey, dbData;
	dbKey.set_data((void *)key.c_str());
	dbKey.set_size((key.size() + 1) * sizeof(char));
	Dbc *cursor = NULL;

	try
	{
		m_pimpl->checkTSSInit();
		m_pimpl->m_database->cursor(&(**m_pimpl->m_transaction), &cursor, m_pimpl->m_cursorFlags);
		int ret = cursor->get(&dbKey, &dbData, DB_SET);
		cursor->close();
		if(ret != DB_NOTFOUND)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	catch (DbException &e) 
	{
        std::cerr << "Error in databse recordExists"
			<< e.what() << e.get_errno() <<  std::endl;
		if(cursor != NULL)
		{
			cursor->close();
		}
		return false;
    }
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:33,代码来源:DatabaseManager.cpp

示例4: deleteRecordRange

void DatabaseManager::deleteRecordRange(const StringPimpl &key,
										const StringPimpl &range)
{
	Dbc *cursor = NULL;

	try 
	{
		Dbt dbKey((void *)key.c_str(), key.size() + 1);
		Dbt dbData((void *) range.c_str(), range.size() + 1);

		m_pimpl->checkTSSInit();
		m_pimpl->m_database->cursor(&(**m_pimpl->m_transaction), &cursor, m_pimpl->m_cursorFlags);
		int ret = cursor->get(&dbKey, &dbData, DB_GET_BOTH_RANGE);
		
		while(ret != DB_NOTFOUND)
		{
			cursor->del(0);
			ret = cursor->get(&dbKey, &dbData, DB_NEXT);
		}
		cursor->close();
	}
	catch (DbException &e) 
	{
            std::cerr << "Error in addRecord: "
                       << e.what() << e.get_errno() << std::endl;
			if(cursor != NULL)
			{
				cursor->close();
			}
    }
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:31,代码来源:DatabaseManager.cpp

示例5: getRecord

int DatabaseManager::getRecordTotalCount(const StringPimpl &key)
{
	StringPimpl sizeAsString = getRecord(m_reserved + key + "[email protected][email protected]", true);
	if(sizeAsString.empty())
	{
		return 0;
	}
	else
	{
		return sizeAsString.getInteger();
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:12,代码来源:DatabaseManager.cpp

示例6: throw

void TestCasesHandler::TestCase::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{
	string nameString(name.c_str());
	string valueString(value.c_str());
	if(nameString == "name")
	{
		m_handler.outputln("Test Case name: " + valueString);
	}
	else
	{
		cout << "Error, wrong attribute" << endl;
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:13,代码来源:TestCasesHandler.cpp

示例7: throw

void Bot::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{
	LOG_BOT_METHOD("void Bot::setAttribute(const StringPimpl &name, const StringPimpl &value)");	
	String nameString(name.c_str());
	String valueString(value.c_str());

	logging("<Input> name:" + nameString);
	logging("<Input> value:" + valueString);
	
	if(nameString == "name" && (!valueString.empty()))
	{
		m_pimpl->m_botPredicateName = valueString;
	}
}
开发者ID:sleimanf,项目名称:aibot,代码行数:14,代码来源:Bot.cpp

示例8: storeGossip

		/**
		 * This is called for each AIML 
		 * "Gossip" tag.
		 *
		 * I am just printing out the gossip.
		 * You can do other things like store it 
		 * in a file and then reload the file at 
		 * startup as a type of persistance.
		 */
		void storeGossip(const StringPimpl &gossip,
                         const StringPimpl &userId,
						 const StringPimpl &botId,
						 const StringPimpl &endUserId) 
		{ 
			cout << "[Gossip: " << gossip.c_str() << " ]" << endl;
		}
开发者ID:hallowname,项目名称:librebecca,代码行数:16,代码来源:main.cpp

示例9: thatTagNumericConversionError

		/**
		 * A AIML "That" tag has a non number in its index attribute.
		 *
		 * This method will only be called during loadtime, GraphBuilder::createGraph().
		 *
		 * @param message The human readable message.
		 */
		virtual void thatTagNumericConversionError(const StringPimpl &message,
                                                   const StringPimpl &userId,
						                           const StringPimpl &botId,
						                           const StringPimpl &endUserId) 
		{ 
			cout << "thatTagNumericConversionError:" << message.c_str() << endl;
		} 
开发者ID:hallowname,项目名称:librebecca,代码行数:14,代码来源:main.cpp

示例10: XMLParseFatalError

		/**
		 * Sends you a message about a XMLParseFatalError. 
		 *
		 * Either with AIML files or RebeccaAIML configuration
		 * files.
		 *
		 * @param message The human readable message.
		 */ 
		virtual void XMLParseFatalError(const StringPimpl &message,
                                        const StringPimpl &userId,
						                const StringPimpl &botId,
						                const StringPimpl &endUserId) 
		{ 
			cout << message.c_str() << endl;
		} 
开发者ID:hallowname,项目名称:librebecca,代码行数:15,代码来源:main.cpp

示例11: filePostLoad

		/**
		 * After each AIML file is parsed, this method is called.
         *
		 * @param fileName The name of the file just parsed.
		 */
		void filePostLoad(const StringPimpl &fileName,
                          const StringPimpl &userId,
						  const StringPimpl &botId,
						  const StringPimpl &endUserId) 
		{
			cout << "[Done loading " << fileName.c_str() << "]" << endl;
		}
开发者ID:hallowname,项目名称:librebecca,代码行数:12,代码来源:main.cpp

示例12: symbolicReduction

		/**
		 * When the "srai" AIML tag is called, the text 
		 * is sent to this method.
		 *
		 * Usually refered to as symbolic reduction, you 
		 * can see what text is being re-fed back into the 
		 * AIML GraphBuilder::getResponse() by AIML its self.
		 *
		 * @param symbol The text which is being sent back
		 * into GraphBuilder::getResponse().
		 */
		void symbolicReduction(const StringPimpl &symbol,
                               const StringPimpl &userId,
						       const StringPimpl &botId,
						       const StringPimpl &endUserId) 
		{
			cout << "Symbolic reduction: " << symbol.c_str() << endl;
		}
开发者ID:hallowname,项目名称:librebecca,代码行数:18,代码来源:main.cpp

示例13: throw

void Person::addCharacters(const StringPimpl &characters) throw(InternalProgrammerErrorException &)
{
	LOG_BOT_METHOD("void Person::addCharacters(const StringPimpl &characters)");
	logging("<Input> characters:" + String(characters.c_str()));

	m_pimpl->m_atomic = false;	
	InnerTemplateListImpl::addCharacters(characters);
}
开发者ID:sleimanf,项目名称:aibot,代码行数:8,代码来源:Person.cpp

示例14: addText

void AIMLEngine::userInput(const QString &text)
{
    /*
     * Check the AIML engine is loaded and
     * that the user actually entered
     * something
     */
    if((!text.isEmpty()) && m_aiml)
    {

        /*
        * 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();

        /*
         * Emit the internal bot information.  Get
         * the bot response and emit all of that
         * information to anyone wishing to display
         * it.
         */
        emit addText("");
        emit addText("");
        emit addText("Internal information:");
        emit addText("=====================");

        //construct the match line and emit it.
        QString matchLine = text + " : " + builder.getThat().c_str() +
                            QString(" : ") + builder.getTopic().c_str();
        emit addText(matchLine);

        //Get the bot response
        StringPimpl response = builder.getResponse(text.toAscii().data());

        emit addText("=====================");
        emit addText("");

        //emit the bot response
        emit addBotText(response.c_str());
    }
}
开发者ID:sleimanf,项目名称:aibot,代码行数:45,代码来源:AIMLEngine.cpp

示例15: throw

void AIML::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{
	LOG_BOT_METHOD("void AIML::setAttribute(const StringPimpl &name, const StringPimpl &value)");
	String nameString(name.c_str());
	String valueString(value.c_str());

	logging("<Input> name: " + nameString + "value: " + valueString);

	if(nameString == "version")
	{
	///@todo use something else instead of this or just leave it out.
	//		m_parser.setAIMLVersion(valueString);
	}
	else
	{
		//Ignore all the rest for right now.  I don't care about any other attributes.
	}
}
开发者ID:sleimanf,项目名称:aibot,代码行数:18,代码来源:AIML.cpp


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