[sword-devel] C++ question

Troy A. Griffitts sword-devel@crosswire.org
Wed, 11 Oct 2000 15:28:21 -0700


> We want to derive our classes directly from SWModule, but IMHO this is not
> possible. But perhaps I think this because I don't know C++ very well.

IMHO, I don't believe this is the best design.  Let me explain why:

	o I think in Torsten's thoughts on the original backend, he wanted to
allow other engines besides sword.  Now obviously, I think we'll be able
to give you everything you need :), but if you extend SWModule, you will
not have the option to use others.

	o  SWMgr is designed to give out 'sets' of base SWModule's.   It
handles creating the correct SWModule derivitate for the frontend
developer, based upon each module's configuration.  This 'common' base
class of functionality is SWModule, or possibly (logically) one level
shallower, SWText, SWCom, or SWLD (known by SWModule::Type()).

	o  If you want to augment the COMMON functionality of what a 'MODULE'
does, the correct place to do it would be IN SWModule (or SWText, ...,
if they are more specific to a module type.)


Let me know what kind of stuff you are thinking and we'll add it if it's
appropriate.

	-Troy.




> We want to have a class called CSwordBibleModuleInfo, which should derive
> from SWText.
> If I want to do this I would have to reimplement SWMgr::Load() so that
> CSwordBibleModuleInfo objects are created.
> But Sword creates the modules in this way:
> 
>         SWModule* module = new RawText(...);
> 
> I don't know how to change this without creating dozens of new classes like
> CSwordRawTextModuleInfo.
> We have the classes to divide the classes into three types (Bibles,
> commentaries and Lexicons), so we don't want to add classes like
> CSwordRawTextModuleInfo.
> 
> Troy, do you know a solution how to solve this problem?
> 
> Thank you very much!
> --Joachim