FieldInfo *BinReader::readField(Type *type) { FieldInfo *field = lmNew(NULL) FieldInfo(); readMemberInfo(field); field->memberType.field = true; field->declaringType = type; // handle attr int numAttr = bytes->readInt(); for (int i = 0; i < numAttr; i++) { const char *attr = readPoolString(); if (!strcmp(attr, "static")) { field->attr.isStatic = true; } else if (!strcmp(attr, "public")) { field->attr.isPublic = true; } else if (!strcmp(attr, "private")) { field->attr.isPrivate = true; } else if (!strcmp(attr, "protected")) { field->attr.isProtected = true; } else if (!strcmp(attr, "native")) { field->attr.isNative = true; } else if (!strcmp(attr, "const")) { field->attr.isConst = true; } } Type *fieldType = NULL; if (bytes->readBoolean()) { fieldType = getType(readPoolString()); } field->type = fieldType; if (bytes->readBoolean()) { field->setTemplateInfo(readTemplateTypes()); } return field; }
void ChangeInfo::Unpack(RoutingServerMessage* theMsgP) { // read in the standard fields theMsgP->ReadClientName(mClientName); // read in the number of optional fields unsigned char aNumOptionalFields = theMsgP->ReadByte(); // read in the types of the optional fields std::vector<FieldInfo> aFieldVector(aNumOptionalFields); int iField; for (iField = 0; iField < aNumOptionalFields; ++iField) { unsigned char aFieldType = theMsgP->ReadByte(); unsigned char aFieldSize = theMsgP->ReadByte(); aFieldVector[iField] = FieldInfo(aFieldType, aFieldSize); } // read in the optional fields, if any for (iField = 0; iField < aNumOptionalFields; ++iField) { switch (aFieldVector[iField].mType) { case OPTIONALFIELD_IP: mIncludesIPs = true; mIPAddress = theMsgP->ReadLong(); break; case OPTIONALFIELD_AUTHINFO: mIncludesAuthInfo = true; mWONUserId = theMsgP->ReadLong(); mCommunityId = theMsgP->ReadLong(); mTrustLevel = theMsgP->ReadShort(); break; case OPTIONALFIELD_MODERATORFLAG: mIncludesModeratorFlag = true; mIsModerator = theMsgP->ReadBool(); break; case OPTIONALFIELD_MUTEFLAG: mIncludesMuteFlag = true; mIsMuted = theMsgP->ReadBool(); break; default: if (aFieldVector[iField].mSize) theMsgP->ReadBytes(aFieldVector[iField].mSize); else theMsgP->ReadBytes(theMsgP->ReadShort()); } } }
void UploadSettings::AddField(TCHAR * lpszFieldName, TCHAR *lpszFieldValue) { m_fields.push_back(FieldInfo(lpszFieldName, lpszFieldValue)); }