// @(#)root/html:$Id$
// Author: Nenad Buncic   18/10/95

/*************************************************************************
 * Copyright (C) 1995-2000, 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_TDocInfo
#define ROOT_TDocInfo

#ifndef ROOT_TClass
#include "TClass.h"
#endif
#ifndef ROOT_THashList
#include "THashList.h"
#endif
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#include <string>
#include <set>

class TDictionary;

class TModuleDocInfo;
//____________________________________________________________________
//
// Cache doc info for all known classes
//
class TClassDocInfo: public TObject {
public:
   // initialize the object
   TClassDocInfo(TClass* cl,
      const char* htmlfilename = "",
      const char* fsdecl = "", const char* fsimpl = "",
      const char* decl = 0, const char* impl = 0):
      fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
      fDeclFileName(decl ? decl : cl->GetDeclFileName()),
      fImplFileName(impl ? impl : cl->GetImplFileName()),
      fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
      fSelected(kTRUE) { }

   TClassDocInfo(TDictionary* cl,
      const char* htmlfilename = "",
      const char* fsdecl = "", const char* fsimpl = "",
      const char* decl = 0, const char* impl = 0):
      fClass(cl), fModule(0), fHtmlFileName(htmlfilename),
      fDeclFileName(decl),
      fImplFileName(impl),
      fDeclFileSysName(fsdecl), fImplFileSysName(fsimpl),
      fSelected(kTRUE) { }

   virtual ~TClassDocInfo() {}

           TDictionary*    GetClass() const { return fClass; }
   virtual const char*     GetName() const;
           const char*     GetHtmlFileName() const { return fHtmlFileName; }
           const char*     GetDeclFileName() const { return fDeclFileName; }
           const char*     GetImplFileName() const { return fImplFileName; }
           const char*     GetDeclFileSysName() const { return fDeclFileSysName; }
           const char*     GetImplFileSysName() const { return fImplFileSysName; }

           void            SetModule(TModuleDocInfo* module) { fModule = module; }
           TModuleDocInfo* GetModule() const { return fModule; }

           void            SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
           Bool_t          IsSelected() const { return fSelected; }
           Bool_t          HaveSource() const { return fDeclFileSysName.Length()
                                                   || (fClass && !dynamic_cast<TClass*>(fClass)); }

           void            SetHtmlFileName(const char* name) { fHtmlFileName = name; }
           void            SetDeclFileName(const char* name) { fDeclFileName = name; }
           void            SetImplFileName(const char* name) { fImplFileName = name; }
           void            SetDeclFileSysName(const char* fsname) { fDeclFileSysName = fsname; }
           void            SetImplFileSysName(const char* fsname) { fImplFileSysName = fsname; }

           ULong_t         Hash() const;

           TList&          GetListOfTypedefs() { return fTypedefs; }

   virtual Bool_t          IsSortable() const { return kTRUE; }
   virtual Int_t           Compare(const TObject* obj) const;

private:
   TClassDocInfo();

   TDictionary*            fClass; // class (or typedef) represented by this info object
   TModuleDocInfo*         fModule; // module this class is in
   TString                 fHtmlFileName; // name of the HTML doc file
   TString                 fDeclFileName; // header
   TString                 fImplFileName; // source
   TString                 fDeclFileSysName; // file system's location of the header
   TString                 fImplFileSysName; // file system's location of the source
   TList                   fTypedefs; // typedefs to this class
   Bool_t                  fSelected; // selected for doc output

   ClassDef(TClassDocInfo,0); // info cache for class documentation
};

//____________________________________________________________________
//
// Cache doc info for all known modules
//
class TModuleDocInfo: public TNamed {
public:
   TModuleDocInfo(const char* name, TModuleDocInfo* super, const char* doc = ""):
      TNamed(name, doc), fSuper(super), fSub(0), fSelected(kTRUE) {
         if (super) super->GetSub().Add(this);
      }
   virtual ~TModuleDocInfo() {}

   void        SetDoc(const char* doc) { SetTitle(doc); }
   const char* GetDoc() const { return GetTitle(); }

   void        SetSelected(Bool_t sel = kTRUE) { fSelected = sel; }
   Bool_t      IsSelected() const { return fSelected; }

   void        AddClass(TClassDocInfo* cl) { fClasses.Add(cl); }
   TList*      GetClasses() { return &fClasses; }

   TModuleDocInfo* GetSuper() const { return fSuper; }
   THashList&  GetSub() { return fSub; }

private:
   TModuleDocInfo* fSuper; // module containing this module
   THashList   fSub; // modules contained in this module
   TList       fClasses;
   Bool_t      fSelected; // selected for doc output

   ClassDef(TModuleDocInfo,0); // documentation for a group of classes
};

//__________________________________________________________________________
//
// A library's documentation database:
// dependencies and sub-modules
//
class TLibraryDocInfo: public TNamed {
 public:
   TLibraryDocInfo() {}
   TLibraryDocInfo(const char* lib): TNamed(lib, "") {}

   std::set<std::string>& GetDependencies() {return fDependencies;}
   std::set<std::string>& GetModules() {return fModules;}
   void AddDependency(const std::string& lib) {fDependencies.insert(lib);}
   void AddModule(const std::string& module) {fModules.insert(module);}

 private:
   std::set<std::string> fDependencies; // dependencies on other libraries
   std::set<std::string> fModules; // modules in the library

   ClassDef(TLibraryDocInfo,0); // documentation for a library
};


#endif // ROOT_TDocInfo
 TDocInfo.h:1
 TDocInfo.h:2
 TDocInfo.h:3
 TDocInfo.h:4
 TDocInfo.h:5
 TDocInfo.h:6
 TDocInfo.h:7
 TDocInfo.h:8
 TDocInfo.h:9
 TDocInfo.h:10
 TDocInfo.h:11
 TDocInfo.h:12
 TDocInfo.h:13
 TDocInfo.h:14
 TDocInfo.h:15
 TDocInfo.h:16
 TDocInfo.h:17
 TDocInfo.h:18
 TDocInfo.h:19
 TDocInfo.h:20
 TDocInfo.h:21
 TDocInfo.h:22
 TDocInfo.h:23
 TDocInfo.h:24
 TDocInfo.h:25
 TDocInfo.h:26
 TDocInfo.h:27
 TDocInfo.h:28
 TDocInfo.h:29
 TDocInfo.h:30
 TDocInfo.h:31
 TDocInfo.h:32
 TDocInfo.h:33
 TDocInfo.h:34
 TDocInfo.h:35
 TDocInfo.h:36
 TDocInfo.h:37
 TDocInfo.h:38
 TDocInfo.h:39
 TDocInfo.h:40
 TDocInfo.h:41
 TDocInfo.h:42
 TDocInfo.h:43
 TDocInfo.h:44
 TDocInfo.h:45
 TDocInfo.h:46
 TDocInfo.h:47
 TDocInfo.h:48
 TDocInfo.h:49
 TDocInfo.h:50
 TDocInfo.h:51
 TDocInfo.h:52
 TDocInfo.h:53
 TDocInfo.h:54
 TDocInfo.h:55
 TDocInfo.h:56
 TDocInfo.h:57
 TDocInfo.h:58
 TDocInfo.h:59
 TDocInfo.h:60
 TDocInfo.h:61
 TDocInfo.h:62
 TDocInfo.h:63
 TDocInfo.h:64
 TDocInfo.h:65
 TDocInfo.h:66
 TDocInfo.h:67
 TDocInfo.h:68
 TDocInfo.h:69
 TDocInfo.h:70
 TDocInfo.h:71
 TDocInfo.h:72
 TDocInfo.h:73
 TDocInfo.h:74
 TDocInfo.h:75
 TDocInfo.h:76
 TDocInfo.h:77
 TDocInfo.h:78
 TDocInfo.h:79
 TDocInfo.h:80
 TDocInfo.h:81
 TDocInfo.h:82
 TDocInfo.h:83
 TDocInfo.h:84
 TDocInfo.h:85
 TDocInfo.h:86
 TDocInfo.h:87
 TDocInfo.h:88
 TDocInfo.h:89
 TDocInfo.h:90
 TDocInfo.h:91
 TDocInfo.h:92
 TDocInfo.h:93
 TDocInfo.h:94
 TDocInfo.h:95
 TDocInfo.h:96
 TDocInfo.h:97
 TDocInfo.h:98
 TDocInfo.h:99
 TDocInfo.h:100
 TDocInfo.h:101
 TDocInfo.h:102
 TDocInfo.h:103
 TDocInfo.h:104
 TDocInfo.h:105
 TDocInfo.h:106
 TDocInfo.h:107
 TDocInfo.h:108
 TDocInfo.h:109
 TDocInfo.h:110
 TDocInfo.h:111
 TDocInfo.h:112
 TDocInfo.h:113
 TDocInfo.h:114
 TDocInfo.h:115
 TDocInfo.h:116
 TDocInfo.h:117
 TDocInfo.h:118
 TDocInfo.h:119
 TDocInfo.h:120
 TDocInfo.h:121
 TDocInfo.h:122
 TDocInfo.h:123
 TDocInfo.h:124
 TDocInfo.h:125
 TDocInfo.h:126
 TDocInfo.h:127
 TDocInfo.h:128
 TDocInfo.h:129
 TDocInfo.h:130
 TDocInfo.h:131
 TDocInfo.h:132
 TDocInfo.h:133
 TDocInfo.h:134
 TDocInfo.h:135
 TDocInfo.h:136
 TDocInfo.h:137
 TDocInfo.h:138
 TDocInfo.h:139
 TDocInfo.h:140
 TDocInfo.h:141
 TDocInfo.h:142
 TDocInfo.h:143
 TDocInfo.h:144
 TDocInfo.h:145
 TDocInfo.h:146
 TDocInfo.h:147
 TDocInfo.h:148
 TDocInfo.h:149
 TDocInfo.h:150
 TDocInfo.h:151
 TDocInfo.h:152
 TDocInfo.h:153
 TDocInfo.h:154
 TDocInfo.h:155
 TDocInfo.h:156
 TDocInfo.h:157
 TDocInfo.h:158
 TDocInfo.h:159
 TDocInfo.h:160