string.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. *
  3. * Embedded Linux library
  4. *
  5. * Copyright (C) 2011-2014 Intel Corporation. All rights reserved.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. */
  22. #ifndef __ELL_STRING_H
  23. #define __ELL_STRING_H
  24. #include <stdarg.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. struct l_string;
  29. struct l_string *l_string_new(size_t initial_length);
  30. void l_string_free(struct l_string *string);
  31. char *l_string_unwrap(struct l_string *string);
  32. struct l_string *l_string_append(struct l_string *dest, const char *src);
  33. struct l_string *l_string_append_c(struct l_string *dest, const char c);
  34. struct l_string *l_string_append_fixed(struct l_string *dest, const char *src,
  35. size_t max);
  36. void l_string_append_vprintf(struct l_string *dest,
  37. const char *format, va_list args)
  38. __attribute__((format(printf, 2, 0)));
  39. void l_string_append_printf(struct l_string *dest, const char *format, ...)
  40. __attribute__((format(printf, 2, 3)));
  41. struct l_string *l_string_truncate(struct l_string *string, size_t new_size);
  42. unsigned int l_string_length(struct l_string *string);
  43. char **l_parse_args(const char *args, int *out_n_args);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* __ELL_STRING_H */