-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDynamicVariant.cpp
More file actions
34 lines (28 loc) · 1.15 KB
/
DynamicVariant.cpp
File metadata and controls
34 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ===========================================================================
// DynamicVariant.cpp
// ===========================================================================
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <memory>
#include "RenderListStrategy.h"
#include "RenderHtmlListStrategy.h"
#include "RenderMarkdownListStrategy.h"
#include "RenderTextProcessor.h"
void test_render_app_dynamically()
{
RenderTextProcessor processor;
// 'markdown' strategy (should be created externally to client)
processor.setOutputFormat(std::make_unique<RenderMarkdownListStrategy>());
processor.appendList({ "foo", "bar", "baz" });
std::cout << processor.toString() << std::endl;
// 'html' strategy (should be created externally to client)
processor.clear();
processor.setOutputFormat(std::make_unique<RenderHtmlListStrategy>());
processor.appendList({ "FOO", "BAR", "BAZ" });
std::cout << processor.toString() << std::endl;
}
// ===========================================================================
// End-of-File
// ===========================================================================