cef/libcef_dll/cpptoc/domdocument_cpptoc.cc

243 lines
6.5 KiB
C++
Raw Normal View History

// Copyright (c) 2011 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.
//
// ---------------------------------------------------------------------------
//
// A portion of this file was generated by the CEF translator tool. When
// making changes by hand only do so within the body of existing function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/domdocument_cpptoc.h"
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
enum cef_dom_document_type_t CEF_CALLBACK domdocument_get_type(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return DOM_DOCUMENT_TYPE_UNKNOWN;
return CefDOMDocumentCppToC::Get(self)->GetType();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_document(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr =
CefDOMDocumentCppToC::Get(self)->GetDocument();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_body(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> nodePtr = CefDOMDocumentCppToC::Get(self)->GetBody();
if (nodePtr.get())
return CefDOMNodeCppToC::Wrap(nodePtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_head(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr = CefDOMDocumentCppToC::Get(self)->GetHead();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_title(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetTitle();
return str.DetachToUserFree();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_element_by_id(
struct _cef_domdocument_t* self, const cef_string_t* id)
{
DCHECK(self);
DCHECK(id);
if(!self || !id)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetElementById(CefString(id));
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_focused_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetFocusedNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_has_selection(struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->HasSelection();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_start_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetSelectionStartNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_get_selection_start_offset(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->GetSelectionStartOffset();
}
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_end_node(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefDOMNode> elementPtr =
CefDOMDocumentCppToC::Get(self)->GetSelectionEndNode();
if (elementPtr.get())
return CefDOMNodeCppToC::Wrap(elementPtr);
return NULL;
}
int CEF_CALLBACK domdocument_get_selection_end_offset(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
return CefDOMDocumentCppToC::Get(self)->GetSelectionEndOffset();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_markup(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsMarkup();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_text(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsText();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_base_url(
struct _cef_domdocument_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString str = CefDOMDocumentCppToC::Get(self)->GetBaseURL();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK domdocument_get_complete_url(
struct _cef_domdocument_t* self, const cef_string_t* partialURL)
{
DCHECK(self);
if(!self)
return NULL;
CefString str =
CefDOMDocumentCppToC::Get(self)->GetCompleteURL(CefString(partialURL));
return str.DetachToUserFree();
}
// CONSTRUCTOR - Do not edit by hand.
CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls)
: CefCppToC<CefDOMDocumentCppToC, CefDOMDocument, cef_domdocument_t>(cls)
{
struct_.struct_.get_type = domdocument_get_type;
struct_.struct_.get_document = domdocument_get_document;
struct_.struct_.get_body = domdocument_get_body;
struct_.struct_.get_head = domdocument_get_head;
struct_.struct_.get_title = domdocument_get_title;
struct_.struct_.get_element_by_id = domdocument_get_element_by_id;
struct_.struct_.get_focused_node = domdocument_get_focused_node;
struct_.struct_.has_selection = domdocument_has_selection;
struct_.struct_.get_selection_start_node =
domdocument_get_selection_start_node;
struct_.struct_.get_selection_start_offset =
domdocument_get_selection_start_offset;
struct_.struct_.get_selection_end_node = domdocument_get_selection_end_node;
struct_.struct_.get_selection_end_offset =
domdocument_get_selection_end_offset;
struct_.struct_.get_selection_as_markup = domdocument_get_selection_as_markup;
struct_.struct_.get_selection_as_text = domdocument_get_selection_as_text;
struct_.struct_.get_base_url = domdocument_get_base_url;
struct_.struct_.get_complete_url = domdocument_get_complete_url;
}
#ifndef NDEBUG
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
cef_domdocument_t>::DebugObjCt = 0;
#endif