Skip to content

Commit 8dd4320

Browse files
committed
revert some interface changes; fix downstream test
1 parent b5da054 commit 8dd4320

5 files changed

Lines changed: 13 additions & 15 deletions

File tree

src/odr/internal/util/odr_meta_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ nlohmann::json meta_to_json(const FileMeta &meta) {
1111
nlohmann::json result;
1212

1313
result["fileType"] = odr::file_type_to_string(meta.type);
14-
result["fileCategory"] = odr::file_category_to_string(
15-
odr::get_file_category_by_file_type(meta.type));
14+
result["fileCategory"] =
15+
odr::file_category_to_string(odr::file_category_by_file_type(meta.type));
1616
result["isEncrypted"] = meta.password_encrypted;
1717

1818
if (meta.document_meta) {

src/odr/odr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ std::string odr::get_commit() noexcept {
1616
}
1717

1818
odr::FileType
19-
odr::get_file_type_by_file_extension(const std::string &extension) noexcept {
19+
odr::file_type_by_file_extension(const std::string &extension) noexcept {
2020
if (extension == "zip") {
2121
return FileType::zip;
2222
} else if (extension == "cfb") {
@@ -70,7 +70,7 @@ odr::get_file_type_by_file_extension(const std::string &extension) noexcept {
7070
}
7171

7272
odr::FileCategory
73-
odr::get_file_category_by_file_type(const FileType type) noexcept {
73+
odr::file_category_by_file_type(const FileType type) noexcept {
7474
switch (type) {
7575
case FileType::zip:
7676
case FileType::compound_file_binary_format:
@@ -204,7 +204,7 @@ std::string odr::decoder_engine_to_string(const DecoderEngine engine) {
204204
throw UnknownDecoderEngine();
205205
}
206206

207-
odr::DecoderEngine odr::get_decoder_engine_by_name(const std::string &name) {
207+
odr::DecoderEngine odr::decoder_engine_by_name(const std::string &name) {
208208
if (name == "odr") {
209209
return DecoderEngine::odr;
210210
} else if (name == "poppler") {

src/odr/odr.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ enum class DocumentType;
2323
/// @param extension The file extension.
2424
/// @return The file type.
2525
[[nodiscard]] FileType
26-
get_file_type_by_file_extension(const std::string &extension) noexcept;
26+
file_type_by_file_extension(const std::string &extension) noexcept;
2727
/// @brief Get the file category by the file type.
2828
/// @param type The file type.
2929
/// @return The file category.
30-
[[nodiscard]] FileCategory
31-
get_file_category_by_file_type(FileType type) noexcept;
30+
[[nodiscard]] FileCategory file_category_by_file_type(FileType type) noexcept;
3231
/// @brief Get the file type as a string.
3332
/// @param type The file type.
3433
/// @return The file type as a string.
@@ -49,8 +48,7 @@ get_file_category_by_file_type(FileType type) noexcept;
4948
/// @brief Get the decoder engine by the name.
5049
/// @param engine The name of the decoder engine.
5150
/// @return The decoder engine.
52-
[[nodiscard]] DecoderEngine
53-
get_decoder_engine_by_name(const std::string &engine);
51+
[[nodiscard]] DecoderEngine decoder_engine_by_name(const std::string &engine);
5452

5553
/// @brief Determine the file types by the file path.
5654
/// @param path The file path.

test/downstream/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
#include <iostream>
44

55
int main(void) {
6-
std::cout << "odr version=\"" << odr::version() << "\' "
7-
<< "commit=\'" << odr::commit() << "\"" << std::endl;
6+
std::cout << "odr version=\"" << odr::get_version() << "\' "
7+
<< "commit=\'" << odr::get_commit() << "\"" << std::endl;
88
}

test/src/test_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace {
2323

2424
TestFile get_test_file(const std::string &root_path,
2525
std::string absolute_path) {
26-
const FileType type = odr::get_file_type_by_file_extension(
27-
common::Path(absolute_path).extension());
26+
const FileType type =
27+
odr::file_type_by_file_extension(common::Path(absolute_path).extension());
2828

2929
std::string short_path = absolute_path.substr(root_path.size() + 1);
3030

@@ -55,7 +55,7 @@ std::vector<TestFile> get_test_files(const std::string &root_path,
5555
for (const auto &row : csv::CSVReader(index_path)) {
5656
std::string absolute_path = input_path + "/" + row["path"].get<>();
5757
std::string short_path = absolute_path.substr(root_path.size() + 1);
58-
FileType type = odr::get_file_type_by_file_extension(row["type"].get<>());
58+
FileType type = odr::file_type_by_file_extension(row["type"].get<>());
5959
std::optional<std::string> password = row["encrypted"].get<>() == "yes"
6060
? row["password"].get<>()
6161
: std::optional<std::string>();

0 commit comments

Comments
 (0)