Loading...
Searching...
No Matches
pyArg.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_BASE_TF_PY_ARG_H
25#define PXR_BASE_TF_PY_ARG_H
26
27#include "pxr/pxr.h"
28#include "pxr/base/tf/api.h"
29
30#include <boost/python/dict.hpp>
31#include <boost/python/tuple.hpp>
32#include <string>
33#include <vector>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
44{
45public:
49 TfPyArg(const std::string& name,
50 const std::string& typeDoc = std::string(),
51 const std::string& defaultValueDoc = std::string())
52 : _name(name), _typeDoc(typeDoc), _defaultValueDoc(defaultValueDoc)
53 { }
54
56 const std::string& GetName() const
57 { return _name; }
58
60 const std::string& GetDefaultValueDoc() const
61 { return _defaultValueDoc; }
62
64 const std::string& GetTypeDoc() const
65 { return _typeDoc; }
66
67private:
68 std::string _name;
69 std::string _typeDoc;
70 std::string _defaultValueDoc;
71};
72
73typedef std::vector<TfPyArg> TfPyArgs;
74
86TF_API
87std::pair<boost::python::tuple, boost::python::dict>
88TfPyProcessOptionalArgs(
89 const boost::python::tuple& args,
90 const boost::python::dict& kwargs,
91 const TfPyArgs& expectedArgs,
92 bool allowExtraArgs = false);
93
97TF_API
98std::string TfPyCreateFunctionDocString(
99 const std::string& functionName,
100 const TfPyArgs& requiredArguments = TfPyArgs(),
101 const TfPyArgs& optionalArguments = TfPyArgs(),
102 const std::string& description = std::string());
103
104PXR_NAMESPACE_CLOSE_SCOPE
105
106#endif // PXR_BASE_TF_PY_ARG_H
Class representing a function argument.
Definition: pyArg.h:44
const std::string & GetName() const
Returns argument name.
Definition: pyArg.h:56
TfPyArg(const std::string &name, const std::string &typeDoc=std::string(), const std::string &defaultValueDoc=std::string())
Create a TfPyArg representing an argument with the given name.
Definition: pyArg.h:49
const std::string & GetTypeDoc() const
Returns documentation of type of value required by this argument.
Definition: pyArg.h:64
const std::string & GetDefaultValueDoc() const
Returns documentation for default value (if any) for this argument.
Definition: pyArg.h:60