Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_infunct_8cpp-source.html
changeset 1 25a17d01db0c
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
       
     2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
       
     3 <title>TB10.1 Example Applications: examples/Base/BufsAndStrings/Desc/InFunct/Infunct.cpp Source File</title>
       
     4 <link href="doxygen.css" rel="stylesheet" type="text/css">
       
     5 <link href="tabs.css" rel="stylesheet" type="text/css">
       
     6 </head><body>
       
     7 <!-- Generated by Doxygen 1.5.3 -->
       
     8 <h1>examples/Base/BufsAndStrings/Desc/InFunct/Infunct.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).</span>
       
     9 <a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span>
       
    10 <a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span>
       
    11 <a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span>
       
    12 <a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span>
       
    13 <a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span>
       
    14 <a name="l00007"></a>00007 <span class="comment">//</span>
       
    15 <a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span>
       
    16 <a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span>
       
    17 <a name="l00010"></a>00010 <span class="comment">//</span>
       
    18 <a name="l00011"></a>00011 <span class="comment">// Contributors:</span>
       
    19 <a name="l00012"></a>00012 <span class="comment">//</span>
       
    20 <a name="l00013"></a>00013 <span class="comment">// Description:</span>
       
    21 <a name="l00014"></a>00014 <span class="comment">// Examples to demonstrate the use of descriptors in function interfaces.</span>
       
    22 <a name="l00015"></a>00015 <span class="comment">//</span>
       
    23 <a name="l00016"></a>00016 
       
    24 <a name="l00017"></a>00017 <span class="preprocessor">#include "CommonFramework.h"</span>
       
    25 <a name="l00018"></a>00018 
       
    26 <a name="l00019"></a>00019 <span class="comment">//</span>
       
    27 <a name="l00020"></a>00020 <span class="comment">// Literal text</span>
       
    28 <a name="l00021"></a>00021 <span class="comment">//</span>
       
    29 <a name="l00022"></a>00022 
       
    30 <a name="l00023"></a>00023 _LIT(KDataTPtrC,<span class="stringliteral">"A TPtrC descriptor"</span>);
       
    31 <a name="l00024"></a>00024 _LIT(KDataTPtr,<span class="stringliteral">"A TPtr descriptor"</span>);
       
    32 <a name="l00025"></a>00025 _LIT(KDataTBufC,<span class="stringliteral">"A TBufC descriptor"</span>);
       
    33 <a name="l00026"></a>00026 _LIT(KDataTBuf,<span class="stringliteral">"A TBuf descriptor"</span>);
       
    34 <a name="l00027"></a>00027 _LIT(KDataHBufC,<span class="stringliteral">"An HBufC descriptor"</span>);
       
    35 <a name="l00028"></a>00028 
       
    36 <a name="l00029"></a>00029 <span class="comment">//</span>
       
    37 <a name="l00030"></a>00030 <span class="comment">// Common format strings</span>
       
    38 <a name="l00031"></a>00031 <span class="comment">//</span>
       
    39 <a name="l00032"></a>00032 
       
    40 <a name="l00033"></a>00033 _LIT(KCommonFormat2,<span class="stringliteral">"0x%02x "</span>);
       
    41 <a name="l00034"></a>00034 
       
    42 <a name="l00035"></a>00035 <span class="comment">// A set of functions called by the example code</span>
       
    43 <a name="l00036"></a>00036 LOCAL_C <span class="keywordtype">void</span> StringRead(<span class="keyword">const</span> TDesC&amp; aString); 
       
    44 <a name="l00037"></a>00037 LOCAL_C <span class="keywordtype">void</span> StringWrite(TDes&amp; aString);       
       
    45 <a name="l00038"></a>00038 LOCAL_C <span class="keywordtype">void</span> BufferRead(<span class="keyword">const</span> TDesC8&amp; aBuffer); 
       
    46 <a name="l00039"></a>00039 LOCAL_C <span class="keywordtype">void</span> BufferWrite(TDes8&amp; aBuffer);       
       
    47 <a name="l00040"></a>00040                  
       
    48 <a name="l00041"></a>00041 <span class="comment">// Do the example</span>
       
    49 <a name="l00042"></a>00042 LOCAL_C <span class="keywordtype">void</span> doExampleL()
       
    50 <a name="l00043"></a>00043     {                              
       
    51 <a name="l00044"></a>00044                                 <span class="comment">// We create four functions:</span>
       
    52 <a name="l00045"></a>00045                                 <span class="comment">// StringRead()</span>
       
    53 <a name="l00046"></a>00046                                 <span class="comment">// StringWrite()</span>
       
    54 <a name="l00047"></a>00047                                 <span class="comment">// BufferRead()</span>
       
    55 <a name="l00048"></a>00048                                 <span class="comment">// BufferWrite() </span>
       
    56 <a name="l00049"></a>00049                                 <span class="comment">// to illustrate the use of descriptors</span>
       
    57 <a name="l00050"></a>00050                                 <span class="comment">// in function interfaces       </span>
       
    58 <a name="l00051"></a>00051         
       
    59 <a name="l00052"></a>00052     TText      area[48]; 
       
    60 <a name="l00053"></a>00053         TPtrC      ptrc;
       
    61 <a name="l00054"></a>00054     TPtr       ptr(&amp;area[0],48);
       
    62 <a name="l00055"></a>00055 
       
    63 <a name="l00056"></a>00056     TBufC&lt;48&gt;  bufc;
       
    64 <a name="l00057"></a>00057         TBuf&lt;48&gt;   buf;
       
    65 <a name="l00058"></a>00058         HBufC*     hbufcptr;
       
    66 <a name="l00059"></a>00059 
       
    67 <a name="l00060"></a>00060         hbufcptr = HBufC::NewL(48);
       
    68 <a name="l00061"></a>00061 
       
    69 <a name="l00062"></a>00062                                 <span class="comment">// Set up some data     for our</span>
       
    70 <a name="l00063"></a>00063                                 <span class="comment">// descriptors</span>
       
    71 <a name="l00064"></a>00064         ptrc.Set(KDataTPtrC);    <span class="comment">// "A TPtrC descriptor"        </span>
       
    72 <a name="l00065"></a>00065         ptr       = KDataTPtr;   <span class="comment">// "A TPtr descriptor"</span>
       
    73 <a name="l00066"></a>00066         bufc      = KDataTBufC;  <span class="comment">// "A TBufC descriptor"</span>
       
    74 <a name="l00067"></a>00067         buf       = KDataTBuf;   <span class="comment">// "A TBuf descriptor"</span>
       
    75 <a name="l00068"></a>00068         *hbufcptr = KDataHBufC;  <span class="comment">//     "An HBufC descriptor"</span>
       
    76 <a name="l00069"></a>00069 
       
    77 <a name="l00070"></a>00070                                 <span class="comment">// We can pass a reference to all</span>
       
    78 <a name="l00071"></a>00071                                 <span class="comment">// descriptor types to StringRead() but the </span>
       
    79 <a name="l00072"></a>00072                                 <span class="comment">// function cannot change the </span>
       
    80 <a name="l00073"></a>00073                                 <span class="comment">// descriptor content </span>
       
    81 <a name="l00074"></a>00074         StringRead(ptrc);                    <span class="comment">// &lt;-- a TPtrC</span>
       
    82 <a name="l00075"></a>00075         StringRead(ptr);                                         <span class="comment">//     &lt;-- a TPtr</span>
       
    83 <a name="l00076"></a>00076         StringRead(bufc);                                        <span class="comment">//     &lt;-- a TBufC</span>
       
    84 <a name="l00077"></a>00077         StringRead(buf);                                         <span class="comment">//     &lt;-- a TBuf</span>
       
    85 <a name="l00078"></a>00078         StringRead(*hbufcptr);                           <span class="comment">//     &lt;-- an HBufC</span>
       
    86 <a name="l00079"></a>00079                                         
       
    87 <a name="l00080"></a>00080                                 <span class="comment">// We can only pass a reference to those</span>
       
    88 <a name="l00081"></a>00081                                 <span class="comment">// descriptors which are derived </span>
       
    89 <a name="l00082"></a>00082                                 <span class="comment">// from TDes, to StringWrite();</span>
       
    90 <a name="l00083"></a>00083                                 <span class="comment">// these are the modifiable</span>
       
    91 <a name="l00084"></a>00084                                 <span class="comment">// descriptors: TPtr and TBuf. </span>
       
    92 <a name="l00085"></a>00085                                 <span class="comment">//</span>
       
    93 <a name="l00086"></a>00086                                 <span class="comment">// The compiler will not permit a reference</span>
       
    94 <a name="l00087"></a>00087                                 <span class="comment">// to any other descriptor type to </span>
       
    95 <a name="l00088"></a>00088                                 <span class="comment">// be passed. </span>
       
    96 <a name="l00089"></a>00089   <span class="comment">//StringWrite(ptrc);                   &lt;-- Illegal</span>
       
    97 <a name="l00090"></a>00090     StringWrite(ptr);                                    <span class="comment">//     &lt;-- a TPtr</span>
       
    98 <a name="l00091"></a>00091   <span class="comment">//StringWrite(bufc);                                   &lt;-- Illegal</span>
       
    99 <a name="l00092"></a>00092         StringWrite(buf);                                        <span class="comment">//     &lt;-- a TBuf</span>
       
   100 <a name="l00093"></a>00093   <span class="comment">//StringWrite(*hbufcptr);                              &lt;-- Illegal</span>
       
   101 <a name="l00094"></a>00094 
       
   102 <a name="l00095"></a>00095         <span class="keyword">delete</span> hbufcptr;
       
   103 <a name="l00096"></a>00096     
       
   104 <a name="l00097"></a>00097         _LIT(KTxtPressToContinue,<span class="stringliteral">" (press any key to continue)\n"</span>);
       
   105 <a name="l00098"></a>00098         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KTxtPressToContinue);
       
   106 <a name="l00099"></a>00099         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Getch();
       
   107 <a name="l00100"></a>00100                                 
       
   108 <a name="l00101"></a>00101         TUint8      data1[3] = {0x00,0x01,0x02};
       
   109 <a name="l00102"></a>00102         TUint8      data2[3] = {0x03,0x04,0x05};
       
   110 <a name="l00103"></a>00103         TUint8      data3[3] = {0x06,0x07,0x08};
       
   111 <a name="l00104"></a>00104         TUint8      data4[3] = {0x09,0x0A,0x0B};
       
   112 <a name="l00105"></a>00105         TUint8      data5[3] = {0x0C,0x0D,0x0E};
       
   113 <a name="l00106"></a>00106                                                       
       
   114 <a name="l00107"></a>00107                                 <span class="comment">// Use the 8 bit variants explicitly for</span>
       
   115 <a name="l00108"></a>00108                                 <span class="comment">// general binary data.</span>
       
   116 <a name="l00109"></a>00109 
       
   117 <a name="l00110"></a>00110                                 <span class="comment">// ptrc8's data area is data1[]</span>
       
   118 <a name="l00111"></a>00111                                 <span class="comment">// ptr8's data areais data2[]</span>
       
   119 <a name="l00112"></a>00112         TPtrC8      ptrc8(&amp;data1[0],3);
       
   120 <a name="l00113"></a>00113         TPtr8       ptr8(&amp;data2[0],3,3);
       
   121 <a name="l00114"></a>00114 
       
   122 <a name="l00115"></a>00115                                 <span class="comment">// bufc8 contains a copy of data3[] data</span>
       
   123 <a name="l00116"></a>00116                                 <span class="comment">// buf8 contains a copy of data4[] data</span>
       
   124 <a name="l00117"></a>00117                                 <span class="comment">// hbufcptr8 contains a copy of data5[] data</span>
       
   125 <a name="l00118"></a>00118     TBufC8&lt;3&gt;  bufc8= TPtrC8(&amp;data3[0],3);
       
   126 <a name="l00119"></a>00119         TBuf8&lt;3&gt;   buf8= TPtrC8(&amp;data4[0],3);
       
   127 <a name="l00120"></a>00120         HBufC8*    hbufcptr8;
       
   128 <a name="l00121"></a>00121 
       
   129 <a name="l00122"></a>00122         hbufcptr8  = HBufC8::NewL(3);
       
   130 <a name="l00123"></a>00123         *hbufcptr8 = TPtrC8(&amp;data5[0],3);
       
   131 <a name="l00124"></a>00124 
       
   132 <a name="l00125"></a>00125                                 <span class="comment">// We can pass a reference to all</span>
       
   133 <a name="l00126"></a>00126                                 <span class="comment">// descriptor types to BufferRead()</span>
       
   134 <a name="l00127"></a>00127                                 <span class="comment">// but the function cannot change the </span>
       
   135 <a name="l00128"></a>00128                                 <span class="comment">// descriptor content </span>
       
   136 <a name="l00129"></a>00129         BufferRead(ptrc8);                   <span class="comment">// &lt;-- a TPtrC</span>
       
   137 <a name="l00130"></a>00130         BufferRead(ptr8);                                        <span class="comment">//     &lt;-- a TPtr</span>
       
   138 <a name="l00131"></a>00131         BufferRead(bufc8);                                       <span class="comment">//     &lt;-- a TBufC</span>
       
   139 <a name="l00132"></a>00132         BufferRead(buf8);                                        <span class="comment">//     &lt;-- a TBuf</span>
       
   140 <a name="l00133"></a>00133         BufferRead(*hbufcptr8);                          <span class="comment">//     &lt;-- an HBufC</span>
       
   141 <a name="l00134"></a>00134         
       
   142 <a name="l00135"></a>00135                                 <span class="comment">// We can only pass a reference to those</span>
       
   143 <a name="l00136"></a>00136                                 <span class="comment">// descriptors which are derived </span>
       
   144 <a name="l00137"></a>00137                                 <span class="comment">// from TDes, to BufferWrite; these are </span>
       
   145 <a name="l00138"></a>00138                                 <span class="comment">// the modifiable descriptors: TPtr and TBuf. </span>
       
   146 <a name="l00139"></a>00139                                 <span class="comment">//</span>
       
   147 <a name="l00140"></a>00140                                 <span class="comment">// The compiler will not permit a reference</span>
       
   148 <a name="l00141"></a>00141                                 <span class="comment">// to any other descriptor type to </span>
       
   149 <a name="l00142"></a>00142                                 <span class="comment">// be passed. </span>
       
   150 <a name="l00143"></a>00143   <span class="comment">//BufferWrite(ptrc8);                  &lt;-- Illegal</span>
       
   151 <a name="l00144"></a>00144     BufferWrite(ptr8);                                   <span class="comment">//     &lt;-- a TPtr</span>
       
   152 <a name="l00145"></a>00145   <span class="comment">//BufferWrite(bufc8);                                  &lt;-- Illegal</span>
       
   153 <a name="l00146"></a>00146         BufferWrite(buf8);                                       <span class="comment">//     &lt;-- a TBuf</span>
       
   154 <a name="l00147"></a>00147   <span class="comment">//BufferWrite(*hbufcptr8);                     &lt;-- Illegal                            </span>
       
   155 <a name="l00148"></a>00148 
       
   156 <a name="l00149"></a>00149         <span class="keyword">delete</span> hbufcptr8;
       
   157 <a name="l00150"></a>00150         }
       
   158 <a name="l00151"></a>00151 
       
   159 <a name="l00152"></a>00152 
       
   160 <a name="l00153"></a>00153 
       
   161 <a name="l00154"></a>00154 <span class="comment">// ************************************************</span>
       
   162 <a name="l00155"></a>00155 <span class="comment">// Functions used by doInterface()</span>
       
   163 <a name="l00156"></a>00156 <span class="comment">// ************************************************</span>
       
   164 <a name="l00157"></a>00157 LOCAL_C <span class="keywordtype">void</span> StringRead(<span class="keyword">const</span> TDesC&amp; aString)
       
   165 <a name="l00158"></a>00158         {
       
   166 <a name="l00159"></a>00159                                 <span class="comment">// A function which handles the content</span>
       
   167 <a name="l00160"></a>00160                                 <span class="comment">// of ANY descriptor passed to it but CANNOT</span>
       
   168 <a name="l00161"></a>00161                                 <span class="comment">// change that descriptor.</span>
       
   169 <a name="l00162"></a>00162                                 <span class="comment">//</span>
       
   170 <a name="l00163"></a>00163                                 <span class="comment">// Function displays descriptor content,</span>
       
   171 <a name="l00164"></a>00164                                 <span class="comment">// length and size.</span>
       
   172 <a name="l00165"></a>00165                                 <span class="comment">//</span>
       
   173 <a name="l00166"></a>00166                                 <span class="comment">// All descriptors can be passed to this </span>
       
   174 <a name="l00167"></a>00167                                 <span class="comment">// function     because all descriptors are </span>
       
   175 <a name="l00168"></a>00168                                 <span class="comment">// ultimately derived from TDesC.</span>
       
   176 <a name="l00169"></a>00169                                 <span class="comment">//</span>
       
   177 <a name="l00170"></a>00170                                 <span class="comment">// Note, however, that all data members and</span>
       
   178 <a name="l00171"></a>00171                                 <span class="comment">// function members in the TDes abstract class</span>
       
   179 <a name="l00172"></a>00172                                 <span class="comment">// cannot be accessed (recall that TDes is </span>
       
   180 <a name="l00173"></a>00173                                 <span class="comment">// derived from TDesC).</span>
       
   181 <a name="l00174"></a>00174                                 <span class="comment">// These include the data member containing </span>
       
   182 <a name="l00175"></a>00175                                 <span class="comment">// the maximum length and all modifying </span>
       
   183 <a name="l00176"></a>00176                                 <span class="comment">// member functions.</span>
       
   184 <a name="l00177"></a>00177         
       
   185 <a name="l00178"></a>00178         _LIT(KFormat5,<span class="stringliteral">"\"%S\"; %d; %d\n"</span>);
       
   186 <a name="l00179"></a>00179         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KFormat5,&amp;aString,aString.Length(),aString.Size());
       
   187 <a name="l00180"></a>00180         }
       
   188 <a name="l00181"></a>00181 
       
   189 <a name="l00182"></a>00182 
       
   190 <a name="l00183"></a>00183 LOCAL_C <span class="keywordtype">void</span> StringWrite(TDes&amp; aString)
       
   191 <a name="l00184"></a>00184         {
       
   192 <a name="l00185"></a>00185                                 <span class="comment">// A function which handles the content</span>
       
   193 <a name="l00186"></a>00186                                 <span class="comment">// of a descriptor derived from TDes;</span>
       
   194 <a name="l00187"></a>00187                                 <span class="comment">// i.e. the modifiable descriptors TPtr and</span>
       
   195 <a name="l00188"></a>00188                                 <span class="comment">// TBuf. </span>
       
   196 <a name="l00189"></a>00189                                 <span class="comment">//</span>
       
   197 <a name="l00190"></a>00190                                 <span class="comment">// Function changes the content of the</span>
       
   198 <a name="l00191"></a>00191                                 <span class="comment">// referenced descriptors and then displays</span>
       
   199 <a name="l00192"></a>00192                                 <span class="comment">// their content, length, size and maximum</span>
       
   200 <a name="l00193"></a>00193                                 <span class="comment">// length.</span>
       
   201 <a name="l00194"></a>00194                                 <span class="comment">//</span>
       
   202 <a name="l00195"></a>00195                                 <span class="comment">// Note that the references to TPtrC, TBufC</span>
       
   203 <a name="l00196"></a>00196                                 <span class="comment">// and HBufC cannot be passed.  </span>
       
   204 <a name="l00197"></a>00197         _LIT(KTxtModStringWrite,<span class="stringliteral">" modified by StringWrite"</span>);                    
       
   205 <a name="l00198"></a>00198     aString.Append(KTxtModStringWrite);
       
   206 <a name="l00199"></a>00199         _LIT(KFormat3,<span class="stringliteral">"\"%S\"; %d; %d; %d\n"</span>);
       
   207 <a name="l00200"></a>00200         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KFormat3,
       
   208 <a name="l00201"></a>00201                     &amp;aString,
       
   209 <a name="l00202"></a>00202                                         aString.Length(),
       
   210 <a name="l00203"></a>00203                                         aString.Size(),
       
   211 <a name="l00204"></a>00204                                         aString.MaxLength()
       
   212 <a name="l00205"></a>00205                                    );
       
   213 <a name="l00206"></a>00206         }
       
   214 <a name="l00207"></a>00207 
       
   215 <a name="l00208"></a>00208 
       
   216 <a name="l00209"></a>00209 LOCAL_C <span class="keywordtype">void</span> BufferRead(<span class="keyword">const</span> TDesC8&amp; aBuffer)
       
   217 <a name="l00210"></a>00210         {
       
   218 <a name="l00211"></a>00211                                 <span class="comment">// A function which handles the content</span>
       
   219 <a name="l00212"></a>00212                                 <span class="comment">// of ANY descriptor passed to it but</span>
       
   220 <a name="l00213"></a>00213                                 <span class="comment">// CANNOT change that descriptor.</span>
       
   221 <a name="l00214"></a>00214                                 <span class="comment">//</span>
       
   222 <a name="l00215"></a>00215                                 <span class="comment">// Function displays descriptor content,</span>
       
   223 <a name="l00216"></a>00216                                 <span class="comment">// length and size.</span>
       
   224 <a name="l00217"></a>00217                                 <span class="comment">//</span>
       
   225 <a name="l00218"></a>00218                                 <span class="comment">// All descriptors can be passed to this </span>
       
   226 <a name="l00219"></a>00219                                 <span class="comment">// function because all descriptors are </span>
       
   227 <a name="l00220"></a>00220                                 <span class="comment">// ultimately derived from TDesC.</span>
       
   228 <a name="l00221"></a>00221                                 <span class="comment">//</span>
       
   229 <a name="l00222"></a>00222                                 <span class="comment">// Note, however, that all data members </span>
       
   230 <a name="l00223"></a>00223                                 <span class="comment">// and function members in the TDes abstract</span>
       
   231 <a name="l00224"></a>00224                                 <span class="comment">// class cannot be accessed (recall that </span>
       
   232 <a name="l00225"></a>00225                                 <span class="comment">// TDes is derived from TDesC).</span>
       
   233 <a name="l00226"></a>00226                                 <span class="comment">// These include the data member containing</span>
       
   234 <a name="l00227"></a>00227                                 <span class="comment">// the maximum length and all modifying</span>
       
   235 <a name="l00228"></a>00228                                 <span class="comment">// member functions.</span>
       
   236 <a name="l00229"></a>00229         <span class="keywordflow">for</span> (TInt ix = 0; ix &lt; aBuffer.Length(); ix++)
       
   237 <a name="l00230"></a>00230                 <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KCommonFormat2,aBuffer[ix]);
       
   238 <a name="l00231"></a>00231         
       
   239 <a name="l00232"></a>00232         _LIT(KFormat4,<span class="stringliteral">"; %d; %d\n"</span>);
       
   240 <a name="l00233"></a>00233         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KFormat4,aBuffer.Length(),aBuffer.Size());      
       
   241 <a name="l00234"></a>00234         }
       
   242 <a name="l00235"></a>00235 
       
   243 <a name="l00236"></a>00236 
       
   244 <a name="l00237"></a>00237 LOCAL_C <span class="keywordtype">void</span> BufferWrite(TDes8&amp; aBuffer)
       
   245 <a name="l00238"></a>00238         {
       
   246 <a name="l00239"></a>00239                                 <span class="comment">// A function which handles the content</span>
       
   247 <a name="l00240"></a>00240                                 <span class="comment">// of a descriptor derived from TDes;</span>
       
   248 <a name="l00241"></a>00241                                 <span class="comment">// i.e. the modifiable descriptors TPtr</span>
       
   249 <a name="l00242"></a>00242                                 <span class="comment">// and TBuf</span>
       
   250 <a name="l00243"></a>00243                                 <span class="comment">//</span>
       
   251 <a name="l00244"></a>00244                                 <span class="comment">// Function changes the content of the </span>
       
   252 <a name="l00245"></a>00245                                 <span class="comment">// referenced descriptors and then displays</span>
       
   253 <a name="l00246"></a>00246                                 <span class="comment">// their content, length, size and maximum</span>
       
   254 <a name="l00247"></a>00247                                 <span class="comment">// length.</span>
       
   255 <a name="l00248"></a>00248                                 <span class="comment">//</span>
       
   256 <a name="l00249"></a>00249                                 <span class="comment">// Note that the references to TPtrC, TBufC</span>
       
   257 <a name="l00250"></a>00250                                 <span class="comment">// and HBufC cannot be passed.</span>
       
   258 <a name="l00251"></a>00251 
       
   259 <a name="l00252"></a>00252         _LIT(KTxtModBufferWrite,<span class="stringliteral">"Modified by BufferWrite "</span>);                    
       
   260 <a name="l00253"></a>00253         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KTxtModBufferWrite);
       
   261 <a name="l00254"></a>00254                                 
       
   262 <a name="l00255"></a>00255         <span class="keywordflow">for</span> (TInt ix = 0; ix &lt; aBuffer.Length(); ix++)
       
   263 <a name="l00256"></a>00256                 {
       
   264 <a name="l00257"></a>00257                 aBuffer[ix] += 0xF0;
       
   265 <a name="l00258"></a>00258                 <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KCommonFormat2,aBuffer[ix]);
       
   266 <a name="l00259"></a>00259                 }
       
   267 <a name="l00260"></a>00260 
       
   268 <a name="l00261"></a>00261         _LIT(KFormat1,<span class="stringliteral">"; %d; %d; %d\n"</span>);
       
   269 <a name="l00262"></a>00262         <a class="code" href="dbllist_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>-&gt;Printf(KFormat1,
       
   270 <a name="l00263"></a>00263                             aBuffer.Length(),
       
   271 <a name="l00264"></a>00264                                         aBuffer.Size(),
       
   272 <a name="l00265"></a>00265                                         aBuffer.MaxLength()
       
   273 <a name="l00266"></a>00266                                    );
       
   274 <a name="l00267"></a>00267         }
       
   275 <a name="l00268"></a>00268 
       
   276 <a name="l00269"></a>00269         
       
   277 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:32:55 2010 for TB10.1 Example Applications by&nbsp;
       
   278 <a href="http://www.doxygen.org/index.html">
       
   279 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
       
   280 </body>
       
   281 </html>