STYLE: fix worst spacing violations for 'os <<' constructions

- accept some violations of the coding guidelines though
- perhaps adding a style exception would be simpler.
This commit is contained in:
Mark Olesen
2010-04-13 17:45:49 +02:00
parent 6b819eb50a
commit 42807ddd7e
37 changed files with 115 additions and 121 deletions

View File

@ -50,7 +50,7 @@ Istream& operator>>
alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
)
{
is >> tp.theta0_ >> tp.uTheta_ >> tp.thetaA_ >> tp.thetaR_;
is >> tp.theta0_ >> tp.uTheta_ >> tp.thetaA_ >> tp.thetaR_;
return is;
}

View File

@ -59,7 +59,7 @@ public:
friend Ostream& operator<<(Ostream& os, const ent& e)
{
os << e.keyword_ << ' ' << e.i_ << endl;
os << e.keyword_ << ' ' << e.i_ << endl;
return os;
}
};
@ -88,7 +88,7 @@ public:
friend Ostream& operator<<(Ostream& os, const Scalar& val)
{
os << val.data_;
os << val.data_;
return os;
}
};

View File

@ -38,7 +38,7 @@ public:
friend std::ostream& operator<<(std::ostream& os, const Vector<C>& v)
{
os << v.X << '\t' << v.Y << '\n';
os << v.X << '\t' << v.Y << '\n';
return os;
}
};

View File

@ -89,7 +89,7 @@ int main()
{
OStringStream os;
os << table1;
os << table1;
HASHTABLE_CLASS<double> readTable(IStringStream(os.str())(), 100);
Info<< "Istream constructor:" << readTable << endl;

View File

@ -54,7 +54,7 @@ public:
friend Ostream& operator<<(Ostream& os, const Scalar& s)
{
os << s.data_;
os << s.data_;
return os;
}

View File

@ -60,7 +60,7 @@ public:
friend Ostream& operator<<(Ostream& os, const Scalar& val)
{
os << val.data_;
os << val.data_;
return os;
}
};

View File

@ -83,7 +83,7 @@ int main()
{
OStringStream os;
os << table1;
os << table1;
HASHTABLE_CLASS<double> readTable(IStringStream(os.str())(), 100);
Info<< "Istream constructor:" << readTable << endl;

View File

@ -56,7 +56,7 @@ public:
friend Ostream& operator<<(Ostream& os, const ent& e)
{
os << e.keyword_ << ' ' << e.i_ << endl;
os << e.keyword_ << ' ' << e.i_ << endl;
return os;
}
};

View File

@ -47,8 +47,7 @@ void writeObj(Ostream& os,const pointField& points)
{
const point& pt = points[pointI];
os << "v " << pt.x() << ' ' << pt.y()
<< ' ' << pt.z() << endl;
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
}

View File

@ -92,14 +92,14 @@ int main(int argc, char * argv[])
{
OSHA1stream os;
os << str;
os << str;
Info<< os.digest() << endl;
os << str;
os << str;
Info<< os.digest() << endl;
os.rewind();
os << "The quick brown fox jumps over the lazy dog";
os << "The quick brown fox jumps over the lazy dog";
Info<< os.digest() << endl;
}

View File

@ -110,9 +110,9 @@ const labelListListList& block::boundaryPatches() const
Ostream& operator<<(Ostream& os, const block& b)
{
os << b.Vertices << nl
<< b.Cells << nl
<< b.BoundaryPatches << endl;
os << b.Vertices << nl
<< b.Cells << nl
<< b.BoundaryPatches << endl;
return os;
}

View File

@ -57,7 +57,7 @@ void hexBlock::readPoints(Istream& is)
{
forAll(points_, i)
{
is >> points_[i].x() >> points_[i].y() >> points_[i].z();
is >> points_[i].x() >> points_[i].y() >> points_[i].z();
}
// Calculate the handedness of the block

View File

@ -128,13 +128,13 @@ void hexBlock::readPoints
Info<< "Reading " << nPoints << " x coordinates..." << endl;
for (label i=0; i < nPoints; i++)
{
is >> points_[i].x();
is >> points_[i].x();
}
Info<< "Reading " << nPoints << " y coordinates..." << endl;
for (label i=0; i < nPoints; i++)
{
is >> points_[i].y();
is >> points_[i].y();
}
if (twoDThicknes > 0)
@ -156,7 +156,7 @@ void hexBlock::readPoints
Info<< "Reading " << nPoints << " z coordinates..." << endl;
for (label i=0; i < nPoints; i++)
{
is >> points_[i].z();
is >> points_[i].z();
}
}
@ -166,7 +166,7 @@ void hexBlock::readPoints
Info<< "Reading " << nPoints << " blanks..." << endl;
for (label i=0; i < nPoints; i++)
{
is >> iBlank;
is >> iBlank;
}
}

View File

@ -51,7 +51,7 @@ using namespace Foam;
void writeOBJ(const point& pt, Ostream& os)
{
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
}
// All edges of mesh

View File

@ -58,7 +58,7 @@ Foam::Ostream& Foam::operator<<
if (faceI != -1)
{
os<< " fc:" << c.patch_.localFaces()[faceI].centre(pts);
os << " fc:" << c.patch_.localFaces()[faceI].centre(pts);
}
return os;
}

View File

@ -974,7 +974,7 @@ int main(int argc, char *argv[])
IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType;
is >> setType;
stat = parseType(runTime, mesh, setType, is);

View File

@ -85,20 +85,20 @@ void Foam::writeFuns::write
fField.size()*sizeof(float)
);
os << std::endl;
os << std::endl;
}
else
{
forAll(fField, i)
{
os << fField[i] << ' ';
os << fField[i] << ' ';
if (i > 0 && (i % 10) == 0)
{
os << std::endl;
os << std::endl;
}
}
os << std::endl;
os << std::endl;
}
}
@ -134,20 +134,20 @@ void Foam::writeFuns::write
elems.size()*sizeof(label)
);
os << std::endl;
os << std::endl;
}
else
{
forAll(elems, i)
{
os << elems[i] << ' ';
os << elems[i] << ' ';
if (i > 0 && (i % 10) == 0)
{
os << std::endl;
os << std::endl;
}
}
os << std::endl;
os << std::endl;
}
}

View File

@ -85,12 +85,12 @@ void writeBytes(char* start, int nBytes)
// Debug: write wall flags data
void writeWallFlags(Ostream& os, label cellI, const labelList& wallFlags)
{
os << "cell " << cellI << " wallsFlags:";
os << "cell " << cellI << " wallsFlags:";
forAll(wallFlags, wallFaceI)
{
os << wallFlags[wallFaceI] << " ";
os << wallFlags[wallFaceI] << ' ';
}
os << endl;
os << endl;
}

View File

@ -99,12 +99,12 @@ void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds)
{
if (flds.size())
{
os << msg;
os << msg;
forAll(flds, i)
{
os<< ' ' << flds[i].name();
os << ' ' << flds[i].name();
}
os << endl;
os << endl;
}
}
@ -113,9 +113,9 @@ void print(Ostream& os, const wordList& flds)
{
forAll(flds, i)
{
os<< ' ' << flds[i];
os << ' ' << flds[i];
}
os << endl;
os << endl;
}

View File

@ -163,12 +163,12 @@ void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds)
{
if (flds.size())
{
os << msg;
os << msg;
forAll(flds, i)
{
os<< ' ' << flds[i].name();
os << ' ' << flds[i].name();
}
os << endl;
os << endl;
}
}
@ -177,9 +177,9 @@ void print(Ostream& os, const wordList& flds)
{
forAll(flds, i)
{
os<< ' ' << flds[i];
os << ' ' << flds[i];
}
os << endl;
os << endl;
}

View File

@ -94,20 +94,20 @@ void Foam::writeFuns::write
fField.size()*sizeof(float)
);
os << std::endl;
os << std::endl;
}
else
{
forAll(fField, i)
{
os << fField[i] << ' ';
os << fField[i] << ' ';
if (i > 0 && (i % 10) == 0)
{
os << std::endl;
os << std::endl;
}
}
os << std::endl;
os << std::endl;
}
}
@ -143,20 +143,20 @@ void Foam::writeFuns::write
elems.size()*sizeof(label)
);
os << std::endl;
os << std::endl;
}
else
{
forAll(elems, i)
{
os << elems[i] << ' ';
os << elems[i] << ' ';
if (i > 0 && (i % 10) == 0)
{
os << std::endl;
os << std::endl;
}
}
os << std::endl;
os << std::endl;
}
}
@ -186,11 +186,11 @@ void Foam::writeFuns::writeHeader
if (binary)
{
os << "BINARY" << std::endl;
os << "BINARY" << std::endl;
}
else
{
os << "ASCII" << std::endl;
os << "ASCII" << std::endl;
}
}

View File

@ -502,15 +502,14 @@ void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
vtkDebugMacro(<<"PrintSelf");
this->Superclass::PrintSelf(os,indent);
os<< indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
os << indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
foamData_->PrintSelf(os, indent);
os<< indent << "Time step range: "
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
<< "\n";
os<< indent << "Time step: " << this->GetTimeStep() << endl;
os << indent << "Time step range: "
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1] << "\n"
<< indent << "Time step: " << this->GetTimeStep() << endl;
}

View File

@ -283,8 +283,8 @@ void vtkPV3blockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
vtkDebugMacro(<<"PrintSelf");
this->Superclass::PrintSelf(os,indent);
os<< indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
os << indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
foamData_->PrintSelf(os, indent);
}

View File

@ -41,7 +41,7 @@ Foam::Ostream& Foam::operator<<
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::sumData& wDist)
{
return is >> wDist.oldFace_ >> wDist.sum_ >> wDist.count_;
return is >> wDist.oldFace_ >> wDist.sum_ >> wDist.count_;
}

View File

@ -65,7 +65,7 @@ void writeOBJ(Ostream& os, const pointField& pts)
{
const point& pt = pts[i];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
}
@ -85,7 +85,7 @@ void dumpPoints(const triSurface& surf, const labelList& borderPoint)
{
const point& pt = surf.localPoints()[pointI];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
}
}
@ -108,7 +108,7 @@ void dumpEdges(const triSurface& surf, const boolList& borderEdge)
{
const edge& e = surf.edges()[edgeI];
os << "l " << e.start()+1 << ' ' << e.end()+1 << endl;
os << "l " << e.start()+1 << ' ' << e.end()+1 << endl;
}
}
}

View File

@ -95,13 +95,13 @@ public:
friend Istream& operator>>(Istream& is, substance& s)
{
is >> s.name_ >> s.volFrac_;
is >> s.name_ >> s.volFrac_;
return is;
}
friend Ostream& operator<<(Ostream& os, const substance& s)
{
os << s.name_ << token::SPACE << s.volFrac_;
os << s.name_ << token::SPACE << s.volFrac_;
return os;
}
};

View File

@ -122,19 +122,18 @@ void printSourceFileAndLine
if (line == "")
{
os << " addr2line failed";
os << " addr2line failed";
}
else if (line == "??:0")
{
os << " in " << filename;
os << " in " << filename;
}
else
{
string cwdLine(line.replaceAll(cwd() + '/', ""));
string homeLine(cwdLine.replaceAll(home(), '~'));
os << " at " << homeLine.c_str();
os << " at " << homeLine.c_str();
}
}
}
@ -160,11 +159,11 @@ void getSymbolForRaw
if (fcnt != "")
{
os << fcnt.c_str();
os << fcnt.c_str();
return;
}
}
os << "Uninterpreted: " << raw.c_str();
os << "Uninterpreted: " << raw.c_str();
}
@ -210,8 +209,8 @@ void error::printStack(Ostream& os)
fileName programFile;
word address;
os << '#' << label(i) << " ";
//os << "Raw : " << msg << "\n\t";
os << '#' << label(i) << " ";
//os << "Raw : " << msg << "\n\t";
{
string::size_type lPos = msg.find('[');
string::size_type rPos = msg.find(']');
@ -263,12 +262,12 @@ void error::printStack(Ostream& os)
if (status == 0 && cplusNamePtr)
{
os << cplusNamePtr;
os << cplusNamePtr;
free(cplusNamePtr);
}
else
{
os << cName.c_str();
os << cName.c_str();
}
}
else
@ -279,7 +278,7 @@ void error::printStack(Ostream& os)
{
string fullName(msg.substr(start, endBracketPos-start));
os << fullName.c_str() << nl;
os << fullName.c_str() << nl;
}
else
{
@ -296,7 +295,7 @@ void error::printStack(Ostream& os)
printSourceFileAndLine(os, addressMap, programFile, address);
os << nl;
os << nl;
}
free(strings);

View File

@ -71,7 +71,7 @@ void Foam::coupledPolyPatch::writeOBJ
writeOBJ(os, p1);
vertI++;
os<< "l " << vertI-1 << ' ' << vertI << nl;
os << "l " << vertI-1 << ' ' << vertI << nl;
}

View File

@ -3036,12 +3036,12 @@ void Foam::cellCuts::writeOBJ
vertI++;
}
os << 'f';
os << 'f';
forAll(loopPts, fp)
{
os << ' ' << startVertI + fp + 1;
}
os<< endl;
os << endl;
}

View File

@ -67,7 +67,7 @@ bool Foam::IOPosition<ParticleType>::write() const
template<class ParticleType>
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
{
os<< cloud_.size() << nl << token::BEGIN_LIST << nl;
os << cloud_.size() << nl << token::BEGIN_LIST << nl;
forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
{
@ -80,7 +80,7 @@ bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
os << nl;
}
os<< token::END_LIST << endl;
os << token::END_LIST << endl;
return os.good();
}

View File

@ -36,7 +36,7 @@ void Foam::treeLeaf<Type>::space(Ostream& os, const label n)
{
for (label i=0; i<n; i++)
{
os<< ' ';
os << ' ';
}
}

View File

@ -104,7 +104,7 @@ void Foam::treeNode<Type>::space(Ostream& os, const label n)
{
for (label i=0; i<n; i++)
{
os<< ' ';
os << ' ';
}
}

View File

@ -53,7 +53,7 @@ void triSurface::writeDXGeometry
os << "# " << patchI << " "
<< myPatches[patchI].name() << endl;
}
os << endl << endl;
os << nl << endl;
// Write vertex coordinates
@ -63,7 +63,7 @@ void triSurface::writeDXGeometry
forAll(localPoints(), pointI)
{
const point& pt = localPoints()[pointI];
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
os << endl;
@ -87,10 +87,9 @@ void triSurface::writeDXGeometry
)
{
const label faceI = faceMap[faceIndex++];
const labelledTri& f = localFaces()[faceI];
os << f[0] << ' ' << f[1] << ' ' << f[2] << endl;
os << f[0] << ' ' << f[1] << ' ' << f[2] << endl;
}
}
}
@ -100,11 +99,11 @@ void triSurface::writeDXGeometry
{
const labelledTri& f = localFaces()[faceI];
os << f[0] << ' ' << f[1] << ' ' << f[2] << endl;
os << f[0] << ' ' << f[1] << ' ' << f[2] << endl;
}
}
os << "attribute \"element type\" string \"triangles\"" << endl
<< "attribute \"ref\" string \"positions\"" << endl << endl;
os << "attribute \"element type\" string \"triangles\"" << endl
<< "attribute \"ref\" string \"positions\"" << endl << endl;
}
@ -139,7 +138,7 @@ void triSurface::writeDX(const bool writeSorted, Ostream& os) const
{
forAll(myPatches[patchI], patchFaceI)
{
os << patchI << endl;
os << patchI << endl;
}
}
}
@ -149,7 +148,7 @@ void triSurface::writeDX(const bool writeSorted, Ostream& os) const
forAll(*this, faceI)
{
os << faceI << endl;
os << faceI << endl;
}
}
@ -157,7 +156,7 @@ void triSurface::writeDX(const bool writeSorted, Ostream& os) const
writeDXTrailer(os);
os << "end" << endl;
os << "end" << endl;
}
@ -173,7 +172,7 @@ void triSurface::writeDX(const scalarField& field, Ostream& os) const
<< " data follows" << endl;
forAll(field, faceI)
{
os << field[faceI] << endl;
os << field[faceI] << endl;
}
os << endl
<< "attribute \"dep\" string \"connections\"" << endl << endl;
@ -185,7 +184,7 @@ void triSurface::writeDX(const scalarField& field, Ostream& os) const
<< " data follows" << endl;
forAll(field, pointI)
{
os << field[pointI] << endl;
os << field[pointI] << endl;
}
os << endl
<< "attribute \"dep\" string \"positions\"" << endl << endl;
@ -202,7 +201,7 @@ void triSurface::writeDX(const scalarField& field, Ostream& os) const
writeDXTrailer(os);
os << "end" << endl;
os << "end" << endl;
}
@ -251,7 +250,7 @@ void triSurface::writeDX(const vectorField& field, Ostream& os) const
writeDXTrailer(os);
os << "end" << endl;
os << "end" << endl;
}

View File

@ -79,7 +79,7 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
{
// Print all faces belonging to this patch
os << "g " << myPatches[patchI].name() << nl;
os << "g " << myPatches[patchI].name() << nl;
for
(
@ -121,7 +121,7 @@ void triSurface::writeOBJ(const bool writeSorted, Ostream& os) const
if (prevPatchI != patchIDs[faceI])
{
prevPatchI = patchIDs[faceI];
os << "g " << myPatches[patchIDs[faceI]].name() << nl;
os << "g " << myPatches[patchIDs[faceI]].name() << nl;
}
os << "f "
<< operator[](faceI)[0] + 1 << ' '

View File

@ -48,7 +48,7 @@ void triSurface::writeOFF(const bool writeSorted, Ostream& os) const
os << "# " << patchI << " "
<< myPatches[patchI].name() << endl;
}
os << endl << endl;
os << nl << endl;
const pointField& ps = points();
@ -56,7 +56,7 @@ void triSurface::writeOFF(const bool writeSorted, Ostream& os) const
<< ps.size()
<< ' ' << size()
<< ' ' << nEdges()
<< endl << endl;
<< nl << endl;
// Write vertex coords
forAll(ps, pointi)
@ -66,7 +66,7 @@ void triSurface::writeOFF(const bool writeSorted, Ostream& os) const
<< ps[pointi].z() << " #" << pointi << endl;
}
os << endl;
os << endl;
if (writeSorted)
{

View File

@ -48,7 +48,7 @@ void triSurface::writeSTLASCII(Ostream& os) const
// Print all faces belonging to this region
const surfacePatch& patch = myPatches[patchI];
os << "solid " << patch.name() << endl;
os << "solid " << patch.name() << endl;
for
(
@ -62,8 +62,8 @@ void triSurface::writeSTLASCII(Ostream& os) const
const vector& n = faceNormals()[faceI];
os << " facet normal "
<< n.x() << ' ' << n.y() << ' ' << n.z() << endl;
os << " outer loop" << endl;
<< n.x() << ' ' << n.y() << ' ' << n.z() << nl
<< " outer loop" << endl;
const labelledTri& f = (*this)[faceI];
const point& pa = points()[f[0]];
@ -71,18 +71,16 @@ void triSurface::writeSTLASCII(Ostream& os) const
const point& pc = points()[f[2]];
os << " vertex "
<< pa.x() << ' ' << pa.y() << ' ' << pa.z() << endl;
os << " vertex "
<< pb.x() << ' ' << pb.y() << ' ' << pb.z() << endl;
os << " vertex "
<< pc.x() << ' ' << pc.y() << ' ' << pc.z() << endl;
os
<< " endloop" << endl;
os
<< pa.x() << ' ' << pa.y() << ' ' << pa.z() << nl
<< " vertex "
<< pb.x() << ' ' << pb.y() << ' ' << pb.z() << nl
<< " vertex "
<< pc.x() << ' ' << pc.y() << ' ' << pc.z() << nl
<< " endloop" << nl
<< " endfacet" << endl;
}
os << "endsolid " << patch.name() << endl;
os << "endsolid " << patch.name() << endl;
}
}

View File

@ -120,7 +120,7 @@ Foam::surfacePatchIOList::~surfacePatchIOList()
// writeData member function required by regIOobject
bool Foam::surfacePatchIOList::writeData(Ostream& os) const
{
os << *this;
os << *this;
return os.good();
}