TClassEdit.h

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TClassEdit.h 33299 2010-04-29 14:43:56Z rdm $
00002 // Author: Victor Perev   10/04/2003
00003 //         Philippe Canal 05/2004
00004 
00005 /*************************************************************************
00006  * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers.               *
00007  * All rights reserved.                                                  *
00008  *                                                                       *
00009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00011  *************************************************************************/
00012 
00013 #ifndef ROOT_TClassEdit
00014 #define ROOT_TClassEdit
00015 
00016 #include "RConfig.h"
00017 #include <string>
00018 #include <vector>
00019 
00020 #ifdef R__OLDHPACC
00021 namespace std {
00022    using ::string;
00023    using ::vector;
00024 }
00025 #endif
00026 
00027 // TClassEdit is used to manipulate class and type names.
00028 //
00029 // This class does not dependent on any other ROOT facility
00030 // so that it can be used by rootcint.
00031 
00032 namespace TClassEdit {
00033 
00034    enum EModType {
00035       kNone             = 0,
00036       kDropTrailStar    = 1<<0,
00037       kDropDefaultAlloc = 1<<1,
00038       kDropAlloc        = 1<<2,
00039       kInnerClass       = 1<<3,
00040       kInnedMostClass   = 1<<4,
00041       kDropStlDefault   = 1<<5, /* implies kDropDefaultAlloc */
00042       kDropComparator   = 1<<6, /* if the class has a comparator, drops BOTH the comparator and the Allocator */
00043       kDropAllDefault   = 1<<7, /* Drop default template parameter even in non STL classes */
00044       kLong64           = 1<<8  /* replace all 'long long' with Long64_t. */
00045    };
00046 
00047    enum ESTLType {
00048       kNotSTL   = 0,
00049       kVector   = 1,
00050       kList     = 2,
00051       kDeque    = 3,
00052       kMap      = 4,
00053       kMultiMap = 5,
00054       kSet      = 6,
00055       kMultiSet = 7,
00056       kBitSet   = 8,
00057       kEnd      = 9
00058    };
00059 
00060    struct TSplitType {
00061       
00062       const char *fName; // Original spelling of the name.
00063       std::vector<std::string> fElements;
00064       int fNestedLocation; // Stores the location of the tail (nested names) in nestedLoc (0 indicates no tail).
00065 
00066       TSplitType(const char *type2split, EModType mode = TClassEdit::kNone);
00067 
00068       int  IsSTLCont(int testAlloc=0) const;
00069       void ShortType(std::string &answer, int mode);
00070 
00071    private:
00072       TSplitType(const TSplitType&); // intentionally not implemented
00073       TSplitType &operator=(const TSplitType &); // intentionally not implemented
00074    };
00075 
00076    std::string CleanType (const char *typeDesc,int mode = 0,const char **tail=0);
00077    bool        IsDefAlloc(const char *alloc, const char *classname);
00078    bool        IsDefAlloc(const char *alloc, const char *keyclassname, const char *valueclassname);
00079    bool        IsDefComp (const char *comp , const char *classname);
00080    bool        IsSTLBitset(const char *type);
00081    int         IsSTLCont (const char *type,int testAlloc=0);
00082    bool        IsStdClass(const char *type);
00083    bool        IsVectorBool(const char *name);
00084    std::string GetLong64_Name(const std::string& original);
00085    int         GetSplit  (const char *type, std::vector<std::string> &output, int &nestedLoc, EModType mode = TClassEdit::kNone);
00086    int         STLKind   (const char *type);    //Kind of stl container
00087    int         STLArgs   (int kind);            //Min number of arguments without allocator
00088    std::string ResolveTypedef(const char *tname, bool resolveAll = false);
00089    std::string ShortType (const char *typeDesc, int mode);
00090    std::string InsertStd(const char *tname);
00091 }
00092 
00093 #endif

Generated on Tue Jul 5 14:11:56 2011 for ROOT_528-00b_version by  doxygen 1.5.1