Home | History | Annotate | Download | only in javascript
      1 // Copyright 2016 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef FPDFSDK_JAVASCRIPT_JS_KEYVALUE_H_
      8 #define FPDFSDK_JAVASCRIPT_JS_KEYVALUE_H_
      9 
     10 #include <memory>
     11 #include <vector>
     12 
     13 #include "core/fxcrt/fx_basic.h"
     14 
     15 enum class JS_GlobalDataType { NUMBER = 0, BOOLEAN, STRING, OBJECT, NULLOBJ };
     16 
     17 class CJS_KeyValue;
     18 
     19 class CJS_GlobalVariableArray {
     20  public:
     21   CJS_GlobalVariableArray();
     22   ~CJS_GlobalVariableArray();
     23 
     24   void Add(CJS_KeyValue* p);
     25   int Count() const;
     26   CJS_KeyValue* GetAt(int index) const;
     27   void Copy(const CJS_GlobalVariableArray& array);
     28 
     29  private:
     30   std::vector<std::unique_ptr<CJS_KeyValue>> m_Array;
     31 };
     32 
     33 class CJS_KeyValue {
     34  public:
     35   CJS_KeyValue();
     36   ~CJS_KeyValue();
     37 
     38   CFX_ByteString sKey;
     39   JS_GlobalDataType nType;
     40   double dData;
     41   bool bData;
     42   CFX_ByteString sData;
     43   CJS_GlobalVariableArray objData;
     44 };
     45 
     46 #endif  // FPDFSDK_JAVASCRIPT_JS_KEYVALUE_H_
     47