commonlib
xml_shared.h
1 
11 #pragma once
12 #include <string>
13 
14 #if defined(_WIN32) && !defined(__MINGW32__)
15  #include <windows.h>
16 #endif
17 
18 #if defined(_WIN32) && !defined(__MINGW32__)
19  #define OPEN_STREAM(stream, fileName, mode) \
20  { \
21  int length = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fileName.c_str(), -1, nullptr, 0); \
22  std::wstring wFileName(length, L'\0'); \
23  MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fileName.c_str(), -1, &wFileName[0], length); \
24  stream.open(wFileName, mode); \
25  }
26 #else
27  #define OPEN_STREAM(stream, fileName, mode) stream.open(fileName, mode);
28 #endif
29 
30 #define OPEN_BINARY_STREAM(stream, fileName) OPEN_STREAM(stream, fileName, std::ios_base::binary)
31 
32 namespace XmlTestUtils
33 {
34  bool compareXmlFiles(const std::string& referenceXmlFileName, const std::string& writtenToXmlFileName);
35 }
Definition: xml_shared.h:32