#ifndef SOLUTIONSETTINGS_H#define SOLUTIONSETTINGS_Hclass QString;struct ComponentSettings{ QString name; double concentration; double liquidusTangent; double distributionRatio;};struct SolutionSettings{ int substrateHeight; int addingLayerHeight; int addingLayerCount; double areaWidth; double areaDepth; int NodesPerSize; int laserSpotDiameter; int laserPower; int preheatingTemperature; int gasTemperature; int laserSpeed; int distanceBetweenPasses; int penetrationRatio; int delayAfterHeating; QString wayType; double delayBetweenPasses; double calculationTimeStep; int outputTimeStep; QString materialName; double liquidusTemperature; double coresCount; double growSpeedRatio; double interaxialDistance; double porosity; double particlesDiameter; ComponentSettings component1, component2, component3;};#endif
out.writeRawData(reinterpret_cast<char*>(&_settings), sizeof(_settings)); out << _settings.wayType << _settings.materialName << _settings.component1.name << _settings.component2.name << _settings.component3.name; binFile.close();
SolutionSettings _settings;
QFile binFile(slmFilePath); binFile.open(QIODevice::WriteOnly); QDataStream out(&binFile);
in.readRawData(reinterpret_cast<char*>(&settings), sizeof(settings));
QFile file(filePath); file.open(QIODevice::ReadOnly); QDataStream in(&file);
in >> settings.wayType; in >> settings.materialName; in >> settings.component1.name; in >> settings.component2.name; in >> settings.component3.name;
C++ (Qt)out << settings;...in >> settings;
char* strings[] = { reinterpret_cast<char*>(&settings.wayType), reinterpret_cast<char*>(&settings.materialName), reinterpret_cast<char*>(&settings.component1.name), reinterpret_cast<char*>(&settings.component2.name), reinterpret_cast<char*>(&settings.component3.name) }; char oldValues[sizeof(strings) / sizeof(char*) * sizeof(QString)]; for (int i = 0; i < sizeof(strings) / sizeof(char*); i++) { char* string = strings[i]; for (int j = 0; j < sizeof(QString) / sizeof(char); j++) { oldValues[sizeof(QString) / sizeof(char) * i + j] = string[j]; } } in.readRawData(reinterpret_cast<char*>(&settings), sizeof(settings)); for (int i = 0; i < sizeof(strings) / sizeof(char*); i++) { char* string = strings[i]; for (int j = 0; j < sizeof(QString) / sizeof(char); j++) { string[j] = oldValues[sizeof(QString) / sizeof(char) * i + j]; } } in >> settings.wayType; in >> settings.materialName; in >> settings.component1.name; in >> settings.component2.name; in >> settings.component3.name;
C++ (Qt)double value = 123.456;out << value;
DelphiValue: Double;Stream.Read(@Value, SizeOf(Value));