| 710 | |
| 711 | |
| 712 | bool CppiaClassInfo::load(CppiaStream &inStream) |
| 713 | { |
| 714 | CppiaOp op = inStream.getOp(); |
| 715 | isInterface = isEnum = false; |
| 716 | |
| 717 | if (op==IaClass) |
| 718 | isInterface = false; |
| 719 | else if (op==IaInterface) |
| 720 | isInterface = true; |
| 721 | else if (op==IaEnum) |
| 722 | isEnum = true; |
| 723 | else |
| 724 | { |
| 725 | DBGLOG("Invalid class field op %d\n", op); |
| 726 | throw "Bad class type"; |
| 727 | } |
| 728 | |
| 729 | std::string tok; |
| 730 | |
| 731 | typeId = inStream.getInt(); |
| 732 | mClass.mPtr = createCppiaClass(this); |
| 733 | |
| 734 | superId = isEnum ? 0 : inStream.getInt(); |
| 735 | int implementCount = isEnum ? 0 : inStream.getInt(); |
| 736 | implements.resize(implementCount); |
| 737 | for(int i=0;i<implementCount;i++) |
| 738 | implements[i] = inStream.getInt(); |
| 739 | |
| 740 | name = cppia.typeStr(typeId); |
| 741 | DBGLOG("Class %s %s\n", name.c_str(), isEnum ? "enum" : isInterface ? "interface" : "class" ); |
| 742 | |
| 743 | bool isNew = //(resolved == null() || !IsCppiaClass(resolved) ) && |
| 744 | (!HaxeNativeClass::findClass(name) && !HaxeNativeInterface::findInterface(name) ); |
| 745 | |
| 746 | if (isNew && isEnum) |
| 747 | { |
| 748 | hx::Class cls = hx::Class_obj::Resolve(String(name.c_str())); |
| 749 | if (cls.mPtr && getScriptId(cls)==0) |
| 750 | { |
| 751 | DBGLOG("Found existing enum %s - ignore\n", name.c_str()); |
| 752 | isNew = false; |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | if (isNew) |
| 757 | { |
| 758 | cppia.types[typeId]->cppiaClass = this; |
| 759 | } |
| 760 | else |
| 761 | { |
| 762 | DBGLOG("Already has registered %s - ignore\n",name.c_str()); |
| 763 | } |
| 764 | |
| 765 | inStream.module->creatingClass = name.c_str(); |
| 766 | |
| 767 | int fields = inStream.getInt(); |
| 768 | for(int f=0;f<fields;f++) |
| 769 | { |
nothing calls this directly
no test coverage detected