Update the formatting to now allow functions on a single line

This makes it less annoying when the IDE is auto-formatting while you type
main
Duncan Ogilvie 2 years ago
parent 3a1298f4e8
commit a90988b81a

@ -10,7 +10,7 @@ AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None

@ -126,13 +126,17 @@ void generate_project(const std::string &type) {
struct CommandEndl { struct CommandEndl {
std::stringstream &ss; std::stringstream &ss;
CommandEndl(std::stringstream &ss) : ss(ss) {} CommandEndl(std::stringstream &ss) : ss(ss) {
void endl() { ss << '\n'; } }
void endl() {
ss << '\n';
}
}; };
struct RawArg { struct RawArg {
RawArg() = default; RawArg() = default;
RawArg(std::string arg) : arg(std::move(arg)) {} RawArg(std::string arg) : arg(std::move(arg)) {
}
std::string arg; std::string arg;
}; };
@ -148,7 +152,8 @@ struct Command {
std::string post_comment; std::string post_comment;
Command(std::stringstream &ss, int depth, std::string command, std::string post_comment) Command(std::stringstream &ss, int depth, std::string command, std::string post_comment)
: ss(ss), depth(depth), command(std::move(command)), post_comment(std::move(post_comment)) {} : ss(ss), depth(depth), command(std::move(command)), post_comment(std::move(post_comment)) {
}
~Command() noexcept(false) { ~Command() noexcept(false) {
if (!generated) { if (!generated) {
@ -317,7 +322,8 @@ static std::string tolf(const std::string &str) {
}; };
struct Generator { struct Generator {
Generator(const parser::Project &project) : project(project) {} Generator(const parser::Project &project) : project(project) {
}
Generator(const Generator &) = delete; Generator(const Generator &) = delete;
const parser::Project &project; const parser::Project &project;
@ -343,7 +349,9 @@ struct Generator {
return CommandEndl(ss); return CommandEndl(ss);
} }
void endl() { ss << '\n'; } void endl() {
ss << '\n';
}
void inject_includes(const std::vector<std::string> &includes) { void inject_includes(const std::vector<std::string> &includes) {
if (!includes.empty()) { if (!includes.empty()) {

@ -6,11 +6,16 @@
namespace cmkr { namespace cmkr {
namespace error { namespace error {
Status::Status(Code ec) noexcept : ec_(ec) {} Status::Status(Code ec) noexcept : ec_(ec) {
}
Status::operator int() const noexcept { return static_cast<int>(ec_); } Status::operator int() const noexcept {
return static_cast<int>(ec_);
}
Status::Code Status::code() const noexcept { return ec_; } Status::Code Status::code() const noexcept {
return ec_;
}
} // namespace error } // namespace error
} // namespace cmkr } // namespace cmkr

@ -4,7 +4,9 @@
namespace cmkr { namespace cmkr {
namespace help { namespace help {
const char *version() noexcept { return "cmkr version " CMKR_VERSION; } const char *version() noexcept {
return "cmkr version " CMKR_VERSION;
}
const char *message() noexcept { const char *message() noexcept {
return R"lit( return R"lit(
@ -22,6 +24,10 @@ arguments:
} // namespace help } // namespace help
} // namespace cmkr } // namespace cmkr
const char *cmkr_help_version(void) { return cmkr::help::version(); } const char *cmkr_help_version(void) {
return cmkr::help::version();
}
const char *cmkr_help_message(void) { return cmkr::help::message(); } const char *cmkr_help_message(void) {
return cmkr::help::message();
}

@ -54,8 +54,10 @@ class TomlChecker {
tsl::ordered_set<toml::key> m_conditionVisited; tsl::ordered_set<toml::key> m_conditionVisited;
public: public:
TomlChecker(const TomlBasicValue &v, const toml::key &ky) : m_v(toml::find(v, ky)) {} TomlChecker(const TomlBasicValue &v, const toml::key &ky) : m_v(toml::find(v, ky)) {
TomlChecker(const TomlBasicValue &v) : m_v(v) {} }
TomlChecker(const TomlBasicValue &v) : m_v(v) {
}
TomlChecker(const TomlChecker &) = delete; TomlChecker(const TomlChecker &) = delete;
TomlChecker(TomlChecker &&) = delete; TomlChecker(TomlChecker &&) = delete;
@ -109,9 +111,13 @@ class TomlChecker {
return toml::find(m_v, ky); return toml::find(m_v, ky);
} }
void visit(const toml::key &ky) { m_visited.emplace(ky); } void visit(const toml::key &ky) {
m_visited.emplace(ky);
}
bool visisted(const toml::key &ky) const { return m_visited.contains(ky); } bool visisted(const toml::key &ky) const {
return m_visited.contains(ky);
}
void check(const tsl::ordered_map<std::string, std::string> &conditions) const { void check(const tsl::ordered_map<std::string, std::string> &conditions) const {
for (const auto &itr : m_v.as_table()) { for (const auto &itr : m_v.as_table()) {
@ -152,7 +158,8 @@ class TomlCheckerRoot {
bool m_checked = false; bool m_checked = false;
public: public:
TomlCheckerRoot(const TomlBasicValue &root) : m_root(root) {} TomlCheckerRoot(const TomlBasicValue &root) : m_root(root) {
}
TomlCheckerRoot(const TomlCheckerRoot &) = delete; TomlCheckerRoot(const TomlCheckerRoot &) = delete;
TomlCheckerRoot(TomlCheckerRoot &&) = delete; TomlCheckerRoot(TomlCheckerRoot &&) = delete;

Loading…
Cancel
Save