simgear/environment/metar.*: getDescription() can now also use single spaces.

If <tabstop> param is -1, all sequences of tabs are replaced by a single space.
This commit is contained in:
Julian Smith 2019-11-06 19:07:50 +00:00
parent 0c8949e723
commit 1a4568175c
2 changed files with 10 additions and 2 deletions

View File

@ -203,6 +203,14 @@ std::ostream& operator << (std::ostream& out, const Tab& t)
std::ostringstream& out2 = *(std::ostringstream*) &out;
std::string s = out2.str();
if (t._stops < 0) {
if (!s.size() || s[s.size()-1] != ' ') {
out << ' ';
}
return out;
}
auto nl = s.rfind('\n');
if (nl < 0) nl = 0;
int column = 0;

View File

@ -236,8 +236,8 @@ public:
inline const std::vector<struct Weather> getWeather2() const { return _weather2; }
/* Returns human-readable description. If tabtops is 0, we use tab
characters, otherwise we use spaces to pad to multiple of <tabstops>.
*/
characters. If +ve we use spaces to pad to multiple of <tabstops>. If
-1 all sequences of tabs are represented by a single space. */
std::string getDescription(int tabstops) const;
protected: