[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recode "typeinfo::name()" into usable format
From: |
Paul Pluzhnikov |
Subject: |
Re: recode "typeinfo::name()" into usable format |
Date: |
Fri, 02 Feb 2007 13:48:16 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"Grizlyk" <grizlyk1@yandex.ru> writes:
> Well it can work, but it is not so good for templates, because
> "__cxa_demangle" makes full name of class with full name of each name
> of template parameter, that is why class name can have size about 1000
> chars, it is hard to read by human.
>
> If I want to print local name of template (_class name_ or _namespace_
> +_class name_), do I need to write simple manual parser for demangled
> name
I believe you'll find that demangled name does not yield itself to
being parsed with a simple parser (IOW, the task is actually harder
then you think).
> or there is gnu (__cxa_???) std parser to dividing full name into
> categories: namespaces, name, template parameters?
You may want to peek into gcc-3.4.6/include/demangle.h.
In particular:
/* Options passed to cplus_demangle (in 2nd parameter). */
#define DMGL_NO_OPTS 0 /* For readability... */
and
/* The V3 demangler works in two passes. The first pass builds a tree
representation of the mangled name, and the second pass turns the
tree representation into a demangled string. Here we define an
interface to permit a caller to build their own tree
representation, which they can pass to the demangler to get a
demangled string. This can be used to canonicalize user input into
something which the demangler might output. It could also be used
by other demanglers in the future. */
might allow you to do what you want.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.