00001 /* 00002 * Character16.hpp 00003 * 00004 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_CHARACTER16_HPP 00017 #define COH_CHARACTER16_HPP 00018 00019 #include "coherence/lang/compatibility.hpp" 00020 00021 #include "coherence/lang/Primitive.hpp" 00022 #include "coherence/lang/TypedHandle.hpp" 00023 00024 COH_OPEN_NAMESPACE2(coherence,lang) 00025 00026 00027 /** 00028 * An immutable 16-bit Unicode character value. 00029 * 00030 * @author jh 2008.04.01 00031 */ 00032 class COH_EXPORT Character16 00033 : public cloneable_spec<Character16, 00034 extends<Primitive<char16_t> >, 00035 implements<Comparable> > 00036 { 00037 friend class factory<Character16>; 00038 00039 // ----- constructors --------------------------------------------------- 00040 00041 private: 00042 /** 00043 * Create a new Character16 instance. 00044 * 00045 * @param ch the value of the new Character16 00046 */ 00047 Character16(char16_t ch); 00048 00049 /** 00050 * Copy constructor. 00051 */ 00052 Character16(const Character16&); 00053 00054 00055 // ----- Character16 interface ------------------------------------------ 00056 00057 public: 00058 /** 00059 * @return true if this is an ASCII (ISO-8859-1) Character16 00060 */ 00061 virtual bool isASCII() const; 00062 00063 00064 // ----- Comparable interface ------------------------------------------- 00065 00066 public: 00067 /** 00068 * {@inheritDoc} 00069 */ 00070 virtual int32_t compareTo(Object::View v) const; 00071 00072 00073 // ----- static methods ------------------------------------------------- 00074 00075 public: 00076 /** 00077 * Factory method to produce Character16 objects with an optimization 00078 * that uses cached objects for all relatively-low values. 00079 * 00080 * @param ch an char16_t 00081 * 00082 * @return an Character16 whose value is the passed char16_t 00083 */ 00084 static Handle valueOf(char16_t ch); 00085 00086 00087 00088 // ----- constants ------------------------------------------------------ 00089 00090 public: 00091 /** 00092 * A constant for the minimum representable value. 00093 */ 00094 static const char16_t min_value = 0x0; 00095 00096 /** 00097 * A constant for the maximum representable value. 00098 */ 00099 static const char16_t max_value = 0xFFFF; 00100 }; 00101 00102 COH_CLOSE_NAMESPACE2 00103 00104 #endif // COH_CHARACTER16_HPP