Contains the public fields of a GByteArray. Adds the given bytes to the end of the `ByteArray`. The array will grow in size automatically if necessary. ## `array` a `ByteArray` ## `data` the byte data to be added ## `len` the number of bytes to add # Returns the `ByteArray` Frees the memory allocated by the `ByteArray`. If `free_segment` is `true` it frees the actual byte data. If the reference count of `array` is greater than one, the `ByteArray` wrapper is preserved but the size of `array` will be set to zero. ## `array` a `ByteArray` ## `free_segment` if `true` the actual byte data is freed as well # Returns the element data if `free_segment` is `false`, otherwise `None`. The element data should be freed using `g_free`. Transfers the data from the `ByteArray` into a new immutable `Bytes`. The `ByteArray` is freed unless the reference count of `array` is greater than one, the `ByteArray` wrapper is preserved but the size of `array` will be set to zero. This is identical to using `Bytes::new_take` and `ByteArray::free` together. ## `array` a `ByteArray` # Returns a new immutable `Bytes` representing same byte data that was in the array Creates a new `ByteArray` with a reference count of 1. # Returns the new `ByteArray` Create byte array containing the data. The data will be owned by the array and will be freed with `g_free`, i.e. it could be allocated using `g_strdup`. ## `data` byte data for the array ## `len` length of `data` # Returns a new `ByteArray` Adds the given data to the start of the `ByteArray`. The array will grow in size automatically if necessary. ## `array` a `ByteArray` ## `data` the byte data to be added ## `len` the number of bytes to add # Returns the `ByteArray` Atomically increments the reference count of `array` by one. This function is thread-safe and may be called from any thread. ## `array` A `ByteArray` # Returns The passed in `ByteArray` Removes the byte at the given index from a `ByteArray`. The following bytes are moved down one place. ## `array` a `ByteArray` ## `index_` the index of the byte to remove # Returns the `ByteArray` Removes the byte at the given index from a `ByteArray`. The last element in the array is used to fill in the space, so this function does not preserve the order of the `ByteArray`. But it is faster than `ByteArray::remove_index`. ## `array` a `ByteArray` ## `index_` the index of the byte to remove # Returns the `ByteArray` Removes the given number of bytes starting at the given index from a `ByteArray`. The following elements are moved to close the gap. ## `array` a `ByteArray` ## `index_` the index of the first byte to remove ## `length` the number of bytes to remove # Returns the `ByteArray` Sets the size of the `ByteArray`, expanding it if necessary. ## `array` a `ByteArray` ## `length` the new size of the `ByteArray` # Returns the `ByteArray` Creates a new `ByteArray` with `reserved_size` bytes preallocated. This avoids frequent reallocation, if you are going to add many bytes to the array. Note however that the size of the array is still 0. ## `reserved_size` number of bytes preallocated # Returns the new `ByteArray` Sorts a byte array, using `compare_func` which should be a `qsort`-style comparison function (returns less than zero for first arg is less than second arg, zero for equal, greater than zero if first arg is greater than second arg). If two array elements compare equal, their order in the sorted array is undefined. If you want equal elements to keep their order (i.e. you want a stable sort) you can write a comparison function that, if two elements would otherwise compare equal, compares them by their addresses. ## `array` a `ByteArray` ## `compare_func` comparison function Like `ByteArray::sort`, but the comparison function takes an extra user data argument. ## `array` a `ByteArray` ## `compare_func` comparison function ## `user_data` data to pass to `compare_func` Atomically decrements the reference count of `array` by one. If the reference count drops to 0, all memory allocated by the array is released. This function is thread-safe and may be called from any thread. ## `array` A `ByteArray` A simple refcounted data type representing an immutable sequence of zero or more bytes from an unspecified origin. The purpose of a `Bytes` 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` without coordinating their activities, resting assured that the byte data will not change or move while they hold a reference. A `Bytes` 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 `MappedFile` or memory from other allocators. `Bytes` work well as keys in `HashTable`. Use `Bytes::equal` and `Bytes::hash` as parameters to `HashTable::new` or `HashTable::new_full`. `Bytes` can also be used as keys in a `Tree` by passing the `Bytes::compare` function to `Tree::new`. The data pointed to by this bytes must not be modified. For a mutable array of bytes see `ByteArray`. Use `Bytes::unref_to_array` to create a mutable array for a `Bytes` sequence. To create an immutable `Bytes` from a mutable `ByteArray`, use the `ByteArray::free_to_bytes` function. Creates a new `Bytes` from `data`. `data` is copied. If `size` is 0, `data` may be `None`. ## `data` the data to be used for the bytes ## `size` the size of `data` # Returns a new `Bytes` Creates a new `Bytes` from static data. `data` must be static (ie: never modified or freed). It may be `None` if `size` is 0. ## `data` the data to be used for the bytes ## `size` the size of `data` # Returns a new `Bytes` Creates a new `Bytes` from `data`. After this call, `data` belongs to the bytes and may no longer be modified by the caller. `g_free` will be called on `data` when the bytes is no longer in use. Because of this `data` must have been created by a call to `g_malloc`, `g_malloc0` or `g_realloc` or by one of the many functions that wrap these calls (such as `g_new`, `g_strdup`, etc). For creating `Bytes` with memory from other allocators, see `Bytes::new_with_free_func`. `data` may be `None` if `size` is 0. ## `data` the data to be used for the bytes ## `size` the size of `data` # Returns a new `Bytes` Creates a `Bytes` from `data`. When the last reference is dropped, `free_func` will be called with the `user_data` argument. `data` must not be modified after this call is made until `free_func` has been called to indicate that the bytes is no longer in use. `data` may be `None` if `size` is 0. ## `data` the data to be used for the bytes ## `size` the size of `data` ## `free_func` the function to call to release the data ## `user_data` data to pass to `free_func` # Returns a new `Bytes` Compares the two `Bytes` values. This function can be used to sort GBytes instances in lexicographical order. If `self` and `bytes2` have different length but the shorter one is a prefix of the longer one then the shorter one is considered to be less than the longer one. Otherwise the first byte where both differ is used for comparison. If `self` has a smaller value at that position it is considered less, otherwise greater than `bytes2`. ## `bytes2` a pointer to a `Bytes` to compare with `self` # Returns a negative value if `self` is less than `bytes2`, a positive value if `self` is greater than `bytes2`, and zero if `self` is equal to `bytes2` Compares the two `Bytes` values being pointed to and returns `true` if they are equal. This function can be passed to `HashTable::new` as the `key_equal_func` parameter, when using non-`None` `Bytes` pointers as keys in a `HashTable`. ## `bytes2` a pointer to a `Bytes` to compare with `self` # Returns `true` if the two keys match. 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`. `None` may be returned if `size` is 0. This is not guaranteed, as the `Bytes` may represent an empty string with `data` non-`None` and `size` as 0. `None` will not be returned if `size` is non-zero. ## `size` location to return size of byte data # Returns a pointer to the byte data, or `None` Get the size of the byte data in the `Bytes`. This function will always return the same value for a given `Bytes`. # Returns the size Creates an integer hash code for the byte data in the `Bytes`. This function can be passed to `HashTable::new` as the `key_hash_func` parameter, when using non-`None` `Bytes` pointers as keys in a `HashTable`. # Returns a hash value corresponding to the key. Creates a `Bytes` which is a subsection of another `Bytes`. The `offset` + `length` may not be longer than the size of `self`. A reference to `self` will be held by the newly created `Bytes` until the byte data is no longer needed. Since 2.56, if `offset` is 0 and `length` matches the size of `self`, then `self` will be returned with the reference count incremented by 1. If `self` is a slice of another `Bytes`, then the resulting `Bytes` will reference the same `Bytes` instead of `self`. This allows consumers to simplify the usage of `Bytes` when asynchronously writing to streams. ## `offset` offset which subsection starts at ## `length` length of subsection # Returns a new `Bytes` Increase the reference count on `self`. # Returns the `Bytes` Releases a reference on `self`. This may result in the bytes being freed. If `self` is `None`, it will return immediately. Unreferences the bytes, and returns a new mutable `ByteArray` containing the same byte data. As an optimization, the byte data is transferred to the array without copying if this was the last reference to bytes and bytes was created with `Bytes::new`, `Bytes::new_take` or `ByteArray::free_to_bytes`. In all other cases the data is copied. # Returns a new mutable `ByteArray` containing the same byte data Unreferences the bytes, and returns a pointer the same byte data contents. As an optimization, the byte data is returned without copying if this was the last reference to bytes and bytes was created with `Bytes::new`, `Bytes::new_take` or `ByteArray::free_to_bytes`. In all other cases the data is copied. ## `size` location to place the length of the returned data # Returns a pointer to the same byte data, which should be freed with `g_free` An opaque structure representing a checksumming operation. To create a new GChecksum, use `Checksum::new`. To free a GChecksum, use `Checksum::free`. Creates a new `Checksum`, using the checksum algorithm `checksum_type`. If the `checksum_type` is not known, `None` is returned. A `Checksum` can be used to compute the checksum, or digest, of an arbitrary binary blob, using different hashing algorithms. A `Checksum` works by feeding a binary blob through `Checksum::update` until there is data to be checked; the digest can then be extracted using `Checksum::get_string`, which will return the checksum as a hexadecimal string; or `Checksum::get_digest`, which will return a vector of raw bytes. Once either `Checksum::get_string` or `Checksum::get_digest` have been called on a `Checksum`, the checksum will be closed and it won't be possible to call `Checksum::update` on it anymore. ## `checksum_type` the desired type of checksum # Returns the newly created `Checksum`, or `None`. Use `Checksum::free` to free the memory allocated by it. Copies a `Checksum`. If `self` has been closed, by calling `Checksum::get_string` or `Checksum::get_digest`, the copied checksum will be closed as well. # Returns the copy of the passed `Checksum`. Use `Checksum::free` when finished using it. Frees the memory allocated for `self`. Gets the digest from `self` as a raw binary vector and places it into `buffer`. The size of the digest depends on the type of checksum. Once this function has been called, the `Checksum` is closed and can no longer be updated with `Checksum::update`. ## `buffer` output buffer ## `digest_len` an inout parameter. The caller initializes it to the size of `buffer`. After the call it contains the length of the digest. Gets the digest as an hexadecimal string. Once this function has been called the `Checksum` can no longer be updated with `Checksum::update`. The hexadecimal characters will be lower case. # Returns the hexadecimal representation of the checksum. The returned string is owned by the checksum and should not be modified or freed. Resets the state of the `self` back to its initial state. Feeds `data` into an existing `Checksum`. The checksum must still be open, that is `Checksum::get_string` or `Checksum::get_digest` must not have been called on `self`. ## `data` buffer used to compute the checksum ## `length` size of the buffer, or -1 if it is a null-terminated string. Gets the length in bytes of digests of type `checksum_type` ## `checksum_type` a `ChecksumType` # Returns the checksum length, or -1 if `checksum_type` is not supported. The hashing algorithm to be used by `Checksum` when performing the digest of some data. Note that the `ChecksumType` enumeration may be extended at a later date to include new hashing algorithm types. Use the MD5 hashing algorithm Use the SHA-1 hashing algorithm Use the SHA-256 hashing algorithm Use the SHA-512 hashing algorithm (Since: 2.36) Use the SHA-384 hashing algorithm (Since: 2.51) Enumeration representing a month; values are `DateMonth::January`, `DateMonth::February`, etc. `DateMonth::BadMonth` is the invalid value. invalid value January February March April May June July August September October November December `GDateTime` is an opaque structure whose members cannot be accessed directly. Creates a new `DateTime` corresponding to the given date and time in the time zone `tz`. The `year` must be between 1 and 9999, `month` between 1 and 12 and `day` between 1 and 28, 29, 30 or 31 depending on the month and the year. `hour` must be between 0 and 23 and `minute` must be between 0 and 59. `seconds` must be at least 0.0 and must be strictly less than 60.0. It will be rounded down to the nearest microsecond. If the given time is not representable in the given time zone (for example, 02:30 on March 14th 2010 in Toronto, due to daylight savings time) then the time will be rounded up to the nearest existing time (in this case, 03:00). If this matters to you then you should verify the return value for containing the same as the numbers you gave. In the case that the given time is ambiguous in the given time zone (for example, 01:30 on November 7th 2010 in Toronto, due to daylight savings time) then the time falling within standard (ie: non-daylight) time is taken. It not considered a programmer error for the values to this function to be out of range, but in the case that they are, the function will return `None`. You should release the return value by calling `DateTime::unref` when you are done with it. ## `tz` a `TimeZone` ## `year` the year component of the date ## `month` the month component of the date ## `day` the day component of the date ## `hour` the hour component of the date ## `minute` the minute component of the date ## `seconds` the number of seconds past the minute # Returns a new `DateTime`, or `None` Creates a `DateTime` corresponding to the given [ISO 8601 formatted string](https://en.wikipedia.org/wiki/ISO_8601) `text`. ISO 8601 strings of the form `````