File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ class ConfError;
68
68
class Conf {
69
69
public:
70
70
Conf () = default ;
71
- explicit Conf (const Json& data) : data_(data) {}
72
- explicit Conf (const std::string& file);
73
- Conf (const Json& data, const std::string& file) : file_(file), data_(data) {}
74
- Conf (const Json& data, const std::string& file, const std::string& root)
75
- : file_(file), root_(root), data_(data) {}
71
+ explicit Conf (Json data) : data_(std::move( data) ) {}
72
+ explicit Conf (std::string file);
73
+ Conf (Json data, std::string file) : file_(std::move( file)) , data_(std::move( data) ) {}
74
+ Conf (Json data, std::string file, std::string root)
75
+ : file_(std::move( file)) , root_(std::move( root)) , data_(std::move( data) ) {}
76
76
77
77
/* *
78
78
* Return whether this configuration was read from a file.
Original file line number Diff line number Diff line change 34
34
35
35
namespace fable {
36
36
37
- Conf::Conf (const std::string& file) : file_(file) {
37
+ Conf::Conf (std::string file) : file_(std::move( file) ) {
38
38
std::ifstream ifs (file_);
39
39
if (ifs.fail ()) {
40
- throw Error (" could not open file {}: {}" , file , strerror (errno));
40
+ throw Error (" could not open file {}: {}" , file_ , strerror (errno));
41
41
}
42
42
try {
43
43
data_ = parse_json (ifs);
44
44
} catch (std::exception & e) {
45
- throw Error (" unable to parse file {}: {}" , file , e.what ());
45
+ throw Error (" unable to parse file {}: {}" , file_ , e.what ());
46
46
}
47
47
}
48
48
You can’t perform that action at this time.
0 commit comments