diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2013-10-24 16:04:08 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2013-10-24 16:04:08 +0000 |
| commit | 9c27ef4d920ac6b05cd052cf48fa1d0b85b194b9 (patch) | |
| tree | 58ca3614efed828528b725234c945cebeb2cbe81 /src | |
| parent | fix bad style (diff) | |
| download | inkscape-9c27ef4d920ac6b05cd052cf48fa1d0b85b194b9.tar.gz inkscape-9c27ef4d920ac6b05cd052cf48fa1d0b85b194b9.zip | |
try to add some const-correctness
(bzr r12719)
Diffstat (limited to 'src')
| -rw-r--r-- | src/document.cpp | 2 | ||||
| -rw-r--r-- | src/document.h | 3 | ||||
| -rw-r--r-- | src/sp-namedview.cpp | 5 | ||||
| -rw-r--r-- | src/sp-namedview.h | 1 |
4 files changed, 9 insertions, 2 deletions
diff --git a/src/document.cpp b/src/document.cpp index e1df38da1..3433e42ec 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -559,7 +559,7 @@ SPDocument *SPDocument::doUnref() } /// guaranteed not to return nullptr -Inkscape::Util::Unit const* SPDocument::getDefaultUnit() +Inkscape::Util::Unit const* SPDocument::getDefaultUnit() const { SPNamedView const* nv = sp_document_namedview(this, NULL); return nv ? nv->getDefaultUnit() : unit_table.getUnit("pt"); diff --git a/src/document.h b/src/document.h index 6982e4c4f..0977fc7a8 100644 --- a/src/document.h +++ b/src/document.h @@ -124,6 +124,7 @@ public: /** Returns our SPRoot */ SPRoot *getRoot() { return root; } + SPRoot const *getRoot() const { return root; } Inkscape::XML::Node *getReprRoot() { return rroot; } @@ -228,7 +229,7 @@ public: SPDocument *doRef(); SPDocument *doUnref(); - Inkscape::Util::Unit const* getDefaultUnit(); + Inkscape::Util::Unit const* getDefaultUnit() const; Inkscape::Util::Quantity getWidth() const; Inkscape::Util::Quantity getHeight() const; Geom::Point getDimensions() const; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index ad497ff2f..a01ba891e 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -1073,6 +1073,11 @@ SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) return (SPNamedView *) nv; } +SPNamedView const *sp_document_namedview(SPDocument const *document, const gchar *id) +{ + return sp_document_namedview(const_cast<SPDocument *>(document), id); // use a const_cast here to avoid duplicating code +} + void SPNamedView::setGuides(bool v) { g_assert(this->getRepr() != NULL); diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 00302e9a1..05cbcc398 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -110,6 +110,7 @@ protected: SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name); +SPNamedView const *sp_document_namedview(SPDocument const *document, gchar const *name); void sp_namedview_window_from_document(SPDesktop *desktop); void sp_namedview_document_from_window(SPDesktop *desktop); |
