cef/libcef_dll/cpptoc/command_line_cpptoc.cc

214 lines
5.7 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/command_line_cpptoc.h"
#include "libcef_dll/transfer_util.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_command_line_t* cef_command_line_create()
{
CefRefPtr<CefCommandLine> impl = CefCommandLine::CreateCommandLine();
if(impl.get())
return CefCommandLineCppToC::Wrap(impl);
return NULL;
}
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK command_line_init_from_argv(struct _cef_command_line_t* self,
int argc, const char* const* argv)
{
DCHECK(self);
if (!self)
return;
CefCommandLineCppToC::Get(self)->InitFromArgv(argc, argv);
}
void CEF_CALLBACK command_line_init_from_string(
struct _cef_command_line_t* self, const cef_string_t* command_line)
{
DCHECK(self);
if (!self)
return;
CefCommandLineCppToC::Get(self)->InitFromString(CefString(command_line));
}
cef_string_userfree_t CEF_CALLBACK command_line_get_command_line_string(
struct _cef_command_line_t* self)
{
DCHECK(self);
if (!self)
return NULL;
CefString str = CefCommandLineCppToC::Get(self)->GetCommandLineString();
return str.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK command_line_get_program(
struct _cef_command_line_t* self)
{
DCHECK(self);
if (!self)
return NULL;
CefString str = CefCommandLineCppToC::Get(self)->GetProgram();
return str.DetachToUserFree();
}
void CEF_CALLBACK command_line_set_program(struct _cef_command_line_t* self,
const cef_string_t* program)
{
DCHECK(self);
if (!self)
return;
CefCommandLineCppToC::Get(self)->SetProgram(CefString(program));
}
int CEF_CALLBACK command_line_has_switches(struct _cef_command_line_t* self)
{
DCHECK(self);
if (!self)
return 0;
return CefCommandLineCppToC::Get(self)->HasSwitches();
}
int CEF_CALLBACK command_line_has_switch(struct _cef_command_line_t* self,
const cef_string_t* name)
{
DCHECK(self);
DCHECK(name);
if (!self || !name)
return 0;
return CefCommandLineCppToC::Get(self)->HasSwitch(CefString(name));
}
cef_string_userfree_t CEF_CALLBACK command_line_get_switch_value(
struct _cef_command_line_t* self, const cef_string_t* name)
{
DCHECK(self);
DCHECK(name);
if (!self || !name)
return NULL;
CefString str = CefCommandLineCppToC::Get(self)->GetSwitchValue(
CefString(name));
return str.DetachToUserFree();
}
void CEF_CALLBACK command_line_get_switches(struct _cef_command_line_t* self,
cef_string_map_t switches)
{
DCHECK(self);
DCHECK(switches);
if (!self || !switches)
return;
CefCommandLine::SwitchMap map;
CefCommandLineCppToC::Get(self)->GetSwitches(map);
transfer_string_map_contents(map, switches);
}
void CEF_CALLBACK command_line_append_switch(struct _cef_command_line_t* self,
const cef_string_t* name)
{
DCHECK(self);
DCHECK(name);
if (!self || !name)
return;
CefCommandLineCppToC::Get(self)->AppendSwitch(CefString(name));
}
void CEF_CALLBACK command_line_append_switch_with_value(
struct _cef_command_line_t* self, const cef_string_t* name,
const cef_string_t* value)
{
DCHECK(self);
DCHECK(name);
DCHECK(value);
if (!self || !name || !value)
return;
CefCommandLineCppToC::Get(self)->AppendSwitchWithValue(CefString(name),
CefString(value));
}
int CEF_CALLBACK command_line_has_arguments(struct _cef_command_line_t* self)
{
DCHECK(self);
if (!self)
return 0;
return CefCommandLineCppToC::Get(self)->HasArguments();
}
void CEF_CALLBACK command_line_get_arguments(struct _cef_command_line_t* self,
cef_string_list_t arguments)
{
DCHECK(self);
if (!self)
return;
CefCommandLine::ArgumentList list;
CefCommandLineCppToC::Get(self)->GetArguments(list);
transfer_string_list_contents(list, arguments);
}
void CEF_CALLBACK command_line_append_argument(struct _cef_command_line_t* self,
const cef_string_t* argument)
{
DCHECK(self);
DCHECK(argument);
if (!self || !argument)
return;
CefCommandLineCppToC::Get(self)->AppendArgument(CefString(argument));
}
// CONSTRUCTOR - Do not edit by hand.
CefCommandLineCppToC::CefCommandLineCppToC(CefCommandLine* cls)
: CefCppToC<CefCommandLineCppToC, CefCommandLine, cef_command_line_t>(cls)
{
struct_.struct_.init_from_argv = command_line_init_from_argv;
struct_.struct_.init_from_string = command_line_init_from_string;
struct_.struct_.get_command_line_string =
command_line_get_command_line_string;
struct_.struct_.get_program = command_line_get_program;
struct_.struct_.set_program = command_line_set_program;
struct_.struct_.has_switches = command_line_has_switches;
struct_.struct_.has_switch = command_line_has_switch;
struct_.struct_.get_switch_value = command_line_get_switch_value;
struct_.struct_.get_switches = command_line_get_switches;
struct_.struct_.append_switch = command_line_append_switch;
struct_.struct_.append_switch_with_value =
command_line_append_switch_with_value;
struct_.struct_.has_arguments = command_line_has_arguments;
struct_.struct_.get_arguments = command_line_get_arguments;
struct_.struct_.append_argument = command_line_append_argument;
}
#ifndef NDEBUG
template<> long CefCppToC<CefCommandLineCppToC, CefCommandLine,
cef_command_line_t>::DebugObjCt = 0;
#endif