Added a wrapString(const char*) which automatically handles null strings.
This commit is contained in:
@@ -49,6 +49,9 @@ class OSGDB_EXPORT Output : public std::ofstream
|
||||
|
||||
Output& indent();
|
||||
|
||||
/** wrap a string with "" quotes and use \" for any internal quotes.*/
|
||||
std::string wrapString(const char* str);
|
||||
|
||||
/** wrap a string with "" quotes and use \" for any internal quotes.*/
|
||||
std::string wrapString(const std::string& str);
|
||||
|
||||
|
||||
@@ -105,6 +105,12 @@ void Output::moveOut()
|
||||
if (_indent<0) _indent=0;
|
||||
}
|
||||
|
||||
std::string Output::wrapString(const char* str)
|
||||
{
|
||||
if (!str) return std::string("\"\"");
|
||||
return wrapString(std::string(str));
|
||||
}
|
||||
|
||||
std::string Output::wrapString(const std::string& str)
|
||||
{
|
||||
std::string newstring;
|
||||
|
||||
Reference in New Issue
Block a user