Skip to content

Commit

Permalink
Add al_ref_info to convert ALLEGRO_USTR_INFO to ALLEGRO_USTR.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Jun 22, 2024
1 parent 92a78be commit a3f2ec0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
15 changes: 13 additions & 2 deletions docs/src/refman/utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ NULs.
### API: ALLEGRO_USTR_INFO

A type that holds additional information for an [ALLEGRO_USTR] that references
an external memory buffer.
an external memory buffer. You can convert it back to [ALLEGRO_USTR] via
[al_ref_info].

See also: [al_ref_cstr], [al_ref_buffer] and [al_ref_ustr].
See also: [al_ref_cstr], [al_ref_buffer], [al_ref_info] and [al_ref_ustr].


## Creating and destroying strings
Expand Down Expand Up @@ -269,6 +270,16 @@ to find the byte offsets.
See also: [al_ref_cstr], [al_ref_buffer]


### API: al_ref_info

Create a read-only string that references the storage of another [ALLEGRO_USTR]
string that has already been stored in the [ALLEGRO_USTR_INFO] structure.

The string is valid until the underlying string is modified or destroyed.

See also: [al_ref_cstr], [al_ref_buffer], [al_ref_ustr]


## Sizes and offsets

### API: al_ustr_size
Expand Down
1 change: 1 addition & 0 deletions include/allegro5/utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ AL_FUNC(const ALLEGRO_USTR *, al_ref_buffer, (ALLEGRO_USTR_INFO *info, const cha
size_t size));
AL_FUNC(const ALLEGRO_USTR *, al_ref_ustr, (ALLEGRO_USTR_INFO *info,
const ALLEGRO_USTR *us, int start_pos, int end_pos));
AL_FUNC(const ALLEGRO_USTR *, al_ref_info, (const ALLEGRO_USTR_INFO *info));

/* Sizes and offsets */
AL_FUNC(size_t, al_ustr_size, (const ALLEGRO_USTR *us));
Expand Down
7 changes: 7 additions & 0 deletions src/utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ const ALLEGRO_USTR *al_ref_ustr(ALLEGRO_USTR_INFO *info, const ALLEGRO_USTR *us,
}


/* Function: al_ref_info
*/
const ALLEGRO_USTR *al_ref_info(const ALLEGRO_USTR_INFO *info)
{
return info;
}

/* Function: al_ustr_size
*/
size_t al_ustr_size(const ALLEGRO_USTR *us)
Expand Down

0 comments on commit a3f2ec0

Please sign in to comment.