/usr/include/x86_64-linux-gnu/zypp/CheckSum.h is in libzypp-dev 14.29.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/CheckSum.h
*
*/
#ifndef ZYPP_CHECKSUM_H
#define ZYPP_CHECKSUM_H
#include <iosfwd>
#include <string>
#include <sstream>
#include "zypp/base/Exception.h"
#include "zypp/Pathname.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
struct CheckSumException : public Exception
{
CheckSumException( const std::string & msg )
: Exception( msg )
{}
};
class CheckSum
{
public:
/** Default Ctor: empty checksum. */
CheckSum()
{}
/**
* Creates a checksum for algorithm \param type.
* \throws CheckSumException if the checksum is invalid and can't be constructed
*/
CheckSum( const std::string & type, const std::string & checksum );
/**
* Creates a checksum auto probing the algorithm type.
* \throws CheckSumException if the checksum is invalid and can't be constructed
*/
CheckSum( const std::string & checksum )
: CheckSum( std::string(), checksum )
{}
/**
* Reads the content of \param input_r and computes the checksum.
*/
CheckSum( const std::string & type, std::istream & input_r );
#ifndef SWIG // Swig treats it as syntax error0
/** Ctor from temporary istream */
CheckSum( const std::string & type, std::istream && input_r )
: CheckSum( type, input_r )
{}
#endif
public:
static const std::string & md5Type();
static const std::string & shaType();
static const std::string & sha1Type();
static const std::string & sha256Type();
/** \name Creates a checksum for algorithm \param type. */
//@{
static CheckSum md5( const std::string & checksum ) { return CheckSum( md5Type(), checksum); }
static CheckSum sha( const std::string & checksum ) { return CheckSum( shaType(), checksum); }
static CheckSum sha1( const std::string & checksum ) { return CheckSum( sha1Type(), checksum); }
static CheckSum sha256( const std::string & checksum ) { return CheckSum( sha256Type(), checksum); }
//@}
/** \name Reads the content of \param input_r and computes the checksum. */
//@{
static CheckSum md5( std::istream & input_r ) { return CheckSum( md5Type(), input_r ); }
static CheckSum sha( std::istream & input_r ) { return CheckSum( sha1Type(), input_r ); }
static CheckSum sha1( std::istream & input_r ) { return CheckSum( sha1Type(), input_r ); }
static CheckSum sha256( std::istream & input_r ) { return CheckSum( sha256Type(), input_r ); }
#ifndef SWIG // Swig treats it as syntax error
static CheckSum md5( std::istream && input_r ) { return CheckSum( md5Type(), input_r ); }
static CheckSum sha( std::istream && input_r ) { return CheckSum( sha1Type(), input_r ); }
static CheckSum sha1( std::istream && input_r ) { return CheckSum( sha1Type(), input_r ); }
static CheckSum sha256( std::istream && input_r ) { return CheckSum( sha256Type(), input_r ); }
#endif
//@}
/** \name Reads the content of \param input_r and computes the checksum. */
//@{
static CheckSum md5FromString( const std::string & input_r ) { return md5( std::stringstream( input_r ) ); }
static CheckSum shaFromString( const std::string & input_r ) { return sha( std::stringstream( input_r ) ); }
static CheckSum sha1FromString( const std::string & input_r ) { return sha1( std::stringstream( input_r ) ); }
static CheckSum sha256FromString( const std::string & input_r ) { return sha256( std::stringstream( input_r ) ); }
//@}
public:
std::string type() const;
std::string checksum() const;
bool empty() const;
public:
std::string asString() const;
private:
std::string _type;
std::string _checksum;
};
/** \relates CheckSum Stream output. */
std::ostream & operator<<( std::ostream & str, const CheckSum & obj );
/** \relates CheckSum XML output. */
std::ostream & dumpAsXmlOn( std::ostream & str, const CheckSum & obj );
/** \relates CheckSum */
bool operator==( const CheckSum & lhs, const CheckSum & rhs );
/** \relates CheckSum */
bool operator!=( const CheckSum & lhs, const CheckSum & rhs );
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_CHECKSUM_H
|