All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WindowsDialogBoxTemplate.h
1 // Copyright eeGeo Ltd (2012-2015), All Rights Reserved
2 
3 #pragma once
4 #include "Types.h"
5 
6 
7 namespace Eegeo
8 {
10  {
11  public:
12  void AlignToDword()
13  {
14  if (v.size() % 4) Write(NULL, 4 - (v.size() % 4));
15  }
16 
17  void Write(LPCVOID pvWrite, DWORD cbWrite)
18  {
19  v.insert(v.end(), cbWrite, 0);
20  if (pvWrite) CopyMemory(&v[v.size() - cbWrite], pvWrite, cbWrite);
21  }
22 
23  template<typename T> void Write(T t) { Write(&t, sizeof(T)); }
24  void WriteString(LPCWSTR psz)
25  {
26  Write(psz, (lstrlenW(psz) + 1) * sizeof(WCHAR));
27  }
28 
29 
30  const std::vector<BYTE>& GetBuffer() const
31  {
32  return v;
33  }
34  private:
35  std::vector<BYTE> v;
36  };
37 }