diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_binary_data_8cpp-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_binary_data_8cpp-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ - - -TB10.1 Example Applications: examples/Base/BufsAndStrings/Desc/BinaryData/BinaryData.cpp Source File - - - - -

examples/Base/BufsAndStrings/Desc/BinaryData/BinaryData.cpp

00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
-00002 // All rights reserved.
-00003 // This component and the accompanying materials are made available
-00004 // under the terms of "Eclipse Public License v1.0"
-00005 // which accompanies this distribution, and is available
-00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
-00007 //
-00008 // Initial Contributors:
-00009 // Nokia Corporation - initial contribution.
-00010 //
-00011 // Contributors:
-00012 //
-00013 // Description:
-00014 // Examples to demonstrate how descriptors can handle 
-00015 // general binary data.
-00016 //
-00017 
-00018 #include "CommonFramework.h"
-00019 
-00020 //
-00021 // Common literal text
-00022 //
-00023 _LIT(KTxtNewLine,"\n");
-00024 
-00025 //
-00026 // Common format strings
-00027 //
-00028 _LIT(KCommonFormat2,"Size()=%d; MaxLength()=%d\n");
-00029 _LIT(KCommonFormat3,"0x%02x ");
-00030 _LIT(KCommonFormat4,"; Length()=%d;\n");
-00031 
-00032 // do the example
-00033 LOCAL_C void doExampleL()
-00034     {
-00035     TInt counter;
-00036         TInt index;
-00037     
-00038                                 // For general binary data, construct an 8 bit
-00039                                 // variant descriptor. Binary data is always
-00040                                 // treated as 8 bit data regardless of the 
-00041                                 // build.
-00042                                 //
-00043                                 // This example constructs a TBuf8 using the 
-00044                                 // default constructor.                                    
-00045 
-00046         TBuf8<32> buffer;
-00047 
-00048                                 // Look at:
-00049                                 //   1. Descriptor content
-00050                                 //   2. Length of descriptor
-00051                                 //   3. Size of descriptor
-00052                                 //   4. Maximum length of descriptor
-00053                                 //  
-00054                                 // Length is zero. Maximum length is 32.
-00055                                 // Size is zero.  
-00056         _LIT(KFormat1,"\"%S\"; Length()=%d; ");
-00057         console->Printf(KFormat1,&buffer,buffer.Length());
-00058         console->Printf(KCommonFormat2,buffer.Size(),buffer.MaxLength());
-00059                                 
-00060                                 // Set up an area in memory initialised
-00061                                 // with binary data.
-00062         TUint8 data[6] = {0x00,0x01,0x02,0xAD,0xAE,0xAF};
-00063                                 
-00064                                 // Put data into descriptor
-00065         buffer.Append(&data[0],sizeof(data));
-00066 
-00067                                 // Append the following byte values
-00068         buffer.Append(0xFD);
-00069         buffer.Append(0xFE);
-00070         buffer.Append(0xFF);
-00071 
-00072                                 // Length is now 9; maxlength is still 32;
-00073                                 // Size is always 9 regardless of build.
-00074         counter = buffer.Length();
-00075         console->Printf(KTxtNewLine);
-00076         for (index = 0; index < counter; index++)
-00077                 console->Printf(KCommonFormat3,buffer[index]);
-00078 
-00079         console->Printf(KCommonFormat4,buffer.Length()
-00080                                           );
-00081         console->Printf(KCommonFormat2,buffer.Size(),buffer.MaxLength());                                                       
-00082                                 // We can also mix text characters and
-00083                                 // general binary data.
-00084         buffer.Append('A');
-00085         buffer.Append('B');
-00086         buffer.Append(0x11);                                            
-00087         
-00088                                 // Show it
-00089         counter = buffer.Length();
-00090         console->Printf(KTxtNewLine);
-00091         for (index = 0; index < counter; index++)
-00092                 console->Printf(KCommonFormat3,buffer[index]);
-00093         
-00094         console->Printf(KCommonFormat4,buffer.Length());
-00095         console->Printf(KCommonFormat2,buffer.Size(),buffer.MaxLength());                                                       
-00096         }
-

Generated on Thu Jan 21 10:32:55 2010 for TB10.1 Example Applications by  - -doxygen 1.5.3
- -