P2P File Share
A simple peer-to-peer file sharing system.
Loading...
Searching...
No Matches
FileInfo Class Reference

#include <fileinfo.hpp>

Public Member Functions

 FileInfo (const std::string &name, size_t size, const std::vector< std::string > &pieces, const std::string &hash)
 
std::string to_string () const
 

Static Public Member Functions

static FileInfo from_string (const std::string &str)
 

Public Attributes

const std::string name
 The filename.
 
const size_t size
 The size of the file (in bytes)
 
const std::vector< std::string > pieces
 The list of SHA1 hashes of the pieces of the file Each piece is should be block_size bytes long.
 
const std::string hash
 The hash of the file Equivalent to the hash of the concatenation of the pieces.
 

Friends

bool operator== (const FileInfo &lhs, const FileInfo &rhs) noexcept
 

Constructor & Destructor Documentation

◆ FileInfo()

FileInfo::FileInfo ( const std::string & name,
size_t size,
const std::vector< std::string > & pieces,
const std::string & hash )
inline

Member Function Documentation

◆ from_string()

static FileInfo FileInfo::from_string ( const std::string & str)
inlinestatic

◆ to_string()

std::string FileInfo::to_string ( ) const
inline

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const FileInfo & lhs,
const FileInfo & rhs )
friend

Member Data Documentation

◆ hash

const std::string FileInfo::hash

The hash of the file Equivalent to the hash of the concatenation of the pieces.

◆ name

const std::string FileInfo::name

The filename.

◆ pieces

const std::vector<std::string> FileInfo::pieces

The list of SHA1 hashes of the pieces of the file Each piece is should be block_size bytes long.

◆ size

const size_t FileInfo::size

The size of the file (in bytes)


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