SFML community forums

General => Feature requests => Topic started by: ferdekk on March 24, 2008, 09:32:58 am

Title: sf::Stream, or similar.
Post by: ferdekk on March 24, 2008, 09:32:58 am
Hello...

Would be cool, if sfml will have be functions/classes for Streams, with possible to register new my own stream, all working by URI (example uri: 'ftp://blabla').

would be possible something like this: (pseudo-code) ;).

Code: [Select]

sfStream *http = CreateStreamFromURI("http://mypage.com/mytestfile.zip");
sfStream *ftp =
CreateStreamFromURI("ftp://mypage.com/mytestfile.zip");
sfStream *zip =
CreateStreamFromURI("zip://C:/example.zip#infile.bmp");

zip->Seek(10,...);               // offset change
http->Seek(100,...);            // offset change if HTTP/1.0 by Range:
bytes=100- etc.
ftp->Seek(100,...);             // offset change....

int howmuch = ftp->Read(100,mybuffer);      //

ftp->SetAsync(true);               // non-blocking reading/writing



and register new my own streams like:

Code: [Select]

class MyOwnStream : public IStreamCreator {
     public:
          MyOwnStream();
          virtual ~MyOwnStream();
     public:
          char*          GetURIPrefix();                   // get "ftp://" or something.
          sf::Stream *CreateStream();               // create interface (use by CreateStreamForURI);....
};

RegisterCustomStream("myzip://",mMyOwnStreamPointer);



BlitzMax have similar streams.
etc, etc.... i hope someone understand me :).
sorry, for bad english.
Title: sf::Stream, or similar.
Post by: Laurent on March 24, 2008, 10:24:18 am
Such feature would be cool... but in another library ;)

SFML is a multimedia API, not a file system library. I can't just put in it everything that people would find useful.