From 483431874222197d5a4725065f863b7fb5d4423c Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 8 Sep 2018 09:56:25 +0200 Subject: [PATCH] Update doc about missing parse_str methods. --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b7678c0b..b8bf8557 100644 --- a/README.md +++ b/README.md @@ -874,6 +874,15 @@ Generate a string representation of the list 'list' and set 'str' to this repres (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t list, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a list +and set 'list' to this representation. +This method is only defined if the type of the element defines a PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t list) Generate a string representation of the list 'list' and outputs it into the FILE 'file'. @@ -1127,6 +1136,15 @@ Generate a string representation of the list 'list' and set 'str' to this repres (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t list, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a list +and set 'list' to this representation. +This method is only defined if the type of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t list) Generate a string representation of the list 'list' and outputs it into the FILE 'file'. @@ -1379,6 +1397,15 @@ Generate a string representation of the array 'array' and set 'str' to this repr (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t array, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of an array +and set 'array' to this representation. +This method is only defined if the type of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t array) Generate a string representation of the array 'array' and outputs it into the FILE 'file'. @@ -1598,6 +1625,15 @@ Generate a string representation of the deque 'deque' and set 'str' to this repr (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t deque, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a deque +and set 'deque' to this representation. +This method is only defined if the type of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t deque) Generate a string representation of the deque 'deque' and outputs it into the FILE 'file'. @@ -1842,6 +1878,15 @@ Generate a string representation of the dict 'dict' and set 'str' to this repres (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t dict, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a dict +and set 'dict' to this representation. +This method is only defined if all types of the element defines PARSE\_STR methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t dict) Generate a string representation of the dict 'dict' and outputs it into the FILE 'file'. @@ -1977,6 +2022,15 @@ Generate a string representation of the tuple 'tuple' and set 'str' to this repr (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if all oplists define a GET\_STR method. +##### bool name\_parse\_str(name\_t tuple, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a tuple +and set 'tuple' to this representation. +This method is only defined if all types of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t tuple) Generate a string representation of the tuple 'tuple' and outputs it into the FILE 'file'. @@ -2120,9 +2174,18 @@ Swap both objects. ##### void name\_get\_str(string\_t str, name\_t variant, bool append) Convert the variant into a string, appending it into 'str' or not. -All types associated to the variant shall have a get\_str function +All types associated to the variant shall have a GET\_STR method for this function to be defined. +##### bool name\_parse\_str(name\_t variant, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a variant +and set 'variant' to this representation. +This method is only defined if all types of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, name\_t variant) Convert the variant into a string and send it to the stream 'file'. @@ -2314,6 +2377,15 @@ Generate a string representation of the rbtree 'rbtree' and set 'str' to this re (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. +##### bool name\_parse\_str(name\_t tree, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a RBTREE +and set 'tree' to this representation. +This method is only defined if all types of the element defines PARSE\_STR & INIT methods itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void name\_out\_str(FILE *file, const name\_t rbtree) Generate a string representation of the rbtree 'rbtree' and outputs it into the FILE 'file'. @@ -2558,11 +2630,6 @@ Generate a string representation of the tree 'tree' and set 'str' to this repres (if 'append' is false) or append 'str' with this representation (if 'append' is true). This method is only defined if the type of the element defines a GET\_STR method itself. -##### void name\_out\_str(FILE *file, const name\_t tree) - -Generate a string representation of the tree 'tree' and outputs it into the FILE 'file'. -This method is only defined if the type of the element defines a OUT\_STR method itself. - ##### bool name\_parse\_str(name\_t tree, const char str[], const char **endp) Parse the string 'str' that is assumed to be a string representation of a tree @@ -2572,6 +2639,11 @@ It returns true if success, false otherwise. If endp is not NULL, it sets '*endp' to the pointer of the first character not decoded by the function. +##### void name\_out\_str(FILE *file, const name\_t tree) + +Generate a string representation of the tree 'tree' and outputs it into the FILE 'file'. +This method is only defined if the type of the element defines a OUT\_STR method itself. + ##### void name\_in\_str(name\_t tree, FILE *file) Read from the file 'file' a string representation of a tree and set 'tree' to this representation. @@ -3824,6 +3896,15 @@ Outputs the input string with quote around, replacing any \" by \\\" within the string into the output string. +##### bool string\_parse\_str(string\_t v, const char str[], const char **endp) + +Parse the string 'str' that is assumed to be a string representation of a string +and set 'v' to this representation. +This method is only defined if the type of the element defines a PARSE\_STR method itself. +It returns true if success, false otherwise. +If endp is not NULL, it sets '*endp' to the pointer of the first character not +decoded by the function. + ##### void string\_out\_str(FILE *f, const string\_t v) Write a string into a FILE: