forked from espressif/arduino-esp32
Extends String to print 64-bit integers (#6768)
This commit is contained in:
@ -73,6 +73,8 @@ class String {
|
||||
explicit String(unsigned long, unsigned char base = 10);
|
||||
explicit String(float, unsigned int decimalPlaces = 2);
|
||||
explicit String(double, unsigned int decimalPlaces = 2);
|
||||
explicit String(long long, unsigned char base = 10);
|
||||
explicit String(unsigned long long, unsigned char base = 10);
|
||||
~String(void);
|
||||
|
||||
// memory management
|
||||
@ -122,6 +124,8 @@ class String {
|
||||
unsigned char concat(unsigned long num);
|
||||
unsigned char concat(float num);
|
||||
unsigned char concat(double num);
|
||||
unsigned char concat(long long num);
|
||||
unsigned char concat(unsigned long long num);
|
||||
unsigned char concat(const __FlashStringHelper * str);
|
||||
|
||||
// if there's not enough memory for the concatenated value, the string
|
||||
@ -166,6 +170,14 @@ class String {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(long long num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned long long num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator += (const __FlashStringHelper *str){
|
||||
concat(str);
|
||||
return (*this);
|
||||
@ -182,6 +194,8 @@ class String {
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, long long num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long long num);
|
||||
|
||||
// comparison (only works w/ Strings and "strings")
|
||||
operator StringIfHelperType() const {
|
||||
@ -373,6 +387,12 @@ class StringSumHelper: public String {
|
||||
StringSumHelper(double num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(long long num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(unsigned long long num) :
|
||||
String(num) {
|
||||
}
|
||||
};
|
||||
|
||||
extern const String emptyString;
|
||||
|
Reference in New Issue
Block a user