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


C++ CreateElement函数代码示例

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


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

示例1: AddTopology

static void AddTopology(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const TOPOLOGY& t)
{
	HRESULT hr;
	IXMLDOMElementPtr categories, connection, name, nodes;

	CreateElement(pDoc,L"ksproperty_topology_categories",&categories);
	CreateElement(pDoc,L"ksproperty_topology_connections",&connection);
	CreateElement(pDoc,L"ksproperty_topology_name",&name);
	CreateElement(pDoc,L"ksproperty_topology_nodes",&nodes);

	for(size_t n=0;n<t.categories.size();n++)
	{
		AddGUID(pDoc,categories,t.categories[n]);
	}

	for(size_t n=0;n<t.connection.size();n++)
	{
		AddTopologyConnection(pDoc,connection,t.connection[n]);
	}

	for(size_t n=0;n<t.name.size();n++)
	{
		AddString(pDoc,name,L"name",t.name[n].c_str());
	}

	for(size_t n=0;n<t.nodes.size();n++)
	{
		AddGUID(pDoc,nodes,t.nodes[n]);
	}

	AppendChild(categories,pParent);
	AppendChild(connection,pParent);
	AppendChild(name,pParent);
	AppendChild(nodes,pParent);
}
开发者ID:jensvaaben,项目名称:mfcbdainf,代码行数:35,代码来源:xmldoc.cpp

示例2: AddDevice

static void AddDevice(IXMLDOMDocument* pDoc,IXMLDOMElement* pParent,const DEVICE& d)
{
	HRESULT hr;
	IXMLDOMElementPtr bdatopology, topology, pintopology;

	AddAttribute(pDoc,L"device_path",d.device_path.c_str(),pParent);
	AddAttribute(pDoc,L"DeviceDesc",d.DeviceDesc.c_str(),pParent);
	AddAttribute(pDoc,L"Service",d.Service.c_str(),pParent);
	AddAttribute(pDoc,L"Class",d.Class.c_str(),pParent);
	AddAttribute(pDoc,L"ClassGUID",d.ClassGUID.c_str(),pParent);
	AddAttribute(pDoc,L"Driver",d.Driver.c_str(),pParent);
	AddAttribute(pDoc,L"PhysicalDeviceObjectName",d.PhysicalDeviceObjectName.c_str(),pParent);
	AddAttribute(pDoc,L"Enumerator_Name",d.Enumerator_Name.c_str(),pParent);
	AddAttribute(pDoc,L"device_instance_id",d.device_instance_id.c_str(),pParent);

	CreateElement(pDoc,L"bdatopology",&bdatopology);
	CreateElement(pDoc,L"topology",&topology);
	CreateElement(pDoc,L"pintopology",&pintopology);

	AddBDATopology(pDoc,bdatopology,d.bdatopology);
	AddTopology(pDoc,topology,d.topology);
	AddPinTopology(pDoc,pintopology,d.pintopology);

	AppendChild(bdatopology,pParent);
	AppendChild(topology,pParent);
	AppendChild(pintopology,pParent);
}
开发者ID:jensvaaben,项目名称:mfcbdainf,代码行数:27,代码来源:xmldoc.cpp

示例3: CreateElement

NS_INTERFACE_MAP_END


NS_IMETHODIMP
nsXULContextMenuBuilder::OpenContainer(const nsAString& aLabel)
{
  if (!mFragment) {
    return NS_ERROR_NOT_INITIALIZED;
  }

  if (!mCurrentNode) {
    mCurrentNode = mFragment;
  } else {
    nsCOMPtr<nsIContent> menu;
    nsresult rv = CreateElement(nsGkAtoms::menu, nsnull, getter_AddRefs(menu));
    NS_ENSURE_SUCCESS(rv, rv);

    menu->SetAttr(kNameSpaceID_None, nsGkAtoms::label, aLabel, PR_FALSE);

    nsCOMPtr<nsIContent> menuPopup;
    rv = CreateElement(nsGkAtoms::menupopup, nsnull,
                       getter_AddRefs(menuPopup));
    NS_ENSURE_SUCCESS(rv, rv);
        
    rv = menu->AppendChildTo(menuPopup, PR_FALSE);
    NS_ENSURE_SUCCESS(rv, rv);

    rv = mCurrentNode->AppendChildTo(menu, PR_FALSE);
    NS_ENSURE_SUCCESS(rv, rv);

    mCurrentNode = menuPopup;
  }

  return NS_OK;
}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:35,代码来源:nsXULContextMenuBuilder.cpp

示例4: ConstructElement

void CBCGPRibbonConstructor::ConstructPanel (CBCGPRibbonPanel& panel, const CBCGPRibbonInfo::XPanel& info) const
{
	panel.SetKeys (info.m_strKeys);
	panel.SetJustifyColumns (info.m_bJustifyColumns);
	panel.SetCenterColumnVert (info.m_bCenterColumnVert);

	ConstructElement (panel.GetLaunchButton (), info.m_btnLaunch);

	int i = 0;
	for (i = 0; i < info.m_arElements.GetSize (); i++)
	{
		CBCGPBaseRibbonElement* pElement = 
			CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);

		if (pElement != NULL)
		{
			ASSERT_VALID (pElement);

			CBCGPRibbonSeparator* pSeparator = DYNAMIC_DOWNCAST (CBCGPRibbonSeparator, pElement);
			if (pSeparator)
			{
				panel.AddSeparator ();
				delete pSeparator;
			}
			else
			{
				panel.Add (pElement);
			}
		}
	}
}
开发者ID:iclosure,项目名称:jframework,代码行数:31,代码来源:BCGPRibbonConstructor.cpp

示例5: CreatePanel

void CBCGPRibbonConstructor::ConstructCategory (CBCGPRibbonCategory& category, const CBCGPRibbonInfo::XCategory& info) const
{
	const_cast<CBCGPToolBarImages&>(info.m_SmallImages.m_Image).CopyTo (category.GetSmallImages ());
	const_cast<CBCGPToolBarImages&>(info.m_LargeImages.m_Image).CopyTo (category.GetLargeImages ());

	category.SetKeys (info.m_strKeys);

	int i = 0;
	for (i = 0; i < info.m_arPanels.GetSize (); i++)
	{
		const CBCGPRibbonInfo::XPanel& infoPanel = 
			*(const CBCGPRibbonInfo::XPanel*)info.m_arPanels[i];

		CBCGPRibbonPanel* pPanel = CreatePanel (category, infoPanel);
		if (pPanel != NULL)
		{
			ASSERT_VALID (pPanel);
			ConstructPanel (*pPanel, infoPanel);
		}
	}

	for (i = 0; i < info.m_arElements.GetSize (); i++)
	{
		CBCGPBaseRibbonElement* pElement = 
			CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);

		if (pElement != NULL)
		{
			ASSERT_VALID (pElement);
			category.AddHidden (pElement);
		}
	}

	category.SetCollapseOrder (info.m_arCollapseOrder);
}
开发者ID:iclosure,项目名称:jframework,代码行数:35,代码来源:BCGPRibbonConstructor.cpp

示例6: Base64CreateElement

TiXmlElement* Base64CreateElement(const string& name,const string& value)
{
	TiXmlElement* e = NULL;

	if (value != "")
	{
		e = CreateElement(name,base64_encode((const unsigned char*)value.c_str(),value.size()));
		if (e != NULL) e->SetAttribute("encode","base64");
	}
	else 
	{
		e = CreateElement(name,value);
	}

	return e;
}
开发者ID:Andy1985,项目名称:myLib,代码行数:16,代码来源:xml.cpp

示例7: TEST

TEST(CustomElementDescriptorTest,
    matches_customizedBuiltIn_shouldNotMatchAutonomousElement)
{
    CustomElementDescriptor descriptor("a-b", "button");
    Element* element = CreateElement("a-b");
    EXPECT_FALSE(descriptor.matches(*element));
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:CustomElementDescriptorTest.cpp

示例8: CreateInsertEle

static void CreateInsertEle(ELEMENT **head, LIST_PT *list_pt)
{
	ELEMENT *new_ele;
	
	new_ele = CreateElement(list_pt);
	InsertElement(head, new_ele);
}
开发者ID:peterbfield,项目名称:pp-postscriptPrint,代码行数:7,代码来源:coor.c

示例9: pEnumerator

BOOL CXTPRibbonBuilder::BuildGroupControls(CXTPPropExchange* pPX, CXTPRibbonGroup* pRibbonGroup)
{
	CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("ELEMENT")));

	POSITION pos = pEnumerator->GetPosition(0);
	while (pos)
	{
		CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos));

		CString strElementName;
		PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName);

		CCmdTarget* pElement = CreateElement(strElementName);
		if (pElement == NULL)
			continue;

		CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement);

		if (!pControl)
		{
			delete pElement;
			continue;

		}
		CXTPPropExchangeSection pxElements(pxControl->GetSection(_T("ELEMENTS")));
		BuildControlPopupBar(&pxElements, pControl, RUNTIME_CLASS(CXTPPopupBar));

		BuildControl(&pxControl, pControl);

		pRibbonGroup->Add(pControl, pControl->GetID());

	}

	return TRUE;
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:35,代码来源:XTPRibbonBuilder.cpp

示例10: aDC

void CSketcherView::OnMouseMove(UINT nFlags, CPoint point)
{
  // Define a Device Context object for the view
  CClientDC aDC(this);                 // DC is for this view
   if((nFlags & MK_LBUTTON) && (this == GetCapture()))
   {
    m_SecondPoint = point;             // Save the current cursor position
    if(m_pTempElement)
    {
      if(CURVE == GetDocument()->GetElementType())   // Is it a curve?
      {  // We are drawing a curve so add a segment to the existing curve
         static_cast<CCurve*>(m_pTempElement)->AddSegment(m_SecondPoint);
         m_pTempElement->Draw(&aDC);   // Now draw it
         return;                       // We are done
      }

      // If we get to here it's not a curve so
      // redraw the old element so it disappears from the view
      aDC.SetROP2(R2_NOTXORPEN);       // Set the drawing mode
      m_pTempElement->Draw(&aDC);      // Redraw the old element
      delete m_pTempElement;           // Delete the old element
      m_pTempElement = 0;              // Reset the pointer to 0
    }

    // Create a temporary element of the type and color that
    // is recorded in the document object, and draw it
    m_pTempElement = CreateElement();  // Create a new element
    m_pTempElement->Draw(&aDC);        // Draw the element
  }
}
开发者ID:ktjones,项目名称:BVC2010,代码行数:30,代码来源:SketcherView.cpp

示例11: CreateCategoryBackstage

void CBCGPRibbonConstructor::ConstructCategoryBackstage (CBCGPRibbonBar& bar, const CBCGPRibbonInfo::XCategoryBackstage& info) const
{
	CBCGPRibbonBackstageViewPanel* pPanel = CreateCategoryBackstage (bar, info);
	ASSERT_VALID (pPanel);

	CBCGPRibbonCategory* pCategory = bar.GetBackstageCategory ();
	ASSERT_VALID (pCategory);

	const_cast<CBCGPToolBarImages&>(info.m_SmallImages.m_Image).CopyTo (pCategory->GetSmallImages ());

	int i = 0;
	for (i = 0; i < info.m_arElements.GetSize (); i++)
	{
		if (info.m_arElements[i]->GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Command) == 0)
		{
			CBCGPBaseRibbonElement* pElement = 
				CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);

			if (pElement != NULL)
			{
				ASSERT_VALID (pElement);

				pElement->SetBackstageViewMode ();
				pPanel->CBCGPRibbonMainPanel::Add (pElement);
			}
		}
	}
}
开发者ID:iclosure,项目名称:jframework,代码行数:28,代码来源:BCGPRibbonConstructor.cpp

示例12: if

bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
    if (strncmp(name, "svg", len) == 0) {
        fInSVG = true;
    } else if (fInSVG == false)
        return false;
    const char* nextColon = strchr(name, ':');
    if (nextColon && (size_t)(nextColon - name) < len)
        return false;
    SkSVGTypes type = GetType(name, len);
//    SkASSERT(type >= 0);
    if (type < 0) {
		type = SkSVGType_G;
//        return true;
	}
    SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
    SkSVGElement* element = CreateElement(type, parent);
    bool result = false;
    if (parent) {
        element->fParent = parent;
        result = fParents.top()->onStartElement(element);
    } else
        *fChildren.append() = element;
    if (strncmp(name, "svg", len) != 0)
        *fParents.append() = element;
    fCurrElement = element;
    return result;
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:27,代码来源:SkSVGParser.cpp

示例13: ReadSetFromFile

SetHeadPtr ReadSetFromFile(char* relativePath)
{
    FILE* file = fopen(relativePath, "r");

    if(file != NULL)
    {
        SetHeadPtr newSetHead = CreateEmptySet();

        while(!feof(file))
        {
            int value;

            if(EOF != fscanf_s(file, "%d", &value))
            {
                AddElementToSet(newSetHead, CreateElement(value));
            }
        }

        fclose(file);

        return newSetHead;
    }
    else
    {
        printf("Error occurred while opening file");
        return NULL;
    }
}
开发者ID:MiroslavJelaska,项目名称:Faculty_DataStructures,代码行数:28,代码来源:Exercise05.cpp

示例14: SaveXMLDoc

bool SaveXMLDoc(LPCWSTR file, BDADEVICES& d)
{
	IXMLDOMDocumentPtr Document;
	IXMLDOMElementPtr root;
	IXMLDOMElementPtr bda_source;
	IXMLDOMElementPtr bda_reciever;

	HRESULT hr;

	hr = Document.CreateInstance(CLSID_DOMDocument30);
	if(hr==S_OK)
	{
		// these methods should not fail so don't inspect result
		Document->put_async(VARIANT_FALSE);
		Document->put_validateOnParse(VARIANT_FALSE);
		Document->put_resolveExternals(VARIANT_FALSE);

		CreatePI(Document);
		CreateElement(Document,L"bdainf",&root);
		CreateElement(Document,L"kscategory_bda_network_tuner",&bda_source);
		CreateElement(Document,L"kscategory_bda_receiver_component",&bda_reciever);

		CreateDeviceList(Document,bda_source,d.bda_source);
		CreateDeviceList(Document,bda_reciever,d.bda_reciever);

		AppendChild(bda_source,root);
		AppendChild(bda_reciever,root);
		AppendChild(root,Document);

		hr = Document->save(_variant_t(file));
		if(hr==S_OK)
		{
			return true;
		}
		else
		{
			//notify error
			return false;
		}
	}
	else
	{
		//notify error
		return false;
	}
}
开发者ID:jensvaaben,项目名称:mfcbdainf,代码行数:46,代码来源:xmldoc.cpp

示例15: getAllFiles

int DicomImageSet::parseFolder(QString folderName)
{
	QStringList fileList = getAllFiles(folderName);
    HRESULT hr = CoInitialize(NULL);
    if (!SUCCEEDED(hr))
    {
		return NULL;
    }

    hr = S_OK;
    IXMLDOMDocument *pXMLDom = NULL;
    IXMLDOMElement *pRoot = NULL;

    BSTR bstrXML = NULL;
    VARIANT varFileName;
    VariantInit(&varFileName);

	QProgressDialog progress (QString("Parsing all files in %1").arg(folderName), QString("Cancel"), 0, fileList.count());

    CHK_HR(CreateAndInitDOM(&pXMLDom));

    // Create a processing instruction element.
    CHK_HR(CreateAndAddPINode(pXMLDom, L"xml", L"version='1.0'"));
    
    // Create the root element.
    CHK_HR(CreateElement(pXMLDom, L"root", &pRoot));

    // Create an attribute for the <root> element, with name "created" and value "using dom".
	CHK_HR(CreateAndAddAttributeNode(pXMLDom, L"path", folderName.toStdWString().c_str(), pRoot));

    // Add NEWLINE for identation before </root>.
    CHK_HR(CreateAndAddTextNode(pXMLDom, L"\n", pRoot));
    // add <root> to document
    CHK_HR(AppendChildToParent(pRoot, pXMLDom));

	progress.show();
	for (int i=0; i<fileList.count(); ++i)
	{
		insertFileItem(pXMLDom, pRoot, folderName, fileList[i]);
		progress.setValue(i);
	}

	CHK_HR(VariantFromString(QDir(folderName).filePath(DATASET_FILE_NAME).toStdWString().c_str(), varFileName));
    CHK_HR(pXMLDom->save(varFileName));

CleanUp:
    SAFE_RELEASE(pRoot);
    SysFreeString(bstrXML);
    VariantClear(&varFileName);

    CoUninitialize();
	if (FAILED(hr))
	{
		SAFE_RELEASE(pXMLDom);
		return 0;
	}
	return 1;
}
开发者ID:vcpudding,项目名称:DTI-Visualization,代码行数:58,代码来源:DicomImageSet.cpp


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