1999-08-16 21:50:52 +00:00
|
|
|
/*
|
1999-12-09 23:27:55 +00:00
|
|
|
**********************************************************************
|
|
|
|
* Copyright (C) 1998-1999, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
1999-08-16 21:50:52 +00:00
|
|
|
*
|
|
|
|
* File rbdata.cpp
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 06/11/99 stephen Creation. (Moved here from resbund.cpp)
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "rbdata.h"
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID StringList::fgClassID = 0; // Value is irrelevant
|
|
|
|
UClassID String2dList::fgClassID = 0; // Value is irrelevant
|
|
|
|
UClassID TaggedList::fgClassID = 0; // Value is irrelevant
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
StringList::StringList()
|
2000-08-14 23:23:20 +00:00
|
|
|
: fCount(0), fStrings(0)
|
1999-08-16 21:50:52 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
StringList::StringList(UnicodeString *adopted,
|
2000-08-14 23:23:20 +00:00
|
|
|
int32_t count)
|
|
|
|
: fCount(count), fStrings(adopted)
|
1999-08-16 21:50:52 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
StringList::~StringList()
|
|
|
|
{ delete [] fStrings; }
|
|
|
|
|
|
|
|
const UnicodeString&
|
|
|
|
StringList::operator[](int32_t i) const
|
|
|
|
{ return fStrings[i]; }
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
StringList::getDynamicClassID() const
|
|
|
|
{ return getStaticClassID(); }
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
StringList::getStaticClassID()
|
1999-10-18 22:48:32 +00:00
|
|
|
{ return (UClassID)&fgClassID; }
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String2dList::String2dList()
|
|
|
|
: fStrings(0), fRowCount(0), fColCount(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
String2dList::String2dList(UnicodeString **adopted,
|
2000-08-14 23:23:20 +00:00
|
|
|
int32_t rowCount,
|
|
|
|
int32_t colCount)
|
1999-08-16 21:50:52 +00:00
|
|
|
: fStrings(adopted), fRowCount(rowCount), fColCount(colCount)
|
|
|
|
{}
|
|
|
|
|
|
|
|
String2dList::~String2dList()
|
|
|
|
{
|
|
|
|
for(int32_t i = 0; i < fRowCount; ++i) {
|
|
|
|
delete[] fStrings[i];
|
|
|
|
}
|
2000-06-26 22:46:15 +00:00
|
|
|
delete[] fStrings;
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const UnicodeString&
|
|
|
|
String2dList::getString(int32_t rowIndex,
|
2000-08-14 23:23:20 +00:00
|
|
|
int32_t colIndex)
|
1999-08-16 21:50:52 +00:00
|
|
|
{ return fStrings[rowIndex][colIndex]; }
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
String2dList::getDynamicClassID() const
|
|
|
|
{ return getStaticClassID(); }
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
String2dList::getStaticClassID()
|
1999-10-18 22:48:32 +00:00
|
|
|
{ return (UClassID)&fgClassID; }
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-03-29 19:17:17 +00:00
|
|
|
TaggedList::TaggedList() {
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
hash = new Hashtable(status);
|
|
|
|
hash->setValueDeleter(uhash_deleteUnicodeString);
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
2000-03-29 19:17:17 +00:00
|
|
|
TaggedList::~TaggedList() {
|
|
|
|
delete hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t TaggedList::count() const {
|
|
|
|
return hash->count();
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TaggedList::put(const UnicodeString& tag,
|
2000-08-14 23:23:20 +00:00
|
|
|
const UnicodeString& data) {
|
2000-03-29 19:17:17 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
hash->put(tag, new UnicodeString(data), status);
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const UnicodeString*
|
2000-03-29 19:17:17 +00:00
|
|
|
TaggedList::get(const UnicodeString& tag) const {
|
|
|
|
return (const UnicodeString*) hash->get(tag);
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
UBool TaggedList::nextElement(const UnicodeString*& key,
|
2000-03-29 19:17:17 +00:00
|
|
|
const UnicodeString*& value,
|
|
|
|
int32_t& pos) const {
|
2000-03-30 04:17:27 +00:00
|
|
|
const UHashElement *e = hash->nextElement(pos);
|
|
|
|
if (e != NULL) {
|
|
|
|
key = (const UnicodeString*) e->key;
|
|
|
|
value = (const UnicodeString*) e->value;
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
1999-08-16 21:50:52 +00:00
|
|
|
}
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
TaggedList::getDynamicClassID() const
|
|
|
|
{ return getStaticClassID(); }
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
UClassID
|
1999-08-16 21:50:52 +00:00
|
|
|
TaggedList::getStaticClassID()
|
1999-10-18 22:48:32 +00:00
|
|
|
{ return (UClassID)&fgClassID; }
|