blob: 61f14d0f67ffa23289fd3a2759dcd3569858499c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#ifndef QPDF_ARRAY_HH
#define QPDF_ARRAY_HH
#include <qpdf/QPDFValue.hh>
#include <qpdf/SparseOHArray.hh>
#include <vector>
class QPDF_Array: public QPDFValue
{
public:
virtual ~QPDF_Array() = default;
static std::shared_ptr<QPDFObject>
create(std::vector<QPDFObjectHandle> const& items);
static std::shared_ptr<QPDFObject>
create(std::vector<std::shared_ptr<QPDFObject>>&& items, bool sparse);
static std::shared_ptr<QPDFObject> create(SparseOHArray const& items);
static std::shared_ptr<QPDFObject>
create(std::vector<std::shared_ptr<QPDFObject>> const& items);
virtual std::shared_ptr<QPDFObject> copy(bool shallow = false);
virtual std::string unparse();
virtual JSON getJSON(int json_version);
virtual void disconnect();
int
size() const noexcept
{
return sparse ? sp_elements.size() : int(elements.size());
}
QPDFObjectHandle at(int n) const noexcept;
void getAsVector(std::vector<QPDFObjectHandle>&) const;
void setItem(int, QPDFObjectHandle const&);
void setFromVector(std::vector<QPDFObjectHandle> const& items);
void setFromVector(std::vector<std::shared_ptr<QPDFObject>>&& items);
void insertItem(int at, QPDFObjectHandle const& item);
void push_back(QPDFObjectHandle const& item);
void eraseItem(int at);
private:
QPDF_Array(std::vector<QPDFObjectHandle> const& items);
QPDF_Array(std::vector<std::shared_ptr<QPDFObject>>&& items, bool sparse);
QPDF_Array(SparseOHArray const& items);
QPDF_Array(std::vector<std::shared_ptr<QPDFObject>> const& items);
void checkOwnership(QPDFObjectHandle const& item) const;
bool sparse{false};
SparseOHArray sp_elements;
std::vector<std::shared_ptr<QPDFObject>> elements;
};
#endif // QPDF_ARRAY_HH
|