diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenkernel/BKE_idprop.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenkernel/BKE_idprop.h')
-rw-r--r-- | source/blender/blenkernel/BKE_idprop.h | 158 |
1 files changed, 93 insertions, 65 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index c1901d6e15f..e6f3d7b4a99 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -33,33 +33,35 @@ struct ID; struct IDProperty; typedef union IDPropertyTemplate { - int i; - float f; - double d; - struct { - const char *str; - int len; - char subtype; - } string; - struct ID *id; - struct { - int len; - char type; - } array; - struct { - int matvec_size; - const float *example; - } matrix_or_vector; + int i; + float f; + double d; + struct { + const char *str; + int len; + char subtype; + } string; + struct ID *id; + struct { + int len; + char type; + } array; + struct { + int matvec_size; + const float *example; + } matrix_or_vector; } IDPropertyTemplate; /* ----------- Property Array Type ---------- */ IDProperty *IDP_NewIDPArray(const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); /* shallow copies item */ void IDP_SetIndexArray(struct IDProperty *prop, int index, struct IDProperty *item) ATTR_NONNULL(); -struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +struct IDProperty *IDP_GetIndexArray(struct IDProperty *prop, int index) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); void IDP_AppendArray(struct IDProperty *prop, struct IDProperty *item); void IDP_ResizeIDPArray(struct IDProperty *prop, int len); @@ -69,45 +71,68 @@ void IDP_ResizeArray(struct IDProperty *prop, int newlen); void IDP_FreeArray(struct IDProperty *prop); /* ---------- String Type ------------ */ -IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2 /* 'name 'arg */); /* maxlen excludes '\0' */ -void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen) ATTR_NONNULL(); /* maxlen excludes '\0' */ +IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(2 /* 'name 'arg */); /* maxlen excludes '\0' */ +void IDP_AssignString(struct IDProperty *prop, const char *st, int maxlen) + ATTR_NONNULL(); /* maxlen excludes '\0' */ void IDP_ConcatStringC(struct IDProperty *prop, const char *st) ATTR_NONNULL(); void IDP_ConcatString(struct IDProperty *str1, struct IDProperty *append) ATTR_NONNULL(); void IDP_FreeString(struct IDProperty *prop) ATTR_NONNULL(); /*-------- ID Type -------*/ -typedef void(*IDPWalkFunc)(void *userData, IDProperty *idp); +typedef void (*IDPWalkFunc)(void *userData, IDProperty *idp); /*-------- Group Functions -------*/ /** Sync values from one group to another, only where they match */ void IDP_SyncGroupValues(struct IDProperty *dest, const struct IDProperty *src) ATTR_NONNULL(); -void IDP_SyncGroupTypes(struct IDProperty *dest, const struct IDProperty *src, const bool do_arraylen) ATTR_NONNULL(); +void IDP_SyncGroupTypes(struct IDProperty *dest, + const struct IDProperty *src, + const bool do_arraylen) ATTR_NONNULL(); void IDP_ReplaceGroupInGroup(struct IDProperty *dest, const struct IDProperty *src) ATTR_NONNULL(); void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); -void IDP_ReplaceInGroup_ex(struct IDProperty *group, struct IDProperty *prop, struct IDProperty *prop_exist); -void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) ATTR_NONNULL(); -void IDP_MergeGroup_ex(IDProperty *dest, const IDProperty *src, const bool do_overwrite, const int flag) ATTR_NONNULL(); +void IDP_ReplaceInGroup_ex(struct IDProperty *group, + struct IDProperty *prop, + struct IDProperty *prop_exist); +void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) + ATTR_NONNULL(); +void IDP_MergeGroup_ex(IDProperty *dest, + const IDProperty *src, + const bool do_overwrite, + const int flag) ATTR_NONNULL(); bool IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); -bool IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous, - struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 /* pnew */); +bool IDP_InsertToGroup(struct IDProperty *group, + struct IDProperty *previous, + struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 /* pnew */); void IDP_RemoveFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); void IDP_FreeFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); -IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, + const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, + const char *name, + const char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /*-------- Main Functions --------*/ -struct IDProperty *IDP_GetProperties(struct ID *id, const bool create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -struct IDProperty *IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -struct IDProperty *IDP_CopyProperty_ex(const struct IDProperty *prop, const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +struct IDProperty *IDP_GetProperties(struct ID *id, + const bool create_if_needed) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); +struct IDProperty *IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); +struct IDProperty *IDP_CopyProperty_ex(const struct IDProperty *prop, + const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is_strict) ATTR_WARN_UNUSED_RESULT; +bool IDP_EqualsProperties_ex(IDProperty *prop1, + IDProperty *prop2, + const bool is_strict) ATTR_WARN_UNUSED_RESULT; -bool IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2) ATTR_WARN_UNUSED_RESULT; +bool IDP_EqualsProperties(struct IDProperty *prop1, + struct IDProperty *prop2) ATTR_WARN_UNUSED_RESULT; -struct IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +struct IDProperty *IDP_New(const char type, + const IDPropertyTemplate *val, + const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void IDP_FreeProperty_ex(struct IDProperty *prop, const bool do_id_user); void IDP_FreeProperty(struct IDProperty *prop); @@ -118,41 +143,44 @@ void IDP_RelinkProperty(struct IDProperty *prop); void IDP_Reset(IDProperty *prop, const IDProperty *reference); -#define IDP_Int(prop) ((prop)->data.val) -#define IDP_Array(prop) ((prop)->data.pointer) +#define IDP_Int(prop) ((prop)->data.val) +#define IDP_Array(prop) ((prop)->data.pointer) /* C11 const correctness for casts */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -# define IDP_Float(prop) _Generic((prop), \ - IDProperty *: (*(float *)&(prop)->data.val), \ - const IDProperty *: (*(const float *)&(prop)->data.val)) -# define IDP_Double(prop) _Generic((prop), \ - IDProperty *: (*(double *)&(prop)->data.val), \ - const IDProperty *: (*(const double *)&(prop)->data.val)) -# define IDP_String(prop) _Generic((prop), \ - IDProperty *: ((char *) (prop)->data.pointer), \ - const IDProperty *: ((const char *) (prop)->data.pointer)) -# define IDP_IDPArray(prop) _Generic((prop), \ - IDProperty *: ((IDProperty *) (prop)->data.pointer), \ - const IDProperty *: ((const IDProperty *) (prop)->data.pointer)) -# define IDP_Id(prop) _Generic((prop), \ - IDProperty *: ((ID *) (prop)->data.pointer), \ - const IDProperty *: ((const ID *) (prop)->data.pointer)) +# define IDP_Float(prop) \ + _Generic((prop), \ + IDProperty *: (*(float *)&(prop)->data.val), \ + const IDProperty *: (*(const float *)&(prop)->data.val)) +# define IDP_Double(prop) \ + _Generic((prop), \ + IDProperty *: (*(double *)&(prop)->data.val), \ + const IDProperty *: (*(const double *)&(prop)->data.val)) +# define IDP_String(prop) \ + _Generic((prop), \ + IDProperty *: ((char *) (prop)->data.pointer), \ + const IDProperty *: ((const char *) (prop)->data.pointer)) +# define IDP_IDPArray(prop) \ + _Generic((prop), \ + IDProperty *: ((IDProperty *) (prop)->data.pointer), \ + const IDProperty *: ((const IDProperty *) (prop)->data.pointer)) +# define IDP_Id(prop) \ + _Generic((prop), \ + IDProperty *: ((ID *) (prop)->data.pointer), \ + const IDProperty *: ((const ID *) (prop)->data.pointer)) #else -# define IDP_Float(prop) (*(float *)&(prop)->data.val) -# define IDP_Double(prop) (*(double *)&(prop)->data.val) -# define IDP_String(prop) ((char *) (prop)->data.pointer) -# define IDP_IDPArray(prop) ((IDProperty *) (prop)->data.pointer) -# define IDP_Id(prop) ((ID *) (prop)->data.pointer) +# define IDP_Float(prop) (*(float *)&(prop)->data.val) +# define IDP_Double(prop) (*(double *)&(prop)->data.val) +# define IDP_String(prop) ((char *)(prop)->data.pointer) +# define IDP_IDPArray(prop) ((IDProperty *)(prop)->data.pointer) +# define IDP_Id(prop) ((ID *)(prop)->data.pointer) #endif /* Format IDProperty as strings */ -char *IDP_reprN( - const struct IDProperty *prop, uint *r_len); -void IDP_repr_fn( - const IDProperty *prop, - void (*str_append_fn)(void *user_data, const char *str, uint str_len), - void *user_data); -void IDP_print(const struct IDProperty *prop); +char *IDP_reprN(const struct IDProperty *prop, uint *r_len); +void IDP_repr_fn(const IDProperty *prop, + void (*str_append_fn)(void *user_data, const char *str, uint str_len), + void *user_data); +void IDP_print(const struct IDProperty *prop); #ifdef __cplusplus } |