[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55545] trunk/blender/source/blender: code cleanup: move doxy docs from headers into source.

Campbell Barton ideasman42 at gmail.com
Sun Mar 24 02:51:55 CET 2013


Revision: 55545
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55545
Author:   campbellbarton
Date:     2013-03-24 01:51:54 +0000 (Sun, 24 Mar 2013)
Log Message:
-----------
code cleanup: move doxy docs from headers into source. also replace strncpy();str[len]=0 with BLI_strncpy() in BLI_stringdec().

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_idcode.h
    trunk/blender/source/blender/blenkernel/BKE_idprop.h
    trunk/blender/source/blender/blenkernel/intern/idcode.c
    trunk/blender/source/blender/blenkernel/intern/idprop.c
    trunk/blender/source/blender/blenlib/BLI_gsqueue.h
    trunk/blender/source/blender/blenlib/BLI_path_util.h
    trunk/blender/source/blender/blenlib/BLI_vfontdata.h
    trunk/blender/source/blender/blenlib/intern/freetypefont.c
    trunk/blender/source/blender/blenlib/intern/gsqueue.c
    trunk/blender/source/blender/blenlib/intern/path_util.c

Modified: trunk/blender/source/blender/blenkernel/BKE_idcode.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_idcode.h	2013-03-24 01:19:55 UTC (rev 55544)
+++ trunk/blender/source/blender/blenkernel/BKE_idcode.h	2013-03-24 01:51:54 UTC (rev 55545)
@@ -32,49 +32,13 @@
  *  \ingroup bke
  */
 
-/**
- * Convert an idcode into a name.
- * 
- * \param code The code to convert.
- * \return A static string representing the name of
- * the code.
- */
 const char *BKE_idcode_to_name(int code);
-
-/**
- * Convert an idcode into a name (plural).
- * 
- * \param code The code to convert.
- * \return A static string representing the name of
- * the code.
- */
 const char *BKE_idcode_to_name_plural(int code);
+int         BKE_idcode_from_name(const char *name);
+bool        BKE_idcode_is_linkable(int code);
+bool        BKE_idcode_is_valid(int code);
 
 /**
- * Convert a name into an idcode (ie. ID_SCE)
- * 
- * \param name The name to convert.
- * \return The code for the name, or 0 if invalid.
- */
-int BKE_idcode_from_name(const char *name);
-
-/**
- * Return non-zero when an ID type is linkable.
- * 
- * \param code The code to check.
- * \return Boolean, 0 when non linkable.
- */
-bool BKE_idcode_is_linkable(int code);
-
-/**
- * Return if the ID code is a valid ID code.
- * 
- * \param code The code to check.
- * \return Boolean, 0 when invalid.
- */
-bool BKE_idcode_is_valid(int code);
-
-/**
  * Return an ID code and steps the index forward 1.
  *
  * \param index start as 0.

Modified: trunk/blender/source/blender/blenkernel/BKE_idprop.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_idprop.h	2013-03-24 01:19:55 UTC (rev 55544)
+++ trunk/blender/source/blender/blenkernel/BKE_idprop.h	2013-03-24 01:51:54 UTC (rev 55545)
@@ -58,8 +58,6 @@
 
 /* ----------- Property Array Type ---------- */
 
-/* note: as a start to move away from the stupid IDP_New function, this type
- * has it's own allocation function.*/
 IDProperty *IDP_NewIDPArray(const char *name)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
@@ -136,18 +134,11 @@
 #endif
 ;
 
-/**
- * replaces all properties with the same name in a destination group from a source group.
- */
 void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
 ;
-
-/**
- * Checks if a property with the same name as prop exists, and if so replaces it.
- * Use this to preserve order!*/
 void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop)
 #ifdef __GNUC__
 __attribute__((nonnull))
@@ -160,42 +151,17 @@
 #endif
 ;
 
-/**
- * This function has a sanity check to make sure ID properties with the same name don't
- * get added to the group.
- * 
- * The sanity check just means the property is not added to the group if another property
- * exists with the same name; the client code using ID properties then needs to detect this 
- * (the function that adds new properties to groups, IDP_AddToGroup, returns 0 if a property can't
- * be added to the group, and 1 if it can) and free the property.
- * 
- * Currently the code to free ID properties is designed to leave the actual struct
- * you pass it un-freed, this is needed for how the system works.  This means
- * to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
- * struct.  In the future this will just be IDP_FreeProperty and the code will
- * be reorganized to work properly.
- */
 int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop)
 #ifdef __GNUC__
 __attribute__((nonnull))
 #endif
 ;
-
-/** this is the same as IDP_AddToGroup, only you pass an item
- * in the group list to be inserted after. */
 int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous, 
                       struct IDProperty *pnew)
 #ifdef __GNUC__
 __attribute__((nonnull  (1, 3))) /* 'group', 'pnew' */
 #endif
 ;
-
-/** \note this does not free the property!!
- *
- * To free the property, you have to do:
- * IDP_FreeProperty(prop); //free all subdata
- * MEM_freeN(prop); //free property struct itself
- */
 void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop)
 #ifdef __GNUC__
 __attribute__((nonnull))
@@ -208,41 +174,23 @@
 __attribute__((nonnull))
 #endif
 ;
-/** same as above but ensure type match */
 IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
 #endif
 ;
-
-/**
- * Get an iterator to iterate over the members of an id property group.
- * Note that this will automatically free the iterator once iteration is complete;
- * if you stop the iteration before hitting the end, make sure to call
- * IDP_FreeIterBeforeEnd(). */
 void *IDP_GetGroupIterator(struct IDProperty *prop)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 #endif
 ;
-
-/**
- * Returns the next item in the iteration.  To use, simple for a loop like the following:
- * while (IDP_GroupIterNext(iter) != NULL) {
- *     ...
- * }
- */
 IDProperty *IDP_GroupIterNext(void *vself)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
 #endif
 ;
-
-/**
- * Frees the iterator pointed to at vself, only use this if iteration is stopped early; 
- * when the iterator hits the end of the list it'll automatically free itself.*/
 void IDP_FreeIterBeforeEnd(void *vself)
 #ifdef __GNUC__
 __attribute__((nonnull))
@@ -250,9 +198,6 @@
 ;
 
 /*-------- Main Functions --------*/
-/** Get the Group property that contains the id properties for ID id.  Set create_if_needed
- * to create the Group property and attach it to id if it doesn't exist; otherwise
- * the function will return NULL if there's no Group property attached to the ID.*/
 struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
@@ -278,31 +223,6 @@
 #endif
 ;
 
-/**
- * Allocate a new ID.
- *
- * This function takes three arguments: the ID property type, a union which defines
- * it's initial value, and a name.
- *
- * The union is simple to use; see the top of this header file for its definition. 
- * An example of using this function:
- *
- *     IDPropertyTemplate val;
- *     IDProperty *group, *idgroup, *color;
- *     group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
- *    
- *     val.array.len = 4
- *     val.array.type = IDP_FLOAT;
- *     color = IDP_New(IDP_ARRAY, val, "color1");
- *    
- *     idgroup = IDP_GetProperties(some_id, 1);
- *     IDP_AddToGroup(idgroup, color);
- *     IDP_AddToGroup(idgroup, group);
- * 
- * Note that you MUST either attach the id property to an id property group with 
- * IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
- * a memory leak.
- */
 struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
@@ -310,14 +230,10 @@
 #endif
 ;
 
-/** \note this will free all child properties of list arrays and groups!
- * Also, note that this does NOT unlink anything!  Plus it doesn't free
- * the actual struct IDProperty struct either.*/
 void IDP_FreeProperty(struct IDProperty *prop);
 
 void IDP_ClearProperty(IDProperty *prop);
 
-/** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
 void IDP_UnlinkProperty(struct IDProperty *prop);
 
 #define IDP_Int(prop)                     ((prop)->data.val)

Modified: trunk/blender/source/blender/blenkernel/intern/idcode.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/idcode.c	2013-03-24 01:19:55 UTC (rev 55544)
+++ trunk/blender/source/blender/blenkernel/intern/idcode.c	2013-03-24 01:51:54 UTC (rev 55545)
@@ -108,17 +108,36 @@
 	return NULL;
 }
 
+/**
+ * Return if the ID code is a valid ID code.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when invalid.
+ */
 bool BKE_idcode_is_valid(int code)
 {
 	return idtype_from_code(code) ? true : false;
 }
 
+/**
+ * Return non-zero when an ID type is linkable.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when non linkable.
+ */
 bool BKE_idcode_is_linkable(int code)
 {
 	IDType *idt = idtype_from_code(code);
 	return idt ? ((idt->flags & IDTYPE_FLAGS_ISLINKABLE) != 0) : false;
 }
 
+/**
+ * Convert an idcode into a name.
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
 const char *BKE_idcode_to_name(int code) 
 {
 	IDType *idt = idtype_from_code(code);
@@ -126,6 +145,12 @@
 	return idt ? idt->name : NULL;
 }
 
+/**
+ * Convert a name into an idcode (ie. ID_SCE)
+ *
+ * \param name The name to convert.
+ * \return The code for the name, or 0 if invalid.
+ */
 int BKE_idcode_from_name(const char *name) 
 {
 	IDType *idt = idtype_from_name(name);
@@ -133,6 +158,13 @@
 	return idt ? idt->code : 0;
 }
 
+/**
+ * Convert an idcode into a name (plural).
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
 const char *BKE_idcode_to_name_plural(int code) 
 {
 	IDType *idt = idtype_from_code(code);
@@ -140,6 +172,12 @@
 	return idt ? idt->plural : NULL;
 }
 
+/**
+ * Return an ID code and steps the index forward 1.
+ *
+ * \param index start as 0.
+ * \return the code, 0 when all codes have been returned.
+ */
 int BKE_idcode_iter_step(int *index)
 {
 	return (*index < nidtypes) ? idtypes[(*index)++].code : 0;

Modified: trunk/blender/source/blender/blenkernel/intern/idprop.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/idprop.c	2013-03-24 01:19:55 UTC (rev 55544)
+++ trunk/blender/source/blender/blenkernel/intern/idprop.c	2013-03-24 01:51:54 UTC (rev 55545)
@@ -61,8 +61,10 @@
 
 /* --------- property array type -------------*/
 
-/* note: as a start to move away from the stupid IDP_New function, this type
- * has it's own allocation function.*/
+/**
+ * \note as a start to move away from the stupid IDP_New function, this type
+ * has it's own allocation function.
+ */
 IDProperty *IDP_NewIDPArray(const char *name)
 {
 	IDProperty *prop = MEM_callocN(sizeof(IDProperty), "IDProperty prop array");
@@ -443,8 +445,8 @@
 	}
 }
 
-/*
- * replaces all properties with the same name in a destination group from a source group.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list