void WriteItem (OPacket *pkt, const sso::property::Item &item) { pkt->Write<uint64_t>(item.ID); pkt->Write<uint32_t>(item.refID); pkt->Write<uint8_t>(item.position); pkt->Write<uint8_t>(item.enchantLv); pkt->Write<uint16_t>(item.quantity); pkt->Write<uint64_t>(item.mods); pkt->Write<uint32_t>(item.arg); pkt->Write<uint8_t>(item.cos.ID ? true : false); if (item.cos.ID) { pkt->Write<uint32_t>(item.cos.ID); pkt->Write<uint8_t>(item.cos.state); pkt->Write(item.cos.name); pkt->Write<uint32_t>(item.cos.HP); pkt->Write<uint16_t>(item.cos.HGP); pkt->Write<uint64_t>(item.cos.XP); pkt->Write<uint32_t>(item.cos.Minutes); pkt->Write<uint32_t>(item.cos.settings); } WriteAttr(pkt,item.magicoptions); }
/*! Writes the specified string to the specified attribute, clobbering any previous data. \param name the name of the attribute \param data the BString to be written to the attribute - \c B_OK: Everything went fine. - \c B_BAD_VALUE: \c NULL \a name or \a data - \c B_FILE_ERROR: The object is not initialized or the node it refers to is read only. - \c B_NOT_ALLOWED: The node resides on a read only volume. - \c B_DEVICE_FULL: Insufficient disk space. - \c B_NO_MEMORY: Insufficient memory to complete the operation. */ status_t BNode::WriteAttrString(const char *name, const BString *data) { status_t error = (!name || !data) ? B_BAD_VALUE : B_OK; if (error == B_OK) { int32 len = data->Length(); ssize_t sizeWritten = WriteAttr(name, B_STRING_TYPE, 0, data->String(), len); if (sizeWritten != len) error = sizeWritten; } return error; }
void WriteStartTag(char *name, pair **attrs, long attrcnt) { WriteChar('<'); WriteText(name); if (attrs) { pair *attr = NULL; char *aname = NULL; char *aval = NULL; for (long i = 0; i < attrcnt; i++) { attr = attrs[i]; if (!attr) break; aname = (char *) Parser->U32to8Str(attr->name, attr->namelen); aval = (char *) Parser->U32to8Str(attr->val, attr->vallen); WriteAttr(aname, aval); } } }
static VBoolean WriteAttrList (FILE *f, VAttrList list, int indent, VList *data_list, long *offset) { VAttrListPosn posn; int i; /* Write the { marking the beginning of the attribute list: */ FailTest (fputs ("{\n", f)); /* Write each attribute in the list: */ for (VFirstAttr (list, & posn); VAttrExists (& posn); VNextAttr (& posn)) if (! WriteAttr (f, & posn, indent, data_list, offset)) return FALSE; /* Write the } marking the end of the attribute list: */ for (i = indent - 1; i > 0; i--) FailTest (fputc ('\t', f)); FailTest (fputc ('}', f)); return TRUE; Fail: VWarning ("VWriteFile: Write to stream failed"); return FALSE; }
void XMLWriter::WriteAttr(const wxChar *name, double value, int digits) { WriteAttr(wxString(name), value, digits); }
void XMLWriter::WriteAttr(const wxChar *name, size_t value) { WriteAttr(wxString(name), value); }
void XMLWriter::WriteAttr(const wxChar *name, long long value) { WriteAttr(wxString(name), value); }
void XMLWriter::WriteAttr(const wxString &name, const wxChar *value) { WriteAttr(name, wxString(value)); }