Generic GALILEI Application. More...

#include <ggalileiapp.h>

Inheritance diagram for GGALILEIApp:
[legend]

Public Member Functions

 GGALILEIApp (const R::RString &name, int argc, char *argv[], bool dlg=false, const R::RString &localconfig=R::RString::Null, const R::RString &globalconfig=R::RString::Null)
 
GSessionGetSession (const R::RString &name, bool &created, GSlot *slot=0, const R::RString &configdir=R::RString::Null)
 
void DeleteSession (GSession *session)
 
R::RString GetIndexDir (void) const
 
void SetIndexDir (const R::RString &name)
 
R::RCursor< R::RStringGetPlugInsPaths (void) const
 
void SetPlugInsPaths (const R::iRContainer< R::RString > &paths)
 
R::RCursor< GPlugInManagerGetManagers (void)
 
GPlugInManagerGetManager (const R::RString &mng) const
 
R::RCursor< GPlugInFactoryGetFactories (const R::RString &mng, const R::RString &list=R::RString::Null) const
 
template<class plugin >
R::RCastCursor< GPlugIn, plugin > GetPlugIns (const R::RString &mng, const R::RString &list=R::RString::Null) const
 
GPlugInFactoryGetFactory (const R::RString &mng, const R::RString &name, const R::RString &list, int need=1) const
 
GPlugInFactoryGetFactory (const R::RString &mng, const R::RString &name, int need=1) const
 
GPlugInGetPlugIn (const R::RString &mng, const R::RString &name, const R::RString &list, int need=1) const
 
GPlugInGetPlugIn (const R::RString &mng, const R::RString &name, int need=1) const
 
template<class plugin >
plugin * GetPlugIn (const R::RString &mng, const R::RString &name, const R::RString &list, int need=1) const
 
template<class plugin >
plugin * GetPlugIn (const R::RString &mng, const R::RString &name, int need=1) const
 
GPlugInFactoryGetCurrentFactory (const R::RString &mng, const R::RString &list, int need=1) const
 
GPlugInFactoryGetCurrentFactory (const R::RString &mng, int need=1) const
 
template<class plugin >
plugin * GetCurrentPlugIn (const R::RString &mng, const R::RString &list, int need=1) const
 
template<class plugin >
plugin * GetCurrentPlugIn (const R::RString &mng, int need=1) const
 
void SetCurrentPlugIn (const R::RString &mng, const R::RString &name, const R::RString &list, int need=1)
 
void SetCurrentPlugIn (const R::RString &mng, const R::RString &name, int need=1)
 
void RunPrg (GSlot *rec, const R::RString &filename)
 
GFilterFindMIMEType (GDoc *doc) const
 
GFilterFindScheme (GDoc *doc) const
 
void AddScheme (const char *mime, GFilter *f)
 
void AddMIME (const char *mime, GFilter *f)
 
void DelMIMES (GFilter *f)
 
virtual ~GGALILEIApp (void)
 
- Public Member Functions inherited from RContainer< GPlugInManager, true, false >
 RContainer (size_t m, size_t i=0)
 
 RContainer (const RContainer< GPlugInManager, true, false > &src)
 
 RContainer (const RContainer< GPlugInManager, false, false > &src)
 
int Compare (const RContainer< GPlugInManager, true, false > &) const
 
size_t GetNb (void) const
 
size_t GetMaxPos (void) const
 
size_t GetMaxNb (void) const
 
size_t GetIncNb (void) const
 
bool VerifyIndex (size_t idx) const
 
void VerifyTab (size_t max=0)
 
void Clear (size_t m=0, size_t i=0, bool force=false)
 
void ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max)
 
void ReOrder (int sortOrder(const void *, const void *))
 
void ReOrder (void)
 
void Exchange (size_t pos1, size_t pos2)
 
void Shift (size_t idx, bool reverse)
 
void Transfer (RContainer< GPlugInManager, a, o > &src)
 
RContaineroperator= (const RContainer< GPlugInManager, true, false > &src)
 
RContaineroperator= (const RContainer< GPlugInManager, false, false > &src)
 
void Copy (const RContainer< GPlugInManager, a, false > &src)
 
RContaineroperator+= (const RContainer< GPlugInManager, a, o > &src)
 
size_t GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, size_t min=0, size_t max=0) const
 
const GPlugInManager * operator[] (size_t idx) const
 
GPlugInManager * operator[] (size_t idx)
 
const GPlugInManager * GetPtrAt (size_t idx) const
 
GPlugInManager * GetPtrAt (size_t idx)
 
GPlugInManager * GetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
GPlugInManager * GetPtr (const TUse &tag, size_t min=0, size_t max=0) const
 
GPlugInManager * GetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
GPlugInManager * GetInsertPtr (const TUse &tag, size_t min=0, size_t max=0)
 
GPlugInManager * GetInsertPtrAt (const TUse &tag, size_t pos)
 
RContainer< GPlugInManager,
false, false > * 
GetPtrs (const TUse &tag, size_t min=0, size_t max=0) const
 
size_t GetTab (const void **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (void **tab, size_t min=0, size_t max=0)
 
size_t GetTab (const GPlugInManager **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (GPlugInManager **tab, size_t min=0, size_t max=0)
 
void InsertPtrAt (GPlugInManager *ins, size_t pos, bool del)
 
void InsertPtrAt (GPlugInManager *ins, size_t pos)
 
void InsertPtr (GPlugInManager *ins, bool del=false, size_t min=0, size_t max=0)
 
void DeletePtrAt (size_t pos, bool shift, bool del)
 
void DeletePtrAt (size_t pos, bool shift)
 
void DeletePtrAt (size_t pos)
 
void DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, size_t min=0, size_t max=0)
 
void Inter (const iRContainer< GPlugInManager > &src1, const iRContainer< GPlugInManager > &src2)
 
void Union (const iRContainer< GPlugInManager > &src1, const iRContainer< GPlugInManager > &src2)
 
virtual ~RContainer (void)
 
- Public Member Functions inherited from iRContainer< C >
size_t GetNb (void) const
 
size_t GetMaxPos (void) const
 
size_t GetMaxNb (void) const
 
size_t GetIncNb (void) const
 
bool VerifyIndex (size_t idx) const
 
void VerifyTab (size_t max=0)
 
void Clear (size_t m=0, size_t i=0, bool force=false)
 
void ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max)
 
void ReOrder (int sortOrder(const void *, const void *))
 
void ReOrder (void)
 
void Exchange (size_t pos1, size_t pos2)
 
void Shift (size_t idx, bool reverse)
 
void Transfer (iRContainer< C > &src)
 
iRContaineroperator= (const iRContainer< C > &src)
 
void Copy (const iRContainer< C > &src)
 
iRContaineroperator+= (const iRContainer< C > &src)
 
size_t GetIndex (bool order, const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
size_t GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
bool IsIn (const TUse &tag, size_t min=0, size_t max=0) const
 
const C * operator[] (size_t idx) const
 
C * operator[] (size_t idx)
 
const C * GetPtrAt (size_t idx) const
 
C * GetPtrAt (size_t idx)
 
C * GetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const
 
C * GetPtr (const TUse &tag, size_t min=0, size_t max=0) const
 
C * GetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
C * GetInsertPtr (const TUse &tag, size_t min=0, size_t max=0)
 
C * GetInsertPtrAt (const TUse &tag, size_t pos)
 
size_t GetTab (const void **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (void **tab, size_t min=0, size_t max=0)
 
size_t GetTab (const C **tab, size_t min=0, size_t max=0) const
 
size_t GetTab (C **tab, size_t min=0, size_t max=0)
 
void InsertPtrAt (C *ins, size_t pos, bool del)
 
void InsertPtrAt (C *ins, size_t pos)
 
void InsertPtr (C *ins, bool del=false, size_t min=0, size_t max=0)
 
void DeletePtrAt (size_t pos, bool shift, bool del)
 
void DeletePtrAt (size_t pos, bool shift)
 
void DeletePtrAt (size_t pos)
 
void DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0)
 
void DeletePtr (const TUse &tag, size_t min=0, size_t max=0)
 
void Inter (const iRContainer< C > &src1, const iRContainer< C > &src2)
 
void Union (const iRContainer< C > &src1, const iRContainer< C > &src2)
 
virtual ~iRContainer (void)
 

Protected Member Functions

virtual void CreateConfig (void)
 
virtual void Init (void)
 
void FindPlugins (const R::RString dir, R::RContainer< R::RString, true, false > &plugins, R::RContainer< R::RString, true, false > &dlgs)
 
void Load (const R::RContainer< R::RString, true, false > &dirs, bool dlg=true)
 
virtual GStorageCreateStorage (GSession *session)
 
- Protected Member Functions inherited from iRContainer< C >
void Create (const iRContainer< C > &src)
 
iRContainerNormalCopy (const iRContainer< C > &src)
 
void DeepCopy (const iRContainer< C > &src)
 
iRContainerAdd (const iRContainer< C > &src)
 

Protected Attributes

R::RContainer< GSession, true,
true > 
Sessions
 
R::RRWLock lSessions
 
GPlugInManagerStorages
 
GPlugInManagerLangs
 
bool LoadDialogs
 
R::RContainer< R::RString,
true, false > 
PlugInsPaths
 
R::RString IndexDir
 
R::RContainer< cFilter, true,
true > 
MIMES
 
R::RContainer< cExt, true, true > Exts
 
R::RContainer< cFilter, true,
true > 
Schemes
 
R::RTextFile Log
 
- Protected Attributes inherited from iRContainer< C >
C ** Tab
 
size_t NbPtr
 
size_t MaxPtr
 
size_t LastPtr
 
size_t IncPtr
 

Additional Inherited Members

- Static Public Member Functions inherited from RContainer< GPlugInManager, true, false >
static int SortOrder (const void *a, const void *b)
 
- Static Public Member Functions inherited from iRContainer< C >
static int SortOrder (const void *a, const void *b)
 

Detailed Description

Generic GALILEI Application.

The GGALILEIApp class represents a generic application running a session.

Each application inheriting from GGALILEIApp manages three configuration files:

  1. Its own configuration which defines at least two parameters. The "GALILEI Config" parameter gives the name of the configuration file for the GALILEI library ("GALILEI" by default). The "Session" parameter defines the current session name.
  2. A configuration file corresponding to the GALILEI library storing some global parameters (such as the directories of the plug-ins). Several applications may share this configuration file.
  3. The configuration file corresponding to the current session (storing the parameters for the plug-ins, the log file, etc.). All the applications having the same current session share this configuration file.

Constructor & Destructor Documentation

GGALILEIApp ( const R::RString name,
int  argc,
char *  argv[],
bool  dlg = false,
const R::RString localconfig = R::RString::Null,
const R::RString globalconfig = R::RString::Null 
)

Construct the application.

Parameters
nameName of the application.
argcNumber of arguments.
argvArguments.
dlgDialog boxes must be loaded too? By default, no.
localconfigLocal configuration.
globalconfigLocal configuration.
virtual ~GGALILEIApp ( void  )
virtual

Destruct the application.

Member Function Documentation

virtual void CreateConfig ( void  )
protectedvirtual

Create the configuration structure. New parameters can be added by defining a new method.

Reimplemented from RApplication.

virtual void Init ( void  )
protectedvirtual

Initialization of the application.

GSession* GetSession ( const R::RString name,
bool &  created,
GSlot slot = 0,
const R::RString configdir = R::RString::Null 
)

Get the session with a given name.

Parameters
nameName of the session.
createdDetermine if the session must be created if not existing. It is modified by the method if the session was created.
slotSlot to show progress.
configdirDirectory where to search for the configuration file of the session.
void DeleteSession ( GSession session)

Delete a session.

Parameters
sessionSession.
R::RString GetIndexDir ( void  ) const
Returns
the name of the index directory.
void SetIndexDir ( const R::RString name)

Set the name of the index directory.

Parameters
nameName.
R::RCursor<R::RString> GetPlugInsPaths ( void  ) const

Get the list of plug-ins paths.

void SetPlugInsPaths ( const R::iRContainer< R::RString > &  paths)

Set the list of plug-ins paths. @âram paths Paths to set.

void FindPlugins ( const R::RString  dir,
R::RContainer< R::RString, true, false > &  plugins,
R::RContainer< R::RString, true, false > &  dlgs 
)
protected

Starting from a directory, this function looks for all shared libraries in the sub-directories and add them in the containers.

Parameters
dirRoot directory to scan.
pluginsStrings for each main plug-ins.
dlgsStrings for each dialog plug-ins.
void Load ( const R::RContainer< R::RString, true, false > &  dirs,
bool  dlg = true 
)
protected

Load all plug-ins and their dialog boxes.

Parameters
dirsDirectories to search in.
dlgShould the dialog boxes be loaded?
virtual GStorage* CreateStorage ( GSession session)
protectedvirtual

Create a valid storage. The method is call when a session is opened for which a current storage doesn't exist. By default, this method does nothing.

Parameters
sessionSession for which the stoarge must be created.
Returns
a valid pointer to a GStorage.
R::RCursor<GPlugInManager> GetManagers ( void  )

Get a cursor over all the managers.

Returns
GPlugInManager A cursor on the managers
GPlugInManager* GetManager ( const R::RString mng) const

Get the manager associated to the "name".

Parameters
mngName of the manager to be found.
R::RCursor<GPlugInFactory> GetFactories ( const R::RString mng,
const R::RString list = R::RString::Null 
) const

Get the factories of a given manager.

Parameters
mngName of the manager to be found.
listList.
R::RCastCursor<GPlugIn,plugin> GetPlugIns ( const R::RString mng,
const R::RString list = R::RString::Null 
) const

Get the plug-ins of a given manager.

Template Parameters
pluginClass of the plug-in.
Parameters
mngName of the manager to be found.
listList.
GPlugInFactory* GetFactory ( const R::RString mng,
const R::RString name,
const R::RString list,
int  need = 1 
) const

Get a factory of a given manager.

Parameters
mngName of the manager to be found.
nameName of the plug-in.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugInFactory* GetFactory ( const R::RString mng,
const R::RString name,
int  need = 1 
) const

Get a factory of a given manager.

Parameters
mngName of the manager to be found.
nameName of the plug-in.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugIn* GetPlugIn ( const R::RString mng,
const R::RString name,
const R::RString list,
int  need = 1 
) const

Get a plug-in of a given manager.

Parameters
mngName of the manager to be found.
nameName of the plug-in.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugIn* GetPlugIn ( const R::RString mng,
const R::RString name,
int  need = 1 
) const

Get a plug-in of a given manager.

Parameters
mngName of the manager to be found.
nameName of the plug-in.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
plugin* GetPlugIn ( const R::RString mng,
const R::RString name,
const R::RString list,
int  need = 1 
) const

Get a plug-in of a given manager.

Template Parameters
pluginClass of the plug-in.
Parameters
mngName of the manager to be found.
nameName of the plug-in.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
plugin* GetPlugIn ( const R::RString mng,
const R::RString name,
int  need = 1 
) const

Get a plug-in of a given manager.

Template Parameters
pluginClass of the plug-in.
Parameters
mngName of the manager to be found.
nameName of the plug-in.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugInFactory* GetCurrentFactory ( const R::RString mng,
const R::RString list,
int  need = 1 
) const

Get the current factory of a given manager.

Parameters
mngName of the manager to be found.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
GPlugInFactory* GetCurrentFactory ( const R::RString mng,
int  need = 1 
) const

Get the current factory of a given manager.

Parameters
mngName of the manager to be found.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
plugin* GetCurrentPlugIn ( const R::RString mng,
const R::RString list,
int  need = 1 
) const

Get the current plug-in of a given manager.

Template Parameters
pluginClass of the plug-in.
Parameters
mngName of the manager to be found.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
plugin* GetCurrentPlugIn ( const R::RString mng,
int  need = 1 
) const

Get the current plug-in of a given manager.

Template Parameters
pluginClass of the plug-in.
Parameters
mngName of the manager to be found.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
void SetCurrentPlugIn ( const R::RString mng,
const R::RString name,
const R::RString list,
int  need = 1 
)

Set the current plug-in for a given manager.

Parameters
mngName of the manager to be found.
nameName of the method.
listList.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
void SetCurrentPlugIn ( const R::RString mng,
const R::RString name,
int  need = 1 
)

Set the current plug-in for a given manager.

Parameters
mngName of the manager to be found.
nameName of the method.
needIf the parameter is non-null and the plug-in doesn't exist, generate an exception.
void RunPrg ( GSlot rec,
const R::RString filename 
)

Run a "program".

Parameters
recSlot that receive information.
filenameName of the file.
GFilter* FindMIMEType ( GDoc doc) const

Find the filter corresponding to a document based on the MIME type.

An exception is generated if no filter was found (no MIME type, no corresponding filter, ...).

Parameters
docDocument to analyse.
Returns
the filter needed to analyse the document.
GFilter* FindScheme ( GDoc doc) const

Find the filter corresponding to a given scheme. This allows GALILEI to manage exotic schemes that CURL cannot handle.

Parameters
docDocument with a given scheme.
Returns
the filter or a null pointer if no filter is found (hoping that CURL can handle the protocol).
void AddScheme ( const char *  mime,
GFilter f 
)

Add a pair (Scheme,filter).

Parameters
scheùeName of the scheme.
fPointer to the filter.
void AddMIME ( const char *  mime,
GFilter f 
)

Add a pair (MIME type,filter).

Parameters
mimeName of the MIME type.
fPointer to the filter.
void DelMIMES ( GFilter f)

Delete all the MIME type associated with a filter.

Parameters
fPointer to the filter.

Member Data Documentation

R::RContainer<GSession,true,true> Sessions
protected

The Sessions.

R::RRWLock lSessions
protected

Reader/writer lock on Session.

GPlugInManager* Storages
protected

The storages.

GPlugInManager* Langs
protected

The languages.

bool LoadDialogs
protected

Load the dialog boxes

R::RContainer<R::RString,true,false> PlugInsPaths
protected

Path where to search for plug-ins

R::RString IndexDir
protected

Directory where to binary files of the index are stored.

R::RContainer<cFilter,true,true> MIMES
protected

List of all pairs (MIME type,filter) available.

R::RContainer<cExt,true,true> Exts
protected

List of all pairs (extension, MIME type) available.

R::RContainer<cFilter,true,true> Schemes
protected

List of all pairs (Schemes,filter) available.

R::RTextFile Log
protected

Log file for the application.