Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

UResourceBundle Class Reference

Inheritance diagram for UResourceBundle:

ICU List of all members.

Public Types

enum  ResType {
  None = -1, String = 0, Binary = 1, Table = 2,
  Alias = 3, Int = 7, Array = 8, IntVector = 14
}

Public Member Functions

 this (inout ULocale locale, char[] path=null)
 ~this ()
uint getSize ()
int getInt ()
UText getString ()
UText getString (uint index)
UText getString (char[] key)
UText getNextString ()
void[] getBinary ()
int[] getIntVector ()
bool hasNext ()
void resetIterator ()
UResourceBundle getNextResource ()
UResourceBundle getResource (char[] key)
UResourceBundle getResource (uint index)
void getVersion (inout Version info)
void getLocale (inout ULocale locale)
char[] getKey ()
ResType getType ()

Static Public Member Functions

void test ()

Private Types

typedef void * Handle
enum  Error { OK, BufferOverflow = 15 }

Private Member Functions

 this (Handle handle)

Static Private Member Functions

UResourceBundle get (Handle handle, inout Error e)
bool isError (Error e)
void testError (Error e, char[] msg)
char * toString (char[] string)
wchar * toString (wchar[] string)
uint length (char *s)
uint length (wchar *s)
char[] toArray (char *s)
wchar[] toArray (wchar *s)

Private Attributes

Handle handle

Detailed Description

API representing a collection of resource information pertaining to a given locale. A resource bundle provides a way of accessing locale- specific information in a data file. You create a resource bundle that manages the resources for a given locale and then ask it for individual resources.

Resource bundles in ICU4C are currently defined using text files which conform to the following BNF definition. More on resource bundle concepts and syntax can be found in the Users Guide.

See this page for full details.

Definition at line 106 of file UResourceBundle.d.


Member Typedef Documentation

typedef void* Handle [protected, inherited]
 

Use this for the primary argument-type to most ICU functions

Definition at line 109 of file ICU.d.


Member Enumeration Documentation

enum ResType
 

Internals opened up to the public

Enumeration values:
None 
String 
Binary 
Table 
Alias 
Int 
Array 
IntVector 

Definition at line 117 of file UResourceBundle.d.

Referenced by getType().

enum Error [protected, inherited]
 

ICU error codes (the ones which are referenced)

Enumeration values:
OK 
BufferOverflow 

Definition at line 117 of file ICU.d.


Constructor & Destructor Documentation

~this  )  [inline]
 

Definition at line 186 of file UResourceBundle.d.


Member Function Documentation

this Handle  handle  )  [inline, private]
 

private constructor for internal use only

Definition at line 141 of file UResourceBundle.d.

this inout ULocale  locale,
char[]  path = null
[inline]
 

Constructs a resource bundle for the locale-specific bundle in the specified path.

locale This is the locale this resource bundle is for. To get resources for the French locale, for example, you would create a ResourceBundle passing ULocale::FRENCH for the "locale" parameter, and all subsequent calls to that resource bundle will return resources that pertain to the French locale. If the caller passes a Locale.Default parameter, the default locale for the system (as returned by ULocale.getDefault()) will be used. Passing Locale.Root will cause the root-locale to be used.

path This is a full pathname in the platform-specific format for the directory containing the resource data files we want to load resources from. We use locale IDs to generate filenames, and the filenames have this string prepended to them before being passed to the C++ I/O functions. Therefore, this string must always end with a directory delimiter (whatever that is for the target OS) for this class to work correctly. A null value will open the default ICU data-files

Definition at line 174 of file UResourceBundle.d.

References ICU::testError(), and ICU::toString().

uint getSize  )  [inline]
 

Returns the size of a resource. Size for scalar types is always 1, and for vector/table types is the number of child resources.

Definition at line 199 of file UResourceBundle.d.

int getInt  )  [inline]
 

Returns a signed integer from a resource. This integer is originally 28 bit and the sign gets propagated.

Definition at line 211 of file UResourceBundle.d.

References ICU::testError().

UText getString  )  [inline]
 

Returns a string from a string resource type

Definition at line 226 of file UResourceBundle.d.

References ICU::testError().

UText getString uint  index  )  [inline]
 

Returns the string in a given resource at the specified index

Definition at line 243 of file UResourceBundle.d.

References ICU::testError().

UText getString char[]  key  )  [inline]
 

Returns a string in a resource that has a given key. This procedure works only with table resources.

Definition at line 260 of file UResourceBundle.d.

References ICU::testError(), and ICU::toString().

UText getNextString  )  [inline]
 

Returns the next string in a resource or NULL if there are no more resources to iterate over

Definition at line 277 of file UResourceBundle.d.

References ICU::testError().

Referenced by test().

void [] getBinary  )  [inline]
 

Returns a binary data from a resource. Can be used at most primitive resource types (binaries, strings, ints)

Definition at line 295 of file UResourceBundle.d.

References ICU::testError().

int [] getIntVector  )  [inline]
 

Returns an integer vector from a resource

Definition at line 311 of file UResourceBundle.d.

References ICU::testError().

bool hasNext  )  [inline]
 

Checks whether the resource has another element to iterate over

Definition at line 328 of file UResourceBundle.d.

void resetIterator  )  [inline]
 

Resets the internal context of a resource so that iteration starts from the first element

Definition at line 340 of file UResourceBundle.d.

UResourceBundle getNextResource  )  [inline]
 

Returns the next resource in a given resource or NULL if there are no more resources

Definition at line 352 of file UResourceBundle.d.

References get().

Referenced by test().

UResourceBundle getResource char[]  key  )  [inline]
 

Returns a resource that has a given key. This procedure works only with table resources.

Definition at line 366 of file UResourceBundle.d.

References get(), and ICU::toString().

UResourceBundle getResource uint  index  )  [inline]
 

Returns the resource at the specified index

Definition at line 379 of file UResourceBundle.d.

References get().

void getVersion inout Version  info  )  [inline]
 

Return the version number associated with this ResourceBundle as a UVersionInfo array

Definition at line 393 of file UResourceBundle.d.

void getLocale inout ULocale  locale  )  [inline]
 

Return the ULocale associated with this ResourceBundle

Definition at line 404 of file UResourceBundle.d.

References ICU::testError(), and ICU::toArray().

char [] getKey  )  [inline]
 

Returns the key associated with this resource. Not all the resources have a key - only those that are members of a table.

Definition at line 420 of file UResourceBundle.d.

References ICU::toArray().

ResType getType  )  [inline]
 

Returns the type of a resource. Available types are defined in enum UResType

Definition at line 432 of file UResourceBundle.d.

References ResType.

UResourceBundle get Handle  handle,
inout Error  e
[inline, static, private]
 

Worker function for constructing internal ResourceBundle instances. Returns null when the provided handle is null.

Definition at line 444 of file UResourceBundle.d.

References ICU::testError(), and UResourceBundle.

Referenced by getNextResource(), and getResource().

void test  )  [inline, static]
 

Definition at line 539 of file UResourceBundle.d.

References getNextResource(), getNextString(), and UResourceBundle.

bool isError Error  e  )  [inline, static, protected, inherited]
 

Definition at line 127 of file ICU.d.

Referenced by UConverter::detectSignature(), UString::format(), and UConverter::this().

void testError Error  e,
char[]  msg
[inline, static, protected, inherited]
 

Definition at line 145 of file ICU.d.

Referenced by UCalendar::add(), UText::compareFolded(), UConverter::decode(), UConverter::encode(), get(), UCalendar::get(), getBinary(), getInt(), getIntVector(), UCalendar::getLimit(), getLocale(), UCalendar::getMillis(), UConverter::getName(), getNextString(), getString(), UDateFormat::getTwoDigitYearStart(), UCalendar::inDaylightTime(), UDateFormat::parse(), UCalendar::roll(), UCalendar::setDate(), UCalendar::setDateTime(), UCalendar::setMillis(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), UCalendar::setTimeZone(), UDateFormat::setTwoDigitYearStart(), this(), UNumberFormat::this(), UMessageFormat::this(), UDateFormat::this(), and UCalendar::this().

char* toString char[]  string  )  [inline, static, protected, inherited]
 

Definition at line 155 of file ICU.d.

Referenced by UConverter::compareNames(), getResource(), getString(), UCalendar::getTimeZoneName(), UMessageFormat::setLocale(), this(), UMessageFormat::this(), UDateFormat::this(), UText::toLower(), ICU::toString(), and UText::toUpper().

wchar* toString wchar[]  string  )  [inline, static, protected, inherited]
 

Definition at line 175 of file ICU.d.

References ICU::toString().

uint length char *  s  )  [inline, static, protected, inherited]
 

Definition at line 184 of file ICU.d.

References strlen().

uint length wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 193 of file ICU.d.

References wcslen().

char [] toArray char *  s  )  [inline, static, protected, inherited]
 

Definition at line 202 of file ICU.d.

References strlen().

Referenced by UConverter::detectSignature(), getKey(), getLocale(), UMessageFormat::getLocale(), and UConverter::getName().

wchar [] toArray wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 213 of file ICU.d.

References wcslen().


Member Data Documentation

Handle handle [private]
 

Definition at line 108 of file UResourceBundle.d.


The documentation for this class was generated from the following file:
Generated on Sun Nov 7 19:07:13 2004 for Mango by doxygen 1.3.6