System documentation of the GNU Image-Finding Tool

CI18nTranslator.h
1 // -*- mode: c++ -*-
2 #ifndef _CI18NTRANSLATOR
3 #define _CI18NTRANSLATOR
4 /* -*- mode: c++ -*-
5 */
6 /*
7 
8  GIFT, a flexible content based image retrieval system.
9  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
10 
11  Copyright (C) 2003, 2004 Bayreuth University
12  2005 Bamberg University
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 
27 */
28 #include <map>
29 #include <string>
30 #include "libMRML/include/CXMLElement.h"
31 #include <expat.h>
32 //#include "expat/xmlparse/xmlparse.h"
40  typedef map<string,string> CTranslatorMap;
43  typedef map<string,bool> CShouldBeTranslatedMap;
45  typedef map<string,CTranslatorMap> CLanguageMap;
46 
51  CLanguageMap mLanguageMap;
55  CShouldBeTranslatedMap mShouldBeTranslatedAttribute;
59  string mCurrentLanguage;
60 
61 
62 protected:
63 public:
65  bool shouldBeTranslatedAttribute(string inAttribute)const;
67  bool shouldBeTranslatedText(string inContainingTag)const;
69  void setCurrentLanguage(const string& inLanguage);
71  string getCurrentLanguage()const;
73  void setShouldBeTranslatedAttribute(string inString);
75  void addTranslationPair(string inString,string inTranslatedString);
76 
78  CI18nTranslator(string inTranslationFileName);
80  const CXMLElement* getLanguagesXML()const;
82  bool hasLanguage(string inLanguageCode)const;
87  const pair<bool,string> translateAttribute(string inLanguageCode,
88  const string& inAttribute,
89  const string& inValue)const;
94  const pair<bool,string> translateText(string inLanguageCode,
95  const string& inContainingTag,
96  const string& inText);
98  void translateXMLTree(string inLanguageCode,
99  CXMLElement& inoutToBeTranslated)const;
101  static void startXMLElement(void *inUserData,
102  const char *inElementName,
103  const char **inAttributes);
105  static void endXMLElement(void *inUserData,
106  const char *inElementName);
107 };
108 #endif

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen