MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / ExportsGenerator

Method ExportsGenerator

src/attributes.cpp:1858–1882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1856 }
1857
1858 ExportsGenerator::ExportsGenerator(const std::string& targetFile,
1859 const std::string& package,
1860 const std::string& commentPrefix)
1861 : targetFile_(targetFile),
1862 package_(package),
1863 packageCpp_(package),
1864 commentPrefix_(commentPrefix),
1865 hasCppInterface_(false) {
1866
1867 // read the existing target file if it exists
1868 if (FileInfo(targetFile_).exists()) {
1869 std::ifstream ifs(targetFile_.c_str()); // #nocov start
1870 if (ifs.fail())
1871 throw Rcpp::file_io_error(targetFile_);
1872 std::stringstream buffer;
1873 buffer << ifs.rdbuf();
1874 existingCode_ = buffer.str(); // #nocov end
1875 }
1876
1877 std::replace(packageCpp_.begin(), packageCpp_.end(), '.', '_');
1878
1879 // see if this is safe to overwite and throw if it isn't
1880 if (!isSafeToOverwrite())
1881 throw Rcpp::file_exists(targetFile_); // #nocov
1882 }
1883
1884 void ExportsGenerator::writeFunctions(
1885 const SourceFileAttributes& attributes,

Callers

nothing calls this directly

Calls 6

FileInfoClass · 0.85
file_io_errorClass · 0.85
file_existsClass · 0.85
existsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected