2001-02-23 13:18:01 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-02-23 13:18:01 +00:00
|
|
|
|
|
|
|
#ifndef _nsCacheMetaData_h_
|
|
|
|
#define _nsCacheMetaData_h_
|
|
|
|
|
|
|
|
#include "nspr.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
|
2001-04-04 03:30:45 +00:00
|
|
|
class nsICacheMetaDataVisitor;
|
|
|
|
|
2001-02-23 13:18:01 +00:00
|
|
|
class nsCacheMetaData {
|
|
|
|
public:
|
2009-09-16 15:56:09 +00:00
|
|
|
nsCacheMetaData() : mBuffer(nsnull), mBufferSize(0), mMetaSize(0) { }
|
2001-03-02 01:51:41 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
~nsCacheMetaData() {
|
|
|
|
mBufferSize = mMetaSize = 0;
|
|
|
|
PR_FREEIF(mBuffer);
|
|
|
|
}
|
2001-02-23 13:18:01 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
const char * GetElement(const char * key);
|
2001-02-23 13:18:01 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
nsresult SetElement(const char * key, const char * value);
|
2001-02-23 13:18:01 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
PRUint32 Size(void) { return mMetaSize; }
|
2001-03-13 15:43:17 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
nsresult FlattenMetaData(char * buffer, PRUint32 bufSize);
|
2003-09-11 16:57:40 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
nsresult UnflattenMetaData(const char * buffer, PRUint32 bufSize);
|
2001-02-28 07:13:32 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
nsresult VisitElements(nsICacheMetaDataVisitor * visitor);
|
2001-04-04 03:30:45 +00:00
|
|
|
|
2001-02-23 13:18:01 +00:00
|
|
|
private:
|
2009-09-16 15:56:09 +00:00
|
|
|
nsresult EnsureBuffer(PRUint32 size);
|
2001-02-28 07:13:32 +00:00
|
|
|
|
2009-09-16 15:56:09 +00:00
|
|
|
char * mBuffer;
|
|
|
|
PRUint32 mBufferSize;
|
2003-09-11 16:57:40 +00:00
|
|
|
PRUint32 mMetaSize;
|
2001-02-23 13:18:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _nsCacheMetaData_h
|