mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
clean up platform specific overloads
This commit is contained in:
parent
7d2e641966
commit
6a098d3049
@ -99,14 +99,6 @@ string string::from(std::uint64_t i)
|
|||||||
return string(std::to_string(i).c_str());
|
return string(std::to_string(i).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
template<>
|
|
||||||
string string::from(std::size_t i)
|
|
||||||
{
|
|
||||||
return string(std::to_string(i).c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string string::from(float i)
|
string string::from(float i)
|
||||||
{
|
{
|
||||||
@ -125,14 +117,6 @@ string string::from(long double i)
|
|||||||
return string(std::to_string(i).c_str());
|
return string(std::to_string(i).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XLNT_STD_STRING
|
|
||||||
template<>
|
|
||||||
string string::from(const std::string &s)
|
|
||||||
{
|
|
||||||
return string(s.data());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xlnt::string::iterator::iterator(xlnt::string *parent, size_type index)
|
xlnt::string::iterator::iterator(xlnt::string *parent, size_type index)
|
||||||
: parent_(parent),
|
: parent_(parent),
|
||||||
index_(index)
|
index_(index)
|
||||||
@ -281,12 +265,6 @@ string::string(const string &str, size_type offset, size_type len) : string()
|
|||||||
*code_point_byte_offsets_ = *part.code_point_byte_offsets_;
|
*code_point_byte_offsets_ = *part.code_point_byte_offsets_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XLNT_STD_STRING
|
|
||||||
string::string(const std::string &str) : string(str.data())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
string::string(const utf_mb_wide_string str) : string()
|
string::string(const utf_mb_wide_string str) : string()
|
||||||
{
|
{
|
||||||
auto iter = str;
|
auto iter = str;
|
||||||
@ -610,6 +588,10 @@ double string::to() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XLNT_STD_STRING
|
#ifdef XLNT_STD_STRING
|
||||||
|
string::string(const std::string &str) : string(str.data())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
std::string string::to() const
|
std::string string::to() const
|
||||||
{
|
{
|
||||||
@ -905,4 +887,44 @@ string::size_type string::length() const
|
|||||||
return code_point_byte_offsets_->size() - 1;
|
return code_point_byte_offsets_->size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
template<>
|
||||||
|
string string::from(unsigned long i)
|
||||||
|
{
|
||||||
|
return string(std::to_string(i).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
unsigned long string::to() const
|
||||||
|
{
|
||||||
|
return std::stoul(std::string(data()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux
|
||||||
|
template<>
|
||||||
|
string string::from(long long int i)
|
||||||
|
{
|
||||||
|
return string(std::to_string(i).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
string string::from(unsigned long long int i)
|
||||||
|
{
|
||||||
|
return string(std::to_string(i).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
long long int string::to() const
|
||||||
|
{
|
||||||
|
return std::stoll(std::string(data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
unsigned long long int string::to() const
|
||||||
|
{
|
||||||
|
return std::stoull(std::string(data()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user