Files
MapLibreParticleLab/platform/default/settings_json.cpp
Konstantin Käfer 77e7846756 [core] code style cleanups
- puts function definitions in a namespace ... {} rather than using namespace ...;
- remove trailing whitespace
- add trailing newline
- protect SQL statements from being formatted by clang-format
2016-07-01 12:38:33 +02:00

42 lines
858 B
C++

#include <mbgl/platform/default/settings_json.hpp>
#include <fstream>
namespace mbgl {
Settings_JSON::Settings_JSON() { load(); }
void Settings_JSON::load() {
std::ifstream file("/tmp/mbgl-native.cfg");
if (file) {
file >> longitude;
file >> latitude;
file >> zoom;
file >> bearing;
file >> pitch;
file >> debug;
}
}
void Settings_JSON::save() {
std::ofstream file("/tmp/mbgl-native.cfg");
if (file) {
file << longitude << std::endl;
file << latitude << std::endl;
file << zoom << std::endl;
file << bearing << std::endl;
file << pitch << std::endl;
file << debug << std::endl;
}
}
void Settings_JSON::clear() {
longitude = 0;
latitude = 0;
zoom = 0;
bearing = 0;
pitch = 0;
debug = 0;
}
} // namespace mbgl