string = 'text' | "text" | """text""" # a Python string delimited by ', ", """ # can have other quote types inside: "it's" -> it's # """ creates a multiline quote # precede by r means "raw" or literal string (note about the example: \t creates a tab character) # r'hi\thi' -> hi\thi # 'hi\thi' -> hi hi # r'path\file' == 'path\\file' list = [ element {, element}* ] # list is surrounded by brackets, items separated by commas, can include anything, including other lists ######################################### # Mandatory sections of the *.init file # ######################################### PrjName = string # the name of the project, basis for filenames, etc. # PrjName = 'HelloWorld' UID = string # a unique project identifier # UID = '0x01231234' resource.menu = list of pairs first element of pair label_string second either command_string or menubar # resource.menu = [['Submenu' , [['DoThis', ' iAppView->doThis();' ], # ['DoThat', ' iAppView->doThat();' ]]] # ['Clear', ' iAppView->Clear();' ] # ['Exit', ' Exit();' ]] ########################## # Basic symwiz machinery # ########################## XYZ = CClass( name_and_doc, classtype = 'C' ) # add a class into the project (in symwiz.py) # creates both *.cpp and *.h file, adds them to the *.mmp file, etc. # name_and_doc is either a string (the name) or a pair of strings (name_string, documentation_string) # classtype is a 1-letter string, typically C for heap-based classes (T for simple classes, M for mixins, ...) # creates a standard destructor ~$CLASS$ # this is how it's initialized (other than self.name and self.discussion) self.parent = '' # the parent of this class self.inc_inc = [] # files to be #included in the *.h file self.inc_src = [] # files to be #included in the *.cpp file self.intro_inc = '' # in *.cpp, statements after includes and before class (forward references, etc.) self.intro_src = '' # in *.h, statements after includes and before functions (global variables, etc.) self.public = [] # list of public members of this class self.protected = [] # list of protected members of this class self.private = [] # list of private members of this class self.members = {} # a dictionary of members (methods, variable, enums, etc., see method.py) self.namespace = '' # if the class defines a namespace, its name self.namespace_consts = '' # consts, enums, etc., defined within the namespace self.is_dll = False # whether this class should be put into a library (dll) rather than app # add an empty destructor self.add_public( Method( '', ('~$CLASS$', ''), [], '' ) ) # Example follows. Notice that you can use $PrjName$ as part of a string, this will be replaced with # the project name when creating the file. You can also use $CLASS$ in a similar fashion, in this # case it would be replaced with 'CVideoRecorded' # # myeng = CClass( ('MyRecorder', 'An engine class') ) # myeng.parent = ': public CBase, public MCameraObserver' # myeng.inc_inc = [ '', '"$PrjName$AppView.h"' ] # myeng.inc_src = [ '"$PrjName$AppUi.h"' ] # myeng.intro_src = """ # const TInt KMinZoomFactor = 0; # const TInt KMaxZoomFactor = 3; # """ # Types of members of CClass (in method.py) Arg( type, name, comment = '' ) # Arg('C$PrjName$AppView*', 'aAppView') # Arg('C$PrjName$AppView*', 'aAppView', 'Store a pointer to the appview.') Method( result_and_doc, name_and_doc, args, code, construct_init = [], # only for constructors, member initializations, a string or list of strings is_const = False, # is it a constant method is_virtual = False, # is it a virtual method is_pure_virtual = False) # is it a pure virtual method # result_and_doc and name_and_doc are either strings or pairs of strings # Method( 'void', ('SetVideoCaptureRes', 'Set video capture resolution.'), # [Arg('TInt', 'aSizeIndex')], ' iVideoSizeIndex = aSizeIndex;') # # Method( ('TInt', 'The index'), 'GetVideoCaptureRes', [], ' return iVideoSizeIndex;', is_const = True ) # Method( '', ('$CLASS$', 'Create the shape at a specified point'), # [Arg('TShapeType', 'aShapeType', 'the type of the actual shape'), # Arg('const TPoint&', 'aOrigin', 'where the center of the shape is located') ], '', # 'iShapeType(aShapeType), iOrigin(aOrigin)' ) Var( type, name, comment = '' ) # Var( 'TPoint', 'iOrigin', 'The origin of the shape' Enum( name_and_doc, value_doc_pairs, var = '' ) # var is an optional assignment of the Enum to a variable # Enum( ('TShapeType', 'Shape constants'), # [['KRectangle = 1', 'represents a rectangle'], # ['KCircle', 'represents a circle']] ) # Enum( ('TShapeType', 'Shape constants'), # [['KRectangle = 1', 'represents a rectangle'], # ['KCircle', 'represents a circle']], iShape ) XYZ.add_public( member ) # member is one of Method, Var, Enum XYZ.add_protected( member ) XYZ.add_private( member ) # appview.add_public( Method( 'void', ('DrawImage', 'Draw the captured image on the display'), # [Arg('CFbsBitmap*', 'aImage')], """\ # // Get the standard graphics context # CWindowGc& gc = SystemGc(); # ... # iCoeEnv->WsSession().Flush();""", is_const = True )) # myeng.add_private( Var( 'C$PrjName$AppView*', 'iAppView' ) ) # symwiz creates some CClasses with predifined functionality: # application, document, appui, appview # some utility functions XYZ.two_phase( args, phase1_init = '', phase1_code = '', phase2_code = '' ) # creates NewL, NewLC, ConstructL, and the default constructor ($CLASS$) XYZ.add_notify() # creates ErrorNotifyL and InfoNotifyL methods XYZ.use_camera() # creates a lot of instructure needed in camera-based applications # can add header files to *.h or *.cpp XYZ.inc_inc += [ '', '"myincl.h"' ] XYZ.inc_src += [ '', '"myincl.h"' ] # '"$CLASS$.h"' is there already # can add arbitrary code after the includes and before other things (file globals, forward references, ...) XYZ.intro_inc += 'class CBlah1;class CBlah2;\n' XYZ.intro_src += '\nconst TInt KMinZoomFactor = 0;' # can get a member and change / add to the code appui.members['~$CLASS$'].code += """ delete iVideoRecorder; iVideoRecorder = NULL;""" Resources # the framework creates resource = Resource() # here is how it is initialized self.menu = [] # menu structure self.strings = [] # resource strings self.caption = [] # caption for the app in application grid self.libraries = [ 'euser', # the libraries needed to link the the project 'apparc', 'cone', 'eikcore', 'avkon' ] self.userincl = [ r'..\inc' ] # list of paths to search user include files self.extra_src = [] # list of extra source files; entries: ( 'path', [ src, src, ... ] ) self.exports = [] # if files must be exported (bld.inf, *.pkg); entries ('path', 'file) self.model = 'v2.0' # index to dictionary of supported models / SDKs # these things are only used if there's a separated engine apart from the Gui stuff self.eng_srcs = [] # source files for the engine self.eng_libs = [] # libraries needed to link the engine # currently used only by symwiz, not *.init self.sources = [ '$PrjName$.cpp' ] # which source files this project has in addition to the above self.copyfiles = [] # src, dest pairs of files that need to be copied to create the project # methods that copy files from srcdir to bitmap or data directories # and also exports the files to emulator and phone resource.images( imgs, srcdir ) resource.datafiles( datafiles, srcdir ) # Examples # add a resource string resource.strings += [[ 'r_new_string_resource', 'This is Hello World Plus!' ]] # infonote_RES() shows an example how resource strings can be read # give the application a long and short name (rather than the project name which is the default) resource.caption = ['swHelloWorld+', 'swHW+'] # add two more libraries to the project, fbscli.lib, ws32.lib resource.libraries += [ 'fbscli', 'ws32' ] # tell how to find header and source files not created by symwiz resource.userincl += [ r'..\..\helperfunctions' ] resource.extra_src += [ ( r'..\..\helperfunctions', [ 'bitmapmethods.cpp' ] ) ] # add files that should be exported (either for the emulator or to the phone) resource.exports += [ ('..\\bitmaps\\', 'bmpmanip.gif') ] # create a multibitmap (in this case images.mbm) from several single bmp's resource.multibm += [( 'images', 'gfx_bitmaps', [ ('c12', 'image1.bmp'), ('c12', 'image2.bmp'), ('c12', 'image2_mask.bmp') ] )] Engine # calling use_engine() creates a separate subproject into a folder called engine # the header files all go to the same place, but the source files are separate # the engine will be compiled into its own DLL, against which the main project # is finally linked # you need to give the engine name (of the main class / file) and the DLL needs a UID use_engine('ShapeListMgr', eng_uid = '0x02222229') # the function takes an optional third argument, a document name # if that is given, several functions are created that help to create a persistent # document, that is, the state is stored at exit and reloaded at start use_engine('ShapeListMgrStore', eng_uid = '0x0222222B', document_name = '$PrjName$State')