Add more details to server RPC test cases in static docs
[hiphop-php.git] / hphp / neo / neo_str.h
blob0397b9db10e1cd89c32462ffbe79929f2c4d997a
1 /*
2 * Copyright 2001-2004 Brandon Long
3 * All Rights Reserved.
5 * ClearSilver Templating System
7 * This code is made available under the terms of the ClearSilver License.
8 * http://www.clearsilver.net/license.hdf
12 #ifndef incl_HPHP_NEO_STR_H_
13 #define incl_HPHP_NEO_STR_H_ 1
15 __BEGIN_DECLS
17 #include <stdarg.h>
18 #include <stdio.h>
19 #include "hphp/neo/neo_bool.h"
20 #include "hphp/neo/neo_misc.h"
22 /* This modifies the string its called with by replacing all the white
23 * space on the end with \0, and returns a pointer to the first
24 * non-white space character in the string
26 char *neos_strip (char *s);
28 char *vsprintf_alloc (const char *fmt, va_list ap);
29 char *vnsprintf_alloc (int start_size, const char *fmt, va_list ap);
31 /* Versions of the above which actually return a length, necessary if
32 * you expect embedded NULLs */
33 int vnisprintf_alloc (char **buf, int start_size, const char *fmt, va_list ap);
34 int visprintf_alloc (char **buf, const char *fmt, va_list ap);
36 typedef struct _string
38 char *buf;
39 int len;
40 int max;
41 } NEOSTRING;
43 /* At some point, we should add the concept of "max len" to these so we
44 * can't get DoS'd by someone sending us a line without an end point,
45 * etc. */
46 void string_init (NEOSTRING *str);
47 NEOERR *string_append (NEOSTRING *str, const char *buf);
48 NEOERR *string_appendn (NEOSTRING *str, const char *buf, int l);
49 NEOERR *string_append_char (NEOSTRING *str, char c);
50 NEOERR *string_appendf (NEOSTRING *str, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3);
51 NEOERR *string_appendvf (NEOSTRING *str, const char *fmt, va_list ap);
52 void string_clear (NEOSTRING *str);
55 char *repr_string_alloc (const char *s);
58 __END_DECLS
60 #endif /* incl_HPHP_NEO_STR_H_ */