glibmm r561 - in trunk: . gio/giomm gio/src tools/m4



Author: jjongsma
Date: Sat Feb  2 20:56:40 2008
New Revision: 561
URL: http://svn.gnome.org/viewvc/glibmm?rev=561&view=rev

Log:
	* gio/src/Makefile_list_of_hg.am_fragment:
	* gio/src/datainputstream.ccg:
	* gio/src/datainputstream.hg:
	* tools/m4/convert_gio.m4: add DataInputStream class


Added:
   trunk/gio/src/datainputstream.ccg
   trunk/gio/src/datainputstream.hg
Modified:
   trunk/ChangeLog
   trunk/gio/giomm/   (props changed)
   trunk/gio/src/Makefile_list_of_hg.am_fragment
   trunk/tools/m4/convert_gio.m4

Modified: trunk/gio/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- trunk/gio/src/Makefile_list_of_hg.am_fragment	(original)
+++ trunk/gio/src/Makefile_list_of_hg.am_fragment	Sat Feb  2 20:56:40 2008
@@ -9,7 +9,8 @@
 				   fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
 				   filemonitor.hg filterinputstream.hg \
 				   icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
-				   seekable.hg simpleasyncresult.hg volume.hg volumemonitor.hg bufferedinputstream.hg
+				   seekable.hg simpleasyncresult.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
+				   datainputstream.hg
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Added: trunk/gio/src/datainputstream.ccg
==============================================================================
--- (empty file)
+++ trunk/gio/src/datainputstream.ccg	Sat Feb  2 20:56:40 2008
@@ -0,0 +1,252 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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 "slot_async.h"
+
+namespace Gio
+{
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+guchar DataInputStream::read_byte()
+#else
+guchar DataInputStream::read_byte(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  guchar retvalue = g_data_input_stream_read_byte(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gint16 DataInputStream::read_int16()
+#else
+gint16 DataInputStream::read_int16(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gint16 retvalue = g_data_input_stream_read_int16(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+guint16 DataInputStream::read_uint16()
+#else
+guint16 DataInputStream::read_uint16(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  guint16 retvalue = g_data_input_stream_read_uint16(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gint32 DataInputStream::read_int32()
+#else
+gint32 DataInputStream::read_int32(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gint32 retvalue = g_data_input_stream_read_int32(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+guint32 DataInputStream::read_uint32()
+#else
+guint32 DataInputStream::read_uint32(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  guint32 retvalue = g_data_input_stream_read_uint32(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gint64 DataInputStream::read_int64()
+#else
+gint64 DataInputStream::read_int64(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gint64 retvalue = g_data_input_stream_read_int64(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+guint64 DataInputStream::read_uint64()
+#else
+guint64 DataInputStream::read_uint64(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  guint64 retvalue = g_data_input_stream_read_uint64(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+std::string DataInputStream::read_line(const Glib::RefPtr<Cancellable>& cancellable)
+#else
+std::string DataInputStream::read_line(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  std::string s =
+      Glib::convert_return_gchar_ptr_to_stdstring(g_data_input_stream_read_line(gobj(),
+                  NULL, // pass NULL since we can easily determine the length from the returned std::string
+                  cancellable->gobj(),
+                  &gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+    return s;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+std::string DataInputStream::read_line()
+#else
+std::string DataInputStream::read_line(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  std::string s =
+      Glib::convert_return_gchar_ptr_to_stdstring(g_data_input_stream_read_line(gobj(),
+                  NULL, // pass NULL since we can easily determine the length from the returned std::string
+                  NULL,
+                  &gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+    return s;
+}
+
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+std::string DataInputStream::read_until(const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable)
+#else
+std::string DataInputStream::read_until(const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  std::string s =
+      Glib::convert_return_gchar_ptr_to_stdstring(g_data_input_stream_read_until(gobj(),
+                  stop_chars.c_str(),
+                  NULL, // pass NULL since we can easily determine the length from the returned std::string
+                  cancellable->gobj(),
+                  &gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+    return s;
+}
+
+/** non-cancellable version of read_until()
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+std::string DataInputStream::read_until(const std::string& stop_chars)
+#else
+std::string DataInputStream::read_until(const std::string& stop_chars, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  std::string s =
+      Glib::convert_return_gchar_ptr_to_stdstring(g_data_input_stream_read_until(gobj(),
+                  stop_chars.c_str(),
+                  NULL, // pass NULL since we can easily determine the length from the returned std::string
+                  NULL,
+                  &gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+    return s;
+}
+
+} // namespace Gio

Added: trunk/gio/src/datainputstream.hg
==============================================================================
--- (empty file)
+++ trunk/gio/src/datainputstream.hg	Sat Feb  2 20:56:40 2008
@@ -0,0 +1,143 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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/bufferedinputstream.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/bufferedinputstream_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE)
+_WRAP_ENUM(DataStreamNewlineType, GDataStreamNewlineType, NO_GTYPE)
+
+/**
+ * An implementation of BufferedInputStream that allows for high-level data
+ * manipulation of arbitrary data (including binary operations).
+
+ * @newin2p16
+ */
+class DataInputStream : public Gio::BufferedInputStream
+{
+  _CLASS_GOBJECT(DataInputStream, GDataInputStream, G_DATA_INPUT_STREAM, Gio::BufferedInputStream, GBufferedInputStream)
+
+  _WRAP_CTOR(DataInputStream(const Glib::RefPtr<InputStream>& base_stream), g_data_input_stream_new)
+public:
+
+  _WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream)
+
+  _WRAP_METHOD(void set_byte_order(DataStreamByteOrder order), g_data_input_stream_set_byte_order)
+  _WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_input_stream_get_byte_order)
+  _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)
+  /** non-cancellable version of read_byte()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  guchar read_byte();
+#else
+  guchar read_byte(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int16, errthrow)
+  /** non-cancellable version of read_int16()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gint16 read_int16();
+#else
+  gint16 read_int16(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint16, errthrow)
+  /** non-cancellable version of read_uint16()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  guint16 read_uint16();
+#else
+  guint16 read_uint16(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int32, errthrow)
+  /** non-cancellable version of read_int32()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gint32 read_int32();
+#else
+  gint32 read_int32(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint32, errthrow)
+  /** non-cancellable version of read_uint32()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  guint32 read_uint32();
+#else
+  guint32 read_uint32(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int64, errthrow)
+  /** non-cancellable version of read_int64()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gint64 read_int64();
+#else
+  gint64 read_int64(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint64, errthrow)
+  /** non-cancellable version of read_uint64()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  guint64 read_uint64();
+#else
+  guint64 read_uint64(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  std::string read_line(const Glib::RefPtr<Cancellable>& cancellable);
+#else
+  std::string read_line(const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+  /** non-cancellable version of read_line()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  std::string read_line();
+#else
+  std::string read_line(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  std::string read_until(const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
+#else
+  std::string read_until(const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+  /** non-cancellable version of read_until()
+   */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  std::string read_until(const std::string& stop_chars);
+#else
+  std::string read_until(const std::string& stop_chars, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+};
+
+} // namespace Gio
+

Modified: trunk/tools/m4/convert_gio.m4
==============================================================================
--- trunk/tools/m4/convert_gio.m4	(original)
+++ trunk/tools/m4/convert_gio.m4	Sat Feb  2 20:56:40 2008
@@ -11,6 +11,8 @@
 _CONV_ENUM(G,FileType)
 _CONV_ENUM(G,OutputStreamSpliceFlags)
 _CONV_ENUM(G,AppInfoCreateFlags)
+_CONV_ENUM(G,DataStreamByteOrder)
+_CONV_ENUM(G,DataStreamNewlineType)
 
 
 # AppInfo



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]