mirror of
https://github.com/OlafvdSpek/ctemplate.git
synced 2025-09-28 19:05:49 +08:00
Remove deprecated Template::SetEscapedValueAndShowSection()
This commit is contained in:
parent
e664a3f8cf
commit
d44f73fa42
|
@ -231,10 +231,6 @@ class @ac_windows_dllexport@ TemplateDictionary : public TemplateDictionaryInter
|
|||
__attribute__((__format__ (__printf__, 4, 5)))
|
||||
#endif
|
||||
; // starts at 4 because of implicit 1st arg 'this'
|
||||
void SetEscapedValueAndShowSection(const TemplateString variable,
|
||||
const TemplateString value,
|
||||
const TemplateModifier& escfn,
|
||||
const TemplateString section_name);
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -616,16 +616,6 @@ void TemplateDictionary::SetValueAndShowSection(const TemplateString variable,
|
|||
sub_dict->SetValue(variable, value);
|
||||
}
|
||||
|
||||
void TemplateDictionary::SetEscapedValueAndShowSection(
|
||||
const TemplateString variable, const TemplateString value,
|
||||
const TemplateModifier& escfn, const TemplateString section_name) {
|
||||
string escaped_string(escfn(value.ptr_, value.length_));
|
||||
if (escaped_string.empty()) // no value: the do-nothing case
|
||||
return;
|
||||
TemplateDictionary* sub_dict = AddSectionDictionary(section_name);
|
||||
sub_dict->SetValue(variable, escaped_string);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// TemplateDictionary::AddIncludeDictionary()
|
||||
// This is much like AddSectionDictionary(). One major difference
|
||||
|
|
|
@ -481,22 +481,9 @@ TEST(TemplateDictionary, SetValueAndShowSection) {
|
|||
dict.SetValueAndShowSection("NOTINSEC", "", "SEC2");
|
||||
dict.SetValueAndShowSection("NOTINSEC2", NULL, "SEC3");
|
||||
|
||||
dict.SetEscapedValueAndShowSection("EINSEC", "a & b",
|
||||
GOOGLE_NAMESPACE::html_escape,
|
||||
"SEC4");
|
||||
dict.SetEscapedValueAndShowSection("EINSEC2", "a beautiful poem",
|
||||
FooEscaper(),
|
||||
"SEC5");
|
||||
dict.SetEscapedValueAndShowSection("NOTEINSEC", "a long string",
|
||||
NullEscaper(),
|
||||
"SEC6");
|
||||
|
||||
EXPECT_FALSE(peer.IsHiddenSection("SEC1"));
|
||||
EXPECT_TRUE(peer.IsHiddenSection("SEC2"));
|
||||
EXPECT_TRUE(peer.IsHiddenSection("SEC3"));
|
||||
EXPECT_FALSE(peer.IsHiddenSection("SEC4"));
|
||||
EXPECT_FALSE(peer.IsHiddenSection("SEC5"));
|
||||
EXPECT_TRUE(peer.IsHiddenSection("SEC6"));
|
||||
|
||||
// Again, we don't get subdicts, so we have to dump to check values
|
||||
string dump;
|
||||
|
@ -514,14 +501,6 @@ TEST(TemplateDictionary, SetValueAndShowSection) {
|
|||
" dictionary 'test_SetValueAndShowSection/SEC1#1' {\n"
|
||||
" INSEC: >bar<\n"
|
||||
" }\n"
|
||||
" section SEC4 (dict 1 of 1) -->\n"
|
||||
" dictionary 'test_SetValueAndShowSection/SEC4#1' {\n"
|
||||
" EINSEC: >a & b<\n"
|
||||
" }\n"
|
||||
" section SEC5 (dict 1 of 1) -->\n"
|
||||
" dictionary 'test_SetValueAndShowSection/SEC5#1' {\n"
|
||||
" EINSEC2: >foo<\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
EXPECT_STREQ(dump.c_str(), expected);
|
||||
}
|
||||
|
|
|
@ -306,9 +306,9 @@ static TemplateDictionary* MakeDict1() {
|
|||
dict->SetEscapedValue("GOTO_MESSAGE", "print \"Go home\"",
|
||||
GOOGLE_NAMESPACE::javascript_escape);
|
||||
|
||||
dict->SetEscapedValueAndShowSection("UPDATE", "monday & tuesday",
|
||||
GOOGLE_NAMESPACE::html_escape,
|
||||
"UPDATE_SECTION");
|
||||
dict->SetEscapedValue("UPDATE", "monday & tuesday",
|
||||
GOOGLE_NAMESPACE::html_escape);
|
||||
dict->ShowSection("UPDATE_SECTION");
|
||||
|
||||
dict->SetValue("ALIGNMENT", "\"right\""); // all results sections see this
|
||||
for (int i = 0; i < 3; ++i) { // we'll do three results
|
||||
|
|
Loading…
Reference in New Issue
Block a user