mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix windows build for dll and static lib
This commit is contained in:
parent
7b5246f9dd
commit
6aaf380c26
|
@ -60,6 +60,11 @@ SET(PUGIXML ../third-party/pugixml/src/pugixml.hpp ../third-party/pugixml/src/pu
|
|||
|
||||
if(SHARED)
|
||||
add_library(xlnt SHARED ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
|
||||
target_compile_definitions(xlnt PRIVATE XLNT_EXPORT=1)
|
||||
add_definitions(-DXLNT_SHARED)
|
||||
if(MSVC)
|
||||
set_target_properties(xlnt PROPERTIES COMPILE_FLAGS "/wd\"4251\"")
|
||||
endif()
|
||||
else()
|
||||
add_library(xlnt STATIC ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
|
||||
endif()
|
||||
|
@ -106,7 +111,7 @@ configure_file(
|
|||
IMMEDIATE @ONLY)
|
||||
|
||||
|
||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../include/xlnt
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../include/xlnt
|
||||
DESTINATION include
|
||||
PATTERN ".DS_Store" EXCLUDE
|
||||
)
|
||||
|
@ -116,7 +121,7 @@ install(TARGETS xlnt
|
|||
ARCHIVE DESTINATION ${LIB_DEST_DIR}
|
||||
)
|
||||
|
||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||
install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||
DESTINATION ${LIB_DEST_DIR}/pkgconfig
|
||||
)
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ source_group(runner FILES ${RUNNER})
|
|||
|
||||
target_link_libraries(xlnt.test xlnt)
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(xlnt.test PROPERTIES COMPILE_FLAGS "/wd\"4251\"")
|
||||
endif()
|
||||
|
||||
# Needed for PathFileExists in path_helper (test helper)
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
target_link_libraries(xlnt.test Shlwapi)
|
||||
|
|
|
@ -381,13 +381,19 @@ public:
|
|||
/// <summary>
|
||||
/// Return true if this cell is uninitialized.
|
||||
/// </summary>
|
||||
friend bool operator==(std::nullptr_t, const cell &cell);
|
||||
friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell);
|
||||
|
||||
/// <summary>
|
||||
/// Return the result of left.get_reference() < right.get_reference().
|
||||
/// What's the point of this?
|
||||
/// </summary>
|
||||
friend bool operator<(cell left, cell right);
|
||||
friend XLNT_FUNCTION bool operator<(const cell left, const cell right);
|
||||
|
||||
/// <summary>
|
||||
/// Convenience function for writing cell to an ostream.
|
||||
/// Uses cell::to_string() internally.
|
||||
/// </summary>
|
||||
friend XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell);
|
||||
|
||||
private:
|
||||
// make these friends so they can use the private constructor
|
||||
|
@ -406,13 +412,4 @@ private:
|
|||
detail::cell_impl *d_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Convenience function for writing cell to an ostream.
|
||||
/// Uses cell::to_string() internally.
|
||||
/// </summary>
|
||||
inline std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell)
|
||||
{
|
||||
return stream << std::string(cell.to_string().data());
|
||||
}
|
||||
|
||||
} // namespace xlnt
|
||||
|
|
|
@ -46,10 +46,10 @@ enum class target_mode
|
|||
/// Represents an association between a source Package or part, and a target object which can be a part or external
|
||||
/// resource.
|
||||
/// </summary>
|
||||
class relationship
|
||||
class XLNT_CLASS relationship
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
enum class XLNT_CLASS type
|
||||
{
|
||||
invalid,
|
||||
hyperlink,
|
||||
|
@ -140,17 +140,19 @@ class relationship
|
|||
}
|
||||
}
|
||||
|
||||
relationship();
|
||||
relationship(const string &t, const string &r_id = "", const string &target_uri = "")
|
||||
relationship();
|
||||
|
||||
relationship(const string &t, const string &r_id = "", const string &target_uri = "")
|
||||
: relationship(type_from_string(t), r_id, target_uri)
|
||||
{
|
||||
}
|
||||
relationship(type t, const string &r_id = "", const string &target_uri = "");
|
||||
|
||||
relationship(type t, const string &r_id = "", const string &target_uri = "");
|
||||
|
||||
/// <summary>
|
||||
/// gets a string that identifies the relationship.
|
||||
/// </summary>
|
||||
string get_id() const
|
||||
string get_id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
@ -158,7 +160,7 @@ class relationship
|
|||
/// <summary>
|
||||
/// gets the URI of the package or part that owns the relationship.
|
||||
/// </summary>
|
||||
string get_source_uri() const
|
||||
string get_source_uri() const
|
||||
{
|
||||
return source_uri_;
|
||||
}
|
||||
|
@ -166,7 +168,7 @@ class relationship
|
|||
/// <summary>
|
||||
/// gets a value that indicates whether the target of the relationship is or External to the Package.
|
||||
/// </summary>
|
||||
target_mode get_target_mode() const
|
||||
target_mode get_target_mode() const
|
||||
{
|
||||
return target_mode_;
|
||||
}
|
||||
|
@ -174,21 +176,22 @@ class relationship
|
|||
/// <summary>
|
||||
/// gets the URI of the target resource of the relationship.
|
||||
/// </summary>
|
||||
string get_target_uri() const
|
||||
string get_target_uri() const
|
||||
{
|
||||
return target_uri_;
|
||||
}
|
||||
|
||||
type get_type() const
|
||||
type get_type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
string get_type_string() const
|
||||
|
||||
string get_type_string() const
|
||||
{
|
||||
return type_to_string(type_);
|
||||
}
|
||||
|
||||
friend bool operator==(const relationship &left, const relationship &right)
|
||||
friend XLNT_FUNCTION bool operator==(const relationship &left, const relationship &right)
|
||||
{
|
||||
return left.type_ == right.type_
|
||||
&& left.id_ == right.id_
|
||||
|
|
|
@ -278,12 +278,12 @@ public:
|
|||
|
||||
bool operator<(const string &other) const;
|
||||
|
||||
friend void swap(string &left, string &right);
|
||||
friend std::ostream &operator<<(std::ostream &left, string &right);
|
||||
friend string operator+(const char *left, const string &right);
|
||||
friend XLNT_FUNCTION void swap(string &left, string &right);
|
||||
friend XLNT_FUNCTION std::ostream & operator<<(std::ostream &left, string &right);
|
||||
friend XLNT_FUNCTION string operator+(const char *left, const string &right);
|
||||
|
||||
friend bool operator==(const char *left, const string &right) { return right == left; }
|
||||
friend bool operator!=(const char *left, const string &right) { return right != left; }
|
||||
friend XLNT_FUNCTION bool operator==(const char *left, const string &right) { return right == left; }
|
||||
friend XLNT_FUNCTION bool operator!=(const char *left, const string &right) { return right != left; }
|
||||
|
||||
private:
|
||||
explicit string(size_type initial_size);
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace detail { struct workbook_impl; } // namespace detail
|
|||
class XLNT_CLASS workbook
|
||||
{
|
||||
public:
|
||||
class iterator
|
||||
class XLNT_CLASS iterator
|
||||
{
|
||||
public:
|
||||
iterator(workbook &wb, std::size_t index);
|
||||
|
@ -85,7 +85,7 @@ class XLNT_CLASS workbook
|
|||
std::size_t index_;
|
||||
};
|
||||
|
||||
class const_iterator
|
||||
class XLNT_CLASS const_iterator
|
||||
{
|
||||
public:
|
||||
const_iterator(const workbook &wb, std::size_t index);
|
||||
|
|
|
@ -18,7 +18,7 @@ class XLNT_CLASS cell_vector
|
|||
{
|
||||
public:
|
||||
template <bool is_const = true>
|
||||
class common_iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
|
||||
class XLNT_CLASS common_iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
|
||||
{
|
||||
public:
|
||||
common_iterator(worksheet ws, const cell_reference &start_cell, major_order order = major_order::row)
|
||||
|
|
|
@ -40,7 +40,7 @@ class XLNT_CLASS range
|
|||
{
|
||||
public:
|
||||
template <bool is_const = true>
|
||||
class common_iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
|
||||
class XLNT_CLASS common_iterator : public std::iterator<std::bidirectional_iterator_tag, cell>
|
||||
{
|
||||
public:
|
||||
common_iterator(worksheet ws, const range_reference &start_cell, major_order order = major_order::row)
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
// @author: see AUTHORS file
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
// Change these values for programs using this library.
|
||||
|
||||
namespace xlnt {
|
||||
|
@ -64,6 +62,8 @@ const limit_style LimitStyle = limit_style::openpyxl;
|
|||
#else
|
||||
#define XLNT_API __declspec(dllimport)
|
||||
#endif // XLNT_EXPORT
|
||||
#else
|
||||
#define XLNT_API
|
||||
#endif // XLNT_SHARED
|
||||
#else
|
||||
#define XLNT_API
|
||||
|
|
|
@ -810,116 +810,117 @@ bool cell::garbage_collectible() const
|
|||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(bool b)
|
||||
XLNT_FUNCTION void cell::set_value(bool b)
|
||||
{
|
||||
d_->value_numeric_ = b ? 1 : 0;
|
||||
d_->type_ = type::boolean;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::int8_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::int8_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::int16_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::int16_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::int32_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::int32_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::int64_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::int64_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::uint8_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::uint8_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::uint16_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::uint16_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::uint32_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::uint32_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(std::uint64_t i)
|
||||
XLNT_FUNCTION void cell::set_value(std::uint64_t i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
template <>
|
||||
void cell::set_value(unsigned long i)
|
||||
XLNT_FUNCTION void cell::set_value(unsigned long i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
#endif
|
||||
#endif // _MSC_VER
|
||||
|
||||
//TODO: base this on 64-bit model (i.e. LLP64/LP64) rather than system/compiler
|
||||
#ifdef __linux
|
||||
template <>
|
||||
void cell::set_value(long long i)
|
||||
XLNT_FUNCTION void cell::set_value(long long i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(unsigned long long i)
|
||||
XLNT_FUNCTION void cell::set_value(unsigned long long i)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(i);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
#endif
|
||||
#endif // __linux
|
||||
|
||||
template <>
|
||||
void cell::set_value(float f)
|
||||
XLNT_FUNCTION void cell::set_value(float f)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(f);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(double d)
|
||||
XLNT_FUNCTION void cell::set_value(double d)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(d);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(long double d)
|
||||
XLNT_FUNCTION void cell::set_value(long double d)
|
||||
{
|
||||
d_->value_numeric_ = static_cast<long double>(d);
|
||||
d_->type_ = type::numeric;
|
||||
}
|
||||
|
||||
template <>
|
||||
void XLNT_FUNCTION cell::set_value(string s)
|
||||
XLNT_FUNCTION void cell::set_value(string s)
|
||||
{
|
||||
d_->set_string(s, get_parent().get_parent().get_guess_types());
|
||||
|
||||
|
@ -930,13 +931,13 @@ void XLNT_FUNCTION cell::set_value(string s)
|
|||
}
|
||||
|
||||
template <>
|
||||
void XLNT_FUNCTION cell::set_value(char const *c)
|
||||
XLNT_FUNCTION void cell::set_value(char const *c)
|
||||
{
|
||||
set_value(string(c));
|
||||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(cell c)
|
||||
XLNT_FUNCTION void cell::set_value(cell c)
|
||||
{
|
||||
d_->type_ = c.d_->type_;
|
||||
d_->value_numeric_ = c.d_->value_numeric_;
|
||||
|
@ -949,7 +950,7 @@ void cell::set_value(cell c)
|
|||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(date d)
|
||||
XLNT_FUNCTION void cell::set_value(date d)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->value_numeric_ = d.to_number(get_base_date());
|
||||
|
@ -957,7 +958,7 @@ void cell::set_value(date d)
|
|||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(datetime d)
|
||||
XLNT_FUNCTION void cell::set_value(datetime d)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->value_numeric_ = d.to_number(get_base_date());
|
||||
|
@ -965,7 +966,7 @@ void cell::set_value(datetime d)
|
|||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(time t)
|
||||
XLNT_FUNCTION void cell::set_value(time t)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->value_numeric_ = t.to_number();
|
||||
|
@ -973,13 +974,21 @@ void cell::set_value(time t)
|
|||
}
|
||||
|
||||
template <>
|
||||
void cell::set_value(timedelta t)
|
||||
XLNT_FUNCTION void cell::set_value(timedelta t)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->value_numeric_ = t.to_number();
|
||||
set_number_format(number_format::date_timedelta());
|
||||
}
|
||||
|
||||
#ifdef XLNT_STD_STRING
|
||||
template<>
|
||||
XLNT_FUNCTION void cell::set_value(std::string str)
|
||||
{
|
||||
set_value(string(str.data()));
|
||||
}
|
||||
#endif
|
||||
|
||||
row_t cell::get_row() const
|
||||
{
|
||||
return d_->row_;
|
||||
|
@ -1044,11 +1053,21 @@ cell &cell::operator=(const cell &rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool operator<(cell left, cell right)
|
||||
XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell)
|
||||
{
|
||||
return cell == nullptr;
|
||||
}
|
||||
|
||||
XLNT_FUNCTION bool operator<(const cell left, const cell right)
|
||||
{
|
||||
return left.get_reference() < right.get_reference();
|
||||
}
|
||||
|
||||
XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell)
|
||||
{
|
||||
return stream << std::string(cell.to_string().data());
|
||||
}
|
||||
|
||||
string cell::to_repr() const
|
||||
{
|
||||
return "<Cell " + worksheet(d_->parent_).get_title() + "." + get_reference().to_string() + ">";
|
||||
|
@ -1309,105 +1328,105 @@ void cell::clear_value()
|
|||
}
|
||||
|
||||
template <>
|
||||
bool cell::get_value() const
|
||||
XLNT_FUNCTION bool cell::get_value() const
|
||||
{
|
||||
return d_->value_numeric_ != 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::int8_t cell::get_value() const
|
||||
XLNT_FUNCTION std::int8_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::int8_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::int16_t cell::get_value() const
|
||||
XLNT_FUNCTION std::int16_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::int16_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::int32_t cell::get_value() const
|
||||
XLNT_FUNCTION std::int32_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::int32_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::int64_t cell::get_value() const
|
||||
XLNT_FUNCTION std::int64_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::int64_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::uint8_t cell::get_value() const
|
||||
XLNT_FUNCTION std::uint8_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::uint8_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::uint16_t cell::get_value() const
|
||||
XLNT_FUNCTION std::uint16_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::uint16_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::uint32_t cell::get_value() const
|
||||
XLNT_FUNCTION std::uint32_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::uint32_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::uint64_t cell::get_value() const
|
||||
XLNT_FUNCTION std::uint64_t cell::get_value() const
|
||||
{
|
||||
return static_cast<std::uint64_t>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
#ifdef __linux
|
||||
template <>
|
||||
long long int cell::get_value() const
|
||||
XLNT_FUNCTION long long int cell::get_value() const
|
||||
{
|
||||
return static_cast<long long int>(d_->value_numeric_);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <>
|
||||
float cell::get_value() const
|
||||
XLNT_FUNCTION float cell::get_value() const
|
||||
{
|
||||
return static_cast<float>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
double cell::get_value() const
|
||||
XLNT_FUNCTION double cell::get_value() const
|
||||
{
|
||||
return static_cast<double>(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
long double cell::get_value() const
|
||||
XLNT_FUNCTION long double cell::get_value() const
|
||||
{
|
||||
return d_->value_numeric_;
|
||||
}
|
||||
|
||||
template <>
|
||||
time cell::get_value() const
|
||||
XLNT_FUNCTION time cell::get_value() const
|
||||
{
|
||||
return time::from_number(d_->value_numeric_);
|
||||
}
|
||||
|
||||
template <>
|
||||
datetime cell::get_value() const
|
||||
XLNT_FUNCTION datetime cell::get_value() const
|
||||
{
|
||||
return datetime::from_number(d_->value_numeric_, get_base_date());
|
||||
}
|
||||
|
||||
template <>
|
||||
date cell::get_value() const
|
||||
XLNT_FUNCTION date cell::get_value() const
|
||||
{
|
||||
return date::from_number(static_cast<int>(d_->value_numeric_), get_base_date());
|
||||
}
|
||||
|
||||
template <>
|
||||
timedelta cell::get_value() const
|
||||
XLNT_FUNCTION timedelta cell::get_value() const
|
||||
{
|
||||
return timedelta::from_number(d_->value_numeric_);
|
||||
}
|
||||
|
@ -1419,11 +1438,19 @@ void cell::set_number_format(const number_format &number_format_)
|
|||
}
|
||||
|
||||
template <>
|
||||
string cell::get_value() const
|
||||
XLNT_FUNCTION string cell::get_value() const
|
||||
{
|
||||
return d_->value_string_;
|
||||
}
|
||||
|
||||
#ifdef XLNT_STD_STRING
|
||||
template<>
|
||||
XLNT_FUNCTION std::string cell::get_value() const
|
||||
{
|
||||
return std::string(d_->value_string_.data());
|
||||
}
|
||||
#endif
|
||||
|
||||
bool cell::has_value() const
|
||||
{
|
||||
return d_->type_ != cell::type::null;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
relationship::relationship(type t, const string &r_id, const string &target_uri)
|
||||
XLNT_FUNCTION relationship::relationship(type t, const string &r_id, const string &target_uri)
|
||||
: type_(t), id_(r_id), source_uri_(""), target_uri_(target_uri), target_mode_(target_mode::internal)
|
||||
{
|
||||
if (t == type::hyperlink)
|
||||
|
@ -11,7 +11,7 @@ relationship::relationship(type t, const string &r_id, const string &target_uri)
|
|||
}
|
||||
}
|
||||
|
||||
relationship::relationship()
|
||||
XLNT_FUNCTION relationship::relationship()
|
||||
: type_(type::invalid), id_(""), source_uri_(""), target_uri_(""), target_mode_(target_mode::internal)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -99,11 +99,13 @@ string string::from(std::uint64_t i)
|
|||
return string(std::to_string(i).c_str());
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
template<>
|
||||
string string::from(std::size_t i)
|
||||
{
|
||||
return string(std::to_string(i).c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
template<>
|
||||
string string::from(float i)
|
||||
|
@ -213,8 +215,8 @@ xlnt::string::const_iterator &xlnt::string::const_iterator::operator++()
|
|||
|
||||
string::const_iterator &string::const_iterator::operator+=(int offset)
|
||||
{
|
||||
auto new_index = index_ + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(parent_->length(), new_index));
|
||||
auto new_index = static_cast<int>(index_) + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(static_cast<int>(parent_->length()), new_index));
|
||||
index_ = static_cast<std::size_t>(new_index);
|
||||
|
||||
return *this;
|
||||
|
@ -224,8 +226,8 @@ xlnt::string::iterator xlnt::string::iterator::operator+(int offset)
|
|||
{
|
||||
iterator copy = *this;
|
||||
|
||||
auto new_index = index_ + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(parent_->length(), new_index));
|
||||
auto new_index = static_cast<int>(index_) + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(static_cast<int>(parent_->length()), new_index));
|
||||
copy.index_ = static_cast<std::size_t>(new_index);
|
||||
|
||||
return copy;
|
||||
|
@ -235,8 +237,8 @@ xlnt::string::const_iterator xlnt::string::const_iterator::operator+(int offset)
|
|||
{
|
||||
const_iterator copy = *this;
|
||||
|
||||
auto new_index = index_ + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(parent_->length(), new_index));
|
||||
auto new_index = static_cast<int>(index_) + offset;
|
||||
new_index = std::max<int>(0, std::min<int>(static_cast<int>(parent_->length()), new_index));
|
||||
copy.index_ = static_cast<std::size_t>(new_index);
|
||||
|
||||
return copy;
|
||||
|
@ -378,10 +380,10 @@ string string::substr(size_type offset, size_type len) const
|
|||
{
|
||||
if(len != npos && offset + len < length())
|
||||
{
|
||||
return string(begin() + offset, begin() + (offset + len));
|
||||
return string(begin() + static_cast<int>(offset), begin() + static_cast<int>(offset + len));
|
||||
}
|
||||
|
||||
return string(begin() + offset, end());
|
||||
return string(begin() + static_cast<int>(offset), end());
|
||||
}
|
||||
|
||||
string::code_point string::back() const
|
||||
|
@ -411,7 +413,7 @@ string::size_type string::find(const string &str) const
|
|||
|
||||
string::size_type string::find(code_point c, size_type offset) const
|
||||
{
|
||||
auto iter = begin() + offset;
|
||||
auto iter = begin() + static_cast<int>(offset);
|
||||
|
||||
while (iter != end())
|
||||
{
|
||||
|
@ -464,7 +466,7 @@ string::size_type string::find_last_of(const string &str) const
|
|||
|
||||
string::size_type string::find_last_of(code_point c, size_type offset) const
|
||||
{
|
||||
auto stop = begin() + offset;
|
||||
auto stop = begin() + static_cast<int>(offset);
|
||||
auto iter = end() - 1;
|
||||
|
||||
while (iter != stop)
|
||||
|
@ -486,7 +488,7 @@ string::size_type string::find_last_of(char c, size_type offset) const
|
|||
|
||||
string::size_type string::find_last_of(const string &str, size_type offset) const
|
||||
{
|
||||
auto stop = begin() + offset;
|
||||
auto stop = begin() + static_cast<int>(offset);
|
||||
auto iter = end() - 1;
|
||||
|
||||
while (iter != stop)
|
||||
|
@ -509,7 +511,7 @@ string::size_type string::find_first_of(const string &str) const
|
|||
|
||||
string::size_type string::find_first_of(const string &str, size_type offset) const
|
||||
{
|
||||
auto iter = begin() + offset;
|
||||
auto iter = begin() + static_cast<int>(offset);
|
||||
|
||||
while (iter != end())
|
||||
{
|
||||
|
@ -531,7 +533,7 @@ string::size_type string::find_first_not_of(const string &str) const
|
|||
|
||||
string::size_type string::find_first_not_of(const string &str, size_type offset) const
|
||||
{
|
||||
auto iter = begin() + offset;
|
||||
auto iter = begin() + static_cast<int>(offset);
|
||||
|
||||
while (iter != end())
|
||||
{
|
||||
|
@ -553,7 +555,7 @@ string::size_type string::find_last_not_of(const string &str) const
|
|||
|
||||
string::size_type string::find_last_not_of(const string &str, size_type offset) const
|
||||
{
|
||||
auto stop = begin() + offset;
|
||||
auto stop = begin() + static_cast<int>(offset);
|
||||
auto iter = end() - 1;
|
||||
|
||||
while (iter != stop)
|
||||
|
@ -767,8 +769,8 @@ void string::replace(size_type index, utf32_char value)
|
|||
auto data_start = code_point_byte_offsets_->at(index);
|
||||
auto data_end = code_point_byte_offsets_->at(index + 1);
|
||||
|
||||
auto previous_len = data_end - data_start;
|
||||
int difference = encoded_len - previous_len;
|
||||
auto previous_len = static_cast<int>(data_end - data_start);
|
||||
int difference = static_cast<int>(encoded_len) - previous_len;
|
||||
|
||||
if(difference < 0)
|
||||
{
|
||||
|
@ -866,7 +868,7 @@ string &string::operator+=(const string &rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
void swap(string &left, string &right)
|
||||
XLNT_FUNCTION void swap(string &left, string &right)
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
|
@ -874,7 +876,7 @@ void swap(string &left, string &right)
|
|||
swap(left.code_point_byte_offsets_, right.code_point_byte_offsets_);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &left, string &right)
|
||||
XLNT_FUNCTION std::ostream &operator<<(std::ostream &left, string &right)
|
||||
{
|
||||
auto d = right.data();
|
||||
std::size_t i = 0;
|
||||
|
@ -888,12 +890,12 @@ std::ostream &operator<<(std::ostream &left, string &right)
|
|||
return left;
|
||||
}
|
||||
|
||||
string operator+(const char *left, const string &right)
|
||||
XLNT_FUNCTION string operator+(const char *left, const string &right)
|
||||
{
|
||||
return string(left) + right;
|
||||
}
|
||||
|
||||
bool string::operator<(const string &other) const
|
||||
XLNT_FUNCTION bool string::operator<(const string &other) const
|
||||
{
|
||||
return std::string(data()) < std::string(other.data());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user