Changeset 910 for XmlTools2


Ignore:
Timestamp:
Feb 1, 2014, 5:02:56 PM (11 years ago)
Author:
s10k
Message:

some more fixes

Location:
XmlTools2/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XmlTools2/trunk/multidimvar.cpp

    r906 r910  
    5757    }
    5858
    59     result += QString::number(this->multiDimValue.size()-1,'G',9); // last one does not have a space at the end
     59    result += QString::number(this->multiDimValue[this->multiDimValue.size()-1],'G',9); // last one does not have a space at the end
    6060
    6161    return result;
  • XmlTools2/trunk/xmlpatch.cpp

    r906 r910  
    88
    99    if(forceTargetFilesWildcard!=""){
    10         std::cout << "User forced patch in the target file(s): " << this->forceTargetFilesWildcard.toLatin1().constData() << std::endl;
    11     }
    12 
    13     if(this->patchFilesToProcess.size()==0){
     10        std::cout << "User forced patch in the target file(s): " << forceTargetFilesWildcard.toLatin1().constData() << std::endl;
     11    }
     12
     13    if(this->patchFilesToProcess.isEmpty()){
    1414        UtilXmlTools::displayErrorMessage("Loading patch files","No .patch or .oni-patch files were found for the wildcard: "+patchFilesWildcard);
    1515    }
     
    4747
    4848    QStringList filesToProcess;
    49 
    50     filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
    51 
    5249    pugi::xml_node nodeToInsertion;
    5350    pugi::xml_document newNode;
    5451    pugi::xml_parse_result result;
    5552
     53    filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
     54
     55    if(filesToProcess.isEmpty()){
     56        UtilXmlTools::displayErrorMessage("@ADD_INSIDE_NODE","No XML files were found for the wildcard: "+filesWildcard);
     57    }
     58
    5659    result=newNode.load(xmlString.toLatin1().constData()); // load xml to insert
    5760
     
    9598    QStringList filesToProcess;
    9699
     100    pugi::xml_node nodeToDeletion;
     101
    97102    filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
    98103
    99     pugi::xml_node nodeToDeletion;
    100     pugi::xml_parse_result result;
     104    if(filesToProcess.isEmpty()){
     105        UtilXmlTools::displayErrorMessage("@REMOVE_NODE","No XML files were found for the wildcard: "+filesWildcard);
     106    }
    101107
    102108    // Process all XmlFiles
     
    184190    filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard);
    185191
     192    if(filesToProcess.isEmpty()){
     193        UtilXmlTools::displayErrorMessage("@CUSTOM_CODE","No XML files were found for the wildcard: "+filesWildcard);
     194    }
     195
    186196    rexmlfile.open(QFile::ReadOnly | QFile::Text);
    187197    jsxmlfile.open(QFile::ReadOnly | QFile::Text);
     
    277287void XmlPatch::checkAndProcessValidCommands(QTextStream &fileStream){
    278288
    279     QString line;
    280     QString filesWildcard;
     289    QString line, filesWildcard;
    281290    QString xmlToInsert, command, jsCode;
    282291    XmlFilter filters;
     
    294303            filters.setAttributeName(getPatchParameterValue(line,"AttributeName"));
    295304            filters.setAttributeValue(getPatchParameterValue(line,"AttributeValue"));
    296             if(this->forceTargetFilesWildcard==""){
     305
     306            if(this->forceTargetFilesWildcard!=""){
     307                filesWildcard=this->forceTargetFilesWildcard;
     308            }
     309            else{
    297310                filesWildcard=getPatchParameterValue(line,"Files");
    298             }
    299             else{
    300                 filesWildcard=this->forceTargetFilesWildcard;
    301311            }
    302312
     
    327337            filters.setAttributeName(getPatchParameterValue(line,"AttributeName"));
    328338            filters.setAttributeValue(getPatchParameterValue(line,"AttributeValue"));
    329             if(this->forceTargetFilesWildcard==""){
     339
     340            if(this->forceTargetFilesWildcard!=""){
     341                filesWildcard=this->forceTargetFilesWildcard;
     342            }
     343            else{
    330344                filesWildcard=getPatchParameterValue(line,"Files");
    331             }
    332             else{
    333                 filesWildcard=this->forceTargetFilesWildcard;
    334345            }
    335346
     
    354365        else if(line.startsWith("@CUSTOM_CODE")){
    355366
    356             if(this->forceTargetFilesWildcard==""){
     367            if(this->forceTargetFilesWildcard!=""){
     368                filesWildcard=this->forceTargetFilesWildcard;
     369            }
     370            else{
    357371                filesWildcard=getPatchParameterValue(line,"Files");
    358             }
    359             else{
    360                 filesWildcard=this->forceTargetFilesWildcard;
    361372            }
    362373
  • XmlTools2/trunk/xmltools.cpp

    r906 r910  
    77    this->backupsEnabled=!noBackups;
    88
    9     if(this->filesToProcess.size()==0){
     9    if(this->filesToProcess.isEmpty()){
    1010        UtilXmlTools::displayErrorMessage("Loading xml files","No XML files were found for the wildcard: "+filesWildcard);
    1111    }
     
    6767                for(int m=0; m<valuesToRemoveList.size(); m++){
    6868                    if(currValuesList[k]==valuesToRemoveList[m]){
    69                         currValuesList[k]=""; // remove it
     69                        currValuesList[k]=""; // flag to deletion
    7070                        elementChanged=true;
    7171                    }
     
    7474
    7575            if(elementChanged){ // If curr element changed update the XML
     76                currValuesList.removeAll(""); // remove all files flagged to deletion
    7677                elements[j].text()=currValuesList.join(' ').toLatin1().constData();
    7778                elementChanged=false;
Note: See TracChangeset for help on using the changeset viewer.