49 #include "mdscommoninternal.h" |
49 #include "mdscommoninternal.h" |
50 |
50 |
51 const TInt KMdsMaxUriLenght = KMaxFileName; |
51 const TInt KMdsMaxUriLenght = KMaxFileName; |
52 const TChar KMdsLineFeed = '\n'; |
52 const TChar KMdsLineFeed = '\n'; |
53 |
53 |
|
54 #ifdef _DEBUG |
54 const TInt KMdsMaxLogLineLenght( 2056 ); |
55 const TInt KMdsMaxLogLineLenght( 2056 ); |
55 |
56 |
56 _LIT( KMdsErrorLogDirectory, "Metadata" ); |
57 _LIT( KMdsErrorLogDirectory, "Metadata" ); |
57 _LIT( KMdsErrorLogFilename, "importerror.log" ); |
58 _LIT( KMdsErrorLogFilename, "importerror.log" ); |
|
59 #endif |
58 |
60 |
59 // keyword definitions in import file |
61 // keyword definitions in import file |
60 _LIT8( KMdsKeywordComment, "//" ); |
62 _LIT8( KMdsKeywordComment, "//" ); |
61 _LIT8( KMdsKeywordNamespace, "namespace" ); |
63 _LIT8( KMdsKeywordNamespace, "namespace" ); |
62 _LIT8( KMdsKeywordObjectDef, "object" ); |
64 _LIT8( KMdsKeywordObjectDef, "object" ); |
134 iSchema = CMdsSchema::NewL(); |
141 iSchema = CMdsSchema::NewL(); |
135 iConverter = CCnvCharacterSetConverter::NewL(); |
142 iConverter = CCnvCharacterSetConverter::NewL(); |
136 |
143 |
137 User::LeaveIfError( iFs.Connect() ); |
144 User::LeaveIfError( iFs.Connect() ); |
138 iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iFs ); |
145 iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iFs ); |
139 |
146 |
140 User::LeaveIfError( iLog.Connect( ) ); |
147 #ifdef _DEBUG |
141 iLog.CreateLog( KMdsErrorLogDirectory, KMdsErrorLogFilename, EFileLoggingModeOverwrite ); |
148 const TInt logError( iLog.Connect( ) ); |
142 iLog.SetDateAndTime(EFalse, ETrue); |
149 if( logError == KErrNone ) |
|
150 { |
|
151 iLogEnabled = ETrue; |
|
152 iLog.CreateLog( KMdsErrorLogDirectory, KMdsErrorLogFilename, EFileLoggingModeOverwrite ); |
|
153 iLog.SetDateAndTime(EFalse, ETrue); |
|
154 } |
|
155 #endif |
143 |
156 |
144 iBuffer = NULL; |
157 iBuffer = NULL; |
145 iLastObjectDef = NULL; |
158 iLastObjectDef = NULL; |
146 } |
159 } |
147 |
160 |
2472 |
2485 |
2473 // ------------------------------------------------ |
2486 // ------------------------------------------------ |
2474 // LogError |
2487 // LogError |
2475 // ------------------------------------------------ |
2488 // ------------------------------------------------ |
2476 // |
2489 // |
|
2490 #ifdef _DEBUG |
2477 void CMdsImportExport::LogError( const TDesC& aMessage ) |
2491 void CMdsImportExport::LogError( const TDesC& aMessage ) |
2478 { |
2492 { |
2479 _LIT( KParseError, "Parse error: %S" ); |
2493 if( iLogEnabled ) |
2480 _LIT( KCurrentFile, "Current file: %S" ); |
2494 { |
2481 _LIT( KCurrentLineNum, "Current line number: %d" ); |
2495 _LIT( KParseError, "Parse error: %S" ); |
2482 _LIT( KCurrentLine, "Current line: %S" ); |
2496 _LIT( KCurrentFile, "Current file: %S" ); |
2483 iLog.WriteFormat( KParseError, &aMessage ); |
2497 _LIT( KCurrentLineNum, "Current line number: %d" ); |
2484 iLog.WriteFormat( KCurrentFile, &iFileName ); |
2498 _LIT( KCurrentLine, "Current line: %S" ); |
2485 iLog.WriteFormat( KCurrentLineNum, iLineNumber ); |
2499 iLog.WriteFormat( KParseError, &aMessage ); |
2486 TBuf16<KMdsMaxLogLineLenght> line16; |
2500 iLog.WriteFormat( KCurrentFile, &iFileName ); |
2487 Conv8To16( iLine, line16 ); |
2501 iLog.WriteFormat( KCurrentLineNum, iLineNumber ); |
2488 iLog.WriteFormat( KCurrentLine, &line16 ); |
2502 TBuf16<KMdsMaxLogLineLenght> line16; |
|
2503 Conv8To16( iLine, line16 ); |
|
2504 iLog.WriteFormat( KCurrentLine, &line16 ); |
|
2505 } |
2489 } |
2506 } |
|
2507 #else |
|
2508 void CMdsImportExport::LogError( const TDesC& /*aMessage*/ ) |
|
2509 { |
|
2510 } |
|
2511 #endif |
2490 |
2512 |
2491 |
2513 |
2492 // ------------------------------------------------ |
2514 // ------------------------------------------------ |
2493 // CheckForConstant |
2515 // CheckForConstant |
2494 // ------------------------------------------------ |
2516 // ------------------------------------------------ |