• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=7a24d4020666f0277e76e190926df2081637a174$
13 //
14 
15 #include "libcef_dll/ctocpp/post_data_ctocpp.h"
16 #include <algorithm>
17 #include "libcef_dll/ctocpp/post_data_element_ctocpp.h"
18 
19 // STATIC METHODS - Body may be edited by hand.
20 
Create()21 NO_SANITIZE("cfi-icall") CefRefPtr<CefPostData> CefPostData::Create() {
22   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
23 
24   // Execute
25   cef_post_data_t* _retval = cef_post_data_create();
26 
27   // Return type: refptr_same
28   return CefPostDataCToCpp::Wrap(_retval);
29 }
30 
31 // VIRTUAL METHODS - Body may be edited by hand.
32 
IsReadOnly()33 NO_SANITIZE("cfi-icall") bool CefPostDataCToCpp::IsReadOnly() {
34   cef_post_data_t* _struct = GetStruct();
35   if (CEF_MEMBER_MISSING(_struct, is_read_only))
36     return false;
37 
38   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
39 
40   // Execute
41   int _retval = _struct->is_read_only(_struct);
42 
43   // Return type: bool
44   return _retval ? true : false;
45 }
46 
HasExcludedElements()47 NO_SANITIZE("cfi-icall") bool CefPostDataCToCpp::HasExcludedElements() {
48   cef_post_data_t* _struct = GetStruct();
49   if (CEF_MEMBER_MISSING(_struct, has_excluded_elements))
50     return false;
51 
52   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
53 
54   // Execute
55   int _retval = _struct->has_excluded_elements(_struct);
56 
57   // Return type: bool
58   return _retval ? true : false;
59 }
60 
GetElementCount()61 NO_SANITIZE("cfi-icall") size_t CefPostDataCToCpp::GetElementCount() {
62   cef_post_data_t* _struct = GetStruct();
63   if (CEF_MEMBER_MISSING(_struct, get_element_count))
64     return 0;
65 
66   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
67 
68   // Execute
69   size_t _retval = _struct->get_element_count(_struct);
70 
71   // Return type: simple
72   return _retval;
73 }
74 
75 NO_SANITIZE("cfi-icall")
GetElements(ElementVector & elements)76 void CefPostDataCToCpp::GetElements(ElementVector& elements) {
77   cef_post_data_t* _struct = GetStruct();
78   if (CEF_MEMBER_MISSING(_struct, get_elements))
79     return;
80 
81   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82 
83   // Translate param: elements; type: refptr_vec_same_byref
84   size_t elementsSize = elements.size();
85   size_t elementsCount = std::max(GetElementCount(), elementsSize);
86   cef_post_data_element_t** elementsList = NULL;
87   if (elementsCount > 0) {
88     elementsList = new cef_post_data_element_t*[elementsCount];
89     DCHECK(elementsList);
90     if (elementsList) {
91       memset(elementsList, 0, sizeof(cef_post_data_element_t*) * elementsCount);
92     }
93     if (elementsList && elementsSize > 0) {
94       for (size_t i = 0; i < elementsSize; ++i) {
95         elementsList[i] = CefPostDataElementCToCpp::Unwrap(elements[i]);
96       }
97     }
98   }
99 
100   // Execute
101   _struct->get_elements(_struct, &elementsCount, elementsList);
102 
103   // Restore param:elements; type: refptr_vec_same_byref
104   elements.clear();
105   if (elementsCount > 0 && elementsList) {
106     for (size_t i = 0; i < elementsCount; ++i) {
107       elements.push_back(CefPostDataElementCToCpp::Wrap(elementsList[i]));
108     }
109     delete[] elementsList;
110   }
111 }
112 
113 NO_SANITIZE("cfi-icall")
RemoveElement(CefRefPtr<CefPostDataElement> element)114 bool CefPostDataCToCpp::RemoveElement(CefRefPtr<CefPostDataElement> element) {
115   cef_post_data_t* _struct = GetStruct();
116   if (CEF_MEMBER_MISSING(_struct, remove_element))
117     return false;
118 
119   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
120 
121   // Verify param: element; type: refptr_same
122   DCHECK(element.get());
123   if (!element.get())
124     return false;
125 
126   // Execute
127   int _retval = _struct->remove_element(
128       _struct, CefPostDataElementCToCpp::Unwrap(element));
129 
130   // Return type: bool
131   return _retval ? true : false;
132 }
133 
134 NO_SANITIZE("cfi-icall")
AddElement(CefRefPtr<CefPostDataElement> element)135 bool CefPostDataCToCpp::AddElement(CefRefPtr<CefPostDataElement> element) {
136   cef_post_data_t* _struct = GetStruct();
137   if (CEF_MEMBER_MISSING(_struct, add_element))
138     return false;
139 
140   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
141 
142   // Verify param: element; type: refptr_same
143   DCHECK(element.get());
144   if (!element.get())
145     return false;
146 
147   // Execute
148   int _retval =
149       _struct->add_element(_struct, CefPostDataElementCToCpp::Unwrap(element));
150 
151   // Return type: bool
152   return _retval ? true : false;
153 }
154 
RemoveElements()155 NO_SANITIZE("cfi-icall") void CefPostDataCToCpp::RemoveElements() {
156   cef_post_data_t* _struct = GetStruct();
157   if (CEF_MEMBER_MISSING(_struct, remove_elements))
158     return;
159 
160   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
161 
162   // Execute
163   _struct->remove_elements(_struct);
164 }
165 
166 // CONSTRUCTOR - Do not edit by hand.
167 
CefPostDataCToCpp()168 CefPostDataCToCpp::CefPostDataCToCpp() {}
169 
170 // DESTRUCTOR - Do not edit by hand.
171 
~CefPostDataCToCpp()172 CefPostDataCToCpp::~CefPostDataCToCpp() {}
173 
174 template <>
175 cef_post_data_t*
176 CefCToCppRefCounted<CefPostDataCToCpp, CefPostData, cef_post_data_t>::
UnwrapDerived(CefWrapperType type,CefPostData * c)177     UnwrapDerived(CefWrapperType type, CefPostData* c) {
178   NOTREACHED() << "Unexpected class type: " << type;
179   return nullptr;
180 }
181 
182 template <>
183 CefWrapperType CefCToCppRefCounted<CefPostDataCToCpp,
184                                    CefPostData,
185                                    cef_post_data_t>::kWrapperType =
186     WT_POST_DATA;
187