37static const char hexChars[] =
"0123456789abcdef";
66 else if (!isxdigit(c))
69 <<
"Illegal hex digit: '" << c <<
"'"
81bool Foam::SHA1Digest::isEqual(
const char* hexdigits, std::size_t len)
const
84 if (*hexdigits ==
'_')
91 if (len != 2*dig_.size())
96 for (
const auto& byteVal : dig_)
98 const char upp =
hexChars[((byteVal >> 4) & 0xF)];
99 const char low =
hexChars[(byteVal & 0xF)];
101 if (upp != *hexdigits++)
return false;
102 if (low != *hexdigits++)
return false;
134 for (
const auto& byteVal : dig_)
148 for (
auto& byteVal : dig_)
153 byteVal = (upp << 4) + low;
164 std::size_t nChar = 0;
168 buf.resize(1 + 2*dig_.size());
173 buf.resize(2*dig_.size());
176 for (
const auto& byteVal : dig_)
178 buf[nChar++] =
hexChars[((byteVal >> 4) & 0xF)];
179 buf[nChar++] =
hexChars[(byteVal & 0xF)];
193 for (
const auto& byteVal : dig_)
208 return (dig_ == rhs.dig_);
215 if (hexdigits.empty())
220 return isEqual(hexdigits.data(), hexdigits.length());
227 if (!hexdigits || !*hexdigits)
232 return isEqual(hexdigits, std::char_traits<char>::length(hexdigits));
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
static const char hexChars[]
static constexpr int offsetAlpha
static constexpr int offsetZero
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual Istream & read(token &)=0
Return next token from stream.
virtual Ostream & write(const char c)
Write character.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool read()
Re-read model coefficients if they have changed.
bool empty() const
Return true if the digest is empty (ie, all zero).
SHA1Digest()
Default construct a zero digest.
Ostream & write(Ostream &os, const bool prefixed=false) const
Write (40-byte) text representation, optionally with '_' prefix.
void clear()
Reset the digest to zero.
static const SHA1Digest null
A null digest (ie, all zero)
Istream & read(Istream &is)
Read (40-byte) text representation.
virtual bool write()
Write the output fields.
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
const word & str() const
The string representation of the volume type enumeration.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
bool read(const char *buf, int32_t &val)
Same as readInt32.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
static unsigned char readHexDigit(Istream &is)
errorManipArg< error, int > exit(error &err, const int errNo=1)