001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License.
018     *
019     */
020    package org.apache.directory.api.util;
021    
022    
023    /**
024     * Various UTF constants are kept here.
025     *
026     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
027     */
028    public interface UnicodeConstants
029    {
030        int UTF8_MULTI_BYTES_MASK = 0x0080;
031        int UTF8_TWO_BYTES_MASK = 0x00E0;
032        int UTF8_TWO_BYTES = 0x00C0;
033        int UTF8_THREE_BYTES_MASK = 0x00F0;
034        int UTF8_THREE_BYTES = 0x00E0;
035        int UTF8_FOUR_BYTES_MASK = 0x00F8;
036        int UTF8_FOUR_BYTES = 0x00F0;
037        int UTF8_FIVE_BYTES_MASK = 0x00FC;
038        int UTF8_FIVE_BYTES = 0x00F8;
039        int UTF8_SIX_BYTES_MASK = 0x00FE;
040        int UTF8_SIX_BYTES = 0x00FC;
041    
042        /** %01-%27 %2B-%5B %5D-%7F */
043        boolean[] UNICODE_SUBSET =
044            {
045                false, true,  true,  true,  true,  true,  true,  true, // '\0'
046                true,  true,  true,  true,  true,  true,  true,  true,
047                true,  true,  true,  true,  true,  true,  true,  true,
048                true,  true,  true,  true,  true,  true,  true,  true,
049                true,  true,  true,  true,  true,  true,  true,  true,
050                false, false, false, true,  true,  true,  true,  true, // '(', ')', '*'
051                true,  true,  true,  true,  true,  true,  true,  true,
052                true,  true,  true,  true,  true,  true,  true,  true,
053                true,  true,  true,  true,  true,  true,  true,  true,
054                true,  true,  true,  true,  true,  true,  true,  true,
055                true,  true,  true,  true,  true,  true,  true,  true,
056                true,  true,  true,  true,  false, true,  true,  true, // '\'
057                true,  true,  true,  true,  true,  true,  true,  true,
058                true,  true,  true,  true,  true,  true,  true,  true,
059                true,  true,  true,  true,  true,  true,  true,  true,
060                true,  true,  true,  true,  true,  true,  true,  true,
061            };
062        int CHAR_ONE_BYTE_MASK = 0xFFFFFF80;
063        int CHAR_TWO_BYTES_MASK = 0xFFFFF800;
064        int CHAR_THREE_BYTES_MASK = 0xFFFF0000;
065        int CHAR_FOUR_BYTES_MASK = 0xFFE00000;
066        int CHAR_FIVE_BYTES_MASK = 0xFC000000;
067        int CHAR_SIX_BYTES_MASK = 0x80000000;
068    }