#ifndef ROOT_TTabCom
#define ROOT_TTabCom
#ifndef ROOT_TObjString
#include "TObjString.h"
#endif
#ifndef ROOT_TRegExp
#include "TRegexp.h"
#endif
#define MAX_LEN_PAT 1024 // maximum length of a pattern
#define dblquote(x) "\"" << x << "\""
class TList;
class TListIter;
class TSeqCollection;
class TClass;
class TTabCom {
public:
TTabCom();
virtual ~TTabCom();
public:
typedef TList TContainer;
typedef TListIter TContIter;
public:
Int_t Hook(char *buf, int *pLoc);
const TSeqCollection* GetListOfClasses();
const TSeqCollection* GetListOfCppDirectives();
const TSeqCollection* GetListOfFilesInPath( const char path[] );
const TSeqCollection* GetListOfEnvVars();
const TSeqCollection* GetListOfGlobalFunctions();
const TSeqCollection* GetListOfGlobals();
const TSeqCollection* GetListOfPragmas();
const TSeqCollection* GetListOfSysIncFiles();
const TSeqCollection* GetListOfUsers();
void ClearClasses();
void ClearCppDirectives();
void ClearEnvVars();
void ClearFiles();
void ClearGlobalFunctions();
void ClearGlobals();
void ClearPragmas();
void ClearSysIncFiles();
void ClearUsers();
void ClearAll();
void RehashClasses();
void RehashCppDirectives();
void RehashEnvVars();
void RehashFiles();
void RehashGlobalFunctions();
void RehashGlobals();
void RehashPragmas();
void RehashSysIncFiles();
void RehashUsers();
void RehashAll();
public:
static Char_t AllAgreeOnChar( int i, const TSeqCollection* pList, Int_t& nGoodStrings );
static void AppendListOfFilesInDirectory( const char dirName[], TSeqCollection* pList );
static TString DetermineClass( const char varName[] );
static Bool_t ExcludedByFignore( TString s );
static TString GetSysIncludePath();
static Bool_t IsDirectory( const char fileName[] );
static TSeqCollection* NewListOfFilesInPath( const char path[] );
static Bool_t PathIsSpecifiedInFileName( const TString& fileName );
static void NoMsg( Int_t errorLevel );
public:
enum {kDebug = 17};
enum EContext_t {
kUNKNOWN_CONTEXT=-1,
kSYS_UserName,
kSYS_EnvVar,
kCINT_stdout,
kCINT_stderr,
kCINT_stdin,
kCINT_Edit,
kCINT_Load,
kCINT_Exec,
kCINT_EXec,
kCINT_pragma,
kCINT_includeSYS,
kCINT_includePWD,
kCINT_cpp,
kROOT_Load,
kSYS_FileName,
kCXX_NewProto,
kCXX_ConstructorProto,
kCXX_ScopeProto,
kCXX_DirectProto,
kCXX_IndirectProto,
kCXX_ScopeMember,
kCXX_DirectMember,
kCXX_IndirectMember,
kCXX_Global,
kCXX_GlobalProto,
kNUM_PAT
};
private:
TTabCom(const TTabCom &);
TTabCom& operator=(const TTabCom&);
Int_t Complete( const TRegexp& re, const TSeqCollection* pListOfCandidates, const char appendage[], TString::ECaseCompare cmp = TString::kExact);
void CopyMatch( char dest[], const char localName[], const char appendage[]=0, const char fullName[]=0 ) const;
EContext_t DetermineContext() const;
TString DeterminePath( const TString& fileName, const char defaultPath[] ) const;
TString ExtendPath( const char originalPath[], TString newBase ) const;
void InitPatterns();
TClass* MakeClassFromClassName( const char className[] ) const;
TClass* TryMakeClassFromClassName( const char className[] ) const;
TClass* MakeClassFromVarName( const char varName[], EContext_t& context,
int iter=0);
void SetPattern( EContext_t handle, const char regexp[] );
int ParseReverse(const char *var_str, int start);
private:
TSeqCollection* fpClasses;
TSeqCollection* fpNamespaces;
TSeqCollection* fpDirectives;
TSeqCollection* fpEnvVars;
TSeqCollection* fpFiles;
TSeqCollection* fpGlobals;
TSeqCollection* fpGlobalFuncs;
TSeqCollection* fpPragmas;
TSeqCollection* fpSysIncFiles;
TSeqCollection* fpUsers;
char* fBuf;
int* fpLoc;
Pattern_t fPat[ kNUM_PAT ][ MAX_LEN_PAT ];
const char* fRegExp[ kNUM_PAT ];
Bool_t fVarIsPointer;
Int_t fLastIter;
ClassDef(TTabCom,0)
};
extern TTabCom *gTabCom;
#endif