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: // 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: #define testChar unsigned char sl@0: 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: 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: sl@0: ENTRY( "ctype_byname1", Ctlocale::ctype_byname1L), sl@0: ENTRY( "moneypunct_byname1", Ctlocale::moneypunct_byname1L), sl@0: ENTRY( "moneypunct1", Ctlocale::moneypunct1L), sl@0: ENTRY( "numpunct1", Ctlocale::numpunct1L), sl@0: ENTRY( "numpunct_byname1", Ctlocale::numpunct_byname1L), 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: __UHEAP_MARK; sl@0: try sl@0: { sl@0: sl@0: sl@0: bool result = 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: sl@0: sl@0: locale loc("en_GB.UTF-8") ; sl@0: result = 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: } 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: __UHEAP_MARKEND; 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: #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: } 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; 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 &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: 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; 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: #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: 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; 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: __UHEAP_MARKEND; 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: __UHEAP_MARKEND; 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: const moneypunct& mp = sl@0: 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: 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: } 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: 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: 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: 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: 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: #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: 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: 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: #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: __UHEAP_MARK; sl@0: sl@0: locale loc ( "de_DE.ISO-8859-1" ); 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: __UHEAP_MARKEND; 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: __UHEAP_MARK; sl@0: sl@0: locale loc ( "de_DE.ISO-8859-1" ); 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: __UHEAP_MARKEND; 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: sl@0: sl@0: // helper API sl@0: template sl@0: void Convert_string2_string_chart(basic_string<_CharT> &dst, string src) sl@0: { sl@0: int length = src.length(); sl@0: const char* str = src.c_str(); sl@0: for(int i = 0; i { sl@0: MyCtype_bybname(const char *name, size_t refs) sl@0: : ctype_byname(name, refs) {} sl@0: testChar my_do_toupper(testChar ch) const sl@0: {return (this->do_toupper(ch)); } sl@0: const testChar *my_do_toupper(testChar *first, sl@0: const testChar *last) const sl@0: {return (this->do_toupper(first, last)); } sl@0: testChar my_do_tolower(testChar ch) const sl@0: {return (this->do_tolower(ch)); } sl@0: const testChar *my_do_tolower(testChar *first, sl@0: const testChar *last) const sl@0: {return (this->do_tolower(first, last)); } sl@0: }; sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::ExampleL sl@0: // Example test method function. sl@0: // (other items were commented in a header). sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: TInt Ctlocale::ctype_byname1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test1" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: MyCtype_bybname fac("C", 1); sl@0: sl@0: if (fac.my_do_toupper('a') != 'A') sl@0: return KErrGeneral; sl@0: sl@0: testChar a[] = {"ABc0D"}; sl@0: fac.my_do_tolower(a, a + 2); sl@0: if (strcmp((const char *)a, "abc0D") != 0) sl@0: return KErrGeneral; sl@0: sl@0: return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::moneypunct_byname_test3L sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: struct Mympunct_byname : public moneypunct_byname { sl@0: Mympunct_byname(const char *name, size_t refs) sl@0: : moneypunct_byname(name, refs) {} sl@0: testChar my_do_decimal_point() const sl@0: {return (do_decimal_point()); } sl@0: }; sl@0: sl@0: TInt Ctlocale::moneypunct_byname1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test3" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: Mympunct_byname fac("C", 1); sl@0: testChar ch = fac.my_do_decimal_point(); sl@0: if (ch != 0) sl@0: return KErrGeneral; sl@0: return KErrNone; sl@0: sl@0: sl@0: } sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::moneypunct_test2L sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: struct Mymoneypunct : public moneypunct { sl@0: string_type my_do_positive_sign() const sl@0: {return (do_positive_sign()); } sl@0: }; sl@0: sl@0: TInt Ctlocale::moneypunct1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test2" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: Mymoneypunct fac; sl@0: basic_string str = fac.my_do_positive_sign(); sl@0: if(str.size() != 0) sl@0: return KErrGeneral; sl@0: sl@0: return KErrNone; sl@0: sl@0: } sl@0: sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::numpunct_test4L sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: struct Mynumpunct : public numpunct { sl@0: protected: sl@0: basic_string do_truename() const sl@0: { basic_string str1; sl@0: Convert_string2_string_chart(str1,"!"); sl@0: return str1; } sl@0: basic_string do_falsename() const sl@0: { sl@0: basic_string str1; sl@0: Convert_string2_string_chart(str1,"!!"); sl@0: return str1; } sl@0: }; sl@0: sl@0: TInt Ctlocale::numpunct1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test4" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: Mynumpunct fac; sl@0: sl@0: basic_string str = fac.truename(); sl@0: if (strcmp((char*)str.c_str(), "!") != 0) sl@0: return KErrGeneral; sl@0: sl@0: str = fac.falsename(); sl@0: if (strcmp((char*)str.c_str(), "!!") != 0) sl@0: return KErrGeneral; sl@0: sl@0: return KErrNone; sl@0: sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::numpunct_byname_test5L sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: struct Mynumpunct_byname : public numpunct_byname { sl@0: Mynumpunct_byname(const char *name, size_t refs) sl@0: : numpunct_byname(name, refs) {} sl@0: string_type my_do_truename() const sl@0: {return (do_truename()); } sl@0: }; sl@0: sl@0: TInt Ctlocale::numpunct_byname1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test5" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: const Mynumpunct_byname fac("C", 1); sl@0: basic_string str = fac.my_do_truename(); sl@0: if(strcmp((char*)str.c_str(),"true") !=0) sl@0: return KErrGeneral; sl@0: sl@0: return KErrNone; sl@0: sl@0: } sl@0: #endif sl@0: sl@0: #if 0 sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Ctlocale::num_get_test6L sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: typedef char_traits mycharite; sl@0: typedef istreambuf_iterator myistrite; sl@0: sl@0: struct Mynum_get : public num_get { sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, bool& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, long& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, unsigned long& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, double& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: #ifndef __SYMBIAN32__ sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, long double& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: #endif sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, unsigned short& val) const // [NOV95] sl@0: {return (do_get(first, last, str, st, val)); } sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, unsigned int& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: iter_type my_do_get(iter_type first, iter_type last, ios_base& str, sl@0: ios_base::iostate& st, float& val) const sl@0: {return (do_get(first, last, str, st, val)); } sl@0: }; sl@0: sl@0: TInt Ctlocale::num_get1L( CStifItemParser& aItem ) sl@0: { sl@0: sl@0: // Print to UI sl@0: _LIT( Ktlocale, "tlocale" ); sl@0: _LIT( Ktest1, "In Test6" ); sl@0: TestModuleIf().Printf( 0, Ktlocale, Ktest1 ); sl@0: // Print to log file sl@0: iLog->Log( Ktest1 ); sl@0: sl@0: TInt i = 0; sl@0: TPtrC string; sl@0: _LIT( KParam, "Param[%i]: %S" ); sl@0: sl@0: Mynum_get fac; sl@0: basic_string str1; sl@0: Convert_string2_string_chart(str1,"1V-2W3X4.00Y6A7B-8.C"); sl@0: locale loc; sl@0: basic_istringstream istr(str1); sl@0: myistrite first(istr.rdbuf()), last; sl@0: bool bv = false; sl@0: ios_base::iostate st = ios_base::goodbit; sl@0: first = fac.my_do_get(first, last, istr, st, bv); sl@0: if (!bv); sl@0: return KErrGeneral; sl@0: if ((char)*first!= 'V'); sl@0: return KErrGeneral; sl@0: sl@0: sl@0: return KErrNone; sl@0: sl@0: } sl@0: sl@0: #endif sl@0: sl@0: // End of File sl@0: