TNB Library
TnbStr.h
[詳解]
1#pragma once
15#include "TnbSerializer.h"
16#include "TnbStrLib.h"
18
19
20
21//T-TestCaseコードカバレッジDisable
22#pragma comment(user,"T-Coverage Disable")
23
24
25
26//TNB Library
27namespace TNB
28{
29
30
31
32#ifndef _TnbDOXYGEN //Document 作成用シンボル
33 // CStrTのNULL状態
34// _SELECTANY LPCVOID gpStrNull = &g_plNullBase[3];
35#define gpStrNull (LPCVOID)(&(g_plNullBase[3]))
36#endif
37
38
39
72template<typename TYP>
73class CStrT
74{
75public:
76
77 #ifndef _TnbDOXYGEN //Document作成用シンボル
78 // const_iterator型宣言
79 typedef const TYP* const_iterator;
80 // iterator型宣言
81 typedef TYP* iterator;
82 #endif //_TnbDOXYEM
83
89 const_iterator begin(void) const { return m_lpBuf; }
90
96 const_iterator end(void) const { return begin() + GetLength(); }
97
103 iterator begin(void) { GetBuffer(); ReleaseBuffer(); return m_lpBuf; }
104
110 iterator end(void) { return begin() + GetLength(); }
111
118 iterator insert(iterator ite, const TYP& t = TYP())
119 {
120 INDEX index = ite - begin();
121 Insert(index, t);
122 return begin() + index;
123 }
124
129 void push_front(TYP t) { Insert(0, t); }
130
135 void push_back(TYP t) { operator+=(t); }
136
137
138 //-------------------------
139
140
142 CStrT(void)
143 {
144 m_InitBuf();
145 }
146
151 CStrT(const CStrT& str)
152 {
153 if ( ! str.IsEmpty() )
154 {
155 ::InterlockedIncrement(str.m_GetRefP());
156 m_lpBuf = str.m_lpBuf;
157 }
158 else
159 {
160 m_InitBuf();
161 }
162 }
163
168 CStrT(const char* lpText)
169 {
170 if ( lpText != NULL && *lpText != 0 )
171 {
172 m_lpBuf = ms_NewBuf(TYP(), lpText);
173 }
174 else
175 {
176 m_InitBuf();
177 }
178 }
179
184 CStrT(const WCHAR* lpText)
185 {
186 if ( lpText != NULL && *lpText != 0 )
187 {
188 m_lpBuf = ms_NewBuf(TYP(), lpText);
189 }
190 else
191 {
192 m_InitBuf();
193 }
194 }
195
197 void Empty(void)
198 {
199 if ( m_lpBuf != static_cast<const TYP*>(gpStrNull) )
200 {
201 if ( ::InterlockedDecrement(m_GetRefP()) <= 0 )
202 {
203 ms_Delete(m_lpBuf);
204 }
205 m_InitBuf();
206 }
207 ASEERT_NULLBASE;
208 }
209
211 ~CStrT(void)
212 {
213 Empty();
214 }
215
221 CStrT& operator=(const CStrT& other)
222 {
223 if ( ! other.IsEmpty() )
224 {
225 ::InterlockedIncrement(other.m_GetRefP());
226 m_SetBuf(other.m_lpBuf);
227 }
228 else
229 {
230 Empty();
231 }
232 return *this;
233 }
234
240 CStrT& operator=(const char* lpText)
241 {
242 if ( lpText != NULL && *lpText != 0 )
243 {
244 m_SetBuf(ms_NewBuf(TYP(), lpText));
245 }
246 else
247 {
248 Empty();
249 }
250 return *this;
251 }
252
258 CStrT& operator=(const WCHAR* lpText)
259 {
260 if ( lpText != NULL && *lpText != 0 )
261 {
262 m_SetBuf(ms_NewBuf(TYP(), lpText));
263 }
264 else
265 {
266 Empty();
267 }
268 return *this;
269 }
270
278 CStrT& SetFromLeft(const TYP* lpText, size_t iLen)
279 {
280 if ( lpText == NULL || STRLIB::GetLen(lpText) <= iLen )
281 {
282 operator=(lpText);
283 }
284 else if ( iLen <= 0 )
285 {
286 Empty();
287 }
288 else
289 {
290 TYP* P = ms_NewBuf(TYP(), ms_NullStr(), iLen);
291 MemCopy(P, lpText, iLen);
292 P[iLen] = 0;
293 ms_CalcInfoPointer(P)->lLength = iLen;
294 m_SetBuf(P);
295 }
296 return *this;
297 }
298
304 CStrT& operator+=(const char* lpText)
305 {
306 return m_AddText(lpText);
307 }
308
314 CStrT& operator+=(const WCHAR* lpText)
315 {
316 return m_AddText(lpText);
317 }
318
326 {
327 TYP at[2] = {t, 0};
328 return operator+=(at);
329 }
330
349 void FormatV(const TYP* lpszFormat, va_list V)
350 {
351 m_SetBuf(ms_Format(lpszFormat, V));
352 }
353
359 void Format(const TYP* lpszFormat, ...)
360 {
361 va_list args;
362 va_start(args, lpszFormat);
363 FormatV(lpszFormat, args);
364 va_end(args);
365 }
366
371 operator const TYP*(void) const
372 {
373 return m_lpBuf;
374 }
375
380 const TYP* ReferBuffer(void) const
381 {
382 return m_lpBuf;
383 }
384
390 void SetAt(INDEX index, TYP t)
391 {
392 if ( ! IsInRange(index, GetLength()) )
393 {
394 ASSERT1( false, "CStrT::SetAt()", "範囲外のIndex(%d)が指定されました。", index );
395 return;
396 }
397 m_Separate();
398 m_lpBuf[index] = t;
399 }
400
406 void Insert(INDEX index, const TYP* lpText)
407 {
408 if ( GetLength() <= index )
409 {
410 m_AddText(lpText);
411 return;
412 }
413 size_t iAddSize = STRLIB::GetLen(lpText);
414 size_t iNowSize = GetLength();
415 if ( *(m_GetRefP()) != 1 || m_GetBufSize() <= iAddSize + iNowSize )
416 {
417 TYP* P = ms_NewBuf(TYP(), m_lpBuf, iAddSize); //足りないので新たに確保
418 m_SetBuf(P);
419 }
420 // ずらす(NUL文字も含めるので、LOOP一回多くしている)
421 for ( INT_PTR i = iNowSize - index; i >= 0; i-- )
422 {
423 m_lpBuf[index + i + iAddSize] = m_lpBuf[index + i];
424 }
425 // 植え込み
426 loop ( i, iAddSize )
427 {
428 m_lpBuf[index + i] = lpText[i];
429 }
430 m_GetInfoP()->lLength = iAddSize + iNowSize;
431 }
432
438 void InsertAt(INDEX index, TYP c)
439 {
440 TYP buf[2] = { c, 0 };
441 Insert(index, buf);
442 }
443
452 int Delete(INDEX index, size_t iLen = 1)
453 {
454 if ( ! IsInRange(index, GetLength()) )
455 {
456 ASSERT1( false, "CStrT::Delete()", "範囲外のIndex(%d)が指定されました。", index );
457 return 0;
458 }
459 if ( iLen == 0 )
460 {
461 ASSERT1( false, "CStrT::Delete()", "範囲外の長さ(%d)が指定されました。", 0 );
462 return 0;
463 }
464 iLen--;
465 if ( index + iLen >= GetLength() )
466 {
467 *this = Left(index);
468 return 0;
469 }
470 m_Separate();
471 size_t iDelSize = STRLIB::GetCharSize(m_lpBuf[index + iLen]) + iLen;
472 size_t iSize = GetLength() - iDelSize;
473 for ( size_t i = index; i < iSize; i++ )
474 {
475 m_lpBuf[i] = m_lpBuf[i + iDelSize];
476 }
477 m_lpBuf[iSize] = 0;
478 m_GetInfoP()->lLength -= iDelSize;
479 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
480 return iDelSize;
481 }
482
487 void DeleteLast(void)
488 {
489 INT_PTR len = GetLength();
490 if ( len > 0 )
491 {
492 m_Separate();
493 m_lpBuf[len - 1] = 0;
494 m_GetInfoP()->lLength -= 1;
495 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
496 }
497 }
498
504 TYP GetAt(INDEX index) const
505 {
506 if ( IsInRange(index, GetLength()) )
507 {
508 return m_lpBuf[index];
509 }
510 ASSERT1( false, "CStrT::GetAt()", "範囲外のIndex(%d)が指定されました。", index );
511 return 0;
512 }
513
518 size_t GetLength(void) const
519 {
520 return m_GetInfoP()->lLength;
521 }
522
528 bool IsEmpty(void) const
529 {
530 return m_GetInfoP()->lLength == 0;
531 }
532
540 INT_PTR Find(TYP t, INDEX iFromIndex = 0) const
541 {
542 return STRLIB::IndexOf(m_lpBuf, t, iFromIndex);
543 }
544
552 INT_PTR Find(const TYP* lpsz, INDEX iFromIndex = 0) const
553 {
554 return STRLIB::IndexOf(m_lpBuf, lpsz, iFromIndex);
555 }
556
564 INT_PTR FindOneOf(const TYP* lpsz, INDEX iFromIndex = 0) const
565 {
566 return STRLIB::IndexOneOf(m_lpBuf, lpsz, iFromIndex);
567 }
568
575 INT_PTR ReverseFind(TYP t) const
576 {
577 INT_PTR lRc = -1;
578 INT_PTR iPos = 0;
579 while ( true )
580 {
581 INT_PTR r = STRLIB::IndexOf(m_lpBuf, t, iPos);
582 if ( r < 0 )
583 {
584 break;
585 }
586 lRc = r;
587 iPos = r + STRLIB::GetCharSize(m_lpBuf[r]);
588 }
589 return lRc;
590 }
591
598 INT_PTR ReverseFind(const TYP* lpsz) const
599 {
600 INT_PTR lRc = -1;
601 INT_PTR iPos = 0;
602 while ( true )
603 {
604 INT_PTR r = STRLIB::IndexOf(m_lpBuf, lpsz, iPos);
605 if ( r < 0 )
606 {
607 break;
608 }
609 lRc = r;
610 iPos = r + STRLIB::GetCharSize(m_lpBuf[r]);
611 }
612 return lRc;
613 }
614
621 INT_PTR ReverseFindOneOf(const TYP* lpsz) const
622 {
623 INT_PTR lRc = -1;
624 INT_PTR iPos = 0;
625 while ( true )
626 {
627 INT_PTR r = STRLIB::IndexOneOf(m_lpBuf, lpsz, iPos);
628 if ( r < 0 )
629 {
630 break;
631 }
632 lRc = r;
633 iPos = r + STRLIB::GetCharSize(m_lpBuf[r]);
634 }
635 return lRc;
636 }
637
646 int operator-(const TYP* lpszSubject) const
647 {
648 return Compare(lpszSubject);
649 }
650
658 int Compare(const TYP* lpszSubject) const
659 {
660 return STRLIB::Compare(m_lpBuf, lpszSubject);
661 }
662
669 bool IsEqual(const TYP* lpszSubject) const { return Compare(lpszSubject) == 0; }
670
678 int CompareNoCase(const TYP* lpszSubject) const
679 {
680 return STRLIB::Compare(m_lpBuf, lpszSubject, -1, NORM_IGNORECASE);
681 }
682
697 int CompareByOption(const TYP* lpszSubject, DWORD dwCmpFlags) const
698 {
699 return STRLIB::Compare(m_lpBuf, lpszSubject, -1, dwCmpFlags);
700 }
701
708 bool IsEqualNoCase(const TYP* lpszSubject) const { return CompareNoCase(lpszSubject) == 0; }
709
716 bool operator==(const TYP* lpszSubject) const { return Compare(lpszSubject) == 0; }
717
724 bool operator!=(const TYP* lpszSubject) const { return Compare(lpszSubject) != 0; }
725
732 bool operator>(const TYP* lpszSubject) const { return Compare(lpszSubject) > 0; }
733
740 bool operator>=(const TYP* lpszSubject) const { return Compare(lpszSubject) >= 0; }
741
748 bool operator<(const TYP* lpszSubject) const { return Compare(lpszSubject) < 0; }
749
756 bool operator<=(const TYP* lpszSubject) const { return Compare(lpszSubject) <= 0; }
757
766 CStrT Mid(INDEX iOffset, size_t iSize = INVALID_SIZE) const
767 {
768 CStrT str;
769 size_t l = GetLength();
770 if ( l > iOffset && iSize != 0 )
771 {
772 if ( iSize == INVALID_SIZE || iOffset + iSize > l )
773 {
774 iSize = l - iOffset;
775 }
776 // = サイズの補正
777 if ( sizeof(TYP) == 1 )
778 {
779 size_t iPos = 0;
780 while ( iPos < iSize )
781 {
782 iPos += STRLIB::GetCharSize(m_lpBuf[iOffset + iPos]);
783 }
784 iSize = iPos;
785 }
786 TYP* P = ms_NewBuf(TYP(), ms_NullStr(), iSize);
787 MemCopy(P, &m_lpBuf[iOffset], iSize);
788 P[iSize] = 0;
789 ms_CalcInfoPointer(P)->lLength = iSize;
790 str.m_SetBuf(P);
791 ASSERTLIB( STRLIB::GetLen(str.m_lpBuf) == str.GetLength() );
792 }
793 return str;
794 }
795
801 CStrT Left(size_t iSize) const
802 {
803 return Mid(0, iSize);
804 }
805
811 CStrT Right(INT_PTR iSize) const
812 {
813 size_t l = GetLength();
814 if ( static_cast<size_t>(iSize) > l )
815 {
816 return *this;
817 }
818 return Mid(l - iSize);
819 }
820
827 CStrT Sandwich(const TYP* lpszBefore, const TYP* lpszAfter) const
828 {
829 CStrT str = lpszBefore;
830 str += m_lpBuf;
831 str += lpszAfter;
832 return str;
833 }
834
842 int ToInt(INDEX iOffset = 0, int iBase = 10) const
843 {
844 int i = 0;
845 if ( IsInRange(iOffset, GetLength()) )
846 {
847 i = STRLIB::ToInt(&m_lpBuf[iOffset], iBase);
848 }
849 return i;
850 }
851
859 DWORD ToDword(INDEX iOffset = 0, int iBase = 10) const
860 {
861 int i = 0;
862 if ( IsInRange(iOffset, GetLength()) )
863 {
864 i = STRLIB::ToDword(&m_lpBuf[iOffset], iBase);
865 }
866 return i;
867 }
868
874 double ToDouble(INDEX iOffset = 0) const
875 {
876 double a = 0;
877 if ( IsInRange(iOffset, GetLength()) )
878 {
879 a = STRLIB::ToDouble(&m_lpBuf[iOffset]);
880 }
881 return a;
882 }
883
889 LONGLONG ToLonglong(INDEX iOffset = 0) const
890 {
891 LONGLONG ll = 0;
892 if ( IsInRange(iOffset, GetLength()) )
893 {
894 ll = STRLIB::ToLonglong(&m_lpBuf[iOffset]);
895 }
896 return ll;
897 }
898
914 TYP* GetBuffer(size_t iLength = 0)
915 {
916 size_t lNowBufSize = m_GetBufSize();
917 if ( lNowBufSize == 0 )
918 {
919 //今、空っぽ
920 if ( iLength > 0 )
921 {
922 m_SetBuf(ms_New(TYP(), iLength + 1));
923 *m_lpBuf = 0;
924 }
925 else
926 {
927 return NULL;
928 }
929 }
930 else if ( lNowBufSize < iLength )
931 {
932 //サイズ拡張
933 TYP* P = ms_New(TYP(), iLength);
934 MemCopy(P, m_lpBuf, lNowBufSize);
935 m_SetBuf(P);
936 }
937 else if ( *(m_GetRefP()) > 1 )
938 {
939 //共有している,複製する必要有り
940 TYP* P = ms_New(TYP(), lNowBufSize);
941 MemCopy(P, m_lpBuf, lNowBufSize);
942 m_SetBuf(P);
943 }
944 m_GetInfoP()->lLength = 0;
945 return m_lpBuf;
946 }
947
954 void ReleaseBuffer(void)
955 {
956 if ( *(m_GetRefP()) == 1 )
957 {
958 m_GetInfoP()->lLength = STRLIB::GetLen(m_lpBuf);
959 }
960 }
961
968 CStrT& TrimLeft(TYP t = ' ')
969 {
970 return m_TrimLeft(t);
971 }
972
979 CStrT& TrimLeft(const TYP* lpsz)
980 {
981 return m_TrimLeft(lpsz);
982 }
983
990 CStrT& TrimRight(TYP t = ' ')
991 {
992 return m_TrimRight(t);
993 }
994
1001 CStrT& TrimRight(const TYP* lpsz)
1002 {
1003 return m_TrimRight(lpsz);
1004 }
1005
1012 CStrT& Trim(TYP t = ' ')
1013 {
1014 m_TrimLeft(t);
1015 return m_TrimRight(t);
1016 }
1017
1024 CStrT& Trim(const TYP* lpsz)
1025 {
1026 m_TrimLeft(lpsz);
1027 return m_TrimRight(lpsz);
1028 }
1029
1038 int Replace(TYP tOld, TYP tNew)
1039 {
1040 return m_Replace(tOld, tNew);
1041 }
1042
1051 int Replace(const TYP* lpszOld, TYP tNew)
1052 {
1053 return m_Replace(lpszOld, tNew);
1054 }
1055
1063 int Replace(const TYP* lpszOld, const TYP* lpszNew)
1064 {
1065 int iRc = 0;
1066 if ( lpszOld != NULL)
1067 {
1068 size_t iOldLen = STRLIB::GetLen(lpszOld);
1069 size_t iNewLen = (lpszNew == NULL) ? 0 : STRLIB::GetLen(lpszNew);
1070 size_t iLength = GetLength();
1071 //いくつあるか調べる
1072 int iCount = 0;
1073 INT_PTR index = 0;
1074 INT_PTR r;
1075 while ( (r = STRLIB::IndexOf(m_lpBuf, lpszOld, index)) >= 0 )
1076 {
1077 iCount++;
1078 index = r + iOldLen;
1079 }
1080 iLength += (iNewLen - iOldLen) * iCount;
1081 //確保して順次コピーする
1082 TYP* P = ms_NewBuf(TYP(), ms_NullStr(), iLength);
1083 TYP* pNew = P;
1084 TYP* pOld = m_lpBuf;
1085 while ( (r = STRLIB::IndexOf(pOld, lpszOld, 0)) >= 0 )
1086 {
1087 MemCopy(pNew, pOld, r); //キー文字までコピー
1088 pNew += r;
1089 MemCopy(pNew, lpszNew, iNewLen); //新しい文字をコピー
1090 pNew += iNewLen;
1091 pOld += iOldLen+r;
1092 iRc++;
1093 }
1094 MemCopy(pNew, pOld, STRLIB::GetLen(pOld) + 1);
1095 m_SetBuf(P);
1096 m_GetInfoP()->lLength = iLength;
1097 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
1098 }
1099 return iRc;
1100 }
1101
1108 int Remove(TYP t)
1109 {
1110 TYP aBuf[2] = {t, 0};
1111 const TYP* P = NULL;
1112 return Replace(aBuf, P);
1113 }
1114
1122 CStrT FindCut(TYP c, CStrT* _pstrRest = NULL) const
1123 {
1124 INT_PTR r = STRLIB::IndexOf(m_lpBuf, c, 0);
1125 if ( r >= 0 && _pstrRest != NULL )
1126 {
1127 *_pstrRest = Mid(r + 1);
1128 }
1129 return Mid(0, r);
1130 }
1131
1135 void MakeUpper(void)
1136 {
1137 ms_strupr(m_lpBuf);
1138 }
1139
1143 void MakeLower(void)
1144 {
1145 ms_strlwr(m_lpBuf);
1146 }
1147
1148
1149 //------------------------------------
1150
1151
1158 static CStrT IntToString(int value)
1159 {
1160 CStrT s;
1161 LPTSTR p = s.GetBuffer(32);
1162 INT_PTR i = CTinyStringFormaterT<TYP>::FormatInt(p, value);
1163 p[i] = 0;
1164 s.ReleaseBuffer();
1165 return s;
1166 }
1167
1174 static CStrT DwordToString(DWORD value)
1175 {
1176 CStrT s;
1177 LPTSTR p = s.GetBuffer(32);
1178 INT_PTR i = CTinyStringFormaterT<TYP>::FormatDword(p, value);
1179 p[i] = 0;
1180 s.ReleaseBuffer();
1181 return s;
1182 }
1183
1191 static CStrT ToHexString(DWORD value, size_t width)
1192 {
1193 CStrT s;
1194 LPTSTR p = s.GetBuffer(width);
1195 CTinyStringFormaterT<TYP>::FormatHex(p, value, width);
1196 s.ReleaseBuffer();
1197 return s;
1198 }
1199
1206 static CStrT Fmt(const TYP* lpszFormat, ...)
1207 {
1208 va_list args;
1209 va_start(args, lpszFormat);
1210 CStrT str;
1211 str.FormatV(lpszFormat, args);
1212 va_end(args);
1213 return str;
1214 }
1215
1222 static CStrT Lineup(TYP t, size_t length)
1223 {
1224 TYP* P = ms_NewBuf(TYP(), ms_NullStr(), length);
1225 loop ( i, length )
1226 {
1227 P[i] = t;
1228 }
1229 P[length] = 0;
1230 ms_CalcInfoPointer(P)->lLength = length;
1231 CStrT str;
1232 str.m_SetBuf(P);
1233 ASSERTLIB( STRLIB::GetLen(str.m_lpBuf) == str.GetLength() );
1234 return str;
1235 }
1236
1243 static CStrT Lineup(const TYP* lpsz, int iSize)
1244 {
1245 size_t l = STRLIB::GetLen(lpsz);
1246 TYP* P = ms_NewBuf(TYP(), ms_NullStr(), iSize * l);
1247 TYP* Q = P;
1248 loop ( i, iSize )
1249 {
1250 loop ( j, l )
1251 {
1252 *Q++ = lpsz[j];
1253 }
1254 }
1255 *Q = 0;
1256 ms_CalcInfoPointer(P)->lLength = iSize * l;
1257 CStrT str;
1258 str.m_SetBuf(P);
1259 ASSERTLIB( STRLIB::GetLen(str.m_lpBuf) == str.GetLength() );
1260 return str;
1261 }
1262
1271 template<typename ITE>
1272 static CStrT FromIterator(ITE is, ITE ie = ITE(), size_t max = INVALID_SIZE)
1273 {
1274 CStrT s;
1275 while ( is != ie && *is != 0 && max-- != 0)
1276 {
1277 s += *is++;
1278 }
1279 return s;
1280 }
1281
1288 static CStrT FromWindowText(HWND hWnd)
1289 {
1290 CStrT s;
1291 int iLen = ::GetWindowTextLength(hWnd);
1292 if ( iLen != 0 )
1293 {
1294 CWorkMemT<TCHAR> m(iLen + 1);
1295 ::GetWindowText(hWnd, m, iLen + 1);
1296 s.m_SetBuf(ms_NewBuf(TYP(), m));
1297 }
1298 return s;
1299 }
1300
1301 #ifdef __AFX_H__
1302
1310 {
1311 return FromWindowText(pcWnd->GetSafeHwnd());
1312 }
1313
1314 #endif
1315
1316private:
1317
1326 template<typename TYP>
1327 class CGroupT
1328 {
1329 public:
1334 CGroupT(TYP c) : m_char(c), m_lpsz(NULL)
1335 {
1336 }
1341 CGroupT(const TYP* lpsz) : m_char(0), m_lpsz(lpsz)
1342 {
1343 }
1344 bool IsEqual(TYP c) const
1345 {
1346 if ( m_char != 0 )
1347 {
1348 return c == m_char;
1349 }
1350 return STRLIB::IndexOf(m_lpsz, c) >= 0;
1351 }
1352 private:
1353 TYP m_char;
1354 const TYP* m_lpsz;
1355 };
1356
1363 CStrT& m_TrimLeft(CGroupT<TYP> t)
1364 {
1365 m_Separate();
1366 size_t l = GetLength();
1367 loop ( i, l )
1368 {
1369 if ( ! t.IsEqual(m_lpBuf[i]) )
1370 {
1371 m_GetInfoP()->lLength -= i;
1372 for ( size_t j = 0; i < l + 1; i++, j++ )
1373 {
1374 m_lpBuf[j] = m_lpBuf[i];
1375 }
1376 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
1377 return *this;
1378 }
1379 }
1380 Empty();
1381 return *this;
1382 }
1383
1390 CStrT& m_TrimRight(CGroupT<TYP> t)
1391 {
1392 m_Separate();
1393 size_t l = GetLength();
1394 for ( INT_PTR i = l - 1; i >= 0; i-- )
1395 {
1396 if ( ! t.IsEqual(m_lpBuf[i]) )
1397 {
1398 m_GetInfoP()->lLength = static_cast<size_t>(i + 1);
1399 m_lpBuf[i + 1] = 0;
1400 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
1401 return *this;
1402 }
1403 }
1404 Empty();
1405 return *this;
1406 }
1407
1416 int m_Replace(CGroupT<TYP> tOld, TYP tNew)
1417 {
1418 int iRc = 0;
1419 if ( tNew != 0 )
1420 {
1421 m_Separate();
1422 size_t l = GetLength();
1423 for ( size_t i = 0; i < l; i += STRLIB::GetCharSize(m_lpBuf[i]) )
1424 {
1425 if ( tOld.IsEqual(m_lpBuf[i]) )
1426 {
1427 m_lpBuf[i] = tNew;
1428 iRc++;
1429 }
1430 }
1431 }
1432 return iRc;
1433 }
1434
1440 struct TInfo
1441 {
1442 LONG lRef;
1443 size_t lLength;
1444 size_t lBufSize;
1445 };
1446
1452 static TInfo* ms_CalcInfoPointer(LPVOID lpsz)
1453 {
1454 BYTE* B = static_cast<BYTE*>(lpsz);
1455 return reinterpret_cast<TInfo*>(B - sizeof(TInfo));
1456 }
1457
1464 static char* ms_New(char d, size_t iLen)
1465 {
1466 BYTE* B = new BYTE[iLen + sizeof(TInfo)];
1467 TInfo* I = reinterpret_cast<TInfo*>(B);
1468 I->lRef = 1;
1469 I->lLength = 0;
1470 I->lBufSize = iLen;
1471 return reinterpret_cast<char*>(B + sizeof(TInfo));
1472 }
1473
1480 static WCHAR* ms_New(WCHAR d, size_t iLen)
1481 {
1482 BYTE* B = new BYTE[iLen * sizeof(WCHAR) + sizeof(TInfo)];
1483 TInfo* I = reinterpret_cast<TInfo*>(B);
1484 I->lRef = 1;
1485 I->lLength = 0;
1486 I->lBufSize = iLen;
1487 return reinterpret_cast<WCHAR*>(B + sizeof(TInfo));
1488 }
1489
1494 static void ms_Delete(LPVOID pMem)
1495 {
1496 ASSERTLIB( pMem != gpStrNull );
1497 BYTE* B = static_cast<BYTE*>(pMem);
1498 delete[] (B - sizeof(TInfo));
1499 }
1500
1507 template<typename T>
1508 static T* ms_Format(const T* lpsz, va_list V)
1509 {
1510 size_t iLen = 1024 + STRLIB::GetLen(lpsz);
1511 while ( true )
1512 {
1513 CWorkMemT<T> work(iLen);
1514 if ( STRLIB::VPrintF(work, iLen, lpsz, V) )
1515 {
1516 size_t r = STRLIB::GetLen(work);
1517 T* X = ms_New(T(), r + 1);
1518 const T* W = work;
1519 MemCopy(X, W, r + 1);
1520 ms_CalcInfoPointer(X)->lLength = r;
1521 return X;
1522 }
1523 iLen *= 2;
1524 }
1525 }
1526
1534 static size_t ms_GetSecureSize(size_t iSize, size_t iExSize = INVALID_SIZE)
1535 {
1536 if ( iExSize != INVALID_SIZE )
1537 {
1538 iSize += iExSize;
1539 size_t l = iSize / 8;
1540 l = (l < 4) ? 4 : ((l > 1024) ? 1024 : l);
1541 iSize += l;
1542 }
1543 return iSize + 1;
1544 }
1545
1554 static LPSTR ms_NewBuf(char d, LPCSTR lpsz, size_t iExSize = INVALID_SIZE)
1555 {
1556 if ( d == 1 )
1557 {
1558 return NULL;
1559 }
1560 size_t iSize = STRLIB::GetLen(lpsz);
1561 LPSTR P = ms_New(char(), ms_GetSecureSize(iSize, iExSize));
1562 MemCopy(P, lpsz, iSize + 1);
1563 ms_CalcInfoPointer(P)->lLength = iSize;
1564 return P;
1565 }
1566
1574 static LPSTR ms_NewBuf(char d, LPCWSTR lpsz, size_t iExSize = INVALID_SIZE)
1575 {
1576 int size = ::WideCharToMultiByte(CP_ACP, 0, lpsz, -1, NULL, 0, NULL, NULL);
1577 char* P = ms_New(char(), ms_GetSecureSize(size, iExSize));
1578 ::WideCharToMultiByte(CP_ACP, 0, lpsz, TNB::ToInt(STRLIB::GetLen(lpsz) + 1), P, size, NULL, NULL);
1579 ms_CalcInfoPointer(P)->lLength = size - 1;
1580 return P;
1581 }
1582
1590 static LPWSTR ms_NewBuf(WCHAR d, LPCSTR lpsz, size_t iExSize = INVALID_SIZE)
1591 {
1592 int size = ::MultiByteToWideChar(CP_ACP, 0, lpsz, -1, NULL, 0);
1593 WCHAR* P = ms_New(WCHAR(), ms_GetSecureSize(size, iExSize));
1594 ::MultiByteToWideChar(CP_ACP, 0, lpsz, TNB::ToInt(STRLIB::GetLen(lpsz) + 1), P, size);
1595 ms_CalcInfoPointer(P)->lLength = size - 1;
1596 return P;
1597 }
1598
1607 static LPWSTR ms_NewBuf(WCHAR d, LPCWSTR lpsz, size_t iExSize = INVALID_SIZE)
1608 {
1609 if ( d == 1 )
1610 {
1611 return NULL;
1612 }
1613 size_t iSize = STRLIB::GetLen(lpsz);
1614 LPWSTR P = ms_New(WCHAR(), ms_GetSecureSize(iSize, iExSize));
1615 MemCopy(P, lpsz, iSize + 1);
1616 ms_CalcInfoPointer(P)->lLength = iSize;
1617 return P;
1618 }
1619
1624 static const TYP* ms_NullStr(void)
1625 {
1626 return static_cast<const TYP*>(gpStrNull);
1627 }
1628
1629 // 小文字化
1630 static void ms_strlwr(LPSTR _p)
1631 {
1632 strlwr(_p);
1633 }
1634
1635 // 小文字化
1636 static void ms_strlwr(LPWSTR _p)
1637 {
1638 wcslwr(_p);
1639 }
1640
1641 // 大文字化
1642 static void ms_strupr(LPSTR _p)
1643 {
1644 strupr(_p);
1645 }
1646
1647 // 大文字化
1648 static void ms_strupr(LPWSTR _p)
1649 {
1650 wcsupr(_p);
1651 }
1652
1653
1654 //--------------------------
1655
1656
1658 void m_InitBuf(void)
1659 {
1660 const TYP* P = static_cast<const TYP*>(gpStrNull);
1661 m_lpBuf = const_cast<TYP*>(P);
1662 }
1663
1668 TInfo* m_GetInfoP(void) const
1669 {
1670 return ms_CalcInfoPointer(m_lpBuf);
1671 }
1672
1677 LONG* m_GetRefP(void) const
1678 {
1679 return &(m_GetInfoP()->lRef);
1680 }
1681
1686 size_t m_GetBufSize(void) const
1687 {
1688 return m_GetInfoP()->lBufSize;
1689 }
1690
1696 void m_SetBuf(TYP* P)
1697 {
1698 Empty();
1699 m_lpBuf = P;
1700 }
1701
1703 void m_Separate(void)
1704 {
1705 if ( *(m_GetRefP()) > 1 )
1706 {
1707 //共有している,複製する必要有り
1708 TYP* P = ms_NewBuf(TYP(), m_lpBuf);
1709 m_SetBuf(P);
1710 }
1711 }
1712
1718 template<typename T>
1719 CStrT& m_AddText(const T* lpText)
1720 {
1721 if ( lpText != NULL && *lpText != 0 )
1722 {
1723 TYP* pNew = ms_NewBuf(TYP(), lpText);
1724 size_t iAddSize = ms_CalcInfoPointer(pNew)->lLength;
1725 size_t iNowSize = GetLength();
1726 if ( *(m_GetRefP()) == 1 && m_GetBufSize() > iAddSize + iNowSize )
1727 {
1728 MemCopy(&m_lpBuf[iNowSize], pNew, iAddSize + 1);
1729 }
1730 else
1731 {
1732 TYP* P = ms_NewBuf(TYP(), m_lpBuf, iAddSize);
1733 MemCopy(&P[iNowSize], pNew, iAddSize + 1);
1734 m_SetBuf(P);
1735 }
1736 m_GetInfoP()->lLength = iAddSize + iNowSize;
1737 ASSERTLIB( STRLIB::GetLen(m_lpBuf) == GetLength() );
1738 ms_Delete(pNew);
1739 }
1740 return *this;
1741 }
1742
1743 TYP* m_lpBuf;
1744};
1745
1746
1747
1759
1760
1761
1772
1773
1774
1786
1787
1788
1796inline CAscii operator+(LPCSTR lpsz, const CAscii& str)
1797{
1798 CAscii s = lpsz;
1799 return s += str;
1800}
1801
1809inline CAscii operator+(const CAscii& str1, const CAscii& str2)
1810{
1811 CAscii s = str1;
1812 return s += str2;
1813}
1814
1822inline CUnicode operator+(LPCWSTR lpsz, const CUnicode& str)
1823{
1824 CUnicode s = lpsz;
1825 return s += str;
1826}
1827
1835inline CUnicode operator+(const CUnicode& str1, const CUnicode& str2)
1836{
1837 CUnicode s = str1;
1838 return s += str2;
1839}
1840
1848inline ISerializer& operator<<(ISerializer& _sr, const char* P)
1849{
1850 TRACE0("Serialize[string(ascii)]\n");
1851 size_t l = STRLIB::GetLen(P);
1852 ASSERTLIB( l >= 0 );
1853 _sr << l << l;
1854 size_t iSize = (l + 1) * sizeof(char);
1855 _sr.AddRaw(iSize, P);
1856 return _sr;
1857}
1858
1867{
1868 const char* P = t;
1869 return operator<<(_sr, P);
1870}
1871
1880inline const IDeserializer& operator>>(const IDeserializer& ds, CAscii& _t)
1881{
1882 TRACE0("Deserialize[string(ascii)]\n");
1883 int l1, l2;
1884 ds >> l1 >> l2;
1885 if ( l1 != l2 )
1886 {
1887 throw CInvalidParamException();
1888 }
1889 l1++;
1890 ds.GetRaw(l1 * sizeof(char), _t.GetBuffer(l1 * sizeof(char)));
1891 _t.ReleaseBuffer();
1892 return ds;
1893}
1894
1902inline ISerializer& operator<<(ISerializer& _sr, const WCHAR* P)
1903{
1904 TRACE0("Serialize[string(unicode)]\n");
1905 size_t l = STRLIB::GetLen(P);
1906 ASSERTLIB( l >= 0 );
1907 _sr << l << l;
1908 size_t iSize = (l + 1) * sizeof(WCHAR);
1909 _sr.AddRaw(iSize, P);
1910 return _sr;
1911}
1912
1921{
1922 const WCHAR* P = t;
1923 return operator<<(_sr, P);
1924}
1925
1934inline const IDeserializer& operator>>(const IDeserializer& ds, CUnicode& _t)
1935{
1936 TRACE0("Deserialize[string(unicode)]\n");
1937 int l1, l2;
1938 ds >> l1 >> l2;
1939 if ( l1 != l2 )
1940 {
1941 throw CInvalidParamException();
1942 }
1943 l1++;
1944 ds.GetRaw(l1 * sizeof(WCHAR), _t.GetBuffer(l1 * sizeof(WCHAR)));
1945 _t.ReleaseBuffer();
1946 return ds;
1947}
1948
1949
1950
1951namespace HASH
1952{
1959 inline DWORD CalcHash(const CAscii& str)
1960 {
1961 return CalcHash(str.GetLength(), str.operator LPCSTR());
1962 }
1963
1970 inline DWORD CalcHash(const CUnicode& str)
1971 {
1972 return CalcHash(str.GetLength() * 2, str.operator LPCWSTR());
1973 }
1974};
1975
1976
1977
1978}; // TNB
1979
1980
1981
1982//T-TestCaseコードカバレッジEnable
1983#pragma comment(user,"T-Coverage Enable")
1984
1985
#define loop(VAR, CNT)
loop構文.
Definition: TnbDef.h:343
シリアライザー関係のヘッダ
文字列操作ライブラリ関係のヘッダ
簡易文字列書式関係のヘッダ
ウィンドウ管理.
HWND GetSafeHwnd(void) const
[取得] ウィンドウハンドル取得.
パラメータ不正例外
Definition: TnbException.h:159
文字列管理テンプレート
Definition: TnbStr.h:74
iterator insert(iterator ite, const TYP &t=TYP())
[反復] 挿入
Definition: TnbStr.h:118
CStrT(void)
コンストラクタ
Definition: TnbStr.h:142
CStrT & TrimLeft(TYP t=' ')
[処理] 先頭から文字をトリム.
Definition: TnbStr.h:968
INT_PTR ReverseFind(TYP t) const
[確認] 検索(後ろから)
Definition: TnbStr.h:575
int CompareByOption(const TYP *lpszSubject, DWORD dwCmpFlags) const
[確認] 文字列比較(比較オプション指定)
Definition: TnbStr.h:697
void FormatV(const TYP *lpszFormat, va_list V)
[代入] 書式付き文字列代入.
Definition: TnbStr.h:349
const_iterator end(void) const
[反復] 最後const_iterator.
Definition: TnbStr.h:96
INT_PTR ReverseFindOneOf(const TYP *lpsz) const
[確認] 検索(後ろから)
Definition: TnbStr.h:621
static CStrT FromWindowText(CWnd *pcWnd)
[代入] WindowText代入.
Definition: TnbStr.h:1309
int Compare(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:658
int Replace(const TYP *lpszOld, TYP tNew)
[処理] 文字置換.
Definition: TnbStr.h:1051
void InsertAt(INDEX index, TYP c)
[挿入] 文字挿入
Definition: TnbStr.h:438
bool IsEmpty(void) const
[確認] 空チェック
Definition: TnbStr.h:528
iterator begin(void)
[反復] 先頭iterator.
Definition: TnbStr.h:103
bool operator>(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:732
DWORD ToDword(INDEX iOffset=0, int iBase=10) const
[取得] 数値(DWORD)へ変換
Definition: TnbStr.h:859
CStrT Left(size_t iSize) const
[作成] 範囲取得.
Definition: TnbStr.h:801
static CStrT FromWindowText(HWND hWnd)
[代入] WindowText代入.
Definition: TnbStr.h:1288
int Replace(const TYP *lpszOld, const TYP *lpszNew)
[処理] 文字置換.
Definition: TnbStr.h:1063
const TYP * ReferBuffer(void) const
[取得] バッファ参照.
Definition: TnbStr.h:380
bool operator!=(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:724
void ReleaseBuffer(void)
[操作] 割り当てたバッファを開放.
Definition: TnbStr.h:954
void push_back(TYP t)
[反復] 最後に追加
Definition: TnbStr.h:135
void Insert(INDEX index, const TYP *lpText)
[挿入] 文字列挿入
Definition: TnbStr.h:406
INT_PTR FindOneOf(const TYP *lpsz, INDEX iFromIndex=0) const
[確認] 検索.
Definition: TnbStr.h:564
size_t GetLength(void) const
[取得] 文字列長
Definition: TnbStr.h:518
static CStrT ToHexString(DWORD value, size_t width)
[設定] DWORD型 HEX 文字列化(0パディング付き).
Definition: TnbStr.h:1191
CStrT & TrimLeft(const TYP *lpsz)
[処理] 先頭から文字をトリム.
Definition: TnbStr.h:979
CStrT & operator=(const char *lpText)
[代入] 代入(ASCII/SJIS用)
Definition: TnbStr.h:240
CStrT(const WCHAR *lpText)
代入コンストラクタ(UNICODE用)
Definition: TnbStr.h:184
CStrT & operator+=(const WCHAR *lpText)
[追加] 追加オペレータ(UNICODE用)
Definition: TnbStr.h:314
int Delete(INDEX index, size_t iLen=1)
[操作] 文字削除.
Definition: TnbStr.h:452
CStrT Right(INT_PTR iSize) const
[作成] 範囲取得.
Definition: TnbStr.h:811
CStrT & operator+=(TYP t)
[追加] 追加オペレータ.
Definition: TnbStr.h:325
static CStrT Fmt(const TYP *lpszFormat,...)
[作成] 書式付き文字列作成
Definition: TnbStr.h:1206
INT_PTR Find(TYP t, INDEX iFromIndex=0) const
[確認] 検索.
Definition: TnbStr.h:540
CStrT & operator+=(const char *lpText)
[追加] 追加オペレータ(ASCII/SJIS用)
Definition: TnbStr.h:304
int Remove(TYP t)
[処理] 文字削除.
Definition: TnbStr.h:1108
CStrT & Trim(const TYP *lpsz)
[処理] 両端から文字をトリム.
Definition: TnbStr.h:1024
bool operator<=(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:756
CStrT & operator=(const CStrT &other)
[代入] コピーオペレータ
Definition: TnbStr.h:221
LONGLONG ToLonglong(INDEX iOffset=0) const
[取得] 数値(LONGLONG)へ変換
Definition: TnbStr.h:889
void DeleteLast(void)
[操作] 最終文字削除.
Definition: TnbStr.h:487
bool operator==(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:716
CStrT & TrimRight(TYP t=' ')
[処理] 末尾から文字をトリム.
Definition: TnbStr.h:990
static CStrT DwordToString(DWORD value)
[設定] DWORD型文字列化.
Definition: TnbStr.h:1174
bool operator<(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:748
bool IsEqual(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:669
TYP GetAt(INDEX index) const
[取得] 一文字取得
Definition: TnbStr.h:504
void MakeUpper(void)
[変換] 大文字化
Definition: TnbStr.h:1135
bool IsEqualNoCase(const TYP *lpszSubject) const
[確認] 文字列比較(大小区別無く比較)
Definition: TnbStr.h:708
void SetAt(INDEX index, TYP t)
[操作] 一文字置き換え
Definition: TnbStr.h:390
CStrT & operator=(const WCHAR *lpText)
[代入] 代入(UNICODE用)
Definition: TnbStr.h:258
double ToDouble(INDEX iOffset=0) const
[取得] 数値(double)へ変換
Definition: TnbStr.h:874
CStrT(const char *lpText)
代入コンストラクタ(ASCII/SJIS用)
Definition: TnbStr.h:168
CStrT & TrimRight(const TYP *lpsz)
[処理] 末尾から文字をトリム.
Definition: TnbStr.h:1001
CStrT & SetFromLeft(const TYP *lpText, size_t iLen)
[代入] 文字数制限代入.
Definition: TnbStr.h:278
int operator-(const TYP *lpszSubject) const
[確認] 文字列比較.
Definition: TnbStr.h:646
CStrT & Trim(TYP t=' ')
[処理] 両端から文字をトリム.
Definition: TnbStr.h:1012
CStrT FindCut(TYP c, CStrT *_pstrRest=NULL) const
[作成] 切り分け
Definition: TnbStr.h:1122
INT_PTR Find(const TYP *lpsz, INDEX iFromIndex=0) const
[確認] 検索.
Definition: TnbStr.h:552
void Empty(void)
[削除] 空化
Definition: TnbStr.h:197
INT_PTR ReverseFind(const TYP *lpsz) const
[確認] 検索(後ろから)
Definition: TnbStr.h:598
const_iterator begin(void) const
[反復] 先頭const_iterator.
Definition: TnbStr.h:89
int Replace(TYP tOld, TYP tNew)
[処理] 文字置換.
Definition: TnbStr.h:1038
CStrT Sandwich(const TYP *lpszBefore, const TYP *lpszAfter) const
[作成] 前後連結.
Definition: TnbStr.h:827
static CStrT Lineup(const TYP *lpsz, int iSize)
[作成] 指定文字を並べた文字列作成
Definition: TnbStr.h:1243
~CStrT(void)
デストラクタ
Definition: TnbStr.h:211
static CStrT IntToString(int value)
[設定] int型文字列化.
Definition: TnbStr.h:1158
void Format(const TYP *lpszFormat,...)
[代入] 書式付き文字列代入.
Definition: TnbStr.h:359
int CompareNoCase(const TYP *lpszSubject) const
[確認] 文字列比較(大小区別無く比較)
Definition: TnbStr.h:678
bool operator>=(const TYP *lpszSubject) const
[確認] 文字列比較
Definition: TnbStr.h:740
static CStrT Lineup(TYP t, size_t length)
[作成] 指定文字を並べた文字列作成
Definition: TnbStr.h:1222
CStrT(const CStrT &str)
コピーコンストラクタ
Definition: TnbStr.h:151
iterator end(void)
[反復] 最後iterator.
Definition: TnbStr.h:110
void MakeLower(void)
[変換] 小文字化
Definition: TnbStr.h:1143
void push_front(TYP t)
[反復] 先頭に挿入
Definition: TnbStr.h:129
CStrT Mid(INDEX iOffset, size_t iSize=INVALID_SIZE) const
[作成] 範囲取得.
Definition: TnbStr.h:766
static CStrT FromIterator(ITE is, ITE ie=ITE(), size_t max=INVALID_SIZE)
[代入] イテレータ代入.
Definition: TnbStr.h:1272
int ToInt(INDEX iOffset=0, int iBase=10) const
[取得] 数値(int)へ変換
Definition: TnbStr.h:842
TYP * GetBuffer(size_t iLength=0)
[操作] 書き込みバッファ要求.
Definition: TnbStr.h:914
static void FormatInt(TYP *_P, int value, size_t width)
[設定] int型文字列化(文字数指定).
static void FormatHex(TYP *_P, DWORD value, size_t width)
[設定] DWORD型 HEX 文字列化(0パディング付き).
static void FormatDword(TYP *_P, DWORD value, size_t width)
[設定] DWORD型文字列化(文字数指定).
インプットイテレータ.
ランダムアクセスイテレータ.
int GetCharSize(char c)
[取得] 文字のサイズ(ASCII/SJIS用)
Definition: TnbStrLib.h:341
int Compare(LPCSTR P1, LPCSTR P2, INT_PTR len=-1, DWORD dwCmpFlags=0)
[比較] 文字列比較(ASCII/SJIS用)
Definition: TnbStrLib.h:135
INT_PTR IndexOf(LPCSTR lpszText, char c, INDEX iFromIndex=0)
[検索] 文字検索(ASCII/SJIS用)
Definition: TnbStrLib.h:184
size_t GetLen(LPCSTR lpsz)
[計算] 文字列長計算(ASCII/SJIS用)
Definition: TnbStrLib.h:44
TNB::CStrT< char > CAscii
ASCII文字列クラス
Definition: TnbStr.h:1758
LONGLONG ToLonglong(LPCSTR lpsz)
[変換] LONGLONG変換(ASCII/SJIS用)
Definition: TnbStrLib.h:445
INT_PTR IndexOneOf(LPCSTR lpszText, LPCSTR lpszMark, INDEX iFromIndex=0)
[検索] 文字セット検索(ASCII/SJIS用)
Definition: TnbStrLib.h:216
TNB::CStrT< WCHAR > CUnicode
UNICODE文字列クラス
Definition: TnbStr.h:1771
DWORD ToDword(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
Definition: TnbStrLib.h:395
CAscii operator+(LPCSTR lpsz, const CAscii &str)
文字列加算(ASCII/SJIS用).
Definition: TnbStr.h:1796
TNB::CStrT< TCHAR > CStr
文字列クラス
Definition: TnbStr.h:1785
int ToInt(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
Definition: TnbStrLib.h:367
double ToDouble(LPCSTR lpsz)
[変換] double変換(ASCII/SJIS用)
Definition: TnbStrLib.h:421
bool IsInRange(INDEX value, size_t size)
[確認] 範囲チェック.
Definition: TnbDef.h:421
ISerializer & operator<<(ISerializer &_sr, const CBitSet &t)
[追加] シリアライズ
Definition: TnbBitSet.h:677
const IDeserializer & operator>>(const IDeserializer &ds, CBitSet &_t)
[取得] デシリアライズ
Definition: TnbBitSet.h:690
DWORD CalcHash(const IConstCollectionT< TYP > &c)
COLLECT [HASH] ハッシュ値計算.
bool VPrintF(LPSTR _pWork, size_t iLen, LPCSTR lpFmt, va_list V)
[作成] 書式付き文字列作成(ASCII/SJIS用)
Definition: TnbDef.h:1080
TNB Library
Definition: TnbDoxyTitle.txt:2
void MemCopy(T *_pDst, const void *pSrc, size_t len)
[複製] メモリコピー
Definition: TnbDef.h:376
デシリアライザーインターフェースクラス.
virtual void GetRaw(size_t size, LPVOID _P) const =0
[取得] 取得.
シリアライザーインターフェースクラス.
virtual void AddRaw(size_t size, LPCVOID P)=0
[追加] 追加.