Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
772B

  1. #include "ScratchString.h"
  2. #include <cstring>
  3. #include <cstdio>
  4. ScratchString::ScratchString(void)
  5. {
  6. memset(c_str, 0, sizeof(c_str));
  7. }
  8. ScratchString::ScratchString(int num)
  9. {
  10. snprintf(c_str, SCRATCH_SIZE, "%d", num);
  11. }
  12. ScratchString::ScratchString(unsigned char num)
  13. {
  14. snprintf(c_str, SCRATCH_SIZE, "%d", num);
  15. }
  16. ScratchString::ScratchString(const char *str)
  17. {
  18. if(str)
  19. strncpy(c_str, str, SCRATCH_SIZE);
  20. else
  21. memset(c_str, 0, sizeof(c_str));
  22. }
  23. ScratchString ScratchString::operator+(const ScratchString s)
  24. {
  25. ScratchString ss;
  26. strncpy(ss.c_str, c_str, SCRATCH_SIZE);
  27. strncat(ss.c_str, s.c_str, SCRATCH_SIZE-strlen(c_str));
  28. return ss;
  29. }
  30. //ScratchString::operator const char*() const
  31. //{
  32. // return c_str;
  33. //}