#include <ACEXML/common/ACEXML_StreamFactory.h>
Public Member Functions | |
| virtual | ~ACEXML_StreamFactory (void) |
| virtual ACEXML_CharStream * | create_stream (const ACEXML_Char *uri) |
ACEXML_HttpCharStream depending on the URI supplied.
Definition at line 38 of file StreamFactory.h.
|
|
Definition at line 53 of file StreamFactory.cpp.
00054 {
00055 // No op
00056 }
|
|
|
Create the appropriate stream from the uri passed and return the stream. The caller is responsible for deallocating the returned stream.
Definition at line 16 of file StreamFactory.cpp. References ACE_NEW_RETURN, ACE_TEXT, ACEXML_Char, ACEXML_FileCharStream::open(), ACEXML_HttpCharStream::open(), and ACE_OS::strstr(). Referenced by ACEXML_InputSource::ACEXML_InputSource(), ACEXML_Parser::parse_entity_reference(), ACEXML_Parser::parse_external_dtd(), and ACEXML_Parser::parse_PE_reference().
00017 {
00018 if (uri == 0)
00019 return 0;
00020 ACEXML_FileCharStream* fstream = 0;
00021 ACEXML_HttpCharStream* hstream = 0;
00022
00023 if (ACE_OS::strstr (uri, ACE_TEXT("ftp://")) != 0)
00024 {
00025 return 0;
00026 }
00027 else if (ACE_OS::strstr (uri, ACE_TEXT ("http://")) != 0)
00028 {
00029 ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0);
00030 if (hstream->open (uri) != -1)
00031 return hstream;
00032 }
00033 else
00034 {
00035 if (ACE_OS::strstr (uri, ACE_TEXT ("file://")) != 0)
00036 uri += 7; // Skip over file://
00037 ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0);
00038 if (fstream->open (uri) != -1)
00039 return fstream;
00040 #ifdef USE_ZZIP
00041 else
00042 {
00043 ACEXML_ZipCharStream* zstream = 0;
00044 ACE_NEW_RETURN (zstream, ACEXML_ZipCharStream, 0);
00045 if (zstream->open (uri) != -1)
00046 return zstream;
00047 }
00048 #endif /* USE_ZZIP */
00049 }
00050 return 0;
00051 }
|
1.3.6