Skip to content

Commit

Permalink
[Rcpp] add .clang-format definition and run:
Browse files Browse the repository at this point in the history
`clang-format -i *.cpp`
  • Loading branch information
JanMarvin committed Jan 11, 2025
1 parent d80bcdb commit c95e44f
Show file tree
Hide file tree
Showing 11 changed files with 2,299 additions and 2,207 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ README.Rmd
codecov.yml
.lintr
.covrignore
^src/.clang-format$

# Temporary files
.DS_Store
Expand Down
24 changes: 12 additions & 12 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,22 @@ write_xml_file <- function(xml_content, escapes) {
#'
#' @examples
#' # add single node
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(qux = "quux")
#' # "<a foo=\"bar\" qux=\"quux\">openxlsx2</a><b qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(qux = "quux")
#' # "<a foo=\"bar\" qux=\"quux\">openxlsx2</a><b qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#'
#' # update node and add node
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(foo = "baz", qux = "quux")
#' # "<a foo=\"baz\" qux=\"quux\">openxlsx2</a><b foo=\"baz\" qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(foo = "baz", qux = "quux")
#' # "<a foo=\"baz\" qux=\"quux\">openxlsx2</a><b foo=\"baz\" qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#'
#' # remove node and add node
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(foo = "", qux = "quux")
#' # "<a qux=\"quux\">openxlsx2</a><b qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#' xml_node <- "<a foo=\"bar\">openxlsx2</a><b />"
#' xml_attr <- c(foo = "", qux = "quux")
#' # "<a qux=\"quux\">openxlsx2</a><b qux=\"quux\"/>"
#' xml_attr_mod(xml_node, xml_attr)
#' @export
xml_attr_mod <- function(xml_content, xml_attributes, escapes = FALSE, declaration = FALSE, remove_empty_attr = TRUE) {
.Call(`_openxlsx2_xml_attr_mod`, xml_content, xml_attributes, escapes, declaration, remove_empty_attr)
Expand Down
24 changes: 12 additions & 12 deletions man/xml_attr_mod.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
IndentWidth: 2
ContinuationIndentWidth: 2 # Control the indentation width after a line break, such as in function arguments
ColumnLimit: 100 # Set the maximum line length to 100 characters
BreakBeforeBraces: Attach # Keep braces on the same line as the function declaration
BinPackParameters: false # Force each parameter to appear on its own line
BinPackArguments: false # Force each argument in calls to appear on its own line
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true # Align equal signs in consecutive assignments
AlignConsecutiveDeclarations: true # Align types and variables in consecutive declarations
AlignTrailingComments: true # Align trailing comments
AllowShortFunctionsOnASingleLine: None # Break short functions into multiple lines
Cpp11BracedListStyle: true # Format braced initializer lists cleanly
PenaltyBreakBeforeFirstCallParameter: 0 # Encourage breaking after the first parameter

Loading

0 comments on commit c95e44f

Please sign in to comment.