1 : /* ***** BEGIN LICENSE BLOCK *****
2 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 : *
4 : * The contents of this file are subject to the Mozilla Public License Version
5 : * 1.1 (the "License"); you may not use this file except in compliance with
6 : * the License. You may obtain a copy of the License at
7 : * http://www.mozilla.org/MPL/
8 : *
9 : * Software distributed under the License is distributed on an "AS IS" basis,
10 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 : * for the specific language governing rights and limitations under the
12 : * License.
13 : *
14 : * The Original Code is the Netscape security libraries.
15 : *
16 : * The Initial Developer of the Original Code is
17 : * Netscape Communications Corporation.
18 : * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Javier Delgadillo <javi@netscape.com>
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 : #ifndef _NSSASNTREE_H_
38 : #define _NSSASNTREE_H_
39 :
40 : #include "nscore.h"
41 : #include "nsIX509Cert.h"
42 : #include "nsIASN1Tree.h"
43 : #include "nsIASN1Object.h"
44 : #include "nsIASN1Sequence.h"
45 : #include "nsITreeView.h"
46 : #include "nsITreeBoxObject.h"
47 : #include "nsITreeSelection.h"
48 : #include "nsCOMPtr.h"
49 :
50 : //4bfaa9f0-1dd2-11b2-afae-a82cbaa0b606
51 : #define NS_NSSASN1OUTINER_CID { \
52 : 0x4bfaa9f0, \
53 : 0x1dd2, \
54 : 0x11b2, \
55 : {0xaf,0xae,0xa8,0x2c,0xba,0xa0,0xb6,0x06} \
56 : }
57 :
58 :
59 : class nsNSSASN1Tree : public nsIASN1Tree
60 : {
61 : public:
62 : NS_DECL_ISUPPORTS
63 : NS_DECL_NSIASN1TREE
64 : NS_DECL_NSITREEVIEW
65 :
66 : nsNSSASN1Tree();
67 : virtual ~nsNSSASN1Tree();
68 : protected:
69 :
70 : class myNode
71 0 : {
72 : public:
73 : nsCOMPtr<nsIASN1Object> obj;
74 : nsCOMPtr<nsIASN1Sequence> seq;
75 : myNode *child;
76 : myNode *next;
77 : myNode *parent;
78 :
79 0 : myNode() {
80 0 : child = next = parent = nsnull;
81 0 : }
82 : };
83 :
84 : myNode *mTopNode;
85 :
86 : nsCOMPtr<nsIASN1Object> mASN1Object;
87 : nsCOMPtr<nsITreeSelection> mSelection;
88 : nsCOMPtr<nsITreeBoxObject> mTree;
89 :
90 : void InitNodes();
91 : void InitChildsRecursively(myNode *n);
92 :
93 : void ClearNodes();
94 : void ClearNodesRecursively(myNode *n);
95 :
96 : PRInt32 CountVisibleNodes(myNode *n);
97 : myNode *FindNodeFromIndex(myNode *n, PRInt32 wantedIndex,
98 : PRInt32 &index_counter, PRInt32 &level_counter,
99 : PRInt32 *optionalOutParentIndex, PRInt32 *optionalOutLevel);
100 : myNode *FindNodeFromIndex(PRInt32 wantedIndex,
101 : PRInt32 *optionalOutParentIndex = nsnull,
102 : PRInt32 *optionalOutLevel = nsnull);
103 :
104 : };
105 : #endif //_NSSASNTREE_H_
|