1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Namespace ostream and endl into std::

Use <iostream> without the .h
This commit is contained in:
Peter Howkins 2012-03-13 17:54:48 +00:00
parent 167fd854e1
commit 7294970c18
4 changed files with 54 additions and 0 deletions

View file

@ -118,13 +118,25 @@ void ManSearchPath::Print()
} }
} }
#if defined(linux)
std::ostream & operator<<
(
std::ostream & os,
const ManSearchPath & sp
)
#else
ostream & operator<< ostream & operator<<
( (
ostream & os, ostream & os,
const ManSearchPath & sp const ManSearchPath & sp
) )
#endif
{ {
#if defined(linux)
os << sp.GetEnvVar() << std::endl;
#else
os << sp.GetEnvVar() << endl; os << sp.GetEnvVar() << endl;
#endif
sp.PrettyPrint(os); sp.PrettyPrint(os);
return os; return os;
} }

View file

@ -33,7 +33,11 @@
#include "Options.h" #include "Options.h"
#include <stdlib.h> #include <stdlib.h>
#if defined(linux)
#include <iostream>
#else
#include <iostream.h> #include <iostream.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>

View file

@ -372,18 +372,33 @@ void SearchPath::Print()
* *
****************************************************************/ ****************************************************************/
#if defined(linux)
void SearchPath::PrettyPrint
(
std::ostream & os
) const
#else
void SearchPath::PrettyPrint void SearchPath::PrettyPrint
( (
ostream & os ostream & os
) const ) const
#endif
{ {
CTokenizedString path (GetSearchPath(), Separator().data()); CTokenizedString path (GetSearchPath(), Separator().data());
CString subpath = path.next(); CString subpath = path.next();
while (!subpath.isNull()) { while (!subpath.isNull()) {
#if defined(linux)
os << " " << subpath << std::endl;
#else
os << " " << subpath << endl; os << " " << subpath << endl;
#endif
subpath = path.next(); subpath = path.next();
} }
#if defined(linux)
os << std::endl;
#else
os << endl; os << endl;
#endif
} }
@ -394,13 +409,25 @@ void SearchPath::PrettyPrint
* *
****************************************************************/ ****************************************************************/
#if defined(linux)
std::ostream & operator<<
(
std::ostream & os,
const SearchPath & sp
)
#else
ostream & operator<< ostream & operator<<
( (
ostream & os, ostream & os,
const SearchPath & sp const SearchPath & sp
) )
#endif
{ {
#if defined(linux)
os << sp.GetEnvVar() << "SEARCHPATH:" << std::endl;
#else
os << sp.GetEnvVar() << "SEARCHPATH:" << endl; os << sp.GetEnvVar() << "SEARCHPATH:" << endl;
#endif
sp.PrettyPrint(os); sp.PrettyPrint(os);
return os; return os;
} }

View file

@ -50,9 +50,16 @@ class SearchPath {
virtual void ExportPath(); virtual void ExportPath();
virtual void Print(); virtual void Print();
virtual void AddPredefinedPath(); virtual void AddPredefinedPath();
#if defined(linux)
virtual void PrettyPrint (std::ostream &) const;
friend std::ostream & operator<< (std::ostream &, const SearchPath &);
#else
virtual void PrettyPrint (ostream &) const; virtual void PrettyPrint (ostream &) const;
friend ostream & operator<< (ostream &, const SearchPath &); friend ostream & operator<< (ostream &, const SearchPath &);
#endif
const char * GetEnvVar() const { return environment_var; } const char * GetEnvVar() const { return environment_var; }
CString GetSearchPath() const { return final_search_path; } CString GetSearchPath() const { return final_search_path; }
@ -178,7 +185,11 @@ class ManSearchPath : public SearchPath {
virtual void ExportPath (); virtual void ExportPath ();
virtual void Print(); virtual void Print();
#if defined(linux)
friend std::ostream & operator<< (std::ostream &, const ManSearchPath &);
#else
friend ostream & operator<< (ostream &, const ManSearchPath &); friend ostream & operator<< (ostream &, const ManSearchPath &);
#endif
protected: protected:
virtual void MakePath (const CString &); virtual void MakePath (const CString &);