Qt 4.8
Public Functions | List of all members
QNetworkAuthenticationCache Class Reference
Inheritance diagram for QNetworkAuthenticationCache:
QVector< QNetworkAuthenticationCredential > QNetworkAccessCache::CacheableObject

Public Functions

virtual void dispose ()
 
QNetworkAuthenticationCredentialfindClosestMatch (const QString &domain)
 
void insert (const QString &domain, const QString &user, const QString &password)
 
 QNetworkAuthenticationCache ()
 
- Public Functions inherited from QNetworkAccessCache::CacheableObject
 CacheableObject ()
 
QByteArray cacheKey () const
 
virtual ~CacheableObject ()
 

Additional Inherited Members

- Protected Functions inherited from QNetworkAccessCache::CacheableObject
void setExpires (bool enable)
 
void setShareable (bool enable)
 
- Private Types inherited from QVector< QNetworkAuthenticationCredential >
typedef const QNetworkAuthenticationCredentialconst_iterator
 The QVector::const_iterator typedef provides an STL-style const iterator for QVector and QStack. More...
 
typedef const value_typeconst_pointer
 Typedef for const T *. More...
 
typedef const value_typeconst_reference
 Typedef for T &. More...
 
typedef const_iterator ConstIterator
 Qt-style synonym for QVector::const_iterator. More...
 
typedef qptrdiff difference_type
 Typedef for ptrdiff_t. More...
 
typedef QNetworkAuthenticationCredentialiterator
 The QVector::iterator typedef provides an STL-style non-const iterator for QVector and QStack. More...
 
typedef iterator Iterator
 Qt-style synonym for QVector::iterator. More...
 
typedef value_typepointer
 Typedef for T *. More...
 
typedef value_typereference
 Typedef for T &. More...
 
typedef int size_type
 Typedef for int. More...
 
typedef QNetworkAuthenticationCredential value_type
 Typedef for T. More...
 
- Private Functions inherited from QVector< QNetworkAuthenticationCredential >
void append (const QNetworkAuthenticationCredential &t)
 Inserts value at the end of the vector. More...
 
const QNetworkAuthenticationCredentialat (int i) const
 Returns the item at index position i in the vector. More...
 
reference back ()
 This function is provided for STL compatibility. More...
 
const_reference back () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
iterator begin ()
 Returns an STL-style iterator pointing to the first item in the vector. More...
 
const_iterator begin () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int capacity () const
 Returns the maximum number of items that can be stored in the vector without forcing a reallocation. More...
 
void clear ()
 Removes all the elements from the vector and releases the memory used by the vector. More...
 
const_iterator constBegin () const
 Returns a const STL-style iterator pointing to the first item in the vector. More...
 
const QNetworkAuthenticationCredentialconstData () const
 Returns a const pointer to the data stored in the vector. More...
 
const_iterator constEnd () const
 Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector. More...
 
bool contains (const QNetworkAuthenticationCredential &t) const
 Returns true if the vector contains an occurrence of value; otherwise returns false. More...
 
int count (const QNetworkAuthenticationCredential &t) const
 Returns the number of occurrences of value in the vector. More...
 
int count () const
 Same as size(). More...
 
QNetworkAuthenticationCredentialdata ()
 Returns a pointer to the data stored in the vector. More...
 
const QNetworkAuthenticationCredentialdata () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void detach ()
 
bool empty () const
 This function is provided for STL compatibility. More...
 
iterator end ()
 Returns an STL-style iterator pointing to the imaginary item after the last item in the vector. More...
 
const_iterator end () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
bool endsWith (const QNetworkAuthenticationCredential &t) const
 Returns true if this vector is not empty and its last item is equal to value; otherwise returns false. More...
 
iterator erase (iterator begin, iterator end)
 Removes all the items from begin up to (but not including) end. More...
 
iterator erase (iterator pos)
 Removes the item pointed to by the iterator pos from the vector, and returns an iterator to the next item in the vector (which may be end()). More...
 
QVector< QNetworkAuthenticationCredential > & fill (const QNetworkAuthenticationCredential &t, int size=-1)
 Assigns value to all items in the vector. More...
 
QNetworkAuthenticationCredentialfirst ()
 Returns a reference to the first item in the vector. More...
 
const QNetworkAuthenticationCredentialfirst () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
QNetworkAuthenticationCredentialfront ()
 This function is provided for STL compatibility. More...
 
const_reference front () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int indexOf (const QNetworkAuthenticationCredential &t, int from=0) const
 Returns the index position of the first occurrence of value in the vector, searching forward from index position from. More...
 
void insert (int i, const QNetworkAuthenticationCredential &t)
 Inserts value at index position i in the vector. More...
 
void insert (int i, int n, const QNetworkAuthenticationCredential &t)
 Inserts count copies of value at index position i in the vector. More...
 
iterator insert (iterator before, int n, const QNetworkAuthenticationCredential &x)
 Inserts count copies of value in front of the item pointed to by the iterator before. More...
 
iterator insert (iterator before, const QNetworkAuthenticationCredential &x)
 Inserts value in front of the item pointed to by the iterator before. More...
 
bool isDetached () const
 
bool isEmpty () const
 Returns true if the vector has size 0; otherwise returns false. More...
 
bool isSharedWith (const QVector< QNetworkAuthenticationCredential > &other) const
 
QNetworkAuthenticationCredentiallast ()
 Returns a reference to the last item in the vector. More...
 
const QNetworkAuthenticationCredentiallast () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int lastIndexOf (const QNetworkAuthenticationCredential &t, int from=-1) const
 Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. More...
 
QVector< QNetworkAuthenticationCredentialmid (int pos, int length=-1) const
 Returns a vector whose elements are copied from this vector, starting at position pos. More...
 
bool operator!= (const QVector< QNetworkAuthenticationCredential > &v) const
 Returns true if other is not equal to this vector; otherwise returns false. More...
 
QVector< QNetworkAuthenticationCredentialoperator+ (const QVector< QNetworkAuthenticationCredential > &l) const
 Returns a vector that contains all the items in this vector followed by all the items in the other vector. More...
 
QVector< QNetworkAuthenticationCredential > & operator+= (const QVector< QNetworkAuthenticationCredential > &l)
 Appends the items of the other vector to this vector and returns a reference to this vector. More...
 
QVector< QNetworkAuthenticationCredential > & operator+= (const QNetworkAuthenticationCredential &t)
 Appends value to the vector. More...
 
QVector< QNetworkAuthenticationCredential > & operator<< (const QVector< QNetworkAuthenticationCredential > &l)
 Appends other to the vector and returns a reference to the vector. More...
 
QVector< QNetworkAuthenticationCredential > & operator<< (const QNetworkAuthenticationCredential &t)
 Appends value to the vector and returns a reference to this vector. More...
 
QVector< QNetworkAuthenticationCredential > & operator= (const QVector< QNetworkAuthenticationCredential > &v)
 Assigns other to this vector and returns a reference to this vector. More...
 
bool operator== (const QVector< QNetworkAuthenticationCredential > &v) const
 Returns true if other is equal to this vector; otherwise returns false. More...
 
QNetworkAuthenticationCredentialoperator[] (int i)
 Returns the item at index position i as a modifiable reference. More...
 
const QNetworkAuthenticationCredentialoperator[] (int i) const
 Same as at(i). More...
 
void pop_back ()
 This function is provided for STL compatibility. More...
 
void pop_front ()
 This function is provided for STL compatibility. More...
 
void prepend (const QNetworkAuthenticationCredential &t)
 Inserts value at the beginning of the vector. More...
 
void push_back (const QNetworkAuthenticationCredential &t)
 This function is provided for STL compatibility. More...
 
void push_front (const QNetworkAuthenticationCredential &t)
 This function is provided for STL compatibility. More...
 
 QVector ()
 Constructs an empty vector. More...
 
 QVector (int size)
 Constructs a vector with an initial size of size elements. More...
 
 QVector (int size, const QNetworkAuthenticationCredential &t)
 Constructs a vector with an initial size of size elements. More...
 
 QVector (const QVector< QNetworkAuthenticationCredential > &v)
 Constructs a copy of other. More...
 
void remove (int i)
 Removes the element at index position i. More...
 
void remove (int i, int n)
 Removes count elements from the middle of the vector, starting at index position i. More...
 
void replace (int i, const QNetworkAuthenticationCredential &t)
 Replaces the item at index position i with value. More...
 
void reserve (int size)
 Attempts to allocate memory for at least size elements. More...
 
void resize (int size)
 Sets the size of the vector to size. More...
 
void setSharable (bool sharable)
 
int size () const
 Returns the number of items in the vector. More...
 
void squeeze ()
 Releases any memory not required to store the items. More...
 
bool startsWith (const QNetworkAuthenticationCredential &t) const
 Returns true if this vector is not empty and its first item is equal to value; otherwise returns false. More...
 
void swap (QVector< QNetworkAuthenticationCredential > &other)
 Swaps vector other with this vector. More...
 
QList< QNetworkAuthenticationCredentialtoList () const
 Returns a QList object with the data contained in this QVector. More...
 
std::vector< QNetworkAuthenticationCredentialtoStdVector () const
 Returns a std::vector object with the data contained in this QVector. More...
 
QNetworkAuthenticationCredential value (int i) const
 Returns the value at index position i in the vector. More...
 
QNetworkAuthenticationCredential value (int i, const QNetworkAuthenticationCredential &defaultValue) const
 If the index i is out of bounds, the function returns defaultValue. More...
 
 ~QVector ()
 Destroys the vector. More...
 
- Static Private Functions inherited from QVector< QNetworkAuthenticationCredential >
static QVector< QNetworkAuthenticationCredentialfromList (const QList< QNetworkAuthenticationCredential > &list)
 Returns a QVector object with the data contained in list. More...
 
static QVector< QNetworkAuthenticationCredentialfromStdVector (const std::vector< QNetworkAuthenticationCredential > &vector)
 Returns a QVector object with the data contained in vector. More...
 
- Properties inherited from QVector< QNetworkAuthenticationCredential >
QVectorDatad
 
Datap
 

Detailed Description

Definition at line 57 of file qnetworkaccessauthenticationmanager.cpp.

Constructors and Destructors

◆ QNetworkAuthenticationCache()

QNetworkAuthenticationCache::QNetworkAuthenticationCache ( )
inline

Definition at line 61 of file qnetworkaccessauthenticationmanager.cpp.

Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), and QNetworkAccessAuthenticationManager::cacheProxyCredentials().

62  {
63  setExpires(false);
64  setShareable(true);
65  reserve(1);
66  }
void reserve(int size)
Attempts to allocate memory for at least size elements.
Definition: qvector.h:339

Functions

◆ dispose()

virtual void QNetworkAuthenticationCache::dispose ( )
inlinevirtual

Implements QNetworkAccessCache::CacheableObject.

Definition at line 98 of file qnetworkaccessauthenticationmanager.cpp.

98 { delete this; }

◆ findClosestMatch()

QNetworkAuthenticationCredential* QNetworkAuthenticationCache::findClosestMatch ( const QString domain)
inline

Definition at line 68 of file qnetworkaccessauthenticationmanager.cpp.

Referenced by QNetworkAccessAuthenticationManager::fetchCachedCredentials(), QNetworkAccessAuthenticationManager::fetchCachedProxyCredentials(), and insert().

69  {
70  iterator it = qLowerBound(begin(), end(), domain);
71  if (it == end() && !isEmpty())
72  --it;
73  if (it == end() || !domain.startsWith(it->domain))
74  return 0;
75  return &*it;
76  }
#define it(className, varName)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
Definition: qvector.h:250
QNetworkAuthenticationCredential * iterator
The QVector::iterator typedef provides an STL-style non-const iterator for QVector and QStack...
Definition: qvector.h:244
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
Definition: qalgorithms.h:227
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
Definition: qvector.h:247
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139

◆ insert()

void QNetworkAuthenticationCache::insert ( const QString domain,
const QString user,
const QString password 
)
inline

Definition at line 78 of file qnetworkaccessauthenticationmanager.cpp.

Referenced by QNetworkAccessAuthenticationManager::cacheCredentials(), and QNetworkAccessAuthenticationManager::cacheProxyCredentials().

79  {
81  if (closestMatch && closestMatch->domain == domain) {
82  // we're overriding the current credentials
83  closestMatch->user = user;
84  closestMatch->password = password;
85  } else {
87  newCredential.domain = domain;
88  newCredential.user = user;
89  newCredential.password = password;
90 
91  if (closestMatch)
92  QVector<QNetworkAuthenticationCredential>::insert(++closestMatch, newCredential);
93  else
95  }
96  }
QNetworkAuthenticationCredential * findClosestMatch(const QString &domain)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
Definition: qvector.h:250
void insert(int i, const T &t)
Inserts value at index position i in the vector.
Definition: qvector.h:362
static int closestMatch(QRgb pixel, const QVector< QRgb > &clut)
Definition: qimage.cpp:4015

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