examples/ForumNokia/DescriptorExample/inc/StringRenderer.h

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 STRING_RENDERER_H
00032 #define STRING_RENDERER_H
00033 
00034 #include <e32std.h>
00035 
00036 // -----------------------------------------------------------------------------
00051 const TInt KRenderDefault = 0x00;
00052 const TInt KRenderContentAsBinary = 0x01;
00053 const TInt KRenderCharacteristics = 0x02;
00054 
00055 // -----------------------------------------------------------------------------
00067 void Append( const TDesC8 &aSrc, TDes16 &aDst );
00068 void Append( const TDesC16 &aSrc, TDes16 &aDst );
00069 
00070 // -----------------------------------------------------------------------------
00075 void RenderAsNumbers( const TDesC8 &anArray, TDes16 &aOutput );
00076 void RenderAsNumbers( const TDesC16 &anArray, TDes16 &aOutput );
00077 
00078 // -----------------------------------------------------------------------------
00084 void RenderObject(const TDesC8 &aVariable,
00085                   TDes16 &aOutput,
00086                   TInt aRenderFormat=KRenderDefault);
00087 void RenderObject(const TDes8 &aVariable,
00088                   TDes16 &aOutput,
00089                   TInt aRenderFormat=KRenderDefault);
00090 void RenderObject(const TDesC16 &aVariable,
00091                   TDes16 &aOutput,
00092                   TInt aRenderFormat=KRenderDefault );
00093 void RenderObject(const TDes16  &aVariable,
00094                   TDes16 &aOutput,
00095                   TInt aRenderFormat=KRenderDefault );
00096 void RenderObject(const TInt &aVariable,
00097                   TDes16 &aOutput,
00098                   TInt aRenderFormat=KRenderDefault );
00099 
00100 // -----------------------------------------------------------------------------
00109 void RenderHeader(const TDesC &aHeader, TDes &aOutput);
00110 
00111 // -----------------------------------------------------------------------------
00133 #define RenderVariableFormatted(aVariableName, aOutput, aRenderFormat) \
00134     aOutput.Append(_L(#aVariableName));\
00135     aOutput.Append('=');\
00136     RenderObject( aVariableName, aOutput, aRenderFormat );\
00137     aOutput.Append('\n');\
00138 
00139 // -----------------------------------------------------------------------------
00140 _LIT( KForward, " -> " );
00168 #define RenderResultFormatted(aDeclaration, aOutput, aRenderFormat) \
00169     aOutput.Append(_L(#aDeclaration));\
00170     aOutput.Append(KForward);\
00171     RenderObject( aDeclaration, aOutput, aRenderFormat );\
00172     aOutput.Append('\n');\
00173 
00174 // -----------------------------------------------------------------------------
00205 #define ExecuteAndRenderVariableFormatted(aDeclaration, \
00206                                           aVariable, \
00207                                           aOutput, \
00208                                           aRenderFormat) \
00209     aDeclaration;\
00210     aOutput.Append(_L(#aDeclaration));\
00211     aOutput.Append(KForward);\
00212     aOutput.Append(_L(#aVariable));\
00213     aOutput.Append('=');\
00214     RenderObject( aVariable, aOutput, aRenderFormat );\
00215     aOutput.Append('\n');\
00216 
00217 #endif // STRING_RENDERER_H

Generated by  doxygen 1.6.2