summaryrefslogtreecommitdiff
path: root/src/interfacegats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfacegats.cpp')
-rw-r--r--src/interfacegats.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/interfacegats.cpp b/src/interfacegats.cpp
new file mode 100644
index 0000000..bd936c7
--- /dev/null
+++ b/src/interfacegats.cpp
@@ -0,0 +1,71 @@
1#include "interfacegats.h"
2
3#include "smlnode.h"
4
5#include <bu/plugger.h>
6#include <bu/sio.h>
7
8using namespace Bu;
9
10PluginInterface3( plugin_interface_gats, gats, InterfaceGats,
11 Interface, "Mike Buland", 1, 0 );
12
13InterfaceGats::InterfaceGats()
14{
15}
16
17InterfaceGats::~InterfaceGats()
18{
19}
20
21void InterfaceGats::display( const SmlNode *pSml )
22{
23 switch( pSml->getType() )
24 {
25 case SmlNode::typeRoot:
26 sio << "<p>";
27 for( SmlNode::SmlNodeList::const_iterator i =
28 pSml->getChildren().begin(); i; i++ )
29 {
30 display( *i );
31 }
32 sio << "</p>";
33 break;
34
35 case SmlNode::typeText:
36 sio << pSml->getText();
37 break;
38
39 case SmlNode::typeTag:
40 if( pSml->getChildren().isEmpty() )
41 {
42 if( pSml->getText() == "break" )
43 sio << "</p><p>";
44 }
45 else
46 {
47 if( pSml->getText() == "red" )
48 {
49 sio << "<span style=\"color: red;\">";
50 for( SmlNode::SmlNodeList::const_iterator i =
51 pSml->getChildren().begin(); i; i++ )
52 {
53 display( *i );
54 }
55 sio << "</span>";
56 }
57 else if( pSml->getText() == "green" )
58 {
59 sio << "<span style=\"color: green;\">";
60 for( SmlNode::SmlNodeList::const_iterator i =
61 pSml->getChildren().begin(); i; i++ )
62 {
63 display( *i );
64 }
65 sio << "</span>";
66 }
67 }
68 break;
69 }
70}
71