OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_BASIC_H_ | 7 #ifndef _FX_BASIC_H_ |
8 #define _FX_BASIC_H_ | 8 #define _FX_BASIC_H_ |
9 | 9 |
10 #include "fx_memory.h" | 10 #include "fx_memory.h" |
11 #include "fx_stream.h" | 11 #include "fx_stream.h" |
12 #include "fx_string.h" | 12 #include "fx_string.h" |
13 #include "fx_system.h" | 13 #include "fx_system.h" |
14 | 14 |
15 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. | 15 // The FX_ArraySize(arr) macro returns the # of elements in an array arr. |
16 // The expression is a compile-time constant, and therefore can be | 16 // The expression is a compile-time constant, and therefore can be |
17 // used in defining new arrays, for example. If you use FX_ArraySize on | 17 // used in defining new arrays, for example. If you use FX_ArraySize on |
18 // a pointer by mistake, you will get a compile-time error. | 18 // a pointer by mistake, you will get a compile-time error. |
19 // | 19 // |
20 // One caveat is that FX_ArraySize() doesn't accept any array of an | 20 // One caveat is that FX_ArraySize() doesn't accept any array of an |
21 // anonymous type or a type defined inside a function. | 21 // anonymous type or a type defined inside a function. |
22 #define FX_ArraySize(array) (sizeof(ArraySizeHelper(array))) | 22 #define FX_ArraySize(array) (sizeof(ArraySizeHelper(array))) |
23 | 23 |
24 // This template function declaration is used in defining FX_ArraySize. | 24 // This template function declaration is used in defining FX_ArraySize. |
25 // Note that the function doesn't need an implementation, as we only | 25 // Note that the function doesn't need an implementation, as we only |
26 // use its type. | 26 // use its type. |
27 template <typename T, size_t N> | 27 template <typename T, size_t N> |
28 char (&ArraySizeHelper(T (&array)[N]))[N]; | 28 char (&ArraySizeHelper(T (&array)[N]))[N]; |
29 | 29 |
30 class CFX_BinaryBuf : public CFX_Object | 30 class CFX_BinaryBuf |
31 { | 31 { |
32 public: | 32 public: |
33 CFX_BinaryBuf(); | 33 CFX_BinaryBuf(); |
34 CFX_BinaryBuf(FX_STRSIZE size); | 34 CFX_BinaryBuf(FX_STRSIZE size); |
35 | 35 |
36 ~CFX_BinaryBuf(); | 36 ~CFX_BinaryBuf(); |
37 | 37 |
38 void Clear(); | 38 void Clear(); |
39 | 39 |
40 void EstimateSize(FX_STRSIZE size, FX
_STRSIZE alloc_step = 0); | 40 void EstimateSize(FX_STRSIZE size, FX
_STRSIZE alloc_step = 0); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return (FX_LPWSTR)m_pBuffer; | 148 return (FX_LPWSTR)m_pBuffer; |
149 } | 149 } |
150 | 150 |
151 void Delete(int start_index, int coun
t) | 151 void Delete(int start_index, int coun
t) |
152 { | 152 { |
153 CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR), count * sizeof(FX_
WCHAR)); | 153 CFX_BinaryBuf::Delete(start_index * sizeof(FX_WCHAR), count * sizeof(FX_
WCHAR)); |
154 } | 154 } |
155 | 155 |
156 CFX_WideStringC GetWideString() const; | 156 CFX_WideStringC GetWideString() const; |
157 }; | 157 }; |
158 class CFX_ArchiveSaver : public CFX_Object | 158 class CFX_ArchiveSaver |
159 { | 159 { |
160 public: | 160 public: |
161 CFX_ArchiveSaver() : m_pStream(NULL) {} | 161 CFX_ArchiveSaver() : m_pStream(NULL) {} |
162 | 162 |
163 CFX_ArchiveSaver& operator << (FX_BYTE i); | 163 CFX_ArchiveSaver& operator << (FX_BYTE i); |
164 | 164 |
165 CFX_ArchiveSaver& operator << (int i); | 165 CFX_ArchiveSaver& operator << (int i); |
166 | 166 |
167 CFX_ArchiveSaver& operator << (FX_DWORD i); | 167 CFX_ArchiveSaver& operator << (FX_DWORD i); |
168 | 168 |
(...skipping 22 matching lines...) Expand all Loading... |
191 void SetStream(IFX_FileStream* pStrea
m) | 191 void SetStream(IFX_FileStream* pStrea
m) |
192 { | 192 { |
193 m_pStream = pStream; | 193 m_pStream = pStream; |
194 } | 194 } |
195 protected: | 195 protected: |
196 | 196 |
197 CFX_BinaryBuf m_SavingBuf; | 197 CFX_BinaryBuf m_SavingBuf; |
198 | 198 |
199 IFX_FileStream* m_pStream; | 199 IFX_FileStream* m_pStream; |
200 }; | 200 }; |
201 class CFX_ArchiveLoader : public CFX_Object | 201 class CFX_ArchiveLoader |
202 { | 202 { |
203 public: | 203 public: |
204 | 204 |
205 CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); | 205 CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize); |
206 | 206 |
207 CFX_ArchiveLoader& operator >> (FX_BYTE& i); | 207 CFX_ArchiveLoader& operator >> (FX_BYTE& i); |
208 | 208 |
209 CFX_ArchiveLoader& operator >> (int& i); | 209 CFX_ArchiveLoader& operator >> (int& i); |
210 | 210 |
211 CFX_ArchiveLoader& operator >> (FX_DWORD& i); | 211 CFX_ArchiveLoader& operator >> (FX_DWORD& i); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 protected: | 253 protected: |
254 | 254 |
255 virtual FX_BOOL DoWork(const void* pBuf, size_t size) =
0; | 255 virtual FX_BOOL DoWork(const void* pBuf, size_t size) =
0; |
256 | 256 |
257 FX_STRSIZE m_BufSize; | 257 FX_STRSIZE m_BufSize; |
258 | 258 |
259 FX_LPBYTE m_pBuffer; | 259 FX_LPBYTE m_pBuffer; |
260 | 260 |
261 FX_STRSIZE m_Length; | 261 FX_STRSIZE m_Length; |
262 }; | 262 }; |
263 class CFX_FileBufferArchive : public IFX_BufferArchive, public CFX_Object | 263 class CFX_FileBufferArchive : public IFX_BufferArchive |
264 { | 264 { |
265 public: | 265 public: |
266 CFX_FileBufferArchive(FX_STRSIZE size = 32768); | 266 CFX_FileBufferArchive(FX_STRSIZE size = 32768); |
267 ~CFX_FileBufferArchive() override; | 267 ~CFX_FileBufferArchive() override; |
268 virtual void Clear(); | 268 virtual void Clear(); |
269 | 269 |
270 FX_BOOL AttachFile(IFX_StreamWrite *pFil
e, FX_BOOL bTakeover = FALSE); | 270 FX_BOOL AttachFile(IFX_StreamWrite *pFil
e, FX_BOOL bTakeover = FALSE); |
271 | 271 |
272 FX_BOOL AttachFile(FX_LPCWSTR filename); | 272 FX_BOOL AttachFile(FX_LPCWSTR filename); |
273 | 273 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 protected: | 345 protected: |
346 | 346 |
347 CFX_ByteTextBuf m_Buffer; | 347 CFX_ByteTextBuf m_Buffer; |
348 | 348 |
349 FX_DWORD m_UTF16First; | 349 FX_DWORD m_UTF16First; |
350 }; | 350 }; |
351 CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl); | 351 CFX_ByteString FX_UrlEncode(const CFX_WideString& wsUrl); |
352 CFX_WideString FX_UrlDecode(const CFX_ByteString& bsUrl); | 352 CFX_WideString FX_UrlDecode(const CFX_ByteString& bsUrl); |
353 CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI); | 353 CFX_ByteString FX_EncodeURI(const CFX_WideString& wsURI); |
354 CFX_WideString FX_DecodeURI(const CFX_ByteString& bsURI); | 354 CFX_WideString FX_DecodeURI(const CFX_ByteString& bsURI); |
355 class CFX_BasicArray : public CFX_Object | 355 class CFX_BasicArray |
356 { | 356 { |
357 protected: | 357 protected: |
358 CFX_BasicArray(int unit_size); | 358 CFX_BasicArray(int unit_size); |
359 | 359 |
360 ~CFX_BasicArray(); | 360 ~CFX_BasicArray(); |
361 | 361 |
362 FX_BOOL SetSize(int nNewSize); | 362 FX_BOOL SetSize(int nNewSize); |
363 | 363 |
364 FX_BOOL Append(const CFX_BasicArray& src); | 364 FX_BOOL Append(const CFX_BasicArray& src); |
365 | 365 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 void RemoveAll() | 658 void RemoveAll() |
659 { | 659 { |
660 for (int i = 0; i < m_nSize; i ++) { | 660 for (int i = 0; i < m_nSize; i ++) { |
661 ((ObjectClass*)GetDataPtr(i))->~ObjectClass(); | 661 ((ObjectClass*)GetDataPtr(i))->~ObjectClass(); |
662 } | 662 } |
663 CFX_BasicArray::SetSize(0); | 663 CFX_BasicArray::SetSize(0); |
664 } | 664 } |
665 }; | 665 }; |
666 typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray; | 666 typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray; |
667 typedef CFX_ObjectArray<CFX_WideString> CFX_WideStringArray; | 667 typedef CFX_ObjectArray<CFX_WideString> CFX_WideStringArray; |
668 class CFX_BaseSegmentedArray : public CFX_Object | 668 class CFX_BaseSegmentedArray |
669 { | 669 { |
670 public: | 670 public: |
671 CFX_BaseSegmentedArray(int unit_size = 1, int segment_units = 512, int index
_size = 8); | 671 CFX_BaseSegmentedArray(int unit_size = 1, int segment_units = 512, int index
_size = 8); |
672 | 672 |
673 ~CFX_BaseSegmentedArray(); | 673 ~CFX_BaseSegmentedArray(); |
674 | 674 |
675 void SetUnitSize(int unit_size, int segment_units, int index_size = 8
); | 675 void SetUnitSize(int unit_size, int segment_units, int index_size = 8
); |
676 | 676 |
677 void* Add(); | 677 void* Add(); |
678 | 678 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 { | 727 { |
728 *(ElementType*)CFX_BaseSegmentedArray::Add() = data; | 728 *(ElementType*)CFX_BaseSegmentedArray::Add() = data; |
729 } | 729 } |
730 | 730 |
731 ElementType& operator [] (int index) | 731 ElementType& operator [] (int index) |
732 { | 732 { |
733 return *(ElementType*)CFX_BaseSegmentedArray::GetAt(index); | 733 return *(ElementType*)CFX_BaseSegmentedArray::GetAt(index); |
734 } | 734 } |
735 }; | 735 }; |
736 template <class DataType, int FixedSize> | 736 template <class DataType, int FixedSize> |
737 class CFX_FixedBufGrow : public CFX_Object | 737 class CFX_FixedBufGrow |
738 { | 738 { |
739 public: | 739 public: |
740 CFX_FixedBufGrow() : m_pData(NULL) | 740 CFX_FixedBufGrow() : m_pData(NULL) |
741 {} | 741 {} |
742 CFX_FixedBufGrow(int data_size) : m_pData(NULL) | 742 CFX_FixedBufGrow(int data_size) : m_pData(NULL) |
743 { | 743 { |
744 if (data_size > FixedSize) { | 744 if (data_size > FixedSize) { |
745 m_pData = FX_Alloc(DataType, data_size); | 745 m_pData = FX_Alloc(DataType, data_size); |
746 } else { | 746 } else { |
747 FXSYS_memset32(m_Data, 0, sizeof(DataType)*FixedSize); | 747 FXSYS_memset32(m_Data, 0, sizeof(DataType)*FixedSize); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 FXSYS_assert(m_pData != NULL); | 792 FXSYS_assert(m_pData != NULL); |
793 return m_pData[i]; | 793 return m_pData[i]; |
794 } | 794 } |
795 operator DataType*() | 795 operator DataType*() |
796 { | 796 { |
797 return m_pData; | 797 return m_pData; |
798 } | 798 } |
799 private: | 799 private: |
800 DataType* m_pData; | 800 DataType* m_pData; |
801 }; | 801 }; |
802 class CFX_MapPtrToPtr : public CFX_Object | 802 class CFX_MapPtrToPtr |
803 { | 803 { |
804 protected: | 804 protected: |
805 | 805 |
806 struct CAssoc { | 806 struct CAssoc { |
807 | 807 |
808 CAssoc* pNext; | 808 CAssoc* pNext; |
809 | 809 |
810 void* key; | 810 void* key; |
811 | 811 |
812 void* value; | 812 void* value; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 909 |
910 void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rVal
ue) const | 910 void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rVal
ue) const |
911 { | 911 { |
912 void* pKey = NULL; | 912 void* pKey = NULL; |
913 void* pValue = NULL; | 913 void* pValue = NULL; |
914 CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); | 914 CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue); |
915 rKey = (KeyType)(FX_UINTPTR)pKey; | 915 rKey = (KeyType)(FX_UINTPTR)pKey; |
916 rValue = (ValueType)(FX_UINTPTR)pValue; | 916 rValue = (ValueType)(FX_UINTPTR)pValue; |
917 } | 917 } |
918 }; | 918 }; |
919 class CFX_CMapDWordToDWord : public CFX_Object | 919 class CFX_CMapDWordToDWord |
920 { | 920 { |
921 public: | 921 public: |
922 | 922 |
923 FX_BOOL Lookup(FX_DWORD key, FX_DWORD& value) const; | 923 FX_BOOL Lookup(FX_DWORD key, FX_DWORD& value) const; |
924 | 924 |
925 void SetAt(FX_DWORD key, FX_DWORD value); | 925 void SetAt(FX_DWORD key, FX_DWORD value); |
926 | 926 |
927 void EstimateSize(FX_DWORD size, FX_DWORD grow_by); | 927 void EstimateSize(FX_DWORD size, FX_DWORD grow_by); |
928 | 928 |
929 FX_POSITION GetStartPosition() const; | 929 FX_POSITION GetStartPosition() const; |
930 | 930 |
931 void GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX
_DWORD& value) const; | 931 void GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX
_DWORD& value) const; |
932 protected: | 932 protected: |
933 | 933 |
934 CFX_BinaryBuf m_Buffer; | 934 CFX_BinaryBuf m_Buffer; |
935 }; | 935 }; |
936 class CFX_MapByteStringToPtr : public CFX_Object | 936 class CFX_MapByteStringToPtr |
937 { | 937 { |
938 protected: | 938 protected: |
939 | 939 |
940 struct CAssoc { | 940 struct CAssoc { |
941 | 941 |
942 CAssoc* pNext; | 942 CAssoc* pNext; |
943 | 943 |
944 FX_DWORD nHashValue; | 944 FX_DWORD nHashValue; |
945 | 945 |
946 CFX_ByteString key; | 946 CFX_ByteString key; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 | 1006 |
1007 CAssoc* NewAssoc(); | 1007 CAssoc* NewAssoc(); |
1008 | 1008 |
1009 void FreeAssoc(CAssoc* pAssoc); | 1009 void FreeAssoc(CAssoc* pAssoc); |
1010 | 1010 |
1011 CAssoc* GetAssocAt(FX_BSTR key, FX_DWORD& hash) const; | 1011 CAssoc* GetAssocAt(FX_BSTR key, FX_DWORD& hash) const; |
1012 public: | 1012 public: |
1013 | 1013 |
1014 ~CFX_MapByteStringToPtr(); | 1014 ~CFX_MapByteStringToPtr(); |
1015 }; | 1015 }; |
1016 class CFX_CMapByteStringToPtr : public CFX_Object | 1016 class CFX_CMapByteStringToPtr |
1017 { | 1017 { |
1018 public: | 1018 public: |
1019 CFX_CMapByteStringToPtr(); | 1019 CFX_CMapByteStringToPtr(); |
1020 | 1020 |
1021 ~CFX_CMapByteStringToPtr(); | 1021 ~CFX_CMapByteStringToPtr(); |
1022 | 1022 |
1023 void RemoveAll(); | 1023 void RemoveAll(); |
1024 | 1024 |
1025 FX_POSITION GetStartPosition() const; | 1025 FX_POSITION GetStartPosition() const; |
1026 | 1026 |
1027 void GetNextAssoc(FX_POSITION& rNextPosition, CFX_Byt
eString& rKey, void*& rValue) const; | 1027 void GetNextAssoc(FX_POSITION& rNextPosition, CFX_Byt
eString& rKey, void*& rValue) const; |
1028 | 1028 |
1029 FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; | 1029 FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const; |
1030 | 1030 |
1031 FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; | 1031 FX_BOOL Lookup(FX_BSTR key, void*& rValue) const; |
1032 | 1032 |
1033 void SetAt(FX_BSTR key, void* value); | 1033 void SetAt(FX_BSTR key, void* value); |
1034 | 1034 |
1035 void RemoveKey(FX_BSTR key); | 1035 void RemoveKey(FX_BSTR key); |
1036 | 1036 |
1037 int GetCount() const; | 1037 int GetCount() const; |
1038 | 1038 |
1039 void AddValue(FX_BSTR key, void* pValue); | 1039 void AddValue(FX_BSTR key, void* pValue); |
1040 private: | 1040 private: |
1041 | 1041 |
1042 CFX_BaseSegmentedArray m_Buffer; | 1042 CFX_BaseSegmentedArray m_Buffer; |
1043 }; | 1043 }; |
1044 class CFX_PtrList : public CFX_Object | 1044 class CFX_PtrList |
1045 { | 1045 { |
1046 protected: | 1046 protected: |
1047 | 1047 |
1048 struct CNode { | 1048 struct CNode { |
1049 | 1049 |
1050 CNode* pNext; | 1050 CNode* pNext; |
1051 | 1051 |
1052 CNode* pPrev; | 1052 CNode* pPrev; |
1053 | 1053 |
1054 void* data; | 1054 void* data; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 return FALSE; | 1183 return FALSE; |
1184 } | 1184 } |
1185 | 1185 |
1186 FX_BOOL RemovePrivateData(FX_LPVOID modu
le_id); | 1186 FX_BOOL RemovePrivateData(FX_LPVOID modu
le_id); |
1187 protected: | 1187 protected: |
1188 | 1188 |
1189 CFX_ArrayTemplate<FX_PRIVATEDATA> m_DataList; | 1189 CFX_ArrayTemplate<FX_PRIVATEDATA> m_DataList; |
1190 | 1190 |
1191 void AddData(FX_LPVOID module_id, FX_
LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); | 1191 void AddData(FX_LPVOID module_id, FX_
LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct); |
1192 }; | 1192 }; |
1193 class CFX_BitStream : public CFX_Object | 1193 class CFX_BitStream |
1194 { | 1194 { |
1195 public: | 1195 public: |
1196 | 1196 |
1197 void Init(FX_LPCBYTE pData, FX_DWORD dwSize); | 1197 void Init(FX_LPCBYTE pData, FX_DWORD dwSize); |
1198 | 1198 |
1199 | 1199 |
1200 FX_DWORD GetBits(FX_DWORD nBits); | 1200 FX_DWORD GetBits(FX_DWORD nBits); |
1201 | 1201 |
1202 void ByteAlign(); | 1202 void ByteAlign(); |
1203 | 1203 |
(...skipping 12 matching lines...) Expand all Loading... |
1216 m_BitPos = 0; | 1216 m_BitPos = 0; |
1217 } | 1217 } |
1218 protected: | 1218 protected: |
1219 | 1219 |
1220 FX_DWORD m_BitPos; | 1220 FX_DWORD m_BitPos; |
1221 | 1221 |
1222 FX_DWORD m_BitSize; | 1222 FX_DWORD m_BitSize; |
1223 | 1223 |
1224 FX_LPCBYTE m_pData; | 1224 FX_LPCBYTE m_pData; |
1225 }; | 1225 }; |
1226 template <class ObjClass> class CFX_CountRef : public CFX_Object | 1226 template <class ObjClass> class CFX_CountRef |
1227 { | 1227 { |
1228 public: | 1228 public: |
1229 | 1229 |
1230 typedef CFX_CountRef<ObjClass> Ref; | 1230 typedef CFX_CountRef<ObjClass> Ref; |
1231 | 1231 |
1232 class CountedObj : public ObjClass | 1232 class CountedObj : public ObjClass |
1233 { | 1233 { |
1234 public: | 1234 public: |
1235 | 1235 |
1236 CountedObj() {} | 1236 CountedObj() {} |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 protected: | 1366 protected: |
1367 | 1367 |
1368 CountedObj* m_pObject; | 1368 CountedObj* m_pObject; |
1369 }; | 1369 }; |
1370 class IFX_Pause | 1370 class IFX_Pause |
1371 { | 1371 { |
1372 public: | 1372 public: |
1373 virtual ~IFX_Pause() { } | 1373 virtual ~IFX_Pause() { } |
1374 virtual FX_BOOL NeedToPauseNow() = 0; | 1374 virtual FX_BOOL NeedToPauseNow() = 0; |
1375 }; | 1375 }; |
1376 class CFX_DataFilter : public CFX_Object | 1376 class CFX_DataFilter |
1377 { | 1377 { |
1378 public: | 1378 public: |
1379 | 1379 |
1380 virtual ~CFX_DataFilter(); | 1380 virtual ~CFX_DataFilter(); |
1381 | 1381 |
1382 void SetDestFilter(CFX_DataFilter* pFilter); | 1382 void SetDestFilter(CFX_DataFilter* pFilter); |
1383 | 1383 |
1384 FX_BOOL IsEOF() const | 1384 FX_BOOL IsEOF() const |
1385 { | 1385 { |
1386 return m_bEOF; | 1386 return m_bEOF; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 } | 1441 } |
1442 T* operator ->(void) | 1442 T* operator ->(void) |
1443 { | 1443 { |
1444 return m_pObj; | 1444 return m_pObj; |
1445 } | 1445 } |
1446 protected: | 1446 protected: |
1447 T *m_pObj; | 1447 T *m_pObj; |
1448 }; | 1448 }; |
1449 #define FX_DATALIST_LENGTH 1024 | 1449 #define FX_DATALIST_LENGTH 1024 |
1450 template<size_t unit> | 1450 template<size_t unit> |
1451 class CFX_SortListArray : public CFX_Object | 1451 class CFX_SortListArray |
1452 { | 1452 { |
1453 protected: | 1453 protected: |
1454 | 1454 |
1455 struct DataList { | 1455 struct DataList { |
1456 | 1456 |
1457 FX_INT32 start; | 1457 FX_INT32 start; |
1458 | 1458 |
1459 FX_INT32 count; | 1459 FX_INT32 count; |
1460 FX_LPBYTE data; | 1460 FX_LPBYTE data; |
1461 }; | 1461 }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 iStart = iMid + 1; | 1555 iStart = iMid + 1; |
1556 } | 1556 } |
1557 } | 1557 } |
1558 } | 1558 } |
1559 m_DataLists.InsertAt(iFind, list); | 1559 m_DataLists.InsertAt(iFind, list); |
1560 } | 1560 } |
1561 FX_INT32 m_CurList; | 1561 FX_INT32 m_CurList; |
1562 CFX_ArrayTemplate<DataList> m_DataLists; | 1562 CFX_ArrayTemplate<DataList> m_DataLists; |
1563 }; | 1563 }; |
1564 template<typename T1, typename T2> | 1564 template<typename T1, typename T2> |
1565 class CFX_ListArrayTemplate : public CFX_Object | 1565 class CFX_ListArrayTemplate |
1566 { | 1566 { |
1567 public: | 1567 public: |
1568 | 1568 |
1569 void Clear() | 1569 void Clear() |
1570 { | 1570 { |
1571 m_Data.Clear(); | 1571 m_Data.Clear(); |
1572 } | 1572 } |
1573 | 1573 |
1574 void Add(FX_INT32 nStart, FX_INT32 nCount) | 1574 void Add(FX_INT32 nStart, FX_INT32 nCount) |
1575 { | 1575 { |
(...skipping 27 matching lines...) Expand all Loading... |
1603 #define ProgressiveStatus FX_ProgressiveStatus | 1603 #define ProgressiveStatus FX_ProgressiveStatus |
1604 #define FX_NAMESPACE_DECLARE(namespace, type) namespace::type | 1604 #define FX_NAMESPACE_DECLARE(namespace, type) namespace::type |
1605 class IFX_Unknown | 1605 class IFX_Unknown |
1606 { | 1606 { |
1607 public: | 1607 public: |
1608 virtual FX_DWORD Release() = 0; | 1608 virtual FX_DWORD Release() = 0; |
1609 virtual FX_DWORD AddRef() = 0; | 1609 virtual FX_DWORD AddRef() = 0; |
1610 }; | 1610 }; |
1611 #define FX_IsOdd(a) ((a) & 1) | 1611 #define FX_IsOdd(a) ((a) & 1) |
1612 | 1612 |
1613 class CFX_Vector_3by1 : public CFX_Object | 1613 class CFX_Vector_3by1 |
1614 { | 1614 { |
1615 public: | 1615 public: |
1616 | 1616 |
1617 CFX_Vector_3by1() : | 1617 CFX_Vector_3by1() : |
1618 a(0.0f), b(0.0f), c(0.0f) | 1618 a(0.0f), b(0.0f), c(0.0f) |
1619 {} | 1619 {} |
1620 | 1620 |
1621 CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1): | 1621 CFX_Vector_3by1(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1): |
1622 a(a1), b(b1), c(c1) | 1622 a(a1), b(b1), c(c1) |
1623 {} | 1623 {} |
1624 | 1624 |
1625 FX_FLOAT a; | 1625 FX_FLOAT a; |
1626 FX_FLOAT b; | 1626 FX_FLOAT b; |
1627 FX_FLOAT c; | 1627 FX_FLOAT c; |
1628 }; | 1628 }; |
1629 class CFX_Matrix_3by3 : public CFX_Object | 1629 class CFX_Matrix_3by3 |
1630 { | 1630 { |
1631 public: | 1631 public: |
1632 | 1632 |
1633 CFX_Matrix_3by3(): | 1633 CFX_Matrix_3by3(): |
1634 a(0.0f), b(0.0f), c(0.0f), d(0.0f), e(0.0f), f(0.0f), g(0.0f), h(0.0f),
i(0.0f) | 1634 a(0.0f), b(0.0f), c(0.0f), d(0.0f), e(0.0f), f(0.0f), g(0.0f), h(0.0f),
i(0.0f) |
1635 {} | 1635 {} |
1636 | 1636 |
1637 CFX_Matrix_3by3(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1, FX_FLOAT d1, FX_FLOAT
e1, FX_FLOAT f1, FX_FLOAT g1, FX_FLOAT h1, FX_FLOAT i1) : | 1637 CFX_Matrix_3by3(FX_FLOAT a1, FX_FLOAT b1, FX_FLOAT c1, FX_FLOAT d1, FX_FLOAT
e1, FX_FLOAT f1, FX_FLOAT g1, FX_FLOAT h1, FX_FLOAT i1) : |
1638 a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) | 1638 a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) |
1639 {} | 1639 {} |
1640 | 1640 |
1641 CFX_Matrix_3by3 Inverse(); | 1641 CFX_Matrix_3by3 Inverse(); |
1642 | 1642 |
1643 CFX_Matrix_3by3 Multiply(const CFX_Matrix_3by3 &m); | 1643 CFX_Matrix_3by3 Multiply(const CFX_Matrix_3by3 &m); |
1644 | 1644 |
1645 CFX_Vector_3by1 TransformVector(const CFX_Vector_3by1 &v); | 1645 CFX_Vector_3by1 TransformVector(const CFX_Vector_3by1 &v); |
1646 | 1646 |
1647 FX_FLOAT a; | 1647 FX_FLOAT a; |
1648 FX_FLOAT b; | 1648 FX_FLOAT b; |
1649 FX_FLOAT c; | 1649 FX_FLOAT c; |
1650 FX_FLOAT d; | 1650 FX_FLOAT d; |
1651 FX_FLOAT e; | 1651 FX_FLOAT e; |
1652 FX_FLOAT f; | 1652 FX_FLOAT f; |
1653 FX_FLOAT g; | 1653 FX_FLOAT g; |
1654 FX_FLOAT h; | 1654 FX_FLOAT h; |
1655 FX_FLOAT i; | 1655 FX_FLOAT i; |
1656 }; | 1656 }; |
1657 | 1657 |
1658 #endif | 1658 #endif |
OLD | NEW |