Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cXResourceFile.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cXResourceFile_H
7 #define _INC_cXResourceFile_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../Gray3D.h"
16 
17 namespace Gray3D
18 {
20  {
26 
27  protected:
29  private:
30  cStringF m_sFilePath;
31 
32  protected:
34 
35  public:
36  cXResourceFile(const FILECHAR_t* pszFileName);
37  virtual ~cXResourceFile();
38 
40  {
42  return m_sFilePath;
43  }
44  void put_FilePath(const FILECHAR_t* pszFileName);
45  STDMETHOD_(cString, get_Name)() const
46  {
47  return m_sFilePath;
48  }
49 
50  cStringF get_FullPath() const;
51 
52  cStringF MakePeerPath(const FILECHAR_t* pszName) const
53  {
55  if (!cFilePath::IsFilePathTitle(pszName))
56  return pszName;
57  return cFilePath::CombineFilePathX(cFilePath::GetFileDir(m_sFilePath), pszName);
58  }
59 
60  virtual bool isResourceLoaded() const noexcept
61  {
62  return SUCCEEDED(m_hResLoad);
63  }
64  void put_LoadedState(HRESULT hResLoad)
65  {
67  ASSERT(hResLoad != OLE_E_BLANK);
68  m_hResLoad = hResLoad;
69  }
71  {
72  return m_hResLoad;
73  }
74 
75  static HRESULT GRAYCALL OnFAIL(HRESULT hRes);
76  };
77 
78  extern cInstallDir g_ResInstall;
79 };
80 
81 #endif
#define GRAY3D_LINK
Definition: Gray3D.h:15
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define SUCCEEDED(x)
Definition: HResult.h:29
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cXResourceFile.h:20
static cStringF s_sFileLoading
name of file loading for debug.
Definition: cXResourceFile.h:33
HRESULT m_hResLoad
0=loaded OK, <0 = it failed to load for some reason! OLE_E_BLANK = have not yet tried to load.
Definition: cXResourceFile.h:28
cStringF MakePeerPath(const FILECHAR_t *pszName) const
Definition: cXResourceFile.h:52
void put_LoadedState(HRESULT hResLoad)
Definition: cXResourceFile.h:64
STDMETHOD_(cString, get_Name)() const
Definition: cXResourceFile.h:45
cStringF get_FilePath() const
Definition: cXResourceFile.h:39
virtual bool isResourceLoaded() const noexcept
Definition: cXResourceFile.h:60
virtual HRESULT LoadResource()
Definition: cXResourceFile.h:70
static bool __stdcall IsFilePathTitle(const FILECHAR_t *pszName)
Definition: cFilePath.cpp:130
static cStringF __stdcall GetFileDir(const FILECHAR_t *pszFilePath, bool bTrailingSep=true)
Definition: cFilePath.cpp:996
static cStringF __stdcall CombineFilePathX(const FILECHAR_t *pszBase, const FILECHAR_t *pszName, FILECHAR_t chSep=k_DirSep)
Definition: cFilePath.cpp:596
Definition: cRefPtr.h:22
Definition: Gray3D.cpp:12
cInstallDir g_ResInstall
if the file name is not rooted this is its base. (acts like current dir)
Definition: cXResourceFile.cpp:12
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22