o2on svn commit
o2on-****@lists*****
2008年 3月 14日 (金) 23:42:08 JST
Revision: 47 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=o2on&view=rev&rev=47 Author: k-uehara Date: 2008-03-14 23:42:07 +0900 (Fri, 14 Mar 2008) Log Message: ----------- 複数datフォルダ機能追加(O2Profile) Modified Paths: -------------- trunk/o2on/src.o2on/O2Profile.cpp trunk/o2on/src.o2on/O2Profile.h Modified: trunk/o2on/src.o2on/O2Profile.cpp =================================================================== --- trunk/o2on/src.o2on/O2Profile.cpp 2008-03-11 12:55:22 UTC (rev 46) +++ trunk/o2on/src.o2on/O2Profile.cpp 2008-03-14 14:42:07 UTC (rev 47) @@ -579,7 +579,49 @@ +/* + * ClearCacheFolders() + * AppendCacheFolder() + * GetCacheFoldersA() + * GetCacheFoldersW() + * + */ +void +O2Profile:: +ClearCacheFolders(void) +{ + CacheFoldersA.clear(); + CacheFoldersW.clear(); +} +int +O2Profile:: +AppendCacheFolder(const wchar_t *path) +{ + string pathA; + wstring pathW = path; + CacheFoldersW.push_back(path); + if (pathW[pathW.size()-1] == L'\\') + pathW.erase(pathW.size()-1); + if (FromUnicode(L"shift_jis", pathW, pathA)) + CacheFoldersA.push_back(pathA); + return CacheFoldersW.size(); +} +const strarray +*O2Profile:: +GetCacheFoldersA(void) const +{ + return &CacheFoldersA; +} +const wstrarray +*O2Profile:: +GetCacheFoldersW(void) const +{ + return &CacheFoldersW; +} + + + /* * SetAdminRoot() * GetAdminRootA() @@ -1254,6 +1296,16 @@ xml += L"]]></CacheRoot>"EOL; } + //CacheFolder + if (cond.mask & PROF_XMLELM_CACHEFOLDER) { + wstrarray::iterator it; + for (it = CacheFoldersW.begin(); it != CacheFoldersW.end(); it++){ + xml += L" <CacheFolder><![CDATA["; + xml += *it; + xml += L"]]></CacheFolder>"EOL; + } + } + //AdminRoot if (cond.mask & PROF_XMLELM_ADMINROOT) { xml += L" <AdminRoot><![CDATA["; @@ -1545,6 +1597,9 @@ else if (MATCHLNAME(L"CacheRoot")) { CurElm = PROF_XMLELM_CACHEROOT; } + else if (MATCHLNAME(L"CacheFolder")) { + CurElm = PROF_XMLELM_CACHEFOLDER; + } else if (MATCHLNAME(L"AdminRoot")) { CurElm = PROF_XMLELM_ADMINROOT; } @@ -1735,6 +1790,10 @@ str.assign(chars, length); Profile->SetCacheRoot(str.c_str()); break; + case PROF_XMLELM_CACHEFOLDER: + str.assign(chars, length); + Profile->AppendCacheFolder(str.c_str()); + break; case PROF_XMLELM_ADMINROOT: str.assign(chars, length); Profile->SetAdminRoot(str.c_str()); Modified: trunk/o2on/src.o2on/O2Profile.h =================================================================== --- trunk/o2on/src.o2on/O2Profile.h 2008-03-11 12:55:22 UTC (rev 46) +++ trunk/o2on/src.o2on/O2Profile.h 2008-03-14 14:42:07 UTC (rev 47) @@ -41,6 +41,7 @@ #define PROF_XMLELM_LIMIT 0x00080000 #define PROF_XMLELM_BOOL 0x00100000 #define PROF_XMLELM_SIZE_T 0x00200000 +#define PROF_XMLELM_CACHEFOLDER 0x00400000 #define PROF_XMLELM_COMMON 0x000000ff #define PROF_XMLELM_ALL 0x0fffffff @@ -104,6 +105,8 @@ wstring CacheRootW; string AdminRootA; wstring AdminRootW; + strarray CacheFoldersA; + wstrarray CacheFoldersW; wstring ProfileFilePath; wstring NodeFilePath; @@ -209,6 +212,11 @@ const wchar_t *GetCacheRootW(void) const; bool MakeCacheRoot(void); + void ClearCacheFolders(void); + int AppendCacheFolder(const wchar_t *path); + const strarray *GetCacheFoldersA(void) const; + const wstrarray *GetCacheFoldersW(void) const; + void SetAdminRoot(const wchar_t *path); const char *GetAdminRootA(void) const; const wchar_t *GetAdminRootW(void) const; @@ -308,7 +316,7 @@ // -// O2NodeDB_SAX2Handler +// O2Profile_SAX2Handler // class O2Profile_SAX2Handler : public SAX2Handler