~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to ACEXML/common/StreamFactory.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// StreamFactory.cpp,v 1.4 2003/11/07 20:27:29 shuston Exp
2
 
 
3
 
#include "ace/OS_NS_string.h"
4
 
 
5
 
#include "ACEXML/common/StreamFactory.h"
6
 
#include "ACEXML/common/FileCharStream.h"
7
 
#include "ACEXML/common/HttpCharStream.h"
8
 
 
9
 
#ifdef ACEXML_HAS_ZZIPLIB
10
 
#include "ACEXML/common/ZipCharStream.h"
11
 
#endif /* ACEXML_HAS_ZZIPLIB */
12
 
 
13
 
ACE_RCSID (common, StreamFactory, "StreamFactory.cpp,v 1.4 2003/11/07 20:27:29 shuston Exp")
14
 
 
15
 
ACEXML_CharStream*
16
 
ACEXML_StreamFactory::create_stream (const ACEXML_Char* uri)
17
 
{
18
 
  if (uri == 0)
19
 
    return 0;
20
 
  ACEXML_FileCharStream* fstream = 0;
21
 
  ACEXML_HttpCharStream* hstream = 0;
22
 
 
23
 
  if (ACE_OS::strstr (uri, ACE_TEXT("ftp://")) != 0)
24
 
    {
25
 
      return 0;
26
 
    }
27
 
  else if (ACE_OS::strstr (uri, ACE_TEXT ("http://")) != 0)
28
 
    {
29
 
      ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0);
30
 
      if (hstream->open (uri) != -1)
31
 
        return hstream;
32
 
    }
33
 
  else
34
 
    {
35
 
      if (ACE_OS::strstr (uri, ACE_TEXT ("file://")) != 0)
36
 
        uri += 7; // Skip over file://
37
 
      ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0);
38
 
      if (fstream->open (uri) != -1)
39
 
        return fstream;
40
 
#ifdef ACEXML_HAS_ZZIPLIB
41
 
      else
42
 
        {
43
 
          ACEXML_ZipCharStream* zstream = 0;
44
 
          ACE_NEW_RETURN (zstream, ACEXML_ZipCharStream, 0);
45
 
          if (zstream->open (uri) != -1)
46
 
            return zstream;
47
 
        }
48
 
#endif /* ACEXML_HAS_ZZIPLIB */
49
 
    }
50
 
  return 0;
51
 
}
52
 
 
53
 
ACEXML_StreamFactory::~ACEXML_StreamFactory ()
54
 
{
55
 
  // No op
56
 
}