From: Peter Howkins Date: Tue, 13 Mar 2012 17:54:48 +0000 (+0000) Subject: Namespace ostream and endl into std:: X-Git-Tag: 2.2.0a~26^2~68 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7294970c1826142d33157a7ad74031fbaad6a317;p=oweals%2Fcde.git Namespace ostream and endl into std:: Use without the .h --- diff --git a/cde/programs/dtsearchpath/dtsp/ManSearchPath.C b/cde/programs/dtsearchpath/dtsp/ManSearchPath.C index aa893312..b03891da 100644 --- a/cde/programs/dtsearchpath/dtsp/ManSearchPath.C +++ b/cde/programs/dtsearchpath/dtsp/ManSearchPath.C @@ -118,13 +118,25 @@ void ManSearchPath::Print() } } +#if defined(linux) +std::ostream & operator<< + ( + std::ostream & os, + const ManSearchPath & sp + ) +#else ostream & operator<< ( ostream & os, const ManSearchPath & sp ) +#endif { +#if defined(linux) + os << sp.GetEnvVar() << std::endl; +#else os << sp.GetEnvVar() << endl; +#endif sp.PrettyPrint(os); return os; } diff --git a/cde/programs/dtsearchpath/dtsp/Options.C b/cde/programs/dtsearchpath/dtsp/Options.C index 6a35d4f6..08004356 100644 --- a/cde/programs/dtsearchpath/dtsp/Options.C +++ b/cde/programs/dtsearchpath/dtsp/Options.C @@ -33,7 +33,11 @@ #include "Options.h" #include +#if defined(linux) +#include +#else #include +#endif #include #include diff --git a/cde/programs/dtsearchpath/dtsp/SearchPath.C b/cde/programs/dtsearchpath/dtsp/SearchPath.C index 3145e852..f0dd4a0e 100644 --- a/cde/programs/dtsearchpath/dtsp/SearchPath.C +++ b/cde/programs/dtsearchpath/dtsp/SearchPath.C @@ -372,18 +372,33 @@ void SearchPath::Print() * ****************************************************************/ +#if defined(linux) +void SearchPath::PrettyPrint + ( + std::ostream & os + ) const +#else void SearchPath::PrettyPrint ( ostream & os ) const +#endif { CTokenizedString path (GetSearchPath(), Separator().data()); CString subpath = path.next(); while (!subpath.isNull()) { +#if defined(linux) + os << " " << subpath << std::endl; +#else os << " " << subpath << endl; +#endif subpath = path.next(); } +#if defined(linux) + os << std::endl; +#else 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 & os, const SearchPath & sp ) +#endif { +#if defined(linux) + os << sp.GetEnvVar() << "SEARCHPATH:" << std::endl; +#else os << sp.GetEnvVar() << "SEARCHPATH:" << endl; +#endif sp.PrettyPrint(os); return os; } diff --git a/cde/programs/dtsearchpath/dtsp/SearchPath.h b/cde/programs/dtsearchpath/dtsp/SearchPath.h index e6d2e797..0902590f 100644 --- a/cde/programs/dtsearchpath/dtsp/SearchPath.h +++ b/cde/programs/dtsearchpath/dtsp/SearchPath.h @@ -50,9 +50,16 @@ class SearchPath { virtual void ExportPath(); virtual void Print(); 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; friend ostream & operator<< (ostream &, const SearchPath &); +#endif const char * GetEnvVar() const { return environment_var; } CString GetSearchPath() const { return final_search_path; } @@ -178,7 +185,11 @@ class ManSearchPath : public SearchPath { virtual void ExportPath (); virtual void Print(); +#if defined(linux) + friend std::ostream & operator<< (std::ostream &, const ManSearchPath &); +#else friend ostream & operator<< (ostream &, const ManSearchPath &); +#endif protected: virtual void MakePath (const CString &);