GeNN  4.0.0
GPU enhanced Neuronal Networks (GeNN)
NativeEOLConverter.h
Go to the documentation of this file.
1 #pragma once
3 #include <plog/Util.h>
4 
5 namespace plog
6 {
7  template<class NextConverter = UTF8Converter>
8  class NativeEOLConverter : public NextConverter
9  {
10 #ifdef _WIN32
11  public:
12  static std::string header(const util::nstring& str)
13  {
14  return NextConverter::header(fixLineEndings(str));
15  }
16 
17  static std::string convert(const util::nstring& str)
18  {
19  return NextConverter::convert(fixLineEndings(str));
20  }
21 
22  private:
23  static std::wstring fixLineEndings(const std::wstring& str)
24  {
25  std::wstring output;
26  output.reserve(str.length() * 2);
27 
28  for (size_t i = 0; i < str.size(); ++i)
29  {
30  wchar_t ch = str[i];
31 
32  if (ch == L'\n')
33  {
34  output.push_back(L'\r');
35  }
36 
37  output.push_back(ch);
38  }
39 
40  return output;
41  }
42 #endif
43  };
44 }
Definition: AndroidAppender.h:5
Definition: NativeEOLConverter.h:8
std::string nstring
Definition: Util.h:56