Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: core/include/fxcrt/fx_basic.h

Issue 1398383002: core/ difference with XFA (for information only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 2015-11-24 version Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fxcodec/fx_codec_def.h ('k') | core/include/fxcrt/fx_ext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fxcrt/fx_basic.h
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index c5bb570fcabd06c4bbf763a68172144850f4a052..710bbcc3c3ac3a62c67690a5f92cd2d7d8a16855 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -130,6 +130,70 @@ class CFX_WideTextBuf : public CFX_BinaryBuf {
CFX_WideStringC GetWideString() const;
};
+#ifdef PDF_ENABLE_XFA
+class CFX_ArchiveSaver {
+ public:
+ CFX_ArchiveSaver() : m_pStream(NULL) {}
+
+ CFX_ArchiveSaver& operator<<(uint8_t i);
+
+ CFX_ArchiveSaver& operator<<(int i);
+
+ CFX_ArchiveSaver& operator<<(FX_DWORD i);
+
+ CFX_ArchiveSaver& operator<<(FX_FLOAT i);
+
+ CFX_ArchiveSaver& operator<<(double i);
+
+ CFX_ArchiveSaver& operator<<(const CFX_ByteStringC& bstr);
+
+ CFX_ArchiveSaver& operator<<(const FX_WCHAR* bstr);
+
+ CFX_ArchiveSaver& operator<<(const CFX_WideString& wstr);
+
+ void Write(const void* pData, FX_STRSIZE dwSize);
+
+ intptr_t GetLength() { return m_SavingBuf.GetSize(); }
+
+ const uint8_t* GetBuffer() { return m_SavingBuf.GetBuffer(); }
+
+ void SetStream(IFX_FileStream* pStream) { m_pStream = pStream; }
+
+ protected:
+ CFX_BinaryBuf m_SavingBuf;
+
+ IFX_FileStream* m_pStream;
+};
+class CFX_ArchiveLoader {
+ public:
+ CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize);
+
+ CFX_ArchiveLoader& operator>>(uint8_t& i);
+
+ CFX_ArchiveLoader& operator>>(int& i);
+
+ CFX_ArchiveLoader& operator>>(FX_DWORD& i);
+
+ CFX_ArchiveLoader& operator>>(FX_FLOAT& i);
+
+ CFX_ArchiveLoader& operator>>(double& i);
+
+ CFX_ArchiveLoader& operator>>(CFX_ByteString& bstr);
+
+ CFX_ArchiveLoader& operator>>(CFX_WideString& wstr);
+
+ FX_BOOL IsEOF();
+
+ FX_BOOL Read(void* pBuf, FX_DWORD dwSize);
+
+ protected:
+ FX_DWORD m_LoadingPos;
+
+ const uint8_t* m_pLoadingBuf;
+
+ FX_DWORD m_LoadingSize;
+};
+#endif
class IFX_BufferArchive {
public:
@@ -374,6 +438,10 @@ typedef CFX_ArrayTemplate<FX_WORD> CFX_WordArray;
typedef CFX_ArrayTemplate<FX_DWORD> CFX_DWordArray;
typedef CFX_ArrayTemplate<void*> CFX_PtrArray;
typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray;
+#ifdef PDF_ENABLE_XFA
+typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray;
+typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array;
+#endif
template <class ObjectClass>
class CFX_ObjectArray : public CFX_BasicArray {
@@ -634,7 +702,46 @@ class CFX_MapPtrToPtr {
CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const;
};
+#ifdef PDF_ENABLE_XFA
+template <class KeyType, class ValueType>
+class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
+ public:
+ CFX_MapPtrTemplate() : CFX_MapPtrToPtr(10) {}
+
+ FX_BOOL Lookup(KeyType key, ValueType& rValue) const {
+ void* pValue = NULL;
+ if (!CFX_MapPtrToPtr::Lookup((void*)(uintptr_t)key, pValue)) {
+ return FALSE;
+ }
+ rValue = (ValueType)(uintptr_t)pValue;
+ return TRUE;
+ }
+
+ ValueType& operator[](KeyType key) {
+ return (ValueType&)CFX_MapPtrToPtr::operator[]((void*)(uintptr_t)key);
+ }
+
+ void SetAt(KeyType key, ValueType newValue) {
+ CFX_MapPtrToPtr::SetAt((void*)(uintptr_t)key, (void*)(uintptr_t)newValue);
+ }
+
+ FX_BOOL RemoveKey(KeyType key) {
+ return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key);
+ }
+#endif
+#ifdef PDF_ENABLE_XFA
+ void GetNextAssoc(FX_POSITION& rNextPosition,
+ KeyType& rKey,
+ ValueType& rValue) const {
+ void* pKey = NULL;
+ void* pValue = NULL;
+ CFX_MapPtrToPtr::GetNextAssoc(rNextPosition, pKey, pValue);
+ rKey = (KeyType)(uintptr_t)pKey;
+ rValue = (ValueType)(uintptr_t)pValue;
+ }
+};
+#endif
class CFX_CMapByteStringToPtr {
public:
CFX_CMapByteStringToPtr();
@@ -1088,6 +1195,15 @@ typedef enum {
} FX_ProgressiveStatus;
#define ProgressiveStatus FX_ProgressiveStatus
#define FX_NAMESPACE_DECLARE(namespace, type) namespace ::type
+#ifdef PDF_ENABLE_XFA
+class IFX_Unknown {
+ public:
+ virtual ~IFX_Unknown() {}
+ virtual FX_DWORD Release() = 0;
+ virtual FX_DWORD AddRef() = 0;
+};
+#define FX_IsOdd(a) ((a)&1)
+#endif
class CFX_Vector_3by1 {
public:
« no previous file with comments | « core/include/fxcodec/fx_codec_def.h ('k') | core/include/fxcrt/fx_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698