本文整理汇总了C++中TiXmlElement::IterateChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::IterateChildren方法的具体用法?C++ TiXmlElement::IterateChildren怎么用?C++ TiXmlElement::IterateChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::IterateChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool CSettings::Load(const char* file)
{
if (m_xmlDocument.LoadFile(file))
{
TiXmlElement* pRootElement = m_xmlDocument.RootElement();
if (pRootElement)
{
TiXmlElement* pPdbFilesElement = pRootElement->FirstChildElement(ELEMENT_REGISTERED_PDB_FILES);
if (pPdbFilesElement)
{
// get all the registered files
TiXmlNode* pFileNode = NULL;
pFileNode = pPdbFilesElement->IterateChildren("File", pFileNode);
while (pFileNode)
{
TiXmlElement* pFileElement = pFileNode->ToElement();
if (!pFileElement) return false;
std::string pdbFile = pFileElement->GetText();
m_pdbFiles.push_back(pdbFile);
pFileNode = pPdbFilesElement->IterateChildren("File", pFileNode);
}
}
return true;
}
}
return false;
}
示例2: SaveParam
void PlayerParameters::SaveParam(int index)
{
TiXmlDocument fichier("data/player/param.xml");
if(!fichier.LoadFile(TIXML_ENCODING_LEGACY))
throw Exception("Impossible de charger le fichier: data/player/param.xml");
TiXmlElement *rootNode = fichier.RootElement();
TiXmlNode *player = 0;
while((player=rootNode->IterateChildren("player",player)))
{
int current;
player->ToElement()->Attribute("numero", ¤t);
if(current==index)
{
player->FirstChild("rouge")->ToElement()->SetAttribute("value", m_param[index].couleur.r);
player->FirstChild("vert")->ToElement()->SetAttribute("value", m_param[index].couleur.g);
player->FirstChild("bleu")->ToElement()->SetAttribute("value", m_param[index].couleur.b);
player->FirstChild("touches")->Clear();
player->ToElement()->SetAttribute("name", Sanitanyse(m_param[index].nom));
for(auto it: m_param[index].touches)
{
TiXmlNode *toucheNode = new TiXmlElement("touche");
toucheNode->ToElement()->SetAttribute("name", it.first);
toucheNode->ToElement()->SetAttribute("code", it.second);
player->FirstChild("touches")->ToElement()->LinkEndChild(toucheNode);
}
fichier.SaveFile("data/player/param.xml");
return;
}
}
}
示例3: Parse
bool BXBoxeeWebFavorites::Parse()
{
TiXmlHandle docHandle(&m_doc);
TiXmlElement *pChild = docHandle.FirstChild("bookmarks").Element();
if (!pChild)
{
LOG(LOG_LEVEL_ERROR,"BXBoxeeWebFavorites::Parse - FAILED to find <bookmark> node");
return false;
}
m_webFavorites.clear();
TiXmlNode *pMsgNode = 0;
while ((pMsgNode = pChild->IterateChildren(pMsgNode)) != NULL)
{
if (pMsgNode->ValueStr().compare("bookmark") == 0)
{
BXObject obj;
if (obj.FromXML(pMsgNode))
{
m_webFavorites.push_back(obj);
}
}
}
return true;
}
示例4: LoadAlbumsInfo
bool CMetadataResolverMusic::LoadAlbumsInfo(BOXEE::BXXMLDocument& doc, vectorMetadata& list)
{
TiXmlElement* pRootElement = doc.GetDocument().RootElement();
bool bRetVal = true;
if (pRootElement->ValueStr() == "results")
{
TiXmlNode* pTag = 0;
BXMetadata album(MEDIA_ITEM_TYPE_AUDIO);
while ((pTag = pRootElement->IterateChildren(pTag)))
{
if (pTag && pTag->ValueStr() == "album")
{
TiXmlElement* pValue = pTag->FirstChildElement();
if (pValue && (LoadAlbumInfo(pValue,album)))
list.push_back(album);
else
bRetVal = false;
}
else
bRetVal = false;
}
}
else
bRetVal = false;
return bRetVal;
}
示例5: SetXmlValue
void COptions::SetXmlValue(unsigned int nID, wxString value)
{
if (!m_pXmlFile)
return;
// No checks are made about the validity of the value, that's done in SetOption
char *utf8 = ConvUTF8(value);
if (!utf8)
return;
TiXmlElement *settings = m_pXmlFile->GetElement()->FirstChildElement("Settings");
if (!settings)
{
TiXmlNode *node = m_pXmlFile->GetElement()->LinkEndChild(new TiXmlElement("Settings"));
if (!node)
{
delete [] utf8;
return;
}
settings = node->ToElement();
if (!settings)
{
delete [] utf8;
return;
}
}
else
{
TiXmlNode *node = 0;
while ((node = settings->IterateChildren("Setting", node)))
{
TiXmlElement *setting = node->ToElement();
if (!setting)
continue;
const char *attribute = setting->Attribute("name");
if (!attribute)
continue;
if (strcmp(attribute, options[nID].name))
continue;
//setting->RemoveAttribute("type");
setting->Clear();
//setting->SetAttribute("type", (options[nID].type == string) ? "string" : "number");
setting->LinkEndChild(new TiXmlText(utf8));
delete [] utf8;
return;
}
}
wxASSERT(options[nID].name[0]);
TiXmlElement *setting = new TiXmlElement("Setting");
setting->SetAttribute("name", options[nID].name);
//setting->SetAttribute("type", (options[nID].type == string) ? "string" : "number");
setting->LinkEndChild(new TiXmlText(utf8));
settings->LinkEndChild(setting);
delete [] utf8;
}
示例6: Parse
bool BXBoxeeServices::Parse()
{
TiXmlHandle docHandle(&m_doc);
TiXmlNode* pTSChild = docHandle.FirstChild("services").FirstChild("timestamp").FirstChild().Node();
if (pTSChild)
{
m_timestamp = atoi(pTSChild->Value());
}
TiXmlElement *pChild = docHandle.FirstChild("services").Element();
if (!pChild)
{
LOG(LOG_LEVEL_ERROR,"BXBoxeeServices::Parse - FAILED to find <applications> node");
return false;
}
m_services.clear();
TiXmlNode *pMsgNode = 0;
while ((pMsgNode = pChild->IterateChildren(pMsgNode)) != NULL)
{
if (pMsgNode->ValueStr().compare("object") == 0)
{
BXObject obj;
if (obj.FromXML(pMsgNode))
{
m_services.push_back(obj);
}
}
}
return true;
}
示例7: while
void N7Xml::list_channels()
{
CStdString strUrl;
strUrl.Format("http://%s:%i/n7channel_nt.xml", g_strHostname.c_str(), g_iPort);
CStdString strXML;
CCurlFile http;
if(!http.Get(strUrl, strXML))
{
XBMC->Log(LOG_DEBUG, "N7Xml - Could not open connection to N7 backend.");
}
else
{
TiXmlDocument xml;
xml.Parse(strXML.c_str());
TiXmlElement* rootXmlNode = xml.RootElement();
if (rootXmlNode == NULL)
return;
TiXmlElement* channelsNode = rootXmlNode->FirstChildElement("channel");
if (channelsNode)
{
XBMC->Log(LOG_DEBUG, "N7Xml - Connected to N7 backend.");
m_connected = true;
int iUniqueChannelId = 0;
TiXmlNode *pChannelNode = NULL;
while ((pChannelNode = channelsNode->IterateChildren(pChannelNode)) != NULL)
{
CStdString strTmp;
PVRChannel channel;
/* unique ID */
channel.iUniqueId = ++iUniqueChannelId;
/* channel number */
if (!XMLUtils::GetInt(pChannelNode, "number", channel.iChannelNumber))
channel.iChannelNumber = channel.iUniqueId;
/* channel name */
if (!XMLUtils::GetString(pChannelNode, "title", strTmp))
continue;
channel.strChannelName = strTmp;
/* icon path */
const TiXmlElement* pElement = pChannelNode->FirstChildElement("media:thumbnail");
channel.strIconPath = pElement->Attribute("url");
/* channel url */
if (!XMLUtils::GetString(pChannelNode, "guid", strTmp))
channel.strStreamURL = "";
else
channel.strStreamURL = strTmp;
m_channels.push_back(channel);
}
}
}
}
示例8: Load
void PlayerParameters::Load()
{
TiXmlDocument fichier("data/player/param.xml");
if(!fichier.LoadFile(TIXML_ENCODING_LEGACY))
throw Exception("Impossible de charger le fichier: data/player/param.xml");
TiXmlElement *rootNode = fichier.RootElement();
TiXmlNode *player = 0;
while((player=rootNode->IterateChildren("player",player)))
{
LoadPlayer(player);
}
}
示例9: load
void load( const TiXmlElement & elem, data::Crop & data ) const
{
data.id = xml::attribute( elem, "id" );
data.seed = &db::getItem( xml::attribute( elem, "seedID" ) );
data.crop = &db::getItem( xml::attribute( elem, "cropID" ) );
data.image = xml::attribute( elem, "image" );
data.seasons = time::parseSeasons( xml::attribute( elem, "season" ) );
data.regrowth = std::stoi( xml::attribute( elem, "regrowth" ) );
const TiXmlNode * it = nullptr;
while ( ( it = elem.IterateChildren( "stage", it ) ) )
data.growth.push_back( std::stoi( xml::attribute( static_cast< const TiXmlElement & >( *it ), "length" ) ) );
if ( data.regrowth != 0 && data.regrowth > data.growth.size() )
throw Exception( "regrowth index is invalid" );
}
示例10: getIt
bool OutputFile::getIt(ParamQt * p)
{
int deb=0;
currentIteration++;
p->setRho(0);
p->setTheta(0);
p->setLL(0);
TiXmlHandle root(&mDoc);
TiXmlHandle h = root.FirstChild("outputFile");
TiXmlHandle hIter = h.Child("Iteration", currentIteration);
TiXmlElement* t;
// <Tree>
t = hIter.FirstChild("Tree").ToElement();
if (t == NULL) // Can I use hIter to return false?
return false;
string s(t->GetText());
while (s.at(0)==10 || s.at(0)==13) s=s.substr(1,s.length()-1);
while (s.at(s.size()-1)==10 || s.at(s.size()-1)==13) s=s.substr(0,s.length()-1);
p->setTreeData(new RecTree(getL(),s,false,false),blocks);
// <number>, <theta>, <delta>, <rho>, <ll>.
t = hIter.FirstChild("number").ToElement(); p->setNumber(atol(t->GetText()));
t = hIter.FirstChild("theta").ToElement(); p->setTheta(p->getTheta() + atof(t->GetText()));
t = hIter.FirstChild("delta").ToElement(); p->setDelta(atof(t->GetText()));
t = hIter.FirstChild("rho").ToElement(); p->setRho(p->getRho() + atof(t->GetText()));
t = hIter.FirstChild("ll").ToElement(); p->setLL(p->getLL() + atof(t->GetText()));
// <recedge>
TiXmlElement* parent = hIter.ToElement();
TiXmlElement* child = 0;
while (child = (TiXmlElement*) parent->IterateChildren("recedge", child))
{
int start=0,end=0,efrom=0,eto=0;
double ato=0,afrom=0;
t = child->FirstChildElement("start"); start = deb + atoi(t->GetText());
t = child->FirstChildElement("end"); end = deb + atoi(t->GetText());
t = child->FirstChildElement("efrom"); efrom = atoi(t->GetText());
t = child->FirstChildElement("eto"); eto = atoi(t->GetText());
t = child->FirstChildElement("afrom"); afrom = atof(t->GetText());
t = child->FirstChildElement("ato"); ato = atof(t->GetText());
p->getTree()->addRecEdge(afrom,ato,start,end,efrom,eto);
}
return true;
}
示例11: ParseResultListXml
bool CGetResultListBG::ParseResultListXml(const CStdString& strHtml, CFileItemList& items)
{
TiXmlDocument xmlDoc;
xmlDoc.Parse(strHtml);
TiXmlElement *pRootElement = xmlDoc.RootElement();
if (!pRootElement)
return false;
if (strcmpi(pRootElement->Value(), "search") != 0)
{
CLog::Log(LOGERROR, "CGetResultListBG::ParseResultListXml, could not parse manual resolution results (manual)");
return false;
}
const TiXmlNode* pTag = 0;
while ((pTag = pRootElement->IterateChildren(pTag)))
{
if (pTag->ValueStr() == "title")
{
const TiXmlNode *pValue = pTag->FirstChild();
CStdString strValue = pValue->ValueStr();
// Find the id attribute, we do not know its name but we know that there are two attributes and it's not the one called 'year'
CStdString idAttributeName;
CStdString idAttributeValue;
TiXmlAttribute* attribute = ((TiXmlElement*)pTag)->FirstAttribute();
while (attribute)
{
if ((strcmpi(attribute->Name(), "year") != 0) && (strcmpi(attribute->Name(), "type") != 0))
{
idAttributeName = attribute->Name();
idAttributeValue = attribute->Value();
}
attribute = attribute->Next();
}
if (idAttributeName.IsEmpty() || idAttributeValue.IsEmpty())
{
// this should not happen, each search result should have an id
CLog::Log(LOGERROR, "CGetResultListBG::ParseResultListXml, search result without id, value = %s (manual)", strValue.c_str());
continue;
}
// Get the year
CStdString strYear = ((TiXmlElement*)pTag)->Attribute("year");
CStdString strType = ((TiXmlElement*)pTag)->Attribute("type");
bool bIsMovie = false;
if (strType == "movie")
{
bIsMovie = true;
}
else if (strType == "tv")
{
bIsMovie = false;
}
else
{
CLog::Log(LOGERROR, "CGetResultListBG::ParseResultListXml, invalid type = %s (manual)", strType.c_str());
continue;
}
CStdString strMovieTypeLabel = "Movie";
CStdString strTvTypeLabel = "TV";
// Format label and create file item
CStdString strLabel;
if (strYear.IsEmpty())
strLabel.Format("%s (%s)", strValue.c_str(), bIsMovie ? strMovieTypeLabel.c_str() : strTvTypeLabel.c_str());
else
strLabel.Format("%s (%s) (%s)", strValue.c_str(), strYear.c_str(), bIsMovie ? strMovieTypeLabel.c_str() : strTvTypeLabel.c_str());
CFileItemPtr resultItem (new CFileItem(strLabel));
resultItem->SetProperty("type", "msearch");
resultItem->SetProperty("manualresolve::Title", strValue);
resultItem->SetProperty("manualresolve::Year", strYear);
resultItem->SetProperty("manualresolve::idName", idAttributeName);
resultItem->SetProperty("manualresolve::idValue", idAttributeValue);
resultItem->SetProperty("manualresolve::isMovie", bIsMovie);
items.Add(resultItem);
CLog::Log(LOGDEBUG, "CGetResultListBG::ParseResultListXml, added item, title = %s, type = %s, year = %s, idName = %s, idValue = %s (manual)",
strValue.c_str(), bIsMovie ? "movie" : "tv", strYear.c_str(), idAttributeName.c_str(), idAttributeValue.c_str());
}
}
return items.Size() > 0;
}
示例12: parseNode
bool XMLScene::parseNode(TiXmlElement *curr_node, bool is_inside_dl) {
char node_id[MAX_STRING_LEN];
if (strdup(node_id, curr_node->Attribute("id")) == NULL) {
printf("Error reading \"id\" attribute!\n");
throw InvalidXMLException();
}
printf("id: %s\n", node_id);
bool is_dl = false;
string dl_node_id;
if (curr_node->QueryBoolAttribute("displaylist", &is_dl) != TIXML_SUCCESS) {
printf("No \"displaylist\" attribute\n");
}
if (is_dl) {
printf("Node \"%s\" defined as a display list.\n", node_id);
dl_node_id = Scene::getInstance()->findNextNameAvail(node_id);
printf("dl_node_id: %s\n", dl_node_id.c_str());
}
Node *n;
if (is_dl) {
n = new DisplayList(dl_node_id);
} else {
n = new Node(node_id);
}
nodes_being_processed.push_back(node_id);
printf("Processing transformations...\n");
TiXmlElement *transf_block = NULL;
if ((transf_block = curr_node->FirstChildElement("transforms")) == NULL) {
printf("Could not find \"transforms\" block on %s node!\n", node_id);
throw InvalidXMLException();
}
TiXmlElement *transf = NULL;
while ((transf = (TiXmlElement*) transf_block->IterateChildren(transf))) {
char t_type[MAX_STRING_LEN];
if (strdup(t_type, transf->Value()) == NULL) {
printf("Invalid transformation on node %s\n", node_id);
throw InvalidXMLException();
}
if (strcmp(t_type, "translate") == 0) {
char tmp_str[MAX_STRING_LEN];
double t_x = 0, t_y = 0, t_z = 0;
if (strdup(tmp_str, transf->Attribute("to")) == NULL) {
printf("Error on translate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf", &t_x, &t_y, &t_z) != 3) {
printf("Error parsing translate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addTranslate(t_x, t_y, t_z);
printf("Translate\nto: (%f %f %f)\n", t_x, t_y, t_z);
} else if (strcmp(t_type, "rotate") == 0) {
char tmp_str[2];
char r_axis = '\0';
double r_angle;
if (strdup(tmp_str, transf->Attribute("axis")) == NULL) {
printf("Error on rotate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
r_axis = tmp_str[0];
if (transf->QueryDoubleAttribute("angle", &r_angle)) {
printf("Error parsing rotate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addRotation(r_angle, r_axis);
printf("Rotate\naxis: %c\nangle: %f\n", r_axis, r_angle);
} else if (strcmp(t_type, "scale") == 0) {
char tmp_str[MAX_STRING_LEN];
double f_x = 0, f_y = 0, f_z = 0;
if (strdup(tmp_str, transf->Attribute("factor")) == NULL) {
printf("Error on scale transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf", &f_x, &f_y, &f_z) != 3) {
printf("Error parsing scale transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addScale(f_x, f_y, f_z);
//.........这里部分代码省略.........
示例13: TiXmlDocument
// get the configuration file using hobbit protocol config
void AgentBBWinUpdate::RunUpdate(std::string & configFile) {
TiXmlDocument * update, * toUpdate;
DeleteFile(m_bbwinupdateTmpFilePath.c_str());
m_mgr.Config(configFile.c_str(), m_bbwinupdateTmpFilePath.c_str());
update = new TiXmlDocument(m_bbwinupdateTmpFilePath.c_str());
bool loadUpdateOkay = update->LoadFile();
if ( !loadUpdateOkay ) {
string err = (string)" failed to get the update " + configFile + (string)" or the update file is not correct";
m_mgr.ReportEventError(err.c_str());
}
toUpdate = new TiXmlDocument(m_bbwinCfgTmpPath.c_str());
bool loadToUpdateOkay = toUpdate->LoadFile();
if ( !loadToUpdateOkay ) {
delete update;
string err = (string)" failed to open " + m_bbwinCfgTmpPath;
m_mgr.ReportEventError(err.c_str());
}
TiXmlElement *root = update->FirstChildElement( "configuration" );
TiXmlElement *toUpdateRoot = toUpdate->FirstChildElement( "configuration" );
if ( root && toUpdateRoot) {
for (TiXmlNode * nameSpaceNode = root->FirstChild(); nameSpaceNode != NULL; nameSpaceNode = root->IterateChildren(nameSpaceNode)) {
// we never update bbwin namespace (too dangerous)
if (strcmp(nameSpaceNode->Value(), "bbwin") != 0) {
TiXmlNode * destNameSpaceNode = toUpdateRoot->FirstChild(nameSpaceNode->Value());
if ( destNameSpaceNode ) {
toUpdateRoot->ReplaceChild(destNameSpaceNode, *nameSpaceNode);
} else {
toUpdateRoot->InsertEndChild(*nameSpaceNode);
}
} else {
string err = (string)" bbwin namespace update is not permitted. Please check the " + (string)configFile + (string)" on your hobbit server.";
m_mgr.ReportEventError(err.c_str());
}
}
}
if (toUpdate->SaveFile() != true) {
string err = (string)" failed to save " + m_bbwinCfgTmpPath;
m_mgr.ReportEventError(err.c_str());
}
delete update;
delete toUpdate;
}
示例14: StatusPluginReference
OsStatus
PluginXmlParser::loadPlugins (
const UtlString configFileName,
Notifier* notifier )
{
OsStatus currentStatus = OS_SUCCESS;
int index = 0;
mDoc = new TiXmlDocument( configFileName.data() );
if( mDoc->LoadFile() )
{
OsSysLog::add(FAC_SIP, PRI_DEBUG, "PluginXmlParser::loadMappings "
"- Loaded %s", configFileName.data() );
}
else
{
OsSysLog::add(FAC_SIP, PRI_ERR, "PluginXmlParser::loadMappings "
"- Unable to Open XML file %s", configFileName.data() );
return OS_NOT_FOUND;
}
// start loading plugins from the configuration file
// Get the "subscribe-server-plugins" element.
// It is a child of the document, and can be selected by name.
TiXmlNode* mMainPluginsNode =
mDoc->FirstChild( XML_TAG_SUBSCRIBE_SERVER_PLUGINS );
if ( !mMainPluginsNode )
{
OsSysLog::add(FAC_SIP, PRI_ERR, "PluginXmlParser::loadMappings "
"- No child Node for subscribe-server-plugins");
return OS_FILE_READ_FAILED;
}
TiXmlElement* mMainPluginsElement = mMainPluginsNode->ToElement();
// get <SUBSCRIBE-PLUGIN> Nodes
TiXmlNode* pluginNode = NULL;
UtlString eventType;
while ((pluginNode = mMainPluginsElement->IterateChildren(pluginNode)))
{
eventType = "";
// Skip over comments etc, only interested in ELEMENTS
if( pluginNode->Type() == TiXmlNode::ELEMENT )
{
TiXmlElement* pluginElement = pluginNode->ToElement();
UtlString value;
value.append( pluginElement->Value() );
if( value.compareTo(XML_TAG_SUBSCRIBE_PLUGINS) == 0 )
{
index ++;
TiXmlNode* attibuteNode = NULL;
SubscribeServerPluginBase* newPlugin = NULL;
// get event type associated with this plug in
// create a new plugin for this event type
attibuteNode = pluginElement->FirstChild(XML_TAG_EVENT_TYPE);
if(attibuteNode)
{
TiXmlNode* eventTypeValue = attibuteNode->FirstChild();
if(eventTypeValue && eventTypeValue->Type() == TiXmlNode::TEXT)
{
TiXmlText* eventTypeText = eventTypeValue->ToText();
if (eventTypeText)
{
eventType = eventTypeText->Value();
// MWI is built in so we do not load a library for now.
// Eventually we should remove this if block so it looks
// for DLL and entry point
if(eventType.compareTo(SIP_EVENT_MESSAGE_SUMMARY,
UtlString::ignoreCase ) == 0)
{
// create new plugin with the specific attributes defined in the node
newPlugin = MwiPluginFactory( *pluginNode,
notifier );
}
// load DLL and find entry point defined in XML
else
{
// OPINION: make fail-fast; so we fail if one plugin fails
currentStatus = loadPlugin(*pluginElement, notifier, &newPlugin);
if (currentStatus != OS_SUCCESS)
return OS_SUCCESS;//:TODO: ???
}
}
}
}
if( newPlugin)
{
StatusPluginReference* pluginContainer =
new StatusPluginReference(*newPlugin,
//.........这里部分代码省略.........
示例15: LoadSupportedSets
void TextureControl::LoadSupportedSets() {
TiXmlDocument* doc;
TiXmlElement* setElem;
TiXmlElement* subSetElem;
TiXmlElement* chanElem;
TiXmlElement* elem;
TiXmlNode* prevChan;
TiXmlNode* prevSubSet;
string fileSetName;
string setName;
string subSetName;
string chanName;
string setPath;
string fileName;
string fileFormat;
string buf;
int size;
int compress;
int alpha;
unsigned int Flags;
TargetTextureSet* ptts;
WIN32_FIND_DATA findData;
HANDLE hFind;
hFind = FindFirstFile("SetDefs\\*.xml",&findData);
do {
fileSetName = "SetDefs\\";
fileSetName += findData.cFileName;
doc = new TiXmlDocument(fileSetName.c_str());
bool loadOkay = doc->LoadFile();
if(!loadOkay) {
delete doc;
continue;
}
setElem = doc->FirstChildElement("TextureSet");
while(setElem) {
setName = setElem->Attribute("Name");
elem = setElem->FirstChildElement("Path");
if(elem) setPath = elem->GetText();
ptts = new TargetTextureSet(setName,setPath);
prevSubSet = NULL;
while(prevSubSet = setElem->IterateChildren("SubSet",prevSubSet)) {
subSetElem = prevSubSet->ToElement();
subSetName = subSetElem->Attribute("Name");
prevChan = NULL;
while( prevChan = subSetElem->IterateChildren("Channel",prevChan) ){
chanElem = prevChan->ToElement();
chanName = chanElem->Attribute("Name");
elem = chanElem->FirstChildElement("FileName");
if(elem) fileName = elem->GetText();
elem = chanElem->FirstChildElement("FileFormat");
if(elem) fileFormat = elem->GetText();
elem = chanElem->FirstChildElement("Size");
if(elem) size = atoi(elem->GetText());
Flags = 0; compress = 0; alpha = 0;
elem = chanElem->FirstChildElement("CompressTex");
if(elem) compress = atoi(elem->GetText());
if(!compress)
Flags = TTS_FLAG_DDSUNCOMPRESSED;
elem = chanElem->FirstChildElement("HasAlpha");
if(elem) alpha = atoi(elem->GetText());
if(alpha)
Flags |= TTS_FLAG_HASALPHA;
ptts->AddSetFile(subSetName, chanName, fileName,fileFormat,size,Flags);
}
}
supportedSets.push_back(ptts);
setElem = setElem->NextSiblingElement("TextureSet");
}
delete doc;
} while(FindNextFile(hFind,&findData)) ;
}