annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/common/unicode/symtable.h @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents fee4ef5c87df
children
rev   line source
arajkumar@11038 1 // © 2016 and later: Unicode, Inc. and others.
arajkumar@11038 2 // License & terms of use: http://www.unicode.org/copyright.html
ghb@10550 3 /*
ghb@10550 4 **********************************************************************
ghb@10550 5 * Copyright (c) 2000-2005, International Business Machines
ghb@10550 6 * Corporation and others. All Rights Reserved.
ghb@10550 7 **********************************************************************
ghb@10550 8 * Date Name Description
ghb@10550 9 * 02/04/00 aliu Creation.
ghb@10550 10 **********************************************************************
ghb@10550 11 */
ghb@10550 12 #ifndef SYMTABLE_H
ghb@10550 13 #define SYMTABLE_H
ghb@10550 14
ghb@10550 15 #include "unicode/utypes.h"
ghb@10550 16 #include "unicode/uobject.h"
ghb@10550 17
ghb@10550 18 /**
ghb@10550 19 * \file
ghb@10550 20 * \brief C++ API: An interface that defines both lookup protocol and parsing of
ghb@10550 21 * symbolic names.
ghb@10550 22 */
ghb@10550 23
ghb@10550 24 U_NAMESPACE_BEGIN
ghb@10550 25
ghb@10550 26 class ParsePosition;
ghb@10550 27 class UnicodeFunctor;
ghb@10550 28 class UnicodeSet;
ghb@10550 29 class UnicodeString;
ghb@10550 30
ghb@10550 31 /**
ghb@10550 32 * An interface that defines both lookup protocol and parsing of
ghb@10550 33 * symbolic names.
ghb@10550 34 *
ghb@10550 35 * <p>A symbol table maintains two kinds of mappings. The first is
ghb@10550 36 * between symbolic names and their values. For example, if the
ghb@10550 37 * variable with the name "start" is set to the value "alpha"
ghb@10550 38 * (perhaps, though not necessarily, through an expression such as
ghb@10550 39 * "$start=alpha"), then the call lookup("start") will return the
ghb@10550 40 * char[] array ['a', 'l', 'p', 'h', 'a'].
ghb@10550 41 *
ghb@10550 42 * <p>The second kind of mapping is between character values and
ghb@10550 43 * UnicodeMatcher objects. This is used by RuleBasedTransliterator,
ghb@10550 44 * which uses characters in the private use area to represent objects
ghb@10550 45 * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z],
ghb@10550 46 * then lookupMatcher(0xE015) will return the UnicodeSet [a-z].
ghb@10550 47 *
ghb@10550 48 * <p>Finally, a symbol table defines parsing behavior for symbolic
ghb@10550 49 * names. All symbolic names start with the SYMBOL_REF character.
ghb@10550 50 * When a parser encounters this character, it calls parseReference()
ghb@10550 51 * with the position immediately following the SYMBOL_REF. The symbol
ghb@10550 52 * table parses the name, if there is one, and returns it.
ghb@10550 53 *
ghb@10550 54 * @stable ICU 2.8
ghb@10550 55 */
ghb@10550 56 class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ {
ghb@10550 57 public:
ghb@10550 58
ghb@10550 59 /**
ghb@10550 60 * The character preceding a symbol reference name.
ghb@10550 61 * @stable ICU 2.8
ghb@10550 62 */
ghb@10550 63 enum { SYMBOL_REF = 0x0024 /*$*/ };
ghb@10550 64
ghb@10550 65 /**
ghb@10550 66 * Destructor.
ghb@10550 67 * @stable ICU 2.8
ghb@10550 68 */
ghb@10550 69 virtual ~SymbolTable();
ghb@10550 70
ghb@10550 71 /**
ghb@10550 72 * Lookup the characters associated with this string and return it.
ghb@10550 73 * Return <tt>NULL</tt> if no such name exists. The resultant
ghb@10550 74 * string may have length zero.
ghb@10550 75 * @param s the symbolic name to lookup
ghb@10550 76 * @return a string containing the name's value, or <tt>NULL</tt> if
ghb@10550 77 * there is no mapping for s.
ghb@10550 78 * @stable ICU 2.8
ghb@10550 79 */
ghb@10550 80 virtual const UnicodeString* lookup(const UnicodeString& s) const = 0;
ghb@10550 81
ghb@10550 82 /**
ghb@10550 83 * Lookup the UnicodeMatcher associated with the given character, and
ghb@10550 84 * return it. Return <tt>NULL</tt> if not found.
ghb@10550 85 * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive.
ghb@10550 86 * @return the UnicodeMatcher object represented by the given
ghb@10550 87 * character, or NULL if there is no mapping for ch.
ghb@10550 88 * @stable ICU 2.8
ghb@10550 89 */
ghb@10550 90 virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0;
ghb@10550 91
ghb@10550 92 /**
ghb@10550 93 * Parse a symbol reference name from the given string, starting
ghb@10550 94 * at the given position. If no valid symbol reference name is
ghb@10550 95 * found, return the empty string and leave pos unchanged. That is, if the
ghb@10550 96 * character at pos cannot start a name, or if pos is at or after
ghb@10550 97 * text.length(), then return an empty string. This indicates an
ghb@10550 98 * isolated SYMBOL_REF character.
ghb@10550 99 * @param text the text to parse for the name
ghb@10550 100 * @param pos on entry, the index of the first character to parse.
ghb@10550 101 * This is the character following the SYMBOL_REF character. On
ghb@10550 102 * exit, the index after the last parsed character. If the parse
ghb@10550 103 * failed, pos is unchanged on exit.
ghb@10550 104 * @param limit the index after the last character to be parsed.
ghb@10550 105 * @return the parsed name, or an empty string if there is no
ghb@10550 106 * valid symbolic name at the given position.
ghb@10550 107 * @stable ICU 2.8
ghb@10550 108 */
ghb@10550 109 virtual UnicodeString parseReference(const UnicodeString& text,
ghb@10550 110 ParsePosition& pos, int32_t limit) const = 0;
ghb@10550 111 };
ghb@10550 112 U_NAMESPACE_END
ghb@10550 113
ghb@10550 114 #endif