... where C++ Argument-Dependent Lookup (ADL) can find them.
These specific printing operators did not encounter build problems yet,
but they were misplaced. See commit XXX for rationale and details.
Also removed unimplemented Mgr::ActionParams printing operator.
Also removed excessive "Namespace::" prefixes inside Namespace in
several printing operators declarations that were already properly
placed in their argument's namespaces (e.g., Ipc::ReadWriteLock).
No functionality changes expected.
/* IpcIo::Command */
std::ostream &
-operator <<(std::ostream &os, const IpcIo::Command command)
+IpcIo::operator <<(std::ostream &os, const Command command)
{
switch (command) {
- case IpcIo::cmdNone:
+ case cmdNone:
return os << '-';
- case IpcIo::cmdOpen:
+ case cmdOpen:
return os << 'o';
- case IpcIo::cmdRead:
+ case cmdRead:
return os << 'r';
- case IpcIo::cmdWrite:
+ case cmdWrite:
return os << 'w';
}
// unreachable code
/// what kind of I/O the disker needs to do or have done
typedef enum { cmdNone, cmdOpen, cmdRead, cmdWrite } Command;
+std::ostream &operator <<(std::ostream &, Command);
+
} // namespace IpcIo
-std::ostream &operator <<(std::ostream &, IpcIo::Command);
/// converts DiskIO requests to IPC queue messages
class IpcIoMsg
bool implicit = false;
};
-} // namespace Acl
-
inline std::ostream &
-operator <<(std::ostream &o, const Acl::Answer a)
+operator <<(std::ostream &o, const Answer a)
{
switch (a) {
case ACCESS_DENIED:
return o;
}
+} // namespace Acl
+
/// \ingroup ACLAPI
class acl_proxy_auth_match_cache
{
}
std::ostream &
-operator <<(std::ostream &os, const Acl::Option &option)
+Acl::operator <<(std::ostream &os, const Option &option)
{
option.print(os);
return os;
}
std::ostream &
-operator <<(std::ostream &os, const Acl::Options &options)
+Acl::operator <<(std::ostream &os, const Options &options)
{
for (const auto option: options)
os << *option;
/// A disabled (+i) and default states are "case sensitive".
const BooleanOption &CaseSensitivityOption();
-} // namespace Acl
+std::ostream &operator <<(std::ostream &, const Option &);
+std::ostream &operator <<(std::ostream &, const Options &);
-std::ostream &operator <<(std::ostream &os, const Acl::Option &option);
-std::ostream &operator <<(std::ostream &os, const Acl::Options &options);
+} // namespace Acl
#endif /* SQUID_ACL_OPTIONS_H */
};
inline std::ostream &
-operator << (std::ostream &os, const AnyP::ProtocolVersion &v)
+operator << (std::ostream &os, const ProtocolVersion &v)
{
return (os << AnyP::ProtocolType_str[v.protocol] << '/' << v.major << '.' << v.minor);
}
mutable SBuf absolute_; ///< RFC 7230 section 5.3.2 absolute-URI
};
-} // namespace AnyP
-
inline std::ostream &
-operator <<(std::ostream &os, const AnyP::Uri &url)
+operator <<(std::ostream &os, const Uri &url)
{
// none means explicit empty string for scheme.
- if (url.getScheme() != AnyP::PROTO_NONE)
+ if (url.getScheme() != PROTO_NONE)
os << url.getScheme().image();
os << ":";
// no authority section on URN
- if (url.getScheme() != AnyP::PROTO_URN)
+ if (url.getScheme() != PROTO_URN)
os << "//" << url.authority();
// path is what it is - including absent
return os;
}
+} // namespace AnyP
+
/* Deprecated functions for Legacy code handling URLs */
class HttpRequest;
SBuf image_;
};
-} // namespace AnyP
-
inline std::ostream &
-operator << (std::ostream &os, AnyP::UriScheme const &scheme)
+operator <<(std::ostream &os, const UriScheme &scheme)
{
os << scheme.image();
return os;
}
+} // namespace AnyP
+
#endif /* SQUID_ANYP_URISCHEME_H */
Comm::ConnectionPointer conn;
};
-std::ostream &operator <<(std::ostream &, const Http::TunnelerAnswer &);
+std::ostream &operator <<(std::ostream &, const TunnelerAnswer &);
} // namespace Http
}
std::ostream &
-operator << (std::ostream &os, const Comm::Connection &conn)
+Comm::operator << (std::ostream &os, const Connection &conn)
{
os << conn.id;
if (!conn.local.isNoAddr() || conn.local.port())
Security::NegotiationHistory *tlsHistory;
};
-}; // namespace Comm
-
-std::ostream &operator << (std::ostream &os, const Comm::Connection &conn);
+std::ostream &operator <<(std::ostream &, const Connection &);
inline std::ostream &
-operator << (std::ostream &os, const Comm::ConnectionPointer &conn)
+operator <<(std::ostream &os, const ConnectionPointer &conn)
{
if (conn != nullptr)
os << *conn;
return os;
}
+} // namespace Comm
+
#endif
int wait; ///< msecs spent waiting for the lookup (if any) or -1 (if none)
};
-} // namespace Dns
-
inline std::ostream &
-operator <<(std::ostream &os, const Dns::LookupDetails &dns)
+operator <<(std::ostream &os, const LookupDetails &dns)
{
return dns.print(os);
}
+} // namespace Dns
+
#endif /* SQUID_DNS_LOOKUPDETAILS_H */
}
std::ostream &
-operator <<(std::ostream &os, const Helper::Reply &r)
+Helper::operator <<(std::ostream &os, const Reply &r)
{
os << "{result=";
switch (r.result) {
- case Helper::Okay:
+ case Okay:
os << "OK";
break;
- case Helper::Error:
+ case Error:
os << "ERR";
break;
- case Helper::BrokenHelper:
+ case BrokenHelper:
os << "BH";
break;
- case Helper::TT:
+ case TT:
os << "TT";
break;
- case Helper::TimedOut:
+ case TimedOut:
os << "Timeout";
break;
- case Helper::Unknown:
+ case Unknown:
os << "Unknown";
break;
}
MemBuf other_;
};
+std::ostream &operator <<(std::ostream &, const Reply &);
+
} // namespace Helper
-std::ostream &operator <<(std::ostream &os, const Helper::Reply &r);
#endif /* _SQUID_SRC_HELPER_REPLY_H */
uint64_t id = 0; ///< uniquely identifies this reservation
};
-}; // namespace Helper
-
inline std::ostream &
-operator <<(std::ostream &os, const Helper::ReservationId &id)
+operator <<(std::ostream &os, const ReservationId &id)
{
return id.print(os);
}
+}; // namespace Helper
+
namespace std {
/// default hash functor to support std::unordered_map<HelperReservationId, *>
template <>
}; /* namespace Http */
std::ostream&
-operator<< (std::ostream &s, Http::HdrType id)
+Http::operator<< (std::ostream &s, const HdrType id)
{
- if (Http::any_HdrType_enum_value(id))
- s << Http::HeaderLookupTable.lookup(id).name << '[' << static_cast<int>(id) << ']';
+ if (any_HdrType_enum_value(id))
+ s << HeaderLookupTable.lookup(id).name << '[' << static_cast<int>(id) << ']';
else
s << "Invalid-Header[" << static_cast<int>(id) << ']';
return s;
return (id >= Http::HdrType::ACCEPT && id < Http::HdrType::OTHER);
}
+std::ostream &operator <<(std::ostream &, HdrType);
+
}; /* namespace Http */
-/* ostream output for Http::HdrType */
-std::ostream &
-operator<< (std::ostream&, Http::HdrType);
#endif /* SQUID_HTTP_REGISTEREDHEADERS_H */
}
std::ostream &
-operator <<(std::ostream &os, const Ip::NfMarkConfig c)
+Ip::operator <<(std::ostream &os, const NfMarkConfig c)
{
os << asHex(c.mark);
nfmark_t mask = 0xffffffff;
};
+std::ostream &operator <<(std::ostream &, NfMarkConfig);
+
} // namespace Ip
-std::ostream &operator <<(std::ostream &os, const Ip::NfMarkConfig connmark);
#endif // SQUID_NFMARKCONFIG_H
};
/// dumps approximate lock state (for debugging)
-std::ostream &operator <<(std::ostream &os, const Ipc::ReadWriteLock &);
+std::ostream &operator <<(std::ostream &, const ReadWriteLock &);
/// approximate stats of a set of ReadWriteLocks
class ReadWriteLockStats
/// initiate an (often) asynchronous DNS lookup; the `receiver` gets the results
void nbgethostbyname(const char *name, const CbcPointer<IpReceiver> &receiver);
+inline std::ostream &
+operator <<(std::ostream &os, const CachedIps &ips)
+{
+ ips.reportCurrent(os);
+ return os;
+}
+
} // namespace Dns
typedef Dns::CachedIps ipcache_addrs; ///< deprecated alias
void ipcache_restart(void);
int ipcacheAddEntryFromHosts(const char *name, const char *ipaddr);
-inline std::ostream &
-operator <<(std::ostream &os, const Dns::CachedIps &ips)
-{
- ips.reportCurrent(os);
- return os;
-}
-
/* inlined implementations */
inline Dns::IpsSelector<Dns::GoodIpsIterator>
} // namespace Mgr
-std::ostream &operator <<(std::ostream &os, const Mgr::ActionParams ¶ms);
-
#endif /* SQUID_MGR_ACTION_PARAMS_H */
ActionCreatorPointer creator; ///< creates Action objects with this profile
};
-} // namespace Mgr
-
inline std::ostream &
-operator <<(std::ostream &os, const Mgr::ActionProfile &profile)
+operator <<(std::ostream &os, const ActionProfile &profile)
{
return os << profile.name;
}
+} // namespace Mgr
+
#endif /* SQUID_MGR_ACTION_PROFILE_H */
#include "mgr/Command.h"
std::ostream &
-operator <<(std::ostream &os, const Mgr::Command &cmd)
+Mgr::operator <<(std::ostream &os, const Command &cmd)
{
if (cmd.profile != nullptr)
return os << *cmd.profile;
ActionParams params; ///< user-supplied action arguments
};
-} // namespace Mgr
+std::ostream &operator <<(std::ostream &, const Command &);
-std::ostream &operator <<(std::ostream &os, const Mgr::Command &cmd);
+} // namespace Mgr
#endif /* SQUID_MGR_COMMAND_H */
bool tunneled;
};
-std::ostream &operator <<(std::ostream &, const Security::EncryptorAnswer &);
+std::ostream &operator <<(std::ostream &, const EncryptorAnswer &);
} // namespace Security
/// \param prefixRawCode whether to prefix raw codes with "SSL_ERR="
const char *ErrorNameFromCode(ErrorCode err, bool prefixRawCode = false);
-} // namespace Security
-
/// Dump the given Security::ErrorDetail via a possibly nil pointer (for
/// debugging). Unfortunately, without this, compilers pick generic RefCount<T>
/// operator "<<" overload (with T=Security::ErrorDetail) instead of the
/// overload provided by the parent ErrorDetail class (that we call here).
inline std::ostream &
-operator <<(std::ostream &os, const Security::ErrorDetail::Pointer &p)
+operator <<(std::ostream &os, const ErrorDetail::Pointer &p)
{
return operator <<(os, ::ErrorDetail::Pointer(p));
}
+} // namespace Security
+
#endif
Ciphers ciphers;
};
-inline
-std::ostream &operator <<(std::ostream &os, Security::TlsDetails const &details)
+inline std::ostream &
+operator <<(std::ostream &os, const TlsDetails &details)
{
return details.print(os);
}
void Comm::WriteCancel(const Comm::ConnectionPointer &, const char *) STUB
/*PF*/ void Comm::HandleWrite(int, void*) STUB
-std::ostream &operator << (std::ostream &os, const Comm::Connection &) STUB_RETVAL(os << "[Connection object]")
+std::ostream &Comm::operator <<(std::ostream &os, const Connection &) STUB_RETVAL(os << "[Connection object]")
const HeaderTableRecord& HeaderLookupTable_t::lookup(const char *, const std::size_t) const STUB_RETVAL(BadHdr)
const HeaderLookupTable_t HeaderLookupTable;
}
-std::ostream &operator<< (std::ostream&os, Http::HdrType) STUB_RETVAL(os)
+std::ostream &Http::operator <<(std::ostream &os, HdrType) STUB_RETVAL(os)
#include "http/RequestMethod.h"
HttpRequestMethod::HttpRequestMethod(const SBuf &) {STUB}
// NP: used by Action.h instantiations
#include "mgr/Command.h"
-std::ostream &operator <<(std::ostream &os, const Mgr::Command &) STUB_RETVAL(os)
+std::ostream &Mgr::operator <<(std::ostream &os, const Command &) STUB_RETVAL(os)
#include "mgr/Action.h"
Mgr::Action::Action(const CommandPointer &) STUB
Mgr::ActionParams::ActionParams() STUB_NOP
Mgr::ActionParams::ActionParams(const Ipc::TypedMsgHdr &) STUB_NOP
void Mgr::ActionParams::pack(Ipc::TypedMsgHdr &) const STUB
-std::ostream &operator <<(std::ostream &os, const Mgr::ActionParams &) STUB_RETVAL(os)
#include "mgr/ActionWriter.h"
//Mgr::ActionWriter::ActionWriter(const Action::Pointer &, int) STUB