Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/StrRsc/src/StrRscConfig.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 119 - (show annotations) (download) (as text)
Fri Oct 8 15:41:45 2010 UTC (13 years, 7 months ago) by kamoya
File MIME type: text/x-c++src
File size: 1106 byte(s)
avoid ARRAYSIZE macro
1 #include "StrRscConfig.h"
2
3 #include <array>
4 #include <windows.h>
5 #include <shlwapi.h>
6 #if defined(_MSC_VER)
7 #pragma comment(lib, "shlwapi.lib")
8 #endif
9
10 #include "../../Common/dummy.h"
11
12 namespace Regnessem
13 {
14 namespace AddIn
15 {
16 namespace StrRsc
17 {
18 const LPCTSTR StrRscConfig::SectionName = TEXT("general");
19 const LPCTSTR StrRscConfig::KeyName = TEXT("locale");
20
21 // StrRsc.ini‚Š‚çLocale‚Ě“Çž‚Ý
22 void StrRscConfig::LoadFromFile(const tstring &fileName)
23 {
24 if(!PathFileExists(fileName.c_str()))
25 return;
26
27 std::array<TCHAR, MAX_PATH> buff;
28 GetPrivateProfileString(SectionName,KeyName,Locale.c_str(),buff.data(),std::tuple_size<decltype(buff)>::value,fileName.c_str());
29 Locale = buff.data();
30 }
31
32 // StrRsc.ini‚ÉLocale‚̏‘ž‚Ý
33 void StrRscConfig::SaveToFile(const tstring &fileName) const
34 {
35 const tstring dirPath = ExtractFilePath(fileName);
36
37 if(!PathFileExists(dirPath.c_str()))
38 ForceDirectories(dirPath);
39
40 WritePrivateProfileString(SectionName,KeyName,Locale.c_str(),fileName.c_str());
41 }
42 }
43 }
44 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26