ROOT logo
// @(#)root/base:$Id$
// Author: Victor Perev   10/04/2003
//         Philippe Canal 05/2004

/*************************************************************************
 * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TClassEdit
#define ROOT_TClassEdit

#include "RConfig.h"
#include <string>
#include <vector>

#ifndef ROOT_ESTLType
#include "ESTLType.h"
#endif

#ifdef R__OLDHPACC
namespace std {
   using ::string;
   using ::vector;
}
#endif

#if defined(__CYGWIN__)
// std::to_string is missing on cygwin with gcc 4.8.2-2 and 4.8.3
#include <sstream>
namespace std {
  template <typename T>
  string to_string(T value) {
    ostringstream os;
    os << value;
    return os.str();
  }
}
#endif

// TClassEdit is used to manipulate class and type names.
//
// This class does not dependent on any other ROOT facility
// so that it can be used by rootcint.

namespace TClassEdit {

   enum EModType {
      kNone             = 0,
      kDropTrailStar    = 1<<0,
      kDropDefaultAlloc = 1<<1,
      kDropAlloc        = 1<<2,
      kInnerClass       = 1<<3,
      kInnedMostClass   = 1<<4,
      kDropStlDefault   = 1<<5, /* implies kDropDefaultAlloc */
      kDropComparator   = 1<<6, /* if the class has a comparator, drops BOTH the comparator and the Allocator */
      kDropAllDefault   = 1<<7, /* Drop default template parameter even in non STL classes */
      kLong64           = 1<<8, /* replace all 'long long' with Long64_t. */
      kDropStd          = 1<<9  /* Drop any std:: */
   };

   enum ESTLType {
      kNotSTL   = ROOT::kNotSTL,
      kVector   = ROOT::kSTLvector,
      kList     = ROOT::kSTLlist,
      kDeque    = ROOT::kSTLdeque,
      kMap      = ROOT::kSTLmap,
      kMultiMap = ROOT::kSTLmultimap,
      kSet      = ROOT::kSTLset,
      kMultiSet = ROOT::kSTLmultiset,
      kBitSet   = ROOT::kSTLbitset,
      kEnd      = 9
   };

   struct TSplitType {
      
      const char *fName; // Original spelling of the name.
      std::vector<std::string> fElements;
      int fNestedLocation; // Stores the location of the tail (nested names) in nestedLoc (0 indicates no tail).

      TSplitType(const char *type2split, EModType mode = TClassEdit::kNone);

      int  IsSTLCont(int testAlloc=0) const;
      void ShortType(std::string &answer, int mode);

   private:
      TSplitType(const TSplitType&); // intentionally not implemented
      TSplitType &operator=(const TSplitType &); // intentionally not implemented
   };

   std::string CleanType (const char *typeDesc,int mode = 0,const char **tail=0);
   bool        IsDefAlloc(const char *alloc, const char *classname);
   bool        IsDefAlloc(const char *alloc, const char *keyclassname, const char *valueclassname);
   bool        IsDefComp (const char *comp , const char *classname);
   bool        IsSTLBitset(const char *type);
   int         IsSTLCont (const char *type,int testAlloc=0);
   bool        IsStdClass(const char *type);
   bool        IsVectorBool(const char *name);
   std::string GetLong64_Name(const char *original);
   std::string GetLong64_Name(const std::string& original);
   int         GetSplit  (const char *type, std::vector<std::string> &output, int &nestedLoc, EModType mode = TClassEdit::kNone);
   int         STLKind   (const char *type);    //Kind of stl container
   int         STLArgs   (int kind);            //Min number of arguments without allocator
   std::string ResolveTypedef(const char *tname, bool resolveAll = false);
   std::string ShortType (const char *typeDesc, int mode);
   std::string InsertStd(const char *tname);
}

#endif
 TClassEdit.h:1
 TClassEdit.h:2
 TClassEdit.h:3
 TClassEdit.h:4
 TClassEdit.h:5
 TClassEdit.h:6
 TClassEdit.h:7
 TClassEdit.h:8
 TClassEdit.h:9
 TClassEdit.h:10
 TClassEdit.h:11
 TClassEdit.h:12
 TClassEdit.h:13
 TClassEdit.h:14
 TClassEdit.h:15
 TClassEdit.h:16
 TClassEdit.h:17
 TClassEdit.h:18
 TClassEdit.h:19
 TClassEdit.h:20
 TClassEdit.h:21
 TClassEdit.h:22
 TClassEdit.h:23
 TClassEdit.h:24
 TClassEdit.h:25
 TClassEdit.h:26
 TClassEdit.h:27
 TClassEdit.h:28
 TClassEdit.h:29
 TClassEdit.h:30
 TClassEdit.h:31
 TClassEdit.h:32
 TClassEdit.h:33
 TClassEdit.h:34
 TClassEdit.h:35
 TClassEdit.h:36
 TClassEdit.h:37
 TClassEdit.h:38
 TClassEdit.h:39
 TClassEdit.h:40
 TClassEdit.h:41
 TClassEdit.h:42
 TClassEdit.h:43
 TClassEdit.h:44
 TClassEdit.h:45
 TClassEdit.h:46
 TClassEdit.h:47
 TClassEdit.h:48
 TClassEdit.h:49
 TClassEdit.h:50
 TClassEdit.h:51
 TClassEdit.h:52
 TClassEdit.h:53
 TClassEdit.h:54
 TClassEdit.h:55
 TClassEdit.h:56
 TClassEdit.h:57
 TClassEdit.h:58
 TClassEdit.h:59
 TClassEdit.h:60
 TClassEdit.h:61
 TClassEdit.h:62
 TClassEdit.h:63
 TClassEdit.h:64
 TClassEdit.h:65
 TClassEdit.h:66
 TClassEdit.h:67
 TClassEdit.h:68
 TClassEdit.h:69
 TClassEdit.h:70
 TClassEdit.h:71
 TClassEdit.h:72
 TClassEdit.h:73
 TClassEdit.h:74
 TClassEdit.h:75
 TClassEdit.h:76
 TClassEdit.h:77
 TClassEdit.h:78
 TClassEdit.h:79
 TClassEdit.h:80
 TClassEdit.h:81
 TClassEdit.h:82
 TClassEdit.h:83
 TClassEdit.h:84
 TClassEdit.h:85
 TClassEdit.h:86
 TClassEdit.h:87
 TClassEdit.h:88
 TClassEdit.h:89
 TClassEdit.h:90
 TClassEdit.h:91
 TClassEdit.h:92
 TClassEdit.h:93
 TClassEdit.h:94
 TClassEdit.h:95
 TClassEdit.h:96
 TClassEdit.h:97
 TClassEdit.h:98
 TClassEdit.h:99
 TClassEdit.h:100
 TClassEdit.h:101
 TClassEdit.h:102
 TClassEdit.h:103
 TClassEdit.h:104
 TClassEdit.h:105
 TClassEdit.h:106
 TClassEdit.h:107
 TClassEdit.h:108
 TClassEdit.h:109
 TClassEdit.h:110
 TClassEdit.h:111
 TClassEdit.h:112