WriterLcf Decode - use StringView
MODIFY
src/lcf/writer_lcf.h
src/lcf/writer_lcf.h
@@ -107,8 +107,7 @@ public:
* @param str_to_encode UTF-8 string to encode.
* @return native version of string.
*/
- std::string Decode(const std::string& str_to_encode);
- std::string Decode(const DBString& str_to_encode);
+ std::string Decode(StringView str_to_encode);
private:
/** File-stream managed by this Writer. */

MODIFY
src/writer_lcf.cpp
src/writer_lcf.cpp
@@ -135,17 +135,12 @@ bool LcfWriter::IsOk() const {
return stream.good() && encoder.IsOk();
}
-std::string LcfWriter::Decode(const std::string& str) {
- auto copy = str;
+std::string LcfWriter::Decode(StringView str) {
+ auto copy = std::string(str);
encoder.Decode(copy);
return copy;
}
-std::string LcfWriter::Decode(const DBString& str) {
- // FIXME: String copy here
- return Decode(str.to_string());
-}
-
#ifdef WORDS_BIGENDIAN
void LcfWriter::SwapByteOrder(uint16_t& us)
{

WriterLcf Decode - use StringView