This commit is contained in:
kelson42 2010-04-05 20:56:18 +00:00
parent 44d9a1abd8
commit fef93ed3b4
4 changed files with 38 additions and 14 deletions

View File

@ -22,6 +22,7 @@
#include <algorithm>
#include <iostream>
#include <zim/zim.h>
/// Returns true, if machine is big-endian (high byte first).
/// e.g. PowerPC

View File

@ -51,6 +51,7 @@ namespace zim
Article getArticle(size_type idx) const;
Article getArticle(char ns, const std::string& url);
Article getArticleByUrl(const std::string& url);
Article getArticleByTitle(size_type idx);
Article getArticleByTitle(char ns, const std::string& title);
@ -77,10 +78,12 @@ namespace zim
const_iterator begin();
const_iterator beginByTitle();
const_iterator end();
std::pair<bool, const_iterator> findxByTitle(char ns, const std::string& title);
std::pair<bool, const_iterator> findx(char ns, const std::string& url);
std::pair<bool, const_iterator> findx(const std::string& url);
std::pair<bool, const_iterator> findxByTitle(char ns, const std::string& title);
const_iterator findByTitle(char ns, const std::string& title);
const_iterator find(char ns, const std::string& url);
const_iterator find(const std::string& url);
bool good() const { return impl.getPointer() != 0; }
time_t getMTime() const { return impl->getMTime(); }

View File

@ -18,7 +18,7 @@
*/
#include <locale>
#include <stdint.h>
#include <zim/zim.h>
namespace zim
{

View File

@ -24,17 +24,27 @@
namespace zim
{
// define 8 bit integer types
//
typedef unsigned char uint8_t;
typedef char int8_t;
// define 16 bit integer types
//
#if USHRT_MAX == 0xffff
typedef unsigned short uint16_t;
typedef short int16_t;
#elif UINT_MAX == 0xffff
typedef unsigned int uint16_t;
typedef int int16_t;
#elif ULONG_MAX == 0xffff
typedef unsigned long uint16_t;
typedef long int16_t;
#else
@ -45,17 +55,22 @@ namespace zim
#endif
// define 32 bit integer types
//
#if USHRT_MAX == 0xffffffffUL
typedef unsigned short size_type;
typedef unsigned short uint32_t;
typedef short int32_t;
#elif UINT_MAX == 0xffffffffUL
typedef unsigned int size_type;
typedef unsigned int uint32_t;
typedef int int32_t;
#elif ULONG_MAX == 0xffffffffUL
typedef unsigned long size_type;
typedef unsigned long uint32_t;
typedef long int32_t;
#else
@ -63,21 +78,25 @@ namespace zim
#include <stdint.h>
namespace zim
{
typedef uint32_t size_type;
#endif
// define 64 bit integer types
//
#if UINT_MAX == 18446744073709551615ULL
typedef unsigned int offset_type;
typedef unsigned int uint64_t;
typedef int int64_t;
#elif ULONG_MAX == 18446744073709551615ULL
typedef unsigned long offset_type;
typedef unsigned long uint64_t;
typedef long int64_t;
#elif ULLONG_MAX == 18446744073709551615ULL
typedef unsigned long long offset_type;
typedef unsigned long long uint64_t;
typedef long long int64_t;
#else
@ -85,10 +104,11 @@ namespace zim
#include <stdint.h>
namespace zim
{
typedef uint64_t offset_type;
#endif
typedef uint32_t size_type;
typedef uint64_t offset_type;
enum CompressionType
{
zimcompDefault,