/*
 * 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: Character.h,v 1.15 2003/02/19 08:33:02 florian Exp $
 */

#ifndef INCLUDE_JAKELIB2_LANG_CHARACTER_H
# define INCLUDE_JAKELIB2_LANG_CHARACTER_H

namespace jakelib {
  namespace lang {

    /**
     * @brief Wrapper class for the primitive char data type.
     *
     * In addition,
     * this class allows one to retrieve property information and
     * perform transformations on the 38,000+ characters in the
     * Unicode Standard, Version 2.  java.lang.Character is designed 
     * to be very dynamic, and as such, it retrieves information on
     * the Unicode character set from a separate database, which
     * can be easily upgraded.<br>
     * <br>
     * For predicates, boundaries are used to describe
     * the set of characters for which the method will return true.
     * This syntax uses fairly normal regular expression notation.
     * See 5.13 of the Unicode Standard, Version 2.0, for the
     * boundary specification.<br>
     * <br>
     * See http://www.unicode.org for more information on the Unicode Standard.
     *
     * @class Character
     * @version $Id: Character.h,v 1.15 2003/02/19 08:33:02 florian Exp $
     * @author Florian 'Overflo' Wolff (florian@donuz.de)
     */
    class Character : public Object, Comparable
      {
      protected:
	/** @brief The immutable value of this Character. */
	jchar value;

      public:
      Character(jchar c);
	/**
	 * @brief Compares an object to this Character.  Assuming the object is a
	 * Character object, this method performs the same comparison as
	 * compareTo(Character).
	 *
	 * @param obj object to compare
	 *
	 * @return a negative integer if this Character is less than o,
	 * zero if this Character is equal to o, or a positive integer if this
	 * Character is greater than o
	 */
	jint compareTo(Object* obj);

	/**
	 * @brief Compares another Character to this Character, numerically.
	 *
	 * @param anotherCharacter Character to compare with this Character
	 *
	 * @return a negative integer if this Character is less than
	 * anotherCharacter, zero if this Character is equal to anotherCharacter, or
	 * a positive integer if this Character is greater than anotherCharacter
	 */
	jint compareTo(Character* anotherCharacter);

	/**
	 * @brief Converts a Unicode character into its uppercase equivalent mapping.
	 * If a mapping does not exist, then the character passed is returned.
	 *
	 * @param ch character to convert to uppercase
	 *
	 * @return uppercase mapping of ch, or ch if uppercase mapping does
	 * not exist.
	 */
	static jchar toUpperCase(jchar ch);

	/**
	 * @brief Converts a Unicode character into its lowercase equivalent mapping.
	 * If a mapping does not exist, then the character passed is returned.
	 *
	 * @param ch character to convert to lowercase
	 *
	 * @return lowercase mapping of ch, or ch if lowercase mapping does
	 * not exist.
	 */
	static jchar toLowerCase(jchar ch);

    static jboolean isLetter(jchar ch);

	/**
	 * @brief Smallest value allowed for radix arguments in Java.
	 * This value is 2.
	 */
	static const int MIN_RADIX;

	/**
	 * @brief Largest value allowed for radix arguments in Java.
	 * This value is 36.
	 */
	static const int MAX_RADIX;

	/**
	 * @brief The maximum value the char data type can hold.
	 * This value is \c U+FFFF.
	 */
	static const jchar MAX_VALUE;

	/**
	 * @brief The minimum value the char data type can hold.
	 * This value is \c U+0000.
	 */
	static const jchar MIN_VALUE;

	JAKELIB_DECLARE_CLASS(Character);
      };

    JAKELIB_DECLARE_ARRAY(Character);
  }
}
#endif

