G
gw7rib
I'm writing a program involving having notes which can store text. In
the beginning, I had a class called Note which did nearly everything,
but I felt it was getting too big and so have created other classes to
deal with the text handling and with the displaying of the note. So
some functions which were previously handled by the Note class are
forwarded to these other classes. For example, the definition of the
class includes:
void hide(void) { display.hide(); }
void cleartext(void) { text.cleartext(); }
void repaint(int newsize) { display.repaint(newsize); }
int isshowing(void) { return display.isshowing(); }
void adjustHscroll(void) { display.adjustHscroll(); }
void adjustVscroll(void) { display.adjustVscroll(); }
int getystep(void) { return display.getystep(); }
int getmousestep(void) { return display.getmousestep(); }
void notehidden(void) { display.notehidden(); }
I thought this was a little ugly and so was considering using macros
to change it to:
FORWARD (display, hide)
FORWARD (text, cleartext)
FORWARDvi (display, repaint, newsize)
FORWARDi (display, isshowing)
FORWARD (display, adjustHscroll)
FORWARD (display, adjustVscroll)
FORWARDi (display, getystep)
FORWARDi (display, getmousestep)
FORWARD (display, notehidden)
Any comments on this? Does it look neat? Or ugly? Are there flaws I
haven't thought of? Does the fact that so many routines are forwarded
show the whole design is bad? Can you come up with better names?
Thanks for any thoughts.
Paul.
the beginning, I had a class called Note which did nearly everything,
but I felt it was getting too big and so have created other classes to
deal with the text handling and with the displaying of the note. So
some functions which were previously handled by the Note class are
forwarded to these other classes. For example, the definition of the
class includes:
void hide(void) { display.hide(); }
void cleartext(void) { text.cleartext(); }
void repaint(int newsize) { display.repaint(newsize); }
int isshowing(void) { return display.isshowing(); }
void adjustHscroll(void) { display.adjustHscroll(); }
void adjustVscroll(void) { display.adjustVscroll(); }
int getystep(void) { return display.getystep(); }
int getmousestep(void) { return display.getmousestep(); }
void notehidden(void) { display.notehidden(); }
I thought this was a little ugly and so was considering using macros
to change it to:
FORWARD (display, hide)
FORWARD (text, cleartext)
FORWARDvi (display, repaint, newsize)
FORWARDi (display, isshowing)
FORWARD (display, adjustHscroll)
FORWARD (display, adjustVscroll)
FORWARDi (display, getystep)
FORWARDi (display, getmousestep)
FORWARD (display, notehidden)
Any comments on this? Does it look neat? Or ugly? Are there flaws I
haven't thought of? Does the fact that so many routines are forwarded
show the whole design is bad? Can you come up with better names?
Thanks for any thoughts.
Paul.