}
#endif // _di_fll_fss_snatch_
+#ifndef _di_fll_fss_snatch_together_
+ f_return_status fll_fss_snatch_together(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size) {
+ #ifndef _di_level_2_parameter_checking_
+ if (size == 0) return f_status_set_error(f_invalid_parameter);
+ #endif // _di_level_2_parameter_checking_
+
+ if (buffer.used == 0) return f_no_data;
+ if (objects.used == 0) return f_no_data;
+ if (contents.used == 0) return f_no_data;
+
+ f_status status = f_none;
+ f_string_length length_object = 0;
+
+ f_array_length i = 0;
+ f_array_length j = 0;
+ f_array_length k = 0;
+
+ for (; i < objects.used; i++) {
+ length_object = (objects.array[i].stop - objects.array[i].start) + 1;
+
+ for (j = 0; j < size; j++) {
+ if (fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]) == f_equal_to) {
+ for (k = 0; k < contents.array[i].used; k++) {
+ status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], values[j]);
+
+ if (f_status_is_error(status)) break;
+ } // for
+
+ if (f_status_is_error(status)) break;
+ }
+ } // for
+
+ if (f_status_is_error(status)) break;
+ } // for
+
+ return status;
+ }
+#endif // _di_fll_fss_snatch_together_
+
#ifndef _di_fll_fss_snatch_mash_
f_return_status fll_fss_snatch_mash(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length) {
#ifndef _di_level_2_parameter_checking_
for (j = 0; j < size; j++) {
if (fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]) == f_equal_to) {
+ if (values[j]->used == 0) {
+ for (k = 0; k < contents.array[i].used; k++) {
+ status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]);
+
+ if (f_status_is_error(status)) break;
+ } // for
+
+ if (f_status_is_error(status)) break;
+ }
+ }
+ } // for
+
+ if (f_status_is_error(status)) break;
+ } // for
+
+ return status;
+ }
+#endif // _di_fll_fss_snatch_mash_
+
+#ifndef _di_fll_fss_snatch_mash_together_
+ f_return_status fll_fss_snatch_mash_together(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length) {
+ #ifndef _di_level_2_parameter_checking_
+ if (size == 0) return f_status_set_error(f_invalid_parameter);
+ #endif // _di_level_2_parameter_checking_
+
+ if (buffer.used == 0) return f_no_data;
+ if (objects.used == 0) return f_no_data;
+ if (contents.used == 0) return f_no_data;
+
+ f_status status = f_none;
+ f_string_length length_object = 0;
+
+ f_array_length i = 0;
+ f_array_length j = 0;
+ f_array_length k = 0;
+
+ for (; i < objects.used; i++) {
+ length_object = (objects.array[i].stop - objects.array[i].start) + 1;
+
+ for (j = 0; j < size; j++) {
+ if (fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]) == f_equal_to) {
for (k = 0; k < contents.array[i].used; k++) {
status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]);
return status;
}
-#endif // _di_fll_fss_snatch_mash_
+#endif // _di_fll_fss_snatch_mash_together_
#ifdef __cplusplus
} // extern "C"
/**
* Perform simple search through all objects against the given set, saving all values when matched.
*
- * Only the first match for each name is snatched, all others are ignored.
+ * Multiple contents for a single object are appended.
+ * Only content for the first of each identical object is snatched, all others are ignored.
*
* This will trim the object names when comparing (removing leading/trailing whitespace).
* This will strip NULL charactes when copying.
*
* This performs only a simple search algorithm that should be acceptable for small sets where performance is generally not a concern.
*
+ * This assumes values[].used is 0 at start to determine if value is already snatched.
+ *
* @param buffer
* The buffer to read from.
* @param objects
* An array of lengths for each names string.
* @param values
* An array of values where "snatched" content is stored.
- * Each of these must be of type f_string_dynamic.
* @param size
* The total size of the names, lengths, and values arrays.
*
/**
* Perform simple search through all objects against the given set, saving all values when matched.
*
- * This will append all duplicates using the provided glue.
+ * All matches for each name is snatched.
+ * Multiple contents for a single object are appended.
+ * Content for multiple identical objects are appended.
+ *
* This will trim the object names when comparing (removing leading/trailing whitespace).
* This will strip NULL charactes when copying.
*
* This content mappings to process.
* @param names
* An array of strings to "snatch" from the buffer.
- * Each of these must be of type f_string.
* @param lengths
* An array of lengths for each names string.
- * Each of these must be of type f_string_length.
* @param values
* An array of values where "snatched" content is stored.
- * Each of these must be of type f_string_dynamic.
+ * @param size
+ * The total size of the names, lengths, and values arrays.
+ *
+ * @return
+ * f_none on success.
+ * f_no_data when there is no buffer, objects or contents to process.
+ * f_error_reallocation (with error bit) on reallocation error.
+ * f_invalid_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_fll_fss_snatch_together_
+ extern f_return_status fll_fss_snatch_together(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size);
+#endif // _di_fll_fss_snatch_together_
+
+/**
+ * Perform simple search through all objects against the given set, saving all values when matched.
+ *
+ * Multiple contents for a single object are appended using the provided glue.
+ * Only content for the first of each identical object is snatched, all others are ignored.
+ *
+ * This will trim the object names when comparing (removing leading/trailing whitespace).
+ * This will strip NULL charactes when copying.
+ *
+ * This performs only a simple search algorithm that should be acceptable for small sets where performance is generally not a concern.
+ *
+ * This assumes values[].used is 0 at start to determine if value is already snatched.
+ *
+ * @param buffer
+ * The buffer to read from.
+ * @param objects
+ * This object mappings to process.
+ * @param contents
+ * This content mappings to process.
+ * @param names
+ * An array of strings to "snatch" from the buffer.
+ * @param lengths
+ * An array of lengths for each names string.
+ * @param values
+ * An array of values where "snatched" content is stored.
* @param size
* The total size of the names, lengths, and values arrays.
* @param glue
extern f_return_status fll_fss_snatch_mash(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length);
#endif // _di_fll_fss_snatch_mash_
+/**
+ * Perform simple search through all objects against the given set, saving all values when matched.
+ *
+ * All matches for each name is snatched.
+ * Multiple contents for a single object are appended using the provided glue.
+ * Content for multiple identical objects are appended using the provided glue.
+ *
+ * This will trim the object names when comparing (removing leading/trailing whitespace).
+ * This will strip NULL charactes when copying.
+ *
+ * This performs only a simple search algorithm that should be acceptable for small sets where performance is generally not a concern.
+ *
+ * @param buffer
+ * The buffer to read from.
+ * @param objects
+ * This object mappings to process.
+ * @param contents
+ * This content mappings to process.
+ * @param names
+ * An array of strings to "snatch" from the buffer.
+ * @param lengths
+ * An array of lengths for each names string.
+ * @param values
+ * An array of values where "snatched" content is stored.
+ * @param size
+ * The total size of the names, lengths, and values arrays.
+ * @param glue
+ * A string to append between each duplicate name found when "snatching".
+ * @param glue_length
+ * The length of the glue string.
+ *
+ * @return
+ * f_none on success.
+ * f_no_data when there is no buffer, objects or contents to process.
+ * f_error_reallocation (with error bit) on reallocation error.
+ * f_invalid_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_fll_fss_snatch_mash_together_
+ extern f_return_status fll_fss_snatch_mash_together(const f_string_dynamic buffer, const f_fss_objects objects, const f_fss_contents contents, const f_string names[], const f_string_length lengths[], f_string_dynamic *values[], const f_string_length size, const f_string glue, const f_string_length glue_length);
+#endif // _di_fll_fss_snatch_mash_together_
+
#ifdef __cplusplus
} // extern "C"
#endif