コード例 #1
0
        /*
         * ----------------------------------------------------------------------------
         *  mapFormatToken()
         *
         *  Maps a token of alphanumeric characters to a numbering format ID and a
         *  minimum length bound.  Tokens specify the character(s) that begins a
         *  Unicode
         *  numbering sequence.  For example, "i" specifies lower case roman numeral
         *  numbering.  Leading "zeros" specify a minimum length to be maintained by
         *  padding, if necessary.
         * ----------------------------------------------------------------------------
         */
        private static void mapFormatToken(String wsToken, int startLen, int tokLen, out MSONFC pnfc, out int pminlen)
        {
            int  wch       = (int)wsToken[startLen];
            bool UseArabic = false;

            pminlen = 1;
            pnfc    = MSONFC.msonfcNil;

            switch (wch)
            {
            case 0x0030:    // Digit zero
            case 0x0966:    // Hindi digit zero
            case 0x0e50:    // Thai digit zero
            case 0xc77b:    // Korean digit zero
            case 0xff10:    // Digit zero (double-byte)
                do
                {
                    // Leading zeros request padding.  Track how much.
                    pminlen++;
                }while ((--tokLen > 0) && (wch == (int)wsToken[++startLen]));

                if ((int)wsToken[startLen] != wch + 1)
                {
                    // If next character isn't "one", then use Arabic
                    UseArabic = true;
                }
                break;
            }
            if (!UseArabic)
            {
                // Map characters of token to number format ID
                switch (wch)
                {
                case 0x0031: pnfc = MSONFC.msonfcArabic; break;

                case 0x0041: pnfc = MSONFC.msonfcUCLetter; break;

                case 0x0049: pnfc = MSONFC.msonfcUCRoman; break;

                case 0x0061: pnfc = MSONFC.msonfcLCLetter; break;

                case 0x0069: pnfc = MSONFC.msonfcLCRoman; break;

                case 0x0410: pnfc = MSONFC.msonfcUCRus; break;

                case 0x0430: pnfc = MSONFC.msonfcLCRus; break;

                case 0x05d0: pnfc = MSONFC.msonfcHebrew; break;

                case 0x0623: pnfc = MSONFC.msonfcArabicScript; break;

                case 0x0905: pnfc = MSONFC.msonfcHindi2; break;

                case 0x0915: pnfc = MSONFC.msonfcHindi1; break;

                case 0x0967: pnfc = MSONFC.msonfcHindi3; break;

                case 0x0e01: pnfc = MSONFC.msonfcThai1; break;

                case 0x0e51: pnfc = MSONFC.msonfcThai2; break;

                case 0x30a2: pnfc = MSONFC.msonfcDAiueo; break;

                case 0x30a4: pnfc = MSONFC.msonfcDIroha; break;

                case 0x3131: pnfc = MSONFC.msonfcDChosung; break;

                case 0x4e00: pnfc = MSONFC.msonfcFEDecimal; break;

                case 0x58f1: pnfc = MSONFC.msonfcDbNum3; break;

                case 0x58f9: pnfc = MSONFC.msonfcChnCmplx; break;

                case 0x5b50: pnfc = MSONFC.msonfcZodiac2; break;

                case 0xac00: pnfc = MSONFC.msonfcGanada; break;

                case 0xc77c: pnfc = MSONFC.msonfcKorDbNum1; break;

                case 0xd558: pnfc = MSONFC.msonfcKorDbNum3; break;

                case 0xff11: pnfc = MSONFC.msonfcDArabic; break;

                case 0xff71: pnfc = MSONFC.msonfcAiueo; break;

                case 0xff72: pnfc = MSONFC.msonfcIroha; break;

                case 0x7532:
                    if (tokLen > 1 && wsToken[1] == 0x5b50)
                    {
                        // 60-based Zodiak numbering begins with two characters
                        pnfc = MSONFC.msonfcZodiac3;
                        tokLen--;
                        startLen++;
                    }
                    else
                    {
                        // 10-based Zodiak numbering begins with one character
                        pnfc = MSONFC.msonfcZodiac1;
                    }
                    break;

                default:
                    pnfc = MSONFC.msonfcArabic;
                    break;
                }
            }

            //if (tokLen != 1 || UseArabic) {
            if (UseArabic)
            {
                // If remaining token length is not 1, then don't recognize
                // sequence and default to Arabic with no zero padding.
                pnfc    = MSONFC.msonfcArabic;
                pminlen = 0;
            }
        }
コード例 #2
0
 bool isDecimalNFC(MSONFC msonfc)
 {
     Debug.Assert(MSONFC.msonfcFirstNum <= msonfc && msonfc <= MSONFC.msonfcLastSpecial);
     return(msonfc <= MSONFC.msonfcLastNum);
 }
コード例 #3
0
 internal void setNumberingType(MSONFC nfc)
 {
     _nfc = nfc;
 }
コード例 #4
0
ファイル: numberaction.cs プロジェクト: ArildF/masters
 bool isDecimalNFC(MSONFC msonfc) {
     Debug.Assert(MSONFC.msonfcFirstNum <= msonfc && msonfc <= MSONFC.msonfcLastSpecial);
     return msonfc <= MSONFC.msonfcLastNum;
 }
コード例 #5
0
ファイル: numberaction.cs プロジェクト: ArildF/masters
        /*      
        ----------------------------------------------------------------------------
            mapFormatToken()

            Maps a token of alphanumeric characters to a numbering format ID and a
            minimum length bound.  Tokens specify the character(s) that begins a 
            Unicode
            numbering sequence.  For example, "i" specifies lower case roman numeral
            numbering.  Leading "zeros" specify a minimum length to be maintained by
            padding, if necessary.
        ----------------------------------------------------------------------------
        */
        private static void mapFormatToken(String wsToken, int startLen, int tokLen, out MSONFC pnfc, out int  pminlen) {
            int wch = (int) wsToken[startLen];
            bool UseArabic = false;
            pminlen = 1;
            pnfc = MSONFC.msonfcNil;
            
            switch (wch) {
            case 0x0030:    // Digit zero
            case 0x0966:    // Hindi digit zero
            case 0x0e50:    // Thai digit zero
            case 0xc77b:    // Korean digit zero
            case 0xff10:    // Digit zero (double-byte)
                do {
                    // Leading zeros request padding.  Track how much.
                    pminlen++;
                }while ((--tokLen > 0) && (wch == (int) wsToken[++startLen]));
                
                if ((int) wsToken[startLen] != wch + 1) {
                    // If next character isn't "one", then use Arabic
                    UseArabic = true;
                }
                break;    
            }
            if (!UseArabic)
            // Map characters of token to number format ID
                switch (wch) {
                case 0x0031: pnfc = MSONFC.msonfcArabic; break;
                case 0x0041: pnfc = MSONFC.msonfcUCLetter; break;
                case 0x0049: pnfc = MSONFC.msonfcUCRoman; break;
                case 0x0061: pnfc = MSONFC.msonfcLCLetter; break;
                case 0x0069: pnfc = MSONFC.msonfcLCRoman; break;
                case 0x0410: pnfc = MSONFC.msonfcUCRus; break;
                case 0x0430: pnfc = MSONFC.msonfcLCRus; break;
                case 0x05d0: pnfc = MSONFC.msonfcHebrew; break;
                case 0x0623: pnfc = MSONFC.msonfcArabicScript; break;
                case 0x0905: pnfc = MSONFC.msonfcHindi2; break;
                case 0x0915: pnfc = MSONFC.msonfcHindi1; break;
                case 0x0967: pnfc = MSONFC.msonfcHindi3; break;
                case 0x0e01: pnfc = MSONFC.msonfcThai1; break;
                case 0x0e51: pnfc = MSONFC.msonfcThai2; break;
                case 0x30a2: pnfc = MSONFC.msonfcDAiueo; break;
                case 0x30a4: pnfc = MSONFC.msonfcDIroha; break;
                case 0x3131: pnfc = MSONFC.msonfcDChosung; break;
                case 0x4e00: pnfc = MSONFC.msonfcFEDecimal; break;
                case 0x58f1: pnfc = MSONFC.msonfcDbNum3; break;
                case 0x58f9: pnfc = MSONFC.msonfcChnCmplx; break;
                case 0x5b50: pnfc = MSONFC.msonfcZodiac2; break;
                case 0xac00: pnfc = MSONFC.msonfcGanada; break;
                case 0xc77c: pnfc = MSONFC.msonfcKorDbNum1; break;
                case 0xd558: pnfc = MSONFC.msonfcKorDbNum3; break;
                case 0xff11: pnfc = MSONFC.msonfcDArabic; break;
                case 0xff71: pnfc = MSONFC.msonfcAiueo; break;
                case 0xff72: pnfc = MSONFC.msonfcIroha; break;
                
                case 0x7532:
                    if (tokLen > 1 && wsToken[1] == 0x5b50) {
                        // 60-based Zodiak numbering begins with two characters
                        pnfc = MSONFC.msonfcZodiac3;
                        tokLen--;
                        startLen++;
                    }
                    else {
                        // 10-based Zodiak numbering begins with one character
                        pnfc = MSONFC.msonfcZodiac1;
                    }
                    break;
                default:
                    pnfc = MSONFC.msonfcArabic;
                    break;
                }

                //if (tokLen != 1 || UseArabic) {
                if (UseArabic) {
                    // If remaining token length is not 1, then don't recognize
                    // sequence and default to Arabic with no zero padding.
                    pnfc = MSONFC.msonfcArabic;
                    pminlen = 0;
                }   
        }
コード例 #6
0
ファイル: numberaction.cs プロジェクト: ArildF/masters
 internal void setNumberingType(MSONFC nfc) {_nfc = nfc;}