XMLTag.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 /************************************************************************
00020                         XMLTag.cpp - Copyright klank
00021 
00022 
00023 **************************************************************************/
00024 
00025 #include "XMLTag.h"
00026 #include <libxml/xmlwriter.h>
00027 #include <libxml/xmlreader.h>
00028 #include <libxml/parser.h>
00029 
00030 #include "AlgorithmSelector.h"
00031 #include <time.h>
00032 // Constructors/Destructors
00033 //
00034 #define MY_ENCODING "ISO-8859-1"
00035 
00036 #define XML_NODE_FILE_REFERENCE "FileReference"
00037 #define XML_ATTRIBUTE_TIMESTAMP "TimeStamp"
00038 
00039 #ifndef WIN32
00040 #define  sprintf_s(_DstBuf, size, _Format, whatever) sprintf(_DstBuf, _Format, whatever)
00041 #endif
00042 
00043 
00044 using namespace cop;
00045 
00046 
00047 XMLTag::XMLTag ( std::string name) :
00048     m_name(name)
00049 {
00050     Touch();
00051 }
00052 
00053 XMLTag* XMLTag::Tag(int n, std::string name)
00054 {
00055     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_INT : name);
00056     if(tag == NULL)
00057      throw "Out of memory";
00058     tag->SetCData(n);
00059     return tag;
00060 }
00061 
00062 
00063 XMLTag* XMLTag::Tag(long n, std::string name)
00064 {
00065     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_INT : name);
00066     if(tag == NULL)
00067      throw "Out of memory";
00068     tag->SetCData(n);
00069     return tag;
00070 }
00071 
00072 XMLTag* XMLTag::Tag(unsigned long n, std::string name)
00073 {
00074     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_ULONG : name);
00075     if(tag == NULL)
00076      throw "Out of memory";
00077     tag->SetCData(n);
00078     return tag;
00079 }
00080 
00081 XMLTag* XMLTag::Tag(double d, std::string name)
00082 {
00083     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_DOUBLE : name);
00084     if(tag == NULL)
00085      throw "Out of memory";
00086     tag->SetCData(d);
00087     return tag;
00088 }
00089 
00090 XMLTag* XMLTag::Tag(std::string value, std::string name)
00091 {
00092     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_STRING : name);
00093     if(tag == NULL)
00094      throw "Out of memory";
00095     tag->SetCData(value);
00096     return tag;
00097 }
00098 
00099 XMLTag* XMLTag::Tag(Elem* e, std::string name)
00100 {
00101     return e->Save();
00102 }
00103 
00104 
00105 XMLTag* XMLTag::Tag(Algorithm<ImprovedPose>* alg, std::string name)
00106 {
00107     if(alg == NULL)
00108         return NULL;
00109     return alg->Save();
00110 }
00111 
00112 XMLTag* XMLTag::Tag(Algorithm<std::vector<Signature*> >* alg, std::string name)
00113 {
00114     if(alg == NULL)
00115         return NULL;
00116     return alg->Save();
00117 }
00118 
00119 
00120 XMLTag* XMLTag::Tag(Algorithm<std::vector<RelPose* > >* alg, std::string name)
00121 {
00122     if(alg == NULL)
00123         return NULL;
00124     return alg->Save();
00125 }
00126 
00127 XMLTag* XMLTag::Tag(Algorithm<Descriptor*>* alg, std::string name)
00128 {
00129     if(alg == NULL)
00130         return NULL;
00131     return alg->Save();
00132 }
00133 
00134 
00135 XMLTag* XMLTag::Tag(Sensor* sensor, std::string name)
00136 {
00137    XMLTag* tag = sensor != NULL ? sensor->Save() : NULL;
00138   return tag;
00139 }
00140 
00141 XMLTag* XMLTag::Tag(const Matrix& alg, std::string name)
00142 {
00143     XMLTag* tag = new XMLTag(name.compare("") == 0 ? XML_NODE_MATRIX : name);
00144     if(tag == NULL)
00145      throw "Out of memory";
00146     int rows = alg.nrows();
00147     int cols = alg.ncols();
00148     tag->AddProperty(XML_ATTRIBUTE_ROWS, rows);
00149     tag->AddProperty(XML_ATTRIBUTE_COLS, cols);
00150     for(int r = 0; r < rows; r++)
00151     {
00152         for(int c = 0; c < cols; c++)
00153         {
00154             tag->AddChild(Tag(alg.element(r,c)));
00155         }
00156     }
00157     return tag;
00158 }
00159 
00160 Matrix XMLTag::Load(XMLTag* tag, Matrix* )
00161 {
00162     if(tag != NULL)
00163     {
00164         int rows = tag->GetPropertyInt(XML_ATTRIBUTE_ROWS);
00165         int cols = tag->GetPropertyInt(XML_ATTRIBUTE_ROWS);
00166         Matrix m(rows, cols);
00167         double counter = 0;
00168         for(int r = 0; r < rows; r++)
00169         {
00170             for(int c = 0; c < cols; c++)
00171             {
00172                 m.Store()[r * rows + c] = Load(tag->GetChild((int)counter), &counter);
00173                 counter++;
00174             }
00175         }
00176         return m;
00177     }
00178     throw "Wrong Node";
00179 }
00180 
00181 XMLTag::~XMLTag ( )
00182 {
00183         for(std::vector<XMLTag*>::iterator children = m_children.begin(); children != m_children.end(); children++)
00184         {
00185             delete (*children);
00186             (*children) = NULL;
00187         }
00188         m_children.clear();
00189 }
00190 
00191 //
00192 // Methods
00193 //
00194 
00195   //static public Methods
00196 
00197     void XMLTag::WriteToFile(const std::string &stFile, XMLTag** fileReference ) const
00198     {
00199 
00200         //Open File
00201         xmlTextWriter* pWriter = xmlNewTextWriterFilename(stFile.c_str(), 0);
00202         int nError = xmlTextWriterStartDocument(pWriter, NULL, MY_ENCODING, NULL);
00203         if(nError >= 0 )
00204 
00205         {
00206             //Write File
00207             Write(pWriter);
00208             //CloseFile
00209             nError = xmlTextWriterEndDocument(pWriter);
00210         }
00211         xmlFreeTextWriter(pWriter);
00212         if(fileReference != NULL)
00213         {
00214             *fileReference = new XMLTag(XML_NODE_FILE_REFERENCE);
00215             (*fileReference)->m_cData = stFile;
00216         }
00217         pWriter = NULL;
00218 
00219     }
00220 
00221     char* XMLTag::WriteToString()
00222     {
00223         int buffersize;
00224 #if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
00225         m_doc = xmlNewDoc(BAD_CAST "1.0");
00226         xmlNodePtr n = xmlNewNode(NULL, BAD_CAST (GetName().c_str()));
00227         DocWrite(n);
00228         xmlDocSetRootElement(m_doc, n);
00229         xmlDocDumpMemory(m_doc, &m_xmlbuff, &buffersize);
00230 #else
00231         printf("Error\n");
00232 #endif
00233         return (char*)m_xmlbuff;
00234     }
00235 
00236     void XMLTag::DocWrite(xmlNodePtr n) const
00237     {
00238         for(std::map<std::string,std::string>::const_iterator iter = m_properties.begin(); iter != m_properties.end(); iter++)
00239         {
00240             xmlNewProp(n, (xmlChar*)(*iter).first.c_str(), (xmlChar*)(*iter).second.c_str());
00241         }
00242         xmlNodeSetContent(n, BAD_CAST m_cData.c_str());
00243         for(std::vector<XMLTag*>::const_iterator children = m_children.begin(); children != m_children.end(); children++)
00244         {
00245           xmlNodePtr child = xmlNewChild(n, NULL, BAD_CAST ((*children)->GetName().c_str()), NULL);
00246           (*children)->DocWrite(child);
00247         }
00248 
00249     }
00250 
00251     void XMLTag::FreeAfterWriteToString()
00252     {
00253        /*
00254        * Free associated memory.
00255        */
00256       xmlFree(m_xmlbuff);
00257       xmlFreeDoc(m_doc);
00258     }
00259 
00260 
00261     void XMLTag::Write(xmlTextWriter* pWriter) const
00262     {
00263         xmlTextWriterWriteRaw(pWriter, (xmlChar*)"\n");
00264         xmlTextWriterStartElement(pWriter, (xmlChar*)m_name.c_str());
00265         for(std::map<std::string,std::string>::const_iterator iter = m_properties.begin(); iter != m_properties.end(); iter++)
00266         {
00267             xmlTextWriterWriteAttribute(pWriter, (xmlChar*)(*iter).first.c_str(), (xmlChar*)(*iter).second.c_str());
00268             xmlTextWriterEndAttribute(pWriter);
00269         }
00270         if(m_cData.length() > 0)
00271             xmlTextWriterWriteFormatRaw(pWriter, m_cData.c_str());
00272         for(std::vector<XMLTag*>::const_iterator children = m_children.begin(); children != m_children.end(); children++)
00273         {
00274             (*children)->Write(pWriter);
00275         }
00276 
00277         xmlTextWriterEndElement(pWriter);
00278         //xmlTextWriterWriteRaw(pWriter, (xmlChar*)"\n");
00279     }
00280 
00281     XMLTag* XMLTag::ReadFromFile(const std::string &stFile)
00282     {
00283         XMLTag* tag = NULL;
00284         xmlTextReader* pReader= xmlNewTextReaderFilename(stFile.c_str());
00285         if(pReader != NULL)
00286         {
00287             xmlGetCompressMode();
00288 
00289             xmlTextReaderRead(pReader);
00290             xmlDocPtr doc = xmlTextReaderCurrentDoc(pReader);
00291             xmlDocGetRootElement(doc);
00292             //xmlChar* text =  xmlNodeGetContent(node);
00293             tag = Read(pReader);
00294 
00295         }
00296         xmlFreeTextReader(pReader);
00297         return tag;
00298     }
00299 
00300     XMLTag* XMLTag::Clone() const
00301     {
00302         XMLTag* tag                     = new XMLTag(this->m_name);
00303         tag->m_properties       = this->m_properties;
00304         tag->m_cData            = this->m_cData;
00305         tag->m_name                     = this->m_name;
00306 
00307         for(std::vector<XMLTag*>::const_iterator children = m_children.begin(); children != m_children.end(); children++)
00308         {
00309           if((*children) != NULL)
00310             tag->AddChild((*children)->Clone());
00311         }
00312         return tag;
00313     }
00314 
00315     XMLTag* XMLTag::Read(xmlTextReader* pReader)
00316     {
00317         XMLTag* tag = NULL;
00318         xmlNode* node = xmlTextReaderCurrentNode(pReader);
00319         if(node != NULL && node->type != XML_TEXT_NODE)
00320         {
00321             tag = new XMLTag(std::string((char*)node->name));
00322             if(xmlTextReaderHasAttributes(pReader))
00323             {
00324                 int nAttr = xmlTextReaderAttributeCount(pReader);
00325                 xmlAttr* attr = node->properties;
00326                 for(int i = 0; i < nAttr ; i++, attr = attr->next)
00327                 {
00328 
00329                     std::string attrValue = (char*)xmlTextReaderGetAttributeNo(pReader, i);
00330                     std::string attrName = (char*)attr->name;
00331                     tag->AddProperty(attrName, attrValue);
00332                 }
00333             }
00334             if(!xmlTextReaderIsEmptyElement(pReader))
00335             {
00336                 int ChildrenDepth = xmlTextReaderDepth(pReader) + 1;
00337                 while(true)
00338                 {
00339                     xmlTextReaderRead(pReader);
00340                     xmlNode* check = xmlTextReaderCurrentNode(pReader);
00341                     if(ChildrenDepth != xmlTextReaderDepth(pReader))
00342                     {
00343                         break;
00344                     }
00345                     if(check->type != XML_TEXT_NODE)
00346                     {
00347                         XMLTag* child = Read(pReader);
00348                         tag->AddChild(child);
00349                     }
00350                     else
00351                         tag->SetCData(std::string((char*)check->content));
00352 
00353                 }
00354             }
00355         }
00356         return tag;
00357     }
00358 
00359     void XMLTag::AddProperty(const std::string &name, const std::string &value)
00360     {
00361         m_properties[name] = value;
00362         Touch();
00363     }
00364 
00365 #define MAXINTLONGSIZE 40
00366     void XMLTag::AddProperty(const std::string &name, const unsigned long &value)
00367     {
00368         char longBuf[MAXINTLONGSIZE];
00369         sprintf_s(longBuf,MAXINTLONGSIZE, "%ld", value);
00370         m_properties[name] = longBuf;
00371         Touch();
00372     }
00373 
00374     void XMLTag::AddProperty(const std::string& name, const long &value)
00375     {
00376         char intBuf[MAXINTLONGSIZE];
00377         sprintf_s(intBuf, MAXINTLONGSIZE, "%ld", value);
00378         m_properties[name] = intBuf;
00379         Touch();
00380     }
00381 
00382 #define MAXINTSIZE 20
00383     void XMLTag::AddProperty(const std::string& name, const int &value)
00384     {
00385         char intBuf[MAXINTSIZE];
00386         sprintf_s(intBuf,MAXINTSIZE, "%d", value);
00387         m_properties[name] = intBuf;
00388         Touch();
00389     }
00390 
00391 #define MAXDOUBLESIZE 190
00392     void XMLTag::AddProperty(const std::string &name, const double &value)
00393     {
00394         char intBuf[MAXDOUBLESIZE];
00395         sprintf_s(intBuf,MAXDOUBLESIZE, "%f", value);
00396         m_properties[name] = intBuf;
00397         Touch();
00398     }
00399 
00400     void XMLTag::SetCData(const double &value)
00401     {
00402         char intBuf[MAXDOUBLESIZE];
00403         sprintf_s(intBuf,MAXDOUBLESIZE, "%f", value);
00404         m_cData = intBuf;
00405         Touch();
00406     }
00407 
00408     int XMLTag::GetCDataInt() const
00409     {
00410         return atoi(m_cData.c_str());
00411     }
00412 
00413     unsigned long XMLTag::GetCDataUlong() const
00414     {
00415         return atol(m_cData.c_str());
00416     }
00417 
00418     double XMLTag::GetCDataDouble() const
00419     {
00420         return atof(m_cData.c_str());
00421     }
00422     std::string XMLTag::GetCDataST() const
00423     {
00424         return m_cData;
00425     }
00426 
00427     void XMLTag::SetCData(const int &value)
00428     {
00429         char intBuf[MAXINTSIZE];
00430         sprintf_s(intBuf,MAXINTSIZE, "%d", value);
00431         m_cData = intBuf;
00432         Touch();
00433     }
00434 
00435     void XMLTag::SetCData(const unsigned long &value)
00436     {
00437         char intBuf[MAXINTSIZE];
00438         sprintf_s(intBuf,MAXINTSIZE, "%ld", value);
00439         m_cData = intBuf;
00440         Touch();
00441     }
00442 
00443     void XMLTag::SetCData(const long &value)
00444     {
00445         char intBuf[MAXINTSIZE];
00446         sprintf_s(intBuf,MAXINTSIZE, "%ld", value);
00447         m_cData = intBuf;
00448         Touch();
00449     }
00450 
00451 
00452     void XMLTag::SetCData(const std::string& value)
00453     {
00454         m_cData = value;
00455         Touch();
00456     }
00457 
00458     std::string XMLTag::GetProperty(const std::string &name, std::string default_value)
00459     {
00460         if(m_properties.find(name) == m_properties.end())
00461             return default_value;
00462         return m_properties[name];
00463     }
00464 
00465     double XMLTag::GetPropertyDouble(const std::string &name , double default_value)
00466     {
00467         if(m_properties.find(name) == m_properties.end())
00468             return default_value;
00469         return atof(m_properties[name].c_str());
00470     }
00471 
00472     int XMLTag::GetPropertyInt(const std::string& name, int default_value)
00473     {
00474         if(m_properties.find(name) == m_properties.end())
00475             return default_value;
00476         return atoi(m_properties[name].c_str());
00477     }
00478 
00479     int XMLTag::AddChild(XMLTag* child, int position)
00480     {
00481         if(child != NULL)
00482         {
00483             if(position < 0 || (unsigned)position > m_children.size())
00484                 m_children.push_back(child);
00485             else
00486                 m_children.insert(m_children.begin() += position, child);
00487             Touch();
00488             return (signed int)m_children.size() - 1;
00489         }
00490         return -1;
00491     }
00492 
00493     void XMLTag::ReplaceChild(XMLTag* child, int position)
00494     {
00495         if(child != NULL)
00496         {
00497             if(position < 0 || (unsigned)position > m_children.size())
00498                 m_children.push_back(child);
00499             else
00500             {
00501                 delete m_children[position];
00502                 m_children[position] = child;
00503             }
00504         }
00505         Touch();
00506     }
00507 
00508     unsigned int XMLTag::CountChildren() const
00509     {
00510         return (int)m_children.size();
00511     }
00512 
00513     void XMLTag::RemoveChild(const unsigned int &position)
00514     {
00515         if(position < m_children.size())
00516         {
00517             delete m_children[position];
00518             m_children.erase(m_children.begin() += position);
00519         }
00520     }
00521 
00522     void XMLTag::RemoveChild(const std::string &name)
00523     {
00524         for(std::vector<XMLTag*>::iterator iter = m_children.begin();
00525             iter != m_children.end(); iter++)
00526         {
00527             if((*iter)->GetName().compare(name) == 0)
00528             {
00529                 delete *iter;
00530                 m_children.erase(iter);
00531                 break;
00532             }
00533         }
00534     }
00535 
00536 
00537     XMLTag* XMLTag::GetChild(const unsigned int &position)
00538     {
00539         if(position < m_children.size())
00540         {
00541             if(m_children[position]->GetName().compare(XML_NODE_FILE_REFERENCE) == 0)
00542             {
00543                 XMLTag* child = ReadFromFile(m_children[position]->m_cData);
00544                 delete m_children[position];
00545                 m_children[position] = child;
00546                 m_children[position]->Touch();
00547             }
00548             return m_children[position];
00549         }
00550         return NULL;
00551     }
00552 
00553     XMLTag* XMLTag::GetChild(const std::string& name)
00554     {
00555         XMLTag* tag = NULL;
00556         int counter = 0;
00557         for(std::vector<XMLTag*>::const_iterator iter = m_children.begin();
00558             iter  != m_children.end(); iter++, counter++)
00559         {
00560             if((*iter)->GetName().compare(name) == 0)
00561             {
00562                 return GetChild(counter);
00563             }
00564         }
00565         return tag;
00566     }
00567 
00568     XMLTag* XMLTag::GetChild(const std::string& name, int innerindex)
00569     {
00570         XMLTag* tag = NULL;
00571         int counter = 0;
00572         int innercounter = 0;
00573         for(std::vector<XMLTag*>::const_iterator iter = m_children.begin();
00574             iter  != m_children.end(); iter++, counter++ )
00575         {
00576             if((*iter)->GetName().compare(name) == 0)
00577             {
00578                 if(innercounter == innerindex)
00579                     return GetChild(counter);
00580                 innercounter++;
00581             }
00582         }
00583         return tag;
00584     }
00585 
00586     unsigned long XMLTag::date()
00587     {
00588         return m_lastChanged;
00589     }
00590     //Methods
00591     int XMLTag::getQueryType()
00592     {
00593         return 0;
00594     }
00595 
00596     void XMLTag::Touch()
00597     {
00598         m_lastChanged = (unsigned long)time(NULL);
00599     }
00600 
00601 std::vector<std::string> XMLTag::GetSubFilenames()
00602 {
00603   std::vector<std::string> strings;
00604   GetSubFilenames(strings);
00605   return strings;
00606 }
00607 
00608 
00609 void XMLTag::GetSubFilenames(std::vector<std::string> &strings)
00610 {
00611 
00612   for(std::map<std::string, std::string>::const_iterator iter_pro = m_properties.begin();
00613       iter_pro != m_properties.end(); iter_pro++)
00614   {
00615     if((*iter_pro).first.compare(XML_ATTRIBUTE_FILENAME) == 0)
00616     {
00617       strings.push_back((*iter_pro).second);
00618       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00619     }
00620     else if((*iter_pro).first.find(XML_ATTRIBUTE_FILENAME) != (*iter_pro).first.npos)
00621     {
00622       strings.push_back((*iter_pro).second);
00623       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00624     }
00625     else if((*iter_pro).first.find("path") != (*iter_pro).first.npos)
00626     {
00627       strings.push_back((*iter_pro).second);
00628       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00629     }
00630   }
00631 
00632   if(m_cData.find(".dxf")!= m_cData.npos || m_cData.find(".DXF") != m_cData.npos|| m_cData.find(".Dxf") != m_cData.npos ||
00633      m_cData.find(".off")!= m_cData.npos)
00634   {
00635     strings.push_back(m_cData);
00636     printf("Found a filename in %s: %s\n", m_name.c_str(), m_cData.c_str());
00637   }
00638   
00639   if(m_name.compare("filename") == 0)
00640   {
00641     strings.push_back(m_cData);
00642     printf("Found a filename in %s: %s\n", m_name.c_str(), m_cData.c_str());
00643   }
00644 
00645 
00646   for(std::vector<XMLTag*>::const_iterator iter_child = m_children.begin();
00647       iter_child != m_children.end(); iter_child++)
00648   {
00649     (*iter_child)->GetSubFilenames(strings);
00650   }
00651 
00652 }
00653 
00654 
00655 
00656 void XMLTag::ReplaceSubFilenames(std::string global_path)
00657 {
00658 
00659   std::map<std::string, std::string>::iterator iter_pro = m_properties.begin();
00660   for(;
00661       iter_pro != m_properties.end(); iter_pro++)
00662   {
00663    if((*iter_pro).second.length() > 0 &&  (*iter_pro).second[0] != '/')
00664    {
00665     if((*iter_pro).first.compare(XML_ATTRIBUTE_FILENAME) == 0)
00666     {
00667       (*iter_pro).second = global_path + (*iter_pro).second;
00668       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00669     }
00670     else if((*iter_pro).first.find(XML_ATTRIBUTE_FILENAME) != (*iter_pro).first.npos)
00671     {
00672       (*iter_pro).second = global_path + (*iter_pro).second;
00673       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00674     }
00675     else if((*iter_pro).first.find("path") != (*iter_pro).first.npos)
00676     {
00677       (*iter_pro).second = global_path + (*iter_pro).second;
00678       printf("Found a filename in %s: %s\n", m_name.c_str(), (*iter_pro).second.c_str());
00679     }
00680    }
00681   }
00682 
00683   if(m_cData.find(".dxf")!= m_cData.npos || m_cData.find(".DXF") != m_cData.npos|| m_cData.find(".Dxf") != m_cData.npos ||
00684      m_cData.find(".off")!= m_cData.npos  )
00685   {
00686     if(m_cData.length() > 0 &&  m_cData[0] != '/')
00687     { 
00688       m_cData = global_path + m_cData;
00689       printf("Found a filename in %s: %s\n", m_name.c_str(), m_cData.c_str());
00690     }
00691   }
00692   
00693   if(m_name.compare("filename") == 0)
00694   {
00695     if(m_cData.length() > 0 &&  m_cData[0] != '/')
00696     {
00697       m_cData = global_path + m_cData;
00698       printf("Found a filename in %s: %s\n", m_name.c_str(), m_cData.c_str());
00699     }
00700   }
00701 
00702 
00703   for(std::vector<XMLTag*>::const_iterator iter_child = m_children.begin();
00704       iter_child != m_children.end(); iter_child++)
00705   {
00706     (*iter_child)->ReplaceSubFilenames(global_path);
00707   }
00708 
00709 }
00710 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:35