osgEarth 2.1.1
Public Member Functions | Protected Attributes | Friends

osgEarth::URIStream Class Reference

List of all members.

Public Member Functions

 URIStream (const URI &uri)
virtual ~URIStream ()
 operator std::istream & ()

Protected Attributes

std::istream * _fileStream
std::stringstream _bufStream

Friends

class URI

Detailed Description

Stream container for reading a URI directly from a stream

Definition at line 93 of file URI.


Constructor & Destructor Documentation

URIStream::URIStream ( const URI uri)

Definition at line 57 of file URI.cpp.

                                     :
_fileStream( 0L )
{
    if ( osgDB::containsServerAddress(uri.full()) )
    {
        HTTPResponse res = HTTPClient::get( uri.full() );
        if ( res.isOK() )
        {
            std::string buf = res.getPartAsString(0);
            _bufStream.str(buf);
        }
    }
    else
    {
        _fileStream = new std::ifstream( uri.full().c_str() );
    }
}

Here is the call graph for this function:

URIStream::~URIStream ( ) [virtual]

Definition at line 75 of file URI.cpp.

{
    if ( _fileStream )
        delete _fileStream;
}

Member Function Documentation

URIStream::operator std::istream & ( )

Definition at line 81 of file URI.cpp.

{
    static std::istringstream s_nullStream;

    if ( _fileStream )
        return *_fileStream;
    else
        return _bufStream;
}

Friends And Related Function Documentation

friend class URI [friend]

Definition at line 105 of file URI.


Member Data Documentation

std::stringstream osgEarth::URIStream::_bufStream [protected]

Definition at line 107 of file URI.

std::istream* osgEarth::URIStream::_fileStream [protected]

Definition at line 106 of file URI.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines