peiyongz    2002/10/10 14:07:56

  Modified:    c/src/xercesc/util/MsgLoaders/ICU ICUMsgLoader.hpp
                        ICUMsgLoader.cpp
  Log:
  load resource files using environement vars and base name
  
  Revision  Changes    Path
  1.3       +10 -4     xml-xerces/c/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp
  
  Index: ICUMsgLoader.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ICUMsgLoader.hpp  30 Sep 2002 22:20:40 -0000      1.2
  +++ ICUMsgLoader.hpp  10 Oct 2002 21:07:55 -0000      1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2002/10/10 21:07:55  peiyongz
  + * load resource files using environement vars and base name
  + *
    * Revision 1.2  2002/09/30 22:20:40  peiyongz
    * Build with ICU MsgLoader
    *
  @@ -156,14 +159,17 @@
       // -----------------------------------------------------------------------
       //  Private data members
       //
  -    //  fRootBundle
  -    //      bundle to the 'root' of the specified locale_country
  +    //  fLocaleBundle
  +    //      pointer to the required locale specific resource bundle,
  +     //           or to the default locale resrouce bundle in case the required
  +     //              locale specific resource bundle unavailable.
       //
       //  fDomainBundle
  -    //      bundle to the resource for the corresponding domain 
  +    //      pointer to the domain specific resource bundle with in the 
  +     //              required locale specific (or default locale) resource bundle.
       //
       // -----------------------------------------------------------------------
  -    UResourceBundle*      fRootBundle;
  +    UResourceBundle*      fLocaleBundle;
       UResourceBundle*      fDomainBundle;
   };
   
  
  
  
  1.4       +22 -16    xml-xerces/c/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp
  
  Index: ICUMsgLoader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ICUMsgLoader.cpp  2 Oct 2002 17:08:50 -0000       1.3
  +++ ICUMsgLoader.cpp  10 Oct 2002 21:07:55 -0000      1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2002/10/10 21:07:55  peiyongz
  + * load resource files using environement vars and base name
  + *
    * Revision 1.3  2002/10/02 17:08:50  peiyongz
    * XMLString::equals() to replace XMLString::compareString()
    *
  @@ -120,7 +123,7 @@
   //  Public Constructors and Destructor
   // ---------------------------------------------------------------------------
   ICUMsgLoader::ICUMsgLoader(const XMLCh* const  msgDomain) 
  -:fRootBundle(0)
  +:fLocaleBundle(0)
   ,fDomainBundle(0)
   {
       // validation on msgDomain
  @@ -131,28 +134,31 @@
           XMLPlatformUtils::panic(XMLPlatformUtils::Panic_UnknownMsgDomain);
       }
   
  -    //
  -    // we hardcode the path for "root.res" for now
  -    // assuming that Makefile would copy root.res from $ICUROOT/bin to 
$XERCESCROOT/bin
  -    //
       char tempBuf[1024];
  -    strcpy(tempBuf, getenv("XERCESCROOT"));
  -    strcat(tempBuf, "/bin/root.res");
  -   
  +    memset(tempBuf, 0, sizeof tempBuf);
  +     char *location  = getenv("XERCESC_RESBUND_PKG_PATH");
  +
  +    if (location)
  +             strcpy(tempBuf, location);
  +  
  +    strcat(tempBuf, U_FILE_SEP_STRING);
  +    strcat(tempBuf, "XercescErrMsg");
  +
       UErrorCode err = U_ZERO_ERROR;
  -    fRootBundle = ures_open(tempBuf, 0, &err);
  -    if (!U_SUCCESS(err) || fRootBundle == NULL)
  +    fLocaleBundle = ures_open(tempBuf, getenv("XERCESC_RESBUND_PKG_LOCALE"), &err);
  +    if (!U_SUCCESS(err) || fLocaleBundle == NULL)
       {
           XMLPlatformUtils::panic(XMLPlatformUtils::Panic_CantLoadMsgDomain);
       }
       
  -     //strip off path information, if any
  +    /***
  +        get the resource bundle for the domain
  +        strip off path information, if any
  +    ***/
        int   index = XMLString::lastIndexOf(msgDomain, chForwardSlash);
        char *domainName = XMLString::transcode(&(msgDomain[index + 1]));
  -
  -     // get the resource bundle for the domain
  -     fDomainBundle = ures_getByKey(fRootBundle, domainName, NULL, &err);
  -
  +      err = U_ZERO_ERROR;
  +     fDomainBundle = ures_getByKey(fLocaleBundle, domainName, NULL, &err);
        delete [] domainName;
    
        if (!U_SUCCESS(err) || fDomainBundle == NULL)
  @@ -165,7 +171,7 @@
   ICUMsgLoader::~ICUMsgLoader()
   {
       ures_close(fDomainBundle);
  -    ures_close(fRootBundle);
  +    ures_close(fLocaleBundle);
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to