Fawkes API  Fawkes Development Version
message.cpp
1 
2 /***************************************************************************
3  * message.cpp - Interface generator message representation
4  *
5  * Generated: Wed Oct 11 22:24:16 2006 (Germany - Slowakia 4:1)
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <interfaces/generator/exceptions.h>
24 #include <interfaces/generator/message.h>
25 
26 /** @class InterfaceMessage message.h <interfaces/generator/message.h>
27  * Interface generator internal representation of a message as parsed from
28  * the XML template file.
29  */
30 
31 /** Constructor
32  * @param name name of message
33  * @param comment comment of message
34  */
35 InterfaceMessage::InterfaceMessage(const std::string &name, const std::string &comment)
36 {
37  if (name.find("Message") != std::string::npos) {
38  this->name = name;
39  } else {
40  this->name = name + "Message";
41  }
42  this->comment = comment;
43  fields.clear();
44 }
45 
46 /** Get name of message.
47  * @return name of message.
48  */
49 std::string
51 {
52  return name;
53 }
54 
55 /** Get comment of message.
56  * @return comment of message.
57  */
58 std::string
60 {
61  return comment;
62 }
63 
64 /** Set fields of message.
65  * @param fields fields of message.
66  */
67 void
68 InterfaceMessage::setFields(const std::vector<InterfaceField> &fields)
69 {
70  this->fields = fields;
71 }
72 
73 /** Get fields of message.
74  * @return fields of message.
75  */
76 std::vector<InterfaceField>
78 {
79  return fields;
80 }
InterfaceMessage::getName
std::string getName()
Get name of message.
Definition: message.cpp:49
InterfaceMessage::getComment
std::string getComment()
Get comment of message.
Definition: message.cpp:58
InterfaceMessage::getFields
std::vector< InterfaceField > getFields()
Get fields of message.
Definition: message.cpp:76
InterfaceMessage::setFields
void setFields(const std::vector< InterfaceField > &fields)
Set fields of message.
Definition: message.cpp:67
InterfaceMessage::InterfaceMessage
InterfaceMessage(const std::string &name, const std::string &comment)
Constructor.
Definition: message.cpp:34