libcmime  
A lightweight C mime library
cmime_string.h
Go to the documentation of this file.
1 /* libcmime - A C mime library
2  * Copyright (C) 2013 SpaceNet AG and Axel Steiner <ast@treibsand.com>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 
30 #ifndef _CMIME_STRING_H
31 #define _CMIME_STRING_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <stdlib.h>
38 #include <string.h>
39 #include <ctype.h>
40 #include <assert.h>
41 
46 typedef struct {
47  char **node;
48  size_t count;
50 
57 
64 
71 void cmime_string_list_insert(CMimeStringList_T *sl, const char *s);
72 
80 char *cmime_string_list_get(CMimeStringList_T *sl, int pos);
81 
86 #define cmime_string_list_get_count(sl) ((int)sl->count)
87 
96 char *cmime_string_strip(char *s);
97 
106 char *cmime_string_chomp(char *s);
107 
114 int cmime_string_is_7bit(const char *s);
115 
122 int cmime_string_is_8bit(const char *s);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* _CMIME_STRING_H */
char * cmime_string_list_get(CMimeStringList_T *sl, int pos)
Return string at given position.
Definition: cmime_string.c:60
CMimeStringList_T * cmime_string_list_new(void)
Creates a new CMimeStringList_T object.
Definition: cmime_string.c:28
size_t count
Definition: cmime_string.h:48
char * cmime_string_strip(char *s)
Strip leading/trailing spaces from string. This function doesn't allocate or reallocate any memory; i...
Definition: cmime_string.c:66
void cmime_string_list_insert(CMimeStringList_T *sl, const char *s)
Insert new string into list.
Definition: cmime_string.c:49
char ** node
Definition: cmime_string.h:47
int cmime_string_is_7bit(const char *s)
Determine if given string is 7bit only or not.
Definition: cmime_string.c:95
char * cmime_string_chomp(char *s)
remove trailing newline from string This function doesn't allocate or reallocate any memory; it modif...
Definition: cmime_string.c:76
A simple list with strings.
Definition: cmime_string.h:46
void cmime_string_list_free(CMimeStringList_T *sl)
Free a CMimeStringList_t object.
Definition: cmime_string.c:36
int cmime_string_is_8bit(const char *s)
Determine if given string contains 8bit characters.
Definition: cmime_string.c:109