TNB Library
TnbAccessor.h
[詳解]
1#pragma once
15#include "TnbStrVector.h"
16#include "TnbCollection.h"
17#include "TnbStrOperator.h"
18#include "TnbSerializeAdapter.h"
19#ifdef _TnbDOXYGEN //Document作成用シンボル
20 #define _TnbACCESSOR_Tree_ENABLE
21#endif
22#ifdef _TnbACCESSOR_Tree_ENABLE
23 #include "TnbTree.h"
24 #include "TnbMap.h"
25#endif
26
27
28
29//TNB Library
30namespace TNB
31{
32
33
34
74{
79 enum EKind
80 {
81 EK_Nothing = 'n',
82 EK_String = 's',
84 EK_Binary = 'b',
85 EK_Dword = 'd',
87 };
88
99 class CValue
100 {
101 EKind m_eKind;
102 CStr m_strData;
103 LONGLONG m_llData;
104 CByteVector m_vbData;
105 public:
106
111 CValue(void) : m_eKind(EK_Nothing)
112 {
113 }
114
119 CValue(LPCTSTR lpsz) : m_eKind(EK_String), m_strData(lpsz)
120 {
121 }
122
127 CValue(const CStrVector& vstr) : m_eKind(EK_PluralStrings), m_strData(StrVectorToStrEx(vstr))
128 {
129 }
130
136 {
137 m_vbData.Copy(c);
138 }
139
146 CValue(size_t len, LPCVOID P) : m_eKind(EK_Binary)
147 {
148 m_vbData.CopyElements(len, static_cast<const BYTE*>(P));
149 }
150
155 CValue(DWORD dw) : m_eKind(EK_Dword), m_llData(dw)
156 {
157 }
158
163 CValue(LONGLONG ll) : m_eKind(EK_Longlong), m_llData(ll)
164 {
165 }
166
171 EKind GetKind(void) const { return m_eKind; }
172
178 bool IsNull(void) const { return m_eKind == EK_Nothing; }
179
185 CStr QueryString(void) const
186 {
187 CStr s;
188 switch ( m_eKind )
189 {
190 case EK_String: // 文字列
191 case EK_PluralStrings: // 複数の文字列群
192 s = m_strData;
193 break;
194 case EK_Binary: // バイナリ
196 break;
197 case EK_Dword: // 32Bit
198 s = CStr::Fmt(_T("%u"), static_cast<DWORD>(m_llData));
199 break;
200 case EK_Longlong: // 64Bit
201 s = CStr::Fmt(_T("%I64d"), m_llData);
202 break;
203 case EK_Nothing:
204 break;
205 }
206 return s;
207 }
208
215 {
216 CStrVector vstr;
217 if ( m_eKind == EK_PluralStrings || m_eKind == EK_String )
218 {
219 vstr = StrToStrVectorEx(m_strData);
220 }
221 return vstr;
222 }
223
230 {
231 if ( m_eKind != EK_Binary )
232 {
234 }
235 return m_vbData;
236 }
237
243 DWORD QueryDword(void) const
244 {
245 return static_cast<DWORD>(QueryLonglong());
246 }
247
253 LONGLONG QueryLonglong(void) const
254 {
255 if ( m_eKind == EK_Longlong || m_eKind == EK_Dword )
256 {
257 return m_llData;
258 }
259 return QueryString().ToLonglong();
260 }
261 };
262
263 #ifdef _TnbACCESSOR_Tree_ENABLE
264
267
270
271 #endif
272
294 {
295 IAccessor* m_piAccessor;
296 CStr m_strSection;
302 bool m_IsEmpty(const CValue& v) const
303 {
304 bool r = v.IsNull();
305 if ( ! r && v.GetKind() == EK_String )
306 {
307 r = v.QueryString().IsEmpty();
308 }
309 return r;
310 }
312 CSection(void);
313 public:
314
321 CSection(const IAccessor* I, LPCTSTR lpszSectionName)
322 : m_piAccessor(const_cast<IAccessor *>(I)), m_strSection(lpszSectionName)
323 {
324 if ( I == NULL )
325 {
326 ASSERT0( false, "CSection::CSection()", "IAccessor が指定されていません。" );
327 throw CNullPointerException();
328 }
329 }
330
336 {
337 return m_strSection;
338 }
339
346 bool CanQuery(void) const
347 {
348 CStr s = m_strSection;
349 INT_PTR d = s.ReverseFind('\\');
350 if ( d >= 0 )
351 {
352 s = s.Left(d);
353 }
354 CStrVector vs = m_piAccessor->EnumSectionNames();
355 return vs.Find(s) != INVALID_INDEX;
356 }
357
365 bool InSubSection(LPCTSTR lpszSubName)
366 {
367 if ( STRLIB::GetLen(lpszSubName) > 0 && STRLIB::IndexOf(lpszSubName, '\\') < 0 )
368 {
369 if ( ! m_strSection.IsEmpty() )
370 {
371 m_strSection += _T('\\');
372 }
373 m_strSection += lpszSubName;
374 return true;
375 }
376 return false;
377 }
378
385 {
386 INT_PTR d = m_strSection.ReverseFind('\\');
387 if ( d >= 0 )
388 {
389 m_strSection = m_strSection.Left(d);
390 }
391 else
392 {
393 m_strSection.Empty();
394 }
395 }
396
401 const IAccessor* ReferAccessor(void) const
402 {
403 return m_piAccessor;
404 }
405
411 {
412 return m_piAccessor->EnumSectionNames(m_strSection);
413 }
414
420 {
421 return m_piAccessor->EnumKeyNames(m_strSection);
422 }
423
429 bool DeleteAllKeys(void)
430 {
431 return m_piAccessor->DeleteSection(m_strSection);
432 }
433
439 EKind GetKeyKind(LPCTSTR lpszKey) const
440 {
441 return m_piAccessor->GetKeyKind(m_strSection, lpszKey);
442 }
443
450 bool HasKey(LPCTSTR lpszKey) const
451 {
452 return GetKeyKind(lpszKey) != EK_Nothing;
453 }
454
461 bool DeleteKey(LPCTSTR lpszKey)
462 {
463 return m_piAccessor->WriteValue(m_strSection, lpszKey, CValue());
464 }
465
473 bool WriteValue(LPCTSTR lpszKey, const CValue& value)
474 {
475 return m_piAccessor->WriteValue(m_strSection, lpszKey, value);
476 }
477
483 CValue QueryValue(LPCTSTR lpszKey) const
484 {
485 return m_piAccessor->QueryValue(m_strSection, lpszKey);
486 }
487
495 bool WriteString(LPCTSTR lpszKey, LPCTSTR lpszValue)
496 {
497 return WriteValue(lpszKey, CValue(lpszValue));
498 }
499
506 CStr QueryString(LPCTSTR lpszKey, LPCTSTR lpszDefault = NULL) const
507 {
508 const CValue& v = QueryValue(lpszKey);
509 return v.IsNull() ? lpszDefault : v.QueryString();
510 }
511
519 bool WritePluralStrings(LPCTSTR lpszKey, const CStrVector& vs)
520 {
521 return WriteValue(lpszKey, CValue(vs));
522 }
523
529 CStrVector QueryPluralStrings(LPCTSTR lpszKey) const
530 {
531 return QueryValue(lpszKey).QueryPluralStrings();
532 }
533
541 bool WriteData(LPCTSTR lpszKey, const IConstCollectionT<BYTE>& c)
542 {
543 return WriteValue(lpszKey, CValue(c));
544 }
545
554 bool WriteData(LPCTSTR lpszKey, size_t len, LPCVOID P)
555 {
556 return WriteValue(lpszKey, CValue(len, P));
557 }
558
564 CByteVector QueryData(LPCTSTR lpszKey) const
565 {
566 return QueryValue(lpszKey).QueryData();
567 }
568
576 bool WriteDword(LPCTSTR lpszKey, DWORD dwValue)
577 {
578 return WriteValue(lpszKey, CValue(dwValue));
579 }
580
587 DWORD QueryDword(LPCTSTR lpszKey, DWORD dwDefault = 0) const
588 {
589 const CValue& v = QueryValue(lpszKey);
590 return m_IsEmpty(v) ? dwDefault : v.QueryDword();
591 }
592
600 bool WriteLonglong(LPCTSTR lpszKey, LONGLONG llValue)
601 {
602 return WriteValue(lpszKey, CValue(llValue));
603 }
604
611 LONGLONG QueryLonglong(LPCTSTR lpszKey, LONGLONG llDefault = 0) const
612 {
613 const CValue& v = QueryValue(lpszKey);
614 return m_IsEmpty(v) ? llDefault : v.QueryLonglong();
615 }
616
626 template<typename TYP>
627 bool WriteStruct(LPCTSTR lpszKey, const TYP& t)
628 {
629 CByteVector vb;
630 vb.SetElements(sizeof(TYP), reinterpret_cast<const BYTE*>(&t));
631 return WriteData(lpszKey, vb);
632 }
633
643 template<typename TYP>
644 bool QueryStruct(LPCTSTR lpszKey, TYP& _t) const
645 {
646 const CByteVector& v = QueryData(lpszKey);
647 if ( v.GetSize() != sizeof(TYP) )
648 {
649 return false;
650 }
651 BYTE* B = reinterpret_cast<BYTE*>(&_t);
652 MemCopy(B, v.ReferBuffer(), sizeof(TYP));
653 return true;
654 }
655
664 {
665 bool r = true;
666 r &= m_piAccessor->DeleteSection(m_strSection);
667 size_t len = vv.GetSize();
668 r &= WriteLonglong(_T("size"), len);
669 loop ( i, len )
670 {
671 r &= WriteValue(CStr::Fmt(_T("%d"), i + 1), vv[i]);
672 }
673 return r;
674 }
675
682 {
684 size_t len = QueryDword(_T("size"), 0);
685 vv.SetSize(len);
686 loop ( i, len )
687 {
688 vv[i] = QueryValue(CStr::Fmt(_T("%d"), i + 1));
689 }
690 return vv;
691 }
692
700 bool WriteSerializableData(LPCTSTR lpszKey, const ISerializable& s)
701 {
702 CByteVector vb;
703 try
704 {
705 CSerializeAdapter sa(&vb);
706 sa << s;
707 return WriteData(lpszKey, vb);
708 }
709 catch ( ... )
710 {
711 return false;
712 }
713 return false;
714 }
715
723 bool QuerySerializableData(LPCTSTR lpszKey, ISerializable& _d) const
724 {
725 CByteVector vb = QueryData(lpszKey);
726 if ( ! vb.IsEmpty() )
727 {
728 try
729 {
730 CDeserializeAdapter da(&vb);
731 da >> _d;
732 return true;
733 }
734 catch ( ... )
735 {
736 return false;
737 }
738 }
739 return false;
740 }
741
742 #ifdef __AFX_H__
743
751 bool WriteWindowText(LPCTSTR lpszKey, HWND hWnd)
752 {
753 CStr s;
754 int l = ::GetWindowTextLength(hWnd);
755 if ( l > 0 )
756 {
757 ::GetWindowText(hWnd, s.GetBuffer(l + 2), l + 1);
758 s.ReleaseBuffer();
759 return WriteString(lpszKey, s);
760 }
761 return DeleteKey(lpszKey);
762 }
763
772 bool QueryWindowText(LPCTSTR lpszKey, HWND hWnd, LPCTSTR lpszDefault = NULL) const
773 {
774 CStr s = QueryString(lpszKey, lpszDefault);
775 return !! ::SetWindowText(hWnd, s);
776 }
777
778 #endif
779
780 #ifdef _TnbACCESSOR_Tree_ENABLE
781
787 CKeyMap GetKeyMap(void) const
788 {
789 CKeyMap map;
790 const CStrVector& vstr = EnumKeyNames();
791 loop ( i, vstr.GetSize() )
792 {
793 map[vstr[i]] = QueryValue(vstr[i]);
794 }
795 return map;
796 }
797
803 void GetKeyTree(CKeyTree& _tree) const
804 {
805 const CStrVector& vs = EnumSectionNames();
806 loop ( i, vs.GetSize() )
807 {
808 CSection s = *this;
809 s.InSubSection(vs[i]);
810 s.GetKeyTree(_tree.Refer(vs[i]));
812 }
813 const CKeyMap& mapKey = GetKeyMap();
814 CStr key;
815 CValue value;
816 loop ( i, mapKey.GetSize() )
817 {
818 mapKey.Get(i, key, value);
819 if ( key.IsEmpty() )
820 {
821 _tree.AtSelf() = value;
822 }
823 else
824 {
825 _tree.Add(key, value);
826 }
827 }
828 }
829
836 void GetKeyTree(CStrsTree& _tree) const
837 {
838 const CStrVector& vs = EnumSectionNames();
839 loop ( i, vs.GetSize() )
840 {
841 CSection s = *this;
842 s.InSubSection(vs[i]);
843 s.GetKeyTree(_tree.Refer(vs[i]));
845 }
846 const CKeyMap& mapKey = GetKeyMap();
847 CStr key;
848 CValue value;
849 loop ( i, mapKey.GetSize() )
850 {
851 mapKey.Get(i, key, value);
852 if ( key.IsEmpty() )
853 {
854 _tree.AtSelf() = value.QueryString();
855 }
856 else
857 {
858 _tree.Add(key, value.QueryString());
859 }
860 }
861 }
862
863 #endif
864 };
865
867 virtual ~IAccessor(void)
868 {
869 }
870
875 virtual CStr GetTypeName(void) const = 0;
876
883 virtual bool Flush(void) = 0;
884
890 virtual CStrVector EnumSectionNames(LPCTSTR lpszSectionName = NULL) const = 0;
891
898 virtual bool DeleteSection(LPCTSTR lpszSectionName) = 0;
899
905 virtual CStrVector EnumKeyNames(LPCTSTR lpszSectionName) const = 0;
906
913 virtual EKind GetKeyKind(LPCTSTR lpszSectionName, LPCTSTR lpszKey) const = 0;
914
921 virtual CValue QueryValue(LPCTSTR lpszSectionName, LPCTSTR lpszKey) const = 0;
922
931 virtual bool WriteValue(LPCTSTR lpszSectionName, LPCTSTR lpszKey, const IAccessor::CValue& value) = 0;
932
939 template<typename TYP>
941 {
943 vv.SetSize(vt.GetSize());
944 loop ( i, vt.GetSize() )
945 {
946 vv[i] = CValue(vt[i]);
947 }
948 return vv;
949 }
950};
951
952
953
967{
968 DEFSUPER(IAccessor);
969public:
970
976 CSection operator[](LPCTSTR lpszSectionName)
977 {
978 return CSection(this, lpszSectionName);
979 }
980
986 const CSection operator[](LPCTSTR lpszSectionName) const
987 {
988 return CSection(this, lpszSectionName);
989 }
990
996 virtual bool Flush(void)
997 {
998 return true;
999 }
1000
1007 {
1008 bool r = true;
1009 CStrVector vs = EnumSectionNames(NULL);
1010 loop ( i, vs.GetSize() )
1011 {
1012 r &= DeleteSection(vs[i]);
1013 }
1014 return r;
1015 }
1016
1017 #ifdef _TnbACCESSOR_Tree_ENABLE
1018
1024 void GetKeyTree(CKeyTree& _tree) const
1025 {
1026 const CStrVector& vstr = EnumSectionNames();
1027 CSection(this, _T("")).GetKeyTree(_tree);
1028 loop ( i, vstr.GetSize() )
1029 {
1030 CSection(this, vstr[i]).GetKeyTree(_tree.Refer(vstr[i]));
1031 }
1032 }
1033
1040 void GetKeyTree(CStrsTree& _tree) const
1041 {
1042 const CStrVector& vstr = EnumSectionNames();
1043 CSection(this, _T("")).GetKeyTree(_tree);
1044 loop ( i, vstr.GetSize() )
1045 {
1046 CSection(this, vstr[i]).GetKeyTree(_tree.Refer(vstr[i]));
1047 }
1048 }
1049
1050 #endif
1051
1058 {
1059 CStr str;
1060 DWORD dwRc = ::GetModuleFileName(NULL, str.GetBuffer(MAX_PATH), MAX_PATH);
1061 str.ReleaseBuffer();
1062 ASSERTLIB(dwRc != 0);
1063 IgnoreUnusedValue(dwRc);
1064 //
1065 CStr strWork;
1066 strWork = str.Left(str.ReverseFind('.'));
1067 #if defined(_DEBUG) && !defined(_WIN32_WCE)
1068 strWork += _T(".");
1069 CStr s;
1070 DWORD dwLength = MAX_COMPUTERNAME_LENGTH + 1;
1071 ::GetComputerName(s.GetBuffer(dwLength), &dwLength);
1072 s.ReleaseBuffer();
1073 strWork += s;
1074 #endif
1075 return strWork;
1076 }
1077};
1078
1079
1080
1093{
1094public:
1095
1097 CDeepAccessFinder(void) : m_depth(0)
1098 {
1099 }
1100
1106 {
1107 IAccessor::CSection sec = section;
1108 m_depth = 0;
1109 m_Find(sec);
1110 }
1111
1112protected:
1113
1116 {
1120 };
1121
1131 virtual EResult OnFindSection(LPCTSTR lpszSection, IAccessor::CSection& sec, int depth)
1132 {
1133 return Next;
1134 }
1135
1136private:
1138 EResult m_Find(IAccessor::CSection& sec)
1139 {
1140 m_depth++;
1141 CStrVector vs = sec.EnumSectionNames();
1142 loop ( i, vs )
1143 {
1144 IAccessor::CSection s = sec;
1145 if ( s.InSubSection(vs[i]) )
1146 {
1147 EResult r = OnFindSection(vs[i], s, m_depth);
1148 if ( r == Next )
1149 {
1150 r = m_Find(s);
1151 }
1152 if ( r == Previous )
1153 {
1154 break;
1155 }
1156 if ( r != Next )
1157 {
1158 m_depth--;
1159 return Stop;
1160 }
1161 }
1162 }
1163 m_depth--;
1164 return Next;
1165 }
1166 int m_depth;
1167};
1168
1169
1170
1171#ifndef _WIN32_WCE
1172
1188inline bool StoreWindowPlacement(IAccessor::CSection& _sec, HWND hWnd)
1189{
1190 bool boRc = true;
1191 WINDOWPLACEMENT t = { 0 };
1192 t.length = sizeof(WINDOWPLACEMENT);
1193 if ( ! ::GetWindowPlacement(hWnd, &t) ){ return false; }
1194 boRc &= _sec.WriteDword(_T("Valid"), 1);
1195 boRc &= _sec.WriteLonglong(_T("SX"), t.rcNormalPosition.left);
1196 boRc &= _sec.WriteLonglong(_T("SY"), t.rcNormalPosition.top);
1197 boRc &= _sec.WriteLonglong(_T("EX"), t.rcNormalPosition.right);
1198 boRc &= _sec.WriteLonglong(_T("EY"), t.rcNormalPosition.bottom);
1199 boRc &= _sec.WriteDword(_T("Show"), ::IsWindowVisible(hWnd));
1200 boRc &= _sec.WriteDword(_T("Maximize"), ::IsZoomed(hWnd));
1201 return boRc;
1202}
1203
1204
1205
1225inline bool RestoreWindowPlacement(const IAccessor::CSection& sec, HWND hWnd, bool withWindowSize = true, bool withShowHide = false)
1226{
1227 if ( sec.QueryDword(_T("Valid"), 0) == 0 )
1228 {
1229 return false;
1230 }
1231 WINDOWPLACEMENT t = { 0 };
1232 t.length = sizeof(WINDOWPLACEMENT);
1233 if ( ! ::GetWindowPlacement(hWnd, &t) )
1234 {
1235 return false;
1236 }
1237 int width = t.rcNormalPosition.right - t.rcNormalPosition.left;
1238 int height = t.rcNormalPosition.bottom - t.rcNormalPosition.top;
1239 t.rcNormalPosition.left = static_cast<LONG>(sec.QueryLonglong(_T("SX"), 0));
1240 t.rcNormalPosition.top = static_cast<LONG>(sec.QueryLonglong(_T("SY"), 0));
1241 if ( withWindowSize )
1242 {
1243 t.rcNormalPosition.right = static_cast<LONG>(sec.QueryLonglong(_T("EX"), 100));
1244 t.rcNormalPosition.bottom = static_cast<LONG>(sec.QueryLonglong(_T("EY"), 100));
1245 }
1246 else
1247 {
1248 t.rcNormalPosition.right = t.rcNormalPosition.left + width;
1249 t.rcNormalPosition.bottom = t.rcNormalPosition.top + height;
1250 }
1251 //
1252 DWORD cx = t.rcNormalPosition.right - t.rcNormalPosition.left;
1253 DWORD cy = t.rcNormalPosition.bottom - t.rcNormalPosition.top;
1254 if ( cx > 4000 || cy > 4000 )
1255 {
1256 return false;
1257 }
1258 t.flags = WPF_SETMINPOSITION;
1259 t.showCmd = SW_HIDE;
1260 ::SetWindowPlacement(hWnd, &t);
1261 if ( withShowHide )
1262 {
1263 DWORD s = sec.QueryDword(_T("Show"), TRUE);
1264 ::ShowWindow(hWnd, (s != 0) ? SW_SHOW : SW_HIDE);
1265 }
1266 if ( !! sec.QueryDword(_T("Maximize"), FALSE) )
1267 {
1268 ::ShowWindow(hWnd, SW_MAXIMIZE);
1269 }
1270 return true;
1271}
1272
1273#endif //_WIN32_WCE
1274
1275
1276
1277}; // TNB
情報群管理関係のヘッダ
#define loop(VAR, CNT)
loop構文.
Definition: TnbDef.h:343
マップ型情報管理関係のヘッダ
情報群管理のシリアライザーアダプタ関係のヘッダ
文字列操作関係のヘッダ
文字列情報配列管理関係のヘッダ
ツリー型情報管理関係のヘッダ
情報アクセス抽象クラス.
Definition: TnbAccessor.h:967
static CStr MakeDefineFilePath(void)
[作成] 定義ファイル名作成.
Definition: TnbAccessor.h:1057
virtual bool Flush(void)
[操作] フラッシュ.
Definition: TnbAccessor.h:996
const CSection operator[](LPCTSTR lpszSectionName) const
[取得] CSection取得
Definition: TnbAccessor.h:986
bool DeleteAllSection(void)
[削除] 全セクション削除
Definition: TnbAccessor.h:1006
CSection operator[](LPCTSTR lpszSectionName)
[取得] CSection取得
Definition: TnbAccessor.h:976
void GetKeyTree(CKeyTree &_tree) const
[取得] 全値取得
Definition: TnbAccessor.h:1024
void GetKeyTree(CStrsTree &_tree) const
[取得] 全値取得
Definition: TnbAccessor.h:1040
ディープ検索クラス
Definition: TnbAccessor.h:1093
void Execute(IAccessor::CSection &section)
[実行] 検索開始.
Definition: TnbAccessor.h:1105
@ Previous
一つ上の階層へ
Definition: TnbAccessor.h:1118
virtual EResult OnFindSection(LPCTSTR lpszSection, IAccessor::CSection &sec, int depth)
[通知] セクション発見.
Definition: TnbAccessor.h:1131
CDeepAccessFinder(void)
コンストラクタ
Definition: TnbAccessor.h:1097
デシリアライズアダプタ.
マップ型情報管理テンプレート
Definition: TnbMap.h:66
virtual size_t GetSize(void) const
[取得] 要素数取得
Definition: TnbMap.h:327
virtual CPair Get(INDEX index) const
[取得] キーと値を取得.
Definition: TnbMap.h:341
NULLポインタ例外
Definition: TnbException.h:172
シリアライズアダプタ.
static CStrT< TYP > BinaryToHexString(const IConstCollectionT< BYTE > &c)
[作成] バイナリ→HEX文字列
static CByteVector HexStringToBinary(const TYP *lpszHex)
[作成] HEX文字列→バイナリ
INT_PTR ReverseFind(TYP t) const
[確認] 検索(後ろから)
Definition: TnbStr.h:575
bool IsEmpty(void) const
[確認] 空チェック
Definition: TnbStr.h:528
CStrT Left(size_t iSize) const
[作成] 範囲取得.
Definition: TnbStr.h:801
void ReleaseBuffer(void)
[操作] 割り当てたバッファを開放.
Definition: TnbStr.h:954
static CStrT Fmt(const TCHAR *lpszFormat,...)
[作成] 書式付き文字列作成
Definition: TnbStr.h:1206
LONGLONG ToLonglong(INDEX iOffset=0) const
[取得] 数値(LONGLONG)へ変換
Definition: TnbStr.h:889
void Empty(void)
[削除] 空化
Definition: TnbStr.h:197
TYP * GetBuffer(size_t iLength=0)
[操作] 書き込みバッファ要求.
Definition: TnbStr.h:914
ツリー型文字列情報管理クラス.
Definition: TnbTree.h:578
CStrsTree Refer(LPCTSTR key)
[取得] キー下のTree取得
Definition: TnbTree.h:654
ツリー型情報管理テンプレートクラス
Definition: TnbTree.h:47
CTreeT< KEY, VAL, INK > Refer(INK key)
[取得] キー下のTree取得
Definition: TnbTree.h:449
bool Add(INK key, VAL v)
[追加] キー下の値追加
Definition: TnbTree.h:356
const VAL & AtSelf(void) const
[取得] 直下の情報の参照
Definition: TnbTree.h:224
virtual size_t GetSize(void) const
[取得] サイズ取得
Definition: TnbVector.h:368
virtual bool SetSize(size_t size)
[操作] サイズ指定
Definition: TnbVector.h:618
virtual const TYP * ReferBuffer(void) const
[取得] データアドレス取得
Definition: TnbVector.h:664
virtual size_t SetElements(size_t size, const TYP *P=NULL)
[設定] 複数要素設定.
Definition: TnbVector.h:526
セクション情報アクセスクラス
Definition: TnbAccessor.h:294
CStrVector EnumKeyNames(void) const
[取得] キー名一覧取得
Definition: TnbAccessor.h:419
bool WriteWindowText(LPCTSTR lpszKey, HWND hWnd)
[追加] ウィンドウテキスト情報記録
Definition: TnbAccessor.h:751
CStr QueryString(LPCTSTR lpszKey, LPCTSTR lpszDefault=NULL) const
[取得] 文字列情報取得
Definition: TnbAccessor.h:506
bool InSubSection(LPCTSTR lpszSubName)
[設定] 対象セクション変更.
Definition: TnbAccessor.h:365
CStr GetSectionName(void) const
[取得] セクション名取得
Definition: TnbAccessor.h:335
bool CanQuery(void) const
[確認] 参照可能? そのセクションが存在し読み込める、確認できます。
Definition: TnbAccessor.h:346
bool WriteDword(LPCTSTR lpszKey, DWORD dwValue)
[追加] 数値情報記録
Definition: TnbAccessor.h:576
CVectorT< CValue > QueryVector(void) const
[取得] 配列値取得
Definition: TnbAccessor.h:681
bool WriteData(LPCTSTR lpszKey, size_t len, LPCVOID P)
[追加] バイナリ情報記録
Definition: TnbAccessor.h:554
CSection(const IAccessor *I, LPCTSTR lpszSectionName)
代入コンストラクタ
Definition: TnbAccessor.h:321
bool QueryWindowText(LPCTSTR lpszKey, HWND hWnd, LPCTSTR lpszDefault=NULL) const
[取得] ウィンドウテキスト情報取得
Definition: TnbAccessor.h:772
bool WritePluralStrings(LPCTSTR lpszKey, const CStrVector &vs)
[追加] 文字列群情報記録
Definition: TnbAccessor.h:519
bool WriteString(LPCTSTR lpszKey, LPCTSTR lpszValue)
[追加] 文字列情報記録
Definition: TnbAccessor.h:495
CStrVector QueryPluralStrings(LPCTSTR lpszKey) const
[取得] 文字列群情報取得
Definition: TnbAccessor.h:529
const IAccessor * ReferAccessor(void) const
[参照] Accessorインターフェース参照
Definition: TnbAccessor.h:401
LONGLONG QueryLonglong(LPCTSTR lpszKey, LONGLONG llDefault=0) const
[取得] 数値情報取得
Definition: TnbAccessor.h:611
bool WriteValue(LPCTSTR lpszKey, const CValue &value)
[追加] 情報記録
Definition: TnbAccessor.h:473
bool WriteData(LPCTSTR lpszKey, const IConstCollectionT< BYTE > &c)
[追加] バイナリ情報記録
Definition: TnbAccessor.h:541
CStrVector EnumSectionNames(void) const
[取得] セクション名一覧取得
Definition: TnbAccessor.h:410
bool HasKey(LPCTSTR lpszKey) const
[確認] 情報存在確認
Definition: TnbAccessor.h:450
bool DeleteAllKeys(void)
[削除] 全キー削除
Definition: TnbAccessor.h:429
CValue QueryValue(LPCTSTR lpszKey) const
[取得] 情報取得
Definition: TnbAccessor.h:483
void GetKeyTree(CKeyTree &_tree) const
[取得] 全値取得
Definition: TnbAccessor.h:803
bool QueryStruct(LPCTSTR lpszKey, TYP &_t) const
[取得] バイナリ情報取得
Definition: TnbAccessor.h:644
void PreviousSubSection(void)
[設定] 対象セクション変更.
Definition: TnbAccessor.h:384
CKeyMap GetKeyMap(void) const
[取得] 全値取得
Definition: TnbAccessor.h:787
DWORD QueryDword(LPCTSTR lpszKey, DWORD dwDefault=0) const
[取得] 数値情報取得
Definition: TnbAccessor.h:587
bool WriteVector(const CVectorT< CValue > &vv)
[追加] 配列値記録
Definition: TnbAccessor.h:663
void GetKeyTree(CStrsTree &_tree) const
[取得] 全値取得
Definition: TnbAccessor.h:836
bool QuerySerializableData(LPCTSTR lpszKey, ISerializable &_d) const
[取得] シリアライザブルデータ情報取得
Definition: TnbAccessor.h:723
bool WriteLonglong(LPCTSTR lpszKey, LONGLONG llValue)
[追加] 数値情報記録
Definition: TnbAccessor.h:600
bool WriteStruct(LPCTSTR lpszKey, const TYP &t)
[追加] バイナリ情報記録
Definition: TnbAccessor.h:627
bool DeleteKey(LPCTSTR lpszKey)
[削除] 指定キー削除
Definition: TnbAccessor.h:461
EKind GetKeyKind(LPCTSTR lpszKey) const
[取得] 情報取種取得
Definition: TnbAccessor.h:439
CByteVector QueryData(LPCTSTR lpszKey) const
[取得] バイナリ情報取得
Definition: TnbAccessor.h:564
bool WriteSerializableData(LPCTSTR lpszKey, const ISerializable &s)
[追加] シリアライザブルデータ情報記録
Definition: TnbAccessor.h:700
情報アクセスの汎用値保持クラス.
Definition: TnbAccessor.h:100
CValue(const CStrVector &vstr)
コンストラクタ
Definition: TnbAccessor.h:127
CStr QueryString(void) const
[取得] 文字列情報取得
Definition: TnbAccessor.h:185
CValue(LPCTSTR lpsz)
コンストラクタ
Definition: TnbAccessor.h:119
CValue(DWORD dw)
コンストラクタ
Definition: TnbAccessor.h:155
LONGLONG QueryLonglong(void) const
[取得] 数値情報取得
Definition: TnbAccessor.h:253
CValue(LONGLONG ll)
コンストラクタ
Definition: TnbAccessor.h:163
CValue(size_t len, LPCVOID P)
コンストラクタ 指定のバイナリを持ったオブジェクトになります。
Definition: TnbAccessor.h:146
CByteVector QueryData(void) const
[取得] バイナリ情報取得
Definition: TnbAccessor.h:229
DWORD QueryDword(void) const
[取得] 数値情報取得
Definition: TnbAccessor.h:243
CValue(const IConstCollectionT< BYTE > &c)
コンストラクタ
Definition: TnbAccessor.h:135
CStrVector QueryPluralStrings(void) const
[取得] 文字列群情報取得
Definition: TnbAccessor.h:214
EKind GetKind(void) const
[取得] 情報取種取得
Definition: TnbAccessor.h:171
bool IsNull(void) const
[確認] 情報有無確認
Definition: TnbAccessor.h:178
CValue(void)
コンストラクタ
Definition: TnbAccessor.h:111
bool RestoreWindowPlacement(const IAccessor::CSection &sec, HWND hWnd, bool withWindowSize=true, bool withShowHide=false)
ウィンドウの状態を復元.
Definition: TnbAccessor.h:1225
bool StoreWindowPlacement(IAccessor::CSection &_sec, HWND hWnd)
ウィンドウの状態を保存.
Definition: TnbAccessor.h:1188
CStr StrVectorToStrEx(const CStrVector &vs, TCHAR sepaChar='^', TCHAR escChar='\\')
[変換] CStrVector → CStr
Definition: TnbStrVector.h:172
INT_PTR IndexOf(LPCSTR lpszText, char c, INDEX iFromIndex=0)
[検索] 文字検索(ASCII/SJIS用)
Definition: TnbStrLib.h:184
CStr GetComputerName(void)
[取得] PC名取得
Definition: TnbStrEx.h:35
size_t GetLen(LPCSTR lpsz)
[計算] 文字列長計算(ASCII/SJIS用)
Definition: TnbStrLib.h:44
CStrVector StrToStrVectorEx(LPCTSTR lpsz, TCHAR sepaChar='^', TCHAR escChar='\\')
[変換] CStr → CStrVector
Definition: TnbStrVector.h:201
void IgnoreUnusedValue(const T &value)
[宣言] 参照しない値宣言.
Definition: TnbDef.h:434
TNB Library
Definition: TnbDoxyTitle.txt:2
void MemCopy(T *_pDst, const void *pSrc, size_t len)
[複製] メモリコピー
Definition: TnbDef.h:376
情報アクセスインターフェース.
Definition: TnbAccessor.h:74
virtual CStrVector EnumSectionNames(LPCTSTR lpszSectionName=NULL) const =0
[取得] セクション名一覧取得
virtual CValue QueryValue(LPCTSTR lpszSectionName, LPCTSTR lpszKey) const =0
[取得] 情報取得
virtual EKind GetKeyKind(LPCTSTR lpszSectionName, LPCTSTR lpszKey) const =0
[取得] 情報取種取得
virtual CStrVector EnumKeyNames(LPCTSTR lpszSectionName) const =0
[取得] キー名一覧取得
static CVectorT< IAccessor::CValue > ToValueVector(const CVectorT< TYP > &vt)
[変換] 配列変換.
Definition: TnbAccessor.h:940
CTreeT< CStr, CValue, LPCTSTR > CKeyTree
キーと値のツリー型宣言
Definition: TnbAccessor.h:269
CMapT< CStr, CValue, LPCTSTR > CKeyMap
キーと値のマップ型宣言
Definition: TnbAccessor.h:266
virtual ~IAccessor(void)
デストラクタ
Definition: TnbAccessor.h:867
virtual bool Flush(void)=0
[操作] フラッシュ.
virtual CStr GetTypeName(void) const =0
[取得] タイプ名取得
EKind
値型の種類.
Definition: TnbAccessor.h:80
@ EK_String
文字列
Definition: TnbAccessor.h:82
@ EK_Binary
バイナリ
Definition: TnbAccessor.h:84
@ EK_Dword
32Bit Unsigned Integer
Definition: TnbAccessor.h:85
@ EK_PluralStrings
複数の文字列群
Definition: TnbAccessor.h:83
@ EK_Nothing
存在しない
Definition: TnbAccessor.h:81
@ EK_Longlong
64Bit Signed Integer
Definition: TnbAccessor.h:86
virtual bool DeleteSection(LPCTSTR lpszSectionName)=0
[削除] 指定セクション削除
virtual bool WriteValue(LPCTSTR lpszSectionName, LPCTSTR lpszKey, const IAccessor::CValue &value)=0
[設定] 情報設定
virtual size_t Copy(const IConstCollectionT< TYP > &c)
[設定] コピー.
virtual size_t CopyElements(size_t size, const TYP *P=NULL)
[設定] コピー.
bool IsEmpty(void) const
[確認] 要素の有無確認.
INDEX Find(const IChecker &checker, INDEX startIndex=0, bool boIsReverse=false) const
[検索] 条件一致要素の検索.
シリアライザブルインターフェース.
Definition: TnbSerializer.h:47