summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/tools/ctestfw/unicode/datamap.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /intl/icu/source/tools/ctestfw/unicode/datamap.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/icu/source/tools/ctestfw/unicode/datamap.h')
-rw-r--r--intl/icu/source/tools/ctestfw/unicode/datamap.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/intl/icu/source/tools/ctestfw/unicode/datamap.h b/intl/icu/source/tools/ctestfw/unicode/datamap.h
new file mode 100644
index 000000000..ccc99484e
--- /dev/null
+++ b/intl/icu/source/tools/ctestfw/unicode/datamap.h
@@ -0,0 +1,140 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 2002-2006, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+/* Created by weiv 05/09/2002 */
+
+#ifndef U_TESTFW_DATAMAP
+#define U_TESTFW_DATAMAP
+
+#include "unicode/resbund.h"
+#include "unicode/testtype.h"
+
+
+
+U_NAMESPACE_BEGIN
+class Hashtable;
+U_NAMESPACE_END
+
+/** Holder of test data and settings. Allows addressing of items by name.
+ * For test cases, names are defined in the "Headers" section. For settings
+ * and info data, names are keys in data. Currently, we return scalar strings
+ * and integers and arrays of strings and integers. Arrays should be deposited
+ * of by the user.
+ */
+class T_CTEST_EXPORT_API DataMap {
+public:
+ virtual ~DataMap();
+
+protected:
+ DataMap();
+ int32_t utoi(const UnicodeString &s) const;
+
+
+public:
+ /** get the string from the DataMap. Addressed by name
+ * @param key name of the data field.
+ * @return a string containing the data
+ */
+ virtual const UnicodeString getString(const char* key, UErrorCode &status) const = 0;
+
+ /** get the string from the DataMap. Addressed by name
+ * parses a bundle string into an integer
+ * @param key name of the data field.
+ * @return an integer containing the data
+ */
+ virtual int32_t getInt(const char* key, UErrorCode &status) const = 0;
+
+ /**
+ * Get a signed integer without runtime parsing.
+ * @param key name of the data field.
+ * @param status UErrorCode in/out parameter
+ * @return the integer
+ */
+ virtual int32_t getInt28(const char* key, UErrorCode &status) const = 0;
+
+ /**
+ * Get an unsigned integer without runtime parsing.
+ * @param key name of the data field.
+ * @param status UErrorCode in/out parameter
+ * @return the integer
+ */
+ virtual uint32_t getUInt28(const char* key, UErrorCode &status) const = 0;
+
+ /**
+ * Get a vector of integers without runtime parsing.
+ * @param length output parameter for the length of the vector
+ * @param key name of the data field.
+ * @param status UErrorCode in/out parameter
+ * @return the integer vector, do not delete
+ */
+ virtual const int32_t *getIntVector(int32_t &length, const char *key, UErrorCode &status) const = 0;
+
+ /**
+ * Get binary data without runtime parsing.
+ * @param length output parameter for the length of the data
+ * @param key name of the data field.
+ * @param status UErrorCode in/out parameter
+ * @return the binary data, do not delete
+ */
+ virtual const uint8_t *getBinary(int32_t &length, const char *key, UErrorCode &status) const = 0;
+
+ /** get an array of strings from the DataMap. Addressed by name.
+ * The user must dispose of it after usage, using delete.
+ * @param key name of the data field.
+ * @return a string array containing the data
+ */
+ virtual const UnicodeString* getStringArray(int32_t& count, const char* key, UErrorCode &status) const = 0;
+
+ /** get an array of integers from the DataMap. Addressed by name.
+ * The user must dispose of it after usage, using delete.
+ * @param key name of the data field.
+ * @return an integer array containing the data
+ */
+ virtual const int32_t* getIntArray(int32_t& count, const char* key, UErrorCode &status) const = 0;
+
+ // ... etc ...
+};
+
+// This one is already concrete - it is going to be instantiated from
+// concrete data by TestData children...
+class T_CTEST_EXPORT_API RBDataMap : public DataMap{
+private:
+ Hashtable *fData;
+
+public:
+ virtual ~RBDataMap();
+
+public:
+ RBDataMap();
+
+ RBDataMap(UResourceBundle *data, UErrorCode &status);
+ RBDataMap(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status);
+
+public:
+ void init(UResourceBundle *data, UErrorCode &status);
+ void init(UResourceBundle *headers, UResourceBundle *data, UErrorCode &status);
+
+ virtual const ResourceBundle *getItem(const char* key, UErrorCode &status) const;
+
+ virtual const UnicodeString getString(const char* key, UErrorCode &status) const;
+ virtual int32_t getInt28(const char* key, UErrorCode &status) const;
+ virtual uint32_t getUInt28(const char* key, UErrorCode &status) const;
+ virtual const int32_t *getIntVector(int32_t &length, const char *key, UErrorCode &status) const;
+ virtual const uint8_t *getBinary(int32_t &length, const char *key, UErrorCode &status) const;
+
+ virtual int32_t getInt(const char* key, UErrorCode &status) const;
+
+ virtual const UnicodeString* getStringArray(int32_t& count, const char* key, UErrorCode &status) const;
+ virtual const int32_t* getIntArray(int32_t& count, const char* key, UErrorCode &status) const;
+
+ // ... etc ...
+};
+
+
+#endif
+