Resolve remaining warnings

This commit is contained in:
Crzyrndm 2018-07-14 20:07:48 +12:00
parent ea850b32d5
commit 11573f45e6
5 changed files with 21 additions and 18 deletions

View File

@ -38,7 +38,7 @@ namespace xlnt {
class XLNT_API phonetic_pr class XLNT_API phonetic_pr
{ {
public: public:
static const std::string Serialised_ID; static std::string Serialised_ID();
/// <summary> /// <summary>
/// possible values for alignment property /// possible values for alignment property

View File

@ -46,6 +46,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-equal") # don't warn on uses of == for fp types set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-equal") # don't warn on uses of == for fp types
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-newline-eof") # no longer an issue with post-c++11 standards which mandate include add a newline if neccesary set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-newline-eof") # no longer an issue with post-c++11 standards which mandate include add a newline if neccesary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default") # default is often added to switches for completeness or to cover future alternatives set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-covered-switch-default") # default is often added to switches for completeness or to cover future alternatives
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors") # this is just a warning to notify that the destructor will run during exit
endif() endif()
if(STATIC_CRT) if(STATIC_CRT)

View File

@ -2749,7 +2749,7 @@ void xlsx_producer::write_worksheet(const relationship &rel)
if (ws.has_phonetic_properties()) if (ws.has_phonetic_properties())
{ {
write_start_element(xmlns, phonetic_pr::Serialised_ID); write_start_element(xmlns, phonetic_pr::Serialised_ID());
const auto &ph_props = ws.phonetic_properties(); const auto &ph_props = ws.phonetic_properties();
write_attribute("fontId", ph_props.font_id()); write_attribute("fontId", ph_props.font_id());
if (ph_props.has_type()) if (ph_props.has_type())
@ -2760,7 +2760,7 @@ void xlsx_producer::write_worksheet(const relationship &rel)
{ {
write_attribute("alignment", phonetic_pr::alignment_as_string(ph_props.alignment())); write_attribute("alignment", phonetic_pr::alignment_as_string(ph_props.alignment()));
} }
write_end_element(xmlns, phonetic_pr::Serialised_ID); write_end_element(xmlns, phonetic_pr::Serialised_ID());
} }
if (ws.has_page_margins()) if (ws.has_page_margins())

View File

@ -25,14 +25,13 @@
#include <array> #include <array>
namespace { namespace {
// Order of elements defined by phonetic_pr::Type enum // Order of elements defined by phonetic_pr::Type enum
const std::array<std::string, 4>& Types() const std::array<std::string, 4> &Types()
{ {
static const std::array<std::string, 4> types{ static const std::array<std::string, 4> types{
"fullwidthKatakana", std::string("fullwidthKatakana"),
"halfwidthKatakana", std::string("halfwidthKatakana"),
"Hiragana", std::string("Hiragana"),
"noConversion" std::string("noConversion")};
};
return types; return types;
} }
@ -40,10 +39,10 @@ const std::array<std::string, 4>& Types()
const std::array<std::string, 4> &Alignments() const std::array<std::string, 4> &Alignments()
{ {
static const std::array<std::string, 4> alignments{ static const std::array<std::string, 4> alignments{
"Center", std::string("Center"),
"Distributed", std::string("Distributed"),
"Left", std::string("Left"),
"NoControl"}; std::string("NoControl")};
return alignments; return alignments;
} }
@ -53,7 +52,10 @@ namespace xlnt {
/// <summary> /// <summary>
/// out of line initialiser for static const member /// out of line initialiser for static const member
/// </summary> /// </summary>
const std::string phonetic_pr::Serialised_ID = "phoneticPr"; std::string phonetic_pr::Serialised_ID()
{
return "phoneticPr";
}
phonetic_pr::phonetic_pr(font_id_t font) phonetic_pr::phonetic_pr(font_id_t font)
: font_id_(font) : font_id_(font)
@ -62,7 +64,7 @@ phonetic_pr::phonetic_pr(font_id_t font)
void phonetic_pr::serialise(std::ostream &output_stream) const void phonetic_pr::serialise(std::ostream &output_stream) const
{ {
output_stream << '<' << Serialised_ID << R"( fontID=")" << std::to_string(font_id_) << '"'; output_stream << '<' << Serialised_ID() << R"( fontID=")" << std::to_string(font_id_) << '"';
if (has_type()) if (has_type())
{ {
output_stream << R"( type=")" << type_as_string(type_.get()) << '"'; output_stream << R"( type=")" << type_as_string(type_.get()) << '"';
@ -117,7 +119,7 @@ void phonetic_pr::alignment(align align)
// serialisation // serialisation
const std::string &phonetic_pr::type_as_string(phonetic_pr::phonetic_type type) const std::string &phonetic_pr::type_as_string(phonetic_pr::phonetic_type type)
{ {
return Types()[static_cast<int>(type)]; return Types()[static_cast<std::size_t>(type)];
} }
phonetic_pr::phonetic_type phonetic_pr::type_from_string(const std::string &str) phonetic_pr::phonetic_type phonetic_pr::type_from_string(const std::string &str)
@ -134,7 +136,7 @@ phonetic_pr::phonetic_type phonetic_pr::type_from_string(const std::string &str)
const std::string &phonetic_pr::alignment_as_string(align type) const std::string &phonetic_pr::alignment_as_string(align type)
{ {
return Alignments()[static_cast<int>(type)]; return Alignments()[static_cast<std::size_t>(type)];
} }
phonetic_pr::align phonetic_pr::alignment_from_string(const std::string &str) phonetic_pr::align phonetic_pr::alignment_from_string(const std::string &str)

View File

@ -98,7 +98,7 @@ void worksheet::create_named_range(const std::string &name, const range_referenc
throw invalid_parameter(); //("named range name must be outside the range A1-XFD1048576"); throw invalid_parameter(); //("named range name must be outside the range A1-XFD1048576");
} }
} }
catch (xlnt::invalid_cell_reference) catch (xlnt::invalid_cell_reference&)
{ {
// name is not a valid reference, that's good // name is not a valid reference, that's good
} }