Logo Search packages:      
Sourcecode: icu version File versions  Download package

NumberingSystem *U_EXPORT2 NumberingSystem::createInstanceByName ( const char *  name,
UErrorCode status 
) [static]

Create a numbering system from one of the predefined numbering systems known to ICU.

Parameters:
name The name of the numbering system.
status ICU status ICU 4.2

Definition at line 128 of file numsys.cpp.

References createInstance(), isAlgorithmic(), NULL, UnicodeString::setTo(), U_FAILURE, and U_UNSUPPORTED_ERROR.

Referenced by createInstance().

                                                                          {
    
     UResourceBundle *numberingSystemsInfo = NULL;
     UResourceBundle *nsTop, *nsCurrent;
     const UChar* description = NULL;
     int32_t radix = 10;
     int32_t algorithmic = 0;
     int32_t len;

     numberingSystemsInfo = ures_openDirect(NULL,gNumberingSystems, &status);
     nsCurrent = ures_getByKey(numberingSystemsInfo,gNumberingSystems,NULL,&status);
     nsTop = ures_getByKey(nsCurrent,name,NULL,&status);
     description = ures_getStringByKey(nsTop,gDesc,&len,&status);

       ures_getByKey(nsTop,gRadix,nsCurrent,&status);
     radix = ures_getInt(nsCurrent,&status);

     ures_getByKey(nsTop,gAlgorithmic,nsCurrent,&status);
     algorithmic = ures_getInt(nsCurrent,&status);

     UBool isAlgorithmic = ( algorithmic == 1 );
     UnicodeString nsd;
     nsd.setTo(description);

       ures_close(nsCurrent);
       ures_close(nsTop);
     ures_close(numberingSystemsInfo);

     if (U_FAILURE(status)) {
         status = U_UNSUPPORTED_ERROR;
         return NULL;
     }

     return NumberingSystem::createInstance(radix,isAlgorithmic,nsd,status);

}


Generated by  Doxygen 1.6.0   Back to index