home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / common / rbdata.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  2.9 KB  |  96 lines

  1. /*
  2. *******************************************************************************
  3. *                                                                             *
  4. * COPYRIGHT:                                                                  *
  5. *   (C) Copyright International Business Machines Corporation, 1998, 1999     *
  6. *   Licensed Material - Program-Property of IBM - All Rights Reserved.        *
  7. *   US Government Users Restricted Rights - Use, duplication, or disclosure   *
  8. *   restricted by GSA ADP Schedule Contract with IBM Corp.                    *
  9. *                                                                             *
  10. *******************************************************************************
  11. *
  12. * File rbdata.h
  13. *
  14. * Modification History:
  15. *
  16. *   Date        Name        Description
  17. *   06/11/99    stephen     Creation. (Moved here from resbund.cpp)
  18. *******************************************************************************
  19. */
  20.  
  21. #ifndef RBDATA_H
  22. #define RBDATA_H 1
  23.  
  24. #include "utypes.h"
  25. #include "uhash.h"
  26. #include "unistr.h"
  27.  
  28. /**
  29.  * Abstract base class for data stored in resource bundles.  These
  30.  * objects are kept in hashtables, indexed by strings.  We never need
  31.  * to copy or clone these objects, since they are created once and
  32.  * never deleted.  
  33.  */
  34. class ResourceBundleData
  35. {
  36. public:
  37.   virtual ~ResourceBundleData() {}
  38.   virtual UClassID getDynamicClassID(void) const = 0;
  39. };
  40.  
  41. /** Concrete data class representing a list of strings.  */
  42. class StringList : public ResourceBundleData
  43. {
  44. public:
  45.   StringList();
  46.   StringList(UnicodeString* adopted, int32_t count);
  47.   virtual ~StringList();
  48.   const UnicodeString& operator[](int32_t i) const;
  49.   virtual UClassID getDynamicClassID(void) const;
  50.   static UClassID getStaticClassID(void);
  51.  
  52.   static UClassID  fgClassID;
  53.   int32_t         fCount;
  54.   UnicodeString   *fStrings;
  55. };
  56.  
  57. /** Concrete data class representing a 2-dimensional list of strings. */
  58. class String2dList : public ResourceBundleData
  59. {
  60. public:
  61.   String2dList();
  62.   String2dList(UnicodeString** adopted, int32_t rowCount, int32_t colCount);
  63.   virtual ~String2dList();
  64.   const UnicodeString& getString(int32_t rowIndex, int32_t colIndex);
  65.   virtual UClassID getDynamicClassID(void) const;
  66.   static UClassID getStaticClassID(void);
  67.  
  68.   static UClassID  fgClassID;
  69.   int32_t         fRowCount;
  70.   int32_t         fColCount;
  71.   UnicodeString   **fStrings;
  72. };
  73.  
  74. /**
  75.  * Concrete data class representing a tagged list of strings.  This is
  76.  * implemented using a hash table.  
  77.  */
  78. class TaggedList : public ResourceBundleData
  79. {
  80. public:
  81.   TaggedList();
  82.   virtual ~TaggedList();
  83.   void put(const UnicodeString& tag, const UnicodeString& data);
  84.   const UnicodeString* get(const UnicodeString& tag) const;
  85.   virtual UClassID getDynamicClassID(void) const;
  86.   static UClassID getStaticClassID(void);
  87.  
  88.   static void deleteValue(void* value);
  89.  
  90.   static UClassID  fgClassID;
  91.   UHashtable      *fHashtableValues;
  92.   UHashtable      *fHashtableKeys;
  93. };
  94.  
  95. #endif
  96.