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


C++ StringPimpl::empty方法代码示例

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


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

示例1: setAttribute

void Bot::setAttribute(const StringPimpl &name, 
					   const StringPimpl &value) 
	throw(InternalProgrammerErrorException &)
{
	if(name == "name" && (!value.empty()))
	{
		m_pimpl->m_botPredicateName = value;
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:9,代码来源:Bot.cpp

示例2: getRecordTotalCount

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

示例3: setAttribute

void TopicStar::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{
	try
	{
		if(name == "index" && (!value.empty()))
		{
			m_pimpl->m_index = value.getInteger();
		}
	}
	catch(NumberFormatException &)
	{
		//Error, the cast to a numeric value failed
		FrameworkFactory *factory = FrameworkFactory::getInstance();
		IdentificationManager *ident = IdentificationManager::getInstance();
		GraphBuilderFramework *builder = factory->getGraphBuilderFramework();
		builder->getCallBacks().topicStarTagNumericConversionError("Index string is not numeric, " + value, ident->getUserId(), ident->getBotId(), ident->getEndUserId()); 
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:18,代码来源:TopicStar.cpp

示例4: setAttribute

///@todo redo this without annoying tokenizer.  Use a for loop
void TemplateSideThat::setAttribute(const StringPimpl &name, const StringPimpl &value) throw(InternalProgrammerErrorException &)
{
	if(name == "index" && (!value.empty()))
	{
		string valueString(value.c_str());
		typedef tokenizer<char_separator<char> > tokenize;
		typedef tokenizer<char_separator<char> >::const_iterator CI;
		char_separator<char> sep(",");
		tokenize pathTokens(valueString, sep);
		int i = 0;
		for(CI it = pathTokens.begin(); it != pathTokens.end(); ++it, ++i)
		{
			string s;
			if(i == 0)
			{				
				try
				{
					//This is the first index which is a previous bot response
					s = *it;
					trim(s);
					m_pimpl->m_previousBotResponse = lexical_cast<int>(s);
				}
				catch(bad_lexical_cast &)
				{
					//User Error, the cast to a numeric value failed
					string msg("First index string is not a valid number, ");
					msg += s.c_str();
					FrameworkFactory *factory = FrameworkFactory::getInstance();
					IdentificationManager *ident = IdentificationManager::getInstance();
					GraphBuilderFramework *builder = factory->getGraphBuilderFramework();
					builder->getCallBacks().thatTagNumericConversionError(msg.c_str(), ident->getUserId(), ident->getBotId(), ident->getEndUserId());
				}
			}
			else if(i == 1)
			{			
				try
				{
					//This is the second index which is a sentence
					s = *it;
					trim(s);
					m_pimpl->m_sentence = lexical_cast<int>(s);
				}
				catch(bad_lexical_cast &)
				{
					string msg("Second index string is not a valid number, ");
					msg += s.c_str();
					FrameworkFactory *factory = FrameworkFactory::getInstance();
					IdentificationManager *ident = IdentificationManager::getInstance();
					GraphBuilderFramework *builder = factory->getGraphBuilderFramework();
					builder->getCallBacks().thatTagNumericConversionError(msg.c_str(), ident->getUserId(), ident->getBotId(), ident->getEndUserId());
					//User Error, the cast to a numeric value failed
				}
			}
			else
			{
				//User error, the i index is past 2
				FrameworkFactory *factory = FrameworkFactory::getInstance();
				IdentificationManager *ident = IdentificationManager::getInstance();
				GraphBuilderFramework *builder = factory->getGraphBuilderFramework();
				builder->getCallBacks().thatTagNumericConversionError("The index is past 2", ident->getUserId(), ident->getBotId(), ident->getEndUserId());
			}
		}	
	}
}
开发者ID:Tiger66639,项目名称:librebecca,代码行数:65,代码来源:TemplateSideThat.cpp


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