00001 #if !defined(_LANGLOADSTREAMER_HPP) 00002 #define _LANGLOADSTREAMER_HPP 00003 //============================================================================= 00004 // 00005 // XDFLengine library 00006 // 00007 //----------------------------------------------------------------------------- 00008 // LANGLOADSTREAMER.HPP 00009 //----------------------------------------------------------------------------- 00015 //_____________________________________________________________________________ 00016 // 00017 // Copyright (C) 2003 Guillaume Baurand. All Rights Reserved. 00018 // 00019 // This file is part of the XDFLengine project. 00020 // 00021 // The XDFLengine is free software; you can redistribute it and/or modify 00022 // it under the terms of the GNU General Public License as published by 00023 // the Free Software Foundation; either version 2 of the License, or 00024 // (at your option) any later version. 00025 // 00026 // This program is distributed in the hope that it will be useful, 00027 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00028 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00029 // GNU General Public License for more details. 00030 // 00031 // You should have received a copy of the GNU General Public License 00032 // along with this program; if not, write to the Free Software 00033 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00034 // USA. 00035 // 00036 // For more information, 00037 // contact : guillaume@baurand.net 00038 // or visit : http://xdflengine.sourceforge.net 00039 // 00040 //============================================================================= 00041 00042 # include "config/commonincs.hpp" 00043 # include "processor/xmlstreamerfactory.hpp" 00044 00045 BEGIN_XDFLENGINE_NS 00046 00047 class XMLProcessor; 00048 00049 typedef VAarray < char*> VAdictionnary; 00050 typedef VAarray < VAdictionnary* > VAlangPack; 00051 00052 //============================================================================= 00053 // CLASS VALUESFACTORY 00054 //----------------------------------------------------------------------------- 00056 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00057 class XDFLENGINE_EXPORT LangLoadStreamerFactory:public XMLStreamerFactory 00058 { 00059 VAarray< VAlangPack* > m_vaLangPacks; 00060 char* m_pszCurDictionnary; 00061 char* m_pszCurLangPack; 00062 VAdictionnary* m_pCurDictionnary; 00063 VAlangPack* m_pCurLangPack; 00064 00065 00066 public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00067 00068 //_____________________________________________________________________ 00069 // LangLoadStreamerFactory 00070 //--------------------------------------------------------------------- 00071 LangLoadStreamerFactory(); 00072 00073 //_____________________________________________________________________ 00074 // LangLoadStreamerFactory 00075 //--------------------------------------------------------------------- 00076 virtual ~LangLoadStreamerFactory(); 00077 00078 //_____________________________________________________________________ 00079 // GETSTREAMER 00080 //--------------------------------------------------------------------- 00081 XMLStreamer* getStreamer(StreamerParams* p_pParameters, XMLFlowContext* p_pStreamContext, XMLStreamConsumer* p_pStreamConsumer) const; 00082 00083 00084 //_____________________________________________________________________ 00085 // setDictionnaryEntry 00086 //--------------------------------------------------------------------- 00087 void setDictionnaryEntry( const char* p_pszLangCode, const char* p_pszDicName, const char* p_pszKey, char* p_pszWord); 00088 00089 //_____________________________________________________________________ 00090 // getDictionnaryEntry 00091 //--------------------------------------------------------------------- 00092 const char* getDictionnaryEntry( const char* p_pszLangCode, const char* p_pszDicName, const char* p_pszKey) const; 00093 00094 00095 }; 00096 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00097 //============================================================================= 00098 00099 00100 00101 00102 //============================================================================= 00103 // CLASS SAXLangHandler 00104 //----------------------------------------------------------------------------- 00106 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00107 class XDFLENGINE_EXPORT SAXLangHandler : public ContentHandler 00108 { 00109 00110 private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00111 00112 LangLoadStreamerFactory* m_pParent; 00113 XMLFlowContext* m_pContext; 00114 VAarray<char*> m_vaValues; 00115 unsigned int m_intCurLevel; 00116 char* m_pszCurDictionnary; 00117 char* m_pszCurLangPack; 00118 00119 public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00120 00121 00122 // CONSTRUCTOR & DESTRUCTOR 00123 00124 //_____________________________________________________________________ 00125 // SAXVALUESHANDLER 00126 //--------------------------------------------------------------------- 00128 //_____________________________________________________________________ 00129 SAXLangHandler(StreamerParams* p_pParameters, XMLFlowContext* p_pContext, const LangLoadStreamerFactory* p_pParent); 00130 00131 00132 //_____________________________________________________________________ 00133 // ~SAXVALUESHANDLER 00134 //--------------------------------------------------------------------- 00136 //_____________________________________________________________________ 00137 ~SAXLangHandler(); 00138 00139 // CONTENTHANDLER 00140 00141 //____________________________________________________________________ 00142 // STARTELEMENT 00143 //-------------------------------------------------------------------- 00150 //_____________________________________________________________________ 00151 void startElement( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs); 00152 00153 //____________________________________________________________________ 00154 // CHARACTERS 00155 //-------------------------------------------------------------------- 00160 //_____________________________________________________________________ 00161 void characters( const XMLCh* const chars, const unsigned int length); 00162 00163 //____________________________________________________________________ 00164 // ENDELEMENT 00165 //-------------------------------------------------------------------- 00171 //_____________________________________________________________________ 00172 void endElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname); 00173 00174 // Not implemented 00175 void startDocument (){}; 00176 void endDocument (){}; 00177 void startPrefixMapping ( const XMLCh* const prefix,const XMLCh* const uri){}; 00178 void endPrefixMapping ( const XMLCh* const prefix){}; 00179 void processingInstruction ( const XMLCh* const target, const XMLCh* const data){}; 00180 void ignorableWhitespace ( const XMLCh* const chars, const unsigned int length){}; 00181 void setDocumentLocator ( const Locator* const locator) {}; 00182 void skippedEntity ( const XMLCh* const name){}; 00183 00184 }; 00185 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00186 //============================================================================= 00187 00188 END_XDFLENGINE_NS 00189 00190 #endif 00191