#include <Notes.h>

Inheritance diagram for NotePairs:
Collaboration diagram for NotePairs:

Classes

class  Entry
 Used to store a note key/value pair. More...
 

Public Types

typedef RefCount< NotePairsPointer
 
typedef std::vector< Entry::PointerEntries
 The key/value pair entries. More...
 
typedef std::vector< SBufNames
 

Public Member Functions

 NotePairs ()
 
NotePairsoperator= (NotePairs const &)=delete
 
 NotePairs (NotePairs const &)=delete
 
void append (const NotePairs *src)
 Append the entries of the src NotePairs list to our list. More...
 
void replaceOrAddOrAppend (const NotePairs *src, const Names &appendables)
 
void replaceOrAdd (const NotePairs *src)
 
void appendNewOnly (const NotePairs *src)
 
bool find (SBuf &resultNote, const char *noteKey, const char *sep=",") const
 
const char * findFirst (const char *noteKey) const
 
void add (const SBuf &key, const SBuf &value)
 
void add (const char *key, const char *value)
 
void remove (const char *key)
 
void remove (const SBuf &key)
 
void addStrList (const SBuf &key, const SBuf &values, const CharacterSet &delimiters)
 
bool hasPair (const SBuf &key, const SBuf &value) const
 
const char * toString (const char *sep="\r\n") const
 
bool empty () const
 
void clear ()
 
const EntriesexpandListEntries (const CharacterSet *delimiters) const
 

Private Attributes

Entries entries
 The key/value pair entries. More...
 

Detailed Description

Used to store list of notes

Definition at line 172 of file Notes.h.

Member Typedef Documentation

◆ Entries

Definition at line 198 of file Notes.h.

◆ Names

Definition at line 199 of file Notes.h.

◆ Pointer

Definition at line 175 of file Notes.h.

Constructor & Destructor Documentation

◆ NotePairs() [1/2]

NotePairs::NotePairs ( )
inline

Definition at line 201 of file Notes.h.

◆ NotePairs() [2/2]

NotePairs::NotePairs ( NotePairs const &  )
delete

Member Function Documentation

◆ add() [1/2]

void NotePairs::add ( const char *  key,
const char *  value 
)

Definition at line 306 of file Notes.cc.

References entries.

◆ add() [2/2]

void NotePairs::add ( const SBuf key,
const SBuf value 
)

Adds a note key and value to the notes list. If the key name already exists in the list, add the given value to its set of values.

Definition at line 312 of file Notes.cc.

References entries.

Referenced by ClientHttpRequest::logRequest(), Adaptation::Icap::ModXact::makeRequestHeaders(), redirectHandleReply(), redirectStart(), Adaptation::Ecap::XactionRep::start(), storeIdStart(), Ssl::Helper::Submit(), Note::updateNotePairs(), and UpdateRequestNotes().

◆ addStrList()

void NotePairs::addStrList ( const SBuf key,
const SBuf values,
const CharacterSet delimiters 
)

Adds a note key and values strList to the notes list. If the key name already exists in the list, add the new values to its set of values.

Definition at line 359 of file Notes.cc.

References AppendTokens(), and entries.

Referenced by Note::updateNotePairs().

◆ append()

void NotePairs::append ( const NotePairs src)

◆ appendNewOnly()

void NotePairs::appendNewOnly ( const NotePairs src)

Append any new entries of the src NotePairs list to our list. Entries which already exist in the destination set are ignored.

Definition at line 381 of file Notes.cc.

References entries, and hasPair().

Referenced by ClientHttpRequest::initRequest().

◆ clear()

void NotePairs::clear ( )
inline

Definition at line 255 of file Notes.h.

References entries.

Referenced by ExternalACLEntry::update().

◆ empty()

bool NotePairs::empty ( ) const
inline
Returns
true if there are not entries in the list

Definition at line 253 of file Notes.h.

References entries.

Referenced by Format::Format::assemble(), ConnStateData::hasNotes(), HttpRequest::hasNotes(), Helper::operator<<(), and Note::updateNotePairs().

◆ expandListEntries()

const NotePairs::Entries & NotePairs::expandListEntries ( const CharacterSet delimiters) const

If delimiters are provided, returns another Entries, converting each single multi-token pair to multiple single-token pairs; returns existing entries otherwise.

Definition at line 346 of file Notes.cc.

References AppendTokens(), and entries.

Referenced by Acl::NoteCheck::matchNotes().

◆ find()

bool NotePairs::find ( SBuf resultNote,
const char *  noteKey,
const char *  sep = "," 
) const
Parameters
resultNotea comma separated list of notes with key 'noteKey'.
Returns
true if there are entries with the given 'noteKey'. Use findFirst() instead when a unique kv-pair is needed.

Definition at line 272 of file Notes.cc.

References SBuf::append(), SBuf::clear(), entries, SBuf::isEmpty(), and SBuf::length().

Referenced by Format::Format::assemble(), and Auth::UserRequest::denyMessageFromHelper().

◆ findFirst()

const char * NotePairs::findFirst ( const char *  noteKey) const
Returns
the first note value for this key or an empty string.

Definition at line 297 of file Notes.cc.

References entries.

Referenced by ClientRequestContext::clientRedirectDone(), ClientRequestContext::clientStoreIdDone(), externalAclHandleReply(), and UpdateRequestNotes().

◆ hasPair()

bool NotePairs::hasPair ( const SBuf key,
const SBuf value 
) const
Returns
true if the key/value pair is already stored

Definition at line 365 of file Notes.cc.

References entries.

Referenced by appendNewOnly(), Adaptation::Icap::ModXact::makeRequestHeaders(), and Adaptation::Ecap::XactionRep::start().

◆ operator=()

NotePairs & NotePairs::operator= ( NotePairs const &  )
delete

◆ remove() [1/2]

void NotePairs::remove ( const char *  key)

Remove all notes with a given key. If keyLen is not provided, the key is assumed null-terminated.

Definition at line 318 of file Notes.cc.

References entries.

Referenced by replaceOrAdd(), replaceOrAddOrAppend(), Note::updateNotePairs(), and UpdateRequestNotes().

◆ remove() [2/2]

void NotePairs::remove ( const SBuf key)

Definition at line 326 of file Notes.cc.

References entries.

◆ replaceOrAdd()

void NotePairs::replaceOrAdd ( const NotePairs src)

Replace existing list entries with the src NotePairs entries. Entries which do not exist in the destination set are added.

Definition at line 400 of file Notes.cc.

References append(), entries, and remove().

Referenced by UpdateRequestNotes().

◆ replaceOrAddOrAppend()

void NotePairs::replaceOrAddOrAppend ( const NotePairs src,
const Names appendables 
)

Replace existing list entries with the src NotePairs entries. Do not replace but append entries named in the appendables Entries which do not exist in the destination set are added.

Definition at line 390 of file Notes.cc.

References append(), entries, and remove().

◆ toString()

const char * NotePairs::toString ( const char *  sep = "\r\n") const

Convert NotePairs list to a string consist of "Key: Value" entries separated by sep string.

Definition at line 286 of file Notes.cc.

References SBuf::appendf(), SBuf::c_str(), SBuf::clear(), entries, and SBuf::isEmpty().

Referenced by Format::Format::assemble(), and Helper::operator<<().

Member Data Documentation

◆ entries


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors