MCPcopy Create free account
hub / github.com/Kitware/VTK / OpenFile

Method OpenFile

IO/GeoJSON/vtkGeoJSONWriter.cxx:117–153  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

115
116//------------------------------------------------------------------------------
117ostream* vtkGeoJSONWriter::OpenFile()
118{
119 vtkDebugMacro(<< "Opening file\n");
120
121 ostream* fptr;
122
123 if (!this->WriteToOutputString)
124 {
125 if (!this->FileName)
126 {
127 vtkErrorMacro(<< "No FileName specified! Can't write!");
128 return nullptr;
129 }
130
131 fptr = new vtksys::ofstream(this->FileName, ios::out);
132 }
133 else
134 {
135 // Get rid of any old output string.
136 if (this->OutputString)
137 {
138 delete[] this->OutputString;
139 this->OutputString = nullptr;
140 this->OutputStringLength = 0;
141 }
142 fptr = new std::ostringstream;
143 }
144
145 if (fptr->fail())
146 {
147 vtkErrorMacro(<< "Unable to open file: " << this->FileName);
148 delete fptr;
149 return nullptr;
150 }
151
152 return fptr;
153}
154
155//------------------------------------------------------------------------------
156void vtkGeoJSONWriter::CloseFile(ostream* fp)

Callers 1

WriteDataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected