str.h revision d56384d5226c8860079d0d0b08b83404e8c42986
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch#ifndef __STR_H
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch#define __STR_H
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch
ee2633056e67353157bfbce4d9e0d1c3ceaa627aStephan Boschstring_t *str_new(pool_t pool, size_t initial_size);
ee2633056e67353157bfbce4d9e0d1c3ceaa627aStephan Boschstring_t *t_str_new(size_t initial_size);
201c3b9375760bafbc180629b4c6ad71ed554aecStephan Boschvoid str_free(string_t *str);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschconst char *str_c(string_t *str);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschconst unsigned char *str_data(const string_t *str);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschchar *str_c_modifyable(string_t *str);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschsize_t str_len(const string_t *str);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch/* Append string/character */
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_append(string_t *str, const char *cstr);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_append_n(string_t *str, const void *cstr, size_t max_len);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_append_c(string_t *str, char chr);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_append_str(string_t *dest, const string_t *src);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch/* Append printf()-like data */
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_printfa(string_t *str, const char *fmt, ...)
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch __attr_format__(2, 3);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_vprintfa(string_t *str, const char *fmt, va_list args);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch/* Delete/truncate */
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_delete(string_t *str, size_t pos, size_t len);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Boschvoid str_truncate(string_t *str, size_t len);
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch#endif
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch