forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make settings.json work again and add documentation.
- Loading branch information
1 parent
fe1b372
commit 1fee584
Showing
18 changed files
with
619 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#pragma once | ||
#include <string> | ||
#include "common/common_utils/json.hpp" | ||
|
||
namespace msr { | ||
namespace airlib { | ||
|
||
class Settings | ||
{ | ||
private: | ||
static Settings settings_; | ||
std::wstring file_; | ||
nlohmann::json doc_; | ||
static std::wstring getFullPath(std::wstring fileName); | ||
public: | ||
static wchar_t* getProductName() { | ||
return L"AirSim"; | ||
} | ||
|
||
static Settings& singleton() { | ||
return settings_; | ||
} | ||
|
||
static Settings& loadJSonFile(std::wstring fileName); | ||
void saveJSonFile(std::wstring fileName); | ||
std::wstring getFileName() { return file_; } | ||
|
||
std::string getString(std::string name, std::string defaultValue = ""); | ||
void setString(std::string name, std::string value); | ||
|
||
double getDouble(std::string name, double defaultValue = 0); | ||
void setDouble(std::string name, double value); | ||
|
||
bool getBool(std::string name, bool defaultValue = false); | ||
void setBool(std::string name, bool value); | ||
|
||
int getInt(std::string name, int defaultValue = 0); | ||
void setInt(std::string name, int value); | ||
|
||
Settings getChild(std::string name); | ||
void setChild(std::string name, Settings& value); | ||
|
||
|
||
static std::wstring getUserDocumentsFolder(); | ||
static std::wstring ensureAppDataFolder(std::wstring productName); | ||
static std::wstring getUserHomeFolder(); | ||
static void createDirectory(std::wstring parentFolder, std::wstring name); | ||
|
||
Settings(); | ||
~Settings(); | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.