1 /*****************************************************************
3 | Platinum - Action Argument
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
7 | http://www.plutinosoft.com
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.
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
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.
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
33 ****************************************************************/
36 UPnP Service Action Argument
39 #ifndef _PLT_ARGUMENT_H_
40 #define _PLT_ARGUMENT_H_
42 /*----------------------------------------------------------------------
44 +---------------------------------------------------------------------*/
47 /*----------------------------------------------------------------------
48 | forward declarations
49 +---------------------------------------------------------------------*/
50 class PLT_StateVariable
;
53 typedef NPT_Array
<PLT_Argument
*> PLT_Arguments
;
55 /*----------------------------------------------------------------------
57 +---------------------------------------------------------------------*/
59 The PLT_ArgumentDesc class provides information about a given argument of a
60 UPnP Service given action.
61 It has a name, a position, a direction (in/out), a PLT_StateVariable state
62 variable association and whether it is the return value of the action or not.
64 class PLT_ArgumentDesc
67 PLT_ArgumentDesc(const char* name
,
69 const char* direction
= "in",
70 PLT_StateVariable
* variable
= NULL
,
71 bool has_ret
= false);
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
; }
83 NPT_Ordinal m_Position
;
84 NPT_String m_Direction
;
85 PLT_StateVariable
* m_RelatedStateVariable
;
86 bool m_HasReturnValue
;
89 /*----------------------------------------------------------------------
91 +---------------------------------------------------------------------*/
93 The PLT_Argument class provides a mechanism to set or verify the validity of a
94 specific UPNP service action argument.
95 Typically, only a PLT_Action uses this class. Since an argument can be
96 associated to a state variable, the argument is automatically updated when
97 the associated state variable is changed
102 PLT_Argument(PLT_ArgumentDesc
& arg_desc
);
105 static NPT_Result
CreateArgument(PLT_ActionDesc
& action_desc
,
106 const char* arg_name
,
107 const char* arg_value
,
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();
117 NPT_Result
ValidateValue(const char* value
);
120 PLT_ArgumentDesc
& m_ArgDesc
;
124 /*----------------------------------------------------------------------
125 | PLT_ArgumentNameFinder
126 +---------------------------------------------------------------------*/
128 The PLT_ArgumentNameFinder class provides a mechanism to find a PLT_Argument given
131 class PLT_ArgumentNameFinder
135 PLT_ArgumentNameFinder(const char* name
) : m_Name(name
) {}
137 bool operator()(PLT_Argument
* const & argument
) const {
138 return argument
->GetDesc().GetName().Compare(m_Name
, true) ? false : true;
146 /*----------------------------------------------------------------------
147 | PLT_ArgumentDescNameFinder
148 +---------------------------------------------------------------------*/
150 The PLT_ArgumentDescNameFinder class provides a mechanism to find a PLT_ArgumentDesc given
153 class PLT_ArgumentDescNameFinder
157 PLT_ArgumentDescNameFinder(const char* name
) : m_Name(name
) {}
159 bool operator()(PLT_ArgumentDesc
* const & arg_desc
) const {
160 return arg_desc
->GetName().Compare(m_Name
, true) ? false : true;
168 #endif /* _PLT_ARGUMENT_H_ */