/usr/include/glibmm-2.4/glibmm/bytes.h is in libglibmm-2.4-dev 2.56.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | // Generated by gmmproc 2.54.1 -- DO NOT MODIFY!
#ifndef _GLIBMM_BYTES_H
#define _GLIBMM_BYTES_H
/* Copyright (C) 2012 The glibmm 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, see <http://www.gnu.org/licenses/>.
*/
#include <glibmmconfig.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
#include <glibmm/arrayhandle.h>
#include <glib.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GBytes GBytes;
#endif
namespace Glib
{
//Note: The documentation is a reduced version of the C documentation,
//because this class is only really useful with other C types that we don't bother to wrap.
//We only wrap it because it is used in the InputStream, OutputStream and Resource APIs.
/** A simple refcounted data type representing an immutable byte sequence
* from an unspecified origin.
*
* The purpose of the Bytes class is to keep the memory region that it holds
* alive for as long as anyone holds a reference to the bytes. When
* the last reference count is dropped, the memory is released. Multiple
* unrelated callers can use byte data in the Bytes object without coordinating
* their activities, resting assured that the byte data will not change or
* move while they hold a reference.
*
* A Bytes object can come from many different origins that may have
* different procedures for freeing the memory region. Examples are
* memory from g_malloc(), from memory slices, from a GMappedFile or
* memory from other allocators.
*
* @newin{2,34}
*/
class Bytes final
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
using CppObjectType = Bytes;
using BaseObjectType = GBytes;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/** Increment the reference count for this object.
* You should never need to do this manually - use the object via a RefPtr instead.
*/
void reference() const;
/** Decrement the reference count for this object.
* You should never need to do this manually - use the object via a RefPtr instead.
*/
void unreference() const;
///Provides access to the underlying C instance.
GBytes* gobj();
///Provides access to the underlying C instance.
const GBytes* gobj() const;
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GBytes* gobj_copy() const;
Bytes() = delete;
// noncopyable
Bytes(const Bytes&) = delete;
Bytes& operator=(const Bytes&) = delete;
protected:
// Do not derive this. Glib::Bytes can neither be constructed nor deleted.
void operator delete(void*, std::size_t);
private:
public:
static Glib::RefPtr<Glib::Bytes> create(gconstpointer data, gsize size);
/** Get the byte data in the Bytes. This data should not be modified.
*
* This function will always return the same pointer for a given Bytes.
*
* <tt>nullptr</tt> may be returned if @a size is 0. This is not guaranteed, as the Bytes
* may represent an empty string with @a data non-<tt>nullptr</tt> and @a size as 0. <tt>nullptr</tt> will
* not be returned if @a size is non-zero.
*
* @newin{2,32}
*
* @param size Location to return size of byte data.
* @return A pointer to the byte data, or <tt>nullptr</tt>.
*/
gconstpointer get_data(gsize& size) const;
/** Get the size of the byte data in the Bytes.
*
* This function will always return the same value for a given Bytes.
*
* @newin{2,32}
*
* @return The size.
*/
gsize get_size() const;
/** Creates an integer hash code for the byte data in the Bytes.
*
* This function can be passed to g_hash_table_new() as the @a key_hash_func
* parameter, when using non-<tt>nullptr</tt> Bytes pointers as keys in a HashTable.
*
* @newin{2,32}
*
* @param bytes A pointer to a Bytes key.
* @return A hash value corresponding to the key.
*/
static guint hash(gconstpointer bytes);
/** Compares the two Bytes values being pointed to and returns
* <tt>true</tt> if they are equal.
*
* This function can be passed to g_hash_table_new() as the @a key_equal_func
* parameter, when using non-<tt>nullptr</tt> Bytes pointers as keys in a HashTable.
*
* @newin{2,32}
*
* @param bytes1 A pointer to a Bytes.
* @param bytes2 A pointer to a Bytes to compare with @a bytes1.
* @return <tt>true</tt> if the two keys match.
*/
static bool equal(gconstpointer bytes1, gconstpointer bytes2);
/** Compares the two Bytes values.
*
* This function can be used to sort GBytes instances in lexographical order.
*
* @newin{2,32}
*
* @param bytes1 A pointer to a Bytes.
* @param bytes2 A pointer to a Bytes to compare with @a bytes1.
* @return A negative value if bytes2 is lesser, a positive value if bytes2 is
* greater, and zero if bytes2 is equal to bytes1.
*/
static gint compare(gconstpointer bytes1, gconstpointer bytes2);
};
} // namespace Glib
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Glib::Bytes
*/
Glib::RefPtr<Glib::Bytes> wrap(GBytes* object, bool take_copy = false);
} // namespace Glib
#endif /* _GLIBMM_BYTES_H */
|