article.h   article.h 
skipping to change at line 61 skipping to change at line 61
std::string getTitle() const { return getDirent().getTitle (); } std::string getTitle() const { return getDirent().getTitle (); }
std::string getUrl() const { return getDirent().getUrl() ; } std::string getUrl() const { return getDirent().getUrl() ; }
std::string getLongUrl() const { return getDirent().getLongU rl(); } std::string getLongUrl() const { return getDirent().getLongU rl(); }
uint16_t getLibraryMimeType() const { return getDirent().getMimeT ype(); } uint16_t getLibraryMimeType() const { return getDirent().getMimeT ype(); }
const std::string& const std::string&
getMimeType() const { return file.getMimeType(get LibraryMimeType()); } getMimeType() const { return file.getMimeType(get LibraryMimeType()); }
bool isRedirect() const { return getDirent().isRedire ct(); } bool isRedirect() const { return getDirent().isRedire ct(); }
bool isLinktarget() const { return getDirent().isLinkta
rget(); }
bool isDeleted() const { return getDirent().isDelete
d(); }
char getNamespace() const { return getDirent().getNames pace(); } char getNamespace() const { return getDirent().getNames pace(); }
size_type getRedirectIndex() const { return getDirent().getRedir ectIndex(); } size_type getRedirectIndex() const { return getDirent().getRedir ectIndex(); }
Article getRedirectArticle() const { return Article(file, getRed irectIndex()); } Article getRedirectArticle() const { return Article(file, getRed irectIndex()); }
size_type getArticleSize() const; size_type getArticleSize() const;
bool operator< (const Article& a) const bool operator< (const Article& a) const
{ return getNamespace() < a.getNamespace() { return getNamespace() < a.getNamespace()
|| (getNamespace() == a.getNamespace() || (getNamespace() == a.getNamespace()
&& getTitle() < a.getTitle()); } && getTitle() < a.getTitle()); }
Cluster getCluster() const Cluster getCluster() const
{ return file.getCluster(getDirent().getClusterNumber()); } { return file.getCluster(getDirent().getClusterNumber()); }
Blob getData() const Blob getData() const
{ {
Dirent dirent = getDirent(); Dirent dirent = getDirent();
return dirent.isRedirect() ? Blob() return isRedirect()
: const_cast<File&>(file).getBlob(dirent || isLinktarget()
.getClusterNumber(), dirent.getBlobNumber()); || isDeleted() ? Blob()
: const_cast<File&>(file).getBlob(dirent.getClus
terNumber(), dirent.getBlobNumber());
} }
std::string getPage(bool layout = true, unsigned maxRecurse = 10); std::string getPage(bool layout = true, unsigned maxRecurse = 10);
void getPage(std::ostream&, bool layout = true, unsigned maxRecurse = 10); void getPage(std::ostream&, bool layout = true, unsigned maxRecurse = 10);
const File& getFile() const { return file; } const File& getFile() const { return file; }
File& getFile() { return file; } File& getFile() { return file; }
size_type getIndex() const { return idx; } size_type getIndex() const { return idx; }
bool good() const { return idx != std::numeric_limits<size_type>::m ax(); } bool good() const { return idx != std::numeric_limits<size_type>::m ax(); }
 End of changes. 2 change blocks. 
3 lines changed or deleted 9 lines changed or added


 articlesource.h   articlesource.h 
skipping to change at line 41 skipping to change at line 41
namespace writer namespace writer
{ {
class Article class Article
{ {
public: public:
virtual std::string getAid() const = 0; virtual std::string getAid() const = 0;
virtual char getNamespace() const = 0; virtual char getNamespace() const = 0;
virtual std::string getUrl() const = 0; virtual std::string getUrl() const = 0;
virtual std::string getTitle() const = 0; virtual std::string getTitle() const = 0;
virtual size_type getVersion() const; virtual size_type getVersion() const;
virtual bool isRedirect() const = 0; virtual bool isRedirect() const;
virtual bool isLinktarget() const;
virtual bool isDeleted() const;
virtual std::string getMimeType() const = 0; virtual std::string getMimeType() const = 0;
virtual bool shouldCompress() const; virtual bool shouldCompress() const;
virtual std::string getRedirectAid() const = 0; virtual std::string getRedirectAid() const;
virtual std::string getParameter() const; virtual std::string getParameter() const;
// returns the next category id, to which the article is assigned t o // returns the next category id, to which the article is assigned t o
virtual std::string getNextCategory(); virtual std::string getNextCategory();
}; };
class Category class Category
{ {
public: public:
virtual Blob getData() = 0; virtual Blob getData() = 0;
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 blob.h   blob.h 
skipping to change at line 25 skipping to change at line 25
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
* *
*/ */
#ifndef ZIM_BLOB_H #ifndef ZIM_BLOB_H
#define ZIM_BLOB_H #define ZIM_BLOB_H
#include <iostream> #include <iostream>
#include <zim/cluster.h> #include <zim/cluster.h>
#include <algorithm>
namespace zim namespace zim
{ {
class Blob class Blob
{ {
const char* _data; const char* _data;
unsigned _size; unsigned _size;
SmartPtr<ClusterImpl> _cluster; SmartPtr<ClusterImpl> _cluster;
public: public:
skipping to change at line 62 skipping to change at line 63
unsigned size() const { return _size; } unsigned size() const { return _size; }
}; };
inline std::ostream& operator<< (std::ostream& out, const Blob& blob) inline std::ostream& operator<< (std::ostream& out, const Blob& blob)
{ {
if (blob.data()) if (blob.data())
out.write(blob.data(), blob.size()); out.write(blob.data(), blob.size());
return out; return out;
} }
inline bool operator== (const Blob& b1, const Blob& b2)
{
return b1.size() == b2.size()
&& std::equal(b1.data(), b1.data() + b1.size(), b2.data());
}
} }
#endif // ZIM_BLOB_H #endif // ZIM_BLOB_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 6 lines changed or added


 dirent.h   dirent.h 
skipping to change at line 25 skipping to change at line 25
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US A
* *
*/ */
#ifndef ZIM_DIRENT_H #ifndef ZIM_DIRENT_H
#define ZIM_DIRENT_H #define ZIM_DIRENT_H
#include <string> #include <string>
#include <zim/zim.h> #include <zim/zim.h>
#include <limits>
namespace zim namespace zim
{ {
class Dirent class Dirent
{ {
bool redirect;
uint16_t mimeType; uint16_t mimeType;
size_type version; size_type version;
size_type clusterNumber; // only used when redirect is false size_type clusterNumber; // only used when redirect is false
size_type blobNumber; // only used when redirect is false size_type blobNumber; // only used when redirect is false
size_type redirectIndex; // only used when redirect is true size_type redirectIndex; // only used when redirect is true
char ns; char ns;
std::string title; std::string title;
std::string url; std::string url;
std::string parameter; std::string parameter;
public: public:
// these constants are put into mimeType field
static const uint16_t redirectMimeType = 0xffff;
static const uint16_t linktargetMimeType = 0xfffe;
static const uint16_t deletedMimeType = 0xfffd;
Dirent() Dirent()
: redirect(false), : mimeType(0),
mimeType(0),
version(0), version(0),
clusterNumber(0), clusterNumber(0),
blobNumber(0), blobNumber(0),
redirectIndex(0), redirectIndex(0),
ns('\0') ns('\0')
{} {}
bool isRedirect() const { return redirect; } bool isRedirect() const { return mimeType == redirect
MimeType; }
bool isLinktarget() const { return mimeType == linktarg
etMimeType; }
bool isDeleted() const { return mimeType == deletedM
imeType; }
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 102 skipping to change at line 106
url = url_; url = url_;
} }
void setParameter(const std::string& parameter_) void setParameter(const std::string& parameter_)
{ {
parameter = parameter_; parameter = parameter_;
} }
void setRedirect(size_type idx) void setRedirect(size_type idx)
{ {
redirect = true;
redirectIndex = idx; redirectIndex = idx;
mimeType = std::numeric_limits<uint16_t>::max(); mimeType = redirectMimeType;
clusterNumber = 0;
blobNumber = 0;
}
void setLinktarget()
{
mimeType = linktargetMimeType;
clusterNumber = 0;
blobNumber = 0;
}
void setDeleted()
{
mimeType = deletedMimeType;
clusterNumber = 0; clusterNumber = 0;
blobNumber = 0; blobNumber = 0;
} }
void setArticle(uint16_t mimeType_, size_type clusterNumber_, size_ty pe blobNumber_) void setArticle(uint16_t mimeType_, size_type clusterNumber_, size_ty pe blobNumber_)
{ {
redirect = false;
mimeType = mimeType_; mimeType = mimeType_;
clusterNumber = clusterNumber_; clusterNumber = clusterNumber_;
blobNumber = blobNumber_; blobNumber = blobNumber_;
} }
}; };
std::ostream& operator<< (std::ostream& out, const Dirent& fh); std::ostream& operator<< (std::ostream& out, const Dirent& fh);
std::istream& operator>> (std::istream& in, Dirent& fh); std::istream& operator>> (std::istream& in, Dirent& fh);
 End of changes. 8 change blocks. 
8 lines changed or deleted 27 lines changed or added


 uuid.h   uuid.h 
skipping to change at line 45 skipping to change at line 45
Uuid(const char uuid[16]) Uuid(const char uuid[16])
{ {
std::copy(uuid, uuid+16, data); std::copy(uuid, uuid+16, data);
} }
static Uuid generate(); static Uuid generate();
bool operator== (const Uuid& other) const bool operator== (const Uuid& other) const
{ return std::equal(data, data+16, other.data); } { return std::equal(data, data+16, other.data); }
bool operator!= (const Uuid& other) const
{ return !(*this == other); }
unsigned size() const { return 16; } unsigned size() const { return 16; }
char data[16]; char data[16];
}; };
std::ostream& operator<< (std::ostream& out, const Uuid& uuid); std::ostream& operator<< (std::ostream& out, const Uuid& uuid);
} }
#endif // ZIM_UUID_H #endif // ZIM_UUID_H
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 zimcreator.h   zimcreator.h 
skipping to change at line 80 skipping to change at line 80
offset_type indexSize() const; offset_type indexSize() const;
offset_type indexPos() const { return titleIdxPos() + titl eIdxSize(); } offset_type indexPos() const { return titleIdxPos() + titl eIdxSize(); }
offset_type clusterPtrSize() const { return clusterCount() * siz eof(offset_type); } offset_type clusterPtrSize() const { return clusterCount() * siz eof(offset_type); }
offset_type clusterPtrPos() const { return indexPos() + indexSi ze(); } offset_type clusterPtrPos() const { return indexPos() + indexSi ze(); }
offset_type checksumPos() const { return clusterPtrPos() + cl usterPtrSize() + clustersSize; } offset_type checksumPos() const { return clusterPtrPos() + cl usterPtrSize() + clustersSize; }
uint16_t getMimeTypeIdx(const std::string& mimeType); uint16_t getMimeTypeIdx(const std::string& mimeType);
const std::string& getMimeType(uint16_t mimeTypeIdx) const; const std::string& getMimeType(uint16_t mimeTypeIdx) const;
public: public:
ZimCreator();
ZimCreator(int& argc, char* argv[]); ZimCreator(int& argc, char* argv[]);
unsigned getMinChunkSize() { return minChunkSize; }
void setMinChunkSize(int s) { minChunkSize = s; }
void create(const std::string& fname, ArticleSource& src); void create(const std::string& fname, ArticleSource& src);
}; };
} }
} }
#endif // ZIM_WRITER_ZIMCREATOR_H #endif // ZIM_WRITER_ZIMCREATOR_H
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/