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


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

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


在下文中一共展示了TiXmlPrinter::SetIndent方法的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: 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

示例3: AppData

wxFBDataObject::wxFBDataObject( PObjectBase obj )
:
wxDataObject()
{
	if ( obj )
	{
		// create xml representation of ObjectBase
		ticpp::Element element;
		obj->SerializeObject( &element );

		// add version info to xml data, just in case it is pasted into a different version of wxFB
		element.SetAttribute( "fbp_version_major", AppData()->m_fbpVerMajor );
		element.SetAttribute( "fbp_version_minor", AppData()->m_fbpVerMinor );

		ticpp::Document doc;
		doc.LinkEndChild( &element );
		TiXmlPrinter printer;
        printer.SetIndent( "\t" );

        #if defined( __WXMSW__ )
            printer.SetLineBreak( "\r\n" );
        #else
            printer.SetLineBreak( "\n" );
        #endif

        doc.Accept( &printer );
		m_data = printer.Str();
	}
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:29,代码来源:dataobject.cpp

示例4: RebuildXmlData

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

示例5: ToString

void CXmlDocument::ToString(CDataBuffer& buffer)
{
	TiXmlPrinter printer;
	printer.SetLineBreak("\r\n");
	printer.SetIndent("\t");
	_doc->Accept(&printer);
	buffer.Add(printer.CStr());
}
开发者ID:Paolo-Maffei,项目名称:eibsuite,代码行数:8,代码来源:Xml.cpp

示例6: save

void xml_write_archive::save(const variant& what)
  {
	  TiXmlPrinter printer;
	  printer.SetIndent( "\t" );

	  base_write_archive::save( what ); 
	  
	  doc_.Accept( &printer );
	  result_ = printer.Str();
  }
开发者ID:gcubar,项目名称:XKP,代码行数:10,代码来源:xml_archive.cpp

示例7: nodeToString

std::string SerializeBase::nodeToString(const TxElement& node) {
    try {
        TiXmlPrinter printer;
        printer.SetIndent("    ");
        node.Accept(&printer);
        return printer.CStr();
    } catch (TxException&) {
        return "No valid root node";
    }
}
开发者ID:david12345678901,项目名称:inviwo,代码行数:10,代码来源:serializebase.cpp

示例8: tiXmlToStr

		std::string tiXmlToStr(TiXmlNode* xmlNode)
		{
				//print
			TiXmlPrinter printer;
			printer.SetIndent( "\t" );

			xmlNode->Accept( &printer );
			const std::string& result = printer.Str();

			return result;
		}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:11,代码来源:convertFunction.cpp

示例9: Export_DAE

void Export_DAE(std::ostream &s, Mesh * aMesh, Options &aOptions) {
  // Create the XML document
  TiXmlDocument doc("model");
  Export_DAE(doc, aMesh, aOptions);

  // Write the document to the stream.
  TiXmlPrinter printer;
  printer.SetIndent("    ");
  doc.Accept(&printer);
  s << printer.CStr();
}
开发者ID:MichaelMcDonnell,项目名称:ion,代码行数:11,代码来源:dae.cpp

示例10: SaveDocument

bool TinyXML::SaveDocument(const wxString& filename, TiXmlDocument* doc)
{
    if (!doc)
        return false;

    TiXmlPrinter printer;
    printer.SetIndent("\t");
    doc->Accept(&printer);

    return Manager::Get()->GetFileManager()->SaveUTF8(filename, printer.CStr(), printer.Size());
}
开发者ID:stahta01,项目名称:codeblocks_https_metadata,代码行数:11,代码来源:tinywxuni.cpp

示例11: getAsRawData

//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void XmlDocumentImpl::getAsRawData(cvf::UByteArray* buffer) const
{
	TiXmlPrinter printer;

	// Use tab as indent marker
	printer.SetIndent( "\t" );

	// Link document to printer
	Accept(&printer);

    buffer->assign((cvf::ubyte*)printer.CStr(), (size_t)printer.Size());
}
开发者ID:CeetronAS,项目名称:CustomVisualizationCore,代码行数:15,代码来源:cvfXml.cpp

示例12: visitLeave

    bool TreeVisitor::visitLeave(Solution& solution)
    {
        TiXmlPrinter printer;
        printer.SetIndent(nullptr);
        printer.SetLineBreak(nullptr);

        m_document.Accept(&printer);

        m_serialized = printer.CStr();

        return true;
    }
开发者ID:knight666,项目名称:IrisBuild,代码行数:12,代码来源:treevisitor.cpp

示例13: getDeviceDescription

string GarminFilebasedDevice::getDeviceDescription() const
{
    if (this->deviceDescription == NULL) { return ""; }

    TiXmlPrinter printer;
	printer.SetIndent( "\t" );
	this->deviceDescription->Accept( &printer );
    string str = printer.Str();

    if (Log::enabledDbg()) Log::dbg("GarminFilebasedDevice::getDeviceDescription() Done: "+this->displayName );
    return str;
}
开发者ID:ianmartin,项目名称:GarminPlugin,代码行数:12,代码来源:garminFilebasedDevice.cpp

示例14: AddNodes

bool CSimpleXml::AddNodes(const string &strPath, list<XMLNODEINFO> &lstaddnode)
{
    if(m_pDoc == NULL || m_pRoot == NULL)
    {
        return false;
    }
    TiXmlElement *pCurrNode = m_pRoot;

    list<string> lstNode;
    SeperateString(lstNode, strPath, "/");

    list<string>::iterator itlstNode = lstNode.begin();

    while (NULL != pCurrNode)
    {
        if (itlstNode != lstNode.end() && *itlstNode == pCurrNode->Value())
        {
            string strShow = pCurrNode->Value();
            if (++itlstNode == lstNode.end())
            {
                AddOneNode(&pCurrNode, lstaddnode);
                goto SIMXML;
            }
            pCurrNode = pCurrNode->FirstChildElement();
        }
        else
        {
            pCurrNode = pCurrNode->NextSiblingElement();
        }
    }
    return false;

    SIMXML:

    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,代码行数:52,代码来源:SimpleXml.cpp

示例15: getXMLNivel

std::string Partida::getXMLNivel() {
	XMLDocument doc;
	bool cargoArchivo = doc.LoadFile(idNiveles[contadorNiveles]);
	if (cargoArchivo == false) {
		std::cout << "\tError al abrir el archivo XML." << std::endl;
		return std::string();
	}
	TiXmlPrinter printer;
	printer.SetIndent("");
	printer.SetLineBreak("");
	doc.Accept(&printer);
	return printer.CStr();
}
开发者ID:ezeperez26,项目名称:cerditosfuriosos,代码行数:13,代码来源:Partida.cpp


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