Back to index

lightning-sunbird  0.9+nobinonly
nsASN1Tree.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Javier Delgadillo <javi@netscape.com>
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 #ifndef _NSSASNTREE_H_
00038 #define _NSSASNTREE_H_
00039 
00040 #include "nscore.h"
00041 #include "nsIX509Cert.h"
00042 #include "nsIASN1Tree.h"
00043 #include "nsIASN1Object.h"
00044 #include "nsIASN1Sequence.h"
00045 #include "nsITreeView.h"
00046 #include "nsITreeBoxObject.h"
00047 #include "nsITreeSelection.h"
00048 #include "nsCOMPtr.h"
00049 
00050 //4bfaa9f0-1dd2-11b2-afae-a82cbaa0b606
00051 #define NS_NSSASN1OUTINER_CID  {             \
00052    0x4bfaa9f0,                               \
00053    0x1dd2,                                   \
00054    0x11b2,                                   \
00055    {0xaf,0xae,0xa8,0x2c,0xba,0xa0,0xb6,0x06} \
00056   }
00057   
00058 
00059 class nsNSSASN1Tree : public nsIASN1Tree
00060 {
00061 public:
00062   NS_DECL_ISUPPORTS
00063   NS_DECL_NSIASN1TREE
00064   NS_DECL_NSITREEVIEW
00065   
00066   nsNSSASN1Tree();
00067   virtual ~nsNSSASN1Tree();
00068 protected:
00069 
00070   class myNode
00071   {
00072   public:
00073     nsCOMPtr<nsIASN1Object> obj;
00074     nsCOMPtr<nsIASN1Sequence> seq;
00075     myNode *child;
00076     myNode *next;
00077     myNode *parent;
00078     
00079     myNode() {
00080       child = next = parent = nsnull;
00081     }
00082   };
00083 
00084   myNode *mTopNode;
00085 
00086   nsCOMPtr<nsIASN1Object> mASN1Object;
00087   nsCOMPtr<nsITreeSelection> mSelection;
00088   nsCOMPtr<nsITreeBoxObject> mTree;
00089 
00090   void InitNodes();
00091   void InitChildsRecursively(myNode *n);
00092 
00093   void ClearNodes();
00094   void ClearNodesRecursively(myNode *n);
00095 
00096   PRInt32 CountVisibleNodes(myNode *n);
00097   myNode *FindNodeFromIndex(myNode *n, PRInt32 wantedIndex,
00098                             PRInt32 &index_counter, PRInt32 &level_counter,
00099                             PRInt32 *optionalOutParentIndex, PRInt32 *optionalOutLevel);
00100   myNode *FindNodeFromIndex(PRInt32 wantedIndex, 
00101                             PRInt32 *optionalOutParentIndex = nsnull, 
00102                             PRInt32 *optionalOutLevel = nsnull);
00103 
00104 };
00105 #endif //_NSSASNTREE_H_