aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/arenastring.h
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:48:38 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:59:59 -0800
commit5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch)
tree0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/arenastring.h
parente28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff)
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/arenastring.h')
-rwxr-xr-xsrc/google/protobuf/arenastring.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index 590ffce9..b60ee379 100755
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -37,7 +37,6 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/fastmem.h>
#include <google/protobuf/arena.h>
-#include <google/protobuf/generated_message_util.h>
@@ -64,9 +63,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
}
// Basic accessors.
- inline const ::std::string& Get(const ::std::string* /* default_value */) const {
- return *ptr_;
- }
+ inline const ::std::string& Get() const { return *ptr_; }
inline ::std::string* Mutable(const ::std::string* default_value,
::google::protobuf::Arena* arena) {
@@ -150,13 +147,12 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
std::swap(ptr_, other->ptr_);
}
- // Frees storage (if not on an arena) and sets field to default value.
+ // Frees storage (if not on an arena).
inline void Destroy(const ::std::string* default_value,
::google::protobuf::Arena* arena) {
if (arena == NULL && ptr_ != default_value) {
delete ptr_;
}
- ptr_ = const_cast< ::std::string* >(default_value);
}
// Clears content, but keeps allocated string if arena != NULL, to avoid the
@@ -216,9 +212,7 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
void AssignWithDefault(const ::std::string* default_value, ArenaStringPtr value);
- inline const ::std::string& GetNoArena(const ::std::string* /* default_value */) const {
- return *ptr_;
- }
+ inline const ::std::string& GetNoArena() const { return *ptr_; }
inline ::std::string* MutableNoArena(const ::std::string* default_value) {
if (ptr_ == default_value) {
@@ -253,7 +247,6 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
if (ptr_ != default_value) {
delete ptr_;
}
- ptr_ = NULL;
}
inline void ClearToEmptyNoArena(const ::std::string* default_value) {
@@ -281,6 +274,10 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
return &ptr_;
}
+ inline bool IsDefault(const ::std::string* default_value) const {
+ return ptr_ == default_value;
+ }
+
private:
::std::string* ptr_;