1 // Copyright 2006-2008 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. 6 7 #ifndef NET_DISK_CACHE_BLOCKFILE_FILE_BLOCK_H_ 8 #define NET_DISK_CACHE_BLOCKFILE_FILE_BLOCK_H_ 9 10 #include <stddef.h> 11 12 namespace disk_cache { 13 14 // This interface exposes common functionality for a single block of data 15 // stored on a file-block, regardless of the real type or size of the block. 16 // Used to simplify loading / storing the block from disk. 17 class FileBlock { 18 public: 19 virtual ~FileBlock() = default; 20 21 // Returns a pointer to the actual data. 22 virtual void* buffer() const = 0; 23 24 // Returns the size of the block; 25 virtual size_t size() const = 0; 26 27 // Returns the file offset of this block. 28 virtual int offset() const = 0; 29 }; 30 31 } // namespace disk_cache 32 33 #endif // NET_DISK_CACHE_BLOCKFILE_FILE_BLOCK_H_ 34