[gdal-dev] HDF5 metadata format problems
Frank Warmerdam
warmerdam at pobox.com
Tue Jun 14 10:19:09 EDT 2011
On 11-06-14 10:08 AM, Alex Mantaut wrote:
> Hi Frank:
> Thanks for your response. I wasn't sure if the whitespace was
> allways going to be there, because for some fields had the white space but
> others didn't. I will remove the trailing whitespace.
> Now, I'm trying to develop a modification on the HDF5 driver to allow it to get
> the georreference information from COSMO-SKYMED HDF5 files... The thing is I'm
> not really familiar with the libraries used by GDAL(the use of iostream is not
> allowed right?), what would be the better way to trim a string? I looked into
> cpl_string and didn't found a simple way to do it (I could use
> CSLTokenizeString() and get the first field on the list, but this seems overly
> convoluted for a simple trim)
> Also, is there any guidelines on which libraries to use on C++ in replace of
> their std equivalents?
Alex,
I would likely do something like:
CPLString osMD = poDS->GetMetadataItem('...');
while( osMD.size() > 0 && osMD[osMD.size()-1] == " " )
osMD.resize(osMD.size()-1));
You can use STL and sstream though we don't normally do file io through
iostreams since we go through the VSI*L "posix-like" API which allows
io virtualization.
Note that CPLString is just an improved (or as some would say polluted)
std::string.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list