00001 /* 00002 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * * Redistributions of source code must retain the above copyright notice, this 00008 * list of conditions and the following disclaimer. 00009 * * Redistributions in binary form must reproduce the above copyright notice, 00010 * this list of conditions and the following disclaimer in the documentation 00011 * and/or other materials provided with the distribution. 00012 * * Neither the name of Nokia Corporation nor the names of its contributors 00013 * may be used to endorse or promote products derived from this software 00014 * without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00020 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00021 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00023 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00024 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 * 00027 * Description: 00028 */ 00029 00030 00031 #ifndef DESCRIPTOREXEXAMPLES_H 00032 #define DESCRIPTOREXEXAMPLES_H 00033 00034 #include <e32std.h> 00035 #include <f32file.h> 00036 00037 //------------------------------------------------------------------------------ 00044 class MResultViewer 00045 { 00046 public: 00051 virtual TPtr GetViewBuffer()=0; 00052 00059 virtual void UpdateView()=0; 00060 }; 00061 00062 //------------------------------------------------------------------------------ 00067 class CDescriptorExamples 00068 { 00069 public: 00070 00079 CDescriptorExamples(MResultViewer *aViewer) : iViewer(aViewer) {}; 00080 00081 //---------------------------------------------------------------------- 00082 // Methods below are implemented in DeclaringDescriptors.cpp 00083 00092 void ToStack(); 00093 00098 void ToHeapL(); 00099 00108 void Literals(); 00109 00110 //---------------------------------------------------------------------- 00111 // Methods below are implemented in ManipulatingDescriptors.cpp 00112 00117 void NonModifyingMethods(); 00118 00123 void ModifyingMethodsL(); 00124 00130 void CharacterConversionsL(); 00131 00136 void LexicalAnalysis(); 00137 00138 //---------------------------------------------------------------------- 00139 // Methods below are implemented in OtherBuffers.cpp 00140 00151 void CircularBuffersL(); 00152 00168 void FlatDynamicBuffersL(); 00169 00184 void SegmentedDynamicBuffersL(); 00185 00200 void PackageBuffers(); 00201 00202 00210 void RBufDemonstrations(); 00211 00212 private: // attributes 00213 00214 MResultViewer* iViewer; // not owned, just referred 00215 00216 }; 00217 00218 //------------------------------------------------------------------------------ 00225 //PK:TODO: 00226 #ifdef __SERIES60_3X__ 00227 _LIT( KDefaultLogFile, "c:\\Data\\descriptorEx.log.txt" ); 00228 #else 00229 _LIT( KDefaultLogFile, "c:\\Nokia\\descriptorEx.log.txt" ); 00230 #endif 00231 00232 class CFileForwarder : public CBase, public MResultViewer 00233 { 00234 public: 00235 00243 void ConstructL(const TDesC &logFileName=KDefaultLogFile); 00244 00249 virtual TPtr GetViewBuffer(); 00250 00255 virtual void UpdateView(); 00256 00257 private: 00258 00262 virtual ~CFileForwarder(); 00263 00264 private: 00265 RFs iFsSession; 00266 RFile iFile; 00267 HBufC *iBuf; 00268 }; 00269 00270 #endif // DESCRIPTOREXEXAMPLES_H