Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / ACEXML / common / StreamFactory.cpp
blob80f722b50ed7de0629388f2e9d5dd98971027887
1 #include "ace/OS_NS_string.h"
3 #include "ACEXML/common/StreamFactory.h"
4 #include "ACEXML/common/FileCharStream.h"
5 #include "ACEXML/common/HttpCharStream.h"
7 #ifdef USE_ZZIP
8 #include "ACEXML/common/ZipCharStream.h"
9 #endif /* USE_ZZIP */
12 ACEXML_CharStream*
13 ACEXML_StreamFactory::create_stream (const ACEXML_Char* uri)
15 if (uri == 0)
16 return 0;
17 ACEXML_FileCharStream* fstream = 0;
18 ACEXML_HttpCharStream* hstream = 0;
20 if (ACE_OS::strstr (uri, ACE_TEXT("ftp://")) != 0)
22 return 0;
24 else if (ACE_OS::strstr (uri, ACE_TEXT ("http://")) != 0)
26 ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0);
27 if (hstream->open (uri) != -1)
28 return hstream;
30 else
32 if (ACE_OS::strstr (uri, ACE_TEXT ("file://")) != 0)
33 uri += 7; // Skip over file://
34 ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0);
35 if (fstream->open (uri) != -1)
36 return fstream;
37 #ifdef USE_ZZIP
38 else
40 ACEXML_ZipCharStream* zstream = 0;
41 ACE_NEW_RETURN (zstream, ACEXML_ZipCharStream, 0);
42 if (zstream->open (uri) != -1)
43 return zstream;
45 #endif /* USE_ZZIP */
47 return 0;
50 ACEXML_StreamFactory::~ACEXML_StreamFactory ()
52 // No op