#include "acl/forward.h"
#include "base/RefCount.h"
+#include "sbuf/forward.h"
#include "format/Format.h"
#include "mem/forward.h"
#include "SquidString.h"
+#include <iosfwd>
#include <string>
#include <vector>
bool match(HttpRequest *request, HttpReply *reply, const AccessLogEntryPointer &al, SBuf &matched);
const SBuf &key() const { return theKey; }
void updateNotePairs(NotePairsPointer pairs, const CharacterSet *delimiters, const AccessLogEntryPointer &al);
- /// Dump the single Note to the given StoreEntry object.
- void dump(StoreEntry *entry, const char *key);
- /// For the key and all its Values compile a string of
- /// "Key: Value" pairs separated by sep string.
- SBuf toString(const char *sep) const;
+
+ /// Prints key and value(s) using a "note" directive format (including directive name).
+ void printAsNoteDirective(StoreEntry *, const char *directiveName) const;
+
+ /// Prints using "annotate_transaction acl parameter" format, one key=value
+ /// or key+=value parameter per stored value.
+ void printAsAnnotationAclParameters(std::ostream &) const;
private:
SBuf theKey; ///< The note key
/// Parses an annotate line with "key=value" or "key+=value" formats.
void parseKvPair();
- /// Dump the notes list to the given StoreEntry object.
- void dump(StoreEntry *entry, const char *name);
+ /// Prints notes using "note" squid.conf directive format, one directive per stored note.
+ void printAsNoteDirectives(StoreEntry *, const char *directiveName) const;
+
/// clean the notes list
void clean() { notes.clear(); }
iterator end() { return notes.end(); }
/// \returns true if the notes list is empty
bool empty() const { return notes.empty(); }
- /// Convert Notes list to a string consist of "Key: Value"
- /// entries separated by sep string.
- const char *toString(const char *sep = "\r\n") const;
+
+ /// print notes using "annotate_transaction acl parameters" format, one
+ /// key=value parameter per note
+ void printAsAnnotationAclParameters(std::ostream &) const;
+
void updateNotePairs(NotePairsPointer pairs, const CharacterSet *delimiters,
const AccessLogEntryPointer &al);
private:
/// \returns true if the key/value pair is already stored
bool hasPair(const SBuf &key, const SBuf &value) const;
- /// Convert NotePairs list to a string consist of "Key: Value"
- /// entries separated by sep string.
- const char *toString(const char *sep = "\r\n") const;
+ /// Reports all entries (if any), printing exactly four items for each:
+ /// entry name, nameValueSeparator, entry value, and entry terminator.
+ void print(std::ostream &os, const char *nameValueSeparator, const char *entryTerminator) const;
/// \returns true if there are not entries in the list
bool empty() const {return entries.empty();}