Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
[submodule "third_party/glob"]
path = third_party/glob
url = https://github.com/p-ranav/glob.git
[submodule "third_party/matplotplusplus"]
path = third_party/matplotplusplus
url = https://github.com/alandefreitas/matplotplusplus.git
[submodule "third_party/pybind11"]
path = third_party/pybind11
url = https://github.com/pybind/pybind11.git
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ include(${oops_3rd_cmake_dir}/fmt.cmake)
include(${oops_3rd_cmake_dir}/scnlib.cmake)
include(${oops_3rd_cmake_dir}/glob.cmake)
include(${oops_3rd_cmake_dir}/pybind11.cmake)
include(${oops_3rd_cmake_dir}/matplotplusplus.cmake)
if(ENABLE_TEST)
include(${oops_3rd_cmake_dir}/googletest.cmake)
endif()
Expand Down
7 changes: 7 additions & 0 deletions module/common/include/oops/str.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ void Split(std::string_view s, const char *delim, Iter iter) {
Split(s, delim, false, iter);
}

template <typename Iter>
void Split(std::string_view s, char delim, Iter iter) {
Split(s, std::string_view(&delim, 1), false, iter);
}

template <typename Iter>
void SplitMultiDelim(std::string_view s, std::string_view delims, bool skip_empty, Iter iter) {
std::size_t begin{0};
Expand Down Expand Up @@ -167,6 +172,8 @@ constexpr std::string_view Strip(std::string_view s, std::string_view chars = SP
return s.substr(pos, s.find_last_not_of(chars) - pos + 1);
}

std::string Elide(std::string_view s, std::size_t n);

template <typename T>
::std::string ToStr(const T &t) {
::std::ostringstream oss;
Expand Down
10 changes: 10 additions & 0 deletions module/common/src/str.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ std::string ToLower(std::string_view s) noexcept {
}
return res;
}

std::string Elide(std::string_view s, std::size_t n) {
if (s.size() <= n) {
return std::string{s};
}
if (n <= 3) {
return std::string(n, '.');
}
return std::string{s.substr(0, n - 3)} + "...";
}
} // namespace oops
2 changes: 1 addition & 1 deletion module/profiling/tool/monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
file(GLOB_RECURSE SRC "*.cpp")
add_executable(oops_profiling_monitor ${SRC})
set_target_properties(oops_profiling_monitor PROPERTIES OUTPUT_NAME monitor)
target_link_libraries(oops_profiling_monitor PRIVATE pthread argparse Glob oops_profiling_s)
target_link_libraries(oops_profiling_monitor PRIVATE pthread argparse Glob pybind11::embed oops_profiling_s)
Loading
Loading