blob: 06aab400f11320c796cd57c925c6ab0ad5a557c6 (
plain)
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
54
55
56
57
58
59
60
61
62
|
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fxfa/parser/xfa_object.h"
CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument)
: CXFA_NodeList(pDocument) {}
CXFA_ArrayNodeList::~CXFA_ArrayNodeList() {}
void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) {
if (srcArray.GetSize() > 0) {
m_array.Copy(srcArray);
}
}
int32_t CXFA_ArrayNodeList::GetLength() {
return m_array.GetSize();
}
FX_BOOL CXFA_ArrayNodeList::Append(CXFA_Node* pNode) {
m_array.Add(pNode);
return TRUE;
}
FX_BOOL CXFA_ArrayNodeList::Insert(CXFA_Node* pNewNode,
CXFA_Node* pBeforeNode) {
if (!pBeforeNode) {
m_array.Add(pNewNode);
} else {
int32_t iSize = m_array.GetSize();
for (int32_t i = 0; i < iSize; ++i) {
if (m_array[i] == pBeforeNode) {
m_array.InsertAt(i, pNewNode);
break;
}
}
}
return TRUE;
}
FX_BOOL CXFA_ArrayNodeList::Remove(CXFA_Node* pNode) {
int32_t iSize = m_array.GetSize();
for (int32_t i = 0; i < iSize; ++i) {
if (m_array[i] == pNode) {
m_array.RemoveAt(i);
break;
}
}
return TRUE;
}
CXFA_Node* CXFA_ArrayNodeList::Item(int32_t iIndex) {
int32_t iSize = m_array.GetSize();
if (iIndex >= 0 && iIndex < iSize) {
return m_array[iIndex];
}
return nullptr;
}
|