summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorljfa <ljfa-ag@web.de>2015-09-22 13:36:17 +0200
committerljfa <ljfa-ag@web.de>2015-09-22 15:43:47 +0200
commit9c63256baa6562c5e50431b555e1c3c8e867bdb7 (patch)
tree4a8ad9c89134c9d8f1b185b9bf8b1da64a700f83 /include
parentc178c3055257d1e0ff63229568eb507486d8ad36 (diff)
downloadProject-Tick-9c63256baa6562c5e50431b555e1c3c8e867bdb7.tar.gz
Project-Tick-9c63256baa6562c5e50431b555e1c3c8e867bdb7.zip
Add exports for shared libraries. Closes #7
Diffstat (limited to 'include')
-rw-r--r--include/endian_str.h81
-rw-r--r--include/io/izlibstream.h4
-rw-r--r--include/io/ozlibstream.h4
-rw-r--r--include/io/stream_reader.h8
-rw-r--r--include/io/stream_writer.h4
-rw-r--r--include/io/zlib_streambuf.h3
-rw-r--r--include/tag.h13
-rw-r--r--include/tag_compound.h2
-rw-r--r--include/tag_list.h6
-rw-r--r--include/tag_string.h2
-rw-r--r--include/text/json_formatter.h3
-rw-r--r--include/value.h6
-rw-r--r--include/value_initializer.h2
13 files changed, 71 insertions, 67 deletions
diff --git a/include/endian_str.h b/include/endian_str.h
index b1549bc27c..ca36835fd0 100644
--- a/include/endian_str.h
+++ b/include/endian_str.h
@@ -22,6 +22,7 @@
#include <cstdint>
#include <iosfwd>
+#include "nbt_export.h"
/**
* @brief Reading and writing numbers from and to streams
@@ -37,56 +38,56 @@ template<class T>
void read(std::istream& is, T& x, endian e);
///Reads number from stream in little endian
-void read_little(std::istream& is, uint8_t& x);
-void read_little(std::istream& is, uint16_t& x);
-void read_little(std::istream& is, uint32_t& x);
-void read_little(std::istream& is, uint64_t& x);
-void read_little(std::istream& is, int8_t& x);
-void read_little(std::istream& is, int16_t& x);
-void read_little(std::istream& is, int32_t& x);
-void read_little(std::istream& is, int64_t& x);
-void read_little(std::istream& is, float& x);
-void read_little(std::istream& is, double& x);
+NBT_EXPORT void read_little(std::istream& is, uint8_t& x);
+NBT_EXPORT void read_little(std::istream& is, uint16_t& x);
+NBT_EXPORT void read_little(std::istream& is, uint32_t& x);
+NBT_EXPORT void read_little(std::istream& is, uint64_t& x);
+NBT_EXPORT void read_little(std::istream& is, int8_t& x);
+NBT_EXPORT void read_little(std::istream& is, int16_t& x);
+NBT_EXPORT void read_little(std::istream& is, int32_t& x);
+NBT_EXPORT void read_little(std::istream& is, int64_t& x);
+NBT_EXPORT void read_little(std::istream& is, float& x);
+NBT_EXPORT void read_little(std::istream& is, double& x);
///Reads number from stream in big endian
-void read_big(std::istream& is, uint8_t& x);
-void read_big(std::istream& is, uint16_t& x);
-void read_big(std::istream& is, uint32_t& x);
-void read_big(std::istream& is, uint64_t& x);
-void read_big(std::istream& is, int8_t& x);
-void read_big(std::istream& is, int16_t& x);
-void read_big(std::istream& is, int32_t& x);
-void read_big(std::istream& is, int64_t& x);
-void read_big(std::istream& is, float& x);
-void read_big(std::istream& is, double& x);
+NBT_EXPORT void read_big(std::istream& is, uint8_t& x);
+NBT_EXPORT void read_big(std::istream& is, uint16_t& x);
+NBT_EXPORT void read_big(std::istream& is, uint32_t& x);
+NBT_EXPORT void read_big(std::istream& is, uint64_t& x);
+NBT_EXPORT void read_big(std::istream& is, int8_t& x);
+NBT_EXPORT void read_big(std::istream& is, int16_t& x);
+NBT_EXPORT void read_big(std::istream& is, int32_t& x);
+NBT_EXPORT void read_big(std::istream& is, int64_t& x);
+NBT_EXPORT void read_big(std::istream& is, float& x);
+NBT_EXPORT void read_big(std::istream& is, double& x);
///Writes number to stream in specified endian
template<class T>
void write(std::ostream& os, T x, endian e);
///Writes number to stream in little endian
-void write_little(std::ostream& os, uint8_t x);
-void write_little(std::ostream& os, uint16_t x);
-void write_little(std::ostream& os, uint32_t x);
-void write_little(std::ostream& os, uint64_t x);
-void write_little(std::ostream& os, int8_t x);
-void write_little(std::ostream& os, int16_t x);
-void write_little(std::ostream& os, int32_t x);
-void write_little(std::ostream& os, int64_t x);
-void write_little(std::ostream& os, float x);
-void write_little(std::ostream& os, double x);
+NBT_EXPORT void write_little(std::ostream& os, uint8_t x);
+NBT_EXPORT void write_little(std::ostream& os, uint16_t x);
+NBT_EXPORT void write_little(std::ostream& os, uint32_t x);
+NBT_EXPORT void write_little(std::ostream& os, uint64_t x);
+NBT_EXPORT void write_little(std::ostream& os, int8_t x);
+NBT_EXPORT void write_little(std::ostream& os, int16_t x);
+NBT_EXPORT void write_little(std::ostream& os, int32_t x);
+NBT_EXPORT void write_little(std::ostream& os, int64_t x);
+NBT_EXPORT void write_little(std::ostream& os, float x);
+NBT_EXPORT void write_little(std::ostream& os, double x);
///Writes number to stream in big endian
-void write_big(std::ostream& os, uint8_t x);
-void write_big(std::ostream& os, uint16_t x);
-void write_big(std::ostream& os, uint32_t x);
-void write_big(std::ostream& os, uint64_t x);
-void write_big(std::ostream& os, int8_t x);
-void write_big(std::ostream& os, int16_t x);
-void write_big(std::ostream& os, int32_t x);
-void write_big(std::ostream& os, int64_t x);
-void write_big(std::ostream& os, float x);
-void write_big(std::ostream& os, double x);
+NBT_EXPORT void write_big(std::ostream& os, uint8_t x);
+NBT_EXPORT void write_big(std::ostream& os, uint16_t x);
+NBT_EXPORT void write_big(std::ostream& os, uint32_t x);
+NBT_EXPORT void write_big(std::ostream& os, uint64_t x);
+NBT_EXPORT void write_big(std::ostream& os, int8_t x);
+NBT_EXPORT void write_big(std::ostream& os, int16_t x);
+NBT_EXPORT void write_big(std::ostream& os, int32_t x);
+NBT_EXPORT void write_big(std::ostream& os, int64_t x);
+NBT_EXPORT void write_big(std::ostream& os, float x);
+NBT_EXPORT void write_big(std::ostream& os, double x);
template<class T>
void read(std::istream& is, T& x, endian e)
diff --git a/include/io/izlibstream.h b/include/io/izlibstream.h
index 4c6d5def85..2b9b91a74a 100644
--- a/include/io/izlibstream.h
+++ b/include/io/izlibstream.h
@@ -31,7 +31,7 @@ namespace zlib
* @brief Stream buffer used by zlib::izlibstream
* @sa izlibstream
*/
-class inflate_streambuf : public zlib_streambuf
+class NBT_EXPORT inflate_streambuf : public zlib_streambuf
{
public:
/**
@@ -71,7 +71,7 @@ private:
* after the end of the compressed data.
* @sa inflate_streambuf
*/
-class izlibstream : public std::istream
+class NBT_EXPORT izlibstream : public std::istream
{
public:
/**
diff --git a/include/io/ozlibstream.h b/include/io/ozlibstream.h
index 78dd2c1684..65c97c7d69 100644
--- a/include/io/ozlibstream.h
+++ b/include/io/ozlibstream.h
@@ -31,7 +31,7 @@ namespace zlib
* @brief Stream buffer used by zlib::ozlibstream
* @sa ozlibstream
*/
-class deflate_streambuf : public zlib_streambuf
+class NBT_EXPORT deflate_streambuf : public zlib_streambuf
{
public:
/**
@@ -68,7 +68,7 @@ private:
*
* @sa deflate_streambuf
*/
-class ozlibstream : public std::ostream
+class NBT_EXPORT ozlibstream : public std::ostream
{
public:
/**
diff --git a/include/io/stream_reader.h b/include/io/stream_reader.h
index ba9708fe1c..469e18ce87 100644
--- a/include/io/stream_reader.h
+++ b/include/io/stream_reader.h
@@ -34,7 +34,7 @@ namespace io
{
///Exception that gets thrown when reading is not successful
-class input_error : public std::runtime_error
+class NBT_EXPORT input_error : public std::runtime_error
{
using std::runtime_error::runtime_error;
};
@@ -46,7 +46,7 @@ class input_error : public std::runtime_error
* of Minecraft uses Big Endian, the Pocket edition uses Little Endian
* @throw input_error on failure, or if the tag in the stream is not a compound
*/
-std::pair<std::string, std::unique_ptr<tag_compound>> read_compound(std::istream& is, endian::endian e = endian::big);
+NBT_EXPORT std::pair<std::string, std::unique_ptr<tag_compound>> read_compound(std::istream& is, endian::endian e = endian::big);
/**
* @brief Reads a named tag from the stream
@@ -55,14 +55,14 @@ std::pair<std::string, std::unique_ptr<tag_compound>> read_compound(std::istream
* of Minecraft uses Big Endian, the Pocket edition uses Little Endian
* @throw input_error on failure
*/
-std::pair<std::string, std::unique_ptr<tag>> read_tag(std::istream& is, endian::endian e = endian::big);
+NBT_EXPORT std::pair<std::string, std::unique_ptr<tag>> read_tag(std::istream& is, endian::endian e = endian::big);
/**
* @brief Helper class for reading NBT tags from input streams
*
* Can be reused to read multiple tags
*/
-class stream_reader
+class NBT_EXPORT stream_reader
{
public:
/**
diff --git a/include/io/stream_writer.h b/include/io/stream_writer.h
index cd3317849b..b10f03adfa 100644
--- a/include/io/stream_writer.h
+++ b/include/io/stream_writer.h
@@ -44,14 +44,14 @@ class output_error : public std::runtime_error
* @param e the byte order of the written data. The Java edition
* of Minecraft uses Big Endian, the Pocket edition uses Little Endian
*/
-void write_tag(const std::string& key, const tag& t, std::ostream& os, endian::endian e = endian::big);
+NBT_EXPORT void write_tag(const std::string& key, const tag& t, std::ostream& os, endian::endian e = endian::big);
/**
* @brief Helper class for writing NBT tags to output streams
*
* Can be reused to write multiple tags
*/
-class stream_writer
+class NBT_EXPORT stream_writer
{
public:
///Maximum length of an NBT string (16 bit unsigned)
diff --git a/include/io/zlib_streambuf.h b/include/io/zlib_streambuf.h
index e7bb780902..4241769e4e 100644
--- a/include/io/zlib_streambuf.h
+++ b/include/io/zlib_streambuf.h
@@ -5,12 +5,13 @@
#include <streambuf>
#include <vector>
#include <zlib.h>
+#include "nbt_export.h"
namespace zlib
{
///Exception thrown in case zlib encounters a problem
-class zlib_error : public std::runtime_error
+class NBT_EXPORT zlib_error : public std::runtime_error
{
public:
const int errcode;
diff --git a/include/tag.h b/include/tag.h
index a2ae49628e..35c71dfd30 100644
--- a/include/tag.h
+++ b/include/tag.h
@@ -23,6 +23,7 @@
#include <cstdint>
#include <iosfwd>
#include <memory>
+#include "nbt_export.h"
namespace nbt
{
@@ -49,7 +50,7 @@ enum class tag_type : int8_t
* @brief Returns whether the given number falls within the range of valid tag types
* @param allow_end whether to consider tag_type::End (0) valid
*/
-bool is_valid_type(int type, bool allow_end = false);
+NBT_EXPORT bool is_valid_type(int type, bool allow_end = false);
//Forward declarations
class nbt_visitor;
@@ -61,7 +62,7 @@ namespace io
}
///Base class for all NBT tag classes
-class tag
+class NBT_EXPORT tag
{
public:
//Virtual destructor
@@ -116,8 +117,8 @@ public:
*/
static std::unique_ptr<tag> create(tag_type type);
- friend bool operator==(const tag& lhs, const tag& rhs);
- friend bool operator!=(const tag& lhs, const tag& rhs);
+ friend NBT_EXPORT bool operator==(const tag& lhs, const tag& rhs);
+ friend NBT_EXPORT bool operator!=(const tag& lhs, const tag& rhs);
private:
/**
@@ -128,7 +129,7 @@ private:
};
///Output operator for tag types
-std::ostream& operator<<(std::ostream& os, tag_type tt);
+NBT_EXPORT std::ostream& operator<<(std::ostream& os, tag_type tt);
/**
* @brief Output operator for tags
@@ -136,7 +137,7 @@ std::ostream& operator<<(std::ostream& os, tag_type tt);
* Uses @ref text::json_formatter
* @relates tag
*/
-std::ostream& operator<<(std::ostream& os, const tag& t);
+NBT_EXPORT std::ostream& operator<<(std::ostream& os, const tag& t);
template<class T>
T& tag::as()
diff --git a/include/tag_compound.h b/include/tag_compound.h
index b1c4c996dc..3bbc1f2fb0 100644
--- a/include/tag_compound.h
+++ b/include/tag_compound.h
@@ -29,7 +29,7 @@ namespace nbt
{
///Tag that contains multiple unordered named tags of arbitrary types
-class tag_compound final : public detail::crtp_tag<tag_compound>
+class NBT_EXPORT tag_compound final : public detail::crtp_tag<tag_compound>
{
typedef std::map<std::string, value> map_t_;
diff --git a/include/tag_list.h b/include/tag_list.h
index 5ae505d4fc..c6a568ec36 100644
--- a/include/tag_list.h
+++ b/include/tag_list.h
@@ -40,7 +40,7 @@ namespace nbt
* will return tag_type::Null. The type will then be set when the first tag
* is added to the list.
*/
-class tag_list final : public detail::crtp_tag<tag_list>
+class NBT_EXPORT tag_list final : public detail::crtp_tag<tag_list>
{
public:
//Iterator types
@@ -174,8 +174,8 @@ public:
* Lists are considered equal if their content types and the contained tags
* are equal.
*/
- friend bool operator==(const tag_list& lhs, const tag_list& rhs);
- friend bool operator!=(const tag_list& lhs, const tag_list& rhs);
+ friend NBT_EXPORT bool operator==(const tag_list& lhs, const tag_list& rhs);
+ friend NBT_EXPORT bool operator!=(const tag_list& lhs, const tag_list& rhs);
private:
std::vector<value> tags;
diff --git a/include/tag_string.h b/include/tag_string.h
index dee47f5f97..f6c49fd5ad 100644
--- a/include/tag_string.h
+++ b/include/tag_string.h
@@ -27,7 +27,7 @@ namespace nbt
{
///Tag that contains a UTF-8 string
-class tag_string final : public detail::crtp_tag<tag_string>
+class NBT_EXPORT tag_string final : public detail::crtp_tag<tag_string>
{
public:
///The type of the tag
diff --git a/include/text/json_formatter.h b/include/text/json_formatter.h
index 4f3e434177..876caff086 100644
--- a/include/text/json_formatter.h
+++ b/include/text/json_formatter.h
@@ -22,6 +22,7 @@
#include "tagfwd.h"
#include <ostream>
+#include "nbt_export.h"
namespace nbt
{
@@ -33,7 +34,7 @@ namespace text
*
* @todo Make it configurable and able to produce actual standard-conformant JSON
*/
-class json_formatter
+class NBT_EXPORT json_formatter
{
public:
json_formatter() {}
diff --git a/include/value.h b/include/value.h
index d741c1f46a..fffe5cd3ec 100644
--- a/include/value.h
+++ b/include/value.h
@@ -57,7 +57,7 @@ namespace nbt
* This is why all the syntactic sugar for tags is contained in the value class
* while the tag class only contains common operations for all tag types.
*/
-class value
+class NBT_EXPORT value
{
public:
//Constructors
@@ -197,8 +197,8 @@ public:
///@sa tag::get_type
tag_type get_type() const;
- friend bool operator==(const value& lhs, const value& rhs);
- friend bool operator!=(const value& lhs, const value& rhs);
+ friend NBT_EXPORT bool operator==(const value& lhs, const value& rhs);
+ friend NBT_EXPORT bool operator!=(const value& lhs, const value& rhs);
private:
std::unique_ptr<tag> tag_;
diff --git a/include/value_initializer.h b/include/value_initializer.h
index 4ec0215740..20fd436e67 100644
--- a/include/value_initializer.h
+++ b/include/value_initializer.h
@@ -41,7 +41,7 @@ namespace nbt
* As value_initializer objects are in no way different than value objects,
* they can just be converted to value after construction.
*/
-class value_initializer : public value
+class NBT_EXPORT value_initializer : public value
{
public:
value_initializer(std::unique_ptr<tag>&& t) noexcept: value(std::move(t)) {}