Updated API Reference (markdown)

Benoît Blanchon
2016-09-09 15:56:46 +02:00
parent f07193af14
commit 0492986f2b

@@ -431,29 +431,36 @@ Sets the value at specified index.
##### Signatures ##### Signatures
```c++ ```c++
void set(size_t index, bool value); bool set(size_t index, bool value);
void set(size_t index, float value, uint8_t decimals = 2); bool set(size_t index, float value, uint8_t decimals = 2);
void set(size_t index, double value, uint8_t decimals = 2); bool set(size_t index, double value, uint8_t decimals = 2);
void set(size_t index, signed char value); bool set(size_t index, signed char value);
void set(size_t index, signed long value); bool set(size_t index, signed long value);
void set(size_t index, signed int value); bool set(size_t index, signed int value);
void set(size_t index, signed short value); bool set(size_t index, signed short value);
void set(size_t index, unsigned char value); bool set(size_t index, unsigned char value);
void set(size_t index, unsigned long value); bool set(size_t index, unsigned long value);
void set(size_t index, unsigned int value); bool set(size_t index, unsigned int value);
void set(size_t index, unsigned short value); bool set(size_t index, unsigned short value);
void set(size_t index, const char *value); bool set(size_t index, const char *value);
void set(size_t index, const String &value); // see Remarks bool set(size_t index, const String &value); // see Remarks
void set(size_t index, JsonArray &array); bool set(size_t index, JsonArray &array);
void set(size_t index, JsonObject &object); bool set(size_t index, JsonObject &object);
void set(size_t index, const JsonVariant &value); bool set(size_t index, const JsonVariant &value);
``` ```
##### Arguments ##### Arguments
`index`: position to set value in array. `index`: position to set value in array.
`value`: the value to set in index of array. `value`: the value to set in index of array.
##### Return value
`true` if allocation succeeded.
`false` if there was not enough space left in the `JsonBuffer`, this can only happen when `value` is a `String`.
##### Remarks ##### Remarks
When you call `JsonArray::set(size_t, const String&)`, a copy of the string is made, causing the `JsonBuffer` to grow. When you call `JsonArray::set(size_t, const String&)`, a copy of the string is made, causing the `JsonBuffer` to grow.
@@ -1149,7 +1156,7 @@ will print the following string to the serial output:
``` ```
### JsonArray::set() ### JsonObject::set()
##### Description ##### Description
@@ -1158,45 +1165,52 @@ Sets the value at specified key.
##### Signatures ##### Signatures
```c++ ```c++
void set(const char* key, bool value); bool set(const char* key, bool value);
void set(const char* key, float value, uint8_t decimals = 2); bool set(const char* key, float value, uint8_t decimals = 2);
void set(const char* key, double value, uint8_t decimals = 2); bool set(const char* key, double value, uint8_t decimals = 2);
void set(const char* key, signed char value); bool set(const char* key, signed char value);
void set(const char* key, signed long value); bool set(const char* key, signed long value);
void set(const char* key, signed int value); bool set(const char* key, signed int value);
void set(const char* key, signed short value); bool set(const char* key, signed short value);
void set(const char* key, unsigned char value); bool set(const char* key, unsigned char value);
void set(const char* key, unsigned long value); bool set(const char* key, unsigned long value);
void set(const char* key, unsigned int value); bool set(const char* key, unsigned int value);
void set(const char* key, unsigned short value); bool set(const char* key, unsigned short value);
void set(const char* key, const char *value); bool set(const char* key, const char *value);
void set(const char* key, const String &value); // see Remarks bool set(const char* key, const String &value); // see Remarks
void set(const char* key, JsonArray &array); bool set(const char* key, JsonArray &array);
void set(const char* key, JsonObject &object); bool set(const char* key, JsonObject &object);
void set(const char* key, const JsonVariant &value); bool set(const char* key, const JsonVariant &value);
void set(const String& key, bool value); // see Remarks bool set(const String& key, bool value); // see Remarks
void set(const String& key, float value, uint8_t decimals = 2); // see Remarks bool set(const String& key, float value, uint8_t decimals = 2); // see Remarks
void set(const String& key, double value, uint8_t decimals = 2); // see Remarks bool set(const String& key, double value, uint8_t decimals = 2); // see Remarks
void set(const String& key, signed char value); // see Remarks bool set(const String& key, signed char value); // see Remarks
void set(const String& key, signed long value); // see Remarks bool set(const String& key, signed long value); // see Remarks
void set(const String& key, signed int value); // see Remarks bool set(const String& key, signed int value); // see Remarks
void set(const String& key, signed short value); // see Remarks bool set(const String& key, signed short value); // see Remarks
void set(const String& key, unsigned char value); // see Remarks bool set(const String& key, unsigned char value); // see Remarks
void set(const String& key, unsigned long value); // see Remarks bool set(const String& key, unsigned long value); // see Remarks
void set(const String& key, unsigned int value); // see Remarks bool set(const String& key, unsigned int value); // see Remarks
void set(const String& key, unsigned short value); // see Remarks bool set(const String& key, unsigned short value); // see Remarks
void set(const String& key, const char *value); // see Remarks bool set(const String& key, const char *value); // see Remarks
void set(const String& key, const String &value); // see Remarks twice bool set(const String& key, const String &value); // see Remarks twice
void set(const String& key, JsonArray &array); // see Remarks bool set(const String& key, JsonArray &array); // see Remarks
void set(const String& key, JsonObject &object); // see Remarks bool set(const String& key, JsonObject &object); // see Remarks
void set(const String& key, const JsonVariant &value); // see Remarks bool set(const String& key, const JsonVariant &value); // see Remarks
``` ```
##### Arguments ##### Arguments
`key`: the key to attach the value to. `key`: the key to attach the value to.
`value`: the value to attach to the key. `value`: the value to attach to the key.
##### Return value
`true` if allocation succeeded.
`false` if there was not enough space left in the `JsonBuffer`.
##### Remarks ##### Remarks
When you use a `String`, a copy of the string is made, causing the `JsonBuffer` to grow. When you use a `String`, a copy of the string is made, causing the `JsonBuffer` to grow.