• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ XElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assert

XElement* XElement::GetElementByItem(CTSTR lpName, CTSTR lpItemName, CTSTR lpItemValue) const
{
    assert(lpItemName);
    assert(lpItemValue);

    if(lpName)
    {
        for(DWORD i=0; i<SubItems.Num(); i++)
        {
            if(!SubItems[i]->IsElement()) continue;

            XElement *element = static_cast<XElement*>(SubItems[i]);
            if(element->strName.CompareI(lpName))
            {
                if(scmpi(element->GetString(lpItemName), lpItemValue) == 0)
                    return element;
            }
        }
    }
    else
    {
        for(DWORD i=0; i<SubItems.Num(); i++)
        {
            if(!SubItems[i]->IsElement()) continue;

            XElement *element = static_cast<XElement*>(SubItems[i]);
            if(scmpi(element->GetString(lpItemName), lpItemValue) == 0)
                return element;
        }
    }

    return NULL;
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:33,代码来源:XConfig.cpp


示例2: OnSceneSwitch

void OnSceneSwitch(CTSTR scene)
{
    XElement *sceneElement;
    float desktopVolumeLevel, micVolumeLevel;
    int dMFV, mMFV;
    bool desktopMuted, micMuted;

    if(!bPSVEnabled)
        return;

    sceneElement = OBSGetSceneElement();

    if(sceneElement)
    {
        desktopVolumeLevel = sceneElement->GetFloat(TEXT("psvDesktopVolume"), 1.0f);
        micVolumeLevel = sceneElement->GetFloat(TEXT("psvMicVolume"), 1.0f);

        dMFV = sceneElement->GetInt(TEXT("psvDesktopMFV"));
        mMFV = sceneElement->GetInt(TEXT("psvMicMFV"));

        desktopMuted = (dMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED;

        micMuted = (mMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED;

        OBSSetDesktopVolume(desktopVolumeLevel, true);

        if(desktopMuted)
            OBSToggleDesktopMute();

        OBSSetMicVolume(micVolumeLevel, true);

        if(micMuted)
            OBSToggleMicMute();
    }
}
开发者ID:Alucard014,项目名称:OBS,代码行数:35,代码来源:psvplugin.cpp


示例3: AddGlobalSourceToScene

ImageSource* OBS::AddGlobalSourceToScene(CTSTR lpName)
{
    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
    {
        XElement *globalSourceElement = globals->GetElement(lpName);
        if(globalSourceElement)
        {
            CTSTR lpClass = globalSourceElement->GetString(TEXT("class"));
            if(lpClass)
            {
                ImageSource *newGlobalSource = CreateImageSource(lpClass, globalSourceElement->GetElement(TEXT("data")));
                if(newGlobalSource)
                {
                    App->EnterSceneMutex();

                    GlobalSourceInfo *info = globalSources.CreateNew();
                    info->strName = lpName;
                    info->element = globalSourceElement;
                    info->source = newGlobalSource;

                    info->source->BeginScene();

                    App->LeaveSceneMutex();

                    return newGlobalSource;
                }
            }
        }
    }

    AppWarning(TEXT("OBS::AddGlobalSourceToScene: Could not find global source '%s'"), lpName);
    return NULL;
}
开发者ID:AaronMike,项目名称:OBS,代码行数:34,代码来源:GlobalSource.cpp


示例4: OBSEnterSceneMutex

json_t* OBSAPIMessageHandler::HandleGetSceneList(OBSAPIMessageHandler* handler, json_t* message)
{
    OBSEnterSceneMutex();
    json_t* ret = GetOkResponse();
    XElement* xscenes = OBSGetSceneListElement();

    XElement* currentScene = OBSGetSceneElement();
    json_object_set_new(ret, "current-scene", json_string_wchar(currentScene->GetName()));

    json_t* scenes = json_array();
    if(scenes != NULL)
    {
        int numScenes = xscenes->NumElements();
        for(int i = 0; i < numScenes; i++)
        {
            XElement* scene = xscenes->GetElementByID(i);
            json_array_append_new(scenes, getSceneJson(scene));
        }
    }
    
    json_object_set_new(ret,"scenes", scenes);
    OBSLeaveSceneMutex();

    return ret;
}
开发者ID:MarsYoung,项目名称:OBSRemote,代码行数:25,代码来源:MessageHandling.cpp


示例5: augeGetFilterFactoryInstance

	GFilter* GetCountRequest::ParseXmlFilter(FeatureClass* pFeatureClass)
	{
		if(m_pxDoc==NULL)
		{
			return NULL;
		}

		XElement* pxRoot = m_pxDoc->GetRootNode();
		XElement* pxQuery = (XElement*)pxRoot->GetFirstChild("Query");
		if(pxQuery==NULL)
		{
			return NULL;
		}

		GFilter* pFilter = NULL;
		FilterFactory* pFilterFactory = augeGetFilterFactoryInstance();
		XElement* pxFilter = (XElement*)pxQuery->GetFirstChild("Filter");
		if(pxFilter!=NULL)
		{	
			FilterReader* reader = pFilterFactory->CreateFilerReader(pFeatureClass->GetFields());
			pFilter = reader->Read(pxFilter);
			reader->Release();
		}
		return pFilter;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:25,代码来源:GetCountRequest.cpp


示例6: ConfigureBitmapSource

bool STDCALL ConfigureBitmapSource(XElement *element, bool bCreating)
{
    if(!element)
    {
        AppWarning(TEXT("ConfigureBitmapSource: NULL element"));
        return false;
    }

    XElement *data = element->GetElement(TEXT("data"));
    if(!data)
        data = element->CreateElement(TEXT("data"));

    ConfigBitmapInfo configInfo;
    configInfo.data = data;

    if(DialogBoxParam(hinstMain, MAKEINTRESOURCE(IDD_CONFIGUREBITMAPSOURCE), hwndMain, ConfigureBitmapProc, (LPARAM)&configInfo) == IDOK)
    {
        CTSTR lpBitmap = data->GetString(TEXT("path"));

        D3DX10_IMAGE_INFO ii;
        if(SUCCEEDED(D3DX10GetImageInfoFromFile(lpBitmap, NULL, &ii, NULL)))
        {
            element->SetInt(TEXT("cx"), ii.Width);
            element->SetInt(TEXT("cy"), ii.Height);
        }
        else
            AppWarning(TEXT("ConfigureBitmapSource: could not get image info for bitmap '%s'"), lpBitmap);

        return true;
    }

    return false;
}
开发者ID:asgeirom,项目名称:OBS,代码行数:33,代码来源:BitmapImageSource.cpp


示例7: GetGlobalSourceElement

XElement* OBS::GetGlobalSourceElement(CTSTR lpName)
{
    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
        return globals->GetElement(lpName);

    return NULL;
}
开发者ID:AaronMike,项目名称:OBS,代码行数:8,代码来源:GlobalSource.cpp


示例8: while

std::vector<std::string> DWConfig::getValueVect(std::string name)
{
	std::vector<std::string> result;
	if(name == "" || this->xelement_ == NULL)
	{
		return result;
	}

	std::string tempstr = name;
	XElement * tmpel = xelement_;
	XElementList* li1 = NULL;  
	if(tempstr.find_first_of(".")>=0)
	{
		tempstr= tempstr.substr(tempstr.find_first_of(".")+1,tempstr.length());
		while(tempstr.length()>0)
		{   
			li1 = tmpel->getChildNodes();
			if(li1 == NULL)
			{
				break;
			}		
			tmpel =  li1->getElement(tempstr.substr(0,tempstr.find_first_of(".")));			
			if(tmpel == NULL)
			{
				break;		
			}
			int idx = tempstr.find_first_of(".");
			if(idx >= 0)
			{
				tempstr = tempstr.substr(idx+1,tempstr.length());
			}
			else
			{
				tempstr ="";
			}		
		}
	}
	

	if(tmpel!=NULL)
	{
		XElementList* li = tmpel->getChildNodes();
		if(tmpel->hasChildNodes())
		{
			for(int i=1;i<=li->getLength();i++)
			{
				result.push_back(li->item(i)->getNodeName());
			}
		}
		else
		{
			result.push_back(tmpel->getNodeValue());
		}
	}

	return result;
}
开发者ID:mydw,项目名称:mydw,代码行数:57,代码来源:DWConfig.cpp


示例9: assert

XElement* XElement::CopyElement(XElement* element, CTSTR lpNewName)
{
   assert(lpNewName);
   assert(element);

   XElement *newElement = new XElement(file, this, lpNewName);

   newElement->NewElementCopy(element, true);

   SubItems << newElement;

   return newElement;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:13,代码来源:XConfig.cpp


示例10: GetDlgItem

void OBS::CheckSources()
{
    XElement *curSceneElement = App->sceneElement;
    XElement *sources = curSceneElement->GetElement(TEXT("sources"));

    if(!sources)
        return;

    HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);

    UINT numSources = ListView_GetItemCount(hwndSources);
    for(UINT i = 0; i < numSources; i++)
    {
        bool checked = ListView_GetCheckState(hwndSources, i) > 0;
        XElement *source =sources->GetElementByID(i);
        bool curRender = source->GetInt(TEXT("render"), 0) > 0;
        if(curRender != checked)
        {
            source->SetInt(TEXT("render"), (checked)?1:0);
            if(scene && i < scene->NumSceneItems())
            {
                SceneItem *sceneItem = scene->GetSceneItem(i);
                sceneItem->bRender = checked;
                sceneItem->SetRender(checked);
            }
            ReportSourceChanged(source->GetName(), source);
        }
    }
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:29,代码来源:OBS.cpp


示例11: WriteSymbol

	void GetSymbolResponse::WriteSymbol(XDocument* pxDoc)
	{
		XElement  *pxNode = NULL;
		XElement  *pxRoot = NULL;
		char str[AUGE_MSG_MAX];

		pxRoot = pxDoc->CreateRootNode("Symbols", NULL, NULL);
		//pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wms",NULL);
		pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");
		//pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema-instance","xsi");
		//pxRoot->SetAttribute("version", "1.0.0", NULL);

		Symbol* pSymbol = m_pSymbol;
		AddSymbolNode(pxRoot, pSymbol);
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:15,代码来源:GetSymbolResponse.cpp


示例12: GetGlobalSourceNames

void OBS::GetGlobalSourceNames(List<CTSTR> &globalSourceNames)
{
    globalSourceNames.Clear();

    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
    {
        UINT numSources = globals->NumElements();
        for(UINT i=0; i<numSources; i++)
        {
            XElement *sourceElement = globals->GetElementByID(i);
            globalSourceNames << sourceElement->GetName();
        }
    }
}
开发者ID:AaronMike,项目名称:OBS,代码行数:15,代码来源:GlobalSource.cpp


示例13: augeGetLoggerInstance

	void GetSymbolResponse::WriteSymbols(XDocument* pxDoc)
	{
		GLogger* pLogger = augeGetLoggerInstance();

		XElement	*pxNode = NULL;
		XElement	*pxRoot = pxDoc->CreateRootNode("Symbols", NULL, NULL);
		pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");

		Symbol		*pSymbol = NULL;
		m_pSymbols->Reset();
		while((pSymbol=m_pSymbols->Next())!=NULL)
		{
			AddSymbolNode(pxRoot, pSymbol);
		}
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:15,代码来源:GetSymbolResponse.cpp


示例14: OnDesktopVolumeChanged

void OnDesktopVolumeChanged(float level, bool muted, bool finalValue)
{
    XElement *sceneElement;

    if(!bPSVEnabled)
        return;

    sceneElement = OBSGetSceneElement();

    if(sceneElement)
    {
        if(!muted)
            sceneElement->SetFloat(TEXT("psvDesktopVolume"), level);

        sceneElement->SetInt(TEXT("psvDesktopMFV"), muted ? PSV_VOL_MUTED : 0);
    }
}
开发者ID:Alucard014,项目名称:OBS,代码行数:17,代码来源:psvplugin.cpp


示例15: GetHandler

	WebRequest*	WProcessEngine::ParseRequest(XDocument* pxDoc, const char* mapName)
	{
		XElement	*pxRoot = pxDoc->GetRootNode();
		const char* request = pxRoot->GetName();

		WebHandler* handler = GetHandler(request);
		if(handler == NULL)
		{
			char msg[AUGE_MSG_MAX];
			g_sprintf(msg, "%s doesn't support request [%s]", GetType(), request);
			GLogger* pLogger = augeGetLoggerInstance();
			pLogger->Error(msg, __FILE__, __LINE__);
			GError* pError = augeGetErrorInstance();
			pError->SetError(msg);

			return NULL;
		}
		return handler->ParseRequest(pxDoc, mapName);
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:19,代码来源:WProcessEngine.cpp


示例16: LoadService

std::pair<std::unique_ptr<XConfig>, XElement*> LoadService(const ServiceIdentifier& sid, String *failReason)
{
    auto fail = [&](CTSTR reason)
    {
        if (failReason)
            *failReason = reason;
        return make_pair(std::unique_ptr<XConfig>(), nullptr);
    };

    auto serverData = make_unique<XConfig>();

    if (sid.file.IsEmpty())
    {
        if (!serverData->Open(FormattedString(L"%s\\services.xconfig", API->GetAppPath())))
            return fail(L"Could not open services.xconfig");

        XElement *services = serverData->GetElement(TEXT("services"));
        if (!services)
            return fail(L"Could not find any services in services.xconfig");

        XElement *service = NULL;
        auto numServices = services->NumElements();
        for (decltype(numServices) i = 0; i < numServices; i++)
        {
            XElement *curService = services->GetElementByID(i);
            if (!curService)
                continue;

            if (curService->GetInt(L"id") == sid.id)
                return { move(serverData), curService };
        }
    }
    else
    {
        if (serverData->Open(FormattedString(L"%s/services/%s", API->GetAppDataPath(), sid.file.Array())))
            return { move(serverData), serverData->GetElementByID(sid.id) };
        else
            return fail(FormattedString(L"Could not open service file '%s'", sid.file.Array()));
    }

    return make_pair(std::unique_ptr<XConfig>(), nullptr);
}
开发者ID:373137461,项目名称:OBS,代码行数:42,代码来源:Service.cpp


示例17: json_object

void WebSocketOBSTriggerHandler::SourceOrderChanged()
{
    json_t* update = json_object();
    json_object_set_new(update, "update-type", json_string("SourceOrderChanged"));

    XElement* xsources = OBSGetSceneElement()->GetElement(TEXT("sources"));
    
    json_t* sources = json_array();
    for(UINT i = 0; i < xsources->NumElements(); i++)
    {
        XElement* source = xsources->GetElementByID(i);

        json_array_append_new(sources, json_string_wchar(source->GetName()));
    }

    json_object_set_new(update, "sources", sources);

    OSEnterMutex(this->updateQueueMutex);
    this->updates.Add(update);
    OSLeaveMutex(this->updateQueueMutex);
}
开发者ID:MarsYoung,项目名称:OBSRemote,代码行数:21,代码来源:MessageHandling.cpp


示例18: LoadBuiltinServices

static inline void LoadBuiltinServices(vector<ServiceIdentifier> &services_)
{
    XConfig serverData;
    if (serverData.Open(FormattedString(L"%s\\services.xconfig", API->GetAppPath())))
    {
        XElement *services = serverData.GetElement(TEXT("services"));
        if (services)
        {
            auto numServices = services->NumElements();

            for (decltype(numServices) i = 0; i < numServices; i++)
            {
                auto service = services->GetElementByID(i);
                if (!service)
                    continue;

                services_.emplace_back(service->GetInt(L"id"), String());
            }
        }
    }
}
开发者ID:373137461,项目名称:OBS,代码行数:21,代码来源:Service.cpp


示例19: getSceneJson

json_t* getSceneJson(XElement* scene)
{
    XElement* sources = scene->GetElement(TEXT("sources"));
    json_t* ret = json_object();
    json_t* scene_items = json_array();
    json_object_set_new(ret, "name", json_string_wchar(scene->GetName()));

    if(sources != NULL)
    {
        for(UINT i = 0; i < sources->NumElements(); i++)
        {
            XElement* source = sources->GetElementByID(i);
            
            json_array_append(scene_items, getSourceJson(source));
        }
    }

    json_object_set_new(ret, "sources", scene_items);

    return ret;
}
开发者ID:MarsYoung,项目名称:OBSRemote,代码行数:21,代码来源:MessageHandling.cpp


示例20: AddDataSourceNode

	void GetDataSourceResponse::AddDataSourceNode(XElement* pxRoot, Workspace* pWorkspace)
	{
		XElement	*pxNode = NULL;
		XElement	*pxDataSource  = NULL;

		pxDataSource = pxRoot->AddChild("DataSource", NULL);

		pxNode = pxDataSource->AddChild("Name");
		pxNode->AddChildText(pWorkspace->GetName());
		pxNode = pxDataSource->AddChild("Engine");
		pxNode->AddChildText(pWorkspace->GetEngine()->GetID());
		pxNode = pxDataSource->AddChild("ConnectionString");
		pxNode->AddChildText(pWorkspace->GetConnectionString());
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:14,代码来源:GetDataSourceResponse.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XFBEncoder类代码示例发布时间:2022-05-31
下一篇:
C++ XDebugEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap