export symbols on Windows

This commit is contained in:
Jiangang (Jeff) Zhuang
2017-01-04 15:09:05 -05:00
parent 09537c4e19
commit 4e44539a59

50
tz.h
View File

@@ -4,6 +4,7 @@
// The MIT License (MIT)
//
// Copyright (c) 2015, 2016 Howard Hinnant
// Copyright (c) 2017 Jiangang Zhuang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -73,6 +74,15 @@ static_assert(HAS_REMOTE_API == 0 ? AUTO_DOWNLOAD == 0 : true,
# define USE_SHELL_API 1
#endif
#ifdef _WIN32
#ifdef DATE_BUILD_DLL
#define DATE_API __declspec(dllexport)
#else
#define DATE_API __declspec(dllimport)
#endif
#endif
#include "date.h"
#if defined(_MSC_VER) && (_MSC_VER < 1900)
@@ -351,7 +361,7 @@ public:
time_zone& operator=(time_zone&& src);
#endif // defined(_MSC_VER) && (_MSC_VER < 1900)
explicit time_zone(const std::string& s, detail::undocumented);
DATE_API explicit time_zone(const std::string& s, detail::undocumented);
const std::string& name() const NOEXCEPT;
@@ -372,15 +382,15 @@ public:
friend bool operator==(const time_zone& x, const time_zone& y) NOEXCEPT;
friend bool operator< (const time_zone& x, const time_zone& y) NOEXCEPT;
friend std::ostream& operator<<(std::ostream& os, const time_zone& z);
friend DATE_API std::ostream& operator<<(std::ostream& os, const time_zone& z);
void add(const std::string& s);
void adjust_infos(const std::vector<detail::Rule>& rules);
DATE_API void add(const std::string& s);
DATE_API void adjust_infos(const std::vector<detail::Rule>& rules);
private:
sys_info get_info_impl(sys_seconds tp) const;
local_info get_info_impl(local_seconds tp) const;
sys_info get_info_impl(sys_seconds tp, int timezone) const;
DATE_API sys_info get_info_impl(sys_seconds tp) const;
DATE_API local_info get_info_impl(local_seconds tp) const;
DATE_API sys_info get_info_impl(sys_seconds tp, int timezone) const;
void parse_info(std::istream& in);
@@ -525,7 +535,7 @@ private:
std::string name_;
std::string target_;
public:
explicit link(const std::string& s);
DATE_API explicit link(const std::string& s);
const std::string& name() const {return name_;}
const std::string& target() const {return target_;}
@@ -533,7 +543,7 @@ public:
friend bool operator==(const link& x, const link& y) {return x.name_ == y.name_;}
friend bool operator< (const link& x, const link& y) {return x.name_ < y.name_;}
friend std::ostream& operator<<(std::ostream& os, const link& x);
friend DATE_API std::ostream& operator<<(std::ostream& os, const link& x);
};
inline bool operator!=(const link& x, const link& y) {return !(x == y);}
@@ -547,7 +557,7 @@ private:
sys_seconds date_;
public:
explicit leap(const std::string& s, detail::undocumented);
DATE_API explicit leap(const std::string& s, detail::undocumented);
sys_seconds date() const {return date_;}
@@ -578,7 +588,7 @@ public:
return x < y.date_;
}
friend std::ostream& operator<<(std::ostream& os, const leap& x);
friend DATE_API std::ostream& operator<<(std::ostream& os, const leap& x);
};
inline bool operator!=(const leap& x, const leap& y) {return !(x == y);}
@@ -751,25 +761,25 @@ struct TZ_DB
#endif // !defined(_MSC_VER) || (_MSC_VER >= 1900)
};
std::ostream&
DATE_API std::ostream&
operator<<(std::ostream& os, const TZ_DB& db);
const TZ_DB& get_tzdb();
const TZ_DB& reload_tzdb();
DATE_API const TZ_DB& get_tzdb();
DATE_API const TZ_DB& reload_tzdb();
#if HAS_REMOTE_API
std::string remote_version();
bool remote_download(const std::string& version);
bool remote_install(const std::string& version);
DATE_API std::string remote_version();
DATE_API bool remote_download(const std::string& version);
DATE_API bool remote_install(const std::string& version);
#endif
const time_zone* locate_zone(const std::string& tz_name);
DATE_API const time_zone* locate_zone(const std::string& tz_name);
#ifdef TZ_TEST
# if _WIN32
const time_zone* locate_native_zone(const std::string& native_tz_name);
DATE_API const time_zone* locate_native_zone(const std::string& native_tz_name);
# endif // _WIN32
#endif // TZ_TEST
const time_zone* current_zone();
DATE_API const time_zone* current_zone();
// zoned_time