Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef _nsCacheMetaData_h_ |
michael@0 | 8 | #define _nsCacheMetaData_h_ |
michael@0 | 9 | |
michael@0 | 10 | #include "nspr.h" |
michael@0 | 11 | #include "nscore.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsICacheMetaDataVisitor; |
michael@0 | 14 | |
michael@0 | 15 | class nsCacheMetaData { |
michael@0 | 16 | public: |
michael@0 | 17 | nsCacheMetaData() : mBuffer(nullptr), mBufferSize(0), mMetaSize(0) { } |
michael@0 | 18 | |
michael@0 | 19 | ~nsCacheMetaData() { |
michael@0 | 20 | mBufferSize = mMetaSize = 0; |
michael@0 | 21 | moz_free(mBuffer); |
michael@0 | 22 | mBuffer = nullptr; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | const char * GetElement(const char * key); |
michael@0 | 26 | |
michael@0 | 27 | nsresult SetElement(const char * key, const char * value); |
michael@0 | 28 | |
michael@0 | 29 | uint32_t Size(void) { return mMetaSize; } |
michael@0 | 30 | |
michael@0 | 31 | nsresult FlattenMetaData(char * buffer, uint32_t bufSize); |
michael@0 | 32 | |
michael@0 | 33 | nsresult UnflattenMetaData(const char * buffer, uint32_t bufSize); |
michael@0 | 34 | |
michael@0 | 35 | nsresult VisitElements(nsICacheMetaDataVisitor * visitor); |
michael@0 | 36 | |
michael@0 | 37 | private: |
michael@0 | 38 | nsresult EnsureBuffer(uint32_t size); |
michael@0 | 39 | |
michael@0 | 40 | char * mBuffer; |
michael@0 | 41 | uint32_t mBufferSize; |
michael@0 | 42 | uint32_t mMetaSize; |
michael@0 | 43 | }; |
michael@0 | 44 | |
michael@0 | 45 | #endif // _nsCacheMetaData_h |