Commit dc8028a1 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkStdString: remove usage from the codebase

It still remains in the ClientServerStream to support other ParaView and
VTK still using it, but it's on the chopping block.
parent 1e6eaef5
......@@ -183,7 +183,7 @@ int vtkCPPythonScriptPipeline::RequestDataDescription(vtkCPDataDescription* data
}
// check the script to see if it should be run...
vtkStdString dataDescriptionString = this->GetPythonAddress(dataDescription);
std::string dataDescriptionString = this->GetPythonAddress(dataDescription);
std::ostringstream pythonInput;
pythonInput << "dataDescription = vtkPVCatalyst.vtkCPDataDescription('" << dataDescriptionString
......@@ -204,7 +204,7 @@ int vtkCPPythonScriptPipeline::CoProcess(vtkCPDataDescription* dataDescription)
return 0;
}
vtkStdString dataDescriptionString = this->GetPythonAddress(dataDescription);
std::string dataDescriptionString = this->GetPythonAddress(dataDescription);
std::ostringstream pythonInput;
pythonInput << "dataDescription = vtkPVCatalyst.vtkCPDataDescription('" << dataDescriptionString
......
......@@ -17,7 +17,6 @@
#include "vtkCPPythonPipeline.h"
#include "vtkPVPythonCatalystModule.h" // For windows import/export of shared libraries
#include "vtkStdString.h" // for the string
class vtkCPDataDescription;
......
# vtkstdstring-removal
Usage of `vtkStdString` inside of ParaView itself has been minimized. Some
usages are still around either for infrastructural reasons or VTK API reasons.
#include "vtkMultiProcessController.h"
#include "vtkObjectFactory.h"
#include "vtkStdString.h"
#include "vtkCPDataDescription.h"
#include "vtkCPProcessor.h"
......
......@@ -7,7 +7,6 @@
#include "vtkImageData.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPointData.h"
#include "vtkStdString.h"
extern "C" void createstructuredgrid_(
int* myid, int* xdim, int* ystart, int* ystop, double* xspc, double* yspc)
......@@ -40,7 +39,7 @@ extern "C" void createstructuredgrid_(
extern "C" void add_scalar_(char* fname, int* len, double* data, int* size)
{
vtkDoubleArray* arr = vtkDoubleArray::New();
vtkStdString name(fname, *len);
std::string name(fname, *len);
arr->SetName(name);
arr->SetNumberOfComponents(1);
// arr->SetNumberOfTuples (*size);
......@@ -56,7 +55,7 @@ extern "C" void add_vector_(
char* fname, int* len, double* data0, double* data1, double* data2, int* size)
{
vtkDoubleArray* arr = vtkDoubleArray::New();
vtkStdString name(fname, *len);
std::string name(fname, *len);
arr->SetName(name);
arr->SetNumberOfComponents(3);
arr->SetNumberOfTuples(*size);
......
......@@ -122,7 +122,7 @@ extern "C" void setcoprocessorfield_(char* fname, int* len, int* mx, int* my, in
if (*down_convert)
{
vtkNew<vtkUnsignedCharArray> att;
vtkStdString name(fname, *len);
std::string name(fname, *len);
att->SetName(name);
att->SetNumberOfComponents(1);
att->SetNumberOfTuples(numCells);
......@@ -135,7 +135,7 @@ extern "C" void setcoprocessorfield_(char* fname, int* len, int* mx, int* my, in
else
{
vtkNew<vtkFloatArray> att;
vtkStdString name(fname, *len);
std::string name(fname, *len);
att->SetName(name);
att->SetNumberOfComponents(1);
att->SetArray(data, numCells, 1);
......@@ -227,7 +227,7 @@ extern "C" void addmarkerscalarfield_(char* fname, // Name of data
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(mgrid->GetBlock(0));
// Get the data array for this variable
vtkStdString varName(fname, *len);
std::string varName(fname, *len);
vtkFloatArray* dataArray = vtkFloatArray::SafeDownCast(ugrid->GetPointData()->GetArray(varName));
// If it doesn't exist, create and size, and refetch
......@@ -267,7 +267,7 @@ extern "C" void addmarkervectorfield_(char* fname, // Name of data
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(mgrid->GetBlock(0));
// Get the data array for this variable
vtkStdString varName(fname, *len);
std::string varName(fname, *len);
vtkFloatArray* dataArray = vtkFloatArray::SafeDownCast(ugrid->GetPointData()->GetArray(varName));
// If it doesn't exist, create and size, and refetch
......@@ -314,7 +314,7 @@ extern "C" void addmarkertensorfield_(char* fname, // Name of data
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(mgrid->GetBlock(0));
// Get the data array for this variable
vtkStdString varName(fname, *len);
std::string varName(fname, *len);
vtkFloatArray* dataArray = vtkFloatArray::SafeDownCast(ugrid->GetPointData()->GetArray(varName));
// If it doesn't exist, create and size, and refetch
......
......@@ -17,7 +17,6 @@
#include "vtkObjectFactory.h"
#include "vtkPVXMLElement.h"
#include "vtkSMPropertyHelper.h"
#include "vtkStdString.h"
#include <assert.h>
#include <vtksys/RegularExpression.hxx>
......@@ -65,8 +64,8 @@ int vtkSMBagChartSeriesListDomain::ReadXMLAttributes(vtkSMProperty* prop, vtkPVX
//----------------------------------------------------------------------------
int vtkSMBagChartSeriesListDomain::SetDefaultValues(vtkSMProperty* prop, bool use_unchecked_values)
{
const std::vector<vtkStdString>& strings = this->GetStrings();
std::vector<vtkStdString>::const_iterator iter = strings.begin();
const std::vector<std::string>& strings = this->GetStrings();
std::vector<std::string>::const_iterator iter = strings.begin();
// Search for an array with a name like HDR (x,y)
vtksys::RegularExpression re =
......
......@@ -15,7 +15,6 @@
#include "vtkSMFunctionalBagChartSeriesSelectionDomain.h"
#include "vtkObjectFactory.h"
#include "vtkStdString.h"
#include "vtksys/SystemTools.hxx"
#include <vector>
......@@ -42,10 +41,10 @@ bool vtkSMFunctionalBagChartSeriesSelectionDomain::GetDefaultSeriesVisibility(co
}
//----------------------------------------------------------------------------
std::vector<vtkStdString> vtkSMFunctionalBagChartSeriesSelectionDomain::GetDefaultValue(
std::vector<std::string> vtkSMFunctionalBagChartSeriesSelectionDomain::GetDefaultValue(
const char* series)
{
std::vector<vtkStdString> values;
std::vector<std::string> values;
std::string name(series);
if (this->DefaultMode == LABEL)
{
......
......@@ -48,7 +48,7 @@ protected:
* Get the default value that will be used for the series with the given name
* by this domain.
*/
std::vector<vtkStdString> GetDefaultValue(const char* series) override;
std::vector<std::string> GetDefaultValue(const char* series) override;
private:
vtkSMFunctionalBagChartSeriesSelectionDomain(
......
......@@ -14,7 +14,7 @@
// --------------------------------------
PropertyItem::PropertyItem(
const vtkStdString& aname, const bool& numeric, const int& pos, const int& status, int numRecords)
const std::string& aname, const bool& numeric, const int& pos, const int& status, int numRecords)
{
this->isNumeric = numeric;
......@@ -50,7 +50,7 @@ PropertyItem::PropertyItem(
this->Storage.TakeReference(vtkStringArray::New());
}
this->Storage->Allocate(numRecords);
this->Storage->SetName(this->name);
this->Storage->SetName(this->name.c_str());
break;
case 0:
default:
......@@ -75,7 +75,7 @@ PropertyStorage::~PropertyStorage()
void PropertyStorage::AddProperty(
char* name, const bool& numeric, const int& pos, const int& status, int numRecords)
{
vtkStdString vname(name);
std::string vname(name);
if (this->properties.size() > 0)
{
PropertyItem& lastItem = this->properties.back();
......@@ -110,7 +110,7 @@ void PropertyStorage::AddValues(Data* values)
{
char ctmp[5];
ctmp[4] = 0;
vtkStdString tempBuf;
std::string tempBuf;
for (int pos = item.startPos; pos < item.endPos; ++pos)
{
ctmp[0] = values[pos].c[0];
......
......@@ -13,7 +13,7 @@ class vtkDataSet;
class PropertyItem
{
public:
PropertyItem(const vtkStdString& name, const bool& numeric, const int& pos, const int& status,
PropertyItem(const std::string& name, const bool& numeric, const int& pos, const int& status,
int numRecords);
~PropertyItem();
......@@ -24,7 +24,7 @@ public:
int startPos;
int endPos;
vtkStdString name;
std::string name;
vtkSmartPointer<vtkAbstractArray> Storage;
};
......
......@@ -104,7 +104,7 @@ int vtkDataMineWireFrameReader::RequestInformation(
int p = this->PointFileBad();
int s = this->StopeFileBad();
vtkStdString ext;
std::string ext;
if (t)
{
// guess Topo File
......@@ -455,10 +455,10 @@ void vtkDataMineWireFrameReader::ParseCellsWithStopes(vtkCellArray* cells, TDMFi
}
// --------------------------------------
bool vtkDataMineWireFrameReader::FindAndSetFilePath(
vtkStdString& dmExt, const bool& update, FileTypes type)
std::string& dmExt, const bool& update, FileTypes type)
{
vtkStdString path(this->FileName);
vtkStdString baseName, baseExt;
std::string path(this->FileName);
std::string baseName, baseExt;
// default guess is the way datamine guess
// which is namept.dm and nametr.dm ( that is why it is dot - 2 )
......@@ -466,7 +466,7 @@ bool vtkDataMineWireFrameReader::FindAndSetFilePath(
baseName = path.substr(0, (dot - 2));
baseExt = path.substr(dot, path.size());
vtkStdString dm(baseName + dmExt + baseExt);
std::string dm(baseName + dmExt + baseExt);
if (vtksys::SystemTools::FileExists(dm))
{
this->SetFileName(dm.c_str(), update, type);
......
......@@ -54,7 +54,7 @@ protected:
// finds a file path based on the input. Used to find the other file for topo/triangle
// was code in RI, but moved to a method to reduce duplication
bool FindAndSetFilePath(vtkStdString& dmExt, const bool& update, FileTypes type);
bool FindAndSetFilePath(std::string& dmExt, const bool& update, FileTypes type);
void Read(vtkPoints* points, vtkCellArray* cells) override;
void ReadPoints(vtkPoints* points);
......
......@@ -28,7 +28,6 @@
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkPoints.h"
#include "vtkStdString.h"
#include "vtkSmartPointer.h"
#define VTK_CREATE(type, name) vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
......@@ -158,7 +157,7 @@ const char* vtkMomentVectors::GetOutputMomentTotalName(vtkDataObject* input)
if (this->InputMomentIsDensity)
{
static vtkStdString result;
static std::string result;
result = inputArray->GetName();
result += "_total";
return result.c_str();
......@@ -190,7 +189,7 @@ const char* vtkMomentVectors::GetOutputMomentDensityName(vtkDataObject* input)
}
else
{
static vtkStdString result;
static std::string result;
result = inputArray->GetName();
result += "_density";
return result.c_str();
......
......@@ -70,12 +70,11 @@ public:
struct InputGui
{
InputType type;
vtkStdString role;
std::string role;
QComboBox* combo;
};
void AddInput(
QWidget* parent, InputType type, const vtkStdString& role, const vtkStdString& name);
void AddInput(QWidget* parent, InputType type, const std::string& role, const std::string& name);
QList<InputGui> Inputs;
QStringList AnalogNames;
......@@ -173,22 +172,22 @@ void pqVRAddStyleDialog::setInteractorStyle(vtkVRInteractorStyle* style, const Q
style->GetAnalogRoles(roles.GetPointer());
for (int i = 0; i < roles->GetNumberOfStrings(); ++i)
{
vtkStdString role(roles->GetString(i));
vtkStdString analogName(style->GetAnalogName(role));
std::string role(roles->GetString(i));
std::string analogName(style->GetAnalogName(role));
this->Internals->AddInput(this, pqInternals::Analog, role, analogName);
}
style->GetButtonRoles(roles.GetPointer());
for (int i = 0; i < roles->GetNumberOfStrings(); ++i)
{
vtkStdString role(roles->GetString(i));
vtkStdString buttonName(style->GetButtonName(role));
std::string role(roles->GetString(i));
std::string buttonName(style->GetButtonName(role));
this->Internals->AddInput(this, pqInternals::Button, role, buttonName);
}
style->GetTrackerRoles(roles.GetPointer());
for (int i = 0; i < roles->GetNumberOfStrings(); ++i)
{
vtkStdString role(roles->GetString(i));
vtkStdString trackerName(style->GetTrackerName(role));
std::string role(roles->GetString(i));
std::string trackerName(style->GetTrackerName(role));
this->Internals->AddInput(this, pqInternals::Tracker, role, trackerName);
}
......@@ -205,8 +204,8 @@ void pqVRAddStyleDialog::updateInteractorStyle()
foreach (const pqInternals::InputGui& gui, this->Internals->Inputs)
{
const vtkStdString& role = gui.role;
const vtkStdString& name = gui.combo->currentText().toStdString();
const std::string& role = gui.role;
const std::string& name = gui.combo->currentText().toStdString();
switch (gui.type)
{
case pqInternals::Analog:
......@@ -232,7 +231,7 @@ bool pqVRAddStyleDialog::isConfigurable()
//-----------------------------------------------------------------------------
void pqVRAddStyleDialog::pqInternals::AddInput(
QWidget* parent, InputType type, const vtkStdString& role, const vtkStdString& name)
QWidget* parent, InputType type, const std::string& role, const std::string& name)
{
this->Inputs.push_back(InputGui());
InputGui& gui = this->Inputs.back();
......
......@@ -105,7 +105,7 @@ bool vtkVRControlSliceOrientationStyle::Update()
// ----------------------------------------------------------------------------
void vtkVRControlSliceOrientationStyle::HandleButton(const vtkVREventData& data)
{
vtkStdString role = this->GetButtonRole(data.name);
std::string role = this->GetButtonRole(data.name);
if (role == "Grab slice")
{
if (this->Enabled && data.data.button.state == 0)
......@@ -121,7 +121,7 @@ void vtkVRControlSliceOrientationStyle::HandleButton(const vtkVREventData& data)
// ----------------------------------------------------------------------------
void vtkVRControlSliceOrientationStyle::HandleTracker(const vtkVREventData& data)
{
vtkStdString role = this->GetTrackerRole(data.name);
std::string role = this->GetTrackerRole(data.name);
if (role != "Slice orientation")
{
return;
......
......@@ -95,7 +95,7 @@ bool vtkVRControlSlicePositionStyle::Update()
// ----------------------------------------------------------------------------
void vtkVRControlSlicePositionStyle::HandleButton(const vtkVREventData& data)
{
vtkStdString role = this->GetButtonRole(data.name);
std::string role = this->GetButtonRole(data.name);
if (role == "Grab slice")
{
if (this->Enabled && data.data.button.state == 0)
......@@ -111,7 +111,7 @@ void vtkVRControlSlicePositionStyle::HandleButton(const vtkVREventData& data)
// ----------------------------------------------------------------------------
void vtkVRControlSlicePositionStyle::HandleTracker(const vtkVREventData& data)
{
vtkStdString role = this->GetTrackerRole(data.name);
std::string role = this->GetTrackerRole(data.name);
if (role != "Slice position")
{
return;
......
......@@ -75,7 +75,7 @@ vtkVRGrabWorldStyle::~vtkVRGrabWorldStyle()
// ----------------------------------------------------------------------------
void vtkVRGrabWorldStyle::HandleButton(const vtkVREventData& data)
{
vtkStdString role = this->GetButtonRole(data.name);
std::string role = this->GetButtonRole(data.name);
if (role == "Translate world")
{
this->EnableTranslate = data.data.button.state;
......@@ -103,7 +103,7 @@ void vtkVRGrabWorldStyle::HandleButton(const vtkVREventData& data)
// ----------------------------------------------------------------------------
void vtkVRGrabWorldStyle::HandleTracker(const vtkVREventData& data)
{
vtkStdString role = this->GetTrackerRole(data.name);
std::string role = this->GetTrackerRole(data.name);
if (role == "Tracker")
{
if (this->EnableTranslate)
......
......@@ -44,6 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <algorithm>
#include <sstream>
#include <string>
// ----------------------------------------------------------------------------
vtkStandardNewMacro(vtkVRInteractorStyle)
......@@ -273,19 +274,19 @@ std::vector<std::string> vtkVRInteractorStyle::Tokenize(std::string input)
}
// ----------------------------------------------------------------------------
void vtkVRInteractorStyle::AddAnalogRole(const vtkStdString& role)
void vtkVRInteractorStyle::AddAnalogRole(const std::string& role)
{
this->Analogs.insert(StringMap::value_type(role, std::string()));
}
// ----------------------------------------------------------------------------
void vtkVRInteractorStyle::AddButtonRole(const vtkStdString& role)
void vtkVRInteractorStyle::AddButtonRole(const std::string& role)
{
this->Buttons.insert(StringMap::value_type(role, std::string()));
}
// ----------------------------------------------------------------------------
void vtkVRInteractorStyle::AddTrackerRole(const vtkStdString& role)
void vtkVRInteractorStyle::AddTrackerRole(const std::string& role)
{
this->Trackers.insert(StringMap::value_type(role, std::string()));
}
......@@ -302,7 +303,7 @@ void vtkVRInteractorStyle::MapKeysToStringList(const StringMap& source, vtkStrin
// ----------------------------------------------------------------------------
bool vtkVRInteractorStyle::SetValueInMap(
StringMap& map_, const vtkStdString& key, const vtkStdString& value)
StringMap& map_, const std::string& key, const std::string& value)
{
StringMap::iterator it = map_.find(key);
if (it != map_.end())
......@@ -314,14 +315,14 @@ bool vtkVRInteractorStyle::SetValueInMap(
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetValueInMap(const StringMap& map_, const vtkStdString& key)
std::string vtkVRInteractorStyle::GetValueInMap(const StringMap& map_, const std::string& key)
{
StringMap::const_iterator it = map_.find(key);
return it != map_.end() ? it->second : vtkStdString();
return it != map_.end() ? it->second : std::string();
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetKeyInMap(const StringMap& map_, const vtkStdString& value)
std::string vtkVRInteractorStyle::GetKeyInMap(const StringMap& map_, const std::string& value)
{
for (StringMap::const_iterator it = map_.begin(), itEnd = map_.end(); it != itEnd; ++it)
{
......@@ -330,7 +331,7 @@ vtkStdString vtkVRInteractorStyle::GetKeyInMap(const StringMap& map_, const vtkS
return it->first;
}
}
return vtkStdString();
return std::string();
}
// ----------------------------------------------------------------------------
......@@ -394,55 +395,55 @@ int vtkVRInteractorStyle::GetNumberOfTrackerRoles()
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetAnalogRole(const vtkStdString& name)
std::string vtkVRInteractorStyle::GetAnalogRole(const std::string& name)
{
return this->GetKeyInMap(this->Analogs, name);
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetButtonRole(const vtkStdString& name)
std::string vtkVRInteractorStyle::GetButtonRole(const std::string& name)
{
return this->GetKeyInMap(this->Buttons, name);
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetTrackerRole(const vtkStdString& name)
std::string vtkVRInteractorStyle::GetTrackerRole(const std::string& name)
{
return this->GetKeyInMap(this->Trackers, name);
}
// ----------------------------------------------------------------------------
bool vtkVRInteractorStyle::SetAnalogName(const vtkStdString& role, const vtkStdString& name)
bool vtkVRInteractorStyle::SetAnalogName(const std::string& role, const std::string& name)
{
return this->SetValueInMap(this->Analogs, role, name);
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetAnalogName(const vtkStdString& role)
std::string vtkVRInteractorStyle::GetAnalogName(const std::string& role)
{
return this->GetValueInMap(this->Analogs, role);
}
// ----------------------------------------------------------------------------
bool vtkVRInteractorStyle::SetButtonName(const vtkStdString& role, const vtkStdString& name)
bool vtkVRInteractorStyle::SetButtonName(const std::string& role, const std::string& name)
{
return this->SetValueInMap(this->Buttons, role, name);
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetButtonName(const vtkStdString& role)
std::string vtkVRInteractorStyle::GetButtonName(const std::string& role)
{
return this->GetValueInMap(this->Buttons, role);
}
// ----------------------------------------------------------------------------
bool vtkVRInteractorStyle::SetTrackerName(const vtkStdString& role, const vtkStdString& name)
bool vtkVRInteractorStyle::SetTrackerName(const std::string& role, const std::string& name)
{
return this->SetValueInMap(this->Trackers, role, name);
}
// ----------------------------------------------------------------------------
vtkStdString vtkVRInteractorStyle::GetTrackerName(const vtkStdString& role)
std::string vtkVRInteractorStyle::GetTrackerName(const std::string& role)
{
return this->GetValueInMap(this->Trackers, role);
}
......
......@@ -33,9 +33,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define vtkVRInteractorStyle_h
#include <vtkObject.h>
#include <vtkStdString.h> // For vtkStdString
#include <map>
#include <string>
#include <vector>
class vtkPVXMLElement;
......@@ -86,18 +86,18 @@ public:
// Description:
// Get the role of the input with the given name. If the name is not
// set or recognized, an empty string is returned.
vtkStdString GetAnalogRole(const vtkStdString& name);
vtkStdString GetButtonRole(const vtkStdString& name);
vtkStdString GetTrackerRole(const vtkStdString& name);
std::string GetAnalogRole(const std::string& name);
std::string GetButtonRole(const std::string& name);
std::string GetTrackerRole(const std::string& name);
// Description:
// Set/Get the name of the input that fulfills the specified role.
bool SetAnalogName(const vtkStdString& role, const vtkStdString& name);
vtkStdString GetAnalogName(const vtkStdString& role);
bool SetButtonName(const vtkStdString& role, const vtkStdString& name);
vtkStdString GetButtonName(const vtkStdString& role);
bool SetTrackerName(const vtkStdString& role, const vtkStdString& name);
vtkStdString GetTrackerName(const vtkStdString& role);
bool SetAnalogName(const std::string& role, const std::string& name);
std::string GetAnalogName(const std::string& role);
bool SetButtonName(const std::string& role, const std::string& name);
std::string GetButtonName(const std::string& role);
bool SetTrackerName(const std::string& role, const std::string& name);
std::string GetTrackerName(const std::string& role);
/// Load state for the style from XML.
virtual bool Configure(vtkPVXMLElement* child, vtkSMProxyLocator*);
......@@ -120,18 +120,18 @@ protected:
// Description:
// Add a new input role to the interactor style.
void AddAnalogRole(const vtkStdString& role);
void AddButtonRole(const vtkStdString& role);
void AddTrackerRole(const vtkStdString& role);
void AddAnalogRole(const std::string& role);
void AddButtonRole(const std::string& role);
void AddTrackerRole(const std::string& role);