Back to index

lightning-sunbird  0.9+nobinonly
nsJARURI.h
Go to the documentation of this file.
00001 /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org Code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsJARURI_h__
00040 #define nsJARURI_h__
00041 
00042 #include "nsIJARURI.h"
00043 #include "nsISerializable.h"
00044 #include "nsIClassInfo.h"
00045 #include "nsCOMPtr.h"
00046 #include "nsString.h"
00047 
00048 #define NS_THIS_JARURI_IMPL_CID                      \
00049 { /* 9a55f629-730b-4d08-b75b-fa7d9570a691 */         \
00050     0x9a55f629,                                      \
00051     0x730b,                                          \
00052     0x4d08,                                          \
00053     {0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \
00054 }
00055 
00056 #define NS_JARURI_CLASSNAME \
00057     "nsJARURI"
00058 #define NS_JARURI_CID                                \
00059 { /* 245abae2-b947-4ded-a46d-9829d3cca462 */         \
00060     0x245abae2,                                      \
00061     0xb947,                                          \
00062     0x4ded,                                          \
00063     {0xa4, 0x6d, 0x98, 0x29, 0xd3, 0xcc, 0xa4, 0x62} \
00064 }
00065 
00066 
00067 class nsJARURI : public nsIJARURI, nsIJARURI_MOZILLA_1_8_BRANCH, nsISerializable, nsIClassInfo
00068 {
00069 public:    
00070     NS_DECL_ISUPPORTS
00071     NS_DECL_NSIURI
00072     NS_DECL_NSIURL
00073     NS_DECL_NSIJARURI
00074     NS_DECL_NSIJARURI_MOZILLA_1_8_BRANCH
00075     NS_DECL_NSISERIALIZABLE
00076     NS_DECL_NSICLASSINFO
00077 
00078     NS_DEFINE_STATIC_IID_ACCESSOR(NS_THIS_JARURI_IMPL_CID);
00079 
00080     // nsJARURI
00081     nsJARURI();
00082     virtual ~nsJARURI();
00083    
00084     nsresult Init(const char *charsetHint);
00085     nsresult FormatSpec(const nsACString &entryPath, nsACString &result,
00086                         PRBool aIncludeScheme = PR_TRUE);
00087     nsresult CreateEntryURL(const nsACString& entryFilename,
00088                             const char* charset,
00089                             nsIURL** url);
00090     nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL);
00091 
00092 protected:
00093     nsCOMPtr<nsIURI> mJARFile;
00094     // mJarEntry stored as a URL so that we can easily access things
00095     // like extensions, refs, etc.
00096     nsCOMPtr<nsIURL> mJAREntry;
00097     nsCString        mCharsetHint;
00098 };
00099 
00100 #endif // nsJARURI_h__