Hi Michael,
A tweak to the below suggest is that I'd place an IO support into
osgDB not core osg. The file IO in classes like osg::Shader should be
deprecated, we now have a plugin that can read shaders so the Shader
method isn't essential anymore, so needing IO in core OSG won't be
required. This will help keep down the namespace polution issue a
little.
Robert.
On Wed, Oct 8, 2008 at 4:26 PM, Michael Platings
<[EMAIL PROTECTED]> wrote:
> Hi Robert,
> Hiding the standard functions and classes with our own fopen and
> fstream/ifstream/ofstream does seem the ideal option.
>
> Hiding fopen in the osg and osgDB namespaces is trivial.
>
> However, hiding fstream/ifstream/ofstream is not so easy as they are in the
> std namespace.
> This works:
>
> //header file osg/fstream
> #include <fstream>
> namespace osg{
> namespace std{
> using namespace ::std;
> class fstream : public ::std::fstream{...};
> }}
>
> //cpp file
> #include <osg/fstream>
> namespace osg{
> void someFunc(){
> std::fstream f;//constructs an osg::std::fstream
> }}
>
> However, most OpenSceneGraph CPP files contain the following line:
> using namespace osg;
> Consequently all subsequent references to the std namespace are ambiguous
> and won't compile.
>
> Personally I think "using namespace osg" is incorrect, and should be
> replaced with "namespace osg{" but that's a separate issue.
>
> In conclusion, yes we should have osg::fopen(). We could have
> osg::fstream, which would look a bit neater, but won't prevent accidental
> use of std::fstream.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> ] On Behalf Of Robert Osfield
> Sent: 07 October 2008 21:14
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Unicode support for Windows
>
> Off the top of my head my first suggestions, perhaps naive, would be to have
> a osgDB::ifstream and osgDB::ofstream implementations that take std::string
> (or alternatively) as parameters for the constructors and open() and hide
> the traditional methods, and have these subclasses do the internal
> conversions required. An osgDB::fopen() could also be written.
>
> Thoughts?
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit
> http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org