1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsLiteralString_h___
8 #define nsLiteralString_h___
13 #include "nsTLiteralString.h"
15 #include "mozilla/Char16.h"
17 #define NS_CSTRING_LITERAL_AS_STRING_LITERAL(s) u"" s
19 #define NS_LITERAL_STRING_FROM_CSTRING(s) \
20 static_cast<const nsLiteralString&>( \
21 nsLiteralString(NS_CSTRING_LITERAL_AS_STRING_LITERAL(s)))
23 constexpr auto operator""_ns(const char* aStr
, std::size_t aLen
) {
24 return nsLiteralCString
{aStr
, aLen
};
27 constexpr auto operator""_ns(const char16_t
* aStr
, std::size_t aLen
) {
28 return nsLiteralString
{aStr
, aLen
};
31 #endif /* !defined(nsLiteralString_h___) */