Code::Blocks  SVN r11506
Classes | Typedefs | Functions | Variables
ProjectLoaderHooks Namespace Reference

Provides static functions to add hooks to the project loading/saving procedure. More...

Classes

class  HookFunctor
 Functor class for use as a project loading/saving hook. More...
 
class  HookFunctorBase
 Abstract base hook functor interface. More...
 

Typedefs

typedef std::map< int, HookFunctorBase * > HookFunctorsMap
 

Functions

DLLIMPORT int RegisterHook (HookFunctorBase *functor)
 Register a project loading/saving hook. More...
 
DLLIMPORT HookFunctorBaseUnregisterHook (int id, bool deleteHook=true)
 Unregister a previously registered project loading/saving hook. More...
 
DLLIMPORT bool HasRegisteredHooks ()
 Are there any hooks registered? More...
 
DLLIMPORT void CallHooks (cbProject *project, TiXmlElement *elem, bool isLoading)
 Call all registered hooks using the supplied parameters. More...
 

Variables

static HookFunctorsMap s_HookFunctorsMap
 
static int s_UniqueID = 0
 

Detailed Description

Provides static functions to add hooks to the project loading/saving procedure.

Typedef Documentation

◆ HookFunctorsMap

Definition at line 23 of file projectloader_hooks.cpp.

Function Documentation

◆ CallHooks()

void ProjectLoaderHooks::CallHooks ( cbProject project,
TiXmlElement *  elem,
bool  isLoading 
)

Call all registered hooks using the supplied parameters.

This is called by ProjectLoader.

Parameters
projectThe project in question.
elemThe XML element under which the called hook can read/write.
isLoadingTrue if the project is being loaded, false if being saved.

Definition at line 61 of file projectloader_hooks.cpp.

References ProjectLoaderHooks::HookFunctorBase::Call(), and s_HookFunctorsMap.

Referenced by ProjectLoader::ExportTargetAsProject(), and ProjectLoader::Open().

◆ HasRegisteredHooks()

bool ProjectLoaderHooks::HasRegisteredHooks ( )

Are there any hooks registered?

Returns
True if any hooks are registered, false if none.

Definition at line 56 of file projectloader_hooks.cpp.

References s_HookFunctorsMap.

Referenced by ProjectLoader::ExportTargetAsProject().

◆ RegisterHook()

int ProjectLoaderHooks::RegisterHook ( ProjectLoaderHooks::HookFunctorBase functor)

Register a project loading/saving hook.

Parameters
functorThe functor to use as a callback.
Returns
An ID. Use this to unregister your hook later.

Definition at line 28 of file projectloader_hooks.cpp.

References s_HookFunctorsMap, and s_UniqueID.

Referenced by NativeParser::NativeParser(), and DebuggerGDB::OnAttachReal().

◆ UnregisterHook()

ProjectLoaderHooks::HookFunctorBase * ProjectLoaderHooks::UnregisterHook ( int  id,
bool  deleteHook = true 
)

Unregister a previously registered project loading/saving hook.

Parameters
idThe hook's ID. You should have the ID from when RegisterHook() was called.
deleteHookIf true, the hook will be deleted (default). If not, it's up to you to delete it.
Returns
The functor. If deleteHook was true, it always returns NULL.

Definition at line 39 of file projectloader_hooks.cpp.

References s_HookFunctorsMap.

Referenced by DebuggerGDB::OnReleaseReal(), and NativeParser::~NativeParser().

Variable Documentation

◆ s_HookFunctorsMap

HookFunctorsMap ProjectLoaderHooks::s_HookFunctorsMap
static

◆ s_UniqueID

int ProjectLoaderHooks::s_UniqueID = 0
static

Definition at line 25 of file projectloader_hooks.cpp.

Referenced by RegisterHook().