From f0b840c4f7f3c20a5bb420ff71c361638f84df19 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 21 Nov 2007 11:19:10 +0000 Subject: [PATCH] getURLString() is const now to avoid uneeded copying when using UrlLists --- contrib/ldapc++/src/LDAPUrl.cpp | 6 +++--- contrib/ldapc++/src/LDAPUrl.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/ldapc++/src/LDAPUrl.cpp b/contrib/ldapc++/src/LDAPUrl.cpp index a960ef6f5c..95b510af75 100644 --- a/contrib/ldapc++/src/LDAPUrl.cpp +++ b/contrib/ldapc++/src/LDAPUrl.cpp @@ -70,7 +70,7 @@ void LDAPUrl::setScope( const std::string &scope ) regenerate = true; } -const string& LDAPUrl::getURLString() +const string& LDAPUrl::getURLString() const { if (regenerate){ this->components2Url(); @@ -323,7 +323,7 @@ void LDAPUrl::string2list(const std::string &src, StringList& sl, } -void LDAPUrl::components2Url() +void LDAPUrl::components2Url() const { std::ostringstream url; std::string encoded = ""; @@ -395,7 +395,7 @@ void LDAPUrl::components2Url() void LDAPUrl::percentEncode( const std::string &src, std::string &dest, - int flags) + int flags) const { std::ostringstream o; o.setf(std::ios::hex, std::ios::basefield); diff --git a/contrib/ldapc++/src/LDAPUrl.h b/contrib/ldapc++/src/LDAPUrl.h index 16e1810e6f..71d2dd3b82 100644 --- a/contrib/ldapc++/src/LDAPUrl.h +++ b/contrib/ldapc++/src/LDAPUrl.h @@ -58,7 +58,7 @@ class LDAPUrl{ /** * @return The complete URL as a string */ - const std::string& getURLString(); + const std::string& getURLString() const; /** * Set the URL member attribute @@ -140,7 +140,7 @@ class LDAPUrl{ */ void percentEncode( const std::string& src, std::string& dest, - int flags=0 ); + int flags=0 ) const; protected : /** @@ -158,13 +158,13 @@ class LDAPUrl{ * (this function is mostly for internal use and gets called * automatically whenever necessary) */ - void components2Url(); + void components2Url() const; void string2list(const std::string &src, StringList& sl, bool percentDecode=false); protected : - bool regenerate; + mutable bool regenerate; int m_Port; int m_Scope; std::string m_Host; @@ -172,7 +172,7 @@ class LDAPUrl{ std::string m_Filter; StringList m_Attrs; StringList m_Extensions; - std::string m_urlString; + mutable std::string m_urlString; std::string m_Scheme; enum mode { base, attrs, scope, filter, extensions }; }; -- 2.39.5