#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 OptionalStringWrapper {
public:
OptionalStringWrapper();
explicit OptionalStringWrapper(const std::string& value);
OptionalStringWrapper(PP_Var* storage, NotOwned);
OptionalStringWrapper(const OptionalStringWrapper& other);
~OptionalStringWrapper();
OptionalStringWrapper& operator=(const OptionalStringWrapper& other);
OptionalStringWrapper& operator=(const PP_Var& other);
bool is_set() const;
void unset();
std::string get() const;
void set(const std::string& value);
const PP_Var& ToVar() const { return *storage_; }
PP_Var* StartRawUpdate();
void EndRawUpdate();
private:
MayOwnPtr<PP_Var> storage_;
};
class StringWrapper {
public:
StringWrapper();
explicit StringWrapper(const std::string& value);
StringWrapper(PP_Var* storage, NotOwned);
StringWrapper(const StringWrapper& other);
~StringWrapper();
StringWrapper& operator=(const StringWrapper& other);
StringWrapper& operator=(const PP_Var& other);
std::string get() const { return storage_.get(); }
void set(const std::string& value) { return storage_.set(value); }
const PP_Var& ToVar() const { return storage_.ToVar(); }
PP_Var* StartRawUpdate();
void EndRawUpdate();
private:
OptionalStringWrapper storage_;
};
}
}
#endif