├── .gitignore ├── 3rd ├── include │ ├── .gitkeep │ └── icu │ │ ├── layout │ │ ├── LEFontInstance.h │ │ ├── LEGlyphFilter.h │ │ ├── LEGlyphStorage.h │ │ ├── LEInsertionList.h │ │ ├── LELanguages.h │ │ ├── LEScripts.h │ │ ├── LESwaps.h │ │ ├── LETypes.h │ │ ├── LayoutEngine.h │ │ ├── ParagraphLayout.h │ │ ├── RunArrays.h │ │ ├── loengine.h │ │ ├── playout.h │ │ └── plruns.h │ │ └── unicode │ │ ├── alphaindex.h │ │ ├── appendable.h │ │ ├── basictz.h │ │ ├── brkiter.h │ │ ├── bytestream.h │ │ ├── bytestrie.h │ │ ├── bytestriebuilder.h │ │ ├── calendar.h │ │ ├── caniter.h │ │ ├── chariter.h │ │ ├── choicfmt.h │ │ ├── coleitr.h │ │ ├── coll.h │ │ ├── compactdecimalformat.h │ │ ├── curramt.h │ │ ├── currpinf.h │ │ ├── currunit.h │ │ ├── datefmt.h │ │ ├── dbbi.h │ │ ├── dcfmtsym.h │ │ ├── decimfmt.h │ │ ├── docmain.h │ │ ├── dtfmtsym.h │ │ ├── dtintrv.h │ │ ├── dtitvfmt.h │ │ ├── dtitvinf.h │ │ ├── dtptngen.h │ │ ├── dtrule.h │ │ ├── enumset.h │ │ ├── errorcode.h │ │ ├── fieldpos.h │ │ ├── fmtable.h │ │ ├── format.h │ │ ├── fpositer.h │ │ ├── gender.h │ │ ├── gregocal.h │ │ ├── icudataver.h │ │ ├── icuplug.h │ │ ├── idna.h │ │ ├── listformatter.h │ │ ├── localpointer.h │ │ ├── locdspnm.h │ │ ├── locid.h │ │ ├── measfmt.h │ │ ├── measunit.h │ │ ├── measure.h │ │ ├── messagepattern.h │ │ ├── msgfmt.h │ │ ├── normalizer2.h │ │ ├── normlzr.h │ │ ├── numfmt.h │ │ ├── numsys.h │ │ ├── parseerr.h │ │ ├── parsepos.h │ │ ├── platform.h │ │ ├── plurfmt.h │ │ ├── plurrule.h │ │ ├── ptypes.h │ │ ├── putil.h │ │ ├── rbbi.h │ │ ├── rbnf.h │ │ ├── rbtz.h │ │ ├── regex.h │ │ ├── region.h │ │ ├── reldatefmt.h │ │ ├── rep.h │ │ ├── resbund.h │ │ ├── schriter.h │ │ ├── scientificformathelper.h │ │ ├── search.h │ │ ├── selfmt.h │ │ ├── simpletz.h │ │ ├── smpdtfmt.h │ │ ├── sortkey.h │ │ ├── std_string.h │ │ ├── strenum.h │ │ ├── stringpiece.h │ │ ├── stringtriebuilder.h │ │ ├── stsearch.h │ │ ├── symtable.h │ │ ├── tblcoll.h │ │ ├── timezone.h │ │ ├── tmunit.h │ │ ├── tmutamt.h │ │ ├── tmutfmt.h │ │ ├── translit.h │ │ ├── tzfmt.h │ │ ├── tznames.h │ │ ├── tzrule.h │ │ ├── tztrans.h │ │ ├── ubidi.h │ │ ├── ubrk.h │ │ ├── ucal.h │ │ ├── ucasemap.h │ │ ├── ucat.h │ │ ├── uchar.h │ │ ├── ucharstrie.h │ │ ├── ucharstriebuilder.h │ │ ├── uchriter.h │ │ ├── uclean.h │ │ ├── ucnv.h │ │ ├── ucnv_cb.h │ │ ├── ucnv_err.h │ │ ├── ucnvsel.h │ │ ├── ucol.h │ │ ├── ucoleitr.h │ │ ├── uconfig.h │ │ ├── ucsdet.h │ │ ├── ucurr.h │ │ ├── udat.h │ │ ├── udata.h │ │ ├── udateintervalformat.h │ │ ├── udatpg.h │ │ ├── udisplaycontext.h │ │ ├── uenum.h │ │ ├── uformattable.h │ │ ├── ugender.h │ │ ├── uidna.h │ │ ├── uiter.h │ │ ├── uldnames.h │ │ ├── uloc.h │ │ ├── ulocdata.h │ │ ├── umachine.h │ │ ├── umisc.h │ │ ├── umsg.h │ │ ├── unifilt.h │ │ ├── unifunct.h │ │ ├── unimatch.h │ │ ├── unirepl.h │ │ ├── uniset.h │ │ ├── unistr.h │ │ ├── unorm.h │ │ ├── unorm2.h │ │ ├── unum.h │ │ ├── unumsys.h │ │ ├── uobject.h │ │ ├── upluralrules.h │ │ ├── uregex.h │ │ ├── uregion.h │ │ ├── urename.h │ │ ├── urep.h │ │ ├── ures.h │ │ ├── uscript.h │ │ ├── usearch.h │ │ ├── uset.h │ │ ├── usetiter.h │ │ ├── ushape.h │ │ ├── uspoof.h │ │ ├── usprep.h │ │ ├── ustdio.h │ │ ├── ustream.h │ │ ├── ustring.h │ │ ├── ustringtrie.h │ │ ├── utext.h │ │ ├── utf.h │ │ ├── utf16.h │ │ ├── utf32.h │ │ ├── utf8.h │ │ ├── utf_old.h │ │ ├── utmscale.h │ │ ├── utrace.h │ │ ├── utrans.h │ │ ├── utypes.h │ │ ├── uvernum.h │ │ ├── uversion.h │ │ └── vtzone.h ├── lib │ ├── .gitkeep │ └── icu │ │ ├── icudt.exp │ │ ├── icudt.lib │ │ ├── icuin.exp │ │ ├── icuin.lib │ │ ├── icuio.exp │ │ ├── icuio.lib │ │ ├── icule.exp │ │ ├── icule.lib │ │ ├── iculx.exp │ │ ├── iculx.lib │ │ ├── icutu.exp │ │ ├── icutu.lib │ │ ├── icuuc.exp │ │ ├── icuuc.lib │ │ ├── testplug.exp │ │ └── testplug.lib └── lib64 │ ├── .gitkeep │ └── icu │ ├── icudt.exp │ ├── icudt.lib │ ├── icuin.exp │ ├── icuin.lib │ ├── icuio.exp │ ├── icuio.lib │ ├── icule.exp │ ├── icule.lib │ ├── iculx.exp │ ├── iculx.lib │ ├── icutu.exp │ ├── icutu.lib │ ├── icuuc.exp │ ├── icuuc.lib │ ├── testplug.exp │ └── testplug.lib ├── LICENSE.md ├── README.md ├── VERSIONS ├── premake.bat ├── premake4.bat ├── premake4.lua ├── src ├── codec.c ├── codec.h ├── codecext.c ├── extensionfunctions.c ├── rijndael.c ├── rijndael.h ├── sha2.c ├── sha2.h ├── shell.c ├── sqlite3.c ├── sqlite3.def ├── sqlite3.h ├── sqlite3.rc ├── sqlite3ext.h ├── sqlite3secure.c ├── sqlite3shell.rc ├── sqlite3userauth.h └── userauth.c └── tools ├── compress.bat ├── inspect.lua ├── premake4.exe ├── update.bat ├── update.ps1 └── update.sh /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | .gitattributes 5 | [Bb]uild/ 6 | [Bb]in/ 7 | *.sln 8 | *.sdf 9 | *.suo 10 | 11 | !premake4.exe 12 | !.gitignore 13 | !lib/ 14 | !lib64/ 15 | 16 | *.html 17 | -------------------------------------------------------------------------------- /3rd/include/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/include/.gitkeep -------------------------------------------------------------------------------- /3rd/include/icu/layout/LEGlyphFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved 4 | * 5 | */ 6 | 7 | #ifndef __LEGLYPHFILTER__H 8 | #define __LEGLYPHFILTER__H 9 | 10 | #include "LETypes.h" 11 | 12 | U_NAMESPACE_BEGIN 13 | 14 | #ifndef U_HIDE_INTERNAL_API 15 | /** 16 | * This is a helper class that is used to 17 | * recognize a set of glyph indices. 18 | * 19 | * @internal 20 | */ 21 | class LEGlyphFilter /* not : public UObject because this is an interface/mixin class */ { 22 | public: 23 | /** 24 | * Destructor. 25 | * @internal 26 | */ 27 | virtual ~LEGlyphFilter(); 28 | 29 | /** 30 | * This method is used to test a particular 31 | * glyph index to see if it is in the set 32 | * recognized by the filter. 33 | * 34 | * @param glyph - the glyph index to be tested 35 | * 36 | * @return TRUE if the glyph index is in the set. 37 | * 38 | * @internal 39 | */ 40 | virtual le_bool accept(LEGlyphID glyph) const = 0; 41 | }; 42 | #endif /* U_HIDE_INTERNAL_API */ 43 | 44 | U_NAMESPACE_END 45 | #endif 46 | -------------------------------------------------------------------------------- /3rd/include/icu/layout/LEInsertionList.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1998-2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | */ 7 | 8 | #ifndef __LEINSERTIONLIST_H 9 | #define __LEINSERTIONLIST_H 10 | 11 | #include "LETypes.h" 12 | 13 | U_NAMESPACE_BEGIN 14 | 15 | struct InsertionRecord; 16 | 17 | #ifndef U_HIDE_INTERNAL_API 18 | /** 19 | * This class encapsulates the callback used by LEInsertionList 20 | * to apply an insertion from the insertion list. 21 | * 22 | * @internal 23 | */ 24 | class U_LAYOUT_API LEInsertionCallback 25 | { 26 | public: 27 | /** 28 | * This method will be called by LEInsertionList::applyInsertions for each 29 | * entry on the insertion list. 30 | * 31 | * @param atPosition the position of the insertion 32 | * @param count the number of glyphs to insert 33 | * @param newGlyphs the address of the glyphs to insert 34 | * 35 | * @return TRUE if LEInsertions::applyInsertions should 36 | * stop after applying this insertion. 37 | * 38 | * @internal 39 | */ 40 | virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]) = 0; 41 | 42 | /** 43 | * The destructor 44 | */ 45 | virtual ~LEInsertionCallback(); 46 | }; 47 | 48 | /** 49 | * This class is used to keep track of insertions to an array of 50 | * LEGlyphIDs. The insertions are kept on a linked 51 | * list of InsertionRecords so that the glyph array 52 | * doesn't have to be grown for each insertion. The insertions are 53 | * stored on the list from leftmost to rightmost to make it easier 54 | * to do the insertions. 55 | * 56 | * The insertions are applied to the array by calling the 57 | * applyInsertions method, which calls a client 58 | * supplied LEInsertionCallback object to actually 59 | * apply the individual insertions. 60 | * 61 | * @internal 62 | */ 63 | class LEInsertionList : public UObject 64 | { 65 | public: 66 | /** 67 | * Construct an empty insertion list. 68 | * 69 | * @param rightToLeft TRUE if the glyphs are stored 70 | * in the array in right to left order. 71 | * 72 | * @internal 73 | */ 74 | LEInsertionList(le_bool rightToLeft); 75 | 76 | /** 77 | * The destructor. 78 | */ 79 | ~LEInsertionList(); 80 | 81 | /** 82 | * Add an entry to the insertion list. 83 | * 84 | * @param position the glyph at this position in the array will be 85 | * replaced by the new glyphs. 86 | * @param count the number of new glyphs 87 | * @param success set to an error code if the auxillary data cannot be retrieved. 88 | * 89 | * @return the address of an array in which to store the new glyphs. This will 90 | * not be in the glyph array. 91 | * 92 | * @internal 93 | */ 94 | LEGlyphID *insert(le_int32 position, le_int32 count, LEErrorCode &success); 95 | 96 | /** 97 | * Return the number of new glyphs that have been inserted. 98 | * 99 | * @return the number of new glyphs which have been inserted 100 | * 101 | * @internal 102 | */ 103 | le_int32 getGrowAmount(); 104 | 105 | /** 106 | * Call the LEInsertionCallback once for each 107 | * entry on the insertion list. 108 | * 109 | * @param callback the LEInsertionCallback to call for each insertion. 110 | * 111 | * @return TRUE if callback returned TRUE to 112 | * terminate the insertion list processing. 113 | * 114 | * @internal 115 | */ 116 | le_bool applyInsertions(LEInsertionCallback *callback); 117 | 118 | /** 119 | * Empty the insertion list and free all associated 120 | * storage. 121 | * 122 | * @internal 123 | */ 124 | void reset(); 125 | 126 | /** 127 | * ICU "poor man's RTTI", returns a UClassID for the actual class. 128 | * 129 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 130 | */ 131 | virtual UClassID getDynamicClassID() const; 132 | 133 | /** 134 | * ICU "poor man's RTTI", returns a UClassID for this class. 135 | * 136 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 137 | */ 138 | static UClassID getStaticClassID(); 139 | 140 | private: 141 | 142 | /** 143 | * The head of the insertion list. 144 | * 145 | * @internal 146 | */ 147 | InsertionRecord *head; 148 | 149 | /** 150 | * The tail of the insertion list. 151 | * 152 | * @internal 153 | */ 154 | InsertionRecord *tail; 155 | 156 | /** 157 | * The total number of new glyphs on the insertion list. 158 | * 159 | * @internal 160 | */ 161 | le_int32 growAmount; 162 | 163 | /** 164 | * Set to TRUE if the glyphs are in right 165 | * to left order. Since we want the rightmost insertion 166 | * to be first on the list, we need to append the 167 | * insertions in this case. Otherwise they're prepended. 168 | * 169 | * @internal 170 | */ 171 | le_bool append; 172 | }; 173 | #endif /* U_HIDE_INTERNAL_API */ 174 | 175 | U_NAMESPACE_END 176 | #endif 177 | 178 | -------------------------------------------------------------------------------- /3rd/include/icu/layout/LELanguages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * (C) Copyright IBM Corp. 1998-2014. All Rights Reserved. 4 | * 5 | * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS 6 | * YOU REALLY KNOW WHAT YOU'RE DOING. 7 | * 8 | * Generated on: 10/26/2010 02:53:33 PM PDT 9 | */ 10 | 11 | #ifndef __LELANGUAGES_H 12 | #define __LELANGUAGES_H 13 | 14 | #include "LETypes.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: List of language codes for LayoutEngine 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | /** 24 | * A provisional list of language codes. For now, 25 | * this is just a list of languages which the LayoutEngine 26 | * supports. 27 | * 28 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 29 | */ 30 | 31 | enum LanguageCodes { 32 | nullLanguageCode = 0, 33 | araLanguageCode = 1, 34 | asmLanguageCode = 2, 35 | benLanguageCode = 3, 36 | farLanguageCode = 4, 37 | gujLanguageCode = 5, 38 | hinLanguageCode = 6, 39 | iwrLanguageCode = 7, 40 | jiiLanguageCode = 8, 41 | janLanguageCode = 9, 42 | kanLanguageCode = 10, 43 | kokLanguageCode = 11, 44 | korLanguageCode = 12, 45 | kshLanguageCode = 13, 46 | malLanguageCode = 14, 47 | marLanguageCode = 15, 48 | mlrLanguageCode = 16, 49 | mniLanguageCode = 17, 50 | oriLanguageCode = 18, 51 | sanLanguageCode = 19, 52 | sndLanguageCode = 20, 53 | snhLanguageCode = 21, 54 | syrLanguageCode = 22, 55 | tamLanguageCode = 23, 56 | telLanguageCode = 24, 57 | thaLanguageCode = 25, 58 | urdLanguageCode = 26, 59 | zhpLanguageCode = 27, 60 | zhsLanguageCode = 28, 61 | zhtLanguageCode = 29, 62 | 63 | /** New language codes added 03/13/2008 @deprecated ICU 54. See {@link icu::LayoutEngine} 64 | */ 65 | afkLanguageCode = 30, 66 | belLanguageCode = 31, 67 | bgrLanguageCode = 32, 68 | catLanguageCode = 33, 69 | cheLanguageCode = 34, 70 | copLanguageCode = 35, 71 | csyLanguageCode = 36, 72 | danLanguageCode = 37, 73 | deuLanguageCode = 38, 74 | dznLanguageCode = 39, 75 | ellLanguageCode = 40, 76 | engLanguageCode = 41, 77 | espLanguageCode = 42, 78 | etiLanguageCode = 43, 79 | euqLanguageCode = 44, 80 | finLanguageCode = 45, 81 | fraLanguageCode = 46, 82 | gaeLanguageCode = 47, 83 | hauLanguageCode = 48, 84 | hrvLanguageCode = 49, 85 | hunLanguageCode = 50, 86 | hyeLanguageCode = 51, 87 | indLanguageCode = 52, 88 | itaLanguageCode = 53, 89 | khmLanguageCode = 54, 90 | mngLanguageCode = 55, 91 | mtsLanguageCode = 56, 92 | nepLanguageCode = 57, 93 | nldLanguageCode = 58, 94 | pasLanguageCode = 59, 95 | plkLanguageCode = 60, 96 | ptgLanguageCode = 61, 97 | romLanguageCode = 62, 98 | rusLanguageCode = 63, 99 | skyLanguageCode = 64, 100 | slvLanguageCode = 65, 101 | sqiLanguageCode = 66, 102 | srbLanguageCode = 67, 103 | sveLanguageCode = 68, 104 | tibLanguageCode = 69, 105 | trkLanguageCode = 70, 106 | welLanguageCode = 71, 107 | 108 | languageCodeCount = 72 109 | }; 110 | 111 | U_NAMESPACE_END 112 | #endif 113 | -------------------------------------------------------------------------------- /3rd/include/icu/layout/LEScripts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * (C) Copyright IBM Corp. 1998-2014. All Rights Reserved. 4 | * 5 | * WARNING: THIS FILE IS MACHINE GENERATED. DO NOT HAND EDIT IT UNLESS 6 | * YOU REALLY KNOW WHAT YOU'RE DOING. 7 | * 8 | * Generated on: 04/08/2014 03:20:04 PM PDT 9 | */ 10 | 11 | #ifndef __LESCRIPTS_H 12 | #define __LESCRIPTS_H 13 | 14 | #include "LETypes.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: Constants for Unicode script values 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | /** 24 | * Constants for Unicode script values, generated using 25 | * ICU4J's UScript class. 26 | * 27 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 28 | */ 29 | 30 | enum ScriptCodes { 31 | zyyyScriptCode = 0, 32 | zinhScriptCode = 1, 33 | qaaiScriptCode = zinhScriptCode, /* manually added alias, for API stability */ 34 | arabScriptCode = 2, 35 | armnScriptCode = 3, 36 | bengScriptCode = 4, 37 | bopoScriptCode = 5, 38 | cherScriptCode = 6, 39 | coptScriptCode = 7, 40 | cyrlScriptCode = 8, 41 | dsrtScriptCode = 9, 42 | devaScriptCode = 10, 43 | ethiScriptCode = 11, 44 | georScriptCode = 12, 45 | gothScriptCode = 13, 46 | grekScriptCode = 14, 47 | gujrScriptCode = 15, 48 | guruScriptCode = 16, 49 | haniScriptCode = 17, 50 | hangScriptCode = 18, 51 | hebrScriptCode = 19, 52 | hiraScriptCode = 20, 53 | kndaScriptCode = 21, 54 | kanaScriptCode = 22, 55 | khmrScriptCode = 23, 56 | laooScriptCode = 24, 57 | latnScriptCode = 25, 58 | mlymScriptCode = 26, 59 | mongScriptCode = 27, 60 | mymrScriptCode = 28, 61 | ogamScriptCode = 29, 62 | italScriptCode = 30, 63 | oryaScriptCode = 31, 64 | runrScriptCode = 32, 65 | sinhScriptCode = 33, 66 | syrcScriptCode = 34, 67 | tamlScriptCode = 35, 68 | teluScriptCode = 36, 69 | thaaScriptCode = 37, 70 | thaiScriptCode = 38, 71 | tibtScriptCode = 39, 72 | /** 73 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 74 | */ 75 | 76 | cansScriptCode = 40, 77 | /** 78 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 79 | */ 80 | 81 | yiiiScriptCode = 41, 82 | tglgScriptCode = 42, 83 | hanoScriptCode = 43, 84 | buhdScriptCode = 44, 85 | tagbScriptCode = 45, 86 | /** 87 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 88 | */ 89 | 90 | braiScriptCode = 46, 91 | cprtScriptCode = 47, 92 | limbScriptCode = 48, 93 | linbScriptCode = 49, 94 | osmaScriptCode = 50, 95 | shawScriptCode = 51, 96 | taleScriptCode = 52, 97 | ugarScriptCode = 53, 98 | /** 99 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 100 | */ 101 | 102 | hrktScriptCode = 54, 103 | /** 104 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 105 | */ 106 | 107 | bugiScriptCode = 55, 108 | glagScriptCode = 56, 109 | kharScriptCode = 57, 110 | syloScriptCode = 58, 111 | taluScriptCode = 59, 112 | tfngScriptCode = 60, 113 | xpeoScriptCode = 61, 114 | /** 115 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 116 | */ 117 | 118 | baliScriptCode = 62, 119 | batkScriptCode = 63, 120 | blisScriptCode = 64, 121 | brahScriptCode = 65, 122 | chamScriptCode = 66, 123 | cirtScriptCode = 67, 124 | cyrsScriptCode = 68, 125 | egydScriptCode = 69, 126 | egyhScriptCode = 70, 127 | egypScriptCode = 71, 128 | geokScriptCode = 72, 129 | hansScriptCode = 73, 130 | hantScriptCode = 74, 131 | hmngScriptCode = 75, 132 | hungScriptCode = 76, 133 | indsScriptCode = 77, 134 | javaScriptCode = 78, 135 | kaliScriptCode = 79, 136 | latfScriptCode = 80, 137 | latgScriptCode = 81, 138 | lepcScriptCode = 82, 139 | linaScriptCode = 83, 140 | mandScriptCode = 84, 141 | mayaScriptCode = 85, 142 | meroScriptCode = 86, 143 | nkooScriptCode = 87, 144 | orkhScriptCode = 88, 145 | permScriptCode = 89, 146 | phagScriptCode = 90, 147 | phnxScriptCode = 91, 148 | plrdScriptCode = 92, 149 | roroScriptCode = 93, 150 | saraScriptCode = 94, 151 | syreScriptCode = 95, 152 | syrjScriptCode = 96, 153 | syrnScriptCode = 97, 154 | tengScriptCode = 98, 155 | vaiiScriptCode = 99, 156 | vispScriptCode = 100, 157 | xsuxScriptCode = 101, 158 | zxxxScriptCode = 102, 159 | zzzzScriptCode = 103, 160 | /** 161 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 162 | */ 163 | 164 | cariScriptCode = 104, 165 | jpanScriptCode = 105, 166 | lanaScriptCode = 106, 167 | lyciScriptCode = 107, 168 | lydiScriptCode = 108, 169 | olckScriptCode = 109, 170 | rjngScriptCode = 110, 171 | saurScriptCode = 111, 172 | sgnwScriptCode = 112, 173 | sundScriptCode = 113, 174 | moonScriptCode = 114, 175 | mteiScriptCode = 115, 176 | /** 177 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 178 | */ 179 | 180 | armiScriptCode = 116, 181 | avstScriptCode = 117, 182 | cakmScriptCode = 118, 183 | koreScriptCode = 119, 184 | kthiScriptCode = 120, 185 | maniScriptCode = 121, 186 | phliScriptCode = 122, 187 | phlpScriptCode = 123, 188 | phlvScriptCode = 124, 189 | prtiScriptCode = 125, 190 | samrScriptCode = 126, 191 | tavtScriptCode = 127, 192 | zmthScriptCode = 128, 193 | zsymScriptCode = 129, 194 | /** 195 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 196 | */ 197 | 198 | bamuScriptCode = 130, 199 | lisuScriptCode = 131, 200 | nkgbScriptCode = 132, 201 | sarbScriptCode = 133, 202 | /** 203 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 204 | */ 205 | 206 | bassScriptCode = 134, 207 | duplScriptCode = 135, 208 | elbaScriptCode = 136, 209 | granScriptCode = 137, 210 | kpelScriptCode = 138, 211 | lomaScriptCode = 139, 212 | mendScriptCode = 140, 213 | mercScriptCode = 141, 214 | narbScriptCode = 142, 215 | nbatScriptCode = 143, 216 | palmScriptCode = 144, 217 | sindScriptCode = 145, 218 | waraScriptCode = 146, 219 | /** 220 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 221 | */ 222 | 223 | afakScriptCode = 147, 224 | jurcScriptCode = 148, 225 | mrooScriptCode = 149, 226 | nshuScriptCode = 150, 227 | shrdScriptCode = 151, 228 | soraScriptCode = 152, 229 | takrScriptCode = 153, 230 | tangScriptCode = 154, 231 | woleScriptCode = 155, 232 | /** 233 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 234 | */ 235 | 236 | hluwScriptCode = 156, 237 | khojScriptCode = 157, 238 | tirhScriptCode = 158, 239 | /** 240 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 241 | */ 242 | 243 | aghbScriptCode = 159, 244 | mahjScriptCode = 160, 245 | /** 246 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 247 | */ 248 | 249 | ahomScriptCode = 161, 250 | hatrScriptCode = 162, 251 | modiScriptCode = 163, 252 | multScriptCode = 164, 253 | paucScriptCode = 165, 254 | siddScriptCode = 166, 255 | 256 | /** 257 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 258 | */ 259 | scriptCodeCount 260 | }; 261 | 262 | U_NAMESPACE_END 263 | #endif 264 | -------------------------------------------------------------------------------- /3rd/include/icu/layout/LESwaps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * (C) Copyright IBM Corp. 1998-2014 - All Rights Reserved 4 | * 5 | */ 6 | 7 | #ifndef __LESWAPS_H 8 | #define __LESWAPS_H 9 | 10 | #include "LETypes.h" 11 | 12 | /** 13 | * \file 14 | * \brief C++ API: Endian independent access to data for LayoutEngine 15 | */ 16 | 17 | U_NAMESPACE_BEGIN 18 | 19 | /** 20 | * A convenience macro which invokes the swapWord member function 21 | * from a concise call. 22 | * 23 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 24 | */ 25 | #define SWAPW(value) LESwaps::swapWord((le_uint16)(value)) 26 | 27 | /** 28 | * A convenience macro which invokes the swapLong member function 29 | * from a concise call. 30 | * 31 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 32 | */ 33 | #define SWAPL(value) LESwaps::swapLong((le_uint32)(value)) 34 | 35 | /** 36 | * This class is used to access data which stored in big endian order 37 | * regardless of the conventions of the platform. 38 | * 39 | * All methods are static and inline in an attempt to induce the compiler 40 | * to do most of the calculations at compile time. 41 | * 42 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 43 | */ 44 | class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ { 45 | public: 46 | 47 | /** 48 | * Reads a big-endian 16-bit word and returns a native-endian value. 49 | * No-op on a big-endian platform, byte-swaps on a little-endian platform. 50 | * 51 | * @param value - the word to be byte swapped 52 | * 53 | * @return the byte swapped word 54 | * 55 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 56 | */ 57 | static le_uint16 swapWord(le_uint16 value) 58 | { 59 | #if (defined(U_IS_BIG_ENDIAN) && U_IS_BIG_ENDIAN) || \ 60 | (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || \ 61 | defined(__BIG_ENDIAN__) 62 | // Fastpath when we know that the platform is big-endian. 63 | return value; 64 | #else 65 | // Reads a big-endian value on any platform. 66 | const le_uint8 *p = reinterpret_cast(&value); 67 | return (le_uint16)((p[0] << 8) | p[1]); 68 | #endif 69 | }; 70 | 71 | /** 72 | * Reads a big-endian 32-bit word and returns a native-endian value. 73 | * No-op on a big-endian platform, byte-swaps on a little-endian platform. 74 | * 75 | * @param value - the long to be byte swapped 76 | * 77 | * @return the byte swapped long 78 | * 79 | * @deprecated ICU 54. See {@link icu::LayoutEngine} 80 | */ 81 | static le_uint32 swapLong(le_uint32 value) 82 | { 83 | #if (defined(U_IS_BIG_ENDIAN) && U_IS_BIG_ENDIAN) || \ 84 | (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || \ 85 | defined(__BIG_ENDIAN__) 86 | // Fastpath when we know that the platform is big-endian. 87 | return value; 88 | #else 89 | // Reads a big-endian value on any platform. 90 | const le_uint8 *p = reinterpret_cast(&value); 91 | return (le_uint32)((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); 92 | #endif 93 | }; 94 | 95 | private: 96 | LESwaps() {} // private - forbid instantiation 97 | }; 98 | 99 | U_NAMESPACE_END 100 | #endif 101 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/curramt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __CURRENCYAMOUNT_H__ 12 | #define __CURRENCYAMOUNT_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/measure.h" 19 | #include "unicode/currunit.h" 20 | 21 | /** 22 | * \file 23 | * \brief C++ API: Currency Amount Object. 24 | */ 25 | 26 | U_NAMESPACE_BEGIN 27 | 28 | /** 29 | * 30 | * A currency together with a numeric amount, such as 200 USD. 31 | * 32 | * @author Alan Liu 33 | * @stable ICU 3.0 34 | */ 35 | class U_I18N_API CurrencyAmount: public Measure { 36 | public: 37 | /** 38 | * Construct an object with the given numeric amount and the given 39 | * ISO currency code. 40 | * @param amount a numeric object; amount.isNumeric() must be TRUE 41 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 42 | * NULL and must have length 3 43 | * @param ec input-output error code. If the amount or the isoCode 44 | * is invalid, then this will be set to a failing value. 45 | * @stable ICU 3.0 46 | */ 47 | CurrencyAmount(const Formattable& amount, const UChar* isoCode, 48 | UErrorCode &ec); 49 | 50 | /** 51 | * Construct an object with the given numeric amount and the given 52 | * ISO currency code. 53 | * @param amount the amount of the given currency 54 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 55 | * NULL and must have length 3 56 | * @param ec input-output error code. If the isoCode is invalid, 57 | * then this will be set to a failing value. 58 | * @stable ICU 3.0 59 | */ 60 | CurrencyAmount(double amount, const UChar* isoCode, 61 | UErrorCode &ec); 62 | 63 | /** 64 | * Copy constructor 65 | * @stable ICU 3.0 66 | */ 67 | CurrencyAmount(const CurrencyAmount& other); 68 | 69 | /** 70 | * Assignment operator 71 | * @stable ICU 3.0 72 | */ 73 | CurrencyAmount& operator=(const CurrencyAmount& other); 74 | 75 | /** 76 | * Return a polymorphic clone of this object. The result will 77 | * have the same class as returned by getDynamicClassID(). 78 | * @stable ICU 3.0 79 | */ 80 | virtual UObject* clone() const; 81 | 82 | /** 83 | * Destructor 84 | * @stable ICU 3.0 85 | */ 86 | virtual ~CurrencyAmount(); 87 | 88 | /** 89 | * Returns a unique class ID for this object POLYMORPHICALLY. 90 | * This method implements a simple form of RTTI used by ICU. 91 | * @return The class ID for this object. All objects of a given 92 | * class have the same class ID. Objects of other classes have 93 | * different class IDs. 94 | * @stable ICU 3.0 95 | */ 96 | virtual UClassID getDynamicClassID() const; 97 | 98 | /** 99 | * Returns the class ID for this class. This is used to compare to 100 | * the return value of getDynamicClassID(). 101 | * @return The class ID for all objects of this class. 102 | * @stable ICU 3.0 103 | */ 104 | static UClassID U_EXPORT2 getStaticClassID(); 105 | 106 | /** 107 | * Return the currency unit object of this object. 108 | * @stable ICU 3.0 109 | */ 110 | inline const CurrencyUnit& getCurrency() const; 111 | 112 | /** 113 | * Return the ISO currency code of this object. 114 | * @stable ICU 3.0 115 | */ 116 | inline const UChar* getISOCurrency() const; 117 | }; 118 | 119 | inline const CurrencyUnit& CurrencyAmount::getCurrency() const { 120 | return (const CurrencyUnit&) getUnit(); 121 | } 122 | 123 | inline const UChar* CurrencyAmount::getISOCurrency() const { 124 | return getCurrency().getISOCurrency(); 125 | } 126 | 127 | U_NAMESPACE_END 128 | 129 | #endif // !UCONFIG_NO_FORMATTING 130 | #endif // __CURRENCYAMOUNT_H__ 131 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/currunit.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __CURRENCYUNIT_H__ 12 | #define __CURRENCYUNIT_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | #if !UCONFIG_NO_FORMATTING 17 | 18 | #include "unicode/measunit.h" 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: Currency Unit Information. 23 | */ 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | /** 28 | * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese 29 | * yen). This class is a thin wrapper over a UChar string that 30 | * subclasses MeasureUnit, for use with Measure and MeasureFormat. 31 | * 32 | * @author Alan Liu 33 | * @stable ICU 3.0 34 | */ 35 | class U_I18N_API CurrencyUnit: public MeasureUnit { 36 | public: 37 | /** 38 | * Construct an object with the given ISO currency code. 39 | * @param isoCode the 3-letter ISO 4217 currency code; must not be 40 | * NULL and must have length 3 41 | * @param ec input-output error code. If the isoCode is invalid, 42 | * then this will be set to a failing value. 43 | * @stable ICU 3.0 44 | */ 45 | CurrencyUnit(const UChar* isoCode, UErrorCode &ec); 46 | 47 | /** 48 | * Copy constructor 49 | * @stable ICU 3.0 50 | */ 51 | CurrencyUnit(const CurrencyUnit& other); 52 | 53 | /** 54 | * Assignment operator 55 | * @stable ICU 3.0 56 | */ 57 | CurrencyUnit& operator=(const CurrencyUnit& other); 58 | 59 | /** 60 | * Return a polymorphic clone of this object. The result will 61 | * have the same class as returned by getDynamicClassID(). 62 | * @stable ICU 3.0 63 | */ 64 | virtual UObject* clone() const; 65 | 66 | /** 67 | * Destructor 68 | * @stable ICU 3.0 69 | */ 70 | virtual ~CurrencyUnit(); 71 | 72 | /** 73 | * Returns a unique class ID for this object POLYMORPHICALLY. 74 | * This method implements a simple form of RTTI used by ICU. 75 | * @return The class ID for this object. All objects of a given 76 | * class have the same class ID. Objects of other classes have 77 | * different class IDs. 78 | * @stable ICU 3.0 79 | */ 80 | virtual UClassID getDynamicClassID() const; 81 | 82 | /** 83 | * Returns the class ID for this class. This is used to compare to 84 | * the return value of getDynamicClassID(). 85 | * @return The class ID for all objects of this class. 86 | * @stable ICU 3.0 87 | */ 88 | static UClassID U_EXPORT2 getStaticClassID(); 89 | 90 | /** 91 | * Return the ISO currency code of this object. 92 | * @stable ICU 3.0 93 | */ 94 | inline const UChar* getISOCurrency() const; 95 | 96 | private: 97 | /** 98 | * The ISO 4217 code of this object. 99 | */ 100 | UChar isoCode[4]; 101 | }; 102 | 103 | inline const UChar* CurrencyUnit::getISOCurrency() const { 104 | return isoCode; 105 | } 106 | 107 | U_NAMESPACE_END 108 | 109 | #endif // !UCONFIG_NO_FORMATTING 110 | #endif // __CURRENCYUNIT_H__ 111 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/dbbi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2006,2013 IBM Corp. All rights reserved. 4 | ********************************************************************** 5 | * Date Name Description 6 | * 12/1/99 rgillam Complete port from Java. 7 | * 01/13/2000 helena Added UErrorCode to ctors. 8 | ********************************************************************** 9 | */ 10 | 11 | #ifndef DBBI_H 12 | #define DBBI_H 13 | 14 | #include "unicode/rbbi.h" 15 | 16 | #if !UCONFIG_NO_BREAK_ITERATION 17 | 18 | /** 19 | * \file 20 | * \brief C++ API: Dictionary Based Break Iterator 21 | */ 22 | 23 | U_NAMESPACE_BEGIN 24 | 25 | #ifndef U_HIDE_DEPRECATED_API 26 | /** 27 | * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary- 28 | * based break iteration has been folded into the base class. This class 29 | * is deprecated as of ICU 3.6. 30 | * @deprecated ICU 3.6 31 | */ 32 | typedef RuleBasedBreakIterator DictionaryBasedBreakIterator; 33 | 34 | #endif /* U_HIDE_DEPRECATED_API */ 35 | 36 | U_NAMESPACE_END 37 | 38 | #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/dtintrv.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2008-2009, International Business Machines Corporation and 4 | * others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * File DTINTRV.H 8 | * 9 | ******************************************************************************* 10 | */ 11 | 12 | #ifndef __DTINTRV_H__ 13 | #define __DTINTRV_H__ 14 | 15 | #include "unicode/utypes.h" 16 | #include "unicode/uobject.h" 17 | 18 | /** 19 | * \file 20 | * \brief C++ API: Date Interval data type 21 | */ 22 | 23 | 24 | U_NAMESPACE_BEGIN 25 | 26 | 27 | /** 28 | * This class represents a date interval. 29 | * It is a pair of UDate representing from UDate 1 to UDate 2. 30 | * @stable ICU 4.0 31 | **/ 32 | class U_COMMON_API DateInterval : public UObject { 33 | public: 34 | 35 | /** 36 | * Construct a DateInterval given a from date and a to date. 37 | * @param fromDate The from date in date interval. 38 | * @param toDate The to date in date interval. 39 | * @stable ICU 4.0 40 | */ 41 | DateInterval(UDate fromDate, UDate toDate); 42 | 43 | /** 44 | * destructor 45 | * @stable ICU 4.0 46 | */ 47 | virtual ~DateInterval(); 48 | 49 | /** 50 | * Get the from date. 51 | * @return the from date in dateInterval. 52 | * @stable ICU 4.0 53 | */ 54 | UDate getFromDate() const; 55 | 56 | /** 57 | * Get the to date. 58 | * @return the to date in dateInterval. 59 | * @stable ICU 4.0 60 | */ 61 | UDate getToDate() const; 62 | 63 | 64 | /** 65 | * Return the class ID for this class. This is useful only for comparing to 66 | * a return value from getDynamicClassID(). For example: 67 | *
 68 |      * .   Base* polymorphic_pointer = createPolymorphicObject();
 69 |      * .   if (polymorphic_pointer->getDynamicClassID() ==
 70 |      * .       erived::getStaticClassID()) ...
 71 |      * 
72 | * @return The class ID for all objects of this class. 73 | * @stable ICU 4.0 74 | */ 75 | static UClassID U_EXPORT2 getStaticClassID(void); 76 | 77 | /** 78 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 79 | * method is to implement a simple version of RTTI, since not all C++ 80 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 81 | * methods call this method. 82 | * 83 | * @return The class ID for this object. All objects of a 84 | * given class have the same class ID. Objects of 85 | * other classes have different class IDs. 86 | * @stable ICU 4.0 87 | */ 88 | virtual UClassID getDynamicClassID(void) const; 89 | 90 | 91 | /** 92 | * Copy constructor. 93 | * @stable ICU 4.0 94 | */ 95 | DateInterval(const DateInterval& other); 96 | 97 | /** 98 | * Default assignment operator 99 | * @stable ICU 4.0 100 | */ 101 | DateInterval& operator=(const DateInterval&); 102 | 103 | /** 104 | * Equality operator. 105 | * @return TRUE if the two DateIntervals are the same 106 | * @stable ICU 4.0 107 | */ 108 | virtual UBool operator==(const DateInterval& other) const; 109 | 110 | /** 111 | * Non-equality operator 112 | * @return TRUE if the two DateIntervals are not the same 113 | * @stable ICU 4.0 114 | */ 115 | UBool operator!=(const DateInterval& other) const; 116 | 117 | 118 | /** 119 | * clone this object. 120 | * The caller owns the result and should delete it when done. 121 | * @return a cloned DateInterval 122 | * @stable ICU 4.0 123 | */ 124 | virtual DateInterval* clone() const; 125 | 126 | private: 127 | /** 128 | * Default constructor, not implemented. 129 | */ 130 | DateInterval(); 131 | 132 | UDate fromDate; 133 | UDate toDate; 134 | 135 | } ;// end class DateInterval 136 | 137 | 138 | inline UDate 139 | DateInterval::getFromDate() const { 140 | return fromDate; 141 | } 142 | 143 | 144 | inline UDate 145 | DateInterval::getToDate() const { 146 | return toDate; 147 | } 148 | 149 | 150 | inline UBool 151 | DateInterval::operator!=(const DateInterval& other) const { 152 | return ( !operator==(other) ); 153 | } 154 | 155 | 156 | U_NAMESPACE_END 157 | 158 | #endif 159 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/enumset.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 2012,2014 International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | */ 9 | 10 | /** 11 | * \file 12 | * \brief C++: internal template EnumSet<> 13 | */ 14 | 15 | #ifndef ENUMSET_H 16 | #define ENUMSET_H 17 | 18 | #include "unicode/utypes.h" 19 | 20 | #if U_SHOW_CPLUSPLUS_API 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | /* Can't use #ifndef U_HIDE_INTERNAL_API for the entire EnumSet class, needed in .h file declarations */ 25 | /** 26 | * enum bitset for boolean fields. Similar to Java EnumSet<>. 27 | * Needs to range check. Used for private instance variables. 28 | * @internal 29 | */ 30 | template 31 | class EnumSet { 32 | public: 33 | inline EnumSet() : fBools(0) {} 34 | inline EnumSet(const EnumSet& other) : fBools(other.fBools) {} 35 | inline ~EnumSet() {} 36 | #ifndef U_HIDE_INTERNAL_API 37 | inline void clear() { fBools=0; } 38 | inline void add(T toAdd) { set(toAdd, 1); } 39 | inline void remove(T toRemove) { set(toRemove, 0); } 40 | inline int32_t contains(T toCheck) const { return get(toCheck); } 41 | inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); } 42 | inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; } 43 | inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck& operator=(const EnumSet& other) { 46 | fBools = other.fBools; 47 | return *this; 48 | } 49 | 50 | inline uint32_t getAll() const { 51 | return fBools; 52 | } 53 | #endif /* U_HIDE_INTERNAL_API */ 54 | 55 | private: 56 | inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); } 57 | private: 58 | uint32_t fBools; 59 | }; 60 | 61 | U_NAMESPACE_END 62 | 63 | #endif /* U_SHOW_CPLUSPLUS_API */ 64 | #endif /* ENUMSET_H */ 65 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/errorcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 2009-2011, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | * file name: errorcode.h 9 | * encoding: US-ASCII 10 | * tab size: 8 (not used) 11 | * indentation:4 12 | * 13 | * created on: 2009mar10 14 | * created by: Markus W. Scherer 15 | */ 16 | 17 | #ifndef __ERRORCODE_H__ 18 | #define __ERRORCODE_H__ 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: ErrorCode class intended to make it easier to use 23 | * ICU C and C++ APIs from C++ user code. 24 | */ 25 | 26 | #include "unicode/utypes.h" 27 | #include "unicode/uobject.h" 28 | 29 | U_NAMESPACE_BEGIN 30 | 31 | /** 32 | * Wrapper class for UErrorCode, with conversion operators for direct use 33 | * in ICU C and C++ APIs. 34 | * Intended to be used as a base class, where a subclass overrides 35 | * the handleFailure() function so that it throws an exception, 36 | * does an assert(), logs an error, etc. 37 | * This is not an abstract base class. This class can be used and instantiated 38 | * by itself, although it will be more useful when subclassed. 39 | * 40 | * Features: 41 | * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, 42 | * removing one common source of errors. 43 | * - Same use in C APIs taking a UErrorCode * (pointer) 44 | * and C++ taking UErrorCode & (reference) via conversion operators. 45 | * - Possible automatic checking for success when it goes out of scope. 46 | * 47 | * Note: For automatic checking for success in the destructor, a subclass 48 | * must implement such logic in its own destructor because the base class 49 | * destructor cannot call a subclass function (like handleFailure()). 50 | * The ErrorCode base class destructor does nothing. 51 | * 52 | * Note also: While it is possible for a destructor to throw an exception, 53 | * it is generally unsafe to do so. This means that in a subclass the destructor 54 | * and the handleFailure() function may need to take different actions. 55 | * 56 | * Sample code: 57 | * \code 58 | * class IcuErrorCode: public icu::ErrorCode { 59 | * public: 60 | * virtual ~IcuErrorCode() { // should be defined in .cpp as "key function" 61 | * // Safe because our handleFailure() does not throw exceptions. 62 | * if(isFailure()) { handleFailure(); } 63 | * } 64 | * protected: 65 | * virtual void handleFailure() const { 66 | * log_failure(u_errorName(errorCode)); 67 | * exit(errorCode); 68 | * } 69 | * }; 70 | * IcuErrorCode error_code; 71 | * UConverter *cnv = ucnv_open("Shift-JIS", error_code); 72 | * length = ucnv_fromUChars(dest, capacity, src, length, error_code); 73 | * ucnv_close(cnv); 74 | * // IcuErrorCode destructor checks for success. 75 | * \endcode 76 | * 77 | * @stable ICU 4.2 78 | */ 79 | class U_COMMON_API ErrorCode: public UMemory { 80 | public: 81 | /** 82 | * Default constructor. Initializes its UErrorCode to U_ZERO_ERROR. 83 | * @stable ICU 4.2 84 | */ 85 | ErrorCode() : errorCode(U_ZERO_ERROR) {} 86 | /** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */ 87 | virtual ~ErrorCode(); 88 | /** Conversion operator, returns a reference. @stable ICU 4.2 */ 89 | operator UErrorCode & () { return errorCode; } 90 | /** Conversion operator, returns a pointer. @stable ICU 4.2 */ 91 | operator UErrorCode * () { return &errorCode; } 92 | /** Tests for U_SUCCESS(). @stable ICU 4.2 */ 93 | UBool isSuccess() const { return U_SUCCESS(errorCode); } 94 | /** Tests for U_FAILURE(). @stable ICU 4.2 */ 95 | UBool isFailure() const { return U_FAILURE(errorCode); } 96 | /** Returns the UErrorCode value. @stable ICU 4.2 */ 97 | UErrorCode get() const { return errorCode; } 98 | /** Sets the UErrorCode value. @stable ICU 4.2 */ 99 | void set(UErrorCode value) { errorCode=value; } 100 | /** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */ 101 | UErrorCode reset(); 102 | /** 103 | * Asserts isSuccess(). 104 | * In other words, this method checks for a failure code, 105 | * and the base class handles it like this: 106 | * \code 107 | * if(isFailure()) { handleFailure(); } 108 | * \endcode 109 | * @stable ICU 4.4 110 | */ 111 | void assertSuccess() const; 112 | /** 113 | * Return a string for the UErrorCode value. 114 | * The string will be the same as the name of the error code constant 115 | * in the UErrorCode enum. 116 | * @stable ICU 4.4 117 | */ 118 | const char* errorName() const; 119 | 120 | protected: 121 | /** 122 | * Internal UErrorCode, accessible to subclasses. 123 | * @stable ICU 4.2 124 | */ 125 | UErrorCode errorCode; 126 | /** 127 | * Called by assertSuccess() if isFailure() is true. 128 | * A subclass should override this function to deal with a failure code: 129 | * Throw an exception, log an error, terminate the program, or similar. 130 | * @stable ICU 4.2 131 | */ 132 | virtual void handleFailure() const {} 133 | }; 134 | 135 | U_NAMESPACE_END 136 | 137 | #endif // __ERRORCODE_H__ 138 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/fpositer.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************** 3 | * Copyright (C) 2010-2012, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************** 6 | * 7 | * File attiter.h 8 | * 9 | * Modification History: 10 | * 11 | * Date Name Description 12 | * 12/15/2009 dougfelt Created 13 | ******************************************************************************** 14 | */ 15 | 16 | #ifndef FPOSITER_H 17 | #define FPOSITER_H 18 | 19 | #include "unicode/utypes.h" 20 | #include "unicode/uobject.h" 21 | 22 | /** 23 | * \file 24 | * \brief C++ API: FieldPosition Iterator. 25 | */ 26 | 27 | #if UCONFIG_NO_FORMATTING 28 | 29 | U_NAMESPACE_BEGIN 30 | 31 | /* 32 | * Allow the declaration of APIs with pointers to FieldPositionIterator 33 | * even when formatting is removed from the build. 34 | */ 35 | class FieldPositionIterator; 36 | 37 | U_NAMESPACE_END 38 | 39 | #else 40 | 41 | #include "unicode/fieldpos.h" 42 | #include "unicode/umisc.h" 43 | 44 | U_NAMESPACE_BEGIN 45 | 46 | class UVector32; 47 | 48 | /** 49 | * FieldPositionIterator returns the field ids and their start/limit positions generated 50 | * by a call to Format::format. See Format, NumberFormat, DecimalFormat. 51 | * @stable ICU 4.4 52 | */ 53 | class U_I18N_API FieldPositionIterator : public UObject { 54 | public: 55 | /** 56 | * Destructor. 57 | * @stable ICU 4.4 58 | */ 59 | ~FieldPositionIterator(); 60 | 61 | /** 62 | * Constructs a new, empty iterator. 63 | * @stable ICU 4.4 64 | */ 65 | FieldPositionIterator(void); 66 | 67 | /** 68 | * Copy constructor. If the copy failed for some reason, the new iterator will 69 | * be empty. 70 | * @stable ICU 4.4 71 | */ 72 | FieldPositionIterator(const FieldPositionIterator&); 73 | 74 | /** 75 | * Return true if another object is semantically equal to this 76 | * one. 77 | *

78 | * Return true if this FieldPositionIterator is at the same position in an 79 | * equal array of run values. 80 | * @stable ICU 4.4 81 | */ 82 | UBool operator==(const FieldPositionIterator&) const; 83 | 84 | /** 85 | * Returns the complement of the result of operator== 86 | * @param rhs The FieldPositionIterator to be compared for inequality 87 | * @return the complement of the result of operator== 88 | * @stable ICU 4.4 89 | */ 90 | UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); } 91 | 92 | /** 93 | * If the current position is valid, updates the FieldPosition values, advances the iterator, 94 | * and returns TRUE, otherwise returns FALSE. 95 | * @stable ICU 4.4 96 | */ 97 | UBool next(FieldPosition& fp); 98 | 99 | private: 100 | friend class FieldPositionIteratorHandler; 101 | 102 | /** 103 | * Sets the data used by the iterator, and resets the position. 104 | * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid 105 | * (length is not a multiple of 3, or start >= limit for any run). 106 | */ 107 | void setData(UVector32 *adopt, UErrorCode& status); 108 | 109 | UVector32 *data; 110 | int32_t pos; 111 | }; 112 | 113 | U_NAMESPACE_END 114 | 115 | #endif /* #if !UCONFIG_NO_FORMATTING */ 116 | 117 | #endif // FPOSITER_H 118 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/gender.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2008-2013, International Business Machines Corporation and 4 | * others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * 8 | * File GENDER.H 9 | * 10 | * Modification History:* 11 | * Date Name Description 12 | * 13 | ******************************************************************************** 14 | */ 15 | 16 | #ifndef _GENDER 17 | #define _GENDER 18 | 19 | #include "unicode/utypes.h" 20 | 21 | #if !UCONFIG_NO_FORMATTING 22 | 23 | #include "unicode/locid.h" 24 | #include "unicode/ugender.h" 25 | #include "unicode/uobject.h" 26 | 27 | class GenderInfoTest; 28 | 29 | U_NAMESPACE_BEGIN 30 | 31 | // Forward Declaration 32 | void U_CALLCONV GenderInfo_initCache(UErrorCode &status); 33 | 34 | /** 35 | * GenderInfo computes the gender of a list as a whole given the gender of 36 | * each element. 37 | * @stable ICU 50 38 | */ 39 | class U_I18N_API GenderInfo : public UObject { 40 | public: 41 | 42 | /** 43 | * Provides access to the predefined GenderInfo object for a given 44 | * locale. 45 | * 46 | * @param locale The locale for which a GenderInfo object is 47 | * returned. 48 | * @param status Output param set to success/failure code on exit, which 49 | * must not indicate a failure before the function call. 50 | * @return The predefined GenderInfo object pointer for 51 | * this locale. The returned object is immutable, so it is 52 | * declared as const. Caller does not own the returned 53 | * pointer, so it must not attempt to free it. 54 | * @stable ICU 50 55 | */ 56 | static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status); 57 | 58 | /** 59 | * Determines the gender of a list as a whole given the gender of each 60 | * of the elements. 61 | * 62 | * @param genders the gender of each element in the list. 63 | * @param length the length of gender array. 64 | * @param status Output param set to success/failure code on exit, which 65 | * must not indicate a failure before the function call. 66 | * @return the gender of the whole list. 67 | * @stable ICU 50 68 | */ 69 | UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const; 70 | 71 | /** 72 | * Destructor. 73 | * 74 | * @stable ICU 50 75 | */ 76 | virtual ~GenderInfo(); 77 | 78 | private: 79 | int32_t _style; 80 | 81 | /** 82 | * Copy constructor. One object per locale invariant. Clients 83 | * must never copy GenderInfo objects. 84 | */ 85 | GenderInfo(const GenderInfo& other); 86 | 87 | /** 88 | * Assignment operator. Not applicable to immutable objects. 89 | */ 90 | GenderInfo& operator=(const GenderInfo&); 91 | 92 | GenderInfo(); 93 | 94 | static const GenderInfo* getNeutralInstance(); 95 | 96 | static const GenderInfo* getMixedNeutralInstance(); 97 | 98 | static const GenderInfo* getMaleTaintsInstance(); 99 | 100 | static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status); 101 | 102 | friend class ::GenderInfoTest; 103 | friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status); 104 | }; 105 | 106 | U_NAMESPACE_END 107 | 108 | #endif /* #if !UCONFIG_NO_FORMATTING */ 109 | 110 | #endif // _GENDER 111 | //eof 112 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/icudataver.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 2009-2013, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | */ 9 | 10 | 11 | /** 12 | * \file 13 | * \brief C API: access to ICU Data Version number 14 | */ 15 | 16 | #ifndef __ICU_DATA_VER_H__ 17 | #define __ICU_DATA_VER_H__ 18 | 19 | #include "unicode/utypes.h" 20 | 21 | /** 22 | * @stable ICU 49 23 | */ 24 | #define U_ICU_VERSION_BUNDLE "icuver" 25 | 26 | /** 27 | * @stable ICU 49 28 | */ 29 | #define U_ICU_DATA_KEY "DataVersion" 30 | 31 | /** 32 | * Retrieves the data version from icuver and stores it in dataVersionFillin. 33 | * 34 | * @param dataVersionFillin icuver data version information to be filled in if not-null 35 | * @param status stores the error code from the calls to resource bundle 36 | * 37 | * @stable ICU 49 38 | */ 39 | U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/listformatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 2012-2014, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | * file name: listformatter.h 9 | * encoding: US-ASCII 10 | * tab size: 8 (not used) 11 | * indentation:4 12 | * 13 | * created on: 20120426 14 | * created by: Umesh P. Nair 15 | */ 16 | 17 | #ifndef __LISTFORMATTER_H__ 18 | #define __LISTFORMATTER_H__ 19 | 20 | #include "unicode/utypes.h" 21 | 22 | #include "unicode/unistr.h" 23 | #include "unicode/locid.h" 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | /** @internal */ 28 | class Hashtable; 29 | 30 | /** @internal */ 31 | struct ListFormatInternal; 32 | 33 | /* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */ 34 | /** @internal */ 35 | struct ListFormatData : public UMemory { 36 | UnicodeString twoPattern; 37 | UnicodeString startPattern; 38 | UnicodeString middlePattern; 39 | UnicodeString endPattern; 40 | 41 | ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end) : 42 | twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end) {} 43 | }; 44 | 45 | 46 | /** 47 | * \file 48 | * \brief C++ API: API for formatting a list. 49 | */ 50 | 51 | 52 | /** 53 | * An immutable class for formatting a list, using data from CLDR (or supplied 54 | * separately). 55 | * 56 | * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted 57 | * as "Alice, Bob, Charlie and Delta" in English. 58 | * 59 | * The ListFormatter class is not intended for public subclassing. 60 | * @stable ICU 50 61 | */ 62 | class U_COMMON_API ListFormatter : public UObject{ 63 | 64 | public: 65 | 66 | /** 67 | * Copy constructor. 68 | * @stable ICU 52 69 | */ 70 | ListFormatter(const ListFormatter&); 71 | 72 | /** 73 | * Assignment operator. 74 | * @stable ICU 52 75 | */ 76 | ListFormatter& operator=(const ListFormatter& other); 77 | 78 | /** 79 | * Creates a ListFormatter appropriate for the default locale. 80 | * 81 | * @param errorCode ICU error code, set if no data available for default locale. 82 | * @return Pointer to a ListFormatter object for the default locale, 83 | * created from internal data derived from CLDR data. 84 | * @stable ICU 50 85 | */ 86 | static ListFormatter* createInstance(UErrorCode& errorCode); 87 | 88 | /** 89 | * Creates a ListFormatter appropriate for a locale. 90 | * 91 | * @param locale The locale. 92 | * @param errorCode ICU error code, set if no data available for the given locale. 93 | * @return A ListFormatter object created from internal data derived from 94 | * CLDR data. 95 | * @stable ICU 50 96 | */ 97 | static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode); 98 | 99 | #ifndef U_HIDE_INTERNAL_API 100 | /** 101 | * Creates a ListFormatter appropriate for a locale and style. 102 | * 103 | * @param locale The locale. 104 | * @param style the style, either "standard", "duration", or "duration-short" 105 | * @param errorCode ICU error code, set if no data available for the given locale. 106 | * @return A ListFormatter object created from internal data derived from 107 | * CLDR data. 108 | * @internal 109 | */ 110 | static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode); 111 | #endif /* U_HIDE_INTERNAL_API */ 112 | 113 | /** 114 | * Destructor. 115 | * 116 | * @stable ICU 50 117 | */ 118 | virtual ~ListFormatter(); 119 | 120 | 121 | /** 122 | * Formats a list of strings. 123 | * 124 | * @param items An array of strings to be combined and formatted. 125 | * @param n_items Length of the array items. 126 | * @param appendTo The string to which the result should be appended to. 127 | * @param errorCode ICU error code, set if there is an error. 128 | * @return Formatted string combining the elements of items, appended to appendTo. 129 | * @stable ICU 50 130 | */ 131 | UnicodeString& format(const UnicodeString items[], int32_t n_items, 132 | UnicodeString& appendTo, UErrorCode& errorCode) const; 133 | 134 | #ifndef U_HIDE_INTERNAL_API 135 | /** 136 | @internal for MeasureFormat 137 | */ 138 | UnicodeString& format( 139 | const UnicodeString items[], 140 | int32_t n_items, 141 | UnicodeString& appendTo, 142 | int32_t index, 143 | int32_t &offset, 144 | UErrorCode& errorCode) const; 145 | /** 146 | * @internal constructor made public for testing. 147 | */ 148 | ListFormatter(const ListFormatData &data); 149 | /** 150 | * @internal constructor made public for testing. 151 | */ 152 | ListFormatter(const ListFormatInternal* listFormatterInternal); 153 | #endif /* U_HIDE_INTERNAL_API */ 154 | 155 | private: 156 | static void initializeHash(UErrorCode& errorCode); 157 | static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); 158 | 159 | ListFormatter(); 160 | 161 | ListFormatInternal* owned; 162 | const ListFormatInternal* data; 163 | }; 164 | 165 | U_NAMESPACE_END 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/measure.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2004-2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: April 26, 2004 8 | * Since: ICU 3.0 9 | ********************************************************************** 10 | */ 11 | #ifndef __MEASURE_H__ 12 | #define __MEASURE_H__ 13 | 14 | #include "unicode/utypes.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: MeasureUnit object. 19 | */ 20 | 21 | #if !UCONFIG_NO_FORMATTING 22 | 23 | #include "unicode/fmtable.h" 24 | 25 | U_NAMESPACE_BEGIN 26 | 27 | class MeasureUnit; 28 | 29 | /** 30 | * An amount of a specified unit, consisting of a number and a Unit. 31 | * For example, a length measure consists of a number and a length 32 | * unit, such as feet or meters. 33 | * 34 | *

Measure objects are formatted by MeasureFormat. 35 | * 36 | *

Measure objects are immutable. 37 | * 38 | * @author Alan Liu 39 | * @stable ICU 3.0 40 | */ 41 | class U_I18N_API Measure: public UObject { 42 | public: 43 | /** 44 | * Construct an object with the given numeric amount and the given 45 | * unit. After this call, the caller must not delete the given 46 | * unit object. 47 | * @param number a numeric object; amount.isNumeric() must be TRUE 48 | * @param adoptedUnit the unit object, which must not be NULL 49 | * @param ec input-output error code. If the amount or the unit 50 | * is invalid, then this will be set to a failing value. 51 | * @stable ICU 3.0 52 | */ 53 | Measure(const Formattable& number, MeasureUnit* adoptedUnit, 54 | UErrorCode& ec); 55 | 56 | /** 57 | * Copy constructor 58 | * @stable ICU 3.0 59 | */ 60 | Measure(const Measure& other); 61 | 62 | /** 63 | * Assignment operator 64 | * @stable ICU 3.0 65 | */ 66 | Measure& operator=(const Measure& other); 67 | 68 | /** 69 | * Return a polymorphic clone of this object. The result will 70 | * have the same class as returned by getDynamicClassID(). 71 | * @stable ICU 3.0 72 | */ 73 | virtual UObject* clone() const; 74 | 75 | /** 76 | * Destructor 77 | * @stable ICU 3.0 78 | */ 79 | virtual ~Measure(); 80 | 81 | /** 82 | * Equality operator. Return true if this object is equal 83 | * to the given object. 84 | * @stable ICU 3.0 85 | */ 86 | UBool operator==(const UObject& other) const; 87 | 88 | /** 89 | * Return a reference to the numeric value of this object. The 90 | * numeric value may be of any numeric type supported by 91 | * Formattable. 92 | * @stable ICU 3.0 93 | */ 94 | inline const Formattable& getNumber() const; 95 | 96 | /** 97 | * Return a reference to the unit of this object. 98 | * @stable ICU 3.0 99 | */ 100 | inline const MeasureUnit& getUnit() const; 101 | 102 | /** 103 | * Return the class ID for this class. This is useful only for comparing to 104 | * a return value from getDynamicClassID(). For example: 105 | *

106 |      * .   Base* polymorphic_pointer = createPolymorphicObject();
107 |      * .   if (polymorphic_pointer->getDynamicClassID() ==
108 |      * .       erived::getStaticClassID()) ...
109 |      * 
110 | * @return The class ID for all objects of this class. 111 | * @draft ICU 53 112 | */ 113 | static UClassID U_EXPORT2 getStaticClassID(void); 114 | 115 | /** 116 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 117 | * method is to implement a simple version of RTTI, since not all C++ 118 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 119 | * methods call this method. 120 | * 121 | * @return The class ID for this object. All objects of a 122 | * given class have the same class ID. Objects of 123 | * other classes have different class IDs. 124 | * @draft ICU 53 125 | */ 126 | virtual UClassID getDynamicClassID(void) const; 127 | 128 | protected: 129 | /** 130 | * Default constructor. 131 | * @stable ICU 3.0 132 | */ 133 | Measure(); 134 | 135 | private: 136 | /** 137 | * The numeric value of this object, e.g. 2.54 or 100. 138 | */ 139 | Formattable number; 140 | 141 | /** 142 | * The unit of this object, e.g., "millimeter" or "JPY". This is 143 | * owned by this object. 144 | */ 145 | MeasureUnit* unit; 146 | }; 147 | 148 | inline const Formattable& Measure::getNumber() const { 149 | return number; 150 | } 151 | 152 | inline const MeasureUnit& Measure::getUnit() const { 153 | return *unit; 154 | } 155 | 156 | U_NAMESPACE_END 157 | 158 | #endif // !UCONFIG_NO_FORMATTING 159 | #endif // __MEASURE_H__ 160 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/parseerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2005, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 03/14/00 aliu Creation. 8 | * 06/27/00 aliu Change from C++ class to C struct 9 | ********************************************************************** 10 | */ 11 | #ifndef PARSEERR_H 12 | #define PARSEERR_H 13 | 14 | #include "unicode/utypes.h" 15 | 16 | 17 | /** 18 | * \file 19 | * \brief C API: Parse Error Information 20 | */ 21 | /** 22 | * The capacity of the context strings in UParseError. 23 | * @stable ICU 2.0 24 | */ 25 | enum { U_PARSE_CONTEXT_LEN = 16 }; 26 | 27 | /** 28 | * A UParseError struct is used to returned detailed information about 29 | * parsing errors. It is used by ICU parsing engines that parse long 30 | * rules, patterns, or programs, where the text being parsed is long 31 | * enough that more information than a UErrorCode is needed to 32 | * localize the error. 33 | * 34 | *

The line, offset, and context fields are optional; parsing 35 | * engines may choose not to use to use them. 36 | * 37 | *

The preContext and postContext strings include some part of the 38 | * context surrounding the error. If the source text is "let for=7" 39 | * and "for" is the error (e.g., because it is a reserved word), then 40 | * some examples of what a parser might produce are the following: 41 | * 42 | *

43 |  * preContext   postContext
44 |  * ""           ""            The parser does not support context
45 |  * "let "       "=7"          Pre- and post-context only
46 |  * "let "       "for=7"       Pre- and post-context and error text
47 |  * ""           "for"         Error text only
48 |  * 
49 | * 50 | *

Examples of engines which use UParseError (or may use it in the 51 | * future) are Transliterator, RuleBasedBreakIterator, and 52 | * RegexPattern. 53 | * 54 | * @stable ICU 2.0 55 | */ 56 | typedef struct UParseError { 57 | 58 | /** 59 | * The line on which the error occured. If the parser uses this 60 | * field, it sets it to the line number of the source text line on 61 | * which the error appears, which will be be a value >= 1. If the 62 | * parse does not support line numbers, the value will be <= 0. 63 | * @stable ICU 2.0 64 | */ 65 | int32_t line; 66 | 67 | /** 68 | * The character offset to the error. If the line field is >= 1, 69 | * then this is the offset from the start of the line. Otherwise, 70 | * this is the offset from the start of the text. If the parser 71 | * does not support this field, it will have a value < 0. 72 | * @stable ICU 2.0 73 | */ 74 | int32_t offset; 75 | 76 | /** 77 | * Textual context before the error. Null-terminated. The empty 78 | * string if not supported by parser. 79 | * @stable ICU 2.0 80 | */ 81 | UChar preContext[U_PARSE_CONTEXT_LEN]; 82 | 83 | /** 84 | * The error itself and/or textual context after the error. 85 | * Null-terminated. The empty string if not supported by parser. 86 | * @stable ICU 2.0 87 | */ 88 | UChar postContext[U_PARSE_CONTEXT_LEN]; 89 | 90 | } UParseError; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/parsepos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. 3 | ******************************************************************************* 4 | * 5 | * File PARSEPOS.H 6 | * 7 | * Modification History: 8 | * 9 | * Date Name Description 10 | * 07/09/97 helena Converted from java. 11 | * 07/17/98 stephen Added errorIndex support. 12 | * 05/11/99 stephen Cleaned up. 13 | ******************************************************************************* 14 | */ 15 | 16 | #ifndef PARSEPOS_H 17 | #define PARSEPOS_H 18 | 19 | #include "unicode/utypes.h" 20 | #include "unicode/uobject.h" 21 | 22 | 23 | U_NAMESPACE_BEGIN 24 | 25 | /** 26 | * \file 27 | * \brief C++ API: Canonical Iterator 28 | */ 29 | /** 30 | * ParsePosition is a simple class used by Format 31 | * and its subclasses to keep track of the current position during parsing. 32 | * The parseObject method in the various Format 33 | * classes requires a ParsePosition object as an argument. 34 | * 35 | *

36 | * By design, as you parse through a string with different formats, 37 | * you can use the same ParsePosition, since the index parameter 38 | * records the current position. 39 | * 40 | * The ParsePosition class is not suitable for subclassing. 41 | * 42 | * @version 1.3 10/30/97 43 | * @author Mark Davis, Helena Shih 44 | * @see java.text.Format 45 | */ 46 | 47 | class U_COMMON_API ParsePosition : public UObject { 48 | public: 49 | /** 50 | * Default constructor, the index starts with 0 as default. 51 | * @stable ICU 2.0 52 | */ 53 | ParsePosition() 54 | : UObject(), 55 | index(0), 56 | errorIndex(-1) 57 | {} 58 | 59 | /** 60 | * Create a new ParsePosition with the given initial index. 61 | * @param newIndex the new text offset. 62 | * @stable ICU 2.0 63 | */ 64 | ParsePosition(int32_t newIndex) 65 | : UObject(), 66 | index(newIndex), 67 | errorIndex(-1) 68 | {} 69 | 70 | /** 71 | * Copy constructor 72 | * @param copy the object to be copied from. 73 | * @stable ICU 2.0 74 | */ 75 | ParsePosition(const ParsePosition& copy) 76 | : UObject(copy), 77 | index(copy.index), 78 | errorIndex(copy.errorIndex) 79 | {} 80 | 81 | /** 82 | * Destructor 83 | * @stable ICU 2.0 84 | */ 85 | virtual ~ParsePosition(); 86 | 87 | /** 88 | * Assignment operator 89 | * @stable ICU 2.0 90 | */ 91 | ParsePosition& operator=(const ParsePosition& copy); 92 | 93 | /** 94 | * Equality operator. 95 | * @return TRUE if the two parse positions are equal, FALSE otherwise. 96 | * @stable ICU 2.0 97 | */ 98 | UBool operator==(const ParsePosition& that) const; 99 | 100 | /** 101 | * Equality operator. 102 | * @return TRUE if the two parse positions are not equal, FALSE otherwise. 103 | * @stable ICU 2.0 104 | */ 105 | UBool operator!=(const ParsePosition& that) const; 106 | 107 | /** 108 | * Clone this object. 109 | * Clones can be used concurrently in multiple threads. 110 | * If an error occurs, then NULL is returned. 111 | * The caller must delete the clone. 112 | * 113 | * @return a clone of this object 114 | * 115 | * @see getDynamicClassID 116 | * @stable ICU 2.8 117 | */ 118 | ParsePosition *clone() const; 119 | 120 | /** 121 | * Retrieve the current parse position. On input to a parse method, this 122 | * is the index of the character at which parsing will begin; on output, it 123 | * is the index of the character following the last character parsed. 124 | * @return the current index. 125 | * @stable ICU 2.0 126 | */ 127 | int32_t getIndex(void) const; 128 | 129 | /** 130 | * Set the current parse position. 131 | * @param index the new index. 132 | * @stable ICU 2.0 133 | */ 134 | void setIndex(int32_t index); 135 | 136 | /** 137 | * Set the index at which a parse error occurred. Formatters 138 | * should set this before returning an error code from their 139 | * parseObject method. The default value is -1 if this is not 140 | * set. 141 | * @stable ICU 2.0 142 | */ 143 | void setErrorIndex(int32_t ei); 144 | 145 | /** 146 | * Retrieve the index at which an error occurred, or -1 if the 147 | * error index has not been set. 148 | * @stable ICU 2.0 149 | */ 150 | int32_t getErrorIndex(void) const; 151 | 152 | /** 153 | * ICU "poor man's RTTI", returns a UClassID for this class. 154 | * 155 | * @stable ICU 2.2 156 | */ 157 | static UClassID U_EXPORT2 getStaticClassID(); 158 | 159 | /** 160 | * ICU "poor man's RTTI", returns a UClassID for the actual class. 161 | * 162 | * @stable ICU 2.2 163 | */ 164 | virtual UClassID getDynamicClassID() const; 165 | 166 | private: 167 | /** 168 | * Input: the place you start parsing. 169 | *
Output: position where the parse stopped. 170 | * This is designed to be used serially, 171 | * with each call setting index up for the next one. 172 | */ 173 | int32_t index; 174 | 175 | /** 176 | * The index at which a parse error occurred. 177 | */ 178 | int32_t errorIndex; 179 | 180 | }; 181 | 182 | inline ParsePosition& 183 | ParsePosition::operator=(const ParsePosition& copy) 184 | { 185 | index = copy.index; 186 | errorIndex = copy.errorIndex; 187 | return *this; 188 | } 189 | 190 | inline UBool 191 | ParsePosition::operator==(const ParsePosition& copy) const 192 | { 193 | if(index != copy.index || errorIndex != copy.errorIndex) 194 | return FALSE; 195 | else 196 | return TRUE; 197 | } 198 | 199 | inline UBool 200 | ParsePosition::operator!=(const ParsePosition& copy) const 201 | { 202 | return !operator==(copy); 203 | } 204 | 205 | inline int32_t 206 | ParsePosition::getIndex() const 207 | { 208 | return index; 209 | } 210 | 211 | inline void 212 | ParsePosition::setIndex(int32_t offset) 213 | { 214 | this->index = offset; 215 | } 216 | 217 | inline int32_t 218 | ParsePosition::getErrorIndex() const 219 | { 220 | return errorIndex; 221 | } 222 | 223 | inline void 224 | ParsePosition::setErrorIndex(int32_t ei) 225 | { 226 | this->errorIndex = ei; 227 | } 228 | U_NAMESPACE_END 229 | 230 | #endif 231 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ptypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 1997-2012, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | * 9 | * FILE NAME : ptypes.h 10 | * 11 | * Date Name Description 12 | * 05/13/98 nos Creation (content moved here from ptypes.h). 13 | * 03/02/99 stephen Added AS400 support. 14 | * 03/30/99 stephen Added Linux support. 15 | * 04/13/99 stephen Reworked for autoconf. 16 | * 09/18/08 srl Moved basic types back to ptypes.h from platform.h 17 | ****************************************************************************** 18 | */ 19 | 20 | /** 21 | * \file 22 | * \brief C API: Definitions of integer types of various widths 23 | */ 24 | 25 | #ifndef _PTYPES_H 26 | #define _PTYPES_H 27 | 28 | /** 29 | * \def __STDC_LIMIT_MACROS 30 | * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations 31 | * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested. 32 | * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code 33 | * that uses such limit macros. 34 | * @internal 35 | */ 36 | #ifndef __STDC_LIMIT_MACROS 37 | #define __STDC_LIMIT_MACROS 38 | #endif 39 | 40 | /* NULL, size_t, wchar_t */ 41 | #include 42 | 43 | /* 44 | * If all compilers provided all of the C99 headers and types, 45 | * we would just unconditionally #include here 46 | * and not need any of the stuff after including platform.h. 47 | */ 48 | 49 | /* Find out if we have stdint.h etc. */ 50 | #include "unicode/platform.h" 51 | 52 | /*===========================================================================*/ 53 | /* Generic data types */ 54 | /*===========================================================================*/ 55 | 56 | /* If your platform does not have the header, you may 57 | need to edit the typedefs in the #else section below. 58 | Use #if...#else...#endif with predefined compiler macros if possible. */ 59 | #if U_HAVE_STDINT_H 60 | 61 | /* 62 | * We mostly need (which defines the standard integer types) but not . 63 | * includes and adds the printf/scanf helpers PRId32, SCNx16 etc. 64 | * which we almost never use, plus stuff like imaxabs() which we never use. 65 | */ 66 | #include 67 | 68 | #if U_PLATFORM == U_PF_OS390 69 | /* The features header is needed to get (u)int64_t sometimes. */ 70 | #include 71 | /* z/OS has , but some versions are missing uint8_t (APAR PK62248). */ 72 | #if !defined(__uint8_t) 73 | #define __uint8_t 1 74 | typedef unsigned char uint8_t; 75 | #endif 76 | #endif /* U_PLATFORM == U_PF_OS390 */ 77 | 78 | #elif U_HAVE_INTTYPES_H 79 | 80 | # include 81 | 82 | #else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ 83 | 84 | #if ! U_HAVE_INT8_T 85 | typedef signed char int8_t; 86 | #endif 87 | 88 | #if ! U_HAVE_UINT8_T 89 | typedef unsigned char uint8_t; 90 | #endif 91 | 92 | #if ! U_HAVE_INT16_T 93 | typedef signed short int16_t; 94 | #endif 95 | 96 | #if ! U_HAVE_UINT16_T 97 | typedef unsigned short uint16_t; 98 | #endif 99 | 100 | #if ! U_HAVE_INT32_T 101 | typedef signed int int32_t; 102 | #endif 103 | 104 | #if ! U_HAVE_UINT32_T 105 | typedef unsigned int uint32_t; 106 | #endif 107 | 108 | #if ! U_HAVE_INT64_T 109 | #ifdef _MSC_VER 110 | typedef signed __int64 int64_t; 111 | #else 112 | typedef signed long long int64_t; 113 | #endif 114 | #endif 115 | 116 | #if ! U_HAVE_UINT64_T 117 | #ifdef _MSC_VER 118 | typedef unsigned __int64 uint64_t; 119 | #else 120 | typedef unsigned long long uint64_t; 121 | #endif 122 | #endif 123 | 124 | #endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ 125 | 126 | #endif /* _PTYPES_H */ 127 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/putil.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 1997-2014, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | * 9 | * FILE NAME : putil.h 10 | * 11 | * Date Name Description 12 | * 05/14/98 nos Creation (content moved here from utypes.h). 13 | * 06/17/99 erm Added IEEE_754 14 | * 07/22/98 stephen Added IEEEremainder, max, min, trunc 15 | * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity 16 | * 08/24/98 stephen Added longBitsFromDouble 17 | * 03/02/99 stephen Removed openFile(). Added AS400 support. 18 | * 04/15/99 stephen Converted to C 19 | * 11/15/99 helena Integrated S/390 changes for IEEE support. 20 | * 01/11/00 helena Added u_getVersion. 21 | ****************************************************************************** 22 | */ 23 | 24 | #ifndef PUTIL_H 25 | #define PUTIL_H 26 | 27 | #include "unicode/utypes.h" 28 | /** 29 | * \file 30 | * \brief C API: Platform Utilities 31 | */ 32 | 33 | /*==========================================================================*/ 34 | /* Platform utilities */ 35 | /*==========================================================================*/ 36 | 37 | /** 38 | * Platform utilities isolates the platform dependencies of the 39 | * libarary. For each platform which this code is ported to, these 40 | * functions may have to be re-implemented. 41 | */ 42 | 43 | /** 44 | * Return the ICU data directory. 45 | * The data directory is where common format ICU data files (.dat files) 46 | * are loaded from. Note that normal use of the built-in ICU 47 | * facilities does not require loading of an external data file; 48 | * unless you are adding custom data to ICU, the data directory 49 | * does not need to be set. 50 | * 51 | * The data directory is determined as follows: 52 | * If u_setDataDirectory() has been called, that is it, otherwise 53 | * if the ICU_DATA environment variable is set, use that, otherwise 54 | * If a data directory was specifed at ICU build time 55 | * 56 | * \code 57 | * #define ICU_DATA_DIR "path" 58 | * \endcode 59 | * use that, 60 | * otherwise no data directory is available. 61 | * 62 | * @return the data directory, or an empty string ("") if no data directory has 63 | * been specified. 64 | * 65 | * @stable ICU 2.0 66 | */ 67 | U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); 68 | 69 | 70 | /** 71 | * Set the ICU data directory. 72 | * The data directory is where common format ICU data files (.dat files) 73 | * are loaded from. Note that normal use of the built-in ICU 74 | * facilities does not require loading of an external data file; 75 | * unless you are adding custom data to ICU, the data directory 76 | * does not need to be set. 77 | * 78 | * This function should be called at most once in a process, before the 79 | * first ICU operation (e.g., u_init()) that will require the loading of an 80 | * ICU data file. 81 | * This function is not thread-safe. Use it before calling ICU APIs from 82 | * multiple threads. 83 | * 84 | * @param directory The directory to be set. 85 | * 86 | * @see u_init 87 | * @stable ICU 2.0 88 | */ 89 | U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); 90 | 91 | #ifndef U_HIDE_INTERNAL_API 92 | /** 93 | * Return the time zone files override directory, or an empty string if 94 | * no directory was specified. Certain time zone resources will be preferrentially 95 | * loaded from individual files in this directory. 96 | * 97 | * @return the time zone data override directory. 98 | * @internal 99 | */ 100 | U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); 101 | 102 | /** 103 | * Set the time zone files override directory. 104 | * This function is not thread safe; it must not be called concurrently with 105 | * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions. 106 | * This function should only be called before using any ICU service that 107 | * will access the time zone data. 108 | * @internal 109 | */ 110 | U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); 111 | #endif /* U_HIDE_INTERNAL_API */ 112 | 113 | 114 | /** 115 | * @{ 116 | * Filesystem file and path separator characters. 117 | * Example: '/' and ':' on Unix, '\\' and ';' on Windows. 118 | * @stable ICU 2.0 119 | */ 120 | #if U_PLATFORM_USES_ONLY_WIN32_API 121 | # define U_FILE_SEP_CHAR '\\' 122 | # define U_FILE_ALT_SEP_CHAR '/' 123 | # define U_PATH_SEP_CHAR ';' 124 | # define U_FILE_SEP_STRING "\\" 125 | # define U_FILE_ALT_SEP_STRING "/" 126 | # define U_PATH_SEP_STRING ";" 127 | #else 128 | # define U_FILE_SEP_CHAR '/' 129 | # define U_FILE_ALT_SEP_CHAR '/' 130 | # define U_PATH_SEP_CHAR ':' 131 | # define U_FILE_SEP_STRING "/" 132 | # define U_FILE_ALT_SEP_STRING "/" 133 | # define U_PATH_SEP_STRING ":" 134 | #endif 135 | 136 | /** @} */ 137 | 138 | /** 139 | * Convert char characters to UChar characters. 140 | * This utility function is useful only for "invariant characters" 141 | * that are encoded in the platform default encoding. 142 | * They are a small, constant subset of the encoding and include 143 | * just the latin letters, digits, and some punctuation. 144 | * For details, see U_CHARSET_FAMILY. 145 | * 146 | * @param cs Input string, points to length 147 | * character bytes from a subset of the platform encoding. 148 | * @param us Output string, points to memory for length 149 | * Unicode characters. 150 | * @param length The number of characters to convert; this may 151 | * include the terminating NUL. 152 | * 153 | * @see U_CHARSET_FAMILY 154 | * @stable ICU 2.0 155 | */ 156 | U_STABLE void U_EXPORT2 157 | u_charsToUChars(const char *cs, UChar *us, int32_t length); 158 | 159 | /** 160 | * Convert UChar characters to char characters. 161 | * This utility function is useful only for "invariant characters" 162 | * that can be encoded in the platform default encoding. 163 | * They are a small, constant subset of the encoding and include 164 | * just the latin letters, digits, and some punctuation. 165 | * For details, see U_CHARSET_FAMILY. 166 | * 167 | * @param us Input string, points to length 168 | * Unicode characters that can be encoded with the 169 | * codepage-invariant subset of the platform encoding. 170 | * @param cs Output string, points to memory for length 171 | * character bytes. 172 | * @param length The number of characters to convert; this may 173 | * include the terminating NUL. 174 | * 175 | * @see U_CHARSET_FAMILY 176 | * @stable ICU 2.0 177 | */ 178 | U_STABLE void U_EXPORT2 179 | u_UCharsToChars(const UChar *us, char *cs, int32_t length); 180 | 181 | #endif 182 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/schriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * 4 | * Copyright (C) 1998-2005, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ****************************************************************************** 8 | * 9 | * File schriter.h 10 | * 11 | * Modification History: 12 | * 13 | * Date Name Description 14 | * 05/05/99 stephen Cleaned up. 15 | ****************************************************************************** 16 | */ 17 | 18 | #ifndef SCHRITER_H 19 | #define SCHRITER_H 20 | 21 | #include "unicode/utypes.h" 22 | #include "unicode/chariter.h" 23 | #include "unicode/uchriter.h" 24 | 25 | /** 26 | * \file 27 | * \brief C++ API: String Character Iterator 28 | */ 29 | 30 | U_NAMESPACE_BEGIN 31 | /** 32 | * A concrete subclass of CharacterIterator that iterates over the 33 | * characters (code units or code points) in a UnicodeString. 34 | * It's possible not only to create an 35 | * iterator that iterates over an entire UnicodeString, but also to 36 | * create one that iterates over only a subrange of a UnicodeString 37 | * (iterators over different subranges of the same UnicodeString don't 38 | * compare equal). 39 | * @see CharacterIterator 40 | * @see ForwardCharacterIterator 41 | * @stable ICU 2.0 42 | */ 43 | class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { 44 | public: 45 | /** 46 | * Create an iterator over the UnicodeString referred to by "textStr". 47 | * The UnicodeString object is copied. 48 | * The iteration range is the whole string, and the starting position is 0. 49 | * @param textStr The unicode string used to create an iterator 50 | * @stable ICU 2.0 51 | */ 52 | StringCharacterIterator(const UnicodeString& textStr); 53 | 54 | /** 55 | * Create an iterator over the UnicodeString referred to by "textStr". 56 | * The iteration range is the whole string, and the starting 57 | * position is specified by "textPos". If "textPos" is outside the valid 58 | * iteration range, the behavior of this object is undefined. 59 | * @param textStr The unicode string used to create an iterator 60 | * @param textPos The starting position of the iteration 61 | * @stable ICU 2.0 62 | */ 63 | StringCharacterIterator(const UnicodeString& textStr, 64 | int32_t textPos); 65 | 66 | /** 67 | * Create an iterator over the UnicodeString referred to by "textStr". 68 | * The UnicodeString object is copied. 69 | * The iteration range begins with the code unit specified by 70 | * "textBegin" and ends with the code unit BEFORE the code unit specfied 71 | * by "textEnd". The starting position is specified by "textPos". If 72 | * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., 73 | * textBegin >= textEnd or either is negative or greater than text.size()), 74 | * or "textPos" is outside the range defined by "textBegin" and "textEnd", 75 | * the behavior of this iterator is undefined. 76 | * @param textStr The unicode string used to create the StringCharacterIterator 77 | * @param textBegin The begin position of the iteration range 78 | * @param textEnd The end position of the iteration range 79 | * @param textPos The starting position of the iteration 80 | * @stable ICU 2.0 81 | */ 82 | StringCharacterIterator(const UnicodeString& textStr, 83 | int32_t textBegin, 84 | int32_t textEnd, 85 | int32_t textPos); 86 | 87 | /** 88 | * Copy constructor. The new iterator iterates over the same range 89 | * of the same string as "that", and its initial position is the 90 | * same as "that"'s current position. 91 | * The UnicodeString object in "that" is copied. 92 | * @param that The StringCharacterIterator to be copied 93 | * @stable ICU 2.0 94 | */ 95 | StringCharacterIterator(const StringCharacterIterator& that); 96 | 97 | /** 98 | * Destructor. 99 | * @stable ICU 2.0 100 | */ 101 | virtual ~StringCharacterIterator(); 102 | 103 | /** 104 | * Assignment operator. *this is altered to iterate over the same 105 | * range of the same string as "that", and refers to the same 106 | * character within that string as "that" does. 107 | * @param that The object to be copied. 108 | * @return the newly created object. 109 | * @stable ICU 2.0 110 | */ 111 | StringCharacterIterator& 112 | operator=(const StringCharacterIterator& that); 113 | 114 | /** 115 | * Returns true if the iterators iterate over the same range of the 116 | * same string and are pointing at the same character. 117 | * @param that The ForwardCharacterIterator to be compared for equality 118 | * @return true if the iterators iterate over the same range of the 119 | * same string and are pointing at the same character. 120 | * @stable ICU 2.0 121 | */ 122 | virtual UBool operator==(const ForwardCharacterIterator& that) const; 123 | 124 | /** 125 | * Returns a new StringCharacterIterator referring to the same 126 | * character in the same range of the same string as this one. The 127 | * caller must delete the new iterator. 128 | * @return the newly cloned object. 129 | * @stable ICU 2.0 130 | */ 131 | virtual CharacterIterator* clone(void) const; 132 | 133 | /** 134 | * Sets the iterator to iterate over the provided string. 135 | * @param newText The string to be iterated over 136 | * @stable ICU 2.0 137 | */ 138 | void setText(const UnicodeString& newText); 139 | 140 | /** 141 | * Copies the UnicodeString under iteration into the UnicodeString 142 | * referred to by "result". Even if this iterator iterates across 143 | * only a part of this string, the whole string is copied. 144 | * @param result Receives a copy of the text under iteration. 145 | * @stable ICU 2.0 146 | */ 147 | virtual void getText(UnicodeString& result); 148 | 149 | /** 150 | * Return a class ID for this object (not really public) 151 | * @return a class ID for this object. 152 | * @stable ICU 2.0 153 | */ 154 | virtual UClassID getDynamicClassID(void) const; 155 | 156 | /** 157 | * Return a class ID for this class (not really public) 158 | * @return a class ID for this class 159 | * @stable ICU 2.0 160 | */ 161 | static UClassID U_EXPORT2 getStaticClassID(void); 162 | 163 | protected: 164 | /** 165 | * Default constructor, iteration over empty string. 166 | * @stable ICU 2.0 167 | */ 168 | StringCharacterIterator(); 169 | 170 | /** 171 | * Sets the iterator to iterate over the provided string. 172 | * @param newText The string to be iterated over 173 | * @param newTextLength The length of the String 174 | * @stable ICU 2.0 175 | */ 176 | void setText(const UChar* newText, int32_t newTextLength); 177 | 178 | /** 179 | * Copy of the iterated string object. 180 | * @stable ICU 2.0 181 | */ 182 | UnicodeString text; 183 | 184 | }; 185 | 186 | U_NAMESPACE_END 187 | #endif 188 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/scientificformathelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | */ 7 | #ifndef SCIFORMATHELPER_H 8 | #define SCIFORMATHELPER_H 9 | 10 | #include "unicode/utypes.h" 11 | 12 | #if !UCONFIG_NO_FORMATTING 13 | 14 | #ifndef U_HIDE_DRAFT_API 15 | 16 | #include "unicode/unistr.h" 17 | 18 | /** 19 | * \file 20 | * \brief C++ API: Formatter for measure objects. 21 | */ 22 | 23 | U_NAMESPACE_BEGIN 24 | 25 | class DecimalFormatSymbols; 26 | class FieldPositionIterator; 27 | class DecimalFormatStaticSets; 28 | 29 | /** 30 | * A helper class for formatting numbers in standard scientific notation 31 | * instead of E notation. 32 | * 33 | * Sample code: 34 | *

 35 |  * UErrorCode status = U_ZERO_ERROR;
 36 |  * DecimalFormat *decfmt = (DecimalFormat *)
 37 |  *     NumberFormat::createScientificInstance("en", status);
 38 |  * UnicodeString appendTo;
 39 |  * FieldPositionIterator fpositer;
 40 |  * decfmt->format(1.23456e-78, appendTo, &fpositer, status);
 41 |  * ScientificFormatHelper helper(*decfmt->getDecimalFormatSymbols(), status);
 42 |  * UnicodeString result;
 43 |  *
 44 |  * // result = "1.23456x10-78"
 45 |  * helper.insertMarkup(appendTo, fpositer, "", "", result, status));
 46 |  * 
47 | * 48 | * @see NumberFormat 49 | * @draft ICU 54 50 | */ 51 | class U_I18N_API ScientificFormatHelper : public UObject { 52 | public: 53 | /** 54 | * Constructor. 55 | * @param symbols comes from DecimalFormat instance used for default 56 | * scientific notation. 57 | * @param status any error reported here. 58 | * @draft ICU 54 59 | */ 60 | ScientificFormatHelper(const DecimalFormatSymbols &symbols, UErrorCode& status); 61 | 62 | /** 63 | * Copy constructor. 64 | * @draft ICU 54 65 | */ 66 | ScientificFormatHelper(const ScientificFormatHelper &other); 67 | 68 | /** 69 | * Assignment operator. 70 | * @draft ICU 54 71 | */ 72 | ScientificFormatHelper &operator=(const ScientificFormatHelper &other); 73 | 74 | /** 75 | * Destructor. 76 | * @draft ICU 54 77 | */ 78 | virtual ~ScientificFormatHelper(); 79 | 80 | /** 81 | * Formats standard scientific notation by surrounding exponent with 82 | * html to make it superscript. 83 | * @param s the original formatted scientific notation 84 | * e.g "6.02e23". s is output from 85 | * NumberFormat::createScientificInstance()->format(). 86 | * @param fpi the FieldPositionIterator from the format call. 87 | * fpi is output from 88 | * NumberFormat::createScientificInstance()->format(). 89 | * @param beginMarkup the start html for the exponent e.g "" 90 | * @param endMarkup the end html for the exponent e.g "" 91 | * @param result standard scientific notation appended here. 92 | * @param status any error returned here. When status is set to a 93 | * non-zero error, the value of result is unspecified, 94 | * and client should fallback to using s for scientific 95 | * notation. 96 | * @return the value stored in result. 97 | * @draft ICU 54 98 | */ 99 | UnicodeString &insertMarkup( 100 | const UnicodeString &s, 101 | FieldPositionIterator &fpi, 102 | const UnicodeString &beginMarkup, 103 | const UnicodeString &endMarkup, 104 | UnicodeString &result, 105 | UErrorCode &status) const; 106 | 107 | /** 108 | * Formats standard scientific notation by using superscript unicode 109 | * points 0..9. 110 | * @param s the original formatted scientific notation 111 | * e.g "6.02e23". s is output from 112 | * NumberFormat::createScientificInstance()->format(). 113 | * @param fpi the FieldPositionIterator from the format call. 114 | * fpi is output from 115 | * NumberFormat::createScientificInstance()->format(). 116 | * @param result standard scientific notation appended here. 117 | * @param status any error returned here. When status is set to a 118 | * non-zero error, the value of result is unspecified, 119 | * and client should fallback to using s for scientific 120 | * notation. 121 | * @return the value stored in result. 122 | * @draft ICU 54 123 | */ 124 | UnicodeString &toSuperscriptExponentDigits( 125 | const UnicodeString &s, 126 | FieldPositionIterator &fpi, 127 | UnicodeString &result, 128 | UErrorCode &status) const; 129 | private: 130 | UnicodeString fPreExponent; 131 | const DecimalFormatStaticSets *fStaticSets; 132 | }; 133 | 134 | U_NAMESPACE_END 135 | 136 | #endif /* U_HIDE_DRAFT_API */ 137 | 138 | #endif /* !UCONFIG_NO_FORMATTING */ 139 | #endif 140 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/std_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 2009-2014, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | * file name: std_string.h 9 | * encoding: US-ASCII 10 | * tab size: 8 (not used) 11 | * indentation:4 12 | * 13 | * created on: 2009feb19 14 | * created by: Markus W. Scherer 15 | */ 16 | 17 | #ifndef __STD_STRING_H__ 18 | #define __STD_STRING_H__ 19 | 20 | /** 21 | * \file 22 | * \brief C++ API: Central ICU header for including the C++ standard <string> 23 | * header and for related definitions. 24 | */ 25 | 26 | #include "unicode/utypes.h" 27 | 28 | #if U_HAVE_STD_STRING 29 | 30 | #if !defined(_MSC_VER) 31 | namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 32 | #endif 33 | #include 34 | 35 | #endif // U_HAVE_STD_STRING 36 | 37 | #endif // __STD_STRING_H__ 38 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/symtable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2000-2005, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 02/04/00 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef SYMTABLE_H 11 | #define SYMTABLE_H 12 | 13 | #include "unicode/utypes.h" 14 | #include "unicode/uobject.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: An interface that defines both lookup protocol and parsing of 19 | * symbolic names. 20 | */ 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | class ParsePosition; 25 | class UnicodeFunctor; 26 | class UnicodeSet; 27 | class UnicodeString; 28 | 29 | /** 30 | * An interface that defines both lookup protocol and parsing of 31 | * symbolic names. 32 | * 33 | *

A symbol table maintains two kinds of mappings. The first is 34 | * between symbolic names and their values. For example, if the 35 | * variable with the name "start" is set to the value "alpha" 36 | * (perhaps, though not necessarily, through an expression such as 37 | * "$start=alpha"), then the call lookup("start") will return the 38 | * char[] array ['a', 'l', 'p', 'h', 'a']. 39 | * 40 | *

The second kind of mapping is between character values and 41 | * UnicodeMatcher objects. This is used by RuleBasedTransliterator, 42 | * which uses characters in the private use area to represent objects 43 | * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], 44 | * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. 45 | * 46 | *

Finally, a symbol table defines parsing behavior for symbolic 47 | * names. All symbolic names start with the SYMBOL_REF character. 48 | * When a parser encounters this character, it calls parseReference() 49 | * with the position immediately following the SYMBOL_REF. The symbol 50 | * table parses the name, if there is one, and returns it. 51 | * 52 | * @stable ICU 2.8 53 | */ 54 | class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ { 55 | public: 56 | 57 | /** 58 | * The character preceding a symbol reference name. 59 | * @stable ICU 2.8 60 | */ 61 | enum { SYMBOL_REF = 0x0024 /*$*/ }; 62 | 63 | /** 64 | * Destructor. 65 | * @stable ICU 2.8 66 | */ 67 | virtual ~SymbolTable(); 68 | 69 | /** 70 | * Lookup the characters associated with this string and return it. 71 | * Return NULL if no such name exists. The resultant 72 | * string may have length zero. 73 | * @param s the symbolic name to lookup 74 | * @return a string containing the name's value, or NULL if 75 | * there is no mapping for s. 76 | * @stable ICU 2.8 77 | */ 78 | virtual const UnicodeString* lookup(const UnicodeString& s) const = 0; 79 | 80 | /** 81 | * Lookup the UnicodeMatcher associated with the given character, and 82 | * return it. Return NULL if not found. 83 | * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. 84 | * @return the UnicodeMatcher object represented by the given 85 | * character, or NULL if there is no mapping for ch. 86 | * @stable ICU 2.8 87 | */ 88 | virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; 89 | 90 | /** 91 | * Parse a symbol reference name from the given string, starting 92 | * at the given position. If no valid symbol reference name is 93 | * found, return the empty string and leave pos unchanged. That is, if the 94 | * character at pos cannot start a name, or if pos is at or after 95 | * text.length(), then return an empty string. This indicates an 96 | * isolated SYMBOL_REF character. 97 | * @param text the text to parse for the name 98 | * @param pos on entry, the index of the first character to parse. 99 | * This is the character following the SYMBOL_REF character. On 100 | * exit, the index after the last parsed character. If the parse 101 | * failed, pos is unchanged on exit. 102 | * @param limit the index after the last character to be parsed. 103 | * @return the parsed name, or an empty string if there is no 104 | * valid symbolic name at the given position. 105 | * @stable ICU 2.8 106 | */ 107 | virtual UnicodeString parseReference(const UnicodeString& text, 108 | ParsePosition& pos, int32_t limit) const = 0; 109 | }; 110 | U_NAMESPACE_END 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/tmunit.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2009-2014, Google, International Business Machines Corporation and * 4 | * others. All Rights Reserved. * 5 | ******************************************************************************* 6 | */ 7 | 8 | #ifndef __TMUNIT_H__ 9 | #define __TMUNIT_H__ 10 | 11 | 12 | /** 13 | * \file 14 | * \brief C++ API: time unit object 15 | */ 16 | 17 | 18 | #include "unicode/measunit.h" 19 | 20 | #if !UCONFIG_NO_FORMATTING 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | /** 25 | * Measurement unit for time units. 26 | * @see TimeUnitAmount 27 | * @see TimeUnit 28 | * @stable ICU 4.2 29 | */ 30 | class U_I18N_API TimeUnit: public MeasureUnit { 31 | public: 32 | /** 33 | * Constants for all the time units we supported. 34 | * @stable ICU 4.2 35 | */ 36 | enum UTimeUnitFields { 37 | UTIMEUNIT_YEAR, 38 | UTIMEUNIT_MONTH, 39 | UTIMEUNIT_DAY, 40 | UTIMEUNIT_WEEK, 41 | UTIMEUNIT_HOUR, 42 | UTIMEUNIT_MINUTE, 43 | UTIMEUNIT_SECOND, 44 | UTIMEUNIT_FIELD_COUNT 45 | }; 46 | 47 | /** 48 | * Create Instance. 49 | * @param timeUnitField time unit field based on which the instance 50 | * is created. 51 | * @param status input-output error code. 52 | * If the timeUnitField is invalid, 53 | * then this will be set to U_ILLEGAL_ARGUMENT_ERROR. 54 | * @return a TimeUnit instance 55 | * @stable ICU 4.2 56 | */ 57 | static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField, 58 | UErrorCode& status); 59 | 60 | 61 | /** 62 | * Override clone. 63 | * @stable ICU 4.2 64 | */ 65 | virtual UObject* clone() const; 66 | 67 | /** 68 | * Copy operator. 69 | * @stable ICU 4.2 70 | */ 71 | TimeUnit(const TimeUnit& other); 72 | 73 | /** 74 | * Assignment operator. 75 | * @stable ICU 4.2 76 | */ 77 | TimeUnit& operator=(const TimeUnit& other); 78 | 79 | /** 80 | * Returns a unique class ID for this object POLYMORPHICALLY. 81 | * This method implements a simple form of RTTI used by ICU. 82 | * @return The class ID for this object. All objects of a given 83 | * class have the same class ID. Objects of other classes have 84 | * different class IDs. 85 | * @stable ICU 4.2 86 | */ 87 | virtual UClassID getDynamicClassID() const; 88 | 89 | /** 90 | * Returns the class ID for this class. This is used to compare to 91 | * the return value of getDynamicClassID(). 92 | * @return The class ID for all objects of this class. 93 | * @stable ICU 4.2 94 | */ 95 | static UClassID U_EXPORT2 getStaticClassID(); 96 | 97 | 98 | /** 99 | * Get time unit field. 100 | * @return time unit field. 101 | * @stable ICU 4.2 102 | */ 103 | UTimeUnitFields getTimeUnitField() const; 104 | 105 | /** 106 | * Destructor. 107 | * @stable ICU 4.2 108 | */ 109 | virtual ~TimeUnit(); 110 | 111 | private: 112 | UTimeUnitFields fTimeUnitField; 113 | 114 | /** 115 | * Constructor 116 | * @internal ICU 4.2 117 | */ 118 | TimeUnit(UTimeUnitFields timeUnitField); 119 | 120 | }; 121 | 122 | 123 | U_NAMESPACE_END 124 | 125 | #endif /* #if !UCONFIG_NO_FORMATTING */ 126 | 127 | #endif // __TMUNIT_H__ 128 | //eof 129 | // 130 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/tmutamt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2009-2010, Google, International Business Machines Corporation and * 4 | * others. All Rights Reserved. * 5 | ******************************************************************************* 6 | */ 7 | 8 | #ifndef __TMUTAMT_H__ 9 | #define __TMUTAMT_H__ 10 | 11 | 12 | /** 13 | * \file 14 | * \brief C++ API: time unit amount object. 15 | */ 16 | 17 | #include "unicode/measure.h" 18 | #include "unicode/tmunit.h" 19 | 20 | #if !UCONFIG_NO_FORMATTING 21 | 22 | U_NAMESPACE_BEGIN 23 | 24 | 25 | /** 26 | * Express a duration as a time unit and number. Patterned after Currency. 27 | * @see TimeUnitAmount 28 | * @see TimeUnitFormat 29 | * @stable ICU 4.2 30 | */ 31 | class U_I18N_API TimeUnitAmount: public Measure { 32 | public: 33 | /** 34 | * Construct TimeUnitAmount object with the given number and the 35 | * given time unit. 36 | * @param number a numeric object; number.isNumeric() must be TRUE 37 | * @param timeUnitField the time unit field of a time unit 38 | * @param status the input-output error code. 39 | * If the number is not numeric or the timeUnitField 40 | * is not valid, 41 | * then this will be set to a failing value: 42 | * U_ILLEGAL_ARGUMENT_ERROR. 43 | * @stable ICU 4.2 44 | */ 45 | TimeUnitAmount(const Formattable& number, 46 | TimeUnit::UTimeUnitFields timeUnitField, 47 | UErrorCode& status); 48 | 49 | /** 50 | * Construct TimeUnitAmount object with the given numeric amount and the 51 | * given time unit. 52 | * @param amount a numeric amount. 53 | * @param timeUnitField the time unit field on which a time unit amount 54 | * object will be created. 55 | * @param status the input-output error code. 56 | * If the timeUnitField is not valid, 57 | * then this will be set to a failing value: 58 | * U_ILLEGAL_ARGUMENT_ERROR. 59 | * @stable ICU 4.2 60 | */ 61 | TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField, 62 | UErrorCode& status); 63 | 64 | 65 | /** 66 | * Copy constructor 67 | * @stable ICU 4.2 68 | */ 69 | TimeUnitAmount(const TimeUnitAmount& other); 70 | 71 | 72 | /** 73 | * Assignment operator 74 | * @stable ICU 4.2 75 | */ 76 | TimeUnitAmount& operator=(const TimeUnitAmount& other); 77 | 78 | 79 | /** 80 | * Clone. 81 | * @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID(). 82 | * @stable ICU 4.2 83 | */ 84 | virtual UObject* clone() const; 85 | 86 | 87 | /** 88 | * Destructor 89 | * @stable ICU 4.2 90 | */ 91 | virtual ~TimeUnitAmount(); 92 | 93 | 94 | /** 95 | * Equality operator. 96 | * @param other the object to compare to. 97 | * @return true if this object is equal to the given object. 98 | * @stable ICU 4.2 99 | */ 100 | virtual UBool operator==(const UObject& other) const; 101 | 102 | 103 | /** 104 | * Not-equality operator. 105 | * @param other the object to compare to. 106 | * @return true if this object is not equal to the given object. 107 | * @stable ICU 4.2 108 | */ 109 | UBool operator!=(const UObject& other) const; 110 | 111 | 112 | /** 113 | * Return the class ID for this class. This is useful only for comparing to 114 | * a return value from getDynamicClassID(). For example: 115 | *

116 |      * .   Base* polymorphic_pointer = createPolymorphicObject();
117 |      * .   if (polymorphic_pointer->getDynamicClassID() ==
118 |      * .       erived::getStaticClassID()) ...
119 |      * 
120 | * @return The class ID for all objects of this class. 121 | * @stable ICU 4.2 122 | */ 123 | static UClassID U_EXPORT2 getStaticClassID(void); 124 | 125 | 126 | /** 127 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 128 | * method is to implement a simple version of RTTI, since not all C++ 129 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 130 | * methods call this method. 131 | * 132 | * @return The class ID for this object. All objects of a 133 | * given class have the same class ID. Objects of 134 | * other classes have different class IDs. 135 | * @stable ICU 4.2 136 | */ 137 | virtual UClassID getDynamicClassID(void) const; 138 | 139 | 140 | /** 141 | * Get the time unit. 142 | * @return time unit object. 143 | * @stable ICU 4.2 144 | */ 145 | const TimeUnit& getTimeUnit() const; 146 | 147 | /** 148 | * Get the time unit field value. 149 | * @return time unit field value. 150 | * @stable ICU 4.2 151 | */ 152 | TimeUnit::UTimeUnitFields getTimeUnitField() const; 153 | }; 154 | 155 | 156 | 157 | inline UBool 158 | TimeUnitAmount::operator!=(const UObject& other) const { 159 | return !operator==(other); 160 | } 161 | 162 | U_NAMESPACE_END 163 | 164 | #endif /* #if !UCONFIG_NO_FORMATTING */ 165 | 166 | #endif // __TMUTAMT_H__ 167 | //eof 168 | // 169 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/tztrans.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2007-2008, International Business Machines Corporation and * 4 | * others. All Rights Reserved. * 5 | ******************************************************************************* 6 | */ 7 | #ifndef TZTRANS_H 8 | #define TZTRANS_H 9 | 10 | /** 11 | * \file 12 | * \brief C++ API: Time zone transition 13 | */ 14 | 15 | #include "unicode/utypes.h" 16 | 17 | #if !UCONFIG_NO_FORMATTING 18 | 19 | #include "unicode/uobject.h" 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | // Forward declaration 24 | class TimeZoneRule; 25 | 26 | /** 27 | * TimeZoneTransition is a class representing a time zone transition. 28 | * An instance has a time of transition and rules for both before and after the transition. 29 | * @stable ICU 3.8 30 | */ 31 | class U_I18N_API TimeZoneTransition : public UObject { 32 | public: 33 | /** 34 | * Constructs a TimeZoneTransition with the time and the rules before/after 35 | * the transition. 36 | * 37 | * @param time The time of transition in milliseconds since the base time. 38 | * @param from The time zone rule used before the transition. 39 | * @param to The time zone rule used after the transition. 40 | * @stable ICU 3.8 41 | */ 42 | TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to); 43 | 44 | /** 45 | * Constructs an empty TimeZoneTransition 46 | * @stable ICU 3.8 47 | */ 48 | TimeZoneTransition(); 49 | 50 | /** 51 | * Copy constructor. 52 | * @param source The TimeZoneTransition object to be copied. 53 | * @stable ICU 3.8 54 | */ 55 | TimeZoneTransition(const TimeZoneTransition& source); 56 | 57 | /** 58 | * Destructor. 59 | * @stable ICU 3.8 60 | */ 61 | ~TimeZoneTransition(); 62 | 63 | /** 64 | * Clone this TimeZoneTransition object polymorphically. The caller owns the result and 65 | * should delete it when done. 66 | * @return A copy of the object. 67 | * @stable ICU 3.8 68 | */ 69 | TimeZoneTransition* clone(void) const; 70 | 71 | /** 72 | * Assignment operator. 73 | * @param right The object to be copied. 74 | * @stable ICU 3.8 75 | */ 76 | TimeZoneTransition& operator=(const TimeZoneTransition& right); 77 | 78 | /** 79 | * Return true if the given TimeZoneTransition objects are semantically equal. Objects 80 | * of different subclasses are considered unequal. 81 | * @param that The object to be compared with. 82 | * @return true if the given TimeZoneTransition objects are semantically equal. 83 | * @stable ICU 3.8 84 | */ 85 | UBool operator==(const TimeZoneTransition& that) const; 86 | 87 | /** 88 | * Return true if the given TimeZoneTransition objects are semantically unequal. Objects 89 | * of different subclasses are considered unequal. 90 | * @param that The object to be compared with. 91 | * @return true if the given TimeZoneTransition objects are semantically unequal. 92 | * @stable ICU 3.8 93 | */ 94 | UBool operator!=(const TimeZoneTransition& that) const; 95 | 96 | /** 97 | * Returns the time of transition in milliseconds. 98 | * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 99 | * @stable ICU 3.8 100 | */ 101 | UDate getTime(void) const; 102 | 103 | /** 104 | * Sets the time of transition in milliseconds. 105 | * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 106 | * @stable ICU 3.8 107 | */ 108 | void setTime(UDate time); 109 | 110 | /** 111 | * Returns the rule used before the transition. 112 | * @return The time zone rule used after the transition. 113 | * @stable ICU 3.8 114 | */ 115 | const TimeZoneRule* getFrom(void) const; 116 | 117 | /** 118 | * Sets the rule used before the transition. The caller remains 119 | * responsible for deleting the TimeZoneRule object. 120 | * @param from The time zone rule used before the transition. 121 | * @stable ICU 3.8 122 | */ 123 | void setFrom(const TimeZoneRule& from); 124 | 125 | /** 126 | * Adopts the rule used before the transition. The caller must 127 | * not delete the TimeZoneRule object passed in. 128 | * @param from The time zone rule used before the transition. 129 | * @stable ICU 3.8 130 | */ 131 | void adoptFrom(TimeZoneRule* from); 132 | 133 | /** 134 | * Sets the rule used after the transition. The caller remains 135 | * responsible for deleting the TimeZoneRule object. 136 | * @param to The time zone rule used after the transition. 137 | * @stable ICU 3.8 138 | */ 139 | void setTo(const TimeZoneRule& to); 140 | 141 | /** 142 | * Adopts the rule used after the transition. The caller must 143 | * not delete the TimeZoneRule object passed in. 144 | * @param to The time zone rule used after the transition. 145 | * @stable ICU 3.8 146 | */ 147 | void adoptTo(TimeZoneRule* to); 148 | 149 | /** 150 | * Returns the rule used after the transition. 151 | * @return The time zone rule used after the transition. 152 | * @stable ICU 3.8 153 | */ 154 | const TimeZoneRule* getTo(void) const; 155 | 156 | private: 157 | UDate fTime; 158 | TimeZoneRule* fFrom; 159 | TimeZoneRule* fTo; 160 | 161 | public: 162 | /** 163 | * Return the class ID for this class. This is useful only for comparing to 164 | * a return value from getDynamicClassID(). For example: 165 | *
166 |      * .   Base* polymorphic_pointer = createPolymorphicObject();
167 |      * .   if (polymorphic_pointer->getDynamicClassID() ==
168 |      * .       erived::getStaticClassID()) ...
169 |      * 
170 | * @return The class ID for all objects of this class. 171 | * @stable ICU 3.8 172 | */ 173 | static UClassID U_EXPORT2 getStaticClassID(void); 174 | 175 | /** 176 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 177 | * method is to implement a simple version of RTTI, since not all C++ 178 | * compilers support genuine RTTI. Polymorphic operator==() and clone() 179 | * methods call this method. 180 | * 181 | * @return The class ID for this object. All objects of a 182 | * given class have the same class ID. Objects of 183 | * other classes have different class IDs. 184 | * @stable ICU 3.8 185 | */ 186 | virtual UClassID getDynamicClassID(void) const; 187 | }; 188 | 189 | U_NAMESPACE_END 190 | 191 | #endif /* #if !UCONFIG_NO_FORMATTING */ 192 | 193 | #endif // TZTRANS_H 194 | 195 | //eof 196 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ucat.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2003-2004, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Author: Alan Liu 7 | * Created: March 19 2003 8 | * Since: ICU 2.6 9 | ********************************************************************** 10 | */ 11 | #ifndef UCAT_H 12 | #define UCAT_H 13 | 14 | #include "unicode/utypes.h" 15 | #include "unicode/ures.h" 16 | 17 | /** 18 | * \file 19 | * \brief C API: Message Catalog Wrappers 20 | * 21 | * This C API provides look-alike functions that deliberately resemble 22 | * the POSIX catopen, catclose, and catgets functions. The underlying 23 | * implementation is in terms of ICU resource bundles, rather than 24 | * POSIX message catalogs. 25 | * 26 | * The ICU resource bundles obey standard ICU inheritance policies. 27 | * To facilitate this, sets and messages are flattened into one tier. 28 | * This is done by creating resource bundle keys of the form 29 | * <set_num>%<msg_num> where set_num is the set number and msg_num is 30 | * the message number, formatted as decimal strings. 31 | * 32 | * Example: Consider a message catalog containing two sets: 33 | * 34 | * Set 1: Message 4 = "Good morning." 35 | * Message 5 = "Good afternoon." 36 | * Message 7 = "Good evening." 37 | * Message 8 = "Good night." 38 | * Set 4: Message 14 = "Please " 39 | * Message 19 = "Thank you." 40 | * Message 20 = "Sincerely," 41 | * 42 | * The ICU resource bundle source file would, assuming it is named 43 | * "greet.txt", would look like this: 44 | * 45 | * greet 46 | * { 47 | * 1%4 { "Good morning." } 48 | * 1%5 { "Good afternoon." } 49 | * 1%7 { "Good evening." } 50 | * 1%8 { "Good night." } 51 | * 52 | * 4%14 { "Please " } 53 | * 4%19 { "Thank you." } 54 | * 4%20 { "Sincerely," } 55 | * } 56 | * 57 | * The catgets function is commonly used in combination with functions 58 | * like printf and strftime. ICU components like message format can 59 | * be used instead, although they use a different format syntax. 60 | * There is an ICU package, icuio, that provides some of 61 | * the POSIX-style formatting API. 62 | */ 63 | 64 | U_CDECL_BEGIN 65 | 66 | /** 67 | * An ICU message catalog descriptor, analogous to nl_catd. 68 | * 69 | * @stable ICU 2.6 70 | */ 71 | typedef UResourceBundle* u_nl_catd; 72 | 73 | /** 74 | * Open and return an ICU message catalog descriptor. The descriptor 75 | * may be passed to u_catgets() to retrieve localized strings. 76 | * 77 | * @param name string containing the full path pointing to the 78 | * directory where the resources reside followed by the package name 79 | * e.g. "/usr/resource/my_app/resources/guimessages" on a Unix system. 80 | * If NULL, ICU default data files will be used. 81 | * 82 | * Unlike POSIX, environment variables are not interpolated within the 83 | * name. 84 | * 85 | * @param locale the locale for which we want to open the resource. If 86 | * NULL, the default ICU locale will be used (see uloc_getDefault). If 87 | * strlen(locale) == 0, the root locale will be used. 88 | * 89 | * @param ec input/output error code. Upon output, 90 | * U_USING_FALLBACK_WARNING indicates that a fallback locale was 91 | * used. For example, 'de_CH' was requested, but nothing was found 92 | * there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the 93 | * default locale data or root locale data was used; neither the 94 | * requested locale nor any of its fallback locales were found. 95 | * 96 | * @return a message catalog descriptor that may be passed to 97 | * u_catgets(). If the ec parameter indicates success, then the caller 98 | * is responsible for calling u_catclose() to close the message 99 | * catalog. If the ec parameter indicates failure, then NULL will be 100 | * returned. 101 | * 102 | * @stable ICU 2.6 103 | */ 104 | U_STABLE u_nl_catd U_EXPORT2 105 | u_catopen(const char* name, const char* locale, UErrorCode* ec); 106 | 107 | /** 108 | * Close an ICU message catalog, given its descriptor. 109 | * 110 | * @param catd a message catalog descriptor to be closed. May be NULL, 111 | * in which case no action is taken. 112 | * 113 | * @stable ICU 2.6 114 | */ 115 | U_STABLE void U_EXPORT2 116 | u_catclose(u_nl_catd catd); 117 | 118 | /** 119 | * Retrieve a localized string from an ICU message catalog. 120 | * 121 | * @param catd a message catalog descriptor returned by u_catopen. 122 | * 123 | * @param set_num the message catalog set number. Sets need not be 124 | * numbered consecutively. 125 | * 126 | * @param msg_num the message catalog message number within the 127 | * set. Messages need not be numbered consecutively. 128 | * 129 | * @param s the default string. This is returned if the string 130 | * specified by the set_num and msg_num is not found. It must be 131 | * zero-terminated. 132 | * 133 | * @param len fill-in parameter to receive the length of the result. 134 | * May be NULL, in which case it is ignored. 135 | * 136 | * @param ec input/output error code. May be U_USING_FALLBACK_WARNING 137 | * or U_USING_DEFAULT_WARNING. U_MISSING_RESOURCE_ERROR indicates that 138 | * the set_num/msg_num tuple does not specify a valid message string 139 | * in this catalog. 140 | * 141 | * @return a pointer to a zero-terminated UChar array which lives in 142 | * an internal buffer area, typically a memory mapped/DLL file. The 143 | * caller must NOT delete this pointer. If the call is unsuccessful 144 | * for any reason, then s is returned. This includes the situation in 145 | * which ec indicates a failing error code upon entry to this 146 | * function. 147 | * 148 | * @stable ICU 2.6 149 | */ 150 | U_STABLE const UChar* U_EXPORT2 151 | u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, 152 | const UChar* s, 153 | int32_t* len, UErrorCode* ec); 154 | 155 | U_CDECL_END 156 | 157 | #endif /*UCAT_H*/ 158 | /*eof*/ 159 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ucnvsel.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 2008-2011, International Business Machines 5 | * Corporation, Google and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | */ 9 | /* 10 | * Author : eldawy@google.com (Mohamed Eldawy) 11 | * ucnvsel.h 12 | * 13 | * Purpose: To generate a list of encodings capable of handling 14 | * a given Unicode text 15 | * 16 | * Started 09-April-2008 17 | */ 18 | 19 | #ifndef __ICU_UCNV_SEL_H__ 20 | #define __ICU_UCNV_SEL_H__ 21 | 22 | #include "unicode/utypes.h" 23 | 24 | #if !UCONFIG_NO_CONVERSION 25 | 26 | #include "unicode/uset.h" 27 | #include "unicode/utf16.h" 28 | #include "unicode/uenum.h" 29 | #include "unicode/ucnv.h" 30 | #include "unicode/localpointer.h" 31 | 32 | /** 33 | * \file 34 | * 35 | * A converter selector is built with a set of encoding/charset names 36 | * and given an input string returns the set of names of the 37 | * corresponding converters which can convert the string. 38 | * 39 | * A converter selector can be serialized into a buffer and reopened 40 | * from the serialized form. 41 | */ 42 | 43 | /** 44 | * @{ 45 | * The selector data structure 46 | */ 47 | struct UConverterSelector; 48 | typedef struct UConverterSelector UConverterSelector; 49 | /** @} */ 50 | 51 | /** 52 | * Open a selector. 53 | * If converterListSize is 0, build for all available converters. 54 | * If excludedCodePoints is NULL, don't exclude any code points. 55 | * 56 | * @param converterList a pointer to encoding names needed to be involved. 57 | * Can be NULL if converterListSize==0. 58 | * The list and the names will be cloned, and the caller 59 | * retains ownership of the original. 60 | * @param converterListSize number of encodings in above list. 61 | * If 0, builds a selector for all available converters. 62 | * @param excludedCodePoints a set of code points to be excluded from consideration. 63 | * That is, excluded code points in a string do not change 64 | * the selection result. (They might be handled by a callback.) 65 | * Use NULL to exclude nothing. 66 | * @param whichSet what converter set to use? Use this to determine whether 67 | * to consider only roundtrip mappings or also fallbacks. 68 | * @param status an in/out ICU UErrorCode 69 | * @return the new selector 70 | * 71 | * @stable ICU 4.2 72 | */ 73 | U_STABLE UConverterSelector* U_EXPORT2 74 | ucnvsel_open(const char* const* converterList, int32_t converterListSize, 75 | const USet* excludedCodePoints, 76 | const UConverterUnicodeSet whichSet, UErrorCode* status); 77 | 78 | /** 79 | * Closes a selector. 80 | * If any Enumerations were returned by ucnv_select*, they become invalid. 81 | * They can be closed before or after calling ucnv_closeSelector, 82 | * but should never be used after the selector is closed. 83 | * 84 | * @see ucnv_selectForString 85 | * @see ucnv_selectForUTF8 86 | * 87 | * @param sel selector to close 88 | * 89 | * @stable ICU 4.2 90 | */ 91 | U_STABLE void U_EXPORT2 92 | ucnvsel_close(UConverterSelector *sel); 93 | 94 | #if U_SHOW_CPLUSPLUS_API 95 | 96 | U_NAMESPACE_BEGIN 97 | 98 | /** 99 | * \class LocalUConverterSelectorPointer 100 | * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). 101 | * For most methods see the LocalPointerBase base class. 102 | * 103 | * @see LocalPointerBase 104 | * @see LocalPointer 105 | * @stable ICU 4.4 106 | */ 107 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); 108 | 109 | U_NAMESPACE_END 110 | 111 | #endif 112 | 113 | /** 114 | * Open a selector from its serialized form. 115 | * The buffer must remain valid and unchanged for the lifetime of the selector. 116 | * This is much faster than creating a selector from scratch. 117 | * Using a serialized form from a different machine (endianness/charset) is supported. 118 | * 119 | * @param buffer pointer to the serialized form of a converter selector; 120 | * must be 32-bit-aligned 121 | * @param length the capacity of this buffer (can be equal to or larger than 122 | * the actual data length) 123 | * @param status an in/out ICU UErrorCode 124 | * @return the new selector 125 | * 126 | * @stable ICU 4.2 127 | */ 128 | U_STABLE UConverterSelector* U_EXPORT2 129 | ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); 130 | 131 | /** 132 | * Serialize a selector into a linear buffer. 133 | * The serialized form is portable to different machines. 134 | * 135 | * @param sel selector to consider 136 | * @param buffer pointer to 32-bit-aligned memory to be filled with the 137 | * serialized form of this converter selector 138 | * @param bufferCapacity the capacity of this buffer 139 | * @param status an in/out ICU UErrorCode 140 | * @return the required buffer capacity to hold serialize data (even if the call fails 141 | * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) 142 | * 143 | * @stable ICU 4.2 144 | */ 145 | U_STABLE int32_t U_EXPORT2 146 | ucnvsel_serialize(const UConverterSelector* sel, 147 | void* buffer, int32_t bufferCapacity, UErrorCode* status); 148 | 149 | /** 150 | * Select converters that can map all characters in a UTF-16 string, 151 | * ignoring the excluded code points. 152 | * 153 | * @param sel a selector 154 | * @param s UTF-16 string 155 | * @param length length of the string, or -1 if NUL-terminated 156 | * @param status an in/out ICU UErrorCode 157 | * @return an enumeration containing encoding names. 158 | * The returned encoding names and their order will be the same as 159 | * supplied when building the selector. 160 | * 161 | * @stable ICU 4.2 162 | */ 163 | U_STABLE UEnumeration * U_EXPORT2 164 | ucnvsel_selectForString(const UConverterSelector* sel, 165 | const UChar *s, int32_t length, UErrorCode *status); 166 | 167 | /** 168 | * Select converters that can map all characters in a UTF-8 string, 169 | * ignoring the excluded code points. 170 | * 171 | * @param sel a selector 172 | * @param s UTF-8 string 173 | * @param length length of the string, or -1 if NUL-terminated 174 | * @param status an in/out ICU UErrorCode 175 | * @return an enumeration containing encoding names. 176 | * The returned encoding names and their order will be the same as 177 | * supplied when building the selector. 178 | * 179 | * @stable ICU 4.2 180 | */ 181 | U_STABLE UEnumeration * U_EXPORT2 182 | ucnvsel_selectForUTF8(const UConverterSelector* sel, 183 | const char *s, int32_t length, UErrorCode *status); 184 | 185 | #endif /* !UCONFIG_NO_CONVERSION */ 186 | 187 | #endif /* __ICU_UCNV_SEL_H__ */ 188 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/udisplaycontext.h: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************************** 3 | * Copyright (C) 2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ***************************************************************************************** 6 | */ 7 | 8 | #ifndef UDISPLAYCONTEXT_H 9 | #define UDISPLAYCONTEXT_H 10 | 11 | #include "unicode/utypes.h" 12 | 13 | #if !UCONFIG_NO_FORMATTING 14 | 15 | /** 16 | * \file 17 | * \brief C API: Display context types (enum values) 18 | */ 19 | 20 | /** 21 | * Display context types, for getting values of a particular setting. 22 | * Note, the specific numeric values are internal and may change. 23 | * @stable ICU 51 24 | */ 25 | enum UDisplayContextType { 26 | /** 27 | * Type to retrieve the dialect handling setting, e.g. 28 | * UDISPCTX_STANDARD_NAMES or UDISPCTX_DIALECT_NAMES. 29 | * @stable ICU 51 30 | */ 31 | UDISPCTX_TYPE_DIALECT_HANDLING = 0, 32 | /** 33 | * Type to retrieve the capitalization context setting, e.g. 34 | * UDISPCTX_CAPITALIZATION_NONE, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, 35 | * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc. 36 | * @stable ICU 51 37 | */ 38 | UDISPCTX_TYPE_CAPITALIZATION = 1 39 | #ifndef U_HIDE_DRAFT_API 40 | , 41 | /** 42 | * Type to retrieve the display length setting, e.g. 43 | * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT. 44 | * @draft ICU 54 45 | */ 46 | UDISPCTX_TYPE_DISPLAY_LENGTH = 2 47 | #endif /* U_HIDE_DRAFT_API */ 48 | }; 49 | /** 50 | * @stable ICU 51 51 | */ 52 | typedef enum UDisplayContextType UDisplayContextType; 53 | 54 | /** 55 | * Display context settings. 56 | * Note, the specific numeric values are internal and may change. 57 | * @stable ICU 51 58 | */ 59 | enum UDisplayContext { 60 | /** 61 | * ================================ 62 | * DIALECT_HANDLING can be set to one of UDISPCTX_STANDARD_NAMES or 63 | * UDISPCTX_DIALECT_NAMES. Use UDisplayContextType UDISPCTX_TYPE_DIALECT_HANDLING 64 | * to get the value. 65 | */ 66 | /** 67 | * A possible setting for DIALECT_HANDLING: 68 | * use standard names when generating a locale name, 69 | * e.g. en_GB displays as 'English (United Kingdom)'. 70 | * @stable ICU 51 71 | */ 72 | UDISPCTX_STANDARD_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 0, 73 | /** 74 | * A possible setting for DIALECT_HANDLING: 75 | * use dialect names, when generating a locale name, 76 | * e.g. en_GB displays as 'British English'. 77 | * @stable ICU 51 78 | */ 79 | UDISPCTX_DIALECT_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 1, 80 | /** 81 | * ================================ 82 | * CAPITALIZATION can be set to one of UDISPCTX_CAPITALIZATION_NONE, 83 | * UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, 84 | * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, 85 | * UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, or 86 | * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. 87 | * Use UDisplayContextType UDISPCTX_TYPE_CAPITALIZATION to get the value. 88 | */ 89 | /** 90 | * The capitalization context to be used is unknown (this is the default value). 91 | * @stable ICU 51 92 | */ 93 | UDISPCTX_CAPITALIZATION_NONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 0, 94 | /** 95 | * The capitalization context if a date, date symbol or display name is to be 96 | * formatted with capitalization appropriate for the middle of a sentence. 97 | * @stable ICU 51 98 | */ 99 | UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 1, 100 | /** 101 | * The capitalization context if a date, date symbol or display name is to be 102 | * formatted with capitalization appropriate for the beginning of a sentence. 103 | * @stable ICU 51 104 | */ 105 | UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 2, 106 | /** 107 | * The capitalization context if a date, date symbol or display name is to be 108 | * formatted with capitalization appropriate for a user-interface list or menu item. 109 | * @stable ICU 51 110 | */ 111 | UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 3, 112 | /** 113 | * The capitalization context if a date, date symbol or display name is to be 114 | * formatted with capitalization appropriate for stand-alone usage such as an 115 | * isolated name on a calendar page. 116 | * @stable ICU 51 117 | */ 118 | UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4 119 | #ifndef U_HIDE_DRAFT_API 120 | , 121 | /** 122 | * ================================ 123 | * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or 124 | * UDISPCTX_LENGTH_SHORT. Use UDisplayContextType UDISPCTX_TYPE_DISPLAY_LENGTH 125 | * to get the value. 126 | */ 127 | /** 128 | * A possible setting for DISPLAY_LENGTH: 129 | * use full names when generating a locale name, 130 | * e.g. "United States" for US. 131 | * @draft ICU 54 132 | */ 133 | UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0, 134 | /** 135 | * A possible setting for DISPLAY_LENGTH: 136 | * use short names when generating a locale name, 137 | * e.g. "U.S." for US. 138 | * @draft ICU 54 139 | */ 140 | UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1 141 | #endif /* U_HIDE_DRAFT_API */ 142 | }; 143 | /** 144 | * @stable ICU 51 145 | */ 146 | typedef enum UDisplayContext UDisplayContext; 147 | 148 | #endif /* #if !UCONFIG_NO_FORMATTING */ 149 | 150 | #endif 151 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ugender.h: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************************** 3 | * Copyright (C) 2010-2013, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ***************************************************************************************** 6 | */ 7 | 8 | #ifndef UGENDER_H 9 | #define UGENDER_H 10 | 11 | #include "unicode/utypes.h" 12 | 13 | #if !UCONFIG_NO_FORMATTING 14 | 15 | #include "unicode/localpointer.h" 16 | 17 | /** 18 | * \file 19 | * \brief C API: The purpose of this API is to compute the gender of a list as a 20 | * whole given the gender of each element. 21 | * 22 | */ 23 | 24 | /** 25 | * Genders 26 | * @stable ICU 50 27 | */ 28 | enum UGender { 29 | /** 30 | * Male gender. 31 | * @stable ICU 50 32 | */ 33 | UGENDER_MALE, 34 | /** 35 | * Female gender. 36 | * @stable ICU 50 37 | */ 38 | UGENDER_FEMALE, 39 | /** 40 | * Neutral gender. 41 | * @stable ICU 50 42 | */ 43 | UGENDER_OTHER 44 | }; 45 | /** 46 | * @stable ICU 50 47 | */ 48 | typedef enum UGender UGender; 49 | 50 | /** 51 | * Opaque UGenderInfo object for use in C programs. 52 | * @stable ICU 50 53 | */ 54 | struct UGenderInfo; 55 | typedef struct UGenderInfo UGenderInfo; 56 | 57 | /** 58 | * Opens a new UGenderInfo object given locale. 59 | * @param locale The locale for which the rules are desired. 60 | * @param status UErrorCode pointer 61 | * @return A UGenderInfo for the specified locale, or NULL if an error occurred. 62 | * @stable ICU 50 63 | */ 64 | U_STABLE const UGenderInfo* U_EXPORT2 65 | ugender_getInstance(const char *locale, UErrorCode *status); 66 | 67 | 68 | /** 69 | * Given a list, returns the gender of the list as a whole. 70 | * @param genderInfo pointer that ugender_getInstance returns. 71 | * @param genders the gender of each element in the list. 72 | * @param size the size of the list. 73 | * @param status A pointer to a UErrorCode to receive any errors. 74 | * @return The gender of the list. 75 | * @stable ICU 50 76 | */ 77 | U_STABLE UGender U_EXPORT2 78 | ugender_getListGender(const UGenderInfo* genderinfo, const UGender *genders, int32_t size, UErrorCode *status); 79 | 80 | #endif /* #if !UCONFIG_NO_FORMATTING */ 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/umisc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2006, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * file name: umisc.h 7 | * encoding: US-ASCII 8 | * tab size: 8 (not used) 9 | * indentation:4 10 | * 11 | * created on: 1999oct15 12 | * created by: Markus W. Scherer 13 | */ 14 | 15 | #ifndef UMISC_H 16 | #define UMISC_H 17 | 18 | #include "unicode/utypes.h" 19 | 20 | /** 21 | * \file 22 | * \brief C API:misc definitions 23 | * 24 | * This file contains miscellaneous definitions for the C APIs. 25 | */ 26 | 27 | U_CDECL_BEGIN 28 | 29 | /** A struct representing a range of text containing a specific field 30 | * @stable ICU 2.0 31 | */ 32 | typedef struct UFieldPosition { 33 | /** 34 | * The field 35 | * @stable ICU 2.0 36 | */ 37 | int32_t field; 38 | /** 39 | * The start of the text range containing field 40 | * @stable ICU 2.0 41 | */ 42 | int32_t beginIndex; 43 | /** 44 | * The limit of the text range containing field 45 | * @stable ICU 2.0 46 | */ 47 | int32_t endIndex; 48 | } UFieldPosition; 49 | 50 | #if !UCONFIG_NO_SERVICE 51 | /** 52 | * Opaque type returned by registerInstance, registerFactory and unregister for service registration. 53 | * @stable ICU 2.6 54 | */ 55 | typedef const void* URegistryKey; 56 | #endif 57 | 58 | U_CDECL_END 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/unifilt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 1999-2010, International Business Machines Corporation and others. 4 | * All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 11/17/99 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIFILT_H 11 | #define UNIFILT_H 12 | 13 | #include "unicode/unifunct.h" 14 | #include "unicode/unimatch.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: Unicode Filter 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | /** 24 | * U_ETHER is used to represent character values for positions outside 25 | * a range. For example, transliterator uses this to represent 26 | * characters outside the range contextStart..contextLimit-1. This 27 | * allows explicit matching by rules and UnicodeSets of text outside a 28 | * defined range. 29 | * @stable ICU 3.0 30 | */ 31 | #define U_ETHER ((UChar)0xFFFF) 32 | 33 | /** 34 | * 35 | * UnicodeFilter defines a protocol for selecting a 36 | * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. 37 | * Currently, filters are used in conjunction with classes like {@link 38 | * Transliterator} to only process selected characters through a 39 | * transformation. 40 | * 41 | *

Note: UnicodeFilter currently stubs out two pure virtual methods 42 | * of its base class, UnicodeMatcher. These methods are toPattern() 43 | * and matchesIndexValue(). This is done so that filter classes that 44 | * are not actually used as matchers -- specifically, those in the 45 | * UnicodeFilterLogic component, and those in tests -- can continue to 46 | * work without defining these methods. As long as a filter is not 47 | * used in an RBT during real transliteration, these methods will not 48 | * be called. However, this breaks the UnicodeMatcher base class 49 | * protocol, and it is not a correct solution. 50 | * 51 | *

In the future we may revisit the UnicodeMatcher / UnicodeFilter 52 | * hierarchy and either redesign it, or simply remove the stubs in 53 | * UnicodeFilter and force subclasses to implement the full 54 | * UnicodeMatcher protocol. 55 | * 56 | * @see UnicodeFilterLogic 57 | * @stable ICU 2.0 58 | */ 59 | class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { 60 | 61 | public: 62 | /** 63 | * Destructor 64 | * @stable ICU 2.0 65 | */ 66 | virtual ~UnicodeFilter(); 67 | 68 | /** 69 | * Returns true for characters that are in the selected 70 | * subset. In other words, if a character is to be 71 | * filtered, then contains() returns 72 | * false. 73 | * @stable ICU 2.0 74 | */ 75 | virtual UBool contains(UChar32 c) const = 0; 76 | 77 | /** 78 | * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer 79 | * and return the pointer. 80 | * @stable ICU 2.4 81 | */ 82 | virtual UnicodeMatcher* toMatcher() const; 83 | 84 | /** 85 | * Implement UnicodeMatcher API. 86 | * @stable ICU 2.4 87 | */ 88 | virtual UMatchDegree matches(const Replaceable& text, 89 | int32_t& offset, 90 | int32_t limit, 91 | UBool incremental); 92 | 93 | /** 94 | * UnicodeFunctor API. Nothing to do. 95 | * @stable ICU 2.4 96 | */ 97 | virtual void setData(const TransliterationRuleData*); 98 | 99 | /** 100 | * ICU "poor man's RTTI", returns a UClassID for this class. 101 | * 102 | * @stable ICU 2.2 103 | */ 104 | static UClassID U_EXPORT2 getStaticClassID(); 105 | 106 | protected: 107 | 108 | /* 109 | * Since this class has pure virtual functions, 110 | * a constructor can't be used. 111 | * @stable ICU 2.0 112 | */ 113 | /* UnicodeFilter();*/ 114 | }; 115 | 116 | /*inline UnicodeFilter::UnicodeFilter() {}*/ 117 | 118 | U_NAMESPACE_END 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/unifunct.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2002-2005, International Business Machines Corporation 4 | * and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 01/14/2002 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIFUNCT_H 11 | #define UNIFUNCT_H 12 | 13 | #include "unicode/utypes.h" 14 | #include "unicode/uobject.h" 15 | 16 | /** 17 | * \file 18 | * \brief C++ API: Unicode Functor 19 | */ 20 | 21 | U_NAMESPACE_BEGIN 22 | 23 | class UnicodeMatcher; 24 | class UnicodeReplacer; 25 | class TransliterationRuleData; 26 | 27 | /** 28 | * UnicodeFunctor is an abstract base class for objects 29 | * that perform match and/or replace operations on Unicode strings. 30 | * @author Alan Liu 31 | * @stable ICU 2.4 32 | */ 33 | class U_COMMON_API UnicodeFunctor : public UObject { 34 | 35 | public: 36 | 37 | /** 38 | * Destructor 39 | * @stable ICU 2.4 40 | */ 41 | virtual ~UnicodeFunctor(); 42 | 43 | /** 44 | * Return a copy of this object. All UnicodeFunctor objects 45 | * have to support cloning in order to allow classes using 46 | * UnicodeFunctor to implement cloning. 47 | * @stable ICU 2.4 48 | */ 49 | virtual UnicodeFunctor* clone() const = 0; 50 | 51 | /** 52 | * Cast 'this' to a UnicodeMatcher* pointer and return the 53 | * pointer, or null if this is not a UnicodeMatcher*. Subclasses 54 | * that mix in UnicodeMatcher as a base class must override this. 55 | * This protocol is required because a pointer to a UnicodeFunctor 56 | * cannot be cast to a pointer to a UnicodeMatcher, since 57 | * UnicodeMatcher is a mixin that does not derive from 58 | * UnicodeFunctor. 59 | * @stable ICU 2.4 60 | */ 61 | virtual UnicodeMatcher* toMatcher() const; 62 | 63 | /** 64 | * Cast 'this' to a UnicodeReplacer* pointer and return the 65 | * pointer, or null if this is not a UnicodeReplacer*. Subclasses 66 | * that mix in UnicodeReplacer as a base class must override this. 67 | * This protocol is required because a pointer to a UnicodeFunctor 68 | * cannot be cast to a pointer to a UnicodeReplacer, since 69 | * UnicodeReplacer is a mixin that does not derive from 70 | * UnicodeFunctor. 71 | * @stable ICU 2.4 72 | */ 73 | virtual UnicodeReplacer* toReplacer() const; 74 | 75 | /** 76 | * Return the class ID for this class. This is useful only for 77 | * comparing to a return value from getDynamicClassID(). 78 | * @return The class ID for all objects of this class. 79 | * @stable ICU 2.0 80 | */ 81 | static UClassID U_EXPORT2 getStaticClassID(void); 82 | 83 | /** 84 | * Returns a unique class ID polymorphically. This method 85 | * is to implement a simple version of RTTI, since not all C++ 86 | * compilers support genuine RTTI. Polymorphic operator==() and 87 | * clone() methods call this method. 88 | * 89 | *

Concrete subclasses of UnicodeFunctor should use the macro 90 | * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to 91 | * provide definitios getStaticClassID and getDynamicClassID. 92 | * 93 | * @return The class ID for this object. All objects of a given 94 | * class have the same class ID. Objects of other classes have 95 | * different class IDs. 96 | * @stable ICU 2.4 97 | */ 98 | virtual UClassID getDynamicClassID(void) const = 0; 99 | 100 | /** 101 | * Set the data object associated with this functor. The data 102 | * object provides context for functor-to-standin mapping. This 103 | * method is required when assigning a functor to a different data 104 | * object. This function MAY GO AWAY later if the architecture is 105 | * changed to pass data object pointers through the API. 106 | * @internal ICU 2.1 107 | */ 108 | virtual void setData(const TransliterationRuleData*) = 0; 109 | 110 | protected: 111 | 112 | /** 113 | * Since this class has pure virtual functions, 114 | * a constructor can't be used. 115 | * @stable ICU 2.0 116 | */ 117 | /*UnicodeFunctor();*/ 118 | 119 | }; 120 | 121 | /*inline UnicodeFunctor::UnicodeFunctor() {}*/ 122 | 123 | U_NAMESPACE_END 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/unimatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. 3 | ********************************************************************** 4 | * Date Name Description 5 | * 07/18/01 aliu Creation. 6 | ********************************************************************** 7 | */ 8 | #ifndef UNIMATCH_H 9 | #define UNIMATCH_H 10 | 11 | #include "unicode/utypes.h" 12 | 13 | /** 14 | * \file 15 | * \brief C++ API: Unicode Matcher 16 | */ 17 | 18 | 19 | U_NAMESPACE_BEGIN 20 | 21 | class Replaceable; 22 | class UnicodeString; 23 | class UnicodeSet; 24 | 25 | /** 26 | * Constants returned by UnicodeMatcher::matches() 27 | * indicating the degree of match. 28 | * @stable ICU 2.4 29 | */ 30 | enum UMatchDegree { 31 | /** 32 | * Constant returned by matches() indicating a 33 | * mismatch between the text and this matcher. The text contains 34 | * a character which does not match, or the text does not contain 35 | * all desired characters for a non-incremental match. 36 | * @stable ICU 2.4 37 | */ 38 | U_MISMATCH, 39 | 40 | /** 41 | * Constant returned by matches() indicating a 42 | * partial match between the text and this matcher. This value is 43 | * only returned for incremental match operations. All characters 44 | * of the text match, but more characters are required for a 45 | * complete match. Alternatively, for variable-length matchers, 46 | * all characters of the text match, and if more characters were 47 | * supplied at limit, they might also match. 48 | * @stable ICU 2.4 49 | */ 50 | U_PARTIAL_MATCH, 51 | 52 | /** 53 | * Constant returned by matches() indicating a 54 | * complete match between the text and this matcher. For an 55 | * incremental variable-length match, this value is returned if 56 | * the given text matches, and it is known that additional 57 | * characters would not alter the extent of the match. 58 | * @stable ICU 2.4 59 | */ 60 | U_MATCH 61 | }; 62 | 63 | /** 64 | * UnicodeMatcher defines a protocol for objects that can 65 | * match a range of characters in a Replaceable string. 66 | * @stable ICU 2.4 67 | */ 68 | class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an interface/mixin class */ { 69 | 70 | public: 71 | /** 72 | * Destructor. 73 | * @stable ICU 2.4 74 | */ 75 | virtual ~UnicodeMatcher(); 76 | 77 | /** 78 | * Return a UMatchDegree value indicating the degree of match for 79 | * the given text at the given offset. Zero, one, or more 80 | * characters may be matched. 81 | * 82 | * Matching in the forward direction is indicated by limit > 83 | * offset. Characters from offset forwards to limit-1 will be 84 | * considered for matching. 85 | * 86 | * Matching in the reverse direction is indicated by limit < 87 | * offset. Characters from offset backwards to limit+1 will be 88 | * considered for matching. 89 | * 90 | * If limit == offset then the only match possible is a zero 91 | * character match (which subclasses may implement if desired). 92 | * 93 | * As a side effect, advance the offset parameter to the limit of 94 | * the matched substring. In the forward direction, this will be 95 | * the index of the last matched character plus one. In the 96 | * reverse direction, this will be the index of the last matched 97 | * character minus one. 98 | * 99 | *

Note: This method is not const because some classes may 100 | * modify their state as the result of a match. 101 | * 102 | * @param text the text to be matched 103 | * @param offset on input, the index into text at which to begin 104 | * matching. On output, the limit of the matched text. The 105 | * number of matched characters is the output value of offset 106 | * minus the input value. Offset should always point to the 107 | * HIGH SURROGATE (leading code unit) of a pair of surrogates, 108 | * both on entry and upon return. 109 | * @param limit the limit index of text to be matched. Greater 110 | * than offset for a forward direction match, less than offset for 111 | * a backward direction match. The last character to be 112 | * considered for matching will be text.charAt(limit-1) in the 113 | * forward direction or text.charAt(limit+1) in the backward 114 | * direction. 115 | * @param incremental if TRUE, then assume further characters may 116 | * be inserted at limit and check for partial matching. Otherwise 117 | * assume the text as given is complete. 118 | * @return a match degree value indicating a full match, a partial 119 | * match, or a mismatch. If incremental is FALSE then 120 | * U_PARTIAL_MATCH should never be returned. 121 | * @stable ICU 2.4 122 | */ 123 | virtual UMatchDegree matches(const Replaceable& text, 124 | int32_t& offset, 125 | int32_t limit, 126 | UBool incremental) = 0; 127 | 128 | /** 129 | * Returns a string representation of this matcher. If the result of 130 | * calling this function is passed to the appropriate parser, it 131 | * will produce another matcher that is equal to this one. 132 | * @param result the string to receive the pattern. Previous 133 | * contents will be deleted. 134 | * @param escapeUnprintable if TRUE then convert unprintable 135 | * character to their hex escape representations, \\uxxxx or 136 | * \\Uxxxxxxxx. Unprintable characters are those other than 137 | * U+000A, U+0020..U+007E. 138 | * @stable ICU 2.4 139 | */ 140 | virtual UnicodeString& toPattern(UnicodeString& result, 141 | UBool escapeUnprintable = FALSE) const = 0; 142 | 143 | /** 144 | * Returns TRUE if this matcher will match a character c, where c 145 | * & 0xFF == v, at offset, in the forward direction (with limit > 146 | * offset). This is used by RuleBasedTransliterator for 147 | * indexing. 148 | * @stable ICU 2.4 149 | */ 150 | virtual UBool matchesIndexValue(uint8_t v) const = 0; 151 | 152 | /** 153 | * Union the set of all characters that may be matched by this object 154 | * into the given set. 155 | * @param toUnionTo the set into which to union the source characters 156 | * @stable ICU 2.4 157 | */ 158 | virtual void addMatchSetTo(UnicodeSet& toUnionTo) const = 0; 159 | }; 160 | 161 | U_NAMESPACE_END 162 | 163 | #endif 164 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/unirepl.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (c) 2002-2005, International Business Machines Corporation 4 | * and others. All Rights Reserved. 5 | ********************************************************************** 6 | * Date Name Description 7 | * 01/14/2002 aliu Creation. 8 | ********************************************************************** 9 | */ 10 | #ifndef UNIREPL_H 11 | #define UNIREPL_H 12 | 13 | #include "unicode/utypes.h" 14 | 15 | /** 16 | * \file 17 | * \brief C++ API: UnicodeReplacer 18 | */ 19 | 20 | U_NAMESPACE_BEGIN 21 | 22 | class Replaceable; 23 | class UnicodeString; 24 | class UnicodeSet; 25 | 26 | /** 27 | * UnicodeReplacer defines a protocol for objects that 28 | * replace a range of characters in a Replaceable string with output 29 | * text. The replacement is done via the Replaceable API so as to 30 | * preserve out-of-band data. 31 | * 32 | *

This is a mixin class. 33 | * @author Alan Liu 34 | * @stable ICU 2.4 35 | */ 36 | class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ { 37 | 38 | public: 39 | 40 | /** 41 | * Destructor. 42 | * @stable ICU 2.4 43 | */ 44 | virtual ~UnicodeReplacer(); 45 | 46 | /** 47 | * Replace characters in 'text' from 'start' to 'limit' with the 48 | * output text of this object. Update the 'cursor' parameter to 49 | * give the cursor position and return the length of the 50 | * replacement text. 51 | * 52 | * @param text the text to be matched 53 | * @param start inclusive start index of text to be replaced 54 | * @param limit exclusive end index of text to be replaced; 55 | * must be greater than or equal to start 56 | * @param cursor output parameter for the cursor position. 57 | * Not all replacer objects will update this, but in a complete 58 | * tree of replacer objects, representing the entire output side 59 | * of a transliteration rule, at least one must update it. 60 | * @return the number of 16-bit code units in the text replacing 61 | * the characters at offsets start..(limit-1) in text 62 | * @stable ICU 2.4 63 | */ 64 | virtual int32_t replace(Replaceable& text, 65 | int32_t start, 66 | int32_t limit, 67 | int32_t& cursor) = 0; 68 | 69 | /** 70 | * Returns a string representation of this replacer. If the 71 | * result of calling this function is passed to the appropriate 72 | * parser, typically TransliteratorParser, it will produce another 73 | * replacer that is equal to this one. 74 | * @param result the string to receive the pattern. Previous 75 | * contents will be deleted. 76 | * @param escapeUnprintable if TRUE then convert unprintable 77 | * character to their hex escape representations, \\uxxxx or 78 | * \\Uxxxxxxxx. Unprintable characters are defined by 79 | * Utility.isUnprintable(). 80 | * @return a reference to 'result'. 81 | * @stable ICU 2.4 82 | */ 83 | virtual UnicodeString& toReplacerPattern(UnicodeString& result, 84 | UBool escapeUnprintable) const = 0; 85 | 86 | /** 87 | * Union the set of all characters that may output by this object 88 | * into the given set. 89 | * @param toUnionTo the set into which to union the output characters 90 | * @stable ICU 2.4 91 | */ 92 | virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0; 93 | }; 94 | 95 | U_NAMESPACE_END 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/upluralrules.h: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************************** 3 | * Copyright (C) 2010-2013, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ***************************************************************************************** 6 | */ 7 | 8 | #ifndef UPLURALRULES_H 9 | #define UPLURALRULES_H 10 | 11 | #include "unicode/utypes.h" 12 | 13 | #if !UCONFIG_NO_FORMATTING 14 | 15 | #include "unicode/localpointer.h" 16 | 17 | /** 18 | * \file 19 | * \brief C API: Plural rules, select plural keywords for numeric values. 20 | * 21 | * A UPluralRules object defines rules for mapping non-negative numeric 22 | * values onto a small set of keywords. Rules are constructed from a text 23 | * description, consisting of a series of keywords and conditions. 24 | * The uplrules_select function examines each condition in order and 25 | * returns the keyword for the first condition that matches the number. 26 | * If none match, the default rule(other) is returned. 27 | * 28 | * For more information, see the LDML spec, C.11 Language Plural Rules: 29 | * http://www.unicode.org/reports/tr35/#Language_Plural_Rules 30 | * 31 | * Keywords: ICU locale data has 6 predefined values - 32 | * 'zero', 'one', 'two', 'few', 'many' and 'other'. Callers need to check 33 | * the value of keyword returned by the uplrules_select function. 34 | * 35 | * These are based on CLDR Language Plural Rules. For these 36 | * predefined rules, see the CLDR page at 37 | * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html 38 | */ 39 | 40 | /** 41 | * Type of plurals and PluralRules. 42 | * @stable ICU 50 43 | */ 44 | enum UPluralType { 45 | /** 46 | * Plural rules for cardinal numbers: 1 file vs. 2 files. 47 | * @stable ICU 50 48 | */ 49 | UPLURAL_TYPE_CARDINAL, 50 | /** 51 | * Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc. 52 | * @stable ICU 50 53 | */ 54 | UPLURAL_TYPE_ORDINAL, 55 | /** 56 | * Number of Plural rules types. 57 | * @stable ICU 50 58 | */ 59 | UPLURAL_TYPE_COUNT 60 | }; 61 | /** 62 | * @stable ICU 50 63 | */ 64 | typedef enum UPluralType UPluralType; 65 | 66 | /** 67 | * Opaque UPluralRules object for use in C programs. 68 | * @stable ICU 4.8 69 | */ 70 | struct UPluralRules; 71 | typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRules. @stable ICU 4.8 */ 72 | 73 | /** 74 | * Opens a new UPluralRules object using the predefined cardinal-number plural rules for a 75 | * given locale. 76 | * Same as uplrules_openForType(locale, UPLURAL_TYPE_CARDINAL, status). 77 | * @param locale The locale for which the rules are desired. 78 | * @param status A pointer to a UErrorCode to receive any errors. 79 | * @return A UPluralRules for the specified locale, or NULL if an error occurred. 80 | * @stable ICU 4.8 81 | */ 82 | U_STABLE UPluralRules* U_EXPORT2 83 | uplrules_open(const char *locale, UErrorCode *status); 84 | 85 | /** 86 | * Opens a new UPluralRules object using the predefined plural rules for a 87 | * given locale and the plural type. 88 | * @param locale The locale for which the rules are desired. 89 | * @param type The plural type (e.g., cardinal or ordinal). 90 | * @param status A pointer to a UErrorCode to receive any errors. 91 | * @return A UPluralRules for the specified locale, or NULL if an error occurred. 92 | * @stable ICU 50 93 | */ 94 | U_DRAFT UPluralRules* U_EXPORT2 95 | uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); 96 | 97 | /** 98 | * Closes a UPluralRules object. Once closed it may no longer be used. 99 | * @param uplrules The UPluralRules object to close. 100 | * @stable ICU 4.8 101 | */ 102 | U_STABLE void U_EXPORT2 103 | uplrules_close(UPluralRules *uplrules); 104 | 105 | 106 | #if U_SHOW_CPLUSPLUS_API 107 | 108 | U_NAMESPACE_BEGIN 109 | 110 | /** 111 | * \class LocalUPluralRulesPointer 112 | * "Smart pointer" class, closes a UPluralRules via uplrules_close(). 113 | * For most methods see the LocalPointerBase base class. 114 | * 115 | * @see LocalPointerBase 116 | * @see LocalPointer 117 | * @stable ICU 4.8 118 | */ 119 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close); 120 | 121 | U_NAMESPACE_END 122 | 123 | #endif 124 | 125 | 126 | /** 127 | * Given a number, returns the keyword of the first rule that 128 | * applies to the number, according to the supplied UPluralRules object. 129 | * @param uplrules The UPluralRules object specifying the rules. 130 | * @param number The number for which the rule has to be determined. 131 | * @param keyword The keyword of the rule that applies to number. 132 | * @param capacity The capacity of keyword. 133 | * @param status A pointer to a UErrorCode to receive any errors. 134 | * @return The length of keyword. 135 | * @stable ICU 4.8 136 | */ 137 | U_STABLE int32_t U_EXPORT2 138 | uplrules_select(const UPluralRules *uplrules, 139 | double number, 140 | UChar *keyword, int32_t capacity, 141 | UErrorCode *status); 142 | 143 | #endif /* #if !UCONFIG_NO_FORMATTING */ 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/urep.h: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | * Copyright (C) 1997-2010, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ****************************************************************************** 6 | * Date Name Description 7 | * 06/23/00 aliu Creation. 8 | ****************************************************************************** 9 | */ 10 | 11 | #ifndef __UREP_H 12 | #define __UREP_H 13 | 14 | #include "unicode/utypes.h" 15 | 16 | U_CDECL_BEGIN 17 | 18 | /******************************************************************** 19 | * General Notes 20 | ******************************************************************** 21 | * TODO 22 | * Add usage scenario 23 | * Add test code 24 | * Talk about pinning 25 | * Talk about "can truncate result if out of memory" 26 | */ 27 | 28 | /******************************************************************** 29 | * Data Structures 30 | ********************************************************************/ 31 | /** 32 | * \file 33 | * \brief C API: Callbacks for UReplaceable 34 | */ 35 | /** 36 | * An opaque replaceable text object. This will be manipulated only 37 | * through the caller-supplied UReplaceableFunctor struct. Related 38 | * to the C++ class Replaceable. 39 | * This is currently only used in the Transliterator C API, see utrans.h . 40 | * @stable ICU 2.0 41 | */ 42 | typedef void* UReplaceable; 43 | 44 | /** 45 | * A set of function pointers that transliterators use to manipulate a 46 | * UReplaceable. The caller should supply the required functions to 47 | * manipulate their text appropriately. Related to the C++ class 48 | * Replaceable. 49 | * @stable ICU 2.0 50 | */ 51 | typedef struct UReplaceableCallbacks { 52 | 53 | /** 54 | * Function pointer that returns the number of UChar code units in 55 | * this text. 56 | * 57 | * @param rep A pointer to "this" UReplaceable object. 58 | * @return The length of the text. 59 | * @stable ICU 2.0 60 | */ 61 | int32_t (*length)(const UReplaceable* rep); 62 | 63 | /** 64 | * Function pointer that returns a UChar code units at the given 65 | * offset into this text; 0 <= offset < n, where n is the value 66 | * returned by (*length)(rep). See unistr.h for a description of 67 | * charAt() vs. char32At(). 68 | * 69 | * @param rep A pointer to "this" UReplaceable object. 70 | * @param offset The index at which to fetch the UChar (code unit). 71 | * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds. 72 | * @stable ICU 2.0 73 | */ 74 | UChar (*charAt)(const UReplaceable* rep, 75 | int32_t offset); 76 | 77 | /** 78 | * Function pointer that returns a UChar32 code point at the given 79 | * offset into this text. See unistr.h for a description of 80 | * charAt() vs. char32At(). 81 | * 82 | * @param rep A pointer to "this" UReplaceable object. 83 | * @param offset The index at which to fetch the UChar32 (code point). 84 | * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds. 85 | * @stable ICU 2.0 86 | */ 87 | UChar32 (*char32At)(const UReplaceable* rep, 88 | int32_t offset); 89 | 90 | /** 91 | * Function pointer that replaces text between start and limit in 92 | * this text with the given text. Attributes (out of band info) 93 | * should be retained. 94 | * 95 | * @param rep A pointer to "this" UReplaceable object. 96 | * @param start the starting index of the text to be replaced, 97 | * inclusive. 98 | * @param limit the ending index of the text to be replaced, 99 | * exclusive. 100 | * @param text the new text to replace the UChars from 101 | * start..limit-1. 102 | * @param textLength the number of UChars at text, or -1 if text 103 | * is null-terminated. 104 | * @stable ICU 2.0 105 | */ 106 | void (*replace)(UReplaceable* rep, 107 | int32_t start, 108 | int32_t limit, 109 | const UChar* text, 110 | int32_t textLength); 111 | 112 | /** 113 | * Function pointer that copies the characters in the range 114 | * [start, limit) into the array dst. 115 | * 116 | * @param rep A pointer to "this" UReplaceable object. 117 | * @param start offset of first character which will be copied 118 | * into the array 119 | * @param limit offset immediately following the last character to 120 | * be copied 121 | * @param dst array in which to copy characters. The length of 122 | * dst must be at least (limit - start). 123 | * @stable ICU 2.1 124 | */ 125 | void (*extract)(UReplaceable* rep, 126 | int32_t start, 127 | int32_t limit, 128 | UChar* dst); 129 | 130 | /** 131 | * Function pointer that copies text between start and limit in 132 | * this text to another index in the text. Attributes (out of 133 | * band info) should be retained. After this call, there will be 134 | * (at least) two copies of the characters originally located at 135 | * start..limit-1. 136 | * 137 | * @param rep A pointer to "this" UReplaceable object. 138 | * @param start the starting index of the text to be copied, 139 | * inclusive. 140 | * @param limit the ending index of the text to be copied, 141 | * exclusive. 142 | * @param dest the index at which the copy of the UChars should be 143 | * inserted. 144 | * @stable ICU 2.0 145 | */ 146 | void (*copy)(UReplaceable* rep, 147 | int32_t start, 148 | int32_t limit, 149 | int32_t dest); 150 | 151 | } UReplaceableCallbacks; 152 | 153 | U_CDECL_END 154 | 155 | #endif 156 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ustream.h: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************** 3 | * Copyright (C) 2001-2014 International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ********************************************************************** 6 | * FILE NAME : ustream.h 7 | * 8 | * Modification History: 9 | * 10 | * Date Name Description 11 | * 06/25/2001 grhoten Move iostream from unistr.h 12 | ****************************************************************************** 13 | */ 14 | 15 | #ifndef USTREAM_H 16 | #define USTREAM_H 17 | 18 | #include "unicode/unistr.h" 19 | 20 | #if !UCONFIG_NO_CONVERSION // not available without conversion 21 | 22 | /** 23 | * \file 24 | * \brief C++ API: Unicode iostream like API 25 | * 26 | * At this time, this API is very limited. It contains 27 | * operator<< and operator>> for UnicodeString manipulation with the 28 | * C++ I/O stream API. 29 | */ 30 | 31 | #if !defined(_MSC_VER) 32 | namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 33 | #endif 34 | 35 | #if U_IOSTREAM_SOURCE >= 199711 36 | #if (__GNUC__ == 2) 37 | #include 38 | #else 39 | #include 40 | #include 41 | #endif 42 | 43 | U_NAMESPACE_BEGIN 44 | 45 | /** 46 | * Write the contents of a UnicodeString to a C++ ostream. This functions writes 47 | * the characters in a UnicodeString to an ostream. The UChars in the 48 | * UnicodeString are converted to the char based ostream with the default 49 | * converter. 50 | * @stable 3.0 51 | */ 52 | U_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const UnicodeString& s); 53 | 54 | /** 55 | * Write the contents from a C++ istream to a UnicodeString. The UChars in the 56 | * UnicodeString are converted from the char based istream with the default 57 | * converter. 58 | * @stable 3.0 59 | */ 60 | U_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s); 61 | U_NAMESPACE_END 62 | 63 | #endif 64 | 65 | /* No operator for UChar because it can conflict with wchar_t */ 66 | 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/ustringtrie.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2010-2012, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************* 6 | * file name: udicttrie.h 7 | * encoding: US-ASCII 8 | * tab size: 8 (not used) 9 | * indentation:4 10 | * 11 | * created on: 2010dec17 12 | * created by: Markus W. Scherer 13 | */ 14 | 15 | #ifndef __USTRINGTRIE_H__ 16 | #define __USTRINGTRIE_H__ 17 | 18 | /** 19 | * \file 20 | * \brief C API: Helper definitions for dictionary trie APIs. 21 | */ 22 | 23 | #include "unicode/utypes.h" 24 | 25 | 26 | /** 27 | * Return values for BytesTrie::next(), UCharsTrie::next() and similar methods. 28 | * @see USTRINGTRIE_MATCHES 29 | * @see USTRINGTRIE_HAS_VALUE 30 | * @see USTRINGTRIE_HAS_NEXT 31 | * @stable ICU 4.8 32 | */ 33 | enum UStringTrieResult { 34 | /** 35 | * The input unit(s) did not continue a matching string. 36 | * Once current()/next() return USTRINGTRIE_NO_MATCH, 37 | * all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH, 38 | * until the trie is reset to its original state or to a saved state. 39 | * @stable ICU 4.8 40 | */ 41 | USTRINGTRIE_NO_MATCH, 42 | /** 43 | * The input unit(s) continued a matching string 44 | * but there is no value for the string so far. 45 | * (It is a prefix of a longer string.) 46 | * @stable ICU 4.8 47 | */ 48 | USTRINGTRIE_NO_VALUE, 49 | /** 50 | * The input unit(s) continued a matching string 51 | * and there is a value for the string so far. 52 | * This value will be returned by getValue(). 53 | * No further input byte/unit can continue a matching string. 54 | * @stable ICU 4.8 55 | */ 56 | USTRINGTRIE_FINAL_VALUE, 57 | /** 58 | * The input unit(s) continued a matching string 59 | * and there is a value for the string so far. 60 | * This value will be returned by getValue(). 61 | * Another input byte/unit can continue a matching string. 62 | * @stable ICU 4.8 63 | */ 64 | USTRINGTRIE_INTERMEDIATE_VALUE 65 | }; 66 | 67 | /** 68 | * Same as (result!=USTRINGTRIE_NO_MATCH). 69 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. 70 | * @return true if the input bytes/units so far are part of a matching string/byte sequence. 71 | * @stable ICU 4.8 72 | */ 73 | #define USTRINGTRIE_MATCHES(result) ((result)!=USTRINGTRIE_NO_MATCH) 74 | 75 | /** 76 | * Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but 77 | * this macro evaluates result exactly once. 78 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. 79 | * @return true if there is a value for the input bytes/units so far. 80 | * @see BytesTrie::getValue 81 | * @see UCharsTrie::getValue 82 | * @stable ICU 4.8 83 | */ 84 | #define USTRINGTRIE_HAS_VALUE(result) ((result)>=USTRINGTRIE_FINAL_VALUE) 85 | 86 | /** 87 | * Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but 88 | * this macro evaluates result exactly once. 89 | * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. 90 | * @return true if another input byte/unit can continue a matching string. 91 | * @stable ICU 4.8 92 | */ 93 | #define USTRINGTRIE_HAS_NEXT(result) ((result)&1) 94 | 95 | #endif /* __USTRINGTRIE_H__ */ 96 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/utf32.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * 4 | * Copyright (C) 1999-2001, International Business Machines 5 | * Corporation and others. All Rights Reserved. 6 | * 7 | ******************************************************************************* 8 | * file name: utf32.h 9 | * encoding: US-ASCII 10 | * tab size: 8 (not used) 11 | * indentation:4 12 | * 13 | * created on: 1999sep20 14 | * created by: Markus W. Scherer 15 | */ 16 | /** 17 | * \file 18 | * \brief C API: UTF-32 macros 19 | * 20 | * This file is obsolete and its contents moved to utf_old.h. 21 | * See utf_old.h and Jitterbug 2150 and its discussion on the ICU mailing list 22 | * in September 2002. 23 | */ 24 | -------------------------------------------------------------------------------- /3rd/include/icu/unicode/uvernum.h: -------------------------------------------------------------------------------- 1 | /* 2 | ******************************************************************************* 3 | * Copyright (C) 2000-2014, International Business Machines 4 | * Corporation and others. All Rights Reserved. 5 | ******************************************************************************* 6 | * 7 | * file name: uvernum.h 8 | * encoding: US-ASCII 9 | * tab size: 8 (not used) 10 | * indentation:4 11 | * 12 | * Created by: Vladimir Weinstein 13 | * Updated by: Steven R. Loomis 14 | * 15 | */ 16 | 17 | /** 18 | * \file 19 | * \brief C API: definitions of ICU version numbers 20 | * 21 | * This file is included by uversion.h and other files. This file contains only 22 | * macros and definitions. The actual version numbers are defined here. 23 | */ 24 | 25 | /* 26 | * IMPORTANT: When updating version, the following things need to be done: 27 | * source/common/unicode/uvernum.h - this file: update major, minor, 28 | * patchlevel, suffix, version, short version constants, namespace, 29 | * renaming macro, and copyright 30 | * 31 | * The following files need to be updated as well, which can be done 32 | * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. 33 | * 34 | * 35 | * source/common/common.vcproj - update 'Output file name' on the link tab so 36 | * that it contains the new major/minor combination 37 | * source/i18n/i18n.vcproj - same as for the common.vcproj 38 | * source/layout/layout.vcproj - same as for the common.vcproj 39 | * source/layoutex/layoutex.vcproj - same 40 | * source/stubdata/stubdata.vcproj - same as for the common.vcproj 41 | * source/io/io.vcproj - same as for the common.vcproj 42 | * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains 43 | * the new major/minor combination and the Unicode version. 44 | */ 45 | 46 | #ifndef UVERNUM_H 47 | #define UVERNUM_H 48 | 49 | /** The standard copyright notice that gets compiled into each library. 50 | * This value will change in the subsequent releases of ICU 51 | * @stable ICU 2.4 52 | */ 53 | #define U_COPYRIGHT_STRING \ 54 | " Copyright (C) 2014, International Business Machines Corporation and others. All Rights Reserved. " 55 | 56 | /** The current ICU major version as an integer. 57 | * This value will change in the subsequent releases of ICU 58 | * @stable ICU 2.4 59 | */ 60 | #define U_ICU_VERSION_MAJOR_NUM 54 61 | 62 | /** The current ICU minor version as an integer. 63 | * This value will change in the subsequent releases of ICU 64 | * @stable ICU 2.6 65 | */ 66 | #define U_ICU_VERSION_MINOR_NUM 1 67 | 68 | /** The current ICU patchlevel version as an integer. 69 | * This value will change in the subsequent releases of ICU 70 | * @stable ICU 2.4 71 | */ 72 | #define U_ICU_VERSION_PATCHLEVEL_NUM 0 73 | 74 | /** The current ICU build level version as an integer. 75 | * This value is for use by ICU clients. It defaults to 0. 76 | * @stable ICU 4.0 77 | */ 78 | #ifndef U_ICU_VERSION_BUILDLEVEL_NUM 79 | #define U_ICU_VERSION_BUILDLEVEL_NUM 0 80 | #endif 81 | 82 | /** Glued version suffix for renamers 83 | * This value will change in the subsequent releases of ICU 84 | * @stable ICU 2.6 85 | */ 86 | #define U_ICU_VERSION_SUFFIX _54 87 | 88 | /** 89 | * \def U_DEF2_ICU_ENTRY_POINT_RENAME 90 | * @internal 91 | */ 92 | /** 93 | * \def U_DEF_ICU_ENTRY_POINT_RENAME 94 | * @internal 95 | */ 96 | /** Glued version suffix function for renamers 97 | * This value will change in the subsequent releases of ICU. 98 | * If a custom suffix (such as matching library suffixes) is desired, this can be modified. 99 | * Note that if present, platform.h may contain an earlier definition of this macro. 100 | * \def U_ICU_ENTRY_POINT_RENAME 101 | * @stable ICU 4.2 102 | */ 103 | 104 | #ifndef U_ICU_ENTRY_POINT_RENAME 105 | #ifdef U_HAVE_LIB_SUFFIX 106 | #define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z 107 | #define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) 108 | #define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME) 109 | #else 110 | #define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y 111 | #define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) 112 | #define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) 113 | #endif 114 | #endif 115 | 116 | /** The current ICU library version as a dotted-decimal string. The patchlevel 117 | * only appears in this string if it non-zero. 118 | * This value will change in the subsequent releases of ICU 119 | * @stable ICU 2.4 120 | */ 121 | #define U_ICU_VERSION "54.1" 122 | 123 | /** The current ICU library major/minor version as a string without dots, for library name suffixes. 124 | * This value will change in the subsequent releases of ICU 125 | * @stable ICU 2.6 126 | */ 127 | #define U_ICU_VERSION_SHORT "54" 128 | 129 | #ifndef U_HIDE_INTERNAL_API 130 | /** Data version in ICU4C. 131 | * @internal ICU 4.4 Internal Use Only 132 | **/ 133 | #define U_ICU_DATA_VERSION "54.1" 134 | #endif /* U_HIDE_INTERNAL_API */ 135 | 136 | /*=========================================================================== 137 | * ICU collation framework version information 138 | * Version info that can be obtained from a collator is affected by these 139 | * numbers in a secret and magic way. Please use collator version as whole 140 | *=========================================================================== 141 | */ 142 | 143 | /** 144 | * Collation runtime version (sort key generator, strcoll). 145 | * If the version is different, sort keys for the same string could be different. 146 | * This value may change in subsequent releases of ICU. 147 | * @stable ICU 2.4 148 | */ 149 | #define UCOL_RUNTIME_VERSION 8 150 | 151 | /** 152 | * Collation builder code version. 153 | * When this is different, the same tailoring might result 154 | * in assigning different collation elements to code points. 155 | * This value may change in subsequent releases of ICU. 156 | * @stable ICU 2.4 157 | */ 158 | #define UCOL_BUILDER_VERSION 9 159 | 160 | #ifndef U_HIDE_DEPRECATED_API 161 | /** 162 | * Constant 1. 163 | * This was intended to be the version of collation tailorings, 164 | * but instead the tailoring data carries a version number. 165 | * @deprecated ICU 54 166 | */ 167 | #define UCOL_TAILORINGS_VERSION 1 168 | #endif /* U_HIDE_DEPRECATED_API */ 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /3rd/lib/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/.gitkeep -------------------------------------------------------------------------------- /3rd/lib/icu/icudt.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icudt.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icudt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icudt.lib -------------------------------------------------------------------------------- /3rd/lib/icu/icuin.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuin.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icuin.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuin.lib -------------------------------------------------------------------------------- /3rd/lib/icu/icuio.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuio.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icuio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuio.lib -------------------------------------------------------------------------------- /3rd/lib/icu/icule.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icule.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icule.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icule.lib -------------------------------------------------------------------------------- /3rd/lib/icu/iculx.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/iculx.exp -------------------------------------------------------------------------------- /3rd/lib/icu/iculx.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/iculx.lib -------------------------------------------------------------------------------- /3rd/lib/icu/icutu.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icutu.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icutu.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icutu.lib -------------------------------------------------------------------------------- /3rd/lib/icu/icuuc.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuuc.exp -------------------------------------------------------------------------------- /3rd/lib/icu/icuuc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/icuuc.lib -------------------------------------------------------------------------------- /3rd/lib/icu/testplug.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/testplug.exp -------------------------------------------------------------------------------- /3rd/lib/icu/testplug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib/icu/testplug.lib -------------------------------------------------------------------------------- /3rd/lib64/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/.gitkeep -------------------------------------------------------------------------------- /3rd/lib64/icu/icudt.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icudt.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icudt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icudt.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/icuin.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuin.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icuin.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuin.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/icuio.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuio.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icuio.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuio.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/icule.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icule.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icule.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icule.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/iculx.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/iculx.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/iculx.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/iculx.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/icutu.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icutu.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icutu.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icutu.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/icuuc.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuuc.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/icuuc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/icuuc.lib -------------------------------------------------------------------------------- /3rd/lib64/icu/testplug.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/testplug.exp -------------------------------------------------------------------------------- /3rd/lib64/icu/testplug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/3rd/lib64/icu/testplug.lib -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | SQLite 2 | ============================================================================= 3 | 4 | - most of the source code 5 | 6 | ```plain 7 | Copyright (c) Hwaci 8 | Public Domain 9 | ``` 10 | 11 | wxSQLite 12 | ============================================================================= 13 | 14 | - encryption extension 15 | 16 | ```plain 17 | wxWindows Library Licence, Version 3.1 18 | ====================================== 19 | 20 | Copyright (c) 1998-2005 Julian Smart, Robert Roebling et al 21 | 22 | Everyone is permitted to copy and distribute verbatim copies 23 | of this licence document, but changing it is not allowed. 24 | 25 | WXWINDOWS LIBRARY LICENCE 26 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 27 | 28 | This library is free software; you can redistribute it and/or modify it 29 | under the terms of the GNU Library General Public Licence as published by 30 | the Free Software Foundation; either version 2 of the Licence, or (at 31 | your option) any later version. 32 | 33 | This library is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of 35 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 36 | General Public Licence for more details. 37 | 38 | You should have received a copy of the GNU Library General Public Licence 39 | along with this software, usually in a file named COPYING.LIB. If not, 40 | write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 41 | Boston, MA 02111-1307 USA. 42 | 43 | EXCEPTION NOTICE 44 | 45 | 1. As a special exception, the copyright holders of this library give 46 | permission for additional uses of the text contained in this release of 47 | the library as licenced under the wxWindows Library Licence, applying 48 | either version 3.1 of the Licence, or (at your option) any later version of 49 | the Licence as published by the copyright holders of version 50 | 3.1 of the Licence document. 51 | 52 | 2. The exception is that you may use, copy, link, modify and distribute 53 | under your own terms, binary object code versions of works based 54 | on the Library. 55 | 56 | 3. If you copy code from files distributed under the terms of the GNU 57 | General Public Licence or the GNU Library General Public Licence into a 58 | copy of this library, as this licence permits, the exception does not 59 | apply to the code that you add in this way. To avoid misleading anyone as 60 | to the status of such modified files, you must delete this exception 61 | notice from such code and/or adjust the licensing conditions notice 62 | accordingly. 63 | 64 | 4. If you write modifications of your own for this library, it is your 65 | choice whether to permit this exception to apply to your modifications. 66 | If you do not wish that, you must delete the exception notice from such 67 | code and/or adjust the licensing conditions notice accordingly. 68 | ``` 69 | 70 | Premake 71 | ======== 72 | - A build configuration tool 73 | 74 | ```plain 75 | Copyright (c) 2003-2013 Jason Perkins and individual contributors. 76 | All rights reserved. 77 | 78 | Redistribution and use in source and binary forms, with or without modification, 79 | are permitted provided that the following conditions are met: 80 | 81 | 1. Redistributions of source code must retain the above copyright notice, 82 | this list of conditions and the following disclaimer. 83 | 84 | 2. Redistributions in binary form must reproduce the above copyright notice, 85 | this list of conditions and the following disclaimer in the documentation 86 | and/or other materials provided with the distribution. 87 | 88 | 3. Neither the name of the Premake nor the names of its contributors may be 89 | used to endorse or promote products derived from this software without 90 | specific prior written permission. 91 | 92 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 93 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 94 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 95 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 96 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 97 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 98 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 99 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 100 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 101 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 102 | ``` 103 | 104 | Jan Chren 105 | ========== 106 | - some lightweight scripting 107 | 108 | ```plain 109 | Copyright (c) 2014-2015, Jan Chren 110 | All rights reserved. 111 | 112 | Redistribution and use in source and binary forms, with or without modification, 113 | are permitted provided that the following conditions are met: 114 | 115 | 1. Redistributions of source code must retain the above copyright notice, this 116 | list of conditions and the following disclaimer. 117 | 118 | 2. Redistributions in binary form must reproduce the above copyright notice, 119 | this list of conditions and the following disclaimer in the documentation and/or 120 | other materials provided with the distribution. 121 | 122 | 3. Neither the name of the copyright holder nor the names of its contributors 123 | may be used to endorse or promote products derived from this software without 124 | specific prior written permission. 125 | 126 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 127 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 128 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 129 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 130 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 131 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 132 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 133 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 134 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 135 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 136 | ``` 137 | -------------------------------------------------------------------------------- /VERSIONS: -------------------------------------------------------------------------------- 1 | wxsqlite=3.3.0 2 | sqlite=3.9.2 3 | premake=4.4-beta5 4 | -------------------------------------------------------------------------------- /premake.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | "%~dp0premake4" %* 3 | -------------------------------------------------------------------------------- /premake4.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | "%~dp0tools\premake4.exe" --file="%~dp0premake4.lua" %* 3 | -------------------------------------------------------------------------------- /src/codec.h: -------------------------------------------------------------------------------- 1 | /* 2 | /////////////////////////////////////////////////////////////////////////////// 3 | // Name: codec.h 4 | // Purpose: 5 | // Author: Ulrich Telle 6 | // Modified by: 7 | // Created: 2006-12-06 8 | // Copyright: (c) Ulrich Telle 9 | // Licence: wxWindows licence 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | /// \file codec.h Interface of the codec class 13 | */ 14 | 15 | #ifndef _CODEC_H_ 16 | #define _CODEC_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #if defined(__BORLANDC__) 23 | #define __STDC__ 1 24 | #endif 25 | 26 | #if defined(__BORLANDC__) 27 | #undef __STDC__ 28 | #endif 29 | 30 | /* 31 | // ATTENTION: Macro similar to that in pager.c 32 | // TODO: Check in case of new version of SQLite 33 | */ 34 | #define WX_PAGER_MJ_PGNO(x) ((PENDING_BYTE/(x))+1) 35 | 36 | #ifdef __cplusplus 37 | } /* End of the 'extern "C"' block */ 38 | #endif 39 | 40 | #include "rijndael.h" 41 | 42 | #define CODEC_TYPE_AES128 1 43 | #define CODEC_TYPE_AES256 2 44 | 45 | #ifndef CODEC_TYPE 46 | #define CODEC_TYPE CODEC_TYPE_AES128 47 | #endif 48 | 49 | #if CODEC_TYPE == CODEC_TYPE_AES256 50 | #define KEYLENGTH 32 51 | #define CODEC_SHA_ITER 4001 52 | #else 53 | #define KEYLENGTH 16 54 | #endif 55 | 56 | typedef struct _Codec 57 | { 58 | int m_isEncrypted; 59 | int m_hasReadKey; 60 | unsigned char m_readKey[KEYLENGTH]; 61 | int m_hasWriteKey; 62 | unsigned char m_writeKey[KEYLENGTH]; 63 | Rijndael* m_aes; 64 | 65 | Btree* m_bt; /* Pointer to B-tree used by DB */ 66 | unsigned char m_page[SQLITE_MAX_PAGE_SIZE+24]; 67 | } Codec; 68 | 69 | void CodecInit(Codec* codec); 70 | void CodecTerm(Codec* codec); 71 | 72 | void CodecCopy(Codec* codec, Codec* other); 73 | 74 | void CodecGenerateReadKey(Codec* codec, char* userPassword, int passwordLength); 75 | 76 | void CodecGenerateWriteKey(Codec* codec, char* userPassword, int passwordLength); 77 | 78 | void CodecEncrypt(Codec* codec, int page, unsigned char* data, int len, int useWriteKey); 79 | 80 | void CodecDecrypt(Codec* codec, int page, unsigned char* data, int len); 81 | 82 | void CodecCopyKey(Codec* codec, int read2write); 83 | 84 | void CodecSetIsEncrypted(Codec* codec, int isEncrypted); 85 | void CodecSetHasReadKey(Codec* codec, int hasReadKey); 86 | void CodecSetHasWriteKey(Codec* codec, int hasWriteKey); 87 | void CodecSetBtree(Codec* codec, Btree* bt); 88 | 89 | int CodecIsEncrypted(Codec* codec); 90 | int CodecHasReadKey(Codec* codec); 91 | int CodecHasWriteKey(Codec* codec); 92 | Btree* CodecGetBtree(Codec* codec); 93 | unsigned char* CodecGetPageBuffer(Codec* codec); 94 | 95 | void CodecGenerateEncryptionKey(Codec* codec, char* userPassword, int passwordLength, 96 | unsigned char encryptionKey[KEYLENGTH]); 97 | 98 | void CodecPadPassword(Codec* codec, char* password, int pswdlen, unsigned char pswd[32]); 99 | 100 | void CodecRC4(Codec* codec, unsigned char* key, int keylen, 101 | unsigned char* textin, int textlen, 102 | unsigned char* textout); 103 | 104 | void CodecGetMD5Binary(Codec* codec, unsigned char* data, int length, unsigned char* digest); 105 | 106 | #if CODEC_TYPE == CODEC_TYPE_AES256 107 | void CodecGetSHABinary(Codec* codec, unsigned char* data, int length, unsigned char* digest); 108 | #endif 109 | 110 | void CodecGenerateInitialVector(Codec* codec, int seed, unsigned char iv[16]); 111 | 112 | void CodecAES(Codec* codec, int page, int encrypt, unsigned char encryptionKey[KEYLENGTH], 113 | unsigned char* datain, int datalen, unsigned char* dataout); 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /src/sha2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FIPS 180-2 SHA-224/256/384/512 implementation 3 | * Last update: 02/02/2007 4 | * Issue date: 04/30/2005 5 | * 6 | * Copyright (C) 2005, 2007 Olivier Gay 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 3. Neither the name of the project nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef SHA2_H 35 | #define SHA2_H 36 | 37 | #define SHA224_DIGEST_SIZE ( 224 / 8) 38 | #define SHA256_DIGEST_SIZE ( 256 / 8) 39 | #define SHA384_DIGEST_SIZE ( 384 / 8) 40 | #define SHA512_DIGEST_SIZE ( 512 / 8) 41 | 42 | #define SHA256_BLOCK_SIZE ( 512 / 8) 43 | #define SHA512_BLOCK_SIZE (1024 / 8) 44 | #define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE 45 | #define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE 46 | 47 | #ifndef SHA2_TYPES 48 | #define SHA2_TYPES 49 | typedef unsigned char uint8; 50 | typedef unsigned int uint32; 51 | 52 | typedef sqlite3_uint64 uint64; 53 | 54 | #if defined(_MSC_VER) || defined(__BORLANDC__) 55 | #define li_64(h) 0x##h##ui64 56 | #else 57 | #define li_64(h) 0x##h##ull 58 | #endif 59 | 60 | #if 0 // Start of original int64 defines 61 | 62 | #if defined(_MSC_VER) 63 | #if _MSC_VER >= 1310 64 | typedef unsigned long long uint64; 65 | #define li_64(h) 0x##h##ull 66 | #else 67 | typedef unsigned __int64 uint64; 68 | #define li_64(h) 0x##h##ui64 69 | #endif 70 | #elif defined(__BORLANDC__) && !defined(__MSDOS__) 71 | #define li_64(h) 0x##h##ull 72 | typedef __int64 uint64; 73 | #elif defined(__sun) 74 | #if defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful 75 | #define li_64(h) 0x##h##ull 76 | typedef unsigned long long uint64; 77 | #elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xfffffffffffffffful 78 | #define li_64(h) 0x##h##ul 79 | typedef unsigned long uint64; 80 | #endif 81 | #elif defined(__MVS__) 82 | #define li_64(h) 0x##h##ull 83 | typedef unsigned int long long uint64; 84 | #elif defined(ULLONG_MAX) && ULLONG_MAX > 4294967295 85 | #if ULLONG_MAX == 18446744073709551615ull 86 | #define li_64(h) 0x##h##ull 87 | typedef unsigned long long uint64; 88 | #endif 89 | #elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX > 4294967295 90 | #if ULONG_LONG_MAX == 18446744073709551615 91 | #define li_64(h) 0x##h##ull 92 | typedef unsigned long long uint64; 93 | #endif 94 | #elif defined(ULONG_MAX) && ULONG_MAX > 4294967295 95 | #if ULONG_MAX == 18446744073709551615 96 | #define li_64(h) 0x##h##ul 97 | typedef unsigned long uint64; 98 | #endif 99 | #elif defined(UINT_MAX) && UINT_MAX > 4294967295 100 | #if UINT_MAX == 18446744073709551615 101 | #define li_64(h) 0x##h##u 102 | typedef unsigned int uint64; 103 | #endif 104 | #endif 105 | #endif 106 | 107 | #endif // End of original int64 defines 108 | // 109 | 110 | #ifdef __cplusplus 111 | extern "C" { 112 | #endif 113 | 114 | typedef struct { 115 | unsigned int tot_len; 116 | unsigned int len; 117 | unsigned char block[2 * SHA256_BLOCK_SIZE]; 118 | uint32 h[8]; 119 | } sha256_ctx; 120 | 121 | typedef struct { 122 | unsigned int tot_len; 123 | unsigned int len; 124 | unsigned char block[2 * SHA512_BLOCK_SIZE]; 125 | uint64 h[8]; 126 | } sha512_ctx; 127 | 128 | typedef sha512_ctx sha384_ctx; 129 | typedef sha256_ctx sha224_ctx; 130 | 131 | void sha224_init(sha224_ctx *ctx); 132 | void sha224_update(sha224_ctx *ctx, const unsigned char *message, 133 | unsigned int len); 134 | void sha224_final(sha224_ctx *ctx, unsigned char *digest); 135 | void sha224(const unsigned char *message, unsigned int len, 136 | unsigned char *digest); 137 | 138 | void sha256_init(sha256_ctx * ctx); 139 | void sha256_update(sha256_ctx *ctx, const unsigned char *message, 140 | unsigned int len); 141 | void sha256_final(sha256_ctx *ctx, unsigned char *digest); 142 | void sha256(const unsigned char *message, unsigned int len, 143 | unsigned char *digest); 144 | 145 | void sha384_init(sha384_ctx *ctx); 146 | void sha384_update(sha384_ctx *ctx, const unsigned char *message, 147 | unsigned int len); 148 | void sha384_final(sha384_ctx *ctx, unsigned char *digest); 149 | void sha384(const unsigned char *message, unsigned int len, 150 | unsigned char *digest); 151 | 152 | void sha512_init(sha512_ctx *ctx); 153 | void sha512_update(sha512_ctx *ctx, const unsigned char *message, 154 | unsigned int len); 155 | void sha512_final(sha512_ctx *ctx, unsigned char *digest); 156 | void sha512(const unsigned char *message, unsigned int len, 157 | unsigned char *digest); 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif /* !SHA2_H */ 164 | 165 | -------------------------------------------------------------------------------- /src/sqlite3.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | sqlite3_aggregate_context 3 | sqlite3_aggregate_count 4 | sqlite3_auto_extension 5 | sqlite3_backup_finish 6 | sqlite3_backup_init 7 | sqlite3_backup_pagecount 8 | sqlite3_backup_remaining 9 | sqlite3_backup_step 10 | sqlite3_bind_blob 11 | sqlite3_bind_blob64 12 | sqlite3_bind_double 13 | sqlite3_bind_int 14 | sqlite3_bind_int64 15 | sqlite3_bind_null 16 | sqlite3_bind_parameter_count 17 | sqlite3_bind_parameter_index 18 | sqlite3_bind_parameter_name 19 | sqlite3_bind_text 20 | sqlite3_bind_text16 21 | sqlite3_bind_text64 22 | sqlite3_bind_value 23 | sqlite3_bind_zeroblob 24 | sqlite3_bind_zeroblob64 25 | sqlite3_blob_bytes 26 | sqlite3_blob_close 27 | sqlite3_blob_open 28 | sqlite3_blob_read 29 | sqlite3_blob_reopen 30 | sqlite3_blob_write 31 | sqlite3_busy_handler 32 | sqlite3_busy_timeout 33 | sqlite3_cancel_auto_extension 34 | sqlite3_changes 35 | sqlite3_clear_bindings 36 | sqlite3_close 37 | sqlite3_close_v2 38 | sqlite3_collation_needed 39 | sqlite3_collation_needed16 40 | sqlite3_column_blob 41 | sqlite3_column_bytes 42 | sqlite3_column_bytes16 43 | sqlite3_column_count 44 | sqlite3_column_database_name 45 | sqlite3_column_database_name16 46 | sqlite3_column_decltype 47 | sqlite3_column_decltype16 48 | sqlite3_column_double 49 | sqlite3_column_int 50 | sqlite3_column_int64 51 | sqlite3_column_name 52 | sqlite3_column_name16 53 | sqlite3_column_origin_name 54 | sqlite3_column_origin_name16 55 | sqlite3_column_table_name 56 | sqlite3_column_table_name16 57 | sqlite3_column_text 58 | sqlite3_column_text16 59 | sqlite3_column_type 60 | sqlite3_column_value 61 | sqlite3_commit_hook 62 | sqlite3_compileoption_get 63 | sqlite3_compileoption_used 64 | sqlite3_complete 65 | sqlite3_complete16 66 | sqlite3_config 67 | sqlite3_context_db_handle 68 | sqlite3_create_collation 69 | sqlite3_create_collation16 70 | sqlite3_create_collation_v2 71 | sqlite3_create_function 72 | sqlite3_create_function16 73 | sqlite3_create_function_v2 74 | sqlite3_create_module 75 | sqlite3_create_module_v2 76 | sqlite3_data_count 77 | sqlite3_db_config 78 | sqlite3_db_filename 79 | sqlite3_db_handle 80 | sqlite3_db_mutex 81 | sqlite3_db_readonly 82 | sqlite3_db_release_memory 83 | sqlite3_db_status 84 | sqlite3_declare_vtab 85 | sqlite3_enable_load_extension 86 | sqlite3_enable_shared_cache 87 | sqlite3_errcode 88 | sqlite3_errmsg 89 | sqlite3_errmsg16 90 | sqlite3_errstr 91 | sqlite3_exec 92 | sqlite3_expired 93 | sqlite3_extended_errcode 94 | sqlite3_extended_result_codes 95 | sqlite3_file_control 96 | sqlite3_finalize 97 | sqlite3_free 98 | sqlite3_free_table 99 | sqlite3_get_autocommit 100 | sqlite3_get_auxdata 101 | sqlite3_get_table 102 | sqlite3_global_recover 103 | sqlite3_initialize 104 | sqlite3_interrupt 105 | sqlite3_key 106 | sqlite3_key_v2 107 | sqlite3_last_insert_rowid 108 | sqlite3_libversion 109 | sqlite3_libversion_number 110 | sqlite3_limit 111 | sqlite3_load_extension 112 | sqlite3_log 113 | sqlite3_malloc 114 | sqlite3_malloc64 115 | sqlite3_memory_alarm 116 | sqlite3_memory_highwater 117 | sqlite3_memory_used 118 | sqlite3_mprintf 119 | sqlite3_msize 120 | sqlite3_mutex_alloc 121 | sqlite3_mutex_enter 122 | sqlite3_mutex_free 123 | sqlite3_mutex_leave 124 | sqlite3_mutex_try 125 | sqlite3_next_stmt 126 | sqlite3_open 127 | sqlite3_open16 128 | sqlite3_open_v2 129 | sqlite3_os_end 130 | sqlite3_os_init 131 | sqlite3_overload_function 132 | sqlite3_prepare 133 | sqlite3_prepare16 134 | sqlite3_prepare16_v2 135 | sqlite3_prepare_v2 136 | sqlite3_profile 137 | sqlite3_progress_handler 138 | sqlite3_randomness 139 | sqlite3_realloc 140 | sqlite3_realloc64 141 | sqlite3_rekey 142 | sqlite3_rekey_v2 143 | sqlite3_release_memory 144 | sqlite3_reset 145 | sqlite3_reset_auto_extension 146 | sqlite3_result_blob 147 | sqlite3_result_blob64 148 | sqlite3_result_double 149 | sqlite3_result_error 150 | sqlite3_result_error16 151 | sqlite3_result_error_code 152 | sqlite3_result_error_nomem 153 | sqlite3_result_error_toobig 154 | sqlite3_result_int 155 | sqlite3_result_int64 156 | sqlite3_result_null 157 | sqlite3_result_subtype 158 | sqlite3_result_text 159 | sqlite3_result_text16 160 | sqlite3_result_text16be 161 | sqlite3_result_text16le 162 | sqlite3_result_text64 163 | sqlite3_result_value 164 | sqlite3_result_zeroblob 165 | sqlite3_result_zeroblob64 166 | sqlite3_rollback_hook 167 | sqlite3_rtree_geometry_callback 168 | sqlite3_rtree_query_callback 169 | sqlite3_set_authorizer 170 | sqlite3_set_auxdata 171 | sqlite3_shutdown 172 | sqlite3_sleep 173 | sqlite3_snprintf 174 | sqlite3_soft_heap_limit 175 | sqlite3_soft_heap_limit64 176 | sqlite3_sourceid 177 | sqlite3_sql 178 | sqlite3_status 179 | sqlite3_status64 180 | sqlite3_step 181 | sqlite3_stmt_busy 182 | sqlite3_stmt_readonly 183 | sqlite3_stmt_status 184 | sqlite3_strglob 185 | sqlite3_stricmp 186 | sqlite3_strnicmp 187 | sqlite3_table_column_metadata 188 | sqlite3_test_control 189 | sqlite3_thread_cleanup 190 | sqlite3_threadsafe 191 | sqlite3_total_changes 192 | sqlite3_trace 193 | sqlite3_transfer_bindings 194 | sqlite3_update_hook 195 | sqlite3_uri_boolean 196 | sqlite3_uri_int64 197 | sqlite3_uri_parameter 198 | sqlite3_user_add 199 | sqlite3_user_authenticate 200 | sqlite3_user_change 201 | sqlite3_user_data 202 | sqlite3_user_delete 203 | sqlite3_value_blob 204 | sqlite3_value_bytes 205 | sqlite3_value_bytes16 206 | sqlite3_value_double 207 | sqlite3_value_dup 208 | sqlite3_value_free 209 | sqlite3_value_int 210 | sqlite3_value_int64 211 | sqlite3_value_numeric_type 212 | sqlite3_value_subtype 213 | sqlite3_value_text 214 | sqlite3_value_text16 215 | sqlite3_value_text16be 216 | sqlite3_value_text16le 217 | sqlite3_value_type 218 | sqlite3_vfs_find 219 | sqlite3_vfs_register 220 | sqlite3_vfs_unregister 221 | sqlite3_vmprintf 222 | sqlite3_vsnprintf 223 | sqlite3_vtab_config 224 | sqlite3_vtab_on_conflict 225 | sqlite3_wal_autocheckpoint 226 | sqlite3_wal_checkpoint 227 | sqlite3_wal_checkpoint_v2 228 | sqlite3_wal_hook 229 | sqlite3_win32_is_nt 230 | sqlite3_win32_mbcs_to_utf8 231 | sqlite3_win32_set_directory 232 | sqlite3_win32_sleep 233 | sqlite3_win32_utf8_to_mbcs 234 | sqlite3_win32_write_debug 235 | -------------------------------------------------------------------------------- /src/sqlite3.rc: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Version 4 | // 5 | #include 6 | 7 | VS_VERSION_INFO VERSIONINFO 8 | FILEVERSION 3,9,2,1 9 | PRODUCTVERSION 3,9,2,1 10 | FILEFLAGSMASK 0x3fL 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS VOS_NT_WINDOWS32 17 | FILETYPE VFT_DLL 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904b0" 23 | BEGIN 24 | VALUE "CompanyName", "SQLite" 25 | VALUE "FileDescription", "SQLite3 Database Library" 26 | VALUE "FileVersion", "3.9.2.1" 27 | VALUE "InternalName", "sqlite3.dll" 28 | VALUE "LegalCopyright", "Public Domain" 29 | VALUE "OriginalFilename", "sqlite3.dll" 30 | VALUE "ProductName", "SQLite3" 31 | VALUE "ProductVersion", "3.9.2.1" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /src/sqlite3secure.c: -------------------------------------------------------------------------------- 1 | // To enable the extension functions define SQLITE_ENABLE_EXTFUNC on compiling this module 2 | #ifdef SQLITE_ENABLE_EXTFUNC 3 | #define sqlite3_open sqlite3_open_internal 4 | #define sqlite3_open16 sqlite3_open16_internal 5 | #define sqlite3_open_v2 sqlite3_open_v2_internal 6 | #endif 7 | 8 | // Enable the user authentication feature 9 | #ifndef SQLITE_USER_AUTHENTICATION 10 | #define SQLITE_USER_AUTHENTICATION 1 11 | #endif 12 | 13 | #include "sqlite3.c" 14 | #ifdef SQLITE_USER_AUTHENTICATION 15 | #include "sha2.h" 16 | #include "sha2.c" 17 | #include "userauth.c" 18 | #endif 19 | 20 | #ifdef SQLITE_ENABLE_EXTFUNC 21 | #undef sqlite3_open 22 | #undef sqlite3_open16 23 | #undef sqlite3_open_v2 24 | #endif 25 | 26 | #ifndef SQLITE_OMIT_DISKIO 27 | 28 | #ifdef SQLITE_HAS_CODEC 29 | 30 | /* 31 | ** Get the codec argument for this pager 32 | */ 33 | 34 | void* mySqlite3PagerGetCodec( 35 | Pager *pPager 36 | ){ 37 | #if (SQLITE_VERSION_NUMBER >= 3006016) 38 | return sqlite3PagerGetCodec(pPager); 39 | #else 40 | return (pPager->xCodec) ? pPager->pCodecArg : NULL; 41 | #endif 42 | } 43 | 44 | /* 45 | ** Set the codec argument for this pager 46 | */ 47 | 48 | void mySqlite3PagerSetCodec( 49 | Pager *pPager, 50 | void *(*xCodec)(void*,void*,Pgno,int), 51 | void (*xCodecSizeChng)(void*,int,int), 52 | void (*xCodecFree)(void*), 53 | void *pCodec 54 | ){ 55 | sqlite3PagerSetCodec(pPager, xCodec, xCodecSizeChng, xCodecFree, pCodec); 56 | } 57 | 58 | #include "rijndael.c" 59 | #include "codec.c" 60 | #include "codecext.c" 61 | 62 | #endif 63 | 64 | #endif 65 | 66 | #ifdef SQLITE_ENABLE_EXTFUNC 67 | 68 | #include "extensionfunctions.c" 69 | 70 | SQLITE_API int sqlite3_open( 71 | const char *filename, /* Database filename (UTF-8) */ 72 | sqlite3 **ppDb /* OUT: SQLite db handle */ 73 | ) 74 | { 75 | int ret = sqlite3_open_internal(filename, ppDb); 76 | if (ret == 0) 77 | { 78 | RegisterExtensionFunctions(*ppDb); 79 | } 80 | return ret; 81 | } 82 | 83 | SQLITE_API int sqlite3_open16( 84 | const void *filename, /* Database filename (UTF-16) */ 85 | sqlite3 **ppDb /* OUT: SQLite db handle */ 86 | ) 87 | { 88 | int ret = sqlite3_open16_internal(filename, ppDb); 89 | if (ret == 0) 90 | { 91 | RegisterExtensionFunctions(*ppDb); 92 | } 93 | return ret; 94 | } 95 | 96 | SQLITE_API int sqlite3_open_v2( 97 | const char *filename, /* Database filename (UTF-8) */ 98 | sqlite3 **ppDb, /* OUT: SQLite db handle */ 99 | int flags, /* Flags */ 100 | const char *zVfs /* Name of VFS module to use */ 101 | ) 102 | { 103 | int ret = sqlite3_open_v2_internal(filename, ppDb, flags, zVfs); 104 | if (ret == 0) 105 | { 106 | RegisterExtensionFunctions(*ppDb); 107 | } 108 | return ret; 109 | } 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /src/sqlite3shell.rc: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Version 4 | // 5 | #include 6 | 7 | VS_VERSION_INFO VERSIONINFO 8 | FILEVERSION 3,9,2,1 9 | PRODUCTVERSION 3,9,2,1 10 | FILEFLAGSMASK 0x3fL 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS VOS_NT_WINDOWS32 17 | FILETYPE VFT_DLL 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904b0" 23 | BEGIN 24 | VALUE "CompanyName", "SQLite" 25 | VALUE "FileDescription", "SQLite3 Database Shell" 26 | VALUE "FileVersion", "3.9.2.1" 27 | VALUE "InternalName", "sqlite3shell.exe" 28 | VALUE "LegalCopyright", "Public Domain" 29 | VALUE "OriginalFilename", "sqlite3shell.exe" 30 | VALUE "ProductName", "SQLite3" 31 | VALUE "ProductVersion", "3.9.2.1" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /src/sqlite3userauth.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** 2014-09-08 3 | ** 4 | ** The author disclaims copyright to this source code. In place of 5 | ** a legal notice, here is a blessing: 6 | ** 7 | ** May you do good and not evil. 8 | ** May you find forgiveness for yourself and forgive others. 9 | ** May you share freely, never taking more than you give. 10 | ** 11 | ************************************************************************* 12 | ** 13 | ** This file contains the application interface definitions for the 14 | ** user-authentication extension feature. 15 | ** 16 | ** To compile with the user-authentication feature, append this file to 17 | ** end of an SQLite amalgamation header file ("sqlite3.h"), then add 18 | ** the SQLITE_USER_AUTHENTICATION compile-time option. See the 19 | ** user-auth.txt file in the same source directory as this file for 20 | ** additional information. 21 | */ 22 | #ifdef SQLITE_USER_AUTHENTICATION 23 | 24 | /* 25 | ** If a database contains the SQLITE_USER table, then the 26 | ** sqlite3_user_authenticate() interface must be invoked with an 27 | ** appropriate username and password prior to enable read and write 28 | ** access to the database. 29 | ** 30 | ** Return SQLITE_OK on success or SQLITE_ERROR if the username/password 31 | ** combination is incorrect or unknown. 32 | ** 33 | ** If the SQLITE_USER table is not present in the database file, then 34 | ** this interface is a harmless no-op returnning SQLITE_OK. 35 | */ 36 | int sqlite3_user_authenticate( 37 | sqlite3 *db, /* The database connection */ 38 | const char *zUsername, /* Username */ 39 | const char *aPW, /* Password or credentials */ 40 | int nPW /* Number of bytes in aPW[] */ 41 | ); 42 | 43 | /* 44 | ** The sqlite3_user_add() interface can be used (by an admin user only) 45 | ** to create a new user. When called on a no-authentication-required 46 | ** database, this routine converts the database into an authentication- 47 | ** required database, automatically makes the added user an 48 | ** administrator, and logs in the current connection as that user. 49 | ** The sqlite3_user_add() interface only works for the "main" database, not 50 | ** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a 51 | ** non-admin user results in an error. 52 | */ 53 | int sqlite3_user_add( 54 | sqlite3 *db, /* Database connection */ 55 | const char *zUsername, /* Username to be added */ 56 | const char *aPW, /* Password or credentials */ 57 | int nPW, /* Number of bytes in aPW[] */ 58 | int isAdmin /* True to give new user admin privilege */ 59 | ); 60 | 61 | /* 62 | ** The sqlite3_user_change() interface can be used to change a users 63 | ** login credentials or admin privilege. Any user can change their own 64 | ** login credentials. Only an admin user can change another users login 65 | ** credentials or admin privilege setting. No user may change their own 66 | ** admin privilege setting. 67 | */ 68 | int sqlite3_user_change( 69 | sqlite3 *db, /* Database connection */ 70 | const char *zUsername, /* Username to change */ 71 | const char *aPW, /* New password or credentials */ 72 | int nPW, /* Number of bytes in aPW[] */ 73 | int isAdmin /* Modified admin privilege for the user */ 74 | ); 75 | 76 | /* 77 | ** The sqlite3_user_delete() interface can be used (by an admin user only) 78 | ** to delete a user. The currently logged-in user cannot be deleted, 79 | ** which guarantees that there is always an admin user and hence that 80 | ** the database cannot be converted into a no-authentication-required 81 | ** database. 82 | */ 83 | int sqlite3_user_delete( 84 | sqlite3 *db, /* Database connection */ 85 | const char *zUsername /* Username to remove */ 86 | ); 87 | 88 | #endif /* SQLITE_USER_AUTHENTICATION */ 89 | -------------------------------------------------------------------------------- /tools/compress.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) Jan Chren 2014 2 | :: Licensed under BSD 3 3 | 4 | @echo off 5 | 6 | :: disable cygwin warnings, if upx comes from cyg repos 7 | set CYGWIN=nodosfilewarning 8 | 9 | pushd "%~dp0bin" 10 | call :recurse 11 | goto :eof 12 | 13 | 14 | :recurse 15 | for %%f in ( *.dll, *.exe ) do call :compress "%CD%" "%%~nf" "%%~xf" 16 | for /D %%d in (*) do ( 17 | cd %%d 18 | call :recurse 19 | cd .. 20 | ) 21 | exit /b 22 | 23 | 24 | :compress 25 | set dir=%1 26 | set dir=%dir:"=% 27 | set file=%2 28 | set file=%file:"=% 29 | set ext=%3 30 | set ext=%ext:"=% 31 | 32 | set in=%dir%\%file%%ext% 33 | set out=%dir%\%file%_compressed%ext% 34 | 35 | :: skip if it's an already compressed file 36 | setlocal enableextensions enabledelayedexpansion 37 | if not x%file:compressed=%==x%file% exit /b 38 | endlocal 39 | 40 | del /f "%out%" 41 | upx --output="%out%" -v --best --no-backup --overlay=strip --compress-icons=1 "%in%" 42 | 43 | exit /b 44 | -------------------------------------------------------------------------------- /tools/premake4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rindeal/SQLite3-Encryption/0c89bb7a6449815db0ac43c7de7874285cc829e7/tools/premake4.exe -------------------------------------------------------------------------------- /tools/update.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -file "%~dp0update.ps1" 3 | -------------------------------------------------------------------------------- /tools/update.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Jan Chren 2014 2 | # Licensed under BSD 3 3 | 4 | # This script updates wxSQLite SQLite source code 5 | 6 | 7 | "Updating of wxSQLite started" 8 | 9 | 10 | $CP_HERE_YES_TO_ALL = 16 11 | 12 | $WebClient = New-Object System.Net.WebClient 13 | $Shell = New-Object -com Shell.Application 14 | 15 | $PROJECT_ROOT_DIR = $(Resolve-Path "$PSScriptRoot\..") 16 | $OUTPUT_DIR = "$PROJECT_ROOT_DIR\src" 17 | $TMP_FILE = "$env:TMP\wxsqlite3.zip" 18 | 19 | $WXSQLITE_SF_API_URL = "http://sourceforge.net/projects/wxcode/rss?path=/Components/wxSQLite3&limit=3" 20 | $WXSQLITE_SF_API_SRC = $WebClient.DownloadString($WXSQLITE_SF_API_URL) 21 | $WXSQLITE_URL = $WXSQLITE_SF_API_SRC -replace "`n|`r" -replace '.*([^<]*\.zip\/download).*','$1' 22 | $WXSQLITE_URL 23 | 24 | function compareVersions ($a, $b){ 25 | (New-Object System.Version($a)).CompareTo((New-Object System.Version($b))) 26 | } 27 | 28 | function getRemoteWxSqliteVersion(){ 29 | $WXSQLITE_URL | %{$_ -replace '.*wxsqlite3-([0-9.]+)\..*', '$1'} 30 | } 31 | 32 | function getLocalVersion($type){ 33 | Get-Content "$PROJECT_ROOT_DIR\VERSIONS" | where { $_ -match "^\s*$type" } | %{$_ -replace '.*=\s*([^\s]*)\s*', '$1'} 34 | } 35 | 36 | function setLocalVersion($type, $value){ 37 | $SRC_FILE="$PROJECT_ROOT_DIR\VERSIONS" 38 | $DEST_FILE="$SRC_FILE.tmp" 39 | Get-Content $SRC_FILE | %{$_ -replace "^\s*($type[^= ]*)\s*=\s*([^\s]*)\s*", "`$1=$value" } | Set-Content $DEST_FILE 40 | Move-Item $DEST_FILE $SRC_FILE -Force 41 | } 42 | 43 | function getSqliteVersion(){ 44 | Get-Content "$OUTPUT_DIR\sqlite3.h" | where { $_ -match "#define SQLITE_VERSION " } | %{$_ -replace '.*"([\d.]{5,})".*', '$1'} 45 | } 46 | 47 | 48 | $OLD_WXSQLITE_VERSION = getLocalVersion "wxsqlite" 49 | $REMOTE_WXSQLITE_VERSION = getRemoteWxSqliteVersion 50 | 51 | if ($(compareVersions $OLD_WXSQLITE_VERSION $REMOTE_WXSQLITE_VERSION) -ne -1){ 52 | "You already have the newest version of wxSqlite - {0}" -f $OLD_WXSQLITE_VERSION 53 | exit 54 | } 55 | 56 | $OLD_SQLITE_VERSION = getSqliteVersion 57 | 58 | 59 | $WebClient.DownloadFile($WXSQLITE_URL, $TMP_FILE) 60 | 61 | $zip = $Shell.Namespace($TMP_FILE) 62 | foreach($item in $zip.items()) 63 | { 64 | if ( $item.Name -like "wxsqlite3-*" ){ 65 | $items = $Shell.NameSpace("$TMP_FILE\"+$item.Name+"\sqlite3\secure\src").Items() 66 | $Shell.Namespace($OUTPUT_DIR).Copyhere($items, $CP_HERE_YES_TO_ALL) 67 | } 68 | } 69 | 70 | Remove-Item $TMP_FILE 71 | 72 | 73 | $NEW_SQLITE_VERSION = getSqliteVersion 74 | 75 | setLocalVersion "sqlite" $NEW_SQLITE_VERSION 76 | setLocalVersion "wxsqlite" $REMOTE_WXSQLITE_VERSION 77 | 78 | "wxSQLite has been updated from {0} to {1}" -f $OLD_WXSQLITE_VERSION, $REMOTE_WXSQLITE_VERSION 79 | "SQLite has been updated from {0} to {1}" -f $OLD_SQLITE_VERSION, $NEW_SQLITE_VERSION 80 | -------------------------------------------------------------------------------- /tools/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash -i 2 | # Copyright (c) Jan Chren 2014 3 | # Licensed under BSD 3 4 | 5 | export CYGWIN="nodosfilewarning $CYGWIN" 6 | 7 | OUTPUT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 | OUTPUT_DIR+="/../src" 9 | 10 | WXSQLITE_SF_API_URL="http://sourceforge.net/api/file/index/project-id/51305/crtime/desc/limit/2/path/Components%2fwxSQLite3/rss" 11 | WXSQLITE_SF_API_SRC="$( wget -qO - "$WXSQLITE_SF_API_URL" | tr -d "\n" )" 12 | WXSQLITE_URL="$( echo "$WXSQLITE_SF_API_SRC" | sed -r 's/.*([^<]*\.tar\.gz\/download).*/\1/' )" 13 | 14 | function get_sqlite_version(){ 15 | cat "$OUTPUT_DIR/sqlite3.h" | grep -m 1 "#define SQLITE_VERSION" | sed -r 's/.*"([0-9.]*)".*/\1/' 16 | } 17 | 18 | OLD_VERSION="$( get_sqlite_version )" 19 | 20 | pushd "$OUTPUT_DIR" &>/dev/null 21 | wget -qO - "$WXSQLITE_URL" \ 22 | | tar xvzf - --wildcards "*/secure/src/*" --show-transformed --xform='s/.*\///' 23 | popd &>/dev/null 24 | 25 | printf "\nSQLite3 updated from %s to %s\n" "$OLD_VERSION" "$( get_sqlite_version )" 26 | --------------------------------------------------------------------------------