All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pyArg.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_BASE_TF_PY_ARG_H
8#define PXR_BASE_TF_PY_ARG_H
9
10#include "pxr/pxr.h"
11#include "pxr/base/tf/api.h"
12
13#include "pxr/external/boost/python/dict.hpp"
14#include "pxr/external/boost/python/tuple.hpp"
15#include <string>
16#include <vector>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
27{
28public:
32 TfPyArg(const std::string& name,
33 const std::string& typeDoc = std::string(),
34 const std::string& defaultValueDoc = std::string())
35 : _name(name), _typeDoc(typeDoc), _defaultValueDoc(defaultValueDoc)
36 { }
37
39 const std::string& GetName() const
40 { return _name; }
41
43 const std::string& GetDefaultValueDoc() const
44 { return _defaultValueDoc; }
45
47 const std::string& GetTypeDoc() const
48 { return _typeDoc; }
49
50private:
51 std::string _name;
52 std::string _typeDoc;
53 std::string _defaultValueDoc;
54};
55
56typedef std::vector<TfPyArg> TfPyArgs;
57
69TF_API
70std::pair<pxr_boost::python::tuple, pxr_boost::python::dict>
71TfPyProcessOptionalArgs(
72 const pxr_boost::python::tuple& args,
73 const pxr_boost::python::dict& kwargs,
74 const TfPyArgs& expectedArgs,
75 bool allowExtraArgs = false);
76
80TF_API
81std::string TfPyCreateFunctionDocString(
82 const std::string& functionName,
83 const TfPyArgs& requiredArguments = TfPyArgs(),
84 const TfPyArgs& optionalArguments = TfPyArgs(),
85 const std::string& description = std::string());
86
87PXR_NAMESPACE_CLOSE_SCOPE
88
89#endif // PXR_BASE_TF_PY_ARG_H
Class representing a function argument.
Definition: pyArg.h:27
const std::string & GetName() const
Returns argument name.
Definition: pyArg.h:39
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:32
const std::string & GetTypeDoc() const
Returns documentation of type of value required by this argument.
Definition: pyArg.h:47
const std::string & GetDefaultValueDoc() const
Returns documentation for default value (if any) for this argument.
Definition: pyArg.h:43