dca_interface  6.3.4
dca::UrlCustomDb Class Reference

#include <customdb_toolbox.h>

Detailed Description

Encapsulates the Custom Database maintenance interface.

Use the setUrl() function to add or modify an existing URL Classification.

Use the getUrl() function to retrieve the classification for a given URL string.

Use the removeUrl() function to remove an URL and its classification.

Note
You can set up a limit of 5 categories to an URL. The category ids must be in the range {0,...254}. If you specify more categories or use an invalid id, then an exception will be thrown.
You will need to specify exactly the URL you want to classify. There are no splittings done in the setUrl() function itself. URL strings are just normalized and used excactly like you specify them. So its your decision whether or not you want to cut off query strings by your own.
Always specify URLs as UTF-8 or you will get unexpected behavior.
Supported protocols for URL string are currently:
  • http:
  • https:
  • ftp:
All other protocols will not be accepted and return an error.

If you don't specify the protocol then http: is assumed and internally added to the database entry.

Also the default port (related to the protocol) will be added internally if you do not explicitely specify a port. So a setUrl() with

"www.abc.xy" is identical to "http://www.abc.xy:80"

or

"https://www.abc.xy" is identical to "https://www.abc.xy:443".

Definition at line 86 of file customdb_toolbox.h.

Public Member Functions

bool getUrl (const std::string &aUrlString, CategorySet &foundCategories) const
 Retrieves the categories of URL string (if found). More...
 
void setUrl (const std::string &aUrlString, const CategorySet &categories)
 Updates or creates categories for the given URL string. More...
 
void removeUrl (const std::string &aUrlString)
 Removes the given URL string from the database, if present. More...
 

Member Function Documentation

◆ getUrl()

bool dca::UrlCustomDb::getUrl ( const std::string &  aUrlString,
CategorySet foundCategories 
) const

Retrieves the categories of URL string (if found).

Parameters
[in]aUrlStringA URL string in UTF-8 whose associated categories should be retrieved
[out]foundCategoriesThe associated categories for the URL, if found in the database
Returns
true if the URL was found, else false.

◆ setUrl()

void dca::UrlCustomDb::setUrl ( const std::string &  aUrlString,
const CategorySet categories 
)

Updates or creates categories for the given URL string.

Parameters
[in]aUrlStringA URL string in UTF-8 to be associated with the given categories
[in]categoriesThe categories to be associated with the given URL. If there were previously associated categories for the specified URL in the database, these will be simply overwritten. Merging of categories is not supported
Note
See the detailed class description above for the requirements of the input URL and the categories. If you specify an invalid URL or invalid categories an exception will be thrown, that can contain one of the following error codes

◆ removeUrl()

void dca::UrlCustomDb::removeUrl ( const std::string &  aUrlString)

Removes the given URL string from the database, if present.

Parameters
[in]aUrlStringThe URL string in UTF-8 to be removed
Note
If the given URL was not found in the database this function will do nothing.

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