MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_stringutils.h File Reference

String utility functions and definitions. More...

Include dependency graph for legato_stringutils.h:

Go to the source code of this file.

Functions

uint32_t leStringUtils_FromCStr (const char *str, leChar *buf, uint32_t size)
 Convert c-style string to leChar. More...
 
uint32_t leStringUtils_ToCStr (const leChar *str, uint32_t strSize, char *buf, uint32_t bufSize)
 Convert leChar buffer to C-style string. More...
 
leResult leStringUtils_GetRect (const leChar *str, uint32_t size, const leFont *font, leRect *rect)
 Get bounding rectangle for a leChar style string. More...
 
leResult leStringUtils_GetRectCStr (const char *str, const leFont *font, leRect *rect)
 Gets the bounding rectangle for a C-style string. More...
 
uint32_t leStringUtils_GetLineCount (const leChar *str, uint32_t size)
 Get line count for a leChar style string. More...
 
uint32_t leStringUtils_GetLineCountCStr (const char *str)
 Get line count for a C-style string. More...
 
leResult leStringUtils_GetLineIndices (const leChar *str, uint32_t size, uint32_t line, uint32_t *start, uint32_t *end)
 Get line indices for a leChar style string. More...
 
leResult leStringUtils_GetLineIndicesCStr (const char *str, uint32_t line, uint32_t *start, uint32_t *end)
 Gets the line indices for a C-style string. More...
 
leResult leStringUtils_GetLineRect (const leChar *str, uint32_t size, const leFont *font, uint32_t line, leRect *rect)
 Gets the line bounding rectangle for a leChar style string. More...
 
leResult leStringUtils_GetLineRectCStr (const char *str, const leFont *font, uint32_t line, leRect *rect)
 Gets the line bounding rectangle for a C-style string. More...
 
leResult leStringUtils_GetCharRect (const leChar *str, uint32_t size, const leFont *font, uint32_t charIdx, leRect *rect)
 Gets a glyph bounding rectangle for a leChar style string. More...
 
leResult leStringUtils_GetCharRectCStr (const char *str, const leFont *font, uint32_t charIdx, leRect *rect)
 Gets a glyph bounding rectangle for a C-style string. More...
 

Detailed Description

String utility functions and definitions.

This module implements various string utility functions..

Function Documentation

◆ leStringUtils_FromCStr()

uint32_t leStringUtils_FromCStr ( const char *  str,
leChar buf,
uint32_t  size 
)

Convert c-style string to leChar.

Converts up to size elements of c-style string str to buf.

const char* str;
leChar* buf;
uint32_t size;
uint32_t cp = leStringUtils_FromCStr(str, buf, size);
Parameters
stris the source C-style string.
bufthe destination leChar string.
sizeis the size of the destination string in leChar
Returns
returns the number of codepoints copied.

◆ leStringUtils_GetCharRect()

leResult leStringUtils_GetCharRect ( const leChar str,
uint32_t  size,
const leFont font,
uint32_t  charIdx,
leRect rect 
)

Gets a glyph bounding rectangle for a leChar style string.

Gets a glyph bounding rectangle for a leChar style string.

Parameters
stris an integer.
bufis an integer.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetCharRectCStr()

leResult leStringUtils_GetCharRectCStr ( const char *  str,
const leFont font,
uint32_t  charIdx,
leRect rect 
)

Gets a glyph bounding rectangle for a C-style string.

Gets a glyph bounding rectangle for a C-style string.

Parameters
stris an integer.
bufis an integer.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetLineCount()

uint32_t leStringUtils_GetLineCount ( const leChar str,
uint32_t  size 
)

Get line count for a leChar style string.

Gets the line count for str with size.

const leChar* str;
uint32_t size;
uint32_t res = leStringUtils_GetLineCount(str, size);
Parameters
stris an leChar string.
sizeis an integer.
Returns
the number of lines in the string.

◆ leStringUtils_GetLineCountCStr()

uint32_t leStringUtils_GetLineCountCStr ( const char *  str)

Get line count for a C-style string.

Gets the line count for str.

const char* str;
uint32_t res = leStringUtils_GetLineCountCStr(str);
Parameters
stris an integer.
Returns
the number of lines in the string.

◆ leStringUtils_GetLineIndices()

leResult leStringUtils_GetLineIndices ( const leChar str,
uint32_t  size,
uint32_t  line,
uint32_t *  start,
uint32_t *  end 
)

Get line indices for a leChar style string.

Gets the line indices for str with size at line from start to end .

const leChar* str;
uint32_t size;
uint32_t line;
uint32_t* start;
uint32_t* end;
uint32_t res = leStringUtils_GetLineIndices(str, size, line, start, end);
Parameters
stris an integer.
bufis an integer.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetLineIndicesCStr()

leResult leStringUtils_GetLineIndicesCStr ( const char *  str,
uint32_t  line,
uint32_t *  start,
uint32_t *  end 
)

Gets the line indices for a C-style string.

Gets the line indices for a C-style string.

Parameters
stris an integer.
bufis an integer.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetLineRect()

leResult leStringUtils_GetLineRect ( const leChar str,
uint32_t  size,
const leFont font,
uint32_t  line,
leRect rect 
)

Gets the line bounding rectangle for a leChar style string.

Gets the line bounding rectangle for a leChar style string.

leResult res = leStringUtils_GetLineRect(str, size, font, line, &rect);
Parameters
stris a string pointer.
sizeis the length of the string.
fontis the font object that provides the glyph metrics
lineis the line number to query
rectis the resulting bounding rect
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetLineRectCStr()

leResult leStringUtils_GetLineRectCStr ( const char *  str,
const leFont font,
uint32_t  line,
leRect rect 
)

Gets the line bounding rectangle for a C-style string.

Gets the line bounding rectangle for a C-style string.

Parameters
stris a C string pointer.
fontis the font object that provides the glyph metrics
lineis the line number to query
rectis the resulting bounding rect
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetRect()

leResult leStringUtils_GetRect ( const leChar str,
uint32_t  size,
const leFont font,
leRect rect 
)

Get bounding rectangle for a leChar style string.

Gets the bounding rect for up to size characters of str with font.

leResult res = leStringUtils_GetRect(str, size, font, rect);
Parameters
stris a string pointer.
sizeis the length of the string.
fontis the font object that provides the glyph metrics
rectis the resulting bounding area
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_GetRectCStr()

leResult leStringUtils_GetRectCStr ( const char *  str,
const leFont font,
leRect rect 
)

Gets the bounding rectangle for a C-style string.

Gets the bounding rect of str with font.

const char* str;
const leFont* font;
leRect* rect;
leResult res = leStringUtils_GetRectCStr(str, font, rect);
Parameters
stris a C string pointer.
fontis the font object that provides the glyph metrics
rectis the resulting bounding area
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leStringUtils_ToCStr()

uint32_t leStringUtils_ToCStr ( const leChar str,
uint32_t  strSize,
char *  buf,
uint32_t  bufSize 
)

Convert leChar buffer to C-style string.

Converts leChar buffer at most strSize of str to buf of size bufSize.

const leChar* str;
uint32_t strSize;
char* buf;
uint32_t bufSize;
uint32_t cp = leStringUtils_ToCStr(str, strSize, buf, size, bufSize);
Parameters
stris an integer.
bufis an integer.
Returns
the number of chars copied