diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-11 04:14:01 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-11-11 04:14:01 +0100 |
commit | 7206f6d1249da0dd8e879d0c0b26185fc6ef89d9 (patch) | |
tree | 9f570b266ee49c06290c048b600346ab8b0dbddd /src/document.h | |
parent | 0987ca8b5b1a6ff50bfc8c3b171fdaf6cfff3a2b (diff) | |
download | sciteco-7206f6d1249da0dd8e879d0c0b26185fc6ef89d9.tar.gz |
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).
Diffstat (limited to 'src/document.h')
-rw-r--r-- | src/document.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/document.h b/src/document.h index 3053ea9..81700b4 100644 --- a/src/document.h +++ b/src/document.h @@ -26,17 +26,13 @@ #include "interface.h" #include "undo.h" +namespace SciTECO { + /* * Classes */ -/* - * NOTE: The only reason this is called TECODocument - * is to prevent a nameclash with Scintilla which - * does not use a proper namespace for its public - * symbols... - */ -class TECODocument { +class Document { typedef const void *SciDoc; SciDoc doc; @@ -45,11 +41,11 @@ class TECODocument { gint first_line, xoffset; public: - TECODocument() : doc(NULL) + Document() : doc(NULL) { reset(); } - virtual ~TECODocument() + virtual ~Document() { if (is_initialized()) interface.ssm(SCI_RELEASEDOCUMENT, 0, (sptr_t)doc); @@ -66,7 +62,7 @@ public: void update(void); inline void - update(const TECODocument &from) + update(const Document &from) { anchor = from.anchor; dot = from.dot; @@ -89,7 +85,7 @@ public: undo.push_var(xoffset); } - void exchange(TECODocument &other); + void exchange(Document &other); inline void undo_exchange(void) { @@ -98,4 +94,6 @@ public: } }; +} /* namespace SciTECO */ + #endif |