本文整理汇总了C++中Hashtable::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Hashtable::begin方法的具体用法?C++ Hashtable::begin怎么用?C++ Hashtable::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hashtable
的用法示例。
在下文中一共展示了Hashtable::begin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db_insert_into_table
void db_insert_into_table( db::CDBAdapter& db, const String& table, Hashtable<String, String>& hashObject, const char* excludes = null)
{
String cols = "";
String quests = "";
Vector<String> vals;
for ( Hashtable<String,String>::iterator it = hashObject.begin(); it != hashObject.end(); ++it )
{
String key = it->first;
String val = it->second;
if ( excludes && key.compare(excludes) == 0 )
continue;
if (cols.length() > 0)
{
cols += ',';
quests += ',';
}
cols += key;
quests += '?';
vals.addElement( val );
}
String query = "insert into " + table + "(" + cols + ") values (" + quests + ")";
db.executeSQLEx(query.c_str(), vals);
}
示例2: pop
void Tabid::pop() {
if (symbols->size() == 0) return;
Hashtable *bucket = (*symbols)[0];
Hashtable::iterator iter = bucket->begin(),
end = bucket->end();
while (iter != end)
delete iter->second;
bucket->clear();
symbols->pop_back();
delete bucket;
}
示例3: pop
void Tabid::pop() {
if (symbols->size() == 0) return;
Hashtable *bucket = symbols->back();
Hashtable::iterator iter = bucket->begin(),
end = bucket->end();
while (iter != end) {
delete &iter->first;
delete iter->second;
iter++;
}
bucket->clear();
symbols->pop_back();
delete bucket;
}
示例4: rho_ringtone_manager_get_all
VALUE rho_ringtone_manager_get_all()
{
LOG(INFO) + __FUNCTION__;
CHoldRubyValue retval(rho_ruby_createHash());
#if _WIN32_WCE > 0x501
Hashtable<String, String> ringtones;
CRingtoneManager::getCRingtoneManager().getAllRingtones(ringtones);
for (Hashtable<String, String>::iterator itr = ringtones.begin();
itr != ringtones.end(); ++itr) {
addStrToHash( retval, itr->first.c_str(), itr->second.c_str() );
}
#endif
return retval;
}
示例5:
/*static*/ String CJSONEntry::toJSON(const Hashtable<String,String>& hash)
{
String resHash = "{ ";
unsigned i = 0;
for( rho::Hashtable<rho::String, rho::String>::const_iterator it = hash.begin(); it != hash.end(); ++it, ++i)
{
if (i > 0)
resHash += ",";
resHash += "\"";
resHash += it->first;
resHash += "\": ";
resHash += CJSONEntry::quoteValue(it->second);
}
resHash += "}";
return resHash;
}
示例6: hashkeysCommand
Handle_ptr hashkeysCommand( CBuiltinAdapter *adapter, Context &ctx,
Environment *env, std::vector<Handle_ptr> args)
{
if (1 != args.size())
throw ArgumentCountException( 1, __FILE__, __LINE__);
Hashtable *hashtable = asHashtable( args[0]);
Hashtable::iterator pos = hashtable->begin();
if (pos != hashtable->end()) {
Handle_ptr listHead, current;
listHead = current = ctx.factory->makeCons( ctx.factory->makeString( (*pos).first.c_str()));
++pos;
for ( ; pos!=hashtable->end(); ++pos) {
current->setCdr( ctx.factory->makeCons( ctx.factory->makeString( (*pos).first.c_str())));
current = current->cdr();
}
return listHead;
} else
return ctx.NIL;
}
示例7: loadBlobAttrs
void CDBAttrManager::loadBlobAttrs(CDBAdapter& db)
{
loadAttrs(db, m_mapBlobAttrs, "blob_attribs");
String strTriggerPrefix = "rhoSchemaTrigger_";
IDBResult res = db.executeSQL( "SELECT name FROM sqlite_master WHERE type='trigger'" );
Hashtable<String,int> mapTriggers;
for ( ; !res.isEnd(); res.next() )
{
String strName = res.getStringByIdx(0);
if ( !String_startsWith(strName, strTriggerPrefix) )
continue;
mapTriggers[strName.substr(strTriggerPrefix.length())] = 0;
}
for ( HashtablePtr< int, Hashtable<String,int>* >::iterator it = m_mapBlobAttrs.begin(); it != m_mapBlobAttrs.end(); ++it )
{
int nSrcID = it->first;
IDBResult res = db.executeSQL("SELECT name FROM sources WHERE source_id=?", nSrcID);
if ( res.isEnd() )
continue;
String strName = res.getStringByIdx(0);
if ( !db.isTableExist(strName) )
continue;
Hashtable<String,int>& hashAttribs = *it->second;
for ( Hashtable<String,int>::iterator itAttr = hashAttribs.begin(); itAttr != hashAttribs.end(); ++itAttr )
{
String strTriggerName = strName + "_" + itAttr->first;
if ( !mapTriggers.containsKey(strTriggerName + "_delete") )
{
String strTrigger = String("CREATE TRIGGER ") + strTriggerPrefix + strTriggerName + "_delete BEFORE DELETE ON \"" + strName + "\" FOR EACH ROW \r\n"
" BEGIN \r\n"
" SELECT rhoOnDeleteSchemaRecord( OLD." + itAttr->first + ");\r\n"
" END;\r\n"
";";
db.createTrigger(strTrigger);
}else
mapTriggers[strTriggerName + "_delete"] = 1;
if ( !mapTriggers.containsKey(strTriggerName + "_update") )
{
String strTrigger = String("CREATE TRIGGER ") + strTriggerPrefix + strTriggerName + "_update BEFORE UPDATE ON \"" + strName + "\" FOR EACH ROW\r\n"
" BEGIN \r\n"
" SELECT rhoOnUpdateSchemaRecord( OLD." + itAttr->first + ", NEW." + itAttr->first + ");\r\n"
" END;\r\n"
";";
db.createTrigger(strTrigger);
}else
mapTriggers[strTriggerName + "_update"] = 1;
}
}
//Remove outdated triggers
for ( Hashtable<String,int>::iterator itTriggers = mapTriggers.begin(); itTriggers != mapTriggers.end(); ++itTriggers )
{
if ( !itTriggers->second )
{
db.dropTrigger(strTriggerPrefix+itTriggers->first);
}
}
}