inst/scripts/translate.R

## simple script for converting C++ Qt code to R Qt code

qtranslate <- function(f = "tmp.cpp") {
  lines <- readLines(f)
  table <- c("new " = "Qt$", "->" = "$", ".* \\*" = "", ";" = "", "=" = "<-",
             "::" = "$", "tr\\((.*?)\\)" = "\\1", "true" = "TRUE",
             "false" = "FALSE")
  for(i in seq_along(table))
    lines <- gsub(names(table)[i], table[i], lines)
  rf <- sub("cpp$", "R", f)
  writeLines(lines, rf)
}

Try the qtbase package in your browser

Any scripts or data that you put into this service are public.

qtbase documentation built on May 2, 2019, 9:58 a.m.