本文整理汇总了C++中Objects::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Objects::insert方法的具体用法?C++ Objects::insert怎么用?C++ Objects::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objects
的用法示例。
在下文中一共展示了Objects::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Objects
instances(World* world, const URISet& types)
{
LilvNode* rdf_type = lilv_new_uri(
world->lilv_world(), LILV_NS_RDF "type");
Objects result;
for (const auto& t : types) {
LilvNode* type = lilv_new_uri(world->lilv_world(), t.c_str());
LilvNodes* objects = lilv_world_find_nodes(
world->lilv_world(), NULL, rdf_type, type);
LILV_FOREACH(nodes, o, objects) {
const LilvNode* object = lilv_nodes_get(objects, o);
if (!lilv_node_is_uri(object)) {
continue;
}
const std::string label = RDFS::label(world, object);
result.insert(
std::make_pair(label,
Raul::URI(lilv_node_as_string(object))));
}
lilv_node_free(type);
}
lilv_node_free(rdf_type);
return result;
}
示例2: set
/** \brief
Force the pointer for the object in store to be a specific pointer.
This can be useful for singleton values.
These usually must be removed from the store explicitly.
\pre No object with this value is already in the store.
*/
void set (std::shared_ptr <Value const> pointer) {
// The value must not be in the store yet.
assert (objects_.find (*pointer,
boost::hash <Value>(), EqualToWeakPtr()) == objects_.end());
objects_.insert (std::move (pointer));
}
示例3:
void
Store::remove(const iterator top, Objects& removed)
{
if (top != end()) {
const iterator descendants_end = find_descendants_end(top);
removed.insert(top, descendants_end);
erase(top, descendants_end);
}
}
示例4: newElement
// Rvalue reference.
std::shared_ptr <Value const> get (Value && value) {
auto existing = objects_.find (value,
boost::hash <Value>(), EqualToWeakPtr());
if (existing != objects_.end())
return existing->get();
// The value is not in the store yet; insert it.
auto sole = SoleType::construct (*this, std::move (value));
Pointer newElement (sole);
objects_.insert (std::move (newElement));
return sole;
}
示例5: add
// called in Stored constructor
// assignes new unique ID and back iterator
virtual ID add(Target * object)
{
assert(generator);
if(!valid(object->id()))
object->localID=generator->generate(object);
else if(contains(object->id()))
{
assert(false);
}
objects.insert(std::make_pair(object->id(),object));
Objects::iterator it=objects.find(object->id());
object->back=it;
onAdd(object); // raise onAdd event.
return object->id();
}