diff options
author | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-07-11 23:57:59 +0000 |
---|---|---|
committer | kitty <kitty@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-07-11 23:57:59 +0000 |
commit | 478226039842cc5f1541c548efa287e344057c3c (patch) | |
tree | 49e9a602855227ffd868feb1f592a3c8b8711be8 /ACEXML/common/StreamFactory.cpp | |
parent | d84c481f55354bc3525dfa9e7c13b4be70e19dc2 (diff) | |
download | ATCD-478226039842cc5f1541c548efa287e344057c3c.tar.gz |
ChangeLogTag: Thu Jul 11 18:37:35 2002 Krishnakumar B <kitty@cs.wustl.edu>
Diffstat (limited to 'ACEXML/common/StreamFactory.cpp')
-rw-r--r-- | ACEXML/common/StreamFactory.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ACEXML/common/StreamFactory.cpp b/ACEXML/common/StreamFactory.cpp new file mode 100644 index 00000000000..600772e1861 --- /dev/null +++ b/ACEXML/common/StreamFactory.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#include "ACEXML/common/StreamFactory.h" +#include "ACEXML/common/FileCharStream.h" +#include "ACEXML/common/HttpCharStream.h" + +ACE_RCSID (common, StreamFactory, "$Id$") + +ACEXML_CharStream* +ACEXML_StreamFactory::create_stream (const ACEXML_Char* uri) +{ + if (uri == 0) + return 0; + + ACEXML_FileCharStream* fstream = 0; + ACEXML_HttpCharStream* hstream = 0; + + if (ACE_OS::strstr (uri, "ftp://") != 0) + { + return 0; + } + else if (ACE_OS::strstr (uri, "http://") != 0) + { + ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0); + if (hstream->open (uri) != -1) + return hstream; + else + return 0; + } + else + { + ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0); + if (fstream->open (uri) != -1) + return fstream; + else + return 0; + } +} |