kodi
PltArgument.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - Action Argument
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
21 |
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
32 |
33 ****************************************************************/
34 
39 #ifndef _PLT_ARGUMENT_H_
40 #define _PLT_ARGUMENT_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "Neptune.h"
46 
47 /*----------------------------------------------------------------------
48 | forward declarations
49 +---------------------------------------------------------------------*/
50 class PLT_StateVariable;
51 class PLT_Argument;
52 class PLT_ActionDesc;
54 
55 /*----------------------------------------------------------------------
56 | PLT_ArgumentDesc
57 +---------------------------------------------------------------------*/
65 {
66 public:
67  PLT_ArgumentDesc(const char* name,
68  NPT_Ordinal position,
69  const char* direction = "in",
70  PLT_StateVariable* variable = NULL,
71  bool has_ret = false);
72 
73  // accessor methods
74  NPT_Result GetSCPDXML(NPT_XmlElementNode* node);
75  const NPT_String& GetName() const { return m_Name; }
76  const NPT_String& GetDirection() const { return m_Direction; }
77  NPT_Ordinal GetPosition() { return m_Position; }
78  PLT_StateVariable* GetRelatedStateVariable() { return m_RelatedStateVariable; }
79  bool HasReturnValue() { return m_HasReturnValue; }
80 
81 protected:
82  NPT_String m_Name;
83  NPT_Ordinal m_Position;
84  NPT_String m_Direction;
85  PLT_StateVariable* m_RelatedStateVariable;
86  bool m_HasReturnValue;
87 };
88 
89 /*----------------------------------------------------------------------
90 | PLT_Argument
91 +---------------------------------------------------------------------*/
100 {
101 public:
102  PLT_Argument(PLT_ArgumentDesc& arg_desc);
103 
104  // class methods
105  static NPT_Result CreateArgument(PLT_ActionDesc& action_desc,
106  const char* arg_name,
107  const char* arg_value,
108  PLT_Argument*& arg);
109 
110  // accessor methods
111  PLT_ArgumentDesc& GetDesc() { return m_ArgDesc; }
112  NPT_Ordinal GetPosition() { return m_ArgDesc.GetPosition(); }
113  NPT_Result SetValue(const char* value);
114  const NPT_String& GetValue();
115 
116 private:
117  NPT_Result ValidateValue(const char* value);
118 
119 protected:
120  PLT_ArgumentDesc& m_ArgDesc;
121  NPT_String m_Value;
122 };
123 
124 /*----------------------------------------------------------------------
125 | PLT_ArgumentNameFinder
126 +---------------------------------------------------------------------*/
132 {
133 public:
134  // methods
135  PLT_ArgumentNameFinder(const char* name) : m_Name(name) {}
136 
137  bool operator()(PLT_Argument* const & argument) const {
138  return argument->GetDesc().GetName().Compare(m_Name, true) ? false : true;
139  }
140 
141 private:
142  // members
143  NPT_String m_Name;
144 };
145 
146 /*----------------------------------------------------------------------
147 | PLT_ArgumentDescNameFinder
148 +---------------------------------------------------------------------*/
154 {
155 public:
156  // methods
157  PLT_ArgumentDescNameFinder(const char* name) : m_Name(name) {}
158 
159  bool operator()(PLT_ArgumentDesc* const & arg_desc) const {
160  return arg_desc->GetName().Compare(m_Name, true) ? false : true;
161  }
162 
163 private:
164  // members
165  NPT_String m_Name;
166 };
167 
168 #endif /* _PLT_ARGUMENT_H_ */
The PLT_Argument class provides a mechanism to set or verify the validity of a specific UPNP service ...
Definition: PltArgument.h:99
Definition: NptXml.h:172
The PLT_ActionDesc class provides information about a UPnP Service given action.
Definition: PltAction.h:61
The PLT_ArgumentDesc class provides information about a given argument of a UPnP Service given action...
Definition: PltArgument.h:64
The PLT_ArgumentDescNameFinder class provides a mechanism to find a PLT_ArgumentDesc given an argumen...
Definition: PltArgument.h:153
The PLT_StateVariable class maintains the state of a UPnP Service state variable. ...
Definition: PltStateVariable.h:75
The PLT_ArgumentNameFinder class provides a mechanism to find a PLT_Argument given an argument name...
Definition: PltArgument.h:131
Definition: NptStrings.h:57