/* Copyright 2015, Michele Santullo
 * This file is part of DoorKeeper.
 *
 * DoorKeeper is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DoorKeeper is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with DoorKeeper.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef id3A8D22AD652142C9A44142EC942E4482
#define id3A8D22AD652142C9A44142EC942E4482

#include "doorkeeper/implem/doorkeeper_conf.h"

#if (defined(__clang__) && \
		(__clang_major__ == 3 && __clang_minor__ > 5) || (__clang_major__ > 3) \
	) || (defined(IS_ORIGINAL_GNUC) && \
		(__GNUC__ == 5 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 5) \
	)
#	define IS_PRETTY_FUNC_CONSTEXPR
#elif defined(__GNUC__)
//uhm.. nothing :p
#else
#	error "Unknown compiler"
#endif

#if defined(IS_PRETTY_FUNC_CONSTEXPR) || defined(USE_MANUAL_TYPENAMES)
#	include "sprout/string.hpp"
#	include "doorkeeper/implem/tiger_bt.hpp"
#	include <stdexcept>
#	if defined(USE_MANUAL_TYPENAMES)
#		include "sprout/cstring/strlen.hpp"
#	endif
#else
#	include <string>
#endif
#include "doorkeeper/implem/compatibility.h"
#include <cstdint>
#include <ciso646>

namespace dk {
#if !defined(IS_PRETTY_FUNC_CONSTEXPR) && !defined(USE_MANUAL_TYPENAMES)
	struct HashType {
		uint64_t a;
		uint64_t b;
		uint64_t c;
	};
#endif
#if defined(USE_MANUAL_TYPENAMES)
	template <typename T>
	constexpr const char* manual_type_name ( void ) a_pure;
#endif

	bool operator< ( const HashType& parL, const HashType& parR );

	namespace implem {
		HashType hash_string ( const char* parString, std::size_t parLen ) a_pure;

#if defined(IS_PRETTY_FUNC_CONSTEXPR) || defined(USE_MANUAL_TYPENAMES)
		template <typename T>
		constexpr std::size_t type_name_len ( void ) a_pure;

		template <typename T>
		struct type_name_info {
			constexpr type_name_info ( void );

			const std::size_t len;
			const char* const str;
		};
#endif
	} //namespace implem

	template <typename T>
#if defined(IS_PRETTY_FUNC_CONSTEXPR) || defined(USE_MANUAL_TYPENAMES)
	constexpr
#endif
	HashType type_name_hash ( void ) a_pure;

	template <typename T>
#if defined(IS_PRETTY_FUNC_CONSTEXPR) || defined(USE_MANUAL_TYPENAMES)
	constexpr sprout::string<implem::type_name_len<T>()> type_name ( void ) a_pure;
#else
	std::string type_name ( void ) a_pure;
#endif
} //namespace dk

#include "doorkeeper/implem/typename.inl"

#if defined(IS_PRETTY_FUNC_CONSTEXPR)
#	undef IS_PRETTY_FUNC_CONSTEXPR
#endif

#endif
