[wx-discuss] wxTNG: using external libraries

Michael Wetherell mike.wetherell at ntlworld.com
Fri Feb 17 07:59:15 PST 2006


On Friday 17 Feb 2006 13:46, Julian Smart wrote:
> I'm still cringing at the necessity to type two colons, which
> means faster onset of repetitive strain injury, as well as being
> harder on the eye. I think we should make it officially sanctioned to
> write wxString for wx::String, wxWindow for wx::Window, etc. and not
> something anyone has to feel slightly guilty about.

You won't need to type two colons on everything, you actually get 
cleaner looking code since you usually don't need any prefix.

e.g. in a header you wrap the whole thing in a single namespace block:

namespace wxWidgets {
...
}

then inside there you don't use the prefix, e.g.:

class WXDLLIMPEXP_BASE Event : public Object
{
private:
    Event& operator=(const Event&);

protected:
    Event(const Event&);

public:
    Event(int winid = 0, EventType commandType = EVT_NULL);

Which looks cleaner. Same thing in the implementation .cpp files.

For user code it's different, since they're not adding to our namespace. 
So in user .cpp files they can use:
	using wxWidgets::Window;
then they don't need to prefix the names in their code either.

The one place where fully qualified names are needed is where a 
wxWidgets type is used in a user header. In that case they can't use 
'using', but that's a small number of cases, so overall it's an 
improvement.

Regards,
Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-discuss-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-discuss-help at lists.wxwidgets.org





More information about the wx-discuss mailing list