| Index: ppapi/cpp/dev/foobar_dev.cc
|
| diff --git a/ppapi/cpp/dev/foobar_dev.cc b/ppapi/cpp/dev/foobar_dev.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9b9c34bd83a2ca7980d3c82ca7a4e738e575558b
|
| --- /dev/null
|
| +++ b/ppapi/cpp/dev/foobar_dev.cc
|
| @@ -0,0 +1,212 @@
|
| +// 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.
|
| +
|
| +#include "ppapi/cpp/dev/foobar_dev.h"
|
| +
|
| +#include "ppapi/cpp/completion_callback.h"
|
| +#include "ppapi/cpp/dev/array_dev.h"
|
| +#include "ppapi/cpp/dev/from_c_type_converter_dev.h"
|
| +#include "ppapi/cpp/dev/to_c_type_converter_dev.h"
|
| +#include "ppapi/cpp/module_impl.h"
|
| +
|
| +namespace pp {
|
| +
|
| +namespace {
|
| +
|
| +template <> const char* interface_name<PPB_Foobar_0_1>() {
|
| + return PPB_FOOBAR_INTERFACE_0_1;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +namespace foobar {
|
| +
|
| +Foo::Foo() : b_wrapper_(&storage_->b, NOT_OWNED),
|
| + c_wrapper_(&storage_->c, NOT_OWNED),
|
| + d_wrapper_(&storage_->d, NOT_OWNED) {
|
| +
|
| +}
|
| +
|
| +Foo::Foo(const Foo& other) : b_wrapper_(&storage_->b, NOT_OWNED),
|
| + c_wrapper_(&storage_->c, NOT_OWNED),
|
| + d_wrapper_(&storage_->d, NOT_OWNED) {
|
| + operator=(other);
|
| +}
|
| +
|
| +Foo::Foo(const PP_Foo& other) : b_wrapper_(&storage_->b, NOT_OWNED),
|
| + c_wrapper_(&storage_->c, NOT_OWNED),
|
| + d_wrapper_(&storage_->d, NOT_OWNED) {
|
| + operator=(other);
|
| +}
|
| +
|
| +Foo::Foo(PP_Foo* storage, NotOwned) : StructWrapperBase(storage, NOT_OWNED),
|
| + b_wrapper_(&storage_->b, NOT_OWNED),
|
| + c_wrapper_(&storage_->c, NOT_OWNED),
|
| + d_wrapper_(&storage_->d, NOT_OWNED) {
|
| +}
|
| +
|
| +Foo::~Foo() {
|
| +}
|
| +
|
| +Foo& Foo::operator=(const Foo& other) {
|
| + return operator=(*other.storage_);
|
| +}
|
| +
|
| +Foo& Foo::operator=(const PP_Foo& other) {
|
| + if (storage_.get() == &other)
|
| + return *this;
|
| +
|
| + storage_->a = other.a;
|
| + b_wrapper_ = other.b;
|
| + c_wrapper_ = other.c;
|
| + d_wrapper_ = other.d;
|
| +
|
| + return *this;
|
| +}
|
| +
|
| +double Foo::a() const {
|
| + return storage_->a;
|
| +}
|
| +
|
| +void Foo::set_a(double value) {
|
| + storage_->a = value;
|
| +}
|
| +
|
| +bool Foo::is_b_set() const {
|
| + return b_wrapper_.is_set();
|
| +}
|
| +
|
| +void Foo::unset_b() {
|
| + b_wrapper_.unset();
|
| +}
|
| +
|
| +double Foo::b() const {
|
| + return b_wrapper_.get();
|
| +}
|
| +
|
| +void Foo::set_b(double value) {
|
| + b_wrapper_.set(value);
|
| +}
|
| +
|
| +Array<double>& Foo::c() {
|
| + return c_wrapper_;
|
| +}
|
| +
|
| +const Array<double>& Foo::c() const {
|
| + return c_wrapper_;
|
| +}
|
| +
|
| +bool Foo::is_d_set() const {
|
| + return d_wrapper_.is_set();
|
| +}
|
| +
|
| +void Foo::unset_d() {
|
| + d_wrapper_.unset();
|
| +}
|
| +
|
| +Array<double>& Foo::d() {
|
| + return d_wrapper_.get();
|
| +}
|
| +
|
| +const Array<double>& Foo::d() const {
|
| + return d_wrapper_.get();
|
| +}
|
| +
|
| +/*
|
| + const std::string& e() const;
|
| + void set_e(const std::string& value);
|
| +
|
| + bool is_f_set() const;
|
| + void unset_f();
|
| + const std::string& f() const;
|
| + void set_f(const std::string& value);
|
| +
|
| + Array<std::string>& g();
|
| + const Array<std::string>& g() const;
|
| +
|
| + bool is_h_set() const;
|
| + void unset_h();
|
| + Array<std::string>& h();
|
| + const Array<std::string>& h() const;
|
| +
|
| + Bar& i();
|
| + const Bar& i() const;
|
| +
|
| + bool is_j_set() const;
|
| + void unset_j();
|
| + Bar& j();
|
| + const Bar& j() const;
|
| +
|
| + Array<Bar>& k();
|
| + const Array<Bar>& k() const;
|
| +
|
| + bool is_l_set() const;
|
| + void unset_l();
|
| + Array<Bar>& l();
|
| + const Array<Bar>& l() const;
|
| +*/
|
| +
|
| +void Foo::NotifyStartRawUpdate() {
|
| + b_wrapper_.StartRawUpdate();
|
| + c_wrapper_.StartRawUpdate();
|
| + d_wrapper_.StartRawUpdate();
|
| +}
|
| +
|
| +void Foo::NotifyEndRawUpdate() {
|
| + b_wrapper_.EndRawUpdate();
|
| + c_wrapper_.EndRawUpdate();
|
| + d_wrapper_.EndRawUpdate();
|
| +}
|
| +
|
| +Foobar::Foobar(const InstanceHandle& instance) : instance_(instance) {
|
| +}
|
| +
|
| +Foobar::~Foobar() {
|
| +}
|
| +
|
| +int32_t Foobar::Baz(const std::string& str,
|
| + const Optional<std::string>& optional_str,
|
| + const Optional<double>& dbl,
|
| + const BazCallback& callback) {
|
| + if (!has_interface<PPB_Foobar_0_1>())
|
| + return callback.MayForce(PP_ERROR_NOINTERFACE);
|
| +
|
| + internal::ToCTypeConverter<std::string> str_converter(str);
|
| + internal::ToCTypeConverter<Optional<std::string> > optional_str_converter(
|
| + optional_str);
|
| + internal::ToCTypeConverter<Optional<double> > dbl_converter(dbl);
|
| +
|
| + return get_interface<PPB_Foobar_0_1>()->Baz(
|
| + instance_.pp_instance(),
|
| + str_converter.GetArg(),
|
| + optional_str_converter.GetArg(),
|
| + dbl_converter.GetArg(),
|
| + callback.output(),
|
| + callback.pp_completion_callback());
|
| +}
|
| +
|
| +int32_t Foobar::Qux(const QuxCallback& callback) {
|
| + if (!has_interface<PPB_Foobar_0_1>())
|
| + return callback.MayForce(PP_ERROR_NOINTERFACE);
|
| +
|
| + return get_interface<PPB_Foobar_0_1>()->Qux(
|
| + instance_.pp_instance(),
|
| + callback.output(),
|
| + internal::ArrayAllocator::Get(),
|
| + callback.pp_completion_callback());
|
| +}
|
| +
|
| +int32_t Foobar::Blah(const BlahCallback& callback) {
|
| + if (!has_interface<PPB_Foobar_0_1>())
|
| + return callback.MayForce(PP_ERROR_NOINTERFACE);
|
| +
|
| + return get_interface<PPB_Foobar_0_1>()->Blah(
|
| + instance_.pp_instance(),
|
| + callback.output(),
|
| + internal::ArrayAllocator::Get(),
|
| + callback.pp_completion_callback());
|
| +}
|
| +
|
| +} // namespace foobar
|
| +} // namespace pp
|
|
|