[bt-devel] (no subject)

Joachim Ansorg junkmail at joachim.ansorgs.de
Wed Jul 14 02:25:01 MST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

> cswordbackend.cpp:537: error: `constBegin' undeclared (first use this
> function)
> cswordbackend.cpp:537: error: (Each undeclared identifier is reported only
> once for each function it appears in.)
> cswordbackend.cpp:537: error: `constEnd' undeclared (first use this
> function)

I have to check this. It seems Qt 3.1 doesn't support const iterators. Or 
Mandrake disabled them.

> cswordbackend.cpp: In member function `const QString
> CSwordBackend::booknameLanguage(const QString&)':
> cswordbackend.cpp:500: error: cannot call member function `virtual void
> sword::LocaleMgr::setDefaultLocaleName(const char*)' without object
> cswordbackend.cpp:502: error: cannot call member function `virtual const
> char* sword::LocaleMgr::getDefaultLocaleName()' without object
> cswordbackend.cpp: In member function `const QStringList
> CSwordBackend::swordDirList()':

Hm, that's strange. You're using BibleTime's and Sword's CVS, right?
Have you made sure that there are no old header files of Sword (e.g. 
localemgr.h)?

On line 500 it says 
sword::LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName

> I need to read up on virtual functions. I thought you can not use a
> "virtual" function directly, but must create a subclass where the function
> is declared non-virtual. In Java the analogy is an "abstract" method.

The right direction :)
The equivalent to an abstract method like in Java is a pure virtual method in 
C++, e.g. declared with "virtual void myFunction() = 0;", which means it has 
no implementation and a subclass has to implement it before objects of the 
subclass may be created.

A normal virtual function is like "virtual void myFunction() { /*impl*/ };", 
it has a (default) implementation, but can be reimplemented in child classes.

> Seems like you have to create a LocaleMgr object and then call
> getDefaultLocaleName() on that object. Because getDefaultLocaleName() is a
> member function, not a static function. (Not a C++ expert, but I'd like to
> learn)

Yes, that's correct.
The object of LocaleMgr is return by the getSystemLocaleMgr static function 
call. LocaleMgr is a singleton, i.e. it makes sure only one object exists and 
manages itself.

> So, how do I create such an object? There is a warning in the 
> default constructor not to call it directly, but use a static variable of
> type LocaleMgr, called 'defaultLocaleMgr' (or something), but I could not
> call any methods on that when I modified sword 1.5.7 yesterday. Probably
> because static objects don't like set() methods :)

The comment is outdated I guess :( We use the getSystemLocaleMgr() function 
instead to get the valid object of LocaleMgr.

I think it should be possible to call set() methods on static objects (but 
don't quote me here :)

After 1.5.7 the LocaleMgr was turned into a Singleton, so using Sword's CVS 
should fix this problem.

I hope that helps,
Joachim
- -- 
<>< Re: deemed!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA9PvxEyRIb2AZBB0RAt3VAJ91Hs3dQSHJDXt26lgrMUo3+nrxUgCfe7mU
mERj2LaQkcvHBpz2l5rXiCg=
=Najy
-----END PGP SIGNATURE-----


More information about the bt-devel mailing list