AString  0.2
A Lightweight C Language String Library
/home/Tom/Projects/astring/astringlist.c文件参考
#include "astring.h"
#include "astringlist.h"
#include <stdio.h>
#include <string.h>

宏定义

#define a_new(type, size)   (type *)malloc(sizeof(type) * (size))
#define a_free(point)   do{free(point);point = NULL;}while(0)
#define P(lock)   while(lock++){--lock;}
#define V(lock)   --lock;
#define A_WARING(msg)   do{fprintf(stderr, "[WARING] %s: [%s():%d] %s\n", __FILE__, __func__, __LINE__, msg);}while(0)
#define A_WARNING_NOT_STRING_LIST   A_WARING("A_IS_STRING_LIST Check falt!")
#define A_WARNING_NOT_STRING   A_WARING("A_IS_STRING Check falt!")

函数

AStringLista_string_list_new (void)
 Create a new AStringList with none string.
AStringLista_string_list_assign (AStringList *list, AString *string)
 Copies string from an AString into an AStringList, destroying any previous contents. It alias a_string_list_set_text;.
AStringLista_string_list_assign_split (AStringList *list, AString *string, AString *split)
 It's like assign,but,split will be
.
AStringLista_string_list_load_from_file (const char *filename)
 Create an AStringList from a file.
AStringLista_string_list_append (AStringList *list, AStringList *list2)
 Append AStringList to exists AStringList.
AStringLista_string_list_prepend (AStringList *list, AStringList *list2)
 Prepend AStringList to exists AStringList.
AStringLista_string_list_add (AStringList *list, AString *string)
 Add an AString to the end of AStringList.
AStringLista_string_list_insert (AStringList *list, asize index, AString *string)
 Insert an AString to AStringList.
AStringLista_string_list_delete (AStringList *list, asize index)
 Delete an AString from an AStringList.
AStringLista_string_list_clear (AStringList *list)
 Clear the AStringList.
AStringLista_string_list_exchange (AStringList *list, asize index1, asize index2)
 Exchange two lines in an AStringList.
asize a_string_list_find (AStringList *list, AString *string, asize index)
 Find an AString from an AStringList.
asize a_string_list_find_name (AStringList *list, AString *string, asize index)
 Find a key from an AStringList When the stringlist is like key=value, find the key in the list.
AStringa_string_list_get_value (AStringList *list, asize index)
 Get a value from an AStringList When the stringlist is like key=value, get the value from a string.
AStringa_string_list_get_index (AStringList *list, asize index)
 Get a AString from an AStringList.
AStringLista_string_list_sort (AStringList *list)
 Sort the StringList.
AStringLista_string_list_sort_custom (AStringList *list, A_CMP cmp)
 Sort the StringList by a custom function.
aboolean a_string_list_sorted (AStringList *list)
 Check the StringList is sorted.
aboolean a_string_list_sorted_custom (AStringList *list, A_CMP cmp)
 Check the StringList is sorted.
AStringLista_string_list_dup (AStringList *list)
 duplicate the AStringList
AStringa_string_list_get_text (AStringList *list, auchar returnchar)
 export an AStringList to an AString
aboolean a_string_list_save_to_file (AStringList *list, const char *filename, auchar returnchar)
 export an AStringList to a file
aboolean a_string_list_equal (AStringList *list1, AStringList *list2)
 compare the two AStringLists
void a_string_list_free (AStringList *list)
 Frees the memory allocated for the AStringList.

宏定义文档

#define a_free (   point)    do{free(point);point = NULL;}while(0)
#define a_new (   type,
  size 
)    (type *)malloc(sizeof(type) * (size))
#define A_WARING (   msg)    do{fprintf(stderr, "[WARING] %s: [%s():%d] %s\n", __FILE__, __func__, __LINE__, msg);}while(0)
#define A_WARNING_NOT_STRING   A_WARING("A_IS_STRING Check falt!")
#define A_WARNING_NOT_STRING_LIST   A_WARING("A_IS_STRING_LIST Check falt!")
#define P (   lock)    while(lock++){--lock;}
#define V (   lock)    --lock;

函数文档

AStringList* a_string_list_add ( AStringList list,
AString string 
)

Add an AString to the end of AStringList.

参数:
listthe destination AStringList
stringthe string you want to add
返回:
list
参见:
a_string_list_append
自从:
0.2
AStringList* a_string_list_append ( AStringList list,
AStringList list2 
)

Append AStringList to exists AStringList.

参数:
listthe destination AStringList
list2the list you want to append
返回:
list
自从:
0.2
AStringList* a_string_list_assign ( AStringList list,
AString string 
)

Copies string from an AString into an AStringList, destroying any previous contents. It alias a_string_list_set_text;.

参数:
listthe AStringList to opera
stringthe AString to assign
返回:
list
自从:
0.2
AStringList* a_string_list_assign_split ( AStringList list,
AString string,
AString split 
)

It's like assign,but,split will be
.

参数:
listthe AStringList to opera
stringthe AString to assign
splitthe split string
返回:
list
参见:
a_string_list_assign
自从:
0.2
AStringList* a_string_list_clear ( AStringList list)

Clear the AStringList.

参数:
listthe AStringList you want to clear
返回:
list
自从:
0.2
AStringList* a_string_list_delete ( AStringList list,
asize  index 
)

Delete an AString from an AStringList.

参数:
listthe destination AStringList
indexthe position you want to delete
返回:
list
自从:
0.2
AStringList* a_string_list_dup ( AStringList list)

duplicate the AStringList

警告:
You should free the return string when you don't want to use it.
参数:
listAn AStringList
返回:
a new AStringList
自从:
0.2
aboolean a_string_list_equal ( AStringList list1,
AStringList list2 
)

compare the two AStringLists

参数:
listthe first AStringList
list2the second AStringList
返回:
TRUE or FALSE
自从:
0.2
AStringList* a_string_list_exchange ( AStringList list,
asize  index1,
asize  index2 
)

Exchange two lines in an AStringList.

参数:
listthe destination AStringList
index1the first position
index2the second position
返回:
list
自从:
0.2
asize a_string_list_find ( AStringList list,
AString string,
asize  index 
)

Find an AString from an AStringList.

参数:
listAn AStringList
stringthe string to find
indexthe position you want to find start
返回:
the position, return -1 when doesn't find it.
自从:
0.2
asize a_string_list_find_name ( AStringList list,
AString string,
asize  index 
)

Find a key from an AStringList When the stringlist is like key=value, find the key in the list.

参数:
listAn AStringList
stringthe string to find
indexthe position you want to find start
返回:
the position, return -1 when doesn't find it.
自从:
0.2
void a_string_list_free ( AStringList list)

Frees the memory allocated for the AStringList.

参数:
stringthe AStringList you want to free
自从:
0.2
AString* a_string_list_get_index ( AStringList list,
asize  index 
)

Get a AString from an AStringList.

参数:
listAn AStringList
indexthe position you want to get
返回:
a new AString
参见:
a_string_list_find_name
自从:
0.2
AString* a_string_list_get_text ( AStringList list,
auchar  returnchar 
)

export an AStringList to an AString

警告:
You should free the return string when you don't want to use it.
参数:
listAn AStringList
returncharthe return char, 0:'
', 1:'', 2:"\r\n"
返回:
A new AString
自从:
0.2
AString* a_string_list_get_value ( AStringList list,
asize  index 
)

Get a value from an AStringList When the stringlist is like key=value, get the value from a string.

参数:
listAn AStringList
indexthe position you want to get value
返回:
a new AString
参见:
a_string_list_find_name
自从:
0.2
AStringList* a_string_list_insert ( AStringList list,
asize  index,
AString string 
)

Insert an AString to AStringList.

参数:
listthe destination AStringList
indexthe position you want to insert
stringthe string you want to insert
返回:
list
参见:
a_string_list_add
自从:
0.2
AStringList* a_string_list_load_from_file ( const char *  filename)

Create an AStringList from a file.

参数:
filenamethe filename you want to load
返回:
a new AStringList
自从:
0.2
AStringList* a_string_list_new ( void  )

Create a new AStringList with none string.

返回:
A new AStringList
自从:
0.2
AStringList* a_string_list_prepend ( AStringList list,
AStringList list2 
)

Prepend AStringList to exists AStringList.

参数:
listthe destination AStringList
list2the list you want to prepend
返回:
list
自从:
0.2
aboolean a_string_list_save_to_file ( AStringList list,
const char *  filename,
auchar  returnchar 
)

export an AStringList to a file

警告:
You should free the return string when you don't want to use it.
参数:
listAn AStringList
filenamethe file you want to export
returncharthe return char, 0:'
', 1:'', 2:"\r\n"
返回:
TRUE or FALSE
自从:
0.2
AStringList* a_string_list_sort ( AStringList list)

Sort the StringList.

参数:
listAn AStringList
返回:
list
自从:
0.2
AStringList* a_string_list_sort_custom ( AStringList list,
A_CMP  cmp 
)

Sort the StringList by a custom function.

参数:
listAn AStringList
cmpAn Compare function
返回:
list
自从:
0.2
aboolean a_string_list_sorted ( AStringList list)

Check the StringList is sorted.

参数:
listAn AStringList
返回:
TRUE or FALSE
自从:
0.2
aboolean a_string_list_sorted_custom ( AStringList list,
A_CMP  cmp 
)

Check the StringList is sorted.

参数:
listAn AStringList
cmpAn Compare function
返回:
TRUE or FALSE
自从:
0.2