~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to util/lib/pretty_name.h

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Saramito
  • Date: 2011-02-08 10:00:06 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110208100006-jg8rarizvhdm8e82
Tags: 5.92-1
* New upstream release:
  - "rheolef" suffix added to all unix manuals (Closes: #607117)
  - minor source code fixes for g++-4.5 (Closes: #607184)
  - minor reference manual fix (Closes: #607038)
* debian/control: libboost-iostreams-dev dependency added, as required
  by the new upstream version.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _RHEOLEF_PRETTY_NAME_H
 
2
#define _RHEOLEF_PRETTY_NAME_H
 
3
///
 
4
/// This file is part of Rheolef.
 
5
///
 
6
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
 
7
///
 
8
/// Rheolef is free software; you can redistribute it and/or modify
 
9
/// it under the terms of the GNU General Public License as published by
 
10
/// the Free Software Foundation; either version 2 of the License, or
 
11
/// (at your option) any later version.
 
12
///
 
13
/// Rheolef is distributed in the hope that it will be useful,
 
14
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
/// GNU General Public License for more details.
 
17
///
 
18
/// You should have received a copy of the GNU General Public License
 
19
/// along with Rheolef; if not, write to the Free Software
 
20
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
21
///
 
22
/// =========================================================================
 
23
 
 
24
#include "rheolef/compiler.h"
 
25
#include <typeinfo>
 
26
 
 
27
namespace rheolef {
 
28
 
 
29
/*Class:man
 
30
NAME: @code{typeid_name_macro}, @code{pretty_name_macro} - type demangler and pretty printer
 
31
DESCRIPTION:
 
32
  These preprocessor macro-definitions are usefull when dealing with complex types
 
33
  as generated by imbricted template technics: they print in clear a complex type at run-time.
 
34
  @code{typeid_name_macro} obtains a human readable type in a @code{std::tring} form
 
35
  by calling the system @code{typeid} function and then a demangler.
 
36
  When this type is very long, @code{pretty_name_macro} prints also it in a multi-line
 
37
  form with a pretty indentation.
 
38
EXAMPLE:
 
39
 @example
 
40
  typedef map <size_t, double, less<size_t>, heap_allocator<pair<size_t,double> > >  map_type;
 
41
  cout << typeid_name_macro (map_type);
 
42
 @end example
 
43
AUTHORS:
 
44
    LJK-IMAG, 38041 Grenoble cedex 9, France
 
45
   | Pierre.Saramito@imag.fr
 
46
DATE: 15 december 2010
 
47
End:
 
48
*/
 
49
//<verbatim:
 
50
extern std::string typeid_name (const char* name, bool do_indent);
 
51
 
 
52
#define typeid_name_macro(T) typeid_name(typeid(T).name(), false)
 
53
#define pretty_name_macro(T) typeid_name(typeid(T).name(), true)
 
54
//>verbatim:
 
55
 
 
56
} // namespace rheolef
 
57
#endif // _RHEOLEF_PRETTY_NAME_H