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

Unified Diff: xfa/fgas/crt/fgas_utils.h

Issue 1944893003: Remove unused CFX_CPLTree<> template (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/crt/fgas_utils.h
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index ab94f6ed40882b5463676e5e54ef6e06ed9b85c5..24224a02f07d129a999020d109520e071f32c8b7 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -12,9 +12,6 @@
class FX_BASEARRAYDATA;
-template <class baseType>
-class CFX_CPLTree;
-
class CFX_BaseArray : public CFX_Target {
protected:
CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize);
@@ -496,243 +493,4 @@ class CFX_ObjectStackTemplate : public CFX_BaseStack {
}
};
-template <class baseType>
-class CFX_CPLTreeNode : public CFX_Target {
- public:
- typedef CFX_CPLTreeNode<baseType> CPLTreeNode;
- CFX_CPLTreeNode()
- : m_pParentNode(NULL),
- m_pChildNode(NULL),
- m_pPrevNode(NULL),
- m_pNextNode(NULL),
- m_Data() {}
- enum TreeNode {
- Root = 0,
- Parent,
- FirstSibling,
- PreviousSibling,
- NextSibling,
- LastSibling,
- FirstNeighbor,
- PreviousNeighbor,
- NextNeighbor,
- LastNeighbor,
- FirstChild,
- LastChild
- };
- CPLTreeNode* GetNode(TreeNode eNode) const {
- switch (eNode) {
- case Root: {
- CPLTreeNode* pParent = (CPLTreeNode*)this;
- CPLTreeNode* pTemp;
- while ((pTemp = pParent->m_pParentNode) != NULL) {
- pParent = pTemp;
- }
- return pParent;
- }
- case Parent:
- return m_pParentNode;
- case FirstSibling: {
- CPLTreeNode* pNode = (CPLTreeNode*)this;
- CPLTreeNode* pTemp;
- while ((pTemp = pNode->m_pPrevNode) != NULL) {
- pNode = pTemp;
- }
- return pNode == (CPLTreeNode*)this ? NULL : pNode;
- }
- case PreviousSibling:
- return m_pPrevNode;
- case NextSibling:
- return m_pNextNode;
- case LastSibling: {
- CPLTreeNode* pNode = (CPLTreeNode*)this;
- CPLTreeNode* pTemp;
- while ((pTemp = pNode->m_pNextNode) != NULL) {
- pNode = pTemp;
- }
- return pNode == (CPLTreeNode*)this ? NULL : pNode;
- }
- case FirstNeighbor: {
- CPLTreeNode* pParent = (CPLTreeNode*)this;
- CPLTreeNode* pTemp;
- while ((pTemp = pParent->m_pParentNode) != NULL) {
- pParent = pTemp;
- }
- return pParent == (CPLTreeNode*)this ? NULL : pParent;
- }
- case PreviousNeighbor: {
- if (m_pPrevNode == NULL) {
- return m_pParentNode;
- }
- CPLTreeNode* pNode = m_pPrevNode;
- CPLTreeNode* pTemp;
- while ((pTemp = pNode->m_pChildNode) != NULL) {
- pNode = pTemp;
- while ((pTemp = pNode->m_pNextNode) != NULL) {
- pNode = pTemp;
- }
- }
- return pNode;
- }
- case NextNeighbor: {
- if (m_pChildNode != NULL) {
- return m_pChildNode;
- }
- if (m_pNextNode != NULL) {
- return m_pNextNode;
- }
- CPLTreeNode* pNode = m_pParentNode;
- while (pNode != NULL) {
- if (pNode->m_pNextNode != NULL) {
- return pNode->m_pNextNode;
- }
- pNode = pNode->m_pParentNode;
- }
- return NULL;
- }
- case LastNeighbor: {
- CPLTreeNode* pNode = (CPLTreeNode*)this;
- CPLTreeNode* pTemp;
- while ((pTemp = pNode->m_pParentNode) != NULL) {
- pNode = pTemp;
- }
- while (TRUE) {
- CPLTreeNode* pTemp;
- while ((pTemp = pNode->m_pNextNode) != NULL) {
- pNode = pTemp;
- }
- if (pNode->m_pChildNode == NULL) {
- break;
- }
- pNode = pNode->m_pChildNode;
- }
- return pNode == (CPLTreeNode*)this ? NULL : pNode;
- }
- case FirstChild:
- return m_pChildNode;
- case LastChild: {
- if (m_pChildNode == NULL) {
- return NULL;
- }
- CPLTreeNode* pChild = m_pChildNode;
- CPLTreeNode* pTemp;
- while ((pTemp = pChild->m_pNextNode) != NULL) {
- pChild = pTemp;
- }
- return pChild;
- }
- default:
- break;
- }
- return NULL;
- }
- void SetParentNode(CPLTreeNode* pNode) { m_pParentNode = pNode; }
- int32_t CountChildNodes() const {
- int32_t iCount = 0;
- CPLTreeNode* pNode = m_pChildNode;
- while (pNode) {
- iCount++;
- pNode = pNode->m_pNextNode;
- }
- return iCount;
- }
- CPLTreeNode* GetChildNode(int32_t iIndex) const {
- int32_t iCount = 0;
- CPLTreeNode* pNode = m_pChildNode;
- while (pNode) {
- if (iIndex == iCount) {
- return pNode;
- }
- iCount++;
- pNode = pNode->m_pNextNode;
- }
- return NULL;
- }
- int32_t GetNodeIndex() const {
- int32_t index = 0;
- CPLTreeNode* pNode = m_pPrevNode;
- while (pNode != NULL) {
- index++;
- pNode = pNode->m_pPrevNode;
- }
- return index;
- }
- FX_BOOL IsParentNode(const CPLTreeNode* pNode) const {
- CPLTreeNode* pParent = m_pParentNode;
- while (pParent != NULL) {
- if (pParent == pNode) {
- return TRUE;
- }
- pParent = pParent->GetTreeNode(Parent);
- }
- return FALSE;
- }
- FX_BOOL IsChildNode(const CPLTreeNode* pNode) const {
- if (pNode == NULL) {
- return FALSE;
- }
- return pNode->IsParentNode((const CPLTreeNode*)this);
- }
- void SetChildNode(CPLTreeNode* pNode) { m_pChildNode = pNode; }
- void SetPrevNode(CPLTreeNode* pNode) { m_pPrevNode = pNode; }
- void SetNextNode(CPLTreeNode* pNode) { m_pNextNode = pNode; }
- int32_t GetNodeLevel() const {
- int32_t iLevel = 0;
- CPLTreeNode* pNode = (CPLTreeNode*)this;
- while ((pNode = pNode->m_pParentNode) != NULL) {
- iLevel++;
- }
- return iLevel;
- }
- bool IsRootNode() const { return !m_pParentNode; }
- baseType GetData() const { return m_Data; }
- void SetData(baseType data) { m_Data = data; }
-
- protected:
- CPLTreeNode* m_pParentNode;
- CPLTreeNode* m_pChildNode;
- CPLTreeNode* m_pPrevNode;
- CPLTreeNode* m_pNextNode;
- baseType m_Data;
- friend class CFX_CPLTree<baseType>;
-};
-
-template <class baseType>
-class CFX_CPLTree {
- public:
- typedef CFX_CPLTreeNode<baseType> CPLTreeNode;
- CFX_CPLTree() : m_Root() {}
- ~CFX_CPLTree() {
- CPLTreeNode* pNode = m_Root.GetNode(CPLTreeNode::LastNeighbor);
- while (pNode != NULL) {
- if (pNode->IsRootNode()) {
- break;
- }
- CPLTreeNode* pTemp = pNode->GetNode(CPLTreeNode::PreviousNeighbor);
- delete pNode;
- pNode = pTemp;
- }
- }
- CPLTreeNode* GetRoot() { return &m_Root; }
- CPLTreeNode* AddChild(baseType data, CPLTreeNode* pParent = NULL) {
- if (pParent == NULL) {
- pParent = &m_Root;
- }
- CPLTreeNode* pChild = new CPLTreeNode;
- pChild->SetParentNode(pParent);
- pChild->SetData(data);
- if (pParent->m_pChildNode == NULL) {
- pParent->m_pChildNode = pChild;
- } else {
- CPLTreeNode* pLast = pParent->GetNode(CPLTreeNode::LastChild);
- pChild->SetPrevNode(pLast);
- pLast->SetNextNode(pChild);
- }
- return pChild;
- }
-
- protected:
- CPLTreeNode m_Root;
-};
-
#endif // XFA_FGAS_CRT_FGAS_UTILS_H_
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698