Skip to content

Commit

Permalink
OrcLib: fix build for fmt 7.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienfl-orc committed Nov 9, 2020
1 parent a08a8f8 commit 12e27c6
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/OrcApacheOrcLib/ApacheOrcWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ STDMETHODIMP Orc::TableOutput::ApacheOrc::Writer::WriteCharArray(const WCHAR* sz
}

STDMETHODIMP
Orc::TableOutput::ApacheOrc::Writer::WriteFormated_(const std::wstring_view& szFormat, IOutput::wformat_args args)
Orc::TableOutput::ApacheOrc::Writer::WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args)
{
Buffer<WCHAR, MAX_PATH> buffer;

Expand Down Expand Up @@ -676,7 +676,7 @@ STDMETHODIMP Orc::TableOutput::ApacheOrc::Writer::WriteCharArray(const CHAR* szS
}

STDMETHODIMP
Orc::TableOutput::ApacheOrc::Writer::WriteFormated_(const std::string_view& szFormat, IOutput::format_args args)
Orc::TableOutput::ApacheOrc::Writer::WriteFormated_(const std::string_view& szFormat, fmt::format_args args)
{
Buffer<CHAR, MAX_PATH> buffer;

Expand Down
4 changes: 2 additions & 2 deletions src/OrcApacheOrcLib/ApacheOrcWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class Writer
STDMETHOD(WriteCharArray)(const WCHAR* szArray, DWORD dwCharCount) override final;

protected:
STDMETHOD(WriteFormated_)(const std::string_view& szFormat, IOutput::format_args args) override final;
STDMETHOD(WriteFormated_)(const std::wstring_view& szFormat, IOutput::wformat_args args) override final;
STDMETHOD(WriteFormated_)(const std::string_view& szFormat, fmt::format_args args) override final;
STDMETHOD(WriteFormated_)(const std::wstring_view& szFormat, fmt::wformat_args args) override final;

public:
STDMETHOD(WriteAttributes)(DWORD dwAttibutes) override final;
Expand Down
4 changes: 2 additions & 2 deletions src/OrcLib/BoundTableRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ HRESULT Orc::TableOutput::BoundColumn::WriteString(const std::string_view& svStr
return S_OK;
}

HRESULT Orc::TableOutput::BoundColumn::WriteFormated(const std::wstring_view& szFormat, IOutput::wformat_args args)
HRESULT Orc::TableOutput::BoundColumn::WriteFormated(const std::wstring_view& szFormat, fmt::wformat_args args)
{
HRESULT hr = E_FAIL;

Expand Down Expand Up @@ -281,7 +281,7 @@ HRESULT Orc::TableOutput::BoundColumn::WriteFormated(const std::wstring_view& sz
return S_OK;
}

HRESULT Orc::TableOutput::BoundColumn::WriteFormated(const std::string_view& szFormat, IOutput::format_args args)
HRESULT Orc::TableOutput::BoundColumn::WriteFormated(const std::string_view& szFormat, fmt::format_args args)
{
HRESULT hr = E_FAIL;

Expand Down
4 changes: 2 additions & 2 deletions src/OrcLib/BoundTableRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class BoundColumn : public Column
}
HRESULT WriteFormatedString(const CHAR* szFormat, ...);

HRESULT WriteFormated(const std::wstring_view& szFormat, IOutput::wformat_args args);
HRESULT WriteFormated(const std::string_view& szFormat, IOutput::format_args args);
HRESULT WriteFormated(const std::wstring_view& szFormat, fmt::wformat_args args);
HRESULT WriteFormated(const std::string_view& szFormat, fmt::format_args args);

HRESULT WriteAttributes(DWORD dwAttibutes);
HRESULT WriteFileTime(FILETIME fileTime);
Expand Down
4 changes: 2 additions & 2 deletions src/OrcLib/CsvFileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ STDMETHODIMP Orc::TableOutput::CSV::Writer::WriteNothing()
}

HRESULT
Orc::TableOutput::CSV::Writer::WriteFormated_(const std::wstring_view& szFormat, IOutput::wformat_args args)
Orc::TableOutput::CSV::Writer::WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args)
{
using namespace std::string_view_literals;

Expand All @@ -410,7 +410,7 @@ Orc::TableOutput::CSV::Writer::WriteFormated_(const std::wstring_view& szFormat,
return S_OK;
}

HRESULT Orc::TableOutput::CSV::Writer::WriteFormated_(const std::string_view& szFormat, IOutput::format_args args)
HRESULT Orc::TableOutput::CSV::Writer::WriteFormated_(const std::string_view& szFormat, fmt::format_args args)
{
Buffer<CHAR, MAX_PATH> buffer;
auto result = fmt::vformat_to(std::back_inserter(buffer), szFormat, args);
Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/CsvFileWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class ORCLIB_API Writer
}

protected:
HRESULT WriteFormated_(const std::wstring_view& szFormat, IOutput::wformat_args args) override final;
HRESULT WriteFormated_(const std::string_view& szFormat, IOutput::format_args args) override final;
HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) override final;
HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) override final;

public:
STDMETHOD(WriteAttributes)(DWORD dwAttibutes) override final;
Expand Down Expand Up @@ -297,11 +297,11 @@ class ORCLIB_API Writer
if (strFormat.find(L"\"{}\"") != std::wstring::npos)
{
auto escapedBuffer = EscapeQuoteInserter(m_buffer);
fmt::format_to(std::back_inserter(escapedBuffer), strFormat, args...);
fmt::format_to(std::back_inserter(escapedBuffer), strFormat, std::forward<Args>(args)...);
}
else
{
fmt::format_to(m_buffer, strFormat, args...);
fmt::format_to(m_buffer, strFormat, std::forward<Args>(args)...);
}
}
catch (const fmt::format_error& error)
Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/JSONOutputWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::EndCollection(LP
template <class _RapidWriter, typename _Ch>
HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::WriteFormated_(
const std::wstring_view& szFormat,
wformat_args args)
fmt::wformat_args args)
{
Buffer<WCHAR, MAX_PATH> buffer;
auto result = fmt::vformat_to(std::back_inserter(buffer), szFormat, args);
Expand All @@ -126,7 +126,7 @@ HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::WriteFormated_(
template <class _RapidWriter, typename _Ch>
HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::WriteFormated_(
const std::string_view& szFormat,
format_args args)
fmt::format_args args)
{
Buffer<CHAR, MAX_PATH> buffer;
auto result = fmt::vformat_to(std::back_inserter(buffer), szFormat, args);
Expand All @@ -144,7 +144,7 @@ template <class _RapidWriter, typename _Ch>
HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::WriteNamedFormated_(
LPCWSTR szName,
const std::wstring_view& szFormat,
wformat_args args)
fmt::wformat_args args)
{
rapidWriter.Key(szName);
WriteFormated_(szFormat, args);
Expand All @@ -155,7 +155,7 @@ template <class _RapidWriter, typename _Ch>
HRESULT Orc::StructuredOutput::JSON::Writer<_RapidWriter, _Ch>::WriteNamedFormated_(
LPCWSTR szName,
const std::string_view& szFormat,
format_args args)
fmt::format_args args)
{
rapidWriter.Key(szName);
WriteFormated_(szFormat, args);
Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/JSONOutputWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ class Writer : public StructuredOutput::Writer
HRESULT WriteNamed_(LPCWSTR szName, Args&&... args);

protected:
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, wformat_args args) override final;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, format_args args) override final;
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) override final;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) override final;
virtual HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, wformat_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, fmt::wformat_args args) override final;
virtual HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, format_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, fmt::format_args args) override final;
};

std::shared_ptr<StructuredOutput::IWriter>
Expand Down
9 changes: 5 additions & 4 deletions src/OrcLib/RobustStructuredWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ HRESULT RobustStructuredWriter::EndCollection(LPCWSTR szCollection)
return m_pWriter->EndCollection(strElt.c_str());
}

HRESULT RobustStructuredWriter::WriteFormated_(const std::wstring_view& szFormat, wformat_args args)
HRESULT RobustStructuredWriter::WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args)
{
using namespace std::string_view_literals;

Expand All @@ -77,7 +77,7 @@ HRESULT RobustStructuredWriter::WriteFormated_(const std::wstring_view& szFormat
return Write(result_string);
}

HRESULT RobustStructuredWriter::WriteFormated_(const std::string_view& szFormat, format_args args)
HRESULT RobustStructuredWriter::WriteFormated_(const std::string_view& szFormat, fmt::format_args args)
{
using namespace std::string_view_literals;

Expand All @@ -93,7 +93,7 @@ HRESULT RobustStructuredWriter::WriteFormated_(const std::string_view& szFormat,
}

HRESULT
RobustStructuredWriter::WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, wformat_args args)
RobustStructuredWriter::WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, fmt::wformat_args args)
{
using namespace std::string_view_literals;

Expand All @@ -108,7 +108,8 @@ RobustStructuredWriter::WriteNamedFormated_(LPCWSTR szName, const std::wstring_v
return WriteNamed(szName, result_string);
}

HRESULT RobustStructuredWriter::WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, format_args args)
HRESULT
RobustStructuredWriter::WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, fmt::format_args args)
{
using namespace std::string_view_literals;

Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/RobustStructuredWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ class ORCLIB_API RobustStructuredWriter : public StructuredOutputWriter
virtual ~RobustStructuredWriter();

protected:
HRESULT WriteFormated_(const std::wstring_view& szFormat, wformat_args args) override final;
HRESULT WriteFormated_(const std::string_view& szFormat, format_args args) override final;
HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) override final;
HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) override final;
HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, wformat_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, fmt::wformat_args args) override final;
HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, format_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, fmt::format_args args) override final;
};

} // namespace Orc
Expand Down
26 changes: 8 additions & 18 deletions src/OrcLib/StructuredOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,35 @@ class IOutput

#ifndef __cplusplus_cli

using wformat_iterator = std::back_insert_iterator<Buffer<WCHAR, MAX_PATH>>;
using wformat_args = fmt::format_args_t<wformat_iterator, wchar_t>;

template <typename... Args>
HRESULT WriteFormated(const std::wstring_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<wformat_iterator, WCHAR>;
return WriteFormated_(szFormat, fmt::make_format_args<context>(args...));
return WriteFormated_(szFormat, fmt::make_format_args<fmt::wformat_context>(args...));
}

template <typename... Args>
HRESULT WriteNamedFormated(LPCWSTR szName, const std::wstring_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<wformat_iterator, WCHAR>;
return WriteNamedFormated_(szName, szFormat, fmt::make_format_args<context>(args...));
return WriteNamedFormated_(szName, szFormat, fmt::make_format_args<fmt::wformat_context>(args...));
}

using format_iterator = std::back_insert_iterator<Buffer<CHAR, MAX_PATH>>;
using format_args = fmt::format_args_t<format_iterator, CHAR>;

template <typename... Args>
HRESULT WriteFormated(const std::string_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<format_iterator, CHAR>;
return WriteFormated_(szFormat, fmt::make_format_args<context>(args...));
return WriteFormated_(szFormat, fmt::make_format_args(args...));
}

template <typename... Args>
HRESULT WriteNamedFormated(LPCWSTR szName, const std::string_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<format_iterator, CHAR>;
return WriteNamedFormated_(szName, szFormat, fmt::make_format_args<context>(args...));
return WriteNamedFormated_(szName, szFormat, fmt::make_format_args(args...));
}

protected:
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, wformat_args args) PURE;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, format_args args) PURE;
virtual HRESULT WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, wformat_args args) PURE;
virtual HRESULT WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, format_args args) PURE;
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) PURE;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) PURE;
virtual HRESULT WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, fmt::wformat_args args) PURE;
virtual HRESULT WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, fmt::format_args args) PURE;

#endif
};
Expand Down
15 changes: 4 additions & 11 deletions src/OrcLib/TableOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,29 +301,22 @@ class IOutput

#ifndef __cplusplus_cli

using wformat_iterator = std::back_insert_iterator<Buffer<WCHAR, MAX_PATH>>;
using wformat_args = fmt::format_args_t<wformat_iterator, wchar_t>;

template <typename... Args>
HRESULT WriteFormated(const std::wstring_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<wformat_iterator, WCHAR>;
return WriteFormated_(szFormat, fmt::make_format_args<context>(args...));
return WriteFormated_(szFormat, fmt::make_format_args<fmt::wformat_context>(args...));
}

using format_iterator = std::back_insert_iterator<Buffer<CHAR, MAX_PATH>>;
using format_args = fmt::format_args_t<format_iterator, CHAR>;

template <typename... Args>
HRESULT WriteFormated(const std::string_view& szFormat, Args&&... args)
{
using context = fmt::basic_format_context<format_iterator, CHAR>;
return WriteFormated_(szFormat, fmt::make_format_args<context>(args...));
return WriteFormated_(szFormat, fmt::make_format_args(args...));
}

protected:
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, wformat_args args) PURE;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, format_args args) PURE;
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) PURE;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) PURE;

#endif
};
Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/XmlOutputWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ HRESULT Orc::StructuredOutput::XML::Writer::WriteNamed(LPCWSTR szName, LPCWSTR s
return S_OK;
}

HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::wstring_view& szFormat, wformat_args args)
HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args)
{
using namespace std::string_view_literals;

Expand Down Expand Up @@ -267,7 +267,7 @@ HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::wstring_vi
return S_OK;
}

HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::string_view& szFormat, format_args args)
HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::string_view& szFormat, fmt::format_args args)
{
using namespace std::string_view_literals;

Expand Down Expand Up @@ -310,7 +310,7 @@ HRESULT Orc::StructuredOutput::XML::Writer::WriteFormated_(const std::string_vie
HRESULT Orc::StructuredOutput::XML::Writer::WriteNamedFormated_(
LPCWSTR szName,
const std::wstring_view& szFormat,
wformat_args args)
fmt::wformat_args args)
{
using namespace std::string_view_literals;

Expand All @@ -332,7 +332,7 @@ HRESULT Orc::StructuredOutput::XML::Writer::WriteNamedFormated_(
HRESULT Orc::StructuredOutput::XML::Writer::WriteNamedFormated_(
LPCWSTR szName,
const std::string_view& szFormat,
format_args args)
fmt::format_args args)
{
using namespace std::string_view_literals;

Expand Down
8 changes: 4 additions & 4 deletions src/OrcLib/XmlOutputWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ class Writer : public StructuredOutput::Writer
~Writer();

protected:
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, wformat_args args) override final;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, format_args args) override final;
virtual HRESULT WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args) override final;
virtual HRESULT WriteFormated_(const std::string_view& szFormat, fmt::format_args args) override final;
virtual HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, wformat_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::wstring_view& szFormat, fmt::wformat_args args) override final;
virtual HRESULT
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, format_args args) override final;
WriteNamedFormated_(LPCWSTR szName, const std::string_view& szFormat, fmt::format_args args) override final;

private:
template <typename... Args>
Expand Down
4 changes: 2 additions & 2 deletions src/OrcParquetLib/ParquetWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ STDMETHODIMP Orc::TableOutput::Parquet::Writer::WriteCharArray(const WCHAR* szSt
}

STDMETHODIMP
Orc::TableOutput::Parquet::Writer::WriteFormated_(const std::wstring_view& szFormat, IOutput::wformat_args args)
Orc::TableOutput::Parquet::Writer::WriteFormated_(const std::wstring_view& szFormat, fmt::wformat_args args)
{
Buffer<WCHAR, MAX_PATH> buffer;

Expand Down Expand Up @@ -703,7 +703,7 @@ STDMETHODIMP Orc::TableOutput::Parquet::Writer::WriteCharArray(const CHAR* szStr
}

STDMETHODIMP
Orc::TableOutput::Parquet::Writer::WriteFormated_(const std::string_view& szFormat, IOutput::format_args args)
Orc::TableOutput::Parquet::Writer::WriteFormated_(const std::string_view& szFormat, fmt::format_args args)
{
Buffer<CHAR, MAX_PATH> buffer;

Expand Down
4 changes: 2 additions & 2 deletions src/OrcParquetLib/ParquetWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class Writer
STDMETHOD(WriteCharArray)(const WCHAR* szArray, DWORD dwCharCount) override final;

protected:
STDMETHOD(WriteFormated_)(const std::string_view& szFormat, IOutput::format_args args) override final;
STDMETHOD(WriteFormated_)(const std::wstring_view& szFormat, IOutput::wformat_args args) override final;
STDMETHOD(WriteFormated_)(const std::string_view& szFormat, fmt::format_args args) override final;
STDMETHOD(WriteFormated_)(const std::wstring_view& szFormat, fmt::wformat_args args) override final;

public:
STDMETHOD(WriteAttributes)(DWORD dwAttibutes) override final;
Expand Down

0 comments on commit 12e27c6

Please sign in to comment.