1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-28 05:01:28 +03:00

Further const correctness / String by reference passing cleanups (#6571)

There are actually several instances where we pass in read-only
parameters as pass-by-value, where in the case of String() that
is inefficient as it involves copy-constructor/temp string creations.

We can avoid that, similarly to single character string concatenations
done via string literals instead of char literals.
This commit is contained in:
Dirk Mueller
2019-10-31 16:02:40 +01:00
committed by david gauchard
parent ba971fe7e9
commit 8bc5a10d6d
11 changed files with 78 additions and 75 deletions

View File

@ -107,17 +107,17 @@ public:
// Allows setting server options (i.e. SSL keys) by the instantiator
ServerType &getServer() { return _server; }
const String& arg(String name) const; // get request argument value by name
const String& arg(const String& name) const; // get request argument value by name
const String& arg(int i) const; // get request argument value by number
const String& argName(int i) const; // get request argument name by number
int args() const; // get arguments count
bool hasArg(const String& name) const; // check if argument exists
void collectHeaders(const char* headerKeys[], const size_t headerKeysCount); // set the request headers to collect
const String& header(String name) const; // get request header value by name
const String& header(const String& name) const; // get request header value by name
const String& header(int i) const; // get request header value by number
const String& headerName(int i) const; // get request header name by number
int headers() const; // get header count
bool hasHeader(String name) const; // check if header exists
bool hasHeader(const String& name) const; // check if header exists
const String& hostHeader() const; // get request host header if available or empty String if not
// send response to the client