Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1001)

Unified Diff: ppapi/cpp/dev/string_wrapper_dev.h

Issue 60173003: Draft: apps APIs in Pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/dev/optional_dev.h ('k') | ppapi/cpp/dev/string_wrapper_dev.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « ppapi/cpp/dev/optional_dev.h ('k') | ppapi/cpp/dev/string_wrapper_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698