equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
121 const std::wstring& fileName = aParamList.ConfigFileName(); |
121 const std::wstring& fileName = aParamList.ConfigFileName(); |
122 |
122 |
123 if ( FileExists( fileName ) ) |
123 if ( FileExists( fileName ) ) |
124 { |
124 { |
125 std::string fName; |
125 std::string fName; |
126 fName = Ucs2ToUtf8( fileName ); |
126 fName = wstring2string( fileName ); |
127 // |
127 // |
128 std::ifstream stream; |
128 std::ifstream stream; |
129 stream.open( fName.c_str(), std::ios::binary ); |
129 stream.open( fName.c_str(), std::ios::binary ); |
130 // |
130 // |
131 try |
131 try |
380 // relevant to interpretsis. |
380 // relevant to interpretsis. |
381 // Instead a warning is produced. |
381 // Instead a warning is produced. |
382 std::ostringstream stream; |
382 std::ostringstream stream; |
383 stream << "Unsupported keyword at line " << aLineNumber << " of ini file [" << aKey << " = " << aValue << "] "; |
383 stream << "Unsupported keyword at line " << aLineNumber << " of ini file [" << aKey << " = " << aValue << "] "; |
384 stream << std::endl; |
384 stream << std::endl; |
385 std::wstring finalMessage = Utf8ToUcs2( stream.str() ); |
385 std::wstring finalMessage = string2wstring( stream.str() ); |
386 LWARN( finalMessage ); |
386 LWARN( finalMessage ); |
387 } |
387 } |
388 } |
388 } |
389 |
389 |
390 |
390 |
396 for( int i=0; i<attributeCount; i++ ) |
396 for( int i=0; i<attributeCount; i++ ) |
397 { |
397 { |
398 if ( KConfigAttributes[i].iId == aId ) |
398 if ( KConfigAttributes[i].iId == aId ) |
399 { |
399 { |
400 std::wstring entry( KConfigAttributes[i].iName ); |
400 std::wstring entry( KConfigAttributes[i].iName ); |
401 ret = Ucs2ToUtf8( entry ); |
401 ret = wstring2string( entry ); |
402 } |
402 } |
403 } |
403 } |
404 // |
404 // |
405 return ret; |
405 return ret; |
406 } |
406 } |
409 const ConfigAttribute* ConfigManager::AttributeByName( const std::string& aName ) |
409 const ConfigAttribute* ConfigManager::AttributeByName( const std::string& aName ) |
410 { |
410 { |
411 std::string upperCased( aName ); |
411 std::string upperCased( aName ); |
412 upperCased = StringUtils::ToUpper( upperCased ); |
412 upperCased = StringUtils::ToUpper( upperCased ); |
413 std::wstring searchFor; |
413 std::wstring searchFor; |
414 searchFor = Utf8ToUcs2( upperCased ); |
414 searchFor = string2wstring( upperCased ); |
415 // |
415 // |
416 const int attributeCount = sizeof( KConfigAttributes ) / sizeof( ConfigAttribute ); |
416 const int attributeCount = sizeof( KConfigAttributes ) / sizeof( ConfigAttribute ); |
417 const ConfigAttribute* ret = NULL; |
417 const ConfigAttribute* ret = NULL; |
418 // |
418 // |
419 for( int i=0; i<attributeCount; i++ ) |
419 for( int i=0; i<attributeCount; i++ ) |
510 { |
510 { |
511 return 0; |
511 return 0; |
512 } |
512 } |
513 |
513 |
514 // Set the drive representation location |
514 // Set the drive representation location |
515 Utf8ToUcs2(std::string(it, (currentPos-it)), aDrive->iDir); |
515 aDrive->iDir = string2wstring(std::string(it, (currentPos-it))); |
516 |
516 |
517 temp = StringUtils::TrimWhiteSpace( std::string(currentPos, end) ); |
517 temp = StringUtils::TrimWhiteSpace( std::string(currentPos, end) ); |
518 |
518 |
519 it = temp.begin(); |
519 it = temp.begin(); |
520 end = temp.end(); |
520 end = temp.end(); |
612 if (it != iDrives.end()) |
612 if (it != iDrives.end()) |
613 { |
613 { |
614 char drive = aDrive; |
614 char drive = aDrive; |
615 std::stringstream warn; |
615 std::stringstream warn; |
616 warn << "Redefining drive: " << drive; |
616 warn << "Redefining drive: " << drive; |
617 std::wstring finalMessage = Utf8ToUcs2( warn.str() ); |
617 std::wstring finalMessage = string2wstring( warn.str() ); |
618 LWARN( finalMessage + L" to " + aDir); |
618 LWARN( finalMessage + L" to " + aDir); |
619 |
619 |
620 delete it->second; |
620 delete it->second; |
621 iDrives.erase(it); |
621 iDrives.erase(it); |
622 } |
622 } |
685 break; |
685 break; |
686 case ETypeInvalidDirectory: |
686 case ETypeInvalidDirectory: |
687 stream << "\'" << iValue << "\'" << " directory is not found"; |
687 stream << "\'" << iValue << "\'" << " directory is not found"; |
688 break; |
688 break; |
689 case ETypeDriveError: |
689 case ETypeDriveError: |
690 LERROR( Utf8ToUcs2( iValue ) ); |
690 LERROR( string2wstring( iValue ) ); |
691 return; |
691 return; |
692 |
692 |
693 default: |
693 default: |
694 stream << "Unknown error"; |
694 stream << "Unknown error"; |
695 break; |
695 break; |
696 } |
696 } |
697 // |
697 // |
698 stream << std::endl; |
698 stream << std::endl; |
699 std::wstring finalMessage = Utf8ToUcs2( stream.str() ); |
699 std::wstring finalMessage = string2wstring( stream.str() ); |
700 // |
700 // |
701 LERROR( finalMessage ); |
701 LERROR( finalMessage ); |
702 } |
702 } |
703 |
703 |