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


C++ TiXmlPrinter::CStr方法代码示例

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


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

示例1: ParseOnePlacemarkPoint

KmlPastebufferType Kml::ParseOnePlacemarkPoint( TiXmlNode* node, wxString& name ) {
    double newLat = 0., newLon = 0.;
    dPointList coordinates;

    if( ParseCoordinates( node->ToElement(), coordinates ) ) {
        newLat = coordinates[0].y;
        newLon = coordinates[0].x;
    }

    if( newLat == 0.0 && newLon == 0.0 ) {
        wxString msg( _T("KML Parser failed to convert <Point> coordinates.") );
        wxLogMessage( msg );
        return KML_PASTE_INVALID;
    }
    wxString pointName = wxEmptyString;
	TiXmlElement* e = node->Parent()->FirstChild( "name" )->ToElement();
    if( e ) pointName = wxString( e->GetText(), wxConvUTF8 );

    wxString pointDescr = wxEmptyString;
    e = node->Parent()->FirstChildElement( "description" );

    // If the <description> is an XML element we must convert it to text,
    // otherwise it gets lost.
    if( e ) {
        TiXmlNode* n = e->FirstChild();
        if( n ) switch( n->Type() ){
            case TiXmlNode::TINYXML_TEXT:
                pointDescr = wxString( e->GetText(), wxConvUTF8 );
                break;
            case TiXmlNode::TINYXML_ELEMENT:
                TiXmlPrinter printer;
                printer.SetIndent( "\t" );
                n->Accept( &printer );
                pointDescr = wxString( printer.CStr(), wxConvUTF8 );
                break;
        }
    }

    // Extended data will override description.
    TiXmlNode* n = node->Parent()->FirstChild( "ExtendedData" );
    if( n ) {
        TiXmlPrinter printer;
        printer.SetIndent( "\t" );
        n->Accept( &printer );
        pointDescr = wxString( printer.CStr(), wxConvUTF8 );
    }

    // XXX leak ?
    parsedRoutePoint = new RoutePoint();
    parsedRoutePoint->m_lat = newLat;
    parsedRoutePoint->m_lon = newLon;
    parsedRoutePoint->m_bIsolatedMark = true;
    parsedRoutePoint->m_bPtIsSelected = false;
    parsedRoutePoint->m_MarkDescription = pointDescr;
    parsedRoutePoint->SetName( pointName );

    return KML_PASTE_WAYPOINT;
}
开发者ID:NicolasJourden,项目名称:OpenCPN,代码行数:58,代码来源:kml.cpp

示例2: BMessage

status_t Converter::ConvertPDoc2FreeMind()
{
	status_t		err					= B_OK;
	BMessage		*inMessage			= new BMessage();
	BMessage		*tmpMessage			= new BMessage();
	void			*id					= NULL;

 	allConnections	= new BMessage();
	selected		= new BMessage();
	allNodes		= new BMessage();


	err = inMessage->Unflatten(in);
	if (err == B_OK)
	{
		inMessage->FindMessage("PDocument::allConnections",allConnections);
		inMessage->FindMessage("PDocument::selected",selected);
		inMessage->FindMessage("PDocument::allNodes",allNodes);
		int32 i = 0;
		while(allNodes->FindMessage("node",i,tmpMessage)==B_OK)
		{
			tmpMessage->FindPointer("this",&id);
			nodes[(int32)id]=tmpMessage;
			tmpMessage = new BMessage();
-			i++;
		}
		i = 0;
		while(allConnections->FindMessage("node",i,tmpMessage)==B_OK)
		{
			tmpMessage->FindPointer("this",&id);
			connections[(int32)id]=tmpMessage;
			tmpMessage = new BMessage();
			i++;
		}

		BMessage	*node= GuessStartNode();
		TiXmlDocument	doc;
		TiXmlElement	freeMap("map");
		freeMap.SetAttribute("version","0.9.0");
		freeMap.SetAttribute("background_color","#ffffff");
		TiXmlComment	comment("this File was gernerated by ProjectConceptor! - To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net");
		freeMap.InsertEndChild(comment);

		tmpMessage=GuessStartNode();
	//	tmpMessage = nodes.begin()->second;
		freeMap.InsertEndChild(ProcessNode(tmpMessage));
		doc.InsertEndChild(freeMap);
		TiXmlPrinter	printer;
//		printer.SetStreamPrinting();
//		printer.SetLineBreak("\n");
//		printer.SetIndent("\t");
		doc.Accept( &printer );
		out->Write(printer.CStr(),strlen(printer.CStr()));
	}
	return err;
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:56,代码来源:FreeMindTranslator.cpp

示例3: ModifyXml

bool CSimpleXml::ModifyXml(list<XMLNODEINFO> &lstXmlNodes)
{
    if(m_pDoc == NULL || m_pRoot == NULL)
    {
        return false;
    }
    list<XMLNODEINFO>::iterator itlist = lstXmlNodes.begin();
    int nSize = lstXmlNodes.size();
    for(int i = 0; i < nSize; ++i)
    {
        if(!AccessXmlNode((*itlist), MODIFY))
        {
            return false;
        }
        ++itlist;
    }
    TiXmlPrinter printer;
    printer.SetStreamPrinting();
    if(m_pDoc->Accept( &printer ))
    {
        m_strXml = printer.CStr();
    }
    else
    {
        return false;
    }
    return true;
}
开发者ID:huddy1985,项目名称:ChatOnline,代码行数:28,代码来源:SimpleXml.cpp

示例4: node

string Versioning::upgradeFrom1To2(string content)
{
    TiXmlDocument doc;
    doc.Parse(content.c_str());
    RRNode node(doc.RootElement());
    node.gotoElement("world");
    int w = node.attrInt("width");
    int h = node.attrInt("height");
    node.setAttr("version", "2");
    for (node.gotoElement("items")->gotoChild("item"); !node.isNull(); node.gotoNext())
    {
        node.setAttr("x", floatToStr(node.attrFloat("x") / w));
        node.setAttr("y", floatToStr(node.attrFloat("y") / h));
        node.setAttr("width", floatToStr(node.attrFloat("width") / w));
        node.setAttr("height", floatToStr(node.attrFloat("height") / h));
    }

    for (node.gotoElement("rooms")->gotoChild("room"); !node.isNull(); node.gotoNext())
    {
        for (node.gotoChild("area"); !node.isNull(); node.gotoNext())
        {
            node.setAttr("x", floatToStr(node.attrFloat("x") / w));
            node.setAttr("y", floatToStr(node.attrFloat("y") / h));
            node.setAttr("width", floatToStr(node.attrFloat("width") / w));
            node.setAttr("height", floatToStr(node.attrFloat("height") / h));
        }
        node.gotoParent();
    }
    TiXmlPrinter printer;
    doc.Accept(&printer);
    return printer.CStr();
}
开发者ID:develersrl,项目名称:rooms,代码行数:32,代码来源:versioning.cpp

示例5: UIAdd

void CALLBACK CUICommandHistory::UIAdd(TiXmlNode* pNode)
{
	TiXmlElement* pElement = pNode->ToElement();
	CStringA strParentName = pElement->Attribute("parentname");
	pElement->RemoveAttribute("parentname");
	if(strParentName.IsEmpty())
		return;

	CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView();
	CPaintManagerUI* pManager = pUIView->GetPaintManager();
	CControlUI* pParentControl = pManager->FindControl(StringConvertor::Utf8ToWide(strParentName));
	if(pParentControl == NULL)
		return;

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pRootElem = new TiXmlElement("UIAdd");
	pRootElem->InsertEndChild(*pElement);
	xmlDoc.InsertEndChild(*pRootElem);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pRootElem;

	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(StringConvertor::Utf8ToWide(printer.CStr()), (UINT)0, NULL, pManager);
 	if(pRoot)
		pUIView->RedoUI(pRoot, pParentControl);
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:29,代码来源:UICommandHistory.cpp

示例6:

	void BehaviorTreeLoader::
	Print() const
	{
		TiXmlPrinter printer;
		_XMLDoc.Accept(&printer);
		std::cout << printer.CStr() << std::endl;
	}
开发者ID:tomblack2014,项目名称:Practice-for-python,代码行数:7,代码来源:BehaviorTreeLoader.cpp

示例7: OpenXml

bool CSimpleXml::OpenXml(const string &strXml, int nXmlType)
{
	if(strXml.empty())
	{
		return false;
	}
//	m_pDoc = new TiXmlDocument(strXml.c_str());
	if(XMLFILE == nXmlType)//解析文件
	{
            m_pDoc = new TiXmlDocument(strXml.c_str());
		if(!m_pDoc->LoadFile())  
		{
			return false;
		}
	}
	else if(XMLSTR == nXmlType)//解析字符串
	{
            m_pDoc = new TiXmlDocument;
		 m_pDoc->Parse(strXml.c_str());
	}
	m_pRoot = m_pDoc->RootElement(); 
	if(NULL == m_pDoc || NULL == m_pRoot)
	{
		return false;
	}
	TiXmlPrinter printer;
	printer.SetStreamPrinting();
	if(m_pDoc->Accept(&printer))
	{
		m_strXml = printer.CStr();
		return true;
	}
	return false;
}
开发者ID:huddy1985,项目名称:ChatOnline,代码行数:34,代码来源:SimpleXml.cpp

示例8: CreateResponXML

void CCardProcess::CreateResponXML(int nID, const char *szResult, char *RetXML)
{
	TiXmlDocument *XmlDoc;
	TiXmlElement *RootElement;
	TiXmlElement *Segment;
	TiXmlDeclaration HeadDec;
	TiXmlPrinter Printer;

	// 创建XML文档
	XmlDoc = new TiXmlDocument();

	// 增加XML的头部说明
	HeadDec.Parse("<?xml version=\"1.0\" encoding=\"gb2312\" ?>", 0, TIXML_ENCODING_UNKNOWN);
	XmlDoc->LinkEndChild(&HeadDec);

	RootElement = new TiXmlElement("CardProcess");
	Segment = new TiXmlElement("ReturnInfo");
	Segment->SetAttribute("ID", nID);
	Segment->SetAttribute("Desc", szResult);

	RootElement->LinkEndChild(Segment);
	XmlDoc->LinkEndChild(RootElement);

	XmlDoc->Accept(&Printer);
	strcpy(RetXML, Printer.CStr());

}
开发者ID:modeyang,项目名称:CardProject,代码行数:27,代码来源:CardProcess.cpp

示例9: CombineMasterSlaveXmlParam

HRESULT CombineMasterSlaveXmlParam(
    const char* szXmlParamMaster,
    const char* szXmlParamSlave,
    char* szXmlParamAll,
    DWORD32& dwLen
)
{
    TiXmlElement* pMasterRootElement = NULL;
    TiXmlDocument cXmlDocMaster;
    if ( szXmlParamMaster && cXmlDocMaster.Parse(szXmlParamMaster) )
    {
        pMasterRootElement = cXmlDocMaster.RootElement();
    }

    TiXmlElement* pSlaveRootElement = NULL;
    TiXmlDocument cXmlDocSlave;
    if ( szXmlParamSlave && cXmlDocSlave.Parse(szXmlParamSlave) )
    {
        pSlaveRootElement = cXmlDocSlave.RootElement();
    }

    if ( NULL == pMasterRootElement || NULL == pSlaveRootElement )
    {
        dwLen = 0;
        return E_FAIL;
    }
    else
    {
        // 将主CPU参数内的所有Section结点插入到从CPU参数内的HvParam结点下。
        TiXmlElement* pMasterHvParamElement = NULL;
        TiXmlElement* pSlaveHvParamElement = NULL;
        pMasterHvParamElement = pMasterRootElement->FirstChildElement("HvParam");
        pSlaveHvParamElement = pSlaveRootElement->FirstChildElement("HvParam");
        if ( pMasterHvParamElement && pSlaveHvParamElement)
        {
            TiXmlElement* pMasterSectionElement = NULL;
            pMasterSectionElement = pMasterHvParamElement->FirstChildElement();
            while (pMasterSectionElement)
            {
                pSlaveHvParamElement->LinkEndChild(pMasterSectionElement->Clone());
                pMasterSectionElement = pMasterSectionElement->NextSiblingElement();
            }
        }

        TiXmlPrinter cTxPr;
        cXmlDocSlave.Accept(&cTxPr);
        DWORD32 dwXmlLen = (DWORD32)cTxPr.Size();
        if ( dwLen > dwXmlLen )
        {
            dwLen = dwXmlLen;
            memcpy(szXmlParamAll, cTxPr.CStr(), dwXmlLen);
            return S_OK;
        }
        else
        {
            dwLen = 0;
            return E_FAIL;
        }
    }
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:60,代码来源:HvParamIO.cpp

示例10: copyXmlToString

//---------------------------------------------------------
void ofxXmlSettings::copyXmlToString(string & str)
{
	TiXmlPrinter printer;
	doc.Accept(&printer);

	str = printer.CStr();
}
开发者ID:AnnaKolla,项目名称:openFrameworks,代码行数:8,代码来源:ofxXmlSettings.cpp

示例11: GetParamXml

HRESULT GetParamXml(
    CParamStore* pParamStore,
    char* szBuf,
    int nBufLen,
    DWORD32 dwFlag /*=0*/
)
{
    if (!szBuf) return E_INVALIDARG;
    szBuf[nBufLen-1] = '\0';

    CFastMemAlloc cStack;
    BYTE8* pBuf = (BYTE8*)cStack.StackAlloc(PARAM_BUF_LEN, FALSE);
    if (pBuf == NULL) return E_OUTOFMEMORY;

    CMemStorage cMemStg;
    cMemStg.Initialize(pBuf, PARAM_BUF_LEN);

    pParamStore->SaveTo(&cMemStg, FALSE);

    int nExportParamRank = 1; //= g_HvDspParam.nExportParamRank;
    bool nExportRankInfo = true; //= g_HvDspParam.nExportRankInfo;

    TiXmlDocument cDoc;
    ConvertParam2Xml(pBuf, PARAM_BUF_LEN, &cDoc, nExportParamRank, TRUE, nExportRankInfo);

    TiXmlPrinter cPrinter;
    cDoc.Accept(&cPrinter);

    strncpy(szBuf, cPrinter.CStr(), nBufLen - 1);

    return S_OK;
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:32,代码来源:HvParamIO.cpp

示例12: RebuildXmlData

void wxsCustomWidget::RebuildXmlData()
{
    TiXmlPrinter Printer;
    Printer.SetIndent("\t");
    m_XmlDataDoc.Accept(&Printer);
    m_XmlData = cbC2U(Printer.CStr());
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:7,代码来源:wxscustomwidget.cpp

示例13:

std::tr1::shared_ptr<std::string> APIServiceManager::_GetXMLDocumentString()
{
    TiXmlPrinter xmlPrinter;
    _XmlDoc.Accept( &xmlPrinter );

    return std::tr1::shared_ptr<std::string>(new std::string(xmlPrinter.CStr()));
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:7,代码来源:APIServiceManager.cpp

示例14: ModifyXmlAttri

bool CSimpleXml::ModifyXmlAttri(list<XMLNODEINFO> &lstNode)
{
    if(m_pDoc == NULL || m_pRoot == NULL)
    {
        return false;
    }

    list<XMLNODEINFO>::iterator itlst = lstNode.begin();
    for(; itlst != lstNode.end(); ++itlst)
    {
        if(!ModifyOneAttri(*itlst))
        {
            return false;
        }
    }

    TiXmlPrinter printer;

    char szBuf[32];
    memset(szBuf, 0, 32);
    szBuf[0] = 0x9;
    printer.SetIndent(szBuf);
    szBuf[0] = 0x0a;
    printer.SetLineBreak(szBuf);
    if(m_pDoc->Accept(&printer))
    {
        m_strXml = printer.CStr();
    }
    else
    {
        return false;
    }
    return true;
}
开发者ID:huddy1985,项目名称:ChatOnline,代码行数:34,代码来源:SimpleXml.cpp

示例15: OnEditCopy

void CUIDesignerView::OnEditCopy()
{
	ASSERT(m_cfUI != NULL);

	TiXmlDocument xmlDoc;
	TiXmlDeclaration Declaration("1.0","utf-8","yes");
	xmlDoc.InsertEndChild(Declaration);
	TiXmlElement* pCopyElm = new TiXmlElement("UICopy");
	CopyUI(pCopyElm);
	xmlDoc.InsertEndChild(*pCopyElm);
	TiXmlPrinter printer;
	xmlDoc.Accept(&printer);
	delete pCopyElm;
	CSharedFile file(GMEM_MOVEABLE, printer.Size() + 1);
	file.Write(printer.CStr(), printer.Size());
	file.Write("\0", 1);
	COleDataSource* pDataSource = NULL;
	TRY
	{
		pDataSource = new COleDataSource;
		pDataSource->CacheGlobalData(m_cfUI, file.Detach());
		pDataSource->SetClipboard();
	}
	CATCH_ALL(e)
	{
		delete pDataSource;
		THROW_LAST();
	}
	END_CATCH_ALL
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:30,代码来源:UIDesignerView.cpp


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