TaskString.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include <Os/TaskString.hpp>
  2. #include <Fw/Types/StringUtils.hpp>
  3. namespace Os {
  4. TaskString::TaskString(const char* src) : StringBase() {
  5. Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
  6. }
  7. TaskString::TaskString(const StringBase& src) : StringBase() {
  8. Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
  9. }
  10. TaskString::TaskString(const TaskString& src) : StringBase() {
  11. Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
  12. }
  13. TaskString::TaskString() {
  14. this->m_buf[0] = 0;
  15. }
  16. TaskString& TaskString::operator=(const TaskString& other) {
  17. if(this == &other) {
  18. return *this;
  19. }
  20. Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
  21. return *this;
  22. }
  23. TaskString& TaskString::operator=(const StringBase& other) {
  24. if(this == &other) {
  25. return *this;
  26. }
  27. Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
  28. return *this;
  29. }
  30. TaskString& TaskString::operator=(const char* other) {
  31. Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
  32. return *this;
  33. }
  34. TaskString::~TaskString() {
  35. }
  36. const char* TaskString::toChar() const {
  37. return this->m_buf;
  38. }
  39. NATIVE_UINT_TYPE TaskString::getCapacity() const {
  40. return FW_TASK_NAME_MAX_SIZE;
  41. }
  42. }