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

StreamFactory.cpp

Go to the documentation of this file.
00001 // $Id: StreamFactory.cpp,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00002 
00003 #include "ACEXML/common/StreamFactory.h"
00004 #include "ACEXML/common/FileCharStream.h"
00005 #include "ACEXML/common/HttpCharStream.h"
00006 
00007 ACE_RCSID (common, StreamFactory, "$Id: StreamFactory.cpp,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $")
00008 
00009 ACEXML_CharStream*
00010 ACEXML_StreamFactory::create_stream (const ACEXML_Char* uri)
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 }
00039 
00040 ACEXML_StreamFactory::~ACEXML_StreamFactory ()
00041 {
00042   // No op
00043 }

Generated on Mon Jun 16 13:23:26 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002