+2.33.13:
+
+2012-09-25 Murray Cumming <murrayc@murrayc.com>
+
+ gio_docs.xml: Replace : with :.
+
+ * gio/src/gio_docs.xml: This fixes the build.
+
+2012-09-24 Murray Cumming <murrayc@murrayc.com>
+
+ Update the *_methods defs files.
+
+ * gio/src/gio_methods.defs:
+ * glib/src/glib_functions.defs:
+ * glib/src/gobject_functions.defs: Updated with tools/gen_scripts/
+
+2012-09-24 Murray Cumming <murrayc@murrayc.com>
+
+ Update the docs XML files.
+
+ * gio/src/gio_docs.xml:
+ * glib/src/glib_docs.xml: Updated with tools/gen_scripts/
+
+2012-09-24 José Alburquerque <jaalburquerque@gmail.com>
+
+ Converter[Input|Output]Stream: Correct whitespace typos.
+
+ * gio/src/converterinputstream.hg:
+ * gio/src/converteroutputstream.hg:
+
+2012-09-24 José Alburquerque <jaalburquerque@gmail.com>
+
+ giomm: Add the Converter[Input|Output]Stream classes.
+
+ * gio/src/converterinputstream.{ccg,hg}:
+ * gio/src/converteroutputstream.{ccg,hg}:
+ * gio/src/filelist.am: Add the new sources adding the constructors,
+ create methods, the methods and properties of the new classes. Add
+ the sources to the build.
+ * gio/src/gio_signals.defs:
+ * tools/extra_defs_gen/generate_defs_gio.cc: Add the two new GTypes to
+ the extra defs generation utility and regenerate the signal and
+ property defs file to get the properties of the new classes.
+ * tools/m4/convert_gio.m4: Add the necessary Converter conversions.
+
+2012-09-20 José Alburquerque <jaalburquerque@gmail.com>
+
+ giomm: Add the PollableOutputStream interface.
+
+ * gio/src/pollableoutputstream.{ccg,hg}:
+ * gio/src/filelist.am: Add the sources adding the new interface
+ methods and virtual functions and include the sources in the build.
+ * gio/src/gio_extra_objects.defs: Add the new object in this file to
+ avoid a gmmproc documentation warning.
+ * gio/src/gio_vfuncs.defs: Add the new interface virtual functions.
+
+2012-09-20 José Alburquerque <jaalburquerque@gmail.com>
+
+ giomm: Add the PollableInputStream interface.
+
+ * gio/src/pollableinputstream.{ccg,hg}:
+ * gio/src/filelist.am: Add the sources adding the new interface
+ methods and virtual functions and include the sources in the build.
+ * gio/src/gio_extra_objects.defs: Mention the new object in this file
+ to avoid the gmmproc documentation warnings.
+ * gio/src/gio_vfuncs.defs: Add the new interface virtual functions but
+ alphabetize the existing entries by class name.
+
+2012-09-19 José Alburquerque <jaalburquerque@gmail.com>
+
+ _WRAP_VFUNC: Prepend @throws clause to vfuncs that throw errors.
+
+ * tools/pm/Output.pm (output_wrap_vfunc_h): Prepend a Doxygen @throws
+ clause to the declaration of virtual functions that throw Glib::Error.
+
+2012-09-18 José Alburquerque <jaalburqu@svn.gnome.org>
+
+ Gio::DBus::Connection: Add the call_[finish|sync]() with UnixFDLists.
+
+ * gio/src/dbusconnection.{hg,ccg}: Add the methods using gmmproc's
+ output parameter functionality. Also add the cancellable and
+ non-cancellable asynchronous call() methods that were #ifdef'ed out
+ because of the missing call_finish() method.
+ * tools/m4/convert_gio.m4: Add a necessary enum conversion.
+
+ Bug #662371.
+
+2012-09-18 José Alburquerque <jaalburqu@svn.gnome.org>
+
+ gmmproc: _WRAP_METHOD: Allow setting parameters from C output params.
+
+ * tools/m4/convert_base.m4 (_INITIALIZATION): Insert newlines between
+ a possible series of statements that has been specified as an
+ initialization. For example, the declaration, assignment and the
+ g_free() call would each be on a seperate line in the following (from
+ datainputstream.hg):
+
+ _INITIALIZATION(`std::string&',`return-char*',`char* tmp = $4; $3 = tmp; g_free(tmp)')
+
+ * tools/pm/Function.pm (FLAG_PARAM_OPTIONAL):
+ (FLAG_PARAM_OUTPUT): Added new constant flags representing if a
+ parameter is optional or if it is an output parameter.
+ (EXPORT_OK): Exported the above flags so they can be used in other
+ modules.
+ (param_optional): Renamed to param_flags. Redesigned it to store a
+ possible combination of both flags above and not just if a parameter
+ is optional.
+ (parse_param): Modified the subroutine to look for an '>>' in a
+ possible '{.*}' following the current parameter name which would
+ signal that the parameter is an output parameter. The syntax for
+ signaling if a parameter is optional, is an output parameter or should
+ be mapped to a specific C parameter would be:
+
+ cpp_param_name{c_param_name>>?}
+
+ c_param_name means that the C++ parameter should be mapped to the C
+ parameter no matter the parameter order of either. The '>>' means
+ that the parameter should be set from the C parameter because the C
+ parameter is an output parameter. Finally, the '?' means that the
+ parameter is optional thus overloads should be generated without that
+ paramter. All three components within the {} are optional. A '.' may
+ be used instead of the c parameter name if the C++ parameter name is
+ the same as the C parameter name.
+
+ (possible_args_list): Modified to use the param_flags variable.
+
+ * tools/pm/Output.pm (output_wrap_vfunc_h): Modified to receive the
+ new return type from convert_args_cpp_to_c() (see below).
+ (output_wrap_meth): Modified to receive the new return from
+ convert_args_cpp_to_c (see below) and pass them to the _METHOD() and
+ _STATIC_METHOD() macros.
+ (convert_args_cpp_to_c): Modified to generate a
+ list of C declarations for any possible C output parameters and to
+ generate a list of _INITIALIZE() macros to initialize the C++
+ parameters from the C output parameters. The function returns an array
+ of three strings (the convert macros, the possible C declarations and
+ the _INITIALIZE() macros in that order).
+
+ * tools/pm/WrapParser.pm (string_split_commas): Modified the
+ subroutine to ignore '>>' if they are in '{}' (so that the '>>' can
+ signal that a parameter should be set from a C output parameter.
+
+ * tools/m4/method.m4 (_METHOD, _STATIC_METHOD): Rewrote to accept
+ C declarations of possible C output parameters and _INITIALIZE macros
+ which would initialize the appropriate C++ parameters from the output
+ variables and insert them appropriately in the generated code.
+
+ Bug #662371.
+
+2012-09-18 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
+
+ Improve the use of _IGNORE. Don't use gio_others.defs.
+
+ * gio/src/applicationcommandline.hg: Change a _CONVERSION (due to the
+ exclusion of gio_others.defs).
+ * gio/src/dbusintrospection.hg:
+ * gio/src/fileinfo.hg: Add _IGNORE.
+ * gio/src/fileiostream.hg:
+ * gio/src/fileoutputstream.hg: Correct an _IGNORE.
+ * gio/src/gio.defs: Don't include gio_others.defs. One of its entries is
+ wrong and all of them also exist (in correct form) in gio_methods.defs or
+ gio_signals.defs.
+ * glib/src/convert.hg:
+ * glib/src/regex.hg: Add _IGNORE.
+ * glib/src/date.hg:
+ * glib/src/fileutils.hg:
+ * glib/src/markup.hg:
+ * glib/src/optionentry.hg:
+ * glib/src/shell.hg:
+ * glib/src/spawn.hg:
+ * glib/src/thread.hg:
+ * glib/src/threads.hg:
+ * glib/src/unicode.hg:
+ * glib/src/uriutils.hg: Remove _IGNORE(g_iconv).
+ * glib/src/variantiter.hg: Add an _IGNORE. Remove _IGNORE(g_variant_iter_new).
+
+2012-09-18 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
+
+ gmmproc: Improve the search for unwrapped methods.
+
+ * tools/pm/GtkDefs.pm: lookup_method_set_weak_mark(): New function.
+ get_unwrapped(): Correct the search when methods from more than one class
+ have been wrapped.
+ GtkDefs::Function::new(): Take into account that a method (g_iconv) may be
+ nameless. After this change the patch of g_iconv in glib_functions.defs.patch
+ is probably unnecessary but harmless.
+ * tools/pm/WrapParser.pm: on_wrap_method_docs_only(), on_wrap_ctor():
+ Call GtkDefs::lookup_method_set_weak_mark().
+ on_wrap_method(): Call GtkDefs::lookup_method_set_weak_mark() if the method
+ is static.
+
+2012-09-14 José Alburquerque <jaalburquerque@gmail.com>
+
+ _CLASS_GOBJECT: Allow classes to have custom wrap() functions.
+
+ * tools/m4/class_gobject.m4 (_CUSTOM_WRAP_FUNCTION): Add this new
+ macro which can be used in _CLASS_GOBJECT classes so that if they want
+ they can write their own implementation of their Glib::wrap()
+ function. This is useful for modules such as gstreamermm that want to
+ keep certain classes (like the plug-ins) from being registered on
+ startup but then do a one time registration of the wrap_new() function
+ in the Glib::wrap() function before calling Glib::wrap_auto() which
+ can then find the wrap_new() function if necessary.
+
+ Bug #684006.
+
+2012-09-14 José Alburquerque <jaalburquerque@gmail.com>
+
+ generate_wrap_init.pl: Allow classes in files to not be registered.
+
+ * tools/m4/class_shared.m4: Add a new _NO_WRAP_INIT_REGISTRATION macro
+ used in the generate_wrap_init.pl script to recognize a file whose
+ classes should not be registered by wrap_init().
+ * tools/generate_wrap_init.pl.in (exclude_from_wrap_init): Include a
+ hash map to determine if the classes in a file should not be
+ registered with the wrapping system by the wrap_init() function.
+ (main): Modified to see if the new _NO_WRAP_INIT_REGISTRATION macro is
+ used in a file and store a true/false value in the hash map for the
+ specified file. Also, modified to not include the includes, the
+ *_get_type() function declarations, the wrap_new() function
+ declarations and the *::get_type() invocations of the classes in the
+ file marked for no registration.
+
+ Bug #684006.
+
+2012-09-16 Murray Cumming <murrayc@murrayc.com>
+
+ File: Add remove_async() and remove_finish().
+
+ * gio/src/file.[hg|ccg]: As for the sync version, we
+ rename delete to remove, because the sync vesion would be
+ delete(), which uses a C++ keyword.
+
+2012-09-15 Murray Cumming <murrayc@murrayc.com>
+
+ Simplified lots of code by using the {?} _WRAP_METHOD() syntax.
+
+ * gio/src/application.[hg|ccg]:
+ * gio/src/bufferedinputstream.[hg|ccg]:
+ * gio/src/datainputstream.[hg|ccg]:
+ * gio/src/dataoutputstream.[hg|ccg]:
+ * gio/src/dbusconnection.[hg|ccg]:
+ * gio/src/fileenumerator.[hg|ccg]:
+ * gio/src/initable.[hg|ccg]:
+ * gio/src/inputstream.[hg|ccg]:
+ * gio/src/iostream.[hg|ccg]:
+ * gio/src/outputstream.[hg|ccg]:
+ * gio/src/resolver.[hg|ccg]:
+ * gio/src/seekable.[hg|ccg]:
+ * gio/src/socket.[hg|ccg]:
+ * gio/src/socketaddressenumerator.[hg|ccg]:
+ * gio/src/socketclient.[hg|ccg]: This relatively new gmmproc syntax lets
+ us avoid the manual implementations and declarations just to have
+ overloads without the Cancellable parameters.
+ * gio/src/unixconnection.hg: This had no method overloads without
+ Cancellable parameters but now it does.
+
+2012-09-15 Murray Cumming <murrayc@murrayc.com>
+
+ Gio::File: Correct the commit again
+
+ * gio/src/file.[hg|ccg]: make_directory() was missing a {?}.
+
+2012-09-15 Murray Cumming <murrayc@murrayc.com>
+
+ Gio::File: Correct the previous commit.
+
+ * gio/src/file.[hg|ccg]: Do not use {?} with query_file_type()
+ because it cannot cope with also having a default parameter value
+ on an earlier parameter.
+
+2012-09-15 Murray Cumming <murrayc@murrayc.com>
+
+ Gio::File: Simplify the code by using {?} in _WRAP_METHOD()
+
+ * gio/src/file.[hg|ccg]: This relatively new gmmproc syntax lets
+ us avoid the manual implementations and declarations just to have
+ overloads without the Cancellable parameters.
+
+2012-09-15 Murray Cumming <murrayc@murrayc.com>
+
+ AppLaunchContext: Add setenv(), unsetenv() and get_environment().
+
+ * gio/src/applaunchcontext.hg: Wrap these C functions.
+
+2012-09-12 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
+
+ Use std::time_t instead of ::time_t.
+
+ * build/c_std.m4:
+ * glib/src/date.[hg|ccg]: Use std::time_t instead of ::time_t. Only
+ std::time_t is required to be declared in <ctime>, which is recommended
+ instead of <time.h> in C++ programs.
+
+2012-09-12 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
+
+ Use std::size_t and std::ptrdiff_t.
+
+ * glib/glibmm/arrayhandle.h:
+ * glib/glibmm/containers.h:
+ * glib/glibmm/listhandle.h:
+ * glib/glibmm/slisthandle.h:
+ * glib/glibmm/vectorutils.h: Use std::size_t and std::ptrdiff_t instead
+ of ::size_t and ::ptrdiff_t. Only the std versions are required to be
+ declared in <cstddef>.
+ * examples/network/resolver.cc:
+ * glib/glibmm/containerhandle_shared.h:
+ * glib/glibmm/helperlist.h:
+ * glib/glibmm/main.h:
+ * glib/glibmm/vectorutils.cc: Use std::size_t instead of ::size_t.
+ * glib/src/convert.hg: Use std::size_t instead of ::size_t in a comment.
+ * glib/glibmm/property.cc:
+ * glib/glibmm/ustring.h: Use std::ptrdiff_t instead of ::ptrdiff_t.
+
2.33.12:
2012-09-07 Murray Cumming <murrayc@murrayc.com>
+2.33.13 (unstable):
+
+Gio:
+* AppLaunchContext: Add setenv(), unsetenv() and get_environment().
+* File: Add remove_async() and remove_finish().
+ (Murray Cumming)
+* Add e ConverterInputStream and ConverterOutputStream.
+* Add PollableInputStream and PollableOutputStream.
+ (José Alburquerque)
+
+Gio::DBus:
+* Connection: Add the call_[finish|sync]() with UnixFDLists.
+ (José Alburquerque)#662371.
+
+gmmproc:
+* Add a _NO_WRAP_INIT_REGISTRATION macro
+ (José Alburquerque) Bug #684006
+* _CLASS_GOBJECT: Allow classes to have custom wrap() functions.
+ (José Alburquerque) Bug #684006
+* _WRAP_METHOD: Allow setting parameters from C output params.
+ (José Alburquerque) Bug #662371
+* Prepend a Doxygen @throws clause to the declaration of virtual
+ functions that throw Glib::Error.
+ (José Alburquerque)
+* Improve the search for unwrapped methods.
+ (Kjell Ahlstedt)
+
+Build:
+* Use std::time_t instead of ::time_t
+ instead of ::time_t.
+* Use std::size_t and std::ptrdiff_t instead
+ of ::size_t and ::ptrdiff_t.
+ (Kjell Ahlstedt)
+
+
2.33.12 (unstable):
Gio:
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-#serial 20110910
+#serial 20120912
## GLIBMM_C_STD_TIME_T_IS_NOT_INT32
##
-## Test whether time_t and gint32 are typedefs of the same builting type. If
-## they aren't then they can be used for method overload. In that case
+## Test whether std::time_t and gint32 are typedefs of the same builting type.
+## If they aren't then they can be used for method overload. In that case
## GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 is defined to 1.
##
AC_DEFUN([GLIBMM_C_STD_TIME_T_IS_NOT_INT32],
[
AC_CACHE_CHECK(
- [whether time_t is not equivalent to gint32, meaning that it can be used for a method overload],
+ [whether std::time_t is not equivalent to gint32, meaning that it can be used for a method overload],
[glibmm_cv_c_std_time_t_is_not_int32],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
- #include <time.h>
+ #include <ctime>
]],[[
typedef signed int gint32;
class Test
void something(gint32 val)
{}
- void something(time_t val)
+ void something(std::time_t val)
{}
};
]])],
AS_VAR_IF([glibmm_cv_c_std_time_t_is_not_int32], ['yes'],
[AC_DEFINE([GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32], [1],
- [Defined when time_t is not equivalent to gint32, meaning that it can be used for a method overload])])[]dnl
+ [Defined when std::time_t is not equivalent to gint32, meaning that it can be used for a method overload])])[]dnl
])
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.33.12],
+AC_INIT([glibmm], [2.33.13],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library])
])
-glibreq='2.0 >= 2.33.12'
+glibreq='2.0 >= 2.34.0'
GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
split_service_parts (const Glib::ustring& arg)
{
std::vector<Glib::ustring> parts;
- size_t delim1 = 0;
- size_t delim2 = 0;
+ std::size_t delim1 = 0;
+ std::size_t delim2 = 0;
delim1 = arg.find ('/', 0);
if (delim1 == std::string::npos)
return parts;
std::string host, port_str;
guint16 port;
- size_t pos = arg.find (':');
+ std::size_t pos = arg.find (':');
if (pos != std::string::npos)
{
host = arg.substr (0, pos);
public:
_WRAP_CREATE()
+ _WRAP_METHOD(void setenv(const Glib::ustring& variable, const Glib::ustring& value), g_app_launch_context_setenv)
+ _WRAP_METHOD(void unsetenv(const Glib::ustring& variable), g_app_launch_context_unsetenv)
+
+#m4 _CONVERSION(`char**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::ustring> get_environment() const, g_app_launch_context_get_environment)
+
#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
_WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle< Glib::RefPtr<Gio::File> >& files),
g_app_launch_context_get_display)
open(files, hint);
}
-bool Application::register_application()
-{
- GError* gerror = 0;
- bool retvalue = g_application_register(gobj(), NULL, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
} // namespace Gio
_WRAP_METHOD(bool is_remote() const, g_application_get_is_remote)
//Renamed from register() because that is a C++ keyword.
- _WRAP_METHOD(bool register_application(const Glib::RefPtr<Gio::Cancellable>& cancellable), g_application_register, errthrow)
-
- /// Non-cancellable version of register_application().
- bool register_application();
+ _WRAP_METHOD(bool register_application(const Glib::RefPtr<Gio::Cancellable>& cancellable{?}), g_application_register, errthrow)
_WRAP_METHOD(void hold(), g_application_hold)
_WRAP_METHOD(void release(), g_application_release)
_WRAP_METHOD(std::string get_cwd() const, g_application_command_line_get_cwd)
//We use std::string instead of ustring because the C documentation says that it may be non-UTF-8 data:
-#m4 _CONVERSION(`const gchar*const*',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3, Glib::OWNERSHIP_NONE)')
+#m4 _CONVERSION(`const gchar* const*',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3, Glib::OWNERSHIP_NONE)')
_WRAP_METHOD(std::vector<std::string> get_environ() const, g_application_command_line_get_environ)
//We use std::string instead of ustring because the C documentation says that it may be non-UTF-8 data:
return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, buffer_size));
}
-gssize BufferedInputStream::fill(gssize count)
-{
- GError* gerror = 0;
- const gssize retvalue = g_buffered_input_stream_fill(const_cast<GBufferedInputStream*>(gobj()), count, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
gssize count,
const Glib::RefPtr<Cancellable>& cancellable,
slot_copy);
}
-int BufferedInputStream::read_byte()
-{
- GError* gerror = 0;
- const int retvalue = g_buffered_input_stream_read_byte(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-
} // namespace Gio
_WRAP_METHOD(gsize get_available() const, g_buffered_input_stream_get_available)
_WRAP_METHOD(gsize peek(void* buffer, gsize offset, gsize count) const, g_buffered_input_stream_peek)
_WRAP_METHOD(const void* peek_buffer(gsize& count) const, g_buffered_input_stream_peek_buffer)
- _WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_fill, errthrow)
-
- /** non-cancellable version of fill()
- */
- gssize fill(gssize count);
+ _WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable{?}), g_buffered_input_stream_fill, errthrow)
_IGNORE(g_buffered_input_stream_fill_async)
_WRAP_METHOD(gssize fill_finish(const Glib::RefPtr<AsyncResult>& result), g_buffered_input_stream_fill_finish, errthrow)
- _WRAP_METHOD(int read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_read_byte, errthrow)
-
- /** Non-cancellable version of read_byte().
- */
- int read_byte();
+ _WRAP_METHOD(int read_byte(const Glib::RefPtr<Cancellable>& cancellable{?}), g_buffered_input_stream_read_byte, errthrow)
_WRAP_PROPERTY("buffer-size", guint)
--- /dev/null
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/converter.h>
+#include <giomm/inputstream.h>
+
+namespace Gio
+{
+
+} // namespace Gio
--- /dev/null
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <giomm/filterinputstream.h>
+#include <giomm/pollableinputstream.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/filterinputstream_p.h)
+
+namespace Gio
+{
+
+class Converter;
+class InputStream;
+
+/** ConverterInputstream - Converter Input Stream.
+ * Converter input stream implements InputStream and allows conversion of data
+ * of various types during reading. ConverterInputStream also implements the
+ * PollableInputStream interface.
+ * @newin{2,34}
+ */
+class ConverterInputStream : public FilterInputStream,
+ public PollableInputStream
+{
+ _CLASS_GOBJECT(ConverterInputStream, GConverterInputStream, G_CONVERTER_INPUT_STREAM, FilterInputStream, GFilterInputStream)
+ _IMPLEMENTS_INTERFACE(PollableInputStream)
+
+protected:
+ _WRAP_CTOR(ConverterInputStream(const Glib::RefPtr<InputStream>& base_stream, const Glib::RefPtr<Converter>& converter), g_converter_input_stream_new)
+
+public:
+ _WRAP_METHOD_DOCS_ONLY(g_converter_input_stream_new)
+ _WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream, const Glib::RefPtr<Converter>& converter)
+
+ // The C function returns an unreffed private member.
+ _WRAP_METHOD(Glib::RefPtr<Converter> get_converter(), g_converter_input_stream_get_converter, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Converter> get_converter() const, g_converter_input_stream_get_converter, constversion)
+
+ _WRAP_PROPERTY("converter", Glib::RefPtr<Converter>)
+};
+
+} // namespace Gio
--- /dev/null
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/converter.h>
+#include <giomm/outputstream.h>
+
+namespace Gio
+{
+
+} // namespace Gio
--- /dev/null
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <giomm/filteroutputstream.h>
+#include <giomm/pollableoutputstream.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/filteroutputstream_p.h)
+
+namespace Gio
+{
+
+class Converter;
+class OutputStream;
+
+/** ConverterOutputstream - Converter Output Stream.
+ * Converter output stream implements OutputStream and allows conversion of
+ * data of various types during reading. ConverterOutputStream also implements
+ * the PollableOutputStream interface.
+ * @newin{2,34}
+ */
+class ConverterOutputStream : public FilterOutputStream,
+ public PollableOutputStream
+{
+ _CLASS_GOBJECT(ConverterOutputStream, GConverterOutputStream, G_CONVERTER_OUTPUT_STREAM, FilterOutputStream, GFilterOutputStream)
+ _IMPLEMENTS_INTERFACE(PollableOutputStream)
+
+protected:
+ _WRAP_CTOR(ConverterOutputStream(const Glib::RefPtr<OutputStream>& base_stream, const Glib::RefPtr<Converter>& converter), g_converter_output_stream_new)
+
+public:
+ _WRAP_METHOD_DOCS_ONLY(g_converter_output_stream_new)
+ _WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream, const Glib::RefPtr<Converter>& converter)
+
+ // The C function returns an unreffed private member.
+ _WRAP_METHOD(Glib::RefPtr<Converter> get_converter(), g_converter_output_stream_get_converter, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Converter> get_converter() const, g_converter_output_stream_get_converter, constversion)
+
+ _WRAP_PROPERTY("converter", Glib::RefPtr<Converter>)
+};
+
+} // namespace Gio
namespace Gio
{
-guchar DataInputStream::read_byte()
-{
- GError* gerror = 0;
- const guchar retvalue = g_data_input_stream_read_byte(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gint16 DataInputStream::read_int16()
-{
- GError* gerror = 0;
- const gint16 retvalue = g_data_input_stream_read_int16(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-guint16 DataInputStream::read_uint16()
-{
- GError* gerror = 0;
- const guint16 retvalue = g_data_input_stream_read_uint16(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gint32 DataInputStream::read_int32()
-{
- GError* gerror = 0;
- const gint32 retvalue = g_data_input_stream_read_int32(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-guint32 DataInputStream::read_uint32()
-{
- GError* gerror = 0;
- const guint32 retvalue = g_data_input_stream_read_uint32(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gint64 DataInputStream::read_int64()
-{
- GError* gerror = 0;
- const gint64 retvalue = g_data_input_stream_read_int64(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-guint64 DataInputStream::read_uint64()
-{
- GError* gerror = 0;
- const guint64 retvalue = g_data_input_stream_read_uint64(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
_WRAP_METHOD(void set_newline_type(DataStreamNewlineType type), g_data_input_stream_set_newline_type)
_WRAP_METHOD(DataStreamNewlineType get_newline_type() const, g_data_input_stream_get_newline_type)
- _WRAP_METHOD(guchar read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_byte, errthrow)
+ _WRAP_METHOD(guchar read_byte(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_byte, errthrow)
- /** non-cancellable version of read_byte()
- */
- guchar read_byte();
-
- _WRAP_METHOD(gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int16, errthrow)
- /** non-cancellable version of read_int16()
- */
- gint16 read_int16();
+ _WRAP_METHOD(gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_int16, errthrow)
- _WRAP_METHOD(guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint16, errthrow)
+ _WRAP_METHOD(guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_uint16, errthrow)
-//TODO: Real documentation:
- /** non-cancellable version of read_uint16()
- */
- guint16 read_uint16();
+ _WRAP_METHOD(gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_int32, errthrow)
- _WRAP_METHOD(gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int32, errthrow)
+ _WRAP_METHOD(guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_uint32, errthrow)
- /** non-cancellable version of read_int32()
- */
- gint32 read_int32();
-
- _WRAP_METHOD(guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint32, errthrow)
- /** non-cancellable version of read_uint32()
- */
- guint32 read_uint32();
-
- _WRAP_METHOD(gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int64, errthrow)
-
- /** non-cancellable version of read_int64()
- */
- gint64 read_int64();
-
- _WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint64, errthrow)
-
- /** non-cancellable version of read_uint64()
- */
- guint64 read_uint64();
+ _WRAP_METHOD(gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_int64, errthrow)
+ _WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_uint64, errthrow)
//Note that we return a bool because we can't use std::string to distinguish between an empty string and a NULL.
namespace Gio
{
-bool DataOutputStream::put_byte(guchar data)
-{
- GError* gerror = 0;
- const guchar retvalue = g_data_output_stream_put_byte(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_int16(gint16 data)
-{
- GError* gerror = 0;
- const gint16 retvalue = g_data_output_stream_put_int16(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_uint16(guint16 data)
-{
- GError* gerror = 0;
- const guint16 retvalue = g_data_output_stream_put_uint16(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_int32(gint32 data)
-{
- GError* gerror = 0;
- const gint32 retvalue = g_data_output_stream_put_int32(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_uint32(guint32 data)
-{
- GError* gerror = 0;
- const guint32 retvalue = g_data_output_stream_put_uint32(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_int64(gint64 data)
-{
- GError* gerror = 0;
- const gint64 retvalue = g_data_output_stream_put_int64(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_uint64(guint64 data)
-{
- GError* gerror = 0;
- guint64 retvalue = g_data_output_stream_put_uint64(gobj(), data, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool DataOutputStream::put_string(std::string str)
-{
- GError* gerror = 0;
- const bool retval = g_data_output_stream_put_string(gobj(),
- str.c_str (),
- 0,
- &gerror);
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
- return retval;
-}
-
-
} // namespace Gio
_WRAP_METHOD(void set_byte_order(DataStreamByteOrder order), g_data_output_stream_set_byte_order)
_WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_output_stream_get_byte_order)
- _WRAP_METHOD(bool put_byte(guchar data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_byte, errthrow)
+ _WRAP_METHOD(bool put_byte(guchar data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_byte, errthrow)
- /** non-cancellable version of put_byte()
- */
- bool put_byte(guchar data);
+ _WRAP_METHOD(bool put_int16(gint16 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int16, errthrow)
- _WRAP_METHOD(bool put_int16(gint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int16, errthrow)
- /** non-cancellable version of put_int16()
- */
- bool put_int16(gint16 data);
+ _WRAP_METHOD(bool put_uint16(guint16 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint16, errthrow)
- _WRAP_METHOD(bool put_uint16(guint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint16, errthrow)
- /** non-cancellable version of put_uint16()
- */
- bool put_uint16(guint16 data);
+ _WRAP_METHOD(bool put_int32(gint32 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int32, errthrow)
- _WRAP_METHOD(bool put_int32(gint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int32, errthrow)
+ _WRAP_METHOD(bool put_uint32(guint32 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint32, errthrow)
- /** non-cancellable version of put_int32()
- */
- bool put_int32(gint32 data);
+ _WRAP_METHOD(bool put_int64(gint64 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_int64, errthrow)
- _WRAP_METHOD(bool put_uint32(guint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint32, errthrow)
- /** non-cancellable version of put_uint32()
- */
- bool put_uint32(guint32 data);
+ _WRAP_METHOD(bool put_uint64(guint64 data, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_uint64, errthrow)
- _WRAP_METHOD(bool put_int64(gint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int64, errthrow)
- /** non-cancellable version of put_int64()
- */
- bool put_int64(gint64 data);
-
- _WRAP_METHOD(bool put_uint64(guint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint64, errthrow)
-
- /** non-cancellable version of put_uint64()
- */
- bool put_uint64(guint64 data);
-
- _WRAP_METHOD(bool put_string(std::string str, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_string, errthrow)
-
- /** non-cancellable version of put_string()
- */
- bool put_string(std::string str);
+ _WRAP_METHOD(bool put_string(std::string str, const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_output_stream_put_string, errthrow)
_WRAP_PROPERTY("byte-order", DataStreamByteOrder)
};
slot_copy);
}
-//static
-Glib::RefPtr<Connection> Connection::get_sync(BusType bus_type)
-{
- GError* gerror = 0;
-
- GDBusConnection* result = g_bus_get_sync(static_cast<GBusType>(bus_type),
- 0, & gerror);
-
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return Glib::wrap(result);
-}
-
void Connection::close()
{
g_dbus_connection_close(gobj(), 0, 0, 0);
slot_copy);
}
-void Connection::close_sync()
-{
- GError* gerror = 0;
- g_dbus_connection_close_sync(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-}
-
void Connection::flush()
{
g_dbus_connection_flush(gobj(), 0, 0, 0);
slot_copy);
}
-void Connection::flush_sync()
-{
- GError* gerror = 0;
- g_dbus_connection_flush_sync(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-}
-
bool Connection::send_message(const Glib::RefPtr<Message>& message,
SendMessageFlags flags)
{
Glib::RefPtr<Message> Connection::send_message_with_reply_sync(
const Glib::RefPtr<Message>& message,
const Glib::RefPtr<Cancellable>& cancellable,
- gint timeout_msec
-)
+ gint timeout_msec)
{
volatile guint32 out_serial = 0;
GError* gerror = 0;
Glib::RefPtr<Message> Connection::send_message_with_reply_sync(
const Glib::RefPtr<Message>& message,
- gint timeout_msec
-)
+ gint timeout_msec)
{
volatile guint32 out_serial = 0;
GError* gerror = 0;
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
GError* gerror = 0;
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
GError* gerror = 0;
return Glib::VariantContainerBase(gvariant, false); //Dont' take an extra reference.
}
-//TODO: Re-add the following two methods when the call_finish() method with a
-//UnixFDList exists.
-#if 0
#ifdef G_OS_LINUX
// With a UnixFDList.
void Connection::call(
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
const Glib::ustring& bus_name,
int timeout_msec,
CallFlags flags,
- const Glib::VariantType& reply_type
-)
+ const Glib::VariantType& reply_type)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
0, &SignalProxy_async_callback, slot_copy);
}
#endif // G_OS_LINUX
-#endif // 0
void Connection::emit_signal(
const Glib::ustring& object_path,
const Glib::ustring& interface_name,
const Glib::ustring& signal_name,
const Glib::ustring& destination_bus_name,
- const Glib::VariantContainerBase& parameters
-)
+ const Glib::VariantContainerBase& parameters)
{
GError* gerror = 0;
const Glib::ustring& member,
const Glib::ustring& object_path,
const Glib::ustring& arg0,
- SignalFlags flags
-)
+ SignalFlags flags)
{
SlotSignal* slot_copy = new SlotSignal(slot);
/// @throw Glib::Error.
_WRAP_METHOD(static Glib::RefPtr<Connection> get_finish(const Glib::RefPtr<AsyncResult>& res), g_bus_get_finish, errthrow)
- _WRAP_METHOD(static Glib::RefPtr<Connection> get_sync(BusType bus_type, const Glib::RefPtr<Cancellable>& cancellable), g_bus_get_sync, errthrow)
-
- /// A Non-cancellable version of get_sync().
- static Glib::RefPtr<Connection> get_sync(BusType bus_type);
+ _WRAP_METHOD(static Glib::RefPtr<Connection> get_sync(BusType bus_type, const Glib::RefPtr<Cancellable>& cancellable{?}), g_bus_get_sync, errthrow)
_WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new)
static void create(const Glib::RefPtr<IOStream>& stream,
_WRAP_METHOD(bool close_finish(const Glib::RefPtr<AsyncResult>& result),
g_dbus_connection_close_finish, errthrow)
- /** Synchronously closees the connection. The calling thread is blocked
- * until this is done. See close() for the asynchronous version of this
- * method and more details about what it does.
- *
- * @newin{2,28}
- *
- * @throw Glib::Error.
- */
- void close_sync();
-
- _WRAP_METHOD(void close_sync(const Glib::RefPtr<Cancellable>& cancellable), g_dbus_connection_close_sync, errthrow)
+ _WRAP_METHOD(void close_sync(const Glib::RefPtr<Cancellable>& cancellable{?}), g_dbus_connection_close_sync, errthrow)
/** Asynchronously flushes the connection, that is, writes all queued
* outgoing message to the transport and then flushes the transport (using
_WRAP_METHOD(bool flush_finish(const Glib::RefPtr<AsyncResult>& result),
g_dbus_connection_flush_finish, errthrow)
- /** Synchronously flushes the connection. The calling thread is blocked
- * until this is done. See flush() for the asynchronous version of this
- * method and more details about what it does.
- *
- * @newin{2,28}
- *
- * @throw Glib::Error.
- */
- void flush_sync();
-
- _WRAP_METHOD(void flush_sync(const Glib::RefPtr<Cancellable>& cancellable), g_dbus_connection_flush_sync, errthrow)
+ _WRAP_METHOD(void flush_sync(const Glib::RefPtr<Cancellable>& cancellable{?}), g_dbus_connection_flush_sync, errthrow)
_WRAP_METHOD(bool get_exit_on_close() const, g_dbus_connection_get_exit_on_close)
_WRAP_METHOD(void set_exit_on_close(bool exit_on_close = true), g_dbus_connection_set_exit_on_close)
Glib::RefPtr<Message> send_message_with_reply_sync(
const Glib::RefPtr<Message>& message,
const Glib::RefPtr<Cancellable>& cancellable,
- gint timeout_msec
- );
+ gint timeout_msec);
_IGNORE(g_dbus_connection_send_message_with_reply_sync)
/// A non-cancellable version of send_message_with_reply_sync().
Glib::RefPtr<Message> send_message_with_reply_sync(
const Glib::RefPtr<Message>& message,
- gint timeout_msec
- );
+ gint timeout_msec);
_WRAP_METHOD(void start_message_processing(), g_dbus_connection_start_message_processing)
_WRAP_METHOD(bool is_closed() const, g_dbus_connection_is_closed)
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
+ const Glib::VariantType& reply_type = Glib::VariantType());
_IGNORE(g_dbus_connection_call)
/// A non-cancellable version of call().
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
+ const Glib::VariantType& reply_type = Glib::VariantType());
/** Finishes an operation started with call().
* @param res A AsyncResult obtained from the SlotAsyncReady passed to
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
+ const Glib::VariantType& reply_type = Glib::VariantType());
_IGNORE(g_dbus_connection_call_sync)
/// A non-cancellable version of call_sync().
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
+ const Glib::VariantType& reply_type = Glib::VariantType());
-// TODO: Re-add the following two methods when the call_finish() method with a
-// UnixFDList is wrapped.
-#if 0
#ifdef G_OS_LINUX
/** Like call() but also takes a GUnixFDList object.
* This method is only available on UNIX.
*
+ * This is an asynchronous method. When the operation is finished, callback
+ * will be invoked in the thread-default main loop of the thread you are
+ * calling this method from. You can then call call_with_unix_fd_finish() to
+ * get the result of the operation. See call_sync() for the synchronous
+ * version of this function.
+ *
* @param object_path Path of remote object.
* @param interface_name D-Bus interface to invoke method on.
* @param method_name The name of the method to invoke.
* timeout or G_MAXINT for no timeout.
* @param flags Flags from the Gio::DBus::CallFlags enumeration.
* @param reply_type The expected type of the reply, or <tt>0</tt>.
- * @newin{2,32}
+ * @newin{2,34}
*/
void call(
const Glib::ustring& object_path,
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
- _IGNORE(g_dbus_connection_call_with_uinx_fd_list)
+ const Glib::VariantType& reply_type = Glib::VariantType());
+ _IGNORE(g_dbus_connection_call_with_unix_fd_list)
- /// A non-cancellable version of call() (with a UnixFDList).
+ /** A non-cancellable version of call() (with a UnixFDList).
+ * @newin{2,34}
+ */
void call(
const Glib::ustring& object_path,
const Glib::ustring& interface_name,
const Glib::ustring& bus_name = Glib::ustring(),
int timeout_msec = -1,
CallFlags flags = Gio::DBus::CALL_FLAGS_NONE,
- const Glib::VariantType& reply_type = Glib::VariantType()
- );
+ const Glib::VariantType& reply_type = Glib::VariantType());
#endif // G_OS_LINUX
-#endif // 0
-
- ///** Finishes an operation started with call() (with a UnixFDList).
- //* @param res A AsyncResult obtained from the SlotAsyncReady passed to
- //* call().
- //* @result A Variant tuple with return values.
- //* @throw Glib::Error.
- //* @newin{2,32}
- //*/
- //TODO: _WRAP_METHOD(Glib::VariantContainerBase call_with_unix_fd_finish(const Glib::RefPtr<AsyncResult>& res{.}, Glib::RefPtr<UnixFDList>& out_fd_list{.?}), g_dbus_connection_call_with_unix_fd_list_finish, errthrow)
-
- /* TODO:
+
+#m4 _INITIALIZATION(`Glib::RefPtr<UnixFDList>&',`GUnixFDList*', `$3 = Glib::wrap($4)')
+
+ /** Finishes an operation started with call() (with a UnixFDList).
+ * @param res A AsyncResult obtained from the SlotAsyncReady passed to
+ * call().
+ * @result A Variant tuple with return values.
+ * @throw Glib::Error.
+ * @newin{2,34}
+ */
+ _WRAP_METHOD(Glib::VariantContainerBase call_finish(const Glib::RefPtr<AsyncResult>& res{.}, Glib::RefPtr<UnixFDList>& out_fd_list{.>>}), g_dbus_connection_call_with_unix_fd_list_finish, errthrow)
+
_WRAP_METHOD(
Glib::VariantContainerBase call_sync(
const Glib::ustring& object_path{.},
const Glib::VariantContainerBase& parameters{.},
const Glib::RefPtr<Cancellable>& cancellable{.?},
const Glib::RefPtr<UnixFDList>& fd_list{.},
- Glib::RefPtr<UnixFDList>& out_fd_list{.},
+ Glib::RefPtr<UnixFDList>& out_fd_list{.>>},
const Glib::ustring& bus_name{.} = Glib::ustring(),
int timeout_msec{.} = -1,
CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE,
),
g_dbus_connection_call_with_unix_fd_list_sync, errthrow
)
- */
/** Emits a signal.
*
const Glib::ustring& interface_name,
const Glib::ustring& signal_name,
const Glib::ustring& destination_bus_name = Glib::ustring(),
- const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase()
- );
+ const Glib::VariantContainerBase& parameters = Glib::VariantContainerBase());
_IGNORE(g_dbus_connection_emit_signal)
/** Subscribes to signals on the connection and invokes @a slot with a
const Glib::ustring& member = Glib::ustring(),
const Glib::ustring& object_path = Glib::ustring(),
const Glib::ustring& arg0 = Glib::ustring(),
- SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE
- );
+ SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE);
_IGNORE(g_dbus_connection_signal_subscribe)
_WRAP_METHOD(void signal_unsubscribe(guint subscription_id), g_dbus_connection_signal_unsubscribe)
class AnnotationInfo
{
_CLASS_OPAQUE_REFCOUNTED(AnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
+ _IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
public:
#m4 _CONVERSION(`const Glib::ArrayHandle< Glib::RefPtr<AnnotationInfo> >&', `GDBusAnnotationInfo**', `const_cast<GDBusAnnotationInfo**>($3.data())')
class ArgInfo
{
_CLASS_OPAQUE_REFCOUNTED(ArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref)
+ _IGNORE(g_dbus_arg_info_ref, g_dbus_arg_info_unref)
public:
};
class MethodInfo
{
_CLASS_OPAQUE_REFCOUNTED(MethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref)
+ _IGNORE(g_dbus_method_info_ref, g_dbus_method_info_unref)
public:
};
class SignalInfo
{
_CLASS_OPAQUE_REFCOUNTED(SignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref)
+ _IGNORE(g_dbus_signal_info_ref, g_dbus_signal_info_unref)
public:
};
class PropertyInfo
{
_CLASS_OPAQUE_REFCOUNTED(PropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref)
+ _IGNORE(g_dbus_property_info_ref, g_dbus_property_info_unref)
public:
};
class InterfaceInfo
{
_CLASS_OPAQUE_REFCOUNTED(InterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref)
+ _IGNORE(g_dbus_interface_info_ref, g_dbus_interface_info_unref)
public:
_WRAP_METHOD(Glib::RefPtr<MethodInfo> lookup_method(const Glib::ustring& name), g_dbus_interface_info_lookup_method, refreturn)
class NodeInfo
{
_CLASS_OPAQUE_REFCOUNTED(NodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref)
+ _IGNORE(g_dbus_node_info_ref, g_dbus_node_info_unref)
public:
_WRAP_METHOD_DOCS_ONLY(g_dbus_node_info_new_for_xml)
slot_copy);
}
+FileType File::query_file_type(FileQueryInfoFlags flags) const
+{
+ return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, 0);
+}
+
Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const
{
GError* gerror = 0;
return retvalue;
}
-bool File::query_exists() const
-{
- return g_file_query_exists(const_cast<GFile*>(gobj()), 0);
-}
-
-FileType File::query_file_type(FileQueryInfoFlags flags) const
-{
- return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, 0);
-}
-
void
File::query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, int io_priority) const
{
slot_copy);
}
-Glib::RefPtr<File> File::set_display_name(const Glib::ustring& display_name)
-{
- GError* gerror = 0;
- Glib::RefPtr<File> retvalue = Glib::wrap(g_file_set_display_name(gobj(), display_name.c_str(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
void
File::set_display_name_async(const Glib::ustring& display_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
return res;
}
-bool File::set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-bool File::set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_byte_string(gobj(), attribute.c_str(), value.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-bool File::set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_uint32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-bool File::set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_int32(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-bool File::set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_uint64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-bool File::set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags)
-{
- GError* gerror = 0;
- bool retvalue = g_file_set_attribute_int64(gobj(), attribute.c_str(), value, ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
void File::mount_mountable(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
{
slot_copy);
}
-Glib::RefPtr<FileInputStream> File::read()
-{
- GError* gerror = 0;
- Glib::RefPtr<FileInputStream> retvalue = Glib::wrap(g_file_read(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
void File::find_enclosing_mount_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
return retvalue;
}
-bool File::remove()
-{
- GError* gerror = 0;
- bool retvalue = g_file_delete(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool File::trash()
-{
- GError* gerror = 0;
- bool retvalue = g_file_trash(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool File::make_directory()
-{
- GError* gerror = 0;
- bool retvalue = g_file_make_directory(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool File::make_directory_with_parents()
-{
- GError* gerror = 0;
- const bool retvalue = g_file_make_directory_with_parents(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool File::make_symbolic_link(const std::string& symlink_value)
-{
- GError* gerror = 0;
- bool retvalue = g_file_make_symbolic_link(gobj(), symlink_value.c_str(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<FileAttributeInfoList> File::query_settable_attributes()
-{
- GError* gerror = 0;
- Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_settable_attributes(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<FileAttributeInfoList> File::query_writable_namespaces()
-{
- GError* gerror = 0;
- Glib::RefPtr<FileAttributeInfoList> retvalue = Glib::wrap(g_file_query_writable_namespaces(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-
Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
{
GError* gerror = 0;
return retvalue;
}
-Glib::RefPtr<Mount> File::find_enclosing_mount()
-{
- GError* gerror = 0;
- Glib::RefPtr<Mount> retvalue = Glib::wrap(g_file_find_enclosing_mount(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<AppInfo> File::query_default_handler()
-{
- GError* gerror = 0;
- Glib::RefPtr<AppInfo> retvalue = Glib::wrap(g_file_query_default_handler(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out)
{
GError* gerror = 0;
}
+void
+File::remove_async(const SlotAsyncReady& slot_ready,
+ const Glib::RefPtr<Cancellable>& cancellable,
+ int io_priority)
+{
+ // Create copies of slots.
+ // Pointers to them will be passed through the callbacks' data parameter
+ // and deleted in the corresponding callback.
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ g_file_delete_async(gobj(),
+ io_priority,
+ Glib::unwrap(cancellable),
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+void
+File::remove_async(const SlotAsyncReady& slot_ready,
+ int io_priority)
+{
+ // Create copies of slots.
+ // Pointers to them will be passed through the callbacks' data parameter
+ // and deleted in the corresponding callback.
+ SlotAsyncReady* slot_ready_copy = new SlotAsyncReady(slot_ready);
+
+ g_file_delete_async(gobj(),
+ io_priority,
+ 0,
+ &SignalProxy_async_callback,
+ slot_ready_copy);
+}
+
+
+
} // namespace Gio
_WRAP_METHOD(std::string get_uri_scheme() const, g_file_get_uri_scheme)
//TODO: We don't have both const and unconst versions because a FileInputStream can't really change the File.
- _WRAP_METHOD(Glib::RefPtr<FileInputStream> read(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<FileInputStream> read(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_read,
refreturn, errthrow)
- /** Opens a file for reading. The result is a FileInputStream that
- * can be used to read the contents of the file.
- *
- * If the file does not exist, a Gio::Error with NOT_FOUND will be thrown.
- * If the file is a directory, a Gio::Error with IS_DIRECTORY will be thrown.
- * Other errors are possible too, and depend on what kind of filesystem the file is on.
- * @return FileInputStream or an empty RefPtr on error.
- */
- Glib::RefPtr<FileInputStream> read();
-
/** Asynchronously opens the file for reading.
* For more details, see read() which is the synchronous version of this call.
* When the operation is finished, @a slot will be called. You can then call read_finish() to get the result of the operation.
refreturn, errthrow)
- _WRAP_METHOD(Glib::RefPtr<FileIOStream> open_readwrite(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<FileIOStream> open_readwrite(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_open_readwrite,
refreturn, errthrow)
_IGNORE(g_file_query_info)
- _WRAP_METHOD(bool query_exists(const Glib::RefPtr<Cancellable>& cancellable) const, g_file_query_exists)
-
- /** Utility function to check if a particular file exists. This is
- * implemented using query_info() and as such does blocking I/O.
- *
- * Note that in many cases it is racy to first check for file existance
- * and then execute something based on the outcome of that, because the
- * file might have been created or removed inbetween the operations. The
- * general approach to handling that is to not check, but just do the
- * operation and handle the errors as they come.
- *
- * As an example of race-free checking, take the case of reading a file, and
- * if it doesn't exist, creating it. There are two racy versions: read it, and
- * on error create it; and: check if it exists, if not create it. These
- * can both result in two processes creating the file (with perhaps a partially
- * written file as the result). The correct approach is to always try to create
- * the file with g_file_create() which will either atomically create the file
- * or throw a Gio::Error with EXISTS.
- *
- * However, in many cases an existance check is useful in a user
- * interface, for instance to make a menu item sensitive/insensitive, so that
- * you don't have to fool users that something is possible and then just show
- * and error dialog. If you do this, you should make sure to also handle the
- * errors that can happen due to races when you execute the operation.
- *
- * @result true if the file exists (and can be detected without error), false otherwise (or if cancelled).
- */
- bool query_exists() const;
-
+ _WRAP_METHOD(bool query_exists(const Glib::RefPtr<Cancellable>& cancellable{?}) const, g_file_query_exists)
+ //We cannot use the {?} format here because we want a default value for flags, but gmmproc then generates a method with a default value for flags when it is not the last parameter.
_WRAP_METHOD(FileType query_file_type(FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) const, g_file_query_file_type)
/** Utility function to inspect the #GFileType of a file. This is
*
* The primary use case of this method is to check if a file is a regular file,
* directory, or symlink.
- *
+ *
* @param flags: a set of FileQueryInfoFlags passed to query_info().
* @results The FileType of the file, or FILE_TYPE_UNKNOWN if the file does not exist.
*
Glib::RefPtr<FileInfo> query_filesystem_info(const std::string& attributes = "*");
_IGNORE(g_file_query_filesystem_info)
- _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_find_enclosing_mount, retreturn, errthrow)
g_file_query_filesystem_info_finish,
refreturn, errthrow)
-
- /** Gets a Mount for the File.
- *
- * If the FileIface for the file does not have a mount (e.g. possibly a
- * remote share), an Gio::Error wtih NOT_FOUND will be thrown and an empty RefPtr
- * will be returned.
- *
- * @param cancellable Cancellable object.
- * @return A Mount where the file is located.
- */
- Glib::RefPtr<Mount> find_enclosing_mount();
-
-
/** Asynchronously gets the mount for the file.
*
* For more details, see find_enclosing_mount() which is
g_file_enumerate_children_finish,
errthrow)
- _WRAP_METHOD(Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_display_name,
refreturn, errthrow)
- /** Renames the file to the specified display name.
- *
- * The display name is converted from UTF8 to the correct encoding for the target
- * filesystem if possible and the file is renamed to this.
- *
- * If you want to implement a rename operation in the user interface the edit name
- * (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename
- * widget, and then the result after editing should be passed to set_display_name().
- *
- * On success the resulting converted filename is returned.
- *
- * The operation can be cancelled by triggering the cancellable object from another thread. If the operation
- * was cancelled, a Gio::Error with CANCELLED will be thrown.
- *
- * @param display_name A string.
- * @return A Glib::File specifying what the file was renamed to, or an empty RefPtr if there was an error.
- */
- Glib::RefPtr<File> set_display_name(const Glib::ustring& display_name);
-
-
/** Asynchronously sets the display name for a given Gio::File. For the synchronous version of this function, see set_display_name().
* When the operation is finished, @a slot will be called. You can then call set_display_name_finish() to get the result of the operation.
*
* @param cancellable A Cancellable object which can be used to cancel the operation.
* @return <tt>true</tt> if the file was deleted. <tt>false</tt> otherwise.
*/
- _WRAP_METHOD(bool remove(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool remove(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_delete,
errthrow)
- /** Deletes a file.
- * If the file is a directory, it will only be deleted if it is empty.
- *
- * @return <tt>true</tt> if the file was deleted. <tt>false</tt> otherwise.
- */
- bool remove();
+ /** Asynchronously delete a file.
+ * If the @file is a directory, it will
+ * only be deleted if it is empty. This has the same semantics as
+ * g_unlink().
+ *
+ * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+ * @param cancellable A Cancellable object which can be used to cancel the operation
+ * @param io_priority The I/O priority of the request
+ * @newin{2,34}
+ */
+ void remove_async(const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
+
+ /** Asynchronously delete a file.
+ * If the @file is a directory, it will
+ * only be deleted if it is empty. This has the same semantics as
+ * g_unlink().
+ *
+ * @param slot_ready A SlotAsyncReady to call when the request is satisfied
+ * @param io_priority The I/O priority of the request
+ * @newin{2,34}
+ */
+ void remove_async(const SlotAsyncReady& slot_ready, int io_priority = Glib::PRIORITY_DEFAULT);
+ _IGNORE(g_file_delete_async)
+
+ _WRAP_METHOD(bool remove_finish(const Glib::RefPtr<AsyncResult>& result),
+ g_file_delete_finish,
+ errthrow)
- _WRAP_METHOD(bool trash(const Glib::RefPtr<Cancellable>& cancellable),
+
+ _WRAP_METHOD(bool trash(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_trash,
errthrow)
- /** Sends the file to the "Trashcan", if possible. This is similar to
- * deleting it, but the user can recover it before emptying the trashcan.
- * Not all filesystems support trashing, so this call can throw a Gio::Error
- * with NOT_SUPPORTED.
- *
- * @return <tt>true</tt> on successful trash, <tt>false</tt> otherwise.
- */
- bool trash();
-
/** A signal handler would be, for instance:
* void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);
bool move(const Glib::RefPtr<File>& destination, FileCopyFlags flags = FILE_COPY_NONE);
_IGNORE(g_file_move)
- _WRAP_METHOD(bool make_directory(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool make_directory(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_make_directory,
errthrow)
- /** Creates a directory.
- * Note that this will only create a child directory of the immediate parent
- * directory of the path or URI given by the File. To recursively create
- * directories, see make_directory_with_parents(). This function will fail if
- * the parent directory does not exist, throwing an exception with
- * IO_ERROR_NOT_FOUND. If the file system doesn't support creating directories,
- * this function will fail, throwing an exception with IO_ERROR_NOT_SUPPORTED.
- *
- * @return <tt>true</tt> on successful creation, <tt>false</tt> otherwise.
- */
- bool make_directory();
-
-
- _WRAP_METHOD(bool make_directory_with_parents(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool make_directory_with_parents(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_make_directory_with_parents,
errthrow)
- /** Creates a directory and any parent directories that may not exist, similar to 'mkdir -p'.
- * If the file system does not support creating directories, this function will fail,
- * throwing an exception with IO_ERROR_NOT_SUPPORTED.
- *
- * @return <tt>true</tt> on successful creation, <tt>false</tt> otherwise.
- *
- * @newin{2,18}
- */
- bool make_directory_with_parents();
-
- _WRAP_METHOD(bool make_symbolic_link(const std::string& symlink_value, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool make_symbolic_link(const std::string& symlink_value, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_make_symbolic_link,
errthrow)
- /** Creates a symbolic link.
- *
- * @param symlink_value A string with the value of the new symlink.
- * @return <tt>true</tt> on the creation of a new symlink, <tt>false</tt> otherwise.
- */
- bool make_symbolic_link(const std::string& symlink_value);
-
- _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_settable_attributes(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_settable_attributes(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_query_settable_attributes,
errthrow)
- /** Obtain the list of settable attributes for the file.
- *
- * Returns: a FileAttributeInfoList describing the settable attributes.
- * @return A FileAttributeInfoList describing the settable attributes.
- */
- Glib::RefPtr<FileAttributeInfoList> query_settable_attributes();
-
- _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_query_writable_namespaces,
errthrow)
- /** Obtain the list of attribute namespaces where new attributes
- * can be created by a user. An example of this is extended
- * attributes (in the "xattr" namespace).
- *
- * @return A FileAttributeInfoList describing the writable namespaces.
- */
- Glib::RefPtr<FileAttributeInfoList> query_writable_namespaces();
-
-
/* This seems to be very generic (see the gpointer parameter),
in a C kind of way. Hopefully we don't need it. murrayc
gboolean g_file_set_attribute (GFile *file,
bool set_attributes_finish(const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info);
- _WRAP_METHOD(bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_string,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_STRING to @a value.
- * If @a attribute is of a different type, this operation will fail.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A string containing the attribute's value.
- * @param flags FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set, <tt>false</tt> otherwise.
- */
- bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags);
-
- _WRAP_METHOD(bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_byte_string,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to @a value.
- * If @a attribute is of a different type, this operation will fail,
- * returning <tt>false</tt>.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A string containing the attribute's new value.
- * @param flags A FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set to @a value
- * in the @a file, <tt>false</tt> otherwise.
- */
- bool set_attribute_byte_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags);
-
- _WRAP_METHOD(bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_uint32,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to @a value.
- * If @a attribute is of a different type, this operation will fail.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A #guint32 containing the attribute's new value.
- * @param flags A FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set to @a value
- * in the @a file, <tt>false</tt> otherwise.
- */
- bool set_attribute_uint32(const std::string& attribute, guint32 value, FileQueryInfoFlags flags);
-
- _WRAP_METHOD(bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_int32,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_INT32 to @a value.
- * If @a attribute is of a different type, this operation will fail.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A #gint32 containing the attribute's new value.
- * @param flags A FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set to @a value
- * in the @a file, <tt>false</tt> otherwise.
- */
- bool set_attribute_int32(const std::string& attribute, gint32 value, FileQueryInfoFlags flags);
-
- _WRAP_METHOD(bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_uint64,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to @a value.
- * If @a attribute is of a different type, this operation will fail.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A #guint64 containing the attribute's new value.
- * @param flags A FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set to @a value
- * in the @a file, <tt>false</tt> otherwise.
- */
- bool set_attribute_uint64(const std::string& attribute, guint64 value, FileQueryInfoFlags flags);
-
- _WRAP_METHOD(bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_set_attribute_int64,
errthrow)
- /** Sets @a attribute of type FILE_ATTRIBUTE_TYPE_INT64 to @a value.
- * If @a attribute is of a different type, this operation will fail.
- *
- * @param attribute A string containing the attribute's name.
- * @param value A #guint64 containing the attribute's new value.
- * @param flags A FileQueryInfoFlags.
- * @return <tt>true</tt> if the @a attribute was successfully set, <tt>false</tt> otherwise.
- */
- bool set_attribute_int64(const std::string& attribute, gint64 value, FileQueryInfoFlags flags);
-
/** Starts a @a mount_operation, mounting the volume that contains the file.
*
* When this operation has completed, @a slot will be called with,
_WRAP_METHOD(bool poll_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_poll_mountable_finish, errthrow)
- _WRAP_METHOD(Glib::RefPtr<AppInfo> query_default_handler(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<AppInfo> query_default_handler(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_query_default_handler,
errthrow)
-/** Returns the AppInfo that is registered as the default
- * application to handle the file specified by the file.
- *
- * @result A AppInfo if the handle was found, or an empty RefPtr if there were errors.
- **/
- Glib::RefPtr<AppInfo> query_default_handler();
-
//TODO: Something better than char*& for contents?
/** Loads the content of the file into memory, returning the size of the data.
* The data is always zero terminated, but this is not included in the resultant @a length.
slot_copy);
}
-Glib::RefPtr<FileInfo> FileEnumerator::next_file()
-{
- GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool FileEnumerator::close()
-{
- GError* gerror = 0;
- bool retvalue = g_file_enumerator_close(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
} // namespace Gio
_CLASS_GOBJECT(FileEnumerator, GFileEnumerator, G_FILE_ENUMERATOR, Glib::Object, GObject)
public:
- _WRAP_METHOD(Glib::RefPtr<FileInfo> next_file(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(Glib::RefPtr<FileInfo> next_file(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_enumerator_next_file,
errthrow)
- /**
- * @return A FileInfo or an empty RefPtr on error or end of enumerator.
- */
- Glib::RefPtr<FileInfo> next_file();
-
- _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_file_enumerator_close,
errthrow)
- /** Releases all resources used by this enumerator, making the
- * enumerator throw a Gio::Error with CLOSED on all calls.
- *
- * This will be automatically called when the last reference
- * is dropped, but you might want to call this method to make sure resources
- * are released as early as possible.
- * @return #<tt>true</tt> on success or an empty RefPtr on error.
- */
- bool close();
-
/** Request information for a number of files from the enumerator asynchronously.
* When all I/O for the operation is finished the callback slot will be called with the requested information.
{
_CLASS_OPAQUE_REFCOUNTED(FileAttributeMatcher, GFileAttributeMatcher,
NONE, g_file_attribute_matcher_ref, g_file_attribute_matcher_unref)
+ _IGNORE(g_file_attribute_matcher_ref, g_file_attribute_matcher_unref)
public:
/** Creates a new file attribute matcher, which matches attributes against a given string.
* @return A FileInfo, or an empty RefPtr on error.
*/
Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*");
- _IGNORE(g_file_input_stream_query_info)
+ _IGNORE(g_file_io_stream_query_info)
/** Queries the stream information asynchronously. For the synchronous version of this function, see query_info().
cancellable.hg \
charsetconverter.hg \
converter.hg \
+ converterinputstream.hg \
+ converteroutputstream.hg \
credentials.hg \
datainputstream.hg \
dataoutputstream.hg \
networkaddress.hg \
networkservice.hg \
outputstream.hg \
+ pollableinputstream.hg \
+ pollableoutputstream.hg \
proxy.hg \
proxyaddress.hg \
proxyresolver.hg \
* @param io_priority The <io-priority of the request.
*/
void query_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT);
- _IGNORE(g_file_input_stream_query_info_async)
+ _IGNORE(g_file_output_stream_query_info_async)
_WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_output_stream_query_info_finish,
(include gio_methods.defs)
(include gio_unix_functions.defs)
(include gio_extra_objects.defs)
-(include gio_others.defs)
(include gio_enums.defs)
(include gio_signals.defs)
(include gio_vfuncs.defs)
<function name="g_async_result_is_tagged">
<description>
-Checks if @result has the given @source_tag (generally a function
-pointer indicating the function @result was created by).
+Checks if @res has the given @source_tag (generally a function
+pointer indicating the function @res was created by).
Since: 2.34
</description>
<parameters>
-<parameter name="result">
+<parameter name="res">
<parameter_description> a #GAsyncResult
</parameter_description>
</parameter>
</parameter_description>
</parameter>
</parameters>
-<return> %TRUE if @result has the indicated @source_tag, %FALSE if
+<return> %TRUE if @res has the indicated @source_tag, %FALSE if
not.
</return>
<function name="g_async_result_legacy_propagate_error">
<description>
-If @result is a #GSimpleAsyncResult, this is equivalent to
+If @res is a #GSimpleAsyncResult, this is equivalent to
g_simple_async_result_propagate_error(). Otherwise it returns
%FALSE.
</description>
<parameters>
-<parameter name="result">
+<parameter name="res">
<parameter_description> a #GAsyncResult
</parameter_description>
</parameter>
-<parameter name="dest">
+<parameter name="error">
<parameter_description> a location to propagate the error to.
</parameter_description>
</parameter>
</return>
</function>
+<function name="g_content_type_get_generic_icon_name">
+<description>
+Gets the generic icon name for a content type.
+
+See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
+specification for more on the generic icon name.
+
+Since: 2.34
+
+</description>
+<parameters>
+<parameter name="type">
+<parameter_description> a content type string
+</parameter_description>
+</parameter>
+</parameters>
+<return> the registered generic icon name for the given @type,
+or %NULL if unknown. Free with g_free()
+
+</return>
+</function>
+
<function name="g_content_type_get_icon">
<description>
Gets the icon for a content type.
</parameter_description>
</parameter>
<parameter name="bus_name">
-<parameter_description> A unique or well-known bus name.
+<parameter_description> A unique or well-known bus name or %NULL if
+@connection is not a message bus connection.
</parameter_description>
</parameter>
<parameter name="object_path">
</parameter_description>
</parameter>
<parameter name="bus_name">
-<parameter_description> A unique or well-known bus name.
+<parameter_description> A unique or well-known bus name or %NULL if
+@connection is not a message bus connection.
</parameter_description>
</parameter>
<parameter name="object_path">
<function name="g_desktop_app_info_get_startup_wm_class">
<description>
-Retrieves the StartupWMClass field from @app_info. This represents the
-WM_CLASS property of the main window of the application, if launched through
-@app_info.
+Retrieves the StartupWMClass field from @info. This represents the
+WM_CLASS property of the main window of the application, if launched
+through @info.
Since: 2.34
</description>
<parameters>
-<parameter name="app_info">
+<parameter name="info">
<parameter_description> a #GDesktopAppInfo that supports startup notify
</parameter_description>
</parameter>
<parameter_description> input #GFile
</parameter_description>
</parameter>
-<parameter name="res">
+<parameter name="result">
<parameter_description> a #GAsyncResult
</parameter_description>
</parameter>
<function name="g_test_dbus_get_flags">
<description>
+Gets the flags of the #GTestDBus object.
+
</description>
<parameters>
<function name="g_unix_mount_guess_symbolic_icon">
<description>
-Guesses the symbolic icon of a Unix mount.
+Guesses the symbolic icon of a Unix mount.
Since: 2.34
</description>
<parameters>
+<parameter name="mount_point">
+<parameter_description> a #GUnixMountPoint
+</parameter_description>
+</parameter>
</parameters>
<return> a #GIcon
(gtype-id "G_TYPE_MENU_ITEM")
)
+(define-object PollableInputStream
+ (in-module "Gio")
+ (c-name "GPollableInputStream")
+ (gtype-id "G_TYPE_POLLABLE_INPUT_STREAM")
+)
+
+(define-object PollableOutputStream
+ (in-module "Gio")
+ (c-name "GPollableOutputStream")
+ (gtype-id "G_TYPE_POLLABLE_OUTPUT_STREAM")
+)
+
(define-object Proxy
(in-module "Gio")
(c-name "GProxy")
)
)
+(define-function g_content_type_get_generic_icon_name
+ (c-name "g_content_type_get_generic_icon_name")
+ (return-type "gchar*")
+ (parameters
+ '("const-gchar*" "type")
+ )
+)
+
(define-function g_content_type_can_be_executable
(c-name "g_content_type_can_be_executable")
(return-type "gboolean")
(return-type "GVariant*")
(parameters
'("const-gchar*" "attribute")
- '("const-GVariantType*" "expected_value")
+ '("const-GVariantType*" "expected_type")
)
)
(construct-only #f)
)
+;; From GConverterInputStream
+
+(define-property converter
+ (of-object "GConverterInputStream")
+ (prop-type "GParamObject")
+ (docs "The converter object")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+;; From GConverterOutputStream
+
+(define-property converter
+ (of-object "GConverterOutputStream")
+ (prop-type "GParamObject")
+ (docs "The converter object")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
;; From GDataInputStream
(define-property byte-order
)
)
+; GAppInfo
+
+(define-vfunc dup
+ (of-object "GAppInfo")
+ (return-type "GAppInfo*")
+)
+
+(define-vfunc equal
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GAppInfo*" "appinfo2")
+ )
+)
+
+(define-vfunc get_id
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_name
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_description
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_executable
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_icon
+ (of-object "GAppInfo")
+ (return-type "GIcon*")
+)
+
+(define-vfunc launch
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "filenames")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc supports_uris
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc supports_files
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc launch_uris
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "uris")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc should_show
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc set_as_default_for_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc set_as_default_for_extension
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "extension")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc add_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc can_remove_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc remove_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
; GApplication
(define-vfunc local_command_line
(return-type "GObject*")
)
+; GBufferedInputStream
+
+(define-vfunc fill
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+ '("gssize" "count")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc fill_async
+ (of-object "GBufferedInputStream")
+ (return-type "void")
+ (parameters
+ '("gssize" "count")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-vfunc fill_finish
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
; GConverter
(define-vfunc convert
)
)
-; GAppInfo
-
-(define-vfunc dup
- (of-object "GAppInfo")
- (return-type "GAppInfo*")
-)
-
-(define-vfunc equal
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("GAppInfo*" "appinfo2")
- )
-)
-
-(define-vfunc get_id
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_name
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_description
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_executable
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_icon
- (of-object "GAppInfo")
- (return-type "GIcon*")
-)
-
-(define-vfunc launch
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("GList*" "filenames")
- '("GAppLaunchContext*" "launch_context")
- '("GError**" "error")
- )
-)
-
-(define-vfunc supports_uris
- (of-object "GAppInfo")
- (return-type "gboolean")
-)
-
-(define-vfunc supports_files
- (of-object "GAppInfo")
- (return-type "gboolean")
-)
+; GPollableInputStream
-(define-vfunc launch_uris
- (of-object "GAppInfo")
+(define-vfunc can_poll
+ (of-object "GPollableInputStream")
(return-type "gboolean")
- (parameters
- '("GList*" "uris")
- '("GAppLaunchContext*" "launch_context")
- '("GError**" "error")
- )
)
-(define-vfunc should_show
- (of-object "GAppInfo")
+(define-vfunc is_readable
+ (of-object "GPollableInputStream")
(return-type "gboolean")
)
-(define-vfunc set_as_default_for_type
- (of-object "GAppInfo")
- (return-type "gboolean")
+(define-vfunc create_source
+ (of-object "GPollableInputStream")
+ (return-type "GSource*")
(parameters
- '("const-char*" "content_type")
- '("GError**" "error")
+ '("GCancellable*" "cancellable")
)
)
-(define-vfunc set_as_default_for_extension
- (of-object "GAppInfo")
- (return-type "gboolean")
+(define-vfunc read_nonblocking
+ (of-object "GPollableInputStream")
+ (return-type "gssize")
(parameters
- '("const-char*" "extension")
+ '("void*" "buffer")
+ '("gsize" "count")
'("GError**" "error")
)
)
-(define-vfunc add_supports_type
- (of-object "GAppInfo")
+; GPollableOutputStream
+
+(define-vfunc can_poll
+ (of-object "GPollableOutputStream")
(return-type "gboolean")
- (parameters
- '("const-char*" "content_type")
- '("GError**" "error")
- )
)
-(define-vfunc can_remove_supports_type
- (of-object "GAppInfo")
+(define-vfunc is_writable
+ (of-object "GPollableOutputStream")
(return-type "gboolean")
)
-(define-vfunc remove_supports_type
- (of-object "GAppInfo")
- (return-type "gboolean")
+(define-vfunc create_source
+ (of-object "GPollableOutputStream")
+ (return-type "GSource*")
(parameters
- '("const-char*" "content_type")
- '("GError**" "error")
+ '("GCancellable*" "cancellable")
)
)
-; GBufferedInputStream
-
-(define-vfunc fill
- (of-object "GBufferedInputStream")
- (return-type "gssize")
- (parameters
- '("gssize" "count")
- '("GCancellable*" "cancellable")
- '("GError**" "error")
- )
-)
-
-(define-vfunc fill_async
- (of-object "GBufferedInputStream")
- (return-type "void")
- (parameters
- '("gssize" "count")
- '("int" "io_priority")
- '("GCancellable*" "cancellable")
- '("GAsyncReadyCallback" "callback")
- '("gpointer" "user_data")
- )
-)
-
-(define-vfunc fill_finish
- (of-object "GBufferedInputStream")
- (return-type "gssize")
- (parameters
- '("GAsyncResult*" "result")
- '("GError**" "error")
- )
+(define-vfunc write_nonblocking
+ (of-object "GPollableOutputStream")
+ (return-type "gssize")
+ (parameters
+ '("const-void*" "buffer")
+ '("gsize" "count")
+ '("GError**" "error")
+ )
)
; GRemoteActionGroup
namespace Gio
{
-void Initable::init()
-{
- GError *gerror = 0;
- g_initable_init(gobj(), 0, &gerror);
- if (gerror)
- ::Glib::Error::throw_exception(gerror);
-}
-
} // namespace Gio
_CLASS_INTERFACE(Initable, GInitable, G_INITABLE, GInitableIface)
protected:
- _WRAP_METHOD(void init(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(void init(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_initable_init, errthrow)
- /// Non-cancellable version of init().
- void init();
-
_WRAP_VFUNC(bool init(const Glib::RefPtr<Cancellable>& cancellable, GError** error), "init")
};
namespace Gio
{
-gssize InputStream::read(void* buffer, gsize count)
-{
- GError* gerror = 0;
- gssize retvalue = g_input_stream_read(gobj(), buffer, count, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-
-bool InputStream::read_all(void* buffer, gsize count, gsize& bytes_read)
-{
- GError* gerror = 0;
- bool retvalue = g_input_stream_read_all(gobj(), buffer, count, &(bytes_read), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gssize InputStream::skip(gsize count)
-{
- GError* gerror = 0;
- gssize retvalue = g_input_stream_skip(gobj(), count, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool InputStream::close()
-{
- GError* gerror = 0;
- bool retvalue = g_input_stream_close(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
void
InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
_CLASS_GOBJECT(InputStream, GInputStream, G_INPUT_STREAM, Glib::Object, GObject)
public:
- _WRAP_METHOD(gssize read(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(gssize read(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_input_stream_read,
errthrow)
- /** Tries to read @a count bytes from the stream into the buffer starting at
- * @a buffer. Will block during this read.
- *
- * If count is zero returns zero and does nothing. A value of @a count
- * larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
- *
- * On success, the number of bytes read into the buffer is returned.
- * It is not an error if this is not the same as the requested size, as it
- * can happen e.g. near the end of a file. Zero is returned on end of file
- * (or if @a count is zero), but never otherwise.
- *
- * On error -1 is returned.
- * @param buffer A buffer to read data into (which should be at least count bytes long).
- * @param count The number of bytes that will be read from the stream.
- * @return Number of bytes read, or -1 on error.
- */
- gssize read(void* buffer, gsize count);
-
//TODO: for glibmm 2.17/18, we should decide whether to provide a read()
// function as below, which would presumably read until EOL, or one with
// an additional size parameter, at the same time taking into account
//TODO: gssize read(std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable);
//TODO: gssize read(std::string& buffer);
- _WRAP_METHOD(bool read_all(void* buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool read_all(void* buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_input_stream_read_all,
errthrow)
- /** Tries to read @a count bytes from the stream into the buffer starting at
- * @a buffer. Will block during this read.
- *
- * This function is similar to read(), except it tries to
- * read as many bytes as requested, only stopping on an error or end of stream.
- *
- * On a successful read of @a count bytes, or if we reached the end of the
- * stream, <tt>true</tt> is returned, and @a bytes_read is set to the number of bytes
- * read into @a buffer .
- *
- * If there is an error during the operation <tt>false</tt> is returned and a Gio::Error
- * is thrown to indicate the error status, @a bytes_read is updated to contain
- * the number of bytes read into @a buffer before the error occured.
- * @param buffer A buffer to read data into (which should be at least count bytes long).
- * @param count The number of bytes that will be read from the stream.
- * @param bytes_read Location to store the number of bytes that was read from the stream.
- * @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
- */
- bool read_all(void* buffer, gsize count, gsize& bytes_read);
-
//TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable);
//TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read)
- _WRAP_METHOD(gssize skip(gsize count, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(gssize skip(gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_input_stream_skip,
errthrow)
- /** Tries to skip @a count bytes from the stream. Will block during the operation.
- *
- * This is identical to read(), from a behaviour standpoint,
- * but the bytes that are skipped are not returned to the user. Some
- * streams have an implementation that is more efficient than reading the data.
- *
- * This function is optional for inherited classes, as the default implementation
- * emulates it using read.
- *
- * @param count The number of bytes that will be skipped from the stream.
- * @return Number of bytes skipped, or -1 on error.
- */
- gssize skip(gsize count);
-
- _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_input_stream_close,
errthrow)
- /** Closes the stream, releasing resources related to it.
- *
- * Once the stream is closed, all other operations will throw a Gio::Error with CLOSED.
- * Closing a stream multiple times will not return an error.
- *
- * Streams will be automatically closed when the last reference
- * is dropped, but you might want to call this make sure resources
- * are released as early as possible.
- *
- * Some streams might keep the backing store of the stream (e.g. a file descriptor)
- * open after the stream is closed. See the documentation for the individual
- * stream for details.
- *
- * On failure the first error that happened will be reported, but the close
- * operation will finish as much as possible. A stream that failed to
- * close will still throw a Gio::Error with CLOSED for all operations. Still, it
- * is important to check and report the error to the user.
- *
- * @return <tt>true</tt> on success, <tt>false</tt> on failure.
- */
- bool close();
/** Request an asynchronous read of @a count bytes from the stream into the buffer
* starting at @a buffer. When the operation is finished @a slot will be called.
namespace Gio
{
-
-
-bool IOStream::close()
-{
- GError* gerror = 0;
- bool retvalue = g_io_stream_close(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-
void
IOStream::close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
public:
_WRAP_METHOD(Glib::RefPtr<InputStream> get_input_stream(), g_io_stream_get_input_stream, refreturn)
_WRAP_METHOD(Glib::RefPtr<OutputStream> get_output_stream(), g_io_stream_get_output_stream, refreturn)
- _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_io_stream_close, errthrow)
-
-bool close();
+ _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable{?}), g_io_stream_close, errthrow)
void close_async(const SlotAsyncReady&slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT);
void close_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
slot_copy);
}
-
-gssize OutputStream::write(const void* buffer, gsize count)
-{
- GError* gerror = 0;
- gssize retvalue = g_output_stream_write(gobj(), buffer, count, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
gssize OutputStream::write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
return retvalue;
}
-bool OutputStream::write_all(const void* buffer, gsize count, gsize& bytes_written)
-{
- GError* gerror = 0;
- bool retvalue = g_output_stream_write_all(gobj(), buffer, count, &(bytes_written), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
return retvalue;
}
-bool OutputStream::flush()
-{
- GError* gerror = 0;
- bool retvalue = g_output_stream_flush(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-bool OutputStream::close()
-{
- GError* gerror = 0;
- bool retvalue = g_output_stream_close(gobj(), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
} // namespace Gio
public:
- _WRAP_METHOD(gssize write(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(gssize write(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_output_stream_write,
errthrow)
*
* On error -1 is returned.
* @param buffer The buffer containing the data to write.
- * @param count The number of bytes to write.
- * @return Number of bytes written, or -1 on error.
- */
- gssize write(const void* buffer, gsize count);
-
- /** Tries to write @a count bytes from @a buffer into the stream. Will block
- * during the operation.
- *
- * If count is zero returns zero and does nothing. A value of @a count
- * larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
- *
- * On success, the number of bytes written to the stream is returned.
- * It is not an error if this is not the same as the requested size, as it
- * can happen e.g. on a partial i/o error, or if the there is not enough
- * storage in the stream. All writes either block until at least one byte
- * is written, so zero is never returned (unless @a count is zero).
- *
- * On error -1 is returned.
- * @param buffer The buffer containing the data to write.
* @param cancellable Cancellable object.
* @return Number of bytes written, or -1 on error.
*/
gssize write(const std::string& buffer);
- _WRAP_METHOD(bool write_all(const void* buffer, gsize count, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool write_all(const void* buffer, gsize count, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable{?}),
g_output_stream_write_all,
errthrow)
* is set to indicate the error status, @a bytes_written is updated to contain
* the number of bytes written into the stream before the error occured.
* @param buffer The buffer containing the data to write.
- * @param count The number of bytes to write.
- * @param bytes_written Location to store the number of bytes that was
- * written to the stream.
- * @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
- */
- bool write_all(const void* buffer, gsize count, gsize& bytes_written);
-
- /** Tries to write @a count bytes from @a buffer into the stream. Will block
- * during the operation.
- *
- * This function is similar to write(), except it tries to
- * write as many bytes as requested, only stopping on an error.
- *
- * On a successful write of @a count bytes, <tt>true</tt> is returned, and @a bytes_written
- * is set to @a count .
- *
- * If there is an error during the operation <tt>false</tt> is returned and @a error
- * is set to indicate the error status, @a bytes_written is updated to contain
- * the number of bytes written into the stream before the error occured.
- * @param buffer The buffer containing the data to write.
* @param bytes_written Location to store the number of bytes that was
* written to the stream.
* @param cancellable Cancellable object.
* @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
*/
bool write_all(const std::string& buffer, gsize& bytes_written);
-
- _WRAP_METHOD(gssize write_bytes(const Glib::RefPtr<const Glib::Bytes>& bytes, const Glib::RefPtr<Cancellable>& cancellable), g_output_stream_write_bytes, errthrow)
+
+ _WRAP_METHOD(gssize write_bytes(const Glib::RefPtr<const Glib::Bytes>& bytes, const Glib::RefPtr<Cancellable>& cancellable{?}), g_output_stream_write_bytes, errthrow)
//TODO: Documentation.
/**
gssize splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE);
_IGNORE(g_output_stream_splice)
- _WRAP_METHOD(bool flush(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool flush(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_output_stream_flush,
errthrow)
- /** Flushed any outstanding buffers in the stream. Will block during
- * the operation. Closing the stream will implicitly cause a flush.
- *
- * This function is optional for inherited classes.
- *
- * The operation can be cancelled by
- * triggering the cancellable object from another thread. If the operation
- * was cancelled, a Gio::Error with CANCELLED will be thrown.
- * @param cancellable Optional cancellable object.
- * @return <tt>true</tt> on success, <tt>false</tt> on error.
- */
- bool flush();
-
- _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
+ _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable{?}),
g_output_stream_close,
errthrow)
- /** Closes the stream, releasing resources related to it.
- *
- * Once the stream is closed, all other operations will throw a Gio::Error with CLOSED.
- * Closing a stream multiple times will not return an error.
- *
- * Closing a stream will automatically flush any outstanding buffers in the
- * stream.
- *
- * Streams will be automatically closed when the last reference
- * is dropped, but you might want to call make sure resources
- * are released as early as possible.
- *
- * Some streams might keep the backing store of the stream (e.g. a file descriptor)
- * open after the stream is closed. See the documentation for the individual
- * stream for details.
- *
- * On failure the first error that happened will be reported, but the close
- * operation will finish as much as possible. A stream that failed to
- * close will still throw a Gio::Error with CLOSED for all operations. Still, it
- * is important to check and report the error to the user, otherwise
- * there might be a loss of data as all data might not be written.
- *
- * The operation can be cancelled by
- * triggering the cancellable object from another thread. If the operation
- * was cancelled, a Gio::Error with CANCELLED will be thrown.
- * Cancelling a close will still leave the stream closed, but there some streams
- * can use a faster close that doesn't block to e.g. check errors. On
- * cancellation (as with any error) there is no guarantee that all written
- * data will reach the target.
- * @param cancellable Optional cancellable object.
- * @return <tt>true</tt> on success, <tt>false</tt> on failure.
- */
- bool close();
-
/** Request an asynchronous write of @a count bytes from @a buffer into
* the stream. When the operation is finished @a slot will be called.
* You can then call write_finish() to get the result of the
--- /dev/null
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/cancellable.h>
+
+namespace Gio
+{
+
+} // namespace Gio
--- /dev/null
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GPollableInputStreamInterface GPollableInputStreamInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+class Cancellable;
+
+/** PollableInputStream - Interface for pollable input streams.
+ * PollableInputStream is implemented by InputStreams that can be polled for
+ * readiness to read. This can be used when interfacing with a non-GIO API that
+ * expects UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
+ * @newin{2,34}
+ */
+class PollableInputStream : public Glib::Interface
+{
+ _CLASS_INTERFACE(PollableInputStream, GPollableInputStream, G_POLLABLE_INPUT_STREAM, GPollableInputStreamInterface)
+
+public:
+ _WRAP_METHOD(bool can_poll() const, g_pollable_input_stream_can_poll)
+ _WRAP_METHOD(bool is_readable() const, g_pollable_input_stream_is_readable)
+
+ //TODO: _WRAP_METHOD(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), g_pollable_input_stream_create_source)
+
+ _WRAP_METHOD(gssize read_nonblocking(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}), g_pollable_input_stream_read_nonblocking, errthrow)
+
+ _WRAP_VFUNC(bool can_poll() const, "can_poll")
+ _WRAP_VFUNC(bool is_readable() const, "is_readable")
+
+ //TODO: _WRAP_VFUNC(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), "create_source")
+
+ _WRAP_VFUNC(gssize read_nonblocking(void* buffer, gsize count), "read_nonblocking", errthrow)
+};
+
+} // namespace Gio
--- /dev/null
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/cancellable.h>
+
+namespace Gio
+{
+
+} // namespace Gio
--- /dev/null
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GPollableOutputStreamInterface GPollableOutputStreamInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+class Cancellable;
+
+/** PollableOutputStream - Interface for pollable output streams.
+ * PollableOutputStream is implemented by OutputStreams that can be polled for
+ * readiness to write. This can be used when interfacing with a non-GIO API
+ * that expects UNIX-file-descriptor-style asynchronous I/O rather than
+ * GIO-style.
+ * @newin{2,34}
+ */
+class PollableOutputStream : public Glib::Interface
+{
+ _CLASS_INTERFACE(PollableOutputStream, GPollableOutputStream, G_POLLABLE_OUTPUT_STREAM, GPollableOutputStreamInterface)
+
+public:
+ _WRAP_METHOD(bool can_poll() const, g_pollable_output_stream_can_poll)
+ _WRAP_METHOD(bool is_writable() const, g_pollable_output_stream_is_writable)
+
+ //TODO: _WRAP_METHOD(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), g_pollable_output_stream_create_source)
+
+ _WRAP_METHOD(gssize write_nonblocking(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}), g_pollable_output_stream_write_nonblocking, errthrow)
+
+ _WRAP_VFUNC(bool can_poll() const, "can_poll")
+ _WRAP_VFUNC(bool is_writable() const, "is_writable")
+
+ //TODO:_WRAP_VFUNC(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), "create_source")
+
+ _WRAP_VFUNC(gssize write_nonblocking(const void* buffer, gsize count), "write_nonblocking", errthrow)
+};
+
+} // namespace Gio
g_resolver_set_default(Glib::unwrap(resolver));
}
-Glib::ListHandle< Glib::RefPtr<InetAddress> > Resolver::lookup_by_name(const Glib::ustring& hostname)
-{
- GError* gerror = 0;
- Glib::ListHandle< Glib::RefPtr<InetAddress> > retvalue = Glib::ListHandle< Glib::RefPtr<InetAddress> >(g_resolver_lookup_by_name(gobj(), hostname.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-Glib::ustring Resolver::lookup_by_address(const Glib::RefPtr<InetAddress>& address)
-{
- GError* gerror = 0;
- Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_resolver_lookup_by_address(gobj(), const_cast<GInetAddress*>(Glib::unwrap(address)), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
-ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain)
-{
- GError* gerror = 0;
- ListHandle_SrvTarget retvalue = ListHandle_SrvTarget(g_resolver_lookup_service(gobj(), service.c_str(), protocol.c_str(), domain.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
-}
-
void
Resolver::lookup_by_name_async(const Glib::ustring& hostname,
const SlotAsyncReady& slot,
_IGNORE(g_resolver_free_addresses)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_name, errthrow)
-
- /** Synchronously resolves hostname to determine its associated IP address(es).
- * @a hostname may be an ASCII-only or UTF-8 hostname, or the textual form of an IP address (in which case this just becomes a wrapper around InetAddress:create_from_string()).
- *
- * On success, this will return a list of InetAddress, sorted in order of preference. (That is, you should attempt to connect to the first address first, then the second if the first fails, etc.)
- *
- * If the DNS resolution fails, a ResolverError exception will be thrown.
- *
- * If you are planning to connect to a socket on the resolved IP address, it may be easier to create a NetworkAddress and use its SocketConnectable base class.
- *
- * @param hostname hostname The hostname to look up.
- */
- Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname);
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_by_name, errthrow)
/** Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls @a slot, which must call
* lookup_by_name_finish() to get the result. See lookup_by_name() for more details.
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_name_finish, errthrow)
- _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_address, errthrow)
-
- /** Synchronously reverse-resolves an address to determine its associated hostname.
- *
- * If the DNS resolution fails then a ResolverError exception will be thrown.
- *
- * @param address The address to reverse-resolve.
- * @result A hostname (either ASCII-only, or in ASCII-encoded form), or an empty string on error.
- */
- Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address);
+ _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_by_address, errthrow)
/** Begins asynchronously reverse-resolving an address to determine its associated hostname, and eventually calls callback, which must call
* lookup_by_address_finish() to get the final result.
_WRAP_METHOD(Glib::ustring lookup_by_address_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_address_finish, errthrow)
#m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_service, errthrow)
+ _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_service, errthrow)
- /** Synchronously performs a DNS SRV lookup for the given service and protocol in the given domain and returns an list of SrvTargets.
- * @a domain may be an ASCII-only or UTF-8 hostname. Note also that the service and protocol arguments do not include the leading underscore that appears in the actual DNS entry.
- *
- * On success, this will return a list of SrvTargets, sorted in order of preference.
- * (That is, you should attempt to connect to the first target first, then the second if the first fails, etc.)
- *
- * If the DNS resolution fails a ResolverError exception will be thrown.
- *
- * If you are planning to connect to the service, it is usually easier to create a NetworkService and use its SocketConnectable base class interface. \
- *
- * @param service The service type to look up (eg, "ldap").
- * @param protocol The networking protocol to use for service (eg, "tcp")
- * @param domain The DNS domain to look up the service in.
- */
- ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain);
-
/** Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback,
* which must call lookup_service_finish() to get the final result. See glookup_service() for more details.
*
namespace Gio
{
-
-bool Seekable::seek(goffset offset, Glib::SeekType type)
-{
- GError* gerror = 0;
- bool retvalue = g_seekable_seek(gobj(), offset, ((GSeekType)(type)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-
-bool Seekable::truncate(goffset offset)
-{
- GError* gerror = 0;
- bool retvalue = g_seekable_truncate(gobj(), offset, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-
} // namespace Gio
_WRAP_METHOD(goffset tell() const, g_seekable_tell)
_WRAP_METHOD(bool can_seek() const, g_seekable_can_seek)
- _WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_seek, errthrow)
+ _WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable{?}), g_seekable_seek, errthrow)
//TODO: Document the exception in the C API: https://bugzilla.gnome.org/show_bug.cgi?id=509990#c1
- /** Seeks in the stream by the given @a offset, modified by @a type .
- *
- * @param offset A #goffset.
- * @param type A Glib::SeekType.
- * @return <tt>true</tt> if successful. If an error
- * has occurred, this function will return <tt>false</tt>.
- */
- bool seek(goffset offset, Glib::SeekType type);
_WRAP_METHOD(bool can_truncate() const, g_seekable_can_truncate)
- _WRAP_METHOD(bool truncate(goffset offset, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_truncate, errthrow)
+ _WRAP_METHOD(bool truncate(goffset offset, const Glib::RefPtr<Cancellable>& cancellable{?}), g_seekable_truncate, errthrow)
//TODO: Document the exception in the C API: https://bugzilla.gnome.org/show_bug.cgi?id=509990#c1
- /** Truncates a stream with a given #offset.
- *
- * @param offset A #goffset.
- * @return <tt>true</tt> if successful. If an error
- * has occured, this function will return <tt>false</tt>.
- */
- bool truncate(goffset offset);
//_WRAP_VFUNC(goffset tell() const, tell)
//_WRAP_VFUNC(goffset can_seek() const, can_seek)
return Glib::RefPtr<Socket>(new Socket(fd, cancellable));
}
-
-void Socket::connect(const Glib::RefPtr<SocketAddress>& address)
-{
- GError* gerror = 0;
- g_socket_connect(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-}
-
-Glib::RefPtr<Socket> Socket::accept()
-{
- GError* gerror = 0;
- Glib::RefPtr<Socket> retvalue = Glib::wrap(g_socket_accept(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gssize Socket::receive(char* buffer, gsize size)
-{
- GError* gerror = 0;
- gssize retvalue = g_socket_receive(gobj(), buffer, size, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gssize Socket::send(const gchar* buffer, gsize size)
-{
- GError* gerror = 0;
- gssize retvalue = g_socket_send(gobj(), buffer, size, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-gssize Socket::send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size)
-{
- GError* gerror = 0;
- gssize retvalue = g_socket_send_to(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), buffer, size, 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-void Socket::condition_wait(Glib::IOCondition condition)
-{
- GError* gerror = 0;
- g_socket_condition_wait(gobj(), ((GIOCondition)(condition)), 0, &(gerror));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-}
-
gssize Socket::receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
//TODO: Write custom documetation, mentioning, for instance, the exception, instead of a bool return.
_WRAP_METHOD(void bind(const Glib::RefPtr<SocketAddress>& address, bool allow_reuse), g_socket_bind, errthrow)
_WRAP_METHOD(void listen(), g_socket_listen, errthrow)
- _WRAP_METHOD(Glib::RefPtr<Socket> accept(const Glib::RefPtr<Cancellable>& cancellable), g_socket_accept, errthrow)
- Glib::RefPtr<Socket> accept();
+ _WRAP_METHOD(Glib::RefPtr<Socket> accept(const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_accept, errthrow)
//TODO: Write custom documetation, mentioning, for instance, the exception, instead of a bool return.
- _WRAP_METHOD(void connect(const Glib::RefPtr<SocketAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_socket_connect, errthrow)
- void connect(const Glib::RefPtr<SocketAddress>& address);
+ _WRAP_METHOD(void connect(const Glib::RefPtr<SocketAddress>& address, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_connect, errthrow)
// FIXME: it doesn't really seem like this is a proper use of exceptions...
_WRAP_METHOD(void check_connect_result(), g_socket_check_connect_result, errthrow)
// TODO: std::string overload?
- _WRAP_METHOD(gssize receive(char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_receive, errthrow)
- gssize receive(char* buffer, gsize size);
+ _WRAP_METHOD(gssize receive(char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_receive, errthrow)
_IGNORE(g_socket_receive_from)
gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable);
// TODO: wrap g_socket_receive_message -- figure out this GInputVector thing
// TODO: std::string overload?
- _WRAP_METHOD(gssize send(const gchar* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send, errthrow)
- gssize send(const gchar* buffer, gsize size);
+ _WRAP_METHOD(gssize send(const gchar* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_send, errthrow)
// TODO: std::string overload?
- _WRAP_METHOD(gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send_to, errthrow)
- gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size);
+ _WRAP_METHOD(gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_send_to, errthrow)
// TODO: wrap g_socket_send_message -- figure out this GOutputVector thing
_WRAP_METHOD(void close(), g_socket_close, errthrow)
// This won't work because Glib::Source is abstract, and Glib::IOSource has no
// constructor that takes a GSource*
//#m4 _CONVERSION(`GSource*',`Glib::RefPtr<Glib::Source>',`Glib::RefPtr<Glib::Source>(new ::Glib::Source($3))')
- //_WRAP_METHOD(Glib::RefPtr<Glib::Source> create_source(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable), g_socket_create_source)
+ //_WRAP_METHOD(Glib::RefPtr<Glib::Source> create_source(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_create_source)
_WRAP_METHOD(gssize get_available_bytes() const, g_socket_get_available_bytes)
_WRAP_METHOD(Glib::IOCondition condition_check(Glib::IOCondition condition), g_socket_condition_check)
- _WRAP_METHOD(void condition_wait(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable), g_socket_condition_wait, errthrow)
-
- //TODO: Documentation.
- void condition_wait(Glib::IOCondition condition);
+ _WRAP_METHOD(void condition_wait(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_condition_wait, errthrow)
_WRAP_METHOD(void condition_timed_wait(Glib::IOCondition condition, gint64 timeout, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_condition_timed_wait, errthrow)
slot_copy);
}
- Glib::RefPtr<SocketAddress>
- SocketAddressEnumerator::next()
- {
- GError* gerror = 0;
- Glib::RefPtr<SocketAddress> retvalue = Glib::wrap(g_socket_address_enumerator_next(gobj(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-
- }
} // namespace Gio
_CLASS_GOBJECT(SocketAddressEnumerator, GSocketAddressEnumerator, G_SOCKET_ADDRESS_ENUMERATOR, Glib::Object, GObject)
public:
- _WRAP_METHOD(Glib::RefPtr<SocketAddress> next(const Glib::RefPtr<Cancellable>& cancellable), g_socket_address_enumerator_next, errthrow)
-
- /** Retrieves the next SocketAddress from the enumerator.
- * Note that this may block for some amount of time. (Eg, a NetworkAddress may need to do a DNS lookup before it can return an address.)
- * Use next_async() if you need to avoid blocking.
- *
- * If this enumerator is expected to yield addresses, but for some reason is unable to (eg, because of a DNS error),
- * then the first call to next() will throw an exception. However, if the first call to next() succeeds, then any further internal errors
- * will be ignored.
- *
- * When there are no further addresses, an exception will be thrown.
- *
- * @result A SocketAddress
- */
- Glib::RefPtr<SocketAddress> next();
+ _WRAP_METHOD(Glib::RefPtr<SocketAddress> next(const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_address_enumerator_next, errthrow)
/** Asynchronously retrieves the next SocketAddress from the enumerator and then calls @a slot,
* which must call next_finish() to get the result.
slot_copy);
}
-Glib::RefPtr<SocketConnection> SocketClient::connect(const Glib::RefPtr<SocketConnectable>& connectable)
-{
- GError* gerror = 0;
- Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect(gobj(), const_cast<GSocketConnectable*>(Glib::unwrap(connectable)), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<SocketConnection> SocketClient::connect_to_host(const Glib::ustring& host_and_port, guint16 default_port)
-{
- GError* gerror = 0;
- Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_host(gobj(), host_and_port.c_str(), default_port, 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<SocketConnection> SocketClient::connect_to_service(const Glib::ustring& domain, const Glib::ustring& service)
-{
- GError* gerror = 0;
- Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_service(gobj(), domain.c_str(), service.c_str(), 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
-Glib::RefPtr<SocketConnection> SocketClient::connect_to_uri(const Glib::ustring& uri, guint16 default_port)
-{
- GError* gerror = 0;
- Glib::RefPtr<SocketConnection> retvalue = Glib::wrap(g_socket_client_connect_to_uri(gobj(), uri.c_str(), default_port, 0, &(gerror)));
- if(gerror)
- ::Glib::Error::throw_exception(gerror);
-
- return retvalue;
-}
-
void
SocketClient::connect_to_uri_async(const Glib::ustring& uri, guint16 default_port,
const Glib::RefPtr<Cancellable>& cancellable,
_WRAP_METHOD(Glib::RefPtr<const SocketAddress> get_local_address() const, g_socket_client_get_local_address, constversion)
_WRAP_METHOD(void set_local_address(const Glib::RefPtr<SocketAddress>& address), g_socket_client_set_local_address)
- _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect, errthrow)
-Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable);
+ _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_client_connect, errthrow)
- _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_host, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_client_connect_to_host, errthrow)
- /** This is a helper function for connect().
- * This attempts to create a TCP connection to the named host.
- *
- * @a host_and_port may be in any of a number of recognised formats; an IPv6 address, an IPv4 address, or a domain name (in which case a DNS lookup is performed). Quoting with [] is supported for all address types. A port override may be specified in the usual way with a colon. Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).
- *
- * If no port override is given in @a host_and_port then default_port will be used as the port number to connect to.
- *
- * In general, @a host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port overide if necessary) and default_port is expected to be provided by the application.
- *
- * In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.
- *
- * Upon a successful connection, a new SocketConnection is constructed and returned.
- *
- * In the event of any failure (DNS error, service not found, no hosts connectable) an exception is thrown.
- *
- * @param host_and_port The name and optionally port of the host to connect to.
- * @param default_port The default port to connect to.
- */
- Glib::RefPtr<SocketConnection> connect_to_host(const Glib::ustring& host_and_port, guint16 default_port);
-
- _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_service, errthrow)
-Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service);
+ _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_service(const Glib::ustring& domain, const Glib::ustring& service, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_client_connect_to_service, errthrow)
- _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_uri(const Glib::ustring& uri, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable), g_socket_client_connect_to_uri, errthrow)
-
- /** This is a helper function for connect().
- * This attempts to create a TCP connection with a network URI.
- *
- * @a uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI, default_port will be used. TLS will be negotiated if "tls" is true. (GSocketClient does not know to automatically assume TLS for certain URI schemes.)
- *
- * Using this rather than connect() or connect_to_host() allows SocketClient to determine when to use application-specific proxy protocols.
- *
- * Upon a successful connection, a new SocketConnection is constructed and returned.
- *
- * In the event of any failure (DNS error, service not found, no hosts connectable) an exception is thrown.
- *
- * @param uri A network URI
- * @param default_port The default port to connect to.
- */
- Glib::RefPtr<SocketConnection> connect_to_uri(const Glib::ustring& uri, guint16 default_port);
+ _WRAP_METHOD(Glib::RefPtr<SocketConnection> connect_to_uri(const Glib::ustring& uri, guint16 default_port, const Glib::RefPtr<Cancellable>& cancellable{?}), g_socket_client_connect_to_uri, errthrow)
_WRAP_METHOD_DOCS_ONLY(g_socket_client_connect_async)
void connect_async(const Glib::RefPtr<SocketConnectable>& connectable, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
_GTKMMPROC_WIN32_NO_WRAP
public:
- _WRAP_METHOD(bool send_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_send_fd, errthrow)
- _WRAP_METHOD(int receive_fd(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_receive_fd, errthrow)
+ _WRAP_METHOD(bool send_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable{?}), g_unix_connection_send_fd, errthrow)
+ _WRAP_METHOD(int receive_fd(const Glib::RefPtr<Cancellable>& cancellable{?}), g_unix_connection_receive_fd, errthrow)
- _WRAP_METHOD(Glib::RefPtr<Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_receive_credentials, errthrow)
- _WRAP_METHOD(Glib::RefPtr<const Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable) const, g_unix_connection_receive_credentials, errthrow, constversion)
- _WRAP_METHOD(bool send_credentials(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_send_credentials, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable{?}), g_unix_connection_receive_credentials, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<const Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable{?}) const, g_unix_connection_receive_credentials, errthrow, constversion)
+ _WRAP_METHOD(bool send_credentials(const Glib::RefPtr<Cancellable>& cancellable{?}), g_unix_connection_send_credentials, errthrow)
};
} // namespace Gio
/* Count the number of elements in a 0-terminated sequence.
*/
template <class T> inline
-size_t compute_array_size(const T* array)
+std::size_t compute_array_size(const T* array)
{
const T* pend = array;
* specifies the number of elements in the input sequence.
*/
template <class For, class Tr>
-typename Tr::CType* create_array(For pbegin, size_t size, Tr)
+typename Tr::CType* create_array(For pbegin, std::size_t size, Tr)
{
typedef typename Tr::CType CType;
}
template <class For>
-gboolean* create_bool_array(For pbegin, size_t size)
+gboolean* create_bool_array(For pbegin, std::size_t size)
{
gboolean *const array(static_cast<gboolean*>(g_malloc((size + 1) * sizeof(gboolean))));
gboolean *const array_end(array + size);
{
typedef typename Tr::CType CType;
- static size_t get_size(const Cont& cont)
+ static std::size_t get_size(const Cont& cont)
{ return cont.size(); }
- static const CType* get_data(const Cont& cont, size_t size)
+ static const CType* get_data(const Cont& cont, std::size_t size)
{ return Glib::Container_Helpers::create_array(cont.begin(), size, Tr()); }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
{
typedef gboolean CType;
- static size_t get_size(const Cont& cont)
+ static std::size_t get_size(const Cont& cont)
{ return cont.size(); }
- static const CType* get_data(const Cont& cont, size_t size)
+ static const CType* get_data(const Cont& cont, std::size_t size)
{ return Glib::Container_Helpers::create_bool_array(cont.begin(), size); }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
{
typedef typename Tr::CType CType;
- static size_t get_size(const CType* array)
+ static std::size_t get_size(const CType* array)
{ return (array) ? Glib::Container_Helpers::compute_array_size(array) : 0; }
- static const CType* get_data(const CType* array, size_t)
+ static const CType* get_data(const CType* array, std::size_t)
{ return array; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
* For consistency, the array must be 0-terminated, even though the array
* size is known at compile time.
*/
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct ArraySourceTraits<Tr,Cont[N]>
{
typedef typename Tr::CType CType;
- static size_t get_size(const CType*)
+ static std::size_t get_size(const CType*)
{ return (N - 1); }
- static const CType* get_data(const CType* array, size_t)
+ static const CType* get_data(const CType* array, std::size_t)
{ return array; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
};
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct ArraySourceTraits<Tr,const Cont[N]> : ArraySourceTraits<Tr,Cont[N]>
{};
typedef std::random_access_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
typedef typename Tr::CType CType;
typedef CppType value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef Glib::Container_Helpers::ArrayHandleIterator<Tr> const_iterator;
typedef Glib::Container_Helpers::ArrayHandleIterator<Tr> iterator;
ArrayHandle(const Cont& container);
// Take over ownership of an array created by GTK+ functions.
- inline ArrayHandle(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayHandle(const CType* array, Glib::OwnershipType ownership);
// Copying clears the ownership flag of the source handle.
void copy(Out pdest) const;
inline const CType* data() const;
- inline size_t size() const;
+ inline std::size_t size() const;
inline bool empty() const;
private:
- size_t size_;
+ std::size_t size_;
const CType* parray_;
mutable Glib::OwnershipType ownership_;
typedef Tr::CType CType;
typedef CppType value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef Glib::Container_Helpers::ArrayHandleIterator<Tr> const_iterator;
typedef Glib::Container_Helpers::ArrayHandleIterator<Tr> iterator;
ArrayHandle(const Cont& container);
// Take over ownership of an array created by GTK+ functions.
- inline ArrayHandle(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayHandle(const CType* array, Glib::OwnershipType ownership);
// Copying clears the ownership flag of the source handle.
void copy(Out pdest) const;
inline const CType* data() const;
- inline size_t size() const;
+ inline std::size_t size() const;
inline bool empty() const;
private:
- size_t size_;
+ std::size_t size_;
const CType* parray_;
mutable Glib::OwnershipType ownership_;
{}
template <class T, class Tr> inline
-ArrayHandle<T,Tr>::ArrayHandle(const typename ArrayHandle<T,Tr>::CType* array, size_t array_size,
+ArrayHandle<T,Tr>::ArrayHandle(const typename ArrayHandle<T,Tr>::CType* array, std::size_t array_size,
Glib::OwnershipType ownership)
:
size_ ((array) ? array_size : 0),
}
template <class T, class Tr> inline
-size_t ArrayHandle<T,Tr>::size() const
+std::size_t ArrayHandle<T,Tr>::size() const
{
return size_;
}
{}
inline
-ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::ArrayHandle(const gboolean* array, size_t array_size,
+ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::ArrayHandle(const gboolean* array, std::size_t array_size,
Glib::OwnershipType ownership)
:
size_ ((array) ? array_size : 0),
}
inline
-size_t ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::size() const
+std::size_t ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::size() const
{
return size_;
}
Iterator begin() const { return pbegin_; }
Iterator end() const { return pend_; }
- size_t size() const { return std::distance(pbegin_, pend_); }
+ std::size_t size() const { return std::distance(pbegin_, pend_); }
};
/** Helper function to create a Glib::Sequence<> object, which
#include <glibmm/sarray.h> /* for backward compatibility */
#include <glib.h>
#include <iterator>
+#include <cstddef>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef typename List_Iterator_Base<T>::pointer pointer;
typedef typename List_Iterator_Base<T>::reference reference;
{
public:
typedef std::forward_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef typename List_Iterator_Base<T>::pointer pointer;
typedef typename List_Iterator_Base<T>::reference reference;
{
public:
typedef std::bidirectional_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef typename List_Iterator_Base<T_IFace>::pointer pointer;
typedef typename List_Iterator_Base<T_IFace>::reference reference;
typedef T_CppElement element_type;
- typedef size_t difference_type;
- typedef size_t size_type;
+ typedef std::size_t difference_type; //TODO Why not std::ptrdiff_t?
+ typedef std::size_t size_type;
//These are implemented differently for each Helper List.
virtual iterator erase(iterator) = 0;
* to the first element. For consistency, the array must be 0-terminated,
* even though the array size is known at compile time.
*/
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct ListSourceTraits<Tr,Cont[N]>
{
static GList* get_data(const Cont* array)
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct ListSourceTraits<Tr,const Cont[N]> : ListSourceTraits<Tr,Cont[N]>
{};
typedef std::forward_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
typedef typename Tr::CType CType;
typedef CppType value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef Glib::Container_Helpers::ListHandleIterator<Tr> const_iterator;
typedef Glib::Container_Helpers::ListHandleIterator<Tr> iterator;
void copy(Out pdest) const;
inline GList* data() const;
- inline size_t size() const;
+ inline std::size_t size() const;
inline bool empty() const;
private:
}
template <class T, class Tr> inline
-size_t ListHandle<T,Tr>::size() const
+std::size_t ListHandle<T,Tr>::size() const
{
return g_list_length(plist_);
}
#include <glibmm/iochannel.h>
#include <sigc++/sigc++.h>
#include <vector>
+#include <cstddef>
namespace Glib
{
private:
// Glib::MainContext can neither be constructed nor deleted.
MainContext();
- void operator delete(void*, size_t);
+ void operator delete(void*, std::size_t);
// noncopyable
MainContext(const MainContext& other);
private:
// Glib::MainLoop can neither be constructed nor deleted.
MainLoop();
- void operator delete(void*, size_t);
+ void operator delete(void*, std::size_t);
MainLoop(const MainLoop&);
MainLoop& operator=(const MainLoop&);
void *const base_ptr = dynamic_cast<void*>(&object);
void *const prop_ptr = &property;
- const ptrdiff_t offset = static_cast<guint8*>(prop_ptr) - static_cast<guint8*>(base_ptr);
+ const std::ptrdiff_t offset = static_cast<guint8*>(prop_ptr) - static_cast<guint8*>(base_ptr);
g_return_val_if_fail(offset > 0 && offset < G_MAXINT, 0);
* to the first element. For consistency, the array must be 0-terminated,
* even though the array size is known at compile time.
*/
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct SListSourceTraits<Tr,Cont[N]>
{
static GSList* get_data(const Cont* array)
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
-template <class Tr, class Cont, size_t N>
+template <class Tr, class Cont, std::size_t N>
struct SListSourceTraits<Tr,const Cont[N]> : SListSourceTraits<Tr,Cont[N]>
{};
typedef std::forward_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
typedef typename Tr::CType CType;
typedef CppType value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef Glib::Container_Helpers::SListHandleIterator<Tr> const_iterator;
typedef Glib::Container_Helpers::SListHandleIterator<Tr> iterator;
void copy(Out pdest) const;
inline GSList* data() const;
- inline size_t size() const;
+ inline std::size_t size() const;
inline bool empty() const;
private:
}
template <class T, class Tr> inline
-size_t SListHandle<T,Tr>::size() const
+std::size_t SListHandle<T,Tr>::size() const
{
return g_slist_length(pslist_);
}
#include <sstream>
#include <string>
#ifndef GLIBMM_HAVE_STD_ITERATOR_TRAITS
-#include <cstddef> /* for ptrdiff_t */
+#include <cstddef> /* for std::ptrdiff_t */
#endif
namespace Glib
{
typedef std::random_access_iterator_tag iterator_category;
typedef T value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef T* pointer;
typedef T& reference;
};
{
typedef std::random_access_iterator_tag iterator_category;
typedef T value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef const T* pointer;
typedef const T& reference;
};
namespace Container_Helpers
{
-gboolean* create_bool_array(std::vector<bool>::const_iterator pbegin, size_t size)
+gboolean* create_bool_array(std::vector<bool>::const_iterator pbegin, std::size_t size)
{
gboolean *const array(static_cast<gboolean*>(g_malloc((size + 1) * sizeof(gboolean))));
gboolean *const array_end(array + size);
/**** Glib::ArrayHandler<bool> ************************/
ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::VectorType
-ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership)
+ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector(const CType* array, std::size_t array_size, Glib::OwnershipType ownership)
{
if(array)
{
#include <vector>
#include <glibmmconfig.h>
#include <glibmm/containerhandle_shared.h>
+#include <cstddef>
/* There are three types of functions:
* 1. Returning a container.
/* Count the number of elements in a 0-terminated sequence.
*/
template <class T> inline
-size_t compute_array_size2(const T* array)
+std::size_t compute_array_size2(const T* array)
{
if(array)
{
* specifies the number of elements in the input sequence.
*/
template <class Tr>
-typename Tr::CType* create_array(typename std::vector<typename Tr::CppType>::const_iterator pbegin, size_t size)
+typename Tr::CType* create_array(typename std::vector<typename Tr::CppType>::const_iterator pbegin, std::size_t size)
{
typedef typename Tr::CType CType;
* which does not conform to being an STL container.
*/
gboolean* create_bool_array(std::vector<bool>::const_iterator pbegin,
- size_t size);
+ std::size_t size);
/* Create and fill a GList as efficient as possible.
* This requires bidirectional iterators.
typedef std::random_access_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
typedef std::forward_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
typedef std::forward_iterator_tag iterator_category;
typedef CppType value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type reference;
typedef void pointer;
* @param array_size - length of @a array.
* @param ownership - ownership definition.
*/
- explicit inline ArrayKeeper(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ explicit inline ArrayKeeper(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayKeeper(const ArrayKeeper& keeper);
~ArrayKeeper();
private:
CType* array_;
- size_t array_size_;
+ std::size_t array_size_;
mutable Glib::OwnershipType ownership_;
};
typedef typename Glib::Container_Helpers::ArrayIterator<Tr> ArrayIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ static VectorType array_to_vector(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
static VectorType array_to_vector(const CType* array, Glib::OwnershipType ownership);
static ArrayKeeperType vector_to_array(const VectorType& vector);
};
typedef Glib::Container_Helpers::ArrayIterator<Glib::Container_Helpers::TypeTraits<bool> > ArrayIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ static VectorType array_to_vector(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
static VectorType array_to_vector(const CType* array, Glib::OwnershipType ownership);
static ArrayKeeperType vector_to_array(const VectorType& vector);
};
/**** Glib::Container_Helpers::ArrayKeeper<> ************************/
template <typename Tr>
-inline ArrayKeeper<Tr>::ArrayKeeper(const CType* array, size_t array_size, Glib::OwnershipType ownership)
+inline ArrayKeeper<Tr>::ArrayKeeper(const CType* array, std::size_t array_size, Glib::OwnershipType ownership)
:
array_(const_cast<CType*>(array)),
array_size_(array_size),
template <typename T, class Tr>
typename ArrayHandler<T, Tr>::VectorType
-ArrayHandler<T, Tr>::array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership)
+ArrayHandler<T, Tr>::array_to_vector(const CType* array, std::size_t array_size, Glib::OwnershipType ownership)
{
if (array)
{
-/* $Id$ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id$ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
// -*- c++ -*-
-/* $Id: convert.ccg,v 1.4 2006/06/05 17:32:14 murrayc Exp $ */
/* Copyright (C) 2002 The gtkmm Development Team
*
-/* $Id: convert.hg,v 1.5 2006/05/12 08:08:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* @throw Glib::ConvertError
*/
IConv(const std::string& to_codeset, const std::string& from_codeset);
+ _IGNORE(g_iconv_open)
explicit IConv(GIConv gobject);
/** Close conversion descriptor.
*/
~IConv();
+ _IGNORE(g_iconv_close)
/** Same as the standard UNIX routine %iconv(), but may be implemented
* via libiconv on UNIX flavors that lack a native implementation. glibmm
* @param inbytes_left In/out parameter, bytes remaining to convert in @a inbuf.
* @param outbuf Converted output bytes.
* @param outbytes_left In/out parameter, bytes available to fill in @a outbuf.
- * @return Count of non-reversible conversions, or <tt>static_cast<size_t>(-1)</tt> on error.
+ * @return Count of non-reversible conversions, or <tt>static_cast<std::size_t>(-1)</tt> on error.
*/
std::size_t iconv(char** inbuf, gsize* inbytes_left, char** outbuf, gsize* outbytes_left);
_IGNORE(g_iconv)
-// -*- c++ -*-
-/* $Id: date.ccg,v 1.7 2006/07/16 13:54:02 jjongsma Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
//#include <glib/gmessages.h> //For g_assert() in glib < 2.15.0
#include <glib.h> //For g_assert() in all versions of glib.
-#include <ctime>
#include <algorithm>
#include <glibmm/convert.h>
_DEPRECATE_IFDEF_START
-//Avoid a build problem in the case that time_t is equivalent to guint32 (GTime is also guint32)
+//Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32)
//That would make the set_time() method overload impossible.
#ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
void Date::set_time(GTime time)
{
- //This method, and the C function that it wraps, are deprecated.
+ //This method, and the C function g_date_set_time() that it wraps, are deprecated.
+ //(::time_t is used here instead of std::time_t, since the C function is declared
+ //with ::time_t. It's not important. The C++ standard requires that ::time_t
+ //and std::time_t shall be identical when both are defined.)
g_date_set_time_t(&gobject_, static_cast<time_t>(time));
}
#endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
_DEPRECATE_IFDEF_END
-void Date::set_time(time_t timet)
+void Date::set_time(std::time_t timet)
{
g_date_set_time_t(&gobject_, timet);
}
-/* $Id: date.hg,v 1.6 2005/11/29 15:53:27 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
#include <glibmmconfig.h>
#include <glibmm/ustring.h>
#include <glib.h>
+#include <ctime>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { struct tm; }
_DEPRECATE_IFDEF_START
- //Avoid a build problem in the case that time_t is equivalent to guint32 (GTime is also guint32)
+ //Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32)
//That would make the set_time() method overload impossible.
#ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
- /** Sets the value of a date from a GTime (time_t) value.
+ /** Sets the value of a date from a GTime value.
*
* @param time GTime value to set.
*
- * @deprecated Please use set_time(time_t) or set_time(const GTimeVal&).
+ * @deprecated Please use set_time(std::time_t) or set_time(const GTimeVal&).
*/
void set_time(GTime time);
#endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
_DEPRECATE_IFDEF_END
- /** Sets the value of a date from a <type>time_t</type> value.
+ /** Sets the value of a date from a <type>std::time_t</type> value.
*
- * @param timet time_t value to set
+ * @param timet std::time_t value to set
*
* @see set_time_current()
*
* Since: 2.10
*/
- void set_time(time_t timet);
+ void set_time(std::time_t timet);
/** Sets the value of a date from a GTimeVal value. Note that the
* tv_usec member is ignored, because Glib::Date can't make use of the
inline bool operator>=(const Date& lhs, const Date& rhs)
{ return (lhs.compare(rhs) >= 0); }
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: fileutils.ccg,v 1.1 2003/01/07 16:58:25 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: fileutils.hg,v 1.3 2004/01/22 18:38:12 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* */
void file_set_contents (const std::string& filename, const std::string& contents);
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
<function name="g_ptr_array_ref">
<description>
-Atomically increments the reference count of @array by one. This
-function is MT-safe and may be called from any thread.
+Atomically increments the reference count of @array by one.
+This function is thread-safe and may be called from any thread.
Since: 2.22
</description>
<parameters>
<parameter name="array">
-<parameter_description> A #GArray.
+<parameter_description> a #GPtrArray
</parameter_description>
</parameter>
</parameters>
-<return> The passed in #GPtrArray.
+<return> The passed in #GPtrArray
</return>
</function>
</parameter_description>
</parameter>
<parameter name="func">
-<parameter_description> the function to call for each node visited. If this function
-returns %TRUE, the traversal is stopped.
+<parameter_description> the function to call for each node visited.
+If this function returns %TRUE, the traversal is stopped.
</parameter_description>
</parameter>
<parameter name="user_data">
(such as the various fundamental type implementations or the signal
system).
-This function is idempotent.
+This function is idempotent: If you call it multiple times, all but
+the first calls will be silently ignored.
+
+There is no way to undo the effect of g_type_init().
Since version 2.24 this also initializes the thread system
(c-name "g_datalist_id_dup_data")
(return-type "gpointer")
(parameters
- '("GData**" "data")
+ '("GData**" "datalist")
'("GQuark" "key_id")
'("GDuplicateFunc" "dup_func")
'("gpointer" "user_data")
(c-name "g_datalist_id_replace_data")
(return-type "gboolean")
(parameters
- '("GData**" "data")
+ '("GData**" "datalist")
'("GQuark" "key_id")
'("gpointer" "oldval")
'("gpointer" "newval")
(return-type "GType")
)
+(define-function g_time_zone_get_type
+ (c-name "g_time_zone_get_type")
+ (return-type "GType")
+)
+
(define-function g_io_channel_get_type
(c-name "g_io_channel_get_type")
(return-type "GType")
-// -*- c++ -*-
-/* $Id: iochannel.ccg,v 1.6 2006/10/04 12:04:09 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-// -*- c++ -*-
-/* $Id: iochannel.hg,v 1.8 2006/05/12 08:08:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-// -*- c++ -*-
-/* $Id: markup.ccg,v 1.5 2006/10/04 12:04:09 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: markup.hg,v 1.5 2005/01/21 12:48:05 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
} // namespace Markup
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: module.ccg,v 1.2 2004/04/09 14:49:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: module.hg,v 1.5 2004/04/09 14:49:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-// -*- c++ -*-
-/* $Id: optioncontext.ccg,v 1.4 2004/10/30 14:25:45 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: optioncontext.hg,v 1.6 2005/01/10 17:42:17 murrayc Exp $ */
-
/* Copyright (C) 2004 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
-// -*- c++ -*-
-/* $Id: optionentry.ccg,v 1.8 2006/03/08 12:23:03 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: optionentry.hg,v 1.11 2005/07/31 13:11:05 murrayc Exp $ */
-
/* Copyright (C) 2004 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
GOptionEntry* gobject_;
};
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: optiongroup.ccg,v 1.15.4.3 2006/03/30 12:19:58 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: optiongroup.hg,v 1.10.4.1 2006/03/30 12:19:58 murrayc Exp $ */
-
/* Copyright (C) 2004 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
class MatchInfo
{
_CLASS_GENERIC(MatchInfo, GMatchInfo)
+ _IGNORE(g_match_info_ref, g_match_info_unref, g_match_info_free)
public:
/// Default constructor.
-// -*- c++ -*-
-/* $Id: shell.ccg,v 1.1 2003/01/07 16:58:38 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: shell.hg,v 1.2 2003/01/22 21:38:35 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
/** @} group ShellUtils */
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: spawn.ccg,v 1.8 2006/05/12 08:08:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: spawn.hg,v 1.4 2004/03/02 23:29:57 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
/** @} group Spawn */
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: thread.ccg,v 1.9 2006/05/12 08:08:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: thread.ccg,v 1.9 2006/05/12 08:08:44 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} //namespace Threads
} // namespace Glib
-// -*- c++ -*-
-/* $Id: unicode.ccg,v 1.1 2003/01/07 16:58:42 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: unicode.hg,v 1.2 2003/08/20 10:31:23 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
/** @} group Unicode */
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-// -*- c++ -*-
-/* $Id: fileutils.ccg,v 1.1 2003/01/07 16:58:25 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id: fileutils.hg,v 1.3 2004/01/22 18:38:12 murrayc Exp $ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
*/
std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed = std::string(), bool allow_utf8 = true);
-// For some reason gmmproc thinks that g_iconv should be wrapped here.
-_IGNORE(g_iconv)
-
} // namespace Glib
-/* $Id$ */
-
/* Copyright (C) 2002-2009 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
-/* $Id$ */
-
/* Copyright (C) 2002-2009 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
class VariantIter
{
_CLASS_OPAQUE_COPYABLE(VariantIter, GVariantIter, NONE, g_variant_iter_copy, g_variant_iter_free)
+ _IGNORE(g_variant_iter_copy, g_variant_iter_free)
public:
explicit VariantIter(const VariantBase& variant);
- _IGNORE(g_variant_iter_new)
+ dnl // Don't _IGNORE(g_variant_iter_new). It's listed in glib_functions.defs as
+ dnl // a method of GVariant. Ignoring it would make gmmproc think that this
+ dnl // file wraps GVariant, and it would list all GVariant methods as unwrapped.
_WRAP_METHOD(gsize get_n_children() const, g_variant_iter_n_children)
<< get_defs(G_TYPE_BUFFERED_INPUT_STREAM)
<< get_defs(G_TYPE_BUFFERED_OUTPUT_STREAM)
<< get_defs(G_TYPE_CHARSET_CONVERTER)
+ << get_defs(G_TYPE_CONVERTER_INPUT_STREAM)
+ << get_defs(G_TYPE_CONVERTER_OUTPUT_STREAM)
<< get_defs(G_TYPE_DATA_INPUT_STREAM)
<< get_defs(G_TYPE_DATA_OUTPUT_STREAM)
<< get_defs(G_TYPE_DRIVE)
my %deprecated = ();
my %extra_includes = ();
+# Hashmap telling if the registration of the classes in a file should not be
+# included in the wrap_init() function. (This is useful for modules such as
+# gstreamermm that want to exclude plug-in types from being registered in their
+# wrap_init() function.)
+my %exclude_from_wrap_init = ();
+
# The keys in all hashes except %extra_includes are names of header files (xyz.h),
# corresponding to the read .hg files.
#
{
$deprecated{$filename_header} = 1; # This file is deprecated
}
+ elsif (/\b_NO_WRAP_INIT_REGISTRATION\b/)
+ {
+ $exclude_from_wrap_init{$filename_header} = 1;
+ }
}
shift @ARGV;
# keys %deprecated contains all filenames, not just the names of deprecated files.
foreach my $filename_header (sort keys %deprecated)
{
+ next if($exclude_from_wrap_init{$filename_header});
print_with_guards($filename_header, "#include \"$filename_header\"\n");
}
foreach my $filename_header (sort keys %objects)
{
+ next if($exclude_from_wrap_init{$filename_header});
+
my @objects_in_file = @{$objects{$filename_header}};
my $message = "";
foreach my $i (@objects_in_file)
foreach my $filename_header (sort keys %objects)
{
+ next if($exclude_from_wrap_init{$filename_header});
+
my @objects_in_file = @{$objects{$filename_header}};
my $message = "";
foreach my $i (@objects_in_file)
foreach my $filename_header (sort keys %objects)
{
+ next if($exclude_from_wrap_init{$filename_header});
+
my @objects_in_file = @{$objects{$filename_header}};
my $message = "";
foreach my $i (@objects_in_file)
foreach my $filename_header (sort keys %objects)
{
+ next if($exclude_from_wrap_init{$filename_header});
+
my @objects_in_file = @{$objects{$filename_header}};
my $message = "";
foreach my $i (@objects_in_file)
EOF
exit 0;
-
dnl _POP()
dnl ')
+dnl In case a class needs to write its own implementation of its Glib::wrap()
+dnl function. The function will be declared in the header, but the body is not
+dnl generated.
+define(`_CUSTOM_WRAP_FUNCTION',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_CUSTOM_WRAP_FUNCTION__',`$1')
+_POP()
+')
+
dnl Some gobjects actually derive from GInitiallyUnowned, which does some odd reference-counting that is useful to C coders.
dnl We don't want to expose that base class in our API,
dnl but we do want to reverse what it does:
_SECTION(SECTION_SRC_GENERATED)
+ifdef(`__BOOL_CUSTOM_WRAP_FUNCTION__',`dnl
+',`dnl else
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
} /* namespace Glib */
')dnl endif
+')dnl endif
_H_VFUNCS_AND_SIGNALS()
')
-
_POP()
')
+dnl _NO_WRAP_INIT_REGISTRATION
+dnl Used to tag the classes in a file as one not be registered by the
+dnl wrap_init() function (all the classes in the file will not be registered).
+dnl This macro does not generate any code in the .h and .cc files.
+dnl generate_wrap_init.pl will look for this in the original .hg file.
+dnl
+define(`_NO_WRAP_INIT_REGISTRATION',`')dnl
# Functions for populating initialization tables.
#
define(`_INITIALIZATION',`
-m4_ifelse(`$3',,,`define(IN`'__HASH2(`$1',`$2'),`$3')')
+m4_ifelse(`$3',,,`define(IN`'__HASH2(`$1',`$2'),m4_patsubst(`$3',`; +',`;
+ '))')
')
define(`_EQUAL',`define(EV`'__HASH(`$1'),`$2')')
_CONV_ENUM(G,CredentialsType)
_CONV_ENUM(G,DataStreamByteOrder)
_CONV_ENUM(G,DataStreamNewlineType)
+_CONV_ENUM(GDBus,CallFlags)
_CONV_ENUM(GDBus,CapabilityFlags)
_CONV_ENUM(GDBus,MessageFlags)
_CONV_ENUM(GDBus,MessageHeaderField)
_CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)')
_CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3)')
+# Converter
+_CONVERSION(`const Glib::RefPtr<Converter>&',`GConverter*',`Glib::unwrap($3)')
+_CONVERSION(`GConverter*',`Glib::RefPtr<Converter>',`Glib::wrap($3)')
+
# Credentials
_CONVERSION(`const Glib::RefPtr<Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials))
_CONVERSION(`const Glib::RefPtr<const Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials))
#VariantType
_CONVERSION(`const GVariantType*',`Glib::VariantType',`Glib::wrap(const_cast<GVariantType*>($3), false)')
+_CONVERSION(`const Glib::VariantType&',`const GVariantType*',`$3.gobj()')
#Volume
_CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)')
dnl
-dnl method
-dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16
-dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const,refreturn,errthrow,deprecated,constversion,ifdef,arglist_without_types,out_param,out_param_cpptype,wrap_line)
+dnl method
+dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18
+dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,const,refreturn,errthrow,deprecated,constversion,ifdef,arglist_without_types,out_param,out_param_cpptype,wrap_line)
define(`_METHOD',`dnl
_PUSH(SECTION_CC)
-ifelse(`$10',,,`_DEPRECATE_IFDEF_START
+ifelse(`$12',,,`_DEPRECATE_IFDEF_START
')dnl
-ifelse(`$13',,,`#ifdef $13'
+ifelse(`$15',,,`#ifdef $15'
)dnl
-$3 __CPPNAME__::$1`'($5)ifelse(`$7',1,` const')
+$3 __CPPNAME__::$1`'($5)ifelse(`$9',1,` const')
{
-ifelse(`$11',,dnl
-`ifelse(`$8'`$9',,dnl If it is not errthrow or refreturn
-`ifelse(`$14',,dnl If no output parameter is specified
-`ifelse(`$3',void,dnl If it returns voids:
-` $2(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6);' dnl It it returns non-void:
-,` return _CONVERT($4,`$3',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
-)'dnl End if it returns voids.
-dnl An output parameter is specified:
-,` _INITIALIZE($15,$4,`$14',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)',$16);'dnl
-)',dnl End if an output parameter is specified.
+ifelse(`$13',,dnl
+`ifelse(`$10'`$11',,dnl If it is not errthrow or refreturn
+dnl Insert the declarations for C output parameters
+`ifelse(`$6',,,`$6
+')`'dnl
+ifelse(`$16',,dnl If no C++ output parameter is specified
+`ifelse(`$3',void,dnl If the C function returns voids:
+` $2(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7);dnl
+dnl Insert the initializations for the C output parameters
+ifelse(`$8',,,`$8
+')dnl
+'dnl If the C function returns non-void:
+,dnl Insert the declarations for C output parameters
+dnl Store the return if there are C output parameters.
+`ifelse(`$6',,` return ',` `$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)');dnl
+dnl Insert the initializations for the C output parameters
+ifelse(`$8',,,`$8
+')dnl
+dnl return the value
+ifelse(`$6',,,` return retvalue;
+')dnl
+')'dnl End if it returns voids.
+dnl A C++ output parameter is specified:
+,` _INITIALIZE($17,$4,`$16',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)',$18);
+dnl
+dnl Insert the initializations for the C output parameters
+ifelse(`$8',,,`$8
+')dnl
+')',dnl End if a C++ output parameter is specified.
dnl If is errthrow or refreturn
-`ifelse(`$9',,,` GError* gerror = 0;')
-ifelse(`$14',,dnl If no output parameter is specified:
-` ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
-dnl An output parameter is specified:
-,` _INITIALIZE($15,$4,`$14',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)',$16);'dnl
+`ifelse(`$11',,,` GError* gerror = 0;
+')dnl
+dnl Insert the declarations for C output parameters
+ifelse(`$6',,,`$6
+')`'dnl
+ifelse(`$16',,dnl If no C++ output parameter is specified:
+` ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)');dnl
+'dnl
+,dnl A C++ output parameter is specified:
+` _INITIALIZE($17,$4,`$16',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)',$18);
+'dnl
)dnl
-ifelse(`$9',,,`
+ifelse(`$11',,,`
if(gerror)
::Glib::Error::throw_exception(gerror);
-')
-ifelse(`$8',,,`dnl
- if(ifelse(`$14',,`retvalue',$14))
- ifelse(`$14',,`retvalue',$14)->reference(); //The function does not do a ref for us.
')dnl
-ifelse(`$3',void,,` return retvalue;')
+ifelse(`$10',,,`
+ if(ifelse(`$16',,`retvalue',$16))
+ ifelse(`$16',,`retvalue',$16)->reference(); //The function does not do a ref for us.
+')dnl
+dnl Insert the initializations for the C output parameters
+ifelse(`$8',,,`$8
+')`'dnl
+ifelse(`$3',void,,` return retvalue;')dnl
')dnl End errthrow/refreturn
-',` return const_cast<__CPPNAME__*>(this)->$1($12);')
+',` return const_cast<__CPPNAME__*>(this)->$1($14);')
}
-ifelse(`$13',,,`
-#endif // $13
+ifelse(`$15',,,`
+#endif // $15
')dnl
-ifelse(`$10',,,`_DEPRECATE_IFDEF_END
+ifelse(`$12',,,`_DEPRECATE_IFDEF_END
')dnl
_POP()')
dnl
dnl static method
-dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13
-dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,refreturn,errthrow,deprecated,ifdef,out_param,out_param_type,wrap_line)
+dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15
+dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,refreturn,errthrow,deprecated,ifdef,out_param,out_param_type,wrap_line)
define(`_STATIC_METHOD',`dnl
_PUSH(SECTION_CC)
-ifelse(`$9',,,`_DEPRECATE_IFDEF_START
+ifelse(`$11',,,`_DEPRECATE_IFDEF_START
')dnl
-ifelse(`$10',,,`#ifdef $10'
+ifelse(`$12',,,`#ifdef $12'
)dnl
$3 __CPPNAME__::$1($5)
{
-ifelse(`$7'`$8',,dnl
-`ifelse(`$11',,dnl If no output parameter is specified
-`ifelse(`$3',void,,` return ')_CONVERT($4,`$3',`$2`'($6)');
-'dnl
-dnl An output parameter is specified:
-,` _INITIALIZE($12,$4,`$11',`$2`'($6)',$13);'
-)',dnl End if an output parameter is specified.
-`ifelse(`$8',,,` GError* gerror = 0;')
-ifelse(`$11',,dnl If no output parameter is specified:
- ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'($6)');
-dnl An output parameter is specified:
-,` _INITIALIZE($12,$4,`$11',`$2`'($6)',$13);'dnl
+ifelse(`$9'`$10',,dnl
+dnl Insert declarations for C the output parameters
+ifelse(`$6',,,`$6
+')`'dnl
+`ifelse(`$13',,
+dnl If no C++ output parameter is specified.
+` ifelse(`$3',void,,dnl
+dnl Returns non-void:
+dnl Store the return if there are C output parameters
+ifelse(`$6',,`return ',``$3' retval = '))_CONVERT($4,`$3',`$2`'($7)');'dnl
+dnl A C++ output parameter is specified so initialize it from C return
+,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$15);'dnl
+)
+dnl Insert the initializations for the C output parameters if there are any
+ifelse(`$8',,,`$8
+')`'dnl
+dnl Return the value if it was stored and if the method returns something
+ifelse(`$3',void,,`ifelse(`$6',,,` return retval;
+')')dnl
+',dnl End if a C++ output parameter is specified.
+`ifelse(`$10',,,` GError* gerror = 0;')
+dnl Insert the declarations for the C output parameters
+ifelse(`$6',,,`$6
+')`'dnl
+ifelse(`$13',,dnl If no C++ output parameter is specified:
+ ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'($7)');dnl
+dnl A C++ output parameter is specified:
+,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$15);'dnl
)dnl
-ifelse(`$8',,,`
+ifelse(`$10',,,`
if(gerror)
::Glib::Error::throw_exception(gerror);
-')
-ifelse(`$7',,,`dnl
- if(ifelse(`$11',,`retvalue',$11))
- ifelse(`$11',,`retvalue',$11)->reference(); //The function does not do a ref for us
')dnl
-ifelse(`$3',void,,` return retvalue;')
+dnl Insert the initializations for the C output parameters.
+ifelse(`$8',,,`$8
+')`'dnl
+ifelse(`$9',,,`
+ if(ifelse(`$13',,`retvalue',$13))
+ ifelse(`$13',,`retvalue',$13)->reference(); //The function does not do a ref for us
+')dnl
+ifelse(`$3',void,,` return retvalue;
+')dnl
')dnl
}
-ifelse(`$10',,,`
-#endif // $10
+ifelse(`$12',,,`
+#endif // $12
')dnl
-ifelse(`$9',,,`_DEPRECATE_IFDEF_END
+ifelse(`$11',,,`_DEPRECATE_IFDEF_END
')
_POP()')
-
-
use Util;
use FunctionBase;
+# These are flags that indicate whether parameters are optional or output
+# parameters.
+use constant FLAG_PARAM_OPTIONAL => 1;
+use constant FLAG_PARAM_OUTPUT => 2;
+
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
- @EXPORT_OK = qw($Var1 %Hashit &func3);
+ @EXPORT_OK = qw($Var1 %Hashit &func3 FLAG_PARAM_OPTIONAL FLAG_PARAM_OUTPUT);
}
our @EXPORT_OK;
# string array param_type;
# string array param_name;
# string array param_default_value;
-# bool array param_optional;
+# int array param_flags; (stores flags form params: 1 => optional, 2 => output)
# hash param_mappings; (maps C param names (if specified) to the C++ index)
# string array possible_args_list; (a list of space separated indexes)
# string in_module; e.g. Gtk
$$self{param_types} = [];
$$self{param_names} = [];
$$self{param_default_values} = [];
- $$self{param_optional} = [];
+ $$self{param_flags} = [];
$$self{param_mappings} = {};
$$self{possible_args_list} = [];
$$self{in_module} = "";
$$self{param_types} = [];
$$self{param_names} = [];
$$self{param_default_values} = [];
- $$self{param_optional} = [];
+ $$self{param_flags} = [];
$$self{param_mappings} = {};
$$self{possible_args_list} = [];
$$self{in_module} = "";
my $value = "";
my $id = 0;
my $has_value = 0;
- my $is_optional = 0;
+ my $flags = 0;
my $curr_param = 0;
my $param_types = $$self{param_types};
my $param_names = $$self{param_names};
my $param_default_values = $$self{param_default_values};
- my $param_optional = $$self{param_optional};
+ my $param_flags = $$self{param_flags};
my $param_mappings = $$self{param_mappings};
# Mappings from a C name to this C++ param defaults to empty (no mapping).
# parse through argument list
my @str = ();
my $par = 0;
- foreach (split(/(const )|([,=&*()])|(<[^,]*>)|(\s+)/, $line)) #special characters OR <something> OR whitespace.
+ foreach (split(/(const )|([,=&*()])|(<[^,{}]*>)|(\s+)/, $line)) #special characters OR <something> OR whitespace.
{
next if ( !defined($_) or $_ eq "" );
$par--; #Decrement the number of parameters.
next;
}
- elsif ( $par || /^(const )|(<[^,]*>)|([*&])|(\s+)/ ) #TODO: What's happening here?
+ elsif ( $par || /^(const )|(<[^,{}]*>)|([*&])|(\s+)/ ) #TODO: What's happening here?
{
push(@str, $_); #This looks like part of the type, so we store it.
next;
$type = string_trim($type);
- # Determine if the param is optional or if a C param name should be
- # mapped to the current C++ index (if name ends with {c_name?}). (A
- # '.' for the name means use the C++ as the C name).
- if ($name =~ /\{\s*(\w*|\.)\s*(\??)\s*\}$/)
+ # Determine if the param is optional, an output param or if a C param
+ # name should be mapped to the current C++ index (if name ends with
+ # {c_name>>?}). (A '.' for the name means use the C++ as the C name).
+ # '@' - Means that it is an output parameter.
+ # '?' - Means that it is an optional parameter.
+ if ($name =~ /\{\s*(\w+|\.)?\s*(>>)?\s*(\??)\s*\}$/)
{
- $is_optional = 1 if($2);
+ $flags = FLAG_PARAM_OPTIONAL if($3);
+ $flags |= FLAG_PARAM_OUTPUT if($2);
$mapping = $1 if($1);
- $name =~ s/\{\s*(\w|\.)*\??\s*\}$//;
+ $name =~ s/\{\s*(\w+|\.)?\s*(>>)?\s*\??\s*\}$//;
$mapping = $name if($mapping eq ".");
}
push(@$param_types, $type);
push(@$param_names, $name);
push(@$param_default_values, $value);
- push(@$param_optional, $is_optional);
+ push(@$param_flags, $flags);
# Map from the c_name to the C++ index (no map if no name given).
$$param_mappings{$mapping} = $curr_param if($mapping);
$value = "";
$has_value = 0;
$name = "";
- $is_optional = 0;
+ $flags = 0;
$curr_param++;
# Mappings from a C name to this C++ param defaults to empty (no mapping).
}
$type = string_trim($type);
-
- # Determine if the param is optional or if a C param name should be
- # mapped to the current C++ index (if name ends with {c_name?}). (A
- # '.' for the name means use the C++ as the C name).
- if ($name =~ /\{\s*(\w*|\.)\s*(\??)\s*\}$/)
+
+ # Determine if the param is optional, an output param or if a C param
+ # name should be mapped to the current C++ index (if name ends with
+ # {c_name>>?}). (A '.' for the name means use the C++ as the C name).
+ if ($name =~ /\{\s*(\w+|\.)?\s*(>>)?\s*(\??)\s*\}$/)
{
- $is_optional = 1 if($2);
+ $flags = FLAG_PARAM_OPTIONAL if($3);
+ $flags |= FLAG_PARAM_OUTPUT if($2);
$mapping = $1 if($1);
- $name =~ s/\{\s*(\w*|\.)\??\s*\}$//;
+ $name =~ s/\{\s*(\w+|\.)?\s*(>>)?\??\s*\}$//;
$mapping = $name if($mapping eq ".");
}
push(@$param_types, $type);
push(@$param_names, $name);
push(@$param_default_values, $value);
- push(@$param_optional, $is_optional);
+ push(@$param_flags, $flags);
# Map from the c_name to the C++ index (no map if no name given).
$$param_mappings{$mapping} = $curr_param if($mapping);
my $param_names = $$self{param_names};
my $param_types = $$self{param_types};
- my $param_optional = $$self{param_optional};
+ my $param_flags = $$self{param_flags};
my @result = ();
push(@result, "$i");
# And if it's optional also add an empty string to represent that it is
# not added.
- push(@result, "") if ($$param_optional[$i]);
+ push(@result, "") if ($$param_flags[$i] & FLAG_PARAM_OPTIONAL);
return @result;
}
# If this parameter is optional, append the remaining possibilities without
# this param's type and name.
- if($$param_optional[$i])
+ if($$param_flags[$i] & FLAG_PARAM_OPTIONAL)
{
foreach my $possibility (@remaining)
{
# @ get_methods()
# @ get_signals()
# @ get_properties()
+# @ get_unwrapped()
#
# $ lookup_enum(c_type)
# $ lookup_object(c_name)
+# $ lookup_method_dont_mark(c_name)
+# $ lookup_method_set_weak_mark(c_name)
# $ lookup_method(c_name)
# $ lookup_function(c_name)
# $ lookup_property(object, c_name)
}
# This searches for items wrapped by this file and then tries to locate
-# other functions/signal/properties which may have been left unmarked.
+# other methods/signals/properties which may have been left unmarked.
sub get_unwrapped
{
- # find methods which were used in for a _WRAP
+ # find methods which were used in a _WRAP or _IGNORE.
my @targets;
push @targets,grep {$$_{entity_type} eq "method" && $$_{mark}==1} values %GtkDefs::methods;
push @targets,grep {$$_{mark}==1} values %GtkDefs::signals;
push @targets,grep {$$_{mark}==1} values %GtkDefs::properties;
# find the classes which used them.
- my @classes = join(" ", unique(map { $$_{class} } @targets));
+ my @classes = unique(map { $$_{class} } @targets);
- # find methods which are in those classes which didn't get marked.
+ # find methods/signals/properties which are in those classes which didn't get marked.
my @unwrapped;
my $class;
foreach $class (@classes)
sub lookup_method($)
{
- my $obj = lookup_method_dont_mark($_);
+ my $obj = lookup_method_dont_mark($_[0]);
$$obj{mark} = 1 if($obj);
return $obj;
return lookup_method($_[0]);
}
+sub lookup_method_set_weak_mark($)
+{
+ my $obj = lookup_method_dont_mark($_[0]);
+
+ # A constructor or a static method may be listed in the .defs file as a method
+ # of another class, if its first parameter is a pointer to a class instance.
+ # Examples:
+ # GVariantIter* g_variant_iter_new(GVariant* value)
+ # GtkWidget* gtk_application_window_new(GtkApplication* application)
+ # GSocketConnection* g_socket_connection_factory_create_connection(GSocket* socket)
+ #
+ # The use of gtk_application_window_new() in Gtk::ApplicationWindow shall
+ # not cause get_unwrapped() to list all methods, signals and properties of
+ # GtkApplication as unwrapped in applicationwindow.hg.
+ # Therefore mark=2 instead of mark=1.
+
+ $$obj{mark} = 2 if ($obj && $$obj{mark} == 0);
+ return $obj;
+}
+
sub lookup_signal($$)
{
no warnings;
BEGIN { @GtkDefs::Function::ISA=qw(FunctionBase); }
# class Function : FunctionBase
-#
# {
-# string name; e.g. gtk_accelerator_valid
-# string c_name;
-# string class e.g. GtkButton
+# string name; e.g. function: gtk_accelerator_valid, method: clicked
+# string c_name; e.g. gtk_accelerator_valid, gtk_button_clicked
+# string class; e.g. GtkButton
#
# string rettype;
# string array param_types;
# string array param_names;
#
-# string entity_type. e.g. method or signal
+# string entity_type; e.g. method or function
#
# bool varargs;
# bool mark;
-#
# }
# "new" can't have prototype
my $self = {};
bless $self;
+ #Remove first and last braces:
$def =~ s/^\(//;
$def =~ s/\)$//;
- $def =~ s/^\s*define-(\S+)\s+(\S+)\s*//;
+
+ #In rare cases a method can be nameless (g_iconv).
+ #Don't interpret the following "(of-object" as the method's name.
+ $def =~ s/^\s*define-([^\s\(]+)\s*([^\s\(]*)\s*//;
$$self{entity_type} = $1;
$$self{name} = $2;
$$self{name} =~ s/-/_/g; # change - to _
package Output;
use strict;
use open IO => ":utf8";
+use Function qw(FLAG_PARAM_OPTIONAL FLAG_PARAM_OUTPUT);
use DocsParser;
sub ifdef($$)
{
- my ($self, $ifdef) = @_;
- if ($ifdef)
- {
- $self->append("\n#ifdef $ifdef\n");
- }
+ my ($self, $ifdef) = @_;
+ if ($ifdef)
+ {
+ $self->append("\n#ifdef $ifdef\n");
+ }
}
sub endif($$)
{
- my ($self, $ifdef) = @_;
- if ($ifdef)
- {
- $self->append("\n#endif // $ifdef\n");
- }
+ my ($self, $ifdef) = @_;
+ if ($ifdef)
+ {
+ $self->append("\n#endif // $ifdef\n");
+ }
}
-### Convert _WRAP to a virtual
+### Convert _WRAP to a virtual
# _VFUNC_H(signame,rettype,`<cppargs>')
# _VFUNC_PH(gtkname,crettype,cargs and names)
# void output_wrap_vfunc_h($filename, $line_num, $objCppfunc, $objCDefsFunc)
# );
# $self->append($str);
+ # Prepend a Doxygen @throws directive to the declaration if the virtual
+ # function throws an error.
+ if($$objCDefsFunc{throw_any_errors})
+ {
+ $self->append('/// @throws Glib::Error.' . "\n");
+ }
+
my $cppVfuncDecl = "virtual " . $$objCppfunc{rettype} . " " . $$objCppfunc{name} . "(" . $objCppfunc->args_types_and_names() . ")";
if($objCppfunc->get_is_const())
{
my $refreturn = "";
$refreturn = "refreturn" if($$objCppfunc{rettype_needs_ref});
+ my ($conversions, $declarations, $initializations) =
+ convert_args_cpp_to_c($objCppfunc, $objCFunc, 0, $line_num, $errthrow);
+
my $str = sprintf("_VFUNC_CC(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s,%s)dnl\n",
$$objCppfunc{name},
$cname,
$$objCppfunc{rettype},
$$objCFunc{rettype},
$objCppfunc->args_types_and_names(),
- convert_args_cpp_to_c($objCppfunc, $objCFunc, 0, $line_num, $errthrow), #$objCppfunc->args_names_only(),
+ $conversions,
$objCppfunc->get_is_const(),
$refreturn,
$ifdef,
#Implementation:
my $str;
if ($$objCppfunc{static}) {
- $str = sprintf("_STATIC_METHOD(%s,%s,`%s\',%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s)dnl\n",
+ my ($conversions, $declarations, $initializations) =
+ convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 1, $line_num,
+ $errthrow, $arg_list); #1 means it's static, so it has 'object'.
+
+ $str = sprintf("_STATIC_METHOD(%s,%s,\`%s\',%s,\`%s\',\`%s\',\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s)dnl\n",
$$objCppfunc{name},
$$objCDefsFunc{c_name},
$$objCppfunc{rettype},
$objCDefsFunc->get_return_type_for_methods(),
$objCppfunc->args_types_and_names($arg_list),
- convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 1, $line_num,
- $errthrow, $arg_list), #1 means it's static, so it has 'object'.
+ $declarations,
+ $conversions,
+ $initializations,
$refneeded,
$errthrow,
$deprecated,
$line_num
);
} else {
- $str = sprintf("_METHOD(%s,%s,`%s\',%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,\`%s\',%s,%s,%s,%s)dnl\n",
+ my ($conversions, $declarations, $initializations) =
+ convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 0, $line_num,
+ $errthrow, $arg_list);
+
+ $str = sprintf("_METHOD(%s,%s,\`%s\',%s,\`%s\',\`%s\',\`%s\',\`%s\',%s,%s,%s,%s,%s,\`%s\',%s,%s,%s,%s)dnl\n",
$$objCppfunc{name},
$$objCDefsFunc{c_name},
$$objCppfunc{rettype},
$objCDefsFunc->get_return_type_for_methods(),
$objCppfunc->args_types_and_names($arg_list),
- convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 0, $line_num,
- $errthrow, $arg_list),
+ $declarations,
+ $conversions,
+ $initializations,
$$objCppfunc{const},
$refneeded,
$errthrow,
-# procedure for generating CONVERT macros
-# $string convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, $static, $wrap_line_number,$automatic_error, $index = 0)
+# procedure for generating CONVERT macros, C declarations (for C output
+# variables), and INITIALIZE macros (to set the corresponding C++ parameters
+# from the C output parameters) for the specified argument list
+# (string, string, string) convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, $static, $wrap_line_number,$automatic_error, $index = 0)
+# The return is an array of 3 strings: The _CONVERT macros, the C declarations
+# and the _INITIALIZE macros.
# The optional index specifies which arg list out of the possible combination
# of arguments based on whether any arguments are optional. index = 0 ==> all
# the arguments.
my $cpp_param_names = $$objCppfunc{param_names};
my $cpp_param_types = $$objCppfunc{param_types};
- my $cpp_param_optional = $$objCppfunc{param_optional};
+ my $cpp_param_flags = $$objCppfunc{param_flags};
my $cpp_param_mappings = $$objCppfunc{param_mappings};
my $c_param_types = $$objCDefsFunc{param_types};
my $c_param_names = $$objCDefsFunc{param_names};
- my @result;
+ my @conversions;
+ my @declarations;
+ my @initializations;
my $num_c_args_expected = scalar(@{$c_param_types});
if( !($static) ) { $num_c_args_expected--; } #The cpp method will need an Object* paramater at the start.
$num_cpp_args++;
$cpp_param_names = [@{$cpp_param_names},"gerror"];
$cpp_param_types = [@{$cpp_param_types},"GError*&"];
- $cpp_param_optional = [@{$cpp_param_optional}, 0];
+ $cpp_param_flags = [@{$cpp_param_flags}, 0];
# Map from the C gerror param name to the newly added C++ param index.
# The correct C++ index to map to (from the C name) depends on if there
$objCppfunc->dump();
$objCDefsFunc->dump();
- return "";
+ return ("", "", "");
}
- # If there is an output variable it must be processed so re-increment (now)
+ # If there is an output parameter it must be processed so re-increment (now)
# the number of C++ arguments.
$num_cpp_args++ if($has_output_param);
# If the C++ index is not found in the list of desired parameters, pass
# NULL to the C func unless the param is not optional (applies to a
# possibly added GError parameter).
- if ($$cpp_param_optional[$cpp_param_index])
+ if (($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OPTIONAL))
{
- push(@result, "0");
+ push(@conversions, "0");
next;
}
}
+ if ($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OUTPUT)
+ {
+ # Get a generic name for the C output parameter name.
+ my $cOutputParamName = "g_" . $$c_param_names[$iCParam];
+ my $cOutputParamType = $cParamType;
+ # Remove a possible final '*' from the output parameter type because it
+ # will be passed by C reference (&name).
+ $cOutputParamType =~ s/\*$//;
+
+ push(@declarations, " $cOutputParamType $cOutputParamName = 0;");
+
+ push(@conversions, "&" . $cOutputParamName);
+
+ push(@initializations, sprintf(" _INITIALIZE(\`%s\',%s,%s,%s,%s);",
+ $cppParamType,
+ $cOutputParamType,
+ $cppParamName,
+ $cOutputParamName,
+ $wrap_line_number));
+ next;
+ }
+
if ($cppParamType ne $cParamType) #If a type conversion is needed.
{
- push(@result, sprintf("_CONVERT(%s,%s,%s,%s)",
+ push(@conversions, sprintf("_CONVERT(%s,%s,%s,%s)",
$cppParamType,
$cParamType,
$cppParamName,
}
else
{
- push(@result, $cppParamName);
+ push(@conversions, $cppParamName);
}
}
- return join(", ", @result);
+ return ( join(", ", @conversions), join("\n ", @declarations),
+ join("\n ", @initializations) );
}
# procedure for generating CONVERT macros
my $cpp_param_names = $$objCppfunc{param_names};
my $cpp_param_types = $$objCppfunc{param_types};
- my $cpp_param_optional = $$objCppfunc{param_optional};
+ my $cpp_param_flags = $$objCppfunc{param_flags};
my $cpp_param_mappings = $$objCppfunc{param_mappings};
my $c_param_types = $$objCDefsFunc{param_types};
my $c_param_names = $$objCDefsFunc{param_names};
{
# If the C++ index is not found in the list of desired parameters, pass
# NULL to the C func unless the param is not optional.
- if ($$cpp_param_optional[$cpp_param_index])
+ if (~($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OPTIONAL))
{
push(@result, "0");
next;
my ($self, $interface, $ifdef) = @_;
my $str = sprintf("_IMPLEMENTS_INTERFACE_CC(%s, %s)dnl\n",
- $interface,
- $ifdef);
+ $interface,
+ $ifdef);
$self->append($str);
}
my @out;
my $level = 0;
+ my $in_braces = 0;
my $str = "";
- my @in = split(/([,()<>])/, $in);
+ my @in = split(/([,()<>{}])/, $in);
while ($#in > -1)
{
my $t = shift @in;
next if ($t eq "");
+
+ $in_braces++ if ($t eq "{");
+ $in_braces-- if ($t eq "}");
+
$level++ if ($t eq "(" or $t eq "<");
- $level-- if ($t eq ")" or $t eq ">");
+
+ # In the case of a '>' decrease the level if it is not in a {...}
+ # because if it is found in a {...} it is most likely indicating that
+ # a parameter in a method declaration is an output param.
+ $level-- if ($t eq ")" or ($t eq ">" && !$in_braces));
# skip , inside functions Ie. void (*)(int,int)
if ( ($t eq ",") && !$level)
return;
}
- #Parse the method decaration and build an object that holds the details:
+ #Parse the method declaration and build an object that holds the details:
$objCppfunc = &Function::new($argCppMethodDecl, $self);
# handle second argument:
if ($argCFunctionName =~ m/^\S+$/s)
{
#c-name. e.g. gtk_clist_set_column_title
- $objCfunc = GtkDefs::lookup_function($argCFunctionName);
+ if ($$objCppfunc{static}) {
+ $objCfunc = GtkDefs::lookup_method_set_weak_mark($argCFunctionName);
+ } else {
+ $objCfunc = GtkDefs::lookup_method($argCFunctionName);
+ }
if(!$objCfunc) #If the lookup failed:
{
if ($argCFunctionName =~ m/^\S+$/s)
{
#c-name. e.g. gtk_clist_set_column_title
- $objCfunc = GtkDefs::lookup_function($argCFunctionName);
+ $objCfunc = GtkDefs::lookup_method_set_weak_mark($argCFunctionName);
if(!$objCfunc) #If the lookup failed:
{
#Get the C function's details:
if ($argCFunctionName =~ m/^\S+$/s)
{
- $objCfunc = GtkDefs::lookup_function($argCFunctionName); #c-name. e.g. gtk_clist_set_column_title
+ #c-name. e.g. gtk_button_new
+ $objCfunc = GtkDefs::lookup_method_set_weak_mark($argCFunctionName);
if(!$objCfunc) #If the lookup failed:
{
$objOutputter->output_wrap_failed($argCFunctionName, "ctor defs lookup failed (2)");