1 /* 2 * Copyright (C) 2018 Muhammad Tayyab Akram 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _SB_PUBLIC_GENERAL_CATEGORY_H 18 #define _SB_PUBLIC_GENERAL_CATEGORY_H 19 20 #include "SBBase.h" 21 22 /** 23 * Constants that specify the general category of a character. 24 */ 25 enum { 26 SBGeneralCategoryNil = 0x00, 27 28 SBGeneralCategoryLU = 0x01, /**< Letter: Uppercase Letter */ 29 SBGeneralCategoryLL = 0x02, /**< Letter: Lowercase Letter */ 30 SBGeneralCategoryLT = 0x03, /**< Letter: Titlecase Letter */ 31 SBGeneralCategoryLM = 0x04, /**< Letter: Modifier Letter */ 32 SBGeneralCategoryLO = 0x05, /**< Letter: Other Letter */ 33 34 SBGeneralCategoryMN = 0x06, /**< Mark: Nonspacing Mark */ 35 SBGeneralCategoryMC = 0x07, /**< Mark: Spacing Mark */ 36 SBGeneralCategoryME = 0x08, /**< Mark: Enclosing Mark */ 37 38 SBGeneralCategoryND = 0x09, /**< Number: Decimal Number */ 39 SBGeneralCategoryNL = 0x0A, /**< Number: Letter Number */ 40 SBGeneralCategoryNO = 0x0B, /**< Number: Other Number */ 41 42 SBGeneralCategoryPC = 0x0C, /**< Punctuation: Connector Punctuation */ 43 SBGeneralCategoryPD = 0x0D, /**< Punctuation: Dash Punctuation */ 44 SBGeneralCategoryPS = 0x0E, /**< Punctuation: Open Punctuation */ 45 SBGeneralCategoryPE = 0x0F, /**< Punctuation: Close Punctuation */ 46 SBGeneralCategoryPI = 0x10, /**< Punctuation: Initial Punctuation */ 47 SBGeneralCategoryPF = 0x11, /**< Punctuation: Final Punctuation */ 48 SBGeneralCategoryPO = 0x12, /**< Punctuation: Other Punctuation */ 49 50 SBGeneralCategorySM = 0x13, /**< Symbol: Math Symbol */ 51 SBGeneralCategorySC = 0x14, /**< Symbol: Currency Symbol */ 52 SBGeneralCategorySK = 0x15, /**< Symbol: Modifier Symbol */ 53 SBGeneralCategorySO = 0x16, /**< Symbol: Other Symbol */ 54 55 SBGeneralCategoryZS = 0x17, /**< Separator: Space Separator */ 56 SBGeneralCategoryZL = 0x18, /**< Separator: Line Separator */ 57 SBGeneralCategoryZP = 0x19, /**< Separator: Paragraph Separator */ 58 59 SBGeneralCategoryCC = 0x1A, /**< Other: Control */ 60 SBGeneralCategoryCF = 0x1B, /**< Other: Format */ 61 SBGeneralCategoryCS = 0x1C, /**< Other: Surrogate */ 62 SBGeneralCategoryCO = 0x1D, /**< Other: Private_Use */ 63 SBGeneralCategoryCN = 0x1E /**< Other: Unassigned */ 64 }; 65 66 /** 67 * A type to represent the general category of a character. 68 */ 69 typedef SBUInt8 SBGeneralCategory; 70 71 /** 72 * Checks whether specified general category is letter. 73 */ 74 #define SBGeneralCategoryIsLetter(gc) SBUInt8InRange(gc, SBGeneralCategoryLU, SBGeneralCategoryLO) 75 76 /** 77 * Checks whether specified general category is mark. 78 */ 79 #define SBGeneralCategoryIsMark(gc) SBUInt8InRange(gc, SBGeneralCategoryMN, SBGeneralCategoryME) 80 81 /** 82 * Checks whether specified general category is number. 83 */ 84 #define SBGeneralCategoryIsNumber(gc) SBUInt8InRange(gc, SBGeneralCategoryND, SBGeneralCategoryNO) 85 86 /** 87 * Checks whether specified general category is punctuation. 88 */ 89 #define SBGeneralCategoryIsPunctuation(gc) SBUInt8InRange(gc, SBGeneralCategoryPC, SBGeneralCategoryPO) 90 91 /** 92 * Checks whether specified general category is symbol. 93 */ 94 #define SBGeneralCategoryIsSymbol(gc) SBUInt8InRange(gc, SBGeneralCategorySM, SBGeneralCategorySO) 95 96 /** 97 * Checks whether specified general category is separator. 98 */ 99 #define SBGeneralCategoryIsSeparator(gc) SBUInt8InRange(gc, SBGeneralCategoryZS, SBGeneralCategoryZP) 100 101 /** 102 * Checks whether specified general category is other. 103 */ 104 #define SBGeneralCategoryIsOther(gc) SBUInt8InRange(gc, SBGeneralCategoryCC, SBGeneralCategoryCN) 105 106 #endif 107