Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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

static this ()
static ~this ()
static void test ()

Static Public Attributes

static FunctionLoader Bind[] targets

Private Types

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

Private Member Functions

 this (Handle handle)

Static Private Member Functions

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

Private Attributes

Handle handle

Static Private Attributes

static void * library

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 109 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 112 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 120 of file UResourceBundle.d.

enum Error [protected, inherited]
 

ICU error codes (the ones which are referenced)

Enumeration values:
OK 
BufferOverflow 

Definition at line 146 of file ICU.d.


Constructor & Destructor Documentation

~this  )  [inline]
 

Definition at line 183 of file UResourceBundle.d.

References handle.

static ~this  )  [inline, static]
 

Definition at line 527 of file UResourceBundle.d.

References library.


Member Function Documentation

this Handle  handle  )  [inline, private]
 

private constructor for internal use only

Definition at line 138 of file UResourceBundle.d.

References handle.

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 171 of file UResourceBundle.d.

References handle, 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 196 of file UResourceBundle.d.

References handle.

int getInt  )  [inline]
 

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

Definition at line 208 of file UResourceBundle.d.

References handle, and ICU::testError().

UText getString  )  [inline]
 

Returns a string from a string resource type

Definition at line 223 of file UResourceBundle.d.

References handle, and ICU::testError().

UText getString uint  index  )  [inline]
 

Returns the string in a given resource at the specified index

Definition at line 240 of file UResourceBundle.d.

References handle, and 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 257 of file UResourceBundle.d.

References handle, 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 274 of file UResourceBundle.d.

References handle, and 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 292 of file UResourceBundle.d.

References handle, and ICU::testError().

int [] getIntVector  )  [inline]
 

Returns an integer vector from a resource

Definition at line 308 of file UResourceBundle.d.

References handle, and ICU::testError().

bool hasNext  )  [inline]
 

Checks whether the resource has another element to iterate over

Definition at line 325 of file UResourceBundle.d.

References handle.

void resetIterator  )  [inline]
 

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

Definition at line 337 of file UResourceBundle.d.

References handle.

UResourceBundle getNextResource  )  [inline]
 

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

Definition at line 349 of file UResourceBundle.d.

References get(), and handle.

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 363 of file UResourceBundle.d.

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

UResourceBundle getResource uint  index  )  [inline]
 

Returns the resource at the specified index

Definition at line 376 of file UResourceBundle.d.

References get(), and handle.

void getVersion inout Version  info  )  [inline]
 

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

Definition at line 390 of file UResourceBundle.d.

References handle.

void getLocale inout ULocale  locale  )  [inline]
 

Return the ULocale associated with this ResourceBundle

Definition at line 401 of file UResourceBundle.d.

References handle, 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 417 of file UResourceBundle.d.

References handle, and ICU::toArray().

ResType getType  )  [inline]
 

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

Definition at line 429 of file UResourceBundle.d.

References handle.

static 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 441 of file UResourceBundle.d.

References ICU::testError(), and UResourceBundle.

Referenced by getNextResource(), and getResource().

static this  )  [inline, static]
 

Definition at line 517 of file UResourceBundle.d.

References library, and targets.

static void test  )  [inline, static]
 

Definition at line 536 of file UResourceBundle.d.

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

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

Definition at line 156 of file ICU.d.

Referenced by UCollator::getLocale().

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

Definition at line 174 of file ICU.d.

Referenced by UCalendar::add(), USet::applyPattern(), UChar::charFromName(), UNormalize::check(), URegex::clone(), UNormalize::compare(), UDomainName::compare(), UText::compareFolded(), UConverter::UTranscoder::convert(), UEnumeration::count(), UConverter::decode(), UConverter::encode(), URegex::end(), UTransform::execute(), USearch::first(), get(), UCalendar::get(), UCollator::getAttribute(), getBinary(), UCollator::getBound(), UChar::getCharName(), UChar::getComment(), UCollator::getContractions(), URegex::getFlags(), getInt(), getIntVector(), UCalendar::getLimit(), getLocale(), UCalendar::getMillis(), UConverter::getName(), getNextString(), URegex::getPattern(), UCollator::getShortDefinitionString(), getString(), UCollator::getTailoredSet(), UDateFormat::getTwoDigitYearStart(), UCollator::getVariableTop(), URegex::groupCount(), UCalendar::inDaylightTime(), UNormalize::isNormalized(), USearch::last(), URegex::match(), USearch::next(), URegex::next(), UEnumeration::next(), UCollator::normalizeShortDefinitionString(), UDateFormat::parse(), USearch::previous(), URegex::probe(), URegex::replaceAll(), URegex::replaceFirst(), URegex::reset(), UEnumeration::reset(), UCalendar::roll(), UCollator::setAttribute(), USearch::setCollator(), UCalendar::setDate(), UCalendar::setDateTime(), UTransform::setFilter(), USearch::setIterator(), UCalendar::setMillis(), USearch::setOffset(), USearch::setPattern(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), USearch::setText(), URegex::setText(), UBreakIterator::setText(), UCalendar::setTimeZone(), UDateFormat::setTwoDigitYearStart(), UCollator::setVariableTop(), URegex::split(), URegex::start(), UTransform::this(), UStringPrep::this(), USet::this(), USearch::this(), this(), URegex::this(), UNumberFormat::this(), UMessageFormat::this(), UDateFormat::this(), UCollator::this(), UCalendar::this(), UBreakIterator::this(), URuleIterator::this(), and UText::toUtf8().

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

Definition at line 184 of file ICU.d.

Referenced by UChar::charFromName(), UConverter::compareNames(), UCollator::getDisplayName(), getResource(), UCollator::getShortDefinitionString(), getString(), UCalendar::getTimeZoneName(), UCollator::normalizeShortDefinitionString(), UMessageFormat::setLocale(), UStringPrep::this(), this(), UDateFormat::this(), UCollator::this(), UBreakIterator::this(), UText::toLower(), and UText::toUpper().

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

Definition at line 206 of file ICU.d.

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

Definition at line 228 of file ICU.d.

References strlen().

Referenced by UConverter::UTranscoder::convert().

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

Definition at line 237 of file ICU.d.

References wcslen().

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

Definition at line 246 of file ICU.d.

References strlen().

Referenced by UConverter::detectSignature(), getKey(), getLocale(), UMessageFormat::getLocale(), UCollator::getLocale(), UConverter::getName(), UChar::getPropertyName(), UChar::getPropertyValueName(), and UConverter::opApply().

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

Definition at line 257 of file ICU.d.

References wcslen().


Member Data Documentation

Handle handle [private]
 

Definition at line 111 of file UResourceBundle.d.

Referenced by getBinary(), getInt(), getIntVector(), getKey(), getLocale(), getNextResource(), getNextString(), getResource(), getSize(), getString(), getType(), getVersion(), hasNext(), resetIterator(), this(), and ~this().

void* library [static, private]
 

Bind the ICU functions from a shared library. This is complicated by the issues regarding D and DLLs on the Windows platform

Definition at line 458 of file UResourceBundle.d.

Referenced by this(), and ~this().

FunctionLoader Bind [] targets [static]
 

Initial value:

 
                [
                {cast(void**) &ures_open,               "ures_open"}

Definition at line 491 of file UResourceBundle.d.

Referenced by this().


The documentation for this class was generated from the following file:
Generated on Fri May 27 18:12:05 2005 for Mango by  doxygen 1.4.0