Add FcPatternGetWithBinding() to obtain the binding type of the value in FcPattern.
https://bugs.freedesktop.org/show_bug.cgi?id=19375
This commit is contained in:
parent
01085e0785
commit
ee2000494c
|
@ -198,6 +198,23 @@ any existing list of values.
|
||||||
<function>FcPatternAddRange</function> are available since 2.11.91.
|
<function>FcPatternAddRange</function> are available since 2.11.91.
|
||||||
@@
|
@@
|
||||||
|
|
||||||
|
@RET@ FcResult
|
||||||
|
@FUNC@ FcPatternGetWithBinding
|
||||||
|
@TYPE1@ FcPattern * @ARG1@ p
|
||||||
|
@TYPE2@ const char * @ARG2@ object
|
||||||
|
@TYPE3@ int% @ARG3@ id
|
||||||
|
@TYPE4@ FcValue * @ARG4@ v
|
||||||
|
@TYPE5@ FcValueBinding * @ARG5@ b
|
||||||
|
@PURPOSE@ Return a value with binding from a pattern
|
||||||
|
@DESC@
|
||||||
|
Returns in <parameter>v</parameter> the <parameter>id</parameter>'th value
|
||||||
|
and <parameter>b</parameter> binding for that associated with the property
|
||||||
|
<parameter>object</parameter>.
|
||||||
|
The Value returned is not a copy, but rather refers to the data stored
|
||||||
|
within the pattern directly. Applications must not free this value.
|
||||||
|
@SINCE@ 2.13.0
|
||||||
|
@@
|
||||||
|
|
||||||
@RET@ FcResult
|
@RET@ FcResult
|
||||||
@FUNC@ FcPatternGet
|
@FUNC@ FcPatternGet
|
||||||
@TYPE1@ FcPattern * @ARG1@ p
|
@TYPE1@ FcPattern * @ARG1@ p
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||||
#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0)))
|
#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0)))
|
||||||
|
@ -236,6 +237,12 @@ typedef enum _FcResult {
|
||||||
FcResultOutOfMemory
|
FcResultOutOfMemory
|
||||||
} FcResult;
|
} FcResult;
|
||||||
|
|
||||||
|
typedef enum _FcValueBinding {
|
||||||
|
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
|
||||||
|
/* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
|
||||||
|
FcValueBindingEnd = INT_MAX
|
||||||
|
} FcValueBinding;
|
||||||
|
|
||||||
typedef struct _FcPattern FcPattern;
|
typedef struct _FcPattern FcPattern;
|
||||||
|
|
||||||
typedef struct _FcLangSet FcLangSet;
|
typedef struct _FcLangSet FcLangSet;
|
||||||
|
@ -837,7 +844,10 @@ FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append
|
||||||
|
|
||||||
FcPublic FcResult
|
FcPublic FcResult
|
||||||
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v);
|
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v);
|
||||||
|
|
||||||
|
FcPublic FcResult
|
||||||
|
FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b);
|
||||||
|
|
||||||
FcPublic FcBool
|
FcPublic FcBool
|
||||||
FcPatternDel (FcPattern *p, const char *object);
|
FcPatternDel (FcPattern *p, const char *object);
|
||||||
|
|
||||||
|
|
|
@ -116,12 +116,6 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
|
||||||
|
|
||||||
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
|
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
|
||||||
|
|
||||||
typedef enum _FcValueBinding {
|
|
||||||
FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
|
|
||||||
/* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
|
|
||||||
FcValueBindingEnd = INT_MAX
|
|
||||||
} FcValueBinding;
|
|
||||||
|
|
||||||
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
|
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
|
||||||
#define FcFree(s) (free ((FcChar8 *) (s)))
|
#define FcFree(s) (free ((FcChar8 *) (s)))
|
||||||
|
|
||||||
|
@ -999,6 +993,9 @@ FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append)
|
||||||
FcPrivate FcBool
|
FcPrivate FcBool
|
||||||
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
|
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
|
||||||
|
|
||||||
|
FcPrivate FcResult
|
||||||
|
FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b);
|
||||||
|
|
||||||
FcPrivate FcResult
|
FcPrivate FcResult
|
||||||
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
|
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
|
||||||
|
|
||||||
|
|
18
src/fcpat.c
18
src/fcpat.c
|
@ -883,7 +883,7 @@ FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
|
FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b)
|
||||||
{
|
{
|
||||||
FcPatternElt *e;
|
FcPatternElt *e;
|
||||||
FcValueListPtr l;
|
FcValueListPtr l;
|
||||||
|
@ -898,6 +898,8 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
|
||||||
if (!id)
|
if (!id)
|
||||||
{
|
{
|
||||||
*v = FcValueCanonicalize(&l->value);
|
*v = FcValueCanonicalize(&l->value);
|
||||||
|
if (b)
|
||||||
|
*b = l->binding;
|
||||||
return FcResultMatch;
|
return FcResultMatch;
|
||||||
}
|
}
|
||||||
id--;
|
id--;
|
||||||
|
@ -905,10 +907,22 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
|
||||||
return FcResultNoId;
|
return FcResultNoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FcResult
|
||||||
|
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
|
||||||
|
{
|
||||||
|
return FcPatternObjectGetWithBinding (p, object, id, v, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
FcResult
|
||||||
|
FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b)
|
||||||
|
{
|
||||||
|
return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, b);
|
||||||
|
}
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v)
|
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v)
|
||||||
{
|
{
|
||||||
return FcPatternObjectGet (p, FcObjectFromName (object), id, v);
|
return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FcResult
|
FcResult
|
||||||
|
|
Loading…
Reference in New Issue