Skip to content
This repository has been archived by the owner. It is now read-only.
The C++ library to work with URL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake CMake stuff: refactoring May 23, 2019
lib/dmitigr Refactoring: dmitigr::internal -> dmitigr::common May 13, 2019
tests
.editorconfig
.gitattributes
.gitignore Initial commit Feb 11, 2019
CMakeLists.txt
LICENSE.txt Initial commit Feb 11, 2019
README.md

README.md

THIS PROJECT IS A PART OF CEFEIKA PROJECT NOW!!!

The C++ library to work with URL {#mainpage}

The implementation is aimed to be as simple as possible (maybe even "dumb") for better understanding and correctness.

ATTENTION, this software is "alpha" quality, use at your own risk!

Any feedback (especially results of testing) is highly appreciated!

Features

Straightforward and efficient parsing of URL query strings.

Example

std::string query_string(); // defined somewhere

void example()
{
  namespace url = dmitigr::url;
  auto qs = url::Query_string::make(query_string());
  std::cout << "Parameters count = " << qs->parameter_count() << "\n";
  // etc.
}

Download

The Dmitigr Url repository is located at Github here.

Installation and consuming

Dependencies

Build time settings

Settings that may be specified at build time by using CMake variables are:

  1. the type of the build (only meaningful to single-configuration generators);
  2. the flag to build the shared library (default is on);
  3. the flag to only install the header-only library (default is off);
  4. the flag to build the tests (default is on);
  5. installation directories.

Details:

CMake variable Possible values Default on Unix Default on Windows
The type of the build
CMAKE_BUILD_TYPE Debug | Release | RelWithDebInfo | MinSizeRel Debug Debug
The flag to build the shared library
BUILD_SHARED_LIBS On | Off On On
The flag to only install the header-only library
DMITIGR_URL_HEADER_ONLY On | Off Off Off
The flag of building the tests
DMITIGR_URL_BUILD_TESTS On | Off On On
Installation directories
CMAKE_INSTALL_PREFIX an absolute path "/usr/local" "%ProgramFiles%\dmitigr_url"
DMITIGR_URL_CMAKE_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "share/dmitigr_url/cmake" "cmake"
DMITIGR_URL_DOC_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "share/dmitigr_url/doc" "doc"
DMITIGR_URL_LIB_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "lib" "lib"
DMITIGR_URL_INCLUDE_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "include" "include"

Installation in common

Dmitigr Url is depends on dmitigr_common.

WARNING It's highly recommended to update the dmitigr_common library (just pull and reinstall) before every build of the Dmitigr Url library!

Installation on Linux

$ git clone https://github.com/dmitigr/url.git
$ mkdir -p url/build
$ cd url/build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ sudo make install

Installation on Microsoft Windows

Run the Developer Command Prompt for Visual Studio and type:

> git clone https://github.com/dmitigr/url.git
> mkdir url\build
> cd url\build
> cmake -G "Visual Studio 15 2017 Win64" ..
> cmake --build . --config Debug

Next, run the Elevated Command Prompt (i.e. the command prompt with administrator privileges) and type:

> cd url\build
> cmake -DBUILD_TYPE=Debug -P cmake_install.cmake

To make the installed DLL available for any application that depends on it, the symbolic link to the dmitigr_url.dll (or to the debug version - dmitigr_urld.dll) should be created:

  • in %SYSTEMROOT%\System32 for the 64-bit DLL on 64-bit host (or for 32-bit DLL on 32-bit host);
  • in %SYSTEMROOT%\SysWOW64 for the 32-bit DLL on 64-bit host.

To create the symbolic link run the Elevated Command Prompt and use mklink command, for example:

> cd /d %SYSTEMROOT%\System32
> mklink dmitigr_urld.dll "%ProgramFiles%\dmitigr_url\lib\dmitigr_urld.dll"

Consuming

If you are using CMake the consuming of the Dmitigr Url library is quite simple. For example:

cmake_minimum_required(VERSION 3.13)
project(foo)
find_package(dmitigr_url REQUIRED) # find shared version of the Dmitigr Url library
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
add_executable(foo foo.cpp)
target_link_libraries(foo dmitigr_url)

The above code snippet is minimal CMakeLists.txt that enough to build the application foo that depends on the Dmitigr Url library.

To consume the header-only version of the Dmitigr Url library just specify it by using CONFIGS option of find_package:

find_package(dmitigr_url REQUIRED CONFIGS dmitigr_url_interface-config.cmake)
# ...
target_link_libraries(foo dmitigr_url_interface)

License

Dmitigr Url is distributed under zlib license. For conditions of distribution and use, see file LICENSE.txt.

Donations

Dmitigr Url has been developed on the own funds. Donations are welcome! To make a donation, please go here.

Feedback

Any feedback are welcome. Contact us.

Copyright

Copyright (C) Dmitry Igrishin

You can’t perform that action at this time.