Skip to content

Commit 2ead3d1

Browse files
committed
[c++/pugi] remove the setXMLPtrval functions. Never used anyway, they were inteded to change values on pugi_xml nodes
1 parent f2b8408 commit 2ead3d1

File tree

3 files changed

+0
-221
lines changed

3 files changed

+0
-221
lines changed

R/RcppExports.R

-16
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,6 @@ getXMLXPtr4val <- function(doc, level1, level2, level3, child) {
9797
.Call(`_openxlsx2_getXMLXPtr4val`, doc, level1, level2, level3, child)
9898
}
9999

100-
setXMLXPtr1val <- function(doc, child, value, no_escapes, raw) {
101-
.Call(`_openxlsx2_setXMLXPtr1val`, doc, child, value, no_escapes, raw)
102-
}
103-
104-
setXMLXPtr2val <- function(doc, level1, child, value, no_escapes, raw) {
105-
.Call(`_openxlsx2_setXMLXPtr2val`, doc, level1, child, value, no_escapes, raw)
106-
}
107-
108-
setXMLXPtr3val <- function(doc, level1, level2, child, value, no_escapes, raw) {
109-
.Call(`_openxlsx2_setXMLXPtr3val`, doc, level1, level2, child, value, no_escapes, raw)
110-
}
111-
112-
setXMLXPtr4val <- function(doc, level1, level2, level3, child, value, no_escapes, raw) {
113-
.Call(`_openxlsx2_setXMLXPtr4val`, doc, level1, level2, level3, child, value, no_escapes, raw)
114-
}
115-
116100
getXMLXPtr1attr <- function(doc, child) {
117101
.Call(`_openxlsx2_getXMLXPtr1attr`, doc, child)
118102
}

src/RcppExports.cpp

-70
Original file line numberDiff line numberDiff line change
@@ -311,72 +311,6 @@ BEGIN_RCPP
311311
return rcpp_result_gen;
312312
END_RCPP
313313
}
314-
// setXMLXPtr1val
315-
SEXP setXMLXPtr1val(XPtrXML doc, std::string child, std::string value, bool no_escapes, bool raw);
316-
RcppExport SEXP _openxlsx2_setXMLXPtr1val(SEXP docSEXP, SEXP childSEXP, SEXP valueSEXP, SEXP no_escapesSEXP, SEXP rawSEXP) {
317-
BEGIN_RCPP
318-
Rcpp::RObject rcpp_result_gen;
319-
Rcpp::RNGScope rcpp_rngScope_gen;
320-
Rcpp::traits::input_parameter< XPtrXML >::type doc(docSEXP);
321-
Rcpp::traits::input_parameter< std::string >::type child(childSEXP);
322-
Rcpp::traits::input_parameter< std::string >::type value(valueSEXP);
323-
Rcpp::traits::input_parameter< bool >::type no_escapes(no_escapesSEXP);
324-
Rcpp::traits::input_parameter< bool >::type raw(rawSEXP);
325-
rcpp_result_gen = Rcpp::wrap(setXMLXPtr1val(doc, child, value, no_escapes, raw));
326-
return rcpp_result_gen;
327-
END_RCPP
328-
}
329-
// setXMLXPtr2val
330-
SEXP setXMLXPtr2val(XPtrXML doc, std::string level1, std::string child, std::string value, bool no_escapes, bool raw);
331-
RcppExport SEXP _openxlsx2_setXMLXPtr2val(SEXP docSEXP, SEXP level1SEXP, SEXP childSEXP, SEXP valueSEXP, SEXP no_escapesSEXP, SEXP rawSEXP) {
332-
BEGIN_RCPP
333-
Rcpp::RObject rcpp_result_gen;
334-
Rcpp::RNGScope rcpp_rngScope_gen;
335-
Rcpp::traits::input_parameter< XPtrXML >::type doc(docSEXP);
336-
Rcpp::traits::input_parameter< std::string >::type level1(level1SEXP);
337-
Rcpp::traits::input_parameter< std::string >::type child(childSEXP);
338-
Rcpp::traits::input_parameter< std::string >::type value(valueSEXP);
339-
Rcpp::traits::input_parameter< bool >::type no_escapes(no_escapesSEXP);
340-
Rcpp::traits::input_parameter< bool >::type raw(rawSEXP);
341-
rcpp_result_gen = Rcpp::wrap(setXMLXPtr2val(doc, level1, child, value, no_escapes, raw));
342-
return rcpp_result_gen;
343-
END_RCPP
344-
}
345-
// setXMLXPtr3val
346-
SEXP setXMLXPtr3val(XPtrXML doc, std::string level1, std::string level2, std::string child, std::string value, bool no_escapes, bool raw);
347-
RcppExport SEXP _openxlsx2_setXMLXPtr3val(SEXP docSEXP, SEXP level1SEXP, SEXP level2SEXP, SEXP childSEXP, SEXP valueSEXP, SEXP no_escapesSEXP, SEXP rawSEXP) {
348-
BEGIN_RCPP
349-
Rcpp::RObject rcpp_result_gen;
350-
Rcpp::RNGScope rcpp_rngScope_gen;
351-
Rcpp::traits::input_parameter< XPtrXML >::type doc(docSEXP);
352-
Rcpp::traits::input_parameter< std::string >::type level1(level1SEXP);
353-
Rcpp::traits::input_parameter< std::string >::type level2(level2SEXP);
354-
Rcpp::traits::input_parameter< std::string >::type child(childSEXP);
355-
Rcpp::traits::input_parameter< std::string >::type value(valueSEXP);
356-
Rcpp::traits::input_parameter< bool >::type no_escapes(no_escapesSEXP);
357-
Rcpp::traits::input_parameter< bool >::type raw(rawSEXP);
358-
rcpp_result_gen = Rcpp::wrap(setXMLXPtr3val(doc, level1, level2, child, value, no_escapes, raw));
359-
return rcpp_result_gen;
360-
END_RCPP
361-
}
362-
// setXMLXPtr4val
363-
SEXP setXMLXPtr4val(XPtrXML doc, std::string level1, std::string level2, std::string level3, std::string child, std::string value, bool no_escapes, bool raw);
364-
RcppExport SEXP _openxlsx2_setXMLXPtr4val(SEXP docSEXP, SEXP level1SEXP, SEXP level2SEXP, SEXP level3SEXP, SEXP childSEXP, SEXP valueSEXP, SEXP no_escapesSEXP, SEXP rawSEXP) {
365-
BEGIN_RCPP
366-
Rcpp::RObject rcpp_result_gen;
367-
Rcpp::RNGScope rcpp_rngScope_gen;
368-
Rcpp::traits::input_parameter< XPtrXML >::type doc(docSEXP);
369-
Rcpp::traits::input_parameter< std::string >::type level1(level1SEXP);
370-
Rcpp::traits::input_parameter< std::string >::type level2(level2SEXP);
371-
Rcpp::traits::input_parameter< std::string >::type level3(level3SEXP);
372-
Rcpp::traits::input_parameter< std::string >::type child(childSEXP);
373-
Rcpp::traits::input_parameter< std::string >::type value(valueSEXP);
374-
Rcpp::traits::input_parameter< bool >::type no_escapes(no_escapesSEXP);
375-
Rcpp::traits::input_parameter< bool >::type raw(rawSEXP);
376-
rcpp_result_gen = Rcpp::wrap(setXMLXPtr4val(doc, level1, level2, level3, child, value, no_escapes, raw));
377-
return rcpp_result_gen;
378-
END_RCPP
379-
}
380314
// getXMLXPtr1attr
381315
SEXP getXMLXPtr1attr(XPtrXML doc, std::string child);
382316
RcppExport SEXP _openxlsx2_getXMLXPtr1attr(SEXP docSEXP, SEXP childSEXP) {
@@ -796,10 +730,6 @@ static const R_CallMethodDef CallEntries[] = {
796730
{"_openxlsx2_getXMLXPtr2val", (DL_FUNC) &_openxlsx2_getXMLXPtr2val, 3},
797731
{"_openxlsx2_getXMLXPtr3val", (DL_FUNC) &_openxlsx2_getXMLXPtr3val, 4},
798732
{"_openxlsx2_getXMLXPtr4val", (DL_FUNC) &_openxlsx2_getXMLXPtr4val, 5},
799-
{"_openxlsx2_setXMLXPtr1val", (DL_FUNC) &_openxlsx2_setXMLXPtr1val, 5},
800-
{"_openxlsx2_setXMLXPtr2val", (DL_FUNC) &_openxlsx2_setXMLXPtr2val, 6},
801-
{"_openxlsx2_setXMLXPtr3val", (DL_FUNC) &_openxlsx2_setXMLXPtr3val, 7},
802-
{"_openxlsx2_setXMLXPtr4val", (DL_FUNC) &_openxlsx2_setXMLXPtr4val, 8},
803733
{"_openxlsx2_getXMLXPtr1attr", (DL_FUNC) &_openxlsx2_getXMLXPtr1attr, 2},
804734
{"_openxlsx2_getXMLXPtr2attr", (DL_FUNC) &_openxlsx2_getXMLXPtr2attr, 3},
805735
{"_openxlsx2_getXMLXPtr3attr", (DL_FUNC) &_openxlsx2_getXMLXPtr3attr, 4},

src/pugi.cpp

-135
Original file line numberDiff line numberDiff line change
@@ -270,141 +270,6 @@ SEXP getXMLXPtr4val(XPtrXML doc, std::string level1, std::string level2, std::st
270270
return Rcpp::wrap(x);
271271
}
272272

273-
// [[Rcpp::export]]
274-
SEXP setXMLXPtr1val(XPtrXML doc, std::string child, std::string value, bool no_escapes, bool raw) {
275-
276-
pugi::xml_document value_node;
277-
pugi::xml_parse_result result;
278-
279-
unsigned int pugi_parse_flags = pugi::parse_cdata | pugi::parse_wconv_attribute | pugi::parse_eol;
280-
if (!no_escapes) pugi_parse_flags |= pugi::parse_escapes;
281-
282-
unsigned int pugi_format_flags = pugi::format_indent;
283-
if (no_escapes) pugi_format_flags |= pugi::format_no_escapes;
284-
if (raw) pugi_format_flags |= pugi::format_raw;
285-
286-
for (auto cld : doc->children(child.c_str()))
287-
{
288-
// remove all values and children
289-
cld.first_child().set_value("");
290-
cld.remove_children();
291-
// check if result is a valid xml_node, else append as is
292-
result = value_node.load_string(value.c_str(), pugi_parse_flags);
293-
if (result) {
294-
cld.prepend_copy(value_node.first_child());
295-
} else {
296-
cld.prepend_child(pugi::node_pcdata).set_value(value.c_str());
297-
}
298-
}
299-
300-
std::ostringstream oss;
301-
doc->print(oss, " ", pugi_format_flags);
302-
303-
return Rcpp::wrap(oss.str());
304-
}
305-
306-
// [[Rcpp::export]]
307-
SEXP setXMLXPtr2val(XPtrXML doc, std::string level1, std::string child, std::string value, bool no_escapes, bool raw) {
308-
309-
pugi::xml_document value_node;
310-
pugi::xml_parse_result result;
311-
312-
unsigned int pugi_parse_flags = pugi::parse_cdata | pugi::parse_wconv_attribute | pugi::parse_eol;
313-
if (!no_escapes) pugi_parse_flags |= pugi::parse_escapes;
314-
315-
unsigned int pugi_format_flags = pugi::format_indent;
316-
if (no_escapes) pugi_format_flags |= pugi::format_no_escapes;
317-
if (raw) pugi_format_flags |= pugi::format_raw;
318-
319-
for (auto cld : doc->child(level1.c_str()).children(child.c_str()))
320-
{
321-
cld.first_child().set_value("");
322-
cld.remove_children();
323-
// check if result is a valid xml_node, else append as is
324-
result = value_node.load_string(value.c_str(), pugi_parse_flags);
325-
if (result) {
326-
cld.prepend_copy(value_node.first_child());
327-
} else {
328-
cld.prepend_child(pugi::node_pcdata).set_value(value.c_str());
329-
}
330-
}
331-
332-
std::ostringstream oss;
333-
doc->print(oss, " ", pugi_format_flags);
334-
335-
return Rcpp::wrap(oss.str());
336-
}
337-
338-
// [[Rcpp::export]]
339-
SEXP setXMLXPtr3val(XPtrXML doc, std::string level1, std::string level2, std::string child, std::string value, bool no_escapes, bool raw) {
340-
341-
pugi::xml_document value_node;
342-
pugi::xml_parse_result result;
343-
344-
unsigned int pugi_parse_flags = pugi::parse_cdata | pugi::parse_wconv_attribute | pugi::parse_eol;
345-
if (!no_escapes) pugi_parse_flags |= pugi::parse_escapes;
346-
347-
unsigned int pugi_format_flags = pugi::format_indent;
348-
if (no_escapes) pugi_format_flags |= pugi::format_no_escapes;
349-
if (raw) pugi_format_flags |= pugi::format_raw;
350-
351-
for (auto cld : doc->child(level1.c_str()).children(level2.c_str()))
352-
{
353-
for (auto col : cld.children(child.c_str()))
354-
{
355-
col.first_child().set_value("");
356-
col.remove_children();
357-
// check if result is a valid xml_node, else append as is
358-
result = value_node.load_string(value.c_str(), pugi_parse_flags);
359-
if (result) {
360-
col.prepend_copy(value_node.first_child());
361-
} else {
362-
col.prepend_child(pugi::node_pcdata).set_value(value.c_str());
363-
}
364-
}
365-
}
366-
367-
std::ostringstream oss;
368-
doc->print(oss, " ", pugi_format_flags);
369-
370-
return Rcpp::wrap(oss.str());
371-
}
372-
373-
// [[Rcpp::export]]
374-
SEXP setXMLXPtr4val(XPtrXML doc, std::string level1, std::string level2, std::string level3, std::string child, std::string value, bool no_escapes, bool raw) {
375-
376-
pugi::xml_document value_node;
377-
pugi::xml_parse_result result;
378-
379-
unsigned int pugi_parse_flags = pugi::parse_cdata | pugi::parse_wconv_attribute | pugi::parse_eol;
380-
if (!no_escapes) pugi_parse_flags |= pugi::parse_escapes;
381-
382-
unsigned int pugi_format_flags = pugi::format_indent;
383-
if (no_escapes) pugi_format_flags |= pugi::format_no_escapes;
384-
if (raw) pugi_format_flags |= pugi::format_raw;
385-
386-
for (auto cld : doc->child(level1.c_str()).child(level2.c_str()).children(level3.c_str()))
387-
{
388-
for (auto col : cld.children(child.c_str()))
389-
{
390-
col.first_child().set_value("");
391-
col.remove_children();
392-
// check if result is a valid xml_node, else append as is
393-
result = value_node.load_string(value.c_str(), pugi_parse_flags);
394-
if (result) {
395-
col.prepend_copy(value_node.first_child());
396-
} else {
397-
col.prepend_child(pugi::node_pcdata).set_value(value.c_str());
398-
}
399-
}
400-
}
401-
402-
std::ostringstream oss;
403-
doc->print(oss, " ", pugi_format_flags);
404-
405-
return Rcpp::wrap(oss.str());
406-
}
407-
408273
// [[Rcpp::export]]
409274
SEXP getXMLXPtr1attr(XPtrXML doc, std::string child) {
410275

0 commit comments

Comments
 (0)