本文整理汇总了C++中dictionary::Ptr::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetLength方法的具体用法?C++ Ptr::GetLength怎么用?C++ Ptr::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dictionary::Ptr
的用法示例。
在下文中一共展示了Ptr::GetLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToBool
bool Value::ToBool(void) const
{
switch (GetType()) {
case ValueNumber:
return static_cast<bool>(boost::get<double>(m_Value));
case ValueBoolean:
return boost::get<bool>(m_Value);
case ValueString:
return !boost::get<String>(m_Value).IsEmpty();
case ValueObject:
if (IsObjectType<Dictionary>()) {
Dictionary::Ptr dictionary = *this;
return dictionary->GetLength() > 0;
} else if (IsObjectType<Array>()) {
Array::Ptr array = *this;
return array->GetLength() > 0;
} else {
return true;
}
case ValueEmpty:
return false;
default:
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid variant type."));
}
}
示例2: PrintLoggers
void TroubleshootCommand::PrintLoggers(InfoLog& log, Dictionary::Ptr& logs)
{
if (!logs->GetLength()) {
InfoLogLine(log, 0, LogWarning)
<< "No loggers found, check whether you enabled any logging features\n";
} else {
InfoLogLine(log)
<< "Getting the last 20 lines of " << logs->GetLength() << " FileLogger objects.\n";
ObjectLock ulock(logs);
for (const Dictionary::Pair& kv : logs) {
InfoLogLine(log)
<< "Logger " << kv.first << " at path: " << kv.second << '\n';
if (!Tail(kv.second, 20, log)) {
InfoLogLine(log, 0, LogWarning)
<< kv.second << " either does not exist or is empty\n";
}
}
}
}
示例3: Len
double ScriptUtils::Len(const Value& value)
{
if (value.IsObjectType<Dictionary>()) {
Dictionary::Ptr dict = value;
return dict->GetLength();
} else if (value.IsObjectType<Array>()) {
Array::Ptr array = value;
return array->GetLength();
} else if (value.IsString()) {
return Convert::ToString(value).GetLength();
} else {
return 0;
}
}
示例4: DictionaryLen
static double DictionaryLen(void)
{
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
return self->GetLength();
}