Index: ppapi/cpp/dev/string_wrapper_dev.h |
diff --git a/ppapi/cpp/dev/string_wrapper_dev.h b/ppapi/cpp/dev/string_wrapper_dev.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aae7b80defb97660e85679052ffa0eb89c2bfbb8 |
--- /dev/null |
+++ b/ppapi/cpp/dev/string_wrapper_dev.h |
@@ -0,0 +1,47 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef PPAPI_CPP_DEV_STRING_WRAPPER_DEV_H_ |
+#define PPAPI_CPP_DEV_STRING_WRAPPER_DEV_H_ |
+ |
+#include <string> |
+ |
+#include "ppapi/c/pp_var.h" |
+#include "ppapi/cpp/dev/may_own_ptr_dev.h" |
+ |
+namespace pp { |
+namespace internal { |
+ |
+class StringWrapper { |
+ public: |
+ StringWrapper(PP_Var* storage, NotOwned); |
+ explicit StringWrapper(const std::string& value); |
+ StringWrapper(const StringWrapper& other); |
+ |
+ ~StringWrapper(); |
+ |
+ StringWrapper& operator=(const StringWrapper& other); |
+ StringWrapper& operator=(const PP_Var& other); |
+ |
+ bool is_set() const; |
+ void unset(); |
+ // TODO(yzshen): it should be easy to add a cache. |
+ std::string get() const; |
+ void set(const std::string& value); |
+ |
+ const PP_Var& ToVar() const { |
+ return *storage_; |
+ } |
+ |
+ PP_Var* StartRawUpdate() { return storage_.get(); } |
+ void EndRawUpdate() {} |
+ |
+ private: |
+ MayOwnPtr<PP_Var> storage_; |
+}; |
+ |
+} // namespace internal |
+} // namespace pp |
+ |
+#endif // PPAPI_CPP_DEV_STRING_WRAPPER_DEV_H_ |