wavelength
1.0.0
Loading...
Searching...
No Matches
datafile.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
#include <expected>
5
#include <optional>
6
#include <span>
7
#include <string>
8
#include <vector>
9
10
#include "
datanode.h
"
11
#include "
error.h
"
12
13
namespace
Tools::Ark
{
14
15
using
Common::Error;
16
24
class
DataFile
{
25
public
:
27
static
constexpr
std::uint8_t
kVersion
= 2;
28
36
static
std::expected<DataFile, Error>
parse
(std::span<const std::uint8_t> data);
37
43
[[nodiscard]] std::vector<std::uint8_t>
serialize
()
const
;
44
51
std::int32_t
fileIndex
(
const
std::string &name);
52
53
std::optional<std::uint32_t>
seed
;
54
std::vector<std::string>
files
;
55
DataNode
root
;
56
};
57
58
}
// namespace Tools::Ark
Tools::Ark::DataFile
A compiled DataArray file (.txt.bin, .ui.bin), the form DataArray::ReadFile loads.
Definition
datafile.h:24
Tools::Ark::DataFile::files
std::vector< std::string > files
Definition
datafile.h:54
Tools::Ark::DataFile::parse
static std::expected< DataFile, Error > parse(std::span< const std::uint8_t > data)
Parse a compiled file, plain or encrypted.
Tools::Ark::DataFile::serialize
std::vector< std::uint8_t > serialize() const
Write the file in compiled form, encrypted with the seed when there is one.
Tools::Ark::DataFile::kVersion
static constexpr std::uint8_t kVersion
The version of the compiled format.
Definition
datafile.h:27
Tools::Ark::DataFile::seed
std::optional< std::uint32_t > seed
Definition
datafile.h:53
Tools::Ark::DataFile::root
DataNode root
Definition
datafile.h:55
Tools::Ark::DataFile::fileIndex
std::int32_t fileIndex(const std::string &name)
Find the index of a source file name, adding the name when missing.
datanode.h
error.h
Tools::Ark
Readers and writers of Harmonix archives and compiled DataArray files.
Definition
arkreader.h:14
Tools::Ark::DataNode
One element of a DataArray, as a compiled DataArray file stores it.
Definition
datanode.h:16
tools
ark
datafile.h
Generated by
1.15.0