本文整理汇总了C++中list_t类的典型用法代码示例。如果您正苦于以下问题:C++ list_t类的具体用法?C++ list_t怎么用?C++ list_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了list_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatList
string View::formatList(list_t &list, const string d1, const string sep, const string d2) {
string output = "";
if(list.empty()) return output;
FOR_l(i,list)
output = output + (i==0 || is_dir(list[i-1]) || is_opt(list[i-1]) ? "" : sep) + list.at(i);
return d1 + output + d2;
}
示例2: getRelationModel
relation_data_t Query::getRelationModel(list_t values, Model * & model)
{
relation_data_t rData;
QList <Model *> list;
if(!values.empty())
{
QStringList fields = model->getSchema()->getFields();
int i = 0;
while(i < values.size())
{
int j = i;
Model * temp = new Model();
temp->setSchema(model->getSchema());
temp->setIsNew(false);
while(values[j] != QPair <QString, QVariant> ("", ""))
{
if((fields.contains(values[j].first)) && (values[j].second != ""))
{
temp->setField(values[j].first, values[j].second);
}
j++;
}
list.append(temp);
i = j + 1;
}
}
rData.insert(rName, list);
return rData;
}
示例3: MEM_CacheLimiterHandleCClass
handle_t *MEM_CacheLimiterCClass::insert(void *data)
{
cclass_list.push_back(new MEM_CacheLimiterHandleCClass(data, this));
list_t::iterator it = cclass_list.end();
--it;
cclass_list.back()->set_iter(it);
return cache.insert(cclass_list.back());
}
示例4: chopList
list_t View::chopList(list_t list, const string prefix) {
if(list.empty()) return list;
FOR_l(i,list) {
string item = list[i];
// normal chop
if(!item.compare(0,prefix.length(),prefix))
list.at(i) = item.substr(prefix.length());
else
list.at(i) = "["+item+"]";
}
示例5: remove_even
static void remove_even(list_t &l) {
bool even = false;
for (auto it = l.begin(); it != l.end();) {
if (even)
it = l.erase(it);
else
++it;
even = !even;
}
}
示例6:
/*@[email protected]*/ static node_t list_get_node_by_value(list_t inst, void* val) {
node_t n = inst->head;
int ctr = 0;
while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
ctr++;
n = n->next;
}
return n;
}
示例7: list_find
int list_find(list_t list, void *data){
struct list_node *p = list->head;
int i = 0;
while (p != NULL) {
if (list->eq(p->data, data))
return i;
i++;
p = p->next;
}
return -1;
}
示例8: list_index_of
int list_index_of(list_t inst, void* val) {
node_t n = inst->head;
int rval = 0;
while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
rval++;
n = n->next;
}
if (n == NULL) {
rval = -1;
}
return rval;
}
示例9: generate
string_t
generate(const string_t& method, const list_t& arguments)
{
std::string call("H\x02\x00""C"s);
generator::value_visitor visitor(call);
visitor(method);
visitor(static_cast<int_t>(arguments.size()));
for (const auto& argument : arguments)
boost::apply_visitor(visitor, argument);
return std::move(call);
}
示例10: walk2
int walk2(list_t::iterator it, int s, int t)
{
if(s==t) return 0;
for(int i=0;i<30;i++)
{
if(links[s][i].size())
{
output.insert(it, mp(links[s][i].back(),s));
links[s][i].pop_back();
return walk2(it, i,t);
}
}
return -1;
}
示例11: pump
int pump(list_t::iterator it)
{
int pos = it->second;
redo:
for(int i=0;i<30;i++)
{
if(links[pos][i].size())
{
output.insert(it, mp(links[pos][i].back(), pos));
links[pos][i].pop_back();
if(walk2(it, i, pos) == -1) return -1;
goto redo;
}
}
return 0;
}
示例12: if
gboolean
post_parse()
{
if (file_ != 0)
{
if (tofile_ == 0 && todir_ == 0)
{
log::errorf("One of \"tofile\" or \"todir\" must be specified with \"file\"\n");
return FALSE;
}
}
else if (filesets_.first() != 0)
{
if (tofile_ != 0)
{
log::errorf("Only \"todir\" is allowed with \"filesets\"\n");
return FALSE;
}
if (todir_ == 0)
{
log::errorf("Must use \"todir\" is \"filesets\"\n");
return FALSE;
}
}
else if (file_ == 0 && filesets_.first() == 0)
{
log::errorf("At least one of \"file\" or \"<fileset>\" must be present\n");
return FALSE;
}
if (mapper_ == 0)
mapper_ = mapper_t::create("identity", 0, 0);
return TRUE;
}
示例13: touch
/** Mark an element as recently used. */
void touch (const key_type& k)
{
auto found (map_.find(k));
assert(found != map_.end());
if (found != map_.end())
list_.splice(list_.begin(), list_, found->second);
}
示例14: found
boost::optional<mapped_type&> try_get (const key_type& k)
{
auto found (map_.find(k));
if (found == map_.end())
return boost::optional<mapped_type&>();
list_.splice(list_.begin(), list_, found->second);
return found->second->second;
}
示例15: prune
/** Prune the cache back to a given size.
* If the cache is larger than the maximum, the oldest entries
* will be deleted.
* @post size() <= max_size
* @param max_size The maximum cache size */
void prune (size_t max_size)
{
while (size_ > max_size)
{
map_.erase(list_.back().first);
list_.pop_back();
--size_;
}
}