Skip to content

Commit

Permalink
organize includes (#328)
Browse files Browse the repository at this point in the history
* organize includes

* fix formatting

* fix formatting script

* fix compilation
  • Loading branch information
andiwand authored Aug 3, 2023
1 parent 4896bc1 commit e44e17a
Show file tree
Hide file tree
Showing 137 changed files with 496 additions and 283 deletions.
6 changes: 4 additions & 2 deletions cli/src/back_translate.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include <internal/util/file_util.h>
#include <iostream>
#include <odr/document.h>
#include <odr/file.h>
#include <odr/html.h>

#include <internal/util/file_util.h>

#include <iostream>
#include <string>

using namespace odr;
Expand Down
4 changes: 3 additions & 1 deletion cli/src/meta.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <odr/file.h>

#include <internal/util/odr_meta_util.h>

#include <iostream>
#include <odr/file.h>
#include <string>

using namespace odr;
Expand Down
3 changes: 2 additions & 1 deletion cli/src/translate.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <iostream>
#include <odr/file.h>
#include <odr/html.h>

#include <iostream>
#include <string>

using namespace odr;
Expand Down
1 change: 1 addition & 0 deletions include/odr/open_document_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define ODR_OPEN_DOCUMENT_READER_H

#include <string>
#include <vector>

namespace odr {
enum class FileType;
Expand Down
2 changes: 1 addition & 1 deletion scripts/git_hooks/pre-commit/0_format
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
format_file() {
local file="${1}"
if [ -f $file ]; then
clang-format-12 -i -style=file ${1}
clang-format -i -style=file ${1}
fi
}

Expand Down
9 changes: 6 additions & 3 deletions src/document.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include <internal/abstract/document.h>
#include <internal/abstract/document_cursor.h>
#include <internal/common/path.h>
#include <odr/document.h>

#include <odr/document_cursor.h>
#include <odr/file.h>

#include <internal/abstract/document.h>
#include <internal/abstract/document_cursor.h>
#include <internal/common/path.h>

#include <stdexcept>
#include <utility>

Expand Down
6 changes: 4 additions & 2 deletions src/document_cursor.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <odr/document_cursor.h>

#include <odr/document_element.h>

#include <internal/abstract/document.h>
#include <internal/abstract/document_cursor.h>
#include <internal/abstract/document_element.h>
#include <internal/common/document_path.h>
#include <odr/document_cursor.h>
#include <odr/document_element.h>

namespace odr {

Expand Down
4 changes: 3 additions & 1 deletion src/document_element.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include <internal/abstract/document_element.h>
#include <odr/document_element.h>

#include <odr/file.h>
#include <odr/style.h>

#include <internal/abstract/document_element.h>

namespace odr {

Element::Element(const internal::abstract::Document *document,
Expand Down
1 change: 1 addition & 0 deletions src/exceptions.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <odr/exceptions.h>

#include <odr/file.h>

namespace odr {
Expand Down
10 changes: 6 additions & 4 deletions src/file.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <cstdint>
#include <odr/file.h>

#include <odr/document.h>
#include <odr/exceptions.h>

#include <internal/abstract/file.h>
#include <internal/common/file.h>
#include <internal/open_strategy.h>
#include <odr/document.h>
#include <odr/exceptions.h>
#include <odr/file.h>

#include <optional>
#include <utility>

Expand Down
14 changes: 9 additions & 5 deletions src/html.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#include <filesystem>
#include <odr/html.h>

#include <odr/document.h>
#include <odr/document_cursor.h>
#include <odr/document_element.h>

#include <internal/html/document.h>
#include <internal/html/image_file.h>
#include <internal/html/text_file.h>

#include <nlohmann/json.hpp>
#include <odr/document.h>
#include <odr/document_cursor.h>
#include <odr/document_element.h>
#include <odr/html.h>

#include <filesystem>

using namespace odr::internal;
namespace fs = std::filesystem;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/abstract/document.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef ODR_INTERNAL_ABSTRACT_DOCUMENT_H
#define ODR_INTERNAL_ABSTRACT_DOCUMENT_H

#include <memory>
#include <odr/document.h>

#include <memory>

namespace odr {
class File;
enum class FileType;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/abstract/document_element.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef ODR_INTERNAL_ABSTRACT_DOCUMENT_ELEMENT_H
#define ODR_INTERNAL_ABSTRACT_DOCUMENT_ELEMENT_H

#include <memory>
#include <odr/document_element.h>

#include <memory>
#include <optional>
#include <string>

Expand Down
3 changes: 2 additions & 1 deletion src/internal/abstract/file.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef ODR_INTERNAL_ABSTRACT_FILE_H
#define ODR_INTERNAL_ABSTRACT_FILE_H

#include <odr/file.h>

#include <iosfwd>
#include <memory>
#include <odr/file.h>
#include <string>

namespace odr::internal::common {
Expand Down
3 changes: 1 addition & 2 deletions src/internal/cfb/cfb_archive.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <internal/cfb/cfb_archive.h>
#include <internal/cfb/cfb_impl.h>

#include <internal/cfb/cfb_util.h>
#include <internal/common/path.h>
#include <internal/util/string_util.h>

namespace odr::internal::abstract {
Expand Down
1 change: 1 addition & 0 deletions src/internal/cfb/cfb_archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <internal/cfb/cfb_impl.h>
#include <internal/common/file.h>
#include <internal/common/path.h>

#include <iterator>
#include <memory>
#include <optional>
Expand Down
6 changes: 4 additions & 2 deletions src/internal/cfb/cfb_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <algorithm>
#include <cstring>
#include <internal/cfb/cfb_impl.h>

#include <odr/exceptions.h>

#include <algorithm>
#include <cstring>
#include <stdexcept>

namespace odr::internal::cfb::impl {
Expand Down
7 changes: 3 additions & 4 deletions src/internal/cfb/cfb_util.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include <algorithm>
#include <cstdint>
#include <internal/abstract/file.h>
#include <internal/cfb/cfb_impl.h>
#include <internal/cfb/cfb_util.h>

#include <internal/common/file.h>

#include <algorithm>
#include <string>
#include <utility>

Expand Down
4 changes: 3 additions & 1 deletion src/internal/cfb/cfb_util.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#ifndef ODR_INTERNAL_CFB_UTIL_H
#define ODR_INTERNAL_CFB_UTIL_H

#include <odr/file.h>

#include <internal/abstract/file.h>
#include <internal/cfb/cfb_impl.h>

#include <istream>
#include <memory>
#include <odr/file.h>
#include <string>

namespace odr::internal::common {
Expand Down
5 changes: 3 additions & 2 deletions src/internal/common/archive.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#ifndef ODR_INTERNAL_COMMON_ARCHIVE_H
#define ODR_INTERNAL_COMMON_ARCHIVE_H

#include <odr/exceptions.h>
#include <odr/file.h>

#include <internal/abstract/archive.h>
#include <internal/abstract/file.h>
#include <internal/common/filesystem.h>
#include <odr/exceptions.h>
#include <odr/file.h>

namespace odr::internal::common {

Expand Down
6 changes: 1 addition & 5 deletions src/internal/common/document_cursor.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include <cstdint>
#include <internal/abstract/document_cursor.h>
#include <internal/abstract/document_element.h>
#include <internal/common/document_cursor.h>
#include <internal/common/document_path.h>
#include <internal/common/style.h>

#include <stdexcept>
#include <variant>

Expand Down
8 changes: 5 additions & 3 deletions src/internal/common/document_cursor.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#ifndef ODR_INTERNAL_COMMON_DOCUMENT_CURSOR_H
#define ODR_INTERNAL_COMMON_DOCUMENT_CURSOR_H

#include <cstdint>
#include <functional>
#include <internal/abstract/document_cursor.h>
#include <internal/abstract/document_element.h>
#include <internal/common/document_path.h>
#include <internal/common/style.h>
#include <optional>

#include <pugixml.hpp>

#include <cstdint>
#include <functional>
#include <optional>
#include <string>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/internal/common/document_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define ODR_INTERNAL_COMMON_DOCUMENT_ELEMENT_H

#include <internal/abstract/document_element.h>

#include <pugixml.hpp>

namespace odr::internal::abstract {
Expand Down
1 change: 1 addition & 0 deletions src/internal/common/document_path.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <internal/common/document_path.h>

#include <iterator>

namespace odr::internal::common {
Expand Down
3 changes: 2 additions & 1 deletion src/internal/common/document_path.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef ODR_INTERNAL_COMMON_DOCUMENT_PATH_H
#define ODR_INTERNAL_COMMON_DOCUMENT_PATH_H

#include <cstdint>
#include <internal/util/string_util.h>

#include <cstdint>
#include <stdexcept>
#include <string>
#include <variant>
Expand Down
9 changes: 4 additions & 5 deletions src/internal/common/file.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <internal/abstract/file.h>
#include <internal/common/file.h>
#include <internal/common/path.h>

#include <odr/exceptions.h>
#include <odr/file.h>

#include <filesystem>
#include <fstream>
#include <sstream>
#include <utility>

Expand Down
1 change: 1 addition & 0 deletions src/internal/common/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <internal/abstract/file.h>
#include <internal/common/path.h>

#include <iosfwd>
#include <memory>
#include <string>
Expand Down
14 changes: 7 additions & 7 deletions src/internal/common/filesystem.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <internal/common/filesystem.h>

#include <odr/exceptions.h>

#include <internal/abstract/file.h>
#include <internal/abstract/filesystem.h>
#include <internal/common/file.h>
#include <internal/common/filesystem.h>
#include <internal/common/path.h>
#include <internal/util/stream_util.h>

#include <filesystem>
#include <fstream>
#include <map>
#include <odr/exceptions.h>
#include <system_error>
#include <utility>

Expand Down
1 change: 1 addition & 0 deletions src/internal/common/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <internal/abstract/filesystem.h>
#include <internal/common/path.h>

#include <iosfwd>
#include <map>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions src/internal/common/path.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <internal/common/path.h>

#include <stdexcept>

std::size_t std::hash<::odr::internal::common::Path>::operator()(
Expand Down
3 changes: 2 additions & 1 deletion src/internal/common/random.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <algorithm>
#include <internal/common/random.h>

#include <algorithm>

namespace odr::internal {

std::string common::random_string(std::size_t length) {
Expand Down
2 changes: 0 additions & 2 deletions src/internal/common/style.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include <internal/common/style.h>
#include <odr/style.h>
#include <utility>

namespace odr::internal::common {

Expand Down
1 change: 1 addition & 0 deletions src/internal/common/style.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define ODR_INTERNAL_COMMON_STYLE_H

#include <odr/style.h>

#include <optional>

namespace odr::internal::common {
Expand Down
3 changes: 1 addition & 2 deletions src/internal/common/table_cursor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <internal/common/table_cursor.h>
#include <internal/common/table_position.h>
#include <iterator>

#include <list>

namespace odr::internal::common {
Expand Down
Loading

0 comments on commit e44e17a

Please sign in to comment.