[docs] Document a few symbols
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 4 Sep 2013 22:28:39 +0000 (18:28 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 5 Sep 2013 20:40:32 +0000 (16:40 -0400)
src/hb-blob.cc
src/hb-buffer.cc
src/hb-version.h.in

index dfd134b..b312546 100644 (file)
@@ -76,6 +76,22 @@ _hb_blob_destroy_user_data (hb_blob_t *blob)
   }
 }
 
+/**
+ * hb_blob_create:
+ * @data: (array length=length) (allow-none): Pointer to blob data.
+ * @length: Length of @data in bytes.
+ * @mode: Memory mode for @data.
+ * @user_data: (allow-none): Data parameter to pass to @destroy.
+ * @destroy: (allow-none) (closure user_data): Callback to call when @data is not needed anymore.
+ *
+ * Creates a new "blob" object wrapping @data.  The @mode parameter is used
+ * to negotiate ownership and lifecycle of @data.
+ *
+ * Returns: New blob, or the empty blob if something failed or if @length is
+ * zero.  Destroy with hb_blob_destroy().
+ *
+ * Since: 1.0
+ **/
 hb_blob_t *
 hb_blob_create (const char        *data,
                unsigned int       length,
@@ -109,6 +125,26 @@ hb_blob_create (const char        *data,
   return blob;
 }
 
+/**
+ * hb_blob_create_sub_blob:
+ * @parent: Parent blob.
+ * @offset: Start offset of sub-blob within @parent, in bytes.
+ * @length: Length of sub-blob.
+ *
+ * Returns a blob that represents a range of bytes in @parent.  The new
+ * blob is always created with %HB_MEMORY_MODE_READONLY, meaning that it
+ * will never modify data in the parent blob.  The parent data is not
+ * expected to be modified, and will result in undefined behavior if it
+ * is.
+ *
+ * Makes @parent immutable.
+ *
+ * Returns: New blob, or the empty blob if something failed or if @length is
+ * zero or @offset is beyond the end of @parent's data.  Destroy with
+ * hb_blob_destroy().
+ *
+ * Since: 1.0
+ **/
 hb_blob_t *
 hb_blob_create_sub_blob (hb_blob_t    *parent,
                         unsigned int  offset,
@@ -130,6 +166,17 @@ hb_blob_create_sub_blob (hb_blob_t    *parent,
   return blob;
 }
 
+/**
+ * hb_blob_get_empty:
+ *
+ * Returns the singleton empty blob.
+ *
+ * See TODO:link object types for more information.
+ *
+ * Returns: The empty blob.
+ *
+ * Since: 1.0
+ **/
 hb_blob_t *
 hb_blob_get_empty (void)
 {
@@ -149,12 +196,36 @@ hb_blob_get_empty (void)
   return const_cast<hb_blob_t *> (&_hb_blob_nil);
 }
 
+/**
+ * hb_blob_reference:
+ * @blob: a blob.
+ *
+ * Increases the reference count on @blob.
+ *
+ * See TODO:link object types for more information.
+ *
+ * Returns: @blob.
+ *
+ * Since: 1.0
+ **/
 hb_blob_t *
 hb_blob_reference (hb_blob_t *blob)
 {
   return hb_object_reference (blob);
 }
 
+/**
+ * hb_blob_destroy:
+ * @blob: a blob.
+ *
+ * Descreases the reference count on @blob, and if it reaches zero, destroys
+ * @blob, freeing all memory, possibly calling the destroy-callback the blob
+ * was created for if it has not been called already.
+ *
+ * See TODO:link object types for more information.
+ *
+ * Since: 1.0
+ **/
 void
 hb_blob_destroy (hb_blob_t *blob)
 {
@@ -165,6 +236,22 @@ hb_blob_destroy (hb_blob_t *blob)
   free (blob);
 }
 
+/**
+ * hb_blob_set_user_data:
+ * @blob: a blob.
+ * @key: key for data to set.
+ * @data: data to set.
+ * @destroy: callback to call when @data is not needed anymore.
+ * @replace: whether to replace an existing data with the same key.
+ *
+ * Attaches a piece of data to the object.
+ *
+ * See TODO:link object types for more information.
+ *
+ * Returns: TODO
+ *
+ * Since: 1.0
+ **/
 hb_bool_t
 hb_blob_set_user_data (hb_blob_t          *blob,
                       hb_user_data_key_t *key,
@@ -175,6 +262,19 @@ hb_blob_set_user_data (hb_blob_t          *blob,
   return hb_object_set_user_data (blob, key, data, destroy, replace);
 }
 
+/**
+ * hb_blob_get_user_data:
+ * @blob: a blob.
+ * @key: key for data to get.
+ *
+ * TODO
+ *
+ * See TODO:link object types for more information.
+ *
+ * Returns: (transfer none): data, or TODO
+ *
+ * Since: 1.0
+ **/
 void *
 hb_blob_get_user_data (hb_blob_t          *blob,
                       hb_user_data_key_t *key)
@@ -183,6 +283,16 @@ hb_blob_get_user_data (hb_blob_t          *blob,
 }
 
 
+/**
+ * hb_blob_make_immutable:
+ * @blob: a blob.
+ *
+ * TODO
+ *
+ * See TODO:link object types for more information.
+ *
+ * Since: 1.0
+ **/
 void
 hb_blob_make_immutable (hb_blob_t *blob)
 {
@@ -192,6 +302,18 @@ hb_blob_make_immutable (hb_blob_t *blob)
   blob->immutable = true;
 }
 
+/**
+ * hb_blob_is_immutable:
+ * @blob: a blob.
+ *
+ * TODO
+ *
+ * See TODO:link object types for more information.
+ *
+ * Returns: TODO
+ *
+ * Since: 1.0
+ **/
 hb_bool_t
 hb_blob_is_immutable (hb_blob_t *blob)
 {
@@ -199,12 +321,33 @@ hb_blob_is_immutable (hb_blob_t *blob)
 }
 
 
+/**
+ * hb_blob_get_length:
+ * @blob: a blob.
+ *
+ * TODO
+ *
+ * Returns: the length of blob data in bytes.
+ *
+ * Since: 1.0
+ **/
 unsigned int
 hb_blob_get_length (hb_blob_t *blob)
 {
   return blob->length;
 }
 
+/**
+ * hb_blob_get_data:
+ * @blob: a blob.
+ * @length: (out) TODO
+ *
+ * TODO
+ *
+ * Returns: (transfer none): TODO
+ *
+ * Since: 1.0
+ **/
 const char *
 hb_blob_get_data (hb_blob_t *blob, unsigned int *length)
 {
@@ -214,6 +357,21 @@ hb_blob_get_data (hb_blob_t *blob, unsigned int *length)
   return blob->data;
 }
 
+/**
+ * hb_blob_get_data_writable:
+ * @blob: a blob.
+ * @length: (out): output length of the writable data.
+ *
+ * Tries to make blob data writable (possibly copying it) and
+ * return pointer to data.
+ *
+ * Fails if blob has been made immutable, or if memory allocation
+ * fails.
+ *
+ * Returns: (transfer none): Writable blob data, or %NULL if failed.
+ *
+ * Since: 1.0
+ **/
 char *
 hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
 {
@@ -324,5 +482,3 @@ _try_writable (hb_blob_t *blob)
 
   return true;
 }
-
-
index 340bd53..495e702 100644 (file)
@@ -853,13 +853,34 @@ hb_buffer_set_length (hb_buffer_t  *buffer,
   return true;
 }
 
+/**
+ * hb_buffer_get_length:
+ * @buffer: a buffer.
+ *
+ * Returns the number of items in the buffer.
+ *
+ * Return value: buffer length.
+ *
+ * Since: 1.0
+ */
 unsigned int
 hb_buffer_get_length (hb_buffer_t *buffer)
 {
   return buffer->len;
 }
 
-/* Return value valid as long as buffer not modified */
+/**
+ * hb_buffer_get_glyph_infos:
+ * @buffer: a buffer.
+ * @length: (out): output array length.
+ *
+ * Returns buffer glyph information array.  Returned pointer
+ * is valid as long as buffer contents are not modified.
+ *
+ * Return value: (transfer none) (array length=length): buffer glyph information array.
+ *
+ * Since: 1.0
+ */
 hb_glyph_info_t *
 hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
                            unsigned int *length)
@@ -870,7 +891,18 @@ hb_buffer_get_glyph_infos (hb_buffer_t  *buffer,
   return (hb_glyph_info_t *) buffer->info;
 }
 
-/* Return value valid as long as buffer not modified */
+/**
+ * hb_buffer_get_glyph_positions:
+ * @buffer: a buffer.
+ * @length: (out): output length.
+ *
+ * Returns buffer glyph position array.  Returned pointer
+ * is valid as long as buffer contents are not modified.
+ *
+ * Return value: (transfer none) (array length=length): buffer glyph position array.
+ *
+ * Since: 1.0
+ */
 hb_glyph_position_t *
 hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
                                unsigned int *length)
@@ -884,18 +916,60 @@ hb_buffer_get_glyph_positions (hb_buffer_t  *buffer,
   return (hb_glyph_position_t *) buffer->pos;
 }
 
+/**
+ * hb_buffer_reverse:
+ * @buffer: a buffer.
+ *
+ * Reverses buffer contents.
+ *
+ * Since: 1.0
+ */
 void
 hb_buffer_reverse (hb_buffer_t *buffer)
 {
   buffer->reverse ();
 }
 
+/**
+ * hb_buffer_reverse_clusters:
+ * @buffer: a buffer.
+ *
+ * Reverses buffer clusters.  That is, the buffer contents are
+ * reversed, then each cluster (consecutive items having the
+ * same cluster number) are reversed again.
+ *
+ * Since: 1.0
+ */
 void
 hb_buffer_reverse_clusters (hb_buffer_t *buffer)
 {
   buffer->reverse_clusters ();
 }
 
+/**
+ * hb_buffer_guess_segment_properties:
+ * @buffer: a buffer.
+ *
+ * Sets unset buffer segment properties based on buffer Unicode
+ * contents.  If buffer is not empty, it must have content type
+ * %HB_BUFFER_CONTENT_TYPE_UNICODE.
+ *
+ * If buffer script is not set (ie. is %HB_SCRIPT_INVALID), it
+ * will be set to the Unicode script of the first character in
+ * the buffer that has a script other than %HB_SCRIPT_COMMON,
+ * %HB_SCRIPT_INHERITED, and %HB_SCRIPT_UNKNOWN.
+ *
+ * Next, if buffer direction is not set (ie. is %HB_DIRECTION_INVALID),
+ * it will be set to the natural horizontal direction of the
+ * buffer script as returned by hb_script_get_horizontal_direction().
+ *
+ * Finally, if buffer language is not set (ie. is %HB_LANGUAGE_INVALID),
+ * it will be set to the process's default language as returned by
+ * hb_language_get_default().  This may change in the future by
+ * taking buffer script into consideration when choosing a language.
+ *
+ * Since: 1.0
+ */
 void
 hb_buffer_guess_segment_properties (hb_buffer_t *buffer)
 {
index 43634f9..c7e9d98 100644 (file)
@@ -47,11 +47,28 @@ HB_BEGIN_DECLS
         HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO)
 
 
+/**
+ * hb_version:
+ * @major: (out): Library major version component.
+ * @minor: (out): Library minor version component.
+ * @micro: (out): Library micro version component.
+ *
+ * Returns library version as three integer components.
+ *
+ * Since: 1.0
+ */
 void
 hb_version (unsigned int *major,
            unsigned int *minor,
            unsigned int *micro);
 
+/**
+ * hb_version_string:
+ *
+ * Returns library version as a string with three components.
+ *
+ * Since: 1.0
+ */
 const char *
 hb_version_string (void);