Synced const-correctness in ui_attrstr.h to attrstr.c, propagated that to the necessary private functions, and added some references to testing.h.
This commit is contained in:
parent
77c07075e3
commit
9c8f6849c3
|
@ -43,6 +43,10 @@ extern "C" {
|
||||||
static inline void testingprivScaffold ## name(testingT *t) { name(t); }
|
static inline void testingprivScaffold ## name(testingT *t) { name(t); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// references:
|
||||||
|
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h
|
||||||
|
// - https://gitlab.gnome.org/GNOME/glib/blob/master/gio/glib-compile-resources.c
|
||||||
|
// - https://msdn.microsoft.com/en-us/library/bb918180.aspx
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define testingprivMkCtor(name, reg) \
|
#define testingprivMkCtor(name, reg) \
|
||||||
static reg ## Class testingprivCtor ## name(#name, testingprivScaffold ## name);
|
static reg ## Class testingprivCtor ## name(#name, testingprivScaffold ## name);
|
||||||
|
|
|
@ -598,7 +598,7 @@ void uiprivAttrListRemoveCharacters(uiprivAttrList *alist, size_t start, size_t
|
||||||
a = attrDeleteRange(alist, a, start, end);
|
a = attrDeleteRange(alist, a, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiprivAttrListForEach(uiprivAttrList *alist, uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
void uiprivAttrListForEach(const uiprivAttrList *alist, const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
||||||
{
|
{
|
||||||
struct attr *a;
|
struct attr *a;
|
||||||
uiForEach ret;
|
uiForEach ret;
|
||||||
|
|
|
@ -279,6 +279,17 @@ void uiAttributedStringDelete(uiAttributedString *s, size_t start, size_t end)
|
||||||
resize(s, start + count, start16 + count16);
|
resize(s, start + count, start16 + count16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiAttributedStringSetAttribute(uiAttributedString *s, uiAttributeSpec *spec, size_t start, size_t end)
|
||||||
|
{
|
||||||
|
uiprivAttrListInsertAttribute(s->attrs, spec, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// LONGTERM introduce an iterator object instead?
|
||||||
|
void uiAttributedStringForEachAttribute(const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
||||||
|
{
|
||||||
|
uiprivAttrListForEach(s->attrs, s, f, data);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO figure out if we should count the grapheme past the end
|
// TODO figure out if we should count the grapheme past the end
|
||||||
size_t uiAttributedStringNumGraphemes(uiAttributedString *s)
|
size_t uiAttributedStringNumGraphemes(uiAttributedString *s)
|
||||||
{
|
{
|
||||||
|
@ -303,17 +314,6 @@ size_t uiAttributedStringGraphemeToByteIndex(uiAttributedString *s, size_t pos)
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiAttributedStringSetAttribute(uiAttributedString *s, uiAttributeSpec *spec, size_t start, size_t end)
|
|
||||||
{
|
|
||||||
uiprivAttrListInsertAttribute(s->attrs, spec, start, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LONGTERM introduce an iterator object instead?
|
|
||||||
void uiAttributedStringForEachAttribute(uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data)
|
|
||||||
{
|
|
||||||
uiprivAttrListForEach(s->attrs, s, f, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// helpers for platform-specific code
|
// helpers for platform-specific code
|
||||||
|
|
||||||
const uint16_t *uiprivAttributedStringUTF16String(uiAttributedString *s)
|
const uint16_t *uiprivAttributedStringUTF16String(uiAttributedString *s)
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern void uiprivAttrListInsertCharactersExtendingAttributes(uiprivAttrList *al
|
||||||
extern void uiprivAttrListRemoveAttribute(uiprivAttrList *alist, uiAttribute type, size_t start, size_t end);
|
extern void uiprivAttrListRemoveAttribute(uiprivAttrList *alist, uiAttribute type, size_t start, size_t end);
|
||||||
extern void uiprivAttrListRemoveAttributes(uiprivAttrList *alist, size_t start, size_t end);
|
extern void uiprivAttrListRemoveAttributes(uiprivAttrList *alist, size_t start, size_t end);
|
||||||
extern void uiprivAttrListRemoveCharacters(uiprivAttrList *alist, size_t start, size_t end);
|
extern void uiprivAttrListRemoveCharacters(uiprivAttrList *alist, size_t start, size_t end);
|
||||||
extern void uiprivAttrListForEach(uiprivAttrList *alist, uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data);
|
extern void uiprivAttrListForEach(const uiprivAttrList *alist, const uiAttributedString *s, uiAttributedStringForEachAttributeFunc f, void *data);
|
||||||
|
|
||||||
// attrstr.c
|
// attrstr.c
|
||||||
extern const uint16_t *uiprivAttributedStringUTF16String(uiAttributedString *s);
|
extern const uint16_t *uiprivAttributedStringUTF16String(uiAttributedString *s);
|
||||||
|
|
Loading…
Reference in New Issue