本文整理汇总了C++中StringPimpl::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ StringPimpl::c_str方法的具体用法?C++ StringPimpl::c_str怎么用?C++ StringPimpl::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringPimpl
的用法示例。
在下文中一共展示了StringPimpl::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: setAttribute
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");
}
}
示例3: printEntireDB
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();
}
}
}
示例4: nameString
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;
}
}
示例5: setAttribute
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;
}
}
示例6: getRecord
bool DatabaseManager::getRecord(const StringPimpl &key,
StringPimpl &data,
bool caseSensitive)
{
Dbt dbKey, dbData;
StringPimpl caseInsensitive;
if(!caseSensitive)
{
caseInsensitive = key;
caseInsensitive.transformToUpperCase();
dbKey.set_data((void *)caseInsensitive.c_str());
dbKey.set_size((caseInsensitive.size() + 1) * sizeof(char));
}
else
{
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)
{
data = StringPimpl((char *) dbData.get_data());
return true;
}
else
{
return false;
}
}
catch (DbException &e)
{
std::cerr << "Error in getDatabaseRecord transaction: "
<< e.what() << e.get_errno() << std::endl;
if(cursor != NULL)
{
cursor->close();
}
return false;
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
}
示例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;
}
示例13: addCharacters
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);
}
示例14: setAttribute
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.
}
}
示例15: ExceptionImpl
StringPimpl::StringPimpl(const StringPimpl& stringPimpl)
: m_pimpl(0)
{
try
{
init(stringPimpl.c_str());
}
catch(std::exception &e)
{
throw ExceptionImpl(e.what());
}
}