src/vapiOperationXML.c

Ir para a documentação deste ficheiro.
00001 #include <libxml/encoding.h>
00002 #include <libxml/xmlreader.h>
00003 #include <libxml/xmlwriter.h>
00004 #include "vapiOptions.h"
00005 #include "vapiOperation.h"
00006 #include "vapiXML.h"
00007 #include "vapiOptionsXML.h"
00008 
00009 void
00010 vapiOptionsXMLGetOptionsOperation (xmlTextWriter * xmlOutput,
00011                                    vOptionsSettings * OptionsSettings,
00012                                    vOptions * Options)
00013 {
00014         if (((vEffectOptions *) Options->CustomOptions)->times > 1)
00015         {
00016                 xmlTextWriterStartElement (xmlOutput, BAD_CAST "option");
00017 
00018                 xmlTextWriterWriteAttribute (xmlOutput, BAD_CAST "type",
00019                                              BAD_CAST "times");
00020                 xmlTextWriterWriteFormatString (xmlOutput, "%d",
00021                                                 ((vEffectOptions *)
00022                                                  Options->CustomOptions)->
00023                                                 times);
00024 
00025                 xmlTextWriterEndElement (xmlOutput);
00026         }
00027 
00028 
00029         if (((vEffectOptions *) Options->CustomOptions)->original)
00030         {
00031                 xmlTextWriterStartElement (xmlOutput, BAD_CAST "option");
00032                 xmlTextWriterWriteAttribute (xmlOutput, BAD_CAST "type",
00033                                              BAD_CAST "original");
00034                 xmlTextWriterWriteString (xmlOutput, BAD_CAST "vTRUE");
00035                 xmlTextWriterEndElement (xmlOutput);
00036         }
00037 }
00038 
00039 int
00040 vapiOptionsXMLSetOptionsOperation (xmlTextReader * xmlInput,
00041                                    vOptions * Options)
00042 {
00043         int ret=1, bk=1;
00044         if (strcmp
00045             ((char *)
00046              xmlTextReaderGetAttribute (xmlInput, BAD_CAST "type"),
00047              "times") == 0)
00048         {
00049                 xmlTextReaderRead (xmlInput);
00050                 v_debug ("node times: %d.",
00051                          atoi ((char *) xmlTextReaderValue (xmlInput)));
00052                 ((vEffectOptions *) Options->CustomOptions)->
00053                         times = atoi ((char *) xmlTextReaderValue (xmlInput));
00054                 ret = vapiXMLNextElementNamed (xmlInput, "option");
00055         }
00056 
00057         bk = vapiOptionsXMLCheckOption (xmlInput, ret);
00058 
00059         if (bk == 0 || bk == -1)
00060         {
00061                 return bk;
00062         }
00063         if (strcmp
00064             ((char *)
00065              xmlTextReaderGetAttribute (xmlInput, BAD_CAST "type"),
00066              "original") == 0)
00067         {
00068                 xmlTextReaderRead (xmlInput);
00069                 v_debug ("original: %s", xmlTextReaderValue (xmlInput));
00070                 if (!strcmp ((char *) xmlTextReaderValue (xmlInput), "vTRUE"))
00071                 {
00072                         ((vEffectOptions *) Options->
00073                          CustomOptions)->original = vTRUE;
00074                 }
00075                 else
00076                 {
00077                         ((vEffectOptions *) Options->
00078                          CustomOptions)->original = vFALSE;
00079                 }
00080                 ret = vapiXMLNextElementNamed (xmlInput, "option");
00081         }
00082         bk = vapiOptionsXMLCheckOption (xmlInput, ret);
00083 
00084         return bk;
00085 }

Gerado em Tue Jul 24 10:34:59 2007 para Vapi por  doxygen 1.5.1