Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

descriptor/src/XmlReader.h

00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: GPL 2.0
00004  *
00005  * K-10 Distributed Processing - Lium, Le Mans
00006  * Copyright (C) 2006 Frederic POUHET
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021  *
00022  * ***** END LICENSE BLOCK ***** */
00023  
00024 #ifndef XMLREADER_H
00025 #define XMLREADER_H
00026 
00027 #include "Task.h"
00028 #include "parsifal.h"
00029 
00030 
00031 int StartElement(void *UserData, const XMLCH *uri, const XMLCH *localName, const XMLCH *qName, LPXMLVECTOR atts);
00032 int EndElement(void *UserData, const XMLCH *uri, const XMLCH *localName, const XMLCH *qName);
00033 int Characters(void *UserData, const XMLCH *Chars, int cbChars);
00034 void ErrorHandler(LPXMLPARSER parser);
00035 int cstream(BYTE *buf, int cBytes, int *cBytesActual, void *inputData);
00036 
00037 #define STACK_PUSH(stack,item) (XMLVector_Append((stack), (item)))
00038 #define STACK_PEEK(stack) (XMLVector_Get((stack),(stack)->length-1))
00039 #define STACK_REMOVE(stack) (XMLVector_Remove((stack), (stack)->length-1))
00040 #define STACK_POP(stack,item) \
00041 ( ((stack)->length) ? (memcpy((item), STACK_PEEK((stack)), (stack)->itemSize), \
00042 STACK_REMOVE((stack)), (item)) : NULL)
00043 
00044 #define ASSERT_MEM_ABORT(p) if (!(p)) { printf("Out of memory! Line: %d\n", __LINE__); return XML_ABORT; }
00045 
00046 
00047 /*
00048  * @enum STATES enumerate all the different states of the xml
00049  */
00050 enum tagSTATES { 
00051         NONE, 
00052         DESCRIPTOR, 
00053         GEN_INFO,
00054                 GEN_INFO_UID,
00055                 GEN_INFO_CREATION_DATE,
00056                 GEN_INFO_EXPIRATION,
00057                 GEN_INFO_PRIORITY,
00058                 GEN_INFO_TASK_NAME,
00059                 GEN_INFO_USER_NAME,
00060                 GEN_INFO_USER_MAIL,
00061         TARGET_FILTERS,
00062                 TARGET_FILTER,
00063                         TARGET_FILTER_TYPE,
00064                         TARGET_FILTER_OPERATOR,
00065                         TARGET_FILTER_VALUE,
00066         TASK_INFO,
00067                 BIN,
00068                         BIN_SOURCE_PATH,
00069                         BIN_COMMAND,
00070                 DATAS,
00071                         DATA,
00072                                 DATA_SHARED,
00073                                 DATA_SOURCE_PATH,
00074                                 DATA_LOCAL_PATH,
00075                 RESULT,
00076                         RESULT_LOCAL_PATH,
00077                         RESULT_STORAGE_PATH
00078 } STATES;
00079 
00080 /*
00081  * @struct K10PARSER Contains :
00082  *              paser parsifal paser
00083  *              ...
00084  *              curDesc pointer to a Descriptor instance which has to be initialize
00085  *      curDataInfo pointer to a DataInfo instance used to initialize the descriptors data menbres 
00086  */
00087 typedef struct tagK10PARSER {
00088         LPXMLPARSER parser;
00089         XMLSTRINGBUF textBuf;
00090         LPXMLVECTOR stateStack;
00091         int state;
00092         int inContent;
00093         int inMixedContent;
00094 
00095         Task *curDesc;
00096         TaskDataInfo *curDataInfo;      
00097         TaskFilterInfo *curFilterInfo;  
00098 } K10PARSER;
00099 
00100 
00101 #endif

Generated on Fri May 19 23:12:36 2006 for common by  doxygen 1.4.4