pango 2.2.4-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +33 -0
- data/Rakefile +65 -0
- data/ext/pango/depend +12 -0
- data/ext/pango/extconf.rb +90 -0
- data/ext/pango/pango.def +18 -0
- data/ext/pango/rbpango.c +318 -0
- data/ext/pango/rbpango.h +96 -0
- data/ext/pango/rbpangoanalysis.c +218 -0
- data/ext/pango/rbpangoattribute.c +499 -0
- data/ext/pango/rbpangoattriterator.c +141 -0
- data/ext/pango/rbpangoattrlist.c +101 -0
- data/ext/pango/rbpangocairo.c +122 -0
- data/ext/pango/rbpangocairocontext.c +131 -0
- data/ext/pango/rbpangocolor.c +120 -0
- data/ext/pango/rbpangocontext.c +309 -0
- data/ext/pango/rbpangoconversions.h +111 -0
- data/ext/pango/rbpangocoverage.c +106 -0
- data/ext/pango/rbpangoengine.c +73 -0
- data/ext/pango/rbpangofont.c +110 -0
- data/ext/pango/rbpangofontdescription.c +282 -0
- data/ext/pango/rbpangofontface.c +73 -0
- data/ext/pango/rbpangofontfamily.c +79 -0
- data/ext/pango/rbpangofontmap.c +102 -0
- data/ext/pango/rbpangofontmetrics.c +85 -0
- data/ext/pango/rbpangofontset.c +69 -0
- data/ext/pango/rbpangofontsetsimple.c +60 -0
- data/ext/pango/rbpangoglyphinfo.c +123 -0
- data/ext/pango/rbpangoglyphitem.c +125 -0
- data/ext/pango/rbpangoglyphstring.c +151 -0
- data/ext/pango/rbpangogravity.c +54 -0
- data/ext/pango/rbpangoitem.c +95 -0
- data/ext/pango/rbpangolanguage.c +86 -0
- data/ext/pango/rbpangolayout.c +572 -0
- data/ext/pango/rbpangolayoutiter.c +189 -0
- data/ext/pango/rbpangolayoutline.c +239 -0
- data/ext/pango/rbpangologattr.c +109 -0
- data/ext/pango/rbpangomatrix.c +143 -0
- data/ext/pango/rbpangoprivate.h +49 -0
- data/ext/pango/rbpangorectangle.c +170 -0
- data/ext/pango/rbpangorenderer.c +193 -0
- data/ext/pango/rbpangoscript.c +84 -0
- data/ext/pango/rbpangoscriptiter.c +92 -0
- data/ext/pango/rbpangotabarray.c +128 -0
- data/extconf.rb +49 -0
- data/lib/2.0/pango.so +0 -0
- data/lib/2.1/pango.so +0 -0
- data/lib/2.2/pango.so +0 -0
- data/lib/pango.rb +79 -0
- data/sample/attribute.rb +82 -0
- data/sample/break.rb +28 -0
- data/sample/gdk_layout.rb +27 -0
- data/sample/glyphstring.rb +61 -0
- data/sample/item.rb +37 -0
- data/sample/label.rb +23 -0
- data/sample/layout.rb +102 -0
- data/sample/pango_cairo.rb +66 -0
- data/sample/parse.rb +33 -0
- data/sample/sample.txt +10 -0
- data/sample/script.rb +23 -0
- data/test/pango-test-utils.rb +9 -0
- data/test/run-test.rb +28 -0
- data/test/test-analysis.rb +26 -0
- data/test/test-attribute.rb +19 -0
- data/test/test-color.rb +47 -0
- data/test/test-language.rb +7 -0
- data/test/test-layout.rb +34 -0
- data/test/test-log-attr.rb +26 -0
- data/test/test-matrix.rb +26 -0
- data/test/test-rectangle.rb +26 -0
- data/vendor/local/bin/derb.exe +0 -0
- data/vendor/local/bin/genbrk.exe +0 -0
- data/vendor/local/bin/genccode.exe +0 -0
- data/vendor/local/bin/gencfu.exe +0 -0
- data/vendor/local/bin/gencmn.exe +0 -0
- data/vendor/local/bin/gencnval.exe +0 -0
- data/vendor/local/bin/gendict.exe +0 -0
- data/vendor/local/bin/gennorm2.exe +0 -0
- data/vendor/local/bin/genrb.exe +0 -0
- data/vendor/local/bin/gensprep.exe +0 -0
- data/vendor/local/bin/hb-ot-shape-closure.exe +0 -0
- data/vendor/local/bin/hb-shape.exe +0 -0
- data/vendor/local/bin/hb-view.exe +0 -0
- data/vendor/local/bin/icu-config +820 -0
- data/vendor/local/bin/icuinfo.exe +0 -0
- data/vendor/local/bin/icupkg.exe +0 -0
- data/vendor/local/bin/libharfbuzz-0.dll +0 -0
- data/vendor/local/bin/libpango-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangocairo-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangoft2-1.0-0.dll +0 -0
- data/vendor/local/bin/libpangowin32-1.0-0.dll +0 -0
- data/vendor/local/bin/makeconv.exe +0 -0
- data/vendor/local/bin/pango-querymodules.exe +0 -0
- data/vendor/local/bin/pango-view.exe +0 -0
- data/vendor/local/bin/pkgdata.exe +0 -0
- data/vendor/local/bin/uconv.exe +0 -0
- data/vendor/local/etc/pango/pango.modules +19 -0
- data/vendor/local/include/harfbuzz/hb-blob.h +126 -0
- data/vendor/local/include/harfbuzz/hb-buffer.h +344 -0
- data/vendor/local/include/harfbuzz/hb-common.h +344 -0
- data/vendor/local/include/harfbuzz/hb-deprecated.h +51 -0
- data/vendor/local/include/harfbuzz/hb-face.h +117 -0
- data/vendor/local/include/harfbuzz/hb-font.h +507 -0
- data/vendor/local/include/harfbuzz/hb-ft.h +62 -0
- data/vendor/local/include/harfbuzz/hb-glib.h +52 -0
- data/vendor/local/include/harfbuzz/hb-icu.h +52 -0
- data/vendor/local/include/harfbuzz/hb-ot-font.h +41 -0
- data/vendor/local/include/harfbuzz/hb-ot-layout.h +302 -0
- data/vendor/local/include/harfbuzz/hb-ot-shape.h +53 -0
- data/vendor/local/include/harfbuzz/hb-ot-tag.h +59 -0
- data/vendor/local/include/harfbuzz/hb-ot.h +43 -0
- data/vendor/local/include/harfbuzz/hb-set.h +154 -0
- data/vendor/local/include/harfbuzz/hb-shape-plan.h +89 -0
- data/vendor/local/include/harfbuzz/hb-shape.h +81 -0
- data/vendor/local/include/harfbuzz/hb-unicode.h +445 -0
- data/vendor/local/include/harfbuzz/hb-version.h +66 -0
- data/vendor/local/include/harfbuzz/hb.h +47 -0
- data/vendor/local/include/layout/LEFontInstance.h +550 -0
- data/vendor/local/include/layout/LEGlyphFilter.h +45 -0
- data/vendor/local/include/layout/LEGlyphStorage.h +546 -0
- data/vendor/local/include/layout/LEInsertionList.h +177 -0
- data/vendor/local/include/layout/LELanguages.h +112 -0
- data/vendor/local/include/layout/LEScripts.h +263 -0
- data/vendor/local/include/layout/LESwaps.h +100 -0
- data/vendor/local/include/layout/LETableReference.h +418 -0
- data/vendor/local/include/layout/LETypes.h +728 -0
- data/vendor/local/include/layout/LayoutEngine.h +518 -0
- data/vendor/local/include/layout/ParagraphLayout.h +747 -0
- data/vendor/local/include/layout/RunArrays.h +676 -0
- data/vendor/local/include/layout/loengine.h +225 -0
- data/vendor/local/include/layout/playout.h +466 -0
- data/vendor/local/include/layout/plruns.h +441 -0
- data/vendor/local/include/pango-1.0/pango/pango-attributes.h +514 -0
- data/vendor/local/include/pango-1.0/pango/pango-bidi-type.h +136 -0
- data/vendor/local/include/pango-1.0/pango/pango-break.h +173 -0
- data/vendor/local/include/pango-1.0/pango/pango-context.h +112 -0
- data/vendor/local/include/pango-1.0/pango/pango-coverage.h +79 -0
- data/vendor/local/include/pango-1.0/pango/pango-engine.h +429 -0
- data/vendor/local/include/pango-1.0/pango/pango-enum-types.h +69 -0
- data/vendor/local/include/pango-1.0/pango/pango-features.h +12 -0
- data/vendor/local/include/pango-1.0/pango/pango-font.h +622 -0
- data/vendor/local/include/pango-1.0/pango/pango-fontmap.h +167 -0
- data/vendor/local/include/pango-1.0/pango/pango-fontset.h +169 -0
- data/vendor/local/include/pango-1.0/pango/pango-glyph-item.h +158 -0
- data/vendor/local/include/pango-1.0/pango/pango-glyph.h +197 -0
- data/vendor/local/include/pango-1.0/pango/pango-gravity.h +128 -0
- data/vendor/local/include/pango-1.0/pango/pango-item.h +109 -0
- data/vendor/local/include/pango-1.0/pango/pango-language.h +61 -0
- data/vendor/local/include/pango-1.0/pango/pango-layout.h +340 -0
- data/vendor/local/include/pango-1.0/pango/pango-matrix.h +117 -0
- data/vendor/local/include/pango-1.0/pango/pango-modules.h +71 -0
- data/vendor/local/include/pango-1.0/pango/pango-ot.h +391 -0
- data/vendor/local/include/pango-1.0/pango/pango-renderer.h +260 -0
- data/vendor/local/include/pango-1.0/pango/pango-script.h +260 -0
- data/vendor/local/include/pango-1.0/pango/pango-tabs.h +87 -0
- data/vendor/local/include/pango-1.0/pango/pango-types.h +200 -0
- data/vendor/local/include/pango-1.0/pango/pango-utils.h +189 -0
- data/vendor/local/include/pango-1.0/pango/pango.h +48 -0
- data/vendor/local/include/pango-1.0/pango/pangocairo.h +169 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-decoder.h +110 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-font.h +153 -0
- data/vendor/local/include/pango-1.0/pango/pangofc-fontmap.h +289 -0
- data/vendor/local/include/pango-1.0/pango/pangoft2.h +133 -0
- data/vendor/local/include/pango-1.0/pango/pangowin32.h +128 -0
- data/vendor/local/include/unicode/alphaindex.h +752 -0
- data/vendor/local/include/unicode/appendable.h +232 -0
- data/vendor/local/include/unicode/basictz.h +214 -0
- data/vendor/local/include/unicode/brkiter.h +655 -0
- data/vendor/local/include/unicode/bytestream.h +257 -0
- data/vendor/local/include/unicode/bytestrie.h +519 -0
- data/vendor/local/include/unicode/bytestriebuilder.h +181 -0
- data/vendor/local/include/unicode/calendar.h +2519 -0
- data/vendor/local/include/unicode/caniter.h +208 -0
- data/vendor/local/include/unicode/chariter.h +722 -0
- data/vendor/local/include/unicode/choicfmt.h +594 -0
- data/vendor/local/include/unicode/coleitr.h +404 -0
- data/vendor/local/include/unicode/coll.h +1267 -0
- data/vendor/local/include/unicode/compactdecimalformat.h +330 -0
- data/vendor/local/include/unicode/curramt.h +130 -0
- data/vendor/local/include/unicode/currpinf.h +258 -0
- data/vendor/local/include/unicode/currunit.h +110 -0
- data/vendor/local/include/unicode/datefmt.h +883 -0
- data/vendor/local/include/unicode/dbbi.h +40 -0
- data/vendor/local/include/unicode/dcfmtsym.h +482 -0
- data/vendor/local/include/unicode/decimfmt.h +2479 -0
- data/vendor/local/include/unicode/docmain.h +215 -0
- data/vendor/local/include/unicode/dtfmtsym.h +912 -0
- data/vendor/local/include/unicode/dtintrv.h +158 -0
- data/vendor/local/include/unicode/dtitvfmt.h +985 -0
- data/vendor/local/include/unicode/dtitvinf.h +514 -0
- data/vendor/local/include/unicode/dtptngen.h +498 -0
- data/vendor/local/include/unicode/dtrule.h +250 -0
- data/vendor/local/include/unicode/enumset.h +64 -0
- data/vendor/local/include/unicode/errorcode.h +137 -0
- data/vendor/local/include/unicode/fieldpos.h +291 -0
- data/vendor/local/include/unicode/filteredbrk.h +131 -0
- data/vendor/local/include/unicode/fmtable.h +760 -0
- data/vendor/local/include/unicode/format.h +305 -0
- data/vendor/local/include/unicode/fpositer.h +117 -0
- data/vendor/local/include/unicode/gender.h +111 -0
- data/vendor/local/include/unicode/gregocal.h +777 -0
- data/vendor/local/include/unicode/icudataver.h +41 -0
- data/vendor/local/include/unicode/icuplug.h +371 -0
- data/vendor/local/include/unicode/idna.h +323 -0
- data/vendor/local/include/unicode/listformatter.h +167 -0
- data/vendor/local/include/unicode/localpointer.h +304 -0
- data/vendor/local/include/unicode/locdspnm.h +204 -0
- data/vendor/local/include/unicode/locid.h +815 -0
- data/vendor/local/include/unicode/measfmt.h +389 -0
- data/vendor/local/include/unicode/measunit.h +1443 -0
- data/vendor/local/include/unicode/measure.h +159 -0
- data/vendor/local/include/unicode/messagepattern.h +943 -0
- data/vendor/local/include/unicode/msgfmt.h +1093 -0
- data/vendor/local/include/unicode/normalizer2.h +658 -0
- data/vendor/local/include/unicode/normlzr.h +797 -0
- data/vendor/local/include/unicode/numfmt.h +1187 -0
- data/vendor/local/include/unicode/numsys.h +208 -0
- data/vendor/local/include/unicode/parseerr.h +92 -0
- data/vendor/local/include/unicode/parsepos.h +230 -0
- data/vendor/local/include/unicode/platform.h +751 -0
- data/vendor/local/include/unicode/plurfmt.h +615 -0
- data/vendor/local/include/unicode/plurrule.h +501 -0
- data/vendor/local/include/unicode/ptypes.h +126 -0
- data/vendor/local/include/unicode/putil.h +181 -0
- data/vendor/local/include/unicode/rbbi.h +782 -0
- data/vendor/local/include/unicode/rbnf.h +1032 -0
- data/vendor/local/include/unicode/rbtz.h +362 -0
- data/vendor/local/include/unicode/regex.h +1857 -0
- data/vendor/local/include/unicode/region.h +228 -0
- data/vendor/local/include/unicode/reldatefmt.h +498 -0
- data/vendor/local/include/unicode/rep.h +261 -0
- data/vendor/local/include/unicode/resbund.h +490 -0
- data/vendor/local/include/unicode/schriter.h +187 -0
- data/vendor/local/include/unicode/scientificformathelper.h +139 -0
- data/vendor/local/include/unicode/search.h +575 -0
- data/vendor/local/include/unicode/selfmt.h +367 -0
- data/vendor/local/include/unicode/simpletz.h +928 -0
- data/vendor/local/include/unicode/smpdtfmt.h +1592 -0
- data/vendor/local/include/unicode/sortkey.h +338 -0
- data/vendor/local/include/unicode/std_string.h +37 -0
- data/vendor/local/include/unicode/strenum.h +276 -0
- data/vendor/local/include/unicode/stringpiece.h +224 -0
- data/vendor/local/include/unicode/stringtriebuilder.h +402 -0
- data/vendor/local/include/unicode/stsearch.h +504 -0
- data/vendor/local/include/unicode/symtable.h +112 -0
- data/vendor/local/include/unicode/tblcoll.h +873 -0
- data/vendor/local/include/unicode/timezone.h +948 -0
- data/vendor/local/include/unicode/tmunit.h +129 -0
- data/vendor/local/include/unicode/tmutamt.h +168 -0
- data/vendor/local/include/unicode/tmutfmt.h +243 -0
- data/vendor/local/include/unicode/translit.h +1342 -0
- data/vendor/local/include/unicode/tzfmt.h +1098 -0
- data/vendor/local/include/unicode/tznames.h +404 -0
- data/vendor/local/include/unicode/tzrule.h +828 -0
- data/vendor/local/include/unicode/tztrans.h +195 -0
- data/vendor/local/include/unicode/ubidi.h +2186 -0
- data/vendor/local/include/unicode/ubrk.h +540 -0
- data/vendor/local/include/unicode/ucal.h +1560 -0
- data/vendor/local/include/unicode/ucasemap.h +423 -0
- data/vendor/local/include/unicode/ucat.h +158 -0
- data/vendor/local/include/unicode/uchar.h +3426 -0
- data/vendor/local/include/unicode/ucharstrie.h +576 -0
- data/vendor/local/include/unicode/ucharstriebuilder.h +185 -0
- data/vendor/local/include/unicode/uchriter.h +381 -0
- data/vendor/local/include/unicode/uclean.h +258 -0
- data/vendor/local/include/unicode/ucnv.h +2036 -0
- data/vendor/local/include/unicode/ucnv_cb.h +162 -0
- data/vendor/local/include/unicode/ucnv_err.h +463 -0
- data/vendor/local/include/unicode/ucnvsel.h +187 -0
- data/vendor/local/include/unicode/ucol.h +1474 -0
- data/vendor/local/include/unicode/ucoleitr.h +266 -0
- data/vendor/local/include/unicode/uconfig.h +430 -0
- data/vendor/local/include/unicode/ucsdet.h +413 -0
- data/vendor/local/include/unicode/ucurr.h +424 -0
- data/vendor/local/include/unicode/udat.h +1536 -0
- data/vendor/local/include/unicode/udata.h +430 -0
- data/vendor/local/include/unicode/udateintervalformat.h +181 -0
- data/vendor/local/include/unicode/udatpg.h +588 -0
- data/vendor/local/include/unicode/udisplaycontext.h +150 -0
- data/vendor/local/include/unicode/uenum.h +206 -0
- data/vendor/local/include/unicode/uformattable.h +280 -0
- data/vendor/local/include/unicode/ugender.h +82 -0
- data/vendor/local/include/unicode/uidna.h +762 -0
- data/vendor/local/include/unicode/uiter.h +707 -0
- data/vendor/local/include/unicode/uldnames.h +302 -0
- data/vendor/local/include/unicode/uloc.h +1256 -0
- data/vendor/local/include/unicode/ulocdata.h +277 -0
- data/vendor/local/include/unicode/umachine.h +356 -0
- data/vendor/local/include/unicode/umisc.h +60 -0
- data/vendor/local/include/unicode/umsg.h +623 -0
- data/vendor/local/include/unicode/unifilt.h +120 -0
- data/vendor/local/include/unicode/unifunct.h +125 -0
- data/vendor/local/include/unicode/unimatch.h +163 -0
- data/vendor/local/include/unicode/unirepl.h +97 -0
- data/vendor/local/include/unicode/uniset.h +1691 -0
- data/vendor/local/include/unicode/unistr.h +4470 -0
- data/vendor/local/include/unicode/unorm.h +561 -0
- data/vendor/local/include/unicode/unorm2.h +528 -0
- data/vendor/local/include/unicode/unum.h +1328 -0
- data/vendor/local/include/unicode/unumsys.h +170 -0
- data/vendor/local/include/unicode/uobject.h +320 -0
- data/vendor/local/include/unicode/upluralrules.h +145 -0
- data/vendor/local/include/unicode/uregex.h +1591 -0
- data/vendor/local/include/unicode/uregion.h +248 -0
- data/vendor/local/include/unicode/urename.h +1784 -0
- data/vendor/local/include/unicode/urep.h +155 -0
- data/vendor/local/include/unicode/ures.h +887 -0
- data/vendor/local/include/unicode/uscript.h +642 -0
- data/vendor/local/include/unicode/usearch.h +885 -0
- data/vendor/local/include/unicode/uset.h +1126 -0
- data/vendor/local/include/unicode/usetiter.h +318 -0
- data/vendor/local/include/unicode/ushape.h +474 -0
- data/vendor/local/include/unicode/uspoof.h +1064 -0
- data/vendor/local/include/unicode/usprep.h +269 -0
- data/vendor/local/include/unicode/ustdio.h +1018 -0
- data/vendor/local/include/unicode/ustream.h +68 -0
- data/vendor/local/include/unicode/ustring.h +1700 -0
- data/vendor/local/include/unicode/ustringtrie.h +95 -0
- data/vendor/local/include/unicode/utext.h +1600 -0
- data/vendor/local/include/unicode/utf.h +223 -0
- data/vendor/local/include/unicode/utf16.h +623 -0
- data/vendor/local/include/unicode/utf32.h +23 -0
- data/vendor/local/include/unicode/utf8.h +824 -0
- data/vendor/local/include/unicode/utf_old.h +1169 -0
- data/vendor/local/include/unicode/utmscale.h +481 -0
- data/vendor/local/include/unicode/utrace.h +359 -0
- data/vendor/local/include/unicode/utrans.h +658 -0
- data/vendor/local/include/unicode/utypes.h +723 -0
- data/vendor/local/include/unicode/uvernum.h +170 -0
- data/vendor/local/include/unicode/uversion.h +193 -0
- data/vendor/local/include/unicode/vtzone.h +455 -0
- data/vendor/local/lib/girepository-1.0/Pango-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/PangoCairo-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/PangoFT2-1.0.typelib +0 -0
- data/vendor/local/lib/icu/54.1/Makefile.inc +293 -0
- data/vendor/local/lib/icu/54.1/pkgdata.inc +17 -0
- data/vendor/local/lib/icu/Makefile.inc +293 -0
- data/vendor/local/lib/icu/pkgdata.inc +17 -0
- data/vendor/local/lib/icudt.dll +0 -0
- data/vendor/local/lib/icudt54.dll +0 -0
- data/vendor/local/lib/icuin.dll +0 -0
- data/vendor/local/lib/icuin54.dll +0 -0
- data/vendor/local/lib/icuio.dll +0 -0
- data/vendor/local/lib/icuio54.dll +0 -0
- data/vendor/local/lib/icule.dll +0 -0
- data/vendor/local/lib/icule54.dll +0 -0
- data/vendor/local/lib/iculx.dll +0 -0
- data/vendor/local/lib/iculx54.dll +0 -0
- data/vendor/local/lib/icutest.dll +0 -0
- data/vendor/local/lib/icutest54.dll +0 -0
- data/vendor/local/lib/icutu.dll +0 -0
- data/vendor/local/lib/icutu54.dll +0 -0
- data/vendor/local/lib/icuuc.dll +0 -0
- data/vendor/local/lib/icuuc54.dll +0 -0
- data/vendor/local/lib/libharfbuzz-icu.a +0 -0
- data/vendor/local/lib/libharfbuzz-icu.la +41 -0
- data/vendor/local/lib/libharfbuzz.dll.a +0 -0
- data/vendor/local/lib/libharfbuzz.la +41 -0
- data/vendor/local/lib/libicudt.dll.a +0 -0
- data/vendor/local/lib/libicuin.dll.a +0 -0
- data/vendor/local/lib/libicuio.dll.a +0 -0
- data/vendor/local/lib/libicule.dll.a +0 -0
- data/vendor/local/lib/libiculx.dll.a +0 -0
- data/vendor/local/lib/libicutest.dll.a +0 -0
- data/vendor/local/lib/libicutu.dll.a +0 -0
- data/vendor/local/lib/libicuuc.dll.a +0 -0
- data/vendor/local/lib/libpango-1.0.dll.a +0 -0
- data/vendor/local/lib/libpango-1.0.la +41 -0
- data/vendor/local/lib/libpangocairo-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangocairo-1.0.la +41 -0
- data/vendor/local/lib/libpangoft2-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangoft2-1.0.la +41 -0
- data/vendor/local/lib/libpangowin32-1.0.dll.a +0 -0
- data/vendor/local/lib/libpangowin32-1.0.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-arabic-lang.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-fc.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-basic-win32.la +41 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.dll +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.dll.a +0 -0
- data/vendor/local/lib/pango/1.8.0/modules/pango-indic-lang.la +41 -0
- data/vendor/local/lib/pkgconfig/harfbuzz-icu.pc +13 -0
- data/vendor/local/lib/pkgconfig/harfbuzz.pc +11 -0
- data/vendor/local/lib/pkgconfig/icu-i18n.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-io.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-le.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-lx.pc +38 -0
- data/vendor/local/lib/pkgconfig/icu-uc.pc +38 -0
- data/vendor/local/lib/pkgconfig/pango.pc +14 -0
- data/vendor/local/lib/pkgconfig/pangocairo.pc +11 -0
- data/vendor/local/lib/pkgconfig/pangoft2.pc +12 -0
- data/vendor/local/lib/pkgconfig/pangowin32.pc +11 -0
- data/vendor/local/share/gir-1.0/Pango-1.0.gir +13329 -0
- data/vendor/local/share/gir-1.0/PangoCairo-1.0.gir +833 -0
- data/vendor/local/share/gir-1.0/PangoFT2-1.0.gir +354 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/annotation-glossary.html +75 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/api-index-full.html +1449 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/ch01.html +98 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/deprecated-api-index.html +46 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-blob.html +610 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-buffer.html +1780 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-common.html +1337 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-coretext.html +144 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-deprecated.html +99 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-face.html +630 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-font.html +2529 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ft.html +188 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-glib.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-gobject.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-graphite2.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-icu.html +120 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot-layout.html +771 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot-tag.html +172 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-ot.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-set.html +966 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-shape-plan.html +405 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-shape.html +286 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-unicode.html +1523 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-uniscribe.html +100 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb-version.html +182 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz-hb.html +50 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/harfbuzz.devhelp2 +378 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/index.html +105 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/index.sgml +496 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/object-tree.html +59 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/harfbuzz/up.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineLang.html +224 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoEngineShape.html +255 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcDecoder.html +246 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFont.html +500 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoFcFontMap.html +1001 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoMarkupFormat.html +301 -0
- data/vendor/local/share/gtk-doc/html/pango/PangoRenderer.html +1219 -0
- data/vendor/local/share/gtk-doc/html/pango/annotation-glossary.html +89 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-10.html +135 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-12.html +49 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-14.html +64 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-16.html +228 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-18.html +152 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-2.html +122 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-20.html +87 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-22.html +124 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-24.html +97 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-26.html +46 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-30.html +39 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-31-0.html +39 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-32-4.html +53 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-32.html +42 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-34.html +38 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-4.html +201 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-6.html +165 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-1-8.html +171 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-deprecated.html +284 -0
- data/vendor/local/share/gtk-doc/html/pango/api-index-full.html +2968 -0
- data/vendor/local/share/gtk-doc/html/pango/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/index.html +146 -0
- data/vendor/local/share/gtk-doc/html/pango/index.sgml +957 -0
- data/vendor/local/share/gtk-doc/html/pango/layout.gif +0 -0
- data/vendor/local/share/gtk-doc/html/pango/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/lowlevel.html +68 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Bidirectional-Text.html +514 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Cairo-Rendering.html +1632 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-CoreText-Fonts.html +115 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Coverage-Maps.html +508 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Engines.html +358 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Fonts.html +4154 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-FreeType-Fonts-and-Rendering.html +956 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Glyph-Storage.html +2627 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Layout-Objects.html +4153 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Miscellaneous-Utilities.html +965 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Modules.html +331 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-OpenType-Font-Handling.html +2202 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Scripts-and-Languages.html +1430 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Tab-Stops.html +582 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Attributes.html +3356 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Text-Processing.html +2079 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Version-Checking.html +325 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Vertical-Text.html +523 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Win32-Fonts-and-Rendering.html +1028 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-Xft-Fonts-and-Rendering.html +1275 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-hierarchy.html +91 -0
- data/vendor/local/share/gtk-doc/html/pango/pango-querymodules.html +131 -0
- data/vendor/local/share/gtk-doc/html/pango/pango.devhelp2 +786 -0
- data/vendor/local/share/gtk-doc/html/pango/pango.html +63 -0
- data/vendor/local/share/gtk-doc/html/pango/rendering.html +47 -0
- data/vendor/local/share/gtk-doc/html/pango/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/rotated-text.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/pango/tools.html +33 -0
- data/vendor/local/share/gtk-doc/html/pango/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/pango/up.png +0 -0
- data/vendor/local/share/icu/54.1/config/mh-mingw64 +158 -0
- data/vendor/local/share/icu/54.1/install-sh +251 -0
- data/vendor/local/share/icu/54.1/license.html +385 -0
- data/vendor/local/share/icu/54.1/mkinstalldirs +43 -0
- data/vendor/local/share/license/harfbuzz/AUTHORS +9 -0
- data/vendor/local/share/license/harfbuzz/COPYING +36 -0
- data/vendor/local/share/license/pango/AUTHORS +2 -0
- data/vendor/local/share/license/pango/COPYING +482 -0
- data/vendor/local/share/man/man1/derb.1 +196 -0
- data/vendor/local/share/man/man1/genbrk.1 +112 -0
- data/vendor/local/share/man/man1/gencfu.1 +91 -0
- data/vendor/local/share/man/man1/gencnval.1 +91 -0
- data/vendor/local/share/man/man1/gendict.1 +131 -0
- data/vendor/local/share/man/man1/genrb.1 +146 -0
- data/vendor/local/share/man/man1/icu-config.1 +288 -0
- data/vendor/local/share/man/man1/makeconv.1 +112 -0
- data/vendor/local/share/man/man1/pango-querymodules.1 +106 -0
- data/vendor/local/share/man/man1/pango-view.1 +1 -0
- data/vendor/local/share/man/man1/pkgdata.1 +258 -0
- data/vendor/local/share/man/man1/uconv.1 +443 -0
- data/vendor/local/share/man/man8/genccode.8 +106 -0
- data/vendor/local/share/man/man8/gencmn.8 +129 -0
- data/vendor/local/share/man/man8/gensprep.8 +102 -0
- data/vendor/local/share/man/man8/icupkg.8 +204 -0
- metadata +599 -0
@@ -0,0 +1,1857 @@
|
|
1
|
+
/*
|
2
|
+
**********************************************************************
|
3
|
+
* Copyright (C) 2002-2014, International Business Machines
|
4
|
+
* Corporation and others. All Rights Reserved.
|
5
|
+
**********************************************************************
|
6
|
+
* file name: regex.h
|
7
|
+
* encoding: US-ASCII
|
8
|
+
* indentation:4
|
9
|
+
*
|
10
|
+
* created on: 2002oct22
|
11
|
+
* created by: Andy Heninger
|
12
|
+
*
|
13
|
+
* ICU Regular Expressions, API for C++
|
14
|
+
*/
|
15
|
+
|
16
|
+
#ifndef REGEX_H
|
17
|
+
#define REGEX_H
|
18
|
+
|
19
|
+
//#define REGEX_DEBUG
|
20
|
+
|
21
|
+
/**
|
22
|
+
* \file
|
23
|
+
* \brief C++ API: Regular Expressions
|
24
|
+
*
|
25
|
+
* <h2>Regular Expression API</h2>
|
26
|
+
*
|
27
|
+
* <p>The ICU API for processing regular expressions consists of two classes,
|
28
|
+
* <code>RegexPattern</code> and <code>RegexMatcher</code>.
|
29
|
+
* <code>RegexPattern</code> objects represent a pre-processed, or compiled
|
30
|
+
* regular expression. They are created from a regular expression pattern string,
|
31
|
+
* and can be used to create <code>RegexMatcher</code> objects for the pattern.</p>
|
32
|
+
*
|
33
|
+
* <p>Class <code>RegexMatcher</code> bundles together a regular expression
|
34
|
+
* pattern and a target string to which the search pattern will be applied.
|
35
|
+
* <code>RegexMatcher</code> includes API for doing plain find or search
|
36
|
+
* operations, for search and replace operations, and for obtaining detailed
|
37
|
+
* information about bounds of a match. </p>
|
38
|
+
*
|
39
|
+
* <p>Note that by constructing <code>RegexMatcher</code> objects directly from regular
|
40
|
+
* expression pattern strings application code can be simplified and the explicit
|
41
|
+
* need for <code>RegexPattern</code> objects can usually be eliminated.
|
42
|
+
* </p>
|
43
|
+
*/
|
44
|
+
|
45
|
+
#include "unicode/utypes.h"
|
46
|
+
|
47
|
+
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
|
48
|
+
|
49
|
+
#include "unicode/uobject.h"
|
50
|
+
#include "unicode/unistr.h"
|
51
|
+
#include "unicode/utext.h"
|
52
|
+
#include "unicode/parseerr.h"
|
53
|
+
|
54
|
+
#include "unicode/uregex.h"
|
55
|
+
|
56
|
+
// Forward Declarations
|
57
|
+
|
58
|
+
U_NAMESPACE_BEGIN
|
59
|
+
|
60
|
+
struct Regex8BitSet;
|
61
|
+
class RegexCImpl;
|
62
|
+
class RegexMatcher;
|
63
|
+
class RegexPattern;
|
64
|
+
struct REStackFrame;
|
65
|
+
class RuleBasedBreakIterator;
|
66
|
+
class UnicodeSet;
|
67
|
+
class UVector;
|
68
|
+
class UVector32;
|
69
|
+
class UVector64;
|
70
|
+
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Class <code>RegexPattern</code> represents a compiled regular expression. It includes
|
74
|
+
* factory methods for creating a RegexPattern object from the source (string) form
|
75
|
+
* of a regular expression, methods for creating RegexMatchers that allow the pattern
|
76
|
+
* to be applied to input text, and a few convenience methods for simple common
|
77
|
+
* uses of regular expressions.
|
78
|
+
*
|
79
|
+
* <p>Class RegexPattern is not intended to be subclassed.</p>
|
80
|
+
*
|
81
|
+
* @stable ICU 2.4
|
82
|
+
*/
|
83
|
+
class U_I18N_API RegexPattern U_FINAL : public UObject {
|
84
|
+
public:
|
85
|
+
|
86
|
+
/**
|
87
|
+
* default constructor. Create a RegexPattern object that refers to no actual
|
88
|
+
* pattern. Not normally needed; RegexPattern objects are usually
|
89
|
+
* created using the factory method <code>compile()</code>.
|
90
|
+
*
|
91
|
+
* @stable ICU 2.4
|
92
|
+
*/
|
93
|
+
RegexPattern();
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Copy Constructor. Create a new RegexPattern object that is equivalent
|
97
|
+
* to the source object.
|
98
|
+
* @param source the pattern object to be copied.
|
99
|
+
* @stable ICU 2.4
|
100
|
+
*/
|
101
|
+
RegexPattern(const RegexPattern &source);
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Destructor. Note that a RegexPattern object must persist so long as any
|
105
|
+
* RegexMatcher objects that were created from the RegexPattern are active.
|
106
|
+
* @stable ICU 2.4
|
107
|
+
*/
|
108
|
+
virtual ~RegexPattern();
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Comparison operator. Two RegexPattern objects are considered equal if they
|
112
|
+
* were constructed from identical source patterns using the same match flag
|
113
|
+
* settings.
|
114
|
+
* @param that a RegexPattern object to compare with "this".
|
115
|
+
* @return TRUE if the objects are equivalent.
|
116
|
+
* @stable ICU 2.4
|
117
|
+
*/
|
118
|
+
UBool operator==(const RegexPattern& that) const;
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Comparison operator. Two RegexPattern objects are considered equal if they
|
122
|
+
* were constructed from identical source patterns using the same match flag
|
123
|
+
* settings.
|
124
|
+
* @param that a RegexPattern object to compare with "this".
|
125
|
+
* @return TRUE if the objects are different.
|
126
|
+
* @stable ICU 2.4
|
127
|
+
*/
|
128
|
+
inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Assignment operator. After assignment, this RegexPattern will behave identically
|
132
|
+
* to the source object.
|
133
|
+
* @stable ICU 2.4
|
134
|
+
*/
|
135
|
+
RegexPattern &operator =(const RegexPattern &source);
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Create an exact copy of this RegexPattern object. Since RegexPattern is not
|
139
|
+
* intended to be subclasses, <code>clone()</code> and the copy construction are
|
140
|
+
* equivalent operations.
|
141
|
+
* @return the copy of this RegexPattern
|
142
|
+
* @stable ICU 2.4
|
143
|
+
*/
|
144
|
+
virtual RegexPattern *clone() const;
|
145
|
+
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Compiles the regular expression in string form into a RegexPattern
|
149
|
+
* object. These compile methods, rather than the constructors, are the usual
|
150
|
+
* way that RegexPattern objects are created.
|
151
|
+
*
|
152
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
153
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
154
|
+
* back to their pattern, so premature deletion of the pattern is a
|
155
|
+
* catastrophic error.</p>
|
156
|
+
*
|
157
|
+
* <p>All pattern match mode flags are set to their default values.</p>
|
158
|
+
*
|
159
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
160
|
+
* from a pattern string rather than separately compiling the pattern and
|
161
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
162
|
+
*
|
163
|
+
* @param regex The regular expression to be compiled.
|
164
|
+
* @param pe Receives the position (line and column nubers) of any error
|
165
|
+
* within the regular expression.)
|
166
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
167
|
+
* @return A regexPattern object for the compiled pattern.
|
168
|
+
*
|
169
|
+
* @stable ICU 2.4
|
170
|
+
*/
|
171
|
+
static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex,
|
172
|
+
UParseError &pe,
|
173
|
+
UErrorCode &status);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Compiles the regular expression in string form into a RegexPattern
|
177
|
+
* object. These compile methods, rather than the constructors, are the usual
|
178
|
+
* way that RegexPattern objects are created.
|
179
|
+
*
|
180
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
181
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
182
|
+
* back to their pattern, so premature deletion of the pattern is a
|
183
|
+
* catastrophic error.</p>
|
184
|
+
*
|
185
|
+
* <p>All pattern match mode flags are set to their default values.</p>
|
186
|
+
*
|
187
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
188
|
+
* from a pattern string rather than separately compiling the pattern and
|
189
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
190
|
+
*
|
191
|
+
* @param regex The regular expression to be compiled. Note, the text referred
|
192
|
+
* to by this UText must not be deleted during the lifetime of the
|
193
|
+
* RegexPattern object or any RegexMatcher object created from it.
|
194
|
+
* @param pe Receives the position (line and column nubers) of any error
|
195
|
+
* within the regular expression.)
|
196
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
197
|
+
* @return A regexPattern object for the compiled pattern.
|
198
|
+
*
|
199
|
+
* @stable ICU 4.6
|
200
|
+
*/
|
201
|
+
static RegexPattern * U_EXPORT2 compile( UText *regex,
|
202
|
+
UParseError &pe,
|
203
|
+
UErrorCode &status);
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Compiles the regular expression in string form into a RegexPattern
|
207
|
+
* object using the specified match mode flags. These compile methods,
|
208
|
+
* rather than the constructors, are the usual way that RegexPattern objects
|
209
|
+
* are created.
|
210
|
+
*
|
211
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
212
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
213
|
+
* back to their pattern, so premature deletion of the pattern is a
|
214
|
+
* catastrophic error.</p>
|
215
|
+
*
|
216
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
217
|
+
* from a pattern string instead of than separately compiling the pattern and
|
218
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
219
|
+
*
|
220
|
+
* @param regex The regular expression to be compiled.
|
221
|
+
* @param flags The match mode flags to be used.
|
222
|
+
* @param pe Receives the position (line and column numbers) of any error
|
223
|
+
* within the regular expression.)
|
224
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
225
|
+
* @return A regexPattern object for the compiled pattern.
|
226
|
+
*
|
227
|
+
* @stable ICU 2.4
|
228
|
+
*/
|
229
|
+
static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex,
|
230
|
+
uint32_t flags,
|
231
|
+
UParseError &pe,
|
232
|
+
UErrorCode &status);
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Compiles the regular expression in string form into a RegexPattern
|
236
|
+
* object using the specified match mode flags. These compile methods,
|
237
|
+
* rather than the constructors, are the usual way that RegexPattern objects
|
238
|
+
* are created.
|
239
|
+
*
|
240
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
241
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
242
|
+
* back to their pattern, so premature deletion of the pattern is a
|
243
|
+
* catastrophic error.</p>
|
244
|
+
*
|
245
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
246
|
+
* from a pattern string instead of than separately compiling the pattern and
|
247
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
248
|
+
*
|
249
|
+
* @param regex The regular expression to be compiled. Note, the text referred
|
250
|
+
* to by this UText must not be deleted during the lifetime of the
|
251
|
+
* RegexPattern object or any RegexMatcher object created from it.
|
252
|
+
* @param flags The match mode flags to be used.
|
253
|
+
* @param pe Receives the position (line and column numbers) of any error
|
254
|
+
* within the regular expression.)
|
255
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
256
|
+
* @return A regexPattern object for the compiled pattern.
|
257
|
+
*
|
258
|
+
* @stable ICU 4.6
|
259
|
+
*/
|
260
|
+
static RegexPattern * U_EXPORT2 compile( UText *regex,
|
261
|
+
uint32_t flags,
|
262
|
+
UParseError &pe,
|
263
|
+
UErrorCode &status);
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Compiles the regular expression in string form into a RegexPattern
|
267
|
+
* object using the specified match mode flags. These compile methods,
|
268
|
+
* rather than the constructors, are the usual way that RegexPattern objects
|
269
|
+
* are created.
|
270
|
+
*
|
271
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
272
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
273
|
+
* back to their pattern, so premature deletion of the pattern is a
|
274
|
+
* catastrophic error.</p>
|
275
|
+
*
|
276
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
277
|
+
* from a pattern string instead of than separately compiling the pattern and
|
278
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
279
|
+
*
|
280
|
+
* @param regex The regular expression to be compiled.
|
281
|
+
* @param flags The match mode flags to be used.
|
282
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
283
|
+
* @return A regexPattern object for the compiled pattern.
|
284
|
+
*
|
285
|
+
* @stable ICU 2.6
|
286
|
+
*/
|
287
|
+
static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex,
|
288
|
+
uint32_t flags,
|
289
|
+
UErrorCode &status);
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Compiles the regular expression in string form into a RegexPattern
|
293
|
+
* object using the specified match mode flags. These compile methods,
|
294
|
+
* rather than the constructors, are the usual way that RegexPattern objects
|
295
|
+
* are created.
|
296
|
+
*
|
297
|
+
* <p>Note that RegexPattern objects must not be deleted while RegexMatcher
|
298
|
+
* objects created from the pattern are active. RegexMatchers keep a pointer
|
299
|
+
* back to their pattern, so premature deletion of the pattern is a
|
300
|
+
* catastrophic error.</p>
|
301
|
+
*
|
302
|
+
* <p>Note that it is often more convenient to construct a RegexMatcher directly
|
303
|
+
* from a pattern string instead of than separately compiling the pattern and
|
304
|
+
* then creating a RegexMatcher object from the pattern.</p>
|
305
|
+
*
|
306
|
+
* @param regex The regular expression to be compiled. Note, the text referred
|
307
|
+
* to by this UText must not be deleted during the lifetime of the
|
308
|
+
* RegexPattern object or any RegexMatcher object created from it.
|
309
|
+
* @param flags The match mode flags to be used.
|
310
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
311
|
+
* @return A regexPattern object for the compiled pattern.
|
312
|
+
*
|
313
|
+
* @stable ICU 4.6
|
314
|
+
*/
|
315
|
+
static RegexPattern * U_EXPORT2 compile( UText *regex,
|
316
|
+
uint32_t flags,
|
317
|
+
UErrorCode &status);
|
318
|
+
|
319
|
+
/**
|
320
|
+
* Get the match mode flags that were used when compiling this pattern.
|
321
|
+
* @return the match mode flags
|
322
|
+
* @stable ICU 2.4
|
323
|
+
*/
|
324
|
+
virtual uint32_t flags() const;
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Creates a RegexMatcher that will match the given input against this pattern. The
|
328
|
+
* RegexMatcher can then be used to perform match, find or replace operations
|
329
|
+
* on the input. Note that a RegexPattern object must not be deleted while
|
330
|
+
* RegexMatchers created from it still exist and might possibly be used again.
|
331
|
+
* <p>
|
332
|
+
* The matcher will retain a reference to the supplied input string, and all regexp
|
333
|
+
* pattern matching operations happen directly on this original string. It is
|
334
|
+
* critical that the string not be altered or deleted before use by the regular
|
335
|
+
* expression operations is complete.
|
336
|
+
*
|
337
|
+
* @param input The input string to which the regular expression will be applied.
|
338
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
339
|
+
* @return A RegexMatcher object for this pattern and input.
|
340
|
+
*
|
341
|
+
* @stable ICU 2.4
|
342
|
+
*/
|
343
|
+
virtual RegexMatcher *matcher(const UnicodeString &input,
|
344
|
+
UErrorCode &status) const;
|
345
|
+
|
346
|
+
private:
|
347
|
+
/**
|
348
|
+
* Cause a compilation error if an application accidentally attempts to
|
349
|
+
* create a matcher with a (UChar *) string as input rather than
|
350
|
+
* a UnicodeString. Avoids a dangling reference to a temporary string.
|
351
|
+
* <p>
|
352
|
+
* To efficiently work with UChar *strings, wrap the data in a UnicodeString
|
353
|
+
* using one of the aliasing constructors, such as
|
354
|
+
* <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
|
355
|
+
* or in a UText, using
|
356
|
+
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
|
357
|
+
*
|
358
|
+
*/
|
359
|
+
RegexMatcher *matcher(const UChar *input,
|
360
|
+
UErrorCode &status) const;
|
361
|
+
public:
|
362
|
+
|
363
|
+
|
364
|
+
/**
|
365
|
+
* Creates a RegexMatcher that will match against this pattern. The
|
366
|
+
* RegexMatcher can be used to perform match, find or replace operations.
|
367
|
+
* Note that a RegexPattern object must not be deleted while
|
368
|
+
* RegexMatchers created from it still exist and might possibly be used again.
|
369
|
+
*
|
370
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
371
|
+
* @return A RegexMatcher object for this pattern and input.
|
372
|
+
*
|
373
|
+
* @stable ICU 2.6
|
374
|
+
*/
|
375
|
+
virtual RegexMatcher *matcher(UErrorCode &status) const;
|
376
|
+
|
377
|
+
|
378
|
+
/**
|
379
|
+
* Test whether a string matches a regular expression. This convenience function
|
380
|
+
* both compiles the regular expression and applies it in a single operation.
|
381
|
+
* Note that if the same pattern needs to be applied repeatedly, this method will be
|
382
|
+
* less efficient than creating and reusing a RegexMatcher object.
|
383
|
+
*
|
384
|
+
* @param regex The regular expression
|
385
|
+
* @param input The string data to be matched
|
386
|
+
* @param pe Receives the position of any syntax errors within the regular expression
|
387
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
388
|
+
* @return True if the regular expression exactly matches the full input string.
|
389
|
+
*
|
390
|
+
* @stable ICU 2.4
|
391
|
+
*/
|
392
|
+
static UBool U_EXPORT2 matches(const UnicodeString ®ex,
|
393
|
+
const UnicodeString &input,
|
394
|
+
UParseError &pe,
|
395
|
+
UErrorCode &status);
|
396
|
+
|
397
|
+
/**
|
398
|
+
* Test whether a string matches a regular expression. This convenience function
|
399
|
+
* both compiles the regular expression and applies it in a single operation.
|
400
|
+
* Note that if the same pattern needs to be applied repeatedly, this method will be
|
401
|
+
* less efficient than creating and reusing a RegexMatcher object.
|
402
|
+
*
|
403
|
+
* @param regex The regular expression
|
404
|
+
* @param input The string data to be matched
|
405
|
+
* @param pe Receives the position of any syntax errors within the regular expression
|
406
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
407
|
+
* @return True if the regular expression exactly matches the full input string.
|
408
|
+
*
|
409
|
+
* @stable ICU 4.6
|
410
|
+
*/
|
411
|
+
static UBool U_EXPORT2 matches(UText *regex,
|
412
|
+
UText *input,
|
413
|
+
UParseError &pe,
|
414
|
+
UErrorCode &status);
|
415
|
+
|
416
|
+
/**
|
417
|
+
* Returns the regular expression from which this pattern was compiled. This method will work
|
418
|
+
* even if the pattern was compiled from a UText.
|
419
|
+
*
|
420
|
+
* Note: If the pattern was originally compiled from a UText, and that UText was modified,
|
421
|
+
* the returned string may no longer reflect the RegexPattern object.
|
422
|
+
* @stable ICU 2.4
|
423
|
+
*/
|
424
|
+
virtual UnicodeString pattern() const;
|
425
|
+
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Returns the regular expression from which this pattern was compiled. This method will work
|
429
|
+
* even if the pattern was compiled from a UnicodeString.
|
430
|
+
*
|
431
|
+
* Note: This is the original input, not a clone. If the pattern was originally compiled from a
|
432
|
+
* UText, and that UText was modified, the returned UText may no longer reflect the RegexPattern
|
433
|
+
* object.
|
434
|
+
*
|
435
|
+
* @stable ICU 4.6
|
436
|
+
*/
|
437
|
+
virtual UText *patternText(UErrorCode &status) const;
|
438
|
+
|
439
|
+
|
440
|
+
/**
|
441
|
+
* Split a string into fields. Somewhat like split() from Perl or Java.
|
442
|
+
* Pattern matches identify delimiters that separate the input
|
443
|
+
* into fields. The input data between the delimiters becomes the
|
444
|
+
* fields themselves.
|
445
|
+
*
|
446
|
+
* If the delimiter pattern includes capture groups, the captured text will
|
447
|
+
* also appear in the destination array of output strings, interspersed
|
448
|
+
* with the fields. This is similar to Perl, but differs from Java,
|
449
|
+
* which ignores the presence of capture groups in the pattern.
|
450
|
+
*
|
451
|
+
* Trailing empty fields will always be returned, assuming sufficient
|
452
|
+
* destination capacity. This differs from the default behavior for Java
|
453
|
+
* and Perl where trailing empty fields are not returned.
|
454
|
+
*
|
455
|
+
* The number of strings produced by the split operation is returned.
|
456
|
+
* This count includes the strings from capture groups in the delimiter pattern.
|
457
|
+
* This behavior differs from Java, which ignores capture groups.
|
458
|
+
*
|
459
|
+
* For the best performance on split() operations,
|
460
|
+
* <code>RegexMatcher::split</code> is preferable to this function
|
461
|
+
*
|
462
|
+
* @param input The string to be split into fields. The field delimiters
|
463
|
+
* match the pattern (in the "this" object)
|
464
|
+
* @param dest An array of UnicodeStrings to receive the results of the split.
|
465
|
+
* This is an array of actual UnicodeString objects, not an
|
466
|
+
* array of pointers to strings. Local (stack based) arrays can
|
467
|
+
* work well here.
|
468
|
+
* @param destCapacity The number of elements in the destination array.
|
469
|
+
* If the number of fields found is less than destCapacity, the
|
470
|
+
* extra strings in the destination array are not altered.
|
471
|
+
* If the number of destination strings is less than the number
|
472
|
+
* of fields, the trailing part of the input string, including any
|
473
|
+
* field delimiters, is placed in the last destination string.
|
474
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
475
|
+
* @return The number of fields into which the input string was split.
|
476
|
+
* @stable ICU 2.4
|
477
|
+
*/
|
478
|
+
virtual int32_t split(const UnicodeString &input,
|
479
|
+
UnicodeString dest[],
|
480
|
+
int32_t destCapacity,
|
481
|
+
UErrorCode &status) const;
|
482
|
+
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Split a string into fields. Somewhat like split() from Perl or Java.
|
486
|
+
* Pattern matches identify delimiters that separate the input
|
487
|
+
* into fields. The input data between the delimiters becomes the
|
488
|
+
* fields themselves.
|
489
|
+
*
|
490
|
+
* If the delimiter pattern includes capture groups, the captured text will
|
491
|
+
* also appear in the destination array of output strings, interspersed
|
492
|
+
* with the fields. This is similar to Perl, but differs from Java,
|
493
|
+
* which ignores the presence of capture groups in the pattern.
|
494
|
+
*
|
495
|
+
* Trailing empty fields will always be returned, assuming sufficient
|
496
|
+
* destination capacity. This differs from the default behavior for Java
|
497
|
+
* and Perl where trailing empty fields are not returned.
|
498
|
+
*
|
499
|
+
* The number of strings produced by the split operation is returned.
|
500
|
+
* This count includes the strings from capture groups in the delimiter pattern.
|
501
|
+
* This behavior differs from Java, which ignores capture groups.
|
502
|
+
*
|
503
|
+
* For the best performance on split() operations,
|
504
|
+
* <code>RegexMatcher::split</code> is preferable to this function
|
505
|
+
*
|
506
|
+
* @param input The string to be split into fields. The field delimiters
|
507
|
+
* match the pattern (in the "this" object)
|
508
|
+
* @param dest An array of mutable UText structs to receive the results of the split.
|
509
|
+
* If a field is NULL, a new UText is allocated to contain the results for
|
510
|
+
* that field. This new UText is not guaranteed to be mutable.
|
511
|
+
* @param destCapacity The number of elements in the destination array.
|
512
|
+
* If the number of fields found is less than destCapacity, the
|
513
|
+
* extra strings in the destination array are not altered.
|
514
|
+
* If the number of destination strings is less than the number
|
515
|
+
* of fields, the trailing part of the input string, including any
|
516
|
+
* field delimiters, is placed in the last destination string.
|
517
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
518
|
+
* @return The number of destination strings used.
|
519
|
+
*
|
520
|
+
* @stable ICU 4.6
|
521
|
+
*/
|
522
|
+
virtual int32_t split(UText *input,
|
523
|
+
UText *dest[],
|
524
|
+
int32_t destCapacity,
|
525
|
+
UErrorCode &status) const;
|
526
|
+
|
527
|
+
|
528
|
+
/**
|
529
|
+
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
530
|
+
*
|
531
|
+
* @stable ICU 2.4
|
532
|
+
*/
|
533
|
+
virtual UClassID getDynamicClassID() const;
|
534
|
+
|
535
|
+
/**
|
536
|
+
* ICU "poor man's RTTI", returns a UClassID for this class.
|
537
|
+
*
|
538
|
+
* @stable ICU 2.4
|
539
|
+
*/
|
540
|
+
static UClassID U_EXPORT2 getStaticClassID();
|
541
|
+
|
542
|
+
private:
|
543
|
+
//
|
544
|
+
// Implementation Data
|
545
|
+
//
|
546
|
+
UText *fPattern; // The original pattern string.
|
547
|
+
UnicodeString *fPatternString; // The original pattern UncodeString if relevant
|
548
|
+
uint32_t fFlags; // The flags used when compiling the pattern.
|
549
|
+
//
|
550
|
+
UVector64 *fCompiledPat; // The compiled pattern p-code.
|
551
|
+
UnicodeString fLiteralText; // Any literal string data from the pattern,
|
552
|
+
// after un-escaping, for use during the match.
|
553
|
+
|
554
|
+
UVector *fSets; // Any UnicodeSets referenced from the pattern.
|
555
|
+
Regex8BitSet *fSets8; // (and fast sets for latin-1 range.)
|
556
|
+
|
557
|
+
|
558
|
+
UErrorCode fDeferredStatus; // status if some prior error has left this
|
559
|
+
// RegexPattern in an unusable state.
|
560
|
+
|
561
|
+
int32_t fMinMatchLen; // Minimum Match Length. All matches will have length
|
562
|
+
// >= this value. For some patterns, this calculated
|
563
|
+
// value may be less than the true shortest
|
564
|
+
// possible match.
|
565
|
+
|
566
|
+
int32_t fFrameSize; // Size of a state stack frame in the
|
567
|
+
// execution engine.
|
568
|
+
|
569
|
+
int32_t fDataSize; // The size of the data needed by the pattern that
|
570
|
+
// does not go on the state stack, but has just
|
571
|
+
// a single copy per matcher.
|
572
|
+
|
573
|
+
UVector32 *fGroupMap; // Map from capture group number to position of
|
574
|
+
// the group's variables in the matcher stack frame.
|
575
|
+
|
576
|
+
int32_t fMaxCaptureDigits;
|
577
|
+
|
578
|
+
UnicodeSet **fStaticSets; // Ptr to static (shared) sets for predefined
|
579
|
+
// regex character classes, e.g. Word.
|
580
|
+
|
581
|
+
Regex8BitSet *fStaticSets8; // Ptr to the static (shared) latin-1 only
|
582
|
+
// sets for predefined regex classes.
|
583
|
+
|
584
|
+
int32_t fStartType; // Info on how a match must start.
|
585
|
+
int32_t fInitialStringIdx; //
|
586
|
+
int32_t fInitialStringLen;
|
587
|
+
UnicodeSet *fInitialChars;
|
588
|
+
UChar32 fInitialChar;
|
589
|
+
Regex8BitSet *fInitialChars8;
|
590
|
+
UBool fNeedsAltInput;
|
591
|
+
|
592
|
+
friend class RegexCompile;
|
593
|
+
friend class RegexMatcher;
|
594
|
+
friend class RegexCImpl;
|
595
|
+
|
596
|
+
//
|
597
|
+
// Implementation Methods
|
598
|
+
//
|
599
|
+
void init(); // Common initialization, for use by constructors.
|
600
|
+
void zap(); // Common cleanup
|
601
|
+
|
602
|
+
void dumpOp(int32_t index) const;
|
603
|
+
|
604
|
+
public:
|
605
|
+
#ifndef U_HIDE_INTERNAL_API
|
606
|
+
/**
|
607
|
+
* Dump a compiled pattern. Internal debug function.
|
608
|
+
* @internal
|
609
|
+
*/
|
610
|
+
void dumpPattern() const;
|
611
|
+
#endif /* U_HIDE_INTERNAL_API */
|
612
|
+
};
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
/**
|
617
|
+
* class RegexMatcher bundles together a regular expression pattern and
|
618
|
+
* input text to which the expression can be applied. It includes methods
|
619
|
+
* for testing for matches, and for find and replace operations.
|
620
|
+
*
|
621
|
+
* <p>Class RegexMatcher is not intended to be subclassed.</p>
|
622
|
+
*
|
623
|
+
* @stable ICU 2.4
|
624
|
+
*/
|
625
|
+
class U_I18N_API RegexMatcher U_FINAL : public UObject {
|
626
|
+
public:
|
627
|
+
|
628
|
+
/**
|
629
|
+
* Construct a RegexMatcher for a regular expression.
|
630
|
+
* This is a convenience method that avoids the need to explicitly create
|
631
|
+
* a RegexPattern object. Note that if several RegexMatchers need to be
|
632
|
+
* created for the same expression, it will be more efficient to
|
633
|
+
* separately create and cache a RegexPattern object, and use
|
634
|
+
* its matcher() method to create the RegexMatcher objects.
|
635
|
+
*
|
636
|
+
* @param regexp The Regular Expression to be compiled.
|
637
|
+
* @param flags Regular expression options, such as case insensitive matching.
|
638
|
+
* @see UREGEX_CASE_INSENSITIVE
|
639
|
+
* @param status Any errors are reported by setting this UErrorCode variable.
|
640
|
+
* @stable ICU 2.6
|
641
|
+
*/
|
642
|
+
RegexMatcher(const UnicodeString ®exp, uint32_t flags, UErrorCode &status);
|
643
|
+
|
644
|
+
/**
|
645
|
+
* Construct a RegexMatcher for a regular expression.
|
646
|
+
* This is a convenience method that avoids the need to explicitly create
|
647
|
+
* a RegexPattern object. Note that if several RegexMatchers need to be
|
648
|
+
* created for the same expression, it will be more efficient to
|
649
|
+
* separately create and cache a RegexPattern object, and use
|
650
|
+
* its matcher() method to create the RegexMatcher objects.
|
651
|
+
*
|
652
|
+
* @param regexp The regular expression to be compiled.
|
653
|
+
* @param flags Regular expression options, such as case insensitive matching.
|
654
|
+
* @see UREGEX_CASE_INSENSITIVE
|
655
|
+
* @param status Any errors are reported by setting this UErrorCode variable.
|
656
|
+
*
|
657
|
+
* @stable ICU 4.6
|
658
|
+
*/
|
659
|
+
RegexMatcher(UText *regexp, uint32_t flags, UErrorCode &status);
|
660
|
+
|
661
|
+
/**
|
662
|
+
* Construct a RegexMatcher for a regular expression.
|
663
|
+
* This is a convenience method that avoids the need to explicitly create
|
664
|
+
* a RegexPattern object. Note that if several RegexMatchers need to be
|
665
|
+
* created for the same expression, it will be more efficient to
|
666
|
+
* separately create and cache a RegexPattern object, and use
|
667
|
+
* its matcher() method to create the RegexMatcher objects.
|
668
|
+
* <p>
|
669
|
+
* The matcher will retain a reference to the supplied input string, and all regexp
|
670
|
+
* pattern matching operations happen directly on the original string. It is
|
671
|
+
* critical that the string not be altered or deleted before use by the regular
|
672
|
+
* expression operations is complete.
|
673
|
+
*
|
674
|
+
* @param regexp The Regular Expression to be compiled.
|
675
|
+
* @param input The string to match. The matcher retains a reference to the
|
676
|
+
* caller's string; mo copy is made.
|
677
|
+
* @param flags Regular expression options, such as case insensitive matching.
|
678
|
+
* @see UREGEX_CASE_INSENSITIVE
|
679
|
+
* @param status Any errors are reported by setting this UErrorCode variable.
|
680
|
+
* @stable ICU 2.6
|
681
|
+
*/
|
682
|
+
RegexMatcher(const UnicodeString ®exp, const UnicodeString &input,
|
683
|
+
uint32_t flags, UErrorCode &status);
|
684
|
+
|
685
|
+
/**
|
686
|
+
* Construct a RegexMatcher for a regular expression.
|
687
|
+
* This is a convenience method that avoids the need to explicitly create
|
688
|
+
* a RegexPattern object. Note that if several RegexMatchers need to be
|
689
|
+
* created for the same expression, it will be more efficient to
|
690
|
+
* separately create and cache a RegexPattern object, and use
|
691
|
+
* its matcher() method to create the RegexMatcher objects.
|
692
|
+
* <p>
|
693
|
+
* The matcher will make a shallow clone of the supplied input text, and all regexp
|
694
|
+
* pattern matching operations happen on this clone. While read-only operations on
|
695
|
+
* the supplied text are permitted, it is critical that the underlying string not be
|
696
|
+
* altered or deleted before use by the regular expression operations is complete.
|
697
|
+
*
|
698
|
+
* @param regexp The Regular Expression to be compiled.
|
699
|
+
* @param input The string to match. The matcher retains a shallow clone of the text.
|
700
|
+
* @param flags Regular expression options, such as case insensitive matching.
|
701
|
+
* @see UREGEX_CASE_INSENSITIVE
|
702
|
+
* @param status Any errors are reported by setting this UErrorCode variable.
|
703
|
+
*
|
704
|
+
* @stable ICU 4.6
|
705
|
+
*/
|
706
|
+
RegexMatcher(UText *regexp, UText *input,
|
707
|
+
uint32_t flags, UErrorCode &status);
|
708
|
+
|
709
|
+
private:
|
710
|
+
/**
|
711
|
+
* Cause a compilation error if an application accidentally attempts to
|
712
|
+
* create a matcher with a (UChar *) string as input rather than
|
713
|
+
* a UnicodeString. Avoids a dangling reference to a temporary string.
|
714
|
+
* <p>
|
715
|
+
* To efficiently work with UChar *strings, wrap the data in a UnicodeString
|
716
|
+
* using one of the aliasing constructors, such as
|
717
|
+
* <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
|
718
|
+
* or in a UText, using
|
719
|
+
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
|
720
|
+
*
|
721
|
+
*/
|
722
|
+
RegexMatcher(const UnicodeString ®exp, const UChar *input,
|
723
|
+
uint32_t flags, UErrorCode &status);
|
724
|
+
public:
|
725
|
+
|
726
|
+
|
727
|
+
/**
|
728
|
+
* Destructor.
|
729
|
+
*
|
730
|
+
* @stable ICU 2.4
|
731
|
+
*/
|
732
|
+
virtual ~RegexMatcher();
|
733
|
+
|
734
|
+
|
735
|
+
/**
|
736
|
+
* Attempts to match the entire input region against the pattern.
|
737
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
738
|
+
* @return TRUE if there is a match
|
739
|
+
* @stable ICU 2.4
|
740
|
+
*/
|
741
|
+
virtual UBool matches(UErrorCode &status);
|
742
|
+
|
743
|
+
|
744
|
+
/**
|
745
|
+
* Resets the matcher, then attempts to match the input beginning
|
746
|
+
* at the specified startIndex, and extending to the end of the input.
|
747
|
+
* The input region is reset to include the entire input string.
|
748
|
+
* A successful match must extend to the end of the input.
|
749
|
+
* @param startIndex The input string (native) index at which to begin matching.
|
750
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
751
|
+
* @return TRUE if there is a match
|
752
|
+
* @stable ICU 2.8
|
753
|
+
*/
|
754
|
+
virtual UBool matches(int64_t startIndex, UErrorCode &status);
|
755
|
+
|
756
|
+
|
757
|
+
/**
|
758
|
+
* Attempts to match the input string, starting from the beginning of the region,
|
759
|
+
* against the pattern. Like the matches() method, this function
|
760
|
+
* always starts at the beginning of the input region;
|
761
|
+
* unlike that function, it does not require that the entire region be matched.
|
762
|
+
*
|
763
|
+
* <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
|
764
|
+
* <code>end()</code>, and <code>group()</code> functions.</p>
|
765
|
+
*
|
766
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
767
|
+
* @return TRUE if there is a match at the start of the input string.
|
768
|
+
* @stable ICU 2.4
|
769
|
+
*/
|
770
|
+
virtual UBool lookingAt(UErrorCode &status);
|
771
|
+
|
772
|
+
|
773
|
+
/**
|
774
|
+
* Attempts to match the input string, starting from the specified index, against the pattern.
|
775
|
+
* The match may be of any length, and is not required to extend to the end
|
776
|
+
* of the input string. Contrast with match().
|
777
|
+
*
|
778
|
+
* <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
|
779
|
+
* <code>end()</code>, and <code>group()</code> functions.</p>
|
780
|
+
*
|
781
|
+
* @param startIndex The input string (native) index at which to begin matching.
|
782
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
783
|
+
* @return TRUE if there is a match.
|
784
|
+
* @stable ICU 2.8
|
785
|
+
*/
|
786
|
+
virtual UBool lookingAt(int64_t startIndex, UErrorCode &status);
|
787
|
+
|
788
|
+
|
789
|
+
/**
|
790
|
+
* Find the next pattern match in the input string.
|
791
|
+
* The find begins searching the input at the location following the end of
|
792
|
+
* the previous match, or at the start of the string if there is no previous match.
|
793
|
+
* If a match is found, <code>start(), end()</code> and <code>group()</code>
|
794
|
+
* will provide more information regarding the match.
|
795
|
+
* <p>Note that if the input string is changed by the application,
|
796
|
+
* use find(startPos, status) instead of find(), because the saved starting
|
797
|
+
* position may not be valid with the altered input string.</p>
|
798
|
+
* @return TRUE if a match is found.
|
799
|
+
* @stable ICU 2.4
|
800
|
+
*/
|
801
|
+
virtual UBool find();
|
802
|
+
|
803
|
+
|
804
|
+
/**
|
805
|
+
* Find the next pattern match in the input string.
|
806
|
+
* The find begins searching the input at the location following the end of
|
807
|
+
* the previous match, or at the start of the string if there is no previous match.
|
808
|
+
* If a match is found, <code>start(), end()</code> and <code>group()</code>
|
809
|
+
* will provide more information regarding the match.
|
810
|
+
* <p>Note that if the input string is changed by the application,
|
811
|
+
* use find(startPos, status) instead of find(), because the saved starting
|
812
|
+
* position may not be valid with the altered input string.</p>
|
813
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
814
|
+
* @return TRUE if a match is found.
|
815
|
+
* @internal
|
816
|
+
*/
|
817
|
+
virtual UBool find(UErrorCode &status);
|
818
|
+
|
819
|
+
/**
|
820
|
+
* Resets this RegexMatcher and then attempts to find the next substring of the
|
821
|
+
* input string that matches the pattern, starting at the specified index.
|
822
|
+
*
|
823
|
+
* @param start The (native) index in the input string to begin the search.
|
824
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
825
|
+
* @return TRUE if a match is found.
|
826
|
+
* @stable ICU 2.4
|
827
|
+
*/
|
828
|
+
virtual UBool find(int64_t start, UErrorCode &status);
|
829
|
+
|
830
|
+
|
831
|
+
/**
|
832
|
+
* Returns a string containing the text matched by the previous match.
|
833
|
+
* If the pattern can match an empty string, an empty string may be returned.
|
834
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
835
|
+
* Possible errors are U_REGEX_INVALID_STATE if no match
|
836
|
+
* has been attempted or the last match failed.
|
837
|
+
* @return a string containing the matched input text.
|
838
|
+
* @stable ICU 2.4
|
839
|
+
*/
|
840
|
+
virtual UnicodeString group(UErrorCode &status) const;
|
841
|
+
|
842
|
+
|
843
|
+
/**
|
844
|
+
* Returns a string containing the text captured by the given group
|
845
|
+
* during the previous match operation. Group(0) is the entire match.
|
846
|
+
*
|
847
|
+
* @param groupNum the capture group number
|
848
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
849
|
+
* Possible errors are U_REGEX_INVALID_STATE if no match
|
850
|
+
* has been attempted or the last match failed and
|
851
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
|
852
|
+
* @return the captured text
|
853
|
+
* @stable ICU 2.4
|
854
|
+
*/
|
855
|
+
virtual UnicodeString group(int32_t groupNum, UErrorCode &status) const;
|
856
|
+
|
857
|
+
|
858
|
+
/**
|
859
|
+
* Returns the number of capturing groups in this matcher's pattern.
|
860
|
+
* @return the number of capture groups
|
861
|
+
* @stable ICU 2.4
|
862
|
+
*/
|
863
|
+
virtual int32_t groupCount() const;
|
864
|
+
|
865
|
+
|
866
|
+
/**
|
867
|
+
* Returns a shallow clone of the entire live input string with the UText current native index
|
868
|
+
* set to the beginning of the requested group.
|
869
|
+
*
|
870
|
+
* @param dest The UText into which the input should be cloned, or NULL to create a new UText
|
871
|
+
* @param group_len A reference to receive the length of the desired capture group
|
872
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
873
|
+
* Possible errors are U_REGEX_INVALID_STATE if no match
|
874
|
+
* has been attempted or the last match failed and
|
875
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
|
876
|
+
* @return dest if non-NULL, a shallow copy of the input text otherwise
|
877
|
+
*
|
878
|
+
* @stable ICU 4.6
|
879
|
+
*/
|
880
|
+
virtual UText *group(UText *dest, int64_t &group_len, UErrorCode &status) const;
|
881
|
+
|
882
|
+
/**
|
883
|
+
* Returns a shallow clone of the entire live input string with the UText current native index
|
884
|
+
* set to the beginning of the requested group.
|
885
|
+
*
|
886
|
+
* @param groupNum The capture group number.
|
887
|
+
* @param dest The UText into which the input should be cloned, or NULL to create a new UText.
|
888
|
+
* @param group_len A reference to receive the length of the desired capture group
|
889
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
890
|
+
* Possible errors are U_REGEX_INVALID_STATE if no match
|
891
|
+
* has been attempted or the last match failed and
|
892
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
|
893
|
+
* @return dest if non-NULL, a shallow copy of the input text otherwise
|
894
|
+
*
|
895
|
+
* @stable ICU 4.6
|
896
|
+
*/
|
897
|
+
virtual UText *group(int32_t groupNum, UText *dest, int64_t &group_len, UErrorCode &status) const;
|
898
|
+
|
899
|
+
/**
|
900
|
+
* Returns a string containing the text captured by the given group
|
901
|
+
* during the previous match operation. Group(0) is the entire match.
|
902
|
+
*
|
903
|
+
* @param groupNum the capture group number
|
904
|
+
* @param dest A mutable UText in which the matching text is placed.
|
905
|
+
* If NULL, a new UText will be created (which may not be mutable).
|
906
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
907
|
+
* Possible errors are U_REGEX_INVALID_STATE if no match
|
908
|
+
* has been attempted or the last match failed.
|
909
|
+
* @return A string containing the matched input text. If a pre-allocated UText
|
910
|
+
* was provided, it will always be used and returned.
|
911
|
+
*
|
912
|
+
* @internal ICU 4.4 technology preview
|
913
|
+
*/
|
914
|
+
virtual UText *group(int32_t groupNum, UText *dest, UErrorCode &status) const;
|
915
|
+
|
916
|
+
|
917
|
+
/**
|
918
|
+
* Returns the index in the input string of the start of the text matched
|
919
|
+
* during the previous match operation.
|
920
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
921
|
+
* @return The (native) position in the input string of the start of the last match.
|
922
|
+
* @stable ICU 2.4
|
923
|
+
*/
|
924
|
+
virtual int32_t start(UErrorCode &status) const;
|
925
|
+
|
926
|
+
/**
|
927
|
+
* Returns the index in the input string of the start of the text matched
|
928
|
+
* during the previous match operation.
|
929
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
930
|
+
* @return The (native) position in the input string of the start of the last match.
|
931
|
+
* @stable ICU 4.6
|
932
|
+
*/
|
933
|
+
virtual int64_t start64(UErrorCode &status) const;
|
934
|
+
|
935
|
+
|
936
|
+
/**
|
937
|
+
* Returns the index in the input string of the start of the text matched by the
|
938
|
+
* specified capture group during the previous match operation. Return -1 if
|
939
|
+
* the capture group exists in the pattern, but was not part of the last match.
|
940
|
+
*
|
941
|
+
* @param group the capture group number
|
942
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
943
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
944
|
+
* attempted or the last match failed, and
|
945
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number
|
946
|
+
* @return the (native) start position of substring matched by the specified group.
|
947
|
+
* @stable ICU 2.4
|
948
|
+
*/
|
949
|
+
virtual int32_t start(int32_t group, UErrorCode &status) const;
|
950
|
+
|
951
|
+
/**
|
952
|
+
* Returns the index in the input string of the start of the text matched by the
|
953
|
+
* specified capture group during the previous match operation. Return -1 if
|
954
|
+
* the capture group exists in the pattern, but was not part of the last match.
|
955
|
+
*
|
956
|
+
* @param group the capture group number.
|
957
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
958
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
959
|
+
* attempted or the last match failed, and
|
960
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
|
961
|
+
* @return the (native) start position of substring matched by the specified group.
|
962
|
+
* @stable ICU 4.6
|
963
|
+
*/
|
964
|
+
virtual int64_t start64(int32_t group, UErrorCode &status) const;
|
965
|
+
|
966
|
+
|
967
|
+
/**
|
968
|
+
* Returns the index in the input string of the first character following the
|
969
|
+
* text matched during the previous match operation.
|
970
|
+
*
|
971
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
972
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
973
|
+
* attempted or the last match failed.
|
974
|
+
* @return the index of the last character matched, plus one.
|
975
|
+
* The index value returned is a native index, corresponding to
|
976
|
+
* code units for the underlying encoding type, for example,
|
977
|
+
* a byte index for UTF-8.
|
978
|
+
* @stable ICU 2.4
|
979
|
+
*/
|
980
|
+
virtual int32_t end(UErrorCode &status) const;
|
981
|
+
|
982
|
+
/**
|
983
|
+
* Returns the index in the input string of the first character following the
|
984
|
+
* text matched during the previous match operation.
|
985
|
+
*
|
986
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
987
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
988
|
+
* attempted or the last match failed.
|
989
|
+
* @return the index of the last character matched, plus one.
|
990
|
+
* The index value returned is a native index, corresponding to
|
991
|
+
* code units for the underlying encoding type, for example,
|
992
|
+
* a byte index for UTF-8.
|
993
|
+
* @stable ICU 4.6
|
994
|
+
*/
|
995
|
+
virtual int64_t end64(UErrorCode &status) const;
|
996
|
+
|
997
|
+
|
998
|
+
/**
|
999
|
+
* Returns the index in the input string of the character following the
|
1000
|
+
* text matched by the specified capture group during the previous match operation.
|
1001
|
+
*
|
1002
|
+
* @param group the capture group number
|
1003
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
1004
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
1005
|
+
* attempted or the last match failed and
|
1006
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number
|
1007
|
+
* @return the index of the first character following the text
|
1008
|
+
* captured by the specified group during the previous match operation.
|
1009
|
+
* Return -1 if the capture group exists in the pattern but was not part of the match.
|
1010
|
+
* The index value returned is a native index, corresponding to
|
1011
|
+
* code units for the underlying encoding type, for example,
|
1012
|
+
* a byte index for UTF8.
|
1013
|
+
* @stable ICU 2.4
|
1014
|
+
*/
|
1015
|
+
virtual int32_t end(int32_t group, UErrorCode &status) const;
|
1016
|
+
|
1017
|
+
/**
|
1018
|
+
* Returns the index in the input string of the character following the
|
1019
|
+
* text matched by the specified capture group during the previous match operation.
|
1020
|
+
*
|
1021
|
+
* @param group the capture group number
|
1022
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
1023
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
1024
|
+
* attempted or the last match failed and
|
1025
|
+
* U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number
|
1026
|
+
* @return the index of the first character following the text
|
1027
|
+
* captured by the specified group during the previous match operation.
|
1028
|
+
* Return -1 if the capture group exists in the pattern but was not part of the match.
|
1029
|
+
* The index value returned is a native index, corresponding to
|
1030
|
+
* code units for the underlying encoding type, for example,
|
1031
|
+
* a byte index for UTF8.
|
1032
|
+
* @stable ICU 4.6
|
1033
|
+
*/
|
1034
|
+
virtual int64_t end64(int32_t group, UErrorCode &status) const;
|
1035
|
+
|
1036
|
+
|
1037
|
+
/**
|
1038
|
+
* Resets this matcher. The effect is to remove any memory of previous matches,
|
1039
|
+
* and to cause subsequent find() operations to begin at the beginning of
|
1040
|
+
* the input string.
|
1041
|
+
*
|
1042
|
+
* @return this RegexMatcher.
|
1043
|
+
* @stable ICU 2.4
|
1044
|
+
*/
|
1045
|
+
virtual RegexMatcher &reset();
|
1046
|
+
|
1047
|
+
|
1048
|
+
/**
|
1049
|
+
* Resets this matcher, and set the current input position.
|
1050
|
+
* The effect is to remove any memory of previous matches,
|
1051
|
+
* and to cause subsequent find() operations to begin at
|
1052
|
+
* the specified (native) position in the input string.
|
1053
|
+
* <p>
|
1054
|
+
* The matcher's region is reset to its default, which is the entire
|
1055
|
+
* input string.
|
1056
|
+
* <p>
|
1057
|
+
* An alternative to this function is to set a match region
|
1058
|
+
* beginning at the desired index.
|
1059
|
+
*
|
1060
|
+
* @return this RegexMatcher.
|
1061
|
+
* @stable ICU 2.8
|
1062
|
+
*/
|
1063
|
+
virtual RegexMatcher &reset(int64_t index, UErrorCode &status);
|
1064
|
+
|
1065
|
+
|
1066
|
+
/**
|
1067
|
+
* Resets this matcher with a new input string. This allows instances of RegexMatcher
|
1068
|
+
* to be reused, which is more efficient than creating a new RegexMatcher for
|
1069
|
+
* each input string to be processed.
|
1070
|
+
* @param input The new string on which subsequent pattern matches will operate.
|
1071
|
+
* The matcher retains a reference to the callers string, and operates
|
1072
|
+
* directly on that. Ownership of the string remains with the caller.
|
1073
|
+
* Because no copy of the string is made, it is essential that the
|
1074
|
+
* caller not delete the string until after regexp operations on it
|
1075
|
+
* are done.
|
1076
|
+
* Note that while a reset on the matcher with an input string that is then
|
1077
|
+
* modified across/during matcher operations may be supported currently for UnicodeString,
|
1078
|
+
* this was not originally intended behavior, and support for this is not guaranteed
|
1079
|
+
* in upcoming versions of ICU.
|
1080
|
+
* @return this RegexMatcher.
|
1081
|
+
* @stable ICU 2.4
|
1082
|
+
*/
|
1083
|
+
virtual RegexMatcher &reset(const UnicodeString &input);
|
1084
|
+
|
1085
|
+
|
1086
|
+
/**
|
1087
|
+
* Resets this matcher with a new input string. This allows instances of RegexMatcher
|
1088
|
+
* to be reused, which is more efficient than creating a new RegexMatcher for
|
1089
|
+
* each input string to be processed.
|
1090
|
+
* @param input The new string on which subsequent pattern matches will operate.
|
1091
|
+
* The matcher makes a shallow clone of the given text; ownership of the
|
1092
|
+
* original string remains with the caller. Because no deep copy of the
|
1093
|
+
* text is made, it is essential that the caller not modify the string
|
1094
|
+
* until after regexp operations on it are done.
|
1095
|
+
* @return this RegexMatcher.
|
1096
|
+
*
|
1097
|
+
* @stable ICU 4.6
|
1098
|
+
*/
|
1099
|
+
virtual RegexMatcher &reset(UText *input);
|
1100
|
+
|
1101
|
+
|
1102
|
+
/**
|
1103
|
+
* Set the subject text string upon which the regular expression is looking for matches
|
1104
|
+
* without changing any other aspect of the matching state.
|
1105
|
+
* The new and previous text strings must have the same content.
|
1106
|
+
*
|
1107
|
+
* This function is intended for use in environments where ICU is operating on
|
1108
|
+
* strings that may move around in memory. It provides a mechanism for notifying
|
1109
|
+
* ICU that the string has been relocated, and providing a new UText to access the
|
1110
|
+
* string in its new position.
|
1111
|
+
*
|
1112
|
+
* Note that the regular expression implementation never copies the underlying text
|
1113
|
+
* of a string being matched, but always operates directly on the original text
|
1114
|
+
* provided by the user. Refreshing simply drops the references to the old text
|
1115
|
+
* and replaces them with references to the new.
|
1116
|
+
*
|
1117
|
+
* Caution: this function is normally used only by very specialized,
|
1118
|
+
* system-level code. One example use case is with garbage collection that moves
|
1119
|
+
* the text in memory.
|
1120
|
+
*
|
1121
|
+
* @param input The new (moved) text string.
|
1122
|
+
* @param status Receives errors detected by this function.
|
1123
|
+
*
|
1124
|
+
* @stable ICU 4.8
|
1125
|
+
*/
|
1126
|
+
virtual RegexMatcher &refreshInputText(UText *input, UErrorCode &status);
|
1127
|
+
|
1128
|
+
private:
|
1129
|
+
/**
|
1130
|
+
* Cause a compilation error if an application accidentally attempts to
|
1131
|
+
* reset a matcher with a (UChar *) string as input rather than
|
1132
|
+
* a UnicodeString. Avoids a dangling reference to a temporary string.
|
1133
|
+
* <p>
|
1134
|
+
* To efficiently work with UChar *strings, wrap the data in a UnicodeString
|
1135
|
+
* using one of the aliasing constructors, such as
|
1136
|
+
* <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
|
1137
|
+
* or in a UText, using
|
1138
|
+
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
|
1139
|
+
*
|
1140
|
+
*/
|
1141
|
+
RegexMatcher &reset(const UChar *input);
|
1142
|
+
public:
|
1143
|
+
|
1144
|
+
/**
|
1145
|
+
* Returns the input string being matched. Ownership of the string belongs to
|
1146
|
+
* the matcher; it should not be altered or deleted. This method will work even if the input
|
1147
|
+
* was originally supplied as a UText.
|
1148
|
+
* @return the input string
|
1149
|
+
* @stable ICU 2.4
|
1150
|
+
*/
|
1151
|
+
virtual const UnicodeString &input() const;
|
1152
|
+
|
1153
|
+
/**
|
1154
|
+
* Returns the input string being matched. This is the live input text; it should not be
|
1155
|
+
* altered or deleted. This method will work even if the input was originally supplied as
|
1156
|
+
* a UnicodeString.
|
1157
|
+
* @return the input text
|
1158
|
+
*
|
1159
|
+
* @stable ICU 4.6
|
1160
|
+
*/
|
1161
|
+
virtual UText *inputText() const;
|
1162
|
+
|
1163
|
+
/**
|
1164
|
+
* Returns the input string being matched, either by copying it into the provided
|
1165
|
+
* UText parameter or by returning a shallow clone of the live input. Note that copying
|
1166
|
+
* the entire input may cause significant performance and memory issues.
|
1167
|
+
* @param dest The UText into which the input should be copied, or NULL to create a new UText
|
1168
|
+
* @param status error code
|
1169
|
+
* @return dest if non-NULL, a shallow copy of the input text otherwise
|
1170
|
+
*
|
1171
|
+
* @stable ICU 4.6
|
1172
|
+
*/
|
1173
|
+
virtual UText *getInput(UText *dest, UErrorCode &status) const;
|
1174
|
+
|
1175
|
+
|
1176
|
+
/** Sets the limits of this matcher's region.
|
1177
|
+
* The region is the part of the input string that will be searched to find a match.
|
1178
|
+
* Invoking this method resets the matcher, and then sets the region to start
|
1179
|
+
* at the index specified by the start parameter and end at the index specified
|
1180
|
+
* by the end parameter.
|
1181
|
+
*
|
1182
|
+
* Depending on the transparency and anchoring being used (see useTransparentBounds
|
1183
|
+
* and useAnchoringBounds), certain constructs such as anchors may behave differently
|
1184
|
+
* at or around the boundaries of the region
|
1185
|
+
*
|
1186
|
+
* The function will fail if start is greater than limit, or if either index
|
1187
|
+
* is less than zero or greater than the length of the string being matched.
|
1188
|
+
*
|
1189
|
+
* @param start The (native) index to begin searches at.
|
1190
|
+
* @param limit The index to end searches at (exclusive).
|
1191
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1192
|
+
* @stable ICU 4.0
|
1193
|
+
*/
|
1194
|
+
virtual RegexMatcher ®ion(int64_t start, int64_t limit, UErrorCode &status);
|
1195
|
+
|
1196
|
+
/**
|
1197
|
+
* Identical to region(start, limit, status) but also allows a start position without
|
1198
|
+
* resetting the region state.
|
1199
|
+
* @param regionStart The region start
|
1200
|
+
* @param regionLimit the limit of the region
|
1201
|
+
* @param startIndex The (native) index within the region bounds at which to begin searches.
|
1202
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1203
|
+
* If startIndex is not within the specified region bounds,
|
1204
|
+
* U_INDEX_OUTOFBOUNDS_ERROR is returned.
|
1205
|
+
* @stable ICU 4.6
|
1206
|
+
*/
|
1207
|
+
virtual RegexMatcher ®ion(int64_t regionStart, int64_t regionLimit, int64_t startIndex, UErrorCode &status);
|
1208
|
+
|
1209
|
+
/**
|
1210
|
+
* Reports the start index of this matcher's region. The searches this matcher
|
1211
|
+
* conducts are limited to finding matches within regionStart (inclusive) and
|
1212
|
+
* regionEnd (exclusive).
|
1213
|
+
*
|
1214
|
+
* @return The starting (native) index of this matcher's region.
|
1215
|
+
* @stable ICU 4.0
|
1216
|
+
*/
|
1217
|
+
virtual int32_t regionStart() const;
|
1218
|
+
|
1219
|
+
/**
|
1220
|
+
* Reports the start index of this matcher's region. The searches this matcher
|
1221
|
+
* conducts are limited to finding matches within regionStart (inclusive) and
|
1222
|
+
* regionEnd (exclusive).
|
1223
|
+
*
|
1224
|
+
* @return The starting (native) index of this matcher's region.
|
1225
|
+
* @stable ICU 4.6
|
1226
|
+
*/
|
1227
|
+
virtual int64_t regionStart64() const;
|
1228
|
+
|
1229
|
+
|
1230
|
+
/**
|
1231
|
+
* Reports the end (limit) index (exclusive) of this matcher's region. The searches
|
1232
|
+
* this matcher conducts are limited to finding matches within regionStart
|
1233
|
+
* (inclusive) and regionEnd (exclusive).
|
1234
|
+
*
|
1235
|
+
* @return The ending point (native) of this matcher's region.
|
1236
|
+
* @stable ICU 4.0
|
1237
|
+
*/
|
1238
|
+
virtual int32_t regionEnd() const;
|
1239
|
+
|
1240
|
+
/**
|
1241
|
+
* Reports the end (limit) index (exclusive) of this matcher's region. The searches
|
1242
|
+
* this matcher conducts are limited to finding matches within regionStart
|
1243
|
+
* (inclusive) and regionEnd (exclusive).
|
1244
|
+
*
|
1245
|
+
* @return The ending point (native) of this matcher's region.
|
1246
|
+
* @stable ICU 4.6
|
1247
|
+
*/
|
1248
|
+
virtual int64_t regionEnd64() const;
|
1249
|
+
|
1250
|
+
/**
|
1251
|
+
* Queries the transparency of region bounds for this matcher.
|
1252
|
+
* See useTransparentBounds for a description of transparent and opaque bounds.
|
1253
|
+
* By default, a matcher uses opaque region boundaries.
|
1254
|
+
*
|
1255
|
+
* @return TRUE if this matcher is using opaque bounds, false if it is not.
|
1256
|
+
* @stable ICU 4.0
|
1257
|
+
*/
|
1258
|
+
virtual UBool hasTransparentBounds() const;
|
1259
|
+
|
1260
|
+
/**
|
1261
|
+
* Sets the transparency of region bounds for this matcher.
|
1262
|
+
* Invoking this function with an argument of true will set this matcher to use transparent bounds.
|
1263
|
+
* If the boolean argument is false, then opaque bounds will be used.
|
1264
|
+
*
|
1265
|
+
* Using transparent bounds, the boundaries of this matcher's region are transparent
|
1266
|
+
* to lookahead, lookbehind, and boundary matching constructs. Those constructs can
|
1267
|
+
* see text beyond the boundaries of the region while checking for a match.
|
1268
|
+
*
|
1269
|
+
* With opaque bounds, no text outside of the matcher's region is visible to lookahead,
|
1270
|
+
* lookbehind, and boundary matching constructs.
|
1271
|
+
*
|
1272
|
+
* By default, a matcher uses opaque bounds.
|
1273
|
+
*
|
1274
|
+
* @param b TRUE for transparent bounds; FALSE for opaque bounds
|
1275
|
+
* @return This Matcher;
|
1276
|
+
* @stable ICU 4.0
|
1277
|
+
**/
|
1278
|
+
virtual RegexMatcher &useTransparentBounds(UBool b);
|
1279
|
+
|
1280
|
+
|
1281
|
+
/**
|
1282
|
+
* Return true if this matcher is using anchoring bounds.
|
1283
|
+
* By default, matchers use anchoring region bounds.
|
1284
|
+
*
|
1285
|
+
* @return TRUE if this matcher is using anchoring bounds.
|
1286
|
+
* @stable ICU 4.0
|
1287
|
+
*/
|
1288
|
+
virtual UBool hasAnchoringBounds() const;
|
1289
|
+
|
1290
|
+
|
1291
|
+
/**
|
1292
|
+
* Set whether this matcher is using Anchoring Bounds for its region.
|
1293
|
+
* With anchoring bounds, pattern anchors such as ^ and $ will match at the start
|
1294
|
+
* and end of the region. Without Anchoring Bounds, anchors will only match at
|
1295
|
+
* the positions they would in the complete text.
|
1296
|
+
*
|
1297
|
+
* Anchoring Bounds are the default for regions.
|
1298
|
+
*
|
1299
|
+
* @param b TRUE if to enable anchoring bounds; FALSE to disable them.
|
1300
|
+
* @return This Matcher
|
1301
|
+
* @stable ICU 4.0
|
1302
|
+
*/
|
1303
|
+
virtual RegexMatcher &useAnchoringBounds(UBool b);
|
1304
|
+
|
1305
|
+
|
1306
|
+
/**
|
1307
|
+
* Return TRUE if the most recent matching operation attempted to access
|
1308
|
+
* additional input beyond the available input text.
|
1309
|
+
* In this case, additional input text could change the results of the match.
|
1310
|
+
*
|
1311
|
+
* hitEnd() is defined for both successful and unsuccessful matches.
|
1312
|
+
* In either case hitEnd() will return TRUE if if the end of the text was
|
1313
|
+
* reached at any point during the matching process.
|
1314
|
+
*
|
1315
|
+
* @return TRUE if the most recent match hit the end of input
|
1316
|
+
* @stable ICU 4.0
|
1317
|
+
*/
|
1318
|
+
virtual UBool hitEnd() const;
|
1319
|
+
|
1320
|
+
/**
|
1321
|
+
* Return TRUE the most recent match succeeded and additional input could cause
|
1322
|
+
* it to fail. If this method returns false and a match was found, then more input
|
1323
|
+
* might change the match but the match won't be lost. If a match was not found,
|
1324
|
+
* then requireEnd has no meaning.
|
1325
|
+
*
|
1326
|
+
* @return TRUE if more input could cause the most recent match to no longer match.
|
1327
|
+
* @stable ICU 4.0
|
1328
|
+
*/
|
1329
|
+
virtual UBool requireEnd() const;
|
1330
|
+
|
1331
|
+
|
1332
|
+
/**
|
1333
|
+
* Returns the pattern that is interpreted by this matcher.
|
1334
|
+
* @return the RegexPattern for this RegexMatcher
|
1335
|
+
* @stable ICU 2.4
|
1336
|
+
*/
|
1337
|
+
virtual const RegexPattern &pattern() const;
|
1338
|
+
|
1339
|
+
|
1340
|
+
/**
|
1341
|
+
* Replaces every substring of the input that matches the pattern
|
1342
|
+
* with the given replacement string. This is a convenience function that
|
1343
|
+
* provides a complete find-and-replace-all operation.
|
1344
|
+
*
|
1345
|
+
* This method first resets this matcher. It then scans the input string
|
1346
|
+
* looking for matches of the pattern. Input that is not part of any
|
1347
|
+
* match is left unchanged; each match is replaced in the result by the
|
1348
|
+
* replacement string. The replacement string may contain references to
|
1349
|
+
* capture groups.
|
1350
|
+
*
|
1351
|
+
* @param replacement a string containing the replacement text.
|
1352
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
1353
|
+
* @return a string containing the results of the find and replace.
|
1354
|
+
* @stable ICU 2.4
|
1355
|
+
*/
|
1356
|
+
virtual UnicodeString replaceAll(const UnicodeString &replacement, UErrorCode &status);
|
1357
|
+
|
1358
|
+
|
1359
|
+
/**
|
1360
|
+
* Replaces every substring of the input that matches the pattern
|
1361
|
+
* with the given replacement string. This is a convenience function that
|
1362
|
+
* provides a complete find-and-replace-all operation.
|
1363
|
+
*
|
1364
|
+
* This method first resets this matcher. It then scans the input string
|
1365
|
+
* looking for matches of the pattern. Input that is not part of any
|
1366
|
+
* match is left unchanged; each match is replaced in the result by the
|
1367
|
+
* replacement string. The replacement string may contain references to
|
1368
|
+
* capture groups.
|
1369
|
+
*
|
1370
|
+
* @param replacement a string containing the replacement text.
|
1371
|
+
* @param dest a mutable UText in which the results are placed.
|
1372
|
+
* If NULL, a new UText will be created (which may not be mutable).
|
1373
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
1374
|
+
* @return a string containing the results of the find and replace.
|
1375
|
+
* If a pre-allocated UText was provided, it will always be used and returned.
|
1376
|
+
*
|
1377
|
+
* @stable ICU 4.6
|
1378
|
+
*/
|
1379
|
+
virtual UText *replaceAll(UText *replacement, UText *dest, UErrorCode &status);
|
1380
|
+
|
1381
|
+
|
1382
|
+
/**
|
1383
|
+
* Replaces the first substring of the input that matches
|
1384
|
+
* the pattern with the replacement string. This is a convenience
|
1385
|
+
* function that provides a complete find-and-replace operation.
|
1386
|
+
*
|
1387
|
+
* <p>This function first resets this RegexMatcher. It then scans the input string
|
1388
|
+
* looking for a match of the pattern. Input that is not part
|
1389
|
+
* of the match is appended directly to the result string; the match is replaced
|
1390
|
+
* in the result by the replacement string. The replacement string may contain
|
1391
|
+
* references to captured groups.</p>
|
1392
|
+
*
|
1393
|
+
* <p>The state of the matcher (the position at which a subsequent find()
|
1394
|
+
* would begin) after completing a replaceFirst() is not specified. The
|
1395
|
+
* RegexMatcher should be reset before doing additional find() operations.</p>
|
1396
|
+
*
|
1397
|
+
* @param replacement a string containing the replacement text.
|
1398
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
1399
|
+
* @return a string containing the results of the find and replace.
|
1400
|
+
* @stable ICU 2.4
|
1401
|
+
*/
|
1402
|
+
virtual UnicodeString replaceFirst(const UnicodeString &replacement, UErrorCode &status);
|
1403
|
+
|
1404
|
+
|
1405
|
+
/**
|
1406
|
+
* Replaces the first substring of the input that matches
|
1407
|
+
* the pattern with the replacement string. This is a convenience
|
1408
|
+
* function that provides a complete find-and-replace operation.
|
1409
|
+
*
|
1410
|
+
* <p>This function first resets this RegexMatcher. It then scans the input string
|
1411
|
+
* looking for a match of the pattern. Input that is not part
|
1412
|
+
* of the match is appended directly to the result string; the match is replaced
|
1413
|
+
* in the result by the replacement string. The replacement string may contain
|
1414
|
+
* references to captured groups.</p>
|
1415
|
+
*
|
1416
|
+
* <p>The state of the matcher (the position at which a subsequent find()
|
1417
|
+
* would begin) after completing a replaceFirst() is not specified. The
|
1418
|
+
* RegexMatcher should be reset before doing additional find() operations.</p>
|
1419
|
+
*
|
1420
|
+
* @param replacement a string containing the replacement text.
|
1421
|
+
* @param dest a mutable UText in which the results are placed.
|
1422
|
+
* If NULL, a new UText will be created (which may not be mutable).
|
1423
|
+
* @param status a reference to a UErrorCode to receive any errors.
|
1424
|
+
* @return a string containing the results of the find and replace.
|
1425
|
+
* If a pre-allocated UText was provided, it will always be used and returned.
|
1426
|
+
*
|
1427
|
+
* @stable ICU 4.6
|
1428
|
+
*/
|
1429
|
+
virtual UText *replaceFirst(UText *replacement, UText *dest, UErrorCode &status);
|
1430
|
+
|
1431
|
+
|
1432
|
+
/**
|
1433
|
+
* Implements a replace operation intended to be used as part of an
|
1434
|
+
* incremental find-and-replace.
|
1435
|
+
*
|
1436
|
+
* <p>The input string, starting from the end of the previous replacement and ending at
|
1437
|
+
* the start of the current match, is appended to the destination string. Then the
|
1438
|
+
* replacement string is appended to the output string,
|
1439
|
+
* including handling any substitutions of captured text.</p>
|
1440
|
+
*
|
1441
|
+
* <p>For simple, prepackaged, non-incremental find-and-replace
|
1442
|
+
* operations, see replaceFirst() or replaceAll().</p>
|
1443
|
+
*
|
1444
|
+
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
|
1445
|
+
* @param replacement A UnicodeString that provides the text to be substituted for
|
1446
|
+
* the input text that matched the regexp pattern. The replacement
|
1447
|
+
* text may contain references to captured text from the
|
1448
|
+
* input.
|
1449
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
1450
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
1451
|
+
* attempted or the last match failed, and U_INDEX_OUTOFBOUNDS_ERROR
|
1452
|
+
* if the replacement text specifies a capture group that
|
1453
|
+
* does not exist in the pattern.
|
1454
|
+
*
|
1455
|
+
* @return this RegexMatcher
|
1456
|
+
* @stable ICU 2.4
|
1457
|
+
*
|
1458
|
+
*/
|
1459
|
+
virtual RegexMatcher &appendReplacement(UnicodeString &dest,
|
1460
|
+
const UnicodeString &replacement, UErrorCode &status);
|
1461
|
+
|
1462
|
+
|
1463
|
+
/**
|
1464
|
+
* Implements a replace operation intended to be used as part of an
|
1465
|
+
* incremental find-and-replace.
|
1466
|
+
*
|
1467
|
+
* <p>The input string, starting from the end of the previous replacement and ending at
|
1468
|
+
* the start of the current match, is appended to the destination string. Then the
|
1469
|
+
* replacement string is appended to the output string,
|
1470
|
+
* including handling any substitutions of captured text.</p>
|
1471
|
+
*
|
1472
|
+
* <p>For simple, prepackaged, non-incremental find-and-replace
|
1473
|
+
* operations, see replaceFirst() or replaceAll().</p>
|
1474
|
+
*
|
1475
|
+
* @param dest A mutable UText to which the results of the find-and-replace are appended.
|
1476
|
+
* Must not be NULL.
|
1477
|
+
* @param replacement A UText that provides the text to be substituted for
|
1478
|
+
* the input text that matched the regexp pattern. The replacement
|
1479
|
+
* text may contain references to captured text from the input.
|
1480
|
+
* @param status A reference to a UErrorCode to receive any errors. Possible
|
1481
|
+
* errors are U_REGEX_INVALID_STATE if no match has been
|
1482
|
+
* attempted or the last match failed, and U_INDEX_OUTOFBOUNDS_ERROR
|
1483
|
+
* if the replacement text specifies a capture group that
|
1484
|
+
* does not exist in the pattern.
|
1485
|
+
*
|
1486
|
+
* @return this RegexMatcher
|
1487
|
+
*
|
1488
|
+
* @stable ICU 4.6
|
1489
|
+
*/
|
1490
|
+
virtual RegexMatcher &appendReplacement(UText *dest,
|
1491
|
+
UText *replacement, UErrorCode &status);
|
1492
|
+
|
1493
|
+
|
1494
|
+
/**
|
1495
|
+
* As the final step in a find-and-replace operation, append the remainder
|
1496
|
+
* of the input string, starting at the position following the last appendReplacement(),
|
1497
|
+
* to the destination string. <code>appendTail()</code> is intended to be invoked after one
|
1498
|
+
* or more invocations of the <code>RegexMatcher::appendReplacement()</code>.
|
1499
|
+
*
|
1500
|
+
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
|
1501
|
+
* @return the destination string.
|
1502
|
+
* @stable ICU 2.4
|
1503
|
+
*/
|
1504
|
+
virtual UnicodeString &appendTail(UnicodeString &dest);
|
1505
|
+
|
1506
|
+
|
1507
|
+
/**
|
1508
|
+
* As the final step in a find-and-replace operation, append the remainder
|
1509
|
+
* of the input string, starting at the position following the last appendReplacement(),
|
1510
|
+
* to the destination string. <code>appendTail()</code> is intended to be invoked after one
|
1511
|
+
* or more invocations of the <code>RegexMatcher::appendReplacement()</code>.
|
1512
|
+
*
|
1513
|
+
* @param dest A mutable UText to which the results of the find-and-replace are appended.
|
1514
|
+
* Must not be NULL.
|
1515
|
+
* @param status error cod
|
1516
|
+
* @return the destination string.
|
1517
|
+
*
|
1518
|
+
* @stable ICU 4.6
|
1519
|
+
*/
|
1520
|
+
virtual UText *appendTail(UText *dest, UErrorCode &status);
|
1521
|
+
|
1522
|
+
|
1523
|
+
/**
|
1524
|
+
* Split a string into fields. Somewhat like split() from Perl.
|
1525
|
+
* The pattern matches identify delimiters that separate the input
|
1526
|
+
* into fields. The input data between the matches becomes the
|
1527
|
+
* fields themselves.
|
1528
|
+
*
|
1529
|
+
* @param input The string to be split into fields. The field delimiters
|
1530
|
+
* match the pattern (in the "this" object). This matcher
|
1531
|
+
* will be reset to this input string.
|
1532
|
+
* @param dest An array of UnicodeStrings to receive the results of the split.
|
1533
|
+
* This is an array of actual UnicodeString objects, not an
|
1534
|
+
* array of pointers to strings. Local (stack based) arrays can
|
1535
|
+
* work well here.
|
1536
|
+
* @param destCapacity The number of elements in the destination array.
|
1537
|
+
* If the number of fields found is less than destCapacity, the
|
1538
|
+
* extra strings in the destination array are not altered.
|
1539
|
+
* If the number of destination strings is less than the number
|
1540
|
+
* of fields, the trailing part of the input string, including any
|
1541
|
+
* field delimiters, is placed in the last destination string.
|
1542
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1543
|
+
* @return The number of fields into which the input string was split.
|
1544
|
+
* @stable ICU 2.6
|
1545
|
+
*/
|
1546
|
+
virtual int32_t split(const UnicodeString &input,
|
1547
|
+
UnicodeString dest[],
|
1548
|
+
int32_t destCapacity,
|
1549
|
+
UErrorCode &status);
|
1550
|
+
|
1551
|
+
|
1552
|
+
/**
|
1553
|
+
* Split a string into fields. Somewhat like split() from Perl.
|
1554
|
+
* The pattern matches identify delimiters that separate the input
|
1555
|
+
* into fields. The input data between the matches becomes the
|
1556
|
+
* fields themselves.
|
1557
|
+
*
|
1558
|
+
* @param input The string to be split into fields. The field delimiters
|
1559
|
+
* match the pattern (in the "this" object). This matcher
|
1560
|
+
* will be reset to this input string.
|
1561
|
+
* @param dest An array of mutable UText structs to receive the results of the split.
|
1562
|
+
* If a field is NULL, a new UText is allocated to contain the results for
|
1563
|
+
* that field. This new UText is not guaranteed to be mutable.
|
1564
|
+
* @param destCapacity The number of elements in the destination array.
|
1565
|
+
* If the number of fields found is less than destCapacity, the
|
1566
|
+
* extra strings in the destination array are not altered.
|
1567
|
+
* If the number of destination strings is less than the number
|
1568
|
+
* of fields, the trailing part of the input string, including any
|
1569
|
+
* field delimiters, is placed in the last destination string.
|
1570
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1571
|
+
* @return The number of fields into which the input string was split.
|
1572
|
+
*
|
1573
|
+
* @stable ICU 4.6
|
1574
|
+
*/
|
1575
|
+
virtual int32_t split(UText *input,
|
1576
|
+
UText *dest[],
|
1577
|
+
int32_t destCapacity,
|
1578
|
+
UErrorCode &status);
|
1579
|
+
|
1580
|
+
/**
|
1581
|
+
* Set a processing time limit for match operations with this Matcher.
|
1582
|
+
*
|
1583
|
+
* Some patterns, when matching certain strings, can run in exponential time.
|
1584
|
+
* For practical purposes, the match operation may appear to be in an
|
1585
|
+
* infinite loop.
|
1586
|
+
* When a limit is set a match operation will fail with an error if the
|
1587
|
+
* limit is exceeded.
|
1588
|
+
* <p>
|
1589
|
+
* The units of the limit are steps of the match engine.
|
1590
|
+
* Correspondence with actual processor time will depend on the speed
|
1591
|
+
* of the processor and the details of the specific pattern, but will
|
1592
|
+
* typically be on the order of milliseconds.
|
1593
|
+
* <p>
|
1594
|
+
* By default, the matching time is not limited.
|
1595
|
+
* <p>
|
1596
|
+
*
|
1597
|
+
* @param limit The limit value, or 0 for no limit.
|
1598
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1599
|
+
* @stable ICU 4.0
|
1600
|
+
*/
|
1601
|
+
virtual void setTimeLimit(int32_t limit, UErrorCode &status);
|
1602
|
+
|
1603
|
+
/**
|
1604
|
+
* Get the time limit, if any, for match operations made with this Matcher.
|
1605
|
+
*
|
1606
|
+
* @return the maximum allowed time for a match, in units of processing steps.
|
1607
|
+
* @stable ICU 4.0
|
1608
|
+
*/
|
1609
|
+
virtual int32_t getTimeLimit() const;
|
1610
|
+
|
1611
|
+
/**
|
1612
|
+
* Set the amount of heap storage available for use by the match backtracking stack.
|
1613
|
+
* The matcher is also reset, discarding any results from previous matches.
|
1614
|
+
* <p>
|
1615
|
+
* ICU uses a backtracking regular expression engine, with the backtrack stack
|
1616
|
+
* maintained on the heap. This function sets the limit to the amount of memory
|
1617
|
+
* that can be used for this purpose. A backtracking stack overflow will
|
1618
|
+
* result in an error from the match operation that caused it.
|
1619
|
+
* <p>
|
1620
|
+
* A limit is desirable because a malicious or poorly designed pattern can use
|
1621
|
+
* excessive memory, potentially crashing the process. A limit is enabled
|
1622
|
+
* by default.
|
1623
|
+
* <p>
|
1624
|
+
* @param limit The maximum size, in bytes, of the matching backtrack stack.
|
1625
|
+
* A value of zero means no limit.
|
1626
|
+
* The limit must be greater or equal to zero.
|
1627
|
+
*
|
1628
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1629
|
+
*
|
1630
|
+
* @stable ICU 4.0
|
1631
|
+
*/
|
1632
|
+
virtual void setStackLimit(int32_t limit, UErrorCode &status);
|
1633
|
+
|
1634
|
+
/**
|
1635
|
+
* Get the size of the heap storage available for use by the back tracking stack.
|
1636
|
+
*
|
1637
|
+
* @return the maximum backtracking stack size, in bytes, or zero if the
|
1638
|
+
* stack size is unlimited.
|
1639
|
+
* @stable ICU 4.0
|
1640
|
+
*/
|
1641
|
+
virtual int32_t getStackLimit() const;
|
1642
|
+
|
1643
|
+
|
1644
|
+
/**
|
1645
|
+
* Set a callback function for use with this Matcher.
|
1646
|
+
* During matching operations the function will be called periodically,
|
1647
|
+
* giving the application the opportunity to terminate a long-running
|
1648
|
+
* match.
|
1649
|
+
*
|
1650
|
+
* @param callback A pointer to the user-supplied callback function.
|
1651
|
+
* @param context User context pointer. The value supplied at the
|
1652
|
+
* time the callback function is set will be saved
|
1653
|
+
* and passed to the callback each time that it is called.
|
1654
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1655
|
+
* @stable ICU 4.0
|
1656
|
+
*/
|
1657
|
+
virtual void setMatchCallback(URegexMatchCallback *callback,
|
1658
|
+
const void *context,
|
1659
|
+
UErrorCode &status);
|
1660
|
+
|
1661
|
+
|
1662
|
+
/**
|
1663
|
+
* Get the callback function for this URegularExpression.
|
1664
|
+
*
|
1665
|
+
* @param callback Out parameter, receives a pointer to the user-supplied
|
1666
|
+
* callback function.
|
1667
|
+
* @param context Out parameter, receives the user context pointer that
|
1668
|
+
* was set when uregex_setMatchCallback() was called.
|
1669
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1670
|
+
* @stable ICU 4.0
|
1671
|
+
*/
|
1672
|
+
virtual void getMatchCallback(URegexMatchCallback *&callback,
|
1673
|
+
const void *&context,
|
1674
|
+
UErrorCode &status);
|
1675
|
+
|
1676
|
+
|
1677
|
+
/**
|
1678
|
+
* Set a progress callback function for use with find operations on this Matcher.
|
1679
|
+
* During find operations, the callback will be invoked after each return from a
|
1680
|
+
* match attempt, giving the application the opportunity to terminate a long-running
|
1681
|
+
* find operation.
|
1682
|
+
*
|
1683
|
+
* @param callback A pointer to the user-supplied callback function.
|
1684
|
+
* @param context User context pointer. The value supplied at the
|
1685
|
+
* time the callback function is set will be saved
|
1686
|
+
* and passed to the callback each time that it is called.
|
1687
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1688
|
+
* @stable ICU 4.6
|
1689
|
+
*/
|
1690
|
+
virtual void setFindProgressCallback(URegexFindProgressCallback *callback,
|
1691
|
+
const void *context,
|
1692
|
+
UErrorCode &status);
|
1693
|
+
|
1694
|
+
|
1695
|
+
/**
|
1696
|
+
* Get the find progress callback function for this URegularExpression.
|
1697
|
+
*
|
1698
|
+
* @param callback Out parameter, receives a pointer to the user-supplied
|
1699
|
+
* callback function.
|
1700
|
+
* @param context Out parameter, receives the user context pointer that
|
1701
|
+
* was set when uregex_setFindProgressCallback() was called.
|
1702
|
+
* @param status A reference to a UErrorCode to receive any errors.
|
1703
|
+
* @stable ICU 4.6
|
1704
|
+
*/
|
1705
|
+
virtual void getFindProgressCallback(URegexFindProgressCallback *&callback,
|
1706
|
+
const void *&context,
|
1707
|
+
UErrorCode &status);
|
1708
|
+
|
1709
|
+
#ifndef U_HIDE_INTERNAL_API
|
1710
|
+
/**
|
1711
|
+
* setTrace Debug function, enable/disable tracing of the matching engine.
|
1712
|
+
* For internal ICU development use only. DO NO USE!!!!
|
1713
|
+
* @internal
|
1714
|
+
*/
|
1715
|
+
void setTrace(UBool state);
|
1716
|
+
#endif /* U_HIDE_INTERNAL_API */
|
1717
|
+
|
1718
|
+
/**
|
1719
|
+
* ICU "poor man's RTTI", returns a UClassID for this class.
|
1720
|
+
*
|
1721
|
+
* @stable ICU 2.2
|
1722
|
+
*/
|
1723
|
+
static UClassID U_EXPORT2 getStaticClassID();
|
1724
|
+
|
1725
|
+
/**
|
1726
|
+
* ICU "poor man's RTTI", returns a UClassID for the actual class.
|
1727
|
+
*
|
1728
|
+
* @stable ICU 2.2
|
1729
|
+
*/
|
1730
|
+
virtual UClassID getDynamicClassID() const;
|
1731
|
+
|
1732
|
+
private:
|
1733
|
+
// Constructors and other object boilerplate are private.
|
1734
|
+
// Instances of RegexMatcher can not be assigned, copied, cloned, etc.
|
1735
|
+
RegexMatcher(); // default constructor not implemented
|
1736
|
+
RegexMatcher(const RegexPattern *pat);
|
1737
|
+
RegexMatcher(const RegexMatcher &other);
|
1738
|
+
RegexMatcher &operator =(const RegexMatcher &rhs);
|
1739
|
+
void init(UErrorCode &status); // Common initialization
|
1740
|
+
void init2(UText *t, UErrorCode &e); // Common initialization, part 2.
|
1741
|
+
|
1742
|
+
friend class RegexPattern;
|
1743
|
+
friend class RegexCImpl;
|
1744
|
+
public:
|
1745
|
+
#ifndef U_HIDE_INTERNAL_API
|
1746
|
+
/** @internal */
|
1747
|
+
void resetPreserveRegion(); // Reset matcher state, but preserve any region.
|
1748
|
+
#endif /* U_HIDE_INTERNAL_API */
|
1749
|
+
private:
|
1750
|
+
|
1751
|
+
//
|
1752
|
+
// MatchAt This is the internal interface to the match engine itself.
|
1753
|
+
// Match status comes back in matcher member variables.
|
1754
|
+
//
|
1755
|
+
void MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status);
|
1756
|
+
inline void backTrack(int64_t &inputIdx, int32_t &patIdx);
|
1757
|
+
UBool isWordBoundary(int64_t pos); // perform Perl-like \b test
|
1758
|
+
UBool isUWordBoundary(int64_t pos); // perform RBBI based \b test
|
1759
|
+
REStackFrame *resetStack();
|
1760
|
+
inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status);
|
1761
|
+
void IncrementTime(UErrorCode &status);
|
1762
|
+
|
1763
|
+
// Call user find callback function, if set. Return TRUE if operation should be interrupted.
|
1764
|
+
inline UBool findProgressInterrupt(int64_t matchIndex, UErrorCode &status);
|
1765
|
+
|
1766
|
+
int64_t appendGroup(int32_t groupNum, UText *dest, UErrorCode &status) const;
|
1767
|
+
|
1768
|
+
UBool findUsingChunk(UErrorCode &status);
|
1769
|
+
void MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &status);
|
1770
|
+
UBool isChunkWordBoundary(int32_t pos);
|
1771
|
+
|
1772
|
+
const RegexPattern *fPattern;
|
1773
|
+
RegexPattern *fPatternOwned; // Non-NULL if this matcher owns the pattern, and
|
1774
|
+
// should delete it when through.
|
1775
|
+
|
1776
|
+
const UnicodeString *fInput; // The string being matched. Only used for input()
|
1777
|
+
UText *fInputText; // The text being matched. Is never NULL.
|
1778
|
+
UText *fAltInputText; // A shallow copy of the text being matched.
|
1779
|
+
// Only created if the pattern contains backreferences.
|
1780
|
+
int64_t fInputLength; // Full length of the input text.
|
1781
|
+
int32_t fFrameSize; // The size of a frame in the backtrack stack.
|
1782
|
+
|
1783
|
+
int64_t fRegionStart; // Start of the input region, default = 0.
|
1784
|
+
int64_t fRegionLimit; // End of input region, default to input.length.
|
1785
|
+
|
1786
|
+
int64_t fAnchorStart; // Region bounds for anchoring operations (^ or $).
|
1787
|
+
int64_t fAnchorLimit; // See useAnchoringBounds
|
1788
|
+
|
1789
|
+
int64_t fLookStart; // Region bounds for look-ahead/behind and
|
1790
|
+
int64_t fLookLimit; // and other boundary tests. See
|
1791
|
+
// useTransparentBounds
|
1792
|
+
|
1793
|
+
int64_t fActiveStart; // Currently active bounds for matching.
|
1794
|
+
int64_t fActiveLimit; // Usually is the same as region, but
|
1795
|
+
// is changed to fLookStart/Limit when
|
1796
|
+
// entering look around regions.
|
1797
|
+
|
1798
|
+
UBool fTransparentBounds; // True if using transparent bounds.
|
1799
|
+
UBool fAnchoringBounds; // True if using anchoring bounds.
|
1800
|
+
|
1801
|
+
UBool fMatch; // True if the last attempted match was successful.
|
1802
|
+
int64_t fMatchStart; // Position of the start of the most recent match
|
1803
|
+
int64_t fMatchEnd; // First position after the end of the most recent match
|
1804
|
+
// Zero if no previous match, even when a region
|
1805
|
+
// is active.
|
1806
|
+
int64_t fLastMatchEnd; // First position after the end of the previous match,
|
1807
|
+
// or -1 if there was no previous match.
|
1808
|
+
int64_t fAppendPosition; // First position after the end of the previous
|
1809
|
+
// appendReplacement(). As described by the
|
1810
|
+
// JavaDoc for Java Matcher, where it is called
|
1811
|
+
// "append position"
|
1812
|
+
UBool fHitEnd; // True if the last match touched the end of input.
|
1813
|
+
UBool fRequireEnd; // True if the last match required end-of-input
|
1814
|
+
// (matched $ or Z)
|
1815
|
+
|
1816
|
+
UVector64 *fStack;
|
1817
|
+
REStackFrame *fFrame; // After finding a match, the last active stack frame,
|
1818
|
+
// which will contain the capture group results.
|
1819
|
+
// NOT valid while match engine is running.
|
1820
|
+
|
1821
|
+
int64_t *fData; // Data area for use by the compiled pattern.
|
1822
|
+
int64_t fSmallData[8]; // Use this for data if it's enough.
|
1823
|
+
|
1824
|
+
int32_t fTimeLimit; // Max time (in arbitrary steps) to let the
|
1825
|
+
// match engine run. Zero for unlimited.
|
1826
|
+
|
1827
|
+
int32_t fTime; // Match time, accumulates while matching.
|
1828
|
+
int32_t fTickCounter; // Low bits counter for time. Counts down StateSaves.
|
1829
|
+
// Kept separately from fTime to keep as much
|
1830
|
+
// code as possible out of the inline
|
1831
|
+
// StateSave function.
|
1832
|
+
|
1833
|
+
int32_t fStackLimit; // Maximum memory size to use for the backtrack
|
1834
|
+
// stack, in bytes. Zero for unlimited.
|
1835
|
+
|
1836
|
+
URegexMatchCallback *fCallbackFn; // Pointer to match progress callback funct.
|
1837
|
+
// NULL if there is no callback.
|
1838
|
+
const void *fCallbackContext; // User Context ptr for callback function.
|
1839
|
+
|
1840
|
+
URegexFindProgressCallback *fFindProgressCallbackFn; // Pointer to match progress callback funct.
|
1841
|
+
// NULL if there is no callback.
|
1842
|
+
const void *fFindProgressCallbackContext; // User Context ptr for callback function.
|
1843
|
+
|
1844
|
+
|
1845
|
+
UBool fInputUniStrMaybeMutable; // Set when fInputText wraps a UnicodeString that may be mutable - compatibility.
|
1846
|
+
|
1847
|
+
UBool fTraceDebug; // Set true for debug tracing of match engine.
|
1848
|
+
|
1849
|
+
UErrorCode fDeferredStatus; // Save error state that cannot be immediately
|
1850
|
+
// reported, or that permanently disables this matcher.
|
1851
|
+
|
1852
|
+
RuleBasedBreakIterator *fWordBreakItr;
|
1853
|
+
};
|
1854
|
+
|
1855
|
+
U_NAMESPACE_END
|
1856
|
+
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
|
1857
|
+
#endif
|