]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tokiter.h
2 **********************************************************************
3 * Copyright (c) 2004-2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: March 22 2004
9 **********************************************************************
11 #ifndef __ICU_INTLTEST_TOKITER__
12 #define __ICU_INTLTEST_TOKITER__
19 * An iterator class that returns successive string tokens from some
20 * source. String tokens are, in general, separated by Pattern_White_Space
21 * in the source test. Furthermore, they may be delimited by
22 * either single or double quotes (opening and closing quotes must
23 * match). Escapes are processed using standard ICU unescaping.
29 * Construct an iterator over the tokens returned by the given
30 * TextFile, ignoring blank lines and comment lines (first
31 * non-blank character is '#'). Note that trailing comments on a
32 * line, beginning with the first unquoted '#', are recognized.
34 TokenIterator(TextFile
* r
);
36 virtual ~TokenIterator();
39 * Return the next token from this iterator.
40 * @return TRUE if a token was read, or FALSE if no more tokens
41 * are available or an error occurred.
43 UBool
next(UnicodeString
& token
, UErrorCode
& ec
);
46 * Return the one-based line number of the line of the last token
47 * returned by next(). Should only be called after a call to
48 * next(); otherwise the return value is undefined.
50 int32_t getLineNumber() const;
53 * Return a string description of the position of the last line
54 * returned by readLine() or readLineSkippingComments().
56 //public String describePosition() {
57 // return reader.describePosition() + ':' + (lastpos+1);
61 UBool
nextToken(UnicodeString
& token
, UErrorCode
& ec
);
63 TextFile
* reader
; // alias