本文整理汇总了C++中XElement类的典型用法代码示例。如果您正苦于以下问题:C++ XElement类的具体用法?C++ XElement怎么用?C++ XElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例7: GetGlobalSourceElement
XElement* OBS::GetGlobalSourceElement(CTSTR lpName)
{
XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
if(globals)
return globals->GetElement(lpName);
return NULL;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}