diff --git a/include/xlnt/worksheet/phonetic_pr.hpp b/include/xlnt/worksheet/phonetic_pr.hpp index 592cb8e8..74561f9c 100644 --- a/include/xlnt/worksheet/phonetic_pr.hpp +++ b/include/xlnt/worksheet/phonetic_pr.hpp @@ -38,7 +38,7 @@ namespace xlnt { class XLNT_API phonetic_pr { public: - static const std::string Serialised_ID; + static std::string Serialised_ID(); /// /// possible values for alignment property diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 739d2c5a..24daabcc 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -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-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-exit-time-destructors") # this is just a warning to notify that the destructor will run during exit endif() if(STATIC_CRT) diff --git a/source/detail/serialization/xlsx_producer.cpp b/source/detail/serialization/xlsx_producer.cpp index d2c27a92..5d854d7d 100644 --- a/source/detail/serialization/xlsx_producer.cpp +++ b/source/detail/serialization/xlsx_producer.cpp @@ -2749,7 +2749,7 @@ void xlsx_producer::write_worksheet(const relationship &rel) 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(); write_attribute("fontId", ph_props.font_id()); 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_end_element(xmlns, phonetic_pr::Serialised_ID); + write_end_element(xmlns, phonetic_pr::Serialised_ID()); } if (ws.has_page_margins()) diff --git a/source/worksheet/phonetic_pr.cpp b/source/worksheet/phonetic_pr.cpp index 602fa01c..f046fa58 100644 --- a/source/worksheet/phonetic_pr.cpp +++ b/source/worksheet/phonetic_pr.cpp @@ -25,14 +25,13 @@ #include namespace { // Order of elements defined by phonetic_pr::Type enum -const std::array& Types() +const std::array &Types() { static const std::array types{ - "fullwidthKatakana", - "halfwidthKatakana", - "Hiragana", - "noConversion" - }; + std::string("fullwidthKatakana"), + std::string("halfwidthKatakana"), + std::string("Hiragana"), + std::string("noConversion")}; return types; } @@ -40,10 +39,10 @@ const std::array& Types() const std::array &Alignments() { static const std::array alignments{ - "Center", - "Distributed", - "Left", - "NoControl"}; + std::string("Center"), + std::string("Distributed"), + std::string("Left"), + std::string("NoControl")}; return alignments; } @@ -53,7 +52,10 @@ namespace xlnt { /// /// out of line initialiser for static const member /// -const std::string phonetic_pr::Serialised_ID = "phoneticPr"; +std::string phonetic_pr::Serialised_ID() +{ + return "phoneticPr"; +} phonetic_pr::phonetic_pr(font_id_t 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 { - 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()) { output_stream << R"( type=")" << type_as_string(type_.get()) << '"'; @@ -117,7 +119,7 @@ void phonetic_pr::alignment(align align) // serialisation const std::string &phonetic_pr::type_as_string(phonetic_pr::phonetic_type type) { - return Types()[static_cast(type)]; + return Types()[static_cast(type)]; } 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) { - return Alignments()[static_cast(type)]; + return Alignments()[static_cast(type)]; } phonetic_pr::align phonetic_pr::alignment_from_string(const std::string &str) diff --git a/source/worksheet/worksheet.cpp b/source/worksheet/worksheet.cpp index 9d59e895..5ab28fa1 100644 --- a/source/worksheet/worksheet.cpp +++ b/source/worksheet/worksheet.cpp @@ -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"); } } - catch (xlnt::invalid_cell_reference) + catch (xlnt::invalid_cell_reference&) { // name is not a valid reference, that's good }