wrap string literals in namespace

This commit is contained in:
Emil Muratov
2024-07-04 11:45:31 +09:00
committed by Mathieu Carbou
parent c004ca8cd3
commit bc8cadbcb4
9 changed files with 20 additions and 1 deletions

View File

@ -24,6 +24,8 @@
#include "AsyncEventSource.h"
#include "literals.h"
using namespace asyncsrv;
static String generateEventMessage(const char* message, const char* event, uint32_t id, uint32_t reconnect) {
String ev;

View File

@ -38,6 +38,9 @@
#define MAX_PRINTF_LEN 64
using namespace asyncsrv;
size_t webSocketSendFrameWindow(AsyncClient* client) {
if (!client->canSend())
return 0;

View File

@ -153,7 +153,7 @@ class AsyncWebHeader {
const String& name() const { return _name; }
const String& value() const { return _value; }
String toString() const { return _name + (char)0x3a + (char)0x20 /*": "*/ + _value + T_rn; }
String toString() const { return _name + (char)0x3a + (char)0x20 /*": "*/ + _value + asyncsrv::T_rn; }
};
/*

View File

@ -27,6 +27,8 @@
#endif
#include "literals.h"
using namespace asyncsrv;
// Basic Auth hash = base64("username:password")
bool checkBasicAuthentication(const char* hash, const char* username, const char* password) {

View File

@ -21,6 +21,9 @@
#include "ESPAsyncWebServer.h"
#include "WebHandlerImpl.h"
using namespace asyncsrv;
AsyncStaticWebHandler::AsyncStaticWebHandler(const char* uri, FS& fs, const char* path, const char* cache_control)
: _fs(fs), _uri(uri), _path(path), _default_file(F("index.htm")), _cache_control(cache_control), _last_modified(), _callback(nullptr) {
// Ensure leading '/'

View File

@ -26,6 +26,8 @@
#define __is_param_char(c) ((c) && ((c) != '{') && ((c) != '[') && ((c) != '&') && ((c) != '='))
using namespace asyncsrv;
enum { PARSE_REQ_START,
PARSE_REQ_HEADERS,
PARSE_REQ_BODY,

View File

@ -22,6 +22,8 @@
#include "WebResponseImpl.h"
#include "cbuf.h"
using namespace asyncsrv;
// Since ESP8266 does not link memchr by default, here's its implementation.
void* memchr(void* ptr, int ch, size_t count) {
unsigned char* p = static_cast<unsigned char*>(ptr);

View File

@ -21,6 +21,8 @@
#include "ESPAsyncWebServer.h"
#include "WebHandlerImpl.h"
using namespace asyncsrv;
bool ON_STA_FILTER(AsyncWebServerRequest* request) {
return WiFi.localIP() == request->client()->localIP();
}

View File

@ -1,5 +1,6 @@
#pragma once
namespace asyncsrv {
#ifndef ESP8622
static constexpr const char* T_100_CONTINUE = "100-continue";
@ -336,3 +337,5 @@ static const char T_uri[] PROGMEM = "uri";
static const char T_username[] PROGMEM = "username";
#endif // ESP8622
} // namespace asyncsrv {}