0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
util.cc File Reference
#include "util.h"
#include <spdlog/spdlog.h>
#include <regex>

Go to the source code of this file.

Namespaces

namespace  clanguml
 
namespace  clanguml::util
 

Functions

std::string clanguml::util::get_process_output (const std::string &command)
 Execute a shell command and return console output as string.
 
void clanguml::util::check_process_output (const std::string &command)
 Execute command shell and throw exception if command fails.
 
std::string clanguml::util::get_env (const std::string &name)
 Get value of an environment variable.
 
bool clanguml::util::is_git_repository ()
 Check if $PWD is in a Git repository.
 
std::string clanguml::util::run_git_command (const std::string &cmd, const std::string &env_override)
 
std::string clanguml::util::get_git_branch ()
 Get current Git branch.
 
std::string clanguml::util::get_git_revision ()
 Get current Git revision.
 
std::string clanguml::util::get_git_commit ()
 Get current Git commit.
 
std::string clanguml::util::get_git_toplevel_dir ()
 Get path to the top level Git directory.
 
std::string clanguml::util::get_os_name ()
 Get descriptive name of the current operating system.
 
std::string clanguml::util::ltrim (const std::string &s)
 Left trim a string.
 
std::string clanguml::util::rtrim (const std::string &s)
 Right trim a string.
 
std::string clanguml::util::trim_typename (const std::string &s)
 Remove typename prefix from a string if exists.
 
std::string clanguml::util::trim (const std::string &s)
 Trim a string.
 
std::vector< std::string > clanguml::util::split (std::string str, std::string_view delimiter, bool skip_empty=true)
 Split a string using delimiter.
 
std::vector< std::string > clanguml::util::split_isspace (std::string str)
 
std::string clanguml::util::join (const std::vector< std::string > &toks, std::string_view delimiter)
 Join toks into string using delimiter as separator.
 
std::string clanguml::util::abbreviate (const std::string &s, unsigned int max_length)
 Abbreviate string to max_length, and replace last 3 characters with ellipsis.
 
bool clanguml::util::find_element_alias (const std::string &input, std::tuple< std::string, size_t, size_t > &result)
 Find element alias in Puml note.
 
bool clanguml::util::replace_all (std::string &input, const std::string &pattern, const std::string &replace_with)
 Find and replace in string.
 
template<>
bool clanguml::util::starts_with (const std::filesystem::path &path, const std::filesystem::path &prefix)
 
template<>
bool clanguml::util::starts_with (const std::string &s, const std::string &prefix)
 
template<>
bool clanguml::util::ends_with (const std::string &value, const std::string &suffix)
 
std::size_t clanguml::util::hash_seed (std::size_t seed)
 Generate a hash seed.
 
std::string clanguml::util::path_to_url (const std::filesystem::path &p)
 Convert filesystem path to url path.
 
std::filesystem::path clanguml::util::ensure_path_is_absolute (const std::filesystem::path &p, const std::filesystem::path &root=std::filesystem::current_path())
 Ensure path is absolute.
 
bool clanguml::util::is_relative_to (const std::filesystem::path &parent, const std::filesystem::path &child)
 Check if a given path is relative to another path.
 
std::string clanguml::util::format_message_comment (const std::string &comment, unsigned width)
 
std::filesystem::path clanguml::util::normalize_relative_path (const std::filesystem::path &path)
 
bool clanguml::util::is_subpath (const std::filesystem::path &path, const std::filesystem::path &base)
 
std::optional< std::pair< std::string, std::string > > clanguml::util::find_entry_by_path_prefix (const std::map< std::string, std::string > &m, const std::string &path)
 

Variables

static const auto clanguml::util::WHITESPACE = " \n\r\t\f\v"
 

Variable Documentation

◆ pipe_

FILE* pipe_
private

Definition at line 66 of file util.cc.

◆ result_

int& result_
private

Definition at line 65 of file util.cc.