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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .idea/FindFace.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

207 changes: 207 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
cmake_minimum_required(VERSION 3.14)
project(FindFace)



set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Sources)
set(GTESTS ${CMAKE_CURRENT_SOURCE_DIR}/Sources/Google_tests)


include_directories(${CMAKE_MODULE_PATH})
include_directories(${CMAKE_MODULE_PATH}/Views)
include_directories(${CMAKE_MODULE_PATH}/PageData)
include_directories(${CMAKE_MODULE_PATH}/Page)
include_directories(${CMAKE_MODULE_PATH}/PageGenerator)
include_directories(${CMAKE_MODULE_PATH}/PageManager)

set(ALL_SOURCES
${CMAKE_MODULE_PATH}/Views/SecondaryView/SecondaryView.cpp
${CMAKE_MODULE_PATH}/Views/UserData/UserData.cpp
${CMAKE_MODULE_PATH}/Views/Container/ContainerView.cpp
${CMAKE_MODULE_PATH}/Views/Cell/CellView.cpp
${CMAKE_MODULE_PATH}/Views/Row/RowView.cpp
${CMAKE_MODULE_PATH}/Views/ImageView/ImageView.cpp
${CMAKE_MODULE_PATH}/Views/TableView/TableView.cpp
${CMAKE_MODULE_PATH}/Views/TextView/TextView.cpp
${CMAKE_MODULE_PATH}/Views/View/View.cpp
${CMAKE_MODULE_PATH}/Views/PersonView/PersonView.cpp

${CMAKE_MODULE_PATH}/Views/Form/FormView.cpp

${CMAKE_MODULE_PATH}/Page/Page.cpp
${CMAKE_MODULE_PATH}/PageGenerator/PageGenerator.cpp
${CMAKE_MODULE_PATH}/PageManager/PageManager.cpp
${CMAKE_MODULE_PATH}/PageData/PageData.cpp

)


set(ALL_VIEWS_HEADERS

${CMAKE_MODULE_PATH}/Views/UserData/
${CMAKE_MODULE_PATH}/Views/Container/
${CMAKE_MODULE_PATH}/Views/Cell/
${CMAKE_MODULE_PATH}/Views/Row/
${CMAKE_MODULE_PATH}/Views/ImageView/
${CMAKE_MODULE_PATH}/Views/TableView/
${CMAKE_MODULE_PATH}/Views/TextView/
${CMAKE_MODULE_PATH}/Views/View/
${CMAKE_MODULE_PATH}/Views/PersonView/
${CMAKE_MODULE_PATH}/Views/SecondaryView/

${CMAKE_MODULE_PATH}/Views/Form/

${CMAKE_MODULE_PATH}/Page/
${CMAKE_MODULE_PATH}/PageGenerator/
${CMAKE_MODULE_PATH}/PageManager/
${CMAKE_MODULE_PATH}/PageData/
)
include_directories(${ALL_SOURCES})
include_directories(${ALL_HEADERS})



find_package(Boost)

include_directories(${Boost_INCLUDE_DIRS})

add_executable(FindFace ${CMAKE_MODULE_PATH}/main.cpp ${ALL_SOURCES} )

target_link_libraries(FindFace ${Boost_LIBRARIES})


add_subdirectory(Sources/Google_tests)

Binary file added Sources/.DS_Store
Binary file not shown.
41 changes: 41 additions & 0 deletions Sources/APIJsonSeializator/Serializator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Created by Сергей Петренко on 2019-12-21.
//

#include "Serializator.h"
#include "UserData/UserData.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using boost::property_tree::ptree;
using boost::property_tree::read_json;
using boost::property_tree::write_json;

std::string Serializator::userToJson(UserData *userData) {
ptree pt;
pt.put ("slug", userData->slug);
pt.put ("fname", userData->firstName);
pt.put ("sname", userData->secondName);
pt.put ("age", userData->age);
pt.put ("url", userData->imageUrl);
std::ostringstream buf;
write_json (buf, pt, false);
std::string json = buf.str();
return json;

}

std::string Serializator::usersToJson(std::vector<UserData *> userData) {
ptree mainPt;
for(auto& user: userData){
ptree chlildPt;
chlildPt.put ("fname", user->firstName);
chlildPt.put ("sname", user->secondName);
chlildPt.put ("age", user->age);
chlildPt.put ("url", user->imageUrl);
mainPt.add_child(user->slug, chlildPt);
}
std::ostringstream buf;
write_json (buf, mainPt, false);
std::string json = buf.str(); // {"foo":"bar"}
return json;
}
18 changes: 18 additions & 0 deletions Sources/APIJsonSeializator/Serializator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by Сергей Петренко on 2019-12-21.
//

#ifndef CPPROJECT_SERIALIZATOR_H
#define CPPROJECT_SERIALIZATOR_H


#include "Views/UserData/UserData.h"

class Serializator {
public:
std::string userToJson(UserData *userData);
std::string usersToJson(std::vector<UserData*> userData);
};


#endif //CPPROJECT_SERIALIZATOR_H
Binary file added Sources/Google_tests/.DS_Store
Binary file not shown.
16 changes: 16 additions & 0 deletions Sources/Google_tests/CMakeFiles/CMakeDirectoryInformation.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.14

# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/sergei/Documents/CPProject — копия 4")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/sergei/Documents/CPProject — копия 4")

# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)


# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
Loading