Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Frameworks/WebServer/Response.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
6
7 /*
8 ********************************************************************************
9 ********************* Framework::WebServer::Response ***************************
10 ********************************************************************************
11 */
12 template <Characters::IConvertibleToString T>
13 inline void Response::write (T&& s)
14 {
15 if constexpr (Common::IAnyOf<T, String&&, String>) {
16 write (static_cast<const String&> (s));
17 }
18 else {
19 write (String{s});
20 }
21 }
22 inline void Response::write (const TypedBLOB& b)
23 {
24 this->contentType (b.fType);
25 this->write (b.fData);
26 }
27 template <typename CHAR_T, typename... ARGS>
28 inline void Response::write (const FormatString<CHAR_T>& f, ARGS&&... args)
29 {
30 write (f (args...));
31 }
32 inline void Response::writeln (const String& e)
33 {
34 Debug::AssertExternallySynchronizedMutex::WriteContext declareContext{_fThisAssertExternallySynchronized};
35 constexpr wchar_t kEOL[] = L"\r\n";
36 write (e);
37 write (span{std::begin (kEOL), std::end (kEOL) - 1});
38 }
39
40}
41
43 template <>
44 constexpr EnumNames<Frameworks::WebServer::Response::State> DefaultNames<Frameworks::WebServer::Response::State>::k{{{
45 {Frameworks::WebServer::Response::State::ePreparingHeaders, L"Preparing-Headers"},
46 {Frameworks::WebServer::Response::State::eHeadersSent, L"Headers-Sent"},
47 {Frameworks::WebServer::Response::State::eCompleted, L"Completed"},
48 }}};
49}
unique_lock< AssertExternallySynchronizedMutex > WriteContext
Instantiate AssertExternallySynchronizedMutex::WriteContext to designate an area of code where protec...