From 7206f6d1249da0dd8e879d0c0b26185fc6ef89d9 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 11 Nov 2014 04:14:01 +0100 Subject: added all of SciTECO's declarations to the "SciTECO" namespace normally, since SciTECO is not a library, this is not strictly necessary since every library should use proper name prefixes or namespaces for all global declarations to avoid name clashes. However * you cannot always rely on that * Scintilla does violate the practice of using prefixes or namespaces. The public APIs are OK, but it does define global functions/methods, e.g. for "Document" that clashed with SciTECO's "TECODocument" class at link-time. Scintilla can put its definitions in a namespace, but this feature cannot be easily enabled without patching Scintilla. * a "SciTECO" namespace will be necessary if "SciTECO" is ever to be turned into a library. Even if this library will have only a C-linkage API, it must ensure it doesn't clutter the global namespace. So the old "TECODocument" class was renamed back to "Document" (SciTECO::Document). --- src/interface.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/interface.h') diff --git a/src/interface.h b/src/interface.h index a2ff00d..e2d24de 100644 --- a/src/interface.h +++ b/src/interface.h @@ -27,6 +27,8 @@ #include "undo.h" +namespace SciTECO { + /* avoid include dependency conflict */ class QRegister; class Buffer; @@ -129,6 +131,8 @@ public: void process_notify(SCNotification *notify); }; +} /* namespace SciTECO */ + #ifdef INTERFACE_GTK #include "interface-gtk.h" #elif defined(INTERFACE_NCURSES) @@ -137,7 +141,9 @@ public: #error No interface selected! #endif -/* object defined in main.cpp */ -extern InterfaceCurrent interface; +namespace SciTECO { + /* object defined in main.cpp */ + extern InterfaceCurrent interface; +} #endif -- cgit v1.2.3