- Project tools
-
-
- How do I...
-
| Category |
Featured projects |
| scm |
Subversion,
Subclipse,
TortoiseSVN,
RapidSVN
|
| issuetrack |
Scarab |
| requirements |
xmlbasedsrs |
| design |
ArgoUML |
| techcomm |
SubEtha,
eyebrowse,
midgard,
cowiki |
| construction |
antelope,
scons,
frameworx,
build-interceptor,
propel,
phing
|
| testing |
maxq,
aut
|
| deployment |
current |
| process |
ReadySET |
| libraries |
GEF,
Axion,
Style,
SSTree
|
| Over 500 more tools... |
|
Hello World Example
This "hello World" example is converted into pure C++ from the orignal
BREW SDK. It does not depend on AEEModgen.c or AEEAppGen.c.
#include
"brewpp_runtime/brewpp.hpp"
#include "helloworld.bid"
class CHelloWorld:public CDefaultBrewApplet
{
public:
enum{CLS_ID = AEECLSID_HELLOWORLD };
CHelloWorld(CDefaultBrewModule*
mdl):CDefaultBrewApplet(mdl){}
virtual boolean BREW_CALL_CONV HandleEvent(
AEEEvent eCode,uint16 wParam, uint32 dwParam);
};
boolean BREW_CALL_CONV CHelloWorld::HandleEvent( AEEEvent eCode,uint16
wParam, uint32 dwParam)
{
const AECHAR szText[] = {'H','e','l','l','o','
','W','o', 'r', 'l', 'd', '\0'};
switch (eCode)
{
case
EVT_APP_START:
m_pIDisplay->DrawText(AEE_FONT_BOLD,szText,-1, 0,0,NULL,
IDF_ALIGN_CENTER | IDF_ALIGN_MIDDLE);
m_pIDisplay->Update(false);
return(TRUE);
case
EVT_APP_STOP:
return(TRUE);
default: ; // do
nothing.
}
return(FALSE);
}
extern "C" int AEEClsCreateInstance(AEECLSID ClsId,CDefaultBrewModule
*pMod, void **ppobj)
{
*ppobj = NULL;
if(ClsId == CHelloWorld::CLS_ID)
{
*ppobj = (void**)new
CHelloWorld(pMod);
return(AEE_SUCCESS);
}
return EFAILED;
}
|
Extension Example
This example creates a BREW EXTENSION that returns a string.
#include
"extension.h"
#include "brewpp_runtime/brewpp.hpp"
#include "AEEStdLib.h"
class CTestExtensionImp:public CBaseImp<IBrewTestExtension>
{
public:
CTestExtensionImp(CDefaultBrewModule* pmod)
:m_pIModule(pmod)
{
if(m_pIModule)
{
m_pIModule->AddRef();
}
STRTOWSTR("!!! Hello extension
!!!",m_Msg,sizeof(m_Msg));
}
override const AECHAR* BREW_CALL_CONV getString()
{
return m_Msg;
}
override ~CTestExtensionImp()
{
if(m_pIModule)
{
m_pIModule->Release();
}
}
private:
CDefaultBrewModule* m_pIModule;
AECHAR m_Msg[32];
};
extern "C" int AEEClsCreateInstance(AEECLSID ClsId,CDefaultBrewModule
*pMod, void **ppobj)
{
*ppobj = NULL;
if(ClsId == CTestExtensionImp::CLS_ID)
{
*ppobj = (void**)new
CTestExtensionImp(pMod);
return(AEE_SUCCESS);
}
return EFAILED;
}
|
|