sftemplateswizard/com.nokia.s60tools.symbianfoundationtemplates/templates/source_template.cpp
changeset 0 61163b28edca
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name        : ?filename.cpp
       
     4 *  Part of     : ?Subsystem_name / ?Module_name
       
     5 *  Description : ?Description
       
     6 *  Version     : %version: %
       
     7 *
       
     8 *  Copyright © ?year-?year ?Company_copyright.
       
     9 *  All rights reserved.
       
    10 *  This component and the accompanying materials are made available
       
    11 *  under the terms of the License "?License"
       
    12 *  which accompanies this distribution, and is available
       
    13 *  at the URL "?LicenseUrl".
       
    14 *
       
    15 *  Initial Contributors:
       
    16 *  ?Company_name - initial contribution.
       
    17 *
       
    18 *  Contributors:
       
    19 *  ?Company_name
       
    20 * ============================================================================
       
    21 * Template version: 4.1
       
    22 */
       
    23 
       
    24 *** INSTRUCTIONS TO THE TEMPLATE USER:
       
    25 
       
    26 *** This template follows the Symbian Foundation coding conventions.
       
    27 *** Remove all unneeded declarations and definitions before checking 
       
    28 *** the file in!  Also remove the template's usage instructions, that is, 
       
    29 *** everything that begins with "***".
       
    30 
       
    31 *** The copyright years should be < the year of the file's creation >
       
    32 *** - < the year of the file's latest update >.
       
    33 
       
    34 *** Words that begin with "?" are for you to replace with your own
       
    35 *** identifiers, filenames, comments, or code.  ?EXPORT_C means either
       
    36 *** the EXPORT_C visibility directive, or nothing, depending on whether
       
    37 *** the function is to be exported or not.
       
    38 
       
    39 *** To support building on Linux, use only forward slashes in include
       
    40 *** directives.  Also, all filenames and pathnames must be completely
       
    41 *** in lowercase.
       
    42 
       
    43 *** Indent four spaces per step, using spaces, not tabs, to display
       
    44 *** the code consistently across different editors.
       
    45 
       
    46 
       
    47 *** Implement only one class in one file.
       
    48 
       
    49 
       
    50 *** system include files go here:
       
    51 
       
    52 #include <?include_file>
       
    53 
       
    54 *** user include files go here:
       
    55 
       
    56 #include "?include_file"
       
    57 
       
    58 *** external function prototypes go here:
       
    59 
       
    60 extern ?external_function( ?arg_type, ?arg_type );
       
    61 
       
    62 *** local constants go here:
       
    63 
       
    64 const ?type ?constant_var = ?constant;
       
    65 
       
    66 
       
    67 // ======== LOCAL FUNCTIONS ========
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // ?description
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 ?type ?function_name( ?arg_type ?arg,
       
    74                       ?arg_type ?arg )
       
    75     {
       
    76     ?code  // ?implementation comment on this line
       
    77     // ?implementation comment on the following statement or block:
       
    78     ?code
       
    79     }
       
    80 
       
    81 
       
    82 // ======== MEMBER FUNCTIONS ========
       
    83 
       
    84 *** In the same order as defined in the header file.
       
    85 
       
    86 *** The first function includes examples of correct tabulation of some
       
    87 *** commonly used statements, and some suggested places to put
       
    88 *** implementation comments, if needed.
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // ?description_if_needed
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 ?classname::?classname()
       
    95     {
       
    96     if ( ?condition )
       
    97         {
       
    98         // ?implementation_comment
       
    99         ?code
       
   100         }
       
   101     else
       
   102         {
       
   103         // ?implementation_comment
       
   104         ?code
       
   105         }
       
   106 
       
   107     // ?implementation_comment
       
   108     while ( ?condition )
       
   109         {
       
   110         ?code
       
   111         }
       
   112 
       
   113     // ?implementation_comment
       
   114     for ( ?for_init_statement; ?condition; ?expression )
       
   115         {
       
   116         ?code
       
   117         }
       
   118 
       
   119     // ?implementation_comment
       
   120     switch ( ?condition )
       
   121         {
       
   122         case ?constant:
       
   123             ?code
       
   124             break;
       
   125         case ?constant:
       
   126             ?code
       
   127             // fall-through intended here
       
   128         case ?constant:
       
   129             ?code
       
   130             break;
       
   131         default:
       
   132             ?code
       
   133             break;
       
   134         }
       
   135     }
       
   136 
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // ?description_if_needed
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void ?classname::ConstructL()
       
   143     {
       
   144     ?code
       
   145     }
       
   146 
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // ?description_if_needed
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 EXPORT_C ?classname* ?classname::NewL()
       
   153     {
       
   154     ?classname* self = ?classname::NewLC();
       
   155     CleanupStack::Pop( self );
       
   156     return self;
       
   157     }
       
   158 
       
   159 
       
   160 // ---------------------------------------------------------------------------
       
   161 // ?description_if_needed
       
   162 // ---------------------------------------------------------------------------
       
   163 //
       
   164 EXPORT_C ?classname* ?classname::NewLC()
       
   165     {
       
   166     ?classname* self = new( ELeave ) ?classname;
       
   167     CleanupStack::PushL( self );
       
   168     self->ConstructL();
       
   169     return self;
       
   170     }
       
   171 
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // ?description_if_needed
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 ?classname::~?classname()
       
   178     {
       
   179     ?code
       
   180     }
       
   181 
       
   182 
       
   183 *** Non-derived function:
       
   184 
       
   185 // ---------------------------------------------------------------------------
       
   186 // ?implementation_description
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 ?EXPORT_C ?type ?classname::?member_function(
       
   190     ?really_really_really_really_long_arg_type_1 ?really_really_long_arg_1,
       
   191     ?really_really_really_really_long_arg_type_2 ?really_really_long_arg_2 )
       
   192     {
       
   193     ?code
       
   194     }
       
   195 
       
   196 
       
   197 *** Derived function:
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // From class ?base_class.
       
   201 // ?implementation_description
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 ?EXPORT_C ?type ?function_name( ?arg_type_1 ?arg_1, ?arg_type_2 ?arg_2 )
       
   205     {
       
   206     ?code
       
   207     }
       
   208 
       
   209 
       
   210 // ======== GLOBAL FUNCTIONS ========
       
   211 
       
   212 *** For an application's UiApp class, functions NewApplication and E32Main
       
   213 *** should go here:
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // Constructs and returns an application object.
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 EXPORT_C CApaApplication* NewApplication()
       
   220     {
       
   221     return new ?CMyApplication;
       
   222     }
       
   223 
       
   224 
       
   225 // ---------------------------------------------------------------------------
       
   226 // Main function of the application executable.
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 GLDEF_C TInt E32Main()
       
   230     {
       
   231     return EikStart::RunApplication( NewApplication );
       
   232     }