V-Gears 0
Free Final Fantasy VII engine.
FieldTextWriter.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <vector>
19#include <memory>
20#include "common/TypeDefine.h"
21#include "common/Logger.h"
22
27
28 public:
29
37 void Begin(std::string file_name);
38
46 void Write(
47 const std::vector<u8>& script_section_buffer, std::string field_name, bool english = true
48 );
49
55 void End();
56
57 private:
58
64 void AddText(std::vector<unsigned char>& text);
65
73 u16 GetU16LE(u32 offset);
74
82 u8 GetU8(u32 offset);
83
87 std::unique_ptr<Logger> logger_;
88
92 std::vector<u8> data_;
93
97 bool tag_open_ = false;
98};
Ogre::uint16 u16
Definition: TypeDefine.h:22
Ogre::uint32 u32
Definition: TypeDefine.h:23
Ogre::uint8 u8
Definition: TypeDefine.h:21
Handles the.
Definition: FieldTextWriter.h:26
void End()
Finalizes the text file.
Definition: FieldTextWriter.cpp:323
void AddText(std::vector< unsigned char > &text)
Adds text.
Definition: FieldTextWriter.cpp:328
std::unique_ptr< Logger > logger_
The logger used to write text.
Definition: FieldTextWriter.h:87
u16 GetU16LE(u32 offset)
Reads 16 bytes of data from the data (little endian).
Definition: FieldTextWriter.cpp:39
u8 GetU8(u32 offset)
Reads 8 bytes of data from the data.
Definition: FieldTextWriter.cpp:44
void Begin(std::string file_name)
Initializes the text file.
Definition: FieldTextWriter.cpp:25
bool tag_open_
Indicates if the text XML tag has been opened and not closed.
Definition: FieldTextWriter.h:97
void Write(const std::vector< u8 > &script_section_buffer, std::string field_name, bool english=true)
Writes text to the XML file.
Definition: FieldTextWriter.cpp:49
std::vector< u8 > data_
The data being read.
Definition: FieldTextWriter.h:92