RSeries astromech firmware
MallocString.h
Go to the documentation of this file.
1 #ifndef MallocString_h
2 #define MallocString_h
3 
4 #pragma once
5 
6 // Utility subclass of Arduino String to give it a preallocated string buffer
7 // that will then be freed by the destructor of String.
8 class MallocString : public String
9 {
10 public:
11  MallocString(char* mstr) :
12  String((char*)NULL)
13  {
14  size_t len = strlen(mstr);
15  setSSO(false);
16  setCapacity(len+1);
17  setBuffer(mstr);
18  setLen(len);
19  }
20 };
21 
22 #endif
MallocString::MallocString
MallocString(char *mstr)
Definition: MallocString.h:11
MallocString
Definition: MallocString.h:8