| cache.h | | cache.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifndef ZIM_CACHE_H | | #ifndef ZIM_CACHE_H | |
| #define ZIM_CACHE_H | | #define ZIM_CACHE_H | |
| | | | |
| #include <map> | | #include <map> | |
| #include <limits> | | #include <limits> | |
| #include <iostream> | | #include <iostream> | |
| | | | |
|
| | | #ifdef _WIN32 | |
| | | #define NOMINMAX | |
| | | #include <windows.h> | |
| | | #undef NOMINMAX | |
| | | #undef max | |
| | | #endif | |
| | | | |
| namespace zim | | namespace zim | |
| { | | { | |
| /** | | /** | |
| Implements a container for caching elements. | | Implements a container for caching elements. | |
| | | | |
| The cache holds a list of key-value-pairs. There are 2 main operations
for | | The cache holds a list of key-value-pairs. There are 2 main operations
for | |
| accessing the cache: put and get. Put takes a key and a value and puts
the | | accessing the cache: put and get. Put takes a key and a value and puts
the | |
| element into the list. Get takes a key and optional a value. If the va
lue | | element into the list. Get takes a key and optional a value. If the va
lue | |
| for the key is found, it is returned. The passed value otherwise. By | | for the key is found, it is returned. The passed value otherwise. By | |
| default the value is constructed with the empty ctor of the value-type
. | | default the value is constructed with the empty ctor of the value-type
. | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 7 lines changed or added | |
|
| dirent.h | | dirent.h | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| version(0), | | version(0), | |
| clusterNumber(0), | | clusterNumber(0), | |
| blobNumber(0), | | blobNumber(0), | |
| redirectIndex(0), | | redirectIndex(0), | |
| ns('\0') | | ns('\0') | |
| {} | | {} | |
| | | | |
| bool isRedirect() const { return mimeType == redirect
MimeType; } | | bool isRedirect() const { return mimeType == redirect
MimeType; } | |
| bool isLinktarget() const { return mimeType == linktarg
etMimeType; } | | bool isLinktarget() const { return mimeType == linktarg
etMimeType; } | |
| bool isDeleted() const { return mimeType == deletedM
imeType; } | | bool isDeleted() const { return mimeType == deletedM
imeType; } | |
|
| | | bool isArticle() const { return !isRedirect() && !is
Linktarget() && !isDeleted(); } | |
| uint16_t getMimeType() const { return mimeType; } | | uint16_t getMimeType() const { return mimeType; } | |
| | | | |
| size_type getVersion() const { return version; } | | size_type getVersion() const { return version; } | |
| void setVersion(size_type v) { version = v; } | | void setVersion(size_type v) { version = v; } | |
| | | | |
| size_type getClusterNumber() const { return isRedirect() ? 0 : c
lusterNumber; } | | size_type getClusterNumber() const { return isRedirect() ? 0 : c
lusterNumber; } | |
| size_type getBlobNumber() const { return isRedirect() ? 0 : b
lobNumber; } | | size_type getBlobNumber() const { return isRedirect() ? 0 : b
lobNumber; } | |
| void setCluster(size_type clusterNumber_, size_type blobNumber_) | | void setCluster(size_type clusterNumber_, size_type blobNumber_) | |
| { clusterNumber = clusterNumber_; blobNumber = blobNumber_; } | | { clusterNumber = clusterNumber_; blobNumber = blobNumber_; } | |
| | | | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 113 | |
| } | | } | |
| | | | |
| void setRedirect(size_type idx) | | void setRedirect(size_type idx) | |
| { | | { | |
| redirectIndex = idx; | | redirectIndex = idx; | |
| mimeType = redirectMimeType; | | mimeType = redirectMimeType; | |
| clusterNumber = 0; | | clusterNumber = 0; | |
| blobNumber = 0; | | blobNumber = 0; | |
| } | | } | |
| | | | |
|
| | | void setMimeType(uint16_t mime) | |
| | | { | |
| | | mimeType = mime; | |
| | | } | |
| | | | |
| void setLinktarget() | | void setLinktarget() | |
| { | | { | |
| mimeType = linktargetMimeType; | | mimeType = linktargetMimeType; | |
| clusterNumber = 0; | | clusterNumber = 0; | |
| blobNumber = 0; | | blobNumber = 0; | |
| } | | } | |
| | | | |
| void setDeleted() | | void setDeleted() | |
| { | | { | |
| mimeType = deletedMimeType; | | mimeType = deletedMimeType; | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 6 lines changed or added | |
|