Commit 80acdb50 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #16962 Correct namespaces for non-clang builds

We need to add the export macro to TSVSerialiser's class definition and
update the namespaces
parent ae5d900e
......@@ -5642,7 +5642,7 @@ void Graph::loadFromProject(const std::string &lines, ApplicationWindow *app,
enableAutoscaling(app->autoscale2DPlots);
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (tsv.selectSection("Antialiasing")) {
int aa;
......@@ -6183,7 +6183,7 @@ void Graph::loadFromProject(const std::string &lines, ApplicationWindow *app,
std::vector<std::string> specSections = tsv.sections("spectrogram");
for (auto it = specSections.begin(); it != specSections.end(); ++it) {
TSVSerialiser specTSV(*it);
MantidQt::API::TSVSerialiser specTSV(*it);
if (specTSV.selectLine("workspace")) {
std::string wsName;
......@@ -6308,7 +6308,7 @@ void Graph::loadFromProject(const std::string &lines, ApplicationWindow *app,
}
std::string Graph::saveToProject() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeLine("ggeometry") << pos().x() << pos().y()
<< frameGeometry().width()
......@@ -6620,7 +6620,7 @@ std::string Graph::saveCurve(int i) {
}
std::string Graph::saveScale() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
for (int i = 0; i < 4; i++) {
tsv.writeLine("scale") << i;
......@@ -6664,7 +6664,7 @@ std::string Graph::saveScale() {
}
std::string Graph::saveMarkers() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
for (int i = 0; i < d_images.size(); ++i) {
auto mrkI = dynamic_cast<ImageMarker *>(d_plot->marker(d_images[i]));
if (!mrkI)
......
......@@ -2516,7 +2516,7 @@ IProjectSerialisable *Graph3D::loadFromProject(const std::string &lines,
const std::string tsvLines = boost::algorithm::join(lineVec, "\n");
TSVSerialiser tsv(tsvLines);
MantidQt::API::TSVSerialiser tsv(tsvLines);
if (tsv.selectLine("SurfaceFunction")) {
auto params = graph->readSurfaceFunction(tsv);
......@@ -2784,7 +2784,7 @@ void Graph3D::setupMatrixPlot3D(ApplicationWindow *app, const QString &caption,
}
void Graph3D::setupMantidMatrixPlot3D(ApplicationWindow *app,
TSVSerialiser &tsv) {
MantidQt::API::TSVSerialiser &tsv) {
using MantidQt::API::PlotAxis;
MantidMatrix *matrix = readWorkspaceForPlot(app, tsv);
int style = read3DPlotStyle(tsv);
......@@ -2835,7 +2835,7 @@ void Graph3D::setupMantidMatrixPlot3D(ApplicationWindow *app,
}
MantidMatrix *Graph3D::readWorkspaceForPlot(ApplicationWindow *app,
TSVSerialiser &tsv) {
MantidQt::API::TSVSerialiser &tsv) {
MantidMatrix *m = nullptr;
if (tsv.selectLine("title")) {
std::string wsName = tsv.asString(1);
......@@ -2851,7 +2851,7 @@ MantidMatrix *Graph3D::readWorkspaceForPlot(ApplicationWindow *app,
return m;
}
int Graph3D::read3DPlotStyle(TSVSerialiser &tsv) {
int Graph3D::read3DPlotStyle(MantidQt::API::TSVSerialiser &tsv) {
int style = Qwt3D::WIREFRAME;
if (tsv.selectLine("Style"))
tsv >> style;
......@@ -2859,7 +2859,7 @@ int Graph3D::read3DPlotStyle(TSVSerialiser &tsv) {
}
Graph3D::SurfaceFunctionParams
Graph3D::readSurfaceFunction(TSVSerialiser &tsv) {
Graph3D::readSurfaceFunction(MantidQt::API::TSVSerialiser &tsv) {
SurfaceFunctionParams params;
tsv >> params.formula;
params.type = readSurfaceFunctionType(params.formula);
......@@ -2928,7 +2928,7 @@ Graph3D::readSurfaceFunctionType(const std::string &formula) {
}
std::string Graph3D::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<SurfacePlot>");
tsv.writeLine(name().toStdString()) << birthDate();
tsv.writeRaw(app->windowGeometryInfo(this));
......
......@@ -416,13 +416,15 @@ signals:
void modified();
private:
Graph3D::SurfaceFunctionParams readSurfaceFunction(TSVSerialiser &tsv);
Graph3D::SurfaceFunctionParams
readSurfaceFunction(MantidQt::API::TSVSerialiser &tsv);
Graph3D::SurfaceFunctionType
readSurfaceFunctionType(const std::string &formula);
MantidMatrix *readWorkspaceForPlot(ApplicationWindow *app,
TSVSerialiser &tsv);
int read3DPlotStyle(TSVSerialiser &tsv);
void setupMantidMatrixPlot3D(ApplicationWindow *app, TSVSerialiser &tsv);
MantidQt::API::TSVSerialiser &tsv);
int read3DPlotStyle(MantidQt::API::TSVSerialiser &tsv);
void setupMantidMatrixPlot3D(ApplicationWindow *app,
MantidQt::API::TSVSerialiser &tsv);
void setupPlot3D(ApplicationWindow *app, const QString &caption,
const SurfaceFunctionParams &params);
void setupPlotXYZ(ApplicationWindow *app, const QString &caption,
......
......@@ -261,7 +261,7 @@ void Grid::copy(Grid *grid) {
}
std::string Grid::saveToString() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeLine("grid");
tsv << xEnabled() << xMinEnabled();
......
......@@ -49,7 +49,7 @@ IProjectSerialisable *InstrumentWindow::loadFromProject(
const std::string &lines, ApplicationWindow *app, const int fileVersion) {
Q_UNUSED(fileVersion);
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (!tsv.selectLine("WorkspaceName"))
return nullptr;
......@@ -103,7 +103,7 @@ IProjectSerialisable *InstrumentWindow::loadFromProject(
* @return a string representing the state of the instrument window
*/
std::string InstrumentWindow::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv, window;
MantidQt::API::TSVSerialiser tsv, window;
window.writeRaw(app->windowGeometryInfo(this));
auto widgetContents = m_instrumentWidget->saveToProject();
window.writeRaw(widgetContents);
......
......@@ -1534,7 +1534,7 @@ IProjectSerialisable *Matrix::loadFromProject(const std::string &lines,
Mantid::Kernel::Strings::convert<int>(values[1], rows);
Mantid::Kernel::Strings::convert<int>(values[2], cols);
TSVSerialiser tsv(newLines);
MantidQt::API::TSVSerialiser tsv(newLines);
std::string gStr;
if (tsv.hasLine("geometry")) {
gStr = tsv.lineAsString("geometry");
......@@ -1642,7 +1642,7 @@ IProjectSerialisable *Matrix::loadFromProject(const std::string &lines,
}
std::string Matrix::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<matrix>");
tsv.writeLine(objectName().toStdString()) << numRows() << numCols()
......
......@@ -1014,7 +1014,7 @@ void MatrixModel::pasteData(double *clipboardBuffer, int topRow, int leftCol,
MatrixModel::~MatrixModel() { free(d_data); }
std::string MatrixModel::saveToProject() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
for (int row = 0; row < d_rows; ++row) {
// Index to the first element of each row
......
......@@ -1758,7 +1758,7 @@ IProjectSerialisable *MultiLayer::loadFromProject(const std::string &lines,
auto multiLayer = new MultiLayer(app, 0, rows, cols);
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
multiLayer->blockSignals(true);
......@@ -1805,7 +1805,7 @@ IProjectSerialisable *MultiLayer::loadFromProject(const std::string &lines,
for (auto it = graphSections.cbegin(); it != graphSections.cend(); ++it) {
auto graphLines = *it;
TSVSerialiser gtsv(graphLines);
MantidQt::API::TSVSerialiser gtsv(graphLines);
if (gtsv.selectLine("ggeometry")) {
int x = 0, y = 0, w = 0, h = 0;
......@@ -1833,7 +1833,7 @@ IProjectSerialisable *MultiLayer::loadFromProject(const std::string &lines,
}
std::string MultiLayer::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<multiLayer>");
......
......@@ -155,7 +155,7 @@ IProjectSerialisable *Note::loadFromProject(const std::string &lines,
app->setListViewDate(name, date);
note->setBirthDate(date);
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (tsv.hasLine("geometry")) {
const QString geometry =
......@@ -186,7 +186,7 @@ IProjectSerialisable *Note::loadFromProject(const std::string &lines,
}
std::string Note::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<note>");
tsv.writeLine(name().toStdString()) << birthDate();
tsv.writeRaw(app->windowGeometryInfo(this));
......
......@@ -435,7 +435,7 @@ void ScriptingWindow::loadFromProject(const std::string &lines,
const int fileVersion) {
Q_UNUSED(fileVersion);
TSVSerialiser sTSV(lines);
MantidQt::API::TSVSerialiser sTSV(lines);
QStringList files;
setWindowTitle("MantidPlot: " + app->scriptingEnv()->languageName() +
......
......@@ -1015,7 +1015,7 @@ QImage Spectrogram::renderImage(const QwtScaleMap &xMap,
void Spectrogram::loadFromProject(const std::string &lines) {
using namespace Mantid::Kernel;
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (tsv.hasSection("ColorPolicy")) {
std::string policyStr = tsv.sections("ColorPolicy").front();
......@@ -1027,7 +1027,7 @@ void Spectrogram::loadFromProject(const std::string &lines) {
setDefaultColorMap();
} else if (tsv.hasSection("ColorMap")) {
const std::string cmStr = tsv.sections("ColorMap").front();
TSVSerialiser cm(cmStr);
MantidQt::API::TSVSerialiser cm(cmStr);
std::string filename;
if (cm.selectLine("FileName"))
......@@ -1073,7 +1073,7 @@ void Spectrogram::loadFromProject(const std::string &lines) {
if (tsv.hasSection("ColorBar")) {
const std::string cbStr = tsv.sections("ColorBar").front();
TSVSerialiser cb(cbStr);
MantidQt::API::TSVSerialiser cb(cbStr);
std::string axisStr = cb.sections("axis")[0];
std::string widthStr = cb.sections("width")[0];
......@@ -1105,7 +1105,7 @@ void Spectrogram::loadFromProject(const std::string &lines) {
std::string Spectrogram::saveToProject() {
using namespace Mantid::Kernel;
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<spectrogram>");
if (!d_wsName.empty())
tsv.writeLine("workspace") << d_wsName;
......@@ -1116,7 +1116,7 @@ std::string Spectrogram::saveToProject() {
tsv.writeInlineSection("ColorPolicy",
Strings::toString<int>(color_map_policy));
else {
TSVSerialiser cm;
MantidQt::API::TSVSerialiser cm;
if (!mCurrentColorMap.isEmpty())
cm.writeLine("FileName") << mCurrentColorMap.toStdString();
cm.writeInlineSection("Mode", Strings::toString<int>(color_map.mode()));
......@@ -1143,7 +1143,7 @@ std::string Spectrogram::saveToProject() {
QwtScaleWidget *colorAxis = plot()->axisWidget(color_axis);
if (colorAxis && colorAxis->isColorBarEnabled()) {
TSVSerialiser cb;
MantidQt::API::TSVSerialiser cb;
cb.writeInlineSection("axis", Strings::toString<int>(color_axis));
cb.writeInlineSection("width",
Strings::toString<int>(colorAxis->colorBarWidth()));
......
......@@ -638,7 +638,7 @@ void Table::updateValues(Table *t, const QString &columnName) {
}
std::string Table::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<table>");
tsv.writeLine(objectName().toStdString())
......@@ -3036,7 +3036,7 @@ IProjectSerialisable *Table::loadFromProject(const std::string &lines,
}
}
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (tsv.selectLine("geometry"))
app->restoreWindowGeometry(
......@@ -3176,7 +3176,7 @@ IProjectSerialisable *Table::loadFromProject(const std::string &lines,
}
std::string Table::saveTableMetadata() {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeLine("header");
for (int j = 0; j < d_table->columnCount(); j++) {
QString val = colLabel(j);
......
......@@ -293,7 +293,7 @@ IProjectSerialisable *TableStatistics::loadFromProject(const std::string &lines,
const std::string type = firstLineVec[2];
QString birthDate = QString::fromStdString(firstLineVec[3]);
TSVSerialiser tsv(lines);
MantidQt::API::TSVSerialiser tsv(lines);
if (!tsv.hasLine("Targets"))
return nullptr;
......@@ -406,7 +406,7 @@ IProjectSerialisable *TableStatistics::loadFromProject(const std::string &lines,
}
std::string TableStatistics::saveToProject(ApplicationWindow *app) {
TSVSerialiser tsv;
MantidQt::API::TSVSerialiser tsv;
tsv.writeRaw("<TableStatistics>");
tsv.writeLine(objectName().toStdString());
......
#ifndef MANTID_TSVSERIALISER_H_
#define MANTID_TSVSERIALISER_H_
#include "DllOption.h"
#include "MantidKernel/CaseInsensitiveMap.h"
#include <map>
......@@ -39,7 +40,10 @@
File change history is stored at: <https://github.com/mantidproject/mantid>
*/
class TSVSerialiser {
namespace MantidQt {
namespace API {
class EXPORT_OPT_MANTIDQT_API TSVSerialiser {
public:
TSVSerialiser();
......@@ -108,5 +112,7 @@ private:
std::stringstream m_output;
bool m_midLine;
};
}
}
#endif
......@@ -10,6 +10,8 @@ namespace {
Mantid::Kernel::Logger g_log("TSVSerialiser");
}
using namespace MantidQt::API;
TSVSerialiser::TSVSerialiser() : m_curIndex(0), m_midLine(false) {}
TSVSerialiser::TSVSerialiser(const std::string &lines)
......
......@@ -327,7 +327,7 @@ void ColorMapWidget::mouseReleaseEvent(QMouseEvent * /*e*/) {
* @return string representing the current state of the color map widget.
*/
std::string ColorMapWidget::saveToProject() const {
TSVSerialiser tsv, cm;
API::TSVSerialiser tsv, cm;
cm.writeLine("ScaleType") << getScaleType();
cm.writeLine("Power") << getNth_power();
cm.writeLine("MinValue") << getMinValue();
......@@ -342,11 +342,11 @@ std::string ColorMapWidget::saveToProject() const {
* widget.
*/
void ColorMapWidget::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
API::TSVSerialiser tsv(lines);
if (tsv.selectSection("colormap")) {
std::string colorMapLines;
tsv >> colorMapLines;
TSVSerialiser cm(colorMapLines);
API::TSVSerialiser cm(colorMapLines);
int scaleType;
double min, max, power;
......
......@@ -1289,7 +1289,7 @@ bool FindComponentVisitor::visit(GLActor *actor) {
* @return string representing the current state of the instrumet actor.
*/
std::string InstrumentActor::saveToProject() const {
TSVSerialiser tsv;
API::TSVSerialiser tsv;
const std::string currentColorMap = getCurrentColorMap().toStdString();
if (!currentColorMap.empty())
......@@ -1304,7 +1304,7 @@ std::string InstrumentActor::saveToProject() const {
* @param lines :: string representing the current state of the instrumet actor.
*/
void InstrumentActor::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
API::TSVSerialiser tsv(lines);
if (tsv.selectLine("FileName")) {
QString filename;
tsv >> filename;
......
......@@ -1186,14 +1186,14 @@ void InstrumentWidgetMaskTab::changedIntegrationRange(double, double) {
* @param lines :: lines from the project file to load state from
*/
void InstrumentWidgetMaskTab::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
API::TSVSerialiser tsv(lines);
if (!tsv.selectSection("masktab"))
return;
std::string tabLines;
tsv >> tabLines;
TSVSerialiser tab(tabLines);
API::TSVSerialiser tab(tabLines);
std::vector<QPushButton *> buttons{
m_move, m_pointer, m_ellipse, m_rectangle,
......@@ -1297,8 +1297,8 @@ InstrumentWidgetMaskTab::loadMask(const std::string &fileName) {
* @return a string representing the state of the mask tab
*/
std::string InstrumentWidgetMaskTab::saveToProject() const {
TSVSerialiser tsv;
TSVSerialiser tab;
API::TSVSerialiser tsv;
API::TSVSerialiser tab;
std::vector<QPushButton *> buttons{
m_move, m_pointer, m_ellipse, m_rectangle,
......
......@@ -700,14 +700,14 @@ void InstrumentWidgetPickTab::savePlotToWorkspace() {
* @param lines :: lines from the project file to load state from
*/
void InstrumentWidgetPickTab::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
API::TSVSerialiser tsv(lines);
if (!tsv.selectSection("picktab"))
return;
std::string tabLines;
tsv >> tabLines;
TSVSerialiser tab(tabLines);
API::TSVSerialiser tab(tabLines);
// load active push button
std::vector<QPushButton *> buttons{
......@@ -726,8 +726,7 @@ void InstrumentWidgetPickTab::loadFromProject(const std::string &lines) {
* @return a string representing the state of the pick tab
*/
std::string InstrumentWidgetPickTab::saveToProject() const {
TSVSerialiser tsv;
TSVSerialiser tab;
API::TSVSerialiser tsv, tab;
// save active push button
std::vector<QPushButton *> buttons{
......
......@@ -734,7 +734,7 @@ QPointF InstrumentWidgetRenderTab::getUCorrection() const {
*/
std::string
MantidQt::MantidWidgets::InstrumentWidgetRenderTab::saveToProject() const {
TSVSerialiser tab;
API::TSVSerialiser tab;
tab.writeLine("AxesView") << mAxisCombo->currentIndex();
tab.writeLine("AutoScaling") << m_autoscaling->isChecked();
......@@ -757,7 +757,7 @@ MantidQt::MantidWidgets::InstrumentWidgetRenderTab::saveToProject() const {
const auto colorMap = m_colorMapWidget->saveToProject();
tab.writeRaw(colorMap);
TSVSerialiser tsv;
API::TSVSerialiser tsv;
tsv.writeSection("rendertab", tab.outputLines());
return tsv.outputLines();
}
......@@ -767,14 +767,14 @@ MantidQt::MantidWidgets::InstrumentWidgetRenderTab::saveToProject() const {
* @param lines :: lines defining the state of the render tab
*/
void InstrumentWidgetRenderTab::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
API::TSVSerialiser tsv(lines);
if (!tsv.selectSection("rendertab"))
return;
std::string tabLines;
tsv >> tabLines;
TSVSerialiser tab(tabLines);
API::TSVSerialiser tab(tabLines);
bool autoScaling, displayAxes, flipView, displayDetectorsOnly,
displayWireframe, displayLighting, useOpenGL, useUCorrection;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment