本文整理汇总了C++中RepoBSON::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ RepoBSON::isValid方法的具体用法?C++ RepoBSON::isValid怎么用?C++ RepoBSON::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepoBSON
的用法示例。
在下文中一共展示了RepoBSON::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeRepoProjectSettings
RepoProjectSettings RepoBSONFactory::makeRepoProjectSettings(
const std::string &uniqueProjectName,
const std::string &owner,
const std::string &type,
const std::string &description,
const double pinSize,
const double avatarHeight,
const double visibilityLimit,
const double speed,
const double zNear,
const double zFar)
{
RepoBSONBuilder builder;
//--------------------------------------------------------------------------
// Project name
if (!uniqueProjectName.empty())
builder << REPO_LABEL_ID << uniqueProjectName;
//--------------------------------------------------------------------------
// Owner
if (!owner.empty())
builder << REPO_LABEL_OWNER << owner;
//--------------------------------------------------------------------------
// Description
if (!description.empty())
builder << REPO_LABEL_DESCRIPTION << description;
//--------------------------------------------------------------------------
// Type
if (!type.empty())
builder << REPO_LABEL_TYPE << type;
//--------------------------------------------------------------------------
// Properties (embedded sub-bson)
RepoBSONBuilder propertiesBuilder;
if (pinSize != REPO_DEFAULT_PROJECT_PIN_SIZE)
propertiesBuilder << REPO_LABEL_PIN_SIZE << pinSize;
if (avatarHeight != REPO_DEFAULT_PROJECT_AVATAR_HEIGHT)
propertiesBuilder << REPO_LABEL_AVATAR_HEIGHT << avatarHeight;
if (visibilityLimit != REPO_DEFAULT_PROJECT_VISIBILITY_LIMIT)
propertiesBuilder << REPO_LABEL_VISIBILITY_LIMIT << visibilityLimit;
if (speed != REPO_DEFAULT_PROJECT_SPEED)
propertiesBuilder << REPO_LABEL_SPEED << speed;
if (zNear != REPO_DEFAULT_PROJECT_ZNEAR)
propertiesBuilder << REPO_LABEL_ZNEAR << zNear;
if (zFar != REPO_DEFAULT_PROJECT_ZFAR)
propertiesBuilder << REPO_LABEL_ZFAR << zFar;
RepoBSON propertiesBSON = propertiesBuilder.obj();
if (propertiesBSON.isValid() && !propertiesBSON.isEmpty())
builder << REPO_LABEL_PROPERTIES << propertiesBSON;
//--------------------------------------------------------------------------
// Add to the parent object
return RepoProjectSettings(builder.obj());
}