Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
Configuration.cpp
1/*
2Copyright (C) 2016,2019,2021,2022,2025 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#include <fstream>
18#include <iostream>
19#include <exception>
20#include "Configuration.h"
21#include "aeongames/Utilities.hpp"
22#include "aeongames/Resource.hpp"
23#include "aeongames/ProtoBufHelpers.hpp"
24
25namespace AeonGames
26{
27
28 Configuration::Configuration ( const std::string& aFilename )
29 : mFilename ( aFilename )
30 {
31 try
32 {
33 mConfigurationMsg =
34 LoadProtoBufObject<ConfigurationMsg> ( aFilename, "AEONCFG"_mgk );
35 }
36 catch ( const std::runtime_error& e )
37 {
38 std::cout << "Warning: " << e.what() << std::endl;
39 }
40 }
41
43 = default;
44}
Configuration(const std::string &aFilename)
Constructs a Configuration by loading from the specified file.
~Configuration()
Destructor.
<- This is here just for the literals
Definition AABB.hpp:31
void LoadProtoBufObject(T &t, const void *aData, size_t aSize, uint64_t aMagick)
Loads a Protocol Buffer Object from a meory buffer into the provided reference.