dmose%mozilla.org ce50f7d151 updated license boilerplate to xPL 1.1, a=chofmann@netscape.com,r=endico@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@52900 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-06 02:47:15 +00:00

152 lines
3.7 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* nsCachePref. A class to separate the preference related code to
* one place. This is an incomplete implementation, I need to access
* the libprefs directly, but that would add another dependency. And
* libpref comes with a JS dependency... so holding this off for the
* moment.
*
* -Gagan Saksena 09/15/98
*/
#ifndef nsCachePref_h__
#define nsCachePref_h__
//#include "nsISupports.h"
#include "prtypes.h"
#include "prlog.h"
class nsCachePref //: public nsISupports
{
public:
static nsCachePref* GetInstance(void);
nsCachePref(void);
~nsCachePref();
enum Refresh
{
ONCE,
ALWAYS,
NEVER
};
const PRUint32 BkgSleepTime(void);
const char* DiskCacheDBFilename(void); /* like Fat.db */
const char* DiskCacheFolder(void); /* Cache dir */
PRBool DiskCacheSSL(void);
void DiskCacheSSL(PRBool bSet);
PRUint32 DiskCacheSize(void);
void DiskCacheSize(const PRUint32 i_Size);
PRUint32 MemCacheSize(void);
void MemCacheSize(const PRUint32 i_Size);
nsCachePref::Refresh
Frequency(void);
/* Revalidating in background, makes IMS calls in the bkg thread to
update cache entries. TODO, this should be at a bigger time period
than the cache cleanup routine */
PRBool RevalidateInBkg(void);
/* Setup all prefs */
void SetupPrefs(const char* i_Pref);
/*
NS_IMETHOD QueryInterface(const nsIID& aIID,
void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
*/
private:
nsCachePref(const nsCachePref& o);
nsCachePref& operator=(const nsCachePref& o);
PRBool m_bRevalidateInBkg;
PRBool m_bDiskCacheSSL;
nsCachePref::Refresh m_RefreshFreq;
PRUint32 m_MemCacheSize;
PRUint32 m_DiskCacheSize;
char* m_DiskCacheDBFilename;
char* m_DiskCacheFolder;
PRUint32 m_BkgSleepTime;
};
inline
PRUint32 nsCachePref::DiskCacheSize()
{
return m_DiskCacheSize;
}
inline
void nsCachePref::DiskCacheSize(const PRUint32 i_Size)
{
m_DiskCacheSize = i_Size;
}
inline
PRBool nsCachePref::DiskCacheSSL(void)
{
return m_bDiskCacheSSL;
}
inline
void nsCachePref::DiskCacheSSL(PRBool bSet)
{
m_bDiskCacheSSL = bSet;
}
inline
const char*
nsCachePref::DiskCacheFolder(void)
{
PR_ASSERT(m_DiskCacheFolder);
return m_DiskCacheFolder;
}
inline
PRUint32 nsCachePref::MemCacheSize()
{
return m_MemCacheSize;
}
inline
void nsCachePref::MemCacheSize(const PRUint32 i_Size)
{
m_MemCacheSize = i_Size;
}
inline
PRBool nsCachePref::RevalidateInBkg(void)
{
return m_bRevalidateInBkg;
}
#endif // nsCachePref_h__