From 0d857999bfce2f2f485ed91c1d32a6378e33448a Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Wed, 17 Jun 2015 14:51:07 +0100 Subject: [PATCH] Make default type ID strings const. Signed-off-by: Dave Hickin --- src/factory/FieldCreateFactory.cpp | 18 +++++++++--------- src/pv/pvIntrospect.h | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/factory/FieldCreateFactory.cpp b/src/factory/FieldCreateFactory.cpp index 32df6cc..76eb7f1 100644 --- a/src/factory/FieldCreateFactory.cpp +++ b/src/factory/FieldCreateFactory.cpp @@ -399,11 +399,11 @@ void UnionArray::deserialize(ByteBuffer* /*buffer*/, DeserializableControl* /*co throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead"); } -string Structure::DEFAULT_ID = Structure::defaultId(); +const string Structure::DEFAULT_ID = Structure::defaultId(); -string & Structure::defaultId() +const string & Structure::defaultId() { - static string id = "structure"; + static const string id = "structure"; return id; } @@ -537,19 +537,19 @@ void Structure::deserialize(ByteBuffer* /*buffer*/, DeserializableControl* /*con throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead"); } -string Union::DEFAULT_ID = Union::defaultId(); +const string Union::DEFAULT_ID = Union::defaultId(); -string & Union::defaultId() +const string & Union::defaultId() { - static string id = "union"; + static const string id = "union"; return id; } -string Union::ANY_ID = Union::anyId(); +const string Union::ANY_ID = Union::anyId(); -string & Union::anyId() +const string & Union::anyId() { - static string id = "any"; + static const string id = "any"; return id; } diff --git a/src/pv/pvIntrospect.h b/src/pv/pvIntrospect.h index 3166407..2ad3888 100644 --- a/src/pv/pvIntrospect.h +++ b/src/pv/pvIntrospect.h @@ -649,13 +649,13 @@ public: /** * Default structure ID. */ - static std::string DEFAULT_ID; + static const std::string DEFAULT_ID; /** * Get the default structure ID. * @return The default structure ID. */ - static std::string & defaultId(); + static const std::string & defaultId(); /** * Destructor. @@ -759,24 +759,24 @@ public: /** * Default union ID. */ - static std::string DEFAULT_ID; + static const std::string DEFAULT_ID; /** * Get the default union ID. * @return The default union ID. */ - static std::string & defaultId(); + static const std::string & defaultId(); /** * Default variant union ID. */ - static std::string ANY_ID; + static const std::string ANY_ID; /** * Get the default variant union ID. * @return The default variant union ID. */ - static std::string & anyId(); + static const std::string & anyId(); /** * Destructor.