// ---------------------------------------------------------------------------
// - Encoding.hpp                                                            -
// - standard object library - encoding system class definition              -
// ---------------------------------------------------------------------------
// - This program is free software;  you can redistribute it  and/or  modify -
// - it provided that this copyright notice is kept intact.                  -
// -                                                                         -
// - This program  is  distributed in  the hope  that it will be useful, but -
// - without  any  warranty;  without  even   the   implied    warranty   of -
// - merchantability or fitness for a particular purpose.  In no event shall -
// - the copyright holder be liable for any  direct, indirect, incidental or -
// - special damages arising in any way out of the use of this software.     -
// ---------------------------------------------------------------------------
// - copyright (c) 1999-2011 amaury darsch                                   -
// ---------------------------------------------------------------------------

#ifndef  AFNIX_ENCODING_HPP
#define  AFNIX_ENCODING_HPP

#ifndef  AFNIX_STRING_HPP
#include "String.hpp"
#endif

namespace afnix {

  /// The encoding class is a collection of definitions and convenient
  /// functions used by the standard library to manage the various
  /// encoding system available on earth and accepted by the afnix 
  /// platform. The two natural encoding is the byte mode which acts as
  /// a plain mode for the stream reader and the utf encoding that serves
  /// the unicode decoder.
  /// @author amaury darsch

  class Encoding {
  public:
    /// the encoding modes
    enum t_emod {
      BYTE, // byte  encoding mode
      UTF8  // utf-8 encoding mode
    };

    /// the trancoding mode
    enum t_tmod {
      DEFAULT,  // transparent  transcoding
      I8859_01, // ISO-88559-01 transcoding
      I8859_02, // ISO-88559-02 transcoding
      I8859_03, // ISO-88559-03 transcoding
      I8859_04, // ISO-88559-04 transcoding
      I8859_05, // ISO-88559-05 transcoding
      I8859_06, // ISO-88559-06 transcoding
      I8859_07, // ISO-88559-07 transcoding
      I8859_08, // ISO-88559-08 transcoding
      I8859_09, // ISO-88559-09 transcoding
      I8859_10, // ISO-88559-10 transcoding
      I8859_11, // ISO-88559-11 transcoding
      I8859_13, // ISO-88559-13 transcoding
      I8859_14, // ISO-88559-14 transcoding
      I8859_15, // ISO-88559-15 transcoding
      I8859_16  // ISO-88559-16 transcoding
    };

  public:
    /// get the encoding mode by name
    /// @param mode the mode to map
    static t_emod toemod (const String& mode);

    /// get the transcoding mode by name
    /// @param mode the mode to map
    static t_tmod totmod (const String& mode);

    /// @return the system encoding mode
    static t_emod getsem (void);

    /// @return the system transcoding mode
    static t_tmod getstm (void);

    /// @return the default encoding mode
    static String getdem (void);

    /// @return the natural encoding mode
    static String getnem (void);
  };
}

#endif
