Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

langvaluer.cpp

Go to the documentation of this file.
00001 //============================================================================= 
00002 //
00003 // XDFLengine library
00004 //
00005 //-----------------------------------------------------------------------------
00006 //  LANGVALUER.CPP
00007 //-----------------------------------------------------------------------------
00013 //_____________________________________________________________________________
00014 //
00015 //  Copyright (C) 2003 Guillaume Baurand. All Rights Reserved.
00016 //
00017 //  This file is part of the XDFLengine project.
00018 //
00019 //  The XDFLengine is free software; you can redistribute it and/or modify
00020 //  it under the terms of the GNU General Public License as published by
00021 //  the Free Software Foundation; either version 2 of the License, or
00022 //  (at your option) any later version.
00023 //
00024 //  This program is distributed in the hope that it will be useful,
00025 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027 //  GNU General Public License for more details.
00028 //
00029 //  You should have received a copy of the GNU General Public License
00030 //  along with this program; if not, write to the Free Software
00031 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00032 //  USA.
00033 //
00034 //  For more information, 
00035 //      contact  : guillaume@baurand.net 
00036 //      or visit : http://xdflengine.sourceforge.net
00037 //
00038 //============================================================================= 
00039 
00040 #   include "langvaluer.hpp"
00041 #   include "processor/xmlprocessor.hpp"
00042 #   include "processor/xmlflowcontext.hpp"
00043 #   include "streamers/multilang/langloadstreamer.hpp"
00044 
00045 BEGIN_XDFLENGINE_NS
00046 
00047 //=============================================================================
00048 //  CLASS LANGVALUER
00049 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00050 
00051     //_________________________________________________________________________
00052     //  LANGVALUER
00053     //-------------------------------------------------------------------------
00054     LangValuer::LangValuer(XMLFlowContext* p_pStreamContext)
00055     {   
00056         m_pszLangCode = 0;
00057         m_pStreamContext=p_pStreamContext;
00058         m_LangLoader= (LangLoadStreamerFactory*) p_pStreamContext->getProcessor()->getStreamerFactory(LANGLOADSTREAMER_TAGNAME);
00059         DEBUG_CREATE(LangValuer::setParent)
00060     }
00061 
00062     //_________________________________________________________________________
00063     //  ~LANGVALUER
00064     //-------------------------------------------------------------------------
00065     LangValuer::~LangValuer()
00066     {
00067         m_pszLangCode = releaseCharBuffer( m_pszLangCode);
00068         DEBUG_DEL(LangValuer::setParent)
00069     }
00070 
00071     //_________________________________________________________________________
00072     //  CALCULATEEXPRESSION
00073     //-------------------------------------------------------------------------
00074     char* LangValuer::calculateExpression(const char* p_pszExpression)
00075     {   
00076         char*   l_pszDictionnary=0;
00077         char*   l_pszKey=0;
00078         const char* l_pszWord;
00079 
00080         DEBUG_FUNC(LangValuer::calculateExpression)
00081 
00082         l_pszDictionnary = copyCharBuffer( p_pszExpression);
00083         l_pszKey = strstr( l_pszDictionnary, LANGLOADSTREAMER_VALSEP);
00084         if(!l_pszKey) return copyCharBuffer("");
00085         l_pszKey[0]='\0';
00086         l_pszKey++;
00087 
00088         l_pszWord = m_LangLoader->getDictionnaryEntry(m_pszLangCode,l_pszDictionnary,l_pszKey);
00089         l_pszDictionnary = releaseCharBuffer(l_pszDictionnary);
00090         return copyCharBuffer( l_pszWord);
00091     }
00092 
00093 
00094     //_____________________________________________________________________
00095     //  SETLANGCODE
00096     //---------------------------------------------------------------------
00097     void LangValuer::setLangCode( const char* p_pszLangCode)
00098     {
00099         m_pszLangCode = importCharBuffer(m_pszLangCode, p_pszLangCode);
00100     }
00101 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00102 //=============================================================================
00103 
00104 END_XDFLENGINE_NS
00105 

Generated on Sat Oct 4 13:19:59 2003 for XDFLengine by doxygen1.3-rc2