-
Notifications
You must be signed in to change notification settings - Fork 0
/
efxc2CompilerParams.cpp
52 lines (45 loc) · 1.77 KB
/
efxc2CompilerParams.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//--------------------------------------------------------------------------------------
// File: efxc2CompilerParams.h
//
// Copyright (c) J. Peter Mugaas
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//--------------------------------------------------------------------------------------
#include "efxc2CompilerParams.h"
#include "efxc2Utils.h"
#include "efxc2Exception.h"
void efxc2CompilerParams::CompilerParams::initializeDefines() {
defines = std::make_shared<std::vector < efxc2Utils::CompilerDefine >>();
}
void efxc2CompilerParams::CompilerParams::add_define(const std::string_view defineOption) {
efxc2Utils::CompilerDefine _def;
_def.Definition = "1";
if (size_t Dellin_pos = defineOption.find('='); Dellin_pos == std::string::npos) {
_def.Name = defineOption;
}
else {
_def.Name = defineOption.substr(0, Dellin_pos);
_def.Definition = defineOption.substr(Dellin_pos + 1, defineOption.length() - 1);
}
(void)defines->insert(defines->begin(), _def);
}
void efxc2CompilerParams::CompilerParams::LoadSourceCode(std::ifstream& f) {
if (efxc2Utils::readAll(f, SourceCode) == false) {
efxc2Console::Console console = efxc2Console::console;
console.std_err_pink();
std::cerr << "Error reading file." << std::endl;
console.std_err_reset();
throw efxc2Exception::FileReadError();
}
}
void efxc2CompilerParams::CompilerParams::LoadPrivateData(std::ifstream& f) {
if (efxc2Utils::readAll(f, PrivateData) == false) {
efxc2Console::Console console = efxc2Console::console;
console.std_err_pink();
std::cerr << "Error reading file." << std::endl;
console.std_err_reset();
throw efxc2Exception::FileReadError();
}
}