00001 /* 00002 * Copyright � 2008 Nokia Corporation. 00003 */ 00004 00005 #ifndef DESCRIPTOREXEXAMPLES_H 00006 #define DESCRIPTOREXEXAMPLES_H 00007 00008 #include <e32std.h> 00009 #include <f32file.h> 00010 00011 //------------------------------------------------------------------------------ 00018 class MResultViewer 00019 { 00020 public: 00025 virtual TPtr GetViewBuffer()=0; 00026 00033 virtual void UpdateView()=0; 00034 }; 00035 00036 //------------------------------------------------------------------------------ 00041 class CDescriptorExamples 00042 { 00043 public: 00044 00053 CDescriptorExamples(MResultViewer *aViewer) : iViewer(aViewer) {}; 00054 00055 //---------------------------------------------------------------------- 00056 // Methods below are implemented in DeclaringDescriptors.cpp 00057 00066 void ToStack(); 00067 00072 void ToHeapL(); 00073 00082 void Literals(); 00083 00084 //---------------------------------------------------------------------- 00085 // Methods below are implemented in ManipulatingDescriptors.cpp 00086 00091 void NonModifyingMethods(); 00092 00097 void ModifyingMethodsL(); 00098 00104 void CharacterConversionsL(); 00105 00110 void LexicalAnalysis(); 00111 00112 //---------------------------------------------------------------------- 00113 // Methods below are implemented in OtherBuffers.cpp 00114 00125 void CircularBuffersL(); 00126 00142 void FlatDynamicBuffersL(); 00143 00158 void SegmentedDynamicBuffersL(); 00159 00174 void PackageBuffers(); 00175 00176 00184 void RBufDemonstrations(); 00185 00186 private: // attributes 00187 00188 MResultViewer* iViewer; // not owned, just referred 00189 00190 }; 00191 00192 //------------------------------------------------------------------------------ 00199 //PK:TODO: 00200 #ifdef __SERIES60_3X__ 00201 _LIT( KDefaultLogFile, "c:\\Data\\descriptorEx.log.txt" ); 00202 #else 00203 _LIT( KDefaultLogFile, "c:\\Nokia\\descriptorEx.log.txt" ); 00204 #endif 00205 00206 class CFileForwarder : public CBase, public MResultViewer 00207 { 00208 public: 00209 00217 void ConstructL(const TDesC &logFileName=KDefaultLogFile); 00218 00223 virtual TPtr GetViewBuffer(); 00224 00229 virtual void UpdateView(); 00230 00231 private: 00232 00236 virtual ~CFileForwarder(); 00237 00238 private: 00239 RFs iFsSession; 00240 RFile iFile; 00241 HBufC *iBuf; 00242 }; 00243 00244 #endif // DESCRIPTOREXEXAMPLES_H