Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
InputFile.hpp
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of clio: https://github.com/XRPLF/clio
4
Copyright (c) 2025, the clio developers.
5
6
Permission to use, copy, modify, and distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#pragma once
21
22
#include "util/Shasum.hpp"
23
24
#include <xrpl/basics/base_uint.h>
25
26
#include <cstddef>
27
#include <cstring>
28
#include <fstream>
29
#include <iosfwd>
30
#include <string>
31
32
namespace
data::impl {
33
34
class
InputFile {
35
std::ifstream file_;
36
util::Sha256sum
shasum_;
37
38
public
:
39
InputFile(std::string
const
& path);
40
41
bool
42
isOpen()
const
;
43
44
template
<
typename
T>
45
bool
46
read(T& t)
47
{
48
return
readRaw(
reinterpret_cast<
char
*
>
(&t),
sizeof
(T));
49
}
50
51
bool
52
readRaw(
char
*
data
,
size_t
size);
53
54
ripple::uint256
55
hash()
const
;
56
};
57
}
// namespace data::impl
util::Sha256sum
Streaming SHA-256 hasher for large data sets.
Definition
Shasum.hpp:54
data
This namespace implements the data access layer and related components.
Definition
AmendmentCenter.cpp:70
src
data
impl
InputFile.hpp
Generated by
1.15.0