(file) Return to LanguageParser.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/LanguageParser.cpp between version 1.15 and 1.20

version 1.15, 2005/05/30 13:43:49 version 1.20, 2005/06/06 08:28:15
Line 30 
Line 30 
 // Author: Humberto Rivero (hurivero@us.ibm.com) // Author: Humberto Rivero (hurivero@us.ibm.com)
 // //
 // Modified By: Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3697, 3698, 3699, 3700 // Modified By: Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3697, 3698, 3699, 3700
   //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3701, 3702, 3703, 3704
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 209 
Line 210 
         PEG_METHOD_EXIT();         PEG_METHOD_EXIT();
 } }
  
 Boolean LanguageParser::isValid(String language_tag, Boolean validate_length){  Boolean LanguageParser::isValid(const String& language_tag, Boolean validate_length){
         //break the String down into parts(subtags), then validate each part         //break the String down into parts(subtags), then validate each part
  
         if(language_tag == "*") return true;         if(language_tag == "*") return true;
Line 229 
Line 230 
         return true;         return true;
 } }
  
 String LanguageParser::convertPrivateLanguageTag(String language_tag){  String LanguageParser::convertPrivateLanguageTag(const String & language_tag){
         // figure out if its a unix style locale or windows locale         // figure out if its a unix style locale or windows locale
         Uint32 i;         Uint32 i;
         if(( i = language_tag.find("pegasus-")) != PEG_NOT_FOUND ){         if(( i = language_tag.find("pegasus-")) != PEG_NOT_FOUND ){
                 language_tag = language_tag.subString(i+5);  // capture the remainder of the string                  String str;
                 return String(replaceSeparator(language_tag.getCString(), '-'));                  str = language_tag.subString(i+5);
                   //language_tag = language_tag.subString(i+5);  // capture the remainder of the string
                   return String(replaceSeparator(str.getCString(), '-'));
         }         }
         //else if( (i = language_tag.find("win-")) != PEG_NOT_FOUND ){         //else if( (i = language_tag.find("win-")) != PEG_NOT_FOUND ){
           // return language_tag.subString(i+4);  // capture the remainder of the string           // return language_tag.subString(i+4);  // capture the remainder of the string
Line 245 
Line 248 
         }         }
 } }
  
 Boolean LanguageParser::checkAlpha(CString _str){  Boolean LanguageParser::checkAlpha(const CString & _str){
         Uint32 length = (Uint32) strlen(_str);         Uint32 length = (Uint32) strlen(_str);
         for(Uint32 i = 0; i < length; i++)         for(Uint32 i = 0; i < length; i++)
                 if( !isalpha(_str[i]) )                 if( !isalpha(_str[i]) )
Line 253 
Line 256 
         return true;         return true;
 } }
  
 char LanguageParser::findSeparator(CString _str){  char LanguageParser::findSeparator(const CString & _str){
         Uint32 length = (Uint32) strlen(_str);         Uint32 length = (Uint32) strlen(_str);
         for(Uint32 i = 0; i < length; i++)         for(Uint32 i = 0; i < length; i++)
                 if(!isalnum(_str[i]))                 if(!isalnum(_str[i]))
Line 261 
Line 264 
         return '\0';         return '\0';
 } }
  
 CString LanguageParser::replaceSeparator(CString _s, char new_sep){  CString LanguageParser::replaceSeparator(const CString & _s, char new_sep){
         char * _str = const_cast<char *>((const char*)_s);      const Uint32 length = (Uint32) strlen(_s);
         Uint32 length = (Uint32) strlen(_str);      AutoArrayPtr<char> _str(new char[length + 1]);
       strcpy(_str.get(),_s);
         for(Uint32 i = 0; i < length; i++)         for(Uint32 i = 0; i < length; i++)
                 _str[i] = (!isalnum(_str[i])) ? new_sep : _str[i];      {
         return (String(_str)).getCString();          if (!isalnum(_str.get()[i]))
           {
               _str.get()[i] = new_sep;
           }
       }
           const String retval(_str.get());
       _str.release();
       return(retval.getCString());
 } }
  
  


Legend:
Removed from v.1.15  
changed lines
  Added in v.1.20

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2