UriScheme.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
18 namespace AnyP
19 {
20 
24 class UriScheme
25 {
26 public:
27  typedef std::vector<SBuf> LowercaseSchemeNames;
28 
31  UriScheme(AnyP::ProtocolType const aScheme, const char *img = nullptr);
33  UriScheme(AnyP::UriScheme &&) = default;
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 
57 private:
61 
64 
67 };
68 
69 } // namespace AnyP
70 
71 inline std::ostream &
72 operator << (std::ostream &os, AnyP::UriScheme const &scheme)
73 {
74  os << scheme.image();
75  return os;
76 }
77 
78 #endif /* SQUID_ANYP_URISCHEME_H */
79 
UriScheme(const AnyP::UriScheme &o)
Definition: UriScheme.h:32
std::ostream & operator<<(std::ostream &os, AnyP::UriScheme const &scheme)
Definition: UriScheme.h:72
Definition: SBuf.h:87
SBuf image() const
Definition: UriScheme.h:50
SBuf image_
the string representation
Definition: UriScheme.h:66
unsigned short defaultPort() const
Definition: UriScheme.cc:52
std::vector< SBuf > LowercaseSchemeNames
Definition: UriScheme.h:27
bool operator!=(AnyP::ProtocolType const &aProtocol) const
Definition: UriScheme.h:45
ProtocolType
Definition: ProtocolType.h:22
AnyP::ProtocolType theScheme_
This is a typecode pointer into the enum/registry of protocols handled.
Definition: UriScheme.h:63
AnyP::UriScheme & operator=(const AnyP::UriScheme &o)
Definition: UriScheme.h:36
static void Init()
initializes down-cased protocol scheme names array
Definition: UriScheme.cc:38
static LowercaseSchemeNames LowercaseSchemeNames_
Definition: UriScheme.h:60

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors