Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * parser.cpp - Interface config parser 00004 * 00005 * Generated: Tue Oct 10 17:41:13 2006 00006 * Copyright 2006 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #include "parser.h" 00024 #include "exceptions.h" 00025 00026 #include <utils/misc/string_conversions.h> 00027 00028 #include <iostream> 00029 #include <vector> 00030 00031 #include <libxml++/libxml++.h> 00032 00033 using namespace std; 00034 using namespace xmlpp; 00035 00036 00037 /** @class InterfaceParser interfaces/generator/parser.h 00038 * Parser used to get information out of interface template. Uses 00039 * XML parser internally. 00040 */ 00041 00042 00043 /** Constructor 00044 * @param config_filename file name of config (interface template) 00045 */ 00046 InterfaceParser::InterfaceParser(std::string config_filename) 00047 { 00048 dom = new DomParser(); 00049 //dom->set_validate(); 00050 dom->set_substitute_entities(); 00051 dom->parse_file(config_filename); 00052 root = dom->get_document()->get_root_node(); 00053 if ( root == NULL ) { 00054 throw InterfaceGeneratorInvalidDocumentException("root == NULL"); 00055 } 00056 } 00057 00058 00059 /** Destructor. */ 00060 InterfaceParser::~InterfaceParser() 00061 { 00062 delete dom; 00063 } 00064 00065 00066 /** Get parsed fields. 00067 * Get fields stored below the given node. 00068 * @param node root node where to start searching 00069 * @return vector of field representations. 00070 */ 00071 std::vector<InterfaceField> 00072 InterfaceParser::getFields(xmlpp::Node *node) 00073 { 00074 vector<InterfaceField> result; 00075 NodeSet set = node->find("field"); 00076 for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) { 00077 InterfaceField f(&enum_constants); 00078 00079 const Element * el = dynamic_cast<const Element *>(*i); 00080 if ( el ) { 00081 // valid element 00082 const Element::AttributeList& attrs = el->get_attributes(); 00083 for(Element::AttributeList::const_iterator iter = attrs.begin(); iter != attrs.end(); ++iter) { 00084 const Attribute* attr = *iter; 00085 //std::cout << " Attribute " << attr->get_name() << " = " << attr->get_value() << std::endl; 00086 f.setAttribute(attr->get_name(), attr->get_value()); 00087 } 00088 } else { 00089 throw InterfaceGeneratorInvalidContentException("constant is not an element"); 00090 } 00091 00092 // Get field comment 00093 NodeSet nameset = (*i)->find("text()"); 00094 if ( nameset.size() == 0 ) { 00095 throw InterfaceGeneratorInvalidContentException("no comment for field %s", f.getName().c_str()); 00096 } 00097 const TextNode *comment_node = dynamic_cast<const TextNode *>(nameset[0]); 00098 if ( ! comment_node ) { 00099 throw InterfaceGeneratorInvalidContentException("comment node not text node for constant"); 00100 } 00101 f.setComment(comment_node->get_content()); 00102 00103 //std::cout << "Field name: " << field_name << std::endl; 00104 try { 00105 f.valid(); 00106 result.push_back(f); 00107 } catch ( fawkes::Exception &e ) { 00108 e.print_trace(); 00109 } 00110 } 00111 for (vector<InterfaceField>::iterator i = result.begin(); i != result.end(); ++i) { 00112 for (vector<InterfaceField>::iterator j = i + 1; j != result.end(); ++j) { 00113 if ( (*i).getName() == (*j).getName() ) { 00114 throw InterfaceGeneratorAmbiguousNameException((*i).getName().c_str(), "field"); 00115 } 00116 } 00117 } 00118 00119 return result; 00120 } 00121 00122 00123 /** Get parsed pseudo maps. 00124 * Get pseudo maps stored below the given node. 00125 * @param node root node where to start searching 00126 * @param fields vector of parsed fields, used to detect name clashes 00127 * @return vector of pseudo map representations. 00128 */ 00129 std::vector<InterfacePseudoMap> 00130 InterfaceParser::getPseudoMaps(xmlpp::Node *node, std::vector<InterfaceField> &fields) 00131 { 00132 vector<InterfacePseudoMap> result; 00133 NodeSet set = node->find("pseudomap"); 00134 for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) { 00135 const Element *el = dynamic_cast<const Element *>(*i); 00136 std::string pm_name, pm_type, pm_keytype; 00137 00138 if ( el ) { 00139 Attribute *attr; 00140 attr = el->get_attribute("name"); 00141 if ( ! attr ) throw InterfaceGeneratorInvalidContentException("no name for pseudo map"); 00142 pm_name = attr->get_value(); 00143 00144 attr = el->get_attribute("type"); 00145 if ( ! attr ) throw InterfaceGeneratorInvalidContentException("no type for pseudo map"); 00146 pm_type = attr->get_value(); 00147 00148 attr = el->get_attribute("keytype"); 00149 if ( ! attr ) throw InterfaceGeneratorInvalidContentException("no key type for pseudo map"); 00150 pm_keytype = attr->get_value(); 00151 } else { 00152 throw InterfaceGeneratorInvalidContentException("pseudo map is not an element"); 00153 } 00154 00155 NodeSet comment_set = (*i)->find("text()"); 00156 if ( comment_set.size() == 0) { 00157 throw InterfaceGeneratorInvalidContentException("pseudo map without comment"); 00158 } 00159 std::string pm_comment = ""; 00160 const TextNode *comment_node = dynamic_cast<const TextNode *>(comment_set[0]); 00161 if ( comment_node ) { 00162 pm_comment = comment_node->get_content(); 00163 } else { 00164 throw InterfaceGeneratorInvalidContentException("pseudo map comment not a text node"); 00165 } 00166 00167 InterfacePseudoMap pm(pm_name, pm_type, pm_keytype, pm_comment); 00168 00169 NodeSet ref_nodes = (*i)->find("mapref"); 00170 for (NodeSet::iterator r = ref_nodes.begin(); r != ref_nodes.end(); ++r) { 00171 NodeSet ref_set = (*r)->find("text()"); 00172 if ( ref_set.size() == 0) { 00173 throw InterfaceGeneratorInvalidContentException("pseudo map without referenced field"); 00174 } 00175 00176 const Element *el = dynamic_cast<const Element *>(*r); 00177 Attribute *attr; 00178 attr = el->get_attribute("key"); 00179 if ( ! attr ) throw InterfaceGeneratorInvalidContentException("no key for mapref map"); 00180 std::string mapref_key = attr->get_value(); 00181 00182 const TextNode *text_node = dynamic_cast<const TextNode *>(ref_set[0]); 00183 if ( text_node ) { 00184 // find field in data fields 00185 bool found = false; 00186 for (vector<InterfaceField>::iterator j = fields.begin(); j != fields.end(); ++j) { 00187 if ( (*j).getName() == text_node->get_content() ) { 00188 // field found 00189 if ( j->getLengthValue() > 0 ) { 00190 throw InterfaceGeneratorInvalidContentException("pseudomap references may only point to non-map types"); 00191 } 00192 pm.addRef(text_node->get_content(), mapref_key); 00193 found = true; 00194 break; 00195 } 00196 } 00197 if (! found) { 00198 throw InterfaceGeneratorInvalidContentException("reference to non-existing data field"); 00199 } 00200 00201 } else { 00202 throw InterfaceGeneratorInvalidContentException("message ref not a text node"); 00203 } 00204 } 00205 00206 00207 try { 00208 pm.valid(); 00209 result.push_back(pm); 00210 } catch ( fawkes::Exception &e ) { 00211 e.print_trace(); 00212 } 00213 } 00214 for (vector<InterfacePseudoMap>::iterator i = result.begin(); i != result.end(); ++i) { 00215 for (vector<InterfacePseudoMap>::iterator j = i + 1; j != result.end(); ++j) { 00216 if ( (*i).getName() == (*j).getName() ) { 00217 throw InterfaceGeneratorAmbiguousNameException((*i).getName().c_str(), "field"); 00218 } 00219 } 00220 for (vector<InterfaceField>::iterator f = fields.begin(); f != fields.end(); ++f) { 00221 if ( i->getName() == f->getName() ) { 00222 throw InterfaceGeneratorAmbiguousNameException((*i).getName().c_str(), "pseudo map"); 00223 } 00224 } 00225 } 00226 00227 return result; 00228 } 00229 00230 00231 /** Print fields. 00232 * Print fields to stdout. 00233 * @param fields fields to print 00234 */ 00235 void 00236 InterfaceParser::printFields(vector<InterfaceField> &fields) 00237 { 00238 for (vector<InterfaceField>::iterator i = fields.begin(); i != fields.end(); ++i) { 00239 cout << " Field: name=" << (*i).getName() << " type=" << (*i).getType(); 00240 if ( (*i).getLength() != "" ) { 00241 cout << " length=" << (*i).getLength(); 00242 } 00243 if ( (*i).getValidFor() != "" ) { 00244 cout << " validfor=" << (*i).getValidFor(); 00245 } 00246 if ( (*i).getDefaultValue() != "" ) { 00247 cout << " default=" << (*i).getDefaultValue(); 00248 } 00249 vector<string> flags = (*i).getFlags(); 00250 if ( flags.size() > 0 ) { 00251 cout << " flags="; 00252 vector<string>::iterator j = flags.begin(); 00253 while (j != flags.end()) { 00254 cout << *j; 00255 ++j; 00256 if ( j != flags.end()) { 00257 cout << ","; 00258 } 00259 } 00260 } 00261 cout << endl; 00262 } 00263 } 00264 00265 /** Print pseudo maps. 00266 * @param pseudo_maps pseudo maps to print 00267 */ 00268 void 00269 InterfaceParser::printPseudoMaps(vector<InterfacePseudoMap> &pseudo_maps) 00270 { 00271 for (vector<InterfacePseudoMap>::iterator i = pseudo_maps.begin(); i != pseudo_maps.end(); ++i) { 00272 cout << " PseudoMap: name=" << i->getName() 00273 << " type=" << i->getType() 00274 << " keytype=" << i->getKeyType() << endl; 00275 InterfacePseudoMap::RefList &reflist = i->getRefList(); 00276 00277 InterfacePseudoMap::RefList::iterator j; 00278 for (j = reflist.begin(); j != reflist.end(); ++j) { 00279 cout << " Ref: field=" << j->first 00280 << " key=" << j->second << endl; 00281 } 00282 00283 cout << endl; 00284 } 00285 } 00286 00287 00288 /** Print parsed config. 00289 * @param constants parsed constants 00290 * @param enum_constants parsed enum_constants 00291 * @param data_fields parsed data fields 00292 * @param pseudo_maps pseudo maps 00293 * @param messages parsed messages. 00294 */ 00295 void 00296 InterfaceParser::printParsed(vector<InterfaceConstant> & constants, 00297 vector<InterfaceEnumConstant> & enum_constants, 00298 vector<InterfaceField> & data_fields, 00299 vector<InterfacePseudoMap> & pseudo_maps, 00300 vector<InterfaceMessage> & messages) 00301 { 00302 cout << "Constants" << endl; 00303 for (vector<InterfaceConstant>::iterator i = constants.begin(); i != constants.end(); ++i) { 00304 cout << " Constant: name=" << (*i).getName() << " type=" << (*i).getType() 00305 << " value=" << (*i).getValue() << endl; 00306 } 00307 00308 cout << "EnumConstants" << endl; 00309 for (vector<InterfaceEnumConstant>::iterator i = enum_constants.begin(); i != enum_constants.end(); ++i) { 00310 cout << " EnumConstant: name=" << (*i).get_name() << endl; 00311 vector<InterfaceEnumConstant::EnumItem> items = (*i).get_items(); 00312 vector<InterfaceEnumConstant::EnumItem>::iterator j; 00313 for (j = items.begin(); j != items.end(); ++j) { 00314 cout << " Item: " << j->name << "(" << j->comment << ")" << endl; 00315 } 00316 } 00317 00318 cout << "Data block" << endl; 00319 printFields(data_fields); 00320 printPseudoMaps(pseudo_maps); 00321 for (vector<InterfaceMessage>::iterator i = messages.begin(); i != messages.end(); ++i) { 00322 cout << "Message: name=" << (*i).getName() << endl; 00323 vector<InterfaceField> msg_fields = (*i).getFields(); 00324 printFields(msg_fields); 00325 } 00326 } 00327 00328 00329 /** Print parsed data. */ 00330 void 00331 InterfaceParser::print() 00332 { 00333 printParsed(constants, enum_constants, data_fields, pseudo_maps, messages); 00334 } 00335 00336 00337 /** Parse config. */ 00338 void 00339 InterfaceParser::parse() 00340 { 00341 NodeSet set; 00342 00343 constants.clear(); 00344 enum_constants.clear(); 00345 data_fields.clear(); 00346 messages.clear(); 00347 00348 /* 00349 * Name and author 00350 * 00351 */ 00352 const Element * el = dynamic_cast<const Element *>(root); 00353 if ( el ) { 00354 // valid element 00355 Attribute *attr; 00356 attr = el->get_attribute("name"); 00357 if ( ! attr ) { 00358 throw InterfaceGeneratorInvalidContentException("no name for interface"); 00359 } 00360 name = attr->get_value(); 00361 00362 attr = el->get_attribute("author"); 00363 if ( attr ) { 00364 author = attr->get_value(); 00365 } 00366 attr = el->get_attribute("year"); 00367 if ( attr ) { 00368 year = attr->get_value(); 00369 } 00370 attr = el->get_attribute("created"); 00371 if ( attr ) { 00372 creation_date = attr->get_value(); 00373 } 00374 } else { 00375 throw InterfaceGeneratorInvalidContentException("root is not an element"); 00376 } 00377 00378 /* 00379 * constants 00380 * 00381 */ 00382 NodeSet constants_set = root->find("/interface/constants"); 00383 if ( constants_set.size() > 1 ) { 00384 throw InterfaceGeneratorInvalidContentException("more than one constants block"); 00385 } 00386 if ( constants_set.size() == 1 ) { 00387 // there are actually constants 00388 set = constants_set[0]->find("constant"); 00389 for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) { 00390 00391 // Get constant name 00392 NodeSet nameset = (*i)->find("text()"); 00393 if ( nameset.size() == 0 ) { 00394 throw InterfaceGeneratorInvalidContentException("no name for constant"); 00395 } 00396 const TextNode *comment_node = dynamic_cast<const TextNode *>(nameset[0]); 00397 if ( ! comment_node ) { 00398 throw InterfaceGeneratorInvalidContentException("name node not text node for constant"); 00399 } 00400 std::string const_comment = comment_node->get_content(); 00401 //std::cout << "Constant name: " << const_name << std::endl; 00402 00403 // Get attributes 00404 std::string type; 00405 std::string value; 00406 std::string const_name; 00407 00408 el = dynamic_cast<const Element *>(*i); 00409 if ( el ) { 00410 // valid element 00411 Attribute *attr; 00412 attr = el->get_attribute("type"); 00413 if ( ! attr ) { 00414 throw InterfaceGeneratorInvalidContentException("no type for constant"); 00415 } 00416 type = attr->get_value(); 00417 00418 attr = el->get_attribute("name"); 00419 if ( ! attr ) { 00420 throw InterfaceGeneratorInvalidContentException("no name for constant"); 00421 } 00422 const_name = attr->get_value(); 00423 00424 attr = el->get_attribute("value"); 00425 if ( ! attr ) { 00426 throw InterfaceGeneratorInvalidContentException("no value for constant"); 00427 } 00428 value = attr->get_value(); 00429 } else { 00430 throw InterfaceGeneratorInvalidContentException("constant is not an element"); 00431 } 00432 00433 // Generate constant object 00434 try { 00435 InterfaceConstant constant(const_name, type, value, const_comment); 00436 constants.push_back(constant); 00437 } catch (InterfaceGeneratorInvalidTypeException &e) { 00438 e.print_trace(); 00439 } catch (InterfaceGeneratorInvalidValueException &e) { 00440 e.print_trace(); 00441 } 00442 } 00443 for (vector<InterfaceConstant>::iterator i = constants.begin(); i != constants.end(); ++i) { 00444 for (vector<InterfaceConstant>::iterator j = i + 1; j != constants.end(); ++j) { 00445 if ( (*i).getName() == (*j).getName() ) { 00446 throw InterfaceGeneratorAmbiguousNameException((*i).getName().c_str(), "constant"); 00447 } 00448 } 00449 } 00450 00451 /* 00452 * enums 00453 * 00454 */ 00455 set = constants_set[0]->find("enum"); 00456 for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) { 00457 00458 std::string enum_comment; 00459 NodeSet comment_set = (*i)->find("comment/text()"); 00460 if ( comment_set.size() == 0 ) { 00461 throw InterfaceGeneratorInvalidContentException("no comment for enum"); 00462 } else { 00463 const TextNode *comment_node = dynamic_cast<const TextNode *>(comment_set[0]); 00464 if ( comment_node ) { 00465 enum_comment = comment_node->get_content(); 00466 } else { 00467 throw InterfaceGeneratorInvalidContentException("enum comment not a text node"); 00468 } 00469 } 00470 00471 string enum_name; 00472 el = dynamic_cast<const Element *>(*i); 00473 if ( el ) { 00474 // valid element 00475 Attribute *attr; 00476 attr = el->get_attribute("name"); 00477 if ( ! attr ) { 00478 throw InterfaceGeneratorInvalidContentException("no name for enum"); 00479 } 00480 enum_name = attr->get_value(); 00481 00482 } else { 00483 throw InterfaceGeneratorInvalidContentException("enum is not an element"); 00484 } 00485 00486 InterfaceEnumConstant enum_constant(enum_name, enum_comment); 00487 00488 // Get constant name 00489 NodeSet items = (*i)->find("item"); 00490 if ( items.size() == 0 ) { 00491 throw InterfaceGeneratorInvalidContentException("no items for enum"); 00492 } 00493 00494 for (NodeSet::iterator j = items.begin(); j != items.end(); ++j) { 00495 00496 std::string item_name; 00497 std::string item_value; 00498 el = dynamic_cast<const Element *>(*j); 00499 if ( el ) { 00500 // valid element 00501 Attribute *attr; 00502 attr = el->get_attribute("name"); 00503 if ( ! attr ) { 00504 throw InterfaceGeneratorInvalidContentException("no name for enum item"); 00505 } 00506 item_name = attr->get_value(); 00507 00508 Attribute *val_attr; 00509 val_attr = el->get_attribute("value"); 00510 if ( val_attr ) { 00511 item_value = val_attr->get_value(); 00512 } 00513 00514 } else { 00515 throw InterfaceGeneratorInvalidContentException("enum item is not an element"); 00516 } 00517 00518 comment_set = (*j)->find("text()"); 00519 if ( comment_set.size() == 0) { 00520 throw InterfaceGeneratorInvalidContentException("enum item without comment"); 00521 } 00522 const TextNode *comment_node = dynamic_cast<const TextNode *>(comment_set[0]); 00523 if ( comment_node ) { 00524 if (item_value != "") { 00525 enum_constant.add_item(item_name, comment_node->get_content(), 00526 fawkes::StringConversions::to_int(item_value)); 00527 } else { 00528 enum_constant.add_item(item_name, comment_node->get_content()); 00529 } 00530 } else { 00531 throw InterfaceGeneratorInvalidContentException("enum comment not a text node"); 00532 } 00533 } 00534 00535 enum_constants.push_back(enum_constant); 00536 } 00537 vector<InterfaceEnumConstant>::iterator i; 00538 for (i = enum_constants.begin(); i != enum_constants.end(); ++i) { 00539 vector<InterfaceEnumConstant>::iterator j; 00540 for (j = i + 1; j != enum_constants.end(); ++j) { 00541 if ( i->get_name() == j->get_name() ) { 00542 throw InterfaceGeneratorAmbiguousNameException((*i).get_name().c_str(), "enum constant"); 00543 } 00544 } 00545 } 00546 } 00547 00548 /* 00549 * data 00550 * 00551 */ 00552 set = root->find("/interface/data"); 00553 if ( set.size() > 1 ) { 00554 throw InterfaceGeneratorInvalidContentException("more than one data block"); 00555 } else if ( set.size() == 0 ) { 00556 throw InterfaceGeneratorInvalidContentException("no data block"); 00557 } 00558 00559 data_fields = getFields(set[0]); 00560 if ( data_fields.size() == 0 ) { 00561 throw InterfaceGeneratorInvalidContentException("data block contains no field"); 00562 } 00563 00564 pseudo_maps = getPseudoMaps(set[0], data_fields); 00565 00566 NodeSet comment_set = root->find("/interface/data/comment/text()"); 00567 if ( comment_set.size() == 0) { 00568 throw InterfaceGeneratorInvalidContentException("data block without comment"); 00569 } 00570 const TextNode *comment_node = dynamic_cast<const TextNode *>(comment_set[0]); 00571 if ( comment_node ) { 00572 data_comment = comment_node->get_content(); 00573 } else { 00574 throw InterfaceGeneratorInvalidContentException("data block comment not a text node"); 00575 } 00576 00577 /* 00578 * Messages 00579 * 00580 */ 00581 set = root->find("/interface/message"); 00582 for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) { 00583 std::string msg_name; 00584 std::string msg_comment; 00585 00586 el = dynamic_cast<const Element *>(*i); 00587 if ( el ) { 00588 Attribute *attr; 00589 attr = el->get_attribute("name"); 00590 if ( ! attr ) { 00591 throw InterfaceGeneratorInvalidContentException("no name for message"); 00592 } 00593 msg_name = attr->get_value(); 00594 } else { 00595 throw InterfaceGeneratorInvalidContentException("message is not an element"); 00596 } 00597 00598 comment_set = (*i)->find("text()"); 00599 if ( comment_set.size() == 0) { 00600 throw InterfaceGeneratorInvalidContentException("message without comment"); 00601 } 00602 comment_node = dynamic_cast<const TextNode *>(comment_set[0]); 00603 if ( comment_node ) { 00604 msg_comment = comment_node->get_content(); 00605 } else { 00606 throw InterfaceGeneratorInvalidContentException("message comment not a text node"); 00607 } 00608 00609 00610 vector<InterfaceField> msg_fields = getFields(*i); 00611 00612 NodeSet ref_nodes = (*i)->find("ref/text()"); 00613 for (NodeSet::iterator r = ref_nodes.begin(); r != ref_nodes.end(); ++r) { 00614 const TextNode *text_node = dynamic_cast<const TextNode *>(*r); 00615 if ( text_node ) { 00616 // find field in data fields 00617 bool found = false; 00618 for (vector<InterfaceField>::iterator j = data_fields.begin(); j != data_fields.end(); ++j) { 00619 if ( (*j).getName() == text_node->get_content() ) { 00620 // field found 00621 msg_fields.push_back(*j); 00622 found = true; 00623 break; 00624 } 00625 } 00626 if (! found) { 00627 throw InterfaceGeneratorInvalidContentException("reference to non-existing data field"); 00628 } 00629 } else { 00630 throw InterfaceGeneratorInvalidContentException("message ref not a text node"); 00631 } 00632 } 00633 for (vector<InterfaceField>::iterator k = msg_fields.begin(); k != msg_fields.end(); ++k) { 00634 for (vector<InterfaceField>::iterator j = k + 1; j != msg_fields.end(); ++j) { 00635 if ( (*k).getName() == (*j).getName() ) { 00636 throw InterfaceGeneratorAmbiguousNameException((*k).getName().c_str(), "message field"); 00637 } 00638 } 00639 } 00640 00641 InterfaceMessage msg(msg_name, msg_comment); 00642 msg.setFields(msg_fields); 00643 00644 messages.push_back(msg); 00645 } 00646 00647 } 00648 00649 00650 /** Get interface name. 00651 * Only valid after parse(). 00652 * @return interface name. 00653 */ 00654 std::string 00655 InterfaceParser::getInterfaceName() 00656 { 00657 return name; 00658 } 00659 00660 00661 /** Get interface author. 00662 * Only valid after parse(). 00663 * @return interface author. 00664 */ 00665 std::string 00666 InterfaceParser::getInterfaceAuthor() 00667 { 00668 return author; 00669 } 00670 00671 00672 /** Get interface copyright year. 00673 * Only valid after parse(). 00674 * @return interface copyright year 00675 */ 00676 std::string 00677 InterfaceParser::getInterfaceYear() 00678 { 00679 return year; 00680 } 00681 00682 00683 /** Get interface creation date as string 00684 * Only valid after parse(). 00685 * @return interface creation date 00686 */ 00687 std::string 00688 InterfaceParser::getInterfaceCreationDate() 00689 { 00690 return creation_date; 00691 } 00692 00693 00694 /** Get constants. 00695 * Only valid after parse(). 00696 * @return constants. 00697 */ 00698 std::vector<InterfaceConstant> 00699 InterfaceParser::getConstants() 00700 { 00701 return constants; 00702 } 00703 00704 00705 /** Get enum constants. 00706 * Only valid after parse(). 00707 * @return enum constants. 00708 */ 00709 std::vector<InterfaceEnumConstant> 00710 InterfaceParser::getEnumConstants() 00711 { 00712 return enum_constants; 00713 } 00714 00715 00716 /** Get data fields. 00717 * Only valid after parse(). 00718 * @return data fields. 00719 */ 00720 std::vector<InterfaceField> 00721 InterfaceParser::getDataFields() 00722 { 00723 return data_fields; 00724 } 00725 00726 00727 /** Get data pseudo maps. 00728 * Only valid after parse(). 00729 * @return pseudo maps 00730 */ 00731 std::vector<InterfacePseudoMap> 00732 InterfaceParser::getPseudoMaps() 00733 { 00734 return pseudo_maps; 00735 } 00736 00737 00738 /** Get data comment. 00739 * Only valid after parse(). 00740 * @return data comment. 00741 */ 00742 std::string 00743 InterfaceParser::getDataComment() 00744 { 00745 return data_comment; 00746 } 00747 00748 00749 /** Get messages. 00750 * Only valid after parse(). 00751 * @return messages. 00752 */ 00753 std::vector<InterfaceMessage> 00754 InterfaceParser::getMessages() 00755 { 00756 return messages; 00757 }