#include "vapiTypes.h"
#include "vapiMacro.h"
#include "vapiMacroList.h"
Diagrama de dependências de inclusão para vapiMacroXML.h:
Este grafo mostra quais são os ficheiros que incluem directamente ou indirectamente este ficheiro:
Ir para o código fonte deste ficheiro.
Funções | |
vMacroHeader * | vapiMacroFromXML (const char *filename, vOperationList *OperationList, vMacroList *MacroList) |
Imports a Macro from XML. It imports the Macro Name, Comments, Operations and Options. | |
char * | vapiMacroFromXMLSetName (const char *filename) |
Get the Name of the Macro from the XML. | |
void | vapiMacroToXML (vMacroHeader *MacroHeader, const char *filename) |
Exports a Macro to XML It will export the Operation Definitions and the options, if different from default. | |
vBoolean | vapiMacroXMLLoadToList (vMacroList *MacroList, vOperationList *OperationList, const char *filename) |
Loads a Macro directly from file to the MacroList. |
Definido no ficheiro vapiMacroXML.h.
vMacroHeader* vapiMacroFromXML | ( | const char * | filename, | |
vOperationList * | OperationList, | |||
vMacroList * | MacroList | |||
) |
Imports a Macro from XML. It imports the Macro Name, Comments, Operations and Options.
filename | The xml filename. |
Definido na linha 122 do ficheiro vapiMacroXML.c.
Referências _vMacroHeader::Macro, MacroList, OperationList, _vEffect::OptionsSettings, v_debug, vapiCheckOperations(), vapiMacroAddItem(), vapiMacroNew(), vapiMacroUpdateComment(), vapiOperationListSelectOperation(), vapiOperationOptionsInit(), vapiOptionsCheck(), vapiOptionsXMLSetOptions(), vapiOptionsXMLSetOptionsOperation() e vapiXMLNextElement().
Referenciado por vapiMacroXMLLoadToList().
00124 { 00125 xmlTextReader *xmlInput; 00126 vMacroHeader *MacroHeader; 00127 vEffect *tempOperation; 00128 vOptions *tempOptions; 00129 int ret = 1; 00130 xmlInput = xmlReaderForFile (filename, "ISO-8859-1", XML_PARSE_DTDATTR | /* default DTD attributes */ 00131 XML_PARSE_NOENT | /* substitute entities */ 00132 XML_PARSE_DTDVALID); /* validate with the DTD */ 00133 00134 if (xmlInput == NULL) 00135 { 00136 return NULL; 00137 } 00138 xmlTextReaderRead (xmlInput); 00139 if (!strcmp 00140 ((char *) xmlTextReaderLocalName (xmlInput), "vapiMacro ")) 00141 { 00142 return MacroHeader = 0; 00143 } 00144 00145 vapiXMLNextElement (xmlInput); 00146 MacroHeader = 00147 vapiMacroNew ((char *) xmlTextReaderGetAttribute 00148 (xmlInput, BAD_CAST "name")); 00149 /* 00150 * Entramos nas Operações. 00151 */ 00152 if (vapiXMLNextElement (xmlInput) > 0) 00153 { 00154 if (!strcmp 00155 ((char *) xmlTextReaderLocalName (xmlInput), "Comment")) 00156 { 00157 v_debug ("comentário lido: .%s.", xmlTextReaderReadString 00158 (xmlInput)); 00159 vapiMacroUpdateComment (MacroHeader, 00160 (char *) 00161 xmlTextReaderReadString 00162 (xmlInput)); 00163 v_debug ("comentário lido: .%s.", xmlTextReaderReadString 00164 (xmlInput)); 00165 vapiXMLNextElement (xmlInput); 00166 00167 } 00168 if (strcmp 00169 ((char *) xmlTextReaderLocalName (xmlInput), "Operation")) 00170 { 00171 return MacroHeader = 0; 00172 } 00173 00174 while (ret > 0) 00175 { 00176 00177 tempOperation = 00178 vapiOperationListSelectOperation 00179 (OperationList, (char *) 00180 xmlTextReaderGetAttribute (xmlInput, 00181 BAD_CAST "name")); 00182 v_debug ("operation name: %s", 00183 xmlTextReaderGetAttribute (xmlInput, 00184 BAD_CAST "name")); 00185 00186 tempOptions = 00187 vapiOperationOptionsInit (tempOperation); 00188 00189 vapiOptionsXMLSetOptions (xmlInput, tempOptions, 00190 &vapiOptionsXMLSetOptionsOperation); 00191 00192 vapiMacroAddItem (MacroHeader->Macro, 00193 tempOperation, tempOptions); 00194 ret = vapiXMLNextElement (xmlInput); 00195 00196 vapiOptionsCheck (tempOperation->OptionsSettings, 00197 tempOptions); 00198 00199 vapiCheckOperations (tempOperation, tempOptions, 00200 MacroList); 00201 } 00202 00203 } 00204 00205 00206 //v_info ("Carregada a Macro de xml"); 00207 return MacroHeader; 00208 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
char* vapiMacroFromXMLSetName | ( | const char * | filename | ) |
Get the Name of the Macro from the XML.
filename | The xml filename. |
Definido na linha 211 do ficheiro vapiMacroXML.c.
Referências vapiXMLNextElement().
Referenciado por vapiGtkMacroOpenFromXML(), vapiGtkMacroTestXMLFileOpen(), vapiGtkMacroUpdateMacroName() e vapiMacroXMLLoadToList().
00212 { 00213 00214 xmlTextReader *xmlInput; 00215 00216 xmlInput = xmlReaderForFile (filename, "ISO-8859-1", XML_PARSE_DTDATTR | /* default DTD attributes */ 00217 XML_PARSE_NOENT | /* substitute entities */ 00218 XML_PARSE_DTDVALID); /* validate with the DTD */ 00219 00220 if (xmlInput == NULL) 00221 { 00222 return NULL; 00223 } 00224 if (xmlTextReaderRead (xmlInput) < 0) 00225 { 00226 return NULL; 00227 } 00228 00229 if (!strcmp 00230 ((char *) xmlTextReaderLocalName (xmlInput), "vapiMacro ")) 00231 { 00232 return NULL; 00233 } 00234 00235 vapiXMLNextElement (xmlInput); 00236 return ((char *) 00237 xmlTextReaderGetAttribute (xmlInput, BAD_CAST "name")); 00238 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
void vapiMacroToXML | ( | vMacroHeader * | MacroHeader, | |
const char * | filename | |||
) |
Exports a Macro to XML It will export the Operation Definitions and the options, if different from default.
filename | the name of the xml file to save to. |
Definido na linha 68 do ficheiro vapiMacroXML.c.
Referências _vMacroHeader::Macro, _vEffect::name, _vMacroItem::Operation, _vMacroItem::Options, _vEffect::OptionsSettings, v_info(), vapiMacroCountElements(), vapiMacroSelectItem(), vapiMacroXMLFileInit(), vapiOptionsXMLGetOptions() e vapiOptionsXMLGetOptionsOperation().
Referenciado por vapiGtkMacroSaveToXML().
00069 { 00070 xmlTextWriter *xmlOutput; 00071 int i, OperationNumber; 00072 vMacroItem *Item; 00073 00074 /* 00075 * Criar cabeçalho do Ficheiro XML. 00076 */ 00077 00078 xmlOutput = vapiMacroXMLFileInit (MacroHeader, filename); 00079 00080 /* 00081 * Ir a cada Operação da Macro. 00082 */ 00083 00084 OperationNumber = vapiMacroCountElements (MacroHeader->Macro); 00085 00086 if (!OperationNumber) 00087 { 00088 return; 00089 } 00090 00091 for (i = 0; i < OperationNumber; i++) 00092 { 00093 Item = vapiMacroSelectItem (MacroHeader->Macro, i); 00094 00095 xmlTextWriterStartElement (xmlOutput, BAD_CAST "Operation"); 00096 00097 xmlTextWriterWriteAttribute (xmlOutput, BAD_CAST "name", 00098 BAD_CAST Item->Operation->name); 00099 00100 /* 00101 * Get Options. 00102 */ 00103 vapiOptionsXMLGetOptions (xmlOutput, 00104 Item->Operation->OptionsSettings, 00105 Item->Options, 00106 &vapiOptionsXMLGetOptionsOperation); 00107 00108 00109 xmlTextWriterEndElement (xmlOutput); 00110 00111 } 00112 00113 00114 xmlTextWriterEndDocument (xmlOutput); 00115 00116 xmlFreeTextWriter (xmlOutput); 00117 v_info ("Guardada Macro para xml"); 00118 00119 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
vBoolean vapiMacroXMLLoadToList | ( | vMacroList * | MacroList, | |
vOperationList * | OperationList, | |||
const char * | filename | |||
) |
Loads a Macro directly from file to the MacroList.
Definido na linha 241 do ficheiro vapiMacroXML.c.
Referências MacroList, MacroName, OperationList, vapiMacroFromXML(), vapiMacroFromXMLSetName(), vapiMacroListAddItem(), vapiMacroListMacroExist(), vFALSE e vTRUE.
Referenciado por vapiGtkMacroOpenFromXML() e vapiLoadExampleMacros().
00243 { 00244 char *MacroName; 00245 vMacroHeader *MacroHeader; 00246 00247 MacroName = vapiMacroFromXMLSetName (filename); 00248 00249 if (MacroName == NULL) 00250 { 00251 return vFALSE; 00252 } 00253 00254 if (vapiMacroListMacroExist (MacroList, MacroName, 1) == -1) 00255 { 00256 return vFALSE; 00257 } 00258 00259 MacroHeader = vapiMacroFromXML (filename, OperationList, MacroList); 00260 00261 vapiMacroListAddItem (MacroList, MacroHeader); 00262 00263 return vTRUE; 00264 00265 }
Grafo de chamadas desta função:
Here is the caller graph for this function: