sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "tlocale.h" sl@0: #define STDCPP_OOM FALSE sl@0: using namespace std; sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::Delete sl@0: // Delete here all resources allocated and opened from test methods. sl@0: // Called from destructor. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void Ctlocale::Delete() sl@0: { sl@0: sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::RunMethodL sl@0: // Run specified method. Contains also table of test mothods and their names. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::RunMethodL( sl@0: CStifItemParser& aItem ) sl@0: { sl@0: sl@0: static TStifFunctionInfo const KFunctions[] = sl@0: { sl@0: // Copy this line for every implemented function. sl@0: // First string is the function name used in TestScripter script file. sl@0: // Second is the actual implementation member function. sl@0: ENTRY( "hasfacet", Ctlocale::hasfacet ), sl@0: ENTRY( "usefacet", Ctlocale::usefacet ), sl@0: ENTRY( "numget", Ctlocale::numget ), sl@0: ENTRY( "numput", Ctlocale::numput ), sl@0: ENTRY( "num_punct", Ctlocale::num_punct ), sl@0: ENTRY( "numpunctbyname", Ctlocale::numpunctbyname ), sl@0: ENTRY( "moneyget", Ctlocale::moneyget ), sl@0: ENTRY( "moneyput", Ctlocale::moneyput ), sl@0: ENTRY( "money_punct", Ctlocale::money_punct ), sl@0: ENTRY( "moneypunctbyname", Ctlocale::moneypunctbyname ), sl@0: ENTRY( "timeget", Ctlocale::timeget ), sl@0: ENTRY( "timeput", Ctlocale::timeput ), sl@0: ENTRY( "messagesL", Ctlocale::messagesL ), sl@0: ENTRY( "messagesbyname", Ctlocale::messagesbyname ), sl@0: ENTRY( "collateL", Ctlocale::collateL ), sl@0: ENTRY( "collatebyname", Ctlocale::collatebyname ), sl@0: ENTRY( "codecvt1", Ctlocale::codecvt1 ), sl@0: ENTRY( "codecvt2", Ctlocale::codecvt2 ), sl@0: ENTRY( "codecvtbyname1", Ctlocale::codecvtbyname1 ), sl@0: ENTRY( "codecvtbyname2", Ctlocale::codecvtbyname2 ), sl@0: ENTRY( "catalog", Ctlocale::catalog ), sl@0: ENTRY( "c_type", Ctlocale::c_type ), sl@0: sl@0: }; sl@0: sl@0: const TInt count = sizeof( KFunctions ) / sl@0: sizeof( TStifFunctionInfo ); sl@0: sl@0: return RunInternalL( KFunctions, count, aItem ); sl@0: sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::has_facet sl@0: // has_facet test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: sl@0: TInt Ctlocale::hasfacet( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: bool result = true; sl@0: bool result_w = true; sl@0: // __UHEAP_MARK; sl@0: sl@0: cout<<""; sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: // char* p = "c"; sl@0: // const char* _Loc_ctype_default(p) ; sl@0: sl@0: locale loc("en_GB.UTF-8") ; sl@0: result = has_facet > ( loc ); sl@0: result_w = has_facet > ( loc ); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: //__UHEAP_MARKEND; sl@0: /* sl@0: if(result) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: */ sl@0: if(!result) sl@0: failures++; sl@0: sl@0: if(!result_w) sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::use_facet sl@0: // use_facet test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: sl@0: TInt Ctlocale::usefacet( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: //__UHEAP_MARK; sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc ("en_GB.UTF-8"); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: bool result = use_facet > ( loc ).is(ctype_base::alpha, 'b'); sl@0: bool result_w = use_facet > ( loc ).is(ctype_base::alpha, L'b'); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: // __UHEAP_MARKEND; sl@0: /* if (result) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: sl@0: */ sl@0: sl@0: if(!result) sl@0: failures++; sl@0: sl@0: if(!result_w) sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::num_get sl@0: // num_get test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: sl@0: TInt Ctlocale::numget( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: typedef istreambuf_iterator > sl@0: iter_type; sl@0: sl@0: sl@0: sl@0: locale loc; sl@0: iter_type end; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const num_get& tg = use_facet >(loc); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::num_put sl@0: // num_put test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::numput( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: typedef ostreambuf_iterator > sl@0: iter_type; sl@0: sl@0: locale loc; sl@0: sl@0: sl@0: // Construct a ostreambuf_iterator on cout sl@0: iter_type begin(cout); sl@0: sl@0: // Get a num_put facet reference sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const num_put& np = use_facet >(loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::num_punct sl@0: // num_punct test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::num_punct( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const numpunct &npunct = use_facet >( loc); sl@0: const numpunct &npunct_w = use_facet >( loc); sl@0: // const numpunct &n1punct = use_facet >( loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: /* sl@0: if(npunct.truename() == "true") sl@0: if(npunct.falsename()=="false") sl@0: if(npunct.decimal_point() =='.') sl@0: if(npunct.thousands_sep() ==',') sl@0: sl@0: sl@0: sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral;*/ sl@0: if(npunct.truename() != "true") sl@0: failures++; sl@0: if(npunct.falsename()!="false") sl@0: failures++; sl@0: if(npunct.decimal_point() !='.') sl@0: failures++; sl@0: if(npunct.thousands_sep() !=',') sl@0: failures++; sl@0: sl@0: sl@0: if(npunct_w.truename() != L"true") sl@0: failures++; sl@0: if(npunct_w.falsename()!=L"false") sl@0: failures++; sl@0: if(npunct_w.decimal_point() != L'.') sl@0: failures++; sl@0: if(npunct_w.thousands_sep() !=L',') sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::numpunct_byname sl@0: // numpunct_byname test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::numpunctbyname( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const numpunct_byname &npunct = use_facet >( loc); sl@0: const numpunct_byname &npunct_w = use_facet >( loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: /*if(npunct.truename() == "true") sl@0: if(npunct.falsename()=="false") sl@0: if(npunct.decimal_point( ) =='.') sl@0: if(npunct.thousands_sep( ) ==',') sl@0: sl@0: sl@0: sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral;*/ sl@0: sl@0: if(npunct.truename() != "true") sl@0: failures++; sl@0: if(npunct.falsename()!="false") sl@0: failures++; sl@0: if(npunct.decimal_point( ) !='.') sl@0: failures++; sl@0: if(npunct.thousands_sep( ) !=',') sl@0: failures++; sl@0: sl@0: sl@0: sl@0: if(npunct_w.truename() != L"true") sl@0: failures++; sl@0: if(npunct_w.falsename()!= L"false") sl@0: failures++; sl@0: if(npunct_w.decimal_point( ) != L'.') sl@0: failures++; sl@0: if(npunct_w.thousands_sep( ) != L',') sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::money_get sl@0: // money_get test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::moneyget( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: typedef istreambuf_iterator > sl@0: iter_type; sl@0: sl@0: locale loc; sl@0: string buffer("$100.02"); sl@0: string dest; sl@0: // long double ldest; sl@0: // ios_base::iostate state; sl@0: iter_type end; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: // Get a money_get facet sl@0: const money_get& mgf = use_facet >(loc); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: // return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::money_put sl@0: // money_put test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::moneyput( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: typedef ostreambuf_iterator > sl@0: iter_type; sl@0: sl@0: locale loc; sl@0: string buffer("10002"); sl@0: // long double ldval = 10002; sl@0: sl@0: iter_type begin(cout); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const money_put& mp = use_facet >(loc); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::moneypunct sl@0: // moneypunct test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::money_punct( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: sl@0: locale loc; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: sl@0: sl@0: sl@0: const moneypunct& mp = use_facet >(loc); sl@0: const moneypunct& mp_true = use_facet >(loc); sl@0: sl@0: sl@0: const moneypunct& mp_w = use_facet >(loc); sl@0: sl@0: const moneypunct& mp_w_true = use_facet >(loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: mp.curr_symbol(); sl@0: mp.negative_sign(); sl@0: mp.grouping(); sl@0: mp.curr_symbol(); sl@0: mp.frac_digits(); sl@0: mp.pos_format() ; sl@0: mp.neg_format(); sl@0: sl@0: sl@0: mp_true.curr_symbol(); sl@0: mp_true.negative_sign(); sl@0: mp_true.grouping(); sl@0: mp_true.curr_symbol(); sl@0: mp_true.frac_digits(); sl@0: mp_true.pos_format() ; sl@0: mp_true.neg_format(); sl@0: sl@0: mp_w.curr_symbol(); sl@0: mp_w.negative_sign(); sl@0: mp_w.grouping(); sl@0: mp_w.curr_symbol(); sl@0: mp_w.frac_digits(); sl@0: mp_w.pos_format() ; sl@0: mp_w.neg_format(); sl@0: sl@0: sl@0: mp_w_true.curr_symbol(); sl@0: mp_w_true.negative_sign(); sl@0: mp_w_true.grouping(); sl@0: mp_w_true.curr_symbol(); sl@0: mp_w_true.frac_digits(); sl@0: mp_w_true.pos_format() ; sl@0: mp_w_true.neg_format(); sl@0: sl@0: /* if(mp.decimal_point() == '.') sl@0: if(mp.thousands_sep() == ',') sl@0: if( mp.frac_digits() == 0) sl@0: sl@0: sl@0: sl@0: sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral;*/ sl@0: sl@0: if(mp.decimal_point() != '.') sl@0: failures++; sl@0: if(mp.thousands_sep() != ',') sl@0: failures++; sl@0: if( mp.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: if(mp_true.decimal_point() != '.') sl@0: failures++; sl@0: if(mp_true.thousands_sep() != ',') sl@0: failures++; sl@0: if( mp_true.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: sl@0: sl@0: if(mp_w.decimal_point() != L'.') sl@0: failures++; sl@0: if(mp_w.thousands_sep() != L',') sl@0: failures++; sl@0: if( mp_w.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: if(mp_w_true.decimal_point() != L'.') sl@0: failures++; sl@0: if(mp_w_true.thousands_sep() != L',') sl@0: failures++; sl@0: if( mp_w_true.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::moneypunct_byname sl@0: // moneypunct_byname test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::moneypunctbyname( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: sl@0: locale loc; sl@0: sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const moneypunct_byname& mp = sl@0: sl@0: use_facet >(loc); sl@0: sl@0: const moneypunct_byname& mp_true = sl@0: sl@0: use_facet >(loc); sl@0: sl@0: sl@0: const moneypunct_byname& mp_w = sl@0: sl@0: use_facet >(loc); sl@0: sl@0: sl@0: sl@0: const moneypunct_byname& mp_w_true = sl@0: sl@0: use_facet >(loc); sl@0: sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: mp.curr_symbol(); sl@0: mp.negative_sign(); sl@0: if(mp.decimal_point() != '.') sl@0: failures++; sl@0: if(mp.thousands_sep() != ',') sl@0: failures++; sl@0: if( mp.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: mp_true.curr_symbol(); sl@0: mp_true.negative_sign(); sl@0: if(mp_true.decimal_point() != '.') sl@0: failures++; sl@0: if(mp_true.thousands_sep() != ',') sl@0: failures++; sl@0: if( mp_true.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: mp_w.curr_symbol(); sl@0: mp_w.negative_sign(); sl@0: if(mp_w.decimal_point() != L'.') sl@0: failures++; sl@0: if(mp_w.thousands_sep() != L',') sl@0: failures++; sl@0: if( mp_w.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: mp_w_true.curr_symbol(); sl@0: mp_w_true.negative_sign(); sl@0: if(mp_w_true.decimal_point() != L'.') sl@0: failures++; sl@0: if(mp_w_true.thousands_sep() != L',') sl@0: failures++; sl@0: if( mp_w_true.frac_digits() != 0) sl@0: failures++; sl@0: sl@0: sl@0: } sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::time_get sl@0: // time_get test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: sl@0: TInt Ctlocale::timeget( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: typedef std::istreambuf_iterator > Iter; sl@0: // static struct tm timeb; sl@0: // std::ios_base::iostate state; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const std::time_get &tg = sl@0: std::use_facet >(std::locale ("C")); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::time_put sl@0: // time_put test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::timeput( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: /* std::tm t = std::tm (); sl@0: sl@0: t.tm_sec = 56; sl@0: t.tm_min = 34; sl@0: t.tm_hour = 14; sl@0: t.tm_mday = 29; sl@0: t.tm_mon = 1; sl@0: t.tm_year = 84; sl@0: sl@0: t.tm_yday = 59; sl@0: t.tm_wday = 3; sl@0: t.tm_isdst = 0; sl@0: sl@0: const char* const fmt[] = { sl@0: "%a", "%A", "%b", "%B", "%c", "%C", "%d", "%D", sl@0: "%e", "%F", "%g", "%G", "%h", "%H", "%I", "%j", sl@0: "%k", "%l", "%m", "%M", "%n", "%p", "%r", "%R", sl@0: "%S", "%t", "%T", "%u", "%U", "%V", "%w", "%W", "%x", sl@0: "%X", "%y", "%Y", "%z", "%Z", "%%", "%Ec", "%EC", "%Ex", sl@0: "%EX", "%Ey", "%EY", "%Od", "%Oe", "%OH", "%OI", "%Om", sl@0: "%OM", "%OS", "%Ou", "%OU", "%OV", "%Ow", "%OW", "%Oy" sl@0: };*/ sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const std::time_put &tput = sl@0: std::use_facet >(std::cout.getloc ()); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::messages sl@0: // messages test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::messagesL( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const messages& mess =use_facet >(loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: // no support to .cat files sl@0: sl@0: /* sl@0: string def("Message Not Found"); sl@0: messages::catalog cat = sl@0: mess.open("./rwstdmessages.cat",loc); sl@0: if (cat != -1) sl@0: { sl@0: string msg0 = mess.get(cat,1,1,def); sl@0: string msg1 = mess.get(cat,1,2,def); sl@0: string msg2 = mess.get(cat,1,6,def); // invalid msg # sl@0: string msg3 = mess.get(cat,2,1,def); sl@0: sl@0: mess.close(cat); sl@0: cout << msg0 << endl << msg1 << endl sl@0: << msg2 << endl << msg3 << endl; sl@0: } sl@0: else sl@0: cout << "Unable to open message catalog" << endl;*/ sl@0: sl@0: //return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::messages_byname sl@0: // messages_byname test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::messagesbyname( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const messages_byname& mess = sl@0: sl@0: use_facet >(loc); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: // no support to .cat files sl@0: /* sl@0: string def("Message Not Found"); sl@0: messages_byname::catalog cat = sl@0: mess.open("./rwstdmessages.cat",loc); sl@0: if (cat != -1) sl@0: { sl@0: string msg0 = mess.get(cat,1,1,def); sl@0: string msg1 = mess.get(cat,1,2,def); sl@0: string msg2 = mess.get(cat,1,6,def); // invalid msg # sl@0: string msg3 = mess.get(cat,2,1,def); sl@0: sl@0: mess.close(cat); sl@0: cout << msg0 << endl << msg1 << endl sl@0: << msg2 << endl << msg3 << endl; sl@0: } sl@0: else sl@0: cout << "Unable to open message catalog" << endl;*/ sl@0: sl@0: //return KErrNone; sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::collate sl@0: // collate test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::collateL( CStifItemParser& aItem ) sl@0: { sl@0: int failures =0; sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: string s1("blue"); sl@0: string s2("blues"); sl@0: wstring ws1(L"blue"); sl@0: wstring ws2(L"blues"); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const collate& co = sl@0: use_facet >(loc); sl@0: sl@0: sl@0: const collate& w_co = sl@0: use_facet >(loc); //wchar sl@0: sl@0: if( co.compare(s1.begin(),s1.end(),s2.begin(),s2.end()-1) != 0) sl@0: failures++; sl@0: sl@0: if( co.compare(s1.begin(),s1.end(), s2.begin(),s2.end()) != -1) sl@0: failures++; sl@0: sl@0: // Retrieve hash values for two strings sl@0: if( co.hash(s1.begin(),s1.end())!= 15636) sl@0: failures++; sl@0: sl@0: //wchar sl@0: sl@0: if( w_co.compare(ws1.begin(),ws1.end(),ws2.begin(),ws2.end()-1) != 0) sl@0: failures++; sl@0: sl@0: if( w_co.compare(ws1.begin(),ws1.end(), ws2.begin(),ws2.end()) != -1) sl@0: failures++; sl@0: sl@0: // Retrieve hash values for two strings sl@0: if( w_co.hash(ws1.begin(),ws1.end())!= 15636) sl@0: failures++; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: } sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::collatebyname sl@0: // collatebyname test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::collatebyname( CStifItemParser& aItem ) sl@0: { sl@0: int failures =0; sl@0: try sl@0: { sl@0: sl@0: sl@0: locale loc; sl@0: string s1("blue"); sl@0: string s2("blues"); sl@0: sl@0: wstring ws1(L"blue"); sl@0: wstring ws2(L"blues"); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: const collate_byname& co = use_facet >(loc); sl@0: const collate_byname& w_co = use_facet >(loc); sl@0: sl@0: if( co.compare(s1.begin(),s1.end(),s2.begin(),s2.end()-1) != 0) sl@0: failures++; sl@0: sl@0: if( co.compare(s1.begin(),s1.end(), s2.begin(),s2.end()) != -1) sl@0: failures++; sl@0: sl@0: // Retrieve hash values for two strings sl@0: if( co.hash(s1.begin(),s1.end())!= 15636) sl@0: failures++; sl@0: sl@0: //wchar sl@0: sl@0: if( w_co.compare(ws1.begin(),ws1.end(),ws2.begin(),ws2.end()-1) != 0) sl@0: failures++; sl@0: sl@0: if( w_co.compare(ws1.begin(),ws1.end(), ws2.begin(),ws2.end()) != -1) sl@0: failures++; sl@0: sl@0: // Retrieve hash values for two strings sl@0: if( w_co.hash(ws1.begin(),ws1.end())!= 15636) sl@0: failures++; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::codecvt1 sl@0: // codecvt1 test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::codecvt1( CStifItemParser& aItem ) sl@0: { sl@0: /* locale loc ( "de_DE.ISO-8859-15" ); sl@0: int failures=0; sl@0: try sl@0: { sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int result = use_facet > ( loc ).encoding (); sl@0: if(result != 1) sl@0: failures++; sl@0: sl@0: sl@0: sl@0: sl@0: char* str = "This is the string whose length is to be measured!"; sl@0: mbstate_t state = {0}; sl@0: locale loc1("C");//English_Britain");//German_Germany sl@0: //int res = use_facet>( loc ).length( state,str, &str[strlen(str)], 90 ); sl@0: sl@0: sl@0: int res = use_facet > sl@0: ( loc1 ).length( state,str, &str[strlen(str)], 90 ); sl@0: sl@0: sl@0: sl@0: if(res!=50) sl@0: failures++; sl@0: sl@0: sl@0: sl@0: locale loc2( "C");//English_Britain" );//German_Germany sl@0: int res2 = use_facet > sl@0: ( loc ).max_length( ); sl@0: if(res2!=1) sl@0: failures++; sl@0: sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral;*/ sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::codecvt2 sl@0: // codecvt2 test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::codecvt2( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: char strout[91]; sl@0: wchar_t *strin = L"This is the wchar_t string to be converted."; sl@0: memset( &strout[0], 0, ( sizeof( char ) )*( 91 ) ); sl@0: char* strnext; sl@0: const wchar_t* pwszNext; sl@0: mbstate_t state; sl@0: locale loc("C"); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int res = use_facet > sl@0: ( loc ).out( state,strin, &strin[wcslen( strin )], pwszNext , sl@0: strout, &strout[wcslen( strin )], strnext ); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: strout[wcslen( strin )] = 0; sl@0: sl@0: string str = "This is the wchar_t string to be converted."; sl@0: sl@0: /*if(str.compare(&strout[0]) == 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: sl@0: */ sl@0: sl@0: if(str.compare(&strout[0]) != 0) sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::codecvtbyname1 sl@0: // codecvtbyname1 test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::codecvtbyname1( CStifItemParser& aItem ) sl@0: { sl@0: /* locale loc ( "de_DE.ISO-8859-15" ); sl@0: int failures=0; sl@0: try sl@0: { sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int result = use_facet > ( loc ).encoding (); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: if(result != 1) sl@0: failures++; sl@0: sl@0: sl@0: char* str = "This is the string whose length is to be measured!"; sl@0: mbstate_t state = {0}; sl@0: locale loc1("C"); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int res = use_facet > sl@0: ( loc1 ).length( state,str, &str[strlen(str)], 90 ); sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: if(res!=50) sl@0: failures++; sl@0: sl@0: sl@0: sl@0: locale loc2( "C"); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int res2 = use_facet >( loc ).max_length( ); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: if(res2!=1) sl@0: failures++; sl@0: sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral;*/ sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::codecvtbyname2 sl@0: // codecvtbyname2 test method function. sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: TInt Ctlocale::codecvtbyname2( CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: char* strout = "This is the string to be converted!"; sl@0: wchar_t strin [91]; sl@0: memset(&strin[0], 0, (sizeof(wchar_t))*(91)); sl@0: const char* pszNext; sl@0: wchar_t* pwszNext; sl@0: mbstate_t state = {0}; sl@0: locale loc("C"); sl@0: cout<<""; sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: int res = use_facet > sl@0: ( loc ).in( state, strout, &strout[strlen(strout)], pszNext, sl@0: strin, &strin[strlen(strout)], pwszNext ); sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: strin[strlen(strout)] = 0; sl@0: sl@0: wstring str = L"This is the string to be converted!"; sl@0: sl@0: /* sl@0: if(str.compare(&strin[0]) == 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: sl@0: */ sl@0: if(str.compare(&strin[0]) != 0) sl@0: failures++; sl@0: sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: //cataloge sl@0: sl@0: TInt Ctlocale::catalog(CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: // __UHEAP_MARK; sl@0: sl@0: cout<<""; sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: // char* p = "c"; sl@0: /* const char* _Loc_ctype_default(p); sl@0: const char* _Loc_numeric_default(p) ; sl@0: const char* _Loc_time_default(p) ; sl@0: const char* _Loc_collate_default(p) ; sl@0: const char* _Loc_monetary_default(p) ; sl@0: const char* _Loc_messages_default(p) ;*/ sl@0: sl@0: /* locale::category c; sl@0: //_Locale* L = "k"; sl@0: const char* name1 = "catalog"; sl@0: const char* name2="test";*/ sl@0: sl@0: sl@0: const locale& L1= 0; sl@0: const locale& L2= 0; sl@0: // const char* name = "testing"; sl@0: // void _Stl_loc_combine_names(L,name1,name2,c); sl@0: //locale::locale(const locale& L1, const locale& L2, category c) sl@0: //locale::category c; sl@0: sl@0: sl@0: sl@0: //locale loc1(L1,name,c); sl@0: //locale loc(L1,L2,c); sl@0: sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: //__UHEAP_MARKEND; sl@0: /* sl@0: if(result) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: */ sl@0: sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: sl@0: //cataloge sl@0: sl@0: TInt Ctlocale::c_type(CStifItemParser& aItem ) sl@0: { sl@0: int failures=0; sl@0: try sl@0: { sl@0: sl@0: sl@0: // __UHEAP_MARK; sl@0: sl@0: cout<<""; sl@0: sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1); sl@0: #endif sl@0: sl@0: sl@0: sl@0: locale loc1 ( "C" ); sl@0: sl@0: char *string = "Hello, my name is John!"; sl@0: // wchar_t *wstring = L"Hello, my name is John!"; sl@0: sl@0: const char* i = use_facet > ( loc1 ).scan_is ( ctype_base::punct, &string[0], &string[strlen(&string[0])-1] ); sl@0: // const wchar_t* wi = use_facet > ( loc1 ).scan_is ( ctype_base::punct, &wstring[0], &wstring[strlen(&wstring[0])-1] ); sl@0: const char* j = use_facet > ( loc1 ).scan_not( ctype_base::alpha, &string[0], &string[strlen(&string[0])-1] ); sl@0: if((*i)!= ',') sl@0: failures++; sl@0: sl@0: if((*j)!= ',') sl@0: failures++; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: //lower sl@0: sl@0: char string2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; sl@0: wchar_t wstring2[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; sl@0: char to_lower = 'a'; sl@0: wchar_t wto_lower = L'a'; sl@0: sl@0: use_facet > ( loc1 ).tolower( &string2[0], &string2[strlen(&string2[0])] ); sl@0: use_facet > ( loc1 ).tolower( &wstring2[0], &wstring2[27] ); sl@0: sl@0: use_facet > ( loc1 ).tolower(to_lower); sl@0: use_facet > ( loc1 ).tolower(wto_lower); sl@0: //upper sl@0: sl@0: sl@0: char string3[] = "abcdefghijklmnopqrstuvwxyz"; sl@0: wchar_t wstring3[] = L"abcdefghijklmnopqrstuvwxyz"; sl@0: char to_upper = 'A'; sl@0: sl@0: wchar_t wto_upper = L'A'; sl@0: sl@0: char str2[16]; sl@0: sl@0: //char test; sl@0: use_facet > ( loc1 ).toupper( &string3[0], &string3[strlen(&string3[0])] ); sl@0: use_facet > ( loc1 ).toupper( &wstring3[0], &wstring3[27] ); sl@0: sl@0: use_facet > ( loc1 ).toupper(to_upper); sl@0: use_facet > ( loc1 ).toupper(wto_upper); sl@0: sl@0: sl@0: sl@0: bool result1 = (use_facet > ( loc1 ).narrow sl@0: (wstring3, wstring3 + wcslen(wstring3), 'X', &str2[0] ) != 0); sl@0: sl@0: bool result2 = (use_facet > ( loc1 ).narrow sl@0: (string3, string3 + strlen(string3), 'X', &str2[0] ) != 0); sl@0: sl@0: const ctype_base::mask* _get_classic_table(); sl@0: const unsigned char* _get_S_upper_table(); sl@0: const unsigned char* _get_S_lower_table(); sl@0: void Dummy_API(void); sl@0: // ctype::narrow(to_upper,test); sl@0: sl@0: //char ctype::do_narrow(char __c, char /* dfault */ ) sl@0: #if STDCPP_OOM sl@0: User::__DbgSetAllocFail(FALSE,RHeap::ENone,1); sl@0: #endif sl@0: sl@0: //__UHEAP_MARKEND; sl@0: /* sl@0: if(result) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: */ sl@0: sl@0: sl@0: } sl@0: sl@0: sl@0: catch(bad_alloc&) sl@0: { sl@0: //do nothing sl@0: } sl@0: catch(...) sl@0: { sl@0: failures++; sl@0: sl@0: } sl@0: sl@0: if(failures ) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: } sl@0: