crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Wrapper::URI Class Reference

RAII wrapper for the RFC 3986 URI structure used by uriparser. More...

#include <URI.hpp>

Construction and Destruction

 URI ()=default
 Default constructor. More...
 
virtual ~URI ()
 Destructor freeing the URI if necessary. More...
 

Getters

UriUriA * get () noexcept
 Gets a pointer to the underlying URI structure. More...
 
const UriUriA * getc () const noexcept
 Gets a const pointer to the underlying URI structure. More...
 
bool valid () const noexcept
 Checks whether the URI is valid. More...
 

Creation and Cleanup

void create ()
 Creates a new and empty URI. More...
 
void clear ()
 Frees the current URI. More...
 

Copy and Move

The class is not copyable, only moveable.

 URI (URI &)=delete
 Deleted copy constructor. More...
 
URIoperator= (URI &)=delete
 Deleted copy assignment operator. More...
 
 URI (URI &&other)=default
 Default move constructor. More...
 
URIoperator= (URI &&other)=default
 Default move assignment operator. More...
 

Detailed Description

RAII wrapper for the RFC 3986 URI structure used by uriparser.

Creates a uriparser structure on request and automatically frees it on destruction, avoiding memory leaks.

At the moment, this class is used exclusively by Parsing::URI.

For more information about the uriparser API, see its GitHub repository.

Constructor & Destructor Documentation

◆ URI() [1/3]

crawlservpp::Wrapper::URI::URI ( )
default

Default constructor.

◆ ~URI()

crawlservpp::Wrapper::URI::~URI ( )
inlinevirtual

Destructor freeing the URI if necessary.

Has no effect if no URI has been created.

References clear().

◆ URI() [2/3]

crawlservpp::Wrapper::URI::URI ( URI )
delete

Deleted copy constructor.

◆ URI() [3/3]

crawlservpp::Wrapper::URI::URI ( URI &&  other)
default

Default move constructor.

Member Function Documentation

◆ clear()

void crawlservpp::Wrapper::URI::clear ( )
inline

Frees the current URI.

Frees and resets the underlying URI structure.

Has no effect if no URI has been created.

Referenced by create(), crawlservpp::Parsing::URI::parseLink(), and ~URI().

◆ create()

void crawlservpp::Wrapper::URI::create ( )
inline

Creates a new and empty URI.

Frees the underlying URI structure beforehand, if necessary.

References clear().

Referenced by crawlservpp::Parsing::URI::makeAbsolute(), crawlservpp::Parsing::URI::parseLink(), and crawlservpp::Parsing::URI::setCurrentOrigin().

◆ get()

UriUriA * crawlservpp::Wrapper::URI::get ( )
inlinenoexcept

Gets a pointer to the underlying URI structure.

Returns
Pointer to the underlying URI structure.

Referenced by crawlservpp::Parsing::URI::makeAbsolute(), crawlservpp::Parsing::URI::parseLink(), and crawlservpp::Parsing::URI::setCurrentOrigin().

◆ getc()

const UriUriA * crawlservpp::Wrapper::URI::getc ( ) const
inlinenoexcept

Gets a const pointer to the underlying URI structure.

Returns
Pointer to the underlying URI structure.

Referenced by crawlservpp::Parsing::URI::getSubUri(), crawlservpp::Parsing::URI::isSameDomain(), crawlservpp::Parsing::URI::makeAbsolute(), and crawlservpp::Parsing::URI::parseLink().

◆ operator=() [1/2]

URI& crawlservpp::Wrapper::URI::operator= ( URI )
delete

Deleted copy assignment operator.

◆ operator=() [2/2]

URI& crawlservpp::Wrapper::URI::operator= ( URI &&  other)
default

Default move assignment operator.

◆ valid()

bool crawlservpp::Wrapper::URI::valid ( ) const
inlinenoexcept

Checks whether the URI is valid.

Returns
True, if the underlying URI structure is valid. False otherwise.

Referenced by crawlservpp::Parsing::URI::getSubUri(), crawlservpp::Parsing::URI::isSameDomain(), and crawlservpp::Parsing::URI::makeAbsolute().


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