OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_CPP_DEV_FOOBAR_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_FOOBAR_DEV_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "ppapi/c/dev/ppb_foobar_dev.h" |
| 12 #include "ppapi/cpp/dev/optional_dev.h" |
| 13 #include "ppapi/cpp/dev/struct_wrapper_base_dev.h" |
| 14 #include "ppapi/cpp/instance_handle.h" |
| 15 #include "ppapi/cpp/output_traits.h" |
| 16 #include "ppapi/cpp/var.h" |
| 17 |
| 18 namespace pp { |
| 19 |
| 20 template <class T> |
| 21 class CompletionCallbackWithOutput; |
| 22 |
| 23 namespace foobar { |
| 24 |
| 25 class Bar : public internal::StructWrapperBase<PP_Bar, PP_Bar_Array> { |
| 26 public: |
| 27 Bar(); |
| 28 Bar(const Bar& other); |
| 29 explicit Bar(const PP_Bar& other); |
| 30 Bar(PP_Bar* storage, NotOwned); |
| 31 virtual ~Bar(); |
| 32 |
| 33 Bar& operator=(const Bar& other); |
| 34 Bar& operator=(const PP_Bar& other); |
| 35 |
| 36 private: |
| 37 virtual void NotifyStartRawUpdate(); |
| 38 virtual void NotifyEndRawUpdate(); |
| 39 }; |
| 40 |
| 41 class Foo : public internal::StructWrapperBase<PP_Foo, PP_Foo_Array> { |
| 42 public: |
| 43 Foo(); |
| 44 |
| 45 Foo(const Foo& other); |
| 46 // For taking input parameters from event listeners. |
| 47 explicit Foo(const PP_Foo& other); |
| 48 |
| 49 // For struct / array members. |
| 50 // Don't take ownership of |storage|, therefore |storage| must live longer |
| 51 // than this object. |
| 52 Foo(PP_Foo* storage, NotOwned); |
| 53 |
| 54 virtual ~Foo(); |
| 55 |
| 56 Foo& operator=(const Foo& other); |
| 57 Foo& operator=(const PP_Foo& other); |
| 58 |
| 59 double a() const; |
| 60 void set_a(double value); |
| 61 |
| 62 bool is_b_set() const; |
| 63 void unset_b(); |
| 64 double b() const; |
| 65 void set_b(double value); |
| 66 |
| 67 Array<double>& c(); |
| 68 const Array<double>& c() const; |
| 69 |
| 70 bool is_d_set() const; |
| 71 void unset_d(); |
| 72 Array<double>& d(); |
| 73 const Array<double>& d() const; |
| 74 /* |
| 75 const std::string& e() const; |
| 76 void set_e(const std::string& value); |
| 77 |
| 78 bool is_f_set() const; |
| 79 void unset_f(); |
| 80 const std::string& f() const; |
| 81 void set_f(const std::string& value); |
| 82 |
| 83 Array<std::string>& g(); |
| 84 const Array<std::string>& g() const; |
| 85 |
| 86 bool is_h_set() const; |
| 87 void unset_h(); |
| 88 Array<std::string>& h(); |
| 89 const Array<std::string>& h() const; |
| 90 |
| 91 Bar& i(); |
| 92 const Bar& i() const; |
| 93 |
| 94 bool is_j_set() const; |
| 95 void unset_j(); |
| 96 Bar& j(); |
| 97 const Bar& j() const; |
| 98 |
| 99 Array<Bar>& k(); |
| 100 const Array<Bar>& k() const; |
| 101 |
| 102 bool is_l_set() const; |
| 103 void unset_l(); |
| 104 Array<Bar>& l(); |
| 105 const Array<Bar>& l() const; |
| 106 */ |
| 107 |
| 108 private: |
| 109 virtual void NotifyStartRawUpdate(); |
| 110 virtual void NotifyEndRawUpdate(); |
| 111 |
| 112 Optional<double> b_wrapper_; |
| 113 Array<double> c_wrapper_; |
| 114 Optional<Array<double> > d_wrapper_; |
| 115 /*StringWrapper e_wrapper_; |
| 116 Optional<StringWrapper> f_wrapper_; |
| 117 Array<StringWrapper> g_wrapper_; |
| 118 Optional<Array<StringWrapper> > h_wrapper_; |
| 119 Bar i_wrapper_; |
| 120 Optional<Bar> j_wrapper_; |
| 121 Array<Bar> k_wrapper_; |
| 122 OptionalArray<Bar> l_wrapper_;*/ |
| 123 }; |
| 124 |
| 125 class Foobar { |
| 126 public: |
| 127 explicit Foobar(const InstanceHandle& instance); |
| 128 ~Foobar(); |
| 129 |
| 130 typedef CompletionCallbackWithOutput<Foo> BazCallback; |
| 131 int32_t Baz(const std::string& str, |
| 132 const Optional<std::string>& optional_str, |
| 133 const Optional<double>& dbl, |
| 134 const BazCallback& callback); |
| 135 |
| 136 typedef CompletionCallbackWithOutput<Array<double> > QuxCallback; |
| 137 int32_t Qux(const QuxCallback& callback); |
| 138 |
| 139 typedef CompletionCallbackWithOutput<Array<Foo> > BlahCallback; |
| 140 int32_t Blah(const BlahCallback& callback); |
| 141 |
| 142 private: |
| 143 InstanceHandle instance_; |
| 144 }; |
| 145 |
| 146 } // namespace foobar |
| 147 } // namespace pp |
| 148 |
| 149 #endif // PPAPI_CPP_DEV_FOOBAR_DEV_H_ |
OLD | NEW |