forked from bblanchon/ArduinoJson
Reduced size by 16 bytes by inlining indent() and unindent()
This commit is contained in:
@ -25,13 +25,19 @@ class IndentedPrint : public Print {
|
|||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
|
|
||||||
// Adds one level of indentation
|
// Adds one level of indentation
|
||||||
void indent();
|
void indent() {
|
||||||
|
if (level < MAX_LEVEL) level++;
|
||||||
|
}
|
||||||
|
|
||||||
// Removes one level of indentation
|
// Removes one level of indentation
|
||||||
void unindent();
|
void unindent() {
|
||||||
|
if (level > 0) level--;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the number of space printed for each level of indentation
|
// Set the number of space printed for each level of indentation
|
||||||
void setTabSize(uint8_t n);
|
void setTabSize(uint8_t n) {
|
||||||
|
if (n < MAX_TAB_SIZE) tabSize = n & MAX_TAB_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Print *sink;
|
Print *sink;
|
||||||
|
@ -8,18 +8,6 @@
|
|||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
void IndentedPrint::indent() {
|
|
||||||
if (level < MAX_LEVEL) level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IndentedPrint::unindent() {
|
|
||||||
if (level > 0) level--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IndentedPrint::setTabSize(uint8_t n) {
|
|
||||||
if (n < MAX_TAB_SIZE) tabSize = n & MAX_TAB_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t IndentedPrint::write(uint8_t c) {
|
size_t IndentedPrint::write(uint8_t c) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user