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.

ScratchString.cpp 797B

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