void DataTypeArray::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const { /// There is no good way to serialize an array in CSV. Therefore, we serialize it into a string, and then write the resulting string in CSV. WriteBufferFromOwnString wb; serializeText(column, row_num, wb, settings); writeCSV(wb.str(), ostr); }
void DataTypeArray::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr) const { /// There is no good way to serialize an array in CSV. Therefore, we serialize it into a string, and then write the resulting string in CSV. String s; { WriteBufferFromString wb(s); serializeText(column, row_num, wb); } writeCSV(s, ostr); }
void DataTypeArray::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr) const { /// Хорошего способа сериализовать массив в CSV нет. Поэтому сериализуем его в строку, а затем полученную строку запишем в CSV. String s; { WriteBufferFromString wb(s); serializeText(column, row_num, wb); } writeCSV(s, ostr); }
Q3DragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, QWidget *source) { if (noteList->count() <= 0) return 0; // The MimeSource: K3MultipleDrag *multipleDrag = new K3MultipleDrag(source); // Make sure the temporary folder exists and is empty (we delete previously moved file(s) (if exists) // since we override the content of the clipboard and previous file willn't be accessable anymore): createAndEmptyCuttingTmpFolder(); // The "Native Format" Serialization: QBuffer buffer; if (buffer.open(QIODevice::WriteOnly)) { QDataStream stream(&buffer); // First append a pointer to the basket: stream << (quint64)(noteList->firstStacked()->note->basket()); // Then a list of pointers to all notes, and parent groups: for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) stream << (quint64)(node->note); Q3ValueList<Note*> groups = noteList->parentGroups(); for (Q3ValueList<Note*>::iterator it = groups.begin(); it != groups.end(); ++it) stream << (quint64)(*it); stream << (quint64)0; // And finally the notes themselves: serializeNotes(noteList, stream, cutting); // Append the object: buffer.close(); Q3StoredDrag *dragObject = new Q3StoredDrag(NOTE_MIME_STRING, source); dragObject->setEncodedData(buffer.buffer()); multipleDrag->addDragObject(dragObject); } // The "Other Flavours" Serialization: serializeText( noteList, multipleDrag ); serializeHtml( noteList, multipleDrag ); serializeImage( noteList, multipleDrag ); serializeLinks( noteList, multipleDrag, cutting ); // The Alternate Flavours: if (noteList->count() == 1) noteList->firstStacked()->note->content()->addAlternateDragObjects(multipleDrag); // If it is a drag, and not a copy/cut, add the feedback pixmap: if (source) setFeedbackPixmap(noteList, multipleDrag); return multipleDrag; }
static cx_int16 serializePrimitive(cx_serializer s, cx_value *v, void *userData) { CX_UNUSED(s); cx_type type = cx_valueType(v); cx_json_ser_t *data = userData; cx_int16 result; cx_string valueString; switch (cx_primitive(type)->kind) { case CX_BINARY: result = serializeBinary(v, &valueString); break; case CX_BITMASK: result = serializeBitmask(v, &valueString); break; case CX_BOOLEAN: result = serializeBoolean(v, &valueString); break; case CX_ENUM: result = serializeEnum(v, &valueString); break; case CX_CHARACTER: case CX_TEXT: result = serializeText(v, &valueString); break; case CX_UINTEGER: case CX_INTEGER: case CX_FLOAT: result = serializeNumber(v, &valueString); break; case CX_ALIAS: result = serializeAlias(v, &valueString); break; } if (result) { goto error; } if (!cx_ser_appendstr(data, "%s", valueString)) { goto finished; } cx_dealloc(valueString); return 0; finished: cx_dealloc(valueString); return 1; error: return -1; }
void DataTypeDateTime::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const { writeChar('"', ostr); serializeText(column, row_num, ostr, settings); writeChar('"', ostr); }
void DataTypeDateTime::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const { serializeText(column, row_num, ostr, settings); }
void DataTypeDate::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr) const { writeChar('"', ostr); serializeText(column, row_num, ostr); writeChar('"', ostr); }
void DataTypeDate::serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr) const { serializeText(column, row_num, ostr); }
void DataTypeTuple::serializeTextQuoted(const IColumn & column, size_t row_num, WriteBuffer & ostr) const { serializeText(column, row_num, ostr); }