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


C++ Guid::toString方法代码示例

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


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

示例1: TEST

    TEST(HashTest, HashGuid)
    {
        Guid guid;
        guid.toString(); // change internal state
        Guid guid2(guid);

        EXPECT_EQ(CapuDefaultHashFunction<>::Digest(guid, 4), CapuDefaultHashFunction<>::Digest(guid2, 4));
    }
开发者ID:bmwcarit,项目名称:capu,代码行数:8,代码来源:HashTest.cpp

示例2:

std::shared_ptr<XmlNode> DptfStatus::getArbitratorXmlForLoadedParticipants()
{
	auto root = XmlNode::createRoot();
	root->addChild(XmlNode::createComment("format_id=" + ArbitratorStatusFormatId.toString()));

	auto arbitratorRoot = XmlNode::createWrapperElement("arbitrator_status");
	auto participantIndexList = m_participantManager->getParticipantIndexes();
	auto numberOfUniqueDomains = 0;
	for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex)
	{
		try
		{
			Participant* participant = m_participantManager->getParticipantPtr(*participantIndex);
			numberOfUniqueDomains = numberOfUniqueDomains + participant->getDomainCount();
		}
		catch (...)
		{
			// Participant not available
		}
	}

	arbitratorRoot->addChild(XmlNode::createDataElement("number_of_domains", StatusFormat::friendlyValue(numberOfUniqueDomains)));

	auto policyIndexes = m_policyManager->getPolicyIndexes();
	for (auto policyIndex = policyIndexes.begin(); policyIndex != policyIndexes.end(); ++policyIndex)
	{
		try
		{
			Policy* policy = m_policyManager->getPolicyPtr(*policyIndex);
			std::string name = policy->getName();
			auto policyRoot = XmlNode::createWrapperElement("policy");
			auto policyName = XmlNode::createDataElement("policy_name", name);
			policyRoot->addChild(policyName);

			for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex)
			{
				try
				{
					Participant* participant = m_participantManager->getParticipantPtr(*participantIndex);
					policyRoot->addChild(participant->getArbitrationXmlForPolicy(*policyIndex));
				}
				catch (...)
				{
					// Participant not available
				}
			}

			arbitratorRoot->addChild(policyRoot);
		}
		catch (...)
		{
			// Policy not available, do not add.
		}
	}

	root->addChild(arbitratorRoot);
	return root;
}
开发者ID:01org,项目名称:dptf,代码行数:58,代码来源:DptfStatus.cpp

示例3: getXmlForFramework

std::string DptfStatus::getXmlForFramework(UInt32 moduleIndex, eEsifError* returnCode)
{
	std::shared_ptr<XmlNode> frameworkRoot;

	switch (moduleIndex)
	{
	case ManagerModuleType::Manager:
	{
		frameworkRoot = XmlNode::createRoot();
		auto formatId = XmlNode::createComment("format_id=" + ManagerStatusFormatId.toString());
		frameworkRoot->addChild(formatId);

		auto dppmRoot = XmlNode::createWrapperElement("manager_status");
		frameworkRoot->addChild(dppmRoot);

		auto policiesRoot = getXmlForFrameworkLoadedPolicies();
		dppmRoot->addChild(policiesRoot);

		auto participantsRoot = getXmlForFrameworkLoadedParticipants();
		dppmRoot->addChild(participantsRoot);

		*returnCode = ESIF_OK;
		break;
	}
	case ManagerModuleType::Events:
	{
		frameworkRoot = m_policyManager->getStatusAsXml();
		*returnCode = ESIF_OK;
		break;
	}
	case ManagerModuleType::Arbitrator:
	{
		frameworkRoot = getArbitratorXmlForLoadedParticipants();
		*returnCode = ESIF_OK;
		break;
	}
	case ManagerModuleType::Statistics:
	{
		frameworkRoot = m_dptfManager->getWorkItemQueueManager()->getStatusAsXml();
		*returnCode = ESIF_OK;
		break;
	}
	default:
		*returnCode = ESIF_E_UNSPECIFIED;
		break;
	}

	std::string s;
	if (frameworkRoot != nullptr)
	{
		s = frameworkRoot->toString();
	}

	return s;
}
开发者ID:01org,项目名称:dptf,代码行数:55,代码来源:DptfStatus.cpp

示例4: getStatusAsXml

string ActPolicy::getStatusAsXml(void) const 
{
    XmlNode* format = XmlNode::createComment("format_id=" + MyGuid.toString());
    XmlNode* status = XmlNode::createWrapperElement("act_policy_status");
    status->addChild(m_fivrDevices.getXml());
    status->addChild(m_radioDevices.getXml());
    status->addChild(m_pixelClockDevices.getXml());
    XmlNode* root = XmlNode::createRoot();
    root->addChild(format);
    root->addChild(status);
    string statusString = root->toString();
    delete root;
    return statusString;
}
开发者ID:zeros1122,项目名称:dptf,代码行数:14,代码来源:ActPolicy.cpp

示例5: if

void
DynamicDLDBList::callback(const Guid &guid, uint32 subserviceID,
	CSSM_SERVICE_TYPE subserviceType, CSSM_MODULE_EVENT eventType)
{
	secdebug("event", "Received callback from guid: %s ssid: %lu type: %lu event: %lu",
 			guid.toString().c_str(), (unsigned long)subserviceID, (unsigned long)subserviceType, (unsigned long)eventType);

	StLock<Mutex>_(mMutex);
	
	bool list_changed = false;

	if (subserviceType & CSSM_SERVICE_DL)
	{
		if (eventType == CSSM_NOTIFY_INSERT)
		{
			/* A DL or CSP/DL was inserted. */
			secdebug("dynamic", "%sDL module: %s SSID: %lu inserted",
				(subserviceType & CSSM_SERVICE_CSP) ? "CSP/" : "", guid.toString().c_str(), (unsigned long)subserviceID);
			list_changed = _add(guid, subserviceID, subserviceType);
		}
		else if (eventType == CSSM_NOTIFY_REMOVE)
		{
			/* A DL or CSP/DL was removed. */
			secdebug("dynamic", "%sDL module: %s SSID: %lu removed",
				(subserviceType & CSSM_SERVICE_CSP) ? "CSP/" : "", guid.toString().c_str(), (unsigned long)subserviceID);
			list_changed = _remove(guid, subserviceID, subserviceType);
		}
	}

	if (list_changed)
	{
		// Make sure we are not holding mLock nor the StorageManager mLock when we post these events.
		// @@@ Rather than posting we should simulate a receive since each client will receive this
		// cssm level notification.
		KCEventNotifier::PostKeychainEvent(kSecKeychainListChangedEvent);
	}
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:37,代码来源:DynamicDLDBList.cpp

示例6: init

/**
 * Initializes the host object.
 *
 * @returns COM result indicator
 * @param   aInterfaceName name of the network interface
 * @param   aGuid GUID of the host network interface
 */
HRESULT HostNetworkInterface::init(Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType)
{
    LogFlowThisFunc(("aInterfaceName={%ls}, aGuid={%s}\n",
                      aInterfaceName.raw(), aGuid.toString().c_str()));

    ComAssertRet(!aInterfaceName.isEmpty(), E_INVALIDARG);
    ComAssertRet(!aGuid.isEmpty(), E_INVALIDARG);

    /* Enclose the state transition NotReady->InInit->Ready */
    AutoInitSpan autoInitSpan(this);
    AssertReturn(autoInitSpan.isOk(), E_FAIL);

    unconst(mInterfaceName) = aInterfaceName;
    unconst(mGuid) = aGuid;
    mIfType = ifType;

    /* Confirm a successful initialization */
    autoInitSpan.setSucceeded();

    return S_OK;
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:28,代码来源:HostNetworkInterfaceImpl.cpp

示例7: unregisterEvent

void EsifServices::unregisterEvent(FrameworkEvent::Type frameworkEvent, UIntN participantIndex, UIntN domainIndex)
{
    throwIfParticipantDomainCombinationInvalid(FLF, participantIndex, domainIndex);

    Guid guid = FrameworkEventInfo::instance()->getGuid(frameworkEvent);

    eEsifError rc = m_esifInterface.fUnregisterEventFuncPtr(m_esifHandle, m_dptfManager,
        (void*)m_dptfManager->getIndexContainer()->getIndexPtr(participantIndex),
        (void*)m_dptfManager->getIndexContainer()->getIndexPtr(domainIndex),
        EsifDataGuid(guid));

    // FIXME:  this should throw an exception if we get an unexpected return code.  For now we will just log an
    //         error so we can see a list of items to correct.
    if (rc != ESIF_OK)
    {
        ManagerMessage message = ManagerMessage(m_dptfManager, FLF,
            "Error returned from ESIF unregister event function call");
        message.setFrameworkEvent(frameworkEvent);
        message.addMessage("Guid", guid.toString());
        message.setParticipantAndDomainIndex(participantIndex, domainIndex);
        message.setEsifErrorCode(rc);
        writeMessageWarning(message);
    }
}
开发者ID:zeros1122,项目名称:dptf,代码行数:24,代码来源:EsifServices.cpp

示例8: decode

std::string ATNSerializer::decode(const std::wstring &inpdata) {
  if (inpdata.size() < 10)
    throw IllegalArgumentException("Not enough data to decode");

  std::vector<uint16_t> data(inpdata.size());
  data[0] = (uint16_t)inpdata[0];

  // Don't adjust the first value since that's the version number.
  for (size_t i = 1; i < inpdata.size(); ++i) {
    data[i] = (uint16_t)inpdata[i] - 2;
  }

  std::string buf;
  int p = 0;
  size_t version = (size_t)data[p++];
  if (version != ATNDeserializer::SERIALIZED_VERSION) {
    std::string reason = "Could not deserialize ATN with version " + std::to_string(version) + "(expected " +
    std::to_string(ATNDeserializer::SERIALIZED_VERSION) + ").";
    throw UnsupportedOperationException("ATN Serializer" + reason);
  }

  Guid uuid = ATNDeserializer::toUUID(data.data(), p);
  p += 8;
  if (uuid != ATNDeserializer::SERIALIZED_UUID()) {
    std::string reason = "Could not deserialize ATN with UUID " + uuid.toString() + " (expected " +
    ATNDeserializer::SERIALIZED_UUID().toString() + ").";
    throw UnsupportedOperationException("ATN Serializer" + reason);
  }

  p++;  // skip grammarType
  int maxType = data[p++];
  buf.append("max type ").append(std::to_string(maxType)).append("\n");
  int nstates = data[p++];
  for (int i = 0; i < nstates; i++) {
    int stype = data[p++];
    if (stype == ATNState::ATN_INVALID_TYPE) {  // ignore bad type of states
      continue;
    }
    int ruleIndex = data[p++];
    if (ruleIndex == 0xFFFF) {
      ruleIndex = -1;
    }

    std::string arg = "";
    if (stype == ATNState::LOOP_END) {
      int loopBackStateNumber = data[p++];
      arg = std::string(" ") + std::to_string(loopBackStateNumber);
    }
    else if (stype == ATNState::PLUS_BLOCK_START ||
             stype == ATNState::STAR_BLOCK_START ||
             stype == ATNState::BLOCK_START) {
      int endStateNumber = data[p++];
      arg = std::string(" ") + std::to_string(endStateNumber);
    }
    buf.append(std::to_string(i))
    .append(":")
    .append(ATNState::serializationNames[(size_t)stype])
    .append(" ")
    .append(std::to_string(ruleIndex))
    .append(arg)
    .append("\n");
  }
  int numNonGreedyStates = data[p++];
  p += numNonGreedyStates; // Instead of that useless loop below.
  /*
   for (int i = 0; i < numNonGreedyStates; i++) {
   int stateNumber = data[p++];
   }
   */

  int numPrecedenceStates = data[p++];
  p += numPrecedenceStates;
  /*
   for (int i = 0; i < numPrecedenceStates; i++) {
   int stateNumber = data[p++];
   }
   */

  int nrules = data[p++];
  for (int i = 0; i < nrules; i++) {
    int s = data[p++];
    if (atn->grammarType == ATNType::LEXER) {
      int arg1 = data[p++];
      buf.append("rule ")
      .append(std::to_string(i))
      .append(":")
      .append(std::to_string(s))
      .append(" ")
      .append(std::to_string(arg1))
      .append("\n");
    }
    else {
      buf.append("rule ")
      .append(std::to_string(i))
      .append(":")
      .append(std::to_string(s))
      .append("\n");
    }
  }
  int nmodes = data[p++];
//.........这里部分代码省略.........
开发者ID:soulstrop,项目名称:antlr4,代码行数:101,代码来源:ATNSerializer.cpp

示例9: deserialize

ATN ATNDeserializer::deserialize(const std::vector<uint16_t>& input) {
  // Don't adjust the first value since that's the version number.
  std::vector<uint16_t> data(input.size());
  data[0] = input[0];
  for (size_t i = 1; i < input.size(); ++i) {
    data[i] = input[i] - 2;
  }

  int p = 0;
  int version = data[p++];
  if (version != SERIALIZED_VERSION) {
    std::string reason = "Could not deserialize ATN with version" + std::to_string(version) + "(expected " + std::to_string(SERIALIZED_VERSION) + ").";

    throw UnsupportedOperationException(reason);
  }

  Guid uuid = toUUID(data.data(), p);
  p += 8;
  auto uuidIterator = std::find(SUPPORTED_UUIDS().begin(), SUPPORTED_UUIDS().end(), uuid);
  if (uuidIterator == SUPPORTED_UUIDS().end()) {
    std::string reason = "Could not deserialize ATN with UUID " + uuid.toString() + " (expected " +
      SERIALIZED_UUID().toString() + " or a legacy UUID).";

    throw UnsupportedOperationException(reason);
  }

  bool supportsPrecedencePredicates = isFeatureSupported(ADDED_PRECEDENCE_TRANSITIONS(), uuid);
  bool supportsLexerActions = isFeatureSupported(ADDED_LEXER_ACTIONS(), uuid);

  ATNType grammarType = (ATNType)data[p++];
  size_t maxTokenType = data[p++];
  ATN atn(grammarType, maxTokenType);

  //
  // STATES
  //
  std::vector<std::pair<LoopEndState*, size_t>> loopBackStateNumbers;
  std::vector<std::pair<BlockStartState*, size_t>> endStateNumbers;
  size_t nstates = data[p++];
  for (size_t i = 0; i < nstates; i++) {
    size_t stype = data[p++];
    // ignore bad type of states
    if (stype == ATNState::ATN_INVALID_TYPE) {
      atn.addState(nullptr);
      continue;
    }

    size_t ruleIndex = data[p++];
    if (ruleIndex == 0xFFFF) {
      ruleIndex = INVALID_INDEX;
    }

    ATNState *s = stateFactory(stype, ruleIndex);
    if (stype == ATNState::LOOP_END) { // special case
      int loopBackStateNumber = data[p++];
      loopBackStateNumbers.push_back({ (LoopEndState*)s,  loopBackStateNumber });
    } else if (is<BlockStartState*>(s)) {
      int endStateNumber = data[p++];
      endStateNumbers.push_back({ (BlockStartState*)s, endStateNumber });
    }
    atn.addState(s);
  }

  // delay the assignment of loop back and end states until we know all the state instances have been initialized
  for (auto &pair : loopBackStateNumbers) {
    pair.first->loopBackState = atn.states[pair.second];
  }

  for (auto &pair : endStateNumbers) {
    pair.first->endState = (BlockEndState*)atn.states[pair.second];
  }

  size_t numNonGreedyStates = data[p++];
  for (size_t i = 0; i < numNonGreedyStates; i++) {
    size_t stateNumber = data[p++];
    // The serialized ATN must be specifying the right states, so that the
    // cast below is correct.
    ((DecisionState *)atn.states[stateNumber])->nonGreedy = true;
  }

  if (supportsPrecedencePredicates) {
    size_t numPrecedenceStates = data[p++];
    for (size_t i = 0; i < numPrecedenceStates; i++) {
      size_t stateNumber = data[p++];
      ((RuleStartState *)atn.states[stateNumber])->isLeftRecursiveRule = true;
    }
  }

  //
  // RULES
  //
  size_t nrules = data[p++];
  for (size_t i = 0; i < nrules; i++) {
    size_t s = data[p++];
    // Also here, the serialized atn must ensure to point to the correct class type.
    RuleStartState *startState = (RuleStartState*)atn.states[s];
    atn.ruleToStartState.push_back(startState);
    if (atn.grammarType == ATNType::LEXER) {
      size_t tokenType = data[p++];
      if (tokenType == 0xFFFF) {
//.........这里部分代码省略.........
开发者ID:KvanTTT,项目名称:antlr4,代码行数:101,代码来源:ATNDeserializer.cpp

示例10: listNetworkInterfaces

/**
 * List network interfaces information (bridged/host only).
 *
 * @returns See produceList.
 * @param   pVirtualBox         Reference to the IVirtualBox smart pointer.
 * @param   fIsBridged          Selects between listing host interfaces (for
 *                              use with bridging) or host only interfaces.
 */
static HRESULT listNetworkInterfaces(const ComPtr<IVirtualBox> pVirtualBox,
                                     bool fIsBridged)
{
    HRESULT rc;
    ComPtr<IHost> host;
    CHECK_ERROR(pVirtualBox, COMGETTER(Host)(host.asOutParam()));
    com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces;
#if defined(VBOX_WITH_NETFLT)
    if (fIsBridged)
        CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_Bridged,
                                                          ComSafeArrayAsOutParam(hostNetworkInterfaces)));
    else
        CHECK_ERROR(host, FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_HostOnly,
                                                          ComSafeArrayAsOutParam(hostNetworkInterfaces)));
#else
    CHECK_ERROR(host, COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(hostNetworkInterfaces)));
#endif
    for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
    {
        ComPtr<IHostNetworkInterface> networkInterface = hostNetworkInterfaces[i];
#ifndef VBOX_WITH_HOSTNETIF_API
        Bstr interfaceName;
        networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
        RTPrintf("Name:        %ls\n", interfaceName.raw());
        Guid interfaceGuid;
        networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
        RTPrintf("GUID:        %ls\n\n", Bstr(interfaceGuid.toString()).raw());
#else /* VBOX_WITH_HOSTNETIF_API */
        Bstr interfaceName;
        networkInterface->COMGETTER(Name)(interfaceName.asOutParam());
        RTPrintf("Name:            %ls\n", interfaceName.raw());
        Bstr interfaceGuid;
        networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
        RTPrintf("GUID:            %ls\n", interfaceGuid.raw());
        BOOL bDHCPEnabled;
        networkInterface->COMGETTER(DHCPEnabled)(&bDHCPEnabled);
        RTPrintf("DHCP:            %s\n", bDHCPEnabled ? "Enabled" : "Disabled");

        Bstr IPAddress;
        networkInterface->COMGETTER(IPAddress)(IPAddress.asOutParam());
        RTPrintf("IPAddress:       %ls\n", IPAddress.raw());
        Bstr NetworkMask;
        networkInterface->COMGETTER(NetworkMask)(NetworkMask.asOutParam());
        RTPrintf("NetworkMask:     %ls\n", NetworkMask.raw());
        Bstr IPV6Address;
        networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
        RTPrintf("IPV6Address:     %ls\n", IPV6Address.raw());
        ULONG IPV6NetworkMaskPrefixLength;
        networkInterface->COMGETTER(IPV6NetworkMaskPrefixLength)(&IPV6NetworkMaskPrefixLength);
        RTPrintf("IPV6NetworkMaskPrefixLength: %d\n", IPV6NetworkMaskPrefixLength);
        Bstr HardwareAddress;
        networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
        RTPrintf("HardwareAddress: %ls\n", HardwareAddress.raw());
        HostNetworkInterfaceMediumType_T Type;
        networkInterface->COMGETTER(MediumType)(&Type);
        RTPrintf("MediumType:      %s\n", getHostIfMediumTypeText(Type));
        HostNetworkInterfaceStatus_T Status;
        networkInterface->COMGETTER(Status)(&Status);
        RTPrintf("Status:          %s\n", getHostIfStatusText(Status));
        Bstr netName;
        networkInterface->COMGETTER(NetworkName)(netName.asOutParam());
        RTPrintf("VBoxNetworkName: %ls\n\n", netName.raw());
#endif
    }
    return rc;
}
开发者ID:eaas-framework,项目名称:virtualbox,代码行数:74,代码来源:VBoxManageList.cpp


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