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