// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//

#include "libcef_dll/ctocpp/binary_value_ctocpp.h"
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/list_value_ctocpp.h"
#include "libcef_dll/ctocpp/value_ctocpp.h"


// STATIC METHODS - Body may be edited by hand.

CefRefPtr<CefValue> CefValue::Create() {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_value_t* _retval = cef_value_create();

  // Return type: refptr_same
  return CefValueCToCpp::Wrap(_retval);
}


// VIRTUAL METHODS - Body may be edited by hand.

bool CefValueCToCpp::IsValid() {
  if (CEF_MEMBER_MISSING(struct_, is_valid))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->is_valid(struct_);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::IsOwned() {
  if (CEF_MEMBER_MISSING(struct_, is_owned))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->is_owned(struct_);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::IsReadOnly() {
  if (CEF_MEMBER_MISSING(struct_, is_read_only))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->is_read_only(struct_);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::IsSame(CefRefPtr<CefValue> that) {
  if (CEF_MEMBER_MISSING(struct_, is_same))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: that; type: refptr_same
  DCHECK(that.get());
  if (!that.get())
    return false;

  // Execute
  int _retval = struct_->is_same(struct_,
      CefValueCToCpp::Unwrap(that));

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::IsEqual(CefRefPtr<CefValue> that) {
  if (CEF_MEMBER_MISSING(struct_, is_equal))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: that; type: refptr_same
  DCHECK(that.get());
  if (!that.get())
    return false;

  // Execute
  int _retval = struct_->is_equal(struct_,
      CefValueCToCpp::Unwrap(that));

  // Return type: bool
  return _retval?true:false;
}

CefRefPtr<CefValue> CefValueCToCpp::Copy() {
  if (CEF_MEMBER_MISSING(struct_, copy))
    return NULL;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_value_t* _retval = struct_->copy(struct_);

  // Return type: refptr_same
  return CefValueCToCpp::Wrap(_retval);
}

CefValueType CefValueCToCpp::GetType() {
  if (CEF_MEMBER_MISSING(struct_, get_type))
    return VTYPE_INVALID;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_value_type_t _retval = struct_->get_type(struct_);

  // Return type: simple
  return _retval;
}

bool CefValueCToCpp::GetBool() {
  if (CEF_MEMBER_MISSING(struct_, get_bool))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->get_bool(struct_);

  // Return type: bool
  return _retval?true:false;
}

int CefValueCToCpp::GetInt() {
  if (CEF_MEMBER_MISSING(struct_, get_int))
    return 0;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->get_int(struct_);

  // Return type: simple
  return _retval;
}

double CefValueCToCpp::GetDouble() {
  if (CEF_MEMBER_MISSING(struct_, get_double))
    return 0;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  double _retval = struct_->get_double(struct_);

  // Return type: simple
  return _retval;
}

CefString CefValueCToCpp::GetString() {
  if (CEF_MEMBER_MISSING(struct_, get_string))
    return CefString();

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_string_userfree_t _retval = struct_->get_string(struct_);

  // Return type: string
  CefString _retvalStr;
  _retvalStr.AttachToUserFree(_retval);
  return _retvalStr;
}

CefRefPtr<CefBinaryValue> CefValueCToCpp::GetBinary() {
  if (CEF_MEMBER_MISSING(struct_, get_binary))
    return NULL;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_binary_value_t* _retval = struct_->get_binary(struct_);

  // Return type: refptr_same
  return CefBinaryValueCToCpp::Wrap(_retval);
}

CefRefPtr<CefDictionaryValue> CefValueCToCpp::GetDictionary() {
  if (CEF_MEMBER_MISSING(struct_, get_dictionary))
    return NULL;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_dictionary_value_t* _retval = struct_->get_dictionary(struct_);

  // Return type: refptr_same
  return CefDictionaryValueCToCpp::Wrap(_retval);
}

CefRefPtr<CefListValue> CefValueCToCpp::GetList() {
  if (CEF_MEMBER_MISSING(struct_, get_list))
    return NULL;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  cef_list_value_t* _retval = struct_->get_list(struct_);

  // Return type: refptr_same
  return CefListValueCToCpp::Wrap(_retval);
}

bool CefValueCToCpp::SetNull() {
  if (CEF_MEMBER_MISSING(struct_, set_null))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->set_null(struct_);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetBool(bool value) {
  if (CEF_MEMBER_MISSING(struct_, set_bool))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->set_bool(struct_,
      value);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetInt(int value) {
  if (CEF_MEMBER_MISSING(struct_, set_int))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->set_int(struct_,
      value);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetDouble(double value) {
  if (CEF_MEMBER_MISSING(struct_, set_double))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Execute
  int _retval = struct_->set_double(struct_,
      value);

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetString(const CefString& value) {
  if (CEF_MEMBER_MISSING(struct_, set_string))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Unverified params: value

  // Execute
  int _retval = struct_->set_string(struct_,
      value.GetStruct());

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetBinary(CefRefPtr<CefBinaryValue> value) {
  if (CEF_MEMBER_MISSING(struct_, set_binary))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: value; type: refptr_same
  DCHECK(value.get());
  if (!value.get())
    return false;

  // Execute
  int _retval = struct_->set_binary(struct_,
      CefBinaryValueCToCpp::Unwrap(value));

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetDictionary(CefRefPtr<CefDictionaryValue> value) {
  if (CEF_MEMBER_MISSING(struct_, set_dictionary))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: value; type: refptr_same
  DCHECK(value.get());
  if (!value.get())
    return false;

  // Execute
  int _retval = struct_->set_dictionary(struct_,
      CefDictionaryValueCToCpp::Unwrap(value));

  // Return type: bool
  return _retval?true:false;
}

bool CefValueCToCpp::SetList(CefRefPtr<CefListValue> value) {
  if (CEF_MEMBER_MISSING(struct_, set_list))
    return false;

  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  // Verify param: value; type: refptr_same
  DCHECK(value.get());
  if (!value.get())
    return false;

  // Execute
  int _retval = struct_->set_list(struct_,
      CefListValueCToCpp::Unwrap(value));

  // Return type: bool
  return _retval?true:false;
}


#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefValueCToCpp, CefValue,
    cef_value_t>::DebugObjCt = 0;
#endif

