home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 4802 / template.7z / stdafx.h < prev   
Encoding:
C/C++ Source or Header  |  2011-10-21  |  3.8 KB  |  123 lines

  1. #ifndef __STDAFX_H
  2. #define __STDAFX_H
  3.  
  4. // Windows Headers
  5. #define NOMINMAX
  6. #pragma warning (disable : 4307)
  7. #pragma warning (disable : 4996)
  8. #include<windows.h>
  9. #include<shlobj.h>
  10. #include<ddraw.h>
  11.  
  12. // Standard Headers
  13. #include<iostream>
  14. #include<iomanip>
  15. #include<fstream>
  16. #include<algorithm>
  17. #include<deque>
  18. #include<map>
  19. #include<set>
  20. #include<vector>
  21. #include<string>
  22. using namespace std;
  23.  
  24. // Boost Headers
  25. #include<boost/shared_array.hpp>
  26. #include<boost/shared_ptr.hpp>
  27.  
  28. // SL Headers
  29. #include "slMathTraits.h"
  30. #include "slEuler.h"
  31. #include "slVector2D.h"
  32. #include "slVector3D.h"
  33. #include "slMatrix.h"
  34.  
  35. template<class T>
  36. inline void reverse_byte_order(T* data)
  37. {
  38.  unsigned char* ptr = reinterpret_cast<unsigned char*>(data);
  39.  std::reverse(ptr, ptr + sizeof(T)); 
  40. }
  41.  
  42. inline unsigned int interpret_as_unsigned(float x) { return *(reinterpret_cast<unsigned*>(&x)); }
  43. inline float interpret_as_float(unsigned int x) { return *(reinterpret_cast<float*>(&x)); }
  44.  
  45. float float_16_to_32(unsigned short value);
  46. bool error(const char* message);
  47. bool get_filename_list(deque<string>& namelist, const char* fext);
  48.  
  49. __int16 LE_read_sint16(ifstream& ifile);
  50. __int32 LE_read_sint32(ifstream& ifile);
  51.  
  52. unsigned __int8  LE_read_uint08(ifstream& ifile);
  53. unsigned __int16 LE_read_uint16(ifstream& ifile);
  54. unsigned __int32 LE_read_uint32(ifstream& ifile);
  55. unsigned __int64 LE_read_uint64(ifstream& ifile);
  56. unsigned __int8  BE_read_uint08(ifstream& ifile);
  57. unsigned __int16 BE_read_uint16(ifstream& ifile);
  58. unsigned __int32 BE_read_uint32(ifstream& ifile);
  59. unsigned __int64 BE_read_uint64(ifstream& ifile);
  60.  
  61. unsigned __int8  LE_read_uint08(ifstream& ifile, unsigned int offset);
  62. unsigned __int16 LE_read_uint16(ifstream& ifile, unsigned int offset);
  63. unsigned __int32 LE_read_uint32(ifstream& ifile, unsigned int offset);
  64. unsigned __int64 LE_read_uint64(ifstream& ifile, unsigned int offset);
  65. unsigned __int8  BE_read_uint08(ifstream& ifile, unsigned int offset);
  66. unsigned __int16 BE_read_uint16(ifstream& ifile, unsigned int offset);
  67. unsigned __int32 BE_read_uint32(ifstream& ifile, unsigned int offset);
  68. unsigned __int64 BE_read_uint64(ifstream& ifile, unsigned int offset);
  69.  
  70. signed __int16 BE_read_sint16(ifstream& ifile);
  71.  
  72. float LE_read_half_float(ifstream& ifile);
  73. float BE_read_half_float(ifstream& ifile);
  74. float LE_read_float(ifstream& ifile);
  75. float BE_read_float(ifstream& ifile);
  76. double LE_read_double(ifstream& ifile);
  77. double BE_read_double(ifstream& ifile);
  78.  
  79. float LE_read_float(ifstream& ifile, unsigned int offset);
  80. float BE_read_float(ifstream& ifile, unsigned int offset);
  81. double LE_read_double(ifstream& ifile, unsigned int offset);
  82. double BE_read_double(ifstream& ifile, unsigned int offset);
  83.  
  84. class find_file {
  85.  protected :
  86.   HANDLE          handle;
  87.   WIN32_FIND_DATA find32;
  88.  public :
  89.   void close(void);
  90.  public :
  91.   bool find(const char* filename);
  92.   bool next(void);
  93.  public :
  94.   bool is_dots(void);
  95.   bool is_directory(void);
  96.   bool is_encrypted(void);
  97.   bool is_compressed(void);
  98.   bool is_normal(void);
  99.   bool is_hidden(void);
  100.   bool is_system(void);
  101.   bool is_archived(void);
  102.   bool is_readonly(void);
  103.  public :
  104.   const char* filename(void);
  105.   size_t filesize(void);
  106.  public :
  107.   bool operator !(void)const;
  108.  public :
  109.   find_file();
  110.  ~find_file();
  111.  private :
  112.   find_file(const find_file&);
  113.   void operator =(const find_file&);
  114. };
  115.  
  116. void CenterDialog(HWND window, bool in_parent = true);
  117. BOOL BrowseDirectoryDialog(HWND parent, const char* caption, char* buffer);
  118. BOOL ColorDialog(HWND parent, COLORREF& color);
  119. BOOL OpenFileDialog(HWND parent, const char* filter, const char* title, const char* defext, char* filename, char* initdir = 0);
  120. BOOL SaveFileDialog(HWND parent, const char* filter, const char* title, const char* defext, char* filename, char* initdir = 0);
  121.  
  122. #endif
  123.