0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-01 19:38:54 +01:00
construct/include/ircd/demangle.h

40 lines
1.2 KiB
C
Raw Normal View History

// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_DEMANGLE_H
namespace ircd::util
{
IRCD_EXCEPTION(ircd::error, demangle_error)
IRCD_EXCEPTION(demangle_error, not_mangled)
string_view demangle(const mutable_buffer &out, const char *const &symbol);
string_view demangle(const mutable_buffer &out, const string_view &symbol);
std::string demangle(const string_view &symbol);
std::string demangle(const char *const &symbol);
template<class T> string_view demangle(const mutable_buffer &out);
template<class T> std::string demangle();
}
template<class T>
std::string
ircd::util::demangle()
{
return demangle(typeid(T).name());
}
template<class T>
ircd::string_view
ircd::util::demangle(const mutable_buffer &out)
{
return demangle(out, typeid(T).name());
}