aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/detail/Warnings.hpp
blob: f854fa892bca327ca5a90d9445ce80bc774be5c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include "openvic-dataloader/v2script/Parser.hpp"

namespace ovdl::v2script::warnings {
   inline const v2script::Parser::Warning make_utf8_warning(const char* file_path) {
      constexpr std::string_view message_suffix = "This may cause problems. Prefer Windows-1252 encoding.";

      std::string message;
      if (!file_path) {
         message = "Buffer is a UTF-8 encoded string. " + std::string(message_suffix);
      } else {
         message = "File '" + std::string(file_path) + "' is a UTF-8 encoded file. " + std::string(message_suffix);
      }

      return v2script::Parser::Warning { message, 1 };
   }
}

namespace ovdl::ovscript::warnings {
}