Logo ROOT   6.08/07
Reference Guide
TClingTypeInfo.h
Go to the documentation of this file.
1 // @(#)root/core/meta:$Id$
2 // Author: Paul Russo 30/07/2012
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TClingTypeInfo
13 #define ROOT_TClingTypeInfo
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TClingTypeInfo //
18 // //
19 // Emulation of the CINT TypeInfo class. //
20 // //
21 // The CINT C++ interpreter provides an interface to metadata about //
22 // a type through the TypeInfo class. This class provides the same //
23 // functionality, using an interface as close as possible to TypeInfo //
24 // but the type metadata comes from the Clang C++ compiler, not CINT. //
25 // //
26 //////////////////////////////////////////////////////////////////////////
27 
28 #include "clang/AST/Type.h"
29 
30 namespace cling {
31 class Interpreter;
32 }
33 
34 namespace ROOT {
35  namespace TMetaUtils {
36  class TNormalizedCtxt;
37  }
38 }
39 
41 
42 private:
43  cling::Interpreter *fInterp; //Cling interpreter, we do *not* own.
44  clang::QualType fQualType; //Clang qualified type we are querying.
45 
46 public:
47 
48  explicit TClingTypeInfo(cling::Interpreter *interp)
49  : fInterp(interp) {}
50 
51  TClingTypeInfo(cling::Interpreter *interp, clang::QualType ty)
52  : fInterp(interp), fQualType(ty) {}
53 
54  TClingTypeInfo(cling::Interpreter *interp, const char *name);
55 
56  cling::Interpreter *GetInterpreter() const { return fInterp; }
57 
58  clang::QualType GetQualType() const { return fQualType; }
59 
60  void Init(const char *name); // Set type by name.
61  void Init(clang::QualType ty) { fQualType = ty; }
62  bool IsValid() const { return !fQualType.isNull(); }
63  const char *Name() const; // Get name of type.
64  long Property() const; // Get properties of type.
65  int RefType() const; // Get CINT reftype of type.
66  int Size() const; // Get size in bytes of type.
67  const char *StemName() const; // Get name of type chain leaf node.
68  const char *TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const; // Get name of type with no typedefs.
69  std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const; // Get name of type with no typedefs.
70 
71 };
72 
73 #endif // ROOT_TClingTypeInfo
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
clang::QualType GetQualType() const
TClingTypeInfo(cling::Interpreter *interp, clang::QualType ty)
const char * Size
Definition: TXMLSetup.cxx:56
cling::Interpreter * fInterp
TClingTypeInfo(cling::Interpreter *interp)
const char * Name
Definition: TXMLSetup.cxx:67
bool IsValid() const
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Definition: TClassEdit.cxx:119
Emulation of the CINT TypeInfo class.
cling::Interpreter * GetInterpreter() const
std::string TrueName(const clang::FieldDecl &m)
TrueName strips the typedefs and array dimensions.
void Init(clang::QualType ty)
clang::QualType fQualType
Print a TSeq at the prompt:
Definition: TDatime.h:114
char name[80]
Definition: TGX11.cxx:109