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 
55 typedef enum _CMimeStringEncodingType_T {
59 
60 
67 
74 
81 void cmime_string_list_insert(CMimeStringList_T *sl, const char *s);
82 
90 char *cmime_string_list_get(CMimeStringList_T *sl, int pos);
91 
96 #define cmime_string_list_get_count(sl) ((int)sl->count)
97 
106 char *cmime_string_strip(char *s);
107 
116 char *cmime_string_chomp(char *s);
117 
124 int cmime_string_is_7bit(const char *s);
125 
132 int cmime_string_is_8bit(const char *s);
133 
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif /* _CMIME_STRING_H */
char * cmime_string_list_get(CMimeStringList_T *sl, int pos)
Return string at given position.
Definition: cmime_string.c:63
CMimeStringList_T * cmime_string_list_new(void)
Creates a new CMimeStringList_T object.
Definition: cmime_string.c:31
size_t count
Definition: cmime_string.h:48
Definition: cmime_string.h:56
char * cmime_string_strip(char *s)
Strip leading/trailing spaces from string. This function doesn&#39;t allocate or reallocate any memory; i...
Definition: cmime_string.c:69
char * cmime_string_encode_to_7bit(const char *s, CMimeStringEncodingType_T t)
Convert given string to 7 bit mime encoded string based on RFC 2047.
Definition: cmime_string.c:125
void cmime_string_list_insert(CMimeStringList_T *sl, const char *s)
Insert new string into list.
Definition: cmime_string.c:52
Definition: cmime_string.h:57
char ** node
Definition: cmime_string.h:47
CMimeStringEncodingType_T
Possible string encoding types.
Definition: cmime_string.h:55
int cmime_string_is_7bit(const char *s)
Determine if given string is 7bit only or not.
Definition: cmime_string.c:98
char * cmime_string_chomp(char *s)
remove trailing newline from string This function doesn&#39;t allocate or reallocate any memory; it modif...
Definition: cmime_string.c:79
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:39
int cmime_string_is_8bit(const char *s)
Determine if given string contains 8bit characters.
Definition: cmime_string.c:112