Logo ROOT   master
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 "TClingDeclInfo.h"
29 
30 #include "clang/AST/Type.h"
31 
32 namespace cling {
33 class Interpreter;
34 }
35 
36 namespace ROOT {
37  namespace TMetaUtils {
38  class TNormalizedCtxt;
39  }
40 }
41 
42 class TClingTypeInfo final : public TClingDeclInfo {
43 
44 private:
45  cling::Interpreter *fInterp; //Cling interpreter, we do *not* own.
46  clang::QualType fQualType; //Clang qualified type we are querying.
47 
48 public:
49 
50  explicit TClingTypeInfo(cling::Interpreter *interp)
51  : TClingDeclInfo(nullptr), fInterp(interp) {}
52 
53  TClingTypeInfo(cling::Interpreter *interp, clang::QualType ty)
54  : TClingDeclInfo(nullptr), fInterp(interp), fQualType(ty) {}
55 
56  TClingTypeInfo(cling::Interpreter *interp, const char *name);
57 
58  cling::Interpreter *GetInterpreter() const { return fInterp; }
59 
60  clang::QualType GetQualType() const { return fQualType; }
61 
62  void Init(const char *name); // Set type by name.
63  void Init(clang::QualType ty) { fQualType = ty; }
64  bool IsValid() const override { return !fQualType.isNull(); }
65  const char *Name() const override; // Get name of type.
66  long Property() const; // Get properties of type.
67  int RefType() const; // Get CINT reftype of type.
68  int Size() const; // Get size in bytes of type.
69  const char *TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const; // Get name of type with no typedefs.
70  std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const; // Get name of type with no typedefs.
71 
72 };
73 
74 #endif // ROOT_TClingTypeInfo
const char * TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
Returns the available number of logical cores.
Definition: StringConv.hxx:21
clang::QualType GetQualType() const
TClingTypeInfo(cling::Interpreter *interp, clang::QualType ty)
void Init(const char *name)
cling::Interpreter * fInterp
TClingTypeInfo(cling::Interpreter *interp)
Emulation of the CINT TypeInfo class.
cling::Interpreter * GetInterpreter() const
bool IsValid() const override
std::string NormalizedName(const ROOT::TMetaUtils::TNormalizedCtxt &normCtxt) const
Return the normalized name of the type (i.e.
const char * Name() const override
void Init(clang::QualType ty)
long Property() const
clang::QualType fQualType
Print a TSeq at the prompt:
Definition: TDatime.h:115
int Size() const
int RefType() const
The file contains a base class of TCling*Info classes.
char name[80]
Definition: TGX11.cxx:109