Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Stream, or similar.  (Read 22232 times)

0 Members and 2 Guests are viewing this topic.

ferdekk

  • Newbie
  • *
  • Posts: 6
    • View Profile
sf::Stream, or similar.
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Stream, or similar.
« Reply #1 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.
Laurent Gomila - SFML developer