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


C++ Guid类代码示例

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


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

示例1: start

HRESULT DHCPServer::start(const com::Utf8Str &aNetworkName,
                          const com::Utf8Str &aTrunkName,
                          const com::Utf8Str &aTrunkType)
{
    /* Silently ignore attempts to run disabled servers. */
    if (!m->enabled)
        return S_OK;

    /* Commmon Network Settings */
    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNetwork, aNetworkName.c_str());

    if (!aTrunkName.isEmpty())
        m->dhcp.setOption(NetworkServiceRunner::kNsrTrunkName, aTrunkName.c_str());

    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyTrunkType, aTrunkType.c_str());

    /* XXX: should this MAC default initialization moved to NetworkServiceRunner? */
    char strMAC[32];
    Guid guid;
    guid.create();
    RTStrPrintf (strMAC, sizeof(strMAC), "08:00:27:%02X:%02X:%02X",
                 guid.raw()->au8[0],
                 guid.raw()->au8[1],
                 guid.raw()->au8[2]);
    m->dhcp.setOption(NetworkServiceRunner::kNsrMacAddress, strMAC);
    m->dhcp.setOption(NetworkServiceRunner::kNsrIpAddress,  Utf8Str(m->IPAddress).c_str());
    m->dhcp.setOption(NetworkServiceRunner::kNsrIpNetmask, Utf8Str(m->GlobalDhcpOptions[DhcpOpt_SubnetMask].text).c_str());
    m->dhcp.setOption(DHCPServerRunner::kDsrKeyLowerIp, Utf8Str(m->lowerIP).c_str());
    m->dhcp.setOption(DHCPServerRunner::kDsrKeyUpperIp, Utf8Str(m->upperIP).c_str());

    /* XXX: This parameters Dhcp Server will fetch via API */
    return RT_FAILURE(m->dhcp.start(!m->router /* KillProcOnExit */)) ? E_FAIL : S_OK;
    //m->dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */
}
开发者ID:miguelinux,项目名称:vbox,代码行数:34,代码来源:DHCPServerImpl.cpp

示例2: transformGuid

//! \brief Generates Guid from extended Bittorrent Guid
inline Guid transformGuid(const BtGuid& other)
{
    Guid result;
    memcpy( &result[ 0 ], &other[ 0 ], result.byteCount );
    result.validate();
    return result;
}
开发者ID:qing3962,项目名称:peerproject,代码行数:8,代码来源:Hashes.hpp

示例3: Utf8Str

STDMETHODIMP DHCPServer::Start(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType)
{
    /* Silently ignore attempts to run disabled servers. */
    if (!m.enabled)
        return S_OK;

    m.dhcp.setOption(DHCPCFG_NETNAME, Utf8Str(aNetworkName), true);
    Bstr tmp(aTrunkName);
    if (!tmp.isEmpty())
        m.dhcp.setOption(DHCPCFG_TRUNKNAME, Utf8Str(tmp), true);
    m.dhcp.setOption(DHCPCFG_TRUNKTYPE, Utf8Str(aTrunkType), true);
    //temporary hack for testing
    //    DHCPCFG_NAME
    char strMAC[32];
    Guid guid;
    guid.create();
    RTStrPrintf (strMAC, sizeof(strMAC), "08:00:27:%02X:%02X:%02X",
                 guid.raw()->au8[0], guid.raw()->au8[1], guid.raw()->au8[2]);
    m.dhcp.setOption(DHCPCFG_MACADDRESS, strMAC, true);
    m.dhcp.setOption(DHCPCFG_IPADDRESS,  Utf8Str(m.IPAddress), true);
    //        DHCPCFG_LEASEDB,
    //        DHCPCFG_VERBOSE,
    //        DHCPCFG_GATEWAY,
    m.dhcp.setOption(DHCPCFG_LOWERIP,  Utf8Str(m.lowerIP), true);
    m.dhcp.setOption(DHCPCFG_UPPERIP,  Utf8Str(m.upperIP), true);
    m.dhcp.setOption(DHCPCFG_NETMASK,  Utf8Str(m.networkMask), true);

    //        DHCPCFG_HELP,
    //        DHCPCFG_VERSION,
    //        DHCPCFG_NOTOPT_MAXVAL
    m.dhcp.setOption(DHCPCFG_BEGINCONFIG,  "", true);

    return RT_FAILURE(m.dhcp.start()) ? E_FAIL : S_OK;
    //m.dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */
}
开发者ID:mutoso-mirrors,项目名称:vbox,代码行数:35,代码来源:DHCPServerImpl.cpp

示例4: 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

示例5: getByID

	IResourcePtr ResourceManager::getByID(const Guid& _id, bool _throw)
	{
		MapResourceID::iterator iter = mResourcesID.find(_id);
		if (iter == mResourcesID.end())
		{
			if (_throw) MYGUI_EXCEPT("resource '" << _id.print() << "' not found");
			MYGUI_LOG(Warning, "resource '" << _id.print() << "' not found");
			return nullptr;
		}
		return iter->second;
	}
开发者ID:OndraK,项目名称:openmw,代码行数:11,代码来源:MyGUI_ResourceManager.cpp

示例6: dptf_exception

void Guid::throwIfInvalid(const Guid& guid) const
{
    if (guid.isValid() == false)
    {
        throw dptf_exception("Guid is invalid.");
    }
}
开发者ID:hoangt,项目名称:dptf,代码行数:7,代码来源:Guid.cpp

示例7: memcpy

	bool VdmHelper::MoveWindowToDesktop(IntPtr topLevelWindow, Guid desktopId)
	{
#ifndef _WIN64
		BOOL isRunningOnX64 = FALSE;
		::IsWow64Process(GetCurrentProcess(), &isRunningOnX64);
		if(isRunningOnX64)
		{
			throw gcnew System::InvalidOperationException("You need call via 64bit dll");
		}
#endif
		// convert System.Guid to GUID
		auto bytes = desktopId.ToByteArray();
		pin_ptr<unsigned char> pbytes = &bytes[0];
		GUID dest;
		memcpy(&dest, pbytes, sizeof(GUID));
		// allocate & request
		auto hwnd = (HWND)topLevelWindow.ToPointer();
		LPVOID rGuid = VDMAllocGuid(hwnd, &dest);
		if (isConsoleWindowClass(hwnd)) {
			VDMInject(hwnd, &dest);
		}
		else {
			SendMessage(hwnd, RequestMoveWindowToDesktopMessage, 0, (LPARAM)rGuid);
		}
		VDMReleaseGuid(hwnd, rGuid);
		return true;
	}
开发者ID:GitMyCode,项目名称:VDMHelper,代码行数:27,代码来源:VDMHelperCLR.cpp

示例8: toGUID

// https://msdn.microsoft.com/en-us/library/wb8scw8f.aspx
static GUID toGUID(Guid& guid)
{
    array<Byte>^ guidData = guid.ToByteArray();
    pin_ptr<Byte> data = &(guidData[0]);

    return *reinterpret_cast<GUID*>(data);
}
开发者ID:JDanielSmith,项目名称:Projects,代码行数:8,代码来源:KnownFolderHelper.cpp

示例9: CreateInstance

ErrorCode ComProxyStatelessServiceFactory::CreateInstance(
    wstring const & serviceType, 
    wstring const & serviceName, 
    vector<byte> const & initializationData,
    Guid const & partitionId,
    const FABRIC_INSTANCE_ID instanceId, 
    __out IStatelessServiceInstancePtr & )
{
    HRESULT hr;
    ComPointer<IFabricStatelessServiceInstance> comService;

    hr = comImpl_->CreateInstance(
        serviceType.c_str(),
        serviceName.c_str(),
        (ULONG)initializationData.size(),
        initializationData.data(),
        partitionId.AsGUID(),
        instanceId,
        comService.InitializationAddress());

    if(SUCCEEDED(hr))
    {
        ASSERT_IFNOT(comService, "Instance create returned a null service.");
        // TODO: create proxy for the stateless service
        // service = make_unique<ComProxyStatelessService>(comService);
        //
    }
    
    return ErrorCode::FromHResult(hr);
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:30,代码来源:ComProxyStatelessServiceFactory.cpp

示例10: serializeUUID

void ATNSerializer::serializeUUID(std::vector<size_t>& data, Guid uuid) {
  unsigned int twoBytes = 0;
  bool firstByte = true;
  for (std::vector<unsigned char>::const_reverse_iterator rit = uuid.rbegin();
       rit != uuid.rend(); ++rit) {
    if (firstByte) {
      twoBytes = *rit;
      firstByte = false;
    } else {
      twoBytes |= (*rit << 8);
      data.push_back(twoBytes);
      firstByte = true;
    }
  }
  if (!firstByte)
    throw IllegalArgumentException(
        "The UUID provided is not valid (odd number of bytes).");
}
开发者ID:asbeane,项目名称:node,代码行数:18,代码来源:ATNSerializer.cpp

示例11: testmethod_GenerateNewGuid

void GuidTest::testmethod_GenerateNewGuid()
{
	Guid guidgen;
	GuidType guid;
	std::map<GuidType, bool> guids;
	int nguids = 10000;
	size_t ncount;
	for (int i=0; i<nguids; i++)
	{
		guid = guidgen.GenerateNewGuid();
		CPPUNIT_ASSERT ( guid.length() == 36 );
		ncount = guids.count(guid);
		if (ncount == 0)
		{
			guids[guid] = true;
		}
		CPPUNIT_ASSERT( ncount == 0);
	}
}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:19,代码来源:GuidTest.cpp

示例12: LogFlowThisFunc

/**
 * 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

示例13: 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

示例14: 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

示例15: throwIfParticipantDomainCombinationInvalid

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


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