1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY! 2 #ifndef _GIOMM_MEMORYINPUTSTREAM_H 3 #define _GIOMM_MEMORYINPUTSTREAM_H 4 5 #include <giommconfig.h> 6 7 8 #include <glibmm/ustring.h> 9 #include <sigc++/sigc++.h> 10 11 /* Copyright (C) 2007 The gtkmm Development Team 12 * 13 * This library is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU Lesser General Public 15 * License as published by the Free Software Foundation; either 16 * version 2.1 of the License, or (at your option) any later version. 17 * 18 * This library is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * Lesser General Public License for more details. 22 * 23 * You should have received a copy of the GNU Lesser General Public 24 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 28 #include <giomm/inputstream.h> 29 #include <giomm/seekable.h> 30 31 32 #ifndef DOXYGEN_SHOULD_SKIP_THIS 33 using GMemoryInputStream = struct _GMemoryInputStream; 34 using GMemoryInputStreamClass = struct _GMemoryInputStreamClass; 35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 36 37 38 #ifndef DOXYGEN_SHOULD_SKIP_THIS 39 namespace Gio 40 { class GIOMM_API MemoryInputStream_Class; } // namespace Gio 41 #endif //DOXYGEN_SHOULD_SKIP_THIS 42 43 namespace Gio 44 { 45 46 /** MemoryInputStream implements InputStream for arbitrary memory chunks. 47 * 48 * @ingroup Streams 49 * 50 * @newin{2,16} 51 */ 52 53 class GIOMM_API MemoryInputStream 54 : public Gio::InputStream, 55 public Seekable 56 { 57 58 #ifndef DOXYGEN_SHOULD_SKIP_THIS 59 60 public: 61 using CppObjectType = MemoryInputStream; 62 using CppClassType = MemoryInputStream_Class; 63 using BaseObjectType = GMemoryInputStream; 64 using BaseClassType = GMemoryInputStreamClass; 65 66 // noncopyable 67 MemoryInputStream(const MemoryInputStream&) = delete; 68 MemoryInputStream& operator=(const MemoryInputStream&) = delete; 69 70 private: friend class MemoryInputStream_Class; 71 static CppClassType memoryinputstream_class_; 72 73 protected: 74 explicit MemoryInputStream(const Glib::ConstructParams& construct_params); 75 explicit MemoryInputStream(GMemoryInputStream* castitem); 76 77 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 78 79 public: 80 81 MemoryInputStream(MemoryInputStream&& src) noexcept; 82 MemoryInputStream& operator=(MemoryInputStream&& src) noexcept; 83 84 ~MemoryInputStream() noexcept override; 85 86 /** Get the GType for this class, for use with the underlying GObject type system. 87 */ 88 static GType get_type() G_GNUC_CONST; 89 90 #ifndef DOXYGEN_SHOULD_SKIP_THIS 91 92 93 static GType get_base_type() G_GNUC_CONST; 94 #endif 95 96 ///Provides access to the underlying C GObject. gobj()97 GMemoryInputStream* gobj() { return reinterpret_cast<GMemoryInputStream*>(gobject_); } 98 99 ///Provides access to the underlying C GObject. gobj()100 const GMemoryInputStream* gobj() const { return reinterpret_cast<GMemoryInputStream*>(gobject_); } 101 102 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 103 GMemoryInputStream* gobj_copy(); 104 105 private: 106 107 108 protected: 109 MemoryInputStream(); 110 // TODO: *_new_from_data constructor needs to be fixed? 111 112 public: 113 114 static Glib::RefPtr<MemoryInputStream> create(); 115 116 117 #ifndef GIOMM_DISABLE_DEPRECATED 118 119 /** Appends to data that can be read from the input stream. 120 * 121 * @param data Input data. 122 * 123 * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead. 124 */ 125 void add_data(const std::string& data); 126 127 /** Appends to data that can be read from the input stream. 128 * 129 * Note that the data will be copied internally and freed when no longer needed. 130 * 131 * @param data Input data. 132 * @param len Length of the data, may be -1 if data is a null-terminated string. 133 * 134 * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead. 135 */ 136 void add_data(const void* data, gssize len); 137 #endif // GIOMM_DISABLE_DEPRECATED 138 139 140 /** Appends @a data to data that can be read from the input stream 141 * 142 * @param data Input data. 143 * @param len Length of the data, may be -1 if @a data is a nul-terminated string. 144 * @param destroy Function that is called to free @a data, or <tt>nullptr</tt>. 145 */ 146 void add_data(const void* data, gssize len, GDestroyNotify destroy); 147 148 /** For example, 149 * void on_destroy_data(void* data); 150 * 151 * @param data The data to free. 152 * 153 * @newin{2,40} 154 */ 155 using SlotDestroyData = sigc::slot<void, void*>; 156 157 /** Appends to data that can be read from the input stream. 158 * 159 * @param data Input data. 160 * @param len Length of the data, may be -1 if data is a null-terminated string. 161 * @param destroy_slot A slot to be called to free the data when it is no longer needed. 162 * 163 * @newin{2,40} 164 */ 165 void add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot); 166 167 168 /** Appends @a bytes to data that can be read from the input stream. 169 * 170 * @newin{2,44} 171 * 172 * @param bytes Input data. 173 */ 174 void add_bytes(const Glib::RefPtr<const Glib::Bytes>& bytes); 175 176 177 public: 178 179 public: 180 //C++ methods used to invoke GTK+ virtual functions: 181 182 protected: 183 //GTK+ Virtual Functions (override these to change behaviour): 184 185 //Default Signal Handlers:: 186 187 188 }; 189 190 } // namespace Gio 191 192 193 namespace Glib 194 { 195 /** A Glib::wrap() method for this object. 196 * 197 * @param object The C instance. 198 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 199 * @result A C++ instance that wraps this C instance. 200 * 201 * @relates Gio::MemoryInputStream 202 */ 203 GIOMM_API 204 Glib::RefPtr<Gio::MemoryInputStream> wrap(GMemoryInputStream* object, bool take_copy = false); 205 } 206 207 208 #endif /* _GIOMM_MEMORYINPUTSTREAM_H */ 209 210