Q:

What is the best way to test if a CPLString is not empty?

If I define a CPLString this way:
CPLString osString;

And I want to check if osString is not empty, what would be the best way?
My bet:
if (osString.c_str() == NULL)

But I find it a little rusty... Is there any other better way?

A:

gdal CPLString is a convenient class for std::string
class CPL_DLL CPLString : public gdal_std_string
{
...
};

and gdal_std_string is a typedef for std::string or MSVC string class
00213 # define gdal_std_string string
00214 #else
00215 # define gdal_std_string std::string
00216 #endif 

Source:GDAL API docs
so basically CPLString can be checked for emptiness using std::string::empty()
in your case:
osString.empty() returns True if its empty.

