本文整理汇总了C++中TiXmlPrinter类的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlPrinter类的具体用法?C++ TiXmlPrinter怎么用?C++ TiXmlPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TiXmlPrinter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: RebuildXmlData
void wxsCustomWidget::RebuildXmlData()
{
TiXmlPrinter Printer;
Printer.SetIndent("\t");
m_XmlDataDoc.Accept(&Printer);
m_XmlData = cbC2U(Printer.CStr());
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:7,代码来源:wxscustomwidget.cpp
示例3: ASSERT
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:csuhuangcheng,项目名称:duilib,代码行数:30,代码来源:UIDesignerView.cpp
示例4:
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:Almamu,项目名称:evemu_server,代码行数:7,代码来源:APIServiceManager.cpp
示例5: TiXmlDocument
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
示例6: CreateResponXML
void 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:iceleeyo,项目名称:CardProject,代码行数:26,代码来源:BHGX_HISReader.cpp
示例7: copyXmlToString
//---------------------------------------------------------
void ofxXmlSettings::copyXmlToString(string & str)
{
TiXmlPrinter printer;
doc.Accept(&printer);
str = printer.CStr();
}
开发者ID:m9dfukc,项目名称:Motion-Sensing-Toolkit,代码行数:8,代码来源:ofxXmlSettings.cpp
示例8: 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
示例9: getPointee
// QC:A (discussion possible sur l'utilisation de snprintf. Les buffers statiques ne sont pas thread safe.)
char* ScriptVariable::getstr() const {
if(isPointer()) {
return getPointee()->getstr();
}
if(type == VAR_NULL) {
return NULL;
}
if(type == VAR_INT) {
static char number[32];
snprintf(number, 32, "%d", value);
number[31] ='\0';
return number;
}
if(type == VAR_XML) {
static TiXmlPrinter printer;
printer = TiXmlPrinter();
printer.SetStreamPrinting();
TiXmlNode* node = (TiXmlNode*) data;
node->Accept(&printer);
return (char*)printer.CStr();
}
if(type == VAR_OBJ) {
static char address[256];
snprintf(address, 256, "(*%p:%s)", data, ((ScriptableObject*)data)->getClassName());
address[255] ='\0';
return address;
}
if(type == VAR_PAIR) {
static char number[64];
snprintf(number, 64, "(%ld:%ld)", (long) data, (long) params);
number[63] ='\0';
return number;
}
if(type == VAR_PACK) {
static char info[4096]; // XXX : NOT thread safe
snprintf(info, 4096, "(*%p => \"%s\")", data, params);
info[4095] ='\0';
return info;
}
if(type == VAR_TBL) {
static char info[4096]; // XXX : NOT thread safe
snprintf(info, 4096, "(tbl[%ld]:*%p)", (long)(data?(((ScriptTable*)data)->size()):0), data);
info[4095] ='\0';
return info;
}
if(type == VAR_FCT) {
return params;
}
return data;
}
开发者ID:Dustpup,项目名称:aurora-game-engine,代码行数:60,代码来源:script_variable.cpp
示例10: getText
size_t XMLSource::getText(const char*& outputBuffer) {
TiXmlPrinter printer;
printer.SetStreamPrinting();
xassert(doc, "No document to save.");
doc->Accept(&printer);
outputBuffer = printer.CStr();
return printer.Size();
}
开发者ID:Dustpup,项目名称:aurora-game-engine,代码行数:8,代码来源:xml_source.cpp
示例11:
std::string em::EmXml::GetText()
{
std::string strResult;
TiXmlPrinter docPrinter;
m_pDoc->Accept(&docPrinter);
strResult = docPrinter.CStr();
return strResult;
}
开发者ID:lidongqiang,项目名称:FWFactoryTool,代码行数:8,代码来源:EmXml.cpp
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: SaveFile
bool CXBMCTinyXML::SaveFile(const std::string& filename) const
{
XFILE::CFile file;
if (file.OpenForWrite(filename, true))
{
TiXmlPrinter printer;
Accept(&printer);
return file.Write(printer.CStr(), printer.Size()) == static_cast<ssize_t>(printer.Size());
}
return false;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:11,代码来源:XBMCTinyXML.cpp
示例18: 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
示例19:
string& Message::GenerateMessage()
{
mStrMessage = "";
if(null != mXmlDoc)
{
TiXmlPrinter printer;
mXmlDoc->Accept(&printer);
mStrMessage = printer.CStr();
}
return mStrMessage;
}
开发者ID:buxinqiufeng,项目名称:UdpSocket,代码行数:11,代码来源:Message.cpp
示例20: readXml
void readXml(string filename)
{
//获取当前的工作目录
getcwd(buffer, MAX_PATH);
string seperator = "\\";
string fullPath = buffer+seperator+filename;
//判断文件是否存在
if(access(fullPath.c_str(),0)==-1)
{
//文件不存在,下面直接略过
cerr<<"配置文件"+fullPath+"不存在"<<endl;
return;
}
//读取配置文件xml
TiXmlDocument doc(fullPath.c_str());
bool loadOk = doc.LoadFile();
if (!loadOk)
{
cout << "could load:" << doc.ErrorDesc() << endl;
}
//输出整个配置文件的内容
TiXmlPrinter printer;//提供的工具类,目的是将xml的数据按格式输出
doc.Accept(&printer);
cout << printer.CStr() << endl;//输出
//获得根元素<Configuration>
TiXmlElement* rootElement =doc.RootElement();
//循环处理<property>节点
TiXmlElement* nextElement=rootElement->FirstChildElement();
while(nextElement!=NULL)
{
//获取其中<name>节点
TiXmlElement* nameElement=nextElement->FirstChildElement();
//获取其中<value>节点
TiXmlElement* valueElement=nameElement->NextSiblingElement();
//获取上述节点的值
//cout<<nextElement->Value()<<endl;
// cout<<nameElement->FirstChild()->Value()<<endl;
parameter[nameElement->FirstChild()->Value()]=valueElement->FirstChild()->Value();
//cout<<valueElement->FirstChild()->Value()<<endl;
nextElement=nextElement->NextSiblingElement();
}
//循环遍历parameter中的参数,进行输出
map<string, string>::iterator iter;
for(iter = parameter.begin(); iter != parameter.end(); iter++)
{
cout<<iter->first<<" "<<iter->second<<endl;
}
}
开发者ID:xwzpp,项目名称:ProcessXmlFile,代码行数:54,代码来源:main.cpp
注:本文中的TiXmlPrinter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论