// -*- c++ -*-

/*
 * Jakelib2 - General purpose C++ library
 * Copyright (C) 2001 Florian Wolff  (florian@donuz.de)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: DecimalFormatSyms.h,v 1.8 2003/09/16 20:16:24 florian Exp $
 */

#ifndef INCLUDE_JAKELIB2_TEXT_DECIMALFORMATSYMBOLS_H
# define INCLUDE_JAKELIB2_TEXT_DECIMALFORMATSYMBOLS_H

#include "../lang/Object.h"
#include "../util/Locale.h"

namespace jakelib {
  namespace util {
    class Locale;
    class ResourceBundle;
  }

  namespace text  {
    /**
     * @author Alex Fabijanic (FabijanicA@nucorsteel.com)(jakelib port)
     */
    class DecimalFormatSyms : public jakelib::lang::Object
    {
    public:

      /**
       * This method initializes a new instance of
       * \c DecimalFormatSyms for the default locale.
       */
      DecimalFormatSyms();

      /**
       * This method initializes a new instance of
       * \c DecimalFormatSyms for the specified locale.
       *
       * @param loc The local to load symbols for.
       */
      DecimalFormatSyms(jakelib::util::Locale* loc);

      /**
       * This method checks this object for equality against the specified object.
       * This will be \c true if and only if the following criteria are met with
       * regard to the specified object:
       *
       * \li It is not \c null.
       * \li It is an instance of \c DecimalFormatSyms
       * \li All of its symbols are identical to the symbols in this object.
       *
       * @return \c true if the specified object is equal to this
       *         object, \c false otherwise.
       */
      jboolean equals (jakelib::lang::Object* obj);

      /**
       * This method returns the currency symbol in local format.  For example,
       * \c "$" for Canadian dollars.
       *
       * @return The currency symbol in local format.
       */
      jakelib::lang::String* getCurrencySymbol();

      /**
       * This method returns the character used as the decimal point.
       *
       * @return The character used as the decimal point.
       */
      jchar getDecimalSeparator();

      /**
       * This method returns the character used to represent a digit in a
       * format pattern string.
       *
       * @return The character used to represent a digit in a format pattern string. 
       */
      jchar getDigit();

      // This is our own extension.
      jchar getExponential();

      /**
       * This method sets the character used to separate groups of digits.  For
       * example, the United States uses a comma (,) to separate thousands in
       * a number.
       *
       * @return The character used to separate groups of digits.
       */
      jchar getGroupingSeparator();

      /**
       * This method returns the character used to represent infinity.
       *
       * @return The character used to represent infinity.
       */
      jakelib::lang::String* getInfinity();

      /**
       * This method returns the currency symbol in international format.  For
       * example, "C$" for Canadian dollars.
       *
       * @return The currency symbol in international format.
       */
      jakelib::lang::String* getInternationalCurrencySymbol();

      /**
       * This method returns the character used to represent the minus sign.
       *
       * @return The character used to represent the minus sign.
       */
      jchar getMinusSign();

      /**
       * This method returns the character used to represent the decimal
       * point for currency values.
       *
       * @return The decimal point character used in currency values.
       */
      jchar getMonetaryDecimalSeparator();

      /**
       * This method returns the string used to represent the NaN (not a number)
       * value.
       *
       * @return The string used to represent NaN
       */
      jakelib::lang::String* getNaN();

      /**
       * This method returns the character used to separate positive and negative
       * subpatterns in a format pattern.
       *
       * @return The character used to separate positive and negative subpatterns
       * in a format pattern.
       */
      jchar getPatternSeparator();

      /**
       * This method returns the character used as the percent sign.
       *
       * @return The character used as the percent sign.
       */
      jchar getPercent();

      /**
       * This method returns the character used as the per mille character.
       *
       * @return The per mille character.
       */
      jchar getPerMill();

      /**
       * This method returns the character used to represent the digit zero.
       *
       * @return The character used to represent the digit zero.
       */
      jchar getZeroDigit();

      /**
       * This method returns a hash value for this object.
       *
       * @return A hash value for this object.
       */
      jint hashCode();

      /**
       * This method sets the currency symbol to the specified value.
       *
       * @param currencySymbol The new currency symbol
       */
      void setCurrencySymbol(jakelib::lang::String *currencySymbol);

      /**
       * This method sets the decimal point character to the specified value.
       *
       * @param decimalSep The new decimal point character
       */
      void setDecimalSeparator(jchar decimalSep);

      /**
       * This method sets the character used to represents a digit in a format
       * string to the specified value.
       *
       * @param digit The character used to represent a digit in a format pattern.
       */
      void setDigit(jchar digit);

      void setExponential(jchar exp);

      /**
       * This method sets the character used to separate groups of digits.
       *
       * @param groupSep The character used to separate groups of digits.
       */
      void setGroupingSeparator(jchar groupSep);

      /**
       * This method sets the string used to represents infinity.
       *
       * @param infinity The string used to represent infinity.
       */
      void setInfinity(jakelib::lang::String* infinity);

      /**
       * This method sets the international currency symbols to the
       * specified value. 
       *
       * @param intlCurrencySymbol The new international currency symbol.
       */
      void setInternationalCurrencySymbol(jakelib::lang::String *intlCurrencySymbol);

      /**
       * This method sets the character used to represent the minus sign.
       *
       * @param minusSign The character used to represent the minus sign.
       */
      void setMinusSign(jchar minusSign);

      /**
       * This method sets the character used for the decimal point in currency
       * values.
       *
       * @param monetarySeparator The decimal point character used in
       *                          currency values. 
       */
      void setMonetaryDecimalSeparator(jchar monetarySeparator);

      /**
       * This method sets the string used to represent the NaN (not a
       * number) value. 
       *
       * @param nan The string used to represent NaN
       */
      void setNaN(jakelib::lang::String* nan);

      /**
       * This method sets the character used to separate positive and negative
       * subpatterns in a format pattern.
       *
       * @param patternSep The character used to separate positive and
       *                   negative subpatterns in a format pattern.
       */
      void setPatternSeparator(jchar patternSep);

      /**
       * This method sets the character used as the percent sign.
       *
       * @param percent  The character used as the percent sign.
       */
      void setPercent(jchar percent);

      /**
       * This method sets the character used as the per mille character.
       *
       * @param perMill The per mille character.
       */
      void setPerMill(jchar perMill);

      /**
       * This method sets the character used to represent the digit zero.
       *
       * @param zeroDigit The character used to represent the digit zero.
       */
      void setZeroDigit(jchar zeroDigit);

    private:

      /**
       * A string used for the local currency
       */
      jakelib::lang::String* currencySymbol;

      void init(jakelib::util::Locale* loc);

      /**
       * The \c jchar used to separate decimals in a number.
       */
      jchar decimalSeparator;

      /**
       * This is the \c jchar used to represent a digit in
       * a format specification.
       */
      jchar digit;

      /**
       * This is the \c jchar used to represent the exponent
       * separator in exponential notation.
       */
      jchar exponential;

      /**
       * This separates groups of thousands in numbers.
       */
      jchar groupingSeparator;

      /**
       * This string represents infinity.
       */
      jakelib::lang::String* infinity;

      /**
       * This string represents the local currency in an international
       * context, eg, "C$" for Canadian dollars.
       */
      jakelib::lang::String* intlCurrencySymbol;

      /**
       * This is the character used to represent the minus sign.
       */
      jchar minusSign;

      /**
       * This character is used to separate decimals when formatting
       * currency values.
       */
      jchar monetarySeparator;

      /**
       * This string is used the represent the Java NaN value for
       * "not a number".
       */
      jakelib::lang::String* NaN;

      /**
       * This is the character used to separate positive and negative
       * subpatterns in a format pattern.
       */
      jchar patternSeparator;

      /**
       * This is the percent symbols
       */
      jchar percent;

      /**
       * This character is used for the mille percent sign.
       */
      jchar perMill;
  
      /**
       * This is the character used to represent 0.
       */
      jchar zeroDigit;

      JAKELIB_DECLARE_CLASS(DecimalFormatSyms);
    };
  }
}

#endif
