Back to index

lightning-sunbird  0.9+nobinonly
nsCache.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 nsCache.h, released
00017  * March 18, 2001.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 2001
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Gordon Sheridan  <gordon@netscape.com>
00026  *   Patrick C. Beard <beard@netscape.com>
00027  *   Darin Fisher     <darin@netscape.com>
00028  *
00029  * Alternatively, the contents of this file may be used under the terms of
00030  * either the GNU General Public License Version 2 or later (the "GPL"), or
00031  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00032  * in which case the provisions of the GPL or the LGPL are applicable instead
00033  * of those above. If you wish to allow use of your version of this file only
00034  * under the terms of either the GPL or the LGPL, and not to allow others to
00035  * use your version of this file under the terms of the MPL, indicate your
00036  * decision by deleting the provisions above and replace them with the notice
00037  * and other provisions required by the GPL or the LGPL. If you do not delete
00038  * the provisions above, a recipient may use your version of this file under
00039  * the terms of any one of the MPL, the GPL or the LGPL.
00040  *
00041  * ***** END LICENSE BLOCK ***** */
00042 
00047 #ifndef _nsCache_h_
00048 #define _nsCache_h_
00049 
00050 #include "nsISupports.h"
00051 #include "nsIFile.h"
00052 #include "nsAString.h"
00053 #include "prtime.h"
00054 #include "nsError.h"
00055 #include "prlog.h"
00056 
00057 // PR_LOG args = "format string", arg, arg, ...
00058 #if defined(PR_LOGGING)
00059 extern PRLogModuleInfo * gCacheLog;
00060 void   CacheLogInit();
00061 void   CacheLogPrintPath(PRLogModuleLevel level,
00062                          char *           format,
00063                          nsIFile *        item);
00064 #define CACHE_LOG_INIT()        CacheLogInit()
00065 #define CACHE_LOG_ALWAYS(args)  PR_LOG(gCacheLog, PR_LOG_ALWAYS, args)
00066 #define CACHE_LOG_ERROR(args)   PR_LOG(gCacheLog, PR_LOG_ERROR, args)
00067 #define CACHE_LOG_WARNING(args) PR_LOG(gCacheLog, PR_LOG_WARNING, args)
00068 #define CACHE_LOG_DEBUG(args)   PR_LOG(gCacheLog, PR_LOG_DEBUG, args)
00069 #define CACHE_LOG_PATH(level, format, item) \
00070                                 CacheLogPrintPath(level, format, item)
00071 #else
00072 #define CACHE_LOG_INIT()        {}
00073 #define CACHE_LOG_ALWAYS(args)  {}
00074 #define CACHE_LOG_ERROR(args)   {}
00075 #define CACHE_LOG_WARNING(args) {}
00076 #define CACHE_LOG_DEBUG(args)   {}
00077 #define CACHE_LOG_PATH(level, format, item)  {}
00078 #endif
00079 
00080 
00081 extern PRUint32  SecondsFromPRTime(PRTime prTime);
00082 extern PRTime    PRTimeFromSeconds(PRUint32 seconds);
00083 
00084 
00085 extern nsresult  ClientIDFromCacheKey(const nsACString&  key, char ** result);
00086 extern nsresult  ClientKeyFromCacheKey(const nsCString& key, nsACString &result);
00087 
00088 
00089 #endif // _nsCache_h