]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/symtable.h
2 **********************************************************************
3 * Copyright (c) 2000, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 02/04/00 aliu Creation.
8 **********************************************************************
13 #include "unicode/utypes.h"
14 #include "unicode/uobject.h"
24 * An interface that maps strings to objects. This interface defines
25 * both lookup protocol and parsing. This allows different components
26 * to share a symbol table and to handle name parsing uniformly. It
27 * is expected that client parse code look for the SYMBOL_REF
28 * character and, when seen, attempt to parse the characters after it
29 * using parseReference().
31 * <p>Currently, RuleBasedTransliterator and UnicodeSet use this
32 * interface to share variable definitions.
34 class SymbolTable
/* not : public UObject because this is an interface/mixin class */ {
38 * The character preceding a symbol reference name.
40 enum { SYMBOL_REF
= 0x0024 /*$*/ };
45 virtual inline ~SymbolTable() {};
48 * Lookup the characters associated with this string and return it.
49 * Return <tt>NULL</tt> if no such name exists. The resultant
50 * string may have length zero.
52 virtual const UnicodeString
* lookup(const UnicodeString
& s
) const = 0;
55 * Lookup the UnicodeMatcher associated with the given character, and
56 * return it. Return <tt>null</tt> if not found.
58 virtual const UnicodeFunctor
* lookupMatcher(UChar32 ch
) const = 0;
61 * Parse a symbol reference name from the given string, starting
62 * at the given position. If no valid symbol reference name is
63 * found, return an empty string.
64 * @param text the text to parse for the name
65 * @param pos on entry, the index of the first character to parse.
66 * This is the character following the SYMBOL_REF character. On
67 * exit, the index after the last parsed character.
68 * @param limit the index after the last character to be parsed.
69 * @return the parsed name or an empty string.
71 virtual UnicodeString
parseReference(const UnicodeString
& text
,
72 ParsePosition
& pos
, int32_t limit
) const = 0;