UriScheme.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_ANYP_URISCHEME_H
10#define SQUID_ANYP_URISCHEME_H
11
12#include "anyp/ProtocolType.h"
13#include "sbuf/SBuf.h"
14
15#include <iosfwd>
16#include <vector>
17
18namespace AnyP
19{
20
25{
26public:
27 typedef std::vector<SBuf> LowercaseSchemeNames;
28
31 UriScheme(AnyP::ProtocolType const aScheme, const char *img = nullptr);
35
38 image_ = o.image_;
39 return *this;
40 }
42
43 operator AnyP::ProtocolType() const { return theScheme_; }
44 // XXX: does not account for comparison of unknown schemes (by image)
45 bool operator != (AnyP::ProtocolType const & aProtocol) const { return theScheme_ != aProtocol; }
46
50 SBuf image() const {return image_;}
51
52 unsigned short defaultPort() const;
53
55 static void Init();
56
59
60private:
64
67
70};
71
72} // namespace AnyP
73
74inline std::ostream &
75operator << (std::ostream &os, AnyP::UriScheme const &scheme)
76{
77 os << scheme.image();
78 return os;
79}
80
81#endif /* SQUID_ANYP_URISCHEME_H */
82
std::ostream & operator<<(std::ostream &os, AnyP::UriScheme const &scheme)
Definition: UriScheme.h:75
std::vector< SBuf > LowercaseSchemeNames
Definition: UriScheme.h:27
unsigned short defaultPort() const
Definition: UriScheme.cc:71
UriScheme(const AnyP::UriScheme &o)
Definition: UriScheme.h:32
AnyP::ProtocolType theScheme_
This is a typecode pointer into the enum/registry of protocols handled.
Definition: UriScheme.h:66
AnyP::UriScheme & operator=(AnyP::UriScheme &&)=default
static void Init()
initializes down-cased protocol scheme names array
Definition: UriScheme.cc:38
static AnyP::ProtocolType FindProtocolType(const SBuf &)
Definition: UriScheme.cc:52
SBuf image_
the string representation
Definition: UriScheme.h:69
AnyP::UriScheme & operator=(const AnyP::UriScheme &o)
Definition: UriScheme.h:36
UriScheme(AnyP::UriScheme &&)=default
SBuf image() const
Definition: UriScheme.h:50
static LowercaseSchemeNames LowercaseSchemeNames_
Definition: UriScheme.h:63
bool operator!=(AnyP::ProtocolType const &aProtocol) const
Definition: UriScheme.h:45
Definition: SBuf.h:94
Definition: forward.h:15
ProtocolType
Definition: ProtocolType.h:23
@ PROTO_NONE
Definition: ProtocolType.h:24

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors