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
13namespace Tools::Ark {
14
15using Common::Error;
16
24class DataFile {
25public:
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;
56};
57
58} // namespace Tools::Ark
A compiled DataArray file (.txt.bin, .ui.bin), the form DataArray::ReadFile loads.
Definition datafile.h:24
std::vector< std::string > files
Definition datafile.h:54
static std::expected< DataFile, Error > parse(std::span< const std::uint8_t > data)
Parse a compiled file, plain or encrypted.
std::vector< std::uint8_t > serialize() const
Write the file in compiled form, encrypted with the seed when there is one.
static constexpr std::uint8_t kVersion
The version of the compiled format.
Definition datafile.h:27
std::optional< std::uint32_t > seed
Definition datafile.h:53
DataNode root
Definition datafile.h:55
std::int32_t fileIndex(const std::string &name)
Find the index of a source file name, adding the name when missing.
Readers and writers of Harmonix archives and compiled DataArray files.
Definition arkreader.h:14
One element of a DataArray, as a compiled DataArray file stores it.
Definition datanode.h:16