This operation is very useful for printing sub-sections of string buffers
of any kind.
#if HAVE_CSTRING
#include <cstring>
#endif
+#include <ostream>
/** A char* plus length combination. Useful for temporary storing
* and quickly looking up strings.
return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ;
}
+ void print(std::ostream &os) const { os.write(theStart, theLen); }
+
private:
/// pointed to the externally-managed memory area
const char *theStart;
size_t theLen;
};
+inline std::ostream &
+operator <<(std::ostream &os, const StringArea &a)
+{
+ a.print(os);
+ return os;
+}
+
#endif /* SQUID_STRINGAREA_H */