LCOV - code coverage report
Current view: directory - objdir/dist/include - nsUnicodeProperties.h (source / functions) Found Hit Coverage
Test: app.info Lines: 12 0 0.0 %
Date: 2012-06-02 Functions: 5 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Corporation code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Corporation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2009-2010
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Jonathan Kew <jfkthame@gmail.com>
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      26                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef NS_UNICODEPROPERTIES_H
      39                 : #define NS_UNICODEPROPERTIES_H
      40                 : 
      41                 : #include "prtypes.h"
      42                 : #include "nsIUGenCategory.h"
      43                 : 
      44                 : namespace mozilla {
      45                 : 
      46                 : namespace unicode {
      47                 : 
      48                 : extern nsIUGenCategory::nsUGenCategory sDetailedToGeneralCategory[];
      49                 : 
      50                 : PRUint32 GetMirroredChar(PRUint32 aCh);
      51                 : 
      52                 : PRUint8 GetCombiningClass(PRUint32 aCh);
      53                 : 
      54                 : // returns the detailed General Category in terms of HB_UNICODE_* values
      55                 : PRUint8 GetGeneralCategory(PRUint32 aCh);
      56                 : 
      57                 : // returns the simplified Gen Category as defined in nsIUGenCategory
      58               0 : inline nsIUGenCategory::nsUGenCategory GetGenCategory(PRUint32 aCh) {
      59               0 :   return sDetailedToGeneralCategory[GetGeneralCategory(aCh)];
      60                 : }
      61                 : 
      62                 : PRUint8 GetEastAsianWidth(PRUint32 aCh);
      63                 : 
      64                 : PRInt32 GetScriptCode(PRUint32 aCh);
      65                 : 
      66                 : PRUint32 GetScriptTagForCode(PRInt32 aScriptCode);
      67                 : 
      68                 : bool IsClusterExtender(PRUint32 aCh, PRUint8 aCategory);
      69                 : 
      70               0 : inline bool IsClusterExtender(PRUint32 aCh) {
      71               0 :     return IsClusterExtender(aCh, GetGeneralCategory(aCh));
      72                 : }
      73                 : 
      74                 : enum HSType {
      75                 :     HST_NONE = 0x00,
      76                 :     HST_L    = 0x01,
      77                 :     HST_V    = 0x02,
      78                 :     HST_T    = 0x04,
      79                 :     HST_LV   = 0x03,
      80                 :     HST_LVT  = 0x07
      81                 : };
      82                 : 
      83                 : HSType GetHangulSyllableType(PRUint32 aCh);
      84                 : 
      85                 : enum ShapingType {
      86                 :     SHAPING_DEFAULT   = 0x0001,
      87                 :     SHAPING_ARABIC    = 0x0002,
      88                 :     SHAPING_HEBREW    = 0x0004,
      89                 :     SHAPING_HANGUL    = 0x0008,
      90                 :     SHAPING_MONGOLIAN = 0x0010,
      91                 :     SHAPING_INDIC     = 0x0020,
      92                 :     SHAPING_THAI      = 0x0040
      93                 : };
      94                 : 
      95                 : PRInt32 ScriptShapingType(PRInt32 aScriptCode);
      96                 : 
      97                 : // A simple iterator for a string of PRUnichar codepoints that advances
      98                 : // by Unicode grapheme clusters
      99                 : class ClusterIterator
     100                 : {
     101                 : public:
     102               0 :     ClusterIterator(const PRUnichar* aText, PRUint32 aLength)
     103               0 :         : mPos(aText), mLimit(aText + aLength)
     104                 : #ifdef DEBUG
     105               0 :         , mText(aText)
     106                 : #endif
     107               0 :     { }
     108                 : 
     109               0 :     operator const PRUnichar* () const {
     110               0 :         return mPos;
     111                 :     }
     112                 : 
     113               0 :     bool AtEnd() const {
     114               0 :         return mPos >= mLimit;
     115                 :     }
     116                 : 
     117                 :     void Next();
     118                 : 
     119                 : private:
     120                 :     const PRUnichar* mPos;
     121                 :     const PRUnichar* mLimit;
     122                 : #ifdef DEBUG
     123                 :     const PRUnichar* mText;
     124                 : #endif
     125                 : };
     126                 : 
     127                 : } // end namespace unicode
     128                 : 
     129                 : } // end namespace mozilla
     130                 : 
     131                 : #endif /* NS_UNICODEPROPERTIES_H */

Generated by: LCOV version 1.7