当前位置: 首页>>代码示例>>C++>>正文


C++ UUID::SetFromCString方法代码示例

本文整理汇总了C++中UUID::SetFromCString方法的典型用法代码示例。如果您正苦于以下问题:C++ UUID::SetFromCString方法的具体用法?C++ UUID::SetFromCString怎么用?C++ UUID::SetFromCString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UUID的用法示例。


在下文中一共展示了UUID::SetFromCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetUUID

lldb_private::UUID CommunicationKDP::GetUUID() {
  UUID uuid;
  if (GetKernelVersion() == NULL)
    return uuid;

  if (m_kernel_version.find("UUID=") == std::string::npos)
    return uuid;

  size_t p = m_kernel_version.find("UUID=") + strlen("UUID=");
  std::string uuid_str = m_kernel_version.substr(p, 36);
  if (uuid_str.size() < 32)
    return uuid;

  if (uuid.SetFromCString(uuid_str.c_str()) == 0) {
    UUID invalid_uuid;
    return invalid_uuid;
  }

  return uuid;
}
开发者ID:emaste,项目名称:lldb,代码行数:20,代码来源:CommunicationKDP.cpp

示例2: switch


//.........这里部分代码省略.........
            // "definition.default_uint_value" is the default enumeration value if
            // "definition.default_cstr_value" is NULL, otherwise interpret
            // "definition.default_cstr_value" as a string value that represents the default
            // value.
        {
            OptionValueEnumeration *enum_value = new OptionValueEnumeration(definition.enum_values, definition.default_uint_value);
            m_value_sp.reset (enum_value);
            if (definition.default_cstr_value)
            {
                if (enum_value->SetValueFromCString(definition.default_cstr_value).Success())
                {
                    enum_value->SetDefaultValue(enum_value->GetCurrentValue());
                    // Call Clear() since we don't want the value to appear as
                    // having been set since we called SetValueFromCString() above.
                    // Clear will set the current value to the default and clear
                    // the boolean that says that the value has been set.
                    enum_value->Clear();
                }
            }
        }
            break;
            
        case OptionValue::eTypeFileSpec:
            // "definition.default_uint_value" represents if the "definition.default_cstr_value" should
            // be resolved or not
            m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, definition.default_uint_value != 0)));
            break;
            
        case OptionValue::eTypeFileSpecList:
            // "definition.default_uint_value" is not used for a OptionValue::eTypeFileSpecList
            m_value_sp.reset (new OptionValueFileSpecList());
            break;
            
        case OptionValue::eTypeFormat:
            // "definition.default_uint_value" is the default format enumeration value if
            // "definition.default_cstr_value" is NULL, otherwise interpret
            // "definition.default_cstr_value" as a string value that represents the default
            // value.
        {
            Format new_format = eFormatInvalid;
            if (definition.default_cstr_value)
                Args::StringToFormat (definition.default_cstr_value, new_format, nullptr);
            else
                new_format = (Format)definition.default_uint_value;
            m_value_sp.reset (new OptionValueFormat(new_format));
        }
            break;
            
        case OptionValue::eTypePathMap:
            // "definition.default_uint_value" tells us if notifications should occur for
            // path mappings
            m_value_sp.reset (new OptionValuePathMappings(definition.default_uint_value != 0));
            break;
            
        case OptionValue::eTypeRegex:
            // "definition.default_uint_value" is used to the regular expression flags
            // "definition.default_cstr_value" the default regular expression value
            // value.
            m_value_sp.reset (new OptionValueRegex(definition.default_cstr_value, definition.default_uint_value));
            break;
            
        case OptionValue::eTypeSInt64:
            // "definition.default_uint_value" is the default integer value if
            // "definition.default_cstr_value" is NULL, otherwise interpret
            // "definition.default_cstr_value" as a string value that represents the default
            // value.
            m_value_sp.reset (new OptionValueSInt64(definition.default_cstr_value ? Args::StringToSInt64 (definition.default_cstr_value) : definition.default_uint_value));
            break;
            
        case OptionValue::eTypeUInt64:
            // "definition.default_uint_value" is the default unsigned integer value if
            // "definition.default_cstr_value" is NULL, otherwise interpret
            // "definition.default_cstr_value" as a string value that represents the default
            // value.
            m_value_sp.reset (new OptionValueUInt64(definition.default_cstr_value ? Args::StringToUInt64 (definition.default_cstr_value) : definition.default_uint_value));
            break;
            
        case OptionValue::eTypeUUID:
            // "definition.default_uint_value" is not used for a OptionValue::eTypeUUID
            // "definition.default_cstr_value" can contain a default UUID value
        {
            UUID uuid;
            if (definition.default_cstr_value)
                uuid.SetFromCString (definition.default_cstr_value);
            m_value_sp.reset (new OptionValueUUID(uuid));
        }
            break;
            
        case OptionValue::eTypeString:
            // "definition.default_uint_value" can contain the string option flags OR'ed together
            // "definition.default_cstr_value" can contain a default string value
            {
                OptionValueString *string_value = new OptionValueString(definition.default_cstr_value);
                if (definition.default_uint_value != 0)
                    string_value->GetOptions().Reset(definition.default_uint_value);
                m_value_sp.reset (string_value);
            }
            break;
    }
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:101,代码来源:Property.cpp


注:本文中的UUID::SetFromCString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。