2001-02-23 16:18:01 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04: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 16:18:01 +03:00
|
|
|
|
|
|
|
#ifndef _nsCacheMetaData_h_
|
|
|
|
#define _nsCacheMetaData_h_
|
|
|
|
|
|
|
|
#include "nspr.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
|
2001-04-04 07:30:45 +04:00
|
|
|
class nsICacheMetaDataVisitor;
|
|
|
|
|
2001-02-23 16:18:01 +03:00
|
|
|
class nsCacheMetaData {
|
|
|
|
public:
|
2012-07-30 18:20:58 +04:00
|
|
|
nsCacheMetaData() : mBuffer(nullptr), mBufferSize(0), mMetaSize(0) { }
|
2001-03-02 04:51:41 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
~nsCacheMetaData() {
|
|
|
|
mBufferSize = mMetaSize = 0;
|
|
|
|
PR_FREEIF(mBuffer);
|
|
|
|
}
|
2001-02-23 16:18:01 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
const char * GetElement(const char * key);
|
2001-02-23 16:18:01 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
nsresult SetElement(const char * key, const char * value);
|
2001-02-23 16:18:01 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
PRUint32 Size(void) { return mMetaSize; }
|
2001-03-13 18:43:17 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
nsresult FlattenMetaData(char * buffer, PRUint32 bufSize);
|
2003-09-11 20:57:40 +04:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
nsresult UnflattenMetaData(const char * buffer, PRUint32 bufSize);
|
2001-02-28 10:13:32 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
nsresult VisitElements(nsICacheMetaDataVisitor * visitor);
|
2001-04-04 07:30:45 +04:00
|
|
|
|
2001-02-23 16:18:01 +03:00
|
|
|
private:
|
2009-09-16 19:56:09 +04:00
|
|
|
nsresult EnsureBuffer(PRUint32 size);
|
2001-02-28 10:13:32 +03:00
|
|
|
|
2009-09-16 19:56:09 +04:00
|
|
|
char * mBuffer;
|
|
|
|
PRUint32 mBufferSize;
|
2003-09-11 20:57:40 +04:00
|
|
|
PRUint32 mMetaSize;
|
2001-02-23 16:18:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _nsCacheMetaData_h
|