Panda3D
|
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer. More...
#include "hashVal.h"
Public Member Functions | |
HashVal (const HashVal ©) | |
string | as_bin () const |
Returns the HashVal as a 16-byte binary string. More... | |
string | as_dec () const |
Returns the HashVal as a string with four decimal numbers. More... | |
string | as_hex () const |
Returns the HashVal as a 32-byte hexadecimal string. More... | |
int | compare_to (const HashVal &other) const |
void | input_binary (istream &in) |
Inputs the HashVal as a binary stream of bytes in order. More... | |
void | input_dec (istream &in) |
Inputs the HashVal as four unsigned decimal integers. More... | |
void | input_hex (istream &in) |
Inputs the HashVal as a 32-digit hexadecimal number. More... | |
void | merge_with (const HashVal &other) |
Generates a new HashVal representing the xor of this one and the other one. More... | |
bool | operator!= (const HashVal &other) const |
bool | operator< (const HashVal &other) const |
void | operator= (const HashVal ©) |
bool | operator== (const HashVal &other) const |
void | output (ostream &out) const |
void | output_binary (ostream &out) const |
Outputs the HashVal as a binary stream of bytes in order. More... | |
void | output_dec (ostream &out) const |
Outputs the HashVal as four unsigned decimal integers. More... | |
void | output_hex (ostream &out) const |
Outputs the HashVal as a 32-digit hexadecimal number. More... | |
void | read_datagram (DatagramIterator &source) |
void | read_stream (StreamReader &source) |
bool | set_from_bin (const string &text) |
Sets the HashVal from a 16-byte binary string. More... | |
bool | set_from_dec (const string &text) |
Sets the HashVal from a string with four decimal numbers. More... | |
bool | set_from_hex (const string &text) |
Sets the HashVal from a 32-byte hexademical string. More... | |
void | write_datagram (Datagram &destination) const |
void | write_stream (StreamWriter &destination) const |
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer.
string HashVal::as_bin | ( | ) | const |
Returns the HashVal as a 16-byte binary string.
Definition at line 169 of file hashVal.cxx.
References Datagram::get_message(), and set_from_bin().
Referenced by set_from_hex().
string HashVal::as_dec | ( | ) | const |
Returns the HashVal as a string with four decimal numbers.
Definition at line 116 of file hashVal.cxx.
References output_dec(), and set_from_dec().
Referenced by DownloadDb::get_hash(), and input_binary().
string HashVal::as_hex | ( | ) | const |
Returns the HashVal as a 32-byte hexadecimal string.
Definition at line 141 of file hashVal.cxx.
References set_from_hex().
Referenced by set_from_dec().
void HashVal::input_binary | ( | istream & | in | ) |
Inputs the HashVal as a binary stream of bytes in order.
This is not the same order expected by read_stream().
Definition at line 101 of file hashVal.cxx.
References as_dec(), and StreamReader::get_be_uint32().
Referenced by output_binary().
|
inline |
Inputs the HashVal as four unsigned decimal integers.
Definition at line 135 of file hashVal.I.
References StreamWriter::add_uint32(), Datagram::add_uint32(), StreamReader::get_uint32(), DatagramIterator::get_uint32(), and output_hex().
Referenced by output_dec(), and set_from_dec().
void HashVal::input_hex | ( | istream & | in | ) |
Inputs the HashVal as a 32-digit hexadecimal number.
Definition at line 46 of file hashVal.cxx.
References output_binary().
Referenced by output_hex(), and set_from_hex().
|
inline |
Generates a new HashVal representing the xor of this one and the other one.
Definition at line 111 of file hashVal.I.
References output_dec().
void HashVal::output_binary | ( | ostream & | out | ) | const |
Outputs the HashVal as a binary stream of bytes in order.
This is not the same order generated by write_stream().
Definition at line 85 of file hashVal.cxx.
References StreamWriter::add_be_uint32(), and input_binary().
Referenced by input_hex().
|
inline |
Outputs the HashVal as four unsigned decimal integers.
Definition at line 125 of file hashVal.I.
References input_dec().
Referenced by as_dec(), and merge_with().
void HashVal::output_hex | ( | ostream & | out | ) | const |
Outputs the HashVal as a 32-digit hexadecimal number.
Definition at line 31 of file hashVal.cxx.
References input_hex().
Referenced by input_dec(), and BamCache::list_index().
bool HashVal::set_from_bin | ( | const string & | text | ) |
Sets the HashVal from a 16-byte binary string.
Returns true if successful, false otherwise.
Definition at line 182 of file hashVal.cxx.
References VirtualFileSystem::close_read_file(), VirtualFileSystem::get_global_ptr(), and VirtualFileSystem::open_read_file().
Referenced by as_bin().
bool HashVal::set_from_dec | ( | const string & | text | ) |
Sets the HashVal from a string with four decimal numbers.
Returns true if valid, false otherwise.
Definition at line 129 of file hashVal.cxx.
References as_hex(), and input_dec().
Referenced by as_dec().
bool HashVal::set_from_hex | ( | const string & | text | ) |
Sets the HashVal from a 32-byte hexademical string.
Returns true if successful, false otherwise.
Definition at line 157 of file hashVal.cxx.
References as_bin(), and input_hex().
Referenced by as_hex().