F439_CPP_SPI_RA8875_TFT_LCD_04
1.0
STM32F439 SPI RA8875 7-inch TFT display with FRAM-backed touch calibration, built on the STM32_GFX, STM32_RA8875 and STM32_MB85RS64V libraries
Loading...
Searching...
No Matches
WString.h
Go to the documentation of this file.
1
15
#ifndef STM32_WSTRING_H_
16
#define STM32_WSTRING_H_
17
18
#include <stdlib.h>
19
#include <string.h>
20
22
class
String
{
23
public
:
26
String
(
const
char
*s =
""
) : buf_(nullptr), len_(0) { assign(s); }
29
String
(
const
String
&o) : buf_(nullptr), len_(0) { assign(o.buf_); }
33
String
&
operator=
(
const
String
&o) {
34
if
(
this
!= &o)
35
assign(o.buf_);
36
return
*
this
;
37
}
41
String
&
operator=
(
const
char
*s) {
42
assign(s);
43
return
*
this
;
44
}
46
~String
() { free(buf_); }
47
49
const
char
*
c_str
()
const
{
return
buf_ ? buf_ :
""
; }
51
unsigned
int
length
()
const
{
return
len_; }
54
char
operator[]
(
unsigned
int
i)
const
{
return
(i < len_) ? buf_[i] : 0; }
55
56
private
:
57
void
assign(
const
char
*s) {
58
free(buf_);
59
buf_ =
nullptr
;
60
len_ = 0;
61
if
(!s)
62
return
;
63
len_ = (
unsigned
int)strlen(s);
64
buf_ = (
char
*)malloc(len_ + 1);
65
if
(buf_)
66
memcpy(buf_, s, len_ + 1);
67
else
68
len_ = 0;
69
}
70
char
*buf_;
71
unsigned
int
len_;
72
};
73
74
#endif
// STM32_WSTRING_H_
String
Minimal Arduino-String stand-in (see file description).
Definition
WString.h:22
String::operator=
String & operator=(const String &o)
Definition
WString.h:33
String::operator=
String & operator=(const char *s)
Definition
WString.h:41
String::operator[]
char operator[](unsigned int i) const
Definition
WString.h:54
String::String
String(const String &o)
Definition
WString.h:29
String::c_str
const char * c_str() const
Definition
WString.h:49
String::length
unsigned int length() const
Definition
WString.h:51
String::~String
~String()
Destructor frees the copy.
Definition
WString.h:46
String::String
String(const char *s="")
Definition
WString.h:26
STM32_GFX
WString.h
Generated by
1.10.0