More SGPath / UTF-8 fixes

Use SGPath in more public APIs, so FlightGear doesn’t have to convert
and guess the conversion itself.
This commit is contained in:
James Turner 2020-03-15 14:26:32 +00:00
parent c3a169319c
commit c8d802bc1d
6 changed files with 13 additions and 11 deletions

View File

@ -71,10 +71,10 @@ static const uint32_t EndianMagic = 0x11223344;
* gzContainerWriter
**************************************************************************/
gzContainerWriter::gzContainerWriter(const std::string& name,
gzContainerWriter::gzContainerWriter(const SGPath& name,
const std::string& fileMagic) :
sg_gzofstream(name, ios_out | ios_binary),
filename(name)
filename(name.utf8Str())
{
/* write byte-order marker **************************************/
write((char*)&EndianMagic, sizeof(EndianMagic));
@ -138,10 +138,10 @@ gzContainerWriter::writeContainer(ContainerType Type, SGPropertyNode* root)
* gzContainerReader
**************************************************************************/
gzContainerReader::gzContainerReader(const std::string& name,
gzContainerReader::gzContainerReader(const SGPath& name,
const std::string& fileMagic) :
sg_gzifstream(SGPath(name), ios_in | ios_binary),
filename(name)
filename(name.utf8Str())
{
bool ok = (good() && !eof());

View File

@ -35,7 +35,7 @@ typedef int ContainerType;
class gzContainerReader : public sg_gzifstream
{
public:
gzContainerReader( const std::string& name,
gzContainerReader( const SGPath& name,
const std::string& fileMagic);
bool readContainerHeader(ContainerType* pType, size_t* pSize);
@ -48,7 +48,7 @@ private:
class gzContainerWriter : public sg_gzofstream
{
public:
gzContainerWriter( const std::string& name,
gzContainerWriter( const SGPath& name,
const std::string& fileMagic);
bool writeContainerHeader(ContainerType Type, size_t Size);

View File

@ -93,7 +93,7 @@ SGMakeState(const SGPath &path, const char* colorTexture,
}
// Constructor
SGCloudLayer::SGCloudLayer( const string &tex_path ) :
SGCloudLayer::SGCloudLayer( const SGPath &tex_path ) :
cloud_root(new osg::Switch),
layer_root(new osg::Switch),
group_top(new osg::Group),

View File

@ -42,6 +42,7 @@
#include <osg/Switch>
class SGCloudField;
class SGPath;
/**
* A class layer to model a single cloud layer
@ -73,7 +74,7 @@ public:
* Constructor
* @param tex_path the path to the set of cloud textures
*/
SGCloudLayer( const std::string &tex_path );
SGCloudLayer( const SGPath &tex_path );
/**
* Destructor

View File

@ -296,8 +296,9 @@ void SGSky::set_3dCloudUseImpostors(bool imp)
SGCloudField::setUseImpostors(imp);
}
void SGSky::texture_path( const std::string& path ) {
tex_path = SGPath( path );
void SGSky::set_texture_path( const SGPath& path )
{
tex_path = path;
}
// modify the current visibility based on cloud layers, thickness,

View File

@ -326,7 +326,7 @@ public:
*
* @param path Base path to texture locations
*/
void texture_path( const std::string& path );
void set_texture_path( const SGPath& path );
/**
* Get the current sun color