Using Classwizard To Browse Namespaces|
Hello, this is my first TOTD. I've grown quite fond of using the
ClassWizard to organize and quickly locate my code. However, when using
namespaces to organize code, they disappear.
So, we can fool ClassWizard into thinking our namespaces are classes. Here
is an example:
ClassWizard reads the first "class Math" and puts the namespace in the
ClassWizard pane. Since the function definition would be "void
Math::CalcSomething()", you can actually double-click to go to the function.
If you use some clever naming, you don't have to worry about knowing what is
a class and what is a namespace, either.
There is an "extension" to this tip I use with this, but less frequently,
because it's less convenient.
In the above example, the members will all appear private. Say you have
some internal function that is used only by members of that namespace.
This is what I would do in that case:
#define MATH_FUNC( x ) Math::x
#define MATH_FUNC( x ) x
and each function is defined in the .cpp like this:
void MATH_FUNC( InternalFunction )()
As I said, I use this second part of the tip less frequently, because
personally I feel it's more ugliness than worth.
But in the second example the members that are accessible outside the
namespace are shown as public, and the "internal" functions are shown
private, but you can still use ClassWizard to navigate to them.
The zip file viewer built into the Developer Toolbox made use
of the zlib library, as well as the zlibdll source additions.