|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Handles log writing. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CBCTESTSTREMLOGGER_H |
|
20 #define C_CBCTESTSTREMLOGGER_H |
|
21 |
|
22 #include <eikenv.h> |
|
23 #include <e32const.h> |
|
24 |
|
25 #define LOG CBCTestStreamLogger::BeginLC() |
|
26 |
|
27 _LIT(KLogFileName, "c:\\bctestLog\\summary.log"); // main log file |
|
28 |
|
29 /** |
|
30 * CBCTestLauncherApp application class. |
|
31 * Provides factory to create concrete document object. |
|
32 */ |
|
33 class CBCTestStreamLogger : public CBase |
|
34 { |
|
35 public: |
|
36 // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 static CBCTestStreamLogger& BeginLC( |
|
42 const TDesC& aFileName = KLogFileName ); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CBCTestStreamLogger(); |
|
48 |
|
49 // New methods |
|
50 |
|
51 /** |
|
52 * Suicide self |
|
53 */ |
|
54 void Suicide(); |
|
55 |
|
56 /** |
|
57 * stream a string out |
|
58 * @param aText, the text u want to stream out |
|
59 */ |
|
60 CBCTestStreamLogger& operator<<(const TDesC& aText); |
|
61 |
|
62 /** |
|
63 * stream a number out |
|
64 * @param aNum, the number u wnat to stream out |
|
65 */ |
|
66 CBCTestStreamLogger& operator<<(TInt aNum); |
|
67 |
|
68 /** |
|
69 * stream out a new line |
|
70 */ |
|
71 CBCTestStreamLogger& CRL(); |
|
72 |
|
73 /** |
|
74 * stream manipulator dispatcher |
|
75 * @param aOp, the manipulator function pointer |
|
76 */ |
|
77 typedef CBCTestStreamLogger& (*Manipulator)( CBCTestStreamLogger& ); |
|
78 CBCTestStreamLogger& operator<<(Manipulator aOp); |
|
79 |
|
80 private: |
|
81 |
|
82 /** |
|
83 * C++ default constructor. disable it! |
|
84 */ |
|
85 CBCTestStreamLogger(); |
|
86 |
|
87 /** |
|
88 * Symbian 2nd phase ctor |
|
89 */ |
|
90 void ConstructL(const TDesC& aFileName); |
|
91 |
|
92 // data |
|
93 TBuf<KMaxPath> iFileName; |
|
94 }; |
|
95 |
|
96 namespace BCTest |
|
97 { |
|
98 CBCTestStreamLogger& End(CBCTestStreamLogger& self); |
|
99 CBCTestStreamLogger& EndLine(CBCTestStreamLogger& self); |
|
100 } |
|
101 |
|
102 #endif //C_CBCTESTSTREMLOGGER_H |
|
103 |