Go to the
documentation of this file.
00001 #pragma once
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "maxheap.h"
00012 #include "strclass.h"
00013 #include "plugapi.h"
00014 #include "Path.h"
00015 #include "Noncopyable.h"
00016 #include "BuildWarnings.h"
00017 #include "DataClassDesc.h"
00018
00027 typedef const ULONG (*LibVersionProcPtr)();
00028
00031 typedef const MCHAR* (*LibDescriptionProcPtr)();
00032
00036 typedef int (*LibNumberClassesProcPtr)();
00037
00041 typedef ClassDesc* (*LibClassDescProcPtr)(int i);
00043
00053 typedef int (*LibInitializeProcPtr)();
00054
00058 typedef int (*LibShutdownProcPtr)();
00059
00065 typedef ULONG (*CanAutoDeferProcPtr)();
00067
00090 class DllDesc: public MaxHeapOperators
00091 {
00092 public:
00095 CoreExport bool IsLoaded() const;
00096
00098 CoreExport const MCHAR* Description() const;
00099
00102 CoreExport int NumberOfClasses() const;
00103
00107 CoreExport ClassDesc* operator[](int i) const;
00108
00113 CoreExport ClassDesc* GetClassDesc(int i) const;
00114
00116 CoreExport int operator==( const DllDesc& dd ) const;
00117
00123 CoreExport bool HasRttiSupport() const;
00124
00128 CoreExport bool IsBinaryCompatible() const;
00129
00131 CoreExport ULONG GetVersion() const;
00132
00134 CoreExport bool IsDeferrable() const;
00135
00137 CoreExport bool ImplementsCanAutoDefer() const;
00138
00147 CoreExport static bool IsPluginDllVersionValid(ULONG pluginDllVersion);
00148
00150 CoreExport const MSTR& GetFullPath() const;
00151
00153 CoreExport const MSTR& GetFileName() const;
00154
00157 CoreExport const MSTR& GetDirectoryName() const;
00158
00161 CoreExport const HINSTANCE GetHandle() const;
00162
00165 CoreExport DWORD GetSize() const;
00166
00168 CoreExport FILETIME GetTimeLastModified() const;
00169
00176 MAX_DEPRECATED void Free();
00177
00181 MAX_DEPRECATED BOOL Initialize();
00182
00186 MAX_DEPRECATED BOOL Shutdown();
00187
00188
00189
00190
00191
00192
00193 explicit DllDesc(
00194 HINSTANCE dllHandle,
00195 const MCHAR* dllFullPath,
00196 LibVersionProcPtr libVersionProcPtr,
00197 LibDescriptionProcPtr libDescriptionProcPtr,
00198 LibNumberClassesProcPtr libNumberClassesProcPtr,
00199 LibClassDescProcPtr libClassDescProcPtr,
00200 LibInitializeProcPtr libInitializeProcPtr,
00201 LibShutdownProcPtr libShutdownProcPtr,
00202 CanAutoDeferProcPtr canAutoDeferProcPtr,
00203 const FILETIME& timeLastWrite);
00204
00205
00206 explicit DllDesc(const MCHAR* dllFullPath, const MCHAR* dllDescription, const FILETIME& timeLastWrite);
00207
00208
00209 void Unload();
00210
00211
00212 BOOL CallInitialize();
00213
00214
00215 BOOL CallShutdown();
00216
00217
00218 DllDesc(const DllDesc& other);
00219
00220
00221 DllDesc operator=(const DllDesc& other);
00222
00223
00224 ~DllDesc();
00225
00226 private:
00227 class DllDescImpl;
00228 MaxSDK::AutoPtr<DllDescImpl> mImpl;
00229
00230
00231 DllDesc();
00232 };
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00251 #pragma warning(push)
00252 #pragma warning(disable:4100)
00253 class ClassEntry : public MaxHeapOperators
00254 {
00255 public:
00256 CoreExport ClassEntry();
00257 CoreExport ClassEntry(const ClassEntry &ce);
00258 CoreExport ClassEntry(ClassDesc *cld, int dllN, int index, bool load);
00259 CoreExport ~ClassEntry();
00260
00263 CoreExport int DllNumber() const;
00264
00267 CoreExport int IsPublic() const;
00268
00270 CoreExport Class_ID ClassID() const;
00271
00273 CoreExport MSTR& ClassName() const;
00274
00276 CoreExport MSTR& Category() const;
00277
00279 CoreExport int UseCount() const;
00280
00282 CoreExport void IncUseCount();
00283
00285 CoreExport void SetUseCount(int i);
00286
00291 CoreExport int IsAccType(int accType);
00292
00294 CoreExport bool IsLoaded() const;
00295
00297 CoreExport int ClassNumber() const;
00298
00303 CoreExport ClassDesc* CD() const;
00304
00311 CoreExport ClassDesc* FullCD();
00312
00314 CoreExport ClassEntry& operator=( const ClassEntry &ce );
00315
00317 CoreExport int operator==( const ClassEntry &ce ) const;
00318
00322 CoreExport void Set(ClassDesc *cld, int dllN, int index, bool load);
00323
00325 CoreExport int GetScroll() const;
00326
00328 CoreExport void SetScroll(int s);
00329
00331 CoreExport BOOL PageStateSet() const;
00332
00334 CoreExport BOOL GetPageState(int i) const;
00335
00337 CoreExport void SetPageState(int i,BOOL state);
00338
00340 CoreExport DWORD GetPageState() const;
00342
00343 private:
00344 class ClassEntryImpl;
00345 MaxSDK::Util::AutoPtr<ClassEntryImpl> mImpl;
00346 };
00347
00348
00352 #define ACC_PUBLIC 1
00353
00355 #define ACC_PRIVATE 2
00356
00357 #define ACC_ALL (ACC_PUBLIC|ACC_PRIVATE)
00358
00359
00367 class SClassUIInfo: public MaxHeapOperators
00368 {
00369 public:
00370 virtual ~SClassUIInfo() {}
00371
00372
00373
00380 CoreExport virtual COLORREF Color(SClass_ID superClassID) { return RGB(128, 128, 128); };
00381
00382
00383
00384
00385
00386
00387
00406 CoreExport virtual bool DrawRepresentation(SClass_ID superClassID, COLORREF bkColor, HDC hDC, Rect &rect) { return false; }
00407 };
00408
00409
00414 class SubClassList : public MaxSDK::Util::Noncopyable
00415 {
00416 public:
00419 CoreExport ClassEntry& operator[](int i)const;
00420
00423 CoreExport int FindClass(Class_ID classID) const;
00424
00427 CoreExport int FindClass(const MCHAR *name) const;
00428
00430 CoreExport void AddClass(ClassDesc *cld, int dllNum, int index, bool load);
00431
00437 CoreExport int Count(int accType) const;
00438
00440 CoreExport SClass_ID SuperID() const;
00441
00446 CoreExport int GetFirst(int accType) const;
00447
00452 CoreExport int GetNext(int accType) const;
00453
00455 CoreExport int operator==( const SubClassList& lst ) const;
00457 CoreExport int operator==(const SubClassList &sl);
00458
00459 CoreExport int DeleteClass(ClassDesc *cld);
00460
00465 CoreExport void SetUIInfo(SClassUIInfo *uiInfo);
00466
00469 CoreExport SClassUIInfo* GetUIInfo() const;
00470
00472 CoreExport void ReplaceClass(int idx, ClassDesc *cld, int dllNum, int index, bool load);
00473
00475 ~SubClassList();
00477 SubClassList(SClass_ID sid);
00478
00479 private:
00480 class SubClassListImpl;
00481 MaxSDK::Util::AutoPtr<SubClassListImpl> mImpl;
00482
00483 private:
00484 SubClassList();
00485 };
00486 #pragma warning(pop)
00487
00500 class ClassDirectory : public MaxSDK::Util::Noncopyable
00501 {
00502 public:
00504 CoreExport static ClassDirectory& GetInstance();
00505
00508 CoreExport SubClassList* GetClassList(SClass_ID superClassID) const;
00509
00511 CoreExport int Count() const;
00512
00515 CoreExport SubClassList& operator[](int i) const;
00516
00520 CoreExport ClassDesc* FindClass(SClass_ID superClassID, const Class_ID& classID) const;
00521
00525 CoreExport ClassEntry* FindClassEntry(SClass_ID superClassID, const Class_ID& classID) const;
00526
00536 CoreExport int AddClass(ClassDesc* cdesc, int dllNum, int index, bool load);
00537
00540 CoreExport int DeleteClass(ClassDesc* cdesc);
00541
00548 CoreExport bool SetUIInfoForSClass(SClass_ID superClassID, SClassUIInfo* uiInfo);
00549
00554 CoreExport SClassUIInfo* GetUIInfoForSClass(SClass_ID superClassID) const;
00555
00557 ClassDirectory();
00559 ~ClassDirectory();
00560
00561 private:
00562 class ClassDirectoryImpl;
00563 MaxSDK::Util::AutoPtr<ClassDirectoryImpl> mImpl;
00564
00566 void AddSuperClass(SClass_ID superClassID);
00567 };
00568
00586 class DllDir : public MaxSDK::Util::Noncopyable
00587 {
00588 public:
00590 CoreExport static DllDir& GetInstance();
00591
00592
00593 virtual ~DllDir() = 0;
00594
00596 CoreExport int Count() const;
00597
00600 CoreExport const DllDesc& operator[](int i) const;
00601
00604 CoreExport const DllDesc& GetDllDescription(int i) const;
00605
00633 CoreExport int LoadDlls(const MCHAR* pluginWildcard, bool forceLoadDeferrablepluginDlls = false);
00634
00645 CoreExport int LoadDllsFromDir(const MCHAR* pluginPath, const MCHAR* pluginWildcard, bool forceLoadDeferrablePluginDlls = false);
00646
00655 CoreExport bool LoadADll(const MCHAR* pluginDllFileName, bool forceLoadDeferrablePluginDlls);
00657
00659 CoreExport ClassDirectory& ClassDir() const;
00660
00665 CoreExport const DllDesc* GetDllDescriptionForClass(SClass_ID superClassId, const Class_ID& classId);
00666
00670 CoreExport int FindDllDescFromDllPath(const MaxSDK::Util::Path& aFullPath) const;
00671
00675 CoreExport int FindDllDescFromHInstance(const HINSTANCE hInst) const;
00676
00679 MAX_DEPRECATED void UnloadAllDlls();
00680
00681 protected:
00682
00683 DllDir();
00684 class DllDirImpl;
00685 MaxSDK::AutoPtr<DllDirImpl> mImpl;
00686
00687 private:
00688 bool LoadADllProxy(const MaxSDK::Util::Path& filePath, const MCHAR* description, const FILETIME& timeLastWrite);
00689
00690 };
00691