Introduce CefString and cef_string_t implementations that support string type conversions and customization of the API string type (issue #146).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@145 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2010-11-22 17:49:46 +00:00
parent 1e1c2ad8d7
commit 7d60642638
121 changed files with 2598 additions and 3209 deletions

View File

@ -13,22 +13,23 @@
#include "libcef_dll/cpptoc/handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// STATIC METHODS - Body may be edited by hand.
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
CefRefPtr<CefHandler> handler, const std::wstring& url)
CefRefPtr<CefHandler> handler, const CefString& url)
{
return cef_browser_create(&windowInfo, popup, CefHandlerCppToC::Wrap(handler),
url.c_str())?true:false;
url.GetStruct())?true:false;
}
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
bool popup, CefRefPtr<CefHandler> handler, const std::wstring& url)
bool popup, CefRefPtr<CefHandler> handler, const CefString& url)
{
cef_browser_t* impl = cef_browser_create_sync(&windowInfo, popup,
CefHandlerCppToC::Wrap(handler), url.c_str());
CefHandlerCppToC::Wrap(handler), url.GetStruct());
if(impl)
return CefBrowserCToCpp::Wrap(impl);
return NULL;
@ -153,19 +154,19 @@ CefRefPtr<CefFrame> CefBrowserCToCpp::GetFocusedFrame()
return NULL;
}
CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(const std::wstring& name)
CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(const CefString& name)
{
if(CEF_MEMBER_MISSING(struct_, get_main_frame))
return NULL;
cef_frame_t* frameStruct = struct_->get_frame(struct_, name.c_str());
cef_frame_t* frameStruct = struct_->get_frame(struct_, name.GetStruct());
if(frameStruct)
return CefFrameCToCpp::Wrap(frameStruct);
return NULL;
}
void CefBrowserCToCpp::GetFrameNames(std::vector<std::wstring>& names)
void CefBrowserCToCpp::GetFrameNames(std::vector<CefString>& names)
{
if(CEF_MEMBER_MISSING(struct_, get_frame_names))
return;
@ -173,24 +174,17 @@ void CefBrowserCToCpp::GetFrameNames(std::vector<std::wstring>& names)
cef_string_list_t list = cef_string_list_alloc();
struct_->get_frame_names(struct_, list);
cef_string_t str;
int size = cef_string_list_size(list);
for(int i = 0; i < size; ++i) {
str = cef_string_list_value(list, i);
names.push_back(str);
cef_string_free(str);
}
transfer_string_list_contents(list, names);
cef_string_list_free(list);
}
void CefBrowserCToCpp::Find(int identifier, const std::wstring& searchText,
void CefBrowserCToCpp::Find(int identifier, const CefString& searchText,
bool forward, bool matchCase, bool findNext)
{
if(CEF_MEMBER_MISSING(struct_, find))
return;
struct_->find(struct_, identifier, searchText.c_str(), forward,
struct_->find(struct_, identifier, searchText.GetStruct(), forward,
matchCase, findNext);
}

View File

@ -44,10 +44,10 @@ public:
virtual CefRefPtr<CefHandler> GetHandler();
virtual CefRefPtr<CefFrame> GetMainFrame();
virtual CefRefPtr<CefFrame> GetFocusedFrame();
virtual CefRefPtr<CefFrame> GetFrame(const std::wstring& name);
virtual void GetFrameNames(std::vector<std::wstring>& names);
virtual void Find(int identifier, const std::wstring& searchText,
bool forward, bool matchCase, bool findNext);
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name);
virtual void GetFrameNames(std::vector<CefString>& names);
virtual void Find(int identifier, const CefString& searchText, bool forward,
bool matchCase, bool findNext);
virtual void StopFinding(bool clearSelection);
};

View File

@ -89,31 +89,25 @@ void CefFrameCToCpp::ViewSource()
struct_->view_source(struct_);
}
std::wstring CefFrameCToCpp::GetSource()
CefString CefFrameCToCpp::GetSource()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_source))
return str;
cef_string_t cef_str = struct_->get_source(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_source(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefFrameCToCpp::GetText()
CefString CefFrameCToCpp::GetText()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_text))
return str;
cef_string_t cef_str = struct_->get_text(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_text(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -125,41 +119,40 @@ void CefFrameCToCpp::LoadRequest(CefRefPtr<CefRequest> request)
struct_->load_request(struct_, CefRequestCToCpp::Unwrap(request));
}
void CefFrameCToCpp::LoadURL(const std::wstring& url)
void CefFrameCToCpp::LoadURL(const CefString& url)
{
if(CEF_MEMBER_MISSING(struct_, load_url))
return;
struct_->load_url(struct_, url.c_str());
struct_->load_url(struct_, url.GetStruct());
}
void CefFrameCToCpp::LoadString(const std::wstring& string,
const std::wstring& url)
void CefFrameCToCpp::LoadString(const CefString& string, const CefString& url)
{
if(CEF_MEMBER_MISSING(struct_, load_string))
return;
struct_->load_string(struct_, string.c_str(), url.c_str());
struct_->load_string(struct_, string.GetStruct(), url.GetStruct());
}
void CefFrameCToCpp::LoadStream(CefRefPtr<CefStreamReader> stream,
const std::wstring& url)
const CefString& url)
{
if(CEF_MEMBER_MISSING(struct_, load_stream))
return;
struct_->load_stream(struct_, CefStreamReaderCToCpp::Unwrap(stream),
url.c_str());
url.GetStruct());
}
void CefFrameCToCpp::ExecuteJavaScript(const std::wstring& jsCode,
const std::wstring& scriptUrl, int startLine)
void CefFrameCToCpp::ExecuteJavaScript(const CefString& jsCode,
const CefString& scriptUrl, int startLine)
{
if(CEF_MEMBER_MISSING(struct_, execute_java_script))
return;
struct_->execute_java_script(struct_, jsCode.c_str(), scriptUrl.c_str(),
startLine);
struct_->execute_java_script(struct_, jsCode.GetStruct(),
scriptUrl.GetStruct(), startLine);
}
bool CefFrameCToCpp::IsMain()
@ -178,31 +171,25 @@ bool CefFrameCToCpp::IsFocused()
return struct_->is_focused(struct_)?true:false;
}
std::wstring CefFrameCToCpp::GetName()
CefString CefFrameCToCpp::GetName()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_name))
return str;
cef_string_t cef_str = struct_->get_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_name(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefFrameCToCpp::GetURL()
CefString CefFrameCToCpp::GetURL()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_url))
return str;
cef_string_t cef_str = struct_->get_url(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_url(struct_);
str.AttachToUserFree(strPtr);
return str;
}

View File

@ -40,19 +40,19 @@ public:
virtual void SelectAll();
virtual void Print();
virtual void ViewSource();
virtual std::wstring GetSource();
virtual std::wstring GetText();
virtual CefString GetSource();
virtual CefString GetText();
virtual void LoadRequest(CefRefPtr<CefRequest> request);
virtual void LoadURL(const std::wstring& url);
virtual void LoadString(const std::wstring& string, const std::wstring& url);
virtual void LoadURL(const CefString& url);
virtual void LoadString(const CefString& string, const CefString& url);
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
const std::wstring& url);
virtual void ExecuteJavaScript(const std::wstring& jsCode,
const std::wstring& scriptUrl, int startLine);
const CefString& url);
virtual void ExecuteJavaScript(const CefString& jsCode,
const CefString& scriptUrl, int startLine);
virtual bool IsMain();
virtual bool IsFocused();
virtual std::wstring GetName();
virtual std::wstring GetURL();
virtual CefString GetName();
virtual CefString GetURL();
};
#endif // USING_CEF_SHARED

View File

@ -17,7 +17,6 @@
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
#include "libcef_dll/ctocpp/handler_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
@ -25,7 +24,7 @@
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& windowInfo, bool popup,
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
std::wstring& url, CefBrowserSettings& settings)
CefString& url, CefBrowserSettings& settings)
{
if(CEF_MEMBER_MISSING(struct_, handle_before_created))
return RV_CONTINUE;
@ -39,13 +38,9 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
handlerStruct = CefHandlerCToCpp::Unwrap(handler);
cef_handler_t *origHandlerStruct = handlerStruct;
cef_string_t urlRet = NULL;
if(!url.empty())
urlRet = cef_string_alloc(url.c_str());
cef_retval_t rv = struct_->handle_before_created(struct_,
browserStruct, &windowInfo, popup, &popupFeatures, &handlerStruct,
&urlRet, &settings);
url.GetWritableStruct(), &settings);
if(handlerStruct && handlerStruct != origHandlerStruct) {
// The handler was changed.
@ -55,8 +50,6 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
handler = NULL;
}
transfer_string_contents(urlRet, url, true);
return rv;
}
@ -72,24 +65,24 @@ CefHandler::RetVal CefHandlerCToCpp::HandleAfterCreated(
CefHandler::RetVal CefHandlerCToCpp::HandleAddressChange(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const std::wstring& url)
const CefString& url)
{
if(CEF_MEMBER_MISSING(struct_, handle_address_change))
return RV_CONTINUE;
return struct_->handle_address_change(struct_,
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
url.c_str());
url.GetStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleTitleChange(
CefRefPtr<CefBrowser> browser, const std::wstring& title)
CefRefPtr<CefBrowser> browser, const CefString& title)
{
if(CEF_MEMBER_MISSING(struct_, handle_title_change))
return RV_CONTINUE;
return struct_->handle_title_change(struct_, CefBrowserCppToC::Wrap(browser),
title.c_str());
title.GetStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeBrowse(
@ -134,46 +127,30 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
CefHandler::RetVal CefHandlerCToCpp::HandleLoadError(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
ErrorCode errorCode, const std::wstring& failedUrl,
std::wstring& errorText)
ErrorCode errorCode, const CefString& failedUrl, CefString& errorText)
{
if(CEF_MEMBER_MISSING(struct_, handle_load_error))
return RV_CONTINUE;
cef_string_t errorTextRet = NULL;
if(!errorText.empty())
errorTextRet = cef_string_alloc(errorText.c_str());
cef_retval_t rv = struct_->handle_load_error(struct_,
return struct_->handle_load_error(struct_,
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame), errorCode,
failedUrl.c_str(), &errorTextRet);
transfer_string_contents(errorTextRet, errorText, true);
return rv;
failedUrl.GetStruct(), errorText.GetWritableStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeResourceLoad(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefRequest> request,
std::wstring& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
std::wstring& mimeType, int loadFlags)
CefString& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
CefString& mimeType, int loadFlags)
{
if(CEF_MEMBER_MISSING(struct_, handle_before_resource_load))
return RV_CONTINUE;
cef_string_t redirectUrlRet = NULL;
cef_string_t mimeTypeRet = NULL;
cef_stream_reader_t* streamRet = NULL;
if(!redirectUrl.empty())
redirectUrlRet = cef_string_alloc(redirectUrl.c_str());
cef_retval_t rv = struct_->handle_before_resource_load(struct_,
CefBrowserCppToC::Wrap(browser), CefRequestCppToC::Wrap(request),
&redirectUrlRet, &streamRet, &mimeTypeRet, loadFlags);
transfer_string_contents(redirectUrlRet, redirectUrl, true);
transfer_string_contents(mimeTypeRet, mimeType, true);
redirectUrl.GetWritableStruct(), &streamRet, mimeType.GetWritableStruct(),
loadFlags);
if(streamRet)
resourceStream = CefStreamReaderCppToC::Unwrap(streamRet);
@ -182,8 +159,8 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeResourceLoad(
}
CefHandler::RetVal CefHandlerCToCpp::HandleDownloadResponse(
CefRefPtr<CefBrowser> browser, const std::wstring& mimeType,
const std::wstring& fileName, int64 contentLength,
CefRefPtr<CefBrowser> browser, const CefString& mimeType,
const CefString& fileName, int64 contentLength,
CefRefPtr<CefDownloadHandler>& handler)
{
if(CEF_MEMBER_MISSING(struct_, handle_download_response))
@ -192,7 +169,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleDownloadResponse(
cef_download_handler_t* handlerRet = NULL;
cef_retval_t rv = struct_->handle_download_response(struct_,
CefBrowserCppToC::Wrap(browser), mimeType.c_str(), fileName.c_str(),
CefBrowserCppToC::Wrap(browser), mimeType.GetStruct(), fileName.GetStruct(),
contentLength, &handlerRet);
if(handlerRet)
@ -212,21 +189,13 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeMenu(
}
CefHandler::RetVal CefHandlerCToCpp::HandleGetMenuLabel(
CefRefPtr<CefBrowser> browser, MenuId menuId, std::wstring& label)
CefRefPtr<CefBrowser> browser, MenuId menuId, CefString& label)
{
if(CEF_MEMBER_MISSING(struct_, handle_get_menu_label))
return RV_CONTINUE;
cef_string_t labelRet = NULL;
if(!label.empty())
labelRet = cef_string_alloc(label.c_str());
cef_retval_t rv = struct_->handle_get_menu_label(struct_,
CefBrowserCppToC::Wrap(browser), menuId, &labelRet);
transfer_string_contents(labelRet, label, true);
return rv;
return struct_->handle_get_menu_label(struct_,
CefBrowserCppToC::Wrap(browser), menuId, label.GetWritableStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleMenuAction(
@ -251,61 +220,36 @@ CefHandler::RetVal CefHandlerCToCpp::HandlePrintOptions(
CefHandler::RetVal CefHandlerCToCpp::HandlePrintHeaderFooter(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefPrintInfo& printInfo, const std::wstring& url,
const std::wstring& title, int currentPage, int maxPages,
std::wstring& topLeft, std::wstring& topCenter, std::wstring& topRight,
std::wstring& bottomLeft, std::wstring& bottomCenter,
std::wstring& bottomRight)
CefPrintInfo& printInfo, const CefString& url, const CefString& title,
int currentPage, int maxPages, CefString& topLeft, CefString& topCenter,
CefString& topRight, CefString& bottomLeft, CefString& bottomCenter,
CefString& bottomRight)
{
if(CEF_MEMBER_MISSING(struct_, handle_print_header_footer))
return RV_CONTINUE;
cef_string_t topLeftRet = NULL, topCenterRet = NULL, topRightRet = NULL,
bottomLeftRet = NULL, bottomCenterRet = NULL, bottomRightRet = NULL;
if(!topLeft.empty())
topLeftRet = cef_string_alloc(topLeft.c_str());
if(!topCenter.empty())
topCenterRet = cef_string_alloc(topCenter.c_str());
if(!topRight.empty())
topRightRet = cef_string_alloc(topRight.c_str());
if(!bottomLeft.empty())
bottomLeftRet = cef_string_alloc(bottomLeft.c_str());
if(!bottomCenter.empty())
bottomCenterRet = cef_string_alloc(bottomCenter.c_str());
if(!bottomRight.empty())
bottomRightRet = cef_string_alloc(bottomRight.c_str());
cef_retval_t rv = struct_->handle_print_header_footer(struct_,
return struct_->handle_print_header_footer(struct_,
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
&printInfo, url.c_str(), title.c_str(), currentPage, maxPages,
&topLeftRet, &topCenterRet, &topRightRet, &bottomLeftRet,
&bottomCenterRet, &bottomRightRet);
transfer_string_contents(topLeftRet, topLeft, true);
transfer_string_contents(topCenterRet, topCenter, true);
transfer_string_contents(topRightRet, topRight, true);
transfer_string_contents(bottomLeftRet, bottomLeft, true);
transfer_string_contents(bottomCenterRet, bottomCenter, true);
transfer_string_contents(bottomRightRet, bottomRight, true);
return rv;
&printInfo, url.GetStruct(), title.GetStruct(), currentPage, maxPages,
topLeft.GetWritableStruct(), topCenter.GetWritableStruct(),
topRight.GetWritableStruct(), bottomLeft.GetWritableStruct(),
bottomCenter.GetWritableStruct(), bottomRight.GetWritableStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleJSAlert(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const std::wstring& message)
const CefString& message)
{
if(CEF_MEMBER_MISSING(struct_, handle_jsalert))
return RV_CONTINUE;
return struct_->handle_jsalert(struct_, CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame), message.c_str());
CefFrameCppToC::Wrap(frame), message.GetStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleJSConfirm(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const std::wstring& message, bool& retval)
const CefString& message, bool& retval)
{
if(CEF_MEMBER_MISSING(struct_, handle_jsconfirm))
return RV_CONTINUE;
@ -313,31 +257,25 @@ CefHandler::RetVal CefHandlerCToCpp::HandleJSConfirm(
int ret = 0;
cef_retval_t rv = struct_->handle_jsconfirm(struct_,
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
message.c_str(), &ret);
message.GetStruct(), &ret);
retval = (ret ? true : false);
return rv;
}
CefHandler::RetVal CefHandlerCToCpp::HandleJSPrompt(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
const std::wstring& message, const std::wstring& defaultValue,
bool& retval, std::wstring& result)
const CefString& message, const CefString& defaultValue, bool& retval,
CefString& result)
{
if(CEF_MEMBER_MISSING(struct_, handle_jsprompt))
return RV_CONTINUE;
cef_string_t resultRet = NULL;
if(!result.empty())
resultRet = cef_string_alloc(result.c_str());
int ret = 0;
cef_retval_t rv = struct_->handle_jsprompt(struct_,
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
message.c_str(), defaultValue.c_str(), &ret, &resultRet);
message.GetStruct(), defaultValue.GetStruct(), &ret,
result.GetWritableStruct());
retval = (ret ? true : false);
transfer_string_contents(resultRet, result, true);
return rv;
}
@ -394,31 +332,25 @@ CefHandler::RetVal CefHandlerCToCpp::HandleKeyEvent(
}
CefHandler::RetVal CefHandlerCToCpp::HandleTooltip(
CefRefPtr<CefBrowser> browser, std::wstring& text)
CefRefPtr<CefBrowser> browser, CefString& text)
{
if(CEF_MEMBER_MISSING(struct_, handle_tooltip))
return RV_CONTINUE;
cef_string_t textRet = NULL;
if(!text.empty())
textRet = cef_string_alloc(text.c_str());
cef_retval_t rv = struct_->handle_tooltip(struct_,
CefBrowserCppToC::Wrap(browser), &textRet);
transfer_string_contents(textRet, text, true);
return rv;
return struct_->handle_tooltip(struct_,
CefBrowserCppToC::Wrap(browser), text.GetWritableStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleConsoleMessage(
CefRefPtr<CefBrowser> browser, const std::wstring& message,
const std::wstring& source, int line)
CefRefPtr<CefBrowser> browser, const CefString& message,
const CefString& source, int line)
{
if(CEF_MEMBER_MISSING(struct_, handle_console_message))
return RV_CONTINUE;
return struct_->handle_console_message(struct_,
CefBrowserCppToC::Wrap(browser), message.c_str(), source.c_str(), line);
CefBrowserCppToC::Wrap(browser), message.GetStruct(), source.GetStruct(),
line);
}
CefHandler::RetVal CefHandlerCToCpp::HandleFindResult(

View File

@ -34,12 +34,12 @@ public:
virtual RetVal HandleBeforeCreated(CefRefPtr<CefBrowser> parentBrowser,
CefWindowInfo& windowInfo, bool popup,
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
std::wstring& url, CefBrowserSettings& settings);
CefString& url, CefBrowserSettings& settings);
virtual RetVal HandleAfterCreated(CefRefPtr<CefBrowser> browser);
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, const std::wstring& url);
CefRefPtr<CefFrame> frame, const CefString& url);
virtual RetVal HandleTitleChange(CefRefPtr<CefBrowser> browser,
const std::wstring& title);
const CefString& title);
virtual RetVal HandleBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
NavType navType, bool isRedirect);
@ -49,34 +49,33 @@ public:
CefRefPtr<CefFrame> frame);
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
const std::wstring& failedUrl, std::wstring& errorText);
const CefString& failedUrl, CefString& errorText);
virtual RetVal HandleBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefRequest> request, std::wstring& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream, std::wstring& mimeType,
CefRefPtr<CefRequest> request, CefString& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream, CefString& mimeType,
int loadFlags);
virtual RetVal HandleDownloadResponse(CefRefPtr<CefBrowser> browser,
const std::wstring& mimeType, const std::wstring& fileName,
const CefString& mimeType, const CefString& fileName,
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler);
virtual RetVal HandleBeforeMenu(CefRefPtr<CefBrowser> browser,
const MenuInfo& menuInfo);
virtual RetVal HandleGetMenuLabel(CefRefPtr<CefBrowser> browser,
MenuId menuId, std::wstring& label);
MenuId menuId, CefString& label);
virtual RetVal HandleMenuAction(CefRefPtr<CefBrowser> browser, MenuId menuId);
virtual RetVal HandlePrintOptions(CefRefPtr<CefBrowser> browser,
CefPrintOptions& printOptions);
virtual RetVal HandlePrintHeaderFooter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefPrintInfo& printInfo,
const std::wstring& url, const std::wstring& title, int currentPage,
int maxPages, std::wstring& topLeft, std::wstring& topCenter,
std::wstring& topRight, std::wstring& bottomLeft,
std::wstring& bottomCenter, std::wstring& bottomRight);
CefRefPtr<CefFrame> frame, CefPrintInfo& printInfo, const CefString& url,
const CefString& title, int currentPage, int maxPages,
CefString& topLeft, CefString& topCenter, CefString& topRight,
CefString& bottomLeft, CefString& bottomCenter, CefString& bottomRight);
virtual RetVal HandleJSAlert(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, const std::wstring& message);
CefRefPtr<CefFrame> frame, const CefString& message);
virtual RetVal HandleJSConfirm(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, const std::wstring& message, bool& retval);
CefRefPtr<CefFrame> frame, const CefString& message, bool& retval);
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, const std::wstring& message,
const std::wstring& defaultValue, bool& retval, std::wstring& result);
CefRefPtr<CefFrame> frame, const CefString& message,
const CefString& defaultValue, bool& retval, CefString& result);
virtual RetVal HandleJSBinding(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Value> object);
virtual RetVal HandleBeforeWindowClose(CefRefPtr<CefBrowser> browser);
@ -84,10 +83,9 @@ public:
virtual RetVal HandleSetFocus(CefRefPtr<CefBrowser> browser, bool isWidget);
virtual RetVal HandleKeyEvent(CefRefPtr<CefBrowser> browser,
KeyEventType type, int code, int modifiers, bool isSystemKey);
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser,
std::wstring& text);
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser, CefString& text);
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
const std::wstring& message, const std::wstring& source, int line);
const CefString& message, const CefString& source, int line);
virtual RetVal HandleFindResult(CefRefPtr<CefBrowser> browser, int identifier,
int count, const CefRect& selectionRect, int activeMatchOrdinal,
bool finalUpdate);

View File

@ -34,12 +34,12 @@ void CefPostDataElementCToCpp::SetToEmpty()
return struct_->set_to_empty(struct_);
}
void CefPostDataElementCToCpp::SetToFile(const std::wstring& fileName)
void CefPostDataElementCToCpp::SetToFile(const CefString& fileName)
{
if(CEF_MEMBER_MISSING(struct_, set_to_file))
return;
return struct_->set_to_file(struct_, fileName.c_str());
return struct_->set_to_file(struct_, fileName.GetStruct());
}
void CefPostDataElementCToCpp::SetToBytes(size_t size, const void* bytes)
@ -58,18 +58,14 @@ CefPostDataElement::Type CefPostDataElementCToCpp::GetType()
return struct_->get_type(struct_);
}
std::wstring CefPostDataElementCToCpp::GetFile()
CefString CefPostDataElementCToCpp::GetFile()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_file))
return str;
cef_string_t cef_str = struct_->get_file(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_file(struct_);
str.AttachToUserFree(strPtr);
return str;
}

View File

@ -34,10 +34,10 @@ public:
// CefPostDataElement methods
virtual void SetToEmpty();
virtual void SetToFile(const std::wstring& fileName);
virtual void SetToFile(const CefString& fileName);
virtual void SetToBytes(size_t size, const void* bytes);
virtual Type GetType();
virtual std::wstring GetFile();
virtual CefString GetFile();
virtual size_t GetBytesCount();
virtual size_t GetBytes(size_t size, void* bytes);
};

View File

@ -28,48 +28,42 @@ CefRefPtr<CefRequest> CefRequest::CreateRequest()
// VIRTUAL METHODS - Body may be edited by hand.
std::wstring CefRequestCToCpp::GetURL()
CefString CefRequestCToCpp::GetURL()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_url))
return str;
cef_string_t cef_str = struct_->get_url(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_url(struct_);
str.AttachToUserFree(strPtr);
return str;
}
void CefRequestCToCpp::SetURL(const std::wstring& url)
void CefRequestCToCpp::SetURL(const CefString& url)
{
if(CEF_MEMBER_MISSING(struct_, set_url))
return;
struct_->set_url(struct_, url.c_str());
struct_->set_url(struct_, url.GetStruct());
}
std::wstring CefRequestCToCpp::GetMethod()
CefString CefRequestCToCpp::GetMethod()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_method))
return str;
cef_string_t cef_str = struct_->get_method(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_method(struct_);
str.AttachToUserFree(strPtr);
return str;
}
void CefRequestCToCpp::SetMethod(const std::wstring& method)
void CefRequestCToCpp::SetMethod(const CefString& method)
{
if(CEF_MEMBER_MISSING(struct_, set_method))
return;
struct_->set_method(struct_, method.c_str());
struct_->set_method(struct_, method.GetStruct());
}
CefRefPtr<CefPostData> CefRequestCToCpp::GetPostData()
@ -128,7 +122,7 @@ void CefRequestCToCpp::SetHeaderMap(const HeaderMap& headerMap)
cef_string_map_free(map);
}
void CefRequestCToCpp::Set(const std::wstring& url, const std::wstring& method,
void CefRequestCToCpp::Set(const CefString& url, const CefString& method,
CefRefPtr<CefPostData> postData, const HeaderMap& headerMap)
{
if(CEF_MEMBER_MISSING(struct_, set))
@ -146,7 +140,8 @@ void CefRequestCToCpp::Set(const std::wstring& url, const std::wstring& method,
transfer_string_map_contents(headerMap, map);
}
struct_->set(struct_, url.c_str(), method.c_str(), postDataStruct, map);
struct_->set(struct_, url.GetStruct(), method.GetStruct(), postDataStruct,
map);
if(map)
cef_string_map_free(map);

View File

@ -31,15 +31,15 @@ public:
virtual ~CefRequestCToCpp() {}
// CefRequest methods
virtual std::wstring GetURL();
virtual void SetURL(const std::wstring& url);
virtual std::wstring GetMethod();
virtual void SetMethod(const std::wstring& method);
virtual CefString GetURL();
virtual void SetURL(const CefString& url);
virtual CefString GetMethod();
virtual void SetMethod(const CefString& method);
virtual CefRefPtr<CefPostData> GetPostData();
virtual void SetPostData(CefRefPtr<CefPostData> postData);
virtual void GetHeaderMap(HeaderMap& headerMap);
virtual void SetHeaderMap(const HeaderMap& headerMap);
virtual void Set(const std::wstring& url, const std::wstring& method,
virtual void Set(const CefString& url, const CefString& method,
CefRefPtr<CefPostData> postData, const HeaderMap& headerMap);
};

View File

@ -12,27 +12,18 @@
#include "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/ctocpp/scheme_handler_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefSchemeHandlerCToCpp::ProcessRequest(CefRefPtr<CefRequest> request,
std::wstring& mime_type, int* response_length)
CefString& mime_type, int* response_length)
{
if(CEF_MEMBER_MISSING(struct_, process_request))
return false;
cef_string_t mimeTypeRet = NULL;
if(!mime_type.empty())
mimeTypeRet = cef_string_alloc(mime_type.c_str());
int rv = struct_->process_request(struct_, CefRequestCppToC::Wrap(request),
&mimeTypeRet, response_length);
transfer_string_contents(mimeTypeRet, mime_type, true);
return rv ? true : false;
return struct_->process_request(struct_, CefRequestCppToC::Wrap(request),
mime_type.GetWritableStruct(), response_length) ? true : false;
}
void CefSchemeHandlerCToCpp::Cancel()
@ -49,8 +40,8 @@ bool CefSchemeHandlerCToCpp::ReadResponse(void* data_out, int bytes_to_read,
if(CEF_MEMBER_MISSING(struct_, read_response))
return false;
return struct_->read_response(struct_, data_out, bytes_to_read, bytes_read)
? true : false;
return struct_->read_response(struct_, data_out, bytes_to_read, bytes_read) ?
true : false;
}

View File

@ -34,7 +34,7 @@ public:
// CefSchemeHandler methods
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
std::wstring& mime_type, int* response_length);
CefString& mime_type, int* response_length);
virtual void Cancel();
virtual bool ReadResponse(void* data_out, int bytes_to_read, int* bytes_read);
};

View File

@ -17,10 +17,10 @@
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefStreamReader> CefStreamReader::CreateForFile(
const std::wstring& fileName)
const CefString& fileName)
{
cef_stream_reader_t* impl =
cef_stream_reader_create_for_file(fileName.c_str());
cef_stream_reader_create_for_file(fileName.GetStruct());
if(impl)
return CefStreamReaderCToCpp::Wrap(impl);
return NULL;

View File

@ -17,14 +17,14 @@
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefStreamWriter> CefStreamWriter::CreateForFile(
const std::wstring& fileName)
const CefString& fileName)
{
DCHECK(!fileName.empty());
if(fileName.empty())
return NULL;
cef_stream_writer_t* impl =
cef_stream_writer_create_for_file(fileName.c_str());
cef_stream_writer_create_for_file(fileName.GetStruct());
if(impl)
return CefStreamWriterCToCpp::Wrap(impl);
return NULL;

View File

@ -16,9 +16,9 @@
// VIRTUAL METHODS - Body may be edited by hand.
bool CefV8HandlerCToCpp::Execute(const std::wstring& name,
bool CefV8HandlerCToCpp::Execute(const CefString& name,
CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval, std::wstring& exception)
CefRefPtr<CefV8Value>& retval, CefString& exception)
{
if(CEF_MEMBER_MISSING(struct_, execute))
return RV_CONTINUE;
@ -32,17 +32,12 @@ bool CefV8HandlerCToCpp::Execute(const std::wstring& name,
}
cef_v8value_t* retvalStruct = NULL;
cef_string_t exceptionStr = NULL;
int rv = struct_->execute(struct_, name.c_str(),
int rv = struct_->execute(struct_, name.GetStruct(),
CefV8ValueCppToC::Wrap(object), argsSize, argsStructPtr, &retvalStruct,
&exceptionStr);
exception.GetWritableStruct());
if(retvalStruct)
retval = CefV8ValueCppToC::Unwrap(retvalStruct);
if(exceptionStr) {
exception = exceptionStr;
cef_string_free(exceptionStr);
}
if(argsStructPtr)
delete [] argsStructPtr;

View File

@ -31,9 +31,9 @@ public:
virtual ~CefV8HandlerCToCpp() {}
// CefV8Handler methods
virtual bool Execute(const std::wstring& name, CefRefPtr<CefV8Value> object,
virtual bool Execute(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
std::wstring& exception);
CefString& exception);
};
#endif // BUILDING_CEF_SHARED

View File

@ -13,6 +13,7 @@
#include "libcef_dll/cpptoc/base_cpptoc.h"
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// STATIC METHODS - Body may be edited by hand.
@ -57,9 +58,9 @@ CefRefPtr<CefV8Value> CefV8Value::CreateDouble(double value)
return NULL;
}
CefRefPtr<CefV8Value> CefV8Value::CreateString(const std::wstring& value)
CefRefPtr<CefV8Value> CefV8Value::CreateString(const CefString& value)
{
cef_v8value_t* impl = cef_v8value_create_string(value.c_str());
cef_v8value_t* impl = cef_v8value_create_string(value.GetStruct());
if(impl)
return CefV8ValueCToCpp::Wrap(impl);
return NULL;
@ -85,14 +86,14 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArray()
return NULL;
}
CefRefPtr<CefV8Value> CefV8Value::CreateFunction(const std::wstring& name,
CefRefPtr<CefV8Value> CefV8Value::CreateFunction(const CefString& name,
CefRefPtr<CefV8Handler> handler)
{
cef_v8handler_t* handlerStruct = NULL;
if(handler.get())
handlerStruct = CefV8HandlerCppToC::Wrap(handler);
cef_v8value_t* impl = cef_v8value_create_function(name.c_str(),
cef_v8value_t* impl = cef_v8value_create_function(name.GetStruct(),
handlerStruct);
if(impl)
return CefV8ValueCToCpp::Wrap(impl);
@ -198,26 +199,23 @@ double CefV8ValueCToCpp::GetDoubleValue()
return struct_->get_double_value(struct_);
}
std::wstring CefV8ValueCToCpp::GetStringValue()
CefString CefV8ValueCToCpp::GetStringValue()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_string_value))
return str;
cef_string_t cef_str = struct_->get_string_value(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_string_value(struct_);
str.AttachToUserFree(strPtr);
return str;
}
bool CefV8ValueCToCpp::HasValue(const std::wstring& key)
bool CefV8ValueCToCpp::HasValue(const CefString& key)
{
if(CEF_MEMBER_MISSING(struct_, has_value_bykey))
return false;
return struct_->has_value_bykey(struct_, key.c_str())?true:false;
return struct_->has_value_bykey(struct_, key.GetStruct())?true:false;
}
bool CefV8ValueCToCpp::HasValue(int index)
@ -228,12 +226,12 @@ bool CefV8ValueCToCpp::HasValue(int index)
return struct_->has_value_byindex(struct_, index)?true:false;
}
bool CefV8ValueCToCpp::DeleteValue(const std::wstring& key)
bool CefV8ValueCToCpp::DeleteValue(const CefString& key)
{
if(CEF_MEMBER_MISSING(struct_, delete_value_bykey))
return false;
return struct_->delete_value_bykey(struct_, key.c_str())?true:false;
return struct_->delete_value_bykey(struct_, key.GetStruct())?true:false;
}
bool CefV8ValueCToCpp::DeleteValue(int index)
@ -244,12 +242,13 @@ bool CefV8ValueCToCpp::DeleteValue(int index)
return struct_->delete_value_byindex(struct_, index)?true:false;
}
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const std::wstring& key)
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const CefString& key)
{
if(CEF_MEMBER_MISSING(struct_, get_value_bykey))
return false;
cef_v8value_t* valueStruct = struct_->get_value_bykey(struct_, key.c_str());
cef_v8value_t* valueStruct = struct_->get_value_bykey(struct_,
key.GetStruct());
if(valueStruct)
return CefV8ValueCToCpp::Wrap(valueStruct);
return NULL;
@ -266,13 +265,13 @@ CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(int index)
return NULL;
}
bool CefV8ValueCToCpp::SetValue(const std::wstring& key,
bool CefV8ValueCToCpp::SetValue(const CefString& key,
CefRefPtr<CefV8Value> value)
{
if(CEF_MEMBER_MISSING(struct_, set_value_bykey))
return false;
return struct_->set_value_bykey(struct_, key.c_str(),
return struct_->set_value_bykey(struct_, key.GetStruct(),
CefV8ValueCToCpp::Unwrap(value))?true:false;
}
@ -285,20 +284,14 @@ bool CefV8ValueCToCpp::SetValue(int index, CefRefPtr<CefV8Value> value)
CefV8ValueCToCpp::Unwrap(value))?true:false;
}
bool CefV8ValueCToCpp::GetKeys(std::vector<std::wstring>& keys)
bool CefV8ValueCToCpp::GetKeys(std::vector<CefString>& keys)
{
if(CEF_MEMBER_MISSING(struct_, get_keys))
return false;
cef_string_list_t list = cef_string_list_alloc();
if(struct_->get_keys(struct_, list)) {
cef_string_t str;
int size = cef_string_list_size(list);
for(int i = 0; i < size; ++i) {
str = cef_string_list_value(list, i);
keys.push_back(str);
cef_string_free(str);
}
transfer_string_list_contents(list, keys);
cef_string_list_free(list);
return true;
}
@ -324,17 +317,14 @@ int CefV8ValueCToCpp::GetArrayLength()
return struct_->get_array_length(struct_);
}
std::wstring CefV8ValueCToCpp::GetFunctionName()
CefString CefV8ValueCToCpp::GetFunctionName()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_function_name))
return str;
cef_string_t cef_str = struct_->get_function_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_function_name(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -351,7 +341,7 @@ CefRefPtr<CefV8Handler> CefV8ValueCToCpp::GetFunctionHandler()
bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
std::wstring& exception)
CefString& exception)
{
if(CEF_MEMBER_MISSING(struct_, execute_function))
return RV_CONTINUE;
@ -365,16 +355,11 @@ bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr<CefV8Value> object,
}
cef_v8value_t* retvalStruct = NULL;
cef_string_t exceptionStr = NULL;
int rv = struct_->execute_function(struct_, CefV8ValueCToCpp::Unwrap(object),
argsSize, argsStructPtr, &retvalStruct, &exceptionStr);
argsSize, argsStructPtr, &retvalStruct, exception.GetWritableStruct());
if(retvalStruct)
retval = CefV8ValueCToCpp::Wrap(retvalStruct);
if(exceptionStr) {
exception = exceptionStr;
cef_string_free(exceptionStr);
}
if(argsStructPtr)
delete [] argsStructPtr;

View File

@ -43,23 +43,23 @@ public:
virtual bool GetBoolValue();
virtual int GetIntValue();
virtual double GetDoubleValue();
virtual std::wstring GetStringValue();
virtual bool HasValue(const std::wstring& key);
virtual CefString GetStringValue();
virtual bool HasValue(const CefString& key);
virtual bool HasValue(int index);
virtual bool DeleteValue(const std::wstring& key);
virtual bool DeleteValue(const CefString& key);
virtual bool DeleteValue(int index);
virtual CefRefPtr<CefV8Value> GetValue(const std::wstring& key);
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key);
virtual CefRefPtr<CefV8Value> GetValue(int index);
virtual bool SetValue(const std::wstring& key, CefRefPtr<CefV8Value> value);
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value);
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
virtual bool GetKeys(std::vector<std::wstring>& keys);
virtual bool GetKeys(std::vector<CefString>& keys);
virtual CefRefPtr<CefBase> GetUserData();
virtual int GetArrayLength();
virtual std::wstring GetFunctionName();
virtual CefString GetFunctionName();
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
std::wstring& exception);
CefString& exception);
};
#endif // USING_CEF_SHARED

View File

@ -17,10 +17,10 @@
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefXmlReader> CefXmlReader::Create(CefRefPtr<CefStreamReader> stream,
EncodingType encodingType, const std::wstring& URI)
EncodingType encodingType, const CefString& URI)
{
cef_xml_reader_t* impl = cef_xml_reader_create(
CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.c_str());
CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.GetStruct());
if(impl)
return CefXmlReaderCToCpp::Wrap(impl);
return NULL;
@ -53,18 +53,14 @@ bool CefXmlReaderCToCpp::HasError()
return struct_->has_error(struct_) ? true : false;
}
std::wstring CefXmlReaderCToCpp::GetError()
CefString CefXmlReaderCToCpp::GetError()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_error))
return str;
cef_string_t cef_str = struct_->get_error(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_error(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -84,93 +80,69 @@ int CefXmlReaderCToCpp::GetDepth()
return struct_->get_depth(struct_);
}
std::wstring CefXmlReaderCToCpp::GetLocalName()
CefString CefXmlReaderCToCpp::GetLocalName()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_local_name))
return str;
cef_string_t cef_str = struct_->get_local_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_local_name(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetPrefix()
CefString CefXmlReaderCToCpp::GetPrefix()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_prefix))
return str;
cef_string_t cef_str = struct_->get_prefix(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_prefix(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetQualifiedName()
CefString CefXmlReaderCToCpp::GetQualifiedName()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_qualified_name))
return str;
cef_string_t cef_str = struct_->get_qualified_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_qualified_name(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetNamespaceURI()
CefString CefXmlReaderCToCpp::GetNamespaceURI()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_namespace_uri))
return str;
cef_string_t cef_str = struct_->get_namespace_uri(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_namespace_uri(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetBaseURI()
CefString CefXmlReaderCToCpp::GetBaseURI()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_base_uri))
return str;
cef_string_t cef_str = struct_->get_base_uri(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_base_uri(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetXmlLang()
CefString CefXmlReaderCToCpp::GetXmlLang()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_xml_lang))
return str;
cef_string_t cef_str = struct_->get_xml_lang(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_xml_lang(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -190,18 +162,14 @@ bool CefXmlReaderCToCpp::HasValue()
return struct_->has_value(struct_) ? true : false;
}
std::wstring CefXmlReaderCToCpp::GetValue()
CefString CefXmlReaderCToCpp::GetValue()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_value))
return str;
cef_string_t cef_str = struct_->get_value(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_value(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -221,81 +189,61 @@ size_t CefXmlReaderCToCpp::GetAttributeCount()
return struct_->get_attribute_count(struct_);
}
std::wstring CefXmlReaderCToCpp::GetAttribute(int index)
CefString CefXmlReaderCToCpp::GetAttribute(int index)
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_byindex))
return str;
cef_string_t cef_str = struct_->get_attribute_byindex(struct_, index);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_attribute_byindex(struct_, index);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetAttribute(const std::wstring& qualifiedName)
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& qualifiedName)
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_byqname))
return str;
cef_string_t cef_str = struct_->get_attribute_byqname(struct_,
qualifiedName.c_str());
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_attribute_byqname(struct_,
qualifiedName.GetStruct());
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetAttribute(const std::wstring& localName,
const std::wstring& namespaceURI)
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& localName,
const CefString& namespaceURI)
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_bylname))
return str;
cef_string_t cef_str = struct_->get_attribute_bylname(struct_,
localName.c_str(), namespaceURI.c_str());
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_attribute_bylname(struct_,
localName.GetStruct(), namespaceURI.GetStruct());
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetInnerXml()
CefString CefXmlReaderCToCpp::GetInnerXml()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_inner_xml))
return str;
cef_string_t cef_str = struct_->get_inner_xml(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_inner_xml(struct_);
str.AttachToUserFree(strPtr);
return str;
}
std::wstring CefXmlReaderCToCpp::GetOuterXml()
CefString CefXmlReaderCToCpp::GetOuterXml()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_outer_xml))
return str;
cef_string_t cef_str = struct_->get_outer_xml(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_outer_xml(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -315,23 +263,23 @@ bool CefXmlReaderCToCpp::MoveToAttribute(int index)
return struct_->move_to_attribute_byindex(struct_, index) ? true : false;
}
bool CefXmlReaderCToCpp::MoveToAttribute(const std::wstring& qualifiedName)
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& qualifiedName)
{
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byqname))
return false;
return struct_->move_to_attribute_byqname(struct_, qualifiedName.c_str()) ?
return struct_->move_to_attribute_byqname(struct_, qualifiedName.GetStruct())?
true : false;
}
bool CefXmlReaderCToCpp::MoveToAttribute(const std::wstring& localName,
const std::wstring& namespaceURI)
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& localName,
const CefString& namespaceURI)
{
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_bylname))
return false;
return struct_->move_to_attribute_bylname(struct_, localName.c_str(),
namespaceURI.c_str()) ? true : false;
return struct_->move_to_attribute_bylname(struct_, localName.GetStruct(),
namespaceURI.GetStruct()) ? true : false;
}
bool CefXmlReaderCToCpp::MoveToFirstAttribute()

View File

@ -34,31 +34,31 @@ public:
virtual bool MoveToNextNode();
virtual bool Close();
virtual bool HasError();
virtual std::wstring GetError();
virtual CefString GetError();
virtual NodeType GetType();
virtual int GetDepth();
virtual std::wstring GetLocalName();
virtual std::wstring GetPrefix();
virtual std::wstring GetQualifiedName();
virtual std::wstring GetNamespaceURI();
virtual std::wstring GetBaseURI();
virtual std::wstring GetXmlLang();
virtual CefString GetLocalName();
virtual CefString GetPrefix();
virtual CefString GetQualifiedName();
virtual CefString GetNamespaceURI();
virtual CefString GetBaseURI();
virtual CefString GetXmlLang();
virtual bool IsEmptyElement();
virtual bool HasValue();
virtual std::wstring GetValue();
virtual CefString GetValue();
virtual bool HasAttributes();
virtual size_t GetAttributeCount();
virtual std::wstring GetAttribute(int index);
virtual std::wstring GetAttribute(const std::wstring& qualifiedName);
virtual std::wstring GetAttribute(const std::wstring& localName,
const std::wstring& namespaceURI);
virtual std::wstring GetInnerXml();
virtual std::wstring GetOuterXml();
virtual CefString GetAttribute(int index);
virtual CefString GetAttribute(const CefString& qualifiedName);
virtual CefString GetAttribute(const CefString& localName,
const CefString& namespaceURI);
virtual CefString GetInnerXml();
virtual CefString GetOuterXml();
virtual int GetLineNumber();
virtual bool MoveToAttribute(int index);
virtual bool MoveToAttribute(const std::wstring& qualifiedName);
virtual bool MoveToAttribute(const std::wstring& localName,
const std::wstring& namespaceURI);
virtual bool MoveToAttribute(const CefString& qualifiedName);
virtual bool MoveToAttribute(const CefString& localName,
const CefString& namespaceURI);
virtual bool MoveToFirstAttribute();
virtual bool MoveToNextAttribute();
virtual bool MoveToCarryingElement();

View File

@ -44,13 +44,13 @@ bool CefZipReaderCToCpp::MoveToNextFile()
return struct_->move_to_next_file(struct_) ? true : false;
}
bool CefZipReaderCToCpp::MoveToFile(const std::wstring& fileName,
bool CefZipReaderCToCpp::MoveToFile(const CefString& fileName,
bool caseSensitive)
{
if(CEF_MEMBER_MISSING(struct_, move_to_file))
return false;
return struct_->move_to_file(struct_, fileName.c_str(), caseSensitive) ?
return struct_->move_to_file(struct_, fileName.GetStruct(), caseSensitive) ?
true : false;
}
@ -62,18 +62,14 @@ bool CefZipReaderCToCpp::Close()
return struct_->close(struct_) ? true : false;
}
std::wstring CefZipReaderCToCpp::GetFileName()
CefString CefZipReaderCToCpp::GetFileName()
{
std::wstring str;
CefString str;
if(CEF_MEMBER_MISSING(struct_, get_file_name))
return str;
cef_string_t cef_str = struct_->get_file_name(struct_);
if(cef_str) {
str = cef_str;
cef_string_free(cef_str);
}
cef_string_userfree_t strPtr = struct_->get_file_name(struct_);
str.AttachToUserFree(strPtr);
return str;
}
@ -93,12 +89,12 @@ time_t CefZipReaderCToCpp::GetFileLastModified()
return struct_->get_file_last_modified(struct_);
}
bool CefZipReaderCToCpp::OpenFile(const std::wstring& password)
bool CefZipReaderCToCpp::OpenFile(const CefString& password)
{
if(CEF_MEMBER_MISSING(struct_, open_file))
return 0;
return struct_->open_file(struct_, password.c_str()) ? true : false;
return struct_->open_file(struct_, password.GetStruct()) ? true : false;
}
bool CefZipReaderCToCpp::CloseFile()

View File

@ -33,12 +33,12 @@ public:
// CefZipReader methods
virtual bool MoveToFirstFile();
virtual bool MoveToNextFile();
virtual bool MoveToFile(const std::wstring& fileName, bool caseSensitive);
virtual bool MoveToFile(const CefString& fileName, bool caseSensitive);
virtual bool Close();
virtual std::wstring GetFileName();
virtual CefString GetFileName();
virtual long GetFileSize();
virtual time_t GetFileLastModified();
virtual bool OpenFile(const std::wstring& password);
virtual bool OpenFile(const CefString& password);
virtual bool CloseFile();
virtual int ReadFile(void* buffer, size_t bufferSize);
virtual long Tell();