0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-11 08:02:59 +01:00
construct/include/ircd/demangle.h

40 lines
1.1 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
2019-09-20 01:37:18 +02:00
namespace ircd
{
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();
2019-09-20 01:37:18 +02:00
}
template<class T>
std::string
2019-09-20 01:37:18 +02:00
ircd::demangle()
{
return demangle(typeid(T).name());
}
template<class T>
ircd::string_view
2019-09-20 01:37:18 +02:00
ircd::demangle(const mutable_buffer &out)
{
return demangle(out, typeid(T).name());
}