本文整理汇总了C++中Name::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Name::empty方法的具体用法?C++ Name::empty怎么用?C++ Name::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name::empty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
inline size_t
calculateSkip(const Name& name,
const Name& hint, const Name& zone)
{
size_t skip = 0;
if (!hint.empty()) {
// These are only asserts. The caller should supply the right parameters
skip = hint.size() + 1 + zone.size();
BOOST_ASSERT(name.size() > skip);
BOOST_ASSERT(name.getPrefix(hint.size()) == hint);
BOOST_ASSERT(name.get(hint.size()) == FORWARDING_HINT_LABEL);
BOOST_ASSERT(name.getSubName(hint.size() + 1, zone.size()) == zone);
}
else {
skip = zone.size();
BOOST_ASSERT(name.size() > skip);
BOOST_ASSERT(name.getPrefix(zone.size()) == zone);
}
BOOST_ASSERT(name.get(skip) == NDNS_ITERATIVE_QUERY ||
name.get(skip) == NDNS_CERT_QUERY);
++skip;
return skip;
}
示例2: makeAbsolute
Name Name::makeAbsolute(const Name& name) const{
assert(isAbsolute());
assert(!name.empty());
if(name.isAbsolute()) {
return name.copy();
} else {
return concat(name);
}
}
示例3: getDefaultCertificateNameForIdentity
void
SecPublicInfo::refreshDefaultCertificate()
{
Name certName = getDefaultCertificateNameForIdentity(getDefaultIdentity());
if(certName.empty())
defaultCertificate_.reset();
else
defaultCertificate_ = getCertificate(certName);
}
示例4: Name
inline void
CommandInterestGenerator::generate(Interest& interest,
const Name& certificateName /*= Name()*/)
{
if (certificateName.empty())
m_keyChain.sign(interest);
else
m_keyChain.sign(interest,
security::SigningInfo(security::SigningInfo::SIGNER_TYPE_CERT,
certificateName));
}
示例5: old
View::View(Name name) :
current(&layout),
old(&layout),
Q(&layout,¤t),
dgserver(0),
locks(0),
allowAnOpen(false) {
if(name.empty())
name = randomName('v');
gd<Name>(&layout) = name;
g_views[name] = this;
}
示例6: performSearch
SearchResult performSearch(Context& context, const Name& name, const size_t searchStartPosition) {
assert(!name.empty());
const auto& scopeStack = context.scopeStack();
const size_t startPosition = name.isAbsolute() ? scopeStack.size() - 1 : searchStartPosition;
for (size_t i = startPosition; i < scopeStack.size(); i++) {
const auto pos = scopeStack.size() - i - 1;
const auto result = performInnerSearch(scopeStack[pos], name);
if (!result.isNone()) return result;
}
return SearchResult::None();
}
示例7: interest
void
SimpleDataRetrieval::sendInterest()
{
Name prefix;
m_context->getContextOption(PREFIX, prefix);
Name suffix;
m_context->getContextOption(SUFFIX, suffix);
if (!suffix.empty())
{
prefix.append(suffix);
}
Interest interest(prefix);
int interestLifetime = 0;
m_context->getContextOption(INTEREST_LIFETIME, interestLifetime);
interest.setInterestLifetime(time::milliseconds(interestLifetime));
SelectorHelper::applySelectors(interest, m_context);
ConsumerInterestCallback onInterestToLeaveContext = EMPTY_CALLBACK;
m_context->getContextOption(INTEREST_LEAVE_CNTX, onInterestToLeaveContext);
if (onInterestToLeaveContext != EMPTY_CALLBACK)
{
onInterestToLeaveContext(*dynamic_cast<Consumer*>(m_context), interest);
}
m_face->expressInterest(interest,
bind(&SimpleDataRetrieval::onData, this, _1, _2),
bind(&SimpleDataRetrieval::onTimeout, this, _1));
bool isAsync = false;
m_context->getContextOption(ASYNC_MODE, isAsync);
if (!isAsync)
{
m_face->processEvents();
}
}
示例8: addIdentity
int64_t
PibDb::addKey(const Name& keyName, const PublicKey& key)
{
if (keyName.empty())
return 0;
Name&& identity = keyName.getPrefix(-1);
if (!hasIdentity(identity))
addIdentity(identity);
sqlite3_stmt* statement;
sqlite3_prepare_v2(m_database,
"INSERT INTO keys (identity_id, key_name, key_type, key_bits) \
values ((SELECT id FROM identities WHERE identity=?), ?, ?, ?)",
-1, &statement, nullptr);
sqlite3_bind_block(statement, 1, identity.wireEncode(), SQLITE_TRANSIENT);
sqlite3_bind_block(statement, 2, keyName.wireEncode(), SQLITE_TRANSIENT);
sqlite3_bind_int(statement, 3, key.getKeyType());
sqlite3_bind_blob(statement, 4, key.get().buf(), key.get().size(), SQLITE_STATIC);
sqlite3_step(statement);
sqlite3_finalize(statement);
return sqlite3_last_insert_rowid(m_database);
}
示例9: applyAEffect
void Unit::applyAEffect(Name effectName, float playtime)
{
if (!effectName.empty())
m_actor->playEffect(effectName, playtime);
}
示例10: applyAction
void Unit::applyAction(Name actionName, float playtime)
{
if (!actionName.empty())
m_actor->playAction(actionName, playtime);
}