本文整理汇总了C++中PyRep::IsObject方法的典型用法代码示例。如果您正苦于以下问题:C++ PyRep::IsObject方法的具体用法?C++ PyRep::IsObject怎么用?C++ PyRep::IsObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyRep
的用法示例。
在下文中一共展示了PyRep::IsObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Decode
bool PyAddress::Decode(PyRep *&in_object) {
PyRep *base = in_object;
in_object = NULL;
if(!base->IsObject()) {
codelog(NET__PACKET_ERROR, "Invalid element type, expected object");
PyDecRef(base);
return false;
}
PyObject *obj = (PyObject *) base;
//do we care about the object type? should be "macho.MachoAddress"
if(!obj->arguments()->IsTuple()) {
codelog(NET__PACKET_ERROR, "Invalid argument type, expected tuple");
PyDecRef(base);
return false;
}
PyTuple *args = (PyTuple *) obj->arguments();
if(args->items.size() < 3) {
codelog(NET__PACKET_ERROR, "Not enough elements in address tuple: %lu", args->items.size());
args->Dump(NET__PACKET_ERROR, " ");
PyDecRef(base);
return false;
}
//decode the address type.
if(!args->items[0]->IsInt()) {
codelog(NET__PACKET_ERROR, "Wrong type on address type element (0)");
args->items[0]->Dump(NET__PACKET_ERROR, " ");
PyDecRef(base);
return false;
}
PyInt *typei = (PyInt *) args->items[0];
switch(typei->value()) {
case Any: {
if(args->items.size() != 3) {
codelog(NET__PACKET_ERROR, "Invalid number of elements in Any address tuple: %lu", args->items.size());
PyDecRef(base);
return false;
}
type = Any;
if(!_DecodeService(args->items[1])
|| !_DecodeCallID(args->items[2])) {
PyDecRef(base);
return false;
}
break;
}
case Node: {
if(args->items.size() != 4) {
codelog(NET__PACKET_ERROR, "Invalid number of elements in Node address tuple: %lu", args->items.size());
PyDecRef(base);
return false;
}
type = Node;
if(!_DecodeTypeID(args->items[1])
|| !_DecodeService(args->items[2])
|| !_DecodeCallID(args->items[3])) {
PyDecRef(base);
return false;
}
break;
}
case Client: {
if(args->items.size() != 4) {
codelog(NET__PACKET_ERROR, "Invalid number of elements in Client address tuple: %lu", args->items.size());
PyDecRef(base);
return false;
}
type = Client;
if(!_DecodeTypeID(args->items[1])
|| !_DecodeCallID(args->items[2])
|| !_DecodeService(args->items[3])) {
PyDecRef(base);
return false;
}
break;
}
case Broadcast: {
if(args->items.size() != 4) {
codelog(NET__PACKET_ERROR, "Invalid number of elements in Broadcast address tuple: %lu", args->items.size());
PyDecRef(base);
return false;
}
type = Broadcast;
if(!args->items[1]->IsString()) {
codelog(NET__PACKET_ERROR, "Invalid type %s for brodcastID", args->items[1]->TypeString());
PyDecRef(base);
return false;
} else if(!args->items[3]->IsString()) {
codelog(NET__PACKET_ERROR, "Invalid type %s for idtype", args->items[3]->TypeString());
PyDecRef(base);
//.........这里部分代码省略.........