// 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/cpptoc/sslcert_principal_cpptoc.h"
#include "libcef_dll/transfer_util.h"


namespace {

// MEMBER FUNCTIONS - Body may be edited by hand.

cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_display_name(
    struct _cef_sslcert_principal_t* self) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return NULL;

  // Execute
  CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetDisplayName();

  // Return type: string
  return _retval.DetachToUserFree();
}

cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_common_name(
    struct _cef_sslcert_principal_t* self) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return NULL;

  // Execute
  CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCommonName();

  // Return type: string
  return _retval.DetachToUserFree();
}

cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_locality_name(
    struct _cef_sslcert_principal_t* self) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return NULL;

  // Execute
  CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetLocalityName();

  // Return type: string
  return _retval.DetachToUserFree();
}

cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_state_or_province_name(
    struct _cef_sslcert_principal_t* self) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return NULL;

  // Execute
  CefString _retval = CefSSLCertPrincipalCppToC::Get(
      self)->GetStateOrProvinceName();

  // Return type: string
  return _retval.DetachToUserFree();
}

cef_string_userfree_t CEF_CALLBACK sslcert_principal_get_country_name(
    struct _cef_sslcert_principal_t* self) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return NULL;

  // Execute
  CefString _retval = CefSSLCertPrincipalCppToC::Get(self)->GetCountryName();

  // Return type: string
  return _retval.DetachToUserFree();
}

void CEF_CALLBACK sslcert_principal_get_street_addresses(
    struct _cef_sslcert_principal_t* self, cef_string_list_t addresses) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: addresses; type: string_vec_byref
  DCHECK(addresses);
  if (!addresses)
    return;

  // Translate param: addresses; type: string_vec_byref
  std::vector<CefString> addressesList;
  transfer_string_list_contents(addresses, addressesList);

  // Execute
  CefSSLCertPrincipalCppToC::Get(self)->GetStreetAddresses(
      addressesList);

  // Restore param: addresses; type: string_vec_byref
  cef_string_list_clear(addresses);
  transfer_string_list_contents(addressesList, addresses);
}

void CEF_CALLBACK sslcert_principal_get_organization_names(
    struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: names; type: string_vec_byref
  DCHECK(names);
  if (!names)
    return;

  // Translate param: names; type: string_vec_byref
  std::vector<CefString> namesList;
  transfer_string_list_contents(names, namesList);

  // Execute
  CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationNames(
      namesList);

  // Restore param: names; type: string_vec_byref
  cef_string_list_clear(names);
  transfer_string_list_contents(namesList, names);
}

void CEF_CALLBACK sslcert_principal_get_organization_unit_names(
    struct _cef_sslcert_principal_t* self, cef_string_list_t names) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: names; type: string_vec_byref
  DCHECK(names);
  if (!names)
    return;

  // Translate param: names; type: string_vec_byref
  std::vector<CefString> namesList;
  transfer_string_list_contents(names, namesList);

  // Execute
  CefSSLCertPrincipalCppToC::Get(self)->GetOrganizationUnitNames(
      namesList);

  // Restore param: names; type: string_vec_byref
  cef_string_list_clear(names);
  transfer_string_list_contents(namesList, names);
}

void CEF_CALLBACK sslcert_principal_get_domain_components(
    struct _cef_sslcert_principal_t* self, cef_string_list_t components) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return;
  // Verify param: components; type: string_vec_byref
  DCHECK(components);
  if (!components)
    return;

  // Translate param: components; type: string_vec_byref
  std::vector<CefString> componentsList;
  transfer_string_list_contents(components, componentsList);

  // Execute
  CefSSLCertPrincipalCppToC::Get(self)->GetDomainComponents(
      componentsList);

  // Restore param: components; type: string_vec_byref
  cef_string_list_clear(components);
  transfer_string_list_contents(componentsList, components);
}

}  // namespace


// CONSTRUCTOR - Do not edit by hand.

CefSSLCertPrincipalCppToC::CefSSLCertPrincipalCppToC() {
  GetStruct()->get_display_name = sslcert_principal_get_display_name;
  GetStruct()->get_common_name = sslcert_principal_get_common_name;
  GetStruct()->get_locality_name = sslcert_principal_get_locality_name;
  GetStruct()->get_state_or_province_name =
      sslcert_principal_get_state_or_province_name;
  GetStruct()->get_country_name = sslcert_principal_get_country_name;
  GetStruct()->get_street_addresses = sslcert_principal_get_street_addresses;
  GetStruct()->get_organization_names =
      sslcert_principal_get_organization_names;
  GetStruct()->get_organization_unit_names =
      sslcert_principal_get_organization_unit_names;
  GetStruct()->get_domain_components = sslcert_principal_get_domain_components;
}

template<> CefRefPtr<CefSSLCertPrincipal> CefCppToC<CefSSLCertPrincipalCppToC,
    CefSSLCertPrincipal, cef_sslcert_principal_t>::UnwrapDerived(
    CefWrapperType type, cef_sslcert_principal_t* s) {
  NOTREACHED() << "Unexpected class type: " << type;
  return NULL;
}

#ifndef NDEBUG
template<> base::AtomicRefCount CefCppToC<CefSSLCertPrincipalCppToC,
    CefSSLCertPrincipal, cef_sslcert_principal_t>::DebugObjCt = 0;
#endif

template<> CefWrapperType CefCppToC<CefSSLCertPrincipalCppToC,
    CefSSLCertPrincipal, cef_sslcert_principal_t>::kWrapperType =
    WT_SSLCERT_PRINCIPAL;
