本文整理汇总了C++中Base::Interpreter方法的典型用法代码示例。如果您正苦于以下问题:C++ Base::Interpreter方法的具体用法?C++ Base::Interpreter怎么用?C++ Base::Interpreter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::Interpreter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
PythonCommand::PythonCommand(const char* name,PyObject * pcPyCommand, const char* pActivationString)
: Command(name),_pcPyCommand(pcPyCommand)
{
if (pActivationString)
Activation = pActivationString;
sGroup = "Python";
Py_INCREF(_pcPyCommand);
// call the method "GetResources()" of the command object
_pcPyResourceDict = Interpreter().runMethodObject(_pcPyCommand, "GetResources");
// check if the "GetResources()" method returns a Dict object
if (!PyDict_Check(_pcPyResourceDict))
throw Base::Exception("PythonCommand::PythonCommand(): Method GetResources() of the Python command object returns the wrong type (has to be Py Dictonary)");
}
示例2: Exception
#if defined (_MSC_VER)
: Command( _strdup(name) )
#else
: Command( strdup(name) )
#endif
,_pcPyCommand(pcPyCommand)
{
if (pActivationString)
Activation = pActivationString;
sGroup = "Python";
Py_INCREF(_pcPyCommand);
// call the method "GetResources()" of the command object
_pcPyResourceDict = Interpreter().runMethodObject(_pcPyCommand, "GetResources");
// check if the "GetResources()" method returns a Dict object
if (!PyDict_Check(_pcPyResourceDict)) {
throw Base::Exception("PythonCommand::PythonCommand(): Method GetResources() of the Python "
"command object returns the wrong type (has to be dict)");
}
// check for command type
std::string cmdType = getResource("CmdType");
if (!cmdType.empty()) {
int type = 0;
if (cmdType.find("AlterDoc") != std::string::npos)
type += int(AlterDoc);
if (cmdType.find("Alter3DView") != std::string::npos)
type += int(Alter3DView);
if (cmdType.find("AlterSelection") != std::string::npos)