7#ifndef FXJS_CFX_GLOBALDATA_H_
8#define FXJS_CFX_GLOBALDATA_H_
13#include "core/fxcrt/binary_buffer.h"
14#include "core/fxcrt/unowned_ptr.h"
15#include "fxjs/cfx_keyvalue.h"
16#include "third_party/abseil-cpp/absl/types/optional.h"
17#include "third_party/base/containers/span.h"
25 virtual bool StoreBuffer(pdfium::span<
const uint8_t> pBuffer) = 0;
47 std::vector<std::unique_ptr<CFX_KeyValue>> array);
61 explicit CFX_GlobalData(
Delegate* pDelegate);
64 bool LoadGlobalPersistentVariables();
65 bool LoadGlobalPersistentVariablesFromBuffer(pdfium::span<uint8_t> buffer);
66 bool SaveGlobalPersisitentVariables();
67 iterator FindGlobalVariable(
const ByteString& sPropname);
69 size_t m_RefCount = 0;
71 std::vector<std::unique_ptr<Element>> m_arrayGlobalData;
virtual ~Delegate()=default
virtual absl::optional< pdfium::span< uint8_t > > LoadBuffer()=0
virtual bool StoreBuffer(pdfium::span< const uint8_t > pBuffer)=0
virtual void BufferDone()=0
bool SetGlobalVariablePersistent(ByteString propname, bool bPersistent)
Element * GetAt(int index)
void SetGlobalVariableObject(ByteString propname, std::vector< std::unique_ptr< CFX_KeyValue > > array)
void SetGlobalVariableNull(ByteString propname)
void SetGlobalVariableNumber(ByteString propname, double dData)
bool DeleteGlobalVariable(ByteString propname)
static CFX_GlobalData * GetRetainedInstance(Delegate *pDelegate)
void SetGlobalVariableBoolean(ByteString propname, bool bData)
Element * GetGlobalVariable(const ByteString &sPropname)
void SetGlobalVariableString(ByteString propname, const ByteString &sData)
void AppendUint16(uint16_t value)
void AppendSpan(pdfium::span< const uint8_t > span)
pdfium::span< const uint8_t > GetSpan() const
void AppendDouble(double value)
void AppendString(const ByteString &str)
void AppendUint32(uint32_t value)
pdfium::span< uint8_t > GetMutableSpan()