29 #include "../my_config.h" 48 static const U_I OLD_CRC_SIZE = 2;
52 virtual bool operator == (
const crc & ref)
const = 0;
53 bool operator != (
const crc & ref)
const {
return ! (*
this == ref); };
55 virtual void compute(
const infinint & offset,
const char *buffer, U_I length) = 0;
56 virtual void compute(
const char *buffer, U_I length) = 0;
57 virtual void clear() = 0;
58 virtual void dump(generic_file & f)
const = 0;
59 virtual std::string crc2str()
const = 0;
60 virtual infinint get_size()
const = 0;
61 virtual crc *clone()
const = 0;
64 extern crc *create_crc_from_file(generic_file & f,
bool old =
false);
65 extern crc *create_crc_from_size(infinint width);
67 class crc_i :
public crc
70 crc_i(
const infinint & width);
71 crc_i(
const infinint & width, generic_file & f);
72 crc_i(
const crc_i & ref) : size(ref.size), cyclic(ref.size) { copy_data_from(ref); pointer = cyclic.begin(); };
73 const crc_i & operator = (
const crc_i & ref) { copy_from(ref);
return *
this; };
75 bool operator == (
const crc & ref)
const;
77 void compute(
const infinint & offset,
const char *buffer, U_I length);
78 void compute(
const char *buffer, U_I length);
80 void dump(generic_file & f)
const;
81 std::string crc2str()
const;
82 infinint get_size()
const {
return size; };
84 #ifdef LIBDAR_SPECIAL_ALLOC 85 USE_SPECIAL_ALLOC(crc_i);
90 crc *clone()
const {
return new (std::nothrow) crc_i(*
this); };
95 storage::iterator pointer;
98 void copy_from(
const crc_i & ref);
99 void copy_data_from(
const crc_i & ref);
103 class crc_n :
public crc
108 crc_n(U_I width, generic_file & f);
109 crc_n(
const crc_n & ref) { copy_from(ref); };
110 const crc_n & operator = (
const crc_n & ref);
111 ~crc_n() { destroy(); };
113 bool operator == (
const crc & ref)
const;
115 void compute(
const infinint & offset,
const char *buffer, U_I length);
116 void compute(
const char *buffer, U_I length);
118 void dump(generic_file & f)
const;
119 std::string crc2str()
const;
120 infinint get_size()
const {
return size; };
122 #ifdef LIBDAR_SPECIAL_ALLOC 123 USE_SPECIAL_ALLOC(crc_n);
127 crc *clone()
const {
return new (std::nothrow) crc_n(*
this); };
132 unsigned char *pointer;
133 unsigned char *cyclic;
135 void alloc(U_I width);
136 void copy_from(
const crc_n & ref);
137 void copy_data_from(
const crc_n & ref);
are defined here basic integer types that tend to be portable
contains a class that permits arbitrary large data storage
switch module to limitint (32 ou 64 bits integers) or infinint
libdar namespace encapsulate all libdar symbols