liblcf
writer_lcf.h
Go to the documentation of this file.
1
/*
2
* This file is part of liblcf. Copyright (c) 2020 liblcf authors.
3
* https://github.com/EasyRPG/liblcf - https://easyrpg.org
4
*
5
* liblcf is Free/Libre Open Source Software, released under the MIT License.
6
* For the full copyright and license information, please view the COPYING
7
* file that was distributed with this source code.
8
*/
9
10
#ifndef LCF_WRITER_LCF_H
11
#define LCF_WRITER_LCF_H
12
13
#include <string>
14
#include <vector>
15
#include <iosfwd>
16
#include <cstring>
17
#include <memory>
18
#include <cassert>
19
#include <stdint.h>
20
#include "
lcf_options.h
"
21
#include "
reader_util.h
"
22
#include "
encoder.h
"
23
27
class
LcfWriter
{
28
29
public
:
36
LcfWriter
(std::ostream& filestream, std::string encoding =
""
);
37
41
~LcfWriter
();
42
50
void
Write
(
const
void
*ptr,
size_t
size,
size_t
nmemb);
51
57
template
<
class
T>
58
void
Write
(T val);
59
66
void
Write
(
const
std::string& str);
67
73
void
WriteInt
(
int
val);
74
80
template
<
class
T>
81
void
Write
(
const
std::vector<T>& buffer);
82
89
uint32_t
Tell
();
90
96
bool
IsOk
()
const
;
97
105
std::string
Decode
(
const
std::string& str_to_encode);
106
107
private
:
109
std::ostream&
stream
;
111
Encoder
encoder
;
112
118
static
void
SwapByteOrder
(int16_t &us);
119
125
static
void
SwapByteOrder
(uint16_t &us);
126
132
static
void
SwapByteOrder
(int32_t &us);
133
139
static
void
SwapByteOrder
(uint32_t &ui);
140
146
static
void
SwapByteOrder
(
double
&d);
147
148
};
149
150
#endif
encoder.h
LcfWriter::stream
std::ostream & stream
Definition:
writer_lcf.h:109
LcfWriter::WriteInt
void WriteInt(int val)
Definition:
writer_lcf.cpp:51
reader_util.h
lcf_options.h
LcfWriter::Decode
std::string Decode(const std::string &str_to_encode)
Definition:
writer_lcf.cpp:129
LcfWriter
Definition:
writer_lcf.h:27
LcfWriter::IsOk
bool IsOk() const
Definition:
writer_lcf.cpp:125
LcfWriter::Write
void Write(const void *ptr, size_t size, size_t nmemb)
Definition:
writer_lcf.cpp:24
Encoder
Definition:
encoder.h:15
LcfWriter::Tell
uint32_t Tell()
Definition:
writer_lcf.cpp:121
LcfWriter::Write
void Write(T val)
LcfWriter::encoder
Encoder encoder
Definition:
writer_lcf.h:111
LcfWriter::SwapByteOrder
static void SwapByteOrder(int16_t &us)
Definition:
writer_lcf.cpp:165
LcfWriter::~LcfWriter
~LcfWriter()
Definition:
writer_lcf.cpp:20
LcfWriter::Write
void Write(const std::vector< T > &buffer)
LcfWriter::LcfWriter
LcfWriter(std::ostream &filestream, std::string encoding="")
Definition:
writer_lcf.cpp:14
src
writer_lcf.h
Generated on Sun Aug 2 2020 00:00:00 for liblcf by
1.8.18