pyInt Class Reference

Class containing all the stuff to use python. More...

#include <pyInt.h>

Inheritance diagram for pyInt:
base

List of all members.

Public Member Functions

 pyInt ()
 Constructor.
 ~pyInt ()
 Destructor.
int init (coeur *)
 Init the interface.
int update ()
 Updating(should be call on each loop).
int close ()
 Close the base.
bool OnEvent (const SEvent &)
 Called when an event occured.
stringw eval (stringw)
 Run a python command.
int exec (stringw)
 Run a python script.
int addPyEnv (stringc, object)
 Add a variable to python envirronement.

Private Attributes

object dict
 Dictionnary for python wrapper.
object main_module
 Main module for python wrapper.

Detailed Description

Class containing all the stuff to use python.

It will create the python embedded system and make it accesible for other class in order to launch instruction, script and to get the output

Definition at line 27 of file pyInt.h.


Constructor & Destructor Documentation

pyInt::pyInt (  ) 

Constructor.

Construct the pyInt class, call base::base().

Definition at line 36 of file pyInt.cpp.

pyInt::~pyInt (  ) 

Destructor.

Destruct the pyInt class.

Definition at line 42 of file pyInt.cpp.


Member Function Documentation

int pyInt::addPyEnv ( stringc  s,
object  o 
)

Add a variable to python envirronement.

This method add a variable to the python envirronement

Parameters:
s Name of the variable
o The object to put in the variable
Returns:
0

Definition at line 138 of file pyInt.cpp.

References main_module.

Referenced by init(), and console::init().

int pyInt::close (  )  [virtual]

Close the base.

Quit python and call base::close()

Returns:
base::close()

Reimplemented from base.

Definition at line 79 of file pyInt.cpp.

Referenced by coeur::close().

stringw pyInt::eval ( stringw  str  ) 

Run a python command.

This method run a python command

Parameters:
str command to run
Returns:
the result of the command

Definition at line 97 of file pyInt.cpp.

References dict, exec(), and base::log().

Referenced by console::OnEvent().

int pyInt::exec ( stringw  str  ) 

Run a python script.

This method run a python script

Parameters:
str script to run
Returns:
0 if succsful, -1 instead

Definition at line 119 of file pyInt.cpp.

References dict, and base::log().

Referenced by console::close(), eval(), init(), and console::init().

int pyInt::init ( coeur c  ) 

Init the interface.

Call base::init() and initialize python

Parameters:
c Pointer to the core
Returns:
0 if succesful, -1 instead

Definition at line 50 of file pyInt.cpp.

References addPyEnv(), dict, exec(), initpyIrr(), initpyMerry(), and main_module.

Referenced by coeur::init().

bool pyInt::OnEvent ( const SEvent &  event  ) 

Called when an event occured.

This method is called when an event has to be treated, but this class do not wait event so this function does nothing

Parameters:
event The event to parse
Returns:
Always false

Definition at line 89 of file pyInt.cpp.

int pyInt::update (  )  [virtual]

Updating(should be call on each loop).

Does nothing, apart from slowing the game

Returns:
always 0

Reimplemented from base.

Definition at line 72 of file pyInt.cpp.


Member Data Documentation

object pyInt::dict [private]

Dictionnary for python wrapper.

Definition at line 58 of file pyInt.h.

Referenced by eval(), exec(), and init().

object pyInt::main_module [private]

Main module for python wrapper.

Definition at line 61 of file pyInt.h.

Referenced by addPyEnv(), and init().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Friends

Generated on Wed Sep 9 18:20:17 2009 for The Merry Turnip by  doxygen 1.6.1