Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACEXML_StreamFactory Class Reference

A generic factory used to create an appropriate
See also:
ACEXML_CharStream from a SYSTEM id. This class creates a , ACEXML_FileCharStream or a , ACEXML_HttpCharStream depending on the URI supplied.
More...

#include "ACEXML/common/ACEXML_StreamFactory.h"

List of all members.

Public Methods

virtual ~ACEXML_StreamFactory (void)
virtual ACEXML_CharStreamcreate_stream (const ACEXML_Char *uri)


Detailed Description

A generic factory used to create an appropriate
See also:
ACEXML_CharStream from a SYSTEM id. This class creates a , ACEXML_FileCharStream or a , ACEXML_HttpCharStream depending on the URI supplied.

Todo:
Write a stream abstraction for handling ftp:// type URIs and add a function to create and return such streams. That is the only chunk missing in the armour.

Definition at line 38 of file StreamFactory.h.


Constructor & Destructor Documentation

ACEXML_StreamFactory::~ACEXML_StreamFactory void    [virtual]
 

Definition at line 40 of file StreamFactory.cpp.

00041 {
00042   // No op
00043 }


Member Function Documentation

ACEXML_CharStream * ACEXML_StreamFactory::create_stream const ACEXML_Char   uri [virtual]
 

Create the appropriate stream from the uri passed and return the stream. The caller is responsible for deallocating the returned stream.

Parameters:
uri  SYSTEM id or a stream of characters (in the case of a StrCharStream).

Definition at line 10 of file StreamFactory.cpp.

References ACE_NEW_RETURN, ACE_TEXT, ACEXML_Char, ACEXML_FileCharStream::open, ACEXML_HttpCharStream::open, and ACE_OS_String::strstr.

00011 {
00012   if (uri == 0)
00013     return 0;
00014 
00015   ACEXML_FileCharStream* fstream = 0;
00016   ACEXML_HttpCharStream* hstream = 0;
00017 
00018   if (ACE_OS::strstr (uri, ACE_TEXT("ftp://")) != 0)
00019     {
00020       return 0;
00021     }
00022   else if (ACE_OS::strstr (uri, ACE_TEXT ("http://")) != 0)
00023     {
00024       ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0);
00025       if (hstream->open (uri) != -1)
00026         return hstream;
00027       else
00028         return 0;
00029     }
00030   else
00031     {
00032       ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0);
00033       if (fstream->open (uri) != -1)
00034         return fstream;
00035       else
00036         return 0;
00037     }
00038 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 13:27:30 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002