Back to index

lightning-sunbird  0.9+nobinonly
nsUnicodeRange.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nscore.h"
00039 
00040 // The following constants define unicode subranges
00041 // values below kRangeNum must be continuous so that we can map to 
00042 // lang group directly.
00043 // all ranges we care about should be defined under 32, that allows 
00044 // us to store range using bits of a PRUint32
00045 
00046 // frequently used range definitions
00047 const PRUint8   kRangeCyrillic =    0;
00048 const PRUint8   kRangeGreek    =    1;
00049 const PRUint8   kRangeTurkish  =    2;
00050 const PRUint8   kRangeHebrew   =    3;
00051 const PRUint8   kRangeArabic   =    4;
00052 const PRUint8   kRangeBaltic   =    5;
00053 const PRUint8   kRangeThai     =    6;
00054 const PRUint8   kRangeKorean   =    7;
00055 const PRUint8   kRangeJapanese =    8;
00056 const PRUint8   kRangeSChinese =    9;
00057 const PRUint8   kRangeTChinese =   10;
00058 const PRUint8   kRangeDevanagari = 11;
00059 const PRUint8   kRangeTamil    =   12;
00060 const PRUint8   kRangeArmenian =   13;
00061 const PRUint8   kRangeBengali  =   14;
00062 const PRUint8   kRangeCanadian =   15;
00063 const PRUint8   kRangeEthiopic =   16;
00064 const PRUint8   kRangeGeorgian =   17;
00065 const PRUint8   kRangeGujarati =   18;
00066 const PRUint8   kRangeGurmukhi =   19;
00067 const PRUint8   kRangeKhmer    =   20;
00068 const PRUint8   kRangeMalayalam =  21;
00069 
00070 const PRUint8   kRangeSpecificItemNum = 22;
00071 
00072 //range/rangeSet grow to this place 22-29
00073 
00074 const PRUint8   kRangeSetStart  =  30;    // range set definition starts from here
00075 const PRUint8   kRangeSetLatin  =  30;
00076 const PRUint8   kRangeSetCJK    =  31;
00077 const PRUint8   kRangeSetEnd    =  31;   // range set definition ends here
00078 
00079 // less frequently used range definition
00080 const PRUint8   kRangeSurrogate            = 32;
00081 const PRUint8   kRangePrivate              = 33;
00082 const PRUint8   kRangeMisc                 = 34;
00083 const PRUint8   kRangeUnassigned           = 35;
00084 const PRUint8   kRangeSyriac               = 36;
00085 const PRUint8   kRangeThaana               = 37;
00086 const PRUint8   kRangeOriya                = 38;
00087 const PRUint8   kRangeTelugu               = 39;
00088 const PRUint8   kRangeKannada              = 40;
00089 const PRUint8   kRangeSinhala              = 41;
00090 const PRUint8   kRangeLao                  = 42;
00091 const PRUint8   kRangeTibetan              = 43;
00092 const PRUint8   kRangeMyanmar              = 44;
00093 const PRUint8   kRangeCherokee             = 45;
00094 const PRUint8   kRangeOghamRunic           = 46;
00095 const PRUint8   kRangeMongolian            = 47;
00096 const PRUint8   kRangeMathOperators        = 48;
00097 const PRUint8   kRangeMiscTechnical        = 49;
00098 const PRUint8   kRangeControlOpticalEnclose = 50;
00099 const PRUint8   kRangeBoxBlockGeometrics   = 51;
00100 const PRUint8   kRangeMiscSymbols          = 52;
00101 const PRUint8   kRangeDingbats             = 53;
00102 const PRUint8   kRangeBraillePattern       = 54;
00103 const PRUint8   kRangeYi                   = 55;
00104 const PRUint8   kRangeCombiningDiacriticalMarks = 56;
00105 const PRUint8   kRangeSpecials             = 57;
00106 
00107 const PRUint8   kRangeTableBase   = 128;    //values over 127 are reserved for internal use only
00108 const PRUint8   kRangeTertiaryTable  = 145; // leave room for 16 subtable 
00109                                             // indices (kRangeTableBase + 1 ..
00110                                             // kRangeTableBase + 16)
00111 
00112 
00113 
00114 extern PRUint32 FindCharUnicodeRange(PRUnichar ch);
00115 extern const char* gUnicodeRangeToLangGroupTable[];
00116 
00117 inline const char* LangGroupFromUnicodeRange(PRUint8 unicodeRange)
00118 {
00119   if (kRangeSpecificItemNum > unicodeRange)  
00120     return gUnicodeRangeToLangGroupTable[unicodeRange];
00121   return nsnull;
00122 }