[sword-devel] CreateMod

Troy A. Griffitts scribe at crosswire.org
Sun Mar 8 09:24:14 MST 2009


Dear Manfred,

CreateMod is a factory method in SWMgr for creating SWModule objects.

You shouldn't need to ever call it yourself.  mgr->getModule("KJV") for 
example will give you the correct SWModule object (currently zText) for 
the KJV module.

Likely not what you want.

If you'd like to actually create a new module on disk, then you can call 
the static createModule(...) method on any of the specific drivers.

For example, you could make a new RawCom module on disk along with its 
corresponding .conf file, something like:

// let's create the directory for storing our module
FileMgr::createParent("/Users/mbergmann/Applications/MacSword/modules/comments/rawcom/mbergmannCommentary1/x");

// let's create a brand new empty module
RawCom::createModule("/Users/mbergmann/Applications/MacSword/modules/comments/rawcom/mbergmannCommentary1");

// let's add our .conf file
SWConfig 
mbergmannConf("/Users/mbergmann/Applications/MacSword/mods.d/mbergmannCommentary1.conf");

mbergmanConf["MBergmannCommentary1"]["DataPath"] = 
"./modules/comments/rawcom/mbergmannCommentary1";
mbergmanConf["MBergmannCommentary1"]["ModDrv"] = "RawCom";
mbergmanConf["MBergmannCommentary1"]["SourceType"] = "OSIS";
mbergmanConf["MBergmannCommentary1"]["Decription"] = "Manfred Bergmann's 
Concise Commentary on the Bible";
mbergmanConf["MBergmannCommentary1"]["About"] = "...";
mbergmanConf.Save();


Hope this is useful.

	-Troy.




Manfred Bergmann wrote:
> Hi.
> 
> I have seen that SWMgr has a method CreateMod().
> What does it do? Can it create all types of modules?
> 
> 
> Regards,
> Manfred
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list