Molybden API
Loading...
Searching...
No Matches
molybden::Cookies Class Referenceabstract

A service that allows working with the session and persistent cookies. More...

#include <cookies.hpp>

Public Member Functions

virtual std::shared_ptr< Profileprofile ()=0
 The profile of this cookie store.
 
virtual std::vector< Cookielist ()=0
 Returns a list of all the cookies available in the cookie store.
 
virtual std::vector< Cookielist (const std::string &url)=0
 Returns a list of cookies for the given url.
 
virtual void deleteAll ()=0
 Deletes the given cookie from the cookie store.
 
virtual void deleteCookie (const Cookie &cookie)=0
 Deletes all the cookies from the cookie store and returns the number of deleted cookies.
 
virtual void setCookie (const Cookie &cookie)=0
 Sets the cookie.
 
virtual void persist ()=0
 Persists all the changes performed to the cookie store.
 

Detailed Description

A service that allows working with the session and persistent cookies.

Cookies can be stored in the process memory (session cookies) or on the file system (persistent cookies). The service provides access to both the session and persistent cookies.

The persistent cookies are stored in the user data directory. You can configure the user data directory path via the AppOptions::user_data_dir field.

All the changes to the cookie store are made in memory, so when you restart the application you will not see the changes you made with the persistent cookies if you do not invoke the persist() method before application exit.

Member Function Documentation

◆ deleteAll()

virtual void molybden::Cookies::deleteAll ( )
pure virtual

Deletes the given cookie from the cookie store.

Important: this method makes the cookie changes in memory. To keep these changes for the persistent cookies after application restart you must invoke the Cookies::persist() method before application exit.

◆ deleteCookie()

virtual void molybden::Cookies::deleteCookie ( const Cookie cookie)
pure virtual

Deletes all the cookies from the cookie store and returns the number of deleted cookies.

Important: this method makes the cookie changes in memory. To keep these changes for persistent cookies after application restart you must invoke the Cookies::persist() method before application exit.

◆ list() [1/2]

virtual std::vector< Cookie > molybden::Cookies::list ( )
pure virtual

Returns a list of all the cookies available in the cookie store.

The list includes both the persistent and session cookies.

The returned cookies are ordered by longest path, then by earliest creation time. Can be empty if there are no cookies in the cookie store.

◆ list() [2/2]

virtual std::vector< Cookie > molybden::Cookies::list ( const std::string &  url)
pure virtual

Returns a list of cookies for the given url.

The list includes both the persistent and session cookies.

The returned cookies are ordered by longest path, then by earliest creation time. Can be empty if there are no cookies associated with the given URL in the cookie store.

◆ persist()

virtual void molybden::Cookies::persist ( )
pure virtual

Persists all the changes performed to the cookie store.

By default, all the changes to the cookie store are made in memory, so when you restart the application you will not see the changes you made with persistent cookies if you do not invoke this method before application exit.

This method can be invoked after every change you made to the cookie store.

◆ setCookie()

virtual void molybden::Cookies::setCookie ( const Cookie cookie)
pure virtual

Sets the cookie.

This method expects that each cookie attribute in the given cookie is well-formed. Please note that Chromium may modify some of the cookie attributes (such as domain or expiration time).

Important: this method makes the cookie changes in memory. To keep these changes for the persistent cookies after the application restart invoke the Cookies::persist() method before the application exit.


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