MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / ProfileSettingEx

Class ProfileSettingEx

tests/UnitTest/ProfileTest.cpp:10–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace ProfileSettingTests
9{
10 class ProfileSettingEx : public ProfileSetting
11 {
12 public:
13 ProfileSettingEx(const std::wstring& path)
14 : ProfileSetting(path)
15 {
16 // any left over from previous run
17 RemoveProfileFile();
18 }
19
20 ~ProfileSettingEx()
21 {
22 RemoveProfileFile();
23 }
24
25 bool ReadValue(const std::wstring& section, const std::wstring& key, int& retVal, int defaultVal = 0) const
26 {
27 return Profile::ReadValue(section, key, retVal, defaultVal);
28 }
29
30 bool ReadValue(const std::wstring& section, const std::wstring& key, std::wstring& retVal, const std::wstring& defaultVal = {}) const
31 {
32 return Profile::ReadValue(section, key, retVal, defaultVal);
33 }
34
35 bool WriteValue(const std::wstring& section, const std::wstring& key, int value) const
36 {
37 return Profile::WriteValue(section, key, value);
38 }
39
40 bool WriteValue(const std::wstring& section, const std::wstring& key, const std::wstring& value) const
41 {
42 return Profile::WriteValue(section, key, value);
43 }
44
45 private:
46 void RemoveProfileFile()
47 {
48 std::error_code ec {};
49 std::filesystem::remove(m_ProfileFilePath, ec);
50 }
51 };
52
53 class ProfileTest : public ::testing::Test
54 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected