Re: Proposal: new UnicodeSet constructor, applyPattern

Alan Liu <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <OFE32B29AE.F88DD392-ON88256DBF.007F430B-88256DBF.007F5EE6@us.ibm.com>
Yes, SymbolTable is public.  I forgot to mention that.  No changes; just 
moved the header from common to common/unicode.  Existing (internal) 
SymbolTable subclasses work as before.

Alan Liu
IBM GCoC - San Jose





George Rhoten
10/14/2003 03:32 PM

        To:     Alan Liu/Cupertino/IBM@IBMUS
        cc:     icu list <[email protected]>
        From:   George Rhoten/San Jose/IBM@IBMUS
        Subject:        Re: Proposal: new UnicodeSet constructor, 
applyPattern

Are you planning on making symtable.h a public header now?  SymbolTable 
looks like an interface that could become public.  This exposed API 
doesn't seem to work without SymbolTable.

George Rhoten
IBM Globalization Center of Competency/ICU  San José, CA, USA




Alan Liu/Cupertino/IBM@IBMUS
Sent by: [email protected]
10/14/2003 02:56 PM
 
        To:     icu list <[email protected]>
        cc: 
        Subject:        Proposal: new UnicodeSet constructor, applyPattern


Jitterbug 3262
http://www.jtcsv.com/cgibin/icu-bugs/others?id=3262

Expires: Oct 21 2003

I've added two new API to UnicodeSet:

/**
* Constructs a set from the given pattern.  See the class description
* for the syntax of the pattern language.
* @param pattern a string specifying what characters are in the set
* @param pos on input, the position in pattern at which to start
parsing.
* On output, the position after the last character parsed.
* @param options bitmask for options to apply to the pattern.
* Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
* @param symbols a symbol table mapping variable names to values
* and stand-in characters to UnicodeSets; may be NULL
* @param status input-output error code
* @draft ICU 2.8
*/
UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);

/**
* Parses the given pattern, starting at the given position.  The
* character at pattern.charAt(pos.getIndex()) must be '[', or the
* parse fails.  Parsing continues until the corresponding closing
* ']'.  If a syntax error is encountered between the opening and
* closing brace, the parse fails.  Upon return from a successful
* parse, the ParsePosition is updated to point to the character
* following the closing ']', and a StringBuffer containing a
* pairs list for the parsed pattern is returned.  This method calls
* itself recursively to parse embedded subpatterns.
*
* @param pattern the string containing the pattern to be parsed.
* The portion of the string from pos.getIndex(), which must be a
* '[', to the corresponding closing ']', is parsed.
* @param pos upon entry, the position at which to being parsing.
* The character at pattern.charAt(pos.getIndex()) must be a '['.
* Upon return from a successful parse, pos.getIndex() is either
* the character after the closing ']' of the parsed pattern, or
* pattern.length() if the closing ']' is the last character of
* the pattern string.
* @param options bitmask for options to apply to the pattern.
* Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
* @param symbols a symbol table mapping variable names to
* values and stand-ins to UnicodeSets; may be NULL
* @return a reference to this
* @draft ICU 2.8
*/
UnicodeSet& applyPattern(const UnicodeString& pattern,
ParsePosition& pos,
uint32_t options,
const SymbolTable* symbols,
UErrorCode& status);

These API expose previously "hidden" functionality of UnicodeSet:
1. The ability to parse part of a string (ParsePosition).
2. The ability to specify control options for white space and case
sensitivity (and other options in the future).
3. The ability to pass in a SymbolTable to control variable dereferencing
and stand-in expansion to nested UnicodeSets.

Please send comments to this mailing list.

Alan Liu
IBM GCoC - San Jose
_______________________________________________
icu mailing list
[email protected]
http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.