[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/support/lupdate-ezpublish3/ -> metatranslator.h (source)

   1  /**********************************************************************
   2  **   Copyright (C) 2000 Trolltech AS.  All rights reserved.
   3  **
   4  **   metatranslator.h
   5  **
   6  **   This file is part of Qt Linguist.
   7  **
   8  **   See the file LICENSE included in the distribution for the usage
   9  **   and distribution terms.
  10  **
  11  **   The file is provided AS IS with NO WARRANTY OF ANY KIND,
  12  **   INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
  13  **   A PARTICULAR PURPOSE.
  14  **
  15  **********************************************************************/
  16  
  17  #ifndef METATRANSLATOR_H
  18  #define METATRANSLATOR_H
  19  
  20  #include <qmap.h>
  21  #include <qstring.h>
  22  #include <qtranslator.h>
  23  #include <qvaluelist.h>
  24  
  25  class QTextCodec;
  26  
  27  class MetaTranslatorMessage : public QTranslatorMessage
  28  {
  29  public:
  30      enum Type { Unfinished, Finished, Obsolete };
  31  
  32      MetaTranslatorMessage();
  33      MetaTranslatorMessage( const char *context, const char *sourceText,
  34                 const char *comment,
  35                 const QString& translation = QString::null,
  36                 bool utf8 = FALSE, Type type = Unfinished );
  37      MetaTranslatorMessage( const MetaTranslatorMessage& m );
  38  
  39      MetaTranslatorMessage& operator=( const MetaTranslatorMessage& m );
  40  
  41      void setType( Type nt ) { ty = nt; }
  42      Type type() const { return ty; }
  43      bool utf8() const { return utfeight; }
  44  
  45      bool operator==( const MetaTranslatorMessage& m ) const;
  46      bool operator!=( const MetaTranslatorMessage& m ) const
  47      { return !operator==( m ); }
  48      bool operator<( const MetaTranslatorMessage& m ) const;
  49      bool operator<=( const MetaTranslatorMessage& m )
  50      { return !operator>( m ); }
  51      bool operator>( const MetaTranslatorMessage& m ) const
  52      { return this->operator<( m ); }
  53      bool operator>=( const MetaTranslatorMessage& m ) const
  54      { return !operator<( m ); }
  55  
  56  private:
  57      bool utfeight;
  58      Type ty;
  59  };
  60  
  61  class MetaTranslator
  62  {
  63  public:
  64      MetaTranslator();
  65      MetaTranslator( const MetaTranslator& tor );
  66  
  67      MetaTranslator& operator=( const MetaTranslator& tor );
  68  
  69      bool load( const QString& filename );
  70      bool save( const QString& filename ) const;
  71      bool release( const QString& filename, bool verbose = FALSE ) const;
  72  
  73      bool contains( const char *context, const char *sourceText,
  74             const char *comment ) const;
  75      void insert( const MetaTranslatorMessage& m );
  76  
  77      void stripObsoleteMessages();
  78      void stripEmptyContexts();
  79  
  80      void setCodec( const char *name );
  81      QString toUnicode( const char *str, bool utf8 ) const;
  82  
  83      QValueList<MetaTranslatorMessage> messages() const;
  84      QValueList<MetaTranslatorMessage> translatedMessages() const;
  85  
  86  private:
  87      typedef QMap<MetaTranslatorMessage, int> TMM;
  88      typedef QMap<int, MetaTranslatorMessage> TMMInv;
  89  
  90      TMM mm;
  91      QCString codecName;
  92      QTextCodec *codec;
  93  };
  94  
  95  #endif


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7