fx_basic.h
Go to the documentation of this file.
1 
15 //<<<+++OPENSOURCE
16 //<<<+++OPENSOURCE_LICENSE
17 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT||LIC==GOOGLE
18 
23 //<<<+++OPENSOURCE_MUST_BEGIN
24 #ifndef _FX_BASIC_H_
25 #define _FX_BASIC_H_
26 
27 /* System dependant definitions */
28 #ifndef _FX_SYSTEM_H_
29  #include "fx_system.h"
30 #endif
31 #ifndef _FX_MEMORY_H_
32  #include "fx_memory.h"
33 #endif
34 #ifndef _FX_STRING_H_
35  #include "fx_string.h"
36 #endif
37 #ifndef _FX_STREAM_H_
38  #include "fx_stream.h"
39 #endif
40 //<<<+++OPENSOURCE_MUST_END
41 
42 #ifndef _FX_EXCEPTION_H_
43  #include "fx_exception.h"
44 #endif
45 
46 //*****************************************************************************
47 //* Buffer
48 //*****************************************************************************
52 class CFX_BinaryBuf : public CFX_Object
53 {
54  public:
60  CFX_BinaryBuf(IFX_Allocator* pAllocator = NULL);
61 
68  CFX_BinaryBuf(FX_STRSIZE size, IFX_Allocator* pAllocator = NULL);
69  //<<<+++OPENSOURCE_END
70 
73 
79  void Clear();
80 
90  FX_BOOL EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0);
91 
100  FX_BOOL AppendBlock(const void* pBuf, FX_STRSIZE size);
101 
110  FX_BOOL AppendFill(FX_BYTE byte, FX_STRSIZE count);
111 
119  void AppendString(FX_BSTR str) { AppendBlock(str.GetPtr(), str.GetLength()); }
120 
128  inline void AppendByte(FX_BYTE byte)
129  {
130  if (m_AllocSize <= m_DataSize)
131  ExpandBuf(100);
132  m_pBuffer[m_DataSize++] = byte;
133  }
134 
144  FX_BOOL InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE size);
145 
154  void AttachData(void* pBuf, FX_STRSIZE size);
155 
164  FX_BOOL CopyData(const void* pBuf, FX_STRSIZE size);
175  void TakeOver(CFX_BinaryBuf& other);
176 
185  void Delete(int start_index, int count);
186 
192  FX_LPBYTE GetBuffer() const { return m_pBuffer; }
193 
199  FX_STRSIZE GetSize() const { return m_DataSize; }
200 
207 
215  void GetByteStringL(CFX_ByteStringL &str) const;
216 
222  void DetachBuffer();
223 
226 
227  protected:
228  /* Allocation step. */
229  FX_STRSIZE m_AllocStep;
230  /* The buffer pointer. */
231  FX_LPBYTE m_pBuffer;
232  /* The length in bytes of the buffer. */
233  FX_STRSIZE m_DataSize;
234  /* Allocation size in bytes of the buffer. */
235  FX_STRSIZE m_AllocSize;
236  /*
237  * Increase allocated buffer, not data size.
238  *
239  * @param[in] size The size in bytes to increase.
240  */
241  FX_BOOL ExpandBuf(FX_STRSIZE size);
242 };
243 
248 {
249  public:
256  CFX_ByteTextBuf(IFX_Allocator* pAllocator = NULL) : CFX_BinaryBuf(pAllocator) {}
257 
265  void operator = (FX_BSTR str);
266 
274  void AppendChar(int ch) { AppendByte((FX_BYTE)ch); }
275 
284 
293 
301  CFX_ByteTextBuf& operator << (double f);
302 
311 
320 
326  FX_STRSIZE GetLength() const { return m_DataSize; }
327 };
328 
333 {
334  public:
341  CFX_WideTextBuf(IFX_Allocator* pAllocator = NULL) : CFX_BinaryBuf(pAllocator) {}
342 
350  void operator = (FX_LPCWSTR lpsz);
351 
359  void operator = (FX_WSTR str);
360 
369 
378 
386  CFX_WideTextBuf& operator << (double f);
387 
396 
405 
414 
423 
429  FX_STRSIZE GetLength() const { return m_DataSize/sizeof(FX_WCHAR); }
430 
436  FX_LPWSTR GetBuffer() const { return (FX_LPWSTR)m_pBuffer; }
437 
446  void Delete(int start_index, int count)
447  { CFX_BinaryBuf::Delete(start_index*sizeof(FX_WCHAR), count*sizeof(FX_WCHAR)); }
448 
455 
456  void GetWideStringL(CFX_WideStringL& wideText) const;
457 
458 };
459 
460 //*****************************************************************************
461 //* Archive
462 //*****************************************************************************
470 class CFX_ArchiveSaver : public CFX_Object
471 {
472  public:
479  CFX_ArchiveSaver(IFX_Allocator* pAllocator = NULL) : m_SavingBuf(pAllocator), m_pStream(NULL) {}
480 
489 
498 
507 
515  CFX_ArchiveSaver& operator << (FX_INT64 i);
516 
525 
533  CFX_ArchiveSaver& operator << (double i);
534 
543 
554 
565 
574  void Write(const void* pData, FX_STRSIZE dwSize);
575 
581  FX_INTPTR GetLength() const { return m_SavingBuf.GetSize(); }
582 
588  FX_LPCBYTE GetBuffer() const { return m_SavingBuf.GetBuffer(); }
589 
597  void SetStream(IFX_FileStream* pStream) {m_pStream = pStream;}
598 
599  protected:
600  /* Saving data. */
601  CFX_BinaryBuf m_SavingBuf;
602  /* Stream data. */
603  IFX_FileStream* m_pStream;
604 };
605 
609 class CFX_ArchiveLoader : public CFX_Object
610 {
611  public:
620  CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize);
621 
630 
639 
647  CFX_ArchiveLoader& operator >> (FX_INT64& i);
648 
657 
666 
674  CFX_ArchiveLoader& operator >> (double& i);
675 
684 
693 
699  FX_BOOL IsEOF();
700 
709  FX_BOOL Read(void* pBuf, FX_DWORD dwSize);
710 
711  protected:
712  /* Current loading position. */
713  FX_DWORD m_LoadingPos;
714  /* Loading buffer. */
715  FX_LPCBYTE m_pLoadingBuf;
716  /* The size in bytes of the loading buffer. */
717  FX_DWORD m_LoadingSize;
718 };
719 
724 {
725  public:
733  IFX_BufferArchive(FX_STRSIZE size, IFX_Allocator* pAllocator = NULL);
734  //<<<+++OPENSOURCE_END
735 
739  virtual ~IFX_BufferArchive() {}
740 
746  virtual void Clear();
747 
753  FX_BOOL Flush();
754 
763  FX_INT32 AppendBlock(const void* pBuf, size_t size);
764 
773 
782 
790  FX_INT32 AppendInt64(FX_INT64 i);
791 
800 
801  protected:
802  /*
803  * @brief Do work, it will be called when the text buffer is full.
804  *
805  * @param[in] pBuf A pointer to a binary buffer block.
806  * @param[in] size The size in bytes of the buffer block.
807  *
808  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure.
809  */
810  virtual FX_BOOL DoWork(const void* pBuf, size_t size) = 0;
811 
812  /* Special allocator pointer. NULL to use default allocator. */
813  IFX_Allocator* m_pAllocator;
814 
815  /* The buffer size*/
816  FX_STRSIZE m_BufSize;
817  /* Buffer. */
818  FX_LPBYTE m_pBuffer;
819  /* Current buffer length. */
820  FX_STRSIZE m_Length;
821 };
822 
826 class CFX_FileBufferArchive : public IFX_BufferArchive, public CFX_Object
827 {
828  public:
835  CFX_FileBufferArchive(FX_STRSIZE size = 32768, IFX_Allocator* pAllocator = NULL);
836 
841 
847  virtual void Clear();
848 
854  FX_BOOL Flush();
855 
864  FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover = FALSE);
865 
873  FX_BOOL AttachFile(FX_LPCWSTR filename);
874 
882  FX_BOOL AttachFile(FX_LPCSTR filename);
883 
884  private:
885  /*
886  * Do work, it will be called when the text buffer is full.
887  *
888  * @param[in] pBuf A pointer to a binary buffer block.
889  * @param[in] size The size in bytes of the buffer block.
890  *
891  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure.
892  */
893  virtual FX_BOOL DoWork(const void* pBuf, size_t size);
894 
895  /* The file stream. */
896  IFX_StreamWrite *m_pFile;
897  /* whether take over the file. */
898  FX_BOOL m_bTakeover;
899 };
900 
906 {
917  static CFX_CharMap* GetDefaultMapper(FX_INT32 codepage = 0);
918 
932 
945 
952 };
953 
954 //*****************************************************************************
955 //* UTF-8
956 //*****************************************************************************
961 {
962  public:
970  CFX_UTF8Decoder(IFX_Allocator* pAllocator = NULL) : m_PendingBytes(0),m_PendingChar(0),m_Buffer(pAllocator) { }
971 
977  void Clear();
978 
986  void Input(FX_BYTE byte);
987 
995  void AppendChar(FX_DWORD ch);
996 
1002  void ClearStatus() { m_PendingBytes = 0; }
1003 
1009  CFX_WideStringC GetResult() const { return m_Buffer.GetWideString(); }
1010 
1018  void GetResult(CFX_WideStringL &result) const {m_Buffer.GetWideStringL(result);}
1019 
1020  protected:
1021  /* The decoding status. */
1022  int m_PendingBytes;
1023  /* Cached value. */
1024  FX_DWORD m_PendingChar;
1025  /* The output wide text buffer. */
1026  CFX_WideTextBuf m_Buffer;
1027 };
1028 
1033 {
1034  public:
1040  CFX_UTF8Encoder(IFX_Allocator* pAllocator = NULL) : m_Buffer(pAllocator) { m_UTF16First = 0; }
1041 
1049  void Input(FX_WCHAR unicode);
1050 
1058  void AppendStr(FX_BSTR str) { m_UTF16First = 0; m_Buffer << str; }
1059 
1065  CFX_ByteStringC GetResult() const { return m_Buffer.GetByteString(); }
1066 
1074  void GetResult(CFX_ByteStringL &result) const {m_Buffer.GetByteStringL(result);}
1075 
1076  protected:
1077  /* The output byte text buffer. */
1078  CFX_ByteTextBuf m_Buffer;
1079  /* The encoding status. */
1080  FX_DWORD m_UTF16First;
1081 };
1082 
1091 
1100 
1109 
1118 
1119 //*****************************************************************************
1120 //* Array
1121 //*****************************************************************************
1125 class CFX_BasicArray : public CFX_Object
1126 {
1127  public:
1130 
1131  protected:
1132  /*
1133  * @brief Construct with specified unit size.
1134  *
1135  * @param[in] unit_size The specified unit size. Must be greater than 0 and less than 2^28.
1136  * @param[in] pAllocator Allocator used in this class. <b>NULL</b> means to use default allocator.
1137  * Default value: <b>NULL</b>.
1138  */
1139  CFX_BasicArray(int unit_size, IFX_Allocator* pAllocator = NULL);
1140  //<<<+++OPENSOURCE_END
1141 
1142  /*
1143  * @brief The destructor.
1144  */
1145  ~CFX_BasicArray();
1146 
1147  /*
1148  * @brief The copy constructor.
1149  *
1150  * @param[in] other The other CFX_BasicArray object.
1151  * @param[in] pAllocator An allocator.
1152  */
1153  CFX_BasicArray(const CFX_BasicArray& other, IFX_Allocator* pAllocator = NULL);
1154 
1155  /*
1156  * @brief The assignment operator.
1157  *
1158  * @param[in] other The other CFX_BasicArray object.
1159  *
1160  * @return Reference to current object itself.
1161  */
1162  CFX_BasicArray& operator=(const CFX_BasicArray& other);
1163 
1164  /*
1165  * @brief Change the allocated size and the grow amount.
1166  *
1167  * @param[in] nNewSize The new size in elements expected.
1168  * @param[in] nGrowBy The grow amount in elements expected, nGrowBy can be -1 for the grow amount unchanged.
1169  *
1170  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure (such as parameter or memory error).
1171  */
1172  FX_BOOL SetSize(int nNewSize, int nGrowBy);
1173 
1174  /*
1175  * @brief Append a basic array.
1176  *
1177  * @param[in] src The input basic array. It must have the save unit size as the current array.
1178  *
1179  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure (such as memory error).
1180  */
1181  FX_BOOL Append(const CFX_BasicArray& src);
1182 
1183  /*
1184  * @brief Copy from a basic array.
1185  *
1186  * @param[in] src The input basic array. It must have the save unit size as the current array.
1187  *
1188  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure (such as memory error).
1189  */
1190  FX_BOOL Copy(const CFX_BasicArray& src);
1191 
1192  /*
1193  * @brief Insert spaces at specified position.
1194  *
1195  * @param[in] nIndex Specifies the zero-based index of element in the basic array.
1196  * @param[in] nCount Specifies the count of element to insert.
1197  *
1198  * @return A byte pointer to the inserted space. <b>NULL</b> means error.
1199  */
1200  FX_LPBYTE InsertSpaceAt(int nIndex, int nCount);
1201 
1202  /*
1203  * @brief Remove a number of elements.
1204  *
1205  * @param[in] nIndex Specifies the zero-based index of start element in the basic array to be removed.
1206  * @param[in] nCount Specifies the count of element to remove.
1207  *
1208  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure (such as parameter error).
1209  */
1210  FX_BOOL RemoveAt(int nIndex, int nCount);
1211 
1212  /*
1213  * @brief Insert a basic array at specified position.
1214  *
1215  * @param[in] nStartIndex Specifies the zero-based index of start element to insert at.
1216  * @param[in] pNewArray The input basic array. It must have the save unit size as the current array.
1217  *
1218  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure (such as parameter or memory error).
1219  */
1220  FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray);
1221 
1222  /*
1223  * @brief Get a typeless pointer to an element data.
1224  *
1225  * @param[in] index Specifies the zero-based index of element.
1226  *
1227  * @return A typeless pointer to the element data. <b>NULL</b> means error.
1228  */
1229  const void* GetDataPtr(int index) const;
1230 
1231  protected:
1232  /* The actual array of data */
1233  FX_LPBYTE m_pData;
1234  /* # of elements (upperBound - 1) */
1235  int m_nSize;
1236  /* Max allocated */
1237  int m_nMaxSize;
1238  /* Grow amount. */
1239  int m_nGrowBy;
1240  /* Number of bytes in one unit. */
1241  int m_nUnitSize;
1242 };
1243 
1245 template<class TYPE>
1247 {
1248  public:
1257 
1260 
1263  };
1264 
1270  CFX_ArrayTemplate(IFX_Allocator* pAllocator = NULL) : CFX_BasicArray(sizeof(TYPE), pAllocator) {}
1271  //<<<+++OPENSOURCE_END
1272 
1279  CFX_ArrayTemplate(const CFX_ArrayTemplate& other, IFX_Allocator* pAllocator = NULL) : CFX_BasicArray(other, pAllocator) {}
1280 
1290  void FX_Error(ErrorType error,FX_INT32 badIndex=0) const
1291  {
1292  const char *errorMsg[] = {
1293  "Invalid array size",
1294  "Memory allocation error",
1295  "Invalid index:"
1296  };
1297 
1298  fprintf(stderr, "%s\n", errorMsg[error]);
1299  if(error == indexOutOfRange)
1300  fprintf(stderr, "%i\n", badIndex);
1301  abort();
1302  }
1303 
1309  int GetSize() const { return m_nSize; }
1310 
1316  int GetUpperBound() const { return m_nSize-1; }
1317 
1326  FX_BOOL SetSize(int nNewSize, int nGrowBy = -1)
1327  {
1328  return CFX_BasicArray::SetSize(nNewSize, nGrowBy);
1329  }
1330 
1336  void RemoveAll() { SetSize(0, -1); }
1337 
1345  const TYPE GetAt(int nIndex) const {
1346  if (nIndex < 0 || nIndex >= m_nSize)
1347  //return (const TYPE&)(*(volatile const TYPE*)NULL);
1348  //In order to avoid crash, we input the index.(For reasons unknown)
1349  FX_Error(indexOutOfRange, nIndex);
1350  return ((const TYPE*)m_pData)[nIndex];
1351  }
1352 
1361  FX_BOOL SetAt(int nIndex, TYPE newElement) {
1362  if (nIndex < 0 || nIndex >= m_nSize) return FALSE;
1363  ((TYPE*)m_pData)[nIndex] = newElement;
1364  return TRUE;
1365  }
1366 
1374  TYPE& ElementAt(int nIndex)
1375  {
1376  if (nIndex < 0 || nIndex >= m_nSize)
1377  //return *(TYPE*)NULL;
1378  //In order to avoid crash, we input the index.(For reasons unknown)
1379  FX_Error(indexOutOfRange, nIndex);
1380  return ((TYPE*)m_pData)[nIndex];
1381  }
1382 
1388  const TYPE* GetData() const { return (const TYPE*)m_pData; }
1389 
1395  TYPE* GetData() { return (TYPE*)m_pData; }
1396 
1405  FX_BOOL SetAtGrow(int nIndex, TYPE newElement)
1406  {
1407  if (nIndex < 0) return FALSE;
1408  if (nIndex >= m_nSize)
1409  if (!SetSize(nIndex+1, -1)) return FALSE;
1410  ((TYPE*)m_pData)[nIndex] = newElement;
1411  return TRUE;
1412  }
1413 
1421  FX_BOOL Add(TYPE newElement)
1422  {
1423  if (m_nSize < m_nMaxSize)
1424  m_nSize ++;
1425  else
1426  if (!SetSize(m_nSize+1, -1)) return FALSE;
1427  ((TYPE*)m_pData)[m_nSize-1] = newElement;
1428  return TRUE;
1429  }
1430 
1438  FX_BOOL Append(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Append(src); }
1439 
1447  FX_BOOL Copy(const CFX_ArrayTemplate& src) { return CFX_BasicArray::Copy(src); }
1448 
1456  TYPE* GetDataPtr(int index) { return (TYPE*)CFX_BasicArray::GetDataPtr(index); }
1457 
1463  TYPE* AddSpace() { return (TYPE*)CFX_BasicArray::InsertSpaceAt(m_nSize, 1); }
1464 
1473  TYPE* InsertSpaceAt(int nIndex, int nCount) { return (TYPE*)CFX_BasicArray::InsertSpaceAt(nIndex, nCount); }
1474 
1482  CFX_ArrayTemplate& operator=(const CFX_ArrayTemplate& src) { CFX_BasicArray::operator=(src); return *this; }
1483 
1491  const TYPE operator[](int nIndex) const
1492  {
1493  if (nIndex < 0 || nIndex >= m_nSize)
1494  //Merge from google trunk r2049, author: Johnson, date:2012.12.07
1495  *(volatile char*)0 = '\0';
1496  return ((const TYPE*)m_pData)[nIndex];
1497  }
1498 
1507  TYPE& operator[](int nIndex)
1508  {
1509  if (nIndex < 0 || nIndex >= m_nSize)
1510  //Merge from google trunk r2049, author: Johnson, date:2012.12.07
1511  *(volatile char*)0 = '\0';
1512  return ((TYPE*)m_pData)[nIndex];
1513  }
1514 
1524  FX_BOOL InsertAt(int nIndex, TYPE newElement, int nCount = 1)
1525  {
1526  if (!InsertSpaceAt(nIndex, nCount)) return FALSE;
1527  while (nCount--)
1528  ((TYPE*)m_pData)[nIndex++] = newElement;
1529  return TRUE;
1530  }
1531 
1540  FX_BOOL RemoveAt(int nIndex, int nCount = 1) { return CFX_BasicArray::RemoveAt(nIndex, nCount); }
1541 
1550  FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray* pNewArray) { return CFX_BasicArray::InsertAt(nStartIndex, pNewArray); }
1559  int Find(const TYPE& data, int iStart = 0) const
1560  {
1561  if (iStart < 0) return -1;
1562  for (; iStart < (int)m_nSize; iStart ++)
1563  if (((TYPE*)m_pData)[iStart] == data) return iStart;
1564  return -1;
1565  }
1566 };
1567 
1584 
1593 template <class ObjectClass>
1595 {
1596  public:
1602  CFX_ObjectArray(IFX_Allocator* pAllocator = NULL) : CFX_BasicArray(sizeof(ObjectClass), pAllocator) {}
1603 
1608 
1615  CFX_ObjectArray(const CFX_ObjectArray& other, IFX_Allocator* pAllocator = NULL)
1616  : CFX_BasicArray(sizeof(ObjectClass), pAllocator)
1617  {
1618  Copy(other);
1619  }
1620 
1629  {
1630  Copy(other);
1631  return *this;
1632  }
1633 
1643  void Add(const ObjectClass& data)
1644  {
1645  #ifndef _FX_NOPLACEMENTNEW_
1646  new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data);
1647  #else
1648  ::new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass(data);
1649  #endif
1650 
1651  }
1652 
1660  ObjectClass& Add()
1661  {
1662  #ifndef _FX_NOPLACEMENTNEW_
1663  return *(ObjectClass*) new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass();
1664  #else
1665  return *(ObjectClass*) ::new ((void*)InsertSpaceAt(m_nSize, 1)) ObjectClass();
1666  #endif
1667  }
1668 
1676  void* AddSpace()
1677  {
1678  return InsertSpaceAt(m_nSize, 1);
1679  }
1680 
1691  FX_INT32 Append(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1)
1692  {
1693  if (nCount == 0) return 0;
1694  FX_INT32 nSize = src.GetSize();
1695  if (!nSize) return 0;
1696  FXSYS_assert(nStart > -1 && nStart < nSize);
1697  if (nCount < 0) nCount = nSize;
1698  if (nStart + nCount > nSize) nCount = nSize - nStart;
1699  if (nCount < 1) return 0;
1700  nSize = m_nSize;
1701  InsertSpaceAt(m_nSize, nCount);
1702  ObjectClass* pStartObj = (ObjectClass*)GetDataPtr(nSize);
1703  nSize = nStart + nCount;
1704  for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++)
1705  {
1706  #ifndef _FX_NOPLACEMENTNEW_
1707  new ((void*)pStartObj) ObjectClass(src[i]);
1708  #else
1709  ::new ((void*)pStartObj) ObjectClass(src[i]);
1710  #endif
1711 
1712  }
1713  return nCount;
1714  }
1715 
1726  FX_INT32 Copy(const CFX_ObjectArray& src, FX_INT32 nStart = 0, FX_INT32 nCount = -1)
1727  {
1728  if (this == &src) return 0;
1729  RemoveAll();
1730  if (nCount == 0) return 0;
1731  FX_INT32 nSize = src.GetSize();
1732  if (!nSize) return 0;
1733  FXSYS_assert(nStart > -1 && nStart < nSize);
1734  if (nCount < 0) nCount = nSize;
1735  if (nStart + nCount > nSize) nCount = nSize - nStart;
1736  if (nCount < 1) return 0;
1737  nSize = nStart + nCount;
1738  SetSize(nCount, -1);
1739  ObjectClass* pStartObj = (ObjectClass*)m_pData;
1740  for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++)
1741  {
1742  #ifndef _FX_NOPLACEMENTNEW_
1743  new ((void*)pStartObj) ObjectClass(src[i]);
1744  #else
1745  ::new ((void*)pStartObj) ObjectClass(src[i]);
1746  #endif
1747 
1748  }
1749  return nCount;
1750  }
1751 
1757  int GetSize() const {return m_nSize;}
1758 
1767  ObjectClass& operator[] (int index) const
1768  {
1769  FXSYS_assert(index < m_nSize);
1770  return *(ObjectClass*)CFX_BasicArray::GetDataPtr(index);
1771  }
1772 
1780  ObjectClass* GetDataPtr(int index) const {return (ObjectClass*)CFX_BasicArray::GetDataPtr(index);}
1781 
1789  void RemoveAt(int index)
1790  {
1791  FXSYS_assert(index < m_nSize);
1792  ((ObjectClass*)GetDataPtr(index))->~ObjectClass();
1793  CFX_BasicArray::RemoveAt(index, 1);
1794  }
1795 
1801  void RemoveAll()
1802  {
1803  for (int i = 0; i < m_nSize; i ++)
1804  ((ObjectClass*)GetDataPtr(i))->~ObjectClass();
1805  CFX_BasicArray::SetSize(0, -1);
1806  }
1807 };
1808 
1813 
1817 template <class TYPE>
1818 class CFX_Stack : CFX_Object
1819 {
1820  public:
1823 
1829  FX_BOOL Empty() const
1830  {
1831  return m_Container.GetSize() == 0;
1832  }
1833 
1839  int Size() const
1840  {
1841  return m_Container.GetSize();
1842  }
1843 
1849  TYPE& Top()
1850  {
1851  return m_Container[Size() - 1];
1852  }
1853 
1859  void Pop()
1860  {
1861  m_Container.RemoveAt(Size() - 1);
1862  }
1863 
1871  void Push(const TYPE& val)
1872  {
1873  m_Container.Add(val);
1874  }
1875 
1876  private:
1877  CFX_ArrayTemplate<TYPE> m_Container;
1878 };
1879 
1883 template <>
1884 class CFX_Stack<CFX_ByteString> : CFX_Object
1885 {
1886  public:
1889 
1895  FX_BOOL Empty() const
1896  {
1897  return m_Container.GetSize() == 0;
1898  }
1899 
1905  int Size() const
1906  {
1907  return m_Container.GetSize();
1908  }
1909 
1916  {
1917  return m_Container[Size() - 1];
1918  }
1919 
1925  void Pop()
1926  {
1927  m_Container.RemoveAt(Size() - 1);
1928  }
1929 
1937  void Push(const CFX_ByteString& val)
1938  {
1939  m_Container.Add(val);
1940  }
1941 
1942  private:
1943  CFX_ObjectArray<CFX_ByteString> m_Container;
1944 };
1945 
1949 class CFX_BaseSegmentedArray : public CFX_Object
1950 {
1951  public:
1960  CFX_BaseSegmentedArray(int unit_size = 1, int segment_units = 512, int index_size = 8, IFX_Allocator* pAllocator = NULL);
1961 
1966 
1976  void SetUnitSize(int unit_size, int segment_units, int index_size = 8);
1977 
1983  void* Add();
1984 
1992  void* GetAt(int index) const;
1993 
1999  void RemoveAll();
2000 
2009  void Delete(int index, int count = 1);
2010 
2016  int GetSize() const { return m_DataSize; }
2017 
2023  int GetSegmentSize() const { return m_SegmentSize; }
2024 
2030  int GetUnitSize() const { return m_UnitSize; }
2031 
2040  void* Iterate(FX_BOOL (*callback)(void* param, void* pData), void* param) const;
2041 
2044  private:
2045  /* Unit size */
2046  int m_UnitSize;
2047  /* Count of units in each segment. */
2048  short m_SegmentSize;
2049  /* Number of index level in the array. */
2050  FX_BYTE m_IndexSize;
2051  /* The current level in the index tree. */
2052  FX_BYTE m_IndexDepth;
2053  /* The current number of units in the array. */
2054  int m_DataSize;
2055  /* index to segments or indices, or directly pointing to the segment if only one segment. */
2056  void* m_pIndex;
2057 
2058  void** GetIndex(int seg_index) const;
2059  void* IterateIndex(int level, int& start, void** pIndex, FX_BOOL (*callback)(void* param, void* pData), void* param) const;
2060  void* IterateSegment(FX_LPCBYTE pSegment, int count, FX_BOOL (*callback)(void* param, void* pData), void* param) const;
2061 };
2062 
2066 template <class ElementType>
2068 {
2069  public:
2077  CFX_SegmentedArray(int segment_units, int index_size = 8, IFX_Allocator* pAllocator = NULL)
2078  : CFX_BaseSegmentedArray(sizeof(ElementType), segment_units, index_size, pAllocator)
2079  {}
2080  //<<<+++OPENSOURCE_END
2081 
2089  void Add(ElementType data)
2090  {
2091  *(ElementType*)CFX_BaseSegmentedArray::Add() = data;
2092  }
2093 
2101  ElementType& operator [] (int index)
2102  {
2103  return *(ElementType*)CFX_BaseSegmentedArray::GetAt(index);
2104  }
2105 };
2106 
2110 template <class DataType, int FixedSize>
2111 class CFX_FixedBufGrow : public CFX_Object
2112 {
2113  public:
2121  : m_pAllocator(pAllocator)
2122  , m_pData(NULL)
2123  {FXSYS_memset32(m_Data, 0, sizeof(DataType)*FixedSize);}
2124 
2132  CFX_FixedBufGrow(int data_size, IFX_Allocator* pAllocator = NULL)
2133  : m_pAllocator(pAllocator)
2134  , m_pData(NULL)
2135  {
2136  if (data_size > FixedSize)
2137  m_pData = FX_Allocator_Alloc(m_pAllocator, DataType, data_size);
2138  else
2139  FXSYS_memset32(m_Data, 0, sizeof(DataType)*FixedSize);
2140  }
2141  //<<<+++OPENSOURCE_END
2142 
2150  void SetDataSize(int data_size) {
2151  if (m_pData)
2152  FX_Allocator_Free(m_pAllocator, m_pData);
2153  m_pData = NULL;
2154  if (data_size > FixedSize)
2155  m_pData = FX_Allocator_Alloc(m_pAllocator, DataType, data_size);
2156  else {
2157  FXSYS_memset32(m_Data, 0, sizeof(DataType)*FixedSize);
2158  }
2159  }
2160 
2164  ~CFX_FixedBufGrow() { if (m_pData) FX_Allocator_Free(m_pAllocator, m_pData); }
2165 
2166  operator DataType*() { return m_pData ? m_pData : m_Data; }
2167 
2168  private:
2169  IFX_Allocator* m_pAllocator;
2170 
2171  DataType m_Data[FixedSize];
2172  DataType* m_pData;
2173 };
2174 
2178 template <class DataType>
2180 {
2181  public:
2189  CFX_TempBuf(int size, IFX_Allocator* pAllocator = NULL) : m_pAllocator(pAllocator)
2190  { m_pData = FX_Allocator_Alloc(m_pAllocator, DataType, size); }
2191 
2196  { if (m_pData) FX_Allocator_Free(m_pAllocator, m_pData); }
2197  //<<<+++OPENSOURCE_END
2198 
2199  DataType& operator[](int i) { FXSYS_assert(m_pData != NULL); return m_pData[i]; }
2200  operator DataType*() const { return m_pData; }
2201 
2202  private:
2203  IFX_Allocator* m_pAllocator;
2204 
2205  DataType* m_pData;
2206 };
2207 
2208 //*****************************************************************************
2209 //* Map
2210 //*****************************************************************************
2211 
2215 class CFX_MapPtrToPtr : public CFX_Object
2216 {
2217  protected:
2221  struct CAssoc
2222  {
2226  void* key;
2228  void* value;
2229  };
2230 
2231  public:
2239  CFX_MapPtrToPtr(int nBlockSize = 10, IFX_Allocator* pAllocator = NULL);
2240  //<<<+++OPENSOURCE_END
2241 
2245  ~CFX_MapPtrToPtr();
2246 
2252  int GetCount() const { return m_nCount; }
2253 
2259  FX_BOOL IsEmpty() const { return m_nCount == 0; }
2260 
2269  FX_BOOL Lookup(void* key, void*& rValue) const;
2270 
2278  void* GetValueAt(void* key) const;
2279 
2287  void*& operator[](void* key);
2288 
2297  void SetAt(void* key, void* newValue) { (*this)[key] = newValue; }
2298 
2306  FX_BOOL RemoveKey(void* key);
2307 
2313  void RemoveAll();
2314 
2320  FX_POSITION GetStartPosition() const { return (m_nCount == 0) ? NULL : (FX_POSITION)-1; }
2321 
2334  void GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, void*& rValue) const;
2335 
2341  FX_DWORD GetHashTableSize() const { return m_nHashTableSize; }
2342 
2352  void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE);
2353 
2354  protected:
2355  /* Special allocator pointer. NULL to use default allocator. */
2356  IFX_Allocator* m_pAllocator;
2357 
2358  /* The hash table. */
2359  CAssoc** m_pHashTable;
2360  /* The size of hash table. */
2361  FX_DWORD m_nHashTableSize;
2362  /* The number of key-value pair in the map. */
2363  int m_nCount;
2364  /* The freed association list internal. */
2365  CAssoc* m_pFreeList;
2366  /* The block list internal. */
2367  struct CFX_Plex* m_pBlocks;
2368  /* The size in associations of each block. */
2369  int m_nBlockSize;
2370 
2371  /*
2372  * Routine used to user-provided hash keys.
2373  *
2374  * @note Overwrite-able: special non-virtual (see map implementation for details).
2375  *
2376  * @param[in] key The key used to produce hash key.
2377  * @return A hash value.
2378  */
2379  FX_DWORD HashKey(void* key) const;
2380 
2381  /*
2382  * Allocate a new association.
2383  *
2384  * @return The pointer to the new allocated association.
2385  */
2386  CAssoc* NewAssoc();
2387  /*
2388  * Free an association.
2389  *
2390  * @param[in] pAssoc A pointer to an association.
2391  */
2392  void FreeAssoc(CAssoc* pAssoc);
2393  /*
2394  * @brief Retrieve an association by a key.
2395  *
2396  * @param[in] key The input key.
2397  * @param[out] hash The hash value computed.
2398  *
2399  * @return Current association object.
2400  */
2401  CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const;
2402  /*
2403  * @brief Retrieve current association by position.
2404  *
2405  * @param[in, out] rNextPosition Input a position, and receive the next association position.
2406  *
2407  * @return Current association object.
2408  */
2409  CAssoc* GetCurrentAssoc(FX_POSITION& rNextPosition) const;
2410  /*
2411  * @brief Expand 2 times HashTable Size than before.
2412  *
2413  * @details The MaxHashTableSize is 10000.
2414  *
2415  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure.
2416  */
2417  FX_BOOL ExpandHashTable();
2418 };
2419 
2423 template <class KeyType, class ValueType>
2425 {
2426  public:
2432  CFX_MapPtrTemplate(IFX_Allocator* pAllocator = NULL) : CFX_MapPtrToPtr(10, pAllocator) {}
2433 
2442  FX_BOOL Lookup(KeyType key, ValueType& rValue) const
2443  {
2444  FX_LPVOID pValue = NULL;
2445  if (!CFX_MapPtrToPtr::Lookup((void*)(FX_UINTPTR)key, pValue))
2446  return FALSE;
2447  rValue = (ValueType)(FX_UINTPTR)pValue;
2448  return TRUE;
2449  }
2450 
2458  ValueType& operator[](KeyType key) { return (ValueType&)CFX_MapPtrToPtr::operator []((void*)(FX_UINTPTR)key); }
2459 
2468  void SetAt(KeyType key, ValueType newValue) { CFX_MapPtrToPtr::SetAt((void*)(FX_UINTPTR)key, (void*)(FX_UINTPTR)newValue); }
2469 
2477  FX_BOOL RemoveKey(KeyType key) { return CFX_MapPtrToPtr::RemoveKey((void*)(FX_UINTPTR)key); }
2478 
2488  void GetNextAssoc(FX_POSITION& rNextPosition, KeyType& rKey, ValueType& rValue) const
2489  {
2490  void* pKey = NULL; void* pValue = NULL;
2491  CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue);
2492  rKey = (KeyType)(FX_UINTPTR)pKey; rValue = (ValueType)(FX_UINTPTR)pValue;
2493  }
2494 };
2495 
2500 class CFX_CMapDWordToDWord : public CFX_Object
2501 {
2502  public:
2508  CFX_CMapDWordToDWord(IFX_Allocator* pAllocator = NULL) : m_Buffer(pAllocator) {}
2509 
2518  FX_BOOL Lookup(FX_DWORD key, FX_DWORD& value) const;
2519 
2528  void SetAt(FX_DWORD key, FX_DWORD value);
2529 
2538  void EstimateSize(FX_DWORD size, FX_DWORD grow_by);
2539 
2545  FX_POSITION GetStartPosition() const;
2546 
2556  void GetNextAssoc(FX_POSITION& pos, FX_DWORD& key, FX_DWORD& value) const;
2557 
2563  void RemoveAll() { m_Buffer.Clear(); }
2564 
2565  protected:
2568 };
2569 
2571 class CFX_MapByteStringToPtr : public CFX_Object
2572 {
2573  protected:
2577  struct CAssoc
2578  {
2581 
2587  void* value;
2588  };
2589 
2590  public:
2598  CFX_MapByteStringToPtr(int nBlockSize = 10, IFX_Allocator* pAllocator = NULL);
2599 
2605  int GetCount() const { return m_nCount; }
2606 
2612  FX_BOOL IsEmpty() const { return m_nCount == 0; }
2613 
2622  FX_BOOL Lookup(FX_BSTR key, void*& rValue) const;
2623 
2631  void*& operator[](FX_BSTR key);
2632 
2641  void SetAt(FX_BSTR key, void* newValue) { (*this)[key] = newValue; }
2642 
2650  FX_BOOL RemoveKey(FX_BSTR key);
2651 
2657  void RemoveAll();
2658 
2664  FX_POSITION GetStartPosition() const { return (m_nCount == 0) ? NULL : (FX_POSITION)-1; }
2665 
2675  void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const;
2676 
2684  FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const;
2685 
2691  FX_DWORD GetHashTableSize() const { return m_nHashTableSize; }
2692 
2702  void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE);
2703 
2713  FX_DWORD HashKey(FX_BSTR key) const;
2714 
2715  protected:
2716  /* Special allocator pointer. NULL to use default allocator. */
2717  IFX_Allocator* m_pAllocator;
2718 
2719  /* The hash table. */
2720  CAssoc** m_pHashTable;
2721  /* The size of hash table. */
2722  FX_DWORD m_nHashTableSize;
2723  /* The number of key-value pair in the map. */
2724  int m_nCount;
2725  /* The freed association list internal. */
2726  CAssoc* m_pFreeList;
2727  /* The block list internal. */
2728  struct CFX_Plex* m_pBlocks;
2729  /* The size in associations of each block. */
2730  int m_nBlockSize;
2731 
2732  /*
2733  * @brief Allocate a new association.
2734  *
2735  * @return The pointer to the new allocated association.
2736  */
2737  CAssoc* NewAssoc();
2738  /*
2739  * @brief Free an association.
2740  *
2741  * @param[in] pAssoc A pointer to an association.
2742  *
2743  * @return None.
2744  */
2745  void FreeAssoc(CAssoc* pAssoc);
2746  /*
2747  * @brief Retrieve an association by a key.
2748  *
2749  * @param[in] key The input key.
2750  * @param[out] hash The hash value computed.
2751  *
2752  * @return An association object.
2753  */
2754  CAssoc* GetAssocAt(FX_BSTR key, FX_DWORD& hash) const;
2755  /*
2756  * @brief Retrieve current association by position.
2757  *
2758  * @param[in] rNextPosition The current position.
2759  *
2760  * @return An association object.
2761  */
2762  CAssoc* GetCurrentAssoc(FX_POSITION& rNextPosition) const;
2763  /*
2764  * @brief Expand 2 times HashTable Size than before.
2765  *
2766  * @details The MaxHashTableSize is 10000.
2767  *
2768  * @return <b>TRUE</b> means success, while <b>FALSE</b> means failure.
2769  */
2770  FX_BOOL ExpendHashTable();
2771 
2772  public:
2775 };
2776 
2785 class CFX_CMapByteStringToPtr : public CFX_Object
2786 {
2787  public:
2794  //<<<+++OPENSOURCE_END
2795 
2798 
2804  void RemoveAll();
2805 
2811  FX_POSITION GetStartPosition() const;
2812 
2822  void GetNextAssoc(FX_POSITION& rNextPosition, CFX_ByteString& rKey, void*& rValue) const;
2823 
2831  FX_LPVOID GetNextValue(FX_POSITION& rNextPosition) const;
2832 
2841  FX_BOOL Lookup(FX_BSTR key, void*& rValue) const;
2842 
2851  void SetAt(FX_BSTR key, void* value);
2852 
2860  void RemoveKey(FX_BSTR key);
2861 
2867  int GetCount() const;
2868 
2880  void AddValue(FX_BSTR key, void* pValue);
2881 
2882  protected:
2883  /* A chained buffer storing keys and values. */
2884  CFX_BaseSegmentedArray m_Buffer;
2885 };
2886 
2888 // Lists
2890 
2892 class CFX_PtrList : public CFX_Object
2893 {
2894  protected:
2896  struct CNode
2897  {
2903  void* data;
2904  };
2905 
2906  public:
2913  CFX_PtrList(int nBlockSize = 10, IFX_Allocator* pAllocator = NULL);
2914  //<<<+++OPENSOURCE_END
2915 
2921  FX_POSITION GetHeadPosition() const { return (FX_POSITION)m_pNodeHead; }
2922 
2928  FX_POSITION GetTailPosition() const { return (FX_POSITION)m_pNodeTail; }
2929 
2937  void* GetNext(FX_POSITION& rPosition) const
2938  { CNode* pNode = (CNode*) rPosition; rPosition = (FX_POSITION) pNode->pNext; return pNode->data; }
2939 
2947  void* GetPrev(FX_POSITION& rPosition) const
2948  { CNode* pNode = (CNode*) rPosition; rPosition = (FX_POSITION) pNode->pPrev; return pNode->data; }
2949 
2957  FX_POSITION GetNextPosition(FX_POSITION pos) const { return ((CNode*)pos)->pNext; }
2958 
2966  FX_POSITION GetPrevPosition(FX_POSITION pos) const { return ((CNode*)pos)->pPrev; }
2967 
2975  void* GetAt(FX_POSITION rPosition) const
2976  { CNode* pNode = (CNode*) rPosition; return pNode ? pNode->data : NULL; }
2977 
2983  int GetCount() const { return m_nCount; }
2984 
2992  FX_POSITION AddTail(void* newElement);
2993 
3001  FX_POSITION AddHead(void* newElement);
3002 
3011  void SetAt(FX_POSITION pos, void* newElement)
3012  { CNode* pNode = (CNode*) pos; pNode->data = newElement; }
3013 
3022  FX_POSITION InsertAfter(FX_POSITION pos, void* newElement);
3023 
3032  FX_POSITION Find(void* searchValue, FX_POSITION startAfter = NULL ) const;
3033 
3041  FX_POSITION FindIndex(int index) const;
3042 
3050  void RemoveAt(FX_POSITION pos);
3051 
3057  void RemoveAll();
3058 
3059  protected:
3060  /* Special allocator pointer. <b>NULL</b> means to use default allocator. */
3061  IFX_Allocator* m_pAllocator;
3062 
3063  /* Pointer to the head. */
3064  CNode* m_pNodeHead;
3065  /* Pointer to the tail. */
3066  CNode* m_pNodeTail;
3067  /* The count of nodes in the list. */
3068  int m_nCount;
3069  /* The freed node list internal. */
3070  CNode* m_pNodeFree;
3071  /* The block list internal. */
3072  struct CFX_Plex* m_pBlocks;
3073  /* The size in nodes of each block. */
3074  int m_nBlockSize;
3075 
3076  /*
3077  * Allocate a new node.
3078  *
3079  * @param[in] pPrev The pointer to the previous node.
3080  * @param[in] pNext The pointer to the next node.
3081  *
3082  * @return The pointer to the new node.
3083  */
3084  CNode* NewNode(CNode* pPrev, CNode* pNext);
3085  /*
3086  * Free a node.
3087  *
3088  * @param[in] pNode The node pointer.
3089  */
3090  void FreeNode(CNode* pNode);
3091 
3092  public:
3094  ~CFX_PtrList();
3095 };
3096 
3097 //*****************************************************************************
3098 //* Utilities
3099 //*****************************************************************************
3100 
3104 typedef void (*PD_CALLBACK_FREEDATA)(FX_LPVOID pData);
3105 
3110 {
3116  void FreeData();
3117 
3120 
3123 
3126 
3132 };
3133 
3138 {
3139  public:
3145  CFX_PrivateData(IFX_Allocator* pAllocator = NULL) : m_DataList(pAllocator) {}
3146 
3148  ~CFX_PrivateData();
3149 
3155  void ClearAll();
3156 
3173  void SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback);
3174 
3187  void SetPrivateObj(FX_LPVOID module_id, CFX_DestructObject* pObj);
3188 
3199  FX_LPVOID GetPrivateData(FX_LPVOID module_id);
3200 
3210  {
3211  if (!module_id) return FALSE;
3212  FX_DWORD nCount = m_DataList.GetSize();
3213  for (FX_DWORD n = 0; n < nCount; n ++) {
3214  if (m_DataList[n].m_pModuleId == module_id) {
3215  pData = m_DataList[n].m_pData;
3216  return TRUE;
3217  }
3218  }
3219  return FALSE;
3220  }
3221 
3231  FX_BOOL RemovePrivateData(FX_LPVOID module_id);
3232 
3233  protected:
3234  /* Private data array. */
3236  /*
3237  * Add a private data. Add if not exist, otherwise modify.
3238  *
3239  * @param[in] module_id The module id.
3240  * @param[in] pData The private data.
3241  * @param[in] callback The callback function for deallocating provided private data.
3242  * @param[in] bSelfDestruct Whether the private data is a CFX_DestructObject derived object actually.
3243  *
3244  * @return None.
3245  */
3246  void AddData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct);
3247 };
3248 
3253 class CFX_BitStream : public CFX_Object
3254 {
3255  public:
3264  void Init(FX_LPCBYTE pData, FX_DWORD dwSize);
3265 
3273  FX_DWORD GetBits(FX_DWORD nBits);
3274 
3280  void ByteAlign();
3281 
3287  FX_BOOL IsEOF() const { return m_BitPos >= m_BitSize; }
3288 
3296  void SkipBits(FX_DWORD nBits) { m_BitPos += nBits; }
3297 
3303  void Rewind() { m_BitPos = 0; }
3304 
3305  protected:
3306  /* Bit position (zero-based). */
3307  FX_DWORD m_BitPos;
3308  /* Total bit counts in the memory block. */
3309  FX_DWORD m_BitSize;
3310  /* bit-stream stream buffer. */
3311  FX_LPCBYTE m_pData;
3312 };
3313 
3318 template <class ObjClass> class CFX_CountRef : public CFX_Object
3319 {
3320  public:
3323 
3327  class CountedObj : public ObjClass
3328  {
3329  public:
3332 
3338  CountedObj(const CountedObj& src) : ObjClass(src) ,m_RefCount(0){}
3339 
3342  };
3343 
3348  {
3349  m_pObject = NULL;
3350  }
3351 
3357  CFX_CountRef(const Ref& ref)
3358  {
3359  m_pObject = ref.m_pObject;
3360  if (m_pObject) m_pObject->m_RefCount ++;
3361  }
3362 
3367  {
3368  if (!m_pObject) return;
3369  m_pObject->m_RefCount --;
3370  if (m_pObject->m_RefCount <= 0) {
3371  delete m_pObject;
3372  m_pObject = NULL;
3373  }
3374  }
3375 
3382  ObjClass* New()
3383  {
3384  if (m_pObject) {
3385  m_pObject->m_RefCount --;
3386  if (m_pObject->m_RefCount <= 0)
3387  delete m_pObject;
3388  m_pObject = NULL;
3389  }
3390  m_pObject = FX_NEW CountedObj;
3391  if (!m_pObject) return NULL;
3392  m_pObject->m_RefCount = 1;
3393  return m_pObject;
3394  }
3395 
3403  void operator = (const Ref& ref)
3404  {
3405  if (ref.m_pObject)
3406  ref.m_pObject->m_RefCount ++;
3407  if (m_pObject) {
3408  m_pObject->m_RefCount --;
3409  if (m_pObject->m_RefCount <= 0)
3410  delete m_pObject;
3411  }
3412  m_pObject = ref.m_pObject;
3413  }
3414 
3422  void operator = (void* p)
3423  {
3424  FXSYS_assert(p == 0);
3425  if (m_pObject == NULL) return;
3426  m_pObject->m_RefCount --;
3427  if (m_pObject->m_RefCount <= 0)
3428  delete m_pObject;
3429  m_pObject = NULL;
3430  }
3431 
3432 #if defined(_FX_MANAGED_CODE_) && defined(GetObject)
3433  #undef GetObject
3434 #endif
3435 
3440  const ObjClass* GetObject() const
3441  {
3442  return m_pObject;
3443  }
3449  operator const ObjClass*() const
3450  {
3451  return m_pObject;
3452  }
3453 
3459  FX_BOOL IsNull() const
3460  {
3461  return m_pObject == NULL;
3462  }
3469  {
3470  return m_pObject != NULL;
3471  }
3472 
3481  ObjClass* GetModify()
3482  {
3483  if (m_pObject == NULL) {
3484  m_pObject = FX_NEW CountedObj;
3485  if (m_pObject)
3486  m_pObject->m_RefCount = 1;
3487  } else if (m_pObject->m_RefCount > 1) {
3488  m_pObject->m_RefCount --;
3489  CountedObj* pOldObject = m_pObject;
3490  m_pObject = NULL;
3491  m_pObject = FX_NEW CountedObj(*pOldObject);
3492  if (m_pObject)
3493  m_pObject->m_RefCount = 1;
3494  }
3495  return m_pObject;
3496  }
3497 
3503  void SetNull()
3504  {
3505  if (m_pObject == NULL) return;
3506  m_pObject->m_RefCount --;
3507  if (m_pObject->m_RefCount <= 0)
3508  delete m_pObject;
3509  m_pObject = NULL;
3510  }
3511 
3519  FX_BOOL operator == (const Ref& ref) const
3520  {
3521  return m_pObject == ref.m_pObject;
3522  }
3523 
3529  int RefCount() const
3530  {
3531  return m_pObject ? m_pObject->m_RefCount : 0;
3532  }
3533 
3539  void Incref()
3540  {
3541  if (m_pObject == NULL) return;
3542  m_pObject->m_RefCount++;
3543  }
3544 
3550  void Decref()
3551  {
3552  if (m_pObject == NULL) return;
3553  m_pObject->m_RefCount--;
3554  if (m_pObject->m_RefCount <= 0) {
3555  delete m_pObject;
3556  m_pObject = NULL;
3557  }
3558  }
3559 
3560  protected:
3561  /* Reference counted object internal. */
3562  CountedObj* m_pObject;
3563 };
3564 
3567 {
3568  public:
3570  virtual ~IFX_Pause() {}
3571 
3577  virtual FX_BOOL NeedToPauseNow() = 0;
3578 };
3579 
3581 class CFX_DataFilter : public CFX_Object
3582 {
3583  public:
3587  virtual ~CFX_DataFilter();
3588 
3596  void SetDestFilter(CFX_DataFilter* pFilter);
3597 
3603  FX_BOOL IsEOF() const { return m_bEOF; }
3604 
3610  FX_FILESIZE GetSrcPos() const { return m_SrcPos; }
3611 
3621  void FilterIn(FX_LPCBYTE src_buf, size_t src_size, CFX_BinaryBuf& dest_buf);
3622 
3631  void FilterFinish(CFX_BinaryBuf& dest_buf);
3632 
3638  FX_BOOL IsExhaustBuffer() const { return m_bExhaustBuffer; }
3639 
3645  FX_BOOL NeedNewSrc();
3646 
3652  FX_BOOL Abort() const { return m_bAbort; }
3653 
3659  FX_BOOL AbortAll();
3660 
3666  void ResetStatistics();
3667 
3668  protected:
3669  /* The constructor. */
3670  CFX_DataFilter();
3671 
3672  virtual void v_FilterIn(FX_LPCBYTE src_buf, size_t src_size, CFX_BinaryBuf& dest_buf) = 0;
3673  virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) = 0;
3674  virtual void v_ResetStatistics() {};
3675  void ReportEOF(FX_FILESIZE left_input);
3676 
3677  /* Indicate whether we met the EOF. */
3678  FX_BOOL m_bEOF;
3679  /* Current position in the source stream. */
3680  FX_FILESIZE m_SrcPos;
3681  /* Filter chain. */
3682  CFX_DataFilter* m_pDestFilter;
3683 
3684  /* Indicate whether this filter exhausts the input buffer. */
3685  FX_BOOL m_bExhaustBuffer;
3686  /* Store the output data of the FilterIn function.*/
3687  CFX_BinaryBuf m_FilterInBuffer;
3688 
3689  /* Indicate whether this filter aborts the filter process. For instance, RunLenFilter meets bad input data */
3690  FX_BOOL m_bAbort;
3691 };
3692 
3694 template<typename T>
3696  public:
3702  explicit CFX_AutoRestorer(T* location) {
3703  m_Location = location;
3704  m_OldValue = *location;
3705  }
3706 
3708  ~CFX_AutoRestorer() { *m_Location = m_OldValue; }
3709  private:
3710  T* m_Location;
3711  T m_OldValue;
3712 };
3713 
3715 template <class T>
3717 {
3718  public:
3724  CFX_SmartPointer(T *pObj) : m_pObj(pObj) {}
3725 
3727  ~CFX_SmartPointer() {m_pObj->Release();}
3728 
3734  T* Get(void) {return m_pObj;}
3735 
3741  T& operator *(void) {return *m_pObj;}
3742 
3748  T* operator ->(void) {return m_pObj;}
3749 
3750  protected:
3751  T *m_pObj;
3752 };
3753 
3754 #define FX_DATALIST_LENGTH 1024
3755 
3757 template<size_t unit>
3758 class CFX_SortListArray : public CFX_Object
3759 {
3760  protected:
3762  struct DataList {
3767  FX_LPBYTE data;
3768  DataList()
3769  {
3770  start = count = 0;
3771  data = NULL;
3772  }
3773  };
3774 
3775  public:
3781  CFX_SortListArray(IFX_Allocator* pAllocator = NULL) : m_CurList(0), m_DataLists(pAllocator) {}
3782 
3785  {
3786  Clear();
3787  }
3788 
3794  void Clear()
3795  {
3796  IFX_Allocator* pAllocator = m_DataLists.m_pAllocator;
3797 
3798  for (FX_INT32 i = m_DataLists.GetUpperBound(); i >= 0; i--){
3799  DataList list = m_DataLists.ElementAt(i);
3800  if (list.data) FX_Allocator_Free(pAllocator, list.data);
3801  }
3802  m_DataLists.RemoveAll();
3803  m_CurList = 0;
3804  }
3805 
3814  void Append(FX_INT32 nStart, FX_INT32 nCount)
3815  {
3816  if (nStart < 0) return;
3817 
3818  IFX_Allocator* pAllocator = m_DataLists.m_pAllocator;
3819 
3820  while (nCount > 0){
3821  FX_INT32 temp_count = FX_MIN(nCount, FX_DATALIST_LENGTH);
3822  DataList list;
3823 
3824  list.data = FX_Allocator_Alloc(pAllocator, FX_BYTE, temp_count * unit);
3825  if (!list.data) break;
3826  FXSYS_memset32(list.data, 0, temp_count * unit);
3827  list.start = nStart;
3828  list.count = temp_count;
3829 
3830  FX_BOOL ret = Append(list);
3831  if(ret)
3832  {
3833  nCount -= temp_count;
3834  nStart += temp_count;
3835  }
3836  else
3837  {
3838  if (list.data) FX_Allocator_Free(pAllocator, list.data);
3839  return;
3840  }
3841  }
3842  }
3843 
3852  {
3853  if (nIndex < 0) return NULL;
3854  if (m_CurList < 0 || m_CurList >= m_DataLists.GetSize()) return NULL;
3855  DataList *pCurList = m_DataLists.GetDataPtr(m_CurList);
3856  if (!pCurList || nIndex < pCurList->start || nIndex >= pCurList->start + pCurList->count){
3857  pCurList = NULL;
3858  FX_INT32 iStart = 0;
3859  FX_INT32 iEnd = m_DataLists.GetUpperBound();
3860  while (iStart <= iEnd){
3861  FX_INT32 iMid = (iStart + iEnd) / 2;
3862  DataList* list = m_DataLists.GetDataPtr(iMid);
3863  if (nIndex < list->start)
3864  iEnd = iMid - 1;
3865  else if (nIndex >= list->start + list->count)
3866  iStart = iMid + 1;
3867  else {
3868  pCurList = list;
3869  m_CurList = iMid;
3870  break;
3871  }
3872  }
3873  }
3874  return pCurList ? pCurList->data + (nIndex - pCurList->start) * unit : NULL;
3875  }
3876 
3877  protected:
3878  FX_BOOL Append(const DataList& list)
3879  {
3880  FX_INT32 iStart = 0;
3881  FX_INT32 iEnd = m_DataLists.GetUpperBound();
3882  FX_INT32 iFind = 0;
3883  while (iStart <= iEnd){
3884  FX_INT32 iMid = (iStart + iEnd) / 2;
3885  DataList* cur_list = m_DataLists.GetDataPtr(iMid);
3886  if (list.start == cur_list->start){
3887  return FALSE; // lists overlap, no op
3888  } else if (list.start < cur_list->start + cur_list->count)
3889  iEnd = iMid - 1;
3890  else{
3891  if (iMid == iEnd){
3892  iFind = iMid + 1;
3893  break;
3894  }
3895  DataList* next_list = m_DataLists.GetDataPtr(iMid + 1);
3896  if (list.start == next_list->start){
3897  return FALSE; // lists overlap, no op
3898  } else if (list.start < next_list->start){
3899  iFind = iMid + 1;
3900  break;
3901  } else {
3902  iStart = iMid + 1;
3903  }
3904  }
3905  }
3906  m_DataLists.InsertAt(iFind, list);
3907  return TRUE;
3908  }
3909 
3910  FX_INT32 m_CurList;
3911  CFX_ArrayTemplate<DataList> m_DataLists;
3912 };
3913 
3915 template<typename T1, typename T2>
3916 class CFX_ListArrayTemplate : public CFX_Object
3917 {
3918  public:
3924  void Clear()
3925  {
3926  m_Data.Clear();
3927  }
3928 
3937  void Add(FX_INT32 nStart, FX_INT32 nCount)
3938  {
3939  m_Data.Append(nStart, nCount);
3940  }
3941 
3950  {
3951  FX_LPBYTE data = m_Data.GetAt(nIndex);
3952  FXSYS_assert(data != NULL);
3953 
3954  return (T2&)(*(volatile T2*)data);
3955  }
3956 
3964  T2* GetPtrAt(FX_INT32 nIndex)
3965  {
3966  return (T2*)m_Data.GetAt(nIndex);
3967  }
3968  protected:
3969  T1 m_Data;
3970 };
3971 
3976 
3982 typedef enum {
3996 
3997 #define ProgressiveStatus FX_ProgressiveStatus
3998 
3999 #ifdef _FX_NO_NAMESPACE_
4000 //<<<+++OPENSOURCE_BEGIN LIC==FOXIT
4001 #define FX_NAMESPACE_DECLARE(namespace, type) type
4002 //<<<+++OPENSOURCE_END
4003 #else
4004 //<<<+++OPENSOURCE_BEGIN LIC==GOOGLE
4005 #define FX_NAMESPACE_DECLARE(namespace, type) namespace::type
4006 //<<<+++OPENSOURCE_END
4007 #endif
4008 
4011 {
4012  public:
4018  virtual FX_DWORD Release() = 0;
4019 
4025  virtual FX_DWORD AddRef() = 0;
4026 
4027  protected:
4028  virtual ~IFX_Unknown() {}
4029 };
4030 
4032 #define FX_IsOdd(a) ((a) & 1)
4033 
4034 //<<<+++OPENSOURCE_MUST_END
4035 
4036 //<<<+++OPENSOURCE_MUST_BEGIN
4037 #endif // _FX_BASIC_H_
4038 //<<<+++OPENSOURCE_MUST_END
4039 
4042 //<<<+++OPENSOURCE_END
Definition: fx_basic.h:3581
void GetNextAssoc(FX_POSITION &rNextPosition, CFX_ByteString &rKey, void *&rValue) const
Get the current association and set the position to next association.
void SetAt(FX_BSTR key, void *newValue)
Add a new (key, value) pair. Add if not exist, otherwise modify.
Definition: fx_basic.h:2641
FX_POSITION GetStartPosition() const
Get the first key-value pair position. iterating all (key, value) pairs.
Definition: fx_basic.h:3137
CFX_WideTextBuf & operator<<(int i)
Left shifts(<<) operator overload. Output a integer to the wide text buffer.
CNode * pNext
Pointer to next node.
Definition: fx_basic.h:2899
CFX_WideStringC GetResult() const
Get the result.
Definition: fx_basic.h:1009
void * FX_LPVOID
Pointer to any type.
Definition: fx_system.h:633
void RemoveAll()
Remove all the (key, value) pairs in the map.
Definition: fx_basic.h:52
Definition: fx_basic.h:1949
Definition: fx_basic.h:4010
Ready.
Definition: fx_basic.h:3984
~CFX_MapByteStringToPtr()
The destructor.
void Add(const ObjectClass &data)
Add a copy of an existing object to the array.
Definition: fx_basic.h:1643
Header file for Streams related definitions and classes.
wchar_t FX_WCHAR
Compiler dependant Unicode character (16-bit for Microsoft Compiler, 32-bit for gcc).
Definition: fx_system.h:708
Bidirectional node in CFX_PtrList.
Definition: fx_basic.h:2896
FX_LPVOID m_pModuleId
Module ID.
Definition: fx_basic.h:3119
CFX_ByteStringC GetResult() const
Get the result.
Definition: fx_basic.h:1065
TYPE & operator[](int nIndex)
Subscript([]) operator overload. This function returns a reference to the specified element specified...
Definition: fx_basic.h:1507
unsigned long FX_DWORD
32-bit unsigned integer.
Definition: fx_system.h:698
Definition: fx_basic.h:1032
FX_BOOL RemovePrivateData(FX_LPVOID module_id)
Remove previously stored private data. FPDFAPI assumes the module has deallocated the data,...
FX_BOOL AppendChar(FX_WCHAR wch)
Append a single wide character.
int Size() const
Get size of the container.
Definition: fx_basic.h:1905
FX_BOOL IsEmpty() const
Verify whether the map is empty.
Definition: fx_basic.h:2259
FX_POSITION InsertAfter(FX_POSITION pos, void *newElement)
Insert a value after specified position.
CONSTANT WIDE STRING CLASS.
Definition: fx_string.h:1216
ElementType & operator[](int index)
Subscript([]) operator overload. This function returns a ref to the specified element specified by th...
Definition: fx_basic.h:2101
Not Found.
Definition: fx_basic.h:3990
Association in CFX_MapByteStringToPtr.
Definition: fx_basic.h:2577
IFX_Allocator * m_pAllocator
Special allocator pointer. NULL to use default allocator.
Definition: fx_basic.h:1129
void Incref()
Increase the reference.
Definition: fx_basic.h:3539
void Delete(int index, int count=1)
Delete a number of elements.
Definition: fx_basic.h:1818
~CFX_ObjectArray()
The destructor.
Definition: fx_basic.h:1607
void GetNextAssoc(FX_POSITION &rNextPosition, void *&rKey, void *&rValue) const
Get the current association and set the position to next association.
#define FX_Allocator_Alloc(fxAllocator, type, size)
Release-mode allocation on an allocator.
Definition: fx_memory.h:1050
FX_STRSIZE GetLength() const
Get the length of the byte string.
Definition: fx_string.h:227
CFX_ArrayTemplate< FX_DWORD > CFX_DWordArray
Type definition for a double-word array type.
Definition: fx_basic.h:1573
TYPE & ElementAt(int nIndex)
This method retrieves a ref to an element specified by an index number.
Definition: fx_basic.h:1374
CFX_ObjectArray(const CFX_ObjectArray &other, IFX_Allocator *pAllocator=0)
The copy constructor.
Definition: fx_basic.h:1615
void AddValue(FX_BSTR key, void *pValue)
Add a key-value pair to the dictionary, assuming there is no duplicated key existing.
T2 * GetPtrAt(FX_INT32 nIndex)
Get a point to data.
Definition: fx_basic.h:3964
void Push(const CFX_ByteString &val)
Push the byte string to stack.
Definition: fx_basic.h:1937
CFX_ArrayTemplate< FX_WORD > CFX_WordArray
Type definition for a word array type.
Definition: fx_basic.h:1571
void RemoveAll()
Remove all nodes in the list.
int GetCount() const
Get the number of key-value pairs.
CFX_ByteTextBuf & operator<<(int i)
Left shifts(<<) operator overload. Output an integer to the byte text buffer.
FX_BOOL IsNull() const
Check if the pointer of the object is NULL.
Definition: fx_basic.h:3459
CFX_FixedBufGrow(IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:2120
void * data
Node data.
Definition: fx_basic.h:2903
void SetAt(FX_DWORD key, FX_DWORD value)
Add a new (key, value) pair. Add if not exist, otherwise modify.
static CFX_CharMap * GetDefaultMapper(FX_INT32 codepage=0)
Get a character mapper according to Windows code page or other encoding system. This char maps are ma...
void Init(FX_LPCBYTE pData, FX_DWORD dwSize)
Initialize the bit-stream with a memory block. Must call Init() first.
CFX_ByteString key
Key data.
Definition: fx_basic.h:2585
void SetAt(KeyType key, ValueType newValue)
Add a new (key, value) pair. Add if not exist, otherwise modify.
Definition: fx_basic.h:2468
FX_POSITION GetStartPosition() const
Get the first key-value pair position. iterating all (key, value) pairs.
Definition: fx_basic.h:2664
FX_INT32(* m_GetCodePage)()
A pointer type to GetCodePage function. The function return a code page of the platform.
Definition: fx_basic.h:951
void GetByteStringL(CFX_ByteStringL &str) const
Get a byte string from current buffer object.
CFX_BinaryBuf(IFX_Allocator *pAllocator=0)
A default constructor creating an empty buffer.
void SetAt(void *key, void *newValue)
Add a new (key, value) pair. Add if not exist, otherwise modify.
Definition: fx_basic.h:2297
void(* PD_CALLBACK_FREEDATA)(FX_LPVOID pData)
Definition: fx_basic.h:3104
wchar_t const * FX_LPCWSTR
Pointer to constant Unicode characters.
Definition: fx_system.h:712
CFX_ObjectArray & operator=(const CFX_ObjectArray &other)
The assignment operator.
Definition: fx_basic.h:1628
FX_BOOL m_bSelfDestruct
A boolean value to decide whether it is using self destruct for private data. If this is TRUE,...
Definition: fx_basic.h:3131
void * Add()
Add an element.
#define GetObject
Get object information. GetObjectW defined for unicode-mode, GetObjectA for ansi-mode.
Definition: fx_system.h:541
FX_LPVOID m_pData
Private data.
Definition: fx_basic.h:3122
CFX_WideTextBuf(IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:341
FX_BOOL Flush()
Flush internal buffer of the file.
void FilterFinish(CFX_BinaryBuf &dest_buf)
Indicate the input finished. For some filters, there might be some last output generated.
FX_INT32 start
The start index.
Definition: fx_basic.h:3764
CFX_Stack()
Construct.
Definition: fx_basic.h:1888
~CFX_CountRef()
Destruct a reference and release the object it refers to.
Definition: fx_basic.h:3366
void RemoveAt(int index)
Remove an object at specified position.
Definition: fx_basic.h:1789
int GetSize() const
Get number of elements in the array.
Definition: fx_basic.h:2016
CFX_PtrList(int nBlockSize=10, IFX_Allocator *pAllocator=0)
Construct with block size and allocator.
void Clear()
Clear the decoding status and set the output wide text buffer to be empty.
virtual ~CFX_DataFilter()
The destructor. Destroy this filter and all its chain.
void ByteAlign()
Get to byte boundary. If current bit position is not multiplication of 8, the rest of the current byt...
void SetUnitSize(int unit_size, int segment_units, int index_size=8)
Change the unit size and the segment units. This can only be called when array is empty.
void FilterIn(FX_LPCBYTE src_buf, size_t src_size, CFX_BinaryBuf &dest_buf)
Input a data block to the filter (and its filter chain), and receive the final output.
void ClearAll()
Release all remaining data.
int GetSize() const
Get the number of elements in the array.
Definition: fx_basic.h:1309
FX_BOOL Flush()
Flush internal buffer.
FX_BOOL EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step=0)
Change the allocated buffer size, and set the allocation step if alloc_step is non-zero.
FX_POSITION GetNextPosition(FX_POSITION pos) const
Get the next position.
Definition: fx_basic.h:2957
Definition: fx_basic.h:723
FX_LPVOID GetPrivateData(FX_LPVOID module_id)
Get previously stored private data. Returns NULL for not stored.
FX_INT32 Copy(const CFX_ObjectArray &src, FX_INT32 nStart=0, FX_INT32 nCount=-1)
Copy from an array.
Definition: fx_basic.h:1726
Definition: fx_basic.h:2067
CFX_UTF8Encoder(IFX_Allocator *pAllocator=0)
A constructor. Set the encoder to initial.
Definition: fx_basic.h:1040
void SetStream(IFX_FileStream *pStream)
Set the attached stream.
Definition: fx_basic.h:597
void operator=(FX_LPCWSTR lpsz)
Assignment(=) operator overload. From a zero terminated wide character string.
CFX_TempBuf(int size, IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:2189
#define FX_MIN(a, b)
A macro that returns the minimum of a and b.
Definition: fx_system.h:801
FX_BOOL Abort() const
Indicate whether to abort the filter process.
Definition: fx_basic.h:3652
void GetResult(CFX_ByteStringL &result) const
Get the result.
Definition: fx_basic.h:1074
CFX_CMapDWordToDWord(IFX_Allocator *pAllocator=0)
Constructor with allocator.
Definition: fx_basic.h:2508
int GetUnitSize() const
Get number of bytes for each element.
Definition: fx_basic.h:2030
WIDE STRING CLASS.
Definition: fx_string.h:1463
FX_BOOL AppendFill(FX_BYTE byte, FX_STRSIZE count)
Append a byte for specified number times. Not a byte-by-byte processing, but a byte filling processin...
CFX_ListArrayTemplate< CFX_SortListArray< sizeof(FX_INT64)>, FX_INT64 > CFX_FileSizeListArray
Type definition for file size list array.
Definition: fx_basic.h:3973
CFX_UTF8Decoder(IFX_Allocator *pAllocator=0)
A constructor. Set the decoder to initial.
Definition: fx_basic.h:970
CFX_CountRef< ObjClass > Ref
Type definition: it is used short for CFX_CountRef<ObjClass>.
Definition: fx_basic.h:3322
CFX_ObjectArray(IFX_Allocator *pAllocator=0)
The constructor.
Definition: fx_basic.h:1602
Stream writing interface.
Definition: fx_stream.h:422
CFX_Stack()
Construct.
Definition: fx_basic.h:1822
virtual FX_DWORD AddRef()=0
Increments reference count.
CFX_MapByteStringToPtr(int nBlockSize=10, IFX_Allocator *pAllocator=0)
Construct with specified block size.
void * FX_POSITION
A value used to denote the position of an element in a collection.
Definition: fx_system.h:637
CFX_PrivateData(IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:3145
virtual FX_DWORD Release()=0
Decrements reference count and release the current object.
int GetSegmentSize() const
Get number of elements in each segment.
Definition: fx_basic.h:2023
void Input(FX_WCHAR unicode)
Input a unicode.
FX_INTPTR GetLength() const
Get the length of saved data.
Definition: fx_basic.h:581
Memory allocation error.
Definition: fx_basic.h:1259
FX_LPCBYTE GetBuffer() const
Get the constant byte pointer to the saved data.
Definition: fx_basic.h:588
FX_BOOL Read(void *pBuf, FX_DWORD dwSize)
De-serialize a memory block.
virtual FX_BOOL NeedToPauseNow()=0
Check whether callers need to pause now.
T & operator*(void)
Get the object reference operator.
Definition: fx_basic.h:3741
ObjectClass & operator[](int index) const
Subscript([]) operator overload. This function returns a reference to the specified object specified ...
Definition: fx_basic.h:1767
FX_BOOL Copy(const CFX_ArrayTemplate &src)
Copy from an array.
Definition: fx_basic.h:1447
FX_BOOL SetSize(int nNewSize, int nGrowBy=-1)
Change the allocated size and the grow amount.
Definition: fx_basic.h:1326
FX_LPCBYTE GetPtr() const
Get a constant byte string pointer to the byte string.
Definition: fx_string.h:215
void Clear()
Set the binary buffer to be empty.
void SetPrivateObj(FX_LPVOID module_id, CFX_DestructObject *pObj)
Set private object.
Definition: fx_basic.h:332
FX_DWORD HashKey(FX_BSTR key) const
Routine used to user-provided hash keys.
IFX_Allocator * m_pAllocator
Special allocator pointer. NULL means to use default allocator.
Definition: fx_basic.h:225
int m_RefCount
The reference count.
Definition: fx_basic.h:3341
FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover=0)
Attach file.
Definition: fx_basic.h:3716
CFX_FileBufferArchive(FX_STRSIZE size=32768, IFX_Allocator *pAllocator=0)
A constructor with size and allocator.
Header file for Strings, variable-length sequence of characters. There are two strings here,...
void * value
Value data.
Definition: fx_basic.h:2228
CFX_MapPtrToPtr(int nBlockSize=10, IFX_Allocator *pAllocator=0)
Construct with specified block size.
FX_INT64 GetSrcPos() const
Get current position in the source stream (byte offset from the beginning of all input data).
Definition: fx_basic.h:3610
FX_BOOL Append(const CFX_ArrayTemplate &src)
Append an array.
Definition: fx_basic.h:1438
FX_BOOL RemoveKey(KeyType key)
Remove existing (key, ?) pair.
Definition: fx_basic.h:2477
int FX_INT32
32-bit signed integer.
Definition: fx_system.h:662
FX_BOOL Lookup(KeyType key, ValueType &rValue) const
Lookup by a key.
Definition: fx_basic.h:2442
void * FXSYS_memset32(void *dst, FX_INT32 v, size_t size)
Set buffer data to specified value.
CFX_CountRef()
Construct a null reference.
Definition: fx_basic.h:3347
int FX_STRSIZE
String size is limited to 2^31-1.
Definition: fx_string.h:35
void RemoveAll()
Clean up the array.
Definition: fx_basic.h:1336
FX_POSITION GetHeadPosition() const
Get the header position.
Definition: fx_basic.h:2921
FX_POSITION GetStartPosition() const
Get the first key-value pair position. iterating all (key, value) pairs.
FX_BOOL Add(TYPE newElement)
Add an element at the tail. Potentially growing the array.
Definition: fx_basic.h:1421
CFX_ArrayTemplate< FX_INT32 > CFX_Int32Array
Type definition for INT32 array.
Definition: fx_basic.h:1581
Definition: fx_basic.h:2785
Definition: fx_basic.h:247
FX_BOOL IsEOF()
Check whether de-serializing is to the end of the loading buffer.
CFX_ByteTextBuf(IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:256
T * operator->(void)
Get the object pointer operator.
Definition: fx_basic.h:3748
Association in CFX_MapPtrToPtr.
Definition: fx_basic.h:2221
int GetCount() const
Get the number of elements.
Definition: fx_basic.h:2605
~CFX_PrivateData()
The destructor.
~CFX_BinaryBuf()
The destructor.
void * Iterate(FX_BOOL(*callback)(void *param, void *pData), void *param) const
Iterate all units, with a callback function for each unit.
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:666
ErrorType
Enumeration for error type.
Definition: fx_basic.h:1254
void RemoveAll()
Remove all (key, value) pair.
Definition: fx_basic.h:2563
virtual void Clear()
Clear the text buffer.
~CFX_TempBuf()
The Destructor.
Definition: fx_basic.h:2195
Definition: fx_basic.h:3758
void SetDestFilter(CFX_DataFilter *pFilter)
Set destination filter. Note the filter will be appended to the end of current filter chain.
Definition: fx_basic.h:3916
CFX_ArchiveSaver & operator<<(FX_BYTE i)
Left shifts(<<) operator overload. Serialize a single byte.
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:679
void AppendChar(FX_DWORD ch)
Append characters to wide text buffer.
Definition: fx_basic.h:2892
FX_INT32 Append(const CFX_ObjectArray &src, FX_INT32 nStart=0, FX_INT32 nCount=-1)
Append an array.
Definition: fx_basic.h:1691
FX_INT32 count
The data count.
Definition: fx_basic.h:3766
T * Get(void)
Get the object pointer.
Definition: fx_basic.h:3734
CFX_WideString FX_DecodeURI(const CFX_ByteString &bsURI)
A simple URI Decode.
CFX_WideString(* m_GetWideString)(CFX_CharMap *pMap, const CFX_ByteString &bstr)
A pointer type to GetWideString function.
Definition: fx_basic.h:931
The data list.
Definition: fx_basic.h:3762
void GetNextAssoc(FX_POSITION &rNextPosition, KeyType &rKey, ValueType &rValue) const
Get the current association and set the position to next association.
Definition: fx_basic.h:2488
FX_BOOL IsExhaustBuffer() const
Indicate whether this filter exhausts the input buffer.
Definition: fx_basic.h:3638
FX_LPBYTE GetAt(FX_INT32 nIndex)
Get the data.
Definition: fx_basic.h:3851
File stream interface, reading & writing.
Definition: fx_stream.h:649
FX_BOOL SetAtGrow(int nIndex, TYPE newElement)
Set an element value at specified position. Potentially growing the array.
Definition: fx_basic.h:1405
void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow=1)
Initialize the hash table.
Found.
Definition: fx_basic.h:3988
void AppendStr(FX_BSTR str)
Append a non-buffered byte string.
Definition: fx_basic.h:1058
FX_INT32 AppendBlock(const void *pBuf, size_t size)
Append a binary buffer block.
void GetResult(CFX_WideStringL &result) const
Get the result.
Definition: fx_basic.h:1018
CFX_ArrayTemplate< FX_INT64 > CFX_FileSizeArray
Type definition for file size array type.
Definition: fx_basic.h:1577
UINT_PTR FX_UINTPTR
Unsigned integral type for pointer precision.
Definition: fx_system.h:729
TYPE * InsertSpaceAt(int nIndex, int nCount)
Insert a number of elements.
Definition: fx_basic.h:1473
void RemoveAt(FX_POSITION pos)
Remove a node at specified position.
FX_BOOL RemoveKey(FX_BSTR key)
Remove existing key.
int RefCount() const
Get the reference count.
Definition: fx_basic.h:3529
FX_BOOL RemoveAt(int nIndex, int nCount=1)
Remove a number of elements at specified position.
Definition: fx_basic.h:1540
Definition: fx_basic.h:3566
void Rewind()
Rewind a bit-stream. Simply set the current bit position to be zero.
Definition: fx_basic.h:3303
FX_DWORD GetHashTableSize() const
Get the internal hash table size. Advanced features for derived classes.
Definition: fx_basic.h:2691
CFX_ObjectArray< CFX_WideString > CFX_WideStringArray
Type definition for a CFX_WideString array type.
Definition: fx_basic.h:1812
void *& operator[](void *key)
Subscript([]) operator overload. Lookup and add if not there.
void AttachData(void *pBuf, FX_STRSIZE size)
Attach to a buffer (this buffer will belong to this object). The buffer must be allocated by FX_Alloc...
void operator=(const Ref &ref)
Assignment(=) operator overload. Assign from another reference.
Definition: fx_basic.h:3403
void * GetNext(FX_POSITION &rPosition) const
Get the the current value and set the position to next node.
Definition: fx_basic.h:2937
FX_DWORD nHashValue
Cached hash value, needed for efficient iteration.
Definition: fx_basic.h:2583
void DetachBuffer()
Detach the buffer. Just set buffer pointer to NULL, and set the binary buffer size to zero.
void * GetPrev(FX_POSITION &rPosition) const
Get the the current value and set the position to previous node.
Definition: fx_basic.h:2947
CFX_ArrayTemplate(const CFX_ArrayTemplate &other, IFX_Allocator *pAllocator=0)
The copy constructor.
Definition: fx_basic.h:1279
void * AddSpace()
Add an empty space to the array.
Definition: fx_basic.h:1676
FX_POSITION AddTail(void *newElement)
Add a value to the tail.
void Write(const void *pData, FX_STRSIZE dwSize)
Serialize a memory block.
CFX_SmartPointer(T *pObj)
The constructor.
Definition: fx_basic.h:3724
Definition: fx_basic.h:3318
void ResetStatistics()
Reset statistics.
Definition: fx_basic.h:1246
T2 & operator[](FX_INT32 nIndex)
Subscript([]) operator overload.
Definition: fx_basic.h:3949
const TYPE GetAt(int nIndex) const
This method retrieves an element specified by an index number.
Definition: fx_basic.h:1345
ObjectClass & Add()
Add an empty object to the array.
Definition: fx_basic.h:1660
CFX_ArrayTemplate(IFX_Allocator *pAllocator=0)
Constructor, from an allocator.
Definition: fx_basic.h:1270
unsigned char * FX_LPBYTE
Pointer to a FX_BYTE.
Definition: fx_system.h:646
FX_POSITION Find(void *searchValue, FX_POSITION startAfter=0) const
Find a value starting after specified position.
CFX_ByteString FX_EncodeURI(const CFX_WideString &wsURI)
A simple URI encode.
void Append(FX_INT32 nStart, FX_INT32 nCount)
Append a list data.
Definition: fx_basic.h:3814
void EstimateSize(FX_DWORD size, FX_DWORD grow_by)
Change internal allocation size and grow amount.
CountedObj(const CountedObj &src)
The copy constructor.
Definition: fx_basic.h:3338
FX_BOOL Lookup(FX_DWORD key, FX_DWORD &value) const
Lookup by a key.
FX_BOOL AppendBlock(const void *pBuf, FX_STRSIZE size)
Append a binary buffer block.
const TYPE * GetData() const
Direct Access to the element data (may return NULL).
Definition: fx_basic.h:1388
CFX_ArrayTemplate & operator=(const CFX_ArrayTemplate &src)
Assignment operator overload.
Definition: fx_basic.h:1482
void FreeData()
Free the private data pointed by m_pData.
const TYPE operator[](int nIndex) const
Subscript([]) operator overload. It retrieves a element specified by the zero-based index in nIndex.
Definition: fx_basic.h:1491
CFX_ArrayTemplate< FX_BYTE > CFX_ByteArray
Type definition for a byte array type.
Definition: fx_basic.h:1569
Foxit allocator interface.
Definition: fx_memory.h:960
void AppendChar(int ch)
Append a single character or byte.
Definition: fx_basic.h:274
void SkipBits(FX_DWORD nBits)
Skip a number of bits.
Definition: fx_basic.h:3296
CFX_SegmentedArray(int segment_units, int index_size=8, IFX_Allocator *pAllocator=0)
Construct with specified segment units.
Definition: fx_basic.h:2077
CNode * pPrev
Pointer to previous node.
Definition: fx_basic.h:2901
void Pop()
Pop the byte string from stack.
Definition: fx_basic.h:1925
Definition: fx_basic.h:905
void RemoveAll()
Remove all key-value pairs in the map.
Invalid array size.
Definition: fx_basic.h:1256
FX_STRSIZE GetLength() const
Get the length of the wide text buffer.
Definition: fx_basic.h:429
CFX_ListArrayTemplate< CFX_SortListArray< sizeof(FX_DWORD)>, FX_DWORD > CFX_DWordListArray
Type definition for FX_DWORD list array.
Definition: fx_basic.h:3975
void Add(ElementType data)
Add an element.
Definition: fx_basic.h:2089
float FX_FLOAT
32-bit floating-point number.
Definition: fx_system.h:664
FX_BOOL IsEmpty() const
Verify whether the map is empty.
Definition: fx_basic.h:2612
FX_POSITION FindIndex(int index) const
Find a value by index number.
CFX_CountRef(const Ref &ref)
Copy constructor from another reference.
Definition: fx_basic.h:3357
#define FXSYS_assert
Assertion.
Definition: fx_system.h:779
TYPE * AddSpace()
Add an element's space.
Definition: fx_basic.h:1463
CFX_ArchiveLoader & operator>>(FX_BYTE &i)
Right shifts(>>) operator overload. De-serialize a byte.
CAssoc * pNext
Pointer to next association.
Definition: fx_basic.h:2580
TYPE * GetDataPtr(int index)
Get a pointer to the specified element in the array. Direct pointer access.
Definition: fx_basic.h:1456
FX_INT32 AppendByte(FX_BYTE byte)
Append a single byte.
int GetCount() const
Get the number of elements.
Definition: fx_basic.h:2252
void SetAt(FX_POSITION pos, void *newElement)
Change the value at specified position.
Definition: fx_basic.h:3011
FX_POSITION AddHead(void *newElement)
Add a value to the head.
CFX_ArchiveSaver(IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:479
virtual void Clear()
Clear buffer.
void Delete(int start_index, int count)
Delete a inter-zone buffer defining by parameters start_index and count in the wide text buffer.
Definition: fx_basic.h:446
FX_BOOL SetAt(int nIndex, TYPE newElement)
This method overwrites an element specified by an index number.
Definition: fx_basic.h:1361
int GetSize() const
Get the size of the array.
Definition: fx_basic.h:1757
CFX_ByteString & Top()
Get the top byte string.
Definition: fx_basic.h:1915
FX_BOOL InsertBlock(FX_STRSIZE pos, const void *pBuf, FX_STRSIZE size)
Insert a binary buffer block at the specified position.
void * GetAt(FX_POSITION rPosition) const
Get an value at specified position.
Definition: fx_basic.h:2975
FX_POSITION GetTailPosition() const
Get the tail position.
Definition: fx_basic.h:2928
FX_BOOL Empty() const
Empty the container.
Definition: fx_basic.h:1829
~CFX_AutoRestorer()
The destructor.
Definition: fx_basic.h:3708
~CFX_BaseSegmentedArray()
The destructor.
#define TRUE
Keyword which value is 1.
Definition: fx_system.h:757
CFX_MapPtrTemplate(IFX_Allocator *pAllocator=0)
Default constructor.
Definition: fx_basic.h:2432
Definition: fx_basic.h:960
FX_STRSIZE GetLength() const
Get the length of the byte text buffer.
Definition: fx_basic.h:326
Definition: fx_basic.h:2424
void AppendString(FX_BSTR str)
Append a non-buffered byte string.
Definition: fx_basic.h:119
FX_BOOL Empty() const
Empty the container.
Definition: fx_basic.h:1895
void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow=1)
Initialize the hash table.
Definition: fx_basic.h:3109
Definition: fx_basic.h:2179
FX_LPVOID GetNextValue(FX_POSITION &rNextPosition) const
Get the the current value and set the position to next association.
Definition: fx_basic.h:609
void GetNextAssoc(FX_POSITION &rNextPosition, CFX_ByteString &rKey, void *&rValue) const
Get the current association and set the position to next association.
CFX_SortListArray(IFX_Allocator *pAllocator=0)
The constructor.
Definition: fx_basic.h:3781
CFX_BinaryBuf m_Buffer
Definition: fx_basic.h:2567
Failed.
Definition: fx_basic.h:3992
void * key
Key data.
Definition: fx_basic.h:2226
FX_LPWSTR GetBuffer() const
Get a wide character pointer.
Definition: fx_basic.h:436
~CFX_FixedBufGrow()
The Destructor.
Definition: fx_basic.h:2164
Done.
Definition: fx_basic.h:3994
void FX_Error(ErrorType error, FX_INT32 badIndex=0) const
The function is called when raise a fatal error.Print error info an exit(1).
Definition: fx_basic.h:1290
CFX_FixedBufGrow(int data_size, IFX_Allocator *pAllocator=0)
Construct with allocator.
Definition: fx_basic.h:2132
CONSTANT BYTE STRING CLASS.
Definition: fx_string.h:51
TYPE * GetData()
Direct Access to the element data (may return NULL).
Definition: fx_basic.h:1395
Definition: fx_basic.h:1594
CFX_ObjectArray< CFX_ByteString > CFX_ByteStringArray
Type definition for a CFX_ByteString array type.
Definition: fx_basic.h:1810
FX_BOOL LookupPrivateData(FX_LPVOID module_id, FX_LPVOID &pData) const
Lookup a private data.
Definition: fx_basic.h:3209
~CFX_SmartPointer()
The destructor.
Definition: fx_basic.h:3727
ObjClass * New()
Create a new object and refer to it. The returned pointer to the object can be used to modify the con...
Definition: fx_basic.h:3382
Define a class here derived from user data class, with an additional reference count member.
Definition: fx_basic.h:3327
CFX_ArrayTemplate< FX_FLOAT > CFX_FloatArray
Type definition for float array.
Definition: fx_basic.h:1579
void ClearStatus()
Clear the decoding status.
Definition: fx_basic.h:1002
~CFX_SortListArray()
The destructor.
Definition: fx_basic.h:3784
IFX_BufferArchive(FX_STRSIZE size, IFX_Allocator *pAllocator=0)
Construct with buffer size and special allocator.
FX_DWORD GetHashTableSize() const
Get the internal hash table size. Advanced features for derived classes.
Definition: fx_basic.h:2341
void *& operator[](FX_BSTR key)
Subscript([]) operator overload. Lookup and add if not there.
FX_BOOL NotNull() const
Check if the pointer of the object is not NULL.
Definition: fx_basic.h:3468
TYPE & Top()
Get the top byte data.
Definition: fx_basic.h:1849
FX_BOOL RemoveKey(void *key)
Removing existing (key, ?) pair.
FX_INT32 AppendDWord(FX_DWORD i)
Append a FX_DWORD value.
FX_BOOL Lookup(FX_BSTR key, void *&rValue) const
Lookup by a key.
void SetAt(FX_BSTR key, void *value)
Add a new (key, value) pair. Add if not exist, otherwise modify.
Definition: fx_basic.h:2111
FX_BOOL InsertAt(int nStartIndex, const CFX_BasicArray *pNewArray)
Inset an array at specified position.
Definition: fx_basic.h:1550
~CFX_FileBufferArchive()
The destructor.
void Clear()
Clear data.
Definition: fx_basic.h:3924
void Delete(int start_index, int count)
Delete a inter-zone buffer defining by parameters start_index and count in the binary buffer.
To be continued.
Definition: fx_basic.h:3986
CFX_WideString FX_UrlDecode(const CFX_ByteString &bsUrl)
A simple URL decode.
FX_DWORD GetBits(FX_DWORD nBits)
Get specified number of bits (maximum 32 bits).
ValueType & operator[](KeyType key)
Subscript([]) operator overload. Lookup and add if not there.
Definition: fx_basic.h:2458
BYTE STRING CLASS.
Definition: fx_string.h:317
FX_BOOL Lookup(FX_BSTR key, void *&rValue) const
Lookup by a key.
void SetPrivateData(FX_LPVOID module_id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback)
Set private data.
void operator=(FX_BSTR str)
Assignment(=) operator overload. From a non-buffered byte string.
CFX_CMapByteStringToPtr(IFX_Allocator *pAllocator=0)
The constructor.
void AppendByte(FX_BYTE byte)
Append a single byte.
Definition: fx_basic.h:128
virtual ~IFX_BufferArchive()
The destructor.
Definition: fx_basic.h:739
Definition: fx_basic.h:1125
FX_BOOL CopyData(const void *pBuf, FX_STRSIZE size)
Copy from another buffer.
CFX_AutoRestorer(T *location)
The constructor.
Definition: fx_basic.h:3702
unsigned char const * FX_LPCBYTE
Pointer to a constant FX_BYTE.
Definition: fx_system.h:648
FX_LPBYTE GetBuffer() const
Get a byte pointer to the binary buffer.
Definition: fx_basic.h:192
Header file for Memory management related definitions and classes.
void SetDataSize(int data_size)
Construct with allocator.
Definition: fx_basic.h:2150
FX_BOOL Lookup(void *key, void *&rValue) const
Lookup by a key.
FX_ProgressiveStatus
Enumeration for progressive status.
Definition: fx_basic.h:3982
#define FALSE
Keyword which value is 0.
Definition: fx_system.h:762
void Pop()
Pop the data from stack.
Definition: fx_basic.h:1859
wchar_t * FX_LPWSTR
Pointer to Unicode characters.
Definition: fx_system.h:710
FX_BOOL NeedNewSrc()
Indicate whether this filter needs to input new src data.
FX_BOOL InsertAt(int nIndex, TYPE newElement, int nCount=1)
Inset one or more continuous element at specified position.
Definition: fx_basic.h:1524
Index out of range.
Definition: fx_basic.h:1262
IFX_Allocator * m_pAllocator
Special allocator pointer. NULL means to use default allocator.
Definition: fx_basic.h:2043
FX_BOOL IsEOF() const
Detect EOF.
Definition: fx_basic.h:3603
~CFX_CMapByteStringToPtr()
The destructor.
void TakeOver(CFX_BinaryBuf &other)
Takeover another buffer.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
void * GetValueAt(void *key) const
Get a value pointer by a key.
FX_INT32 AppendInt64(FX_INT64 i)
Append a FX_INT64 value.
int GetUpperBound() const
Get the upper bound in the array, actually the maximum valid index.
Definition: fx_basic.h:1316
void RemoveKey(FX_BSTR key)
Removing existing (key, ?) pair.
Definition: fx_basic.h:2500
Definition: fx_basic.h:2215
FX_BOOL IsEOF() const
Check if reached end of the stream.
Definition: fx_basic.h:3287
CFX_ByteString FX_UrlEncode(const CFX_WideString &wsUrl)
A simple URL encode.
void Push(const TYPE &val)
Push the data to stack.
Definition: fx_basic.h:1871
#define FX_FILESIZE
Support large file directly.
Definition: fx_stream.h:138
FX_POSITION GetStartPosition() const
Get the first key-value pair position. iterating all (key, value) pairs.
Definition: fx_basic.h:2320
Definition: fx_basic.h:2571
void Clear()
Clear the data list.
Definition: fx_basic.h:3794
CountedObj()
The constructor.
Definition: fx_basic.h:3331
void RemoveAll()
Remove all objects in the array.
Definition: fx_basic.h:1801
int GetCount() const
Get the number of nodes.
Definition: fx_basic.h:2983
FX_BOOL AbortAll()
Indicate whether to abort the filter process, including all dest filter.
ObjClass * GetModify()
Get a modifiable copy of the object.
Definition: fx_basic.h:3481
void GetNextAssoc(FX_POSITION &pos, FX_DWORD &key, FX_DWORD &value) const
Get the next association.
void RemoveAll()
Remove all the (key, value) pairs in the map.
int Size() const
Get size of the container.
Definition: fx_basic.h:1839
#define FX_Allocator_Free(fxAllocator, ptr)
Free memory block on an allocator.
Definition: fx_memory.h:1057
FX_POSITION GetPrevPosition(FX_POSITION pos) const
Get the previous position.
Definition: fx_basic.h:2966
CFX_WideStringC GetWideString() const
Get a wide string from the wide text buffer.
~CFX_MapPtrToPtr()
The Destructor.
CFX_ArchiveLoader(FX_LPCBYTE pData, FX_DWORD dwSize)
Construct a loading archive.
PD_CALLBACK_FREEDATA m_pCallback
Pointer of a callback function provided by custom module for deallocating private data.
Definition: fx_basic.h:3125
FX_STRSIZE GetSize() const
Get the length of the binary buffer.
Definition: fx_basic.h:199
CFX_ByteString(* m_GetByteString)(CFX_CharMap *pMap, const CFX_WideString &wstr)
A pointer type to GetByteString function.
Definition: fx_basic.h:944
Definition: fx_basic.h:3253
void SetNull()
Set the pointer of the object to be null.
Definition: fx_basic.h:3503
Definition: fx_basic.h:3695
CFX_ArrayTemplate< FX_WCHAR > CFX_WCHARArray
Type definition for FX_WHAR array.
Definition: fx_basic.h:1583
FX_INT32 AppendString(FX_BSTR lpsz)
Append a byte string value.
FX_BOOL operator==(const Ref &ref) const
Comparison(==) operator overload. Compare with another reference.
Definition: fx_basic.h:3519
ObjectClass * GetDataPtr(int index) const
Get a pointer to the specified element in the array. Direct pointer access.
Definition: fx_basic.h:1780
void * value
Value data.
Definition: fx_basic.h:2587
INT_PTR FX_INTPTR
Signed integral type for pointer precision.
Definition: fx_system.h:727
Header file for exception class.
unsigned char FX_BYTE
Byte (8 bits).
Definition: fx_system.h:644
void * GetAt(int index) const
Get a typeless pointer to an element data.
void RemoveAll()
Remove all elements in the array.
Definition: fx_basic.h:826
void Decref()
Decrease the reference.
Definition: fx_basic.h:3550
virtual ~IFX_Pause()
Destructor.
Definition: fx_basic.h:3570
CFX_ArrayTemplate< void * > CFX_PtrArray
Type definition for: a typeless pointer array type.
Definition: fx_basic.h:1575
Definition: fx_basic.h:470
CFX_BaseSegmentedArray(int unit_size=1, int segment_units=512, int index_size=8, IFX_Allocator *pAllocator=0)
Construct with specified unit size, segment units, and number of index levels.
int Find(const TYPE &data, int iStart=0) const
Find an element from specified position to last.
Definition: fx_basic.h:1559
void Input(FX_BYTE byte)
Input a byte.
Header file for system related definitions.
FX_LPVOID GetNextValue(FX_POSITION &rNextPosition) const
Get the the current value and set the position to next association.
CFX_ByteStringC GetByteString() const
Get a byte string from the buffer.
void Add(FX_INT32 nStart, FX_INT32 nCount)
Add a list data.
Definition: fx_basic.h:3937
CAssoc * pNext
Pointer to next association.
Definition: fx_basic.h:2224

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.