2 **********************************************************************
3 * Copyright (c) 2004-2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: March 19 2004
9 **********************************************************************
11 #ifndef __ICU_INTLTEST_TEXTFILE__
12 #define __ICU_INTLTEST_TEXTFILE__
18 * This class implements access to a text data file located in the
19 * icu/source/test/testdata/ directory.
24 * Open a file with the given name, in the given encoding, in the
25 * ICU testdata directory. See textfile.cpp to determine if the
26 * 'name' and 'encoding' parameters are aliased or copied.
28 TextFile(const char* name, const char* encoding, UErrorCode& ec);
33 * Read a line terminated by ^J or ^M or ^M^J, and convert it from
34 * this file's encoding to Unicode. The EOL character(s) are not
36 * @return TRUE if a line was read, or FALSE if the EOF
37 * was reached or an error occurred
39 UBool readLine(UnicodeString& line, UErrorCode& ec);
42 * Read a line, ignoring blank lines and lines that start with
43 * '#'. Trim leading white space.
44 * @param trim if TRUE then remove leading Pattern_White_Space
45 * @return TRUE if a line was read, or FALSE if the EOF
46 * was reached or an error occurred
48 UBool readLineSkippingComments(UnicodeString& line, UErrorCode& ec,
52 * Return the line number of the last line returned by readLine().
54 inline int32_t getLineNumber() const;
57 UBool ensureCapacity(int32_t capacity);
58 UBool setBuffer(int32_t index, char c, UErrorCode& ec);
68 inline int32_t TextFile::getLineNumber() const {