/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef INCLUDE_ECXX_PLATFORM_SPECIFIC_PROG_STR_LITERAL_H
#error "this file cannot be included directly"
#endif
#undef INCLUDE_ECXX_PLATFORM_SPECIFIC_PROG_STR_LITERAL_H


#ifndef ECXX_PLATFORM_NODEMCU_PROG_STR_LITERAL_H
#define ECXX_PLATFORM_NODEMCU_PROG_STR_LITERAL_H


namespace eCxx {


//
// Literal operators to put inline string literals in program memory
//
#ifdef ECXX_CXXCOMP_HAVE_N3599

    // Inform that the platform-specific's literal operators have been defined here
    #define ECXX_PROGRAM_STRING_LITERALS_DEFINED

    // Define the literals
    namespace program_string_literals {

        template<typename CharT, CharT... Str>
        inline PGMCharPointer __ECXX_ATTR_ALWAYS_INLINE  operator "" _pgm()
        {
            ECXX_CHECK_IF_TEMPLATE_ARG_IS_CHAR(CharT);

            static const CharT __ECXX_ATTR_ALIGNED_4 PROGMEM_STR __C[] = { Str..., 0 };
            return eCxx::PGM_PTR(&__C[0]);
        }

        template<typename CharT, CharT... Str>
        inline PGMCharPointerFar __ECXX_ATTR_ALWAYS_INLINE  operator "" _pgmf()
        {
            ECXX_CHECK_IF_TEMPLATE_ARG_IS_CHAR(CharT);

            static const CharT __ECXX_ATTR_ALIGNED_4 PROGMEM_STR __C[] = { Str..., 0 };
            return eCxx::PGM_PTR_FAR(&__C[0]);
        }

    } // namespace program_string_literals

#endif


} // namespace eCxx


#endif
