Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: icu46/source/test/intltest/textfile.h

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « icu46/source/test/intltest/testutil.cpp ('k') | icu46/source/test/intltest/textfile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: icu46/source/test/intltest/textfile.h
===================================================================
--- icu46/source/test/intltest/textfile.h (revision 0)
+++ icu46/source/test/intltest/textfile.h (revision 0)
@@ -0,0 +1,72 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: March 19 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef __ICU_INTLTEST_TEXTFILE__
+#define __ICU_INTLTEST_TEXTFILE__
+
+#include "intltest.h"
+#include "filestrm.h"
+
+/**
+ * This class implements access to a text data file located in the
+ * icu/source/test/testdata/ directory.
+ */
+class TextFile {
+ public:
+ /**
+ * Open a file with the given name, in the given encoding, in the
+ * ICU testdata directory. See textfile.cpp to determine if the
+ * 'name' and 'encoding' parameters are aliased or copied.
+ */
+ TextFile(const char* name, const char* encoding, UErrorCode& ec);
+
+ virtual ~TextFile();
+
+ /**
+ * Read a line terminated by ^J or ^M or ^M^J, and convert it from
+ * this file's encoding to Unicode. The EOL character(s) are not
+ * included in 'line'.
+ * @return TRUE if a line was read, or FALSE if the EOF
+ * was reached or an error occurred
+ */
+ UBool readLine(UnicodeString& line, UErrorCode& ec);
+
+ /**
+ * Read a line, ignoring blank lines and lines that start with
+ * '#'. Trim leading white space.
+ * @param trim if TRUE then remove leading rule white space
+ * @return TRUE if a line was read, or FALSE if the EOF
+ * was reached or an error occurred
+ */
+ UBool readLineSkippingComments(UnicodeString& line, UErrorCode& ec,
+ UBool trim = FALSE);
+
+ /**
+ * Return the line number of the last line returned by readLine().
+ */
+ inline int32_t getLineNumber() const;
+
+ private:
+ UBool ensureCapacity(int32_t capacity);
+ UBool setBuffer(int32_t index, char c, UErrorCode& ec);
+
+ FileStream* file;
+ char* name;
+ char* encoding;
+ char* buffer;
+ int32_t capacity;
+ int32_t lineNo;
+};
+
+inline int32_t TextFile::getLineNumber() const {
+ return lineNo;
+}
+
+#endif
Property changes on: icu46/source/test/intltest/textfile.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « icu46/source/test/intltest/testutil.cpp ('k') | icu46/source/test/intltest/textfile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698