In article <bd**********@news01.intel.com>,
dr****@aaahawk.com says...
[ ... ]
The question is....is there a tool that can automatically perform
this sort of transformation to accessor methods from public
member variables?
I don't know of anything that does it entirely automatically, but right
now operator overloading just became one of your best friends.
Instead of attempting to find every place every variable is used, look
only for where they're declared, which is usually a LOT easier. Convert
each from its current type to an instance of a class that overloads
operator=(T const &) and operator T (where T is the original type).
These are your new "accessor" functions -- operator T converts your type
to the original type just before its value gets assigned, and operator=
gets called (of course) to assign some value to your object.
IMO, even if this didn't save a tremendous amount of work, it would
still be the way to go -- using accessor and mutator functions is almost
always quite ugly.
--
Later,
Jerry.
The universe is a figment of its own imagination.