00001 00002 /**************************************************************************** 00003 ** 00004 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 00005 ** All rights reserved. 00006 ** Contact: Nokia Corporation 00007 ** 00008 ** 00009 ** $QT_BEGIN_LICENSE:BSD$ 00010 ** You may use this file under the terms of the BSD license as follows: 00011 ** 00012 ** "Redistribution and use in source and binary forms, with or without 00013 ** modification, are permitted provided that the following conditions are 00014 ** met: 00015 ** * Redistributions of source code must retain the above copyright 00016 ** notice, this list of conditions and the following disclaimer. 00017 ** * Redistributions in binary form must reproduce the above copyright 00018 ** notice, this list of conditions and the following disclaimer in 00019 ** the documentation and/or other materials provided with the 00020 ** distribution. 00021 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 00022 ** the names of its contributors may be used to endorse or promote 00023 ** products derived from this software without specific prior written 00024 ** permission. 00025 ** 00026 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00027 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00028 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00029 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00030 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00031 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00032 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00033 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00034 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00035 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00036 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 00037 ** $QT_END_LICENSE$ 00038 ** 00039 ****************************************************************************/ 00040 00041 00042 00043 // System Include. 00044 #include <e32def.h> 00045 00047 #include "descriptors.h" 00048 00052 Descriptors::Descriptors() 00053 { 00054 iBuffer = HBufC::NewL(4096); 00055 d_ptr = new (ELeave) CDescriptorExamples( this ); 00056 } 00057 00061 Descriptors::~Descriptors() 00062 { 00063 delete d_ptr; 00064 d_ptr = NULL; 00065 00066 delete iBuffer; 00067 iBuffer = NULL; 00068 } 00069 00074 TPtr Descriptors::GetViewBuffer() 00075 { 00076 return iBuffer->Des(); 00077 } 00078 00083 void Descriptors::UpdateView() 00084 { 00085 QString msg((QChar*)iBuffer->Des().Ptr(),iBuffer->Length()); 00086 message = msg; 00087 emit printMessage(); 00088 } 00089 00093 QString Descriptors::showResponse() 00094 { 00095 return message; 00096 } 00097 00102 void Descriptors::createOnStack() 00103 { 00104 iBuffer->Des().SetLength(0); 00105 d_ptr->OnStack(); 00106 } 00107 00112 void Descriptors::createOnHeap() 00113 { 00114 iBuffer->Des().SetLength(0); 00115 d_ptr->OnHeapL(); 00116 } 00117 00121 void Descriptors::createLiterals() 00122 { 00123 iBuffer->Des().SetLength(0); 00124 d_ptr->Literals(); 00125 } 00126 00131 void Descriptors::callNonModifyingMethods() 00132 { 00133 iBuffer->Des().SetLength(0); 00134 d_ptr->NonModifyingMethods(); 00135 } 00136 00141 void Descriptors::callModifyingMethods() 00142 { 00143 iBuffer->Des().SetLength(0); 00144 d_ptr->ModifyingMethodsL(); 00145 } 00146 00151 void Descriptors::callCharacterConversions() 00152 { 00153 iBuffer->Des().SetLength(0); 00154 d_ptr->CharacterConversionsL(); 00155 } 00156 00161 void Descriptors::doLexicalAnalysis() 00162 { 00163 iBuffer->Des().SetLength(0); 00164 d_ptr->LexicalAnalysis(); 00165 } 00166 00171 void Descriptors::useCircularBuffers() 00172 { 00173 iBuffer->Des().SetLength(0); 00174 d_ptr->CircularBuffersL(); 00175 } 00176 00181 void Descriptors::useFlatDynamicBuffers() 00182 { 00183 iBuffer->Des().SetLength(0); 00184 d_ptr->FlatDynamicBuffersL(); 00185 } 00186 00191 void Descriptors::useSegmentedDynamicBuffers() 00192 { 00193 iBuffer->Des().SetLength(0); 00194 d_ptr->SegmentedDynamicBuffersL(); 00195 } 00196 00201 void Descriptors::usePackageBuffers() 00202 { 00203 iBuffer->Des().SetLength(0); 00204 d_ptr->PackageBuffers(); 00205 } 00206 00210 void Descriptors::callRBufDemonstrations() 00211 { 00212 iBuffer->Des().SetLength(0); 00213 d_ptr->RBufDemonstrations(); 00214 }