MPLABĀ® Harmony Graphics Suite
legato_fixedstring.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
30 #ifndef LEGATO_FIXEDSTRING_H
31 #define LEGATO_FIXEDSTRING_H
32 
34 struct leFixedString;
38 #define LE_FIXEDSTRING_VTABLE(THIS_TYPE) \
39  LE_STRING_VTABLE(THIS_TYPE) \
40  \
41  leResult (*setBuffer)(THIS_TYPE* str, leChar* buf, uint32_t size); \
42 
43 typedef struct leFixedStringVTable
44 {
45  LE_FIXEDSTRING_VTABLE(struct leFixedString)
46 } leFixedStringVTable;
56 typedef struct leFixedString
57 {
59  const leFixedStringVTable* fn;
61  uint16_t capacity;
62  uint16_t length;
63  const leFont* font;
65 
66 // *****************************************************************************
80 LIB_EXPORT leFixedString* leFixedString_New(leChar* buf,
81  uint32_t size);
82 
83 // *****************************************************************************
97 LIB_EXPORT void leFixedString_Constructor(leFixedString* str,
98  leChar* buf,
99  uint32_t size);
100 
101 // *****************************************************************************
102 
103 #ifdef _DOXYGEN_
104 #define THIS_TYPE struct leWidget
105 
106 // *****************************************************************************
123  leChar* buf,
124  uint32_t size);
125 
126 #undef THIS_TYPE
127 #endif
128 
129 
130 #endif /* LEGATO_FIXEDSTRING_H */
getCharIndexAtPoint
virtual leResult getCharIndexAtPoint(const leString *_this, const lePoint *pt, uint32_t *idx)
Get character index at point.
setFromString
virtual leResult setFromString(leString *_this, const struct leString *src)
Set string value from another string.
remove
virtual leResult remove(leString *_this, uint32_t idx, uint32_t count)
Remove substring.
leFixedString::base
leString base
Definition: legato_fixedstring.h:58
legato_error.h
Error functions, macros and definitions.
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
getLineIndices
virtual leResult getLineIndices(const leString *_this, uint32_t line, uint32_t *start, uint32_t *end)
Get indices of a string line.
leFixedString
struct leFixedString leFixedString
This struct represents a fixed string.
legato_memory.h
Memory functions and definitions.
leHAlignment
leHAlignment
This enum represents the horizontal alignment mode of objects.
Definition: legato_common.h:206
getLineCount
uint32_t getLineCount(const leString *_this)
Get number of lines in the string.
preinvalidate
virtual void preinvalidate(leString *_this)
Raise pre-invalidate event.
leFixedString_Constructor
LIB_EXPORT void leFixedString_Constructor(leFixedString *str, leChar *buf, uint32_t size)
Consructs a fixed string.
Definition: legato_fixedstring.c:42
leFixedString_New
LIB_EXPORT leFixedString * leFixedString_New(leChar *buf, uint32_t size)
Create a new fixed string.
Definition: legato_fixedstring.c:60
leFont
This struct represents a font object.
Definition: legato_font.h:136
leStringVTable
Definition: legato_string.h:98
leString
This struct represents a string.
Definition: legato_string.h:108
setFromChar
virtual leResult setFromChar(leString *_this, const leChar *buf, uint32_t size)
Set string value from a leChar buffer.
charAt
virtual leChar charAt(const leString *_this, uint32_t idx)
Get codepoint at the given index.
setPreInvalidateCallback
virtual leResult setPreInvalidateCallback(leString *_this, leString_InvalidateCallback, void *userData)
Set string invalidate event.
leFixedString::font
const leFont * font
Definition: legato_fixedstring.h:63
leFixedString::fn
const leFixedStringVTable * fn
Definition: legato_fixedstring.h:59
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
leFixedString::capacity
uint16_t capacity
Definition: legato_fixedstring.h:61
length
virtual uint32_t length(const leString *_this)
Get length of the string.
setFont
virtual leResult setFont(leString *_this, const leFont *font)
Set font.
insert
virtual leResult insert(leString *_this, const struct leString *val, uint32_t idx)
Insert string at a given index.
setBuffer
virtual leResult setBuffer(leFixedString *_this, leChar *buf, uint32_t size)
Set capacity of the dynamic string.
legato_string.h
Fixed string functions and definitions.
compare
virtual int32_t compare(const leString *_this, const struct leString *tgt)
Compare string to another string.
leFixedString::data
leChar * data
Definition: legato_fixedstring.h:60
leFixedString
This struct represents a fixed string.
Definition: legato_fixedstring.h:57
leChar
uint16_t leChar
This typedef represents Legato character.
Definition: legato_common.h:424
toChar
virtual uint32_t toChar(const leString *_this, leChar *buf, uint32_t size)
Convert string to a C-style string.
getFont
virtual leFont * getFont(const leString *_this)
Get font.
legato_fixedstring.h
Fixed string functions and definitions.
isEmpty
virtual leBool isEmpty(const leString *_this)
Determine if string is empty.
append
virtual leResult append(leString *_this, const struct leString *val)
Append string.
clear
virtual void clear(leString *_this)
Clear string.
leString::fn
const leStringVTable * fn
Definition: legato_string.h:109
destructor
virtual void destructor(leString *_this)
Destruct string.
leFixedString::length
uint16_t length
Definition: legato_fixedstring.h:62
setFromCStr
virtual leResult setFromCStr(leString *_this, const char *cstr)
Set string value from a C string buffer.
lePoint
This structure represents a integer Cartesian point.
Definition: legato_common.h:357