MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / print_class

Function print_class

ogsr_engine/xrGame/script_engine_help.cpp:154–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154static void print_class(lua_State* L, luabind::detail::class_rep* crep)
155{
156 luabind::internal_string S;
157 // print class and bases
158 {
159 S = (crep->get_class_type() != luabind::detail::class_rep::cpp_class) ? "LUA class " : "C++ class ";
160 S.append(crep->name());
161 typedef luabind::internal_vector<luabind::detail::class_rep::base_info> BASES;
162 const BASES& bases = crep->bases();
163 BASES::const_iterator I = bases.begin(), B = I;
164 BASES::const_iterator E = bases.end();
165 if (B != E)
166 S.append(" : ");
167 for (; I != E; ++I)
168 {
169 if (I != B)
170 S.append(",");
171 S.append((*I).base->name());
172 }
173 FastMsg("%s {", S.c_str());
174 }
175 // print class constants
176 {
177 const luabind::detail::class_rep::STATIC_CONSTANTS& constants = crep->static_constants();
178 luabind::detail::class_rep::STATIC_CONSTANTS::const_iterator I = constants.begin();
179 luabind::detail::class_rep::STATIC_CONSTANTS::const_iterator E = constants.end();
180 for (; I != E; ++I)
181 FastMsg(" const %s = %d;", (*I).first, (*I).second);
182 if (!constants.empty())
183 FastMsg(" ");
184 }
185 // print class properties
186 using namespace luabind::detail;
187 {
188 typedef luabind::internal_map<const char*, luabind::detail::class_rep::callback, luabind::detail::ltstr> PROPERTIES;
189 const PROPERTIES& properties = crep->properties();
190 const PROPERTIES& properties_rw = crep->properties_rw();
191 PROPERTIES::const_iterator I = properties.begin();
192 PROPERTIES::const_iterator E = properties.end();
193 for (; I != E; ++I)
194 {
195 LPCSTR pname = (*I).first;
196 PROPERTIES::const_iterator X = properties_rw.find(pname);
197
198 luabind::internal_string cname = "";
199 if (X != properties_rw.end())
200 {
201 luabind::detail::class_rep::callback cb = properties_rw.at(pname);
202 if ((size_t)cb.sig > 0x1000u)
203 cb.sig(L, cname);
204
205 FastMsg(" property\t\t\t%-25s%s;", pname, extract_last_params(cname).c_str());
206 }
207 else
208 FastMsg(" property\t\t\t%s;", pname);
209 }
210 if (!properties.empty())
211 FastMsg(" ");

Callers

nothing calls this directly

Calls 14

FastMsgFunction · 0.85
strreplaceallFunction · 0.85
to_stringFunction · 0.85
member_to_stringFunction · 0.85
atMethod · 0.80
keyMethod · 0.80
appendMethod · 0.45
nameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected