Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
os: linux
dist: xenial
sudo: required
language: cpp
dist: focal
sudo: required
compiler: clang

addons:
Expand All @@ -12,13 +11,23 @@ addons:
before_install:
- sudo apt-get update -qq

install:
- sudo apt-get install doxygen graphviz -y

script:
- bash scripts/deploy.sh

before_deploy:
- sed -i "s/__VERSION__/$TRAVIS_BUILD_NUMBER/g" bintray-spec.json

deploy:
- provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep-history: true
local-dir: docs/html
on:
all_branches: true
- provider: script
skip_cleanup: true
provider: bintray
Expand Down
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# build options
option(ENABLE_TESTING "Build small (unit) tests" ON)
# generate docs
option(ENABLE_DOXYGEN "Build documentation" OFF)

# ================ Project ========================
# Project name and a few useful settings
project(struct
project(print_ip
VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER}
DESCRIPTION "OTUS c++ homeworks: ip_filter"
LANGUAGES CXX
Expand All @@ -39,4 +41,8 @@ endif()
add_subdirectory(library)

# main apps are here
add_subdirectory(apps)
add_subdirectory(apps)

if (ENABLE_DOXYGEN)
include(doxygen/doxygen)
endif()
2 changes: 1 addition & 1 deletion apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_subdirectory()
add_subdirectory(PrintIp)
4 changes: 4 additions & 0 deletions apps/PrintIp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_and_install_project_app(print_ip
DEPEND
lib_PrintIp
)
29 changes: 29 additions & 0 deletions apps/PrintIp/src/main_PrintIp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* \brief Main application
*/

#include <iostream>
#include <string>
#include <PrintIp/PrintIp.h>

using namespace std::string_literals;

int main() {
// from arithmetic values
std::cout << PrintIp::print_ip(static_cast<char>(-1)) << std::endl; // expect 255
std::cout << PrintIp::print_ip(static_cast<short>(0)) << std::endl; // expect 0.0
std::cout << PrintIp::print_ip(static_cast<int>(2130706433)) << std::endl;
std::cout << PrintIp::print_ip(static_cast<long>(8875824491850138409)) << std::endl;

// from string
std::cout << PrintIp::print_ip(std::string("12.67.89.12")) << std::endl;
std::cout << PrintIp::print_ip("12.67.89.12"s) << std::endl;
// from vector
std::cout << PrintIp::print_ip(std::vector<int>{1,2,3,4,5,6,7}) << std::endl;

// from list
std::cout << PrintIp::print_ip(std::list<int>{9,8,7,6,5,4,3,2,1}) << std::endl;

// from tuple
std::cout << PrintIp::print_ip(std::tuple{9,8,7,6,5,4}) << std::endl;
}
Loading