1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <precomp.h>
23 #include <s2_dsapi/tk_xml.hxx>
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <s2_dsapi/tokintpr.hxx>
28 
29 using csi::dsapi::Tok_XmlConst;
30 using csi::dsapi::Tok_XmlLink_Tag;
31 using csi::dsapi::Tok_XmlFormat_Tag;
32 
33 
34 lux::EnumValueMap			G_aTok_XmlConst_EV_TokenId_Values;
35 Tok_XmlConst::EV_TokenId    ev_consts_none(Tok_XmlConst::e_none,"");
36 Tok_XmlConst::EV_TokenId    ev_e_true(Tok_XmlConst::e_true,"true");
37 Tok_XmlConst::EV_TokenId    ev_e_false(Tok_XmlConst::e_false,"false");
38 Tok_XmlConst::EV_TokenId    ev_e_null(Tok_XmlConst::e_null,"NULL");
39 Tok_XmlConst::EV_TokenId    ev_e_void(Tok_XmlConst::e_void,"void");
40 
41 lux::EnumValueMap	        G_aTok_XmlLink_Tag_EV_TokenId_Values;
42 Tok_XmlLink_Tag::EV_TokenId ev_linktags_none(Tok_XmlLink_Tag::e_none,"");
43 Tok_XmlLink_Tag::EV_TokenId ev_e_const(Tok_XmlLink_Tag::e_const,"const");
44 Tok_XmlLink_Tag::EV_TokenId ev_member(Tok_XmlLink_Tag::member,"member");
45 Tok_XmlLink_Tag::EV_TokenId ev_type(Tok_XmlLink_Tag::type,"type");
46 
47 lux::EnumValueMap	        	G_aTok_XmlFormat_Tag_EV_TokenId_Values;
48 Tok_XmlFormat_Tag::EV_TokenId   ev_formattags_none(Tok_XmlFormat_Tag::e_none,"");
49 Tok_XmlFormat_Tag::EV_TokenId   ev_code(Tok_XmlFormat_Tag::code,"code");
50 Tok_XmlFormat_Tag::EV_TokenId   ev_listing(Tok_XmlFormat_Tag::listing,"listing");
51 Tok_XmlFormat_Tag::EV_TokenId   ev_atom(Tok_XmlFormat_Tag::atom,"code");
52 
53 
54 namespace lux
55 {
56 
57 template<> EnumValueMap &
Values_()58 Tok_XmlConst::EV_TokenId::Values_()	        { return G_aTok_XmlConst_EV_TokenId_Values; }
59 template<> EnumValueMap &
Values_()60 Tok_XmlLink_Tag::EV_TokenId::Values_()	    { return G_aTok_XmlLink_Tag_EV_TokenId_Values; }
61 template<> EnumValueMap &
Values_()62 Tok_XmlFormat_Tag::EV_TokenId::Values_()	{ return G_aTok_XmlFormat_Tag_EV_TokenId_Values; }
63 
64 }   // namespace lux
65 
66 
67 
68 namespace csi
69 {
70 namespace dsapi
71 {
72 
73 void
Trigger(TokenInterpreter & io_rInterpreter) const74 Tok_XmlConst::Trigger( TokenInterpreter &	io_rInterpreter ) const
75 {
76 	io_rInterpreter.Process_XmlConst(*this);
77 }
78 
79 const char *
Text() const80 Tok_XmlConst::Text() const
81 {
82 	return eTag.Text();
83 }
84 
85 void
Trigger(TokenInterpreter & io_rInterpreter) const86 Tok_XmlLink_BeginTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
87 {
88 	io_rInterpreter.Process_XmlLink_BeginTag(*this);
89 }
90 
91 const char *
Text() const92 Tok_XmlLink_BeginTag::Text() const
93 {
94     static StreamStr ret(120);
95     ret.seekp(0);
96 	if (sScope.length() > 0)
97 	{
98         ret << "<"
99             << eTag.Text()
100             << " scope=\""
101             << sScope
102             << "\">";
103     }
104 	else
105     {
106         ret << "<"
107             << eTag.Text()
108             << ">";
109     }
110     return ret.c_str();
111 }
112 
113 void
Trigger(TokenInterpreter & io_rInterpreter) const114 Tok_XmlLink_EndTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
115 {
116 	io_rInterpreter.Process_XmlLink_EndTag(*this);
117 }
118 
119 const char *
Text() const120 Tok_XmlLink_EndTag::Text() const
121 {
122     static StreamStr ret(120);
123     ret.seekp(0);
124     ret << "</"
125         << eTag.Text()
126         << ">";
127     return ret.c_str();
128 }
129 
130 void
Trigger(TokenInterpreter & io_rInterpreter) const131 Tok_XmlFormat_BeginTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
132 {
133 	io_rInterpreter.Process_XmlFormat_BeginTag(*this);
134 }
135 
136 const char *
Text() const137 Tok_XmlFormat_BeginTag::Text() const
138 {
139     static StreamStr ret(120);
140     ret.seekp(0);
141     ret << "<"
142         << eTag.Text()
143         << ">";
144     return ret.c_str();
145 }
146 
147 void
Trigger(TokenInterpreter & io_rInterpreter) const148 Tok_XmlFormat_EndTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
149 {
150 	io_rInterpreter.Process_XmlFormat_EndTag(*this);
151 }
152 
153 const char *
Text() const154 Tok_XmlFormat_EndTag::Text() const
155 {
156     static StreamStr ret(120);
157     ret.seekp(0);
158     ret << "</"
159         << eTag.Text()
160         << ">";
161     return ret.c_str();
162 }
163 
164 
165 }   // namespace dsapi
166 }   // namespace csi
167 
168 
169