* This is a little Arduino String emulation to keep the OLEDDisplay * library code in common between Arduino and mbed-os */
| 46 | * library code in common between Arduino and mbed-os |
| 47 | */ |
| 48 | class String { |
| 49 | public: |
| 50 | String(const char *s) { _str = s; }; |
| 51 | int length() { return strlen(_str); }; |
| 52 | const char *c_str() { return _str; }; |
| 53 | void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const { |
| 54 | memcpy(buf, _str + index, std::min(bufsize, strlen(_str))); |
| 55 | }; |
| 56 | private: |
| 57 | const char *_str; |
| 58 | }; |
| 59 | |
| 60 | #else |
| 61 | #error "Unkown operating system" |