#include <IoManip.h>
![Collaboration graph](classRawPointerT__coll__graph.png)
Public Member Functions | |
RawPointerT (const char *aLabel, const Pointer &aPtr) | |
RawPointerT< Pointer > & | asExtra () |
Report the pointed-to-object on a dedicated Debug::Extra line. More... | |
RawPointerT< Pointer > & | orNil (const char *nilTextToUse="[nil]") |
enable and, optionally, customize reporting of nil pointers More... | |
Public Attributes | |
const char * | label |
const char * | nilText = nullptr |
the name or description of the being-debugged object More... | |
const Pointer & | ptr |
bool | onExtraLine = false |
a possibly nil pointer to the being-debugged object More... | |
Detailed Description
template<class Pointer>
class RawPointerT< Pointer >
manipulator tuning methods
Our convenience manipulator/wrapper classes often have methods that tune their "printing" effects (e.g., AsHex::minDigits()). STL streams also have manipulators that tune how subsequent operator "<<" parameters are printed (e.g., std::setw()). The calling code can also print various decorations (i.e. prefixes and suffixes). The following principles are useful when deciding what manipulator methods to add and how to implement them:
- Add a manipulator method if callers would otherwise have to restore stream format after calling the manipulator. For example, AsHex::toUpper() frees callers from doing
std::uppercase << asHex(n) << std::nouppercase
.
- Add a manipulator method if callers would otherwise have to use conditionals to get the same effect. For example, AsList::prefixedBy() frees callers from doing
(c.empty() ? "" : "/") << asList(c)
.
- Add a manipulator method if callers would otherwise have to repeat a combination of actions to get the right effect. For example, AsList::minDigits() prevents duplication of the following caller code: ‘std::setfill('0’) << std::setw(8) << asHex(n)`.
- Avoid adding a manipulator method that can be fully replaced with a single caller item. For example, do not add AsX::foo() if callers can do
bar << asX(y)
orasX(y) << bar
and get exactly the same effect.
- Manipulators should honor existing stream formatting to the extent possible (e.g., AsHex honors std::uppercase by default). Safely prints an object pointed to by the given pointer: [label]<object> Prints nothing at all if the pointer is nil.
Constructor & Destructor Documentation
◆ RawPointerT()
|
inline |
Member Function Documentation
◆ asExtra()
|
inline |
Definition at line 56 of file IoManip.h.
References RawPointerT< Pointer >::onExtraLine.
◆ orNil()
|
inline |
Definition at line 59 of file IoManip.h.
References RawPointerT< Pointer >::nilText.
Member Data Documentation
◆ label
const char* RawPointerT< Pointer >::label |
Definition at line 61 of file IoManip.h.
Referenced by operator<<().
◆ nilText
const char* RawPointerT< Pointer >::nilText = nullptr |
whether and how to report a nil pointer; use orNil() to enable
Definition at line 64 of file IoManip.h.
Referenced by operator<<(), and RawPointerT< Pointer >::orNil().
◆ onExtraLine
bool RawPointerT< Pointer >::onExtraLine = false |
Definition at line 67 of file IoManip.h.
Referenced by RawPointerT< Pointer >::asExtra(), and operator<<().
◆ ptr
const Pointer& RawPointerT< Pointer >::ptr |
Definition at line 66 of file IoManip.h.
Referenced by operator<<().
The documentation for this class was generated from the following file:
- src/base/IoManip.h
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products