Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cXObjMgrPack.h
Go to the documentation of this file.
1 //
6 //
7 
8 #ifndef _INC_cXObjMgrPack_H
9 #define _INC_cXObjMgrPack_H
10 #ifndef NO_PRAGMA_ONCE
11 #pragma once
12 #endif
13 
14 #include "cXObjModule.h"
15 #include "../XObject/cXObjMgr.h"
16 #include "../ScriptExec/cScriptExec.h"
17 
18 namespace GrayLib
19 {
21  : public cXObjMgr
22  {
27 
28  typedef cXObjMgr SUPER_t;
29 
30  public:
33 
34  protected:
39 
43 
44  protected:
46  HRESULT ReadXObjPack(const FILECHAR_t* pszPathName, const cFileStatus& status);
47  cXObjPackFactory* FindXObjFactory(const FILECHAR_t* pszTitle) const;
48 
49  public:
50  cXObjMgrPack(cXObjDef* pRoot = nullptr);
51  virtual ~cXObjMgrPack();
52 
53  static inline cXObjMgrPack* get_Single() // type cast cSingletonSmart
54  {
56  return get_SingleT<cXObjMgrPack>();
57  }
58  static inline cXObjMgrPack& I()
59  {
61  return *get_Single();
62  }
63 
64  cStringF get_ScriptDir() const noexcept
65  {
66  return m_sScriptDir;
67  }
68  void put_ScriptDir(cStringF sDir);
69 
70  // IXObjMgr
71  virtual HRESULT InitXObjMgr(cXObjDef* pRoot) override;
72  virtual void DisposeAllX() override;
73  virtual void AddFactory(cXObjPackFactory* pFactory);
74  virtual bool RemoveFactory(cXObjPackFactory* pFactory);
75  virtual void RemoveXObjDef(cXObjDef* pObj) override;
76 
77  cXObjPackPtr FindXObjPack(const FILECHAR_t* pszFilePath) const;
78 
79  // Manually load a new resource file/Dir by name.
80  HRESULT LoadXObjPack(const FILECHAR_t* pszFilePath);
81 
82  // Specific hack for cXObjModule/IXObjModPlugin
83  virtual cXObjectPtr FindByUID(UID_t uid) const override;
84  virtual HRESULT CreateXObjDefX(cXObjDefPtr& rpObjNew, const cXObjTypeDef* pXObjTypeDef, cAtomRef aSymName, IScriptableEnumerator* rProps);
85  virtual HRESULT CreateXObjFromS(cXObjectPtr& rpObj, const ATOMCHAR_t* pszXObjType, const ATOMCHAR_t* pszSymName, IScriptableEnumerator& rProps);
86 
88  {
90  return ReadXObjDir(get_ScriptDir());
91  }
92  HRESULT LoadAllScripts(bool bForce);
93 
94  HRESULT ReadXObjDir(const FILECHAR_t* pszDirName, const FILECHAR_t* pszWildcardFile = nullptr);
95 
97  };
98 }
99 
100 #endif // _INC_cXObjMgrPack_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cXObjMgr.h:28
Definition: cScriptContext.h:24
Definition: cScriptExec.h:46
Definition: cXObjDef.h:17
Definition: cXObjMgrPack.h:22
cStringF get_ScriptDir() const noexcept
Definition: cXObjMgrPack.h:64
cArrayRef< cXObjModule > m_aXObjModulesToLoad
plug-in DLL/SO's are dangerous and must be treated special. Read order is important here (they may ca...
Definition: cXObjMgrPack.h:37
HRESULT LoadXObjRoot()
Definition: cXObjMgrPack.h:87
cStringF m_sScriptDir
default base directory for script/DLL/SO/Module resource files/packs
Definition: cXObjMgrPack.h:40
cScriptExec m_ScriptExecBest
set sm_pExpExecBest with a default value. Preferred script execution/evaluation engine.
Definition: cXObjMgrPack.h:42
cArrayPtr< cXObjPackFactory > m_aPackFactories
what file extensions can we handle for packages? How to load each type.
Definition: cXObjMgrPack.h:38
cArrayRef< cXObjPack > m_aXObjPacksToLoad
Files queued to be read later. (load order used at startup)
Definition: cXObjMgrPack.h:36
UNITTEST_FRIEND(cXObjMgrPack)
cArraySortSymName< cXObjPack > m_aXObjPacks
All package files we need to get script blocks from. SYMNAME sorted.
Definition: cXObjMgrPack.h:35
static cXObjMgrPack & I()
Definition: cXObjMgrPack.h:58
cScriptContext m_ScriptContextRoot
global/default/Root context. PLEVEL_Owner
Definition: cXObjMgrPack.h:41
TIMESYSD_t m_iScriptCacheTime
Params for control.
Definition: cXObjMgrPack.h:32
static cXObjMgrPack * get_Single()
Definition: cXObjMgrPack.h:53
Definition: cXObjMgr.h:135
Definition: cXObjPack.h:110
Definition: cXObjMgr.h:92
Definition: cArray.h:864
Definition: cArrayRef.h:21
Definition: cAtom.h:63
Definition: cFileStatus.h:58
Definition: cSingleton.h:30
Definition: IScriptableObj.h:38
Definition: cMesh.h:22
HASHCODE32_t UID_t
Sort of the same as a HASHCODE_t. not the same as UIDINDEX_t.
Definition: cUID.h:18
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
char ATOMCHAR_t
the char form (UNICODE or not) for an atom. (for symbolic names)
Definition: StrConst.h:15