[Kde-games-devel] KGameSvgDocument

Mark A. Taff marktaff at comcast.net
Tue Mar 27 05:41:07 CEST 2007


On Monday 26 March 2007 12:04:58 Mark A. Taff wrote:
> I would very much appreciate any critiques on the class, from my coding
> style, to the api, to help with the d-pointer issue, to anything else
> obvious to an experienced c++ coder, yet oblivious to me. ;-)

I have made several changes based on feedback from <tsdgeos> (Albert Astals 
Cid) (Thanks!) in #kdegames on freenode:

1) removed excessive use of the @author tag
2) added "const" to the end of the method declarations & definitions for 
accessor methods, as they obviously aren't going to be changing values
3) Clarified the documentation for elementById()
4) Abstracted elementById() into elementByUniqueAttributeValue(), with 
elementById now a convenience function
5) Switched from Latin1 to Utf8 for reading and writing the SVG file
6) Reimplemented my d-pointer code, as this has to happen prior to svn commit, 
even though it is currently broken.

This code won't compile due to an unknown issue in my d-pointer setup, likely 
a confusion on my part about const/static.  Even then, it probably has 
another bug relating to passing info between the public and private classes, 
like in setCurrentNode and setCurrentElement.

I haven't tested some of the recent changes (due to the d-pointer issues), but 
I don't forsee any issues with them.

If anyone wants to compile my test app to help figure out what I'm doing wrong 
with my d-pointer, get the code at: 
http://marktaff.com/tmp/kgamelcd/kapp4-20070326.tar.gz

The class in question can be had at: 
http://www.marktaff.com/tmp/kgamelcd/kapp4/kgamesvgdocument.cpp
http://www.marktaff.com/tmp/kgamelcd/kapp4/kgamesvgdocument.h

I have left the code in an uncompileable state for the night; first time ever.  
Hope it doesn't come back to bite me.

The current compile errors are:

/home/kde-devel/kapp4/kgamesvgdocument.h: In member 
function ‘KGameSvgDocument& KGameSvgDocument::operator=(const 
KGameSvgDocument&)’:

/home/kde-devel/kapp4/kgamesvgdocument.h:103: error: non-static const 
member ‘KGameSvgDocumentPrivate* const KGameSvgDocument::d’, can't use 
default assignment operator

/home/kde-devel/kapp4/tsvgdigits.cpp: In 
constructor ‘TSvgDigits::TSvgDigits(QString)’:

/home/kde-devel/kapp4/tsvgdigits.cpp:38: note: synthesized 
method ‘KGameSvgDocument& KGameSvgDocument::operator=(const 
KGameSvgDocument&)’ first required here

I've googled on "can't use default assignment operator" but haven't found 
anything meaningful to me.

Night, and thanks for all the help. :-)

Regards,

Mark


More information about the kde-games-devel mailing list