本文整理汇总了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;
}
示例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;
}
示例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();
}
}
示例4: RebuildXmlData
void wxsCustomWidget::RebuildXmlData()
{
TiXmlPrinter Printer;
Printer.SetIndent("\t");
m_XmlDataDoc.Accept(&Printer);
m_XmlData = cbC2U(Printer.CStr());
}
示例5: ToString
void CXmlDocument::ToString(CDataBuffer& buffer)
{
TiXmlPrinter printer;
printer.SetLineBreak("\r\n");
printer.SetIndent("\t");
_doc->Accept(&printer);
buffer.Add(printer.CStr());
}
示例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();
}
示例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";
}
}
示例8: tiXmlToStr
std::string tiXmlToStr(TiXmlNode* xmlNode)
{
//print
TiXmlPrinter printer;
printer.SetIndent( "\t" );
xmlNode->Accept( &printer );
const std::string& result = printer.Str();
return result;
}
示例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();
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}