source: icXML/icXML-devel/src/xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 2.4 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: WinSockNetAccessor.cpp 635984 2008-03-11 15:54:37Z borisk $
20 */
21
22
23#define _WINSOCKAPI_
24
25#include <windows.h>
26
27#include <xercesc/util/XMLUniDefs.hpp>
28#include <xercesc/util/XMLUni.hpp>
29#include <xercesc/util/XMLExceptMsgs.hpp>
30#include <xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.hpp>
31#include <xercesc/util/NetAccessors/WinSock/WinSockNetAccessor.hpp>
32
33XERCES_CPP_NAMESPACE_BEGIN
34
35const XMLCh WinSockNetAccessor::fgMyName[] =
36{
37    chLatin_W, chLatin_i, chLatin_n, chLatin_S, chLatin_o, chLatin_c,
38    chLatin_k, chLatin_N, chLatin_e, chLatin_t, chLatin_A, chLatin_c,
39    chLatin_c, chLatin_e, chLatin_s, chLatin_s, chLatin_o, chLatin_r,
40    chNull
41};
42
43WinSockNetAccessor::WinSockNetAccessor()
44{
45}
46
47
48WinSockNetAccessor::~WinSockNetAccessor()
49{
50    // Cleanup code for the WinSock library here.
51    BinHTTPURLInputStream::Cleanup();
52}
53
54
55BinInputStream* WinSockNetAccessor::makeNew(const XMLURL&  urlSource, const XMLNetHTTPInfo* httpInfo /*=0*/)
56{
57    XMLURL::Protocols  protocol = urlSource.getProtocol();
58    switch(protocol)
59    {
60        case XMLURL::HTTP:
61        {
62            BinHTTPURLInputStream* retStrm =
63                new (urlSource.getMemoryManager()) BinHTTPURLInputStream(urlSource, httpInfo);
64            return retStrm;
65            break;
66        }
67
68        //
69        // These are the only protocols we support now. So throw and
70        // unsupported protocol exception for the others.
71        //
72        default :
73            ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_UnsupportedProto, urlSource.getMemoryManager());
74            break;
75    }
76    return 0;
77}
78
79XERCES_CPP_NAMESPACE_END
80
Note: See TracBrowser for help on using the repository browser.