Skip to content

Commit

Permalink
fromXML() and parseDataFromString() are now UTF-8 only
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Sep 11, 2023
1 parent 6f93611 commit 08f16b3
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 74 deletions.
3 changes: 0 additions & 3 deletions six/modules/c++/cphd/include/cphd/CPHDXMLControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class CPHDXMLControl
*
* \return pointer to metadata object
*/
virtual std::unique_ptr<Metadata> fromXML(
const std::string& xmlString,
const std::vector<std::string>& schemaPaths = std::vector<std::string>());
virtual std::unique_ptr<Metadata> fromXML(
const std::u8string& xmlString,
const std::vector<std::filesystem::path>& schemaPaths = std::vector<std::filesystem::path>());
Expand Down
9 changes: 0 additions & 9 deletions six/modules/c++/cphd/source/CPHDXMLControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ std::unique_ptr<xml::lite::Document> CPHDXMLControl::toXMLImpl(const Metadata& m
}

/* FROM XML */
std::unique_ptr<Metadata> CPHDXMLControl::fromXML(const std::string& xmlString,
const std::vector<std::string>& schemaPaths_)
{
std::vector<std::filesystem::path> schemaPaths;
std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths),
[](const std::string& s) { return s; });

return fromXML(str::u8FromNative(xmlString), schemaPaths);
}
std::unique_ptr<Metadata> CPHDXMLControl::fromXML(const std::u8string& xmlString,
const std::vector<std::filesystem::path>& schemaPaths)
{
Expand Down
4 changes: 0 additions & 4 deletions six/modules/c++/six.sicd/include/six/sicd/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,6 @@ struct Utilities final
*
* \return Data representation of 'xmlStr'
*/
static std::unique_ptr<ComplexData> parseDataFromString(
const std::string& xmlStr,
const std::vector<std::string>& schemaPaths,
logging::Logger& log);
static std::unique_ptr<ComplexData> parseDataFromString(
const std::u8string& xmlStr,
const std::vector<std::filesystem::path>* pSchemaPaths,
Expand Down
13 changes: 0 additions & 13 deletions six/modules/c++/six.sicd/source/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,19 +1019,6 @@ std::unique_ptr<ComplexData> Utilities::parseDataFromFile(const std::filesystem:
return parser.fromXML(pathname);
}

std::unique_ptr<ComplexData> Utilities::parseDataFromString(
const std::string& xmlStr_,
const std::vector<std::string>& schemaPaths_,
logging::Logger& log)
{
const auto xmlStr = str::u8FromNative(xmlStr_);

std::vector<std::filesystem::path> schemaPaths;
std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths),
[](const std::string& s) { return s; });

return parseDataFromString(xmlStr, &schemaPaths, &log);
}
std::unique_ptr<ComplexData> Utilities::parseDataFromString(const std::u8string& xmlStr,
const std::vector<std::filesystem::path>* pSchemaPaths, logging::Logger* pLogger)
{
Expand Down
4 changes: 0 additions & 4 deletions six/modules/c++/six.sidd/include/six/sidd/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ class Utilities
*
* \return Data representation of 'xmlStr'
*/
static std::unique_ptr<DerivedData> parseDataFromString(
const std::string& xmlStr,
const std::vector<std::string>& schemaPaths,
logging::Logger& log);
static std::unique_ptr<DerivedData> parseDataFromString(
const std::u8string& xmlStr,
const std::vector<std::filesystem::path>* pSchemaPaths,
Expand Down
12 changes: 0 additions & 12 deletions six/modules/c++/six.sidd/source/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,6 @@ std::unique_ptr<DerivedData> Utilities::parseDataFromFile(const std::filesystem:
return dataParser.fromXML(pathname);
}

std::unique_ptr<DerivedData> Utilities::parseDataFromString(const std::string& xmlStr_,
const std::vector<std::string>& schemaPaths_, logging::Logger& log)
{
const auto xmlStr = str::u8FromNative(xmlStr_);

std::vector<std::filesystem::path> schemaPaths;
std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths),
[](const std::string& s) { return s; });

auto result = parseDataFromString(xmlStr, &schemaPaths, &log);
return std::unique_ptr<DerivedData>(result.release());
}
std::unique_ptr<DerivedData> Utilities::parseDataFromString(const std::u8string& xmlStr,
const std::vector<std::filesystem::path>* pSchemaPaths, logging::Logger* pLogger)
{
Expand Down
9 changes: 0 additions & 9 deletions six/modules/c++/six/include/six/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ std::unique_ptr<Data> parseDataFromFile(const XMLControlRegistry& xmlReg,
*
* \return Data representation of 'xmlStr'
*/
std::unique_ptr<Data> parseDataFromString(const XMLControlRegistry& xmlReg,
const std::string& xmlStr,
DataType dataType,
const std::vector<std::string>& schemaPaths,
logging::Logger& log);
std::unique_ptr<Data> parseDataFromString(const XMLControlRegistry& xmlReg,
const std::u8string& xmlStr,
DataType dataType,
Expand All @@ -297,10 +292,6 @@ std::unique_ptr<Data> parseDataFromString(const XMLControlRegistry& xmlReg,
*
* \return Data representation of 'xmlStr'
*/
std::unique_ptr<Data> parseDataFromString(const XMLControlRegistry& xmlReg,
const std::string& xmlStr,
const std::vector<std::string>& schemaPaths,
logging::Logger& log);
std::unique_ptr<Data> parseDataFromString(const XMLControlRegistry& xmlReg,
const std::u8string& xmlStr,
const std::vector<std::filesystem::path>* pSchemaPaths,
Expand Down
20 changes: 0 additions & 20 deletions six/modules/c++/six/source/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,6 @@ std::unique_ptr<Data> six::parseDataFromString(const XMLControlRegistry& xmlReg,
dataParser.preserveCharacterData(false); // existing behavior
return dataParser.fromXML(xmlStr, xmlReg, DataType::NOT_SET);
}
std::unique_ptr<Data> six::parseDataFromString(const XMLControlRegistry& xmlReg,
const std::string& xmlStr,
const std::vector<std::string>& schemaPaths,
logging::Logger& log)
{
return parseDataFromString(xmlReg, xmlStr, DataType::NOT_SET, schemaPaths, log);
}

std::unique_ptr<Data> six::parseDataFromString(
const XMLControlRegistry& xmlReg,
Expand All @@ -706,19 +699,6 @@ std::unique_ptr<Data> six::parseDataFromString(
dataParser.preserveCharacterData(false); // existing behavior
return dataParser.fromXML(xmlStr, xmlReg, dataType);
}
std::unique_ptr<Data> six::parseDataFromString(const XMLControlRegistry& xmlReg,
const std::string& xmlStr,
DataType dataType,
const std::vector<std::string>& schemaPaths_,
logging::Logger& log)
{
std::vector<std::filesystem::path> schemaPaths;
std::transform(schemaPaths_.begin(), schemaPaths_.end(), std::back_inserter(schemaPaths),
[](const std::string& s) { return s; });

auto result = parseDataFromString(xmlReg, str::u8FromNative(xmlStr), dataType, &schemaPaths, &log);
return std::unique_ptr<Data>(result.release());
}

std::string six::findSchemaPath(const std::string& progname)
{
Expand Down

0 comments on commit 08f16b3

Please sign in to comment.