stdcpp/tsrc/Stdcpp_test/bcdrivers/tlocale/src/tlocaleblocks.cpp
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
   111    cout<<"";  
   111    cout<<"";  
   112  
   112  
   113  #if  STDCPP_OOM
   113  #if  STDCPP_OOM
   114 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   114 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   115   #endif 
   115   #endif 
   116  char* p = "c";
   116 // char* p = "c";
   117   const char* _Loc_ctype_default(p) ;
   117 //  const char* _Loc_ctype_default(p) ;
   118  
   118  
   119   locale loc("en_GB.UTF-8") ;
   119   locale loc("en_GB.UTF-8") ;
   120  result = has_facet <ctype<char> > ( loc );
   120  result = has_facet <ctype<char> > ( loc );
   121   result_w = has_facet <ctype<wchar_t> > ( loc );
   121   result_w = has_facet <ctype<wchar_t> > ( loc );
   122  #if  STDCPP_OOM
   122  #if  STDCPP_OOM
   479  iter_type;
   479  iter_type;
   480 
   480 
   481  locale loc;
   481  locale loc;
   482  string buffer("$100.02");
   482  string buffer("$100.02");
   483  string dest;
   483  string dest;
   484  long double ldest;
   484 // long double ldest;
   485  ios_base::iostate state;
   485 // ios_base::iostate state;
   486  iter_type end;
   486  iter_type end;
   487  cout<<"";
   487  cout<<"";
   488 #if  STDCPP_OOM
   488 #if  STDCPP_OOM
   489 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   489 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   490   #endif 
   490   #endif 
   531  typedef ostreambuf_iterator<char,char_traits<char> >
   531  typedef ostreambuf_iterator<char,char_traits<char> >
   532  iter_type;
   532  iter_type;
   533 
   533 
   534  locale loc;
   534  locale loc;
   535  string buffer("10002");
   535  string buffer("10002");
   536  long double ldval = 10002;
   536 // long double ldval = 10002;
   537 
   537 
   538   iter_type begin(cout);
   538   iter_type begin(cout);
   539   cout<<"";
   539   cout<<"";
   540 #if  STDCPP_OOM
   540 #if  STDCPP_OOM
   541 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   541 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   816     {
   816     {
   817     	
   817     	
   818     
   818     
   819   typedef std::istreambuf_iterator<char,
   819   typedef std::istreambuf_iterator<char,
   820   std::char_traits<char> > Iter;
   820   std::char_traits<char> > Iter;
   821   static struct tm timeb;  
   821 //  static struct tm timeb;  
   822   std::ios_base::iostate state;
   822 //  std::ios_base::iostate state;
   823 cout<<"";
   823 cout<<"";
   824     #if  STDCPP_OOM
   824     #if  STDCPP_OOM
   825 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   825 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   826   #endif 
   826   #endif 
   827  const std::time_get<char, Iter> &tg =
   827  const std::time_get<char, Iter> &tg =
   861     int failures=0; 
   861     int failures=0; 
   862     try
   862     try
   863     {
   863     {
   864     	
   864     	
   865    
   865    
   866     std::tm t = std::tm ();
   866 /*    std::tm t = std::tm ();
   867    
   867    
   868     t.tm_sec   = 56;    
   868     t.tm_sec   = 56;    
   869     t.tm_min   = 34;    
   869     t.tm_min   = 34;    
   870     t.tm_hour  = 14;    
   870     t.tm_hour  = 14;    
   871     t.tm_mday  = 29;   
   871     t.tm_mday  = 29;   
   882       "%k", "%l", "%m", "%M", "%n", "%p", "%r", "%R",
   882       "%k", "%l", "%m", "%M", "%n", "%p", "%r", "%R",
   883       "%S", "%t", "%T", "%u", "%U", "%V", "%w", "%W", "%x",
   883       "%S", "%t", "%T", "%u", "%U", "%V", "%w", "%W", "%x",
   884       "%X", "%y", "%Y", "%z", "%Z", "%%", "%Ec", "%EC", "%Ex",
   884       "%X", "%y", "%Y", "%z", "%Z", "%%", "%Ec", "%EC", "%Ex",
   885       "%EX", "%Ey", "%EY", "%Od", "%Oe", "%OH", "%OI", "%Om",
   885       "%EX", "%Ey", "%EY", "%Od", "%Oe", "%OH", "%OI", "%Om",
   886       "%OM", "%OS", "%Ou", "%OU", "%OV", "%Ow", "%OW", "%Oy"         
   886       "%OM", "%OS", "%Ou", "%OU", "%OV", "%Ow", "%OW", "%Oy"         
   887     };
   887     };*/
   888     cout<<"";
   888     cout<<"";
   889 #if  STDCPP_OOM
   889 #if  STDCPP_OOM
   890 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   890 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   891   #endif 
   891   #endif 
   892      const std::time_put<char> &tput =
   892      const std::time_put<char> &tput =
  1480    cout<<"";  
  1480    cout<<"";  
  1481  
  1481  
  1482  #if  STDCPP_OOM
  1482  #if  STDCPP_OOM
  1483 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1483 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1484   #endif 
  1484   #endif 
  1485  char* p = "c";
  1485 // char* p = "c";
  1486   const char* _Loc_ctype_default(p);
  1486 /*  const char* _Loc_ctype_default(p);
  1487    const char* _Loc_numeric_default(p) ;
  1487    const char* _Loc_numeric_default(p) ;
  1488 	const char* _Loc_time_default(p) ;
  1488 	const char* _Loc_time_default(p) ;
  1489    const char* _Loc_collate_default(p) ;
  1489    const char* _Loc_collate_default(p) ;
  1490    const char* _Loc_monetary_default(p) ;
  1490    const char* _Loc_monetary_default(p) ;
  1491    const char* _Loc_messages_default(p) ;
  1491    const char* _Loc_messages_default(p) ;*/
  1492    
  1492    
  1493     locale::category c;
  1493 /*    locale::category c;
  1494    //_Locale* L = "k";
  1494    //_Locale* L = "k";
  1495    const char* name1 = "catalog";
  1495    const char* name1 = "catalog";
  1496     const char* name2="test";
  1496     const char* name2="test";*/
  1497     
  1497     
  1498             
  1498             
  1499    const locale& L1= 0;
  1499    const locale& L1= 0;
  1500    const locale& L2= 0;
  1500    const locale& L2= 0;
  1501    const char* name = "testing";
  1501 //   const char* name = "testing";
  1502   // void _Stl_loc_combine_names(L,name1,name2,c);
  1502   // void _Stl_loc_combine_names(L,name1,name2,c);
  1503    //locale::locale(const locale& L1, const locale& L2, category c)
  1503    //locale::locale(const locale& L1, const locale& L2, category c)
  1504    //locale::category c;
  1504    //locale::category c;
  1505   
  1505   
  1506    
  1506    
  1562   
  1562   
  1563   
  1563   
  1564   locale loc1 ( "C" );
  1564   locale loc1 ( "C" );
  1565    
  1565    
  1566    char *string = "Hello, my name is John!";
  1566    char *string = "Hello, my name is John!";
  1567     wchar_t *wstring = L"Hello, my name is John!";
  1567 //    wchar_t *wstring = L"Hello, my name is John!";
  1568 
  1568 
  1569    const char* i = use_facet<ctype<char> > ( loc1 ).scan_is ( ctype_base::punct, &string[0], &string[strlen(&string[0])-1] );
  1569    const char* i = use_facet<ctype<char> > ( loc1 ).scan_is ( ctype_base::punct, &string[0], &string[strlen(&string[0])-1] );
  1570     // const wchar_t* wi = use_facet<ctype<wchar_t> > ( loc1 ).scan_is ( ctype_base::punct, &wstring[0], &wstring[strlen(&wstring[0])-1] );
  1570     // const wchar_t* wi = use_facet<ctype<wchar_t> > ( loc1 ).scan_is ( ctype_base::punct, &wstring[0], &wstring[strlen(&wstring[0])-1] );
  1571    const char* j = use_facet<ctype<char> > ( loc1 ).scan_not( ctype_base::alpha, &string[0], &string[strlen(&string[0])-1] );
  1571    const char* j = use_facet<ctype<char> > ( loc1 ).scan_not( ctype_base::alpha, &string[0], &string[strlen(&string[0])-1] );
  1572    if((*i)!= ',')
  1572    if((*i)!= ',')
  1600 
  1600 
  1601 wchar_t wto_upper = L'A';
  1601 wchar_t wto_upper = L'A';
  1602 
  1602 
  1603 char str2[16];
  1603 char str2[16];
  1604 
  1604 
  1605 char test;
  1605 //char test;
  1606    use_facet<ctype<char> > ( loc1 ).toupper( &string3[0], &string3[strlen(&string3[0])] );
  1606    use_facet<ctype<char> > ( loc1 ).toupper( &string3[0], &string3[strlen(&string3[0])] );
  1607      use_facet<ctype<wchar_t> > ( loc1 ).toupper( &wstring3[0], &wstring3[27] );
  1607      use_facet<ctype<wchar_t> > ( loc1 ).toupper( &wstring3[0], &wstring3[27] );
  1608 
  1608 
  1609    use_facet<ctype<char> > ( loc1 ).toupper(to_upper);
  1609    use_facet<ctype<char> > ( loc1 ).toupper(to_upper);
  1610      use_facet<ctype<wchar_t> > ( loc1 ).toupper(wto_upper);
  1610      use_facet<ctype<wchar_t> > ( loc1 ).toupper(wto_upper);