Panda3D
Public Member Functions | List of all members
HashVal Class Reference

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 &copy)
 
vector_uchar as_bin () const
 Returns the HashVal as a 16-byte binary string. More...
 
std::string as_dec () const
 Returns the HashVal as a string with four decimal numbers. More...
 
std::string as_hex () const
 Returns the HashVal as a 32-byte hexadecimal string. More...
 
int compare_to (const HashVal &other) const
 
void input_binary (std::istream &in)
 Inputs the HashVal as a binary stream of bytes in order. More...
 
void input_dec (std::istream &in)
 Inputs the HashVal as four unsigned decimal integers. More...
 
void input_hex (std::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 &copy)
 
bool operator== (const HashVal &other) const
 
void output (std::ostream &out) const
 
void output_binary (std::ostream &out) const
 Outputs the HashVal as a binary stream of bytes in order. More...
 
void output_dec (std::ostream &out) const
 Outputs the HashVal as four unsigned decimal integers. More...
 
void output_hex (std::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 vector_uchar &text)
 Sets the HashVal from a 16-byte binary string. More...
 
bool set_from_dec (const std::string &text)
 Sets the HashVal from a string with four decimal numbers. More...
 
bool set_from_hex (const std::string &text)
 Sets the HashVal from a 32-byte hexademical string. More...
 
void write_datagram (Datagram &destination) const
 
void write_stream (StreamWriter &destination) const
 

Detailed Description

Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer.

Definition at line 31 of file hashVal.h.

Member Function Documentation

◆ as_bin()

vector_uchar HashVal::as_bin ( ) const

Returns the HashVal as a 16-byte binary string.

Definition at line 153 of file hashVal.cxx.

References Datagram::get_data(), and Datagram::get_length().

◆ as_dec()

string HashVal::as_dec ( ) const

Returns the HashVal as a string with four decimal numbers.

Definition at line 108 of file hashVal.cxx.

References output_dec().

◆ as_hex()

string HashVal::as_hex ( ) const

Returns the HashVal as a 32-byte hexadecimal string.

Definition at line 129 of file hashVal.cxx.

◆ input_binary()

void HashVal::input_binary ( std::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 96 of file hashVal.cxx.

References StreamReader::get_be_uint32().

◆ input_dec()

void HashVal::input_dec ( std::istream &  in)
inline

Inputs the HashVal as four unsigned decimal integers.

Definition at line 111 of file hashVal.I.

Referenced by set_from_dec().

◆ input_hex()

void HashVal::input_hex ( std::istream &  in)

Inputs the HashVal as a 32-digit hexadecimal number.

Definition at line 47 of file hashVal.cxx.

Referenced by set_from_hex().

◆ merge_with()

void HashVal::merge_with ( const HashVal other)
inline

Generates a new HashVal representing the xor of this one and the other one.

Definition at line 92 of file hashVal.I.

◆ output_binary()

void HashVal::output_binary ( std::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 83 of file hashVal.cxx.

References StreamWriter::add_be_uint32().

◆ output_dec()

void HashVal::output_dec ( std::ostream &  out) const
inline

Outputs the HashVal as four unsigned decimal integers.

Definition at line 103 of file hashVal.I.

Referenced by as_dec().

◆ output_hex()

void HashVal::output_hex ( std::ostream &  out) const

Outputs the HashVal as a 32-digit hexadecimal number.

Definition at line 34 of file hashVal.cxx.

◆ set_from_bin()

bool HashVal::set_from_bin ( const vector_uchar &  text)

Sets the HashVal from a 16-byte binary string.

Returns true if successful, false otherwise.

Definition at line 164 of file hashVal.cxx.

◆ set_from_dec()

bool HashVal::set_from_dec ( const std::string &  text)

Sets the HashVal from a string with four decimal numbers.

Returns true if valid, false otherwise.

Definition at line 119 of file hashVal.cxx.

References input_dec().

◆ set_from_hex()

bool HashVal::set_from_hex ( const std::string &  text)

Sets the HashVal from a 32-byte hexademical string.

Returns true if successful, false otherwise.

Definition at line 143 of file hashVal.cxx.

References input_hex().


The documentation for this class was generated from the following files: