Mod: replace std::ifstream/std::ofstream with Base::ifstream/Base::ofstream
This commit is contained in:
@@ -32,7 +32,9 @@
|
||||
#include "Builder3D.h"
|
||||
#include "Console.h"
|
||||
#include "Exception.h"
|
||||
#include "FileInfo.h"
|
||||
#include "Matrix.h"
|
||||
#include "Stream.h"
|
||||
#include "Tools.h"
|
||||
|
||||
|
||||
@@ -318,7 +320,8 @@ void Builder3D::saveToLog()
|
||||
void Builder3D::saveToFile(const char* FileName)
|
||||
{
|
||||
result << "} ";
|
||||
std::ofstream file(FileName);
|
||||
Base::FileInfo fi(FileName);
|
||||
Base::ofstream file(fi);
|
||||
if(!file)
|
||||
throw FileException("Builder3D::saveToFile(): Can not open file...");
|
||||
|
||||
|
||||
@@ -1545,8 +1545,9 @@ void FemMesh::readNastran(const std::string &Filename)
|
||||
|
||||
_Mtrx = Base::Matrix4D();
|
||||
|
||||
std::ifstream inputfile;
|
||||
inputfile.open(Filename.c_str());
|
||||
Base::FileInfo fi(Filename);
|
||||
Base::ifstream inputfile;
|
||||
inputfile.open(fi);
|
||||
inputfile.seekg(std::ifstream::beg);
|
||||
std::string line1,line2;
|
||||
std::vector<NastranElementPtr> mesh_elements;
|
||||
@@ -1636,8 +1637,9 @@ void FemMesh::readNastran95(const std::string &Filename)
|
||||
|
||||
_Mtrx = Base::Matrix4D();
|
||||
|
||||
std::ifstream inputfile;
|
||||
inputfile.open(Filename.c_str());
|
||||
Base::FileInfo fi(Filename);
|
||||
Base::ifstream inputfile;
|
||||
inputfile.open(fi);
|
||||
inputfile.seekg(std::ifstream::beg);
|
||||
std::string line1,line2,tcard;
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <Base/Stream.h>
|
||||
|
||||
|
||||
using namespace MeshPart;
|
||||
@@ -78,7 +80,8 @@ CurveProjector::CurveProjector(const TopoDS_Shape &aShape, const MeshKernel &pMe
|
||||
void CurveProjector::writeIntersectionPointsToFile(const char *name)
|
||||
{
|
||||
// export points
|
||||
std::ofstream str(name, std::ios::out | std::ios::binary);
|
||||
Base::FileInfo fi(name);
|
||||
Base::ofstream str(fi, std::ios::out | std::ios::binary);
|
||||
str.precision(4);
|
||||
str.setf(std::ios::fixed | std::ios::showpoint);
|
||||
for (result_type::const_iterator it1 = mvEdgeSplitPoints.begin();it1!=mvEdgeSplitPoints.end();++it1) {
|
||||
@@ -319,7 +322,8 @@ void CurveProjectorSimple::projectCurve( const TopoDS_Edge& aEdge,
|
||||
MeshFacetIterator It(_Mesh);
|
||||
|
||||
Base::SequencerLauncher seq("Building up projection map...", ulNbOfPoints+1);
|
||||
std::ofstream str("projected.asc", std::ios::out | std::ios::binary);
|
||||
Base::FileInfo fi("projected.asc");
|
||||
Base::ofstream str(fi, std::ios::out | std::ios::binary);
|
||||
str.precision(4);
|
||||
str.setf(std::ios::fixed | std::ios::showpoint);
|
||||
|
||||
@@ -711,7 +715,8 @@ void MeshProjection::splitMeshByShape ( const TopoDS_Shape &aShape, float fMaxDi
|
||||
std::vector<PolyLine> rPolyLines;
|
||||
projectToMesh( aShape, fMaxDist, rPolyLines );
|
||||
|
||||
std::ofstream str("output.asc", std::ios::out | std::ios::binary);
|
||||
Base::FileInfo fi("output.asc");
|
||||
Base::ofstream str(fi, std::ios::out | std::ios::binary);
|
||||
str.precision(4);
|
||||
str.setf(std::ios::fixed | std::ios::showpoint);
|
||||
for (std::vector<PolyLine>::const_iterator it = rPolyLines.begin();it!=rPolyLines.end();++it) {
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#endif
|
||||
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
#include <Base/MatrixPy.h>
|
||||
#include <Base/Rotation.h>
|
||||
@@ -405,7 +406,8 @@ PyObject* TopoShapePy::exportBinary(PyObject *args)
|
||||
|
||||
try {
|
||||
// read binary brep
|
||||
std::ofstream str(input, std::ios::out | std::ios::binary);
|
||||
Base::FileInfo fi(input);
|
||||
Base::ofstream str(fi, std::ios::out | std::ios::binary);
|
||||
getTopoShapePtr()->exportBinary(str);
|
||||
str.close();
|
||||
}
|
||||
@@ -516,7 +518,8 @@ PyObject* TopoShapePy::importBinary(PyObject *args)
|
||||
|
||||
try {
|
||||
// read binary brep
|
||||
std::ifstream str(input, std::ios::in | std::ios::binary);
|
||||
Base::FileInfo fi(input);
|
||||
Base::ifstream str(fi, std::ios::in | std::ios::binary);
|
||||
getTopoShapePtr()->importBinary(str);
|
||||
str.close();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <App/Application.h>
|
||||
@@ -163,7 +164,7 @@ namespace Path {
|
||||
if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Path::Feature"))) {
|
||||
const Toolpath& path = static_cast<Path::Feature*>(obj)->Path.getValue();
|
||||
std::string gcode = path.toGCode();
|
||||
std::ofstream ofile(EncodedName.c_str());
|
||||
Base::ofstream ofile(file);
|
||||
ofile << gcode;
|
||||
ofile.close();
|
||||
}
|
||||
@@ -199,7 +200,7 @@ namespace Path {
|
||||
|
||||
try {
|
||||
// read the gcode file
|
||||
std::ifstream filestr(file.filePath().c_str());
|
||||
Base::ifstream filestr(file);
|
||||
std::stringstream buffer;
|
||||
buffer << filestr.rdbuf();
|
||||
std::string gcode = buffer.str();
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include "PovTools.h"
|
||||
#include "LuxTools.h"
|
||||
// automatically generated.....
|
||||
@@ -72,15 +74,13 @@ public:
|
||||
private:
|
||||
Py::Object writeProjectFile(const Py::Tuple& args)
|
||||
{
|
||||
char *fromPython;
|
||||
if (! PyArg_ParseTuple(args.ptr(), "(s)", &fromPython))
|
||||
const char *fromPython = "FreeCAD.pov";
|
||||
if (! PyArg_ParseTuple(args.ptr(), "|(s)", &fromPython))
|
||||
throw Py::Exception();
|
||||
|
||||
std::ofstream fout;
|
||||
if (fromPython)
|
||||
fout.open(fromPython);
|
||||
else
|
||||
fout.open("FreeCAD.pov");
|
||||
Base::ofstream fout;
|
||||
Base::FileInfo fi(fromPython);
|
||||
fout.open(fi);
|
||||
|
||||
fout << FreeCAD ;
|
||||
fout.close();
|
||||
|
||||
@@ -317,7 +317,8 @@ void PovTools::writeShapeCSV(const char *FileName,
|
||||
BRepMesh_IncrementalMesh MESH(Shape,fMeshDeviation);
|
||||
|
||||
// open the file and write
|
||||
std::ofstream fout(FileName);
|
||||
Base::FileInfo fi(FileName);
|
||||
Base::ofstream fout(fi);
|
||||
|
||||
// counting faces and start sequencer
|
||||
int l = 1;
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Writer.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Stream.h>
|
||||
|
||||
#include "kdl_cp/chain.hpp"
|
||||
#include "kdl_cp/chainfksolver.hpp"
|
||||
@@ -136,7 +138,8 @@ void split(std::string const& string, const char delimiter, std::vector<std::str
|
||||
void Robot6Axis::readKinematic(const char * FileName)
|
||||
{
|
||||
char buf[120];
|
||||
std::ifstream in(FileName);
|
||||
Base::FileInfo fi(FileName);
|
||||
Base::ifstream in(fi);
|
||||
if (!in)
|
||||
return;
|
||||
|
||||
|
||||
@@ -266,10 +266,11 @@ static void writeEscaped(std::string const& s, char quoteChar, char escapeChar,
|
||||
|
||||
bool Sheet::exportToFile(const std::string &filename, char delimiter, char quoteChar, char escapeChar) const
|
||||
{
|
||||
std::ofstream file;
|
||||
Base::ofstream file;
|
||||
int prevRow = -1, prevCol = -1;
|
||||
|
||||
file.open(filename.c_str(), std::ios::out | std::ios::ate | std::ios::binary);
|
||||
Base::FileInfo fi(filename);
|
||||
file.open(fi, std::ios::out | std::ios::ate | std::ios::binary);
|
||||
|
||||
if (!file.is_open())
|
||||
return false;
|
||||
|
||||
@@ -67,7 +67,9 @@
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
@@ -1154,7 +1156,9 @@ void DrawUtil::copyFile(std::string inSpec, std::string outSpec)
|
||||
{
|
||||
// Base::Console().Message("DU::copyFile(%s, %s)\n", inSpec.c_str(), outSpec.c_str());
|
||||
if (inSpec.empty()) {
|
||||
std::ofstream output(outSpec);
|
||||
// create an empty file
|
||||
Base::FileInfo fi(outSpec);
|
||||
Base::ofstream output(fi);
|
||||
return;
|
||||
}
|
||||
Base::FileInfo fi(inSpec);
|
||||
|
||||
@@ -55,8 +55,8 @@ PyObject* DrawViewSymbolPy::dumpSymbol(PyObject *args)
|
||||
}
|
||||
|
||||
Base::FileInfo fi(fileSpec);
|
||||
std::ofstream outfile;
|
||||
outfile.open(fi.filePath());
|
||||
Base::ofstream outfile;
|
||||
outfile.open(fi);
|
||||
outfile.write (symbolRepr.c_str(),symbolRepr.size());
|
||||
outfile.close();
|
||||
if (outfile.good()) {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <TopExp.hxx>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "Geometry.h"
|
||||
@@ -305,8 +306,9 @@ std::vector<PATLineSpec> PATLineSpec::getSpecsForPattern(std::string& parmFile,
|
||||
{
|
||||
std::vector<PATLineSpec> result;
|
||||
std::vector<std::string> lineSpecs;
|
||||
std::ifstream inFile;
|
||||
inFile.open (parmFile, std::ifstream::in);
|
||||
Base::FileInfo fi(parmFile);
|
||||
Base::ifstream inFile;
|
||||
inFile.open (fi, std::ifstream::in);
|
||||
if(!inFile.is_open()) {
|
||||
Base::Console().Message( "Cannot open input file.\n");
|
||||
return result;
|
||||
@@ -385,8 +387,9 @@ std::vector<std::string> PATLineSpec::loadPatternDef(std::ifstream& inFile)
|
||||
std::vector<std::string> PATLineSpec::getPatternList(std::string& parmFile)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::ifstream inFile;
|
||||
inFile.open (parmFile, std::ifstream::in);
|
||||
Base::FileInfo fi(parmFile);
|
||||
Base::ifstream inFile;
|
||||
inFile.open (fi, std::ifstream::in);
|
||||
if(!inFile.is_open()) {
|
||||
Base::Console().Message( "Cannot open input file.\n");
|
||||
return result;
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
@@ -231,7 +233,8 @@ void QGITile::makeText()
|
||||
//read whole text file into std::string
|
||||
std::string QGITile::getStringFromFile(std::string inSpec)
|
||||
{
|
||||
std::ifstream f(inSpec);
|
||||
Base::FileInfo fi(inSpec);
|
||||
Base::ifstream f(fi);
|
||||
std::stringstream ss;
|
||||
ss << f.rdbuf();
|
||||
return ss.str();
|
||||
|
||||
Reference in New Issue
Block a user