SGMetar: avoid raw char pointers in the public API
Ideally would refactor to remove the raw pointers internally, but this is a good first step.
This commit is contained in:
parent
6fe7c307b2
commit
bf1db210d7
@ -491,9 +491,17 @@ void SGMetar::useCurrentDate()
|
||||
_month = now.tm_mon + 1;
|
||||
}
|
||||
|
||||
const char* SGMetar::getRawDataPtr()
|
||||
std::string SGMetar::getDataString() const
|
||||
{
|
||||
return _data.data();
|
||||
return std::string{_data.data()};
|
||||
}
|
||||
|
||||
std::string SGMetar::getUnparsedData() const
|
||||
{
|
||||
if (!_m || (strlen(_m) < 1))
|
||||
return {};
|
||||
|
||||
return std::string{_m};
|
||||
}
|
||||
/**
|
||||
* Replace any number of subsequent spaces by just one space, and add
|
||||
|
@ -186,7 +186,8 @@ public:
|
||||
std::vector<std::string> phenomena;
|
||||
};
|
||||
|
||||
const char* getRawDataPtr();
|
||||
std::string getDataString() const;
|
||||
std::string getUnparsedData() const;
|
||||
|
||||
inline bool getProxy() const { return _x_proxy; }
|
||||
inline const char *getId() const { return _icao; }
|
||||
|
Loading…
Reference in New Issue
Block a user