NeoFOAM
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
demangle.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2024 NeoFOAM authors
3
4#pragma once
5// TODO For WIN builds, needs to be ifdef'ed out.
6#ifdef __GNUC__
7#include <cxxabi.h>
8#endif
9#include <string>
10#include <any>
11#include <iostream>
12
13namespace NeoFOAM
14{
15
16std::string demangle(const char* mangledName);
17
18template<typename T, typename Container, typename Key>
19void logBadAnyCast(const std::bad_any_cast& e, const Key& key, const Container& data)
20{
21 std::cerr << "Caught a bad_any_cast exception: \n"
22 << "requested type " << demangle(typeid(T).name()) << "\n"
23 << "actual type " << demangle(data.at(key).type().name()) << "\n"
24 << e.what() << std::endl;
25}
26
27}
const std::string & name(const NeoFOAM::Document &doc)
Retrieves the name of a Document.
std::string demangle(const char *mangledName)
void logBadAnyCast(const std::bad_any_cast &e, const Key &key, const Container &data)
Definition demangle.hpp:19