本文整理汇总了C++中CID::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ CID::ToString方法的具体用法?C++ CID::ToString怎么用?C++ CID::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CID
的用法示例。
在下文中一共展示了CID::ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testToString
/*
* Check that ToString works.
*/
void CIDTest::testToString() {
CID cid = CID::FromData(TEST_DATA);
string cid_str = cid.ToString();
transform(cid_str.begin(), cid_str.end(), cid_str.begin(), toupper);
OLA_ASSERT_EQ(string("00010203-0405-0607-0809-0A0B0C0D0E0F"),
cid_str);
}
示例2: testFromString
/*
* Check that from string works.
*/
void CIDTest::testFromString() {
const string uuid = "00010203-0405-0607-0809-0A0B0C0D0E0F";
CID cid = CID::FromString(uuid);
string cid_str = cid.ToString();
transform(cid_str.begin(), cid_str.end(), cid_str.begin(), toupper);
OLA_ASSERT_EQ(uuid, cid_str);
const string bad_uuid = "foo";
cid = CID::FromString(bad_uuid);
OLA_ASSERT(cid.IsNil());
}
示例3: UIntValidator
/*
* Load the plugin prefs and default to sensible values
*
*/
bool E131Plugin::SetDefaultPreferences() {
if (!m_preferences)
return false;
bool save = false;
CID cid = CID::FromString(m_preferences->GetValue(CID_KEY));
if (cid.IsNil()) {
cid = CID::Generate();
m_preferences->SetValue(CID_KEY, cid.ToString());
save = true;
}
save |= m_preferences->SetDefaultValue(
DSCP_KEY,
UIntValidator(0, 63),
DEFAULT_DSCP_VALUE);
save |= m_preferences->SetDefaultValue(
DRAFT_DISCOVERY_KEY,
BoolValidator(),
BoolValidator::DISABLED);
save |= m_preferences->SetDefaultValue(
IGNORE_PREVIEW_DATA_KEY,
BoolValidator(),
BoolValidator::ENABLED);
save |= m_preferences->SetDefaultValue(
INPUT_PORT_COUNT_KEY,
UIntValidator(0, 128),
DEFAULT_PORT_COUNT);
save |= m_preferences->SetDefaultValue(
OUTPUT_PORT_COUNT_KEY,
UIntValidator(0, 128),
DEFAULT_PORT_COUNT);
save |= m_preferences->SetDefaultValue(IP_KEY, StringValidator(true), "");
save |= m_preferences->SetDefaultValue(
PREPEND_HOSTNAME_KEY,
BoolValidator(),
BoolValidator::ENABLED);
std::set<string> revision_values;
revision_values.insert(REVISION_0_2);
revision_values.insert(REVISION_0_46);
save |= m_preferences->SetDefaultValue(
REVISION_KEY,
SetValidator<string>(revision_values),
REVISION_0_46);
if (save)
m_preferences->Save();
// check if this saved correctly
// we don't want to use it if null
string revision = m_preferences->GetValue(REVISION_KEY);
if (m_preferences->GetValue(CID_KEY).empty() ||
(revision != REVISION_0_2 && revision != REVISION_0_46))
return false;
return true;
}