summaryrefslogtreecommitdiffstats
path: root/security/manager/pki/nsASN1Tree.h
blob: bb2325b7a561f5c95960a606ce49961b5a6a4c03 (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
63
64
65
66
67
68
69
70
71
72
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSSASNTREE_H_
#define _NSSASNTREE_H_

#include "nscore.h"
#include "nsIX509Cert.h"
#include "nsIASN1Tree.h"
#include "nsIASN1Object.h"
#include "nsIASN1Sequence.h"
#include "nsITreeView.h"
#include "nsITreeBoxObject.h"
#include "nsITreeSelection.h"
#include "nsCOMPtr.h"

//4bfaa9f0-1dd2-11b2-afae-a82cbaa0b606
#define NS_NSSASN1OUTINER_CID  {             \
   0x4bfaa9f0,                               \
   0x1dd2,                                   \
   0x11b2,                                   \
   {0xaf,0xae,0xa8,0x2c,0xba,0xa0,0xb6,0x06} \
  }
  

class nsNSSASN1Tree : public nsIASN1Tree
{
public:
  NS_DECL_THREADSAFE_ISUPPORTS
  NS_DECL_NSIASN1TREE
  NS_DECL_NSITREEVIEW
  
  nsNSSASN1Tree();
protected:
  virtual ~nsNSSASN1Tree();

  class myNode
  {
  public:
    nsCOMPtr<nsIASN1Object> obj;
    nsCOMPtr<nsIASN1Sequence> seq;
    myNode *child;
    myNode *next;
    myNode *parent;
    
    myNode() {
      child = next = parent = nullptr;
    }
  };

  myNode *mTopNode;

  nsCOMPtr<nsIASN1Object> mASN1Object;
  nsCOMPtr<nsITreeSelection> mSelection;
  nsCOMPtr<nsITreeBoxObject> mTree;

  void InitNodes();
  void InitChildsRecursively(myNode *n);

  void ClearNodes();
  void ClearNodesRecursively(myNode *n);

  int32_t CountVisibleNodes(myNode *n);
  myNode *FindNodeFromIndex(myNode *n, int32_t wantedIndex,
                            int32_t &index_counter, int32_t &level_counter,
                            int32_t *optionalOutParentIndex, int32_t *optionalOutLevel);
  myNode *FindNodeFromIndex(int32_t wantedIndex, 
                            int32_t *optionalOutParentIndex = nullptr, 
                            int32_t *optionalOutLevel = nullptr);

};
#endif //_NSSASNTREE_H_