From 1eaeacaffd247216043a6098445074c121e89649 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:54:37 +0300 Subject: [PATCH 001/134] move from local repository --- .gitignore | 4 + CMakeLists.txt | 12 ++ conanfile.txt | 10 + config.sh | 8 + src/main.cpp | 321 ++++++++++++++++++++++++++++++++ text-basic-metrics/code1.txt | 29 +++ text-basic-metrics/code2.txt | 29 +++ text-basic-metrics/tbm_main.cpp | 153 +++++++++++++++ 8 files changed, 566 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 conanfile.txt create mode 100644 config.sh create mode 100644 src/main.cpp create mode 100644 text-basic-metrics/code1.txt create mode 100644 text-basic-metrics/code2.txt create mode 100644 text-basic-metrics/tbm_main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29e77ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/cmake-build-debug/ +/build/ +.idea +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..bdb1810 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.19) +set(CMAKE_PREFIX_PATH build) +project(SourcedOut CXX) +find_package(antlr4-runtime REQUIRED) +find_package(Boost 1.8.1 REQUIRED) +find_package(libpqxx REQUIRED) +find_package(GTest REQUIRED) +message(STATUS ${Boost_LIBRARIES}) +add_executable(${PROJECT_NAME} src/main.cpp) +#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..18ee8ce --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,10 @@ +[requires] +boost/1.81.0 +antlr4-cppruntime/4.12.0 +libpqxx/7.7.5 +gtest/cci.20210126 + + +[generators] +CMakeDeps +CMakeToolchain \ No newline at end of file diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..b05efd5 --- /dev/null +++ b/config.sh @@ -0,0 +1,8 @@ +pip install conan +conan profile detect --force +#------------- +mkdir "build" +cd build/ +#------------ +conan install . --build=missing -s build_type=Debug +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..a222488 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,321 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace beast = boost::beast; // from +namespace http = beast::http; // from +namespace net = boost::asio; // from +using tcp = boost::asio::ip::tcp; // from + +//------------------------------------------------------------------------------ + +// Return a reasonable mime type based on the extension of a file. +beast::string_view +mime_type(beast::string_view path) +{ + using beast::iequals; + auto const ext = [&path] + { + auto const pos = path.rfind("."); + if(pos == beast::string_view::npos) + return beast::string_view{}; + return path.substr(pos); + }(); + if(iequals(ext, ".htm")) return "text/html"; + if(iequals(ext, ".html")) return "text/html"; + if(iequals(ext, ".php")) return "text/html"; + if(iequals(ext, ".css")) return "text/css"; + if(iequals(ext, ".txt")) return "text/plain"; + if(iequals(ext, ".js")) return "application/javascript"; + if(iequals(ext, ".json")) return "application/json"; + if(iequals(ext, ".xml")) return "application/xml"; + if(iequals(ext, ".swf")) return "application/x-shockwave-flash"; + if(iequals(ext, ".flv")) return "video/x-flv"; + if(iequals(ext, ".png")) return "image/png"; + if(iequals(ext, ".jpe")) return "image/jpeg"; + if(iequals(ext, ".jpeg")) return "image/jpeg"; + if(iequals(ext, ".jpg")) return "image/jpeg"; + if(iequals(ext, ".gif")) return "image/gif"; + if(iequals(ext, ".bmp")) return "image/bmp"; + if(iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; + if(iequals(ext, ".tiff")) return "image/tiff"; + if(iequals(ext, ".tif")) return "image/tiff"; + if(iequals(ext, ".svg")) return "image/svg+xml"; + if(iequals(ext, ".svgz")) return "image/svg+xml"; + return "application/text"; +} + +// Append an HTTP rel-path to a local filesystem path. +// The returned path is normalized for the platform. +std::string +path_cat( + beast::string_view base, + beast::string_view path) +{ + if (base.empty()) + return std::string(path); + std::string result(base); +#ifdef BOOST_MSVC + char constexpr path_separator = '\\'; + if(result.back() == path_separator) + result.resize(result.size() - 1); + result.append(path.data(), path.size()); + for(auto& c : result) + if(c == '/') + c = path_separator; +#else + char constexpr path_separator = '/'; + if(result.back() == path_separator) + result.resize(result.size() - 1); + result.append(path.data(), path.size()); +#endif + return result; +} + +// This function produces an HTTP response for the given +// request. The type of the response object depends on the +// contents of the request, so the interface requires the +// caller to pass a generic lambda for receiving the response. +template< + class Body, class Allocator, + class Send> +void +handle_request( + beast::string_view doc_root, + http::request>&& req, + Send&& send) +{ + // Returns a bad request response + auto const bad_request = + [&req](beast::string_view why) + { + http::response res{http::status::bad_request, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; + }; + + // Returns a not found response + auto const not_found = + [&req](beast::string_view target) + { + http::response res{http::status::not_found, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = "The resource '" + std::string(target) + "' was not found."; + res.prepare_payload(); + return res; + }; + + // Returns a server error response + auto const server_error = + [&req](beast::string_view what) + { + http::response res{http::status::internal_server_error, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = "An error occurred: '" + std::string(what) + "'"; + res.prepare_payload(); + return res; + }; + + // Make sure we can handle the method + if( req.method() != http::verb::get && + req.method() != http::verb::head) + return send(bad_request("Unknown HTTP-method")); + + // Request path must be absolute and not contain "..". + if( req.target().empty() || + req.target()[0] != '/' || + req.target().find("..") != beast::string_view::npos) + return send(bad_request("Illegal request-target")); + + // Build the path to the requested file + std::string path = path_cat(doc_root, req.target()); + if(req.target().back() == '/') + path.append("index.html"); + + // Attempt to open the file + beast::error_code ec; + http::file_body::value_type body; + body.open(path.c_str(), beast::file_mode::scan, ec); + + // Handle the case where the file doesn't exist + if(ec == beast::errc::no_such_file_or_directory) + return send(not_found(req.target())); + + // Handle an unknown error + if(ec) + return send(server_error(ec.message())); + + // Cache the size since we need it after the move + auto const size = body.size(); + + // Respond to HEAD request + if(req.method() == http::verb::head) + { + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, mime_type(path)); + res.content_length(size); + res.keep_alive(req.keep_alive()); + return send(std::move(res)); + } + + // Respond to GET request + http::response res{ + std::piecewise_construct, + std::make_tuple(std::move(body)), + std::make_tuple(http::status::ok, req.version())}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, mime_type(path)); + res.content_length(size); + res.keep_alive(req.keep_alive()); + return send(std::move(res)); +} + +//------------------------------------------------------------------------------ + +// Report a failure +void +fail(beast::error_code ec, char const* what) +{ + std::cerr << what << ": " << ec.message() << "\n"; +} + +// This is the C++11 equivalent of a generic lambda. +// The function object is used to send an HTTP message. +template +struct send_lambda +{ + Stream& stream_; + bool& close_; + beast::error_code& ec_; + + explicit + send_lambda( + Stream& stream, + bool& close, + beast::error_code& ec) + : stream_(stream) + , close_(close) + , ec_(ec) + { + } + + template + void + operator()(http::message&& msg) const + { + // Determine if we should close the connection after + close_ = msg.need_eof(); + + // We need the serializer here because the serializer requires + // a non-const file_body, and the message oriented version of + // http::write only works with const messages. + http::serializer sr{msg}; + http::write(stream_, sr, ec_); + } +}; + +// Handles an HTTP server connection +void +do_session( + tcp::socket& socket, + std::shared_ptr const& doc_root) +{ + bool close = false; + beast::error_code ec; + + // This buffer is required to persist across reads + beast::flat_buffer buffer; + + // This lambda is used to send messages + send_lambda lambda{socket, close, ec}; + + for(;;) + { + // Read a request + http::request req; + http::read(socket, buffer, req, ec); + if(ec == http::error::end_of_stream) + break; + if(ec) + return fail(ec, "read"); + + // Send the response + handle_request(*doc_root, std::move(req), lambda); + if(ec) + return fail(ec, "write"); + if(close) + { + // This means we should close the connection, usually because + // the response indicated the "Connection: close" semantic. + break; + } + } + + // Send a TCP shutdown + socket.shutdown(tcp::socket::shutdown_send, ec); + + // At this point the connection is closed gracefully +} + +//------------------------------------------------------------------------------ + +int main(int argc, char* argv[]) +{ + try + { + // Check command line arguments. + if (argc != 4) + { + std::cerr << + "Usage: http-server-sync
\n" << + "Example:\n" << + " http-server-sync 0.0.0.0 8080 .\n"; + return EXIT_FAILURE; + } + auto const address = net::ip::make_address(argv[1]); + auto const port = static_cast(std::atoi(argv[2])); + auto const doc_root = std::make_shared(argv[3]); + + // The io_context is required for all I/O + net::io_context ioc{1}; + + // The acceptor receives incoming connections + tcp::acceptor acceptor{ioc, {address, port}}; + for(;;) + { + // This will receive the new connection + tcp::socket socket{ioc}; + + // Block until we get a connection + acceptor.accept(socket); + + // Launch the session, transferring ownership of the socket + std::thread{std::bind( + &do_session, + std::move(socket), + doc_root)}.detach(); + } + } + catch (const std::exception& e) + { + std::cerr << "Error: " << e.what() << std::endl; + return EXIT_FAILURE; + } +} \ No newline at end of file diff --git a/text-basic-metrics/code1.txt b/text-basic-metrics/code1.txt new file mode 100644 index 0000000..5fa95b8 --- /dev/null +++ b/text-basic-metrics/code1.txt @@ -0,0 +1,29 @@ +// однострочный комментарий +// еще один +// вау еще один + +#include +#include +#include + +using namespace std; + +/* многострочный комм + * // внутри него однострочный + * + */ + + +int main() { + stringstream ss; + string res; + // ещё в код напихаю комментов + ss << "a bwfw ce "; + while(getline(ss, res, ' ')){ //комментарий после строки с кодом + /* + * летс гоу + * худшее место для многострочного коммента + */ + cout << res << endl; /* многострочный однострочно */ + } +} diff --git a/text-basic-metrics/code2.txt b/text-basic-metrics/code2.txt new file mode 100644 index 0000000..2115b76 --- /dev/null +++ b/text-basic-metrics/code2.txt @@ -0,0 +1,29 @@ +// однострочный комментарий +// еще один +// вау еще один + +#include +#include +#include + +using namespace std; + +/* многострочный комм + * // внутри него однострочный + * + */ + + +int main() { + stringstream ss1; + string res1; + // ещё в код напихаю комментов + ss1 << "a bwfw ce "; + while(getline(ss, res1, ' ')){ //комментарий после строки с кодом + /* + * летс гоу + * худшее место для многострочного коммента + */ + cout << res1 << endl; /* многострочный однострочно */ + } +} \ No newline at end of file diff --git a/text-basic-metrics/tbm_main.cpp b/text-basic-metrics/tbm_main.cpp new file mode 100644 index 0000000..fdd4253 --- /dev/null +++ b/text-basic-metrics/tbm_main.cpp @@ -0,0 +1,153 @@ +// +// Created by march on 21.04.2023. +// + +#include +#include +#include +#include +#include +#include +#include + +#include + + +std::string deleteComms(const std::string& text){ + std::string modif; + std::string res; + + std::stringstream ss; + std::string line; + + ss << text; + + while(getline(ss, line)){ + line.pop_back(); + line.push_back('\0'); + modif += line; + } + + bool s_comm = false; + bool m_comm = false; + + for (int i = 0; i < modif.size(); i++){ + if (s_comm && modif[i] == '\0') + s_comm = false; + else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') + m_comm = false, i++; + else if (s_comm || m_comm) + continue; + else if (modif[i] == '/' && modif[i+1] == '/') + s_comm = true, i++; + else if (modif[i] == '/' && modif[i+1] == '*') + m_comm = true, i++; + + else if (modif[i] != '\0') + res += modif[i]; + else{ + res += '\n'; + } + } + return res; +} + +std::vector tbm_tokenizer(const std::string &text){ + boost::char_separator sep(" {}();,\"\0\'"); + std::vector res; + boost::tokenizer < boost::char_separator > tokens(text, sep); + + for (const std::string &s: tokens) { + if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ + res.push_back(s); + } + } + return res; +} + +// % = intersection(A, B) / union(A, B) +double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ + std::set s1; + std::set s2; + + for (auto &i : tokens1) s1.insert(i); + for (auto &i : tokens2) s2.insert(i); + + + std::set intersect_sets; + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(intersect_sets, intersect_sets.begin())); + + std::set union_sets; + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(union_sets, union_sets.begin())); + + std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; + + return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); +} + +double Livenstain_dist(std::vector tokens1, std::vector tokens2){ + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + int x, y, z; + + std::vector > lev (n, std::vector (m, 0)); + + for (int i = 0; i < n; i++){ + for (int j = 0; j < m; j++){ + if (std::min(i, j) == 0){ + lev[i][j] = std::max(i, j); + } + else{ + x = lev[i-1][j]; + y = lev[i][j-1]; + z = lev[i-1][j-1]; + lev[i][j] = std::min(x, std::min(y, z)); + if (tokens1[i] != tokens2[j]){ + lev[i][j]++; + } + } + } + } + + return lev[n-1][m-1]; +} + +std::pair textCompare(std::istream& fin1, std::istream& fin2){ + std::string line; + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); + + std::string non_comm_text1 = deleteComms(text1); + std::string non_comm_text2 = deleteComms(text2); + + std::vector tokens1 = tbm_tokenizer(non_comm_text1); + std::vector tokens2 = tbm_tokenizer(non_comm_text2); + + double res1 = Jaccard_metric(tokens1, tokens2); + double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); + + return {res1, res2}; +} + +int main(){ + + std::ifstream fin1; + fin1.open("text-basic-metrics/code1.txt"); + assert(fin1.is_open()); + + std::ifstream fin2; + fin2.open("text-basic-metrics/code2.txt"); + assert(fin2.is_open()); + + std::pair metrics_res = textCompare(fin1, fin2); + + std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; + fin1.close(); + fin2.close(); +} \ No newline at end of file -- GitLab From 49b133d59f846f0c90a30645567d1cd98f2a9f28 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:18:42 +0300 Subject: [PATCH 002/134] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B5=D0=B9,=20=D0=BD=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B7=D0=B0?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B4=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=20=D0=B1=D0=B4,=20=D0=B8=20=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=83=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 9 +- conanfile.txt | 2 +- include/dataBase/config.json | 6 + include/dataBase/conn.hpp | 33 +++++ include/entity/Solution.hpp | 60 ++++++++ include/entity/Task.hpp | 23 +++ include/entity/User.hpp | 51 +++++++ include/repository/ISolutionRepository.hpp | 26 ++++ include/repository/ITaskRepository.hpp | 21 +++ include/repository/IUserRepository.hpp | 23 +++ include/repository/UserRepository.hpp | 157 +++++++++++++++++++++ 11 files changed, 406 insertions(+), 5 deletions(-) create mode 100644 include/dataBase/config.json create mode 100644 include/dataBase/conn.hpp create mode 100644 include/entity/Solution.hpp create mode 100644 include/entity/Task.hpp create mode 100644 include/entity/User.hpp create mode 100644 include/repository/ISolutionRepository.hpp create mode 100644 include/repository/ITaskRepository.hpp create mode 100644 include/repository/IUserRepository.hpp create mode 100644 include/repository/UserRepository.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index bdb1810..d5cb5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.19) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) @@ -6,7 +6,8 @@ find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) -message(STATUS ${Boost_LIBRARIES}) -add_executable(${PROJECT_NAME} src/main.cpp) +find_package(nlohmann_json REQUIRED) +message(STATUS ${nlohmann_json_LIBRARIES}) +add_executable(${PROJECT_NAME} src/main.cpp include/entity/User.hpp include/repository/UserRepository.hpp include/dataBase/conn.hpp include/repository/IUserRepository.hpp include/entity/Solution.hpp include/entity/Task.hpp include/repository/ISolutionRepository.hpp include/repository/ISolutionRepository.hpp include/repository/ITaskRepository.hpp include/repository/ITaskRepository.hpp) #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} nlohmann_json::nlohmann_json) \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt index 18ee8ce..e4b350b 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -3,7 +3,7 @@ boost/1.81.0 antlr4-cppruntime/4.12.0 libpqxx/7.7.5 gtest/cci.20210126 - +nlohmann_json/3.11.2 [generators] CMakeDeps diff --git a/include/dataBase/config.json b/include/dataBase/config.json new file mode 100644 index 0000000..eee75d5 --- /dev/null +++ b/include/dataBase/config.json @@ -0,0 +1,6 @@ +{"dbname":"mydb", + "user":"postgres", + "password": "root", + "hostaddr": "127.0.0.1", + "port": "5432" +} \ No newline at end of file diff --git a/include/dataBase/conn.hpp b/include/dataBase/conn.hpp new file mode 100644 index 0000000..91dbd55 --- /dev/null +++ b/include/dataBase/conn.hpp @@ -0,0 +1,33 @@ +#ifndef SOURCEDOUT_CONN_HPP +#define SOURCEDOUT_CONN_HPP + +#include +#include +#include + +using json = nlohmann::json; + +struct conn { + std::string dbname; + std::string user; + std::string password; + std::string hostaddr; + std::string port; + + conn() { + std::ifstream f("config.json"); + json data = json::parse(f); + data.at("dbname").get_to(dbname); + data.at("user").get_to(user); + data.at("password").get_to(password); + data.at("hostaddr").get_to(hostaddr); + data.at("port").get_to(port); + } + + [[nodiscard]] std::string getData() const { + return "dbname = " + dbname + " user = " + user + " password = " + password + + " hostaddr = " + hostaddr + " port = " + port; + } +}; + +#endif //SOURCEDOUT_CONN_HPP diff --git a/include/entity/Solution.hpp b/include/entity/Solution.hpp new file mode 100644 index 0000000..8bd04ea --- /dev/null +++ b/include/entity/Solution.hpp @@ -0,0 +1,60 @@ +#ifndef SOURCEDOUT_SOLUTION_HPP +#define SOURCEDOUT_SOLUTION_HPP +#include +#include + +class Solution{ +private: + size_t id; + std::string send_date; + size_t sender_id; + std::string source; + size_t task_id; + std::string result; +public: + [[nodiscard]] size_t getId() const { + return id; + } + + + [[nodiscard]] const std::string &getSendDate() const { + return send_date; + } + + void setSendDate(const std::string &sendDate) { + send_date = sendDate; + } + + [[nodiscard]] size_t getSenderId() const { + return sender_id; + } + + void setSenderId(size_t senderId) { + sender_id = senderId; + } + + [[nodiscard]] const std::string &getSource() const { + return source; + } + + void setSource(const std::string &source_) { + Solution::source = source_; + } + + [[nodiscard]] size_t getTaskId() const { + return task_id; + } + + void setTaskId(size_t taskId) { + task_id = taskId; + } + + [[nodiscard]] const std::string &getResult() const { + return result; + } + + void setResult(const std::string &result_) { + Solution::result = result_; + } +}; +#endif //SOURCEDOUT_SOLUTION_HPP diff --git a/include/entity/Task.hpp b/include/entity/Task.hpp new file mode 100644 index 0000000..b252c26 --- /dev/null +++ b/include/entity/Task.hpp @@ -0,0 +1,23 @@ +#ifndef SOURCEDOUT_TASK_HPP +#define SOURCEDOUT_TASK_HPP +#include +class Task{ +private: + size_t id; + std::string description; +public: + [[nodiscard]] size_t getId() const { + return id; + } + + [[nodiscard]] const std::string &getDescription() const { + return description; + } + + void setDescription(const std::string &description_) { + Task::description = description_; + } + +public: +}; +#endif //SOURCEDOUT_TASK_HPP diff --git a/include/entity/User.hpp b/include/entity/User.hpp new file mode 100644 index 0000000..3c0e24e --- /dev/null +++ b/include/entity/User.hpp @@ -0,0 +1,51 @@ +#ifndef SOURCEDOUT_USER_HPP + +#include +#include + +#define SOURCEDOUT_USER_HPP + +class User { +private: + size_t id; + std::string login; + std::string password; + std::string username; + +public: + User(size_t id_, std::string login_, std::string password_, std::string username_) : + id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { + } + + User(std::string login_, std::string password_, std::string username_) : + id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { + } + + [[nodiscard]] size_t getId() const { + return id; + } + + + [[nodiscard]] const std::string &getLogin() const { + return login; + } + + + [[nodiscard]] const std::string &getPassword() const { + return password; + } + + void setPassword(const std::string &password_) { + User::password = password_; + } + + [[nodiscard]] const std::string &getUsername() const { + return username; + } + + void setUsername(const std::string &username_) { + User::username = username_; + } +}; + +#endif //SOURCEDOUT_USER_HPP diff --git a/include/repository/ISolutionRepository.hpp b/include/repository/ISolutionRepository.hpp new file mode 100644 index 0000000..7099c47 --- /dev/null +++ b/include/repository/ISolutionRepository.hpp @@ -0,0 +1,26 @@ +#ifndef SOURCEDOUT_ISOLUTIONREPOSITORY_HPP +#define SOURCEDOUT_ISOLUTIONREPOSITORY_HPP + +#include +#include +#include "../entity/Solution.hpp" + +class ISolutionRepository { + virtual Solution getSolutionById(size_t id) = 0; + + virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; + + virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; + + virtual void makeSolution(Solution solution) = 0; + + virtual void updateSolution(Solution solution) = 0; + + virtual void deleteSolutionById(size_t id) = 0; + + virtual void deleteSolution(Solution solution) = 0; + + +}; + +#endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/include/repository/ITaskRepository.hpp b/include/repository/ITaskRepository.hpp new file mode 100644 index 0000000..81ef63a --- /dev/null +++ b/include/repository/ITaskRepository.hpp @@ -0,0 +1,21 @@ +#ifndef SOURCEDOUT_ITASKREPOSITORY_HPP +#define SOURCEDOUT_ITASKREPOSITORY_HPP + +#include +#include "../entity/Task.hpp" + +class ITaskRepository { + virtual Task getTaskById(size_t id) = 0; + + virtual Task updateTask(size_t id) = 0; + + virtual Task updateTask(Task task) = 0; + + virtual void makeTask(Task task) = 0; + + virtual void deleteTask(Task task) = 0; + + virtual void deleteTaskById(size_t task_id) = 0; +}; + +#endif //SOURCEDOUT_ITASKREPOSITORY_HPP diff --git a/include/repository/IUserRepository.hpp b/include/repository/IUserRepository.hpp new file mode 100644 index 0000000..0647432 --- /dev/null +++ b/include/repository/IUserRepository.hpp @@ -0,0 +1,23 @@ +#ifndef SOURCEDOUT_IUSERREPOSITORY_HPP +#define SOURCEDOUT_IUSERREPOSITORY_HPP + +#include +#include "../entity/User.hpp" +class IUserRepository { +public: + virtual User getUserById(size_t id) = 0; + + virtual User getUserByLogin(std::string login) = 0; + + virtual size_t makeUser(User user) = 0; + + virtual void deleteUser(User user) = 0; + + virtual void deleteByUserId(size_t user_id) = 0; + + virtual std::vector getAllUsers() = 0; + + virtual void getUsersByTaskId(size_t id) = 0; +}; + +#endif //SOURCEDOUT_IUSERREPOSITORY_HPP diff --git a/include/repository/UserRepository.hpp b/include/repository/UserRepository.hpp new file mode 100644 index 0000000..64bda8f --- /dev/null +++ b/include/repository/UserRepository.hpp @@ -0,0 +1,157 @@ +#ifndef SOURCEDOUT_USERREPOSITORY_HPP +#define SOURCEDOUT_USERREPOSITORY_HPP + +#include +#include "IUserRepository.hpp" +#include "../entity/User.hpp" +#include "../dataBase/conn.hpp" +#include +#include + +using namespace pqxx; + +class UserRepository : IUserRepository { +public: + explicit UserRepository(conn conn_) { + conn = std::move(conn_); + } + + User getUserById(size_t id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeUser(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + User getUserByLogin(std::string login) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users WHERE login=" + login; + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeUser(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + size_t makeUser(User user) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO Users (login,password,username) " \ + "VALUES (%s, %s, %s); ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + return getUserByLogin(user.getLogin()).getId(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void deleteUser(User user) override { + deleteByUserId(user.getId()); + } + + void deleteByUserId(size_t user_id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + std::vector getAllUsers() override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users"; + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector users; + for(result::const_iterator k = r.begin(); k != r.end(); ++k) + users.push_back(makeUser(k)); + return users; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void getUsersByTaskId(size_t id) override { + + } + +private: + static User makeUser(const result::const_iterator& c) { + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("login")).as(), + c.at(c.column_number("password")).as(), + c.at(c.column_number("username")).as()}; + } + + static conn conn; +}; + +#endif //SOURCEDOUT_USERREPOSITORY_HPP -- GitLab From 9d6453c91835c45b50877d7b3c5cbbabe6996f66 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Sun, 30 Apr 2023 01:55:07 +0300 Subject: [PATCH 003/134] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B5=D0=B9,=20=D0=BD=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B7=D0=B0?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B4=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=20=D0=B1=D0=B4,=20=D0=B8=20=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=83=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- include/entity/Solution.hpp | 5 + include/entity/Task.hpp | 3 + include/repository/ISolutionRepository.hpp | 2 +- include/repository/ITaskRepository.hpp | 6 +- include/repository/SolutionRepository.hpp | 173 +++++++++++++++++++++ include/repository/TaskRepository.hpp | 113 ++++++++++++++ 7 files changed, 298 insertions(+), 6 deletions(-) create mode 100644 include/repository/SolutionRepository.hpp create mode 100644 include/repository/TaskRepository.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d5cb5a4..395d0b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,6 @@ find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) -add_executable(${PROJECT_NAME} src/main.cpp include/entity/User.hpp include/repository/UserRepository.hpp include/dataBase/conn.hpp include/repository/IUserRepository.hpp include/entity/Solution.hpp include/entity/Task.hpp include/repository/ISolutionRepository.hpp include/repository/ISolutionRepository.hpp include/repository/ITaskRepository.hpp include/repository/ITaskRepository.hpp) +add_executable(${PROJECT_NAME} src/main.cpp include/entity/User.hpp include/repository/UserRepository.hpp include/dataBase/conn.hpp include/repository/IUserRepository.hpp include/entity/Solution.hpp include/entity/Task.hpp include/repository/ISolutionRepository.hpp include/repository/ISolutionRepository.hpp include/repository/ITaskRepository.hpp include/repository/ITaskRepository.hpp include/repository/TaskRepository.hpp include/repository/TaskRepository.hpp include/repository/SolutionRepository.hpp include/repository/SolutionRepository.hpp) #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} nlohmann_json::nlohmann_json) \ No newline at end of file diff --git a/include/entity/Solution.hpp b/include/entity/Solution.hpp index 8bd04ea..ed4b1e5 100644 --- a/include/entity/Solution.hpp +++ b/include/entity/Solution.hpp @@ -2,6 +2,7 @@ #define SOURCEDOUT_SOLUTION_HPP #include #include +#include class Solution{ private: @@ -12,6 +13,10 @@ private: size_t task_id; std::string result; public: + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, + std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), + task_id(taskId), result(std::move(result)) {} + [[nodiscard]] size_t getId() const { return id; } diff --git a/include/entity/Task.hpp b/include/entity/Task.hpp index b252c26..a9f2ad1 100644 --- a/include/entity/Task.hpp +++ b/include/entity/Task.hpp @@ -1,11 +1,14 @@ #ifndef SOURCEDOUT_TASK_HPP #define SOURCEDOUT_TASK_HPP #include +#include class Task{ private: size_t id; std::string description; + public: + Task(size_t id, std::string description) : id(id), description(std::move(description)) {} [[nodiscard]] size_t getId() const { return id; } diff --git a/include/repository/ISolutionRepository.hpp b/include/repository/ISolutionRepository.hpp index 7099c47..286e432 100644 --- a/include/repository/ISolutionRepository.hpp +++ b/include/repository/ISolutionRepository.hpp @@ -12,7 +12,7 @@ class ISolutionRepository { virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; - virtual void makeSolution(Solution solution) = 0; + virtual void storeSolution(Solution solution) = 0; virtual void updateSolution(Solution solution) = 0; diff --git a/include/repository/ITaskRepository.hpp b/include/repository/ITaskRepository.hpp index 81ef63a..740e2de 100644 --- a/include/repository/ITaskRepository.hpp +++ b/include/repository/ITaskRepository.hpp @@ -7,11 +7,9 @@ class ITaskRepository { virtual Task getTaskById(size_t id) = 0; - virtual Task updateTask(size_t id) = 0; + virtual void updateTask(Task task) = 0; - virtual Task updateTask(Task task) = 0; - - virtual void makeTask(Task task) = 0; + virtual void storeTask(Task task) = 0; virtual void deleteTask(Task task) = 0; diff --git a/include/repository/SolutionRepository.hpp b/include/repository/SolutionRepository.hpp new file mode 100644 index 0000000..5671b33 --- /dev/null +++ b/include/repository/SolutionRepository.hpp @@ -0,0 +1,173 @@ +#ifndef SOURCEDOUT_SOLUTIONREPOSITORY_HPP +#define SOURCEDOUT_SOLUTIONREPOSITORY_HPP + +#include +#include +#include +#include "ISolutionRepository.hpp" +#include "../entity/Solution.hpp" +#include "../dataBase/conn.hpp" +using namespace pqxx; + +class SolutionRepository : ISolutionRepository { + Solution getSolutionById(size_t id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeSolution(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + std::vector getSolutionsBySenderId(size_t sender_id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector solutions; + for(result::const_iterator k = r.begin(); k != r.end(); ++k) + solutions.push_back(makeSolution(k)); + return solutions; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + std::vector getSolutionsByTaskId(size_t task_id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector solutions; + for(result::const_iterator k = r.begin(); k != r.end(); ++k) + solutions.push_back(makeSolution(k)); + return solutions; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void storeSolution(Solution solution) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result) " \ + "VALUES (%s, %s, %s, %s, %s); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void updateSolution(Solution solution) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("UPDATE solutions SET send_date = %s, sender_id = %s, source = %s, task_id = %s, resulr = %s ;") + % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult()).str(); + work w(c); + w.exec(sql); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void deleteSolutionById(size_t id) override { + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void deleteSolution(Solution solution) override { + deleteSolutionById(solution.getId()); + } + +private: + conn conn; + static Solution makeSolution(const result::const_iterator& c){ + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("send_date")).as(), + c.at(c.column_number("sender_id")).as(), + c.at(c.column_number("source")).as(), + c.at(c.column_number("task_id")).as(), + c.at(c.column_number("result")).as()}; + } +}; + +#endif //SOURCEDOUT_SOLUTIONREPOSITORY_HPP diff --git a/include/repository/TaskRepository.hpp b/include/repository/TaskRepository.hpp new file mode 100644 index 0000000..2a4c778 --- /dev/null +++ b/include/repository/TaskRepository.hpp @@ -0,0 +1,113 @@ +#ifndef SOURCEDOUT_TASKREPOSITORY_HPP +#define SOURCEDOUT_TASKREPOSITORY_HPP + +#include +#include "ITaskRepository.hpp" +#include "pqxx/pqxx" +#include "../dataBase/conn.hpp" +using namespace pqxx; +class TaskRepository:ITaskRepository{ +public: + Task getTaskById(size_t id) override{ + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeTask(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void updateTask(Task task) override{ + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("UPDATE tasks SET description = %s ;") % task.getDescription()).str(); + work w(c); + w.exec(sql); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void storeTask(Task task) override{ + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO tasks (description) " \ + "VALUES (%s); ") % task.getDescription()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } + + void deleteTask(Task task) override{ + deleteTaskById(task.getId()); + } + + void deleteTaskById(size_t task_id) override{ + try { + connection c(conn.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } + } +private: + static Task makeTask(const result::const_iterator& c){ + return{c.at(c.column_number("id")).as(), + c.at(c.column_number("description")).as()}; + } + static conn conn; +}; + +#endif //SOURCEDOUT_TASKREPOSITORY_HPP -- GitLab From a524400ddacaf2a56252fbd91f4dae2762b908ae Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 1 May 2023 11:03:01 +0300 Subject: [PATCH 004/134] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B5=D0=B9,=20=D0=BD=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B7=D0=B0?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B4=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=20=D0=B1=D0=B4,=20=D0=B8=20=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=83=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 5 + CMakeLists.txt | 13 - conanfile.txt | 10 - config.sh | 8 - include/dataBase/config.json | 6 - include/dataBase/conn.hpp | 33 -- include/entity/Solution.hpp | 65 ---- include/entity/Task.hpp | 26 -- include/entity/User.hpp | 51 --- include/repository/ISolutionRepository.hpp | 26 -- include/repository/ITaskRepository.hpp | 19 -- include/repository/IUserRepository.hpp | 23 -- include/repository/SolutionRepository.hpp | 173 ---------- include/repository/TaskRepository.hpp | 113 ------ include/repository/UserRepository.hpp | 157 --------- server/cmd/CMakeLists.txt | 14 + server/cmd/main.cpp | 11 + server/internal/CMakeLists.txt | 11 + server/internal/solutions/CMakeLists.txt | 20 ++ server/internal/tasks/CMakeLists.txt | 20 ++ server/internal/users/CMakeLists.txt | 28 ++ server/internal/users/tests/CMakeLists.txt | 0 .../internal/users/tests/users_repo_test.cpp | 0 src/main.cpp | 321 ------------------ text-basic-metrics/code1.txt | 29 -- text-basic-metrics/code2.txt | 29 -- text-basic-metrics/tbm_main.cpp | 153 --------- 27 files changed, 109 insertions(+), 1255 deletions(-) create mode 100644 .env delete mode 100644 CMakeLists.txt delete mode 100644 conanfile.txt delete mode 100644 config.sh delete mode 100644 include/dataBase/config.json delete mode 100644 include/dataBase/conn.hpp delete mode 100644 include/entity/Solution.hpp delete mode 100644 include/entity/Task.hpp delete mode 100644 include/entity/User.hpp delete mode 100644 include/repository/ISolutionRepository.hpp delete mode 100644 include/repository/ITaskRepository.hpp delete mode 100644 include/repository/IUserRepository.hpp delete mode 100644 include/repository/SolutionRepository.hpp delete mode 100644 include/repository/TaskRepository.hpp delete mode 100644 include/repository/UserRepository.hpp create mode 100644 server/cmd/CMakeLists.txt create mode 100644 server/cmd/main.cpp create mode 100644 server/internal/CMakeLists.txt create mode 100644 server/internal/solutions/CMakeLists.txt create mode 100644 server/internal/tasks/CMakeLists.txt create mode 100644 server/internal/users/CMakeLists.txt create mode 100644 server/internal/users/tests/CMakeLists.txt create mode 100644 server/internal/users/tests/users_repo_test.cpp delete mode 100644 src/main.cpp delete mode 100644 text-basic-metrics/code1.txt delete mode 100644 text-basic-metrics/code2.txt delete mode 100644 text-basic-metrics/tbm_main.cpp diff --git a/.env b/.env new file mode 100644 index 0000000..0804779 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +PGHOSTADDR=0.0.0.0 +PGPORT=5432 +PGDATABASE=mydb +PGUSER=postgres +PGPASSWORD=root diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 395d0b7..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) -set(CMAKE_PREFIX_PATH build) -project(SourcedOut CXX) -find_package(antlr4-runtime REQUIRED) -find_package(Boost 1.8.1 REQUIRED) -find_package(libpqxx REQUIRED) -find_package(GTest REQUIRED) -find_package(nlohmann_json REQUIRED) -message(STATUS ${nlohmann_json_LIBRARIES}) -add_executable(${PROJECT_NAME} src/main.cpp include/entity/User.hpp include/repository/UserRepository.hpp include/dataBase/conn.hpp include/repository/IUserRepository.hpp include/entity/Solution.hpp include/entity/Task.hpp include/repository/ISolutionRepository.hpp include/repository/ISolutionRepository.hpp include/repository/ITaskRepository.hpp include/repository/ITaskRepository.hpp include/repository/TaskRepository.hpp include/repository/TaskRepository.hpp include/repository/SolutionRepository.hpp include/repository/SolutionRepository.hpp) -#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} nlohmann_json::nlohmann_json) \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index e4b350b..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,10 +0,0 @@ -[requires] -boost/1.81.0 -antlr4-cppruntime/4.12.0 -libpqxx/7.7.5 -gtest/cci.20210126 -nlohmann_json/3.11.2 - -[generators] -CMakeDeps -CMakeToolchain \ No newline at end of file diff --git a/config.sh b/config.sh deleted file mode 100644 index b05efd5..0000000 --- a/config.sh +++ /dev/null @@ -1,8 +0,0 @@ -pip install conan -conan profile detect --force -#------------- -mkdir "build" -cd build/ -#------------ -conan install . --build=missing -s build_type=Debug -cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug diff --git a/include/dataBase/config.json b/include/dataBase/config.json deleted file mode 100644 index eee75d5..0000000 --- a/include/dataBase/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{"dbname":"mydb", - "user":"postgres", - "password": "root", - "hostaddr": "127.0.0.1", - "port": "5432" -} \ No newline at end of file diff --git a/include/dataBase/conn.hpp b/include/dataBase/conn.hpp deleted file mode 100644 index 91dbd55..0000000 --- a/include/dataBase/conn.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SOURCEDOUT_CONN_HPP -#define SOURCEDOUT_CONN_HPP - -#include -#include -#include - -using json = nlohmann::json; - -struct conn { - std::string dbname; - std::string user; - std::string password; - std::string hostaddr; - std::string port; - - conn() { - std::ifstream f("config.json"); - json data = json::parse(f); - data.at("dbname").get_to(dbname); - data.at("user").get_to(user); - data.at("password").get_to(password); - data.at("hostaddr").get_to(hostaddr); - data.at("port").get_to(port); - } - - [[nodiscard]] std::string getData() const { - return "dbname = " + dbname + " user = " + user + " password = " + password + - " hostaddr = " + hostaddr + " port = " + port; - } -}; - -#endif //SOURCEDOUT_CONN_HPP diff --git a/include/entity/Solution.hpp b/include/entity/Solution.hpp deleted file mode 100644 index ed4b1e5..0000000 --- a/include/entity/Solution.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef SOURCEDOUT_SOLUTION_HPP -#define SOURCEDOUT_SOLUTION_HPP -#include -#include -#include - -class Solution{ -private: - size_t id; - std::string send_date; - size_t sender_id; - std::string source; - size_t task_id; - std::string result; -public: - Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, - std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), - task_id(taskId), result(std::move(result)) {} - - [[nodiscard]] size_t getId() const { - return id; - } - - - [[nodiscard]] const std::string &getSendDate() const { - return send_date; - } - - void setSendDate(const std::string &sendDate) { - send_date = sendDate; - } - - [[nodiscard]] size_t getSenderId() const { - return sender_id; - } - - void setSenderId(size_t senderId) { - sender_id = senderId; - } - - [[nodiscard]] const std::string &getSource() const { - return source; - } - - void setSource(const std::string &source_) { - Solution::source = source_; - } - - [[nodiscard]] size_t getTaskId() const { - return task_id; - } - - void setTaskId(size_t taskId) { - task_id = taskId; - } - - [[nodiscard]] const std::string &getResult() const { - return result; - } - - void setResult(const std::string &result_) { - Solution::result = result_; - } -}; -#endif //SOURCEDOUT_SOLUTION_HPP diff --git a/include/entity/Task.hpp b/include/entity/Task.hpp deleted file mode 100644 index a9f2ad1..0000000 --- a/include/entity/Task.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SOURCEDOUT_TASK_HPP -#define SOURCEDOUT_TASK_HPP -#include -#include -class Task{ -private: - size_t id; - std::string description; - -public: - Task(size_t id, std::string description) : id(id), description(std::move(description)) {} - [[nodiscard]] size_t getId() const { - return id; - } - - [[nodiscard]] const std::string &getDescription() const { - return description; - } - - void setDescription(const std::string &description_) { - Task::description = description_; - } - -public: -}; -#endif //SOURCEDOUT_TASK_HPP diff --git a/include/entity/User.hpp b/include/entity/User.hpp deleted file mode 100644 index 3c0e24e..0000000 --- a/include/entity/User.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef SOURCEDOUT_USER_HPP - -#include -#include - -#define SOURCEDOUT_USER_HPP - -class User { -private: - size_t id; - std::string login; - std::string password; - std::string username; - -public: - User(size_t id_, std::string login_, std::string password_, std::string username_) : - id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { - } - - User(std::string login_, std::string password_, std::string username_) : - id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { - } - - [[nodiscard]] size_t getId() const { - return id; - } - - - [[nodiscard]] const std::string &getLogin() const { - return login; - } - - - [[nodiscard]] const std::string &getPassword() const { - return password; - } - - void setPassword(const std::string &password_) { - User::password = password_; - } - - [[nodiscard]] const std::string &getUsername() const { - return username; - } - - void setUsername(const std::string &username_) { - User::username = username_; - } -}; - -#endif //SOURCEDOUT_USER_HPP diff --git a/include/repository/ISolutionRepository.hpp b/include/repository/ISolutionRepository.hpp deleted file mode 100644 index 286e432..0000000 --- a/include/repository/ISolutionRepository.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef SOURCEDOUT_ISOLUTIONREPOSITORY_HPP -#define SOURCEDOUT_ISOLUTIONREPOSITORY_HPP - -#include -#include -#include "../entity/Solution.hpp" - -class ISolutionRepository { - virtual Solution getSolutionById(size_t id) = 0; - - virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; - - virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; - - virtual void storeSolution(Solution solution) = 0; - - virtual void updateSolution(Solution solution) = 0; - - virtual void deleteSolutionById(size_t id) = 0; - - virtual void deleteSolution(Solution solution) = 0; - - -}; - -#endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/include/repository/ITaskRepository.hpp b/include/repository/ITaskRepository.hpp deleted file mode 100644 index 740e2de..0000000 --- a/include/repository/ITaskRepository.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef SOURCEDOUT_ITASKREPOSITORY_HPP -#define SOURCEDOUT_ITASKREPOSITORY_HPP - -#include -#include "../entity/Task.hpp" - -class ITaskRepository { - virtual Task getTaskById(size_t id) = 0; - - virtual void updateTask(Task task) = 0; - - virtual void storeTask(Task task) = 0; - - virtual void deleteTask(Task task) = 0; - - virtual void deleteTaskById(size_t task_id) = 0; -}; - -#endif //SOURCEDOUT_ITASKREPOSITORY_HPP diff --git a/include/repository/IUserRepository.hpp b/include/repository/IUserRepository.hpp deleted file mode 100644 index 0647432..0000000 --- a/include/repository/IUserRepository.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SOURCEDOUT_IUSERREPOSITORY_HPP -#define SOURCEDOUT_IUSERREPOSITORY_HPP - -#include -#include "../entity/User.hpp" -class IUserRepository { -public: - virtual User getUserById(size_t id) = 0; - - virtual User getUserByLogin(std::string login) = 0; - - virtual size_t makeUser(User user) = 0; - - virtual void deleteUser(User user) = 0; - - virtual void deleteByUserId(size_t user_id) = 0; - - virtual std::vector getAllUsers() = 0; - - virtual void getUsersByTaskId(size_t id) = 0; -}; - -#endif //SOURCEDOUT_IUSERREPOSITORY_HPP diff --git a/include/repository/SolutionRepository.hpp b/include/repository/SolutionRepository.hpp deleted file mode 100644 index 5671b33..0000000 --- a/include/repository/SolutionRepository.hpp +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef SOURCEDOUT_SOLUTIONREPOSITORY_HPP -#define SOURCEDOUT_SOLUTIONREPOSITORY_HPP - -#include -#include -#include -#include "ISolutionRepository.hpp" -#include "../entity/Solution.hpp" -#include "../dataBase/conn.hpp" -using namespace pqxx; - -class SolutionRepository : ISolutionRepository { - Solution getSolutionById(size_t id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - return makeSolution(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - std::vector getSolutionsBySenderId(size_t sender_id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - std::vector solutions; - for(result::const_iterator k = r.begin(); k != r.end(); ++k) - solutions.push_back(makeSolution(k)); - return solutions; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - std::vector getSolutionsByTaskId(size_t task_id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - std::vector solutions; - for(result::const_iterator k = r.begin(); k != r.end(); ++k) - solutions.push_back(makeSolution(k)); - return solutions; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void storeSolution(Solution solution) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result) " \ - "VALUES (%s, %s, %s, %s, %s); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult()).str(); - work w(c); - w.exec(sql); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void updateSolution(Solution solution) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("UPDATE solutions SET send_date = %s, sender_id = %s, source = %s, task_id = %s, resulr = %s ;") - % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult()).str(); - work w(c); - w.exec(sql); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void deleteSolutionById(size_t id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); - work w(c); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void deleteSolution(Solution solution) override { - deleteSolutionById(solution.getId()); - } - -private: - conn conn; - static Solution makeSolution(const result::const_iterator& c){ - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("send_date")).as(), - c.at(c.column_number("sender_id")).as(), - c.at(c.column_number("source")).as(), - c.at(c.column_number("task_id")).as(), - c.at(c.column_number("result")).as()}; - } -}; - -#endif //SOURCEDOUT_SOLUTIONREPOSITORY_HPP diff --git a/include/repository/TaskRepository.hpp b/include/repository/TaskRepository.hpp deleted file mode 100644 index 2a4c778..0000000 --- a/include/repository/TaskRepository.hpp +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef SOURCEDOUT_TASKREPOSITORY_HPP -#define SOURCEDOUT_TASKREPOSITORY_HPP - -#include -#include "ITaskRepository.hpp" -#include "pqxx/pqxx" -#include "../dataBase/conn.hpp" -using namespace pqxx; -class TaskRepository:ITaskRepository{ -public: - Task getTaskById(size_t id) override{ - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - return makeTask(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void updateTask(Task task) override{ - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("UPDATE tasks SET description = %s ;") % task.getDescription()).str(); - work w(c); - w.exec(sql); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void storeTask(Task task) override{ - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("INSERT INTO tasks (description) " \ - "VALUES (%s); ") % task.getDescription()).str(); - work w(c); - w.exec(sql); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void deleteTask(Task task) override{ - deleteTaskById(task.getId()); - } - - void deleteTaskById(size_t task_id) override{ - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); - work w(c); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } -private: - static Task makeTask(const result::const_iterator& c){ - return{c.at(c.column_number("id")).as(), - c.at(c.column_number("description")).as()}; - } - static conn conn; -}; - -#endif //SOURCEDOUT_TASKREPOSITORY_HPP diff --git a/include/repository/UserRepository.hpp b/include/repository/UserRepository.hpp deleted file mode 100644 index 64bda8f..0000000 --- a/include/repository/UserRepository.hpp +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef SOURCEDOUT_USERREPOSITORY_HPP -#define SOURCEDOUT_USERREPOSITORY_HPP - -#include -#include "IUserRepository.hpp" -#include "../entity/User.hpp" -#include "../dataBase/conn.hpp" -#include -#include - -using namespace pqxx; - -class UserRepository : IUserRepository { -public: - explicit UserRepository(conn conn_) { - conn = std::move(conn_); - } - - User getUserById(size_t id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - return makeUser(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - User getUserByLogin(std::string login) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM Users WHERE login=" + login; - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - return makeUser(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - size_t makeUser(User user) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("INSERT INTO Users (login,password,username) " \ - "VALUES (%s, %s, %s); ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); - work w(c); - w.exec(sql); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - return getUserByLogin(user.getLogin()).getId(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void deleteUser(User user) override { - deleteByUserId(user.getId()); - } - - void deleteByUserId(size_t user_id) override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); - work w(c); - w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - std::vector getAllUsers() override { - try { - connection c(conn.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "SELECT * FROM Users"; - nontransaction n(c); - result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); - std::vector users; - for(result::const_iterator k = r.begin(); k != r.end(); ++k) - users.push_back(makeUser(k)); - return users; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; - } - } - - void getUsersByTaskId(size_t id) override { - - } - -private: - static User makeUser(const result::const_iterator& c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("login")).as(), - c.at(c.column_number("password")).as(), - c.at(c.column_number("username")).as()}; - } - - static conn conn; -}; - -#endif //SOURCEDOUT_USERREPOSITORY_HPP diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt new file mode 100644 index 0000000..4829fdd --- /dev/null +++ b/server/cmd/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.19) + +set(CMAKE_CXX_STANDARD 20) + +set(PROJECT_NAME "Server") + +project(${PROJECT_NAME}) + +add_executable(Server main.cpp) +message(STATUS ${libusers}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} ${libusers_LIB}) +target_include_directories(Server PUBLIC ${libusers_INCLUDE_DIRS}) +message("Built server") + diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp new file mode 100644 index 0000000..83f740d --- /dev/null +++ b/server/cmd/main.cpp @@ -0,0 +1,11 @@ + + +#include "../internal/users/include/UserRepository.hpp" + +int main(){ + User user{"qwerty200468@gmail.com", "123", "tolik"}; + conn conn; + UserRepository repo(conn); + std::cout< -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace beast = boost::beast; // from -namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = boost::asio::ip::tcp; // from - -//------------------------------------------------------------------------------ - -// Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) -{ - using beast::iequals; - auto const ext = [&path] - { - auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; - return path.substr(pos); - }(); - if(iequals(ext, ".htm")) return "text/html"; - if(iequals(ext, ".html")) return "text/html"; - if(iequals(ext, ".php")) return "text/html"; - if(iequals(ext, ".css")) return "text/css"; - if(iequals(ext, ".txt")) return "text/plain"; - if(iequals(ext, ".js")) return "application/javascript"; - if(iequals(ext, ".json")) return "application/json"; - if(iequals(ext, ".xml")) return "application/xml"; - if(iequals(ext, ".swf")) return "application/x-shockwave-flash"; - if(iequals(ext, ".flv")) return "video/x-flv"; - if(iequals(ext, ".png")) return "image/png"; - if(iequals(ext, ".jpe")) return "image/jpeg"; - if(iequals(ext, ".jpeg")) return "image/jpeg"; - if(iequals(ext, ".jpg")) return "image/jpeg"; - if(iequals(ext, ".gif")) return "image/gif"; - if(iequals(ext, ".bmp")) return "image/bmp"; - if(iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; - if(iequals(ext, ".tiff")) return "image/tiff"; - if(iequals(ext, ".tif")) return "image/tiff"; - if(iequals(ext, ".svg")) return "image/svg+xml"; - if(iequals(ext, ".svgz")) return "image/svg+xml"; - return "application/text"; -} - -// Append an HTTP rel-path to a local filesystem path. -// The returned path is normalized for the platform. -std::string -path_cat( - beast::string_view base, - beast::string_view path) -{ - if (base.empty()) - return std::string(path); - std::string result(base); -#ifdef BOOST_MSVC - char constexpr path_separator = '\\'; - if(result.back() == path_separator) - result.resize(result.size() - 1); - result.append(path.data(), path.size()); - for(auto& c : result) - if(c == '/') - c = path_separator; -#else - char constexpr path_separator = '/'; - if(result.back() == path_separator) - result.resize(result.size() - 1); - result.append(path.data(), path.size()); -#endif - return result; -} - -// This function produces an HTTP response for the given -// request. The type of the response object depends on the -// contents of the request, so the interface requires the -// caller to pass a generic lambda for receiving the response. -template< - class Body, class Allocator, - class Send> -void -handle_request( - beast::string_view doc_root, - http::request>&& req, - Send&& send) -{ - // Returns a bad request response - auto const bad_request = - [&req](beast::string_view why) - { - http::response res{http::status::bad_request, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - // Returns a not found response - auto const not_found = - [&req](beast::string_view target) - { - http::response res{http::status::not_found, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "The resource '" + std::string(target) + "' was not found."; - res.prepare_payload(); - return res; - }; - - // Returns a server error response - auto const server_error = - [&req](beast::string_view what) - { - http::response res{http::status::internal_server_error, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "An error occurred: '" + std::string(what) + "'"; - res.prepare_payload(); - return res; - }; - - // Make sure we can handle the method - if( req.method() != http::verb::get && - req.method() != http::verb::head) - return send(bad_request("Unknown HTTP-method")); - - // Request path must be absolute and not contain "..". - if( req.target().empty() || - req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) - return send(bad_request("Illegal request-target")); - - // Build the path to the requested file - std::string path = path_cat(doc_root, req.target()); - if(req.target().back() == '/') - path.append("index.html"); - - // Attempt to open the file - beast::error_code ec; - http::file_body::value_type body; - body.open(path.c_str(), beast::file_mode::scan, ec); - - // Handle the case where the file doesn't exist - if(ec == beast::errc::no_such_file_or_directory) - return send(not_found(req.target())); - - // Handle an unknown error - if(ec) - return send(server_error(ec.message())); - - // Cache the size since we need it after the move - auto const size = body.size(); - - // Respond to HEAD request - if(req.method() == http::verb::head) - { - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); - } - - // Respond to GET request - http::response res{ - std::piecewise_construct, - std::make_tuple(std::move(body)), - std::make_tuple(http::status::ok, req.version())}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); -} - -//------------------------------------------------------------------------------ - -// Report a failure -void -fail(beast::error_code ec, char const* what) -{ - std::cerr << what << ": " << ec.message() << "\n"; -} - -// This is the C++11 equivalent of a generic lambda. -// The function object is used to send an HTTP message. -template -struct send_lambda -{ - Stream& stream_; - bool& close_; - beast::error_code& ec_; - - explicit - send_lambda( - Stream& stream, - bool& close, - beast::error_code& ec) - : stream_(stream) - , close_(close) - , ec_(ec) - { - } - - template - void - operator()(http::message&& msg) const - { - // Determine if we should close the connection after - close_ = msg.need_eof(); - - // We need the serializer here because the serializer requires - // a non-const file_body, and the message oriented version of - // http::write only works with const messages. - http::serializer sr{msg}; - http::write(stream_, sr, ec_); - } -}; - -// Handles an HTTP server connection -void -do_session( - tcp::socket& socket, - std::shared_ptr const& doc_root) -{ - bool close = false; - beast::error_code ec; - - // This buffer is required to persist across reads - beast::flat_buffer buffer; - - // This lambda is used to send messages - send_lambda lambda{socket, close, ec}; - - for(;;) - { - // Read a request - http::request req; - http::read(socket, buffer, req, ec); - if(ec == http::error::end_of_stream) - break; - if(ec) - return fail(ec, "read"); - - // Send the response - handle_request(*doc_root, std::move(req), lambda); - if(ec) - return fail(ec, "write"); - if(close) - { - // This means we should close the connection, usually because - // the response indicated the "Connection: close" semantic. - break; - } - } - - // Send a TCP shutdown - socket.shutdown(tcp::socket::shutdown_send, ec); - - // At this point the connection is closed gracefully -} - -//------------------------------------------------------------------------------ - -int main(int argc, char* argv[]) -{ - try - { - // Check command line arguments. - if (argc != 4) - { - std::cerr << - "Usage: http-server-sync
\n" << - "Example:\n" << - " http-server-sync 0.0.0.0 8080 .\n"; - return EXIT_FAILURE; - } - auto const address = net::ip::make_address(argv[1]); - auto const port = static_cast(std::atoi(argv[2])); - auto const doc_root = std::make_shared(argv[3]); - - // The io_context is required for all I/O - net::io_context ioc{1}; - - // The acceptor receives incoming connections - tcp::acceptor acceptor{ioc, {address, port}}; - for(;;) - { - // This will receive the new connection - tcp::socket socket{ioc}; - - // Block until we get a connection - acceptor.accept(socket); - - // Launch the session, transferring ownership of the socket - std::thread{std::bind( - &do_session, - std::move(socket), - doc_root)}.detach(); - } - } - catch (const std::exception& e) - { - std::cerr << "Error: " << e.what() << std::endl; - return EXIT_FAILURE; - } -} \ No newline at end of file diff --git a/text-basic-metrics/code1.txt b/text-basic-metrics/code1.txt deleted file mode 100644 index 5fa95b8..0000000 --- a/text-basic-metrics/code1.txt +++ /dev/null @@ -1,29 +0,0 @@ -// однострочный комментарий -// еще один -// вау еще один - -#include -#include -#include - -using namespace std; - -/* многострочный комм - * // внутри него однострочный - * - */ - - -int main() { - stringstream ss; - string res; - // ещё в код напихаю комментов - ss << "a bwfw ce "; - while(getline(ss, res, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res << endl; /* многострочный однострочно */ - } -} diff --git a/text-basic-metrics/code2.txt b/text-basic-metrics/code2.txt deleted file mode 100644 index 2115b76..0000000 --- a/text-basic-metrics/code2.txt +++ /dev/null @@ -1,29 +0,0 @@ -// однострочный комментарий -// еще один -// вау еще один - -#include -#include -#include - -using namespace std; - -/* многострочный комм - * // внутри него однострочный - * - */ - - -int main() { - stringstream ss1; - string res1; - // ещё в код напихаю комментов - ss1 << "a bwfw ce "; - while(getline(ss, res1, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res1 << endl; /* многострочный однострочно */ - } -} \ No newline at end of file diff --git a/text-basic-metrics/tbm_main.cpp b/text-basic-metrics/tbm_main.cpp deleted file mode 100644 index fdd4253..0000000 --- a/text-basic-metrics/tbm_main.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// -// Created by march on 21.04.2023. -// - -#include -#include -#include -#include -#include -#include -#include - -#include - - -std::string deleteComms(const std::string& text){ - std::string modif; - std::string res; - - std::stringstream ss; - std::string line; - - ss << text; - - while(getline(ss, line)){ - line.pop_back(); - line.push_back('\0'); - modif += line; - } - - bool s_comm = false; - bool m_comm = false; - - for (int i = 0; i < modif.size(); i++){ - if (s_comm && modif[i] == '\0') - s_comm = false; - else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') - m_comm = false, i++; - else if (s_comm || m_comm) - continue; - else if (modif[i] == '/' && modif[i+1] == '/') - s_comm = true, i++; - else if (modif[i] == '/' && modif[i+1] == '*') - m_comm = true, i++; - - else if (modif[i] != '\0') - res += modif[i]; - else{ - res += '\n'; - } - } - return res; -} - -std::vector tbm_tokenizer(const std::string &text){ - boost::char_separator sep(" {}();,\"\0\'"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); - - for (const std::string &s: tokens) { - if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ - res.push_back(s); - } - } - return res; -} - -// % = intersection(A, B) / union(A, B) -double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ - std::set s1; - std::set s2; - - for (auto &i : tokens1) s1.insert(i); - for (auto &i : tokens2) s2.insert(i); - - - std::set intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); - - std::set union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); - - std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; - - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); -} - -double Livenstain_dist(std::vector tokens1, std::vector tokens2){ - unsigned long n = tokens1.size(); - unsigned long m = tokens2.size(); - int x, y, z; - - std::vector > lev (n, std::vector (m, 0)); - - for (int i = 0; i < n; i++){ - for (int j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = std::max(i, j); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; - lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ - lev[i][j]++; - } - } - } - } - - return lev[n-1][m-1]; -} - -std::pair textCompare(std::istream& fin1, std::istream& fin2){ - std::string line; - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - - std::string non_comm_text1 = deleteComms(text1); - std::string non_comm_text2 = deleteComms(text2); - - std::vector tokens1 = tbm_tokenizer(non_comm_text1); - std::vector tokens2 = tbm_tokenizer(non_comm_text2); - - double res1 = Jaccard_metric(tokens1, tokens2); - double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); - - return {res1, res2}; -} - -int main(){ - - std::ifstream fin1; - fin1.open("text-basic-metrics/code1.txt"); - assert(fin1.is_open()); - - std::ifstream fin2; - fin2.open("text-basic-metrics/code2.txt"); - assert(fin2.is_open()); - - std::pair metrics_res = textCompare(fin1, fin2); - - std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; - fin1.close(); - fin2.close(); -} \ No newline at end of file -- GitLab From 9295e895979b85fde141d87dbe6b82dd19fc5896 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 1 May 2023 11:10:35 +0300 Subject: [PATCH 005/134] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B5=D0=B9,=20=D0=BD=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BB=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B7=D0=B0?= =?UTF-8?q?=D0=B8=D0=BC=D0=BE=D0=B4=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=20=D0=B1=D0=B4,=20=D0=B8=20=D0=BE=D0=B4=D0=BD?= =?UTF-8?q?=D1=83=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 40 +++++ log.txt | 13 ++ server/cmd/.env | 5 + server/internal/solutions/Solution.hpp | 57 ++++++ .../solutions/include/SolutionRepository.hpp | 30 ++++ server/internal/solutions/src/Solution.cpp | 73 ++++++++ .../solutions/src/SolutionRepository.cpp | 169 ++++++++++++++++++ .../solutions/virtual/ISolutionRepository.hpp | 26 +++ server/internal/src/CMakeLists.txt | 5 + server/internal/src/db/CMakeLists.txt | 29 +++ server/internal/src/db/config.json | 7 + server/internal/src/db/include/conn.hpp | 22 +++ server/internal/src/db/src/conn.cpp | 27 +++ server/internal/tasks/Task.hpp | 21 +++ .../internal/tasks/include/TaskRepository.hpp | 27 +++ server/internal/tasks/src/Task.cpp | 21 +++ server/internal/tasks/src/TaskRepository.cpp | 106 +++++++++++ .../tasks/virtual/ITaskRepository.hpp | 19 ++ server/internal/users/User.hpp | 35 ++++ .../internal/users/include/UserRepository.hpp | 35 ++++ server/internal/users/src/User.cpp | 37 ++++ server/internal/users/src/UserRepository.cpp | 145 +++++++++++++++ .../users/virtual/IUserRepository.hpp | 22 +++ 23 files changed, 971 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 log.txt create mode 100644 server/cmd/.env create mode 100644 server/internal/solutions/Solution.hpp create mode 100644 server/internal/solutions/include/SolutionRepository.hpp create mode 100644 server/internal/solutions/src/Solution.cpp create mode 100644 server/internal/solutions/src/SolutionRepository.cpp create mode 100644 server/internal/solutions/virtual/ISolutionRepository.hpp create mode 100644 server/internal/src/CMakeLists.txt create mode 100644 server/internal/src/db/CMakeLists.txt create mode 100644 server/internal/src/db/config.json create mode 100644 server/internal/src/db/include/conn.hpp create mode 100644 server/internal/src/db/src/conn.cpp create mode 100644 server/internal/tasks/Task.hpp create mode 100644 server/internal/tasks/include/TaskRepository.hpp create mode 100644 server/internal/tasks/src/Task.cpp create mode 100644 server/internal/tasks/src/TaskRepository.cpp create mode 100644 server/internal/tasks/virtual/ITaskRepository.hpp create mode 100644 server/internal/users/User.hpp create mode 100644 server/internal/users/include/UserRepository.hpp create mode 100644 server/internal/users/src/User.cpp create mode 100644 server/internal/users/src/UserRepository.cpp create mode 100644 server/internal/users/virtual/IUserRepository.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..90ae8b6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,40 @@ +set(CMAKE_CXX_STANDARD 20) +cmake_minimum_required(VERSION 3.19) + +set(PROJECT_NAME "SourcedOut") + +project(${PROJECT_NAME}) + + +set(BUILD_DEV TRUE CACHE BOOL "build dev version") +set(SANITIZE_BUILD TRUE CACHE BOOL "build with sanitizers") + +if(BUILD_DEV) + enable_testing() + message("Building dev version") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ + -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") + + if(SANITIZE_BUILD) + message("Sanitizers ON") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-sanitize-recover=all -fsanitize-undefined-trap-on-error") + endif(SANITIZE_BUILD) +endif(BUILD_DEV) + +set(BUILD_SERVER "BUILD_SERVER") +set(BUILD_CLIENT "BUILD_CLIENT") +set(BUILD_ALL "BUILD_ALL") + + +message("${BUILD_DEV} ${SANITIZE_BUILD} ${CMAKE_EXE_LINKER_FLAGS}") +set(BUILD_MODE ${BUILD_SERVER}) + +if((BUILD_MODE STREQUAL ${BUILD_CLIENT}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(client) +endif() + +if((BUILD_MODE STREQUAL ${BUILD_SERVER}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(server) +endif() diff --git a/log.txt b/log.txt new file mode 100644 index 0000000..836dc35 --- /dev/null +++ b/log.txt @@ -0,0 +1,13 @@ +Opened database successfully: mydb +Opened database successfully: mydb +Opened database successfully: mydb +Opened database successfully: mydb +OK +Opened database successfully: mydb +OK +Opened database successfully: mydb +Opened database successfully: mydb +OK +Opened database successfully: mydb +OK +Opened database successfully: mydb diff --git a/server/cmd/.env b/server/cmd/.env new file mode 100644 index 0000000..0804779 --- /dev/null +++ b/server/cmd/.env @@ -0,0 +1,5 @@ +PGHOSTADDR=0.0.0.0 +PGPORT=5432 +PGDATABASE=mydb +PGUSER=postgres +PGPASSWORD=root diff --git a/server/internal/solutions/Solution.hpp b/server/internal/solutions/Solution.hpp new file mode 100644 index 0000000..dcfa255 --- /dev/null +++ b/server/internal/solutions/Solution.hpp @@ -0,0 +1,57 @@ +#ifndef SOURCEDOUT_SOLUTION_HPP +#define SOURCEDOUT_SOLUTION_HPP + +#include +#include +#include + +class Solution { +public: + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, + std::string tokens, std::string astTree, size_t taskId, std::string result); + + [[nodiscard]] size_t getId() const; + + + [[nodiscard]] const std::string &getSendDate() const; + + void setSendDate(const std::string &sendDate); + + [[nodiscard]] size_t getSenderId() const; + + void setSenderId(size_t senderId); + + [[nodiscard]] const std::string &getSource() const; + + void setSource(const std::string &source); + + [[nodiscard]] const std::string &getTokens() const; + + void setTokens(const std::string &tokens); + + [[nodiscard]] const std::string &getAstTree() const; + + void setAstTree(const std::string &astTree); + + [[nodiscard]] size_t getTaskId() const; + + void setTaskId(size_t taskId); + + [[nodiscard]] const std::string &getResult() const; + + void setResult(const std::string &result); + +private: + size_t id; + std::string send_date; + size_t sender_id; + std::string source; + std::string tokens; + std::string astTree; + size_t task_id; + std::string result; +public: + +}; + +#endif //SOURCEDOUT_SOLUTION_HPP diff --git a/server/internal/solutions/include/SolutionRepository.hpp b/server/internal/solutions/include/SolutionRepository.hpp new file mode 100644 index 0000000..4856b6d --- /dev/null +++ b/server/internal/solutions/include/SolutionRepository.hpp @@ -0,0 +1,30 @@ +#ifndef SOURCEDOUT_SOLUTIONREPOSITORY_HPP +#define SOURCEDOUT_SOLUTIONREPOSITORY_HPP + +#include +#include +#include +#include +#include "ISolutionRepository.hpp" +using namespace pqxx; + +class SolutionRepository : ISolutionRepository { + Solution getSolutionById(size_t id) override; + + std::vector getSolutionsBySenderId(size_t sender_id) override; + + std::vector getSolutionsByTaskId(size_t task_id) override; + + void storeSolution(Solution solution) override; + + void updateSolution(Solution solution) override; + + void deleteSolutionById(size_t id) override; + + void deleteSolution(Solution solution) override; + +private: + static Solution makeSolution(const result::const_iterator& c); +}; + +#endif //SOURCEDOUT_SOLUTIONREPOSITORY_HPP diff --git a/server/internal/solutions/src/Solution.cpp b/server/internal/solutions/src/Solution.cpp new file mode 100644 index 0000000..db3b2b9 --- /dev/null +++ b/server/internal/solutions/src/Solution.cpp @@ -0,0 +1,73 @@ + +#include +#include +#include "../Solution.hpp" + +Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, + std::string source, std::string tokens, + std::string astTree, unsigned long taskId, + std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)) {} + +size_t Solution::getId() const { + return id; +} + + +const std::string &Solution::getSendDate() const { + return send_date; +} + +void Solution::setSendDate(const std::string &sendDate) { + send_date = sendDate; +} + +size_t Solution::getSenderId() const { + return sender_id; +} + +void Solution::setSenderId(size_t senderId) { + sender_id = senderId; +} + +const std::string &Solution::getSource() const { + return source; +} + +void Solution::setSource(const std::string &source_) { + Solution::source = source_; +} + +const std::string &Solution::getTokens() const { + return tokens; +} + +void Solution::setTokens(const std::string &tokens_) { + Solution::tokens = tokens_; +} + +const std::string &Solution::getAstTree() const { + return astTree; +} + +void Solution::setAstTree(const std::string &astTree_) { + Solution::astTree = astTree_; +} + +size_t Solution::getTaskId() const { + return task_id; +} + +void Solution::setTaskId(size_t taskId) { + task_id = taskId; +} + +const std::string &Solution::getResult() const { + return result; +} + +void Solution::setResult(const std::string &result_) { + Solution::result = result_; +} diff --git a/server/internal/solutions/src/SolutionRepository.cpp b/server/internal/solutions/src/SolutionRepository.cpp new file mode 100644 index 0000000..fdb9d3c --- /dev/null +++ b/server/internal/solutions/src/SolutionRepository.cpp @@ -0,0 +1,169 @@ +#pragma once + +#include +#include +#include +#include +#include "../Solution.hpp" +#include "SolutionRepository.hpp" +using namespace pqxx; + +Solution SolutionRepository::getSolutionById(size_t id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeSolution(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector solutions; + for(result::const_iterator k = r.begin(); k != r.end(); ++k) + solutions.push_back(makeSolution(k)); + return solutions; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector solutions; + for(result::const_iterator k = r.begin(); k != r.end(); ++k) + solutions.push_back(makeSolution(k)); + return solutions; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void SolutionRepository::storeSolution(Solution solution) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ + "VALUES (%s, %s, %s, %s, %s, %s, %s); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void SolutionRepository::updateSolution(Solution solution) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("UPDATE solutions SET send_date = %s, sender_id = %s, source = %s, task_id = %s, result = %s, tokens = %s, astTree = %s ;") + % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + work w(c); + w.exec(sql); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void SolutionRepository::deleteSolutionById(size_t id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void SolutionRepository::deleteSolution(Solution solution) { + deleteSolutionById(solution.getId()); +} + + +Solution SolutionRepository::makeSolution(const result::const_iterator& c){ + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("send_date")).as(), + c.at(c.column_number("sender_id")).as(), + c.at(c.column_number("source")).as(), + c.at(c.column_number("tokens")).as(), + c.at(c.column_number("astTree")).as(), + c.at(c.column_number("task_id")).as(), + c.at(c.column_number("result")).as()}; +} \ No newline at end of file diff --git a/server/internal/solutions/virtual/ISolutionRepository.hpp b/server/internal/solutions/virtual/ISolutionRepository.hpp new file mode 100644 index 0000000..902d0d5 --- /dev/null +++ b/server/internal/solutions/virtual/ISolutionRepository.hpp @@ -0,0 +1,26 @@ +#ifndef SOURCEDOUT_ISOLUTIONREPOSITORY_HPP +#define SOURCEDOUT_ISOLUTIONREPOSITORY_HPP + +#include +#include +#include "../Solution.hpp" + +class ISolutionRepository { + virtual Solution getSolutionById(size_t id) = 0; + + virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; + + virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; + + virtual void storeSolution(Solution solution) = 0; + + virtual void updateSolution(Solution solution) = 0; + + virtual void deleteSolutionById(size_t id) = 0; + + virtual void deleteSolution(Solution solution) = 0; + + +}; + +#endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/server/internal/src/CMakeLists.txt b/server/internal/src/CMakeLists.txt new file mode 100644 index 0000000..72e4c50 --- /dev/null +++ b/server/internal/src/CMakeLists.txt @@ -0,0 +1,5 @@ +set(CMAKE_CXX_STANDARD 20) +cmake_minimum_required(VERSION 3.19) +add_subdirectory(db) +set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) +set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/server/internal/src/db/CMakeLists.txt b/server/internal/src/db/CMakeLists.txt new file mode 100644 index 0000000..df02471 --- /dev/null +++ b/server/internal/src/db/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.10) + +project("DBLib") + +set(LIB_NAME DB_Lib) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +message("SOURCES = ${SOURCES}") +message("HEADERS = ${HEADERS}") + + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(${LIB_NAME} ${libpqxx_LIBRARIES} nlohmann_json::nlohmann_json) + +set(DB_Lib_LIB ${LIB_NAME}) +set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) +set(DB_Lib_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) + +message("DB_Lib_LIB = ${DB_Lib_LIB}") +message("DB_Lib_INCLUDE_DIRS = ${DB_Lib_INCLUDE_DIRS}") diff --git a/server/internal/src/db/config.json b/server/internal/src/db/config.json new file mode 100644 index 0000000..81007a5 --- /dev/null +++ b/server/internal/src/db/config.json @@ -0,0 +1,7 @@ +{ + "dbname": "mydb", + "user": "postgres", + "password": "root", + "hostaddr": "127.0.0.1", + "port": "5432" +} diff --git a/server/internal/src/db/include/conn.hpp b/server/internal/src/db/include/conn.hpp new file mode 100644 index 0000000..1468361 --- /dev/null +++ b/server/internal/src/db/include/conn.hpp @@ -0,0 +1,22 @@ +#ifndef SOURCEDOUT_CONN_HPP +#define SOURCEDOUT_CONN_HPP + +#include +#include +#include + +using json = nlohmann::json; + +struct conn { + std::string dbname; + std::string user; + std::string password; + std::string hostaddr; + std::string port; + + conn(); + + [[nodiscard]] std::string getData() const; +}; + +#endif //SOURCEDOUT_CONN_HPP diff --git a/server/internal/src/db/src/conn.cpp b/server/internal/src/db/src/conn.cpp new file mode 100644 index 0000000..9fe5074 --- /dev/null +++ b/server/internal/src/db/src/conn.cpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include "conn.hpp" +#include +conn::conn() { + std::ifstream f("../config.json"); + json data = json::parse(R"( +{ + "dbname": "mydb", + "user": "postgres", + "password": "root", + "hostaddr": "172.28.224.1", + "port": "5432" +} +)"); + data.at("dbname").get_to(dbname); + data.at("user").get_to(user); + data.at("password").get_to(password); + data.at("hostaddr").get_to(hostaddr); + data.at("port").get_to(port); +} + +std::string conn::getData() const { + return "dbname = " + dbname + " user = " + user + " password = " + password + + " hostaddr = " + hostaddr + " port = " + port; +} \ No newline at end of file diff --git a/server/internal/tasks/Task.hpp b/server/internal/tasks/Task.hpp new file mode 100644 index 0000000..a9832ec --- /dev/null +++ b/server/internal/tasks/Task.hpp @@ -0,0 +1,21 @@ +#ifndef SOURCEDOUT_TASK_HPP +#define SOURCEDOUT_TASK_HPP +#include +#include +class Task{ +private: + size_t id; + std::string description; + +public: + Task(size_t id, std::string description); + + explicit Task(std::string description); + + [[nodiscard]] size_t getId() const; + + [[nodiscard]] const std::string &getDescription() const; + + void setDescription(const std::string &description); +}; +#endif //SOURCEDOUT_TASK_HPP diff --git a/server/internal/tasks/include/TaskRepository.hpp b/server/internal/tasks/include/TaskRepository.hpp new file mode 100644 index 0000000..342f64b --- /dev/null +++ b/server/internal/tasks/include/TaskRepository.hpp @@ -0,0 +1,27 @@ +#ifndef SOURCEDOUT_TASKREPOSITORY_HPP +#define SOURCEDOUT_TASKREPOSITORY_HPP + +#include +#include +#include "ITaskRepository.hpp" +#include "pqxx/pqxx" + +using namespace pqxx; + +class TaskRepository : ITaskRepository { +public: + Task getTaskById(size_t id) override; + + void updateTask(Task task) override; + + void storeTask(Task task) override; + + void deleteTask(Task task) override; + + void deleteTaskById(size_t task_id) override; + +private: + static Task makeTask(const result::const_iterator &c); +}; + +#endif //SOURCEDOUT_TASKREPOSITORY_HPP diff --git a/server/internal/tasks/src/Task.cpp b/server/internal/tasks/src/Task.cpp new file mode 100644 index 0000000..03629d8 --- /dev/null +++ b/server/internal/tasks/src/Task.cpp @@ -0,0 +1,21 @@ +#pragma once + +#include "../Task.hpp" +#include +#include + +unsigned long Task::getId() const { + return id; +} + +Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} + +Task::Task(std::string description) : id(0), description(std::move(description)) {} + +const std::string &Task::getDescription() const { + return description; +} + +void Task::setDescription(const std::string &description_) { + Task::description = description_; +} diff --git a/server/internal/tasks/src/TaskRepository.cpp b/server/internal/tasks/src/TaskRepository.cpp new file mode 100644 index 0000000..655dd04 --- /dev/null +++ b/server/internal/tasks/src/TaskRepository.cpp @@ -0,0 +1,106 @@ +#pragma once +#include +#include +#include "../Task.hpp" +#include +#include "TaskRepository.hpp" + +Task TaskRepository::getTaskById(size_t id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeTask(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void TaskRepository::updateTask(Task task) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("UPDATE tasks SET description = %s ;") % task.getDescription()).str(); + work w(c); + w.exec(sql); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void TaskRepository::storeTask(Task task) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO tasks (description) " \ + "VALUES (%s); ") % task.getDescription()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void TaskRepository::deleteTask(Task task) { + deleteTaskById(task.getId()); +} + +void TaskRepository::deleteTaskById(size_t task_id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +Task TaskRepository::makeTask(const result::const_iterator &c) { + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("description")).as()}; +} \ No newline at end of file diff --git a/server/internal/tasks/virtual/ITaskRepository.hpp b/server/internal/tasks/virtual/ITaskRepository.hpp new file mode 100644 index 0000000..c788f94 --- /dev/null +++ b/server/internal/tasks/virtual/ITaskRepository.hpp @@ -0,0 +1,19 @@ +#ifndef SOURCEDOUT_ITASKREPOSITORY_HPP +#define SOURCEDOUT_ITASKREPOSITORY_HPP + +#include +#include "../Task.hpp" + +class ITaskRepository { + virtual Task getTaskById(size_t id) = 0; + + virtual void updateTask(Task task) = 0; + + virtual void storeTask(Task task) = 0; + + virtual void deleteTask(Task task) = 0; + + virtual void deleteTaskById(size_t task_id) = 0; +}; + +#endif //SOURCEDOUT_ITASKREPOSITORY_HPP diff --git a/server/internal/users/User.hpp b/server/internal/users/User.hpp new file mode 100644 index 0000000..b4dba92 --- /dev/null +++ b/server/internal/users/User.hpp @@ -0,0 +1,35 @@ +#ifndef SOURCEDOUT_USER_HPP + +#include +#include + +#define SOURCEDOUT_USER_HPP + +class User { +private: + size_t id; + std::string login; + std::string password; + std::string username; + +public: + User(size_t id_, std::string login_, std::string password_, std::string username_); + + User(std::string login_, std::string password_, std::string username_); + + [[nodiscard]] const std::string &getLogin() const; + + void setLogin(const std::string &login); + + [[nodiscard]] const std::string &getPassword() const; + + void setPassword(const std::string &password); + + [[nodiscard]] const std::string &getUsername() const; + + void setUsername(const std::string &username); + + [[nodiscard]] size_t getId() const; +}; + +#endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/users/include/UserRepository.hpp b/server/internal/users/include/UserRepository.hpp new file mode 100644 index 0000000..3851cd7 --- /dev/null +++ b/server/internal/users/include/UserRepository.hpp @@ -0,0 +1,35 @@ +#ifndef SOURCEDOUT_USERREPOSITORY_HPP +#define SOURCEDOUT_USERREPOSITORY_HPP + +#include +#include "IUserRepository.hpp" +#include "../User.hpp" +#include +#include +#include +#include "conn.hpp" +using namespace pqxx; + +class UserRepository : IUserRepository { +public: + explicit UserRepository(conn connect); + + User getUserById(size_t id) override; + + User getUserByLogin(std::string login) override; + + size_t makeUser(User user) override; + + void deleteUser(User user) override; + + void deleteByUserId(size_t user_id) override; + + std::vector getAllUsers() override; + + +private: + static User makeUser(const result::const_iterator& c); + conn conn_; +}; + +#endif //SOURCEDOUT_USERREPOSITORY_HPP diff --git a/server/internal/users/src/User.cpp b/server/internal/users/src/User.cpp new file mode 100644 index 0000000..e32d7ae --- /dev/null +++ b/server/internal/users/src/User.cpp @@ -0,0 +1,37 @@ +#include +#include "../User.hpp" + +User::User(size_t id_, std::string login_, std::string password_, std::string username_) : + id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} +User::User(std::string login_, std::string password_, std::string username_) : +id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} + +const std::string &User::getLogin() const { + return login; +} + +void User::setLogin(const std::string &login_) { + User::login = login_; +} + +const std::string &User::getPassword() const { + return password; +} + +void User::setPassword(const std::string &password_) { + User::password = password_; +} + +const std::string &User::getUsername() const { + return username; +} + +void User::setUsername(const std::string &username_) { + User::username = username_; +} + +size_t User::getId() const { + return id; +} diff --git a/server/internal/users/src/UserRepository.cpp b/server/internal/users/src/UserRepository.cpp new file mode 100644 index 0000000..6b3207b --- /dev/null +++ b/server/internal/users/src/UserRepository.cpp @@ -0,0 +1,145 @@ +#pragma once + +#include +#include +#include "../User.hpp" +#include "UserRepository.hpp" +#include +#include + +User UserRepository::getUserById(size_t id) { + try { + connection c(conn_.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeUser(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +User UserRepository::getUserByLogin(std::string login) { + try { + connection c(conn_.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("SELECT * FROM Users WHERE login= '%s'")% login).str(); + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + return makeUser(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +size_t UserRepository::makeUser(User user) { + try { + connection c(conn_.getData()); + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = (boost::format("INSERT INTO users (login,password,username) " \ + "VALUES ('%s', '%s', '%s'); ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); + work w(c); + w.exec(sql); + w.commit(); + log << "OK" << std::endl; + log.close(); + + c.close(); + + return getUserByLogin(user.getLogin()).getId(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void UserRepository::deleteByUserId(size_t user_id) { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); + work w(c); + w.commit(); + log << "OK" << std::endl; + log.close(); + c.close(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + + +void UserRepository::deleteUser(User user) { + deleteByUserId(user.getId()); +} + +std::vector UserRepository::getAllUsers() { + try { + connection c; + std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); + if (c.is_open()) { + log << "Opened database successfully: " << c.dbname() << std::endl; + } else { + log << "Can't open database" << std::endl; + std::cerr << "Can't open database" << std::endl; + } + std::string sql = "SELECT * FROM Users"; + nontransaction n(c); + result r(n.exec(sql)); + log << "OK" << std::endl; + log.close(); + c.close(); + std::vector users; + for (result::const_iterator k = r.begin(); k != r.end(); ++k) + users.push_back(makeUser(k)); + return users; + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +User UserRepository::makeUser(const result::const_iterator &c) { + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("login")).as(), + c.at(c.column_number("password")).as(), + c.at(c.column_number("username")).as()}; +} + +UserRepository::UserRepository(conn connect) { + conn_ = std::move(connect); +} diff --git a/server/internal/users/virtual/IUserRepository.hpp b/server/internal/users/virtual/IUserRepository.hpp new file mode 100644 index 0000000..8f41eb3 --- /dev/null +++ b/server/internal/users/virtual/IUserRepository.hpp @@ -0,0 +1,22 @@ +#ifndef SOURCEDOUT_IUSERREPOSITORY_HPP +#define SOURCEDOUT_IUSERREPOSITORY_HPP + +#include +#include "../User.hpp" +class IUserRepository { +public: + virtual User getUserById(size_t id) = 0; + + virtual User getUserByLogin(std::string login) = 0; + + virtual size_t makeUser(User user) = 0; + + virtual void deleteUser(User user) = 0; + + virtual void deleteByUserId(size_t user_id) = 0; + + virtual std::vector getAllUsers() = 0; + +}; + +#endif //SOURCEDOUT_IUSERREPOSITORY_HPP -- GitLab From 18cb05a3c4350dd84f757a18a8c54319e5067009 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 1 May 2023 13:20:36 +0300 Subject: [PATCH 006/134] modify architecture --- .gitignore | 2 ++ .../users/tests => client}/CMakeLists.txt | 0 server/CMakeLists.txt | 14 ++++++++ server/cmd/main.cpp | 2 +- server/conanfile.txt | 10 ++++++ server/internal/CMakeLists.txt | 13 ++++--- .../internal/dbManager/include/dbManager.hpp | 14 ++++++++ server/internal/dbManager/src/dbManager.cpp | 5 +++ .../include}/Solution.hpp | 0 .../{tasks => entities/include}/Task.hpp | 0 .../{users => entities/include}/User.hpp | 0 .../{solutions => entities}/src/Solution.cpp | 2 +- .../internal/{tasks => entities}/src/Task.cpp | 2 +- .../internal/{users => entities}/src/User.cpp | 2 +- server/internal/entities/tests/CMakeLists.txt | 0 server/internal/repository/CMakeLists.txt | 34 +++++++++++++++++++ .../include/SolutionRepository.hpp | 3 +- .../include/TaskRepository.hpp | 2 +- .../include/UserRepository.hpp | 3 +- .../src/SolutionRepository.cpp | 2 +- .../src/TaskRepository.cpp | 2 +- .../src/UserRepository.cpp | 2 +- .../internal/repository/tests/CMakeLists.txt | 0 .../virtual/ISolutionRepository.hpp | 2 +- .../virtual/ITaskRepository.hpp | 2 +- .../virtual/IUserRepository.hpp | 2 +- server/internal/solutions/CMakeLists.txt | 20 ----------- server/internal/tasks/CMakeLists.txt | 20 ----------- server/internal/users/CMakeLists.txt | 28 --------------- 29 files changed, 101 insertions(+), 87 deletions(-) rename {server/internal/users/tests => client}/CMakeLists.txt (100%) create mode 100644 server/CMakeLists.txt create mode 100644 server/conanfile.txt create mode 100644 server/internal/dbManager/include/dbManager.hpp create mode 100644 server/internal/dbManager/src/dbManager.cpp rename server/internal/{solutions => entities/include}/Solution.hpp (100%) rename server/internal/{tasks => entities/include}/Task.hpp (100%) rename server/internal/{users => entities/include}/User.hpp (100%) rename server/internal/{solutions => entities}/src/Solution.cpp (98%) rename server/internal/{tasks => entities}/src/Task.cpp (93%) rename server/internal/{users => entities}/src/User.cpp (96%) create mode 100644 server/internal/entities/tests/CMakeLists.txt create mode 100644 server/internal/repository/CMakeLists.txt rename server/internal/{solutions => repository}/include/SolutionRepository.hpp (94%) rename server/internal/{tasks => repository}/include/TaskRepository.hpp (92%) rename server/internal/{users => repository}/include/UserRepository.hpp (92%) rename server/internal/{solutions => repository}/src/SolutionRepository.cpp (99%) rename server/internal/{tasks => repository}/src/TaskRepository.cpp (99%) rename server/internal/{users => repository}/src/UserRepository.cpp (99%) create mode 100644 server/internal/repository/tests/CMakeLists.txt rename server/internal/{solutions => repository}/virtual/ISolutionRepository.hpp (93%) rename server/internal/{tasks => repository}/virtual/ITaskRepository.hpp (90%) rename server/internal/{users => repository}/virtual/IUserRepository.hpp (91%) delete mode 100644 server/internal/solutions/CMakeLists.txt delete mode 100644 server/internal/tasks/CMakeLists.txt delete mode 100644 server/internal/users/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 29e77ea..ff16b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /cmake-build-debug/ /build/ .idea +server/build/ +log.txt CMakeUserPresets.json diff --git a/server/internal/users/tests/CMakeLists.txt b/client/CMakeLists.txt similarity index 100% rename from server/internal/users/tests/CMakeLists.txt rename to client/CMakeLists.txt diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..83d384f --- /dev/null +++ b/server/CMakeLists.txt @@ -0,0 +1,14 @@ +set(CMAKE_CXX_STANDARD 20) +cmake_minimum_required(VERSION 3.19) +set(CMAKE_PREFIX_PATH build) +project(SourcedOut CXX) +find_package(antlr4-runtime REQUIRED) +find_package(Boost 1.8.1 REQUIRED) +find_package(libpqxx REQUIRED) +find_package(GTest REQUIRED) +find_package(nlohmann_json REQUIRED) +message(STATUS ${nlohmann_json_LIBRARIES}) +add_subdirectory(internal) +add_subdirectory(cmd) +#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics +#target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} nlohmann_json::nlohmann_json) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 83f740d..e494b5e 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,6 +1,6 @@ -#include "../internal/users/include/UserRepository.hpp" +#include "../internal/repository/include/UserRepository.hpp" int main(){ User user{"qwerty200468@gmail.com", "123", "tolik"}; diff --git a/server/conanfile.txt b/server/conanfile.txt new file mode 100644 index 0000000..e4b350b --- /dev/null +++ b/server/conanfile.txt @@ -0,0 +1,10 @@ +[requires] +boost/1.81.0 +antlr4-cppruntime/4.12.0 +libpqxx/7.7.5 +gtest/cci.20210126 +nlohmann_json/3.11.2 + +[generators] +CMakeDeps +CMakeToolchain \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index d990989..87ba964 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -1,11 +1,14 @@ set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.19) add_subdirectory(src) -add_subdirectory(users) -add_subdirectory(solutions) -add_subdirectory(tasks) -set(libusers_LIB ${libusers_LIB} PARENT_SCOPE) -set(libusers_INCLUDE_DIRS ${libusers_INCLUDE_DIRS} PARENT_SCOPE) +add_subdirectory(entities) +add_subdirectory(repository) +add_subdirectory(dbManager) +set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) +set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + +set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) +set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp new file mode 100644 index 0000000..78bcc74 --- /dev/null +++ b/server/internal/dbManager/include/dbManager.hpp @@ -0,0 +1,14 @@ +// +// Created by qwert on 01.05.2023. +// + +#ifndef SOURCEDOUT_DBMANAGER_HPP +#define SOURCEDOUT_DBMANAGER_HPP + + +class dbManager { + +}; + + +#endif //SOURCEDOUT_DBMANAGER_HPP diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp new file mode 100644 index 0000000..a778fc7 --- /dev/null +++ b/server/internal/dbManager/src/dbManager.cpp @@ -0,0 +1,5 @@ +// +// Created by qwert on 01.05.2023. +// + +#include "../include/dbManager.hpp" diff --git a/server/internal/solutions/Solution.hpp b/server/internal/entities/include/Solution.hpp similarity index 100% rename from server/internal/solutions/Solution.hpp rename to server/internal/entities/include/Solution.hpp diff --git a/server/internal/tasks/Task.hpp b/server/internal/entities/include/Task.hpp similarity index 100% rename from server/internal/tasks/Task.hpp rename to server/internal/entities/include/Task.hpp diff --git a/server/internal/users/User.hpp b/server/internal/entities/include/User.hpp similarity index 100% rename from server/internal/users/User.hpp rename to server/internal/entities/include/User.hpp diff --git a/server/internal/solutions/src/Solution.cpp b/server/internal/entities/src/Solution.cpp similarity index 98% rename from server/internal/solutions/src/Solution.cpp rename to server/internal/entities/src/Solution.cpp index db3b2b9..dd8a542 100644 --- a/server/internal/solutions/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -1,7 +1,7 @@ #include #include -#include "../Solution.hpp" +#include "../include/Solution.hpp" Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, std::string source, std::string tokens, diff --git a/server/internal/tasks/src/Task.cpp b/server/internal/entities/src/Task.cpp similarity index 93% rename from server/internal/tasks/src/Task.cpp rename to server/internal/entities/src/Task.cpp index 03629d8..99e0fe6 100644 --- a/server/internal/tasks/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -1,6 +1,6 @@ #pragma once -#include "../Task.hpp" +#include "../include/Task.hpp" #include #include diff --git a/server/internal/users/src/User.cpp b/server/internal/entities/src/User.cpp similarity index 96% rename from server/internal/users/src/User.cpp rename to server/internal/entities/src/User.cpp index e32d7ae..d1ade4b 100644 --- a/server/internal/users/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -1,5 +1,5 @@ #include -#include "../User.hpp" +#include "../include/User.hpp" User::User(size_t id_, std::string login_, std::string password_, std::string username_) : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { diff --git a/server/internal/entities/tests/CMakeLists.txt b/server/internal/entities/tests/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt new file mode 100644 index 0000000..c51edf2 --- /dev/null +++ b/server/internal/repository/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.19) + +project("RepositoryLib") + +set(LIB_NAME libRepository) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +message("SOURCES = ${SOURCES}") +message("HEADERS = ${HEADERS}") + + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB}) + +set(libRepository_LIB ${LIB_NAME}) +set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) +set(libRepository_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) + +message(Entities_LIB = "${libEntities_LIB}") +message("libRepository_LIB = ${libRepository_LIB}") +message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/solutions/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp similarity index 94% rename from server/internal/solutions/include/SolutionRepository.hpp rename to server/internal/repository/include/SolutionRepository.hpp index 4856b6d..2642624 100644 --- a/server/internal/solutions/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -5,7 +5,8 @@ #include #include #include -#include "ISolutionRepository.hpp" +#include "../virtual/ISolutionRepository.hpp" + using namespace pqxx; class SolutionRepository : ISolutionRepository { diff --git a/server/internal/tasks/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp similarity index 92% rename from server/internal/tasks/include/TaskRepository.hpp rename to server/internal/repository/include/TaskRepository.hpp index 342f64b..551efbe 100644 --- a/server/internal/tasks/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -3,7 +3,7 @@ #include #include -#include "ITaskRepository.hpp" +#include "../virtual/ITaskRepository.hpp" #include "pqxx/pqxx" using namespace pqxx; diff --git a/server/internal/users/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp similarity index 92% rename from server/internal/users/include/UserRepository.hpp rename to server/internal/repository/include/UserRepository.hpp index 3851cd7..335dbd0 100644 --- a/server/internal/users/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -2,8 +2,7 @@ #define SOURCEDOUT_USERREPOSITORY_HPP #include -#include "IUserRepository.hpp" -#include "../User.hpp" +#include "../virtual/IUserRepository.hpp" #include #include #include diff --git a/server/internal/solutions/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp similarity index 99% rename from server/internal/solutions/src/SolutionRepository.cpp rename to server/internal/repository/src/SolutionRepository.cpp index fdb9d3c..05e200f 100644 --- a/server/internal/solutions/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "../Solution.hpp" +#include "Solution.hpp" #include "SolutionRepository.hpp" using namespace pqxx; diff --git a/server/internal/tasks/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp similarity index 99% rename from server/internal/tasks/src/TaskRepository.cpp rename to server/internal/repository/src/TaskRepository.cpp index 655dd04..a90b3b6 100644 --- a/server/internal/tasks/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,7 +1,7 @@ #pragma once #include #include -#include "../Task.hpp" +#include "Task.hpp" #include #include "TaskRepository.hpp" diff --git a/server/internal/users/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp similarity index 99% rename from server/internal/users/src/UserRepository.cpp rename to server/internal/repository/src/UserRepository.cpp index 6b3207b..835402f 100644 --- a/server/internal/users/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -2,7 +2,7 @@ #include #include -#include "../User.hpp" +#include "User.hpp" #include "UserRepository.hpp" #include #include diff --git a/server/internal/repository/tests/CMakeLists.txt b/server/internal/repository/tests/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/internal/solutions/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp similarity index 93% rename from server/internal/solutions/virtual/ISolutionRepository.hpp rename to server/internal/repository/virtual/ISolutionRepository.hpp index 902d0d5..c64a1b6 100644 --- a/server/internal/solutions/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -3,7 +3,7 @@ #include #include -#include "../Solution.hpp" +#include "../../entities/include/Solution.hpp" class ISolutionRepository { virtual Solution getSolutionById(size_t id) = 0; diff --git a/server/internal/tasks/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp similarity index 90% rename from server/internal/tasks/virtual/ITaskRepository.hpp rename to server/internal/repository/virtual/ITaskRepository.hpp index c788f94..26d32d2 100644 --- a/server/internal/tasks/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -2,7 +2,7 @@ #define SOURCEDOUT_ITASKREPOSITORY_HPP #include -#include "../Task.hpp" +#include "../../entities/include/Task.hpp" class ITaskRepository { virtual Task getTaskById(size_t id) = 0; diff --git a/server/internal/users/virtual/IUserRepository.hpp b/server/internal/repository/virtual/IUserRepository.hpp similarity index 91% rename from server/internal/users/virtual/IUserRepository.hpp rename to server/internal/repository/virtual/IUserRepository.hpp index 8f41eb3..8b3f7ab 100644 --- a/server/internal/users/virtual/IUserRepository.hpp +++ b/server/internal/repository/virtual/IUserRepository.hpp @@ -2,7 +2,7 @@ #define SOURCEDOUT_IUSERREPOSITORY_HPP #include -#include "../User.hpp" +#include "../../entities/include/User.hpp" class IUserRepository { public: virtual User getUserById(size_t id) = 0; diff --git a/server/internal/solutions/CMakeLists.txt b/server/internal/solutions/CMakeLists.txt deleted file mode 100644 index 48709e6..0000000 --- a/server/internal/solutions/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) -project(solutions) - -set(LIB_NAME libsolutions) - -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) - -message("SOURCES = ${SOURCES}") -message("HEADERS = ${HEADERS}") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ --Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES}) \ No newline at end of file diff --git a/server/internal/tasks/CMakeLists.txt b/server/internal/tasks/CMakeLists.txt deleted file mode 100644 index b118f3d..0000000 --- a/server/internal/tasks/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) -project(tasks) - -set(LIB_NAME libtasks) - -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) - -message("SOURCES = ${SOURCES}") -message("HEADERS = ${HEADERS}") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ --Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES}) \ No newline at end of file diff --git a/server/internal/users/CMakeLists.txt b/server/internal/users/CMakeLists.txt deleted file mode 100644 index 168866a..0000000 --- a/server/internal/users/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) -project(users) - -set(LIB_NAME libusers) - -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) - -message("SOURCES = ${SOURCES}") -message("HEADERS = ${HEADERS}") - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ --Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${DB_Lib_LIB}) - -set(libusers_LIB ${LIB_NAME}) -set(libusers_LIB ${libusers_LIB} PARENT_SCOPE) -set(libusers_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) -set(libusers_INCLUDE_DIRS ${libusers_INCLUDE_DIRS} PARENT_SCOPE) - -enable_testing() -add_subdirectory(tests) \ No newline at end of file -- GitLab From dd5c97d633da95609e2950a47492ccae2af5a536 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 15:16:13 +0300 Subject: [PATCH 007/134] add minimal ci --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7a67001 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: Cpp + +on: + push: + branches: [ "dev", "main" ] + pull_request: + branches: [ "dev", "main" ] + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Installing + run: | + sudo apt update + git clone https://github.com/google/googletest.git -b release-1.11.0 + cd googletest + mkdir build + cd build + cmake .. -DBUILD_GMOCK=OFF + make + sudo make install + cd ../.. + - name: Building + run: | + mkdir build + cd build + cmake .. + make + # - name: Testing + # run: | + # ./build/tests/test_parser + linters: + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v3 + - name: Installing + run: | + sudo apt update + sudo apt install cppcheck + pip install cpplint + - name: Cppcheck + run: | + cppcheck --language=c++ ./src/main.cpp + - name: Cpplint + run: | + cpplint --filter=-legal/copyright,-readability/casting,-whitespace/tab,-build/include_subdir --linelength=110 ./src/main.cpp \ No newline at end of file diff --git a/.gitignore b/.gitignore index 29e77ea..870ca9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /cmake-build-debug/ /build/ +.vscode .idea CMakeUserPresets.json -- GitLab From 00a32a991a414ce6ec5360c3b00f29621a517f63 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 16:07:35 +0300 Subject: [PATCH 008/134] add boost to ci --- .github/workflows/ci.yml | 7 +++++++ CMakeLists.txt | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a67001..2e069cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: - name: Installing run: | sudo apt update + wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz + tar xvf boost_1_82_0.tar.gz + cd boost_1_82_0 + ./bootstrap.sh --prefix=/usr/ + sudo ./b2 install + cd .. + git clone https://github.com/google/googletest.git -b release-1.11.0 cd googletest mkdir build diff --git a/CMakeLists.txt b/CMakeLists.txt index bdb1810..41ba7c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ set(CMAKE_CXX_STANDARD 17) -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.7) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) -find_package(antlr4-runtime REQUIRED) +# find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) -find_package(libpqxx REQUIRED) +# find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) message(STATUS ${Boost_LIBRARIES}) add_executable(${PROJECT_NAME} src/main.cpp) -- GitLab From f580b22dff342375f22ff610912e262ec91d5c12 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 1 May 2023 16:18:48 +0300 Subject: [PATCH 009/134] add dbManager --- .env | 1 + log.txt | 8 ++ server/CMakeLists.txt | 1 + server/cmd/.env | 1 + server/cmd/CMakeLists.txt | 2 +- server/cmd/main.cpp | 13 ++- server/internal/CMakeLists.txt | 8 +- server/internal/dbManager/CMakeLists.txt | 32 ++++++ .../dbManager/include/dbConnection.hpp | 26 +++++ .../internal/dbManager/include/dbManager.hpp | 26 +++-- .../internal/dbManager/src/dbConnection.cpp | 20 ++++ server/internal/dbManager/src/dbManager.cpp | 48 ++++++++- server/internal/entities/CMakeLists.txt | 33 +++++++ server/internal/entities/include/User.hpp | 2 + server/internal/entities/src/User.cpp | 6 ++ server/internal/repository/CMakeLists.txt | 5 +- .../repository/include/SolutionRepository.hpp | 2 + .../repository/include/TaskRepository.hpp | 2 + .../repository/include/UserRepository.hpp | 6 +- .../repository/src/SolutionRepository.cpp | 99 +++++-------------- .../repository/src/TaskRepository.cpp | 67 +++---------- .../repository/src/UserRepository.cpp | 85 ++++------------ .../internal/users/tests/users_repo_test.cpp | 0 23 files changed, 273 insertions(+), 220 deletions(-) create mode 100644 server/internal/dbManager/CMakeLists.txt create mode 100644 server/internal/dbManager/include/dbConnection.hpp create mode 100644 server/internal/dbManager/src/dbConnection.cpp create mode 100644 server/internal/entities/CMakeLists.txt delete mode 100644 server/internal/users/tests/users_repo_test.cpp diff --git a/.env b/.env index 0804779..3281990 100644 --- a/.env +++ b/.env @@ -3,3 +3,4 @@ PGPORT=5432 PGDATABASE=mydb PGUSER=postgres PGPASSWORD=root +POOLSIZE=10 \ No newline at end of file diff --git a/log.txt b/log.txt index 836dc35..d72fd29 100644 --- a/log.txt +++ b/log.txt @@ -11,3 +11,11 @@ OK Opened database successfully: mydb OK Opened database successfully: mydb +Opened database successfully: mydb +OK +Opened database successfully: mydb +OK +Opened database successfully: mydb +OK +Opened database successfully: mydb +OK diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 83d384f..e7bc4e0 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -10,5 +10,6 @@ find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) add_subdirectory(internal) add_subdirectory(cmd) +#add_subdirectory(cpp-dotenv) #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics #target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} nlohmann_json::nlohmann_json) diff --git a/server/cmd/.env b/server/cmd/.env index 0804779..7cac90d 100644 --- a/server/cmd/.env +++ b/server/cmd/.env @@ -3,3 +3,4 @@ PGPORT=5432 PGDATABASE=mydb PGUSER=postgres PGPASSWORD=root +POOL_SIZE=10 \ No newline at end of file diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index 4829fdd..7b7c468 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -8,7 +8,7 @@ project(${PROJECT_NAME}) add_executable(Server main.cpp) message(STATUS ${libusers}) -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} ${libusers_LIB}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libRepository_LIB}) target_include_directories(Server PUBLIC ${libusers_INCLUDE_DIRS}) message("Built server") diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index e494b5e..177490d 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,11 +1,10 @@ +//#include "dotenv.h" +#include "UserRepository.hpp" +#include "User.hpp" - -#include "../internal/repository/include/UserRepository.hpp" - +//using namespace dotenv; int main(){ User user{"qwerty200468@gmail.com", "123", "tolik"}; - conn conn; - UserRepository repo(conn); - std::cout< +//#include "dotenv.h" +//using namespace dotenv; +class dbConnection { +public: + dbConnection(); + [[nodiscard]] std::shared_ptr connection() const; +private: + void establish_connection(); + + std::string m_dbhost = "localhost"; + int m_dbport = 5432; + std::string m_dbname = "demo"; + std::string m_dbuser = "postgres"; + std::string m_dbpass = "postgres"; + + std::shared_ptr m_connection; + +}; + + +#endif //SOURCEDOUT_DBCONNECTION_HPP diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp index 78bcc74..deeeba2 100644 --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -1,13 +1,27 @@ -// -// Created by qwert on 01.05.2023. -// - #ifndef SOURCEDOUT_DBMANAGER_HPP #define SOURCEDOUT_DBMANAGER_HPP - +#include +#include +#include +#include +#include +#include +#include +#include +//#include "dotenv.h" +//using namespace dotenv; class dbManager { - +public: + dbManager(); + std::shared_ptr connection(); + void freeConnection(const std::shared_ptr&); +private: + const int POOL_SIZE = 10; + std::condition_variable m_condition; + void createPool(); + std::queue> connection_pool; + std::mutex m_mutex; }; diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp new file mode 100644 index 0000000..6ad134a --- /dev/null +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -0,0 +1,20 @@ +// +// Created by qwert on 01.05.2023. +// + +#include +#include "../include/dbConnection.hpp" + +dbConnection::dbConnection() { + +} + +std::shared_ptr dbConnection::connection() const { + return m_connection; +} + +void dbConnection::establish_connection() { + pqxx::connection c( "dbname =mydb" "user = postgres password =root hostaddr =172.28.224.1 port = 5432"); + m_connection.reset(&c); + +} diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index a778fc7..1c4f71f 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -1,5 +1,45 @@ -// -// Created by qwert on 01.05.2023. -// -#include "../include/dbManager.hpp" +#include "dbManager.hpp" + + +dbManager::dbManager() { + createPool(); +} + +void dbManager::createPool() { + std::lock_guard locker_(m_mutex); + + for (auto i = 0; i < POOL_SIZE; i++) { + connection_pool.emplace(std::make_shared( + "dbname =mydb user = postgres password =root hostaddr =172.28.224.1 port = 5432")); + } +} + +std::shared_ptr dbManager::connection() { + std::unique_lock lock_(m_mutex); + + // if pool is empty, then wait until it notifies back + while (connection_pool.empty()) { + m_condition.wait(lock_); + } + + // get new connection in queue + auto conn_ = connection_pool.front(); + // immediately pop as we will use it now + connection_pool.pop(); + + return conn_; +} + +void dbManager::freeConnection(const std::shared_ptr &conn_) { + std::unique_lock lock_(m_mutex); + + // push a new connection into a pool + connection_pool.push(conn_); + + // unlock mutex + lock_.unlock(); + + // notify one of thread that is waiting + m_condition.notify_one(); +} diff --git a/server/internal/entities/CMakeLists.txt b/server/internal/entities/CMakeLists.txt new file mode 100644 index 0000000..08858c7 --- /dev/null +++ b/server/internal/entities/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.19) + +project("EntitiesLib") + +set(LIB_NAME libEntities) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +message("SOURCES = ${SOURCES}") +message("HEADERS = ${HEADERS}") + + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +#target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} nlohmann_json::nlohmann_json) + +set(libEntities_LIB ${LIB_NAME}) +set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) +set(libEntities_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + +message("libEntities_LIB = ${libEntities_LIB}") +message("libEntities_INCLUDE_DIRS = ${libEntities_INCLUDE_DIRS}") + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index b4dba92..23a2f13 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -30,6 +30,8 @@ public: void setUsername(const std::string &username); [[nodiscard]] size_t getId() const; + + friend std::ostream &operator<<(std::ostream &os, const User &user); }; #endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index d1ade4b..c048f8f 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -35,3 +35,9 @@ void User::setUsername(const std::string &username_) { size_t User::getId() const { return id; } + +std::ostream &operator<<(std::ostream &os, const User &user) { + os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " + << user.username; + return os; +} diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index c51edf2..c3eeeee 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -19,14 +19,17 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB}) +target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) set(libRepository_LIB ${LIB_NAME}) set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) + set(libRepository_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) + message(Entities_LIB = "${libEntities_LIB}") +message(dbManager = "${libDbManager_LIB}") message("libRepository_LIB = ${libRepository_LIB}") message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 2642624..04034d5 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -6,6 +6,7 @@ #include #include #include "../virtual/ISolutionRepository.hpp" +#include "dbManager.hpp" using namespace pqxx; @@ -26,6 +27,7 @@ class SolutionRepository : ISolutionRepository { private: static Solution makeSolution(const result::const_iterator& c); + std::shared_ptr manager; }; #endif //SOURCEDOUT_SOLUTIONREPOSITORY_HPP diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 551efbe..793ea2f 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -5,6 +5,7 @@ #include #include "../virtual/ITaskRepository.hpp" #include "pqxx/pqxx" +#include "dbManager.hpp" using namespace pqxx; @@ -22,6 +23,7 @@ public: private: static Task makeTask(const result::const_iterator &c); + std::shared_ptr manager; }; #endif //SOURCEDOUT_TASKREPOSITORY_HPP diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index 335dbd0..a8bd86d 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -3,15 +3,15 @@ #include #include "../virtual/IUserRepository.hpp" +#include "dbManager.hpp" #include #include #include -#include "conn.hpp" using namespace pqxx; class UserRepository : IUserRepository { public: - explicit UserRepository(conn connect); + explicit UserRepository(); User getUserById(size_t id) override; @@ -28,7 +28,7 @@ public: private: static User makeUser(const result::const_iterator& c); - conn conn_; + std::shared_ptr manager; }; #endif //SOURCEDOUT_USERREPOSITORY_HPP diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 05e200f..4e21f05 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -1,29 +1,17 @@ -#pragma once - #include #include #include -#include #include "Solution.hpp" #include "SolutionRepository.hpp" using namespace pqxx; Solution SolutionRepository::getSolutionById(size_t id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); return makeSolution(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -33,21 +21,12 @@ Solution SolutionRepository::getSolutionById(size_t id) { std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); std::vector solutions; + manager->freeConnection(c); for(result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; @@ -59,21 +38,12 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); std::vector solutions; + manager->freeConnection(c); for(result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; @@ -85,22 +55,14 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) void SolutionRepository::storeSolution(Solution solution) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); + std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ - "VALUES (%s, %s, %s, %s, %s, %s, %s); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); - work w(c); + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s'); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + work w(*c); w.exec(sql); w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -109,21 +71,13 @@ void SolutionRepository::storeSolution(Solution solution) { void SolutionRepository::updateSolution(Solution solution) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("UPDATE solutions SET send_date = %s, sender_id = %s, source = %s, task_id = %s, result = %s, tokens = %s, astTree = %s ;") + auto c = manager->connection(); + + std::string sql = (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s', task_id = '%s', result = '%s', tokens = '%s', astTree = '%s';") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); - work w(c); + work w(*c); w.exec(sql); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -132,20 +86,11 @@ void SolutionRepository::updateSolution(Solution solution) { void SolutionRepository::deleteSolutionById(size_t id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); - work w(c); + work w(*c); w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index a90b3b6..58725b5 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,4 +1,4 @@ -#pragma once + #include #include #include "Task.hpp" @@ -7,20 +7,11 @@ Task TaskRepository::getTaskById(size_t id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); return makeTask(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -30,20 +21,11 @@ Task TaskRepository::getTaskById(size_t id) { void TaskRepository::updateTask(Task task) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = (boost::format("UPDATE tasks SET description = %s ;") % task.getDescription()).str(); - work w(c); + auto c = manager->connection(); + std::string sql = (boost::format("UPDATE tasks SET description = '%s' ;") % task.getDescription()).str(); + work w(*c); w.exec(sql); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -52,22 +34,13 @@ void TaskRepository::updateTask(Task task) { void TaskRepository::storeTask(Task task) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO tasks (description) " \ - "VALUES (%s); ") % task.getDescription()).str(); - work w(c); + "VALUES ('%s'); ") % task.getDescription()).str(); + work w(*c); w.exec(sql); w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -80,20 +53,10 @@ void TaskRepository::deleteTask(Task task) { void TaskRepository::deleteTaskById(size_t task_id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } - std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); - work w(c); + auto c = manager->connection(); + work w(*c); w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 835402f..b496286 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -1,28 +1,17 @@ -#pragma once #include -#include #include "User.hpp" #include "UserRepository.hpp" +#include "dbManager.hpp" #include -#include User UserRepository::getUserById(size_t id) { try { - connection c(conn_.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -32,20 +21,11 @@ User UserRepository::getUserById(size_t id) { User UserRepository::getUserByLogin(std::string login) { try { - connection c(conn_.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = (boost::format("SELECT * FROM Users WHERE login= '%s'")% login).str(); - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -55,23 +35,14 @@ User UserRepository::getUserByLogin(std::string login) { size_t UserRepository::makeUser(User user) { try { - connection c(conn_.getData()); - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); + std::string sql = (boost::format("INSERT INTO users (login,password,username) " \ "VALUES ('%s', '%s', '%s'); ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); - work w(c); + work w(*c); w.exec(sql); w.commit(); - log << "OK" << std::endl; - log.close(); - - c.close(); + manager->freeConnection(c); return getUserByLogin(user.getLogin()).getId(); } catch (const std::exception &e) { @@ -82,20 +53,11 @@ size_t UserRepository::makeUser(User user) { void UserRepository::deleteByUserId(size_t user_id) { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); - work w(c); + work w(*c); w.commit(); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -109,20 +71,11 @@ void UserRepository::deleteUser(User user) { std::vector UserRepository::getAllUsers() { try { - connection c; - std::ofstream log("log.txt", std::ios_base::out | std::ios_base::app); - if (c.is_open()) { - log << "Opened database successfully: " << c.dbname() << std::endl; - } else { - log << "Can't open database" << std::endl; - std::cerr << "Can't open database" << std::endl; - } + auto c = manager->connection(); std::string sql = "SELECT * FROM Users"; - nontransaction n(c); + nontransaction n(*c); result r(n.exec(sql)); - log << "OK" << std::endl; - log.close(); - c.close(); + manager->freeConnection(c); std::vector users; for (result::const_iterator k = r.begin(); k != r.end(); ++k) users.push_back(makeUser(k)); @@ -140,6 +93,6 @@ User UserRepository::makeUser(const result::const_iterator &c) { c.at(c.column_number("username")).as()}; } -UserRepository::UserRepository(conn connect) { - conn_ = std::move(connect); +UserRepository::UserRepository() { + manager = std::make_shared(); } diff --git a/server/internal/users/tests/users_repo_test.cpp b/server/internal/users/tests/users_repo_test.cpp deleted file mode 100644 index e69de29..0000000 -- GitLab From 5027b34d192fb5391b62ff105590b158081fb837 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 16:47:26 +0300 Subject: [PATCH 010/134] init service --- .gitignore | 1 + server/internal/CMakeLists.txt | 4 ++++ server/internal/service/CMakeLists.txt | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 server/internal/service/CMakeLists.txt diff --git a/.gitignore b/.gitignore index ff16b4f..341fd67 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /cmake-build-debug/ /build/ .idea +.vscode server/build/ log.txt CMakeUserPresets.json diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index 87ba964..4d65978 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -1,9 +1,13 @@ set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.19) + add_subdirectory(src) add_subdirectory(entities) add_subdirectory(repository) add_subdirectory(dbManager) +add_subdirectory(service) + + set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt new file mode 100644 index 0000000..969968e --- /dev/null +++ b/server/internal/service/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.19) + +project("ServiceLib") + +file(GLOB SOURCES ./src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include /home/denis/2023_1_DDT/antlr/virtual) + + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES}) + +# target_link_libraries(${LIB_NAME}) + +set(SERVICE_LIBRARY ${PROJECT_NAME} PARENT_SCOPE) +set(SERVICE_INCLUDE_DIRS ${INCLUDE_DIRS} PARENT_SCOPE) + + +enable_testing() +add_subdirectory(tests) \ No newline at end of file -- GitLab From a3fecdaadf6293e166032ed8671a70af76c934b6 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 18:25:08 +0300 Subject: [PATCH 011/134] create docker container --- .github/workflows/ci.yml | 26 +-- Dockerfile | 28 +++ src/main.cpp | 477 +++++++++++++++++---------------------- 3 files changed, 240 insertions(+), 291 deletions(-) create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e069cd..3859e29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,26 +13,9 @@ defaults: jobs: build: runs-on: ubuntu-latest + container: raiden454/sourced-out steps: - uses: actions/checkout@v3 - - name: Installing - run: | - sudo apt update - wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz - tar xvf boost_1_82_0.tar.gz - cd boost_1_82_0 - ./bootstrap.sh --prefix=/usr/ - sudo ./b2 install - cd .. - - git clone https://github.com/google/googletest.git -b release-1.11.0 - cd googletest - mkdir build - cd build - cmake .. -DBUILD_GMOCK=OFF - make - sudo make install - cd ../.. - name: Building run: | mkdir build @@ -44,14 +27,9 @@ jobs: # ./build/tests/test_parser linters: runs-on: ubuntu-latest + container: raiden454/sourced-out needs: [build] steps: - - uses: actions/checkout@v3 - - name: Installing - run: | - sudo apt update - sudo apt install cppcheck - pip install cpplint - name: Cppcheck run: | cppcheck --language=c++ ./src/main.cpp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cdea2e8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:20.04 AS base + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt update -y +RUN apt install -y gcc +RUN apt install -y libpqxx-dev +RUN apt install -y clang-tidy +RUN apt install -y python3-pip +RUN apt install -y cppcheck +RUN apt install -y cmake +RUN apt install -y libboost-all-dev +RUN apt install -y git +RUN apt-get update -y +RUN apt install -y xvfb +RUN pip install gcovr +RUN pip install cpplint + +RUN git clone https://github.com/google/googletest.git -b release-1.11.0 +WORKDIR googletest/build +RUN cmake .. -DBUILD_GMOCK=OFF +RUN make +RUN make install + +WORKDIR /project + +COPY . . \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a222488..cbd2bd5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,8 @@ +#include #include #include #include -#include #include #include #include @@ -10,312 +10,255 @@ #include #include -namespace beast = boost::beast; // from -namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = boost::asio::ip::tcp; // from +namespace beast = boost::beast; // from +namespace http = beast::http; // from +namespace net = boost::asio; // from +using tcp = boost::asio::ip::tcp; // from //------------------------------------------------------------------------------ // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) -{ - using beast::iequals; - auto const ext = [&path] - { - auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; - return path.substr(pos); - }(); - if(iequals(ext, ".htm")) return "text/html"; - if(iequals(ext, ".html")) return "text/html"; - if(iequals(ext, ".php")) return "text/html"; - if(iequals(ext, ".css")) return "text/css"; - if(iequals(ext, ".txt")) return "text/plain"; - if(iequals(ext, ".js")) return "application/javascript"; - if(iequals(ext, ".json")) return "application/json"; - if(iequals(ext, ".xml")) return "application/xml"; - if(iequals(ext, ".swf")) return "application/x-shockwave-flash"; - if(iequals(ext, ".flv")) return "video/x-flv"; - if(iequals(ext, ".png")) return "image/png"; - if(iequals(ext, ".jpe")) return "image/jpeg"; - if(iequals(ext, ".jpeg")) return "image/jpeg"; - if(iequals(ext, ".jpg")) return "image/jpeg"; - if(iequals(ext, ".gif")) return "image/gif"; - if(iequals(ext, ".bmp")) return "image/bmp"; - if(iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; - if(iequals(ext, ".tiff")) return "image/tiff"; - if(iequals(ext, ".tif")) return "image/tiff"; - if(iequals(ext, ".svg")) return "image/svg+xml"; - if(iequals(ext, ".svgz")) return "image/svg+xml"; - return "application/text"; +beast::string_view mime_type(beast::string_view path) { + using beast::iequals; + auto const ext = [&path] { + auto const pos = path.rfind("."); + if (pos == beast::string_view::npos) return beast::string_view{}; + return path.substr(pos); + }(); + if (iequals(ext, ".htm")) return "text/html"; + if (iequals(ext, ".html")) return "text/html"; + if (iequals(ext, ".php")) return "text/html"; + if (iequals(ext, ".css")) return "text/css"; + if (iequals(ext, ".txt")) return "text/plain"; + if (iequals(ext, ".js")) return "application/javascript"; + if (iequals(ext, ".json")) return "application/json"; + if (iequals(ext, ".xml")) return "application/xml"; + if (iequals(ext, ".swf")) return "application/x-shockwave-flash"; + if (iequals(ext, ".flv")) return "video/x-flv"; + if (iequals(ext, ".png")) return "image/png"; + if (iequals(ext, ".jpe")) return "image/jpeg"; + if (iequals(ext, ".jpeg")) return "image/jpeg"; + if (iequals(ext, ".jpg")) return "image/jpeg"; + if (iequals(ext, ".gif")) return "image/gif"; + if (iequals(ext, ".bmp")) return "image/bmp"; + if (iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; + if (iequals(ext, ".tiff")) return "image/tiff"; + if (iequals(ext, ".tif")) return "image/tiff"; + if (iequals(ext, ".svg")) return "image/svg+xml"; + if (iequals(ext, ".svgz")) return "image/svg+xml"; + return "application/text"; } // Append an HTTP rel-path to a local filesystem path. // The returned path is normalized for the platform. -std::string -path_cat( - beast::string_view base, - beast::string_view path) -{ - if (base.empty()) - return std::string(path); - std::string result(base); +std::string path_cat(beast::string_view base, beast::string_view path) { + if (base.empty()) return std::string(path); + std::string result(base); #ifdef BOOST_MSVC - char constexpr path_separator = '\\'; - if(result.back() == path_separator) - result.resize(result.size() - 1); - result.append(path.data(), path.size()); - for(auto& c : result) - if(c == '/') - c = path_separator; + char constexpr path_separator = '\\'; + if (result.back() == path_separator) result.resize(result.size() - 1); + result.append(path.data(), path.size()); + for (auto& c : result) + if (c == '/') c = path_separator; #else - char constexpr path_separator = '/'; - if(result.back() == path_separator) - result.resize(result.size() - 1); - result.append(path.data(), path.size()); + char constexpr path_separator = '/'; + if (result.back() == path_separator) result.resize(result.size() - 1); + result.append(path.data(), path.size()); #endif - return result; + return result; } // This function produces an HTTP response for the given // request. The type of the response object depends on the // contents of the request, so the interface requires the // caller to pass a generic lambda for receiving the response. -template< - class Body, class Allocator, - class Send> -void -handle_request( - beast::string_view doc_root, - http::request>&& req, - Send&& send) -{ - // Returns a bad request response - auto const bad_request = - [&req](beast::string_view why) - { - http::response res{http::status::bad_request, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - // Returns a not found response - auto const not_found = - [&req](beast::string_view target) - { - http::response res{http::status::not_found, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "The resource '" + std::string(target) + "' was not found."; - res.prepare_payload(); - return res; - }; - - // Returns a server error response - auto const server_error = - [&req](beast::string_view what) - { - http::response res{http::status::internal_server_error, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "An error occurred: '" + std::string(what) + "'"; - res.prepare_payload(); - return res; - }; - - // Make sure we can handle the method - if( req.method() != http::verb::get && - req.method() != http::verb::head) - return send(bad_request("Unknown HTTP-method")); - - // Request path must be absolute and not contain "..". - if( req.target().empty() || - req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) - return send(bad_request("Illegal request-target")); - - // Build the path to the requested file - std::string path = path_cat(doc_root, req.target()); - if(req.target().back() == '/') - path.append("index.html"); - - // Attempt to open the file - beast::error_code ec; - http::file_body::value_type body; - body.open(path.c_str(), beast::file_mode::scan, ec); - - // Handle the case where the file doesn't exist - if(ec == beast::errc::no_such_file_or_directory) - return send(not_found(req.target())); - - // Handle an unknown error - if(ec) - return send(server_error(ec.message())); - - // Cache the size since we need it after the move - auto const size = body.size(); - - // Respond to HEAD request - if(req.method() == http::verb::head) - { - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); - } - - // Respond to GET request - http::response res{ - std::piecewise_construct, - std::make_tuple(std::move(body)), - std::make_tuple(http::status::ok, req.version())}; +template +void handle_request(beast::string_view doc_root, + http::request>&& req, + Send&& send) { + // Returns a bad request response + auto const bad_request = [&req](beast::string_view why) { + http::response res{http::status::bad_request, + req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; + }; + + // Returns a not found response + auto const not_found = [&req](beast::string_view target) { + http::response res{http::status::not_found, + req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = "The resource '" + std::string(target) + "' was not found."; + res.prepare_payload(); + return res; + }; + + // Returns a server error response + auto const server_error = [&req](beast::string_view what) { + http::response res{http::status::internal_server_error, + req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = "An error occurred: '" + std::string(what) + "'"; + res.prepare_payload(); + return res; + }; + + // Make sure we can handle the method + if (req.method() != http::verb::get && req.method() != http::verb::head) + return send(bad_request("Unknown HTTP-method")); + + // Request path must be absolute and not contain "..". + if (req.target().empty() || req.target()[0] != '/' || + req.target().find("..") != beast::string_view::npos) + return send(bad_request("Illegal request-target")); + + // Build the path to the requested file + std::string path = path_cat(doc_root, req.target()); + if (req.target().back() == '/') path.append("index.html"); + + // Attempt to open the file + beast::error_code ec; + http::file_body::value_type body; + body.open(path.c_str(), beast::file_mode::scan, ec); + + // Handle the case where the file doesn't exist + if (ec == beast::errc::no_such_file_or_directory) + return send(not_found(req.target())); + + // Handle an unknown error + if (ec) return send(server_error(ec.message())); + + // Cache the size since we need it after the move + auto const size = body.size(); + + // Respond to HEAD request + if (req.method() == http::verb::head) { + http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, mime_type(path)); res.content_length(size); res.keep_alive(req.keep_alive()); return send(std::move(res)); + } + + // Respond to GET request + http::response res{ + std::piecewise_construct, std::make_tuple(std::move(body)), + std::make_tuple(http::status::ok, req.version())}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, mime_type(path)); + res.content_length(size); + res.keep_alive(req.keep_alive()); + return send(std::move(res)); } //------------------------------------------------------------------------------ // Report a failure -void -fail(beast::error_code ec, char const* what) -{ - std::cerr << what << ": " << ec.message() << "\n"; +void fail(beast::error_code ec, char const* what) { + std::cerr << what << ": " << ec.message() << "\n"; } // This is the C++11 equivalent of a generic lambda. // The function object is used to send an HTTP message. -template -struct send_lambda -{ - Stream& stream_; - bool& close_; - beast::error_code& ec_; - - explicit - send_lambda( - Stream& stream, - bool& close, - beast::error_code& ec) - : stream_(stream) - , close_(close) - , ec_(ec) - { - } - - template - void - operator()(http::message&& msg) const - { - // Determine if we should close the connection after - close_ = msg.need_eof(); - - // We need the serializer here because the serializer requires - // a non-const file_body, and the message oriented version of - // http::write only works with const messages. - http::serializer sr{msg}; - http::write(stream_, sr, ec_); - } +template +struct send_lambda { + Stream& stream_; + bool& close_; + beast::error_code& ec_; + + explicit send_lambda(Stream& stream, bool& close, beast::error_code& ec) + : stream_(stream), close_(close), ec_(ec) {} + + template + void operator()(http::message&& msg) const { + // Determine if we should close the connection after + close_ = msg.need_eof(); + + // We need the serializer here because the serializer requires + // a non-const file_body, and the message oriented version of + // http::write only works with const messages. + http::serializer sr{msg}; + http::write(stream_, sr, ec_); + } }; // Handles an HTTP server connection -void -do_session( - tcp::socket& socket, - std::shared_ptr const& doc_root) -{ - bool close = false; - beast::error_code ec; - - // This buffer is required to persist across reads - beast::flat_buffer buffer; - - // This lambda is used to send messages - send_lambda lambda{socket, close, ec}; - - for(;;) - { - // Read a request - http::request req; - http::read(socket, buffer, req, ec); - if(ec == http::error::end_of_stream) - break; - if(ec) - return fail(ec, "read"); - - // Send the response - handle_request(*doc_root, std::move(req), lambda); - if(ec) - return fail(ec, "write"); - if(close) - { - // This means we should close the connection, usually because - // the response indicated the "Connection: close" semantic. - break; - } +void do_session(tcp::socket& socket, + std::shared_ptr const& doc_root) { + bool close = false; + beast::error_code ec; + + // This buffer is required to persist across reads + beast::flat_buffer buffer; + + // This lambda is used to send messages + send_lambda lambda{socket, close, ec}; + + for (;;) { + // Read a request + http::request req; + http::read(socket, buffer, req, ec); + if (ec == http::error::end_of_stream) break; + if (ec) return fail(ec, "read"); + + // Send the response + handle_request(*doc_root, std::move(req), lambda); + if (ec) return fail(ec, "write"); + if (close) { + // This means we should close the connection, usually because + // the response indicated the "Connection: close" semantic. + break; } + } - // Send a TCP shutdown - socket.shutdown(tcp::socket::shutdown_send, ec); + // Send a TCP shutdown + socket.shutdown(tcp::socket::shutdown_send, ec); - // At this point the connection is closed gracefully + // At this point the connection is closed gracefully } //------------------------------------------------------------------------------ -int main(int argc, char* argv[]) -{ - try - { - // Check command line arguments. - if (argc != 4) - { - std::cerr << - "Usage: http-server-sync
\n" << - "Example:\n" << - " http-server-sync 0.0.0.0 8080 .\n"; - return EXIT_FAILURE; - } - auto const address = net::ip::make_address(argv[1]); - auto const port = static_cast(std::atoi(argv[2])); - auto const doc_root = std::make_shared(argv[3]); - - // The io_context is required for all I/O - net::io_context ioc{1}; - - // The acceptor receives incoming connections - tcp::acceptor acceptor{ioc, {address, port}}; - for(;;) - { - // This will receive the new connection - tcp::socket socket{ioc}; - - // Block until we get a connection - acceptor.accept(socket); - - // Launch the session, transferring ownership of the socket - std::thread{std::bind( - &do_session, - std::move(socket), - doc_root)}.detach(); - } +int main(int argc, char* argv[]) { + try { + // Check command line arguments. + if (argc != 4) { + std::cerr << "Usage: http-server-sync
\n" + << "Example:\n" + << " http-server-sync 0.0.0.0 8080 .\n"; + return EXIT_FAILURE; } - catch (const std::exception& e) - { - std::cerr << "Error: " << e.what() << std::endl; - return EXIT_FAILURE; + auto const address = net::ip::make_address(argv[1]); + auto const port = static_cast(std::atoi(argv[2])); + auto const doc_root = std::make_shared(argv[3]); + + // The io_context is required for all I/O + net::io_context ioc{1}; + + // The acceptor receives incoming connections + tcp::acceptor acceptor{ioc, {address, port}}; + for (;;) { + // This will receive the new connection + tcp::socket socket{ioc}; + + // Block until we get a connection + acceptor.accept(socket); + + // Launch the session, transferring ownership of the socket + std::thread{std::bind(&do_session, std::move(socket), doc_root)}.detach(); } -} \ No newline at end of file + } catch (const std::exception& e) { + std::cerr << "Error: " << e.what() << std::endl; + return EXIT_FAILURE; + } +} -- GitLab From d727decc36204efc32051962c05927944d7f94ee Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 19:23:06 +0300 Subject: [PATCH 012/134] fix boost --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cdea2e8..16fed7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,13 +10,19 @@ RUN apt install -y clang-tidy RUN apt install -y python3-pip RUN apt install -y cppcheck RUN apt install -y cmake -RUN apt install -y libboost-all-dev RUN apt install -y git RUN apt-get update -y RUN apt install -y xvfb RUN pip install gcovr RUN pip install cpplint +RUN apt-get install wget +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz +RUN tar xvf boost_1_82_0.tar.gz +WORKDIR boost_1_82_0 +RUN ./bootstrap.sh --prefix=/usr/ +RUN ./b2 install + RUN git clone https://github.com/google/googletest.git -b release-1.11.0 WORKDIR googletest/build RUN cmake .. -DBUILD_GMOCK=OFF -- GitLab From e5daf13f5a155c26baf722cea52e5db48a365c02 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 19:40:35 +0300 Subject: [PATCH 013/134] add compile flags --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41ba7c6..7efaa4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_CXX_STANDARD 17) -cmake_minimum_required(VERSION 3.7) +cmake_minimum_required(VERSION 3.19) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) @@ -7,6 +7,7 @@ find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) message(STATUS ${Boost_LIBRARIES}) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lboost_system -lboost_thread -lpthread") add_executable(${PROJECT_NAME} src/main.cpp) #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file -- GitLab From bc349bb2464f2fdd0db299ec923b161b30381400 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 20:12:42 +0300 Subject: [PATCH 014/134] change cmakelists --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7efaa4a..5054100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,15 @@ set(CMAKE_CXX_STANDARD 17) -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.16) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) message(STATUS ${Boost_LIBRARIES}) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lboost_system -lboost_thread -lpthread") +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") add_executable(${PROJECT_NAME} src/main.cpp) #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file -- GitLab From 7409880f0e1a665867c9f71efba9e982d7e698d5 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 1 May 2023 21:56:03 +0300 Subject: [PATCH 015/134] fix ci --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3859e29..debe623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,11 +28,11 @@ jobs: linters: runs-on: ubuntu-latest container: raiden454/sourced-out - needs: [build] steps: + - uses: actions/checkout@v3 - name: Cppcheck run: | - cppcheck --language=c++ ./src/main.cpp + cppcheck src --std=c++17 --enable=all - name: Cpplint run: | - cpplint --filter=-legal/copyright,-readability/casting,-whitespace/tab,-build/include_subdir --linelength=110 ./src/main.cpp \ No newline at end of file + cpplint --extensions=cpp,hpp --recursive ./src/* \ No newline at end of file -- GitLab From 484bc172a622d6788f8f446f34d475e8f67bc8a5 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 11:33:20 +0300 Subject: [PATCH 016/134] make service structure --- .github/workflows/ci.yml | 4 ++-- server/CMakeLists.txt | 15 +++++++++---- server/internal/CMakeLists.txt | 5 ++++- server/internal/entities/include/Solution.hpp | 1 + server/internal/entities/include/Task.hpp | 1 + server/internal/entities/include/User.hpp | 1 + .../repository/include/SolutionRepository.hpp | 2 +- .../repository/src/SolutionRepository.cpp | 12 +++++------ .../repository/src/TaskRepository.cpp | 8 +++---- .../repository/src/UserRepository.cpp | 10 ++++----- server/internal/service/CMakeLists.txt | 14 ++++++++----- .../service/include/SolutionService.h | 20 ++++++++++++++++++ server/internal/service/include/TaskService.h | 17 +++++++++++++++ server/internal/service/include/UserService.h | 18 ++++++++++++++++ .../internal/service/include/UserValidator.h | 16 ++++++++++++++ .../internal/service/src/SolutionService.cpp | 21 +++++++++++++++++++ server/internal/service/src/TaskService.cpp | 12 +++++++++++ server/internal/service/src/UserService.cpp | 13 ++++++++++++ server/internal/service/src/UserValidator.cpp | 11 ++++++++++ server/internal/service/tests/CMakeLists.txt | 16 ++++++++++++++ .../service/tests/UserService_test.cpp | 1 + .../service/virtual/ISolutionService.h | 16 ++++++++++++++ .../internal/service/virtual/ITaskService.h | 11 ++++++++++ .../internal/service/virtual/IUserService.h | 13 ++++++++++++ 24 files changed, 230 insertions(+), 28 deletions(-) create mode 100644 server/internal/service/include/SolutionService.h create mode 100644 server/internal/service/include/TaskService.h create mode 100644 server/internal/service/include/UserService.h create mode 100644 server/internal/service/include/UserValidator.h create mode 100644 server/internal/service/src/SolutionService.cpp create mode 100644 server/internal/service/src/TaskService.cpp create mode 100644 server/internal/service/src/UserService.cpp create mode 100644 server/internal/service/src/UserValidator.cpp create mode 100644 server/internal/service/tests/CMakeLists.txt create mode 100644 server/internal/service/tests/UserService_test.cpp create mode 100644 server/internal/service/virtual/ISolutionService.h create mode 100644 server/internal/service/virtual/ITaskService.h create mode 100644 server/internal/service/virtual/IUserService.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index debe623..8c816f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3 - name: Cppcheck run: | - cppcheck src --std=c++17 --enable=all + cppcheck server --std=c++17 --enable=all - name: Cpplint run: | - cpplint --extensions=cpp,hpp --recursive ./src/* \ No newline at end of file + cpplint --extensions=cpp,hpp,h --recursive ./server/* \ No newline at end of file diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 5054100..2b07502 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,15 +1,22 @@ -set(CMAKE_CXX_STANDARD 17) -cmake_minimum_required(VERSION 3.16) +set(CMAKE_CXX_STANDARD 20) +cmake_minimum_required(VERSION 3.19) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) +find_package(nlohmann_json REQUIRED) +message(STATUS ${nlohmann_json_LIBRARIES}) + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) + +add_subdirectory(internal) +add_subdirectory(cmd) + message(STATUS ${Boost_LIBRARIES}) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") -add_executable(${PROJECT_NAME} src/main.cpp) + #add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file +# target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index 4d65978..e1397ef 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -15,4 +15,7 @@ set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) -set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file +set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) + +set(SERVICE_LIB ${SERVICE_lib_LIB} PARENT_SCOPE) +set(SERVICE_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index dcfa255..5c39ef5 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -7,6 +7,7 @@ class Solution { public: + Solution() =default; Solution(size_t id, std::string sendDate, size_t senderId, std::string source, std::string tokens, std::string astTree, size_t taskId, std::string result); diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index a9832ec..af8fad9 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -8,6 +8,7 @@ private: std::string description; public: + Task()=default; Task(size_t id, std::string description); explicit Task(std::string description); diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index b4dba92..20b3f88 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -13,6 +13,7 @@ private: std::string username; public: + User()=default; User(size_t id_, std::string login_, std::string password_, std::string username_); User(std::string login_, std::string password_, std::string username_); diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 2642624..31a1845 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -5,7 +5,7 @@ #include #include #include -#include "../virtual/ISolutionRepository.hpp" +#include "ISolutionRepository.hpp" using namespace pqxx; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 05e200f..215d7ed 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -23,7 +23,7 @@ Solution SolutionRepository::getSolutionById(size_t id) { result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); return makeSolution(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -46,7 +46,7 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); std::vector solutions; for(result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); @@ -72,7 +72,7 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); std::vector solutions; for(result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); @@ -100,7 +100,7 @@ void SolutionRepository::storeSolution(Solution solution) { w.commit(); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -123,7 +123,7 @@ void SolutionRepository::updateSolution(Solution solution) { w.exec(sql); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -145,7 +145,7 @@ void SolutionRepository::deleteSolutionById(size_t id) { w.commit(); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index a90b3b6..98b2007 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -20,7 +20,7 @@ Task TaskRepository::getTaskById(size_t id) { result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); return makeTask(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -43,7 +43,7 @@ void TaskRepository::updateTask(Task task) { w.exec(sql); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -67,7 +67,7 @@ void TaskRepository::storeTask(Task task) { w.commit(); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -93,7 +93,7 @@ void TaskRepository::deleteTaskById(size_t task_id) { w.commit(); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 835402f..fcbe486 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -22,7 +22,7 @@ User UserRepository::getUserById(size_t id) { result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -45,7 +45,7 @@ User UserRepository::getUserByLogin(std::string login) { result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -71,7 +71,7 @@ size_t UserRepository::makeUser(User user) { log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); return getUserByLogin(user.getLogin()).getId(); } catch (const std::exception &e) { @@ -95,7 +95,7 @@ void UserRepository::deleteByUserId(size_t user_id) { w.commit(); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -122,7 +122,7 @@ std::vector UserRepository::getAllUsers() { result r(n.exec(sql)); log << "OK" << std::endl; log.close(); - c.close(); + //c.close(); std::vector users; for (result::const_iterator k = r.begin(); k != r.end(); ++k) users.push_back(makeUser(k)); diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 969968e..31cf7fa 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -2,17 +2,21 @@ cmake_minimum_required(VERSION 3.19) project("ServiceLib") -file(GLOB SOURCES ./src/*.cpp) -file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include /home/denis/2023_1_DDT/antlr/virtual) +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) include_directories(${INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${SOURCES}) -# target_link_libraries(${LIB_NAME}) +message("libRepository_LIB = ${libRepository_LIB}") +message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") -set(SERVICE_LIBRARY ${PROJECT_NAME} PARENT_SCOPE) -set(SERVICE_INCLUDE_DIRS ${INCLUDE_DIRS} PARENT_SCOPE) +# target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${ibEntities_LIB}) + +set(SERVICE_lib_LIBRARY ${PROJECT_NAME} PARENT_SCOPE) +set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS} PARENT_SCOPE) enable_testing() diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h new file mode 100644 index 0000000..5b0a38d --- /dev/null +++ b/server/internal/service/include/SolutionService.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include "ISolutionRepository.h" +#include "ISolutionService.h" + +class SolutionService : ISolutionService { + private: + std::unique_ptr solutionRepo; + // std::unique_ptr antlr + public: + explicit SolutionService(std::unique_ptr solutionRepo); + Solution createSolution(size_t userId, size_t taskId, + std::string source) override; + std::vector getSolutionsByUserAndTaskId(size_t userId, + size_t taskId) override; + void deleteSolutionById(size_t solId) override; + std::pair getMetrics(size_t solId) override; +}; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h new file mode 100644 index 0000000..e03917f --- /dev/null +++ b/server/internal/service/include/TaskService.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +#include "ITaskRepository.h" +#include "ITaskService.h" + +class TaskService : ITaskService { + private: + std::unique_ptr taskRepo; + + public: + explicit TaskService(std::unique_ptr taskRepo); + Task createTask(std::string desc) override; + std::vector getAllTasks(size_t id) override; + void deleteTask(size_t id) override; +}; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h new file mode 100644 index 0000000..b27a645 --- /dev/null +++ b/server/internal/service/include/UserService.h @@ -0,0 +1,18 @@ +#pragma once +#include + +#include "IUserRepository.h" +#include "IUserService.h" +#include "UserValidation.h" + +class UserService : IUserService { + private: + std::unique_ptr userRepo; + + public: + explicit UserService(std::unique_ptr userRepo); + User createUser(std::string login, std::string username, + std::string password) override; + User getUserById(size_t id) override; + void deleteUser(size_t id) override; +}; diff --git a/server/internal/service/include/UserValidator.h b/server/internal/service/include/UserValidator.h new file mode 100644 index 0000000..8a7b155 --- /dev/null +++ b/server/internal/service/include/UserValidator.h @@ -0,0 +1,16 @@ +#pragma once + +#include "User.h" + +class UserValidator { + private: + User user; + bool validateLogin(); + bool validatePassword(); + bool validateUsername(); + + public: + explicit UserValidator(User user); + bool validateUser(); + ~UserValidator(); +}; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp new file mode 100644 index 0000000..bc01136 --- /dev/null +++ b/server/internal/service/src/SolutionService.cpp @@ -0,0 +1,21 @@ +#include "SolutionService.h" + +SolutionService::SolutionService( + std::unique_ptr solutionRepo) + : solutionRepo(std::move(solutionRepo)) {} + +Solution SolutionService::createSolution(size_t userId, size_t taskId, + std::string source) { + return Solution(); +} + +std::vector SolutionService::getSolutionsByUserAndTaskId( + size_t userId, size_t taskId) { + return std::vector(); +} + +SolutionService::deleteSolutionById(size_t solId) {} + +std::pair Solution::getMetrics(size_t solId) { + return std::make_pair("", ""); +} diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp new file mode 100644 index 0000000..3c2b89b --- /dev/null +++ b/server/internal/service/src/TaskService.cpp @@ -0,0 +1,12 @@ +#include "TaskService.h" + +TaskService::TaskService(std::unique_ptr taskRepo) + : taskRepo(std::move(taskRepo)) {} + +Task TaskService::createTask(std::string desc) { return Task(); } + +std::vector TaskService::getAllTasks(size_t id) { + return std::vector(); +} + +void TaskService::deleteTask(size_t id) {} diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp new file mode 100644 index 0000000..8cbd084 --- /dev/null +++ b/server/internal/service/src/UserService.cpp @@ -0,0 +1,13 @@ +#include "UserService.h" + +UserService::UserService(std::unique_ptr userRepo) + : userRepo(std::move(userRepo)) {} + +User UserService::createUser(std::string login, std::string username, + std::string password) { + return User(); +} + +User UserService::getUserById(size_t id) { return User(); } + +void UserService::deleteUser(size_t id) {} diff --git a/server/internal/service/src/UserValidator.cpp b/server/internal/service/src/UserValidator.cpp new file mode 100644 index 0000000..da64212 --- /dev/null +++ b/server/internal/service/src/UserValidator.cpp @@ -0,0 +1,11 @@ +#include "UserValidator.h" + +UserValidator::UserValidator(User user) : user(user) {} + +bool UserValidator::validateUser() { return true; } + +bool UserValidator::validateLogin() { return true; } + +bool UserValidator::validatePassword() { return true; } + +bool UserValidator::validateUsername() { return true; } diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt new file mode 100644 index 0000000..95d96c7 --- /dev/null +++ b/server/internal/service/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.16) +project(test_service) + +set(CMAKE_CXX_STANDARD 20) +add_compile_options(-coverage) + +file(GLOB SOURCES *.cpp) + +enable_testing() +find_package(GTest REQUIRED) + +add_executable(${PROJECT_NAME} ${SOURCES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${SERVICE_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${SERVICE_LIBRARY} GTest::GTest) + +add_test(test_service test_service) \ No newline at end of file diff --git a/server/internal/service/tests/UserService_test.cpp b/server/internal/service/tests/UserService_test.cpp new file mode 100644 index 0000000..7b243ad --- /dev/null +++ b/server/internal/service/tests/UserService_test.cpp @@ -0,0 +1 @@ +#include \ No newline at end of file diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h new file mode 100644 index 0000000..0c37337 --- /dev/null +++ b/server/internal/service/virtual/ISolutionService.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include "Solution.hpp" + +class ISolutionService { + public: + virtual Solution createSolution(size_t userId, size_t taskId, + std::string source) = 0; + virtual std::vector getSolutionByUserAndTaskId(size_t userId, + size_t taskId) = 0; + virtual deleteSolutionById(size_t solId) = 0; + + virtual std::pair getMetrics(size_t solId) = 0; +}; diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h new file mode 100644 index 0000000..2a1029d --- /dev/null +++ b/server/internal/service/virtual/ITaskService.h @@ -0,0 +1,11 @@ +#pragma once +#include "Task.hpp" +#include + + +class ITaskService { + public: + virtual Task createTask(std::string desc) = 0; + virtual std::vector getAllTasks(size_t id) = 0; + virtual void deleteTask(size_t id) = 0; +}; diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h new file mode 100644 index 0000000..1b02932 --- /dev/null +++ b/server/internal/service/virtual/IUserService.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +#include "User.hpp" + +class IUserService { + public: + virtual User createUser(std::string login, std::string username, + std::string password) = 0; + virtual User getUserById(size_t id) = 0; + virtual deleteUser(size_t id) = 0; +}; -- GitLab From 4af898fbc4ab51320fb2628121f90d48f48da85d Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 12:11:11 +0300 Subject: [PATCH 017/134] local bild passed --- server/internal/CMakeLists.txt | 2 +- server/internal/repository/CMakeLists.txt | 6 +++--- server/internal/service/include/SolutionService.h | 2 +- server/internal/service/include/TaskService.h | 2 +- server/internal/service/include/UserService.h | 4 ++-- server/internal/service/include/UserValidator.h | 2 +- server/internal/service/src/SolutionService.cpp | 4 ++-- server/internal/service/tests/UserService_test.cpp | 8 +++++++- server/internal/service/virtual/ISolutionService.h | 7 ++++--- server/internal/service/virtual/IUserService.h | 2 +- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index ff8b7cb..c3d79ef 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -4,8 +4,8 @@ cmake_minimum_required(VERSION 3.19) add_subdirectory(src) add_subdirectory(entities) add_subdirectory(dbManager) -add_subdirectory(service) add_subdirectory(repository) +add_subdirectory(service) set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index c3eeeee..872a4fa 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -5,7 +5,7 @@ project("RepositoryLib") set(LIB_NAME libRepository) file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.hpp) message("SOURCES = ${SOURCES}") message("HEADERS = ${HEADERS}") @@ -18,13 +18,13 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) set(libRepository_LIB ${LIB_NAME}) set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) -set(libRepository_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(libRepository_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 5b0a38d..86e432b 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -2,7 +2,7 @@ #include -#include "ISolutionRepository.h" +#include "ISolutionRepository.hpp" #include "ISolutionService.h" class SolutionService : ISolutionService { diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index e03917f..5723fd0 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -2,7 +2,7 @@ #include -#include "ITaskRepository.h" +#include "ITaskRepository.hpp" #include "ITaskService.h" class TaskService : ITaskService { diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index b27a645..aa0de45 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -1,9 +1,9 @@ #pragma once #include -#include "IUserRepository.h" +#include "IUserRepository.hpp" #include "IUserService.h" -#include "UserValidation.h" +#include "UserValidator.h" class UserService : IUserService { private: diff --git a/server/internal/service/include/UserValidator.h b/server/internal/service/include/UserValidator.h index 8a7b155..77f1a50 100644 --- a/server/internal/service/include/UserValidator.h +++ b/server/internal/service/include/UserValidator.h @@ -1,6 +1,6 @@ #pragma once -#include "User.h" +#include "User.hpp" class UserValidator { private: diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index bc01136..ba707c3 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -14,8 +14,8 @@ std::vector SolutionService::getSolutionsByUserAndTaskId( return std::vector(); } -SolutionService::deleteSolutionById(size_t solId) {} +void SolutionService::deleteSolutionById(size_t solId) {} -std::pair Solution::getMetrics(size_t solId) { +std::pair SolutionService::getMetrics(size_t solId) { return std::make_pair("", ""); } diff --git a/server/internal/service/tests/UserService_test.cpp b/server/internal/service/tests/UserService_test.cpp index 7b243ad..63abcf0 100644 --- a/server/internal/service/tests/UserService_test.cpp +++ b/server/internal/service/tests/UserService_test.cpp @@ -1 +1,7 @@ -#include \ No newline at end of file +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index 0c37337..e7fb0e1 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "Solution.hpp" @@ -8,9 +9,9 @@ class ISolutionService { public: virtual Solution createSolution(size_t userId, size_t taskId, std::string source) = 0; - virtual std::vector getSolutionByUserAndTaskId(size_t userId, - size_t taskId) = 0; - virtual deleteSolutionById(size_t solId) = 0; + virtual std::vector getSolutionsByUserAndTaskId(size_t userId, + size_t taskId) = 0; + virtual void deleteSolutionById(size_t solId) = 0; virtual std::pair getMetrics(size_t solId) = 0; }; diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h index 1b02932..ad74eff 100644 --- a/server/internal/service/virtual/IUserService.h +++ b/server/internal/service/virtual/IUserService.h @@ -9,5 +9,5 @@ class IUserService { virtual User createUser(std::string login, std::string username, std::string password) = 0; virtual User getUserById(size_t id) = 0; - virtual deleteUser(size_t id) = 0; + virtual void deleteUser(size_t id) = 0; }; -- GitLab From 0a2468e4ec4ed89a650ba42c18d5861126c2a11a Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 20:43:00 +0300 Subject: [PATCH 018/134] test init --- server/CMakeLists.txt | 1 + server/internal/entities/include/Task.hpp | 1 + .../repository/include/TaskRepository.hpp | 2 +- .../repository/virtual/ITaskRepository.hpp | 2 + server/internal/service/CMakeLists.txt | 6 ++- server/internal/service/include/TaskService.h | 8 ++-- server/internal/service/src/TaskService.cpp | 8 ++-- server/internal/service/tests/CMakeLists.txt | 6 ++- .../internal/service/tests/Service_test.cpp | 46 +++++++++++++++++++ .../service/tests/UserService_test.cpp | 7 --- .../internal/service/virtual/ITaskService.h | 6 ++- 11 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 server/internal/service/tests/Service_test.cpp delete mode 100644 server/internal/service/tests/UserService_test.cpp diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 52a7e1c..53ca1ea 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -5,6 +5,7 @@ project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) +find_library(PQXX_LIB pqxx) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index af8fad9..6ad362f 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -9,6 +9,7 @@ private: public: Task()=default; + ~Task() = default; Task(size_t id, std::string description); explicit Task(std::string description); diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 793ea2f..6780c36 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -9,7 +9,7 @@ using namespace pqxx; -class TaskRepository : ITaskRepository { +class TaskRepository : public ITaskRepository { public: Task getTaskById(size_t id) override; diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 26d32d2..1ba3292 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -5,6 +5,8 @@ #include "../../entities/include/Task.hpp" class ITaskRepository { + public: + virtual ~ITaskRepository() = default; virtual Task getTaskById(size_t id) = 0; virtual void updateTask(Task task) = 0; diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 31cf7fa..f405d37 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -15,9 +15,11 @@ message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") # target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${ibEntities_LIB}) -set(SERVICE_lib_LIBRARY ${PROJECT_NAME} PARENT_SCOPE) -set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS} PARENT_SCOPE) +set(SERVICE_lib_LIBRARY ${PROJECT_NAME}) +set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) +set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) enable_testing() add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index 5723fd0..bf04d3e 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -5,13 +5,15 @@ #include "ITaskRepository.hpp" #include "ITaskService.h" -class TaskService : ITaskService { +class TaskService : public ITaskService { private: std::unique_ptr taskRepo; public: - explicit TaskService(std::unique_ptr taskRepo); + TaskService(std::unique_ptr taskRepo); + ~TaskService() override = default; Task createTask(std::string desc) override; - std::vector getAllTasks(size_t id) override; + Task getTask(size_t id) override; + std::vector getAllTasks() override; void deleteTask(size_t id) override; }; diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 3c2b89b..92452f3 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -5,8 +5,8 @@ TaskService::TaskService(std::unique_ptr taskRepo) Task TaskService::createTask(std::string desc) { return Task(); } -std::vector TaskService::getAllTasks(size_t id) { - return std::vector(); -} +std::vector TaskService::getAllTasks() { return std::vector(); } -void TaskService::deleteTask(size_t id) {} +Task TaskService::getTask(size_t id) { return taskRepo->getTaskById(id); } + +void TaskService::deleteTask(size_t id) { taskRepo->deleteTaskById(id); } diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt index 95d96c7..1b81101 100644 --- a/server/internal/service/tests/CMakeLists.txt +++ b/server/internal/service/tests/CMakeLists.txt @@ -10,7 +10,9 @@ enable_testing() find_package(GTest REQUIRED) add_executable(${PROJECT_NAME} ${SOURCES}) -target_include_directories(${PROJECT_NAME} PUBLIC ${SERVICE_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${SERVICE_LIBRARY} GTest::GTest) + +target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIBRARY} GTest::GTest gmock pthread) +target_include_directories(${PROJECT_NAME} PUBLIC ${SERVICE_lib_INCLUDE_DIRS}) + add_test(test_service test_service) \ No newline at end of file diff --git a/server/internal/service/tests/Service_test.cpp b/server/internal/service/tests/Service_test.cpp new file mode 100644 index 0000000..2210fd3 --- /dev/null +++ b/server/internal/service/tests/Service_test.cpp @@ -0,0 +1,46 @@ +#include +#include + +#include + +#include "TaskService.h" + +class TaskRepositoryMock : public ITaskRepository { + public: + ~TaskRepositoryMock() override = default; + MOCK_METHOD(Task, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (Task task), (override)); + MOCK_METHOD(void, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); +}; + +struct TaskServiceTest : public testing::Test { + TaskService* ts; + TaskRepositoryMock* mock_ptr; + + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + ts = new TaskService(std::move(mock)); + } + void TearDown() { + delete ts; + } +}; + +TEST_F(TaskServiceTest, GetTask) { + EXPECT_CALL(*mock_ptr, deleteTaskById(1)); + ts->deleteTask(1); +} + +TEST_F(TaskServiceTest, Test) { + int a = 2; + EXPECT_EQ(a, 2); +} + +int main(int argc, char** argv) { + ::testing::InitGoogleMock(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/service/tests/UserService_test.cpp b/server/internal/service/tests/UserService_test.cpp deleted file mode 100644 index 63abcf0..0000000 --- a/server/internal/service/tests/UserService_test.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h index 2a1029d..731fb0f 100644 --- a/server/internal/service/virtual/ITaskService.h +++ b/server/internal/service/virtual/ITaskService.h @@ -1,11 +1,13 @@ #pragma once -#include "Task.hpp" #include +#include "Task.hpp" class ITaskService { public: + virtual ~ITaskService() = default; virtual Task createTask(std::string desc) = 0; - virtual std::vector getAllTasks(size_t id) = 0; + virtual Task getTask(size_t id) = 0; + virtual std::vector getAllTasks() = 0; virtual void deleteTask(size_t id) = 0; }; -- GitLab From f931ae85c2308e47f282abb7839bbe9ebd651c77 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 20:45:53 +0300 Subject: [PATCH 019/134] upd ci --- .github/workflows/ci.yml | 4 +-- Dockerfile | 76 +++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index debe623..16503a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ defaults: jobs: build: runs-on: ubuntu-latest - container: raiden454/sourced-out + container: raiden454/ddt-project steps: - uses: actions/checkout@v3 - name: Building @@ -27,7 +27,7 @@ jobs: # ./build/tests/test_parser linters: runs-on: ubuntu-latest - container: raiden454/sourced-out + container: raiden454/ddt-project steps: - uses: actions/checkout@v3 - name: Cppcheck diff --git a/Dockerfile b/Dockerfile index 16fed7e..fd9957b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,44 @@ -FROM ubuntu:20.04 AS base - -ENV TZ=Europe/Moscow -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN apt update -y -RUN apt install -y gcc -RUN apt install -y libpqxx-dev -RUN apt install -y clang-tidy -RUN apt install -y python3-pip -RUN apt install -y cppcheck -RUN apt install -y cmake -RUN apt install -y git -RUN apt-get update -y -RUN apt install -y xvfb -RUN pip install gcovr -RUN pip install cpplint - -RUN apt-get install wget -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz -RUN tar xvf boost_1_82_0.tar.gz -WORKDIR boost_1_82_0 -RUN ./bootstrap.sh --prefix=/usr/ -RUN ./b2 install - -RUN git clone https://github.com/google/googletest.git -b release-1.11.0 -WORKDIR googletest/build -RUN cmake .. -DBUILD_GMOCK=OFF -RUN make -RUN make install - -WORKDIR /project - +FROM ubuntu:20.04 AS base + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt update -y +RUN apt install -y gcc +RUN apt install -y libpqxx-dev +RUN apt install -y clang-tidy +RUN apt install -y nlohmann-json3-dev +RUN apt install -y python3-pip +RUN apt install -y cppcheck +RUN apt install -y git +RUN apt-get update -y +RUN apt install -y xvfb +RUN pip install gcovr +RUN pip install cpplint + +RUN apt-get install wget +RUN apt-get install libssl-dev + +RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz +RUN tar -zxvf cmake-3.26.3.tar.gz +WORKDIR cmake-3.26.3 +RUN ./bootstrap +RUN make +RUN make install +RUN cd .. + +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz +RUN tar xvf boost_1_82_0.tar.gz +WORKDIR boost_1_82_0 +RUN ./bootstrap.sh --prefix=/usr/ +RUN ./b2 install + +RUN git clone https://github.com/google/googletest.git -b release-1.11.0 +WORKDIR googletest/build +RUN cmake .. -DBUILD_GMOCK=OFF +RUN make +RUN make install + +WORKDIR /project + COPY . . \ No newline at end of file -- GitLab From 33b1a89961a09a850d028333af5e7ae5fc66a52d Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 20:56:44 +0300 Subject: [PATCH 020/134] add my tests to ci --- .github/workflows/ci.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c816f4..455e715 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ defaults: jobs: build: runs-on: ubuntu-latest - container: raiden454/sourced-out + container: raiden454/ddt-project steps: - uses: actions/checkout@v3 - name: Building @@ -22,12 +22,17 @@ jobs: cd build cmake .. make - # - name: Testing - # run: | - # ./build/tests/test_parser + tests: + runs-on: ubuntu-latest + container: raiden454/ddt-project + needs: [build] + steps: + - uses: actions/checkout@v3 + - name: Run-Tests + run: ./build/server/internal/service/tests/test_service linters: runs-on: ubuntu-latest - container: raiden454/sourced-out + container: raiden454/ddt-project steps: - uses: actions/checkout@v3 - name: Cppcheck @@ -35,4 +40,4 @@ jobs: cppcheck server --std=c++17 --enable=all - name: Cpplint run: | - cpplint --extensions=cpp,hpp,h --recursive ./server/* \ No newline at end of file + cpplint --extensions=cpp,hpp,h --recursive ./server/* -- GitLab From 969d4eab39f95d8956dfe78c8bb52a7119c67c6f Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 2 May 2023 23:26:33 +0300 Subject: [PATCH 021/134] add test support to ci --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16503a9..fb53bfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,26 +13,43 @@ defaults: jobs: build: runs-on: ubuntu-latest - container: raiden454/ddt-project + container: raiden454/cpp-app steps: - uses: actions/checkout@v3 + - name: Installing + run: | + apt update + git clone https://github.com/google/googletest.git -b release-1.11.0 + cd googletest + mkdir build + cd build + cmake .. -DBUILD_GMOCK=ON + make + make install + cd ../.. - name: Building run: | mkdir build cd build cmake .. make - # - name: Testing - # run: | - # ./build/tests/test_parser + # tests: + # runs-on: ubuntu-latest + # container: raiden454/cpp-app + # needs: [build] + # steps: + # - uses: actions/checkout@v3 + # - name: Run-Tests + # run: | + # find / -name "test_service" linters: runs-on: ubuntu-latest - container: raiden454/ddt-project + container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - name: Cppcheck run: | - cppcheck src --std=c++17 --enable=all + cppcheck server --std=c++17 --enable=all - name: Cpplint run: | - cpplint --extensions=cpp,hpp --recursive ./src/* \ No newline at end of file + cpplint --extensions=cpp,hpp,h --recursive ./server/* -- GitLab From 10a888a8323d0a7d6377269e8e6b846ca968a8a6 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 3 May 2023 00:49:36 +0300 Subject: [PATCH 022/134] add some test to ci --- .github/workflows/ci.yml | 24 +++--- CMakeLists.txt | 2 +- Dockerfile | 76 +++++++++++-------- server/CMakeLists.txt | 2 - server/cmd/CMakeLists.txt | 4 - server/internal/CMakeLists.txt | 3 - server/internal/dbManager/CMakeLists.txt | 2 - server/internal/entities/CMakeLists.txt | 2 - server/internal/repository/CMakeLists.txt | 2 - .../repository/include/TaskRepository.hpp | 2 +- .../repository/src/TaskRepository.cpp | 3 +- .../repository/virtual/ITaskRepository.hpp | 2 +- server/internal/service/CMakeLists.txt | 2 - server/internal/service/src/TaskService.cpp | 4 +- server/internal/service/tests/CMakeLists.txt | 1 - .../internal/service/tests/Service_test.cpp | 55 +++++++++++--- server/internal/src/CMakeLists.txt | 2 - server/internal/src/db/CMakeLists.txt | 2 - 18 files changed, 112 insertions(+), 78 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 455e715..02e6602 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,26 +13,32 @@ defaults: jobs: build: runs-on: ubuntu-latest - container: raiden454/ddt-project + container: raiden454/cpp-app steps: - uses: actions/checkout@v3 + - name: Installing + run: | + apt update + git clone https://github.com/google/googletest.git -b release-1.11.0 + cd googletest + mkdir build + cd build + cmake .. -DBUILD_GMOCK=ON + make + make install + cd ../.. - name: Building run: | mkdir build cd build cmake .. make - tests: - runs-on: ubuntu-latest - container: raiden454/ddt-project - needs: [build] - steps: - - uses: actions/checkout@v3 - name: Run-Tests - run: ./build/server/internal/service/tests/test_service + run: | + ./build/server/internal/service/tests/test_service linters: runs-on: ubuntu-latest - container: raiden454/ddt-project + container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - name: Cppcheck diff --git a/CMakeLists.txt b/CMakeLists.txt index e51f2bf..41c84fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(SANITIZE_BUILD TRUE CACHE BOOL "build with sanitizers") if(BUILD_DEV) enable_testing() message("Building dev version") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") diff --git a/Dockerfile b/Dockerfile index 16fed7e..fd9957b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,44 @@ -FROM ubuntu:20.04 AS base - -ENV TZ=Europe/Moscow -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN apt update -y -RUN apt install -y gcc -RUN apt install -y libpqxx-dev -RUN apt install -y clang-tidy -RUN apt install -y python3-pip -RUN apt install -y cppcheck -RUN apt install -y cmake -RUN apt install -y git -RUN apt-get update -y -RUN apt install -y xvfb -RUN pip install gcovr -RUN pip install cpplint - -RUN apt-get install wget -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz -RUN tar xvf boost_1_82_0.tar.gz -WORKDIR boost_1_82_0 -RUN ./bootstrap.sh --prefix=/usr/ -RUN ./b2 install - -RUN git clone https://github.com/google/googletest.git -b release-1.11.0 -WORKDIR googletest/build -RUN cmake .. -DBUILD_GMOCK=OFF -RUN make -RUN make install - -WORKDIR /project - +FROM ubuntu:20.04 AS base + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt update -y +RUN apt install -y gcc +RUN apt install -y libpqxx-dev +RUN apt install -y clang-tidy +RUN apt install -y nlohmann-json3-dev +RUN apt install -y python3-pip +RUN apt install -y cppcheck +RUN apt install -y git +RUN apt-get update -y +RUN apt install -y xvfb +RUN pip install gcovr +RUN pip install cpplint + +RUN apt-get install wget +RUN apt-get install libssl-dev + +RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz +RUN tar -zxvf cmake-3.26.3.tar.gz +WORKDIR cmake-3.26.3 +RUN ./bootstrap +RUN make +RUN make install +RUN cd .. + +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz +RUN tar xvf boost_1_82_0.tar.gz +WORKDIR boost_1_82_0 +RUN ./bootstrap.sh --prefix=/usr/ +RUN ./b2 install + +RUN git clone https://github.com/google/googletest.git -b release-1.11.0 +WORKDIR googletest/build +RUN cmake .. -DBUILD_GMOCK=OFF +RUN make +RUN make install + +WORKDIR /project + COPY . . \ No newline at end of file diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 53ca1ea..2e5c3dc 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index 7b7c468..446f2a8 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -1,7 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - -set(CMAKE_CXX_STANDARD 20) - set(PROJECT_NAME "Server") project(${PROJECT_NAME}) diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index c3d79ef..f23cb6b 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -1,6 +1,3 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) - add_subdirectory(src) add_subdirectory(entities) add_subdirectory(dbManager) diff --git a/server/internal/dbManager/CMakeLists.txt b/server/internal/dbManager/CMakeLists.txt index 432484e..3299f96 100644 --- a/server/internal/dbManager/CMakeLists.txt +++ b/server/internal/dbManager/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("DbManagerLib") set(LIB_NAME libDbManager) diff --git a/server/internal/entities/CMakeLists.txt b/server/internal/entities/CMakeLists.txt index 08858c7..7b6ad66 100644 --- a/server/internal/entities/CMakeLists.txt +++ b/server/internal/entities/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("EntitiesLib") set(LIB_NAME libEntities) diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index 872a4fa..67bead1 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("RepositoryLib") set(LIB_NAME libRepository) diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 6780c36..11d2f3e 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -15,7 +15,7 @@ public: void updateTask(Task task) override; - void storeTask(Task task) override; + int storeTask(Task task) override; void deleteTask(Task task) override; diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 58725b5..ea43451 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -32,7 +32,7 @@ void TaskRepository::updateTask(Task task) { } } -void TaskRepository::storeTask(Task task) { +int TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO tasks (description) " \ @@ -45,6 +45,7 @@ void TaskRepository::storeTask(Task task) { std::cerr << e.what() << std::endl; throw e; } + return 0; } void TaskRepository::deleteTask(Task task) { diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 1ba3292..e367c21 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -11,7 +11,7 @@ class ITaskRepository { virtual void updateTask(Task task) = 0; - virtual void storeTask(Task task) = 0; + virtual int storeTask(Task task) = 0; virtual void deleteTask(Task task) = 0; diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index f405d37..1fd20be 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("ServiceLib") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 92452f3..62d43db 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -3,7 +3,9 @@ TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(std::move(taskRepo)) {} -Task TaskService::createTask(std::string desc) { return Task(); } +Task TaskService::createTask(std::string desc) { + return Task(desc); +} std::vector TaskService::getAllTasks() { return std::vector(); } diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt index 1b81101..914089a 100644 --- a/server/internal/service/tests/CMakeLists.txt +++ b/server/internal/service/tests/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.16) project(test_service) set(CMAKE_CXX_STANDARD 20) diff --git a/server/internal/service/tests/Service_test.cpp b/server/internal/service/tests/Service_test.cpp index 2210fd3..f7e26c3 100644 --- a/server/internal/service/tests/Service_test.cpp +++ b/server/internal/service/tests/Service_test.cpp @@ -5,12 +5,22 @@ #include "TaskService.h" +bool operator==(Task p1, Task p2) { return p1.getId() == p2.getId(); } + +class Exception : public std::exception { + std::string _msg; + + public: + Exception(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + class TaskRepositoryMock : public ITaskRepository { public: ~TaskRepositoryMock() override = default; MOCK_METHOD(Task, getTaskById, (size_t id), (override)); MOCK_METHOD(void, updateTask, (Task task), (override)); - MOCK_METHOD(void, storeTask, (Task task), (override)); + MOCK_METHOD(int, storeTask, (Task task), (override)); MOCK_METHOD(void, deleteTask, (Task task), (override)); MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); }; @@ -24,19 +34,46 @@ struct TaskServiceTest : public testing::Test { mock_ptr = mock.get(); ts = new TaskService(std::move(mock)); } - void TearDown() { - delete ts; - } + void TearDown() { delete ts; } }; -TEST_F(TaskServiceTest, GetTask) { - EXPECT_CALL(*mock_ptr, deleteTaskById(1)); +ACTION(MyThrowException) { throw Exception("no user with this id in db"); } + +TEST_F(TaskServiceTest, deleteTaskById) { + EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1); ts->deleteTask(1); } -TEST_F(TaskServiceTest, Test) { - int a = 2; - EXPECT_EQ(a, 2); +TEST_F(TaskServiceTest, deleteTasWithInvalidId) { + EXPECT_CALL(*mock_ptr, deleteTaskById(1)) + .Times(1) + .WillRepeatedly(MyThrowException()); + EXPECT_THROW(ts->deleteTask(1), Exception); +} + +TEST_F(TaskServiceTest, GetTaskById) { + EXPECT_CALL(*mock_ptr, getTaskById(1)) + .Times(1) + .WillOnce(::testing::Return(Task(1, "desription"))); + Task t = ts->getTask(1); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desription"); +} + +TEST_F(TaskServiceTest, CreateTask) { + EXPECT_CALL(*mock_ptr, storeTask(Task("desc"))) + .Times(1) + .WillOnce(::testing::Return(1)); + Task t = ts->createTask("desc"); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desc"); + + EXPECT_CALL(*mock_ptr, storeTask(Task("desc2"))) + .Times(1) + .WillOnce(::testing::Return(2)); + t = ts->createTask("desc2"); + EXPECT_EQ(t.getId(), 2); + EXPECT_EQ(t.getDescription(), "desc2"); } int main(int argc, char** argv) { diff --git a/server/internal/src/CMakeLists.txt b/server/internal/src/CMakeLists.txt index 72e4c50..58510fa 100644 --- a/server/internal/src/CMakeLists.txt +++ b/server/internal/src/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) add_subdirectory(db) set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/server/internal/src/db/CMakeLists.txt b/server/internal/src/db/CMakeLists.txt index df02471..9d4549e 100644 --- a/server/internal/src/db/CMakeLists.txt +++ b/server/internal/src/db/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.10) - project("DBLib") set(LIB_NAME DB_Lib) -- GitLab From 450ee048ac8b18c53a65bcf290f97b0e43bce027 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Wed, 3 May 2023 01:52:19 +0300 Subject: [PATCH 023/134] =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=B0=20=D0=B2=20?= =?UTF-8?q?=D0=B1=D0=B4=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=89=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F=20=D0=B5=D0=B3=D0=BE=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + server/cmd/main.cpp | 2 +- server/internal/entities/include/MetricStat.hpp | 8 ++++++++ server/internal/entities/src/MetricStat.cpp | 3 +++ server/internal/repository/include/MetricRepository.hpp | 8 ++++++++ .../internal/repository/include/SolutionRepository.hpp | 2 +- server/internal/repository/include/TaskRepository.hpp | 2 +- server/internal/repository/src/MetricRepository.cpp | 3 +++ server/internal/repository/src/SolutionRepository.cpp | 8 +++++--- server/internal/repository/src/TaskRepository.cpp | 9 ++++++--- server/internal/repository/src/UserRepository.cpp | 8 ++++---- server/internal/repository/virtual/IMetricRepository.hpp | 8 ++++++++ .../internal/repository/virtual/ISolutionRepository.hpp | 2 +- server/internal/repository/virtual/ITaskRepository.hpp | 2 +- 14 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 server/internal/entities/include/MetricStat.hpp create mode 100644 server/internal/entities/src/MetricStat.cpp create mode 100644 server/internal/repository/include/MetricRepository.hpp create mode 100644 server/internal/repository/src/MetricRepository.cpp create mode 100644 server/internal/repository/virtual/IMetricRepository.hpp diff --git a/.gitignore b/.gitignore index ff16b4f..6e8ea51 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .idea server/build/ log.txt +/server/cpp-dotenv CMakeUserPresets.json diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 177490d..10b8775 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -6,5 +6,5 @@ int main(){ User user{"qwerty200468@gmail.com", "123", "tolik"}; UserRepository repo; - std::cout< getSolutionsByTaskId(size_t task_id) override; - void storeSolution(Solution solution) override; + size_t storeSolution(Solution solution) override; void updateSolution(Solution solution) override; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 793ea2f..7ffae02 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -15,7 +15,7 @@ public: void updateTask(Task task) override; - void storeTask(Task task) override; + size_t storeTask(Task task) override; void deleteTask(Task task) override; diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp new file mode 100644 index 0000000..6427df1 --- /dev/null +++ b/server/internal/repository/src/MetricRepository.cpp @@ -0,0 +1,3 @@ +// +// Created by qwert on 03.05.2023. +// diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 4e21f05..3c7d0cd 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -53,16 +53,17 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) } } -void SolutionRepository::storeSolution(Solution solution) { +size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s'); ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); work w(*c); - w.exec(sql); + row r = (w.exec1(sql)); w.commit(); manager->freeConnection(c); + return r["id"].as(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -89,6 +90,7 @@ void SolutionRepository::deleteSolutionById(size_t id) { auto c = manager->connection(); std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); work w(*c); + w.exec(sql); w.commit(); manager->freeConnection(c); } catch (const std::exception &e) { diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 58725b5..0f06026 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -32,15 +32,16 @@ void TaskRepository::updateTask(Task task) { } } -void TaskRepository::storeTask(Task task) { +size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO tasks (description) " \ - "VALUES ('%s'); ") % task.getDescription()).str(); + "VALUES ('%s') RETURNING id; ") % task.getDescription()).str(); work w(*c); - w.exec(sql); + row r = w.exec1(sql); w.commit(); manager->freeConnection(c); + return r["id"].as(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -54,7 +55,9 @@ void TaskRepository::deleteTask(Task task) { void TaskRepository::deleteTaskById(size_t task_id) { try { auto c = manager->connection(); + std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); work w(*c); + w.exec(sql); w.commit(); manager->freeConnection(c); } catch (const std::exception &e) { diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index b496286..df85bda 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -38,13 +38,12 @@ size_t UserRepository::makeUser(User user) { auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO users (login,password,username) " \ - "VALUES ('%s', '%s', '%s'); ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); + "VALUES ('%s', '%s', '%s') RETURNING id; ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); work w(*c); - w.exec(sql); + row r = w.exec1(sql); w.commit(); manager->freeConnection(c); - - return getUserByLogin(user.getLogin()).getId(); + return r["id"].as(); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; throw e; @@ -56,6 +55,7 @@ void UserRepository::deleteByUserId(size_t user_id) { auto c = manager->connection(); std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); work w(*c); + w.exec(sql); w.commit(); manager->freeConnection(c); } catch (const std::exception &e) { diff --git a/server/internal/repository/virtual/IMetricRepository.hpp b/server/internal/repository/virtual/IMetricRepository.hpp new file mode 100644 index 0000000..2c4fcff --- /dev/null +++ b/server/internal/repository/virtual/IMetricRepository.hpp @@ -0,0 +1,8 @@ +// +// Created by qwert on 03.05.2023. +// + +#ifndef SOURCEDOUT_IMETRICREPOSITORY_HPP +#define SOURCEDOUT_IMETRICREPOSITORY_HPP + +#endif //SOURCEDOUT_IMETRICREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index c64a1b6..236f760 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -12,7 +12,7 @@ class ISolutionRepository { virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; - virtual void storeSolution(Solution solution) = 0; + virtual size_t storeSolution(Solution solution) = 0; virtual void updateSolution(Solution solution) = 0; diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 26d32d2..89962ff 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -9,7 +9,7 @@ class ITaskRepository { virtual void updateTask(Task task) = 0; - virtual void storeTask(Task task) = 0; + virtual size_t storeTask(Task task) = 0; virtual void deleteTask(Task task) = 0; -- GitLab From c6380f400d2ca11b312f42e0e8747783357331c3 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Wed, 3 May 2023 01:55:19 +0300 Subject: [PATCH 024/134] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B4=D0=B8=D1=80=D0=B5=D0=BA=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=B2=20=D0=BB=D0=B8=D0=B1=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/internal/repository/CMakeLists.txt | 2 +- server/internal/repository/include/SolutionRepository.hpp | 2 +- server/internal/repository/include/TaskRepository.hpp | 2 +- server/internal/repository/include/UserRepository.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index c3eeeee..2c08543 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -18,7 +18,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) set(libRepository_LIB ${LIB_NAME}) diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 949edbf..5513cbc 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -5,7 +5,7 @@ #include #include #include -#include "../virtual/ISolutionRepository.hpp" +#include "ISolutionRepository.hpp" #include "dbManager.hpp" using namespace pqxx; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 7ffae02..308a1a6 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -3,7 +3,7 @@ #include #include -#include "../virtual/ITaskRepository.hpp" +#include "ITaskRepository.hpp" #include "pqxx/pqxx" #include "dbManager.hpp" diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index a8bd86d..7a82f82 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -2,7 +2,7 @@ #define SOURCEDOUT_USERREPOSITORY_HPP #include -#include "../virtual/IUserRepository.hpp" +#include "IUserRepository.hpp" #include "dbManager.hpp" #include #include -- GitLab From e242d9883ea39d1d3e301a5db5dc2efc94d0c0bb Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 3 May 2023 10:50:01 +0300 Subject: [PATCH 025/134] add test for user service --- .../repository/virtual/IUserRepository.hpp | 1 + server/internal/service/include/Exeptions.h | 9 ++ server/internal/service/include/UserService.h | 1 + server/internal/service/src/TaskService.cpp | 3 +- server/internal/service/src/UserService.cpp | 12 ++- .../internal/service/tests/Service_test.cpp | 87 ++++++++++++++++++- .../internal/service/virtual/IUserService.h | 1 + 7 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 server/internal/service/include/Exeptions.h diff --git a/server/internal/repository/virtual/IUserRepository.hpp b/server/internal/repository/virtual/IUserRepository.hpp index 8b3f7ab..14d7a50 100644 --- a/server/internal/repository/virtual/IUserRepository.hpp +++ b/server/internal/repository/virtual/IUserRepository.hpp @@ -5,6 +5,7 @@ #include "../../entities/include/User.hpp" class IUserRepository { public: + virtual ~IUserRepository() = default; virtual User getUserById(size_t id) = 0; virtual User getUserByLogin(std::string login) = 0; diff --git a/server/internal/service/include/Exeptions.h b/server/internal/service/include/Exeptions.h new file mode 100644 index 0000000..43925ff --- /dev/null +++ b/server/internal/service/include/Exeptions.h @@ -0,0 +1,9 @@ +#pragma once + +class ValidateExeption : public std::exception { + std::string _msg; + + public: + ValidateExeption(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; \ No newline at end of file diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index aa0de45..719aa02 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -10,6 +10,7 @@ class UserService : IUserService { std::unique_ptr userRepo; public: + ~UserService() override = default; explicit UserService(std::unique_ptr userRepo); User createUser(std::string login, std::string username, std::string password) override; diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 62d43db..a3ce5ef 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -4,7 +4,8 @@ TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(std::move(taskRepo)) {} Task TaskService::createTask(std::string desc) { - return Task(desc); + size_t id = taskRepo->storeTask(Task(desc)); + return Task(id, desc); } std::vector TaskService::getAllTasks() { return std::vector(); } diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index 8cbd084..270f801 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -1,13 +1,19 @@ #include "UserService.h" +#include "Exeptions.h" + UserService::UserService(std::unique_ptr userRepo) : userRepo(std::move(userRepo)) {} User UserService::createUser(std::string login, std::string username, std::string password) { - return User(); + if (login == "") { + throw ValidateExeption("invalid login"); + } + size_t id = userRepo->makeUser(User(login, password, username)); + return User(id, login, password, username); } -User UserService::getUserById(size_t id) { return User(); } +User UserService::getUserById(size_t id) { return userRepo->getUserById(id); } -void UserService::deleteUser(size_t id) {} +void UserService::deleteUser(size_t id) { userRepo->deleteByUserId(id); } diff --git a/server/internal/service/tests/Service_test.cpp b/server/internal/service/tests/Service_test.cpp index f7e26c3..199dfa8 100644 --- a/server/internal/service/tests/Service_test.cpp +++ b/server/internal/service/tests/Service_test.cpp @@ -3,9 +3,11 @@ #include +#include "Exeptions.h" #include "TaskService.h" +#include "UserService.h" -bool operator==(Task p1, Task p2) { return p1.getId() == p2.getId(); } +bool operator==(Task t1, Task t2) { return t1.getId() == t2.getId(); } class Exception : public std::exception { std::string _msg; @@ -37,7 +39,7 @@ struct TaskServiceTest : public testing::Test { void TearDown() { delete ts; } }; -ACTION(MyThrowException) { throw Exception("no user with this id in db"); } +ACTION(NoTaskException) { throw Exception("no task with this id in db"); } TEST_F(TaskServiceTest, deleteTaskById) { EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1); @@ -47,11 +49,11 @@ TEST_F(TaskServiceTest, deleteTaskById) { TEST_F(TaskServiceTest, deleteTasWithInvalidId) { EXPECT_CALL(*mock_ptr, deleteTaskById(1)) .Times(1) - .WillRepeatedly(MyThrowException()); + .WillRepeatedly(NoTaskException()); EXPECT_THROW(ts->deleteTask(1), Exception); } -TEST_F(TaskServiceTest, GetTaskById) { +TEST_F(TaskServiceTest, GetTaskByIdOK) { EXPECT_CALL(*mock_ptr, getTaskById(1)) .Times(1) .WillOnce(::testing::Return(Task(1, "desription"))); @@ -60,6 +62,11 @@ TEST_F(TaskServiceTest, GetTaskById) { EXPECT_EQ(t.getDescription(), "desription"); } +TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { + EXPECT_CALL(*mock_ptr, getTaskById(-1)).Times(1).WillRepeatedly(NoTaskException()); + EXPECT_THROW(ts->getTask(-1), Exception); +} + TEST_F(TaskServiceTest, CreateTask) { EXPECT_CALL(*mock_ptr, storeTask(Task("desc"))) .Times(1) @@ -76,6 +83,78 @@ TEST_F(TaskServiceTest, CreateTask) { EXPECT_EQ(t.getDescription(), "desc2"); } +bool operator==(User u1, User u2) { return u1.getId() == u2.getId(); } + +class UserRepositoryMock : public IUserRepository { + public: + ~UserRepositoryMock() override = default; + MOCK_METHOD(User, getUserById, (size_t id), (override)); + MOCK_METHOD(User, getUserByLogin, (std::string login), (override)); + MOCK_METHOD(size_t, makeUser, (User user), (override)); + MOCK_METHOD(void, deleteUser, (User user), (override)); + MOCK_METHOD(void, deleteByUserId, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllUsers, (), (override)); +}; + +struct UserServiceTest : public testing::Test { + UserService* us; + UserRepositoryMock* mock_ptr; + + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + us = new UserService(std::move(mock)); + } + void TearDown() { delete us; } +}; + +ACTION(NoUserException) { throw Exception("no user with this id in db"); } + +TEST_F(UserServiceTest, deleteUser) { + EXPECT_CALL(*mock_ptr, deleteByUserId(1)).Times(1); + us->deleteUser(1); +} + +TEST_F(UserServiceTest, deleteUserWithInvalidId) { + EXPECT_CALL(*mock_ptr, deleteByUserId(1)) + .Times(1) + .WillRepeatedly(NoUserException()); + EXPECT_THROW(us->deleteUser(1), Exception); +} + +TEST_F(UserServiceTest, getUserOk) { + EXPECT_CALL(*mock_ptr, getUserById(1)) + .Times(1) + .WillOnce(::testing::Return(User(1, "login", "password", "username"))); + User u = us->getUserById(1); + EXPECT_EQ(u.getLogin(), "login"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); +} + +TEST_F(UserServiceTest, getUserEXEPTION) { + EXPECT_CALL(*mock_ptr, getUserById(-1)).Times(1).WillOnce(NoUserException()); + EXPECT_THROW(us->getUserById(-1), Exception); +} + +TEST_F(UserServiceTest, makeUserOk) { + EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) + .Times(1) + .WillOnce(::testing::Return(1)); + User u = us->createUser("login", "username", "password"); + EXPECT_EQ(u.getLogin(), "login"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); +} + +TEST_F(UserServiceTest, makeUserInvalidData) { + EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) + .Times(0); + EXPECT_THROW(us->createUser("", "", ""), ValidateExeption); +} + int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h index ad74eff..06d7972 100644 --- a/server/internal/service/virtual/IUserService.h +++ b/server/internal/service/virtual/IUserService.h @@ -6,6 +6,7 @@ class IUserService { public: + virtual ~IUserService() = default; virtual User createUser(std::string login, std::string username, std::string password) = 0; virtual User getUserById(size_t id) = 0; -- GitLab From 4b10027a3839192a8b4e89f605746a0745c1d591 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Wed, 3 May 2023 12:58:00 +0300 Subject: [PATCH 026/134] added new entity, small refactoring --- .../internal/entities/include/MetricStat.hpp | 52 ++++++++++- server/internal/entities/include/Solution.hpp | 6 ++ server/internal/entities/include/Task.hpp | 6 ++ server/internal/entities/include/User.hpp | 6 ++ server/internal/entities/src/MetricStat.cpp | 71 ++++++++++++++- server/internal/entities/src/Solution.cpp | 11 +++ server/internal/entities/src/Task.cpp | 12 +++ server/internal/entities/src/User.cpp | 12 +++ .../repository/include/MetricRepository.hpp | 29 +++++- .../repository/include/SolutionRepository.hpp | 3 +- .../repository/src/MetricRepository.cpp | 88 ++++++++++++++++++- .../repository/src/SolutionRepository.cpp | 37 ++++---- .../repository/virtual/IMetricRepository.hpp | 21 ++++- 13 files changed, 320 insertions(+), 34 deletions(-) diff --git a/server/internal/entities/include/MetricStat.hpp b/server/internal/entities/include/MetricStat.hpp index 8880d30..69ca521 100644 --- a/server/internal/entities/include/MetricStat.hpp +++ b/server/internal/entities/include/MetricStat.hpp @@ -1,8 +1,52 @@ -// -// Created by qwert on 03.05.2023. -// - #ifndef SOURCEDOUT_METRICSTAT_HPP #define SOURCEDOUT_METRICSTAT_HPP +#include + +class MetricStat { +public: + MetricStat(size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, + float meanRes); + + MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, + float meanRes); + + [[nodiscard]] size_t getId() const; + + void setId(size_t id); + + [[nodiscard]] size_t getSolutionId() const; + + void setSolutionId(size_t solutionId); + + [[nodiscard]] float getTextBasedRes() const; + + void setTextBasedRes(float textBasedRes); + + [[nodiscard]] float getTokenBasedRes() const; + + void setTokenBasedRes(float tokenBasedRes); + + [[nodiscard]] float getTreeBasedRes() const; + + void setTreeBasedRes(float treeBasedRes); + + [[nodiscard]] bool isVerdict() const; + + void setVerdict(bool verdict); + + [[nodiscard]] float getMeanRes() const; + + void setMeanRes(float meanRes); + +private: + size_t id; + size_t solution_id; + float text_based_res; + float token_based_res; + float tree_based_res; + bool verdict; + float mean_res; +}; + #endif //SOURCEDOUT_METRICSTAT_HPP diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index dcfa255..5c3d313 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -41,6 +41,12 @@ public: void setResult(const std::string &result); + void setId(size_t id); + + bool operator==(const Solution &rhs) const; + + bool operator!=(const Solution &rhs) const; + private: size_t id; std::string send_date; diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index a9832ec..99d28e6 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -17,5 +17,11 @@ public: [[nodiscard]] const std::string &getDescription() const; void setDescription(const std::string &description); + + void setId(size_t id); + + bool operator==(const Task &rhs) const; + + bool operator!=(const Task &rhs) const; }; #endif //SOURCEDOUT_TASK_HPP diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index 23a2f13..d593cf9 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -32,6 +32,12 @@ public: [[nodiscard]] size_t getId() const; friend std::ostream &operator<<(std::ostream &os, const User &user); + + void setId(size_t id); + + bool operator==(const User &rhs) const; + + bool operator!=(const User &rhs) const; }; #endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp index 6427df1..268dde6 100644 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -1,3 +1,68 @@ -// -// Created by qwert on 03.05.2023. -// + +#include "MetricStat.hpp" + +MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, + bool verdict, float meanRes) : id(0), solution_id(solutionId), + text_based_res(textBasedRes), token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), verdict(verdict), mean_res(meanRes) {} + +MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, + bool verdict, float meanRes) : id(id), solution_id(solutionId), text_based_res(textBasedRes), + token_based_res(tokenBasedRes), tree_based_res(treeBasedRes), + verdict(verdict), mean_res(meanRes) {} + +size_t MetricStat::getId() const { + return id; +} + +void MetricStat::setId(size_t id_) { + id = id_; +} + +size_t MetricStat::getSolutionId() const { + return solution_id; +} + +void MetricStat::setSolutionId(size_t solutionId) { + solution_id = solutionId; +} + +float MetricStat::getTextBasedRes() const { + return text_based_res; +} + +void MetricStat::setTextBasedRes(float textBasedRes) { + text_based_res = textBasedRes; +} + +float MetricStat::getTokenBasedRes() const { + return token_based_res; +} + +void MetricStat::setTokenBasedRes(float tokenBasedRes) { + token_based_res = tokenBasedRes; +} + +float MetricStat::getTreeBasedRes() const { + return tree_based_res; +} + +void MetricStat::setTreeBasedRes(float treeBasedRes) { + tree_based_res = treeBasedRes; +} + +bool MetricStat::isVerdict() const { + return verdict; +} + +void MetricStat::setVerdict(bool verdict_) { + verdict = verdict_; +} + +float MetricStat::getMeanRes() const { + return mean_res; +} + +void MetricStat::setMeanRes(float meanRes) { + mean_res = meanRes; +} diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index dd8a542..331f7e9 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -15,6 +15,9 @@ size_t Solution::getId() const { return id; } +void Solution::setId(size_t id_) { + id = id_; +} const std::string &Solution::getSendDate() const { return send_date; @@ -71,3 +74,11 @@ const std::string &Solution::getResult() const { void Solution::setResult(const std::string &result_) { Solution::result = result_; } + +bool Solution::operator==(const Solution &rhs) const { + return id == rhs.id; +} + +bool Solution::operator!=(const Solution &rhs) const { + return !(rhs == *this); +} diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index 99e0fe6..56de902 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -16,6 +16,18 @@ const std::string &Task::getDescription() const { return description; } +void Task::setId(size_t id_) { + id = id_; +} + void Task::setDescription(const std::string &description_) { Task::description = description_; } + +bool Task::operator==(const Task &rhs) const { + return id == rhs.id; +} + +bool Task::operator!=(const Task &rhs) const { + return !(rhs == *this); +} diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index c048f8f..b6f54d7 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -12,6 +12,10 @@ const std::string &User::getLogin() const { return login; } +void User::setId(size_t id_) { + id = id_; +} + void User::setLogin(const std::string &login_) { User::login = login_; } @@ -41,3 +45,11 @@ std::ostream &operator<<(std::ostream &os, const User &user) { << user.username; return os; } + +bool User::operator==(const User &rhs) const { + return id == rhs.id; +} + +bool User::operator!=(const User &rhs) const { + return !(rhs == *this); +} diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp index ce611ba..4ece7fe 100644 --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -1,8 +1,29 @@ -// -// Created by qwert on 03.05.2023. -// - #ifndef SOURCEDOUT_METRICREPOSITORY_HPP #define SOURCEDOUT_METRICREPOSITORY_HPP +#include "IMetricRepository.hpp" +#include "dbManager.hpp" +#include + + +using namespace pqxx; + +class MetricRepository : IMetricRepository { +public: + MetricStat getById(size_t id) override; + + size_t storeMetric(MetricStat metric) override; + + void updateMetric(MetricStat metric) override; + + void deleteMetric(MetricStat metric) override; + + void deleteMetricById(size_t id) override; + +private: + std::shared_ptr manager; + + static MetricStat makeMetric(const result::const_iterator &c); +}; + #endif //SOURCEDOUT_METRICREPOSITORY_HPP diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 5513cbc..f0b1c88 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -11,6 +11,7 @@ using namespace pqxx; class SolutionRepository : ISolutionRepository { +public: Solution getSolutionById(size_t id) override; std::vector getSolutionsBySenderId(size_t sender_id) override; @@ -30,4 +31,4 @@ private: std::shared_ptr manager; }; -#endif //SOURCEDOUT_SOLUTIONREPOSITORY_HPP +#endif diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp index 6427df1..0e72661 100644 --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -1,3 +1,85 @@ -// -// Created by qwert on 03.05.2023. -// +#include "MetricStat.hpp" +#include "MetricRepository.hpp" +#include + +MetricStat MetricRepository::getById(size_t id) { + try { + auto c = manager->connection(); + std::string sql = "SELECT * FROM metricStat WHERE id=" + std::to_string(id); + nontransaction n(*c); + result r(n.exec(sql)); + manager->freeConnection(c); + return makeMetric(r.begin()); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + + +size_t MetricRepository::storeMetric(MetricStat metric) { + try { + auto c = manager->connection(); + + std::string sql = ( + boost::format( + "INSERT INTO metricStat (solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) " \ + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % metric.getSolutionId() % + metric.getTextBasedRes() % metric.getTokenBasedRes() % metric.getTreeBasedRes() % metric.isVerdict() % + metric.getMeanRes()).str(); + work w(*c); + row r = (w.exec1(sql)); + w.commit(); + manager->freeConnection(c); + return r["id"].as(); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void MetricRepository::updateMetric(MetricStat metric) { + try { + auto c = manager->connection(); + + std::string sql = (boost::format( + "UPDATE metricStat SET solution_id = '%s', text_based_res = '%s', token_based_res = '%s', tree_based_res = '%s', verdict = '%s', mean_res = '%s';") + % metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % + metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()).str(); + work w(*c); + w.exec(sql); + manager->freeConnection(c); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +void MetricRepository::deleteMetric(MetricStat metric) { + deleteMetricById(metric.getId()); +} + +void MetricRepository::deleteMetricById(size_t id) { + try { + auto c = manager->connection(); + std::string sql = "DELETE FROM metricStat WHERE id=" + std::to_string(id); + work w(*c); + w.exec(sql); + w.commit(); + manager->freeConnection(c); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} + +MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("solution_id")).as(), + c.at(c.column_number("text_based_res")).as(), + c.at(c.column_number("token_based_res")).as(), + c.at(c.column_number("tree_based_res")).as(), + c.at(c.column_number("verdict")).as(), + c.at(c.column_number("mean_res")).as() + }; +} diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 3c7d0cd..3288158 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -3,12 +3,13 @@ #include #include "Solution.hpp" #include "SolutionRepository.hpp" + using namespace pqxx; -Solution SolutionRepository::getSolutionById(size_t id) { +Solution SolutionRepository::getSolutionById(size_t id) { try { auto c = manager->connection(); - std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); + std::string sql = "SELECT * FROM solutions WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); @@ -19,7 +20,7 @@ Solution SolutionRepository::getSolutionById(size_t id) { } } -std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { +std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); @@ -27,7 +28,7 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i result r(n.exec(sql)); std::vector solutions; manager->freeConnection(c); - for(result::const_iterator k = r.begin(); k != r.end(); ++k) + for (result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; } catch (const std::exception &e) { @@ -36,7 +37,7 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i } } -std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { +std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); @@ -44,7 +45,7 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) result r(n.exec(sql)); std::vector solutions; manager->freeConnection(c); - for(result::const_iterator k = r.begin(); k != r.end(); ++k) + for (result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; } catch (const std::exception &e) { @@ -53,12 +54,15 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) } } -size_t SolutionRepository::storeSolution(Solution solution) { +size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + std::string sql = ( + boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % + solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % + solution.getTokens() % solution.getAstTree()).str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -70,12 +74,15 @@ size_t SolutionRepository::storeSolution(Solution solution) { } } -void SolutionRepository::updateSolution(Solution solution) { +void SolutionRepository::updateSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s', task_id = '%s', result = '%s', tokens = '%s', astTree = '%s';") - % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree()).str(); + std::string sql = (boost::format( + "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s', task_id = '%s', result = '%s', tokens = '%s', astTree = '%s';") + % solution.getSendDate() % solution.getSenderId() % solution.getSource() % + solution.getTaskId() % solution.getResult() % solution.getTokens() % + solution.getAstTree()).str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -85,7 +92,7 @@ void SolutionRepository::updateSolution(Solution solution) { } } -void SolutionRepository::deleteSolutionById(size_t id) { +void SolutionRepository::deleteSolutionById(size_t id) { try { auto c = manager->connection(); std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); @@ -99,12 +106,12 @@ void SolutionRepository::deleteSolutionById(size_t id) { } } -void SolutionRepository::deleteSolution(Solution solution) { +void SolutionRepository::deleteSolution(Solution solution) { deleteSolutionById(solution.getId()); } -Solution SolutionRepository::makeSolution(const result::const_iterator& c){ +Solution SolutionRepository::makeSolution(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), c.at(c.column_number("send_date")).as(), c.at(c.column_number("sender_id")).as(), diff --git a/server/internal/repository/virtual/IMetricRepository.hpp b/server/internal/repository/virtual/IMetricRepository.hpp index 2c4fcff..f0911b9 100644 --- a/server/internal/repository/virtual/IMetricRepository.hpp +++ b/server/internal/repository/virtual/IMetricRepository.hpp @@ -1,8 +1,21 @@ -// -// Created by qwert on 03.05.2023. -// - #ifndef SOURCEDOUT_IMETRICREPOSITORY_HPP #define SOURCEDOUT_IMETRICREPOSITORY_HPP + +#include +#include "MetricStat.hpp" + +class IMetricRepository { +public: + virtual MetricStat getById(size_t id) = 0; + + virtual size_t storeMetric(MetricStat metric) = 0; + + virtual void updateMetric(MetricStat metric) = 0; + + virtual void deleteMetric(MetricStat metric) = 0; + + virtual void deleteMetricById(size_t id) = 0; +}; + #endif //SOURCEDOUT_IMETRICREPOSITORY_HPP -- GitLab From f04c90040855d37b072a5d29cc23334b65e1e419 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Wed, 3 May 2023 13:00:32 +0300 Subject: [PATCH 027/134] add equality op --- server/internal/dbManager/include/dbManager.hpp | 8 +++++++- server/internal/dbManager/src/dbConnection.cpp | 2 +- server/internal/entities/include/MetricStat.hpp | 4 ++++ server/internal/entities/src/MetricStat.cpp | 8 ++++++++ .../internal/repository/virtual/ISolutionRepository.hpp | 1 + server/internal/repository/virtual/ITaskRepository.hpp | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp index deeeba2..a6d323d 100644 --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -9,17 +9,23 @@ #include #include #include + //#include "dotenv.h" //using namespace dotenv; class dbManager { public: dbManager(); + std::shared_ptr connection(); - void freeConnection(const std::shared_ptr&); + + void freeConnection(const std::shared_ptr &); + private: const int POOL_SIZE = 10; std::condition_variable m_condition; + void createPool(); + std::queue> connection_pool; std::mutex m_mutex; }; diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index 6ad134a..39fd7a6 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -14,7 +14,7 @@ std::shared_ptr dbConnection::connection() const { } void dbConnection::establish_connection() { - pqxx::connection c( "dbname =mydb" "user = postgres password =root hostaddr =172.28.224.1 port = 5432"); + pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =172.28.224.1 port = 5432"); m_connection.reset(&c); } diff --git a/server/internal/entities/include/MetricStat.hpp b/server/internal/entities/include/MetricStat.hpp index 69ca521..4d5d338 100644 --- a/server/internal/entities/include/MetricStat.hpp +++ b/server/internal/entities/include/MetricStat.hpp @@ -39,6 +39,10 @@ public: void setMeanRes(float meanRes); + bool operator==(const MetricStat &rhs) const; + + bool operator!=(const MetricStat &rhs) const; + private: size_t id; size_t solution_id; diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp index 268dde6..12fa3b4 100644 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -66,3 +66,11 @@ float MetricStat::getMeanRes() const { void MetricStat::setMeanRes(float meanRes) { mean_res = meanRes; } + +bool MetricStat::operator==(const MetricStat &rhs) const { + return id == rhs.id; +} + +bool MetricStat::operator!=(const MetricStat &rhs) const { + return !(rhs == *this); +} diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 236f760..4325a3f 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -6,6 +6,7 @@ #include "../../entities/include/Solution.hpp" class ISolutionRepository { +public: virtual Solution getSolutionById(size_t id) = 0; virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 89962ff..6e97d0b 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -5,6 +5,7 @@ #include "../../entities/include/Task.hpp" class ITaskRepository { +public: virtual Task getTaskById(size_t id) = 0; virtual void updateTask(Task task) = 0; -- GitLab From fe5c1365e079621be798f47260cbcd8290317f0a Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 3 May 2023 14:16:30 +0300 Subject: [PATCH 028/134] start project skeleton --- CMakeLists.txt | 6 +- metrics/CMakeLists.txt | 4 + metrics/cmake-build-debug/CMakeCache.txt | 419 +++++++++ .../CMakeFiles/3.22.1/CMakeCCompiler.cmake | 72 ++ .../CMakeFiles/3.22.1/CMakeCXXCompiler.cmake | 83 ++ .../3.22.1/CMakeDetermineCompilerABI_C.bin | Bin 0 -> 15968 bytes .../3.22.1/CMakeDetermineCompilerABI_CXX.bin | Bin 0 -> 15992 bytes .../CMakeFiles/3.22.1/CMakeSystem.cmake | 15 + .../3.22.1/CompilerIdC/CMakeCCompilerId.c | 803 ++++++++++++++++++ .../CMakeFiles/3.22.1/CompilerIdC/a.out | Bin 0 -> 16088 bytes .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 791 +++++++++++++++++ .../CMakeFiles/3.22.1/CompilerIdCXX/a.out | Bin 0 -> 16096 bytes .../CMakeFiles/CMakeOutput.log | 451 ++++++++++ .../CMakeFiles/clion-environment.txt | 3 + .../CMakeFiles/clion-log.txt | 62 ++ .../CMakeFiles/cmake.check_cache | 1 + {text-basic-metrics => metrics}/code1.txt | 0 {text-basic-metrics => metrics}/code2.txt | 0 metrics/metrics_headers/TextMetricsLib.h | 42 + metrics/source/TextMetricImpl.cpp | 75 ++ {text-basic-metrics => metrics}/tbm_main.cpp | 2 + src/main.cpp | 265 +----- 22 files changed, 2829 insertions(+), 265 deletions(-) create mode 100644 metrics/CMakeLists.txt create mode 100644 metrics/cmake-build-debug/CMakeCache.txt create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp create mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out create mode 100644 metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log create mode 100644 metrics/cmake-build-debug/CMakeFiles/clion-environment.txt create mode 100644 metrics/cmake-build-debug/CMakeFiles/clion-log.txt create mode 100644 metrics/cmake-build-debug/CMakeFiles/cmake.check_cache rename {text-basic-metrics => metrics}/code1.txt (100%) rename {text-basic-metrics => metrics}/code2.txt (100%) create mode 100644 metrics/metrics_headers/TextMetricsLib.h create mode 100644 metrics/source/TextMetricImpl.cpp rename {text-basic-metrics => metrics}/tbm_main.cpp (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5054100..2bd3583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) message(STATUS ${Boost_LIBRARIES}) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") + +add_subdirectory(metrics) + add_executable(${PROJECT_NAME} src/main.cpp) -#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES} MetricsLib) \ No newline at end of file diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt new file mode 100644 index 0000000..7fe4c8c --- /dev/null +++ b/metrics/CMakeLists.txt @@ -0,0 +1,4 @@ +find_package(Boost 1.8.1 REQUIRED) +add_library(MetricsLib source/TextMetricImpl.cpp) + +target_include_directories(MetricsLib PUBLIC metrics_headers ${Boost_LIBRARIES}) \ No newline at end of file diff --git a/metrics/cmake-build-debug/CMakeCache.txt b/metrics/cmake-build-debug/CMakeCache.txt new file mode 100644 index 0000000..071bbc0 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeCache.txt @@ -0,0 +1,419 @@ +# This is the CMakeCache file. +# For build in directory: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//The directory containing a CMake configuration file for Boost. +Boost_DIR:PATH=Boost_DIR-NOTFOUND + +//Path to a file. +Boost_INCLUDE_DIR:PATH=Boost_INCLUDE_DIR-NOTFOUND + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//For backwards compatibility, what version of CMake commands and +// syntax should this version of CMake try to support. +CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4 + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING=Debug + +//Id string of the compiler for the CodeBlocks IDE. Automatically +// detected when left empty +CMAKE_CODEBLOCKS_COMPILER_ID:STRING= + +//The CodeBlocks executable +CMAKE_CODEBLOCKS_EXECUTABLE:FILEPATH=CMAKE_CODEBLOCKS_EXECUTABLE-NOTFOUND + +//Additional command line arguments when CodeBlocks invokes make. +// Enter e.g. -j to get parallel builds +CMAKE_CODEBLOCKS_MAKE_ARGUMENTS:STRING=-j12 + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//No help, variable specified on the command line. +CMAKE_DEPENDS_USE_COMPILER:UNINITIALIZED=FALSE + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=Project + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Single output directory for building all executables. +EXECUTABLE_OUTPUT_PATH:PATH= + +//Single output directory for building all libraries. +LIBRARY_OUTPUT_PATH:PATH= + +//Path to a program. +ProcessorCount_cmd_nproc:FILEPATH=/usr/bin/nproc + +//Path to a program. +ProcessorCount_cmd_sysctl:FILEPATH=/usr/sbin/sysctl + +//Value Computed by CMake +Project_BINARY_DIR:STATIC=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug + +//Value Computed by CMake +Project_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +Project_SOURCE_DIR:STATIC=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: Boost_DIR +Boost_DIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=22 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL=CodeBlocks +//CXX compiler system defined macros +CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS:INTERNAL=__STDC__;1;__STDC_VERSION__;201710L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_MIN__;((double)2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;((double)2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;((double)4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L;__STDC__;1;__cplusplus;201703L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__GNUG__;11;__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_WEAK__;1;__DEPRECATED;1;__GXX_RTTI;1;__cpp_rtti;199711L;__GXX_EXPERIMENTAL_CXX0X__;1;__cpp_binary_literals;201304L;__cpp_hex_float;201603L;__cpp_runtime_arrays;198712L;__cpp_raw_strings;200710L;__cpp_unicode_literals;200710L;__cpp_user_defined_literals;200809L;__cpp_lambdas;200907L;__cpp_decltype;200707L;__cpp_attributes;200809L;__cpp_rvalue_reference;200610L;__cpp_rvalue_references;200610L;__cpp_variadic_templates;200704L;__cpp_initializer_lists;200806L;__cpp_delegating_constructors;200604L;__cpp_nsdmi;200809L;__cpp_inheriting_constructors;201511L;__cpp_ref_qualifiers;200710L;__cpp_alias_templates;200704L;__cpp_return_type_deduction;201304L;__cpp_init_captures;201304L;__cpp_generic_lambdas;201304L;__cpp_decltype_auto;201304L;__cpp_aggregate_nsdmi;201304L;__cpp_variable_templates;201304L;__cpp_digit_separators;201309L;__cpp_unicode_characters;201411L;__cpp_static_assert;201411L;__cpp_namespace_attributes;201411L;__cpp_enumerator_attributes;201411L;__cpp_nested_namespace_definitions;201411L;__cpp_fold_expressions;201603L;__cpp_nontype_template_args;201411L;__cpp_range_based_for;201603L;__cpp_constexpr;201603L;__cpp_if_constexpr;201606L;__cpp_capture_star_this;201603L;__cpp_inline_variables;201606L;__cpp_aggregate_bases;201603L;__cpp_deduction_guides;201703L;__cpp_noexcept_function_type;201510L;__cpp_template_auto;201606L;__cpp_structured_bindings;201606L;__cpp_variadic_using;201611L;__cpp_guaranteed_copy_elision;201606L;__cpp_nontype_template_parameter_auto;201606L;__cpp_sized_deallocation;201309L;__cpp_aligned_new;201606L;__STDCPP_DEFAULT_NEW_ALIGNMENT__;16;__cpp_template_template_args;201611L;__cpp_threadsafe_static_init;200806L;__STDCPP_THREADS__;1;__EXCEPTIONS;1;__cpp_exceptions;199711L;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__GLIBCXX_TYPE_INT_N_0;__int128;__GLIBCXX_BITSIZE_INT_N_0;128;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;double(1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;double(1.79769313486231570814527423731704357e+308L);__DBL_MIN__;double(2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;double(2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;double(4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_GNU_SOURCE;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L +//CXX compiler system include directories +CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS:INTERNAL=/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include +//C compiler system defined macros +CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS:INTERNAL=__STDC__;1;__STDC_VERSION__;201710L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_MIN__;((double)2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;((double)2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;((double)4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L +//C compiler system include directories +CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS:INTERNAL=/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: ProcessorCount_cmd_nproc +ProcessorCount_cmd_nproc-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: ProcessorCount_cmd_sysctl +ProcessorCount_cmd_sysctl-ADVANCED:INTERNAL=1 + diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake new file mode 100644 index 0000000..73373ba --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake @@ -0,0 +1,72 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "11.3.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..5cd1af7 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake @@ -0,0 +1,83 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "11.3.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-11") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin new file mode 100644 index 0000000000000000000000000000000000000000..799c4bc62137ad2856b0f4508ffb22d789403995 GIT binary patch literal 15968 zcmeHOYit}>6~4Q65{Eo?(1CD-;*r>r*D;RoE#3MwGeshtrKxvo@Iu7)khboeT z{3Lb2ob}cIG;{{i$d9?-4|6l!tn8<^&gL5BWj%5BLlOOiuI%A-C?Z~_{+M$< zF(8?p(f+~ugSW10n7O#@?#I5=JMs9Qrjsu;p$(23eb5F8 z8T&*V%*T;Cz8qO+*WZTNLfDqV)|Gtj;)fP?KmVQc4;?sT|2((2!XWq%;6pjW`DYUxr!Mln3SHGA9Mm+I;^+w?Ylv*7l|O?XIAn1RygZ`E)_zRJ1N;#{jAQd2LiX+%Zv}My0c=Cp z3oGYhYY(B}Y2sk-Nc+ucWKCC%scGYxKW;OgnW-}(&l+d0ddnfeEfk=ka&9EH7RJT? zINn2BQ7uZh?=}u^jbhW7ddXXC9Njt}gbPiTO65WZcF)dx74Ett`@naW|L^YuB?j6J zep4U4XiSyP{Wy6Ahj}!4(fF)!Y{heM-xYhRJ|6piIg-3W=yE*F7g2MnJ{mg})cmHF zX2l-@k*@4JT|GzDvw~fR6lNgIK$w9r17QZj41^g7GZ1DV%s`ldFau!*{`CytbDGzp z)IjfGhwpjQ-j*%<{PqK>!QOO-H)+~#!OrY;Q(flvfn=&@pi@XY>7SnTY_s6PBdxuC zsiC31q?sJ(Np%i@h16SVXD`$tphIL;-FxsEBR+FEeyLK~5Bvo1Bfy^oZUBE|x>7j- z90{MPB1P`sDIyc`$g0H)8jiz*AH-L~wjX@tv%H=K^2yOU!0-XqdcY;HG~Ts1;58Z>H+|GUyYE)trujSPLP)_4|0@VH`vuV*%226zPOrFkAOzDDA3l?CS6I{?Q@XRhC8`wof| ztn2QT_?rb^mu!C*;86irb>KXv0k2hmeh_etoqhaU62HD~{PTdgl;@LKif-ymEh ze8Hhvmhop}DE)%s3r*?hYfJoE#<{*;{b|5!)tR3s`(WNKk$tev{4(IwrRtdWOX2T4 z{w|-T*fs2Wt$G0pzv16D)3Zhe07b7fGNKQQYsKcKmota4+`Nb-T#Bd=up0zzYqqo$yz#4bQv|QJMKLzuiJ1It7D`%UTQZ6?ME`KAlWXb!rzYxu|Gm0hbj+MVom32HXYtPcc(L$%aJ3IU3zm6u9!{Y#P z?8SmPX5}+bRd4p(Inddk>IM{EyfBjnIT$@V0fGX2{KFDmxAzTpb@rKqy}i4VL*`It z7yOqg>-uNEj8GjYmiY_4IGOXTG;q&Ve2iO89$rTn z7ka+n+4^X{q>sCWaohDKeNejOz)Leuh9EeF%{bYl`IuE46MAMc4_zn@FEB{Whi$j$ z6!NnK6LhYfwa`K6I8}r`o>e=2v;Ymyo`AhPow{3)??LGH7|pP;4EVF8{MA%b9^8iD zR?ZoQ;oxf&I=mGjbeQ8gn7XsBpEoGr`Uoyn_>NN)eBX`NN2Hdv+(!O(*l-QQ{&T(8 zg|vcb0x{ zdHqgds_A9?{*MRz6Xd`=6F6bPcqaq?yzXJn_cvfB ziKiFKr=WpdaQ=lx8seWKkr}}(iXTAB@6YQc=J>43Pr?3ie)|2(nzCm8X}>eH`TR5d zD`?;vlJ7tGzK!394BE5I{5<%^eEz&no@oXUi0zbgO=kQOC~)p^|J8M*t~|Qhh XIQOfxxOT4XzYKp^fEEWF0;2dQots7{ literal 0 HcmV?d00001 diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin new file mode 100644 index 0000000000000000000000000000000000000000..49a8a11254c388a5a45cf391b6970765b4c0d3c7 GIT binary patch literal 15992 zcmeHOYit}>6~4Q65{Ee1Z5mUPq|HzolKSC54Xdc6xn53cYCQ6q0Li7s<%SPME1vnnQnCbr+3cR3dN;?H1p6zo={zXm=0G+7pXti z98Zi1e%dLXe%(aPu=evtiRahd#AA(ppzMFaN&PGR4G{0FBAXF@{dN}?thv9vz>{&I z`qxuD&HJdo#pWSO@n=op6K8q)KQVLN)pu(ASeTt96>PYmwSQ>JZ>Sb4{^2lsTPb6IoH zNTz{jrVPgbIx3eA#z-cYrM7gS_d_{lW%WYdOaUVcUwSg1XLoGAV&l7e6P;api`t@Y z6I^cH3P%uz^)&Za(I%dAR#g|Kga=5w$N!{P$Pfq&=t_eG&N&Cu^3 zL?DPj z5P={9K?MHaBk;$_J+Eq~Zq{g1OMbaU2<_pb6D~cgo%%t|C3)zjZI1)|htkF`fr@Mp z=nvL+rPVE@-TYEw^74nY$zN-yeltBV7;i2%|42Kt^BHKMRF?Y(fQVi~$#Ub+_9a1tFakp_QD`fp33+BB<8PHRv7ewX&tOqCXTTDv^! ztbqnLQUf)mYr~NZFfQifcu(%cYEjsHKs&WFj74qo1*cY<+PM^r8=Fd{(v1{+J-y^_ zaMc|;4BUDA7axF1Z0G>+CO>vln=D-WVf;1@b1HsQ`@D9h?#e2N&bO+gk?$2l@!N#1 z!NYtWYc5uYBNzQOzp7MI_d8!pw+~+`&rx|+u*?Q-hbLOOVLdhG*oT_h4}1Ol68$~N9nOSq+Bq|I$WCUI>*PZC-0}okmB&|b`hk%68x~g~LvtN8x zbN1y@=?Lg^pihH-60`>TvFTFj9B34Lriv0ewoin{qoH-R%WBTT10%%O!{-QaT&h$M+_(InQq$*?j4-~%Ax%vCFx<_DvCx0%=bf? zq53ztruYu&6{PD)*O6w$xqn5<@1t~ZF+dITIEqBzoLO$~9>Ur0uO)Z95GM)ElC4mC z@MKsX562NMO{HB;^?xCo$Hn9Pk7>>i|2G@tyvyBPT|1P91Ia?xDJad&YOC7R*j$ii z^MfrdYSY$D1iyBN7>{c4O3Ckq@eV=FCn+EbIot`ll0VKz81i$+Xg!jryuL6NxX(E58JIr9AX!2p2IPiL0NJ?aar}`Yqs<^2%??b{6KXKMQ!JeDhby-yff) zaC;8@{rToA09O_cM{ETA-U_(bKV&=2Y7R2R;clDm7$X9Jyi*t+R)@q~GP>?$^dU?~ z&tndHP9I6R+cw~)VAioG#IS8-Og&Y| zWF~;(v2^fs=DBw5F^-yD2M=~ZFIL*LJ315U(Ab#JKhWFUW@U$Sy60XbqAe~ucZX3= zS|gYeZy8xxzg@CC^=Zp-(x%6yU3x%NU~oPAI`+uBlRD(tTxf~eBLjz z9>Cy&;25#UeBS3-fZ-N|`Mm#R&HGJokwVR}Dei|7?){k0`#sh?e>{HnWBnlTaWBa> z?FZ%l~KT|1Iz9shI`y_eCFHAs%br zziof>;&C6pi3qG;kNZ7^S*~QU-y8U6#x3Y2q<>J@fV786RbZ) zCM&LH+uaw=@p-?*n%{q9e}Df!g$i%~Me2a{XPHQv=bz!{pn!WwzAoYYEWan|_h*~+ zb>K!keBM9LGy(|1ey%lVGyXDE;M(K<%lk;xWfbw?Kydw|FpuZ)tAL>k^LhVR+=AXh z#N_wf7xP)qK$VwYCN#Mm?uT1o9^11}K#cq6eOr|Het$X~ri&^75F__8&iu_~#4Rx2 ztIKQ8;~S#}zeWSY^BAwmc|834hu2{|b`M?LzzZmln6Gi}*R91pZ)JW1{$l~D^$~og F_&X6;L(KpH literal 0 HcmV?d00001 diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake new file mode 100644 index 0000000..42ff974 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.15.90.1-microsoft-standard-WSL2") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.15.90.1-microsoft-standard-WSL2") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-5.15.90.1-microsoft-standard-WSL2") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.15.90.1-microsoft-standard-WSL2") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..41b99d7 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,803 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out new file mode 100644 index 0000000000000000000000000000000000000000..98db4768605cea2f84b7ab8615f48d02c003719e GIT binary patch literal 16088 zcmeHOeQX>@6`#9&IW&nKH^wGuo28`4A@%0$eAEp}bBTSECPn?`B@LI0pqDS`@UB`TpJA_0zy0xbnK5>mr|0a_`b(3-Exlqko0Gw*jk zFXtf9{(;1f<^9e3&3kWV-^}jK?#_HRHP9E2#T3#Kb(dl(*<_fc6g+;1WC)U~Tdk(! z&FUt#oaCjNGv!GGRBF=2_(E(DehDGlwQ;5n-ehR1!6dYhk?j^sWZgdL0e6l|kU-C>g8jMN82 zJUJ%(-!1VBV?x{j!*=6h7sg((19Balj=UbE|C{;_iQUVVcB8_0yP*{j^?iiwq-#av z`hadeEcGqc4^0w(poCX#&1QyoZr_?scVsj9@?^(k_s));+wD@p?$Q-=yDa+WF}44| zQAKWMn3FK7_z5G!AD69@a@O}-?reXi`-!$q_qIKE^WA^^`Zw2gZ($v7H`}ldC-#RS z!ZPQ%PS!E;_#EYAY!hDaf0fh3A_w;0T&JvuII9ltF2d&*;kjM6*72iUcVyCYM>BaZ zo4Ma7kpev8mIALBxH&JAS1faUcdGpZ{rh^{F1yR#QO$4LuH62iK{xFe{jp3b@QXu( zJ=sFuAM%E?>~1Vq$csDIsMb~F2*&iE>8TjW++K{A^7_n5jyjJ&=Dz>fS18PJy5pII z>loLMwbt-+a(#opBn}&rrW`!vrVwvgMz1Zz7lpS%{1=385Ak0TJ`v)d75?HLr4x@G z?kl8AH9U_oq{}rt#x|GD*6=)Tk>+Z6eZNIPgi!>d2t*NxA`nF&ia->BC<6Zz5%_E4 zEpIy~uQWKPm;Gj|QqJdRf_UW>=j2ZtUeN8U?0Aakzf^Af20`OS#rh=uNK3s+%bkDf zpT6)3XZm-}$=7BN4W&9~I$w0o?0$(HR9Z@;`L|KKapQy9AMxjian39|%W&sh&_Y#z zl=D>e%F3n2jVD;~1wqn(OzZD>m|^oZXL{B-_r@OQ+}si;cHX&gEm%hmZW9L$l}n?I z8>wBe=k}i1JxIl>yyd8Ka(A4w&h+cSD(Cd>&9;x_s$psjJ*f=XA?U^rU_|b;WtyiM`VJylVXMOe}Sk__K@f->JtN2WMKI zT|-fRerZ$H%Y*f_$$LKoo%}0#O8_2t*NxA`nF&ia->B zC<0Lg{+}bj-@mSx`VaIS+%;0jO=Plu@fdxTJibtSLAiUcUo2$``C|#4Iy-HXNo+$V zaa?JOiL4il7K*uJ1N?PWNUu0DeoXT8VKATeifQ`bH|mwM!LiOeq{N>L{5;oEs+Ju* zpj#E&u;jz-)I9zkHS}hsat~pekl#E6g!EcK9iOdKzDCI3VmZa`KdfStO|cEDRx~_H zAH1J*$_;pQM_Zh*A`RC<0Lgq6kD0h$0Y0Ac{Z~fhYn| z1m4{UV7(&NCt?ktet4m(R-rmszqnfDU&}hj_lb;kkQ+qCBg}e{u^y72dpM!|@7F2? zmcJ*939&|SoFCdK@w!A#7p43?MpUN+ZxCz~Y!L*AnVOMxh%2NZAr+w=-E!iz*i$F? zyG3N^{j*})OX`}sCbC&fP9M1E%e5svUh4CkmGk+B$nYob-#x(k@OS7D>ryStIKsM9 ztTV;BQmiB0-_x_pYCk$$&Ie_S9`xx6zoWCP#m)!1y6nXE%|c(lVcZQ%)t@V2E$){X zl{_LHYKg*)g!S~f-{NYGnviiT>dF%S$q>Iycw7h2@25;mwW;o;VYq#qcr|v6p6)TO zHA#n0(?8dX>k9lS%EZ)-3fBqvrzumf{fnK~S?#A;oq9h!%ws)2KiB$nRfNXH1#Pyr zy51gMUeo&TtzIwS-=<76gc@w6fLJv$vimgOs#Fq;!EMAhsn%*dQM!xx=6IvReFc0{ z^uvAzwSQ>M<2}T$jkhX{UzB8+r<#>z7`YtPq~=>yThj2jE*}y;yl(nw;+tqZBt_p? zDb+`OGxd8?#+80oM1{|YpC-|V|Fhx;;|hMxi=WMMf7S1XsPGr;ht4ak|ElyTsrw&9^EmX$YK`IxeWmRzqqsrVgZ)(`x&ov5$D zdj~SES1fu{uAdKzQ);y6<$O0?&gG`aq(*W{GgzS7Gw6NN@9B~EnEh#Lo9p%+-aD9b zQwMro+A+}k@dJAY`+JC{mz-|Oky5AkuyXeg9Nf2ez&+U4cO*6B4(;7HkRprl4u&N5 zE&Qjw3VzxPJf+Wvys%(4E|9Qr7lWHF72I)p5z0Fp`VW#;I+J(HB|oh)`O$)lx2Q(S zdik-kH|D$l{)SXh#KZ>ga;dW6Qb{V-8!%j#wp2(swEL>V@XOfi?5|k3&7&F;-pZkS z#WYpk6B~hF`zmFZrgDKdOc)dmjw6@J({_&uW#^@C)av72XH>SrZ-J+% ztTu(?|0ycuxh3o|p9Er_j`l+j_yF1STop3rtH6X*9&SI{bcQk@ zt7OaPg!1a|jQrlIhybA>s-IAfn+W@tMFDtwRnug`_5YIS zTKhS%2YxwZkNyY!DrIObYjr;)=E2y98PZ@ERb%7 literal 0 HcmV?d00001 diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..25c62a8 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,791 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ +#if (defined(__clang__) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) && !defined(_MSC_VER) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out new file mode 100644 index 0000000000000000000000000000000000000000..b898fe5edea70c84b145851a6b3ec03ffafcec60 GIT binary patch literal 16096 zcmeHOYit}>6~4Pk8iywFCT&PaO0z9(mC$-(JCB;6kag^J#>h_6#3_L^3}f%uyJ8<^ zcb3=@v_YW|lLR#a0Y8FN6$ySIB%Vc7v^W%sQne`gMUW5*kBA_pt$E6n$jdqRo^L&# zu7iO7;Kv-xbME=h8oC^x%bNsWK%D*7aG?Re!@yL7A+(S=`^`sLZV(Z;lJj7{MXV4x z%r8g<;Lz9WOR_UjQXlL5wD^Gs{kSPpEyjLo$6RhpUiJxxAB*}FEMrgIVMzF-)CZ1y za!&ZaL-HBstr7-2?3We4Fz*&WaIS;tz*Rr<-_*BH{9a1xFe=O+Ft7qgeGieJbgfw2 zoS~cdOMUb8LqhToF6mX9^0~onTQ=o0E%{urI@U7Qv8`p>7OPUS+I7X;t|a~QnA*MP zprSC7j7b_*{J4=3k9D_;p6$Q)^0|2XiK~ytj?R4OI~TvbFA>Y%#Wvh-_F)?)j)x(_ zGMBkdwlVqm1eIiL6TjsByr6-34jg}F16>zk$p*MH4_=%H=XTxQAdYgJp)uDP&K2E! z?wCg+C3wiG_-@&E3U02bSmyk0Q@i_mcXc`KR=c&eUf#S#IlTk@PR1*HBe{z2l?VE} z@};6T;11?F+(@BRlyHtQZD`0DjOjnqQ!$dcy%;amwYepnbsm3=efR7aD9v%Y;~Bzr zjO!=4!r;?#eFMKD0h>}r4;*qLgeQ~6ZcPX;3!V(&pB8*W2>+bmts(pyf?wXLH1XKs zz5-nd;5^1a*8(`kHtVJWIFDPY)O@PCnkzck4WyfZ|xJmpV~K&ZkueoV4vCXA_b_es*vShhpp!IpVaXPKTn8#X3;au-Zky7qN*R} zGF82#cBOg!aW;HjIN6`o_FF&0Y~zeQF=d~Bb*FuPdVw8#!M-%(-%bJUl>kk(E5ps} zsa^2r_8#BSPij@Y|Db(hN1TiH#8rQ(eQL)oBwX8AtJSV$=BC?#`9ow&BV~N@lc@a{6ksi_%@NT4sxByc!XIiGS)-#a}N{rf19b5SpKFg zCd3-SEI+gn@w!B&%c6ga5!FfIw+de)e3fu8aZ{7B4so$4TBRbiqeD)d7JF(!ygNmP z-9Kxly=1PT8IjFma{9nMtJj|Nc&X2CO3vpWA|sxJfAbjDhyRZeu`V^4G=Z@06zfc} zt`zG?cXxGdPi{CkSS|Y1Bt7WU6MjouRf}zpwzpfYTQ&-O^M-LZEL4B0g{`<>Vx&1O z9hww_+lV)^=YET;7ajii* ze2o6NUR+nePf{VKZd15UfPak&joSa5woj;3(pa_|MiCm@UnD$6E4feJC58dkDE_at zJzXuK@$v`lx1zodA7NhC_HV6UN5B)5kd+VuyoK;&Kt}P9##bwq0%CYC;R&_6o@Z$H z5xz3stZ=^p{;=4G;|%Heu$tv%!dJvsD~xMs9%GzpR!M`%WvV`_@zpB4{`#EY;q}zd z5}u%Ol1d@6;g1l$lEyN-|-915U+o62~-S6Mi+27kmFunS8(za;r?)}Qy-M4pFXP>jT zr{_R=z!~V=)t4rZ@V-Jm-z?O%>%)eDH>sDjTd+q+-1-!*OV%g``7=uLlgj zqP@wki@BRW>M7w39=fkgQ~CX`QdVWW;Jbsw{j%X%lyXJd_c5xhV#)Wckz&;vEtf{U zvOgYx2CF&Rw3EvS)VZs-g$JcJ&$^YYvNGdEs={!;Y&7!XdXC_buI%Mqc2E`%DP@i3 z&A}QeQNgF2DvQS@S(bGFSzcB~Vm3qmkc__>lEwpN3howiL)0AZev7iNEb5H{4e;|h6M-~r-nT;jnAd>g`3m;o^Z&m1BmXKXmclQH2qrK@^&={A6XE}o z7=S-ew={)t{Vx+7^q&@g@Xv?*(f@#dK?PdtTHhCm`7rilhV3DP|Bif{1OAwQPqz?A z1UnjF_GO(z;rvN$Ecx|4i^hKYo=kHi18$DPZ9tC literal 0 HcmV?d00001 diff --git a/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log b/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..f66394f --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log @@ -0,0 +1,451 @@ +The system is: Linux - 5.15.90.1-microsoft-standard-WSL2 - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out" + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_8749b/fast && /usr/bin/gmake -f CMakeFiles/cmTC_8749b.dir/build.make CMakeFiles/cmTC_8749b.dir/build +gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/' + /usr/lib/gcc/x86_64-linux-gnu/11/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_8749b.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc1DmWsu.s +GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) + compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/11/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) + compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 3f6cb05d963ad324b8f9442822c95179 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/' + as -v --64 -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o /tmp/cc1DmWsu.s +GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.' +Linking C executable cmTC_8749b +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8749b.dir/link.txt --verbose=1 +/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -o cmTC_8749b +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.' + /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/cc69cHrV.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_8749b /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.' +gmake[1]: Leaving directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/11/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/11/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/11/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_8749b/fast && /usr/bin/gmake -f CMakeFiles/cmTC_8749b.dir/build.make CMakeFiles/cmTC_8749b.dir/build] + ignore line: [gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp'] + ignore line: [Building C object CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_8749b.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc1DmWsu.s] + ignore line: [GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 3f6cb05d963ad324b8f9442822c95179] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o /tmp/cc1DmWsu.s] + ignore line: [GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.'] + ignore line: [Linking C executable cmTC_8749b] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8749b.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -o cmTC_8749b ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/cc69cHrV.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_8749b /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cc69cHrV.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_8749b] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] + arg [CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11] ==> [/usr/lib/gcc/x86_64-linux-gnu/11] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_313d1/fast && /usr/bin/gmake -f CMakeFiles/cmTC_313d1.dir/build.make CMakeFiles/cmTC_313d1.dir/build +gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/' + /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_313d1.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7F4o2Q.s +GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) + compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/11 + /usr/include/x86_64-linux-gnu/c++/11 + /usr/include/c++/11/backward + /usr/lib/gcc/x86_64-linux-gnu/11/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) + compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 449548cbb29044828dc7ea158b577b98 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/' + as -v --64 -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7F4o2Q.s +GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.' +Linking CXX executable cmTC_313d1 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_313d1.dir/link.txt --verbose=1 +/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_313d1 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.' + /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccOEwjUV.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_313d1 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.' +gmake[1]: Leaving directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/11] + add: [/usr/include/x86_64-linux-gnu/c++/11] + add: [/usr/include/c++/11/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/11/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/11] ==> [/usr/include/c++/11] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/11] ==> [/usr/include/x86_64-linux-gnu/c++/11] + collapse include dir [/usr/include/c++/11/backward] ==> [/usr/include/c++/11/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/11/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/11/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_313d1/fast && /usr/bin/gmake -f CMakeFiles/cmTC_313d1.dir/build.make CMakeFiles/cmTC_313d1.dir/build] + ignore line: [gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp'] + ignore line: [Building CXX object CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_313d1.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7F4o2Q.s] + ignore line: [GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/11] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/11] + ignore line: [ /usr/include/c++/11/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 449548cbb29044828dc7ea158b577b98] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7F4o2Q.s] + ignore line: [GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [Linking CXX executable cmTC_313d1] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_313d1.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_313d1 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccOEwjUV.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_313d1 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccOEwjUV.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_313d1] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] + arg [CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11] ==> [/usr/lib/gcc/x86_64-linux-gnu/11] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + diff --git a/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt b/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt new file mode 100644 index 0000000..d275d42 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt @@ -0,0 +1,3 @@ +ToolSet: Ubuntu 22.04.2 LTS (local)Options: + +Options: \ No newline at end of file diff --git a/metrics/cmake-build-debug/CMakeFiles/clion-log.txt b/metrics/cmake-build-debug/CMakeFiles/clion-log.txt new file mode 100644 index 0000000..656c29f --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/clion-log.txt @@ -0,0 +1,62 @@ +C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/sh -c "export CLION_IDE=TRUE && export JETBRAINS_IDE=TRUE && cd '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug' && /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G 'CodeBlocks - Unix Makefiles' '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics'" +CMake Warning (dev) in CMakeLists.txt: + No project() command is present. The top-level CMakeLists.txt file must + contain a literal, direct call to the project() command. Add a line of + code such as + + project(ProjectName) + + near the top of the file, but after cmake_minimum_required(). + + CMake is pretending there is a "project(Project)" command on the first + line. +This warning is for project developers. Use -Wno-dev to suppress it. + +-- The C compiler identification is GNU 11.3.0 +-- The CXX compiler identification is GNU 11.3.0 +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working C compiler: /usr/bin/cc - skipped +-- Detecting C compile features +-- Detecting C compile features - done +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): + Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least + version "1.8.1") +Call Stack (most recent call first): + /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) + /usr/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args) + CMakeLists.txt:1 (find_package) + + +CMake Warning (dev) in /usr/share/cmake-3.22/Modules/FindBoost.cmake: + Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH + and POP. Run "cmake --help-policy CMP0011" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + The included script + + /usr/share/cmake-3.22/Modules/FindBoost.cmake + + affects policy settings. CMake is implying the NO_POLICY_SCOPE option for + compatibility, so the effects are applied to the including context. +Call Stack (most recent call first): + CMakeLists.txt:1 (find_package) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning (dev) in CMakeLists.txt: + No cmake_minimum_required command is present. A line of code such as + + cmake_minimum_required(VERSION 3.22) + + should be added at the top of the file. The version specified may be lower + if you wish to support older CMake versions for this project. For more + information run "cmake --help-policy CMP0000". +This warning is for project developers. Use -Wno-dev to suppress it. + +-- Configuring incomplete, errors occurred! +See also "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log". diff --git a/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache b/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/text-basic-metrics/code1.txt b/metrics/code1.txt similarity index 100% rename from text-basic-metrics/code1.txt rename to metrics/code1.txt diff --git a/text-basic-metrics/code2.txt b/metrics/code2.txt similarity index 100% rename from text-basic-metrics/code2.txt rename to metrics/code2.txt diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h new file mode 100644 index 0000000..2830b07 --- /dev/null +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -0,0 +1,42 @@ +// +// Created by march on 02.05.2023. +// + +#ifndef SOURCEDOUT_DECLARATION_H +#define SOURCEDOUT_DECLARATION_H + +#include +#include +#include +#include + +#include + + +class ITextMetric{ + virtual double countMetric() = 0; + virtual void getData(std::istream& fin1, std::istream& fin2) = 0; +}; + +class PrepareDataTextMetric : public ITextMetric{ +public: + void getData(std::istream& fin1, std::istream& fin2); +protected: + std::vector tokens1; + std::vector tokens2; + static std::string deleteComments(const std::string& text); + std::vector tbmTokenizer(const std::string &text); +}; + +class LivDistTextMetric : public PrepareDataTextMetric{ +public: + double countMetric(); + + +private: + std::vector tokens1; + std::vector tokens2; +}; + + +#endif //SOURCEDOUT_DECLARATION_H diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp new file mode 100644 index 0000000..8c33fbc --- /dev/null +++ b/metrics/source/TextMetricImpl.cpp @@ -0,0 +1,75 @@ +// +// Created by march on 02.05.2023. +// + +#include "TextMetricsLib.h" + + +void PrepareDataTextMetric::getData(std::istream &fin1, std::istream &fin2) { + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); + + std::string non_comm_text1 = deleteComments(text1); + std::string non_comm_text2 = deleteComments(text2); + + tokens1 = tbmTokenizer(non_comm_text1); + tokens2 = tbmTokenizer(non_comm_text2); +} + +std::string PrepareDataTextMetric::deleteComments(const std::string& text) { + std::string modif; + std::string res; + + std::stringstream ss; + std::string line; + + ss << text; + + while(getline(ss, line)){ + line.pop_back(); + line.push_back('\0'); + modif += line; + } + + bool s_comm = false; + bool m_comm = false; + + for (int i = 0; i < modif.size(); i++){ + if (s_comm && modif[i] == '\0') + s_comm = false; + else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') + m_comm = false, i++; + else if (s_comm || m_comm) + continue; + else if (modif[i] == '/' && modif[i+1] == '/') + s_comm = true, i++; + else if (modif[i] == '/' && modif[i+1] == '*') + m_comm = true, i++; + + else if (modif[i] != '\0') + res += modif[i]; + else{ + res += '\n'; + } + } + return res; +} + +std::vector PrepareDataTextMetric::tbmTokenizer(const std::string &text) { + boost::char_separator sep(" {}();,\"\0\'"); + std::vector res; + boost::tokenizer < boost::char_separator > tokens(text, sep); + + for (const std::string &s: tokens) { + if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ + res.push_back(s); + } + } + return res; +} + + + diff --git a/text-basic-metrics/tbm_main.cpp b/metrics/tbm_main.cpp similarity index 98% rename from text-basic-metrics/tbm_main.cpp rename to metrics/tbm_main.cpp index fdd4253..797084c 100644 --- a/text-basic-metrics/tbm_main.cpp +++ b/metrics/tbm_main.cpp @@ -12,6 +12,8 @@ #include +#include "metrics_headers/TextMetricsLib.h" + std::string deleteComms(const std::string& text){ std::string modif; diff --git a/src/main.cpp b/src/main.cpp index cbd2bd5..a7225a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,264 +1,3 @@ +#include "TextMetricsLib.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace beast = boost::beast; // from -namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = boost::asio::ip::tcp; // from - -//------------------------------------------------------------------------------ - -// Return a reasonable mime type based on the extension of a file. -beast::string_view mime_type(beast::string_view path) { - using beast::iequals; - auto const ext = [&path] { - auto const pos = path.rfind("."); - if (pos == beast::string_view::npos) return beast::string_view{}; - return path.substr(pos); - }(); - if (iequals(ext, ".htm")) return "text/html"; - if (iequals(ext, ".html")) return "text/html"; - if (iequals(ext, ".php")) return "text/html"; - if (iequals(ext, ".css")) return "text/css"; - if (iequals(ext, ".txt")) return "text/plain"; - if (iequals(ext, ".js")) return "application/javascript"; - if (iequals(ext, ".json")) return "application/json"; - if (iequals(ext, ".xml")) return "application/xml"; - if (iequals(ext, ".swf")) return "application/x-shockwave-flash"; - if (iequals(ext, ".flv")) return "video/x-flv"; - if (iequals(ext, ".png")) return "image/png"; - if (iequals(ext, ".jpe")) return "image/jpeg"; - if (iequals(ext, ".jpeg")) return "image/jpeg"; - if (iequals(ext, ".jpg")) return "image/jpeg"; - if (iequals(ext, ".gif")) return "image/gif"; - if (iequals(ext, ".bmp")) return "image/bmp"; - if (iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; - if (iequals(ext, ".tiff")) return "image/tiff"; - if (iequals(ext, ".tif")) return "image/tiff"; - if (iequals(ext, ".svg")) return "image/svg+xml"; - if (iequals(ext, ".svgz")) return "image/svg+xml"; - return "application/text"; -} - -// Append an HTTP rel-path to a local filesystem path. -// The returned path is normalized for the platform. -std::string path_cat(beast::string_view base, beast::string_view path) { - if (base.empty()) return std::string(path); - std::string result(base); -#ifdef BOOST_MSVC - char constexpr path_separator = '\\'; - if (result.back() == path_separator) result.resize(result.size() - 1); - result.append(path.data(), path.size()); - for (auto& c : result) - if (c == '/') c = path_separator; -#else - char constexpr path_separator = '/'; - if (result.back() == path_separator) result.resize(result.size() - 1); - result.append(path.data(), path.size()); -#endif - return result; -} - -// This function produces an HTTP response for the given -// request. The type of the response object depends on the -// contents of the request, so the interface requires the -// caller to pass a generic lambda for receiving the response. -template -void handle_request(beast::string_view doc_root, - http::request>&& req, - Send&& send) { - // Returns a bad request response - auto const bad_request = [&req](beast::string_view why) { - http::response res{http::status::bad_request, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - // Returns a not found response - auto const not_found = [&req](beast::string_view target) { - http::response res{http::status::not_found, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "The resource '" + std::string(target) + "' was not found."; - res.prepare_payload(); - return res; - }; - - // Returns a server error response - auto const server_error = [&req](beast::string_view what) { - http::response res{http::status::internal_server_error, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "An error occurred: '" + std::string(what) + "'"; - res.prepare_payload(); - return res; - }; - - // Make sure we can handle the method - if (req.method() != http::verb::get && req.method() != http::verb::head) - return send(bad_request("Unknown HTTP-method")); - - // Request path must be absolute and not contain "..". - if (req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) - return send(bad_request("Illegal request-target")); - - // Build the path to the requested file - std::string path = path_cat(doc_root, req.target()); - if (req.target().back() == '/') path.append("index.html"); - - // Attempt to open the file - beast::error_code ec; - http::file_body::value_type body; - body.open(path.c_str(), beast::file_mode::scan, ec); - - // Handle the case where the file doesn't exist - if (ec == beast::errc::no_such_file_or_directory) - return send(not_found(req.target())); - - // Handle an unknown error - if (ec) return send(server_error(ec.message())); - - // Cache the size since we need it after the move - auto const size = body.size(); - - // Respond to HEAD request - if (req.method() == http::verb::head) { - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); - } - - // Respond to GET request - http::response res{ - std::piecewise_construct, std::make_tuple(std::move(body)), - std::make_tuple(http::status::ok, req.version())}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); -} - -//------------------------------------------------------------------------------ - -// Report a failure -void fail(beast::error_code ec, char const* what) { - std::cerr << what << ": " << ec.message() << "\n"; -} - -// This is the C++11 equivalent of a generic lambda. -// The function object is used to send an HTTP message. -template -struct send_lambda { - Stream& stream_; - bool& close_; - beast::error_code& ec_; - - explicit send_lambda(Stream& stream, bool& close, beast::error_code& ec) - : stream_(stream), close_(close), ec_(ec) {} - - template - void operator()(http::message&& msg) const { - // Determine if we should close the connection after - close_ = msg.need_eof(); - - // We need the serializer here because the serializer requires - // a non-const file_body, and the message oriented version of - // http::write only works with const messages. - http::serializer sr{msg}; - http::write(stream_, sr, ec_); - } -}; - -// Handles an HTTP server connection -void do_session(tcp::socket& socket, - std::shared_ptr const& doc_root) { - bool close = false; - beast::error_code ec; - - // This buffer is required to persist across reads - beast::flat_buffer buffer; - - // This lambda is used to send messages - send_lambda lambda{socket, close, ec}; - - for (;;) { - // Read a request - http::request req; - http::read(socket, buffer, req, ec); - if (ec == http::error::end_of_stream) break; - if (ec) return fail(ec, "read"); - - // Send the response - handle_request(*doc_root, std::move(req), lambda); - if (ec) return fail(ec, "write"); - if (close) { - // This means we should close the connection, usually because - // the response indicated the "Connection: close" semantic. - break; - } - } - - // Send a TCP shutdown - socket.shutdown(tcp::socket::shutdown_send, ec); - - // At this point the connection is closed gracefully -} - -//------------------------------------------------------------------------------ - -int main(int argc, char* argv[]) { - try { - // Check command line arguments. - if (argc != 4) { - std::cerr << "Usage: http-server-sync
\n" - << "Example:\n" - << " http-server-sync 0.0.0.0 8080 .\n"; - return EXIT_FAILURE; - } - auto const address = net::ip::make_address(argv[1]); - auto const port = static_cast(std::atoi(argv[2])); - auto const doc_root = std::make_shared(argv[3]); - - // The io_context is required for all I/O - net::io_context ioc{1}; - - // The acceptor receives incoming connections - tcp::acceptor acceptor{ioc, {address, port}}; - for (;;) { - // This will receive the new connection - tcp::socket socket{ioc}; - - // Block until we get a connection - acceptor.accept(socket); - - // Launch the session, transferring ownership of the socket - std::thread{std::bind(&do_session, std::move(socket), doc_root)}.detach(); - } - } catch (const std::exception& e) { - std::cerr << "Error: " << e.what() << std::endl; - return EXIT_FAILURE; - } -} +#include \ No newline at end of file -- GitLab From 5749db7bb6f4a4ad6df4fac34c2810b056c393d8 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 3 May 2023 14:39:51 +0300 Subject: [PATCH 029/134] fix lib's cmakelists --- metrics/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt index 7fe4c8c..cac65b0 100644 --- a/metrics/CMakeLists.txt +++ b/metrics/CMakeLists.txt @@ -1,4 +1,5 @@ -find_package(Boost 1.8.1 REQUIRED) add_library(MetricsLib source/TextMetricImpl.cpp) +find_package(Boost 1.8.1 REQUIRED) -target_include_directories(MetricsLib PUBLIC metrics_headers ${Boost_LIBRARIES}) \ No newline at end of file +target_include_directories(MetricsLib PUBLIC metrics_headers) +target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) \ No newline at end of file -- GitLab From 8e03ef23d87269ce97b3014e46fc47afd903db65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 3 May 2023 16:53:27 +0300 Subject: [PATCH 030/134] Add tests for http server --- CMakeLists.txt | 6 +- server/CMakeLists.txt | 2 +- server/internal/CMakeLists.txt | 5 + server/internal/httpServer/CMakeLists.txt | 24 ++++ server/internal/httpServer/include/Header.h | 11 ++ .../httpServer/include/HttpConnection.h | 33 +++++ .../internal/httpServer/include/HttpServer.h | 30 +++++ server/internal/httpServer/include/Parser.h | 57 ++++++++ server/internal/httpServer/include/Request.h | 17 +++ server/internal/httpServer/include/Response.h | 38 ++++++ server/internal/httpServer/include/Router.h | 35 +++++ .../internal/httpServer/include/Serializer.h | 14 ++ .../httpServer/include/SolutionManager.h | 27 ++++ .../internal/httpServer/include/TaskManager.h | 25 ++++ .../internal/httpServer/include/UserManager.h | 25 ++++ .../httpServer/src/HttpConnection.cpp | 16 +++ server/internal/httpServer/src/HttpServer.cpp | 20 +++ server/internal/httpServer/src/Parser.cpp | 17 +++ server/internal/httpServer/src/Response.cpp | 5 + server/internal/httpServer/src/Router.cpp | 15 +++ .../httpServer/src/SolutionManager.cpp | 26 ++++ .../internal/httpServer/src/TaskManager.cpp | 24 ++++ .../internal/httpServer/src/UserManager.cpp | 24 ++++ .../internal/httpServer/tests/CMakeLists.txt | 16 +++ .../internal/httpServer/tests/RouterSuite.cpp | 124 ++++++++++++++++++ .../httpServer/tests/SolutionManagerSuite.cpp | 60 +++++++++ .../httpServer/tests/TaskManagerSuite.cpp | 42 ++++++ .../httpServer/tests/UserManagerSuite.cpp | 48 +++++++ server/internal/httpServer/tests/main.cpp | 8 ++ .../httpServer/virtual/ISolutionManager.h | 17 +++ .../httpServer/virtual/ITaskManager.h | 17 +++ .../httpServer/virtual/IUserManager.h | 17 +++ 32 files changed, 841 insertions(+), 4 deletions(-) create mode 100644 server/internal/httpServer/CMakeLists.txt create mode 100644 server/internal/httpServer/include/Header.h create mode 100644 server/internal/httpServer/include/HttpConnection.h create mode 100644 server/internal/httpServer/include/HttpServer.h create mode 100644 server/internal/httpServer/include/Parser.h create mode 100644 server/internal/httpServer/include/Request.h create mode 100644 server/internal/httpServer/include/Response.h create mode 100644 server/internal/httpServer/include/Router.h create mode 100644 server/internal/httpServer/include/Serializer.h create mode 100644 server/internal/httpServer/include/SolutionManager.h create mode 100644 server/internal/httpServer/include/TaskManager.h create mode 100644 server/internal/httpServer/include/UserManager.h create mode 100644 server/internal/httpServer/src/HttpConnection.cpp create mode 100644 server/internal/httpServer/src/HttpServer.cpp create mode 100644 server/internal/httpServer/src/Parser.cpp create mode 100644 server/internal/httpServer/src/Response.cpp create mode 100644 server/internal/httpServer/src/Router.cpp create mode 100644 server/internal/httpServer/src/SolutionManager.cpp create mode 100644 server/internal/httpServer/src/TaskManager.cpp create mode 100644 server/internal/httpServer/src/UserManager.cpp create mode 100644 server/internal/httpServer/tests/CMakeLists.txt create mode 100644 server/internal/httpServer/tests/RouterSuite.cpp create mode 100644 server/internal/httpServer/tests/SolutionManagerSuite.cpp create mode 100644 server/internal/httpServer/tests/TaskManagerSuite.cpp create mode 100644 server/internal/httpServer/tests/UserManagerSuite.cpp create mode 100644 server/internal/httpServer/tests/main.cpp create mode 100644 server/internal/httpServer/virtual/ISolutionManager.h create mode 100644 server/internal/httpServer/virtual/ITaskManager.h create mode 100644 server/internal/httpServer/virtual/IUserManager.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 41c84fa..451ba69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,13 +13,13 @@ if(BUILD_DEV) enable_testing() message("Building dev version") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ - -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +# -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") if(SANITIZE_BUILD) message("Sanitizers ON") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-sanitize-recover=all -fsanitize-undefined-trap-on-error") +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-sanitize-recover=all -fsanitize-undefined-trap-on-error") endif(SANITIZE_BUILD) endif(BUILD_DEV) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 2e5c3dc..86cd702 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -3,7 +3,7 @@ project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) -find_library(PQXX_LIB pqxx) +#find_library(PQXX_LIB pqxx) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index f23cb6b..a6a49c7 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -3,6 +3,7 @@ add_subdirectory(entities) add_subdirectory(dbManager) add_subdirectory(repository) add_subdirectory(service) +add_subdirectory(httpServer) set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) @@ -16,4 +17,8 @@ set(SERVICE_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) set(libDbManager_LIB ${libDbManager_LIB} PARENT_SCOPE) set(libDbManager_INCLUDE_DIRS ${libDbManager_INCLUDE_DIRS} PARENT_SCOPE) +set(HTTPSERVER_lib_LIB ${HTTPSERVER_lib_LIB} PARENT_SCOPE) +set(HTTPSERVER_lib_INCLUDE_DIRS ${HTTPSERVER_lib_INCLUDE_DIRS} PARENT_SCOPE) + message("DbManager = ${libDbManager_LIB}") +message("HTTPSERVER = " ${HTTPSERVER_lib_LIB}) diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt new file mode 100644 index 0000000..871e221 --- /dev/null +++ b/server/internal/httpServer/CMakeLists.txt @@ -0,0 +1,24 @@ +project("HttpServerLib") + +set(CMAKE_CXX_STANDARD 20) + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) +file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h) + +include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libEntities_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) + +message("SERVICE_lib_LIB = ${SERVICE_lib_LIB}") +message("SERVICE_lib_INCLUDE_DIRS = ${SERVICE_lib_INCLUDE_DIRS}") + +target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIB} ${libEntities_LIB} ${Boost_LIBRARIES}) + +set(HTTPSERVER_lib_LIB ${PROJECT_NAME}) +set(HTTPSERVER_lib_LIB ${HTTPSERVER_lib_LIB} PARENT_SCOPE) + +set(HTTPSERVER_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(HTTPSERVER_lib_INCLUDE_DIRS ${HTTPSERVER_lib_INCLUDE_DIRS} PARENT_SCOPE) + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/httpServer/include/Header.h b/server/internal/httpServer/include/Header.h new file mode 100644 index 0000000..a3e50dd --- /dev/null +++ b/server/internal/httpServer/include/Header.h @@ -0,0 +1,11 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_HEADER_H_ +#define APP_HTTPSERVER_HTTPSERVER_HEADER_H_ + +#include + +struct Header { + std::string name; + std::string value; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_HEADER_H_ diff --git a/server/internal/httpServer/include/HttpConnection.h b/server/internal/httpServer/include/HttpConnection.h new file mode 100644 index 0000000..cee5f56 --- /dev/null +++ b/server/internal/httpServer/include/HttpConnection.h @@ -0,0 +1,33 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ +#define APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ + + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Router.h" +#include "Parser.h" + +class HttpConnection : public std::enable_shared_from_this, + private boost::noncopyable { + public: + explicit HttpConnection(boost::asio::io_service& io_service); + boost::asio::ip::tcp::socket& getSocket(); + void start(); + protected: + void handleRead(const boost::system::error_code& e, + std::size_t bytes_transferred); + void handleWrite(const boost::system::error_code& e); + + boost::asio::io_service::strand strand; + boost::asio::ip::tcp::socket socket; + std::shared_ptr router; + std::array buffer{}; + Request request; + Parser parser; + Response response; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ diff --git a/server/internal/httpServer/include/HttpServer.h b/server/internal/httpServer/include/HttpServer.h new file mode 100644 index 0000000..083d224 --- /dev/null +++ b/server/internal/httpServer/include/HttpServer.h @@ -0,0 +1,30 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ +#define APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ + +#include +#include +#include +#include +#include + +#include "HttpConnection.h" +#include "Router.h" + +class HttpServer : private boost::noncopyable { + public: + HttpServer(const std::string& address, const std::string& port, std::size_t thread_pool_size); + void run(); + private: + void startAccept(); + void handleAccept(const boost::system::error_code& e); + void handleStop(); + + std::size_t thread_pool_size; + boost::asio::io_service io_service; + boost::asio::signal_set signals; + boost::asio::ip::tcp::acceptor acceptor; + std::shared_ptr connection; +}; + + +#endif // APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ diff --git a/server/internal/httpServer/include/Parser.h b/server/internal/httpServer/include/Parser.h new file mode 100644 index 0000000..142f234 --- /dev/null +++ b/server/internal/httpServer/include/Parser.h @@ -0,0 +1,57 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_PARSER_H_ +#define APP_HTTPSERVER_HTTPSERVER_PARSER_H_ + +#include "Request.h" + +#include +#include + +class Parser { + public: + Parser(); + void reset(); + + template + boost::tuple parse(Request& req, + InputIterator begin, InputIterator end) { + while (begin != end) { + boost::tribool result = consume(req, *begin++); + if (result || !result) + return boost::make_tuple(result, begin); + } + boost::tribool result = boost::indeterminate; + return boost::make_tuple(result, begin); + } + + private: + boost::tribool consume(Request& req, char input); + static bool isChar(int c); + static bool isCtl(int c); + static bool isTspecial(int c); + static bool isDigit(int c); + + enum state { + method_start, + method, + uri, + http_version_h, + http_version_t_1, + http_version_t_2, + http_version_p, + http_version_slash, + http_version_major_start, + http_version_major, + http_version_minor_start, + http_version_minor, + expecting_newline_1, + header_line_start, + header_lws, + header_name, + space_before_header_value, + header_value, + expecting_newline_2, + expecting_newline_3 + } state; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_PARSER_H_ diff --git a/server/internal/httpServer/include/Request.h b/server/internal/httpServer/include/Request.h new file mode 100644 index 0000000..386f9b3 --- /dev/null +++ b/server/internal/httpServer/include/Request.h @@ -0,0 +1,17 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ +#define APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ + +#include +#include + +#include "Header.h" + +struct Request { + std::string method; + std::string uri; + int http_version_major; + int http_version_minor; + std::vector
headers; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ diff --git a/server/internal/httpServer/include/Response.h b/server/internal/httpServer/include/Response.h new file mode 100644 index 0000000..6dd3a1d --- /dev/null +++ b/server/internal/httpServer/include/Response.h @@ -0,0 +1,38 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_REPLY_H_ +#define APP_HTTPSERVER_HTTPSERVER_REPLY_H_ + +#include +#include +#include + +#include "Header.h" + +struct Response { + enum status_type { + ok = 200, + created = 201, + accepted = 202, + no_content = 204, + multiple_choices = 300, + moved_permanently = 301, + moved_temporarily = 302, + not_modified = 304, + bad_request = 400, + unauthorized = 401, + forbidden = 403, + not_found = 404, + internal_server_error = 500, + not_implemented = 501, + bad_gateway = 502, + service_unavailable = 503 + } status; + + std::vector
headers; + std::string content; + + std::vector toBuffers(); + static Response stockResponse(status_type status); +}; + + +#endif // APP_HTTPSERVER_HTTPSERVER_REPLY_H_ diff --git a/server/internal/httpServer/include/Router.h b/server/internal/httpServer/include/Router.h new file mode 100644 index 0000000..50267ea --- /dev/null +++ b/server/internal/httpServer/include/Router.h @@ -0,0 +1,35 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ +#define APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ + +#include +#include +#include + +#include "SolutionManager.h" +#include "UserManager.h" +#include "TaskManager.h" +#include "Response.h" +#include "Request.h" + +class Router : private boost::noncopyable { + public: + Router(); + void handleRequest(const Request& req, Response& res); + void setSolutionManager(std::shared_ptr mng) { + solutionManager = mng; + } + void setUserManager(std::shared_ptr mng) { + userManager = mng; + } + void setTaskManager(std::shared_ptr mng) { + taskManager = mng; + } + private: + std::shared_ptr solutionManager; + std::shared_ptr userManager; + std::shared_ptr taskManager; + static bool decodeUrl(const std::string& in, std::string& out); +}; + + +#endif // APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h new file mode 100644 index 0000000..a8a68be --- /dev/null +++ b/server/internal/httpServer/include/Serializer.h @@ -0,0 +1,14 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ + +#include +#include +#include + +#include "Solution.hpp" +#include "User.hpp" + +class Serializer {}; + + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ diff --git a/server/internal/httpServer/include/SolutionManager.h b/server/internal/httpServer/include/SolutionManager.h new file mode 100644 index 0000000..5a11065 --- /dev/null +++ b/server/internal/httpServer/include/SolutionManager.h @@ -0,0 +1,27 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Serializer.h" +#include "ISolutionManager.h" +#include "ISolutionService.h" + +class SolutionManager : public ISolutionManager { + public: + SolutionManager(); + Response getAllSolutions(const Request &req) override; + Response createSolution(const Request &req) override; + Response getMetrics(const Request &req) override; + void setService(std::shared_ptr service); + + private: + std::shared_ptr solutionService; + std::shared_ptr serializer; + static std::string getParam(const std::string& path, const std::string& name); +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ diff --git a/server/internal/httpServer/include/TaskManager.h b/server/internal/httpServer/include/TaskManager.h new file mode 100644 index 0000000..c49b08b --- /dev/null +++ b/server/internal/httpServer/include/TaskManager.h @@ -0,0 +1,25 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Serializer.h" +#include "ITaskManager.h" +#include "ITaskService.h" + +class TaskManager : public ITaskManager { +public: + TaskManager(); + Response createTask(const Request &req) override; + Response getAllTasks(const Request &req) override; + void setService(std::shared_ptr service); +private: + std::shared_ptr taskService; + std::shared_ptr serializer; + static std::string getParam(const std::string& path, const std::string& name); +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ diff --git a/server/internal/httpServer/include/UserManager.h b/server/internal/httpServer/include/UserManager.h new file mode 100644 index 0000000..9043ada --- /dev/null +++ b/server/internal/httpServer/include/UserManager.h @@ -0,0 +1,25 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Serializer.h" +#include "IUserManager.h" +#include "IUserService.h" + +class UserManager : public IUserManager { + public: + UserManager(); + Response loginUser(const Request &req) override; + Response registerUser(const Request &req) override; + void setService(std::shared_ptr service); + private: + std::shared_ptr userService; + std::shared_ptr serializer; + static std::string getParam(const std::string& path, const std::string& name); +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ diff --git a/server/internal/httpServer/src/HttpConnection.cpp b/server/internal/httpServer/src/HttpConnection.cpp new file mode 100644 index 0000000..412f670 --- /dev/null +++ b/server/internal/httpServer/src/HttpConnection.cpp @@ -0,0 +1,16 @@ +#include "HttpConnection.h" + +#include + +HttpConnection::HttpConnection(boost::asio::io_service& io_service) + : strand(io_service), + socket(io_service) {} + +boost::asio::ip::tcp::socket& HttpConnection::getSocket() {} + +void HttpConnection::start() {} + +void HttpConnection::handleRead(const boost::system::error_code& e, + std::size_t bytes_transferred) {} + +void HttpConnection::handleWrite(const boost::system::error_code& e) {} diff --git a/server/internal/httpServer/src/HttpServer.cpp b/server/internal/httpServer/src/HttpServer.cpp new file mode 100644 index 0000000..246b4f0 --- /dev/null +++ b/server/internal/httpServer/src/HttpServer.cpp @@ -0,0 +1,20 @@ +#include "HttpServer.h" + +#include +#include +#include +#include + +HttpServer::HttpServer(const std::string& address, const std::string& port, std::size_t thread_pool_size) + : thread_pool_size(thread_pool_size), + signals(io_service), + acceptor(io_service), + connection() {} + +void HttpServer::run() {} + +void HttpServer::startAccept() {} + +void HttpServer::handleAccept(const boost::system::error_code& e) {} + +void HttpServer::handleStop() {} diff --git a/server/internal/httpServer/src/Parser.cpp b/server/internal/httpServer/src/Parser.cpp new file mode 100644 index 0000000..86b9541 --- /dev/null +++ b/server/internal/httpServer/src/Parser.cpp @@ -0,0 +1,17 @@ +#include "Parser.h" +#include "Request.h" + +Parser::Parser() + : state(method_start) {} + +void Parser::reset() {} + +boost::tribool Parser::consume(Request& req, char input) {} + +bool Parser::isChar(int c) {} + +bool Parser::isCtl(int c) {} + +bool Parser::isTspecial(int c) {} + +bool Parser::isDigit(int c) {} diff --git a/server/internal/httpServer/src/Response.cpp b/server/internal/httpServer/src/Response.cpp new file mode 100644 index 0000000..f688c34 --- /dev/null +++ b/server/internal/httpServer/src/Response.cpp @@ -0,0 +1,5 @@ +#include "Response.h" + +std::vector Response::toBuffers() {} + +Response Response::stockResponse(Response::status_type status) {} diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp new file mode 100644 index 0000000..e235dee --- /dev/null +++ b/server/internal/httpServer/src/Router.cpp @@ -0,0 +1,15 @@ +#include "Router.h" + +#include +#include +#include + +#include "Response.h" + +Router::Router() : + solutionManager(std::make_shared()), + userManager(std::make_shared()) {} + +void Router::handleRequest(const Request& req, Response& res) {} + +bool Router::decodeUrl(const std::string& in, std::string& out) {} diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp new file mode 100644 index 0000000..3a93e41 --- /dev/null +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -0,0 +1,26 @@ +// +// Created by Николай Степанов on 03.05.2023. +// +#include "SolutionManager.h" + +SolutionManager::SolutionManager() {} + +Response SolutionManager::getAllSolutions(const Request &req) { + return Response(); +} + +Response SolutionManager::createSolution(const Request &req) { + return Response(); +} + +Response SolutionManager::getMetrics(const Request &req) { + return Response(); +} + +std::string SolutionManager::getParam(const std::string &path, const std::string &name) { + return std::string(); +} + +void SolutionManager::setService(std::shared_ptr service) { + solutionService = service; +} diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp new file mode 100644 index 0000000..ca3875d --- /dev/null +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -0,0 +1,24 @@ +// +// Created by Николай Степанов on 03.05.2023. +// +#include "TaskManager.h" + +TaskManager::TaskManager() { + +} + +Response TaskManager::createTask(const Request &req) { + return Response(); +} + +Response TaskManager::getAllTasks(const Request &req) { + return Response(); +} + +std::string TaskManager::getParam(const std::string &path, const std::string &name) { + return std::string(); +} + +void TaskManager::setService(std::shared_ptr service) { + taskService = service; +} diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp new file mode 100644 index 0000000..4137716 --- /dev/null +++ b/server/internal/httpServer/src/UserManager.cpp @@ -0,0 +1,24 @@ +// +// Created by Николай Степанов on 03.05.2023. +// +#include "UserManager.h" + +UserManager::UserManager() { + +} + +Response UserManager::loginUser(const Request &req) { + return Response(); +} + +Response UserManager::registerUser(const Request &req) { + return Response(); +} + +std::string UserManager::getParam(const std::string &path, const std::string &name) { + return std::string(); +} + +void UserManager::setService(std::shared_ptr service) { + userService = service; +} diff --git a/server/internal/httpServer/tests/CMakeLists.txt b/server/internal/httpServer/tests/CMakeLists.txt new file mode 100644 index 0000000..c635b60 --- /dev/null +++ b/server/internal/httpServer/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +project(test_httpserver) + +set(CMAKE_CXX_STANDARD 20) +add_compile_options(-coverage) + +file(GLOB SOURCES *.cpp) + +enable_testing() +find_package(GTest REQUIRED) + +add_executable(${PROJECT_NAME} ${SOURCES}) + +target_link_libraries(${PROJECT_NAME} ${HTTPSERVER_lib_LIB} GTest::GTest GTest::gmock) +target_include_directories(${PROJECT_NAME} PUBLIC ${HTTPSERVER_lib_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS}) + +add_test(test_httpserver test_httpserver) \ No newline at end of file diff --git a/server/internal/httpServer/tests/RouterSuite.cpp b/server/internal/httpServer/tests/RouterSuite.cpp new file mode 100644 index 0000000..6fd7331 --- /dev/null +++ b/server/internal/httpServer/tests/RouterSuite.cpp @@ -0,0 +1,124 @@ +#include +#include + +#include "Router.h" +#include "ISolutionManager.h" +#include "ITaskManager.h" +#include "IUserManager.h" + +class SolutionManagerMock : public ISolutionManager { +public: + SolutionManagerMock() = default; + MOCK_METHOD(Response, getAllSolutions, (const Request &req), (override)); + MOCK_METHOD(Response, createSolution, (const Request& req), (override)); + MOCK_METHOD(Response, getMetrics, (const Request& req), (override)); +}; + +class TaskManagerMock : public ITaskManager { +public: + TaskManagerMock() = default; + MOCK_METHOD(Response, createTask, (const Request &req), (override)); + MOCK_METHOD(Response, getAllTasks, (const Request& req), (override)); +}; + +class UserManagerMock : public IUserManager { +public: + UserManagerMock() = default; + MOCK_METHOD(Response, loginUser, (const Request &req), (override)); + MOCK_METHOD(Response, registerUser, (const Request& req), (override)); +}; + +class RouterSuite : public ::testing::Test { +protected: + void SetUp() override { + router.setSolutionManager(solutionManager); + router.setUserManager(userManager); + router.setTaskManager(taskManager); + } + + std::shared_ptr userManager = std::make_shared(); + std::shared_ptr taskManager = std::make_shared(); + std::shared_ptr solutionManager = std::make_shared(); + Router router; +}; + +TEST_F(RouterSuite, RegisterUserTest) { + Request req; + req.method = "POST"; + req.uri = "/user/register"; + Response res; + EXPECT_CALL(*userManager, registerUser); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, LoginUserTest) { + Request req; + req.method = "GET"; + req.uri = "/user/login"; + Response res; + EXPECT_CALL(*userManager, loginUser); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, GetAllTasksTest) { + Request req; + req.method = "GET"; + req.uri = "/task/all"; + Response res; + EXPECT_CALL(*taskManager, getAllTasks); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, CreateTaskTest) { + Request req; + req.method = "POST"; + req.uri = "/task/create"; + Response res; + EXPECT_CALL(*taskManager, createTask); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, GetSolutionMetricsTest) { + Request req; + req.method = "GET"; + req.uri = "/solution/metrics"; + Response res; + EXPECT_CALL(*solutionManager, getMetrics); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, CreateSolutionTest) { + Request req; + req.method = "POST"; + req.uri = "/solution/create"; + Response res; + EXPECT_CALL(*solutionManager, createSolution); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, GetAllSolutionsTest) { + Request req; + req.method = "GET"; + req.uri = "/solution/all"; + Response res; + EXPECT_CALL(*solutionManager, getAllSolutions); + router.handleRequest(req, res); +} + +TEST_F(RouterSuite, BadMethodTest) { + Request req; + req.method = ""; + req.uri = "/solution/all"; + Response res; + router.handleRequest(req, res); + EXPECT_EQ(res.status, 500); +} + +TEST_F(RouterSuite, BadUriTest) { + Request req; + req.method = "GET"; + req.uri = ""; + Response res; + router.handleRequest(req, res); + EXPECT_EQ(res.status, 500); +} \ No newline at end of file diff --git a/server/internal/httpServer/tests/SolutionManagerSuite.cpp b/server/internal/httpServer/tests/SolutionManagerSuite.cpp new file mode 100644 index 0000000..fb5cc54 --- /dev/null +++ b/server/internal/httpServer/tests/SolutionManagerSuite.cpp @@ -0,0 +1,60 @@ +#include +#include + +#include "SolutionManager.h" +#include "ISolutionService.h" + +class SolutionServiceMock : public ISolutionService { +public: + SolutionServiceMock() = default; + MOCK_METHOD(Solution, createSolution, (size_t userId, size_t taskId, std::string source), (override)); + MOCK_METHOD(std::vector, getSolutionsByUserAndTaskId, (size_t userId, size_t taskId), (override)); + MOCK_METHOD((std::pair), getMetrics, (size_t solId), (override)); + MOCK_METHOD(void, deleteSolutionById, (size_t solId), (override)); +}; + +class SolutionManagerSuite : public ::testing::Test { +protected: + void SetUp() override { + manager.setService(solutionService); + } + + std::shared_ptr solutionService = std::make_shared(); + SolutionManager manager; +}; + +TEST_F(SolutionManagerSuite, GetSolutionByUserAndTaskTest) { + Request req; + Header h1, h2; + h1.name = "user_id"; + h2.name = "task_id"; + h1.value = '1'; + h2.value = '2'; + req.headers = {h1, h2}; + EXPECT_CALL(*solutionService, getSolutionsByUserAndTaskId(1, 2)); + manager.getAllSolutions(req); +} + +TEST_F(SolutionManagerSuite, GetMetricsTest) { + Request req; + Header h1; + h1.name = "sol_id"; + h1.value = "1"; + req.headers = {h1}; + EXPECT_CALL(*solutionService, getMetrics(1)); + manager.getMetrics(req); +} + +TEST_F(SolutionManagerSuite, CreateSolutionTest) { + Request req; + Header h1, h2, h3; + h1.name = "user_id"; + h1.value = "1"; + h2.name = "task_id"; + h2.value = "2"; + h3.name = "source"; + h3.value = "int main() { return 0; }"; + req.headers = {h1, h2, h3}; + EXPECT_CALL(*solutionService, createSolution(1, 2, "int main() { return 0; }")); + manager.createSolution(req); +} \ No newline at end of file diff --git a/server/internal/httpServer/tests/TaskManagerSuite.cpp b/server/internal/httpServer/tests/TaskManagerSuite.cpp new file mode 100644 index 0000000..f4822d2 --- /dev/null +++ b/server/internal/httpServer/tests/TaskManagerSuite.cpp @@ -0,0 +1,42 @@ +#include +#include + +#include "TaskManager.h" +#include "ITaskService.h" + +class TaskServiceMock : public ITaskService { +public: + TaskServiceMock() = default; + ~TaskServiceMock() = default; + + MOCK_METHOD(Task, createTask, (std::string desc), (override)); + MOCK_METHOD(Task, getTask, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks, (), (override)); + MOCK_METHOD(void, deleteTask, (size_t id), (override)); +}; + +class TaskManagerSuite : public ::testing::Test { +protected: + void SetUp() override { + manager.setService(taskService); + } + + std::shared_ptr taskService = std::make_shared(); + TaskManager manager; +}; + +TEST_F(TaskManagerSuite, CreateTaskTest) { + Request req; + Header h1, h2; + h1.name = "description"; + h1.value = "a"; + req.headers = {h1}; + EXPECT_CALL(*taskService, createTask("a")); + manager.createTask(req); +} + +TEST_F(TaskManagerSuite, GetAllTaskTest) { + Request req; + EXPECT_CALL(*taskService, getAllTasks); + manager.getAllTasks(req); +} \ No newline at end of file diff --git a/server/internal/httpServer/tests/UserManagerSuite.cpp b/server/internal/httpServer/tests/UserManagerSuite.cpp new file mode 100644 index 0000000..ad6b9d4 --- /dev/null +++ b/server/internal/httpServer/tests/UserManagerSuite.cpp @@ -0,0 +1,48 @@ +#include +#include + +#include "UserManager.h" +#include "IUserService.h" + +class UserServiceMock : public IUserService { +public: + UserServiceMock() = default; + ~UserServiceMock() = default; + MOCK_METHOD(User, createUser, (std::string login, std::string username, std::string password), (override)); + MOCK_METHOD(User, getUserById, (size_t id), (override)); + MOCK_METHOD(void, deleteUser, (size_t id), (override)); +}; + +class UserManagerSuite : public ::testing::Test { +protected: + void SetUp() override { + manager.setService(userService); + } + + std::shared_ptr userService = std::make_shared(); + UserManager manager; +}; + +TEST_F(UserManagerSuite, LoginUserTest) { + Request req; + Header h1, h2; + h1.name = "login"; + h1.value = 1; + req.headers = {h1}; + EXPECT_CALL(*userService, getUserById(1)); + manager.loginUser(req); +} + +TEST_F(UserManagerSuite, RgisterUserTest) { + Request req; + Header h1, h2, h3; + h1.name = "login"; + h1.value = "1"; + h2.name = "username"; + h2.value = "2"; + h3.name = "password"; + h3.value = "3"; + req.headers = {h1, h2, h3}; + EXPECT_CALL(*userService, createUser("1", "2", "3")); + manager.registerUser(req); +} \ No newline at end of file diff --git a/server/internal/httpServer/tests/main.cpp b/server/internal/httpServer/tests/main.cpp new file mode 100644 index 0000000..b8dd7bc --- /dev/null +++ b/server/internal/httpServer/tests/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleMock(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/httpServer/virtual/ISolutionManager.h b/server/internal/httpServer/virtual/ISolutionManager.h new file mode 100644 index 0000000..cd77215 --- /dev/null +++ b/server/internal/httpServer/virtual/ISolutionManager.h @@ -0,0 +1,17 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" + +class ISolutionManager { +public: + virtual Response getAllSolutions(const Request &req) = 0; + virtual Response createSolution(const Request &req) = 0; + virtual Response getMetrics(const Request &req) = 0; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ diff --git a/server/internal/httpServer/virtual/ITaskManager.h b/server/internal/httpServer/virtual/ITaskManager.h new file mode 100644 index 0000000..11747f7 --- /dev/null +++ b/server/internal/httpServer/virtual/ITaskManager.h @@ -0,0 +1,17 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Serializer.h" + +class ITaskManager { +public: + virtual Response createTask(const Request &req) = 0; + virtual Response getAllTasks(const Request &req) = 0; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ diff --git a/server/internal/httpServer/virtual/IUserManager.h b/server/internal/httpServer/virtual/IUserManager.h new file mode 100644 index 0000000..599a8ec --- /dev/null +++ b/server/internal/httpServer/virtual/IUserManager.h @@ -0,0 +1,17 @@ +#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ +#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ + +#include +#include + +#include "Response.h" +#include "Request.h" +#include "Serializer.h" + +class IUserManager { +public: + virtual Response loginUser(const Request &req) = 0; + virtual Response registerUser(const Request &req) = 0; +}; + +#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ -- GitLab From c9a2b667a3fa848364e6e145fe47622b886c34ea Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 3 May 2023 19:36:59 +0300 Subject: [PATCH 031/134] finish Jaccard and Livenstain metrics --- metrics/metrics_headers/TextMetricsLib.h | 23 ++++++---- metrics/source/TextMetricImpl.cpp | 56 +++++++++++++++++++++--- metrics/tbm_main.cpp | 2 +- src/main.cpp | 31 ++++++++++++- 4 files changed, 94 insertions(+), 18 deletions(-) diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h index 2830b07..97cd280 100644 --- a/metrics/metrics_headers/TextMetricsLib.h +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -9,33 +9,38 @@ #include #include #include +#include #include class ITextMetric{ - virtual double countMetric() = 0; - virtual void getData(std::istream& fin1, std::istream& fin2) = 0; + virtual void countMetric() = 0; + virtual void getData(std::string text1, std::string text2) = 0; + virtual double getMetric() = 0; }; class PrepareDataTextMetric : public ITextMetric{ public: - void getData(std::istream& fin1, std::istream& fin2); + void getData(std::string text1, std::string text2) override; + double getMetric() override; protected: std::vector tokens1; std::vector tokens2; + double metric_res; +private: static std::string deleteComments(const std::string& text); - std::vector tbmTokenizer(const std::string &text); + static std::vector tbmTokenizer(const std::string &text); }; class LivDistTextMetric : public PrepareDataTextMetric{ public: - double countMetric(); - + void countMetric() override; +}; -private: - std::vector tokens1; - std::vector tokens2; +class JaccardTextMetric : public PrepareDataTextMetric{ +public: + void countMetric() override; }; diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index 8c33fbc..330d667 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -5,13 +5,7 @@ #include "TextMetricsLib.h" -void PrepareDataTextMetric::getData(std::istream &fin1, std::istream &fin2) { - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - +void PrepareDataTextMetric::getData(std::string text1, std::string text2) { std::string non_comm_text1 = deleteComments(text1); std::string non_comm_text2 = deleteComments(text2); @@ -71,5 +65,53 @@ std::vector PrepareDataTextMetric::tbmTokenizer(const std::string return res; } +double PrepareDataTextMetric::getMetric() { + return metric_res; +} + +void LivDistTextMetric::countMetric(){ + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + int x, y, z; + + std::vector > lev (n, std::vector (m, 0)); + + for (int i = 0; i < n; i++){ + for (int j = 0; j < m; j++){ + if (std::min(i, j) == 0){ + lev[i][j] = std::max(i, j); + } + else{ + x = lev[i-1][j]; + y = lev[i][j-1]; + z = lev[i-1][j-1]; + lev[i][j] = std::min(x, std::min(y, z)); + if (tokens1[i] != tokens2[j]){ + lev[i][j]++; + } + } + } + } + + metric_res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); +} + + +void JaccardTextMetric::countMetric() { + std::set s1; + std::set s2; + + for (auto &i : tokens1) s1.insert(i); + for (auto &i : tokens2) s2.insert(i); + std::set intersect_sets; + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(intersect_sets, intersect_sets.begin())); + + std::set union_sets; + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(union_sets, union_sets.begin())); + + metric_res = static_cast (intersect_sets.size()) / static_cast (union_sets.size()); +} diff --git a/metrics/tbm_main.cpp b/metrics/tbm_main.cpp index 797084c..e10d94f 100644 --- a/metrics/tbm_main.cpp +++ b/metrics/tbm_main.cpp @@ -86,7 +86,7 @@ double Jaccard_metric(const std::vector & tokens1, const std::vecto std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); + return тут (intersect_sets.size()) / static_cast (union_sets.size()); } double Livenstain_dist(std::vector tokens1, std::vector tokens2){ diff --git a/src/main.cpp b/src/main.cpp index a7225a7..61e7b20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,32 @@ +#include #include "TextMetricsLib.h" +#include -#include \ No newline at end of file +int main(){ + std::ifstream fin1; + fin1.open("metrics/code1.txt"); + assert(fin1.is_open()); + + std::ifstream fin2; + fin2.open("metrics/code2.txt"); + assert(fin2.is_open()); + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); + fin1.close(); + fin2.close(); + + LivDistTextMetric livDistTextMetric; + JaccardTextMetric jaccardTextMetric; + + livDistTextMetric.getData(text1, text2); + jaccardTextMetric.getData(text1, text2); + + livDistTextMetric.countMetric(); + jaccardTextMetric.countMetric(); + + std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric(); +} \ No newline at end of file -- GitLab From 30f21ba5f8269fc9351b5bfbd19d6dfb7ea99a59 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 3 May 2023 19:51:18 +0300 Subject: [PATCH 032/134] add folder and delete old file --- metrics/tbm_main.cpp | 155 ------------------------------ metrics/{ => testProgs}/code1.txt | 0 metrics/{ => testProgs}/code2.txt | 0 src/main.cpp | 7 +- 4 files changed, 4 insertions(+), 158 deletions(-) delete mode 100644 metrics/tbm_main.cpp rename metrics/{ => testProgs}/code1.txt (100%) rename metrics/{ => testProgs}/code2.txt (100%) diff --git a/metrics/tbm_main.cpp b/metrics/tbm_main.cpp deleted file mode 100644 index e10d94f..0000000 --- a/metrics/tbm_main.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// -// Created by march on 21.04.2023. -// - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "metrics_headers/TextMetricsLib.h" - - -std::string deleteComms(const std::string& text){ - std::string modif; - std::string res; - - std::stringstream ss; - std::string line; - - ss << text; - - while(getline(ss, line)){ - line.pop_back(); - line.push_back('\0'); - modif += line; - } - - bool s_comm = false; - bool m_comm = false; - - for (int i = 0; i < modif.size(); i++){ - if (s_comm && modif[i] == '\0') - s_comm = false; - else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') - m_comm = false, i++; - else if (s_comm || m_comm) - continue; - else if (modif[i] == '/' && modif[i+1] == '/') - s_comm = true, i++; - else if (modif[i] == '/' && modif[i+1] == '*') - m_comm = true, i++; - - else if (modif[i] != '\0') - res += modif[i]; - else{ - res += '\n'; - } - } - return res; -} - -std::vector tbm_tokenizer(const std::string &text){ - boost::char_separator sep(" {}();,\"\0\'"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); - - for (const std::string &s: tokens) { - if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ - res.push_back(s); - } - } - return res; -} - -// % = intersection(A, B) / union(A, B) -double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ - std::set s1; - std::set s2; - - for (auto &i : tokens1) s1.insert(i); - for (auto &i : tokens2) s2.insert(i); - - - std::set intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); - - std::set union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); - - std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; - - return тут (intersect_sets.size()) / static_cast (union_sets.size()); -} - -double Livenstain_dist(std::vector tokens1, std::vector tokens2){ - unsigned long n = tokens1.size(); - unsigned long m = tokens2.size(); - int x, y, z; - - std::vector > lev (n, std::vector (m, 0)); - - for (int i = 0; i < n; i++){ - for (int j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = std::max(i, j); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; - lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ - lev[i][j]++; - } - } - } - } - - return lev[n-1][m-1]; -} - -std::pair textCompare(std::istream& fin1, std::istream& fin2){ - std::string line; - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - - std::string non_comm_text1 = deleteComms(text1); - std::string non_comm_text2 = deleteComms(text2); - - std::vector tokens1 = tbm_tokenizer(non_comm_text1); - std::vector tokens2 = tbm_tokenizer(non_comm_text2); - - double res1 = Jaccard_metric(tokens1, tokens2); - double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); - - return {res1, res2}; -} - -int main(){ - - std::ifstream fin1; - fin1.open("text-basic-metrics/code1.txt"); - assert(fin1.is_open()); - - std::ifstream fin2; - fin2.open("text-basic-metrics/code2.txt"); - assert(fin2.is_open()); - - std::pair metrics_res = textCompare(fin1, fin2); - - std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; - fin1.close(); - fin2.close(); -} \ No newline at end of file diff --git a/metrics/code1.txt b/metrics/testProgs/code1.txt similarity index 100% rename from metrics/code1.txt rename to metrics/testProgs/code1.txt diff --git a/metrics/code2.txt b/metrics/testProgs/code2.txt similarity index 100% rename from metrics/code2.txt rename to metrics/testProgs/code2.txt diff --git a/src/main.cpp b/src/main.cpp index 61e7b20..e1d00e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,14 +1,15 @@ #include -#include "TextMetricsLib.h" #include +#include "TextMetricsLib.h" + int main(){ std::ifstream fin1; - fin1.open("metrics/code1.txt"); + fin1.open("metrics/testProgs/code1.txt"); assert(fin1.is_open()); std::ifstream fin2; - fin2.open("metrics/code2.txt"); + fin2.open("metrics/testProgs/code2.txt"); assert(fin2.is_open()); std::string text1( (std::istreambuf_iterator(fin1) ), -- GitLab From 14f2e9696c6102c0dec444e4009321cda30013e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 3 May 2023 20:20:16 +0300 Subject: [PATCH 033/134] Add tests for http client --- CMakeLists.txt | 53 +++- client/CMakeLists.txt | 15 + client/cmd/CMakeLists.txt | 0 client/internal/CMakeLists.txt | 8 + client/internal/entities/CMakeLists.txt | 19 ++ client/internal/entities/include/Metric.h | 11 + client/internal/entities/include/Solution.h | 58 ++++ client/internal/entities/include/Task.h | 23 ++ client/internal/entities/include/User.h | 38 +++ client/internal/entities/src/Solution.cpp | 73 +++++ client/internal/entities/src/Task.cpp | 21 ++ client/internal/entities/src/User.cpp | 43 +++ client/internal/httpClient/CMakeLists.txt | 21 ++ .../internal/httpClient/include/ClientTypes.h | 34 +++ .../internal/httpClient/include/HttpClient.h | 41 +++ .../httpClient/include/HttpClientManager.h | 33 +++ .../internal/httpClient/include/Serializer.h | 14 + client/internal/httpClient/src/HttpClient.cpp | 32 +++ .../httpClient/src/HttpClientManager.cpp | 42 +++ .../internal/httpClient/tests/CMakeLists.txt | 16 ++ .../tests/HttpClientManagerSuite.cpp | 64 +++++ .../httpClient/tests/HttpClientSuite.cpp | 11 + client/internal/httpClient/tests/main.cpp | 8 + .../internal/httpClient/virtual/IHttpClient.h | 32 +++ server/CMakeLists.txt | 0 src/main.cpp | 264 ------------------ text-basic-metrics/code1.txt | 29 -- text-basic-metrics/code2.txt | 29 -- text-basic-metrics/tbm_main.cpp | 153 ---------- 29 files changed, 696 insertions(+), 489 deletions(-) create mode 100644 client/CMakeLists.txt create mode 100644 client/cmd/CMakeLists.txt create mode 100644 client/internal/CMakeLists.txt create mode 100644 client/internal/entities/CMakeLists.txt create mode 100644 client/internal/entities/include/Metric.h create mode 100644 client/internal/entities/include/Solution.h create mode 100644 client/internal/entities/include/Task.h create mode 100644 client/internal/entities/include/User.h create mode 100644 client/internal/entities/src/Solution.cpp create mode 100644 client/internal/entities/src/Task.cpp create mode 100644 client/internal/entities/src/User.cpp create mode 100644 client/internal/httpClient/CMakeLists.txt create mode 100644 client/internal/httpClient/include/ClientTypes.h create mode 100644 client/internal/httpClient/include/HttpClient.h create mode 100644 client/internal/httpClient/include/HttpClientManager.h create mode 100644 client/internal/httpClient/include/Serializer.h create mode 100644 client/internal/httpClient/src/HttpClient.cpp create mode 100644 client/internal/httpClient/src/HttpClientManager.cpp create mode 100644 client/internal/httpClient/tests/CMakeLists.txt create mode 100644 client/internal/httpClient/tests/HttpClientManagerSuite.cpp create mode 100644 client/internal/httpClient/tests/HttpClientSuite.cpp create mode 100644 client/internal/httpClient/tests/main.cpp create mode 100644 client/internal/httpClient/virtual/IHttpClient.h create mode 100644 server/CMakeLists.txt delete mode 100644 src/main.cpp delete mode 100644 text-basic-metrics/code1.txt delete mode 100644 text-basic-metrics/code2.txt delete mode 100644 text-basic-metrics/tbm_main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5054100..23aba3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,40 @@ -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.16) -set(CMAKE_PREFIX_PATH build) -project(SourcedOut CXX) -# find_package(antlr4-runtime REQUIRED) -find_package(Boost 1.8.1 REQUIRED) -# find_package(libpqxx REQUIRED) -find_package(GTest REQUIRED) -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) -message(STATUS ${Boost_LIBRARIES}) -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") -add_executable(${PROJECT_NAME} src/main.cpp) -#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file + +set(PROJECT_NAME "SourcedOut") + +project(${PROJECT_NAME}) + + +set(BUILD_DEV TRUE CACHE BOOL "build dev version") +set(SANITIZE_BUILD TRUE CACHE BOOL "build with sanitizers") + +if(BUILD_DEV) + enable_testing() + message("Building dev version") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ + # -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") + + if(SANITIZE_BUILD) + message("Sanitizers ON") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-sanitize-recover=all -fsanitize-undefined-trap-on-error") + endif(SANITIZE_BUILD) +endif(BUILD_DEV) + +set(BUILD_SERVER "BUILD_SERVER") +set(BUILD_CLIENT "BUILD_CLIENT") +set(BUILD_ALL "BUILD_ALL") + + +message("${BUILD_DEV} ${SANITIZE_BUILD} ${CMAKE_EXE_LINKER_FLAGS}") +set(BUILD_MODE ${BUILD_CLIENT}) + +if((BUILD_MODE STREQUAL ${BUILD_CLIENT}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(client) +endif() + +if((BUILD_MODE STREQUAL ${BUILD_SERVER}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(server) +endif() \ No newline at end of file diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt new file mode 100644 index 0000000..4147519 --- /dev/null +++ b/client/CMakeLists.txt @@ -0,0 +1,15 @@ +set(CMAKE_PREFIX_PATH build) +project(SourcedOut_client CXX) + +set(CMAKE_CXX_STANDARD 20) + +find_package(Boost 1.8.1 REQUIRED) +find_package(GTest REQUIRED) + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + +add_subdirectory(internal) +add_subdirectory(cmd) + +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") \ No newline at end of file diff --git a/client/cmd/CMakeLists.txt b/client/cmd/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/client/internal/CMakeLists.txt b/client/internal/CMakeLists.txt new file mode 100644 index 0000000..93fbed8 --- /dev/null +++ b/client/internal/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(entities) +add_subdirectory(httpClient) + +set(libClientEntities_LIB ${libClientEntities_LIB} PARENT_SCOPE) +set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOPE) + +set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) +set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/entities/CMakeLists.txt b/client/internal/entities/CMakeLists.txt new file mode 100644 index 0000000..4087519 --- /dev/null +++ b/client/internal/entities/CMakeLists.txt @@ -0,0 +1,19 @@ +project("ClientEntitiesLib") + +set(LIB_NAME libClientEntities) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set(libClientEntities_LIB ${LIB_NAME}) +set(libClientEntities_LIB ${libClientEntities_LIB} PARENT_SCOPE) +set(libClientEntities_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/entities/include/Metric.h b/client/internal/entities/include/Metric.h new file mode 100644 index 0000000..3ab8ea7 --- /dev/null +++ b/client/internal/entities/include/Metric.h @@ -0,0 +1,11 @@ +#ifndef SOURCEDOUT_METRIC_H +#define SOURCEDOUT_METRIC_H + +#include + +struct Metric { + std::string name; + unsigned int value; +}; + +#endif //SOURCEDOUT_METRIC_H diff --git a/client/internal/entities/include/Solution.h b/client/internal/entities/include/Solution.h new file mode 100644 index 0000000..6282f47 --- /dev/null +++ b/client/internal/entities/include/Solution.h @@ -0,0 +1,58 @@ +#ifndef SOURCEDOUT_SOLUTION_HPP +#define SOURCEDOUT_SOLUTION_HPP + +#include +#include +#include + +class Solution { +public: + Solution() =default; + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, + std::string tokens, std::string astTree, size_t taskId, std::string result); + + [[nodiscard]] size_t getId() const; + + + [[nodiscard]] const std::string &getSendDate() const; + + void setSendDate(const std::string &sendDate); + + [[nodiscard]] size_t getSenderId() const; + + void setSenderId(size_t senderId); + + [[nodiscard]] const std::string &getSource() const; + + void setSource(const std::string &source); + + [[nodiscard]] const std::string &getTokens() const; + + void setTokens(const std::string &tokens); + + [[nodiscard]] const std::string &getAstTree() const; + + void setAstTree(const std::string &astTree); + + [[nodiscard]] size_t getTaskId() const; + + void setTaskId(size_t taskId); + + [[nodiscard]] const std::string &getResult() const; + + void setResult(const std::string &result); + +private: + size_t id; + std::string send_date; + size_t sender_id; + std::string source; + std::string tokens; + std::string astTree; + size_t task_id; + std::string result; +public: + +}; + +#endif //SOURCEDOUT_SOLUTION_HPP \ No newline at end of file diff --git a/client/internal/entities/include/Task.h b/client/internal/entities/include/Task.h new file mode 100644 index 0000000..d51c17f --- /dev/null +++ b/client/internal/entities/include/Task.h @@ -0,0 +1,23 @@ +#ifndef SOURCEDOUT_TASK_HPP +#define SOURCEDOUT_TASK_HPP +#include +#include +class Task{ +private: + size_t id; + std::string description; + +public: + Task()=default; + ~Task() = default; + Task(size_t id, std::string description); + + explicit Task(std::string description); + + [[nodiscard]] size_t getId() const; + + [[nodiscard]] const std::string &getDescription() const; + + void setDescription(const std::string &description); +}; +#endif //SOURCEDOUT_TASK_HPP \ No newline at end of file diff --git a/client/internal/entities/include/User.h b/client/internal/entities/include/User.h new file mode 100644 index 0000000..5802df2 --- /dev/null +++ b/client/internal/entities/include/User.h @@ -0,0 +1,38 @@ +#ifndef SOURCEDOUT_USER_HPP + +#include +#include + +#define SOURCEDOUT_USER_HPP + +class User { +private: + size_t id; + std::string login; + std::string password; + std::string username; + +public: + User()=default; + User(size_t id_, std::string login_, std::string password_, std::string username_); + + User(std::string login_, std::string password_, std::string username_); + + [[nodiscard]] const std::string &getLogin() const; + + void setLogin(const std::string &login); + + [[nodiscard]] const std::string &getPassword() const; + + void setPassword(const std::string &password); + + [[nodiscard]] const std::string &getUsername() const; + + void setUsername(const std::string &username); + + [[nodiscard]] size_t getId() const; + + friend std::ostream &operator<<(std::ostream &os, const User &user); +}; + +#endif //SOURCEDOUT_USER_HPP \ No newline at end of file diff --git a/client/internal/entities/src/Solution.cpp b/client/internal/entities/src/Solution.cpp new file mode 100644 index 0000000..2e9b1e8 --- /dev/null +++ b/client/internal/entities/src/Solution.cpp @@ -0,0 +1,73 @@ + +#include +#include +#include "Solution.h" + +Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, + std::string source, std::string tokens, + std::string astTree, unsigned long taskId, + std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)) {} + +size_t Solution::getId() const { + return id; +} + + +const std::string &Solution::getSendDate() const { + return send_date; +} + +void Solution::setSendDate(const std::string &sendDate) { + send_date = sendDate; +} + +size_t Solution::getSenderId() const { + return sender_id; +} + +void Solution::setSenderId(size_t senderId) { + sender_id = senderId; +} + +const std::string &Solution::getSource() const { + return source; +} + +void Solution::setSource(const std::string &source_) { + Solution::source = source_; +} + +const std::string &Solution::getTokens() const { + return tokens; +} + +void Solution::setTokens(const std::string &tokens_) { + Solution::tokens = tokens_; +} + +const std::string &Solution::getAstTree() const { + return astTree; +} + +void Solution::setAstTree(const std::string &astTree_) { + Solution::astTree = astTree_; +} + +size_t Solution::getTaskId() const { + return task_id; +} + +void Solution::setTaskId(size_t taskId) { + task_id = taskId; +} + +const std::string &Solution::getResult() const { + return result; +} + +void Solution::setResult(const std::string &result_) { + Solution::result = result_; +} \ No newline at end of file diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp new file mode 100644 index 0000000..7dd9bfe --- /dev/null +++ b/client/internal/entities/src/Task.cpp @@ -0,0 +1,21 @@ +#pragma once + +#include "Task.h" +#include +#include + +unsigned long Task::getId() const { + return id; +} + +Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} + +Task::Task(std::string description) : id(0), description(std::move(description)) {} + +const std::string &Task::getDescription() const { + return description; +} + +void Task::setDescription(const std::string &description_) { + Task::description = description_; +} \ No newline at end of file diff --git a/client/internal/entities/src/User.cpp b/client/internal/entities/src/User.cpp new file mode 100644 index 0000000..53706e2 --- /dev/null +++ b/client/internal/entities/src/User.cpp @@ -0,0 +1,43 @@ +#include +#include "User.h" + +User::User(size_t id_, std::string login_, std::string password_, std::string username_) : + id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} +User::User(std::string login_, std::string password_, std::string username_) : + id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} + +const std::string &User::getLogin() const { + return login; +} + +void User::setLogin(const std::string &login_) { + User::login = login_; +} + +const std::string &User::getPassword() const { + return password; +} + +void User::setPassword(const std::string &password_) { + User::password = password_; +} + +const std::string &User::getUsername() const { + return username; +} + +void User::setUsername(const std::string &username_) { + User::username = username_; +} + +size_t User::getId() const { + return id; +} + +std::ostream &operator<<(std::ostream &os, const User &user) { + os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " + << user.username; + return os; +} \ No newline at end of file diff --git a/client/internal/httpClient/CMakeLists.txt b/client/internal/httpClient/CMakeLists.txt new file mode 100644 index 0000000..591e57a --- /dev/null +++ b/client/internal/httpClient/CMakeLists.txt @@ -0,0 +1,21 @@ +project("HttpClientLib") + +set(CMAKE_CXX_STANDARD 20) + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) +file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h) + +include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libClientEntities_INCLUDE_DIRS}) + +add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) +target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} ${Boost_LIBRARIES}) + +set(HTTPCLIENT_lib_LIB ${PROJECT_NAME}) +set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) + +set(HTTPCLIENT_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/client/internal/httpClient/include/ClientTypes.h b/client/internal/httpClient/include/ClientTypes.h new file mode 100644 index 0000000..9ba6e87 --- /dev/null +++ b/client/internal/httpClient/include/ClientTypes.h @@ -0,0 +1,34 @@ +#ifndef APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ +#define APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ + +#include +#include +#include +#include +#include + +using Response = boost::beast::http::response; +using Request = boost::beast::http::request; + +using Params = std::map; + +struct Header { + std::string name; + std::string values; +}; + +struct ResponseStruct { + unsigned int status; + std::string body; + std::vector
headers; +}; + +struct Host { + std::string domain; + std::string ip; + unsigned short port; + Host(std::string domain, std::string ip, unsigned short port) + : domain(std::move(domain)), ip(std::move(ip)), port(port) {} +}; + +#endif // APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ diff --git a/client/internal/httpClient/include/HttpClient.h b/client/internal/httpClient/include/HttpClient.h new file mode 100644 index 0000000..99e7fb0 --- /dev/null +++ b/client/internal/httpClient/include/HttpClient.h @@ -0,0 +1,41 @@ +#ifndef APP_HTTPCLIENT_HTTPCLIENT_HTTPCLIENT_H_ +#define APP_HTTPCLIENT_HTTPCLIENT_HTTPCLIENT_H_ + +#include +#include +#include +#include + +#include "ClientTypes.h" +#include "Serializer.h" +#include "IHttpClient.h" + +class HttpClient : public IHttpClient { + public: + HttpClient(); + ResponseStruct makeGetRequest(const Host& host, const std::string& target, + const std::shared_ptr& params = nullptr, + const std::shared_ptr& headers = nullptr) override; + ResponseStruct makePostRequest(const Host& host, const std::string& target, + const std::shared_ptr& body, + const std::shared_ptr& headers = nullptr) override; + + private: + ResponseStruct parseResponse(Response response) override; + std::string createURL(const std::string& target, const std::shared_ptr& params = nullptr) override; + bool connect(unsigned short port) override; + ResponseStruct makeRequest(const Host& host, const std::string& target, boost::beast::http::verb method, + const std::shared_ptr& params = nullptr, + const std::shared_ptr& body = nullptr, + const std::shared_ptr& headers = nullptr) override; + + boost::asio::io_context context; + boost::asio::ip::tcp::resolver resolver; + boost::asio::ip::tcp::socket socket; + std::string ip; + boost::beast::flat_buffer flat_buffer; + Serializer serializer; +}; + + +#endif // APP_HTTPCLIENT_HTTPCLIENT_HTTPCLIENT_H_ diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h new file mode 100644 index 0000000..1d31ce3 --- /dev/null +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -0,0 +1,33 @@ +#ifndef APP_HTTPCLIENT_HTTPCLIENTMANAGER_HTTPCLIENTMANAGER_H_ +#define APP_HTTPCLIENT_HTTPCLIENTMANAGER_HTTPCLIENTMANAGER_H_ + +#include +#include +#include + +#include "IHttpClient.h" +#include "User.h" +#include "Solution.h" +#include "Task.h" +#include "Metric.h" + +class HttpClientManager { + public: + HttpClientManager(const std::string &domain, const std::string &ip, const unsigned short &port, + std::string saved_path_); + unsigned int loginUser(const std::string &login, const std::string &password); + unsigned int registerUser(const std::string &login, const std::string &username, const std::string &password); + unsigned int submitSolution(const int& user_id, const std::string &path_to_sound); + unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); + std::vector getAllTasks(); + std::vector getMetrics(const int& sol_id); + void setHttpClient(std::shared_ptr client_); + private: + std::string saved_path; + Host host; + std::shared_ptr client; + Serializer serializer; +}; + + +#endif // APP_HTTPCLIENT_HTTPCLIENTMANAGER_HTTPCLIENTMANAGER_H_ diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h new file mode 100644 index 0000000..31d4468 --- /dev/null +++ b/client/internal/httpClient/include/Serializer.h @@ -0,0 +1,14 @@ +#ifndef APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ +#define APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ + +#include +#include +#include + +#include "ClientTypes.h" + +class Serializer {}; + + + +#endif // APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ diff --git a/client/internal/httpClient/src/HttpClient.cpp b/client/internal/httpClient/src/HttpClient.cpp new file mode 100644 index 0000000..93881ff --- /dev/null +++ b/client/internal/httpClient/src/HttpClient.cpp @@ -0,0 +1,32 @@ +#include "httpClient.h" + +#include +#include +#include +#include +#include +#include + +using Error = boost::system::system_error; + +std::string HttpClient::createURL(const std::string& target, const std::shared_ptr& params) {} + +bool HttpClient::connect(unsigned short port = 80) {} + +HttpClient::HttpClient() : socket(context), resolver(context) {} + +ResponseStruct HttpClient::makeRequest(const Host &host, const std::string &target, + const boost::beast::http::verb method, + const std::shared_ptr& params, + const std::shared_ptr& body, + const std::shared_ptr& headers) {} + +ResponseStruct HttpClient::parseResponse(Response response) {} + +ResponseStruct HttpClient::makeGetRequest(const Host &host, const std::string &target, + const std::shared_ptr& params, + const std::shared_ptr& headers) {} + +ResponseStruct HttpClient::makePostRequest(const Host &host, const std::string &target, + const std::shared_ptr& body, + const std::shared_ptr& headers) {} diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp new file mode 100644 index 0000000..57e1a88 --- /dev/null +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -0,0 +1,42 @@ +#include "httpClientManager.h" + +#include +#include +#include +#include +#include + +HttpClientManager::HttpClientManager(const std::string &domain, + const std::string &ip, + const unsigned short &port, + std::string saved_path_) + : host(domain, ip, port), client(), serializer(), saved_path(std::move(saved_path_)) {} + +unsigned int HttpClientManager::loginUser(const std::string &login, const std::string &password) { + return 0; +} + +unsigned int HttpClientManager::registerUser(const std::string &login, const std::string &username, + const std::string &password) { + return 0; +} + +unsigned int HttpClientManager::submitSolution(const int &user_id, const std::string &path_to_sound) { + return 0; +} + +unsigned int HttpClientManager::getAllSolutionsForTask(const int &user_id, const int &task_id) { + return 0; +} + +std::vector HttpClientManager::getMetrics(const int &sol_id) { + return std::vector(); +} + +void HttpClientManager::setHttpClient(std::shared_ptr client_) { + client = client_; +} + +std::vector HttpClientManager::getAllTasks() { + return std::vector(); +} diff --git a/client/internal/httpClient/tests/CMakeLists.txt b/client/internal/httpClient/tests/CMakeLists.txt new file mode 100644 index 0000000..7b0e0c7 --- /dev/null +++ b/client/internal/httpClient/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +project(test_httpclient) + +set(CMAKE_CXX_STANDARD 20) +add_compile_options(-coverage) + +file(GLOB SOURCES *.cpp) + +enable_testing() +find_package(GTest REQUIRED) + +add_executable(${PROJECT_NAME} ${SOURCES}) + +target_link_libraries(${PROJECT_NAME} ${HTTPCLIENT_lib_LIB} GTest::GTest GTest::gmock) +target_include_directories(${PROJECT_NAME} PUBLIC ${HTTPCLIENT_lib_INCLUDE_DIRS}) + +add_test(test_httpclient test_httpclient) \ No newline at end of file diff --git a/client/internal/httpClient/tests/HttpClientManagerSuite.cpp b/client/internal/httpClient/tests/HttpClientManagerSuite.cpp new file mode 100644 index 0000000..44de182 --- /dev/null +++ b/client/internal/httpClient/tests/HttpClientManagerSuite.cpp @@ -0,0 +1,64 @@ +#include +#include + +#include "IHttpClient.h" +#include "HttpClientManager.h" + +class HttpClientMock : public IHttpClient { +public: + HttpClientMock() = default; + MOCK_METHOD(ResponseStruct, makeGetRequest, (const Host& host, const std::string& target, + const std::shared_ptr& params, + const std::shared_ptr& headers), (override)); + MOCK_METHOD(ResponseStruct, makePostRequest, (const Host& host, const std::string& target, + const std::shared_ptr& body, + const std::shared_ptr& headers), (override)); + MOCK_METHOD(ResponseStruct, parseResponse, (Response response), (override)); + MOCK_METHOD(std::string, createURL, (const std::string& target, const std::shared_ptr& params), + (override)); + MOCK_METHOD(bool, connect, (unsigned short port), (override)); + MOCK_METHOD(ResponseStruct, makeRequest, (const Host& host, const std::string& target, boost::beast::http::verb method, + const std::shared_ptr& params, + const std::shared_ptr& body, + const std::shared_ptr& headers), (override)); +}; + +class HttpClientManagerSuite : public ::testing::Test { +protected: + void SetUp() override { + manager.setHttpClient(client); + } + + std::shared_ptr client = std::make_shared(); + HttpClientManager manager = HttpClientManager("1", "1.1.1.1", 1, "."); +}; + +TEST_F(HttpClientManagerSuite, LoginUserTest){ + EXPECT_CALL(*client, makeGetRequest); + manager.loginUser("1", "2"); +} + +TEST_F(HttpClientManagerSuite, RegisterUserTest){ + EXPECT_CALL(*client, makePostRequest); + manager.registerUser("1", "2", "3"); +} + +TEST_F(HttpClientManagerSuite, SubmitSolutionTest){ + EXPECT_CALL(*client, makePostRequest); + manager.submitSolution(1, "2234"); +} + +TEST_F(HttpClientManagerSuite, GetAllSolutionsForTaskTest){ + EXPECT_CALL(*client, makeGetRequest); + manager.getAllSolutionsForTask(1, 2); +} + +TEST_F(HttpClientManagerSuite, GetAllTasksTest){ + EXPECT_CALL(*client, makeGetRequest); + manager.getAllTasks(); +} + +TEST_F(HttpClientManagerSuite, GetMetricsTest){ + EXPECT_CALL(*client, makeGetRequest); + manager.getMetrics(1); +} diff --git a/client/internal/httpClient/tests/HttpClientSuite.cpp b/client/internal/httpClient/tests/HttpClientSuite.cpp new file mode 100644 index 0000000..7ff26c2 --- /dev/null +++ b/client/internal/httpClient/tests/HttpClientSuite.cpp @@ -0,0 +1,11 @@ +#include +#include + +#include "HttpClient.h" + +TEST(HttpClientSuite, WrongGetTest) { + HttpClient client; + Host h("1", "1.1.1.1", 80); + ResponseStruct res = client.makeGetRequest(h, "/ser/login"); + EXPECT_EQ(res.status, 500); +} \ No newline at end of file diff --git a/client/internal/httpClient/tests/main.cpp b/client/internal/httpClient/tests/main.cpp new file mode 100644 index 0000000..21bd133 --- /dev/null +++ b/client/internal/httpClient/tests/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleMock(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/client/internal/httpClient/virtual/IHttpClient.h b/client/internal/httpClient/virtual/IHttpClient.h new file mode 100644 index 0000000..e24e15d --- /dev/null +++ b/client/internal/httpClient/virtual/IHttpClient.h @@ -0,0 +1,32 @@ +#ifndef APP_HTTPCLIENT_HTTPCLIENT_IHTTPCLIENT_H_ +#define APP_HTTPCLIENT_HTTPCLIENT_IHTTPCLIENT_H_ + +#include +#include +#include +#include + +#include "clientTypes.h" +#include "serializer.h" + +class IHttpClient { +public: + virtual ResponseStruct makeGetRequest(const Host& host, const std::string& target, + const std::shared_ptr& params = nullptr, + const std::shared_ptr& headers = nullptr) = 0; + virtual ResponseStruct makePostRequest(const Host& host, const std::string& target, + const std::shared_ptr& body, + const std::shared_ptr& headers = nullptr) = 0; + +protected: + virtual ResponseStruct parseResponse(Response response) = 0; + virtual std::string createURL(const std::string& target, const std::shared_ptr& params = nullptr) = 0; + virtual bool connect(unsigned short port) = 0; + virtual ResponseStruct makeRequest(const Host& host, const std::string& target, boost::beast::http::verb method, + const std::shared_ptr& params = nullptr, + const std::shared_ptr& body = nullptr, + const std::shared_ptr& headers = nullptr) = 0; +}; + + +#endif // APP_HTTPCLIENT_HTTPCLIENT_HTTPCLIENT_H_ diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index cbd2bd5..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,264 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace beast = boost::beast; // from -namespace http = beast::http; // from -namespace net = boost::asio; // from -using tcp = boost::asio::ip::tcp; // from - -//------------------------------------------------------------------------------ - -// Return a reasonable mime type based on the extension of a file. -beast::string_view mime_type(beast::string_view path) { - using beast::iequals; - auto const ext = [&path] { - auto const pos = path.rfind("."); - if (pos == beast::string_view::npos) return beast::string_view{}; - return path.substr(pos); - }(); - if (iequals(ext, ".htm")) return "text/html"; - if (iequals(ext, ".html")) return "text/html"; - if (iequals(ext, ".php")) return "text/html"; - if (iequals(ext, ".css")) return "text/css"; - if (iequals(ext, ".txt")) return "text/plain"; - if (iequals(ext, ".js")) return "application/javascript"; - if (iequals(ext, ".json")) return "application/json"; - if (iequals(ext, ".xml")) return "application/xml"; - if (iequals(ext, ".swf")) return "application/x-shockwave-flash"; - if (iequals(ext, ".flv")) return "video/x-flv"; - if (iequals(ext, ".png")) return "image/png"; - if (iequals(ext, ".jpe")) return "image/jpeg"; - if (iequals(ext, ".jpeg")) return "image/jpeg"; - if (iequals(ext, ".jpg")) return "image/jpeg"; - if (iequals(ext, ".gif")) return "image/gif"; - if (iequals(ext, ".bmp")) return "image/bmp"; - if (iequals(ext, ".ico")) return "image/vnd.microsoft.icon"; - if (iequals(ext, ".tiff")) return "image/tiff"; - if (iequals(ext, ".tif")) return "image/tiff"; - if (iequals(ext, ".svg")) return "image/svg+xml"; - if (iequals(ext, ".svgz")) return "image/svg+xml"; - return "application/text"; -} - -// Append an HTTP rel-path to a local filesystem path. -// The returned path is normalized for the platform. -std::string path_cat(beast::string_view base, beast::string_view path) { - if (base.empty()) return std::string(path); - std::string result(base); -#ifdef BOOST_MSVC - char constexpr path_separator = '\\'; - if (result.back() == path_separator) result.resize(result.size() - 1); - result.append(path.data(), path.size()); - for (auto& c : result) - if (c == '/') c = path_separator; -#else - char constexpr path_separator = '/'; - if (result.back() == path_separator) result.resize(result.size() - 1); - result.append(path.data(), path.size()); -#endif - return result; -} - -// This function produces an HTTP response for the given -// request. The type of the response object depends on the -// contents of the request, so the interface requires the -// caller to pass a generic lambda for receiving the response. -template -void handle_request(beast::string_view doc_root, - http::request>&& req, - Send&& send) { - // Returns a bad request response - auto const bad_request = [&req](beast::string_view why) { - http::response res{http::status::bad_request, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - // Returns a not found response - auto const not_found = [&req](beast::string_view target) { - http::response res{http::status::not_found, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "The resource '" + std::string(target) + "' was not found."; - res.prepare_payload(); - return res; - }; - - // Returns a server error response - auto const server_error = [&req](beast::string_view what) { - http::response res{http::status::internal_server_error, - req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = "An error occurred: '" + std::string(what) + "'"; - res.prepare_payload(); - return res; - }; - - // Make sure we can handle the method - if (req.method() != http::verb::get && req.method() != http::verb::head) - return send(bad_request("Unknown HTTP-method")); - - // Request path must be absolute and not contain "..". - if (req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) - return send(bad_request("Illegal request-target")); - - // Build the path to the requested file - std::string path = path_cat(doc_root, req.target()); - if (req.target().back() == '/') path.append("index.html"); - - // Attempt to open the file - beast::error_code ec; - http::file_body::value_type body; - body.open(path.c_str(), beast::file_mode::scan, ec); - - // Handle the case where the file doesn't exist - if (ec == beast::errc::no_such_file_or_directory) - return send(not_found(req.target())); - - // Handle an unknown error - if (ec) return send(server_error(ec.message())); - - // Cache the size since we need it after the move - auto const size = body.size(); - - // Respond to HEAD request - if (req.method() == http::verb::head) { - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); - } - - // Respond to GET request - http::response res{ - std::piecewise_construct, std::make_tuple(std::move(body)), - std::make_tuple(http::status::ok, req.version())}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, mime_type(path)); - res.content_length(size); - res.keep_alive(req.keep_alive()); - return send(std::move(res)); -} - -//------------------------------------------------------------------------------ - -// Report a failure -void fail(beast::error_code ec, char const* what) { - std::cerr << what << ": " << ec.message() << "\n"; -} - -// This is the C++11 equivalent of a generic lambda. -// The function object is used to send an HTTP message. -template -struct send_lambda { - Stream& stream_; - bool& close_; - beast::error_code& ec_; - - explicit send_lambda(Stream& stream, bool& close, beast::error_code& ec) - : stream_(stream), close_(close), ec_(ec) {} - - template - void operator()(http::message&& msg) const { - // Determine if we should close the connection after - close_ = msg.need_eof(); - - // We need the serializer here because the serializer requires - // a non-const file_body, and the message oriented version of - // http::write only works with const messages. - http::serializer sr{msg}; - http::write(stream_, sr, ec_); - } -}; - -// Handles an HTTP server connection -void do_session(tcp::socket& socket, - std::shared_ptr const& doc_root) { - bool close = false; - beast::error_code ec; - - // This buffer is required to persist across reads - beast::flat_buffer buffer; - - // This lambda is used to send messages - send_lambda lambda{socket, close, ec}; - - for (;;) { - // Read a request - http::request req; - http::read(socket, buffer, req, ec); - if (ec == http::error::end_of_stream) break; - if (ec) return fail(ec, "read"); - - // Send the response - handle_request(*doc_root, std::move(req), lambda); - if (ec) return fail(ec, "write"); - if (close) { - // This means we should close the connection, usually because - // the response indicated the "Connection: close" semantic. - break; - } - } - - // Send a TCP shutdown - socket.shutdown(tcp::socket::shutdown_send, ec); - - // At this point the connection is closed gracefully -} - -//------------------------------------------------------------------------------ - -int main(int argc, char* argv[]) { - try { - // Check command line arguments. - if (argc != 4) { - std::cerr << "Usage: http-server-sync
\n" - << "Example:\n" - << " http-server-sync 0.0.0.0 8080 .\n"; - return EXIT_FAILURE; - } - auto const address = net::ip::make_address(argv[1]); - auto const port = static_cast(std::atoi(argv[2])); - auto const doc_root = std::make_shared(argv[3]); - - // The io_context is required for all I/O - net::io_context ioc{1}; - - // The acceptor receives incoming connections - tcp::acceptor acceptor{ioc, {address, port}}; - for (;;) { - // This will receive the new connection - tcp::socket socket{ioc}; - - // Block until we get a connection - acceptor.accept(socket); - - // Launch the session, transferring ownership of the socket - std::thread{std::bind(&do_session, std::move(socket), doc_root)}.detach(); - } - } catch (const std::exception& e) { - std::cerr << "Error: " << e.what() << std::endl; - return EXIT_FAILURE; - } -} diff --git a/text-basic-metrics/code1.txt b/text-basic-metrics/code1.txt deleted file mode 100644 index 5fa95b8..0000000 --- a/text-basic-metrics/code1.txt +++ /dev/null @@ -1,29 +0,0 @@ -// однострочный комментарий -// еще один -// вау еще один - -#include -#include -#include - -using namespace std; - -/* многострочный комм - * // внутри него однострочный - * - */ - - -int main() { - stringstream ss; - string res; - // ещё в код напихаю комментов - ss << "a bwfw ce "; - while(getline(ss, res, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res << endl; /* многострочный однострочно */ - } -} diff --git a/text-basic-metrics/code2.txt b/text-basic-metrics/code2.txt deleted file mode 100644 index 2115b76..0000000 --- a/text-basic-metrics/code2.txt +++ /dev/null @@ -1,29 +0,0 @@ -// однострочный комментарий -// еще один -// вау еще один - -#include -#include -#include - -using namespace std; - -/* многострочный комм - * // внутри него однострочный - * - */ - - -int main() { - stringstream ss1; - string res1; - // ещё в код напихаю комментов - ss1 << "a bwfw ce "; - while(getline(ss, res1, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res1 << endl; /* многострочный однострочно */ - } -} \ No newline at end of file diff --git a/text-basic-metrics/tbm_main.cpp b/text-basic-metrics/tbm_main.cpp deleted file mode 100644 index fdd4253..0000000 --- a/text-basic-metrics/tbm_main.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// -// Created by march on 21.04.2023. -// - -#include -#include -#include -#include -#include -#include -#include - -#include - - -std::string deleteComms(const std::string& text){ - std::string modif; - std::string res; - - std::stringstream ss; - std::string line; - - ss << text; - - while(getline(ss, line)){ - line.pop_back(); - line.push_back('\0'); - modif += line; - } - - bool s_comm = false; - bool m_comm = false; - - for (int i = 0; i < modif.size(); i++){ - if (s_comm && modif[i] == '\0') - s_comm = false; - else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') - m_comm = false, i++; - else if (s_comm || m_comm) - continue; - else if (modif[i] == '/' && modif[i+1] == '/') - s_comm = true, i++; - else if (modif[i] == '/' && modif[i+1] == '*') - m_comm = true, i++; - - else if (modif[i] != '\0') - res += modif[i]; - else{ - res += '\n'; - } - } - return res; -} - -std::vector tbm_tokenizer(const std::string &text){ - boost::char_separator sep(" {}();,\"\0\'"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); - - for (const std::string &s: tokens) { - if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ - res.push_back(s); - } - } - return res; -} - -// % = intersection(A, B) / union(A, B) -double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ - std::set s1; - std::set s2; - - for (auto &i : tokens1) s1.insert(i); - for (auto &i : tokens2) s2.insert(i); - - - std::set intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); - - std::set union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); - - std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; - - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); -} - -double Livenstain_dist(std::vector tokens1, std::vector tokens2){ - unsigned long n = tokens1.size(); - unsigned long m = tokens2.size(); - int x, y, z; - - std::vector > lev (n, std::vector (m, 0)); - - for (int i = 0; i < n; i++){ - for (int j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = std::max(i, j); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; - lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ - lev[i][j]++; - } - } - } - } - - return lev[n-1][m-1]; -} - -std::pair textCompare(std::istream& fin1, std::istream& fin2){ - std::string line; - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - - std::string non_comm_text1 = deleteComms(text1); - std::string non_comm_text2 = deleteComms(text2); - - std::vector tokens1 = tbm_tokenizer(non_comm_text1); - std::vector tokens2 = tbm_tokenizer(non_comm_text2); - - double res1 = Jaccard_metric(tokens1, tokens2); - double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); - - return {res1, res2}; -} - -int main(){ - - std::ifstream fin1; - fin1.open("text-basic-metrics/code1.txt"); - assert(fin1.is_open()); - - std::ifstream fin2; - fin2.open("text-basic-metrics/code2.txt"); - assert(fin2.is_open()); - - std::pair metrics_res = textCompare(fin1, fin2); - - std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; - fin1.close(); - fin2.close(); -} \ No newline at end of file -- GitLab From 8f6982061e302385b8ff54dd051854a57c2f86d5 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 3 May 2023 20:41:39 +0300 Subject: [PATCH 034/134] rename metod && delete useless find --- metrics/CMakeLists.txt | 1 - metrics/metrics_headers/TextMetricsLib.h | 4 ++-- metrics/source/TextMetricImpl.cpp | 2 +- src/main.cpp | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt index cac65b0..5ab0e06 100644 --- a/metrics/CMakeLists.txt +++ b/metrics/CMakeLists.txt @@ -1,5 +1,4 @@ add_library(MetricsLib source/TextMetricImpl.cpp) -find_package(Boost 1.8.1 REQUIRED) target_include_directories(MetricsLib PUBLIC metrics_headers) target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) \ No newline at end of file diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h index 97cd280..3ff4960 100644 --- a/metrics/metrics_headers/TextMetricsLib.h +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -16,13 +16,13 @@ class ITextMetric{ virtual void countMetric() = 0; - virtual void getData(std::string text1, std::string text2) = 0; + virtual void setData(std::string text1, std::string text2) = 0; virtual double getMetric() = 0; }; class PrepareDataTextMetric : public ITextMetric{ public: - void getData(std::string text1, std::string text2) override; + void setData(std::string text1, std::string text2) override; double getMetric() override; protected: std::vector tokens1; diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index 330d667..6f9eba6 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -5,7 +5,7 @@ #include "TextMetricsLib.h" -void PrepareDataTextMetric::getData(std::string text1, std::string text2) { +void PrepareDataTextMetric::setData(std::string text1, std::string text2) { std::string non_comm_text1 = deleteComments(text1); std::string non_comm_text2 = deleteComments(text2); diff --git a/src/main.cpp b/src/main.cpp index e1d00e8..b2d44b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,8 +23,8 @@ int main(){ LivDistTextMetric livDistTextMetric; JaccardTextMetric jaccardTextMetric; - livDistTextMetric.getData(text1, text2); - jaccardTextMetric.getData(text1, text2); + livDistTextMetric.setData(text1, text2); + jaccardTextMetric.setData(text1, text2); livDistTextMetric.countMetric(); jaccardTextMetric.countMetric(); -- GitLab From 8306ff1cb95bad8119e13fc9da1b35dcb72177aa Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 3 May 2023 23:16:35 +0300 Subject: [PATCH 035/134] add tests and structure for services --- .github/workflows/ci.yml | 14 +-- CMakeLists.txt | 53 +++++++--- server/CMakeLists.txt | 21 ++++ server/conanfile.txt | 10 ++ server/internal/CMakeLists.txt | 12 +++ server/internal/entities/CMakeLists.txt | 28 ++++++ server/internal/entities/include/Solution.hpp | 58 +++++++++++ server/internal/entities/include/Task.hpp | 23 +++++ server/internal/entities/include/User.hpp | 38 ++++++++ server/internal/entities/src/Solution.cpp | 73 ++++++++++++++ server/internal/entities/src/Task.cpp | 21 ++++ server/internal/entities/src/User.cpp | 43 +++++++++ server/internal/repository/CMakeLists.txt | 32 +++++++ .../virtual/ISolutionRepository.hpp | 29 ++++++ .../repository/virtual/ITaskRepository.hpp | 21 ++++ .../repository/virtual/IUserRepository.hpp | 23 +++++ server/internal/service/CMakeLists.txt | 23 +++++ server/internal/service/include/Exceptions.h | 9 ++ .../service/include/SolutionService.h | 20 ++++ server/internal/service/include/TaskService.h | 19 ++++ server/internal/service/include/UserService.h | 19 ++++ .../internal/service/include/UserValidator.h | 16 ++++ .../internal/service/src/SolutionService.cpp | 40 ++++++++ server/internal/service/src/TaskService.cpp | 15 +++ server/internal/service/src/UserService.cpp | 19 ++++ server/internal/service/src/UserValidator.cpp | 36 +++++++ server/internal/service/tests/CMakeLists.txt | 17 ++++ .../service/tests/SolutionServiceTest.cpp | 96 +++++++++++++++++++ .../service/tests/TaskServiceTest.cpp | 82 ++++++++++++++++ .../service/tests/UserServiceTest.cpp | 85 ++++++++++++++++ .../service/tests/UserValidatorTest.cpp | 29 ++++++ server/internal/service/tests/main.cpp | 8 ++ .../service/virtual/ISolutionService.h | 18 ++++ .../internal/service/virtual/ITaskService.h | 13 +++ .../internal/service/virtual/IUserService.h | 14 +++ 35 files changed, 1053 insertions(+), 24 deletions(-) create mode 100644 server/CMakeLists.txt create mode 100644 server/conanfile.txt create mode 100644 server/internal/CMakeLists.txt create mode 100644 server/internal/entities/CMakeLists.txt create mode 100644 server/internal/entities/include/Solution.hpp create mode 100644 server/internal/entities/include/Task.hpp create mode 100644 server/internal/entities/include/User.hpp create mode 100644 server/internal/entities/src/Solution.cpp create mode 100644 server/internal/entities/src/Task.cpp create mode 100644 server/internal/entities/src/User.cpp create mode 100644 server/internal/repository/CMakeLists.txt create mode 100644 server/internal/repository/virtual/ISolutionRepository.hpp create mode 100644 server/internal/repository/virtual/ITaskRepository.hpp create mode 100644 server/internal/repository/virtual/IUserRepository.hpp create mode 100644 server/internal/service/CMakeLists.txt create mode 100644 server/internal/service/include/Exceptions.h create mode 100644 server/internal/service/include/SolutionService.h create mode 100644 server/internal/service/include/TaskService.h create mode 100644 server/internal/service/include/UserService.h create mode 100644 server/internal/service/include/UserValidator.h create mode 100644 server/internal/service/src/SolutionService.cpp create mode 100644 server/internal/service/src/TaskService.cpp create mode 100644 server/internal/service/src/UserService.cpp create mode 100644 server/internal/service/src/UserValidator.cpp create mode 100644 server/internal/service/tests/CMakeLists.txt create mode 100644 server/internal/service/tests/SolutionServiceTest.cpp create mode 100644 server/internal/service/tests/TaskServiceTest.cpp create mode 100644 server/internal/service/tests/UserServiceTest.cpp create mode 100644 server/internal/service/tests/UserValidatorTest.cpp create mode 100644 server/internal/service/tests/main.cpp create mode 100644 server/internal/service/virtual/ISolutionService.h create mode 100644 server/internal/service/virtual/ITaskService.h create mode 100644 server/internal/service/virtual/IUserService.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb53bfb..7c7b798 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,9 @@ jobs: cd build cmake .. make - # tests: - # runs-on: ubuntu-latest - # container: raiden454/cpp-app - # needs: [build] - # steps: - # - uses: actions/checkout@v3 - # - name: Run-Tests - # run: | - # find / -name "test_service" + - name: Run-Tests + run: | + ./build/server/internal/service/tests/test_service linters: runs-on: ubuntu-latest container: raiden454/cpp-app @@ -52,4 +46,4 @@ jobs: cppcheck server --std=c++17 --enable=all - name: Cpplint run: | - cpplint --extensions=cpp,hpp,h --recursive ./server/* + cpplint --extensions=cpp,hpp,h --recursive ./server/* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 5054100..1047f93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,40 @@ -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.16) -set(CMAKE_PREFIX_PATH build) -project(SourcedOut CXX) -# find_package(antlr4-runtime REQUIRED) -find_package(Boost 1.8.1 REQUIRED) -# find_package(libpqxx REQUIRED) -find_package(GTest REQUIRED) -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) -message(STATUS ${Boost_LIBRARIES}) -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") -add_executable(${PROJECT_NAME} src/main.cpp) -#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file + +set(PROJECT_NAME "SourcedOut") + +project(${PROJECT_NAME}) + + +set(BUILD_DEV TRUE CACHE BOOL "build dev version") +set(SANITIZE_BUILD TRUE CACHE BOOL "build with sanitizers") + +if(BUILD_DEV) + enable_testing() + message("Building dev version") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ + -Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -lpq -lpqxx") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") + + if(SANITIZE_BUILD) + message("Sanitizers ON") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-sanitize-recover=all -fsanitize-undefined-trap-on-error") + endif(SANITIZE_BUILD) +endif(BUILD_DEV) + +set(BUILD_SERVER "BUILD_SERVER") +set(BUILD_CLIENT "BUILD_CLIENT") +set(BUILD_ALL "BUILD_ALL") + + +message("${BUILD_DEV} ${SANITIZE_BUILD} ${CMAKE_EXE_LINKER_FLAGS}") +set(BUILD_MODE ${BUILD_SERVER}) + +if((BUILD_MODE STREQUAL ${BUILD_CLIENT}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(client) +endif() + +if((BUILD_MODE STREQUAL ${BUILD_SERVER}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) + add_subdirectory(server) +endif() \ No newline at end of file diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..47ff64a --- /dev/null +++ b/server/CMakeLists.txt @@ -0,0 +1,21 @@ +set(CMAKE_PREFIX_PATH build) +project(SourcedOut CXX) +# find_package(antlr4-runtime REQUIRED) +find_package(Boost 1.8.1 REQUIRED) +# find_package(libpqxx REQUIRED) +find_library(PQXX_LIB pqxx) +find_package(GTest REQUIRED) +find_package(nlohmann_json REQUIRED) +message(STATUS ${nlohmann_json_LIBRARIES}) + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + +add_subdirectory(internal) + +message(STATUS ${Boost_LIBRARIES}) +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") + +#add_subdirectory(cpp-dotenv) +#add_executable(${PROJECT_NAME} text-basic-metrics/tbm_main.cpp text-basic-metrics/tbm_main.cpp) строка для запуска моей части в text-basic-metrics +# target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${GTest_LIBRARIES}) \ No newline at end of file diff --git a/server/conanfile.txt b/server/conanfile.txt new file mode 100644 index 0000000..e4b350b --- /dev/null +++ b/server/conanfile.txt @@ -0,0 +1,10 @@ +[requires] +boost/1.81.0 +antlr4-cppruntime/4.12.0 +libpqxx/7.7.5 +gtest/cci.20210126 +nlohmann_json/3.11.2 + +[generators] +CMakeDeps +CMakeToolchain \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt new file mode 100644 index 0000000..c981db9 --- /dev/null +++ b/server/internal/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(entities) +add_subdirectory(repository) +add_subdirectory(service) + +set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) +set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + +set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) +set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) + +set(SERVICE_LIB ${SERVICE_lib_LIB} PARENT_SCOPE) +set(SERVICE_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/entities/CMakeLists.txt b/server/internal/entities/CMakeLists.txt new file mode 100644 index 0000000..fc7e628 --- /dev/null +++ b/server/internal/entities/CMakeLists.txt @@ -0,0 +1,28 @@ +project("EntitiesLib") + +set(LIB_NAME libEntities) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +message("SOURCES = ${SOURCES}") +message("HEADERS = ${HEADERS}") + + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +#target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} nlohmann_json::nlohmann_json) + +set(libEntities_LIB ${LIB_NAME}) +set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) +set(libEntities_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + +message("libEntities_LIB = ${libEntities_LIB}") +message("libEntities_INCLUDE_DIRS = ${libEntities_INCLUDE_DIRS}") diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp new file mode 100644 index 0000000..5c39ef5 --- /dev/null +++ b/server/internal/entities/include/Solution.hpp @@ -0,0 +1,58 @@ +#ifndef SOURCEDOUT_SOLUTION_HPP +#define SOURCEDOUT_SOLUTION_HPP + +#include +#include +#include + +class Solution { +public: + Solution() =default; + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, + std::string tokens, std::string astTree, size_t taskId, std::string result); + + [[nodiscard]] size_t getId() const; + + + [[nodiscard]] const std::string &getSendDate() const; + + void setSendDate(const std::string &sendDate); + + [[nodiscard]] size_t getSenderId() const; + + void setSenderId(size_t senderId); + + [[nodiscard]] const std::string &getSource() const; + + void setSource(const std::string &source); + + [[nodiscard]] const std::string &getTokens() const; + + void setTokens(const std::string &tokens); + + [[nodiscard]] const std::string &getAstTree() const; + + void setAstTree(const std::string &astTree); + + [[nodiscard]] size_t getTaskId() const; + + void setTaskId(size_t taskId); + + [[nodiscard]] const std::string &getResult() const; + + void setResult(const std::string &result); + +private: + size_t id; + std::string send_date; + size_t sender_id; + std::string source; + std::string tokens; + std::string astTree; + size_t task_id; + std::string result; +public: + +}; + +#endif //SOURCEDOUT_SOLUTION_HPP diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp new file mode 100644 index 0000000..6ad362f --- /dev/null +++ b/server/internal/entities/include/Task.hpp @@ -0,0 +1,23 @@ +#ifndef SOURCEDOUT_TASK_HPP +#define SOURCEDOUT_TASK_HPP +#include +#include +class Task{ +private: + size_t id; + std::string description; + +public: + Task()=default; + ~Task() = default; + Task(size_t id, std::string description); + + explicit Task(std::string description); + + [[nodiscard]] size_t getId() const; + + [[nodiscard]] const std::string &getDescription() const; + + void setDescription(const std::string &description); +}; +#endif //SOURCEDOUT_TASK_HPP diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp new file mode 100644 index 0000000..a597e69 --- /dev/null +++ b/server/internal/entities/include/User.hpp @@ -0,0 +1,38 @@ +#ifndef SOURCEDOUT_USER_HPP + +#include +#include + +#define SOURCEDOUT_USER_HPP + +class User { +private: + size_t id; + std::string login; + std::string password; + std::string username; + +public: + User()=default; + User(size_t id_, std::string login_, std::string password_, std::string username_); + + User(std::string login_, std::string password_, std::string username_); + + [[nodiscard]] const std::string &getLogin() const; + + void setLogin(const std::string &login); + + [[nodiscard]] const std::string &getPassword() const; + + void setPassword(const std::string &password); + + [[nodiscard]] const std::string &getUsername() const; + + void setUsername(const std::string &username); + + [[nodiscard]] size_t getId() const; + + friend std::ostream &operator<<(std::ostream &os, const User &user); +}; + +#endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp new file mode 100644 index 0000000..dd8a542 --- /dev/null +++ b/server/internal/entities/src/Solution.cpp @@ -0,0 +1,73 @@ + +#include +#include +#include "../include/Solution.hpp" + +Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, + std::string source, std::string tokens, + std::string astTree, unsigned long taskId, + std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)) {} + +size_t Solution::getId() const { + return id; +} + + +const std::string &Solution::getSendDate() const { + return send_date; +} + +void Solution::setSendDate(const std::string &sendDate) { + send_date = sendDate; +} + +size_t Solution::getSenderId() const { + return sender_id; +} + +void Solution::setSenderId(size_t senderId) { + sender_id = senderId; +} + +const std::string &Solution::getSource() const { + return source; +} + +void Solution::setSource(const std::string &source_) { + Solution::source = source_; +} + +const std::string &Solution::getTokens() const { + return tokens; +} + +void Solution::setTokens(const std::string &tokens_) { + Solution::tokens = tokens_; +} + +const std::string &Solution::getAstTree() const { + return astTree; +} + +void Solution::setAstTree(const std::string &astTree_) { + Solution::astTree = astTree_; +} + +size_t Solution::getTaskId() const { + return task_id; +} + +void Solution::setTaskId(size_t taskId) { + task_id = taskId; +} + +const std::string &Solution::getResult() const { + return result; +} + +void Solution::setResult(const std::string &result_) { + Solution::result = result_; +} diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp new file mode 100644 index 0000000..99e0fe6 --- /dev/null +++ b/server/internal/entities/src/Task.cpp @@ -0,0 +1,21 @@ +#pragma once + +#include "../include/Task.hpp" +#include +#include + +unsigned long Task::getId() const { + return id; +} + +Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} + +Task::Task(std::string description) : id(0), description(std::move(description)) {} + +const std::string &Task::getDescription() const { + return description; +} + +void Task::setDescription(const std::string &description_) { + Task::description = description_; +} diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp new file mode 100644 index 0000000..c048f8f --- /dev/null +++ b/server/internal/entities/src/User.cpp @@ -0,0 +1,43 @@ +#include +#include "../include/User.hpp" + +User::User(size_t id_, std::string login_, std::string password_, std::string username_) : + id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} +User::User(std::string login_, std::string password_, std::string username_) : +id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} + +const std::string &User::getLogin() const { + return login; +} + +void User::setLogin(const std::string &login_) { + User::login = login_; +} + +const std::string &User::getPassword() const { + return password; +} + +void User::setPassword(const std::string &password_) { + User::password = password_; +} + +const std::string &User::getUsername() const { + return username; +} + +void User::setUsername(const std::string &username_) { + User::username = username_; +} + +size_t User::getId() const { + return id; +} + +std::ostream &operator<<(std::ostream &os, const User &user) { + os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " + << user.username; + return os; +} diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt new file mode 100644 index 0000000..bee149e --- /dev/null +++ b/server/internal/repository/CMakeLists.txt @@ -0,0 +1,32 @@ +project("RepositoryLib") + +set(LIB_NAME libRepository) + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.hpp) + +message("SOURCES = ${SOURCES}") +message("HEADERS = ${HEADERS}") + + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + + +add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) +target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) +target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) + +set(libRepository_LIB ${LIB_NAME}) +set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) + +set(libRepository_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) +set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) + + +message(Entities_LIB = "${libEntities_LIB}") +message(dbManager = "${libDbManager_LIB}") +message("libRepository_LIB = ${libRepository_LIB}") +message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp new file mode 100644 index 0000000..8a7b035 --- /dev/null +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -0,0 +1,29 @@ +#ifndef SOURCEDOUT_ISOLUTIONREPOSITORY_HPP +#define SOURCEDOUT_ISOLUTIONREPOSITORY_HPP + +#include +#include +#include "../../entities/include/Solution.hpp" + +class ISolutionRepository { + public: + virtual ~ISolutionRepository() = default; + virtual Solution getSolutionById(size_t id) = 0; + + virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; + virtual std::vector getSolutions(size_t sender_id, size_t task_id) = 0; + + virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; + + virtual size_t storeSolution(Solution solution) = 0; + + virtual void updateSolution(Solution solution) = 0; + + virtual void deleteSolutionById(size_t id) = 0; + + virtual void deleteSolution(Solution solution) = 0; + + +}; + +#endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp new file mode 100644 index 0000000..e367c21 --- /dev/null +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -0,0 +1,21 @@ +#ifndef SOURCEDOUT_ITASKREPOSITORY_HPP +#define SOURCEDOUT_ITASKREPOSITORY_HPP + +#include +#include "../../entities/include/Task.hpp" + +class ITaskRepository { + public: + virtual ~ITaskRepository() = default; + virtual Task getTaskById(size_t id) = 0; + + virtual void updateTask(Task task) = 0; + + virtual int storeTask(Task task) = 0; + + virtual void deleteTask(Task task) = 0; + + virtual void deleteTaskById(size_t task_id) = 0; +}; + +#endif //SOURCEDOUT_ITASKREPOSITORY_HPP diff --git a/server/internal/repository/virtual/IUserRepository.hpp b/server/internal/repository/virtual/IUserRepository.hpp new file mode 100644 index 0000000..14d7a50 --- /dev/null +++ b/server/internal/repository/virtual/IUserRepository.hpp @@ -0,0 +1,23 @@ +#ifndef SOURCEDOUT_IUSERREPOSITORY_HPP +#define SOURCEDOUT_IUSERREPOSITORY_HPP + +#include +#include "../../entities/include/User.hpp" +class IUserRepository { +public: + virtual ~IUserRepository() = default; + virtual User getUserById(size_t id) = 0; + + virtual User getUserByLogin(std::string login) = 0; + + virtual size_t makeUser(User user) = 0; + + virtual void deleteUser(User user) = 0; + + virtual void deleteByUserId(size_t user_id) = 0; + + virtual std::vector getAllUsers() = 0; + +}; + +#endif //SOURCEDOUT_IUSERREPOSITORY_HPP diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt new file mode 100644 index 0000000..1fd20be --- /dev/null +++ b/server/internal/service/CMakeLists.txt @@ -0,0 +1,23 @@ +project("ServiceLib") + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) + + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES}) + +message("libRepository_LIB = ${libRepository_LIB}") +message("libRepository_INCLUDE_DIRS = ${libRepository_INCLUDE_DIRS}") + +# target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${ibEntities_LIB}) + +set(SERVICE_lib_LIBRARY ${PROJECT_NAME}) +set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) + +set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/service/include/Exceptions.h b/server/internal/service/include/Exceptions.h new file mode 100644 index 0000000..a032c21 --- /dev/null +++ b/server/internal/service/include/Exceptions.h @@ -0,0 +1,9 @@ +#pragma once + +class ValidateException : public std::exception { + std::string _msg; + + public: + ValidateException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h new file mode 100644 index 0000000..86e432b --- /dev/null +++ b/server/internal/service/include/SolutionService.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +#include "ISolutionRepository.hpp" +#include "ISolutionService.h" + +class SolutionService : ISolutionService { + private: + std::unique_ptr solutionRepo; + // std::unique_ptr antlr + public: + explicit SolutionService(std::unique_ptr solutionRepo); + Solution createSolution(size_t userId, size_t taskId, + std::string source) override; + std::vector getSolutionsByUserAndTaskId(size_t userId, + size_t taskId) override; + void deleteSolutionById(size_t solId) override; + std::pair getMetrics(size_t solId) override; +}; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h new file mode 100644 index 0000000..bf04d3e --- /dev/null +++ b/server/internal/service/include/TaskService.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +#include "ITaskRepository.hpp" +#include "ITaskService.h" + +class TaskService : public ITaskService { + private: + std::unique_ptr taskRepo; + + public: + TaskService(std::unique_ptr taskRepo); + ~TaskService() override = default; + Task createTask(std::string desc) override; + Task getTask(size_t id) override; + std::vector getAllTasks() override; + void deleteTask(size_t id) override; +}; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h new file mode 100644 index 0000000..719aa02 --- /dev/null +++ b/server/internal/service/include/UserService.h @@ -0,0 +1,19 @@ +#pragma once +#include + +#include "IUserRepository.hpp" +#include "IUserService.h" +#include "UserValidator.h" + +class UserService : IUserService { + private: + std::unique_ptr userRepo; + + public: + ~UserService() override = default; + explicit UserService(std::unique_ptr userRepo); + User createUser(std::string login, std::string username, + std::string password) override; + User getUserById(size_t id) override; + void deleteUser(size_t id) override; +}; diff --git a/server/internal/service/include/UserValidator.h b/server/internal/service/include/UserValidator.h new file mode 100644 index 0000000..002f450 --- /dev/null +++ b/server/internal/service/include/UserValidator.h @@ -0,0 +1,16 @@ +#pragma once + +#include "User.hpp" + +class UserValidator { + private: + User user; + bool validateLogin(); + bool validatePassword(); + bool validateUsername(); + + public: + explicit UserValidator(User user); + bool validateUser(); + ~UserValidator() = default; +}; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp new file mode 100644 index 0000000..216b76c --- /dev/null +++ b/server/internal/service/src/SolutionService.cpp @@ -0,0 +1,40 @@ +#include "SolutionService.h" + +SolutionService::SolutionService( + std::unique_ptr solutionRepo) + : solutionRepo(std::move(solutionRepo)) {} + +Solution SolutionService::createSolution(size_t userId, size_t taskId, + std::string source) { + size_t id = solutionRepo->storeSolution( + Solution(0, "", userId, "", "", "", taskId, "")); + return Solution(id, "", userId, source, "", "", taskId, ""); +} + +std::vector SolutionService::getSolutionsByUserAndTaskId( + size_t userId, size_t taskId) { + try { + return solutionRepo->getSolutions(userId, taskId); + } catch (std::exception& e) { + throw e; + } +} + +void SolutionService::deleteSolutionById(size_t solId) { + try { + solutionRepo->deleteSolutionById(solId); + } catch (std::exception& e) { + throw e; + } +} + +std::pair SolutionService::getMetrics(size_t solId) { + try { + Solution sol = solutionRepo->getSolutionById(solId); + std::string tokens = sol.getTokens(); + std::string astTree = sol.getAstTree(); + return std::make_pair(tokens, astTree); + } catch (std::exception& e) { + throw e; + } +} diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp new file mode 100644 index 0000000..a3ce5ef --- /dev/null +++ b/server/internal/service/src/TaskService.cpp @@ -0,0 +1,15 @@ +#include "TaskService.h" + +TaskService::TaskService(std::unique_ptr taskRepo) + : taskRepo(std::move(taskRepo)) {} + +Task TaskService::createTask(std::string desc) { + size_t id = taskRepo->storeTask(Task(desc)); + return Task(id, desc); +} + +std::vector TaskService::getAllTasks() { return std::vector(); } + +Task TaskService::getTask(size_t id) { return taskRepo->getTaskById(id); } + +void TaskService::deleteTask(size_t id) { taskRepo->deleteTaskById(id); } diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp new file mode 100644 index 0000000..b44ecf3 --- /dev/null +++ b/server/internal/service/src/UserService.cpp @@ -0,0 +1,19 @@ +#include "UserService.h" + +#include "Exceptions.h" + +UserService::UserService(std::unique_ptr userRepo) + : userRepo(std::move(userRepo)) {} + +User UserService::createUser(std::string login, std::string username, + std::string password) { + if (login == "") { + throw ValidateException("invalid login"); + } + size_t id = userRepo->makeUser(User(login, password, username)); + return User(id, login, password, username); +} + +User UserService::getUserById(size_t id) { return userRepo->getUserById(id); } + +void UserService::deleteUser(size_t id) { userRepo->deleteByUserId(id); } diff --git a/server/internal/service/src/UserValidator.cpp b/server/internal/service/src/UserValidator.cpp new file mode 100644 index 0000000..6666641 --- /dev/null +++ b/server/internal/service/src/UserValidator.cpp @@ -0,0 +1,36 @@ +#include "UserValidator.h" + +#include + +UserValidator::UserValidator(User user) : user(user) {} + +bool UserValidator::validateUser() { + if (validateLogin() && validatePassword() && validateUsername()) { + return true; + } + return false; +} + +bool UserValidator::validateLogin() { + std::string login = user.getLogin(); + if (login.length() < 3 || login.length() > 30) { + return false; + } + return true; +} + +bool UserValidator::validatePassword() { + std::string password = user.getPassword(); + if (password.length() < 8 || password.length() > 30) { + return false; + } + return true; +} + +bool UserValidator::validateUsername() { + std::string username = user.getUsername(); + if (username.length() < 3 || username.length() > 20) { + return false; + } + return true; +} diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt new file mode 100644 index 0000000..5dc8740 --- /dev/null +++ b/server/internal/service/tests/CMakeLists.txt @@ -0,0 +1,17 @@ +project(test_service) + +set(CMAKE_CXX_STANDARD 20) +add_compile_options(-coverage) + +file(GLOB SOURCES *.cpp) + +enable_testing() +find_package(GTest REQUIRED) + +add_executable(${PROJECT_NAME} ${SOURCES}) + +target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIBRARY} GTest::GTest gmock) +target_include_directories(${PROJECT_NAME} PUBLIC ${SERVICE_lib_INCLUDE_DIRS}) + + +add_test(test_service test_service) \ No newline at end of file diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp new file mode 100644 index 0000000..2dcb91f --- /dev/null +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -0,0 +1,96 @@ +#include +#include + +#include "SolutionService.h" + +class Exception : public std::exception { + std::string _msg; + + public: + Exception(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +bool operator==(Solution s1, Solution s2) { return s1.getId() == s2.getId(); } + +class SolutionRepositoryMock : public ISolutionRepository { + public: + ~SolutionRepositoryMock() override = default; + MOCK_METHOD(Solution, getSolutionById, (size_t id), (override)); + MOCK_METHOD(std::vector, getSolutionsBySenderId, (size_t sender_id), + (override)); + MOCK_METHOD(std::vector, getSolutionsByTaskId, (size_t task_id), + (override)); + MOCK_METHOD(std::vector, getSolutions, + (size_t sender_id, size_t task_id), (override)); + MOCK_METHOD(size_t, storeSolution, (Solution solution), (override)); + MOCK_METHOD(void, updateSolution, (Solution solution), (override)); + MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); + MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); +}; + +struct SolutionServiceTest : public testing::Test { + SolutionService* ss; + SolutionRepositoryMock* mock_ptr; + + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + ss = new SolutionService(std::move(mock)); + } + void TearDown() { delete ss; } +}; + +ACTION(NoSolutionException) { + throw Exception("no solution with this id in db"); +} + +TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { + std::vector solutions; + solutions.push_back(Solution(0, "", 1, "", "", "", 1, "")); + solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + EXPECT_CALL(*mock_ptr, getSolutions(1, 1)) + .Times(1) + .WillOnce(::testing::Return(solutions)); + std::vector sols = ss->getSolutionsByUserAndTaskId(1, 1); + EXPECT_EQ(sols.size(), 2); +} + +TEST_F(SolutionServiceTest, deleteSolution) { + EXPECT_CALL(*mock_ptr, deleteSolutionById(1)).Times(1); + ss->deleteSolutionById(1); +} + +TEST_F(SolutionServiceTest, deleteSolutionException) { + EXPECT_CALL(*mock_ptr, deleteSolutionById(-1)) + .Times(1) + .WillRepeatedly(NoSolutionException()); + EXPECT_THROW(ss->deleteSolutionById(-1), std::exception); +} + +TEST_F(SolutionServiceTest, getMetrics) { + EXPECT_CALL(*mock_ptr, getSolutionById(1)) + .Times(1) + .WillOnce(::testing::Return( + Solution(1, "", 1, "", "tokens", "astTree", 1, ""))); + std::pair metrics = ss->getMetrics(1); + EXPECT_EQ(metrics.first, "tokens"); + EXPECT_EQ(metrics.second, "astTree"); +} + +TEST_F(SolutionServiceTest, getMetricsException) { + EXPECT_CALL(*mock_ptr, getSolutionById(-1)) + .Times(1) + .WillRepeatedly(NoSolutionException()); + EXPECT_THROW(ss->getMetrics(-1), std::exception); +} + +TEST_F(SolutionServiceTest, createSolution) { + EXPECT_CALL(*mock_ptr, + storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) + .Times(1) + .WillRepeatedly(::testing::Return(1)); + Solution sol = ss->createSolution(2, 1, "source"); + EXPECT_EQ(sol.getId(), 1); + EXPECT_EQ(sol.getSource(), "source"); +} \ No newline at end of file diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp new file mode 100644 index 0000000..5a450d2 --- /dev/null +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -0,0 +1,82 @@ +#include +#include + +#include "TaskService.h" + +bool operator==(Task t1, Task t2) { return t1.getId() == t2.getId(); } + +class Exception : public std::exception { + std::string _msg; + + public: + Exception(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +class TaskRepositoryMock : public ITaskRepository { + public: + ~TaskRepositoryMock() override = default; + MOCK_METHOD(Task, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (Task task), (override)); + MOCK_METHOD(int, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); +}; + +struct TaskServiceTest : public testing::Test { + TaskService* ts; + TaskRepositoryMock* mock_ptr; + + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + ts = new TaskService(std::move(mock)); + } + void TearDown() { delete ts; } +}; + +ACTION(NoTaskException) { throw Exception("no task with this id in db"); } + +TEST_F(TaskServiceTest, deleteTaskById) { + EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1); + ts->deleteTask(1); +} + +TEST_F(TaskServiceTest, deleteTasWithInvalidId) { + EXPECT_CALL(*mock_ptr, deleteTaskById(1)) + .Times(1) + .WillRepeatedly(NoTaskException()); + EXPECT_THROW(ts->deleteTask(1), Exception); +} + +TEST_F(TaskServiceTest, GetTaskByIdOK) { + EXPECT_CALL(*mock_ptr, getTaskById(1)) + .Times(1) + .WillOnce(::testing::Return(Task(1, "desription"))); + Task t = ts->getTask(1); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desription"); +} + +TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { + EXPECT_CALL(*mock_ptr, getTaskById(-1)) + .Times(1) + .WillRepeatedly(NoTaskException()); + EXPECT_THROW(ts->getTask(-1), Exception); +} + +TEST_F(TaskServiceTest, CreateTask) { + EXPECT_CALL(*mock_ptr, storeTask(Task("desc"))) + .Times(1) + .WillOnce(::testing::Return(1)); + Task t = ts->createTask("desc"); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desc"); + + EXPECT_CALL(*mock_ptr, storeTask(Task("desc2"))) + .Times(1) + .WillOnce(::testing::Return(2)); + t = ts->createTask("desc2"); + EXPECT_EQ(t.getId(), 2); + EXPECT_EQ(t.getDescription(), "desc2"); +} diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp new file mode 100644 index 0000000..a742351 --- /dev/null +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -0,0 +1,85 @@ +#include +#include + +#include "Exceptions.h" +#include "UserService.h" + +bool operator==(User u1, User u2) { return u1.getId() == u2.getId(); } + +class Exception : public std::exception { + std::string _msg; + + public: + Exception(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +class UserRepositoryMock : public IUserRepository { + public: + ~UserRepositoryMock() override = default; + MOCK_METHOD(User, getUserById, (size_t id), (override)); + MOCK_METHOD(User, getUserByLogin, (std::string login), (override)); + MOCK_METHOD(size_t, makeUser, (User user), (override)); + MOCK_METHOD(void, deleteUser, (User user), (override)); + MOCK_METHOD(void, deleteByUserId, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllUsers, (), (override)); +}; + +struct UserServiceTest : public testing::Test { + UserService* us; + UserRepositoryMock* mock_ptr; + + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + us = new UserService(std::move(mock)); + } + void TearDown() { delete us; } +}; + +ACTION(NoUserException) { throw Exception("no user with this id in db"); } + +TEST_F(UserServiceTest, deleteUser) { + EXPECT_CALL(*mock_ptr, deleteByUserId(1)).Times(1); + us->deleteUser(1); +} + +TEST_F(UserServiceTest, deleteUserWithInvalidId) { + EXPECT_CALL(*mock_ptr, deleteByUserId(1)) + .Times(1) + .WillRepeatedly(NoUserException()); + EXPECT_THROW(us->deleteUser(1), Exception); +} + +TEST_F(UserServiceTest, getUserOk) { + EXPECT_CALL(*mock_ptr, getUserById(1)) + .Times(1) + .WillOnce(::testing::Return(User(1, "login", "password", "username"))); + User u = us->getUserById(1); + EXPECT_EQ(u.getLogin(), "login"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); +} + +TEST_F(UserServiceTest, getUserEXEPTION) { + EXPECT_CALL(*mock_ptr, getUserById(-1)).Times(1).WillOnce(NoUserException()); + EXPECT_THROW(us->getUserById(-1), Exception); +} + +TEST_F(UserServiceTest, makeUserOk) { + EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) + .Times(1) + .WillOnce(::testing::Return(1)); + User u = us->createUser("login", "username", "password"); + EXPECT_EQ(u.getLogin(), "login"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); +} + +TEST_F(UserServiceTest, makeUserInvalidData) { + EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) + .Times(0); + EXPECT_THROW(us->createUser("", "", ""), ValidateException); +} \ No newline at end of file diff --git a/server/internal/service/tests/UserValidatorTest.cpp b/server/internal/service/tests/UserValidatorTest.cpp new file mode 100644 index 0000000..802b2f0 --- /dev/null +++ b/server/internal/service/tests/UserValidatorTest.cpp @@ -0,0 +1,29 @@ +#include +#include + +#include "UserValidator.h" + +TEST(UserValidatorTest, validateOK) { + UserValidator uv(User("login", "password", "username")); + EXPECT_TRUE(uv.validateUser()); +} + +TEST(UserValidatorTest, invalidLogin) { + UserValidator uv(User("", "password", "username")); + EXPECT_FALSE(uv.validateUser()); +} + +TEST(UserValidatorTest, invalidPassword) { + UserValidator uv(User("login", "", "username")); + EXPECT_FALSE(uv.validateUser()); +} + +TEST(UserValidatorTest, invalidUsername) { + UserValidator uv(User("login", "password", "")); + EXPECT_FALSE(uv.validateUser()); +} + +TEST(UserValidatorTest, invalidUserFields) { + UserValidator uv(User("", "", "")); + EXPECT_FALSE(uv.validateUser()); +} \ No newline at end of file diff --git a/server/internal/service/tests/main.cpp b/server/internal/service/tests/main.cpp new file mode 100644 index 0000000..4ccb037 --- /dev/null +++ b/server/internal/service/tests/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleMock(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h new file mode 100644 index 0000000..a9ec548 --- /dev/null +++ b/server/internal/service/virtual/ISolutionService.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +#include "Solution.hpp" + +class ISolutionService { + public: + virtual ~ISolutionService() = default; + virtual Solution createSolution(size_t userId, size_t taskId, + std::string source) = 0; + virtual std::vector getSolutionsByUserAndTaskId(size_t userId, + size_t taskId) = 0; + virtual void deleteSolutionById(size_t solId) = 0; + + virtual std::pair getMetrics(size_t solId) = 0; +}; diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h new file mode 100644 index 0000000..731fb0f --- /dev/null +++ b/server/internal/service/virtual/ITaskService.h @@ -0,0 +1,13 @@ +#pragma once +#include + +#include "Task.hpp" + +class ITaskService { + public: + virtual ~ITaskService() = default; + virtual Task createTask(std::string desc) = 0; + virtual Task getTask(size_t id) = 0; + virtual std::vector getAllTasks() = 0; + virtual void deleteTask(size_t id) = 0; +}; diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h new file mode 100644 index 0000000..06d7972 --- /dev/null +++ b/server/internal/service/virtual/IUserService.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +#include "User.hpp" + +class IUserService { + public: + virtual ~IUserService() = default; + virtual User createUser(std::string login, std::string username, + std::string password) = 0; + virtual User getUserById(size_t id) = 0; + virtual void deleteUser(size_t id) = 0; +}; -- GitLab From 62100f6002b333cdbb679129eb72f862373f2e43 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 4 May 2023 00:26:00 +0300 Subject: [PATCH 036/134] add antlr lib and metrics mock --- server/CMakeLists.txt | 3 +- server/cmd/.env | 6 + server/cmd/CMakeLists.txt | 10 + server/cmd/main.cpp | 10 + server/internal/CMakeLists.txt | 2 + server/internal/service/CMakeLists.txt | 8 +- .../service/include/SolutionService.h | 7 +- .../internal/service/src/SolutionService.cpp | 10 +- .../internal/service/virtual/IMockMetrics.h | 6 + server/pkg/CMakeLists.txt | 4 + server/pkg/antlr/CMakeLists.txt | 23 + .../pkg/antlr/cmake/ExternalAntlr4Cpp.cmake | 177 + server/pkg/antlr/cmake/FindANTLR.cmake | 124 + .../pkg/antlr/cmake/antlr4-generator.cmake.in | 181 + .../pkg/antlr/cmake/antlr4-runtime.cmake.in | 13 + server/pkg/antlr/cpp14/CMakeLists.txt | 20 + server/pkg/antlr/cpp14/CPP14Lexer.g4 | 409 + server/pkg/antlr/cpp14/CPP14Parser.g4 | 823 + server/pkg/antlr/cpp14/include/CPP14Lexer.h | 79 + server/pkg/antlr/cpp14/include/CPP14Parser.h | 3149 +++ server/pkg/antlr/cpp14/include/MyCppAntlr.h | 31 + server/pkg/antlr/cpp14/src/CPP14Lexer.cpp | 718 + server/pkg/antlr/cpp14/src/CPP14Parser.cpp | 18169 ++++++++++++++++ server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 41 + server/pkg/antlr/python3/Python3.g4 | 1182 + server/pkg/antlr/testprogs/cpp/test.cpp | 12 + server/pkg/antlr/testprogs/python/test.py | 7 + server/pkg/antlr/virtual/IAntlrWrapper.h | 9 + 28 files changed, 25226 insertions(+), 7 deletions(-) create mode 100644 server/cmd/.env create mode 100644 server/cmd/CMakeLists.txt create mode 100644 server/cmd/main.cpp create mode 100644 server/internal/service/virtual/IMockMetrics.h create mode 100644 server/pkg/CMakeLists.txt create mode 100644 server/pkg/antlr/CMakeLists.txt create mode 100644 server/pkg/antlr/cmake/ExternalAntlr4Cpp.cmake create mode 100644 server/pkg/antlr/cmake/FindANTLR.cmake create mode 100644 server/pkg/antlr/cmake/antlr4-generator.cmake.in create mode 100644 server/pkg/antlr/cmake/antlr4-runtime.cmake.in create mode 100644 server/pkg/antlr/cpp14/CMakeLists.txt create mode 100644 server/pkg/antlr/cpp14/CPP14Lexer.g4 create mode 100644 server/pkg/antlr/cpp14/CPP14Parser.g4 create mode 100644 server/pkg/antlr/cpp14/include/CPP14Lexer.h create mode 100644 server/pkg/antlr/cpp14/include/CPP14Parser.h create mode 100644 server/pkg/antlr/cpp14/include/MyCppAntlr.h create mode 100644 server/pkg/antlr/cpp14/src/CPP14Lexer.cpp create mode 100644 server/pkg/antlr/cpp14/src/CPP14Parser.cpp create mode 100644 server/pkg/antlr/cpp14/src/MyCppAntlr.cpp create mode 100644 server/pkg/antlr/python3/Python3.g4 create mode 100644 server/pkg/antlr/testprogs/cpp/test.cpp create mode 100644 server/pkg/antlr/testprogs/python/test.py create mode 100644 server/pkg/antlr/virtual/IAntlrWrapper.h diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 47ff64a..a860480 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -2,7 +2,7 @@ set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) -# find_package(libpqxx REQUIRED) +find_package(Threads REQUIRED) find_library(PQXX_LIB pqxx) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) @@ -11,6 +11,7 @@ message(STATUS ${nlohmann_json_LIBRARIES}) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) +add_subdirectory(pkg) add_subdirectory(internal) message(STATUS ${Boost_LIBRARIES}) diff --git a/server/cmd/.env b/server/cmd/.env new file mode 100644 index 0000000..7cac90d --- /dev/null +++ b/server/cmd/.env @@ -0,0 +1,6 @@ +PGHOSTADDR=0.0.0.0 +PGPORT=5432 +PGDATABASE=mydb +PGUSER=postgres +PGPASSWORD=root +POOL_SIZE=10 \ No newline at end of file diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt new file mode 100644 index 0000000..446f2a8 --- /dev/null +++ b/server/cmd/CMakeLists.txt @@ -0,0 +1,10 @@ +set(PROJECT_NAME "Server") + +project(${PROJECT_NAME}) + +add_executable(Server main.cpp) +message(STATUS ${libusers}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libRepository_LIB}) +target_include_directories(Server PUBLIC ${libusers_INCLUDE_DIRS}) +message("Built server") + diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp new file mode 100644 index 0000000..177490d --- /dev/null +++ b/server/cmd/main.cpp @@ -0,0 +1,10 @@ +//#include "dotenv.h" +#include "UserRepository.hpp" +#include "User.hpp" + +//using namespace dotenv; +int main(){ + User user{"qwerty200468@gmail.com", "123", "tolik"}; + UserRepository repo; + std::cout< solutionRepo; - // std::unique_ptr antlr + std::unique_ptr antlr; + std::unique_ptr metrics; public: explicit SolutionService(std::unique_ptr solutionRepo); + void setAntlrWrapper(std::unique_ptr antlr_); + void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, std::string source) override; std::vector getSolutionsByUserAndTaskId(size_t userId, diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 216b76c..485f86b 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -7,7 +7,7 @@ SolutionService::SolutionService( Solution SolutionService::createSolution(size_t userId, size_t taskId, std::string source) { size_t id = solutionRepo->storeSolution( - Solution(0, "", userId, "", "", "", taskId, "")); + Solution(0, "", userId, source, "metrics1", "metrics2", taskId, "")); return Solution(id, "", userId, source, "", "", taskId, ""); } @@ -38,3 +38,11 @@ std::pair SolutionService::getMetrics(size_t solId) { throw e; } } + +void SolutionService::setAntlrWrapper(std::unique_ptr antlr_) { + antlr = std::move(antlr_); +} + +void SolutionService::setMetrics(std::unique_ptr metrics_) { + metrics = std::move(metrics_); +} diff --git a/server/internal/service/virtual/IMockMetrics.h b/server/internal/service/virtual/IMockMetrics.h new file mode 100644 index 0000000..d86a0f6 --- /dev/null +++ b/server/internal/service/virtual/IMockMetrics.h @@ -0,0 +1,6 @@ +#pragma once + +class IMockMetrics { + public: + virtual void countMetric(); +}; diff --git a/server/pkg/CMakeLists.txt b/server/pkg/CMakeLists.txt new file mode 100644 index 0000000..f105ad5 --- /dev/null +++ b/server/pkg/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(antlr) + +set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) +set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/pkg/antlr/CMakeLists.txt b/server/pkg/antlr/CMakeLists.txt new file mode 100644 index 0000000..c80b455 --- /dev/null +++ b/server/pkg/antlr/CMakeLists.txt @@ -0,0 +1,23 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +set(CMAKE_CXX_STANDARD 20) + + +# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread") +set(THREADS_PREFER_PTHREAD_FLAG ON) + + +include(ExternalAntlr4Cpp) +include_directories(${ANTLR4_INCLUDE_DIRS}) + +set(ANTLR_EXECUTABLE /usr/local/lib/antlr-4.12.0-complete.jar) +find_package(ANTLR REQUIRED) + +add_subdirectory(cpp14) +# add_subdirectory(python3) + +set(ANTLR4_LIB ${CPP_ANTLR_LIBRARY}) +set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) +set(ANTLR4_LIB_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS}) +set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) + diff --git a/server/pkg/antlr/cmake/ExternalAntlr4Cpp.cmake b/server/pkg/antlr/cmake/ExternalAntlr4Cpp.cmake new file mode 100644 index 0000000..54f874b --- /dev/null +++ b/server/pkg/antlr/cmake/ExternalAntlr4Cpp.cmake @@ -0,0 +1,177 @@ +cmake_minimum_required(VERSION 3.7) + +if(POLICY CMP0114) + cmake_policy(SET CMP0114 NEW) +endif() + +include(ExternalProject) + +set(ANTLR4_ROOT ${CMAKE_CURRENT_BINARY_DIR}/antlr4_runtime/src/antlr4_runtime) +set(ANTLR4_INCLUDE_DIRS ${ANTLR4_ROOT}/runtime/Cpp/runtime/src) +set(ANTLR4_GIT_REPOSITORY https://github.com/antlr/antlr4.git) +if(NOT DEFINED ANTLR4_TAG) + # Set to branch name to keep library updated at the cost of needing to rebuild after 'clean' + # Set to commit hash to keep the build stable and does not need to rebuild after 'clean' + set(ANTLR4_TAG master) +endif() + +# Ensure that the include dir already exists at configure time (to avoid cmake erroring +# on non-existent include dirs) +file(MAKE_DIRECTORY "${ANTLR4_INCLUDE_DIRS}") + +if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") + set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist/$(Configuration)) +elseif(${CMAKE_GENERATOR} MATCHES "Xcode.*") + set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist/$(CONFIGURATION)) +else() + set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist) +endif() + +if(MSVC) + set(ANTLR4_STATIC_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/antlr4-runtime-static.lib) + set(ANTLR4_SHARED_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/antlr4-runtime.lib) + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/antlr4-runtime.dll) +else() + set(ANTLR4_STATIC_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.a) + if(MINGW) + set(ANTLR4_SHARED_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a) + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll) + elseif(CYGWIN) + set(ANTLR4_SHARED_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a) + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/cygantlr4-runtime-4.12.0.dll) + elseif(APPLE) + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dylib) + else() + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.so) + endif() +endif() + +if(${CMAKE_GENERATOR} MATCHES ".* Makefiles") + # This avoids + # 'warning: jobserver unavailable: using -j1. Add '+' to parent make rule.' + set(ANTLR4_BUILD_COMMAND $(MAKE)) +elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") + set(ANTLR4_BUILD_COMMAND + ${CMAKE_COMMAND} + --build . + --config $(Configuration) + --target) +elseif(${CMAKE_GENERATOR} MATCHES "Xcode.*") + set(ANTLR4_BUILD_COMMAND + ${CMAKE_COMMAND} + --build . + --config $(CONFIGURATION) + --target) +else() + set(ANTLR4_BUILD_COMMAND + ${CMAKE_COMMAND} + --build . + --target) +endif() + +if(NOT DEFINED ANTLR4_WITH_STATIC_CRT) + set(ANTLR4_WITH_STATIC_CRT ON) +endif() + +if(ANTLR4_ZIP_REPOSITORY) + ExternalProject_Add( + antlr4_runtime + PREFIX antlr4_runtime + URL ${ANTLR4_ZIP_REPOSITORY} + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} + BUILD_COMMAND "" + BUILD_IN_SOURCE 1 + SOURCE_DIR ${ANTLR4_ROOT} + SOURCE_SUBDIR runtime/Cpp + CMAKE_CACHE_ARGS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} + -DDISABLE_WARNINGS:BOOL=ON + # -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard + # -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project + INSTALL_COMMAND "" + EXCLUDE_FROM_ALL 1) +else() + ExternalProject_Add( + antlr4_runtime + PREFIX antlr4_runtime + GIT_REPOSITORY ${ANTLR4_GIT_REPOSITORY} + GIT_TAG ${ANTLR4_TAG} + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} + BUILD_COMMAND "" + BUILD_IN_SOURCE 1 + SOURCE_DIR ${ANTLR4_ROOT} + SOURCE_SUBDIR runtime/Cpp + CMAKE_CACHE_ARGS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} + -DDISABLE_WARNINGS:BOOL=ON + # -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard + # -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project + INSTALL_COMMAND "" + EXCLUDE_FROM_ALL 1) +endif() + +# Separate build step as rarely people want both +set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT}) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") + # CMake 3.14 builds in above's SOURCE_SUBDIR when BUILD_IN_SOURCE is true + set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT}/runtime/Cpp) +endif() + +ExternalProject_Add_Step( + antlr4_runtime + build_static + COMMAND ${ANTLR4_BUILD_COMMAND} antlr4_static + # Depend on target instead of step (a custom command) + # to avoid running dependent steps concurrently + DEPENDS antlr4_runtime + BYPRODUCTS ${ANTLR4_STATIC_LIBRARIES} + EXCLUDE_FROM_MAIN 1 + WORKING_DIRECTORY ${ANTLR4_BUILD_DIR}) +ExternalProject_Add_StepTargets(antlr4_runtime build_static) + +add_library(antlr4_static STATIC IMPORTED) +add_dependencies(antlr4_static antlr4_runtime-build_static) +set_target_properties(antlr4_static PROPERTIES + IMPORTED_LOCATION ${ANTLR4_STATIC_LIBRARIES}) +target_include_directories(antlr4_static + INTERFACE + ${ANTLR4_INCLUDE_DIRS} +) + +ExternalProject_Add_Step( + antlr4_runtime + build_shared + COMMAND ${ANTLR4_BUILD_COMMAND} antlr4_shared + # Depend on target instead of step (a custom command) + # to avoid running dependent steps concurrently + DEPENDS antlr4_runtime + BYPRODUCTS ${ANTLR4_SHARED_LIBRARIES} ${ANTLR4_RUNTIME_LIBRARIES} + EXCLUDE_FROM_MAIN 1 + WORKING_DIRECTORY ${ANTLR4_BUILD_DIR}) +ExternalProject_Add_StepTargets(antlr4_runtime build_shared) + +add_library(antlr4_shared SHARED IMPORTED) +add_dependencies(antlr4_shared antlr4_runtime-build_shared) +set_target_properties(antlr4_shared PROPERTIES + IMPORTED_LOCATION ${ANTLR4_RUNTIME_LIBRARIES}) +target_include_directories(antlr4_shared + INTERFACE + ${ANTLR4_INCLUDE_DIRS} +) + +if(ANTLR4_SHARED_LIBRARIES) + set_target_properties(antlr4_shared PROPERTIES + IMPORTED_IMPLIB ${ANTLR4_SHARED_LIBRARIES}) +endif() diff --git a/server/pkg/antlr/cmake/FindANTLR.cmake b/server/pkg/antlr/cmake/FindANTLR.cmake new file mode 100644 index 0000000..0ac8f8c --- /dev/null +++ b/server/pkg/antlr/cmake/FindANTLR.cmake @@ -0,0 +1,124 @@ +find_package(Java QUIET COMPONENTS Runtime) + +if(NOT ANTLR_EXECUTABLE) + find_program(ANTLR_EXECUTABLE + NAMES antlr.jar antlr4.jar antlr-4.jar antlr-4.12.0-complete.jar) +endif() + +if(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE) + execute_process( + COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE} + OUTPUT_VARIABLE ANTLR_COMMAND_OUTPUT + ERROR_VARIABLE ANTLR_COMMAND_ERROR + RESULT_VARIABLE ANTLR_COMMAND_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(ANTLR_COMMAND_RESULT EQUAL 0) + string(REGEX MATCH "Version [0-9]+(\\.[0-9]+)*" ANTLR_VERSION ${ANTLR_COMMAND_OUTPUT}) + string(REPLACE "Version " "" ANTLR_VERSION ${ANTLR_VERSION}) + else() + message( + SEND_ERROR + "Command '${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE}' " + "failed with the output '${ANTLR_COMMAND_ERROR}'") + endif() + + macro(ANTLR_TARGET Name InputFile) + set(ANTLR_OPTIONS LEXER PARSER LISTENER VISITOR) + set(ANTLR_ONE_VALUE_ARGS PACKAGE OUTPUT_DIRECTORY DEPENDS_ANTLR) + set(ANTLR_MULTI_VALUE_ARGS COMPILE_FLAGS DEPENDS) + cmake_parse_arguments(ANTLR_TARGET + "${ANTLR_OPTIONS}" + "${ANTLR_ONE_VALUE_ARGS}" + "${ANTLR_MULTI_VALUE_ARGS}" + ${ARGN}) + + set(ANTLR_${Name}_INPUT ${InputFile}) + + get_filename_component(ANTLR_INPUT ${InputFile} NAME_WE) + + if(ANTLR_TARGET_OUTPUT_DIRECTORY) + set(ANTLR_${Name}_OUTPUT_DIR ${ANTLR_TARGET_OUTPUT_DIRECTORY}) + else() + set(ANTLR_${Name}_OUTPUT_DIR + ${CMAKE_CURRENT_BINARY_DIR}/antlr4cpp_generated_src/${ANTLR_INPUT}) + endif() + + unset(ANTLR_${Name}_CXX_OUTPUTS) + + if((ANTLR_TARGET_LEXER AND NOT ANTLR_TARGET_PARSER) OR + (ANTLR_TARGET_PARSER AND NOT ANTLR_TARGET_LEXER)) + list(APPEND ANTLR_${Name}_CXX_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.cpp) + set(ANTLR_${Name}_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.interp + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.tokens) + else() + list(APPEND ANTLR_${Name}_CXX_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.cpp + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Parser.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Parser.cpp) + list(APPEND ANTLR_${Name}_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.interp + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.tokens) + endif() + + if(ANTLR_TARGET_LISTENER) + list(APPEND ANTLR_${Name}_CXX_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseListener.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseListener.cpp + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Listener.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Listener.cpp) + list(APPEND ANTLR_TARGET_COMPILE_FLAGS -listener) + endif() + + if(ANTLR_TARGET_VISITOR) + list(APPEND ANTLR_${Name}_CXX_OUTPUTS + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseVisitor.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseVisitor.cpp + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Visitor.h + ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Visitor.cpp) + list(APPEND ANTLR_TARGET_COMPILE_FLAGS -visitor) + endif() + + if(ANTLR_TARGET_PACKAGE) + list(APPEND ANTLR_TARGET_COMPILE_FLAGS -package ${ANTLR_TARGET_PACKAGE}) + endif() + + list(APPEND ANTLR_${Name}_OUTPUTS ${ANTLR_${Name}_CXX_OUTPUTS}) + + if(ANTLR_TARGET_DEPENDS_ANTLR) + if(ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_INPUT) + list(APPEND ANTLR_TARGET_DEPENDS + ${ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_INPUT}) + list(APPEND ANTLR_TARGET_DEPENDS + ${ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_OUTPUTS}) + else() + message(SEND_ERROR + "ANTLR target '${ANTLR_TARGET_DEPENDS_ANTLR}' not found") + endif() + endif() + + add_custom_command( + OUTPUT ${ANTLR_${Name}_OUTPUTS} + COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE} + ${InputFile} + -o ${ANTLR_${Name}_OUTPUT_DIR} + -no-listener + -Dlanguage=Cpp + ${ANTLR_TARGET_COMPILE_FLAGS} + DEPENDS ${InputFile} + ${ANTLR_TARGET_DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building ${Name} with ANTLR ${ANTLR_VERSION}") + endmacro(ANTLR_TARGET) + +endif(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + ANTLR + REQUIRED_VARS ANTLR_EXECUTABLE Java_JAVA_EXECUTABLE + VERSION_VAR ANTLR_VERSION) diff --git a/server/pkg/antlr/cmake/antlr4-generator.cmake.in b/server/pkg/antlr/cmake/antlr4-generator.cmake.in new file mode 100644 index 0000000..6399651 --- /dev/null +++ b/server/pkg/antlr/cmake/antlr4-generator.cmake.in @@ -0,0 +1,181 @@ +set(ANTLR_VERSION @ANTLR_VERSION@) + +@PACKAGE_INIT@ + +if (NOT ANTLR4_CPP_GENERATED_SRC_DIR) + set(ANTLR4_GENERATED_SRC_DIR ${CMAKE_BINARY_DIR}/antlr4_generated_src) +endif() + +FIND_PACKAGE(Java COMPONENTS Runtime REQUIRED) + +# +# The ANTLR generator will output the following files given the input file f.g4 +# +# Input -> f.g4 +# Output -> f.h +# -> f.cpp +# +# the following files will only be produced if there is a parser contained +# Flag -visitor active +# Output -> BaseVisitor.h +# -> BaseVisitor.cpp +# -> Visitor.h +# -> Visitor.cpp +# +# Flag -listener active +# Output -> BaseListener.h +# -> BaseListener.cpp +# -> Listener.h +# -> Listener.cpp +# +# See documentation in markup +# +function(antlr4_generate + Antlr4_ProjectTarget + Antlr4_InputFile + Antlr4_GeneratorType + ) + + set( Antlr4_GeneratedSrcDir ${ANTLR4_GENERATED_SRC_DIR}/${Antlr4_ProjectTarget} ) + + get_filename_component(Antlr4_InputFileBaseName ${Antlr4_InputFile} NAME_WE ) + + list( APPEND Antlr4_GeneratorStatusMessage "Common Include-, Source- and Tokenfiles" ) + + if ( ${Antlr4_GeneratorType} STREQUAL "LEXER") + set(Antlr4_LexerBaseName "${Antlr4_InputFileBaseName}") + set(Antlr4_ParserBaseName "") + else() + if ( ${Antlr4_GeneratorType} STREQUAL "PARSER") + set(Antlr4_LexerBaseName "") + set(Antlr4_ParserBaseName "${Antlr4_InputFileBaseName}") + else() + if ( ${Antlr4_GeneratorType} STREQUAL "BOTH") + set(Antlr4_LexerBaseName "${Antlr4_InputFileBaseName}Lexer") + set(Antlr4_ParserBaseName "${Antlr4_InputFileBaseName}Parser") + else() + message(FATAL_ERROR "The third parameter must be LEXER, PARSER or BOTH") + endif () + endif () + endif () + + # Prepare list of generated targets + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}.tokens" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}.interp" ) + list( APPEND DependentTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}.tokens" ) + + if ( NOT ${Antlr4_LexerBaseName} STREQUAL "" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_LexerBaseName}.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_LexerBaseName}.cpp" ) + endif () + + if ( NOT ${Antlr4_ParserBaseName} STREQUAL "" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_ParserBaseName}.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_ParserBaseName}.cpp" ) + endif () + + # process optional arguments ... + + if ( ( ARGC GREATER_EQUAL 4 ) AND ARGV3 ) + set(Antlr4_BuildListenerOption "-listener") + + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}BaseListener.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}BaseListener.cpp" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}Listener.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}Listener.cpp" ) + + list( APPEND Antlr4_GeneratorStatusMessage ", Listener Include- and Sourcefiles" ) + else() + set(Antlr4_BuildListenerOption "-no-listener") + endif () + + if ( ( ARGC GREATER_EQUAL 5 ) AND ARGV4 ) + set(Antlr4_BuildVisitorOption "-visitor") + + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}BaseVisitor.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}BaseVisitor.cpp" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}Visitor.h" ) + list( APPEND Antlr4_GeneratedTargets "${Antlr4_GeneratedSrcDir}/${Antlr4_InputFileBaseName}Visitor.cpp" ) + + list( APPEND Antlr4_GeneratorStatusMessage ", Visitor Include- and Sourcefiles" ) + else() + set(Antlr4_BuildVisitorOption "-no-visitor") + endif () + + if ( (ARGC GREATER_EQUAL 6 ) AND (NOT ${ARGV5} STREQUAL "") ) + set(Antlr4_NamespaceOption "-package;${ARGV5}") + + list( APPEND Antlr4_GeneratorStatusMessage " in Namespace ${ARGV5}" ) + else() + set(Antlr4_NamespaceOption "") + endif () + + if ( (ARGC GREATER_EQUAL 7 ) AND (NOT ${ARGV6} STREQUAL "") ) + set(Antlr4_AdditionalDependencies ${ARGV6}) + else() + set(Antlr4_AdditionalDependencies "") + endif () + + if ( (ARGC GREATER_EQUAL 8 ) AND (NOT ${ARGV7} STREQUAL "") ) + set(Antlr4_LibOption "-lib;${ARGV7}") + + list( APPEND Antlr4_GeneratorStatusMessage " using Library ${ARGV7}" ) + else() + set(Antlr4_LibOption "") + endif () + + if(NOT Java_FOUND) + message(FATAL_ERROR "Java is required to process grammar or lexer files! - Use 'FIND_PACKAGE(Java COMPONENTS Runtime REQUIRED)'") + endif() + + if(NOT EXISTS "${ANTLR4_JAR_LOCATION}") + message(FATAL_ERROR "Unable to find antlr tool. ANTLR4_JAR_LOCATION:${ANTLR4_JAR_LOCATION}") + endif() + + # The call to generate the files + add_custom_command( + OUTPUT ${Antlr4_GeneratedTargets} + # Remove target directory + COMMAND + ${CMAKE_COMMAND} -E remove_directory ${Antlr4_GeneratedSrcDir} + # Create target directory + COMMAND + ${CMAKE_COMMAND} -E make_directory ${Antlr4_GeneratedSrcDir} + COMMAND + # Generate files + "${Java_JAVA_EXECUTABLE}" -jar "${ANTLR4_JAR_LOCATION}" -Werror -Dlanguage=Cpp ${Antlr4_BuildListenerOption} ${Antlr4_BuildVisitorOption} ${Antlr4_LibOption} ${ANTLR4_GENERATED_OPTIONS} -o "${Antlr4_GeneratedSrcDir}" ${Antlr4_NamespaceOption} "${Antlr4_InputFile}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + MAIN_DEPENDENCY "${Antlr4_InputFile}" + DEPENDS ${Antlr4_AdditionalDependencies} + ) + + # set output variables in parent scope + set( ANTLR4_INCLUDE_DIR_${Antlr4_ProjectTarget} ${Antlr4_GeneratedSrcDir} PARENT_SCOPE) + set( ANTLR4_SRC_FILES_${Antlr4_ProjectTarget} ${Antlr4_GeneratedTargets} PARENT_SCOPE) + set( ANTLR4_TOKEN_FILES_${Antlr4_ProjectTarget} ${DependentTargets} PARENT_SCOPE) + set( ANTLR4_TOKEN_DIRECTORY_${Antlr4_ProjectTarget} ${Antlr4_GeneratedSrcDir} PARENT_SCOPE) + + # export generated cpp files into list + foreach(generated_file ${Antlr4_GeneratedTargets}) + + if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set_source_files_properties( + ${generated_file} + PROPERTIES + COMPILE_FLAGS -Wno-overloaded-virtual + ) + endif () + + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set_source_files_properties( + ${generated_file} + PROPERTIES + COMPILE_FLAGS -wd4251 + ) + endif () + + endforeach(generated_file) + +message(STATUS "Antlr4 ${Antlr4_ProjectTarget} - Building " ${Antlr4_GeneratorStatusMessage} ) + +endfunction() diff --git a/server/pkg/antlr/cmake/antlr4-runtime.cmake.in b/server/pkg/antlr/cmake/antlr4-runtime.cmake.in new file mode 100644 index 0000000..697b36c --- /dev/null +++ b/server/pkg/antlr/cmake/antlr4-runtime.cmake.in @@ -0,0 +1,13 @@ +set(ANTLR_VERSION @ANTLR_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(ANTLR4_INCLUDE_DIR "@PACKAGE_ANTLR4_INCLUDE_DIR@") +set_and_check(ANTLR4_LIB_DIR "@PACKAGE_ANTLR4_LIB_DIR@") + +include(CMakeFindDependencyMacro) +find_dependency(Threads) + +include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake) + +check_required_components(antlr) diff --git a/server/pkg/antlr/cpp14/CMakeLists.txt b/server/pkg/antlr/cpp14/CMakeLists.txt new file mode 100644 index 0000000..c883479 --- /dev/null +++ b/server/pkg/antlr/cpp14/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.7) +project(cpp_antlr_lib) + +file(GLOB SOURCES ./src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) + + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES}) + + +target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) + +set(CPP_ANTLR_LIBRARY ${PROJECT_NAME}) +set(CPP_ANTLR_LIBRARY ${CPP_ANTLR_LIBRARY} PARENT_SCOPE) + +set(CPP_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(CPP_ANTLR_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) + +message("CPP_ANTLR = ${CPP_ANTLR_INCLUDE_DIRS} ") \ No newline at end of file diff --git a/server/pkg/antlr/cpp14/CPP14Lexer.g4 b/server/pkg/antlr/cpp14/CPP14Lexer.g4 new file mode 100644 index 0000000..860e6d2 --- /dev/null +++ b/server/pkg/antlr/cpp14/CPP14Lexer.g4 @@ -0,0 +1,409 @@ +lexer grammar CPP14Lexer; + +IntegerLiteral: + DecimalLiteral Integersuffix? + | OctalLiteral Integersuffix? + | HexadecimalLiteral Integersuffix? + | BinaryLiteral Integersuffix?; + +CharacterLiteral: + ('u' | 'U' | 'L')? '\'' Cchar+ '\''; + +FloatingLiteral: + Fractionalconstant Exponentpart? Floatingsuffix? + | Digitsequence Exponentpart Floatingsuffix?; + +StringLiteral: + Encodingprefix? + (Rawstring + |'"' Schar* '"'); + +BooleanLiteral: False_ | True_; + +PointerLiteral: Nullptr; + +UserDefinedLiteral: + UserDefinedIntegerLiteral + | UserDefinedFloatingLiteral + | UserDefinedStringLiteral + | UserDefinedCharacterLiteral; + +MultiLineMacro: + '#' (~[\n]*? '\\' '\r'? '\n')+ ~ [\n]+ -> channel (HIDDEN); + +Directive: '#' ~ [\n]* -> channel (HIDDEN); +/*Keywords*/ + +Alignas: 'alignas'; + +Alignof: 'alignof'; + +Asm: 'asm'; + +Auto: 'auto'; + +Bool: 'bool'; + +Break: 'break'; + +Case: 'case'; + +Catch: 'catch'; + +Char: 'char'; + +Char16: 'char16_t'; + +Char32: 'char32_t'; + +Class: 'class'; + +Const: 'const'; + +Constexpr: 'constexpr'; + +Const_cast: 'const_cast'; + +Continue: 'continue'; + +Decltype: 'decltype'; + +Default: 'default'; + +Delete: 'delete'; + +Do: 'do'; + +Double: 'double'; + +Dynamic_cast: 'dynamic_cast'; + +Else: 'else'; + +Enum: 'enum'; + +Explicit: 'explicit'; + +Export: 'export'; + +Extern: 'extern'; + +//DO NOT RENAME - PYTHON NEEDS True and False +False_: 'false'; + +Final: 'final'; + +Float: 'float'; + +For: 'for'; + +Friend: 'friend'; + +Goto: 'goto'; + +If: 'if'; + +Inline: 'inline'; + +Int: 'int'; + +Long: 'long'; + +Mutable: 'mutable'; + +Namespace: 'namespace'; + +New: 'new'; + +Noexcept: 'noexcept'; + +Nullptr: 'nullptr'; + +Operator: 'operator'; + +Override: 'override'; + +Private: 'private'; + +Protected: 'protected'; + +Public: 'public'; + +Register: 'register'; + +Reinterpret_cast: 'reinterpret_cast'; + +Return: 'return'; + +Short: 'short'; + +Signed: 'signed'; + +Sizeof: 'sizeof'; + +Static: 'static'; + +Static_assert: 'static_assert'; + +Static_cast: 'static_cast'; + +Struct: 'struct'; + +Switch: 'switch'; + +Template: 'template'; + +This: 'this'; + +Thread_local: 'thread_local'; + +Throw: 'throw'; + +//DO NOT RENAME - PYTHON NEEDS True and False +True_: 'true'; + +Try: 'try'; + +Typedef: 'typedef'; + +Typeid_: 'typeid'; + +Typename_: 'typename'; + +Union: 'union'; + +Unsigned: 'unsigned'; + +Using: 'using'; + +Virtual: 'virtual'; + +Void: 'void'; + +Volatile: 'volatile'; + +Wchar: 'wchar_t'; + +While: 'while'; +/*Operators*/ + +LeftParen: '('; + +RightParen: ')'; + +LeftBracket: '['; + +RightBracket: ']'; + +LeftBrace: '{'; + +RightBrace: '}'; + +Plus: '+'; + +Minus: '-'; + +Star: '*'; + +Div: '/'; + +Mod: '%'; + +Caret: '^'; + +And: '&'; + +Or: '|'; + +Tilde: '~'; + +Not: '!' | 'not'; + +Assign: '='; + +Less: '<'; + +Greater: '>'; + +PlusAssign: '+='; + +MinusAssign: '-='; + +StarAssign: '*='; + +DivAssign: '/='; + +ModAssign: '%='; + +XorAssign: '^='; + +AndAssign: '&='; + +OrAssign: '|='; + +LeftShiftAssign: '<<='; + +RightShiftAssign: '>>='; + +Equal: '=='; + +NotEqual: '!='; + +LessEqual: '<='; + +GreaterEqual: '>='; + +AndAnd: '&&' | 'and'; + +OrOr: '||' | 'or'; + +PlusPlus: '++'; + +MinusMinus: '--'; + +Comma: ','; + +ArrowStar: '->*'; + +Arrow: '->'; + +Question: '?'; + +Colon: ':'; + +Doublecolon: '::'; + +Semi: ';'; + +Dot: '.'; + +DotStar: '.*'; + +Ellipsis: '...'; + +fragment Hexquad: + HEXADECIMALDIGIT HEXADECIMALDIGIT HEXADECIMALDIGIT HEXADECIMALDIGIT; + +fragment Universalcharactername: + '\\u' Hexquad + | '\\U' Hexquad Hexquad; + +Identifier: + /* + Identifiernondigit | Identifier Identifiernondigit | Identifier DIGIT + */ + Identifiernondigit (Identifiernondigit | DIGIT)*; + +fragment Identifiernondigit: NONDIGIT | Universalcharactername; + +fragment NONDIGIT: [a-zA-Z_]; + +fragment DIGIT: [0-9]; + +DecimalLiteral: NONZERODIGIT ('\''? DIGIT)*; + +OctalLiteral: '0' ('\''? OCTALDIGIT)*; + +HexadecimalLiteral: ('0x' | '0X') HEXADECIMALDIGIT ( + '\''? HEXADECIMALDIGIT + )*; + +BinaryLiteral: ('0b' | '0B') BINARYDIGIT ('\''? BINARYDIGIT)*; + +fragment NONZERODIGIT: [1-9]; + +fragment OCTALDIGIT: [0-7]; + +fragment HEXADECIMALDIGIT: [0-9a-fA-F]; + +fragment BINARYDIGIT: [01]; + +Integersuffix: + Unsignedsuffix Longsuffix? + | Unsignedsuffix Longlongsuffix? + | Longsuffix Unsignedsuffix? + | Longlongsuffix Unsignedsuffix?; + +fragment Unsignedsuffix: [uU]; + +fragment Longsuffix: [lL]; + +fragment Longlongsuffix: 'll' | 'LL'; + +fragment Cchar: + ~ ['\\\r\n] + | Escapesequence + | Universalcharactername; + +fragment Escapesequence: + Simpleescapesequence + | Octalescapesequence + | Hexadecimalescapesequence; + +fragment Simpleescapesequence: + '\\\'' + | '\\"' + | '\\?' + | '\\\\' + | '\\a' + | '\\b' + | '\\f' + | '\\n' + | '\\r' + | ('\\' ('\r' '\n'? | '\n')) + | '\\t' + | '\\v'; + +fragment Octalescapesequence: + '\\' OCTALDIGIT + | '\\' OCTALDIGIT OCTALDIGIT + | '\\' OCTALDIGIT OCTALDIGIT OCTALDIGIT; + +fragment Hexadecimalescapesequence: '\\x' HEXADECIMALDIGIT+; + +fragment Fractionalconstant: + Digitsequence? '.' Digitsequence + | Digitsequence '.'; + +fragment Exponentpart: + 'e' SIGN? Digitsequence + | 'E' SIGN? Digitsequence; + +fragment SIGN: [+-]; + +fragment Digitsequence: DIGIT ('\''? DIGIT)*; + +fragment Floatingsuffix: [flFL]; + +fragment Encodingprefix: 'u8' | 'u' | 'U' | 'L'; + +fragment Schar: + ~ ["\\\r\n] + | Escapesequence + | Universalcharactername; + +fragment Rawstring: 'R"' (( '\\' ["()] )|~[\r\n (])*? '(' ~[)]*? ')' (( '\\' ["()]) | ~[\r\n "])*? '"'; + +UserDefinedIntegerLiteral: + DecimalLiteral Udsuffix + | OctalLiteral Udsuffix + | HexadecimalLiteral Udsuffix + | BinaryLiteral Udsuffix; + +UserDefinedFloatingLiteral: + Fractionalconstant Exponentpart? Udsuffix + | Digitsequence Exponentpart Udsuffix; + +UserDefinedStringLiteral: StringLiteral Udsuffix; + +UserDefinedCharacterLiteral: CharacterLiteral Udsuffix; + +fragment Udsuffix: Identifier; + +Whitespace: [ \t]+ -> skip; + +Newline: ('\r' '\n'? | '\n') -> skip; + +BlockComment: '/*' .*? '*/' -> skip; + +LineComment: '//' ~ [\r\n]* -> skip; diff --git a/server/pkg/antlr/cpp14/CPP14Parser.g4 b/server/pkg/antlr/cpp14/CPP14Parser.g4 new file mode 100644 index 0000000..6c4d848 --- /dev/null +++ b/server/pkg/antlr/cpp14/CPP14Parser.g4 @@ -0,0 +1,823 @@ +/******************************************************************************* + * The MIT License (MIT) + * + * Copyright (c) 2015 Camilo Sanchez (Camiloasc1) 2020 Martin Mirchev (Marti2203) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * **************************************************************************** + */ +parser grammar CPP14Parser; +options { + tokenVocab = CPP14Lexer; +} +/*Basic concepts*/ + +translationUnit: declarationseq? EOF; +/*Expressions*/ + +primaryExpression: + literal+ + | This + | LeftParen expression RightParen + | idExpression + | lambdaExpression; + +idExpression: unqualifiedId | qualifiedId; + +unqualifiedId: + Identifier + | operatorFunctionId + | conversionFunctionId + | literalOperatorId + | Tilde (className | decltypeSpecifier) + | templateId; + +qualifiedId: nestedNameSpecifier Template? unqualifiedId; + +nestedNameSpecifier: + (theTypeName | namespaceName | decltypeSpecifier)? Doublecolon + | nestedNameSpecifier ( + Identifier + | Template? simpleTemplateId + ) Doublecolon; +lambdaExpression: + lambdaIntroducer lambdaDeclarator? compoundStatement; + +lambdaIntroducer: LeftBracket lambdaCapture? RightBracket; + +lambdaCapture: + captureList + | captureDefault (Comma captureList)?; + +captureDefault: And | Assign; + +captureList: capture (Comma capture)* Ellipsis?; + +capture: simpleCapture | initcapture; + +simpleCapture: And? Identifier | This; + +initcapture: And? Identifier initializer; + +lambdaDeclarator: + LeftParen parameterDeclarationClause? RightParen Mutable? exceptionSpecification? + attributeSpecifierSeq? trailingReturnType?; + +postfixExpression: + primaryExpression + | postfixExpression LeftBracket (expression | bracedInitList) RightBracket + | postfixExpression LeftParen expressionList? RightParen + | (simpleTypeSpecifier | typeNameSpecifier) ( + LeftParen expressionList? RightParen + | bracedInitList + ) + | postfixExpression (Dot | Arrow) ( + Template? idExpression + | pseudoDestructorName + ) + | postfixExpression (PlusPlus | MinusMinus) + | ( + Dynamic_cast + | Static_cast + | Reinterpret_cast + | Const_cast + ) Less theTypeId Greater LeftParen expression RightParen + | typeIdOfTheTypeId LeftParen (expression | theTypeId) RightParen; +/* + add a middle layer to eliminate duplicated function declarations + */ + +typeIdOfTheTypeId: Typeid_; + +expressionList: initializerList; + +pseudoDestructorName: + nestedNameSpecifier? (theTypeName Doublecolon)? Tilde theTypeName + | nestedNameSpecifier Template simpleTemplateId Doublecolon Tilde theTypeName + | Tilde decltypeSpecifier; + +unaryExpression: + postfixExpression + | (PlusPlus | MinusMinus | unaryOperator | Sizeof) unaryExpression + | Sizeof ( + LeftParen theTypeId RightParen + | Ellipsis LeftParen Identifier RightParen + ) + | Alignof LeftParen theTypeId RightParen + | noExceptExpression + | newExpression + | deleteExpression; + +unaryOperator: Or | Star | And | Plus | Tilde | Minus | Not; + +newExpression: + Doublecolon? New newPlacement? ( + newTypeId + | (LeftParen theTypeId RightParen) + ) newInitializer?; + +newPlacement: LeftParen expressionList RightParen; + +newTypeId: typeSpecifierSeq newDeclarator?; + +newDeclarator: + pointerOperator newDeclarator? + | noPointerNewDeclarator; + +noPointerNewDeclarator: + LeftBracket expression RightBracket attributeSpecifierSeq? + | noPointerNewDeclarator LeftBracket constantExpression RightBracket attributeSpecifierSeq?; + +newInitializer: + LeftParen expressionList? RightParen + | bracedInitList; + +deleteExpression: + Doublecolon? Delete (LeftBracket RightBracket)? castExpression; + +noExceptExpression: Noexcept LeftParen expression RightParen; + +castExpression: + unaryExpression + | LeftParen theTypeId RightParen castExpression; + +pointerMemberExpression: + castExpression ((DotStar | ArrowStar) castExpression)*; + +multiplicativeExpression: + pointerMemberExpression ( + (Star | Div | Mod) pointerMemberExpression + )*; + +additiveExpression: + multiplicativeExpression ( + (Plus | Minus) multiplicativeExpression + )*; + +shiftExpression: + additiveExpression (shiftOperator additiveExpression)*; + +shiftOperator: Greater Greater | Less Less; + +relationalExpression: + shiftExpression ( + (Less | Greater | LessEqual | GreaterEqual) shiftExpression + )*; + +equalityExpression: + relationalExpression ( + (Equal | NotEqual) relationalExpression + )*; + +andExpression: equalityExpression (And equalityExpression)*; + +exclusiveOrExpression: andExpression (Caret andExpression)*; + +inclusiveOrExpression: + exclusiveOrExpression (Or exclusiveOrExpression)*; + +logicalAndExpression: + inclusiveOrExpression (AndAnd inclusiveOrExpression)*; + +logicalOrExpression: + logicalAndExpression (OrOr logicalAndExpression)*; + +conditionalExpression: + logicalOrExpression ( + Question expression Colon assignmentExpression + )?; + +assignmentExpression: + conditionalExpression + | logicalOrExpression assignmentOperator initializerClause + | throwExpression; + +assignmentOperator: + Assign + | StarAssign + | DivAssign + | ModAssign + | PlusAssign + | MinusAssign + | RightShiftAssign + | LeftShiftAssign + | AndAssign + | XorAssign + | OrAssign; + +expression: assignmentExpression (Comma assignmentExpression)*; + +constantExpression: conditionalExpression; +/*Statements*/ + +statement: + labeledStatement + | declarationStatement + | attributeSpecifierSeq? ( + expressionStatement + | compoundStatement + | selectionStatement + | iterationStatement + | jumpStatement + | tryBlock + ); + +labeledStatement: + attributeSpecifierSeq? ( + Identifier + | Case constantExpression + | Default + ) Colon statement; + +expressionStatement: expression? Semi; + +compoundStatement: LeftBrace statementSeq? RightBrace; + +statementSeq: statement+; + +selectionStatement: + If LeftParen condition RightParen statement (Else statement)? + | Switch LeftParen condition RightParen statement; + +condition: + expression + | attributeSpecifierSeq? declSpecifierSeq declarator ( + Assign initializerClause + | bracedInitList + ); + +iterationStatement: + While LeftParen condition RightParen statement + | Do statement While LeftParen expression RightParen Semi + | For LeftParen ( + forInitStatement condition? Semi expression? + | forRangeDeclaration Colon forRangeInitializer + ) RightParen statement; + +forInitStatement: expressionStatement | simpleDeclaration; + +forRangeDeclaration: + attributeSpecifierSeq? declSpecifierSeq declarator; + +forRangeInitializer: expression | bracedInitList; + +jumpStatement: + ( + Break + | Continue + | Return (expression | bracedInitList)? + | Goto Identifier + ) Semi; + +declarationStatement: blockDeclaration; +/*Declarations*/ + +declarationseq: declaration+; + +declaration: + blockDeclaration + | functionDefinition + | templateDeclaration + | explicitInstantiation + | explicitSpecialization + | linkageSpecification + | namespaceDefinition + | emptyDeclaration + | attributeDeclaration; + +blockDeclaration: + simpleDeclaration + | asmDefinition + | namespaceAliasDefinition + | usingDeclaration + | usingDirective + | staticAssertDeclaration + | aliasDeclaration + | opaqueEnumDeclaration; + +aliasDeclaration: + Using Identifier attributeSpecifierSeq? Assign theTypeId Semi; + +simpleDeclaration: + declSpecifierSeq? initDeclaratorList? Semi + | attributeSpecifierSeq declSpecifierSeq? initDeclaratorList Semi; + +staticAssertDeclaration: + Static_assert LeftParen constantExpression Comma StringLiteral RightParen Semi; + +emptyDeclaration: Semi; + +attributeDeclaration: attributeSpecifierSeq Semi; + +declSpecifier: + storageClassSpecifier + | typeSpecifier + | functionSpecifier + | Friend + | Typedef + | Constexpr; + +declSpecifierSeq: declSpecifier+? attributeSpecifierSeq?; + +storageClassSpecifier: + Register + | Static + | Thread_local + | Extern + | Mutable; + +functionSpecifier: Inline | Virtual | Explicit; + +typedefName: Identifier; + +typeSpecifier: + trailingTypeSpecifier + | classSpecifier + | enumSpecifier; + +trailingTypeSpecifier: + simpleTypeSpecifier + | elaboratedTypeSpecifier + | typeNameSpecifier + | cvQualifier; + +typeSpecifierSeq: typeSpecifier+ attributeSpecifierSeq?; + +trailingTypeSpecifierSeq: + trailingTypeSpecifier+ attributeSpecifierSeq?; + +simpleTypeLengthModifier: + Short + | Long; + +simpleTypeSignednessModifier: + Unsigned + | Signed; + +simpleTypeSpecifier: + nestedNameSpecifier? theTypeName + | nestedNameSpecifier Template simpleTemplateId + | simpleTypeSignednessModifier + | simpleTypeSignednessModifier? simpleTypeLengthModifier+ + | simpleTypeSignednessModifier? Char + | simpleTypeSignednessModifier? Char16 + | simpleTypeSignednessModifier? Char32 + | simpleTypeSignednessModifier? Wchar + | Bool + | simpleTypeSignednessModifier? simpleTypeLengthModifier* Int + | Float + | simpleTypeLengthModifier? Double + | Void + | Auto + | decltypeSpecifier; + +theTypeName: + className + | enumName + | typedefName + | simpleTemplateId; + +decltypeSpecifier: + Decltype LeftParen (expression | Auto) RightParen; + +elaboratedTypeSpecifier: + classKey ( + attributeSpecifierSeq? nestedNameSpecifier? Identifier + | simpleTemplateId + | nestedNameSpecifier Template? simpleTemplateId + ) + | Enum nestedNameSpecifier? Identifier; + +enumName: Identifier; + +enumSpecifier: + enumHead LeftBrace (enumeratorList Comma?)? RightBrace; + +enumHead: + enumkey attributeSpecifierSeq? ( + nestedNameSpecifier? Identifier + )? enumbase?; + +opaqueEnumDeclaration: + enumkey attributeSpecifierSeq? Identifier enumbase? Semi; + +enumkey: Enum (Class | Struct)?; + +enumbase: Colon typeSpecifierSeq; + +enumeratorList: + enumeratorDefinition (Comma enumeratorDefinition)*; + +enumeratorDefinition: enumerator (Assign constantExpression)?; + +enumerator: Identifier; + +namespaceName: originalNamespaceName | namespaceAlias; + +originalNamespaceName: Identifier; + +namespaceDefinition: + Inline? Namespace (Identifier | originalNamespaceName)? LeftBrace namespaceBody = declarationseq + ? RightBrace; + +namespaceAlias: Identifier; + +namespaceAliasDefinition: + Namespace Identifier Assign qualifiednamespacespecifier Semi; + +qualifiednamespacespecifier: nestedNameSpecifier? namespaceName; + +usingDeclaration: + Using ((Typename_? nestedNameSpecifier) | Doublecolon) unqualifiedId Semi; + +usingDirective: + attributeSpecifierSeq? Using Namespace nestedNameSpecifier? namespaceName Semi; + +asmDefinition: Asm LeftParen StringLiteral RightParen Semi; + +linkageSpecification: + Extern StringLiteral ( + LeftBrace declarationseq? RightBrace + | declaration + ); + +attributeSpecifierSeq: attributeSpecifier+; + +attributeSpecifier: + LeftBracket LeftBracket attributeList? RightBracket RightBracket + | alignmentspecifier; + +alignmentspecifier: + Alignas LeftParen (theTypeId | constantExpression) Ellipsis? RightParen; + +attributeList: attribute (Comma attribute)* Ellipsis?; + +attribute: (attributeNamespace Doublecolon)? Identifier attributeArgumentClause?; + +attributeNamespace: Identifier; + +attributeArgumentClause: LeftParen balancedTokenSeq? RightParen; + +balancedTokenSeq: balancedtoken+; + +balancedtoken: + LeftParen balancedTokenSeq RightParen + | LeftBracket balancedTokenSeq RightBracket + | LeftBrace balancedTokenSeq RightBrace + | ~( + LeftParen + | RightParen + | LeftBrace + | RightBrace + | LeftBracket + | RightBracket + )+; +/*Declarators*/ + +initDeclaratorList: initDeclarator (Comma initDeclarator)*; + +initDeclarator: declarator initializer?; + +declarator: + pointerDeclarator + | noPointerDeclarator parametersAndQualifiers trailingReturnType; + +pointerDeclarator: (pointerOperator Const?)* noPointerDeclarator; + +noPointerDeclarator: + declaratorid attributeSpecifierSeq? + | noPointerDeclarator ( + parametersAndQualifiers + | LeftBracket constantExpression? RightBracket attributeSpecifierSeq? + ) + | LeftParen pointerDeclarator RightParen; + +parametersAndQualifiers: + LeftParen parameterDeclarationClause? RightParen cvqualifierseq? refqualifier? + exceptionSpecification? attributeSpecifierSeq?; + +trailingReturnType: + Arrow trailingTypeSpecifierSeq abstractDeclarator?; + +pointerOperator: + (And | AndAnd) attributeSpecifierSeq? + | nestedNameSpecifier? Star attributeSpecifierSeq? cvqualifierseq?; + +cvqualifierseq: cvQualifier+; + +cvQualifier: Const | Volatile; + +refqualifier: And | AndAnd; + +declaratorid: Ellipsis? idExpression; + +theTypeId: typeSpecifierSeq abstractDeclarator?; + +abstractDeclarator: + pointerAbstractDeclarator + | noPointerAbstractDeclarator? parametersAndQualifiers trailingReturnType + | abstractPackDeclarator; + +pointerAbstractDeclarator: + noPointerAbstractDeclarator + | pointerOperator+ noPointerAbstractDeclarator?; + +noPointerAbstractDeclarator: + noPointerAbstractDeclarator ( + parametersAndQualifiers + | noPointerAbstractDeclarator LeftBracket constantExpression? RightBracket + attributeSpecifierSeq? + ) + | parametersAndQualifiers + | LeftBracket constantExpression? RightBracket attributeSpecifierSeq? + | LeftParen pointerAbstractDeclarator RightParen; + +abstractPackDeclarator: + pointerOperator* noPointerAbstractPackDeclarator; + +noPointerAbstractPackDeclarator: + noPointerAbstractPackDeclarator ( + parametersAndQualifiers + | LeftBracket constantExpression? RightBracket attributeSpecifierSeq? + ) + | Ellipsis; + +parameterDeclarationClause: + parameterDeclarationList (Comma? Ellipsis)?; + +parameterDeclarationList: + parameterDeclaration (Comma parameterDeclaration)*; + +parameterDeclaration: + attributeSpecifierSeq? declSpecifierSeq ( + (declarator | abstractDeclarator?) ( + Assign initializerClause + )? + ); + +functionDefinition: + attributeSpecifierSeq? declSpecifierSeq? declarator virtualSpecifierSeq? functionBody; + +functionBody: + constructorInitializer? compoundStatement + | functionTryBlock + | Assign (Default | Delete) Semi; + +initializer: + braceOrEqualInitializer + | LeftParen expressionList RightParen; + +braceOrEqualInitializer: + Assign initializerClause + | bracedInitList; + +initializerClause: assignmentExpression | bracedInitList; + +initializerList: + initializerClause Ellipsis? ( + Comma initializerClause Ellipsis? + )*; + +bracedInitList: LeftBrace (initializerList Comma?)? RightBrace; +/*Classes*/ + +className: Identifier | simpleTemplateId; + +classSpecifier: + classHead LeftBrace memberSpecification? RightBrace; + +classHead: + classKey attributeSpecifierSeq? ( + classHeadName classVirtSpecifier? + )? baseClause? + | Union attributeSpecifierSeq? ( + classHeadName classVirtSpecifier? + )?; + +classHeadName: nestedNameSpecifier? className; + +classVirtSpecifier: Final; + +classKey: Class | Struct; + +memberSpecification: + (memberdeclaration | accessSpecifier Colon)+; + +memberdeclaration: + attributeSpecifierSeq? declSpecifierSeq? memberDeclaratorList? Semi + | functionDefinition + | usingDeclaration + | staticAssertDeclaration + | templateDeclaration + | aliasDeclaration + | emptyDeclaration; + +memberDeclaratorList: + memberDeclarator (Comma memberDeclarator)*; + +memberDeclarator: + declarator ( + virtualSpecifierSeq? pureSpecifier? + | braceOrEqualInitializer? + ) + | Identifier? attributeSpecifierSeq? Colon constantExpression; + +virtualSpecifierSeq: virtualSpecifier+; + +virtualSpecifier: Override | Final; +/* + purespecifier: Assign '0'//Conflicts with the lexer ; + */ + +pureSpecifier: + Assign val = OctalLiteral {if($val.text.compareTo("0")!=0) throw new InputMismatchException(this); + }; +/*Derived classes*/ + +baseClause: Colon baseSpecifierList; + +baseSpecifierList: + baseSpecifier Ellipsis? (Comma baseSpecifier Ellipsis?)*; + +baseSpecifier: + attributeSpecifierSeq? ( + baseTypeSpecifier + | Virtual accessSpecifier? baseTypeSpecifier + | accessSpecifier Virtual? baseTypeSpecifier + ); + +classOrDeclType: + nestedNameSpecifier? className + | decltypeSpecifier; + +baseTypeSpecifier: classOrDeclType; + +accessSpecifier: Private | Protected | Public; +/*Special member functions*/ + +conversionFunctionId: Operator conversionTypeId; + +conversionTypeId: typeSpecifierSeq conversionDeclarator?; + +conversionDeclarator: pointerOperator conversionDeclarator?; + +constructorInitializer: Colon memInitializerList; + +memInitializerList: + memInitializer Ellipsis? (Comma memInitializer Ellipsis?)*; + +memInitializer: + meminitializerid ( + LeftParen expressionList? RightParen + | bracedInitList + ); + +meminitializerid: classOrDeclType | Identifier; +/*Overloading*/ + +operatorFunctionId: Operator theOperator; + +literalOperatorId: + Operator ( + StringLiteral Identifier + | UserDefinedStringLiteral + ); +/*Templates*/ + +templateDeclaration: + Template Less templateparameterList Greater declaration; + +templateparameterList: + templateParameter (Comma templateParameter)*; + +templateParameter: typeParameter | parameterDeclaration; + +typeParameter: + ( + (Template Less templateparameterList Greater)? Class + | Typename_ + ) ((Ellipsis? Identifier?) | (Identifier? Assign theTypeId)); + +simpleTemplateId: + templateName Less templateArgumentList? Greater; + +templateId: + simpleTemplateId + | (operatorFunctionId | literalOperatorId) Less templateArgumentList? Greater; + +templateName: Identifier; + +templateArgumentList: + templateArgument Ellipsis? (Comma templateArgument Ellipsis?)*; + +templateArgument: theTypeId | constantExpression | idExpression; + +typeNameSpecifier: + Typename_ nestedNameSpecifier ( + Identifier + | Template? simpleTemplateId + ); + +explicitInstantiation: Extern? Template declaration; + +explicitSpecialization: Template Less Greater declaration; +/*Exception handling*/ + +tryBlock: Try compoundStatement handlerSeq; + +functionTryBlock: + Try constructorInitializer? compoundStatement handlerSeq; + +handlerSeq: handler+; + +handler: + Catch LeftParen exceptionDeclaration RightParen compoundStatement; + +exceptionDeclaration: + attributeSpecifierSeq? typeSpecifierSeq ( + declarator + | abstractDeclarator + )? + | Ellipsis; + +throwExpression: Throw assignmentExpression?; + +exceptionSpecification: + dynamicExceptionSpecification + | noeExceptSpecification; + +dynamicExceptionSpecification: + Throw LeftParen typeIdList? RightParen; + +typeIdList: theTypeId Ellipsis? (Comma theTypeId Ellipsis?)*; + +noeExceptSpecification: + Noexcept LeftParen constantExpression RightParen + | Noexcept; +/*Preprocessing directives*/ + +/*Lexer*/ + +theOperator: + New (LeftBracket RightBracket)? + | Delete (LeftBracket RightBracket)? + | Plus + | Minus + | Star + | Div + | Mod + | Caret + | And + | Or + | Tilde + | Not + | Assign + | Greater + | Less + | GreaterEqual + | PlusAssign + | MinusAssign + | StarAssign + | ModAssign + | XorAssign + | AndAssign + | OrAssign + | Less Less + | Greater Greater + | RightShiftAssign + | LeftShiftAssign + | Equal + | NotEqual + | LessEqual + | AndAnd + | OrOr + | PlusPlus + | MinusMinus + | Comma + | ArrowStar + | Arrow + | LeftParen RightParen + | LeftBracket RightBracket; + +literal: + IntegerLiteral + | CharacterLiteral + | FloatingLiteral + | StringLiteral + | BooleanLiteral + | PointerLiteral + | UserDefinedLiteral; + diff --git a/server/pkg/antlr/cpp14/include/CPP14Lexer.h b/server/pkg/antlr/cpp14/include/CPP14Lexer.h new file mode 100644 index 0000000..d8f3103 --- /dev/null +++ b/server/pkg/antlr/cpp14/include/CPP14Lexer.h @@ -0,0 +1,79 @@ + +// Generated from CPP14Lexer.g4 by ANTLR 4.12.0 + +#pragma once + + +#include "antlr4-runtime.h" + + +namespace antlrcpptest { + + +class CPP14Lexer : public antlr4::Lexer { +public: + enum { + IntegerLiteral = 1, CharacterLiteral = 2, FloatingLiteral = 3, StringLiteral = 4, + BooleanLiteral = 5, PointerLiteral = 6, UserDefinedLiteral = 7, MultiLineMacro = 8, + Directive = 9, Alignas = 10, Alignof = 11, Asm = 12, Auto = 13, Bool = 14, + Break = 15, Case = 16, Catch = 17, Char = 18, Char16 = 19, Char32 = 20, + Class = 21, Const = 22, Constexpr = 23, Const_cast = 24, Continue = 25, + Decltype = 26, Default = 27, Delete = 28, Do = 29, Double = 30, Dynamic_cast = 31, + Else = 32, Enum = 33, Explicit = 34, Export = 35, Extern = 36, False_ = 37, + Final = 38, Float = 39, For = 40, Friend = 41, Goto = 42, If = 43, Inline = 44, + Int = 45, Long = 46, Mutable = 47, Namespace = 48, New = 49, Noexcept = 50, + Nullptr = 51, Operator = 52, Override = 53, Private = 54, Protected = 55, + Public = 56, Register = 57, Reinterpret_cast = 58, Return = 59, Short = 60, + Signed = 61, Sizeof = 62, Static = 63, Static_assert = 64, Static_cast = 65, + Struct = 66, Switch = 67, Template = 68, This = 69, Thread_local = 70, + Throw = 71, True_ = 72, Try = 73, Typedef = 74, Typeid_ = 75, Typename_ = 76, + Union = 77, Unsigned = 78, Using = 79, Virtual = 80, Void = 81, Volatile = 82, + Wchar = 83, While = 84, LeftParen = 85, RightParen = 86, LeftBracket = 87, + RightBracket = 88, LeftBrace = 89, RightBrace = 90, Plus = 91, Minus = 92, + Star = 93, Div = 94, Mod = 95, Caret = 96, And = 97, Or = 98, Tilde = 99, + Not = 100, Assign = 101, Less = 102, Greater = 103, PlusAssign = 104, + MinusAssign = 105, StarAssign = 106, DivAssign = 107, ModAssign = 108, + XorAssign = 109, AndAssign = 110, OrAssign = 111, LeftShiftAssign = 112, + RightShiftAssign = 113, Equal = 114, NotEqual = 115, LessEqual = 116, + GreaterEqual = 117, AndAnd = 118, OrOr = 119, PlusPlus = 120, MinusMinus = 121, + Comma = 122, ArrowStar = 123, Arrow = 124, Question = 125, Colon = 126, + Doublecolon = 127, Semi = 128, Dot = 129, DotStar = 130, Ellipsis = 131, + Identifier = 132, DecimalLiteral = 133, OctalLiteral = 134, HexadecimalLiteral = 135, + BinaryLiteral = 136, Integersuffix = 137, UserDefinedIntegerLiteral = 138, + UserDefinedFloatingLiteral = 139, UserDefinedStringLiteral = 140, UserDefinedCharacterLiteral = 141, + Whitespace = 142, Newline = 143, BlockComment = 144, LineComment = 145 + }; + + explicit CPP14Lexer(antlr4::CharStream *input); + + ~CPP14Lexer() override; + + + std::string getGrammarFileName() const override; + + const std::vector& getRuleNames() const override; + + const std::vector& getChannelNames() const override; + + const std::vector& getModeNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + const antlr4::atn::ATN& getATN() const override; + + // By default the static state used to implement the lexer is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: + + // Individual action functions triggered by action() above. + + // Individual semantic predicate functions triggered by sempred() above. + +}; + +} // namespace antlrcpptest diff --git a/server/pkg/antlr/cpp14/include/CPP14Parser.h b/server/pkg/antlr/cpp14/include/CPP14Parser.h new file mode 100644 index 0000000..6b00d6b --- /dev/null +++ b/server/pkg/antlr/cpp14/include/CPP14Parser.h @@ -0,0 +1,3149 @@ + +// Generated from CPP14Parser.g4 by ANTLR 4.12.0 + +#pragma once + + +#include "antlr4-runtime.h" + + +namespace antlrcpptest { + + +class CPP14Parser : public antlr4::Parser { +public: + enum { + IntegerLiteral = 1, CharacterLiteral = 2, FloatingLiteral = 3, StringLiteral = 4, + BooleanLiteral = 5, PointerLiteral = 6, UserDefinedLiteral = 7, MultiLineMacro = 8, + Directive = 9, Alignas = 10, Alignof = 11, Asm = 12, Auto = 13, Bool = 14, + Break = 15, Case = 16, Catch = 17, Char = 18, Char16 = 19, Char32 = 20, + Class = 21, Const = 22, Constexpr = 23, Const_cast = 24, Continue = 25, + Decltype = 26, Default = 27, Delete = 28, Do = 29, Double = 30, Dynamic_cast = 31, + Else = 32, Enum = 33, Explicit = 34, Export = 35, Extern = 36, False_ = 37, + Final = 38, Float = 39, For = 40, Friend = 41, Goto = 42, If = 43, Inline = 44, + Int = 45, Long = 46, Mutable = 47, Namespace = 48, New = 49, Noexcept = 50, + Nullptr = 51, Operator = 52, Override = 53, Private = 54, Protected = 55, + Public = 56, Register = 57, Reinterpret_cast = 58, Return = 59, Short = 60, + Signed = 61, Sizeof = 62, Static = 63, Static_assert = 64, Static_cast = 65, + Struct = 66, Switch = 67, Template = 68, This = 69, Thread_local = 70, + Throw = 71, True_ = 72, Try = 73, Typedef = 74, Typeid_ = 75, Typename_ = 76, + Union = 77, Unsigned = 78, Using = 79, Virtual = 80, Void = 81, Volatile = 82, + Wchar = 83, While = 84, LeftParen = 85, RightParen = 86, LeftBracket = 87, + RightBracket = 88, LeftBrace = 89, RightBrace = 90, Plus = 91, Minus = 92, + Star = 93, Div = 94, Mod = 95, Caret = 96, And = 97, Or = 98, Tilde = 99, + Not = 100, Assign = 101, Less = 102, Greater = 103, PlusAssign = 104, + MinusAssign = 105, StarAssign = 106, DivAssign = 107, ModAssign = 108, + XorAssign = 109, AndAssign = 110, OrAssign = 111, LeftShiftAssign = 112, + RightShiftAssign = 113, Equal = 114, NotEqual = 115, LessEqual = 116, + GreaterEqual = 117, AndAnd = 118, OrOr = 119, PlusPlus = 120, MinusMinus = 121, + Comma = 122, ArrowStar = 123, Arrow = 124, Question = 125, Colon = 126, + Doublecolon = 127, Semi = 128, Dot = 129, DotStar = 130, Ellipsis = 131, + Identifier = 132, DecimalLiteral = 133, OctalLiteral = 134, HexadecimalLiteral = 135, + BinaryLiteral = 136, Integersuffix = 137, UserDefinedIntegerLiteral = 138, + UserDefinedFloatingLiteral = 139, UserDefinedStringLiteral = 140, UserDefinedCharacterLiteral = 141, + Whitespace = 142, Newline = 143, BlockComment = 144, LineComment = 145 + }; + + enum { + RuleTranslationUnit = 0, RulePrimaryExpression = 1, RuleIdExpression = 2, + RuleUnqualifiedId = 3, RuleQualifiedId = 4, RuleNestedNameSpecifier = 5, + RuleLambdaExpression = 6, RuleLambdaIntroducer = 7, RuleLambdaCapture = 8, + RuleCaptureDefault = 9, RuleCaptureList = 10, RuleCapture = 11, RuleSimpleCapture = 12, + RuleInitcapture = 13, RuleLambdaDeclarator = 14, RulePostfixExpression = 15, + RuleTypeIdOfTheTypeId = 16, RuleExpressionList = 17, RulePseudoDestructorName = 18, + RuleUnaryExpression = 19, RuleUnaryOperator = 20, RuleNewExpression = 21, + RuleNewPlacement = 22, RuleNewTypeId = 23, RuleNewDeclarator = 24, RuleNoPointerNewDeclarator = 25, + RuleNewInitializer = 26, RuleDeleteExpression = 27, RuleNoExceptExpression = 28, + RuleCastExpression = 29, RulePointerMemberExpression = 30, RuleMultiplicativeExpression = 31, + RuleAdditiveExpression = 32, RuleShiftExpression = 33, RuleShiftOperator = 34, + RuleRelationalExpression = 35, RuleEqualityExpression = 36, RuleAndExpression = 37, + RuleExclusiveOrExpression = 38, RuleInclusiveOrExpression = 39, RuleLogicalAndExpression = 40, + RuleLogicalOrExpression = 41, RuleConditionalExpression = 42, RuleAssignmentExpression = 43, + RuleAssignmentOperator = 44, RuleExpression = 45, RuleConstantExpression = 46, + RuleStatement = 47, RuleLabeledStatement = 48, RuleExpressionStatement = 49, + RuleCompoundStatement = 50, RuleStatementSeq = 51, RuleSelectionStatement = 52, + RuleCondition = 53, RuleIterationStatement = 54, RuleForInitStatement = 55, + RuleForRangeDeclaration = 56, RuleForRangeInitializer = 57, RuleJumpStatement = 58, + RuleDeclarationStatement = 59, RuleDeclarationseq = 60, RuleDeclaration = 61, + RuleBlockDeclaration = 62, RuleAliasDeclaration = 63, RuleSimpleDeclaration = 64, + RuleStaticAssertDeclaration = 65, RuleEmptyDeclaration = 66, RuleAttributeDeclaration = 67, + RuleDeclSpecifier = 68, RuleDeclSpecifierSeq = 69, RuleStorageClassSpecifier = 70, + RuleFunctionSpecifier = 71, RuleTypedefName = 72, RuleTypeSpecifier = 73, + RuleTrailingTypeSpecifier = 74, RuleTypeSpecifierSeq = 75, RuleTrailingTypeSpecifierSeq = 76, + RuleSimpleTypeLengthModifier = 77, RuleSimpleTypeSignednessModifier = 78, + RuleSimpleTypeSpecifier = 79, RuleTheTypeName = 80, RuleDecltypeSpecifier = 81, + RuleElaboratedTypeSpecifier = 82, RuleEnumName = 83, RuleEnumSpecifier = 84, + RuleEnumHead = 85, RuleOpaqueEnumDeclaration = 86, RuleEnumkey = 87, + RuleEnumbase = 88, RuleEnumeratorList = 89, RuleEnumeratorDefinition = 90, + RuleEnumerator = 91, RuleNamespaceName = 92, RuleOriginalNamespaceName = 93, + RuleNamespaceDefinition = 94, RuleNamespaceAlias = 95, RuleNamespaceAliasDefinition = 96, + RuleQualifiednamespacespecifier = 97, RuleUsingDeclaration = 98, RuleUsingDirective = 99, + RuleAsmDefinition = 100, RuleLinkageSpecification = 101, RuleAttributeSpecifierSeq = 102, + RuleAttributeSpecifier = 103, RuleAlignmentspecifier = 104, RuleAttributeList = 105, + RuleAttribute = 106, RuleAttributeNamespace = 107, RuleAttributeArgumentClause = 108, + RuleBalancedTokenSeq = 109, RuleBalancedtoken = 110, RuleInitDeclaratorList = 111, + RuleInitDeclarator = 112, RuleDeclarator = 113, RulePointerDeclarator = 114, + RuleNoPointerDeclarator = 115, RuleParametersAndQualifiers = 116, RuleTrailingReturnType = 117, + RulePointerOperator = 118, RuleCvqualifierseq = 119, RuleCvQualifier = 120, + RuleRefqualifier = 121, RuleDeclaratorid = 122, RuleTheTypeId = 123, + RuleAbstractDeclarator = 124, RulePointerAbstractDeclarator = 125, RuleNoPointerAbstractDeclarator = 126, + RuleAbstractPackDeclarator = 127, RuleNoPointerAbstractPackDeclarator = 128, + RuleParameterDeclarationClause = 129, RuleParameterDeclarationList = 130, + RuleParameterDeclaration = 131, RuleFunctionDefinition = 132, RuleFunctionBody = 133, + RuleInitializer = 134, RuleBraceOrEqualInitializer = 135, RuleInitializerClause = 136, + RuleInitializerList = 137, RuleBracedInitList = 138, RuleClassName = 139, + RuleClassSpecifier = 140, RuleClassHead = 141, RuleClassHeadName = 142, + RuleClassVirtSpecifier = 143, RuleClassKey = 144, RuleMemberSpecification = 145, + RuleMemberdeclaration = 146, RuleMemberDeclaratorList = 147, RuleMemberDeclarator = 148, + RuleVirtualSpecifierSeq = 149, RuleVirtualSpecifier = 150, RulePureSpecifier = 151, + RuleBaseClause = 152, RuleBaseSpecifierList = 153, RuleBaseSpecifier = 154, + RuleClassOrDeclType = 155, RuleBaseTypeSpecifier = 156, RuleAccessSpecifier = 157, + RuleConversionFunctionId = 158, RuleConversionTypeId = 159, RuleConversionDeclarator = 160, + RuleConstructorInitializer = 161, RuleMemInitializerList = 162, RuleMemInitializer = 163, + RuleMeminitializerid = 164, RuleOperatorFunctionId = 165, RuleLiteralOperatorId = 166, + RuleTemplateDeclaration = 167, RuleTemplateparameterList = 168, RuleTemplateParameter = 169, + RuleTypeParameter = 170, RuleSimpleTemplateId = 171, RuleTemplateId = 172, + RuleTemplateName = 173, RuleTemplateArgumentList = 174, RuleTemplateArgument = 175, + RuleTypeNameSpecifier = 176, RuleExplicitInstantiation = 177, RuleExplicitSpecialization = 178, + RuleTryBlock = 179, RuleFunctionTryBlock = 180, RuleHandlerSeq = 181, + RuleHandler = 182, RuleExceptionDeclaration = 183, RuleThrowExpression = 184, + RuleExceptionSpecification = 185, RuleDynamicExceptionSpecification = 186, + RuleTypeIdList = 187, RuleNoeExceptSpecification = 188, RuleTheOperator = 189, + RuleLiteral = 190 + }; + + explicit CPP14Parser(antlr4::TokenStream *input); + + CPP14Parser(antlr4::TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options); + + ~CPP14Parser() override; + + std::string getGrammarFileName() const override; + + const antlr4::atn::ATN& getATN() const override; + + const std::vector& getRuleNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + + class TranslationUnitContext; + class PrimaryExpressionContext; + class IdExpressionContext; + class UnqualifiedIdContext; + class QualifiedIdContext; + class NestedNameSpecifierContext; + class LambdaExpressionContext; + class LambdaIntroducerContext; + class LambdaCaptureContext; + class CaptureDefaultContext; + class CaptureListContext; + class CaptureContext; + class SimpleCaptureContext; + class InitcaptureContext; + class LambdaDeclaratorContext; + class PostfixExpressionContext; + class TypeIdOfTheTypeIdContext; + class ExpressionListContext; + class PseudoDestructorNameContext; + class UnaryExpressionContext; + class UnaryOperatorContext; + class NewExpressionContext; + class NewPlacementContext; + class NewTypeIdContext; + class NewDeclaratorContext; + class NoPointerNewDeclaratorContext; + class NewInitializerContext; + class DeleteExpressionContext; + class NoExceptExpressionContext; + class CastExpressionContext; + class PointerMemberExpressionContext; + class MultiplicativeExpressionContext; + class AdditiveExpressionContext; + class ShiftExpressionContext; + class ShiftOperatorContext; + class RelationalExpressionContext; + class EqualityExpressionContext; + class AndExpressionContext; + class ExclusiveOrExpressionContext; + class InclusiveOrExpressionContext; + class LogicalAndExpressionContext; + class LogicalOrExpressionContext; + class ConditionalExpressionContext; + class AssignmentExpressionContext; + class AssignmentOperatorContext; + class ExpressionContext; + class ConstantExpressionContext; + class StatementContext; + class LabeledStatementContext; + class ExpressionStatementContext; + class CompoundStatementContext; + class StatementSeqContext; + class SelectionStatementContext; + class ConditionContext; + class IterationStatementContext; + class ForInitStatementContext; + class ForRangeDeclarationContext; + class ForRangeInitializerContext; + class JumpStatementContext; + class DeclarationStatementContext; + class DeclarationseqContext; + class DeclarationContext; + class BlockDeclarationContext; + class AliasDeclarationContext; + class SimpleDeclarationContext; + class StaticAssertDeclarationContext; + class EmptyDeclarationContext; + class AttributeDeclarationContext; + class DeclSpecifierContext; + class DeclSpecifierSeqContext; + class StorageClassSpecifierContext; + class FunctionSpecifierContext; + class TypedefNameContext; + class TypeSpecifierContext; + class TrailingTypeSpecifierContext; + class TypeSpecifierSeqContext; + class TrailingTypeSpecifierSeqContext; + class SimpleTypeLengthModifierContext; + class SimpleTypeSignednessModifierContext; + class SimpleTypeSpecifierContext; + class TheTypeNameContext; + class DecltypeSpecifierContext; + class ElaboratedTypeSpecifierContext; + class EnumNameContext; + class EnumSpecifierContext; + class EnumHeadContext; + class OpaqueEnumDeclarationContext; + class EnumkeyContext; + class EnumbaseContext; + class EnumeratorListContext; + class EnumeratorDefinitionContext; + class EnumeratorContext; + class NamespaceNameContext; + class OriginalNamespaceNameContext; + class NamespaceDefinitionContext; + class NamespaceAliasContext; + class NamespaceAliasDefinitionContext; + class QualifiednamespacespecifierContext; + class UsingDeclarationContext; + class UsingDirectiveContext; + class AsmDefinitionContext; + class LinkageSpecificationContext; + class AttributeSpecifierSeqContext; + class AttributeSpecifierContext; + class AlignmentspecifierContext; + class AttributeListContext; + class AttributeContext; + class AttributeNamespaceContext; + class AttributeArgumentClauseContext; + class BalancedTokenSeqContext; + class BalancedtokenContext; + class InitDeclaratorListContext; + class InitDeclaratorContext; + class DeclaratorContext; + class PointerDeclaratorContext; + class NoPointerDeclaratorContext; + class ParametersAndQualifiersContext; + class TrailingReturnTypeContext; + class PointerOperatorContext; + class CvqualifierseqContext; + class CvQualifierContext; + class RefqualifierContext; + class DeclaratoridContext; + class TheTypeIdContext; + class AbstractDeclaratorContext; + class PointerAbstractDeclaratorContext; + class NoPointerAbstractDeclaratorContext; + class AbstractPackDeclaratorContext; + class NoPointerAbstractPackDeclaratorContext; + class ParameterDeclarationClauseContext; + class ParameterDeclarationListContext; + class ParameterDeclarationContext; + class FunctionDefinitionContext; + class FunctionBodyContext; + class InitializerContext; + class BraceOrEqualInitializerContext; + class InitializerClauseContext; + class InitializerListContext; + class BracedInitListContext; + class ClassNameContext; + class ClassSpecifierContext; + class ClassHeadContext; + class ClassHeadNameContext; + class ClassVirtSpecifierContext; + class ClassKeyContext; + class MemberSpecificationContext; + class MemberdeclarationContext; + class MemberDeclaratorListContext; + class MemberDeclaratorContext; + class VirtualSpecifierSeqContext; + class VirtualSpecifierContext; + class PureSpecifierContext; + class BaseClauseContext; + class BaseSpecifierListContext; + class BaseSpecifierContext; + class ClassOrDeclTypeContext; + class BaseTypeSpecifierContext; + class AccessSpecifierContext; + class ConversionFunctionIdContext; + class ConversionTypeIdContext; + class ConversionDeclaratorContext; + class ConstructorInitializerContext; + class MemInitializerListContext; + class MemInitializerContext; + class MeminitializeridContext; + class OperatorFunctionIdContext; + class LiteralOperatorIdContext; + class TemplateDeclarationContext; + class TemplateparameterListContext; + class TemplateParameterContext; + class TypeParameterContext; + class SimpleTemplateIdContext; + class TemplateIdContext; + class TemplateNameContext; + class TemplateArgumentListContext; + class TemplateArgumentContext; + class TypeNameSpecifierContext; + class ExplicitInstantiationContext; + class ExplicitSpecializationContext; + class TryBlockContext; + class FunctionTryBlockContext; + class HandlerSeqContext; + class HandlerContext; + class ExceptionDeclarationContext; + class ThrowExpressionContext; + class ExceptionSpecificationContext; + class DynamicExceptionSpecificationContext; + class TypeIdListContext; + class NoeExceptSpecificationContext; + class TheOperatorContext; + class LiteralContext; + + class TranslationUnitContext : public antlr4::ParserRuleContext { + public: + TranslationUnitContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *EOF(); + DeclarationseqContext *declarationseq(); + + + }; + + TranslationUnitContext* translationUnit(); + + class PrimaryExpressionContext : public antlr4::ParserRuleContext { + public: + PrimaryExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector literal(); + LiteralContext* literal(size_t i); + antlr4::tree::TerminalNode *This(); + antlr4::tree::TerminalNode *LeftParen(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *RightParen(); + IdExpressionContext *idExpression(); + LambdaExpressionContext *lambdaExpression(); + + + }; + + PrimaryExpressionContext* primaryExpression(); + + class IdExpressionContext : public antlr4::ParserRuleContext { + public: + IdExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + UnqualifiedIdContext *unqualifiedId(); + QualifiedIdContext *qualifiedId(); + + + }; + + IdExpressionContext* idExpression(); + + class UnqualifiedIdContext : public antlr4::ParserRuleContext { + public: + UnqualifiedIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + OperatorFunctionIdContext *operatorFunctionId(); + ConversionFunctionIdContext *conversionFunctionId(); + LiteralOperatorIdContext *literalOperatorId(); + antlr4::tree::TerminalNode *Tilde(); + ClassNameContext *className(); + DecltypeSpecifierContext *decltypeSpecifier(); + TemplateIdContext *templateId(); + + + }; + + UnqualifiedIdContext* unqualifiedId(); + + class QualifiedIdContext : public antlr4::ParserRuleContext { + public: + QualifiedIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NestedNameSpecifierContext *nestedNameSpecifier(); + UnqualifiedIdContext *unqualifiedId(); + antlr4::tree::TerminalNode *Template(); + + + }; + + QualifiedIdContext* qualifiedId(); + + class NestedNameSpecifierContext : public antlr4::ParserRuleContext { + public: + NestedNameSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Doublecolon(); + TheTypeNameContext *theTypeName(); + NamespaceNameContext *namespaceName(); + DecltypeSpecifierContext *decltypeSpecifier(); + NestedNameSpecifierContext *nestedNameSpecifier(); + antlr4::tree::TerminalNode *Identifier(); + SimpleTemplateIdContext *simpleTemplateId(); + antlr4::tree::TerminalNode *Template(); + + + }; + + NestedNameSpecifierContext* nestedNameSpecifier(); + NestedNameSpecifierContext* nestedNameSpecifier(int precedence); + class LambdaExpressionContext : public antlr4::ParserRuleContext { + public: + LambdaExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + LambdaIntroducerContext *lambdaIntroducer(); + CompoundStatementContext *compoundStatement(); + LambdaDeclaratorContext *lambdaDeclarator(); + + + }; + + LambdaExpressionContext* lambdaExpression(); + + class LambdaIntroducerContext : public antlr4::ParserRuleContext { + public: + LambdaIntroducerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + LambdaCaptureContext *lambdaCapture(); + + + }; + + LambdaIntroducerContext* lambdaIntroducer(); + + class LambdaCaptureContext : public antlr4::ParserRuleContext { + public: + LambdaCaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + CaptureListContext *captureList(); + CaptureDefaultContext *captureDefault(); + antlr4::tree::TerminalNode *Comma(); + + + }; + + LambdaCaptureContext* lambdaCapture(); + + class CaptureDefaultContext : public antlr4::ParserRuleContext { + public: + CaptureDefaultContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *Assign(); + + + }; + + CaptureDefaultContext* captureDefault(); + + class CaptureListContext : public antlr4::ParserRuleContext { + public: + CaptureListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector capture(); + CaptureContext* capture(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + antlr4::tree::TerminalNode *Ellipsis(); + + + }; + + CaptureListContext* captureList(); + + class CaptureContext : public antlr4::ParserRuleContext { + public: + CaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + SimpleCaptureContext *simpleCapture(); + InitcaptureContext *initcapture(); + + + }; + + CaptureContext* capture(); + + class SimpleCaptureContext : public antlr4::ParserRuleContext { + public: + SimpleCaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *This(); + + + }; + + SimpleCaptureContext* simpleCapture(); + + class InitcaptureContext : public antlr4::ParserRuleContext { + public: + InitcaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + InitializerContext *initializer(); + antlr4::tree::TerminalNode *And(); + + + }; + + InitcaptureContext* initcapture(); + + class LambdaDeclaratorContext : public antlr4::ParserRuleContext { + public: + LambdaDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + ParameterDeclarationClauseContext *parameterDeclarationClause(); + antlr4::tree::TerminalNode *Mutable(); + ExceptionSpecificationContext *exceptionSpecification(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + TrailingReturnTypeContext *trailingReturnType(); + + + }; + + LambdaDeclaratorContext* lambdaDeclarator(); + + class PostfixExpressionContext : public antlr4::ParserRuleContext { + public: + PostfixExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PrimaryExpressionContext *primaryExpression(); + SimpleTypeSpecifierContext *simpleTypeSpecifier(); + TypeNameSpecifierContext *typeNameSpecifier(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + BracedInitListContext *bracedInitList(); + ExpressionListContext *expressionList(); + antlr4::tree::TerminalNode *Less(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *Greater(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *Dynamic_cast(); + antlr4::tree::TerminalNode *Static_cast(); + antlr4::tree::TerminalNode *Reinterpret_cast(); + antlr4::tree::TerminalNode *Const_cast(); + TypeIdOfTheTypeIdContext *typeIdOfTheTypeId(); + PostfixExpressionContext *postfixExpression(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + antlr4::tree::TerminalNode *Dot(); + antlr4::tree::TerminalNode *Arrow(); + IdExpressionContext *idExpression(); + PseudoDestructorNameContext *pseudoDestructorName(); + antlr4::tree::TerminalNode *Template(); + antlr4::tree::TerminalNode *PlusPlus(); + antlr4::tree::TerminalNode *MinusMinus(); + + + }; + + PostfixExpressionContext* postfixExpression(); + PostfixExpressionContext* postfixExpression(int precedence); + class TypeIdOfTheTypeIdContext : public antlr4::ParserRuleContext { + public: + TypeIdOfTheTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Typeid_(); + + + }; + + TypeIdOfTheTypeIdContext* typeIdOfTheTypeId(); + + class ExpressionListContext : public antlr4::ParserRuleContext { + public: + ExpressionListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + InitializerListContext *initializerList(); + + + }; + + ExpressionListContext* expressionList(); + + class PseudoDestructorNameContext : public antlr4::ParserRuleContext { + public: + PseudoDestructorNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Tilde(); + std::vector theTypeName(); + TheTypeNameContext* theTypeName(size_t i); + NestedNameSpecifierContext *nestedNameSpecifier(); + antlr4::tree::TerminalNode *Doublecolon(); + antlr4::tree::TerminalNode *Template(); + SimpleTemplateIdContext *simpleTemplateId(); + DecltypeSpecifierContext *decltypeSpecifier(); + + + }; + + PseudoDestructorNameContext* pseudoDestructorName(); + + class UnaryExpressionContext : public antlr4::ParserRuleContext { + public: + UnaryExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PostfixExpressionContext *postfixExpression(); + UnaryExpressionContext *unaryExpression(); + antlr4::tree::TerminalNode *PlusPlus(); + antlr4::tree::TerminalNode *MinusMinus(); + UnaryOperatorContext *unaryOperator(); + antlr4::tree::TerminalNode *Sizeof(); + antlr4::tree::TerminalNode *LeftParen(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *RightParen(); + antlr4::tree::TerminalNode *Ellipsis(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *Alignof(); + NoExceptExpressionContext *noExceptExpression(); + NewExpressionContext *newExpression(); + DeleteExpressionContext *deleteExpression(); + + + }; + + UnaryExpressionContext* unaryExpression(); + + class UnaryOperatorContext : public antlr4::ParserRuleContext { + public: + UnaryOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Or(); + antlr4::tree::TerminalNode *Star(); + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *Plus(); + antlr4::tree::TerminalNode *Tilde(); + antlr4::tree::TerminalNode *Minus(); + antlr4::tree::TerminalNode *Not(); + + + }; + + UnaryOperatorContext* unaryOperator(); + + class NewExpressionContext : public antlr4::ParserRuleContext { + public: + NewExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *New(); + NewTypeIdContext *newTypeId(); + antlr4::tree::TerminalNode *Doublecolon(); + NewPlacementContext *newPlacement(); + NewInitializerContext *newInitializer(); + antlr4::tree::TerminalNode *LeftParen(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + NewExpressionContext* newExpression(); + + class NewPlacementContext : public antlr4::ParserRuleContext { + public: + NewPlacementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftParen(); + ExpressionListContext *expressionList(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + NewPlacementContext* newPlacement(); + + class NewTypeIdContext : public antlr4::ParserRuleContext { + public: + NewTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TypeSpecifierSeqContext *typeSpecifierSeq(); + NewDeclaratorContext *newDeclarator(); + + + }; + + NewTypeIdContext* newTypeId(); + + class NewDeclaratorContext : public antlr4::ParserRuleContext { + public: + NewDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PointerOperatorContext *pointerOperator(); + NewDeclaratorContext *newDeclarator(); + NoPointerNewDeclaratorContext *noPointerNewDeclarator(); + + + }; + + NewDeclaratorContext* newDeclarator(); + + class NoPointerNewDeclaratorContext : public antlr4::ParserRuleContext { + public: + NoPointerNewDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftBracket(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *RightBracket(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + NoPointerNewDeclaratorContext *noPointerNewDeclarator(); + ConstantExpressionContext *constantExpression(); + + + }; + + NoPointerNewDeclaratorContext* noPointerNewDeclarator(); + NoPointerNewDeclaratorContext* noPointerNewDeclarator(int precedence); + class NewInitializerContext : public antlr4::ParserRuleContext { + public: + NewInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + ExpressionListContext *expressionList(); + BracedInitListContext *bracedInitList(); + + + }; + + NewInitializerContext* newInitializer(); + + class DeleteExpressionContext : public antlr4::ParserRuleContext { + public: + DeleteExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Delete(); + CastExpressionContext *castExpression(); + antlr4::tree::TerminalNode *Doublecolon(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + + + }; + + DeleteExpressionContext* deleteExpression(); + + class NoExceptExpressionContext : public antlr4::ParserRuleContext { + public: + NoExceptExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Noexcept(); + antlr4::tree::TerminalNode *LeftParen(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + NoExceptExpressionContext* noExceptExpression(); + + class CastExpressionContext : public antlr4::ParserRuleContext { + public: + CastExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + UnaryExpressionContext *unaryExpression(); + antlr4::tree::TerminalNode *LeftParen(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *RightParen(); + CastExpressionContext *castExpression(); + + + }; + + CastExpressionContext* castExpression(); + + class PointerMemberExpressionContext : public antlr4::ParserRuleContext { + public: + PointerMemberExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector castExpression(); + CastExpressionContext* castExpression(size_t i); + std::vector DotStar(); + antlr4::tree::TerminalNode* DotStar(size_t i); + std::vector ArrowStar(); + antlr4::tree::TerminalNode* ArrowStar(size_t i); + + + }; + + PointerMemberExpressionContext* pointerMemberExpression(); + + class MultiplicativeExpressionContext : public antlr4::ParserRuleContext { + public: + MultiplicativeExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector pointerMemberExpression(); + PointerMemberExpressionContext* pointerMemberExpression(size_t i); + std::vector Star(); + antlr4::tree::TerminalNode* Star(size_t i); + std::vector Div(); + antlr4::tree::TerminalNode* Div(size_t i); + std::vector Mod(); + antlr4::tree::TerminalNode* Mod(size_t i); + + + }; + + MultiplicativeExpressionContext* multiplicativeExpression(); + + class AdditiveExpressionContext : public antlr4::ParserRuleContext { + public: + AdditiveExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector multiplicativeExpression(); + MultiplicativeExpressionContext* multiplicativeExpression(size_t i); + std::vector Plus(); + antlr4::tree::TerminalNode* Plus(size_t i); + std::vector Minus(); + antlr4::tree::TerminalNode* Minus(size_t i); + + + }; + + AdditiveExpressionContext* additiveExpression(); + + class ShiftExpressionContext : public antlr4::ParserRuleContext { + public: + ShiftExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector additiveExpression(); + AdditiveExpressionContext* additiveExpression(size_t i); + std::vector shiftOperator(); + ShiftOperatorContext* shiftOperator(size_t i); + + + }; + + ShiftExpressionContext* shiftExpression(); + + class ShiftOperatorContext : public antlr4::ParserRuleContext { + public: + ShiftOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector Greater(); + antlr4::tree::TerminalNode* Greater(size_t i); + std::vector Less(); + antlr4::tree::TerminalNode* Less(size_t i); + + + }; + + ShiftOperatorContext* shiftOperator(); + + class RelationalExpressionContext : public antlr4::ParserRuleContext { + public: + RelationalExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector shiftExpression(); + ShiftExpressionContext* shiftExpression(size_t i); + std::vector Less(); + antlr4::tree::TerminalNode* Less(size_t i); + std::vector Greater(); + antlr4::tree::TerminalNode* Greater(size_t i); + std::vector LessEqual(); + antlr4::tree::TerminalNode* LessEqual(size_t i); + std::vector GreaterEqual(); + antlr4::tree::TerminalNode* GreaterEqual(size_t i); + + + }; + + RelationalExpressionContext* relationalExpression(); + + class EqualityExpressionContext : public antlr4::ParserRuleContext { + public: + EqualityExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector relationalExpression(); + RelationalExpressionContext* relationalExpression(size_t i); + std::vector Equal(); + antlr4::tree::TerminalNode* Equal(size_t i); + std::vector NotEqual(); + antlr4::tree::TerminalNode* NotEqual(size_t i); + + + }; + + EqualityExpressionContext* equalityExpression(); + + class AndExpressionContext : public antlr4::ParserRuleContext { + public: + AndExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector equalityExpression(); + EqualityExpressionContext* equalityExpression(size_t i); + std::vector And(); + antlr4::tree::TerminalNode* And(size_t i); + + + }; + + AndExpressionContext* andExpression(); + + class ExclusiveOrExpressionContext : public antlr4::ParserRuleContext { + public: + ExclusiveOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector andExpression(); + AndExpressionContext* andExpression(size_t i); + std::vector Caret(); + antlr4::tree::TerminalNode* Caret(size_t i); + + + }; + + ExclusiveOrExpressionContext* exclusiveOrExpression(); + + class InclusiveOrExpressionContext : public antlr4::ParserRuleContext { + public: + InclusiveOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector exclusiveOrExpression(); + ExclusiveOrExpressionContext* exclusiveOrExpression(size_t i); + std::vector Or(); + antlr4::tree::TerminalNode* Or(size_t i); + + + }; + + InclusiveOrExpressionContext* inclusiveOrExpression(); + + class LogicalAndExpressionContext : public antlr4::ParserRuleContext { + public: + LogicalAndExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector inclusiveOrExpression(); + InclusiveOrExpressionContext* inclusiveOrExpression(size_t i); + std::vector AndAnd(); + antlr4::tree::TerminalNode* AndAnd(size_t i); + + + }; + + LogicalAndExpressionContext* logicalAndExpression(); + + class LogicalOrExpressionContext : public antlr4::ParserRuleContext { + public: + LogicalOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector logicalAndExpression(); + LogicalAndExpressionContext* logicalAndExpression(size_t i); + std::vector OrOr(); + antlr4::tree::TerminalNode* OrOr(size_t i); + + + }; + + LogicalOrExpressionContext* logicalOrExpression(); + + class ConditionalExpressionContext : public antlr4::ParserRuleContext { + public: + ConditionalExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + LogicalOrExpressionContext *logicalOrExpression(); + antlr4::tree::TerminalNode *Question(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *Colon(); + AssignmentExpressionContext *assignmentExpression(); + + + }; + + ConditionalExpressionContext* conditionalExpression(); + + class AssignmentExpressionContext : public antlr4::ParserRuleContext { + public: + AssignmentExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ConditionalExpressionContext *conditionalExpression(); + LogicalOrExpressionContext *logicalOrExpression(); + AssignmentOperatorContext *assignmentOperator(); + InitializerClauseContext *initializerClause(); + ThrowExpressionContext *throwExpression(); + + + }; + + AssignmentExpressionContext* assignmentExpression(); + + class AssignmentOperatorContext : public antlr4::ParserRuleContext { + public: + AssignmentOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Assign(); + antlr4::tree::TerminalNode *StarAssign(); + antlr4::tree::TerminalNode *DivAssign(); + antlr4::tree::TerminalNode *ModAssign(); + antlr4::tree::TerminalNode *PlusAssign(); + antlr4::tree::TerminalNode *MinusAssign(); + antlr4::tree::TerminalNode *RightShiftAssign(); + antlr4::tree::TerminalNode *LeftShiftAssign(); + antlr4::tree::TerminalNode *AndAssign(); + antlr4::tree::TerminalNode *XorAssign(); + antlr4::tree::TerminalNode *OrAssign(); + + + }; + + AssignmentOperatorContext* assignmentOperator(); + + class ExpressionContext : public antlr4::ParserRuleContext { + public: + ExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector assignmentExpression(); + AssignmentExpressionContext* assignmentExpression(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + ExpressionContext* expression(); + + class ConstantExpressionContext : public antlr4::ParserRuleContext { + public: + ConstantExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ConditionalExpressionContext *conditionalExpression(); + + + }; + + ConstantExpressionContext* constantExpression(); + + class StatementContext : public antlr4::ParserRuleContext { + public: + StatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + LabeledStatementContext *labeledStatement(); + DeclarationStatementContext *declarationStatement(); + ExpressionStatementContext *expressionStatement(); + CompoundStatementContext *compoundStatement(); + SelectionStatementContext *selectionStatement(); + IterationStatementContext *iterationStatement(); + JumpStatementContext *jumpStatement(); + TryBlockContext *tryBlock(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + StatementContext* statement(); + + class LabeledStatementContext : public antlr4::ParserRuleContext { + public: + LabeledStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Colon(); + StatementContext *statement(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *Case(); + ConstantExpressionContext *constantExpression(); + antlr4::tree::TerminalNode *Default(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + LabeledStatementContext* labeledStatement(); + + class ExpressionStatementContext : public antlr4::ParserRuleContext { + public: + ExpressionStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Semi(); + ExpressionContext *expression(); + + + }; + + ExpressionStatementContext* expressionStatement(); + + class CompoundStatementContext : public antlr4::ParserRuleContext { + public: + CompoundStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + StatementSeqContext *statementSeq(); + + + }; + + CompoundStatementContext* compoundStatement(); + + class StatementSeqContext : public antlr4::ParserRuleContext { + public: + StatementSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector statement(); + StatementContext* statement(size_t i); + + + }; + + StatementSeqContext* statementSeq(); + + class SelectionStatementContext : public antlr4::ParserRuleContext { + public: + SelectionStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *If(); + antlr4::tree::TerminalNode *LeftParen(); + ConditionContext *condition(); + antlr4::tree::TerminalNode *RightParen(); + std::vector statement(); + StatementContext* statement(size_t i); + antlr4::tree::TerminalNode *Else(); + antlr4::tree::TerminalNode *Switch(); + + + }; + + SelectionStatementContext* selectionStatement(); + + class ConditionContext : public antlr4::ParserRuleContext { + public: + ConditionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ExpressionContext *expression(); + DeclSpecifierSeqContext *declSpecifierSeq(); + DeclaratorContext *declarator(); + antlr4::tree::TerminalNode *Assign(); + InitializerClauseContext *initializerClause(); + BracedInitListContext *bracedInitList(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + ConditionContext* condition(); + + class IterationStatementContext : public antlr4::ParserRuleContext { + public: + IterationStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *While(); + antlr4::tree::TerminalNode *LeftParen(); + ConditionContext *condition(); + antlr4::tree::TerminalNode *RightParen(); + StatementContext *statement(); + antlr4::tree::TerminalNode *Do(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *Semi(); + antlr4::tree::TerminalNode *For(); + ForInitStatementContext *forInitStatement(); + ForRangeDeclarationContext *forRangeDeclaration(); + antlr4::tree::TerminalNode *Colon(); + ForRangeInitializerContext *forRangeInitializer(); + + + }; + + IterationStatementContext* iterationStatement(); + + class ForInitStatementContext : public antlr4::ParserRuleContext { + public: + ForInitStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ExpressionStatementContext *expressionStatement(); + SimpleDeclarationContext *simpleDeclaration(); + + + }; + + ForInitStatementContext* forInitStatement(); + + class ForRangeDeclarationContext : public antlr4::ParserRuleContext { + public: + ForRangeDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclSpecifierSeqContext *declSpecifierSeq(); + DeclaratorContext *declarator(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + ForRangeDeclarationContext* forRangeDeclaration(); + + class ForRangeInitializerContext : public antlr4::ParserRuleContext { + public: + ForRangeInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ExpressionContext *expression(); + BracedInitListContext *bracedInitList(); + + + }; + + ForRangeInitializerContext* forRangeInitializer(); + + class JumpStatementContext : public antlr4::ParserRuleContext { + public: + JumpStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Semi(); + antlr4::tree::TerminalNode *Break(); + antlr4::tree::TerminalNode *Continue(); + antlr4::tree::TerminalNode *Return(); + antlr4::tree::TerminalNode *Goto(); + antlr4::tree::TerminalNode *Identifier(); + ExpressionContext *expression(); + BracedInitListContext *bracedInitList(); + + + }; + + JumpStatementContext* jumpStatement(); + + class DeclarationStatementContext : public antlr4::ParserRuleContext { + public: + DeclarationStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + BlockDeclarationContext *blockDeclaration(); + + + }; + + DeclarationStatementContext* declarationStatement(); + + class DeclarationseqContext : public antlr4::ParserRuleContext { + public: + DeclarationseqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector declaration(); + DeclarationContext* declaration(size_t i); + + + }; + + DeclarationseqContext* declarationseq(); + + class DeclarationContext : public antlr4::ParserRuleContext { + public: + DeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + BlockDeclarationContext *blockDeclaration(); + FunctionDefinitionContext *functionDefinition(); + TemplateDeclarationContext *templateDeclaration(); + ExplicitInstantiationContext *explicitInstantiation(); + ExplicitSpecializationContext *explicitSpecialization(); + LinkageSpecificationContext *linkageSpecification(); + NamespaceDefinitionContext *namespaceDefinition(); + EmptyDeclarationContext *emptyDeclaration(); + AttributeDeclarationContext *attributeDeclaration(); + + + }; + + DeclarationContext* declaration(); + + class BlockDeclarationContext : public antlr4::ParserRuleContext { + public: + BlockDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + SimpleDeclarationContext *simpleDeclaration(); + AsmDefinitionContext *asmDefinition(); + NamespaceAliasDefinitionContext *namespaceAliasDefinition(); + UsingDeclarationContext *usingDeclaration(); + UsingDirectiveContext *usingDirective(); + StaticAssertDeclarationContext *staticAssertDeclaration(); + AliasDeclarationContext *aliasDeclaration(); + OpaqueEnumDeclarationContext *opaqueEnumDeclaration(); + + + }; + + BlockDeclarationContext* blockDeclaration(); + + class AliasDeclarationContext : public antlr4::ParserRuleContext { + public: + AliasDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Using(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *Assign(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *Semi(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + AliasDeclarationContext* aliasDeclaration(); + + class SimpleDeclarationContext : public antlr4::ParserRuleContext { + public: + SimpleDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Semi(); + DeclSpecifierSeqContext *declSpecifierSeq(); + InitDeclaratorListContext *initDeclaratorList(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + SimpleDeclarationContext* simpleDeclaration(); + + class StaticAssertDeclarationContext : public antlr4::ParserRuleContext { + public: + StaticAssertDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Static_assert(); + antlr4::tree::TerminalNode *LeftParen(); + ConstantExpressionContext *constantExpression(); + antlr4::tree::TerminalNode *Comma(); + antlr4::tree::TerminalNode *StringLiteral(); + antlr4::tree::TerminalNode *RightParen(); + antlr4::tree::TerminalNode *Semi(); + + + }; + + StaticAssertDeclarationContext* staticAssertDeclaration(); + + class EmptyDeclarationContext : public antlr4::ParserRuleContext { + public: + EmptyDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Semi(); + + + }; + + EmptyDeclarationContext* emptyDeclaration(); + + class AttributeDeclarationContext : public antlr4::ParserRuleContext { + public: + AttributeDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *Semi(); + + + }; + + AttributeDeclarationContext* attributeDeclaration(); + + class DeclSpecifierContext : public antlr4::ParserRuleContext { + public: + DeclSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + StorageClassSpecifierContext *storageClassSpecifier(); + TypeSpecifierContext *typeSpecifier(); + FunctionSpecifierContext *functionSpecifier(); + antlr4::tree::TerminalNode *Friend(); + antlr4::tree::TerminalNode *Typedef(); + antlr4::tree::TerminalNode *Constexpr(); + + + }; + + DeclSpecifierContext* declSpecifier(); + + class DeclSpecifierSeqContext : public antlr4::ParserRuleContext { + public: + DeclSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector declSpecifier(); + DeclSpecifierContext* declSpecifier(size_t i); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + DeclSpecifierSeqContext* declSpecifierSeq(); + + class StorageClassSpecifierContext : public antlr4::ParserRuleContext { + public: + StorageClassSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Register(); + antlr4::tree::TerminalNode *Static(); + antlr4::tree::TerminalNode *Thread_local(); + antlr4::tree::TerminalNode *Extern(); + antlr4::tree::TerminalNode *Mutable(); + + + }; + + StorageClassSpecifierContext* storageClassSpecifier(); + + class FunctionSpecifierContext : public antlr4::ParserRuleContext { + public: + FunctionSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Inline(); + antlr4::tree::TerminalNode *Virtual(); + antlr4::tree::TerminalNode *Explicit(); + + + }; + + FunctionSpecifierContext* functionSpecifier(); + + class TypedefNameContext : public antlr4::ParserRuleContext { + public: + TypedefNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + TypedefNameContext* typedefName(); + + class TypeSpecifierContext : public antlr4::ParserRuleContext { + public: + TypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TrailingTypeSpecifierContext *trailingTypeSpecifier(); + ClassSpecifierContext *classSpecifier(); + EnumSpecifierContext *enumSpecifier(); + + + }; + + TypeSpecifierContext* typeSpecifier(); + + class TrailingTypeSpecifierContext : public antlr4::ParserRuleContext { + public: + TrailingTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + SimpleTypeSpecifierContext *simpleTypeSpecifier(); + ElaboratedTypeSpecifierContext *elaboratedTypeSpecifier(); + TypeNameSpecifierContext *typeNameSpecifier(); + CvQualifierContext *cvQualifier(); + + + }; + + TrailingTypeSpecifierContext* trailingTypeSpecifier(); + + class TypeSpecifierSeqContext : public antlr4::ParserRuleContext { + public: + TypeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector typeSpecifier(); + TypeSpecifierContext* typeSpecifier(size_t i); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + TypeSpecifierSeqContext* typeSpecifierSeq(); + + class TrailingTypeSpecifierSeqContext : public antlr4::ParserRuleContext { + public: + TrailingTypeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector trailingTypeSpecifier(); + TrailingTypeSpecifierContext* trailingTypeSpecifier(size_t i); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + TrailingTypeSpecifierSeqContext* trailingTypeSpecifierSeq(); + + class SimpleTypeLengthModifierContext : public antlr4::ParserRuleContext { + public: + SimpleTypeLengthModifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Short(); + antlr4::tree::TerminalNode *Long(); + + + }; + + SimpleTypeLengthModifierContext* simpleTypeLengthModifier(); + + class SimpleTypeSignednessModifierContext : public antlr4::ParserRuleContext { + public: + SimpleTypeSignednessModifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Unsigned(); + antlr4::tree::TerminalNode *Signed(); + + + }; + + SimpleTypeSignednessModifierContext* simpleTypeSignednessModifier(); + + class SimpleTypeSpecifierContext : public antlr4::ParserRuleContext { + public: + SimpleTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TheTypeNameContext *theTypeName(); + NestedNameSpecifierContext *nestedNameSpecifier(); + antlr4::tree::TerminalNode *Template(); + SimpleTemplateIdContext *simpleTemplateId(); + SimpleTypeSignednessModifierContext *simpleTypeSignednessModifier(); + std::vector simpleTypeLengthModifier(); + SimpleTypeLengthModifierContext* simpleTypeLengthModifier(size_t i); + antlr4::tree::TerminalNode *Char(); + antlr4::tree::TerminalNode *Char16(); + antlr4::tree::TerminalNode *Char32(); + antlr4::tree::TerminalNode *Wchar(); + antlr4::tree::TerminalNode *Bool(); + antlr4::tree::TerminalNode *Int(); + antlr4::tree::TerminalNode *Float(); + antlr4::tree::TerminalNode *Double(); + antlr4::tree::TerminalNode *Void(); + antlr4::tree::TerminalNode *Auto(); + DecltypeSpecifierContext *decltypeSpecifier(); + + + }; + + SimpleTypeSpecifierContext* simpleTypeSpecifier(); + + class TheTypeNameContext : public antlr4::ParserRuleContext { + public: + TheTypeNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassNameContext *className(); + EnumNameContext *enumName(); + TypedefNameContext *typedefName(); + SimpleTemplateIdContext *simpleTemplateId(); + + + }; + + TheTypeNameContext* theTypeName(); + + class DecltypeSpecifierContext : public antlr4::ParserRuleContext { + public: + DecltypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Decltype(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + ExpressionContext *expression(); + antlr4::tree::TerminalNode *Auto(); + + + }; + + DecltypeSpecifierContext* decltypeSpecifier(); + + class ElaboratedTypeSpecifierContext : public antlr4::ParserRuleContext { + public: + ElaboratedTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassKeyContext *classKey(); + antlr4::tree::TerminalNode *Identifier(); + SimpleTemplateIdContext *simpleTemplateId(); + NestedNameSpecifierContext *nestedNameSpecifier(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *Template(); + antlr4::tree::TerminalNode *Enum(); + + + }; + + ElaboratedTypeSpecifierContext* elaboratedTypeSpecifier(); + + class EnumNameContext : public antlr4::ParserRuleContext { + public: + EnumNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + EnumNameContext* enumName(); + + class EnumSpecifierContext : public antlr4::ParserRuleContext { + public: + EnumSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + EnumHeadContext *enumHead(); + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + EnumeratorListContext *enumeratorList(); + antlr4::tree::TerminalNode *Comma(); + + + }; + + EnumSpecifierContext* enumSpecifier(); + + class EnumHeadContext : public antlr4::ParserRuleContext { + public: + EnumHeadContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + EnumkeyContext *enumkey(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *Identifier(); + EnumbaseContext *enumbase(); + NestedNameSpecifierContext *nestedNameSpecifier(); + + + }; + + EnumHeadContext* enumHead(); + + class OpaqueEnumDeclarationContext : public antlr4::ParserRuleContext { + public: + OpaqueEnumDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + EnumkeyContext *enumkey(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *Semi(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + EnumbaseContext *enumbase(); + + + }; + + OpaqueEnumDeclarationContext* opaqueEnumDeclaration(); + + class EnumkeyContext : public antlr4::ParserRuleContext { + public: + EnumkeyContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Enum(); + antlr4::tree::TerminalNode *Class(); + antlr4::tree::TerminalNode *Struct(); + + + }; + + EnumkeyContext* enumkey(); + + class EnumbaseContext : public antlr4::ParserRuleContext { + public: + EnumbaseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Colon(); + TypeSpecifierSeqContext *typeSpecifierSeq(); + + + }; + + EnumbaseContext* enumbase(); + + class EnumeratorListContext : public antlr4::ParserRuleContext { + public: + EnumeratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector enumeratorDefinition(); + EnumeratorDefinitionContext* enumeratorDefinition(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + EnumeratorListContext* enumeratorList(); + + class EnumeratorDefinitionContext : public antlr4::ParserRuleContext { + public: + EnumeratorDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + EnumeratorContext *enumerator(); + antlr4::tree::TerminalNode *Assign(); + ConstantExpressionContext *constantExpression(); + + + }; + + EnumeratorDefinitionContext* enumeratorDefinition(); + + class EnumeratorContext : public antlr4::ParserRuleContext { + public: + EnumeratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + EnumeratorContext* enumerator(); + + class NamespaceNameContext : public antlr4::ParserRuleContext { + public: + NamespaceNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + OriginalNamespaceNameContext *originalNamespaceName(); + NamespaceAliasContext *namespaceAlias(); + + + }; + + NamespaceNameContext* namespaceName(); + + class OriginalNamespaceNameContext : public antlr4::ParserRuleContext { + public: + OriginalNamespaceNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + OriginalNamespaceNameContext* originalNamespaceName(); + + class NamespaceDefinitionContext : public antlr4::ParserRuleContext { + public: + CPP14Parser::DeclarationseqContext *namespaceBody = nullptr; + NamespaceDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Namespace(); + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + antlr4::tree::TerminalNode *Inline(); + antlr4::tree::TerminalNode *Identifier(); + OriginalNamespaceNameContext *originalNamespaceName(); + DeclarationseqContext *declarationseq(); + + + }; + + NamespaceDefinitionContext* namespaceDefinition(); + + class NamespaceAliasContext : public antlr4::ParserRuleContext { + public: + NamespaceAliasContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + NamespaceAliasContext* namespaceAlias(); + + class NamespaceAliasDefinitionContext : public antlr4::ParserRuleContext { + public: + NamespaceAliasDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Namespace(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *Assign(); + QualifiednamespacespecifierContext *qualifiednamespacespecifier(); + antlr4::tree::TerminalNode *Semi(); + + + }; + + NamespaceAliasDefinitionContext* namespaceAliasDefinition(); + + class QualifiednamespacespecifierContext : public antlr4::ParserRuleContext { + public: + QualifiednamespacespecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NamespaceNameContext *namespaceName(); + NestedNameSpecifierContext *nestedNameSpecifier(); + + + }; + + QualifiednamespacespecifierContext* qualifiednamespacespecifier(); + + class UsingDeclarationContext : public antlr4::ParserRuleContext { + public: + UsingDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Using(); + UnqualifiedIdContext *unqualifiedId(); + antlr4::tree::TerminalNode *Semi(); + antlr4::tree::TerminalNode *Doublecolon(); + NestedNameSpecifierContext *nestedNameSpecifier(); + antlr4::tree::TerminalNode *Typename_(); + + + }; + + UsingDeclarationContext* usingDeclaration(); + + class UsingDirectiveContext : public antlr4::ParserRuleContext { + public: + UsingDirectiveContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Using(); + antlr4::tree::TerminalNode *Namespace(); + NamespaceNameContext *namespaceName(); + antlr4::tree::TerminalNode *Semi(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + NestedNameSpecifierContext *nestedNameSpecifier(); + + + }; + + UsingDirectiveContext* usingDirective(); + + class AsmDefinitionContext : public antlr4::ParserRuleContext { + public: + AsmDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Asm(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *StringLiteral(); + antlr4::tree::TerminalNode *RightParen(); + antlr4::tree::TerminalNode *Semi(); + + + }; + + AsmDefinitionContext* asmDefinition(); + + class LinkageSpecificationContext : public antlr4::ParserRuleContext { + public: + LinkageSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Extern(); + antlr4::tree::TerminalNode *StringLiteral(); + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + DeclarationContext *declaration(); + DeclarationseqContext *declarationseq(); + + + }; + + LinkageSpecificationContext* linkageSpecification(); + + class AttributeSpecifierSeqContext : public antlr4::ParserRuleContext { + public: + AttributeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector attributeSpecifier(); + AttributeSpecifierContext* attributeSpecifier(size_t i); + + + }; + + AttributeSpecifierSeqContext* attributeSpecifierSeq(); + + class AttributeSpecifierContext : public antlr4::ParserRuleContext { + public: + AttributeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector LeftBracket(); + antlr4::tree::TerminalNode* LeftBracket(size_t i); + std::vector RightBracket(); + antlr4::tree::TerminalNode* RightBracket(size_t i); + AttributeListContext *attributeList(); + AlignmentspecifierContext *alignmentspecifier(); + + + }; + + AttributeSpecifierContext* attributeSpecifier(); + + class AlignmentspecifierContext : public antlr4::ParserRuleContext { + public: + AlignmentspecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Alignas(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + TheTypeIdContext *theTypeId(); + ConstantExpressionContext *constantExpression(); + antlr4::tree::TerminalNode *Ellipsis(); + + + }; + + AlignmentspecifierContext* alignmentspecifier(); + + class AttributeListContext : public antlr4::ParserRuleContext { + public: + AttributeListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector attribute(); + AttributeContext* attribute(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + antlr4::tree::TerminalNode *Ellipsis(); + + + }; + + AttributeListContext* attributeList(); + + class AttributeContext : public antlr4::ParserRuleContext { + public: + AttributeContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + AttributeNamespaceContext *attributeNamespace(); + antlr4::tree::TerminalNode *Doublecolon(); + AttributeArgumentClauseContext *attributeArgumentClause(); + + + }; + + AttributeContext* attribute(); + + class AttributeNamespaceContext : public antlr4::ParserRuleContext { + public: + AttributeNamespaceContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + AttributeNamespaceContext* attributeNamespace(); + + class AttributeArgumentClauseContext : public antlr4::ParserRuleContext { + public: + AttributeArgumentClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + BalancedTokenSeqContext *balancedTokenSeq(); + + + }; + + AttributeArgumentClauseContext* attributeArgumentClause(); + + class BalancedTokenSeqContext : public antlr4::ParserRuleContext { + public: + BalancedTokenSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector balancedtoken(); + BalancedtokenContext* balancedtoken(size_t i); + + + }; + + BalancedTokenSeqContext* balancedTokenSeq(); + + class BalancedtokenContext : public antlr4::ParserRuleContext { + public: + BalancedtokenContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector LeftParen(); + antlr4::tree::TerminalNode* LeftParen(size_t i); + BalancedTokenSeqContext *balancedTokenSeq(); + std::vector RightParen(); + antlr4::tree::TerminalNode* RightParen(size_t i); + std::vector LeftBracket(); + antlr4::tree::TerminalNode* LeftBracket(size_t i); + std::vector RightBracket(); + antlr4::tree::TerminalNode* RightBracket(size_t i); + std::vector LeftBrace(); + antlr4::tree::TerminalNode* LeftBrace(size_t i); + std::vector RightBrace(); + antlr4::tree::TerminalNode* RightBrace(size_t i); + + + }; + + BalancedtokenContext* balancedtoken(); + + class InitDeclaratorListContext : public antlr4::ParserRuleContext { + public: + InitDeclaratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector initDeclarator(); + InitDeclaratorContext* initDeclarator(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + InitDeclaratorListContext* initDeclaratorList(); + + class InitDeclaratorContext : public antlr4::ParserRuleContext { + public: + InitDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclaratorContext *declarator(); + InitializerContext *initializer(); + + + }; + + InitDeclaratorContext* initDeclarator(); + + class DeclaratorContext : public antlr4::ParserRuleContext { + public: + DeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PointerDeclaratorContext *pointerDeclarator(); + NoPointerDeclaratorContext *noPointerDeclarator(); + ParametersAndQualifiersContext *parametersAndQualifiers(); + TrailingReturnTypeContext *trailingReturnType(); + + + }; + + DeclaratorContext* declarator(); + + class PointerDeclaratorContext : public antlr4::ParserRuleContext { + public: + PointerDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NoPointerDeclaratorContext *noPointerDeclarator(); + std::vector pointerOperator(); + PointerOperatorContext* pointerOperator(size_t i); + std::vector Const(); + antlr4::tree::TerminalNode* Const(size_t i); + + + }; + + PointerDeclaratorContext* pointerDeclarator(); + + class NoPointerDeclaratorContext : public antlr4::ParserRuleContext { + public: + NoPointerDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclaratoridContext *declaratorid(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *LeftParen(); + PointerDeclaratorContext *pointerDeclarator(); + antlr4::tree::TerminalNode *RightParen(); + NoPointerDeclaratorContext *noPointerDeclarator(); + ParametersAndQualifiersContext *parametersAndQualifiers(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + ConstantExpressionContext *constantExpression(); + + + }; + + NoPointerDeclaratorContext* noPointerDeclarator(); + NoPointerDeclaratorContext* noPointerDeclarator(int precedence); + class ParametersAndQualifiersContext : public antlr4::ParserRuleContext { + public: + ParametersAndQualifiersContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + ParameterDeclarationClauseContext *parameterDeclarationClause(); + CvqualifierseqContext *cvqualifierseq(); + RefqualifierContext *refqualifier(); + ExceptionSpecificationContext *exceptionSpecification(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + ParametersAndQualifiersContext* parametersAndQualifiers(); + + class TrailingReturnTypeContext : public antlr4::ParserRuleContext { + public: + TrailingReturnTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Arrow(); + TrailingTypeSpecifierSeqContext *trailingTypeSpecifierSeq(); + AbstractDeclaratorContext *abstractDeclarator(); + + + }; + + TrailingReturnTypeContext* trailingReturnType(); + + class PointerOperatorContext : public antlr4::ParserRuleContext { + public: + PointerOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *AndAnd(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *Star(); + NestedNameSpecifierContext *nestedNameSpecifier(); + CvqualifierseqContext *cvqualifierseq(); + + + }; + + PointerOperatorContext* pointerOperator(); + + class CvqualifierseqContext : public antlr4::ParserRuleContext { + public: + CvqualifierseqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector cvQualifier(); + CvQualifierContext* cvQualifier(size_t i); + + + }; + + CvqualifierseqContext* cvqualifierseq(); + + class CvQualifierContext : public antlr4::ParserRuleContext { + public: + CvQualifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Const(); + antlr4::tree::TerminalNode *Volatile(); + + + }; + + CvQualifierContext* cvQualifier(); + + class RefqualifierContext : public antlr4::ParserRuleContext { + public: + RefqualifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *AndAnd(); + + + }; + + RefqualifierContext* refqualifier(); + + class DeclaratoridContext : public antlr4::ParserRuleContext { + public: + DeclaratoridContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdExpressionContext *idExpression(); + antlr4::tree::TerminalNode *Ellipsis(); + + + }; + + DeclaratoridContext* declaratorid(); + + class TheTypeIdContext : public antlr4::ParserRuleContext { + public: + TheTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TypeSpecifierSeqContext *typeSpecifierSeq(); + AbstractDeclaratorContext *abstractDeclarator(); + + + }; + + TheTypeIdContext* theTypeId(); + + class AbstractDeclaratorContext : public antlr4::ParserRuleContext { + public: + AbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PointerAbstractDeclaratorContext *pointerAbstractDeclarator(); + ParametersAndQualifiersContext *parametersAndQualifiers(); + TrailingReturnTypeContext *trailingReturnType(); + NoPointerAbstractDeclaratorContext *noPointerAbstractDeclarator(); + AbstractPackDeclaratorContext *abstractPackDeclarator(); + + + }; + + AbstractDeclaratorContext* abstractDeclarator(); + + class PointerAbstractDeclaratorContext : public antlr4::ParserRuleContext { + public: + PointerAbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NoPointerAbstractDeclaratorContext *noPointerAbstractDeclarator(); + std::vector pointerOperator(); + PointerOperatorContext* pointerOperator(size_t i); + + + }; + + PointerAbstractDeclaratorContext* pointerAbstractDeclarator(); + + class NoPointerAbstractDeclaratorContext : public antlr4::ParserRuleContext { + public: + NoPointerAbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ParametersAndQualifiersContext *parametersAndQualifiers(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + ConstantExpressionContext *constantExpression(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + antlr4::tree::TerminalNode *LeftParen(); + PointerAbstractDeclaratorContext *pointerAbstractDeclarator(); + antlr4::tree::TerminalNode *RightParen(); + std::vector noPointerAbstractDeclarator(); + NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(size_t i); + + + }; + + NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(); + NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(int precedence); + class AbstractPackDeclaratorContext : public antlr4::ParserRuleContext { + public: + AbstractPackDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NoPointerAbstractPackDeclaratorContext *noPointerAbstractPackDeclarator(); + std::vector pointerOperator(); + PointerOperatorContext* pointerOperator(size_t i); + + + }; + + AbstractPackDeclaratorContext* abstractPackDeclarator(); + + class NoPointerAbstractPackDeclaratorContext : public antlr4::ParserRuleContext { + public: + NoPointerAbstractPackDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Ellipsis(); + NoPointerAbstractPackDeclaratorContext *noPointerAbstractPackDeclarator(); + ParametersAndQualifiersContext *parametersAndQualifiers(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + ConstantExpressionContext *constantExpression(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + NoPointerAbstractPackDeclaratorContext* noPointerAbstractPackDeclarator(); + NoPointerAbstractPackDeclaratorContext* noPointerAbstractPackDeclarator(int precedence); + class ParameterDeclarationClauseContext : public antlr4::ParserRuleContext { + public: + ParameterDeclarationClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ParameterDeclarationListContext *parameterDeclarationList(); + antlr4::tree::TerminalNode *Ellipsis(); + antlr4::tree::TerminalNode *Comma(); + + + }; + + ParameterDeclarationClauseContext* parameterDeclarationClause(); + + class ParameterDeclarationListContext : public antlr4::ParserRuleContext { + public: + ParameterDeclarationListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector parameterDeclaration(); + ParameterDeclarationContext* parameterDeclaration(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + ParameterDeclarationListContext* parameterDeclarationList(); + + class ParameterDeclarationContext : public antlr4::ParserRuleContext { + public: + ParameterDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclSpecifierSeqContext *declSpecifierSeq(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + DeclaratorContext *declarator(); + antlr4::tree::TerminalNode *Assign(); + InitializerClauseContext *initializerClause(); + AbstractDeclaratorContext *abstractDeclarator(); + + + }; + + ParameterDeclarationContext* parameterDeclaration(); + + class FunctionDefinitionContext : public antlr4::ParserRuleContext { + public: + FunctionDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclaratorContext *declarator(); + FunctionBodyContext *functionBody(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + DeclSpecifierSeqContext *declSpecifierSeq(); + VirtualSpecifierSeqContext *virtualSpecifierSeq(); + + + }; + + FunctionDefinitionContext* functionDefinition(); + + class FunctionBodyContext : public antlr4::ParserRuleContext { + public: + FunctionBodyContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + CompoundStatementContext *compoundStatement(); + ConstructorInitializerContext *constructorInitializer(); + FunctionTryBlockContext *functionTryBlock(); + antlr4::tree::TerminalNode *Assign(); + antlr4::tree::TerminalNode *Semi(); + antlr4::tree::TerminalNode *Default(); + antlr4::tree::TerminalNode *Delete(); + + + }; + + FunctionBodyContext* functionBody(); + + class InitializerContext : public antlr4::ParserRuleContext { + public: + InitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + BraceOrEqualInitializerContext *braceOrEqualInitializer(); + antlr4::tree::TerminalNode *LeftParen(); + ExpressionListContext *expressionList(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + InitializerContext* initializer(); + + class BraceOrEqualInitializerContext : public antlr4::ParserRuleContext { + public: + BraceOrEqualInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Assign(); + InitializerClauseContext *initializerClause(); + BracedInitListContext *bracedInitList(); + + + }; + + BraceOrEqualInitializerContext* braceOrEqualInitializer(); + + class InitializerClauseContext : public antlr4::ParserRuleContext { + public: + InitializerClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + AssignmentExpressionContext *assignmentExpression(); + BracedInitListContext *bracedInitList(); + + + }; + + InitializerClauseContext* initializerClause(); + + class InitializerListContext : public antlr4::ParserRuleContext { + public: + InitializerListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector initializerClause(); + InitializerClauseContext* initializerClause(size_t i); + std::vector Ellipsis(); + antlr4::tree::TerminalNode* Ellipsis(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + InitializerListContext* initializerList(); + + class BracedInitListContext : public antlr4::ParserRuleContext { + public: + BracedInitListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + InitializerListContext *initializerList(); + antlr4::tree::TerminalNode *Comma(); + + + }; + + BracedInitListContext* bracedInitList(); + + class ClassNameContext : public antlr4::ParserRuleContext { + public: + ClassNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + SimpleTemplateIdContext *simpleTemplateId(); + + + }; + + ClassNameContext* className(); + + class ClassSpecifierContext : public antlr4::ParserRuleContext { + public: + ClassSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassHeadContext *classHead(); + antlr4::tree::TerminalNode *LeftBrace(); + antlr4::tree::TerminalNode *RightBrace(); + MemberSpecificationContext *memberSpecification(); + + + }; + + ClassSpecifierContext* classSpecifier(); + + class ClassHeadContext : public antlr4::ParserRuleContext { + public: + ClassHeadContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassKeyContext *classKey(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + ClassHeadNameContext *classHeadName(); + BaseClauseContext *baseClause(); + ClassVirtSpecifierContext *classVirtSpecifier(); + antlr4::tree::TerminalNode *Union(); + + + }; + + ClassHeadContext* classHead(); + + class ClassHeadNameContext : public antlr4::ParserRuleContext { + public: + ClassHeadNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassNameContext *className(); + NestedNameSpecifierContext *nestedNameSpecifier(); + + + }; + + ClassHeadNameContext* classHeadName(); + + class ClassVirtSpecifierContext : public antlr4::ParserRuleContext { + public: + ClassVirtSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Final(); + + + }; + + ClassVirtSpecifierContext* classVirtSpecifier(); + + class ClassKeyContext : public antlr4::ParserRuleContext { + public: + ClassKeyContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Class(); + antlr4::tree::TerminalNode *Struct(); + + + }; + + ClassKeyContext* classKey(); + + class MemberSpecificationContext : public antlr4::ParserRuleContext { + public: + MemberSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector memberdeclaration(); + MemberdeclarationContext* memberdeclaration(size_t i); + std::vector accessSpecifier(); + AccessSpecifierContext* accessSpecifier(size_t i); + std::vector Colon(); + antlr4::tree::TerminalNode* Colon(size_t i); + + + }; + + MemberSpecificationContext* memberSpecification(); + + class MemberdeclarationContext : public antlr4::ParserRuleContext { + public: + MemberdeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Semi(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + DeclSpecifierSeqContext *declSpecifierSeq(); + MemberDeclaratorListContext *memberDeclaratorList(); + FunctionDefinitionContext *functionDefinition(); + UsingDeclarationContext *usingDeclaration(); + StaticAssertDeclarationContext *staticAssertDeclaration(); + TemplateDeclarationContext *templateDeclaration(); + AliasDeclarationContext *aliasDeclaration(); + EmptyDeclarationContext *emptyDeclaration(); + + + }; + + MemberdeclarationContext* memberdeclaration(); + + class MemberDeclaratorListContext : public antlr4::ParserRuleContext { + public: + MemberDeclaratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector memberDeclarator(); + MemberDeclaratorContext* memberDeclarator(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + MemberDeclaratorListContext* memberDeclaratorList(); + + class MemberDeclaratorContext : public antlr4::ParserRuleContext { + public: + MemberDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DeclaratorContext *declarator(); + VirtualSpecifierSeqContext *virtualSpecifierSeq(); + PureSpecifierContext *pureSpecifier(); + BraceOrEqualInitializerContext *braceOrEqualInitializer(); + antlr4::tree::TerminalNode *Colon(); + ConstantExpressionContext *constantExpression(); + antlr4::tree::TerminalNode *Identifier(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + MemberDeclaratorContext* memberDeclarator(); + + class VirtualSpecifierSeqContext : public antlr4::ParserRuleContext { + public: + VirtualSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector virtualSpecifier(); + VirtualSpecifierContext* virtualSpecifier(size_t i); + + + }; + + VirtualSpecifierSeqContext* virtualSpecifierSeq(); + + class VirtualSpecifierContext : public antlr4::ParserRuleContext { + public: + VirtualSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Override(); + antlr4::tree::TerminalNode *Final(); + + + }; + + VirtualSpecifierContext* virtualSpecifier(); + + class PureSpecifierContext : public antlr4::ParserRuleContext { + public: + antlr4::Token *val = nullptr; + PureSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Assign(); + antlr4::tree::TerminalNode *OctalLiteral(); + + + }; + + PureSpecifierContext* pureSpecifier(); + + class BaseClauseContext : public antlr4::ParserRuleContext { + public: + BaseClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Colon(); + BaseSpecifierListContext *baseSpecifierList(); + + + }; + + BaseClauseContext* baseClause(); + + class BaseSpecifierListContext : public antlr4::ParserRuleContext { + public: + BaseSpecifierListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector baseSpecifier(); + BaseSpecifierContext* baseSpecifier(size_t i); + std::vector Ellipsis(); + antlr4::tree::TerminalNode* Ellipsis(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + BaseSpecifierListContext* baseSpecifierList(); + + class BaseSpecifierContext : public antlr4::ParserRuleContext { + public: + BaseSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + BaseTypeSpecifierContext *baseTypeSpecifier(); + antlr4::tree::TerminalNode *Virtual(); + AccessSpecifierContext *accessSpecifier(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + + + }; + + BaseSpecifierContext* baseSpecifier(); + + class ClassOrDeclTypeContext : public antlr4::ParserRuleContext { + public: + ClassOrDeclTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassNameContext *className(); + NestedNameSpecifierContext *nestedNameSpecifier(); + DecltypeSpecifierContext *decltypeSpecifier(); + + + }; + + ClassOrDeclTypeContext* classOrDeclType(); + + class BaseTypeSpecifierContext : public antlr4::ParserRuleContext { + public: + BaseTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassOrDeclTypeContext *classOrDeclType(); + + + }; + + BaseTypeSpecifierContext* baseTypeSpecifier(); + + class AccessSpecifierContext : public antlr4::ParserRuleContext { + public: + AccessSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Private(); + antlr4::tree::TerminalNode *Protected(); + antlr4::tree::TerminalNode *Public(); + + + }; + + AccessSpecifierContext* accessSpecifier(); + + class ConversionFunctionIdContext : public antlr4::ParserRuleContext { + public: + ConversionFunctionIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Operator(); + ConversionTypeIdContext *conversionTypeId(); + + + }; + + ConversionFunctionIdContext* conversionFunctionId(); + + class ConversionTypeIdContext : public antlr4::ParserRuleContext { + public: + ConversionTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TypeSpecifierSeqContext *typeSpecifierSeq(); + ConversionDeclaratorContext *conversionDeclarator(); + + + }; + + ConversionTypeIdContext* conversionTypeId(); + + class ConversionDeclaratorContext : public antlr4::ParserRuleContext { + public: + ConversionDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + PointerOperatorContext *pointerOperator(); + ConversionDeclaratorContext *conversionDeclarator(); + + + }; + + ConversionDeclaratorContext* conversionDeclarator(); + + class ConstructorInitializerContext : public antlr4::ParserRuleContext { + public: + ConstructorInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Colon(); + MemInitializerListContext *memInitializerList(); + + + }; + + ConstructorInitializerContext* constructorInitializer(); + + class MemInitializerListContext : public antlr4::ParserRuleContext { + public: + MemInitializerListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector memInitializer(); + MemInitializerContext* memInitializer(size_t i); + std::vector Ellipsis(); + antlr4::tree::TerminalNode* Ellipsis(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + MemInitializerListContext* memInitializerList(); + + class MemInitializerContext : public antlr4::ParserRuleContext { + public: + MemInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + MeminitializeridContext *meminitializerid(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + BracedInitListContext *bracedInitList(); + ExpressionListContext *expressionList(); + + + }; + + MemInitializerContext* memInitializer(); + + class MeminitializeridContext : public antlr4::ParserRuleContext { + public: + MeminitializeridContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ClassOrDeclTypeContext *classOrDeclType(); + antlr4::tree::TerminalNode *Identifier(); + + + }; + + MeminitializeridContext* meminitializerid(); + + class OperatorFunctionIdContext : public antlr4::ParserRuleContext { + public: + OperatorFunctionIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Operator(); + TheOperatorContext *theOperator(); + + + }; + + OperatorFunctionIdContext* operatorFunctionId(); + + class LiteralOperatorIdContext : public antlr4::ParserRuleContext { + public: + LiteralOperatorIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Operator(); + antlr4::tree::TerminalNode *StringLiteral(); + antlr4::tree::TerminalNode *Identifier(); + antlr4::tree::TerminalNode *UserDefinedStringLiteral(); + + + }; + + LiteralOperatorIdContext* literalOperatorId(); + + class TemplateDeclarationContext : public antlr4::ParserRuleContext { + public: + TemplateDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Template(); + antlr4::tree::TerminalNode *Less(); + TemplateparameterListContext *templateparameterList(); + antlr4::tree::TerminalNode *Greater(); + DeclarationContext *declaration(); + + + }; + + TemplateDeclarationContext* templateDeclaration(); + + class TemplateparameterListContext : public antlr4::ParserRuleContext { + public: + TemplateparameterListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector templateParameter(); + TemplateParameterContext* templateParameter(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + TemplateparameterListContext* templateparameterList(); + + class TemplateParameterContext : public antlr4::ParserRuleContext { + public: + TemplateParameterContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TypeParameterContext *typeParameter(); + ParameterDeclarationContext *parameterDeclaration(); + + + }; + + TemplateParameterContext* templateParameter(); + + class TypeParameterContext : public antlr4::ParserRuleContext { + public: + TypeParameterContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Class(); + antlr4::tree::TerminalNode *Typename_(); + antlr4::tree::TerminalNode *Assign(); + TheTypeIdContext *theTypeId(); + antlr4::tree::TerminalNode *Template(); + antlr4::tree::TerminalNode *Less(); + TemplateparameterListContext *templateparameterList(); + antlr4::tree::TerminalNode *Greater(); + antlr4::tree::TerminalNode *Ellipsis(); + antlr4::tree::TerminalNode *Identifier(); + + + }; + + TypeParameterContext* typeParameter(); + + class SimpleTemplateIdContext : public antlr4::ParserRuleContext { + public: + SimpleTemplateIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TemplateNameContext *templateName(); + antlr4::tree::TerminalNode *Less(); + antlr4::tree::TerminalNode *Greater(); + TemplateArgumentListContext *templateArgumentList(); + + + }; + + SimpleTemplateIdContext* simpleTemplateId(); + + class TemplateIdContext : public antlr4::ParserRuleContext { + public: + TemplateIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + SimpleTemplateIdContext *simpleTemplateId(); + antlr4::tree::TerminalNode *Less(); + antlr4::tree::TerminalNode *Greater(); + OperatorFunctionIdContext *operatorFunctionId(); + LiteralOperatorIdContext *literalOperatorId(); + TemplateArgumentListContext *templateArgumentList(); + + + }; + + TemplateIdContext* templateId(); + + class TemplateNameContext : public antlr4::ParserRuleContext { + public: + TemplateNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Identifier(); + + + }; + + TemplateNameContext* templateName(); + + class TemplateArgumentListContext : public antlr4::ParserRuleContext { + public: + TemplateArgumentListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector templateArgument(); + TemplateArgumentContext* templateArgument(size_t i); + std::vector Ellipsis(); + antlr4::tree::TerminalNode* Ellipsis(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + TemplateArgumentListContext* templateArgumentList(); + + class TemplateArgumentContext : public antlr4::ParserRuleContext { + public: + TemplateArgumentContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TheTypeIdContext *theTypeId(); + ConstantExpressionContext *constantExpression(); + IdExpressionContext *idExpression(); + + + }; + + TemplateArgumentContext* templateArgument(); + + class TypeNameSpecifierContext : public antlr4::ParserRuleContext { + public: + TypeNameSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Typename_(); + NestedNameSpecifierContext *nestedNameSpecifier(); + antlr4::tree::TerminalNode *Identifier(); + SimpleTemplateIdContext *simpleTemplateId(); + antlr4::tree::TerminalNode *Template(); + + + }; + + TypeNameSpecifierContext* typeNameSpecifier(); + + class ExplicitInstantiationContext : public antlr4::ParserRuleContext { + public: + ExplicitInstantiationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Template(); + DeclarationContext *declaration(); + antlr4::tree::TerminalNode *Extern(); + + + }; + + ExplicitInstantiationContext* explicitInstantiation(); + + class ExplicitSpecializationContext : public antlr4::ParserRuleContext { + public: + ExplicitSpecializationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Template(); + antlr4::tree::TerminalNode *Less(); + antlr4::tree::TerminalNode *Greater(); + DeclarationContext *declaration(); + + + }; + + ExplicitSpecializationContext* explicitSpecialization(); + + class TryBlockContext : public antlr4::ParserRuleContext { + public: + TryBlockContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Try(); + CompoundStatementContext *compoundStatement(); + HandlerSeqContext *handlerSeq(); + + + }; + + TryBlockContext* tryBlock(); + + class FunctionTryBlockContext : public antlr4::ParserRuleContext { + public: + FunctionTryBlockContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Try(); + CompoundStatementContext *compoundStatement(); + HandlerSeqContext *handlerSeq(); + ConstructorInitializerContext *constructorInitializer(); + + + }; + + FunctionTryBlockContext* functionTryBlock(); + + class HandlerSeqContext : public antlr4::ParserRuleContext { + public: + HandlerSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector handler(); + HandlerContext* handler(size_t i); + + + }; + + HandlerSeqContext* handlerSeq(); + + class HandlerContext : public antlr4::ParserRuleContext { + public: + HandlerContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Catch(); + antlr4::tree::TerminalNode *LeftParen(); + ExceptionDeclarationContext *exceptionDeclaration(); + antlr4::tree::TerminalNode *RightParen(); + CompoundStatementContext *compoundStatement(); + + + }; + + HandlerContext* handler(); + + class ExceptionDeclarationContext : public antlr4::ParserRuleContext { + public: + ExceptionDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TypeSpecifierSeqContext *typeSpecifierSeq(); + AttributeSpecifierSeqContext *attributeSpecifierSeq(); + DeclaratorContext *declarator(); + AbstractDeclaratorContext *abstractDeclarator(); + antlr4::tree::TerminalNode *Ellipsis(); + + + }; + + ExceptionDeclarationContext* exceptionDeclaration(); + + class ThrowExpressionContext : public antlr4::ParserRuleContext { + public: + ThrowExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Throw(); + AssignmentExpressionContext *assignmentExpression(); + + + }; + + ThrowExpressionContext* throwExpression(); + + class ExceptionSpecificationContext : public antlr4::ParserRuleContext { + public: + ExceptionSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DynamicExceptionSpecificationContext *dynamicExceptionSpecification(); + NoeExceptSpecificationContext *noeExceptSpecification(); + + + }; + + ExceptionSpecificationContext* exceptionSpecification(); + + class DynamicExceptionSpecificationContext : public antlr4::ParserRuleContext { + public: + DynamicExceptionSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Throw(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + TypeIdListContext *typeIdList(); + + + }; + + DynamicExceptionSpecificationContext* dynamicExceptionSpecification(); + + class TypeIdListContext : public antlr4::ParserRuleContext { + public: + TypeIdListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector theTypeId(); + TheTypeIdContext* theTypeId(size_t i); + std::vector Ellipsis(); + antlr4::tree::TerminalNode* Ellipsis(size_t i); + std::vector Comma(); + antlr4::tree::TerminalNode* Comma(size_t i); + + + }; + + TypeIdListContext* typeIdList(); + + class NoeExceptSpecificationContext : public antlr4::ParserRuleContext { + public: + NoeExceptSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *Noexcept(); + antlr4::tree::TerminalNode *LeftParen(); + ConstantExpressionContext *constantExpression(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + NoeExceptSpecificationContext* noeExceptSpecification(); + + class TheOperatorContext : public antlr4::ParserRuleContext { + public: + TheOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *New(); + antlr4::tree::TerminalNode *LeftBracket(); + antlr4::tree::TerminalNode *RightBracket(); + antlr4::tree::TerminalNode *Delete(); + antlr4::tree::TerminalNode *Plus(); + antlr4::tree::TerminalNode *Minus(); + antlr4::tree::TerminalNode *Star(); + antlr4::tree::TerminalNode *Div(); + antlr4::tree::TerminalNode *Mod(); + antlr4::tree::TerminalNode *Caret(); + antlr4::tree::TerminalNode *And(); + antlr4::tree::TerminalNode *Or(); + antlr4::tree::TerminalNode *Tilde(); + antlr4::tree::TerminalNode *Not(); + antlr4::tree::TerminalNode *Assign(); + std::vector Greater(); + antlr4::tree::TerminalNode* Greater(size_t i); + std::vector Less(); + antlr4::tree::TerminalNode* Less(size_t i); + antlr4::tree::TerminalNode *GreaterEqual(); + antlr4::tree::TerminalNode *PlusAssign(); + antlr4::tree::TerminalNode *MinusAssign(); + antlr4::tree::TerminalNode *StarAssign(); + antlr4::tree::TerminalNode *ModAssign(); + antlr4::tree::TerminalNode *XorAssign(); + antlr4::tree::TerminalNode *AndAssign(); + antlr4::tree::TerminalNode *OrAssign(); + antlr4::tree::TerminalNode *RightShiftAssign(); + antlr4::tree::TerminalNode *LeftShiftAssign(); + antlr4::tree::TerminalNode *Equal(); + antlr4::tree::TerminalNode *NotEqual(); + antlr4::tree::TerminalNode *LessEqual(); + antlr4::tree::TerminalNode *AndAnd(); + antlr4::tree::TerminalNode *OrOr(); + antlr4::tree::TerminalNode *PlusPlus(); + antlr4::tree::TerminalNode *MinusMinus(); + antlr4::tree::TerminalNode *Comma(); + antlr4::tree::TerminalNode *ArrowStar(); + antlr4::tree::TerminalNode *Arrow(); + antlr4::tree::TerminalNode *LeftParen(); + antlr4::tree::TerminalNode *RightParen(); + + + }; + + TheOperatorContext* theOperator(); + + class LiteralContext : public antlr4::ParserRuleContext { + public: + LiteralContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *IntegerLiteral(); + antlr4::tree::TerminalNode *CharacterLiteral(); + antlr4::tree::TerminalNode *FloatingLiteral(); + antlr4::tree::TerminalNode *StringLiteral(); + antlr4::tree::TerminalNode *BooleanLiteral(); + antlr4::tree::TerminalNode *PointerLiteral(); + antlr4::tree::TerminalNode *UserDefinedLiteral(); + + + }; + + LiteralContext* literal(); + + + bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override; + + bool nestedNameSpecifierSempred(NestedNameSpecifierContext *_localctx, size_t predicateIndex); + bool postfixExpressionSempred(PostfixExpressionContext *_localctx, size_t predicateIndex); + bool noPointerNewDeclaratorSempred(NoPointerNewDeclaratorContext *_localctx, size_t predicateIndex); + bool noPointerDeclaratorSempred(NoPointerDeclaratorContext *_localctx, size_t predicateIndex); + bool noPointerAbstractDeclaratorSempred(NoPointerAbstractDeclaratorContext *_localctx, size_t predicateIndex); + bool noPointerAbstractPackDeclaratorSempred(NoPointerAbstractPackDeclaratorContext *_localctx, size_t predicateIndex); + + // By default the static state used to implement the parser is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: +}; + +} // namespace antlrcpptest diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h new file mode 100644 index 0000000..561ba34 --- /dev/null +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +#include "CPP14Lexer.h" +#include "CPP14Parser.h" +#include "IAntlrWrapper.h" +#include "antlr4-runtime.h" + +class MyCppAntlr:IAntlrWrapper { + private: + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; + + public: + MyCppAntlr(std::unique_ptr input, + std::unique_ptr tokenStream, + std::unique_ptr lexer, + std::unique_ptr parser); + + static std::unique_ptr init(std::ifstream &in); + + std::vector getTokens() override; + + // antlr4::tree::ParseTree *getTree(); + std::string getTreeString() override; +}; diff --git a/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp b/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp new file mode 100644 index 0000000..f2c8623 --- /dev/null +++ b/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp @@ -0,0 +1,718 @@ + +// Generated from CPP14Lexer.g4 by ANTLR 4.12.0 + + +#include "CPP14Lexer.h" + + +using namespace antlr4; + +using namespace antlrcpptest; + + +using namespace antlr4; + +namespace { + +struct CPP14LexerStaticData final { + CPP14LexerStaticData(std::vector ruleNames, + std::vector channelNames, + std::vector modeNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)), + modeNames(std::move(modeNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + CPP14LexerStaticData(const CPP14LexerStaticData&) = delete; + CPP14LexerStaticData(CPP14LexerStaticData&&) = delete; + CPP14LexerStaticData& operator=(const CPP14LexerStaticData&) = delete; + CPP14LexerStaticData& operator=(CPP14LexerStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector channelNames; + const std::vector modeNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag cpp14lexerLexerOnceFlag; +CPP14LexerStaticData *cpp14lexerLexerStaticData = nullptr; + +void cpp14lexerLexerInitialize() { + assert(cpp14lexerLexerStaticData == nullptr); + auto staticData = std::make_unique( + std::vector{ + "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", + "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", + "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", + "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", + "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", + "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", + "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", + "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", + "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", + "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", + "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", + "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", + "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", + "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", + "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", + "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", + "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", + "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", + "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", + "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", + "Semi", "Dot", "DotStar", "Ellipsis", "Hexquad", "Universalcharactername", + "Identifier", "Identifiernondigit", "NONDIGIT", "DIGIT", "DecimalLiteral", + "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "NONZERODIGIT", + "OCTALDIGIT", "HEXADECIMALDIGIT", "BINARYDIGIT", "Integersuffix", + "Unsignedsuffix", "Longsuffix", "Longlongsuffix", "Cchar", "Escapesequence", + "Simpleescapesequence", "Octalescapesequence", "Hexadecimalescapesequence", + "Fractionalconstant", "Exponentpart", "SIGN", "Digitsequence", "Floatingsuffix", + "Encodingprefix", "Schar", "Rawstring", "UserDefinedIntegerLiteral", + "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", "UserDefinedCharacterLiteral", + "Udsuffix", "Whitespace", "Newline", "BlockComment", "LineComment" + }, + std::vector{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }, + std::vector{ + "DEFAULT_MODE" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "'alignas'", "'alignof'", + "'asm'", "'auto'", "'bool'", "'break'", "'case'", "'catch'", "'char'", + "'char16_t'", "'char32_t'", "'class'", "'const'", "'constexpr'", "'const_cast'", + "'continue'", "'decltype'", "'default'", "'delete'", "'do'", "'double'", + "'dynamic_cast'", "'else'", "'enum'", "'explicit'", "'export'", "'extern'", + "'false'", "'final'", "'float'", "'for'", "'friend'", "'goto'", "'if'", + "'inline'", "'int'", "'long'", "'mutable'", "'namespace'", "'new'", + "'noexcept'", "'nullptr'", "'operator'", "'override'", "'private'", + "'protected'", "'public'", "'register'", "'reinterpret_cast'", "'return'", + "'short'", "'signed'", "'sizeof'", "'static'", "'static_assert'", + "'static_cast'", "'struct'", "'switch'", "'template'", "'this'", "'thread_local'", + "'throw'", "'true'", "'try'", "'typedef'", "'typeid'", "'typename'", + "'union'", "'unsigned'", "'using'", "'virtual'", "'void'", "'volatile'", + "'wchar_t'", "'while'", "'('", "')'", "'['", "']'", "'{'", "'}'", + "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'&'", "'|'", "'~'", "", + "'='", "'<'", "'>'", "'+='", "'-='", "'*='", "'/='", "'%='", "'^='", + "'&='", "'|='", "'<<='", "'>>='", "'=='", "'!='", "'<='", "'>='", + "", "", "'++'", "'--'", "','", "'->*'", "'->'", "'\\u003F'", "':'", + "'::'", "';'", "'.'", "'.*'", "'...'" + }, + std::vector{ + "", "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", + "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", + "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", + "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", + "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", + "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", + "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", + "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", + "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", + "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", + "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", + "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", + "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", + "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", + "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", + "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", + "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", + "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", + "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", + "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", + "Semi", "Dot", "DotStar", "Ellipsis", "Identifier", "DecimalLiteral", + "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "Integersuffix", + "UserDefinedIntegerLiteral", "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", + "UserDefinedCharacterLiteral", "Whitespace", "Newline", "BlockComment", + "LineComment" + } + ); + static const int32_t serializedATNSegment[] = { + 4,0,145,1460,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, + 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2, + 14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2, + 21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2, + 28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2, + 35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2, + 42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2, + 49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2, + 56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2, + 63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2, + 70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2, + 77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2, + 84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, + 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2, + 98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104, + 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110, + 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116, + 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122, + 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128, + 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134, + 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140, + 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146, + 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152, + 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,2,157,7,157,2,158, + 7,158,2,159,7,159,2,160,7,160,2,161,7,161,2,162,7,162,2,163,7,163,2,164, + 7,164,2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170, + 7,170,1,0,1,0,3,0,346,8,0,1,0,1,0,3,0,350,8,0,1,0,1,0,3,0,354,8,0,1,0, + 1,0,3,0,358,8,0,3,0,360,8,0,1,1,3,1,363,8,1,1,1,1,1,4,1,367,8,1,11,1, + 12,1,368,1,1,1,1,1,2,1,2,3,2,375,8,2,1,2,3,2,378,8,2,1,2,1,2,1,2,3,2, + 383,8,2,3,2,385,8,2,1,3,3,3,388,8,3,1,3,1,3,1,3,5,3,393,8,3,10,3,12,3, + 396,9,3,1,3,3,3,399,8,3,1,4,1,4,3,4,403,8,4,1,5,1,5,1,6,1,6,1,6,1,6,3, + 6,411,8,6,1,7,1,7,5,7,415,8,7,10,7,12,7,418,9,7,1,7,1,7,3,7,422,8,7,1, + 7,4,7,425,8,7,11,7,12,7,426,1,7,4,7,430,8,7,11,7,12,7,431,1,7,1,7,1,8, + 1,8,5,8,438,8,8,10,8,12,8,441,9,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9, + 1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,12, + 1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14, + 1,14,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17, + 1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19, + 1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,21, + 1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22, + 1,22,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,24,1,24, + 1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25, + 1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27, + 1,27,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30, + 1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31, + 1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33, + 1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35, + 1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37, + 1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40, + 1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,43,1,43, + 1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45, + 1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47, + 1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49, + 1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51, + 1,51,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54, + 1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,56,1,56, + 1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,1,57,1,57, + 1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,58,1,58,1,58,1,58, + 1,58,1,58,1,58,1,59,1,59,1,59,1,59,1,59,1,59,1,60,1,60,1,60,1,60,1,60, + 1,60,1,60,1,61,1,61,1,61,1,61,1,61,1,61,1,61,1,62,1,62,1,62,1,62,1,62, + 1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63, + 1,63,1,63,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64, + 1,65,1,65,1,65,1,65,1,65,1,65,1,65,1,66,1,66,1,66,1,66,1,66,1,66,1,66, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,68,1,68,1,68,1,68,1,68, + 1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,70, + 1,70,1,70,1,70,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,72,1,72,1,72,1,72, + 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,74,1,74,1,74,1,74,1,74,1,74, + 1,74,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,76,1,76,1,76,1,76, + 1,76,1,76,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,78,1,78,1,78, + 1,78,1,78,1,78,1,79,1,79,1,79,1,79,1,79,1,79,1,79,1,79,1,80,1,80,1,80, + 1,80,1,80,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,82,1,82,1,82, + 1,82,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,85, + 1,85,1,86,1,86,1,87,1,87,1,88,1,88,1,89,1,89,1,90,1,90,1,91,1,91,1,92, + 1,92,1,93,1,93,1,94,1,94,1,95,1,95,1,96,1,96,1,97,1,97,1,98,1,98,1,99, + 1,99,1,99,1,99,3,99,1029,8,99,1,100,1,100,1,101,1,101,1,102,1,102,1,103, + 1,103,1,103,1,104,1,104,1,104,1,105,1,105,1,105,1,106,1,106,1,106,1,107, + 1,107,1,107,1,108,1,108,1,108,1,109,1,109,1,109,1,110,1,110,1,110,1,111, + 1,111,1,111,1,111,1,112,1,112,1,112,1,112,1,113,1,113,1,113,1,114,1,114, + 1,114,1,115,1,115,1,115,1,116,1,116,1,116,1,117,1,117,1,117,1,117,1,117, + 3,117,1086,8,117,1,118,1,118,1,118,1,118,3,118,1092,8,118,1,119,1,119, + 1,119,1,120,1,120,1,120,1,121,1,121,1,122,1,122,1,122,1,122,1,123,1,123, + 1,123,1,124,1,124,1,125,1,125,1,126,1,126,1,126,1,127,1,127,1,128,1,128, + 1,129,1,129,1,129,1,130,1,130,1,130,1,130,1,131,1,131,1,131,1,131,1,131, + 1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,3,132,1142, + 8,132,1,133,1,133,1,133,5,133,1147,8,133,10,133,12,133,1150,9,133,1,134, + 1,134,3,134,1154,8,134,1,135,1,135,1,136,1,136,1,137,1,137,3,137,1162, + 8,137,1,137,5,137,1165,8,137,10,137,12,137,1168,9,137,1,138,1,138,3,138, + 1172,8,138,1,138,5,138,1175,8,138,10,138,12,138,1178,9,138,1,139,1,139, + 1,139,1,139,3,139,1184,8,139,1,139,1,139,3,139,1188,8,139,1,139,5,139, + 1191,8,139,10,139,12,139,1194,9,139,1,140,1,140,1,140,1,140,3,140,1200, + 8,140,1,140,1,140,3,140,1204,8,140,1,140,5,140,1207,8,140,10,140,12,140, + 1210,9,140,1,141,1,141,1,142,1,142,1,143,1,143,1,144,1,144,1,145,1,145, + 3,145,1222,8,145,1,145,1,145,3,145,1226,8,145,1,145,1,145,3,145,1230, + 8,145,1,145,1,145,3,145,1234,8,145,3,145,1236,8,145,1,146,1,146,1,147, + 1,147,1,148,1,148,1,148,1,148,3,148,1246,8,148,1,149,1,149,1,149,3,149, + 1251,8,149,1,150,1,150,1,150,3,150,1256,8,150,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,3,151,1279,8,151,1,151,3,151,1282,8,151, + 1,151,1,151,1,151,1,151,3,151,1288,8,151,1,152,1,152,1,152,1,152,1,152, + 1,152,1,152,1,152,1,152,1,152,1,152,3,152,1301,8,152,1,153,1,153,1,153, + 1,153,4,153,1307,8,153,11,153,12,153,1308,1,154,3,154,1312,8,154,1,154, + 1,154,1,154,1,154,1,154,3,154,1319,8,154,1,155,1,155,3,155,1323,8,155, + 1,155,1,155,1,155,3,155,1328,8,155,1,155,3,155,1331,8,155,1,156,1,156, + 1,157,1,157,3,157,1337,8,157,1,157,5,157,1340,8,157,10,157,12,157,1343, + 9,157,1,158,1,158,1,159,1,159,1,159,3,159,1350,8,159,1,160,1,160,1,160, + 3,160,1355,8,160,1,161,1,161,1,161,1,161,1,161,1,161,5,161,1363,8,161, + 10,161,12,161,1366,9,161,1,161,1,161,5,161,1370,8,161,10,161,12,161,1373, + 9,161,1,161,1,161,1,161,1,161,5,161,1379,8,161,10,161,12,161,1382,9,161, + 1,161,1,161,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162, + 1,162,1,162,3,162,1398,8,162,1,163,1,163,3,163,1402,8,163,1,163,1,163, + 1,163,1,163,1,163,1,163,3,163,1410,8,163,1,164,1,164,1,164,1,165,1,165, + 1,165,1,166,1,166,1,167,4,167,1421,8,167,11,167,12,167,1422,1,167,1,167, + 1,168,1,168,3,168,1429,8,168,1,168,3,168,1432,8,168,1,168,1,168,1,169, + 1,169,1,169,1,169,5,169,1440,8,169,10,169,12,169,1443,9,169,1,169,1,169, + 1,169,1,169,1,169,1,170,1,170,1,170,1,170,5,170,1454,8,170,10,170,12, + 170,1457,9,170,1,170,1,170,5,416,1364,1371,1380,1441,0,171,1,1,3,2,5, + 3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31, + 16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27, + 55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77, + 39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50, + 101,51,103,52,105,53,107,54,109,55,111,56,113,57,115,58,117,59,119,60, + 121,61,123,62,125,63,127,64,129,65,131,66,133,67,135,68,137,69,139,70, + 141,71,143,72,145,73,147,74,149,75,151,76,153,77,155,78,157,79,159,80, + 161,81,163,82,165,83,167,84,169,85,171,86,173,87,175,88,177,89,179,90, + 181,91,183,92,185,93,187,94,189,95,191,96,193,97,195,98,197,99,199,100, + 201,101,203,102,205,103,207,104,209,105,211,106,213,107,215,108,217,109, + 219,110,221,111,223,112,225,113,227,114,229,115,231,116,233,117,235,118, + 237,119,239,120,241,121,243,122,245,123,247,124,249,125,251,126,253,127, + 255,128,257,129,259,130,261,131,263,0,265,0,267,132,269,0,271,0,273,0, + 275,133,277,134,279,135,281,136,283,0,285,0,287,0,289,0,291,137,293,0, + 295,0,297,0,299,0,301,0,303,0,305,0,307,0,309,0,311,0,313,0,315,0,317, + 0,319,0,321,0,323,0,325,138,327,139,329,140,331,141,333,0,335,142,337, + 143,339,144,341,145,1,0,20,3,0,76,76,85,85,117,117,1,0,10,10,3,0,65,90, + 95,95,97,122,1,0,48,57,1,0,49,57,1,0,48,55,3,0,48,57,65,70,97,102,1,0, + 48,49,2,0,85,85,117,117,2,0,76,76,108,108,4,0,10,10,13,13,39,39,92,92, + 2,0,43,43,45,45,4,0,70,70,76,76,102,102,108,108,4,0,10,10,13,13,34,34, + 92,92,2,0,34,34,40,41,4,0,10,10,13,13,32,32,40,40,1,0,41,41,4,0,10,10, + 13,13,32,32,34,34,2,0,9,9,32,32,2,0,10,10,13,13,1528,0,1,1,0,0,0,0,3, + 1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0, + 0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25, + 1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0, + 0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0, + 0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57, + 1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0, + 0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0, + 0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89, + 1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0, + 0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0, + 0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,0,119,1,0, + 0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0, + 0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0, + 0,0,0,141,1,0,0,0,0,143,1,0,0,0,0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0, + 0,0,0,151,1,0,0,0,0,153,1,0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0, + 0,0,0,161,1,0,0,0,0,163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0, + 0,0,0,171,1,0,0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0, + 0,0,0,181,1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0,0,189,1,0, + 0,0,0,191,1,0,0,0,0,193,1,0,0,0,0,195,1,0,0,0,0,197,1,0,0,0,0,199,1,0, + 0,0,0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0,0,0,0,209,1,0, + 0,0,0,211,1,0,0,0,0,213,1,0,0,0,0,215,1,0,0,0,0,217,1,0,0,0,0,219,1,0, + 0,0,0,221,1,0,0,0,0,223,1,0,0,0,0,225,1,0,0,0,0,227,1,0,0,0,0,229,1,0, + 0,0,0,231,1,0,0,0,0,233,1,0,0,0,0,235,1,0,0,0,0,237,1,0,0,0,0,239,1,0, + 0,0,0,241,1,0,0,0,0,243,1,0,0,0,0,245,1,0,0,0,0,247,1,0,0,0,0,249,1,0, + 0,0,0,251,1,0,0,0,0,253,1,0,0,0,0,255,1,0,0,0,0,257,1,0,0,0,0,259,1,0, + 0,0,0,261,1,0,0,0,0,267,1,0,0,0,0,275,1,0,0,0,0,277,1,0,0,0,0,279,1,0, + 0,0,0,281,1,0,0,0,0,291,1,0,0,0,0,325,1,0,0,0,0,327,1,0,0,0,0,329,1,0, + 0,0,0,331,1,0,0,0,0,335,1,0,0,0,0,337,1,0,0,0,0,339,1,0,0,0,0,341,1,0, + 0,0,1,359,1,0,0,0,3,362,1,0,0,0,5,384,1,0,0,0,7,387,1,0,0,0,9,402,1,0, + 0,0,11,404,1,0,0,0,13,410,1,0,0,0,15,412,1,0,0,0,17,435,1,0,0,0,19,444, + 1,0,0,0,21,452,1,0,0,0,23,460,1,0,0,0,25,464,1,0,0,0,27,469,1,0,0,0,29, + 474,1,0,0,0,31,480,1,0,0,0,33,485,1,0,0,0,35,491,1,0,0,0,37,496,1,0,0, + 0,39,505,1,0,0,0,41,514,1,0,0,0,43,520,1,0,0,0,45,526,1,0,0,0,47,536, + 1,0,0,0,49,547,1,0,0,0,51,556,1,0,0,0,53,565,1,0,0,0,55,573,1,0,0,0,57, + 580,1,0,0,0,59,583,1,0,0,0,61,590,1,0,0,0,63,603,1,0,0,0,65,608,1,0,0, + 0,67,613,1,0,0,0,69,622,1,0,0,0,71,629,1,0,0,0,73,636,1,0,0,0,75,642, + 1,0,0,0,77,648,1,0,0,0,79,654,1,0,0,0,81,658,1,0,0,0,83,665,1,0,0,0,85, + 670,1,0,0,0,87,673,1,0,0,0,89,680,1,0,0,0,91,684,1,0,0,0,93,689,1,0,0, + 0,95,697,1,0,0,0,97,707,1,0,0,0,99,711,1,0,0,0,101,720,1,0,0,0,103,728, + 1,0,0,0,105,737,1,0,0,0,107,746,1,0,0,0,109,754,1,0,0,0,111,764,1,0,0, + 0,113,771,1,0,0,0,115,780,1,0,0,0,117,797,1,0,0,0,119,804,1,0,0,0,121, + 810,1,0,0,0,123,817,1,0,0,0,125,824,1,0,0,0,127,831,1,0,0,0,129,845,1, + 0,0,0,131,857,1,0,0,0,133,864,1,0,0,0,135,871,1,0,0,0,137,880,1,0,0,0, + 139,885,1,0,0,0,141,898,1,0,0,0,143,904,1,0,0,0,145,909,1,0,0,0,147,913, + 1,0,0,0,149,921,1,0,0,0,151,928,1,0,0,0,153,937,1,0,0,0,155,943,1,0,0, + 0,157,952,1,0,0,0,159,958,1,0,0,0,161,966,1,0,0,0,163,971,1,0,0,0,165, + 980,1,0,0,0,167,988,1,0,0,0,169,994,1,0,0,0,171,996,1,0,0,0,173,998,1, + 0,0,0,175,1000,1,0,0,0,177,1002,1,0,0,0,179,1004,1,0,0,0,181,1006,1,0, + 0,0,183,1008,1,0,0,0,185,1010,1,0,0,0,187,1012,1,0,0,0,189,1014,1,0,0, + 0,191,1016,1,0,0,0,193,1018,1,0,0,0,195,1020,1,0,0,0,197,1022,1,0,0,0, + 199,1028,1,0,0,0,201,1030,1,0,0,0,203,1032,1,0,0,0,205,1034,1,0,0,0,207, + 1036,1,0,0,0,209,1039,1,0,0,0,211,1042,1,0,0,0,213,1045,1,0,0,0,215,1048, + 1,0,0,0,217,1051,1,0,0,0,219,1054,1,0,0,0,221,1057,1,0,0,0,223,1060,1, + 0,0,0,225,1064,1,0,0,0,227,1068,1,0,0,0,229,1071,1,0,0,0,231,1074,1,0, + 0,0,233,1077,1,0,0,0,235,1085,1,0,0,0,237,1091,1,0,0,0,239,1093,1,0,0, + 0,241,1096,1,0,0,0,243,1099,1,0,0,0,245,1101,1,0,0,0,247,1105,1,0,0,0, + 249,1108,1,0,0,0,251,1110,1,0,0,0,253,1112,1,0,0,0,255,1115,1,0,0,0,257, + 1117,1,0,0,0,259,1119,1,0,0,0,261,1122,1,0,0,0,263,1126,1,0,0,0,265,1141, + 1,0,0,0,267,1143,1,0,0,0,269,1153,1,0,0,0,271,1155,1,0,0,0,273,1157,1, + 0,0,0,275,1159,1,0,0,0,277,1169,1,0,0,0,279,1183,1,0,0,0,281,1199,1,0, + 0,0,283,1211,1,0,0,0,285,1213,1,0,0,0,287,1215,1,0,0,0,289,1217,1,0,0, + 0,291,1235,1,0,0,0,293,1237,1,0,0,0,295,1239,1,0,0,0,297,1245,1,0,0,0, + 299,1250,1,0,0,0,301,1255,1,0,0,0,303,1287,1,0,0,0,305,1300,1,0,0,0,307, + 1302,1,0,0,0,309,1318,1,0,0,0,311,1330,1,0,0,0,313,1332,1,0,0,0,315,1334, + 1,0,0,0,317,1344,1,0,0,0,319,1349,1,0,0,0,321,1354,1,0,0,0,323,1356,1, + 0,0,0,325,1397,1,0,0,0,327,1409,1,0,0,0,329,1411,1,0,0,0,331,1414,1,0, + 0,0,333,1417,1,0,0,0,335,1420,1,0,0,0,337,1431,1,0,0,0,339,1435,1,0,0, + 0,341,1449,1,0,0,0,343,345,3,275,137,0,344,346,3,291,145,0,345,344,1, + 0,0,0,345,346,1,0,0,0,346,360,1,0,0,0,347,349,3,277,138,0,348,350,3,291, + 145,0,349,348,1,0,0,0,349,350,1,0,0,0,350,360,1,0,0,0,351,353,3,279,139, + 0,352,354,3,291,145,0,353,352,1,0,0,0,353,354,1,0,0,0,354,360,1,0,0,0, + 355,357,3,281,140,0,356,358,3,291,145,0,357,356,1,0,0,0,357,358,1,0,0, + 0,358,360,1,0,0,0,359,343,1,0,0,0,359,347,1,0,0,0,359,351,1,0,0,0,359, + 355,1,0,0,0,360,2,1,0,0,0,361,363,7,0,0,0,362,361,1,0,0,0,362,363,1,0, + 0,0,363,364,1,0,0,0,364,366,5,39,0,0,365,367,3,299,149,0,366,365,1,0, + 0,0,367,368,1,0,0,0,368,366,1,0,0,0,368,369,1,0,0,0,369,370,1,0,0,0,370, + 371,5,39,0,0,371,4,1,0,0,0,372,374,3,309,154,0,373,375,3,311,155,0,374, + 373,1,0,0,0,374,375,1,0,0,0,375,377,1,0,0,0,376,378,3,317,158,0,377,376, + 1,0,0,0,377,378,1,0,0,0,378,385,1,0,0,0,379,380,3,315,157,0,380,382,3, + 311,155,0,381,383,3,317,158,0,382,381,1,0,0,0,382,383,1,0,0,0,383,385, + 1,0,0,0,384,372,1,0,0,0,384,379,1,0,0,0,385,6,1,0,0,0,386,388,3,319,159, + 0,387,386,1,0,0,0,387,388,1,0,0,0,388,398,1,0,0,0,389,399,3,323,161,0, + 390,394,5,34,0,0,391,393,3,321,160,0,392,391,1,0,0,0,393,396,1,0,0,0, + 394,392,1,0,0,0,394,395,1,0,0,0,395,397,1,0,0,0,396,394,1,0,0,0,397,399, + 5,34,0,0,398,389,1,0,0,0,398,390,1,0,0,0,399,8,1,0,0,0,400,403,3,73,36, + 0,401,403,3,143,71,0,402,400,1,0,0,0,402,401,1,0,0,0,403,10,1,0,0,0,404, + 405,3,101,50,0,405,12,1,0,0,0,406,411,3,325,162,0,407,411,3,327,163,0, + 408,411,3,329,164,0,409,411,3,331,165,0,410,406,1,0,0,0,410,407,1,0,0, + 0,410,408,1,0,0,0,410,409,1,0,0,0,411,14,1,0,0,0,412,424,5,35,0,0,413, + 415,8,1,0,0,414,413,1,0,0,0,415,418,1,0,0,0,416,417,1,0,0,0,416,414,1, + 0,0,0,417,419,1,0,0,0,418,416,1,0,0,0,419,421,5,92,0,0,420,422,5,13,0, + 0,421,420,1,0,0,0,421,422,1,0,0,0,422,423,1,0,0,0,423,425,5,10,0,0,424, + 416,1,0,0,0,425,426,1,0,0,0,426,424,1,0,0,0,426,427,1,0,0,0,427,429,1, + 0,0,0,428,430,8,1,0,0,429,428,1,0,0,0,430,431,1,0,0,0,431,429,1,0,0,0, + 431,432,1,0,0,0,432,433,1,0,0,0,433,434,6,7,0,0,434,16,1,0,0,0,435,439, + 5,35,0,0,436,438,8,1,0,0,437,436,1,0,0,0,438,441,1,0,0,0,439,437,1,0, + 0,0,439,440,1,0,0,0,440,442,1,0,0,0,441,439,1,0,0,0,442,443,6,8,0,0,443, + 18,1,0,0,0,444,445,5,97,0,0,445,446,5,108,0,0,446,447,5,105,0,0,447,448, + 5,103,0,0,448,449,5,110,0,0,449,450,5,97,0,0,450,451,5,115,0,0,451,20, + 1,0,0,0,452,453,5,97,0,0,453,454,5,108,0,0,454,455,5,105,0,0,455,456, + 5,103,0,0,456,457,5,110,0,0,457,458,5,111,0,0,458,459,5,102,0,0,459,22, + 1,0,0,0,460,461,5,97,0,0,461,462,5,115,0,0,462,463,5,109,0,0,463,24,1, + 0,0,0,464,465,5,97,0,0,465,466,5,117,0,0,466,467,5,116,0,0,467,468,5, + 111,0,0,468,26,1,0,0,0,469,470,5,98,0,0,470,471,5,111,0,0,471,472,5,111, + 0,0,472,473,5,108,0,0,473,28,1,0,0,0,474,475,5,98,0,0,475,476,5,114,0, + 0,476,477,5,101,0,0,477,478,5,97,0,0,478,479,5,107,0,0,479,30,1,0,0,0, + 480,481,5,99,0,0,481,482,5,97,0,0,482,483,5,115,0,0,483,484,5,101,0,0, + 484,32,1,0,0,0,485,486,5,99,0,0,486,487,5,97,0,0,487,488,5,116,0,0,488, + 489,5,99,0,0,489,490,5,104,0,0,490,34,1,0,0,0,491,492,5,99,0,0,492,493, + 5,104,0,0,493,494,5,97,0,0,494,495,5,114,0,0,495,36,1,0,0,0,496,497,5, + 99,0,0,497,498,5,104,0,0,498,499,5,97,0,0,499,500,5,114,0,0,500,501,5, + 49,0,0,501,502,5,54,0,0,502,503,5,95,0,0,503,504,5,116,0,0,504,38,1,0, + 0,0,505,506,5,99,0,0,506,507,5,104,0,0,507,508,5,97,0,0,508,509,5,114, + 0,0,509,510,5,51,0,0,510,511,5,50,0,0,511,512,5,95,0,0,512,513,5,116, + 0,0,513,40,1,0,0,0,514,515,5,99,0,0,515,516,5,108,0,0,516,517,5,97,0, + 0,517,518,5,115,0,0,518,519,5,115,0,0,519,42,1,0,0,0,520,521,5,99,0,0, + 521,522,5,111,0,0,522,523,5,110,0,0,523,524,5,115,0,0,524,525,5,116,0, + 0,525,44,1,0,0,0,526,527,5,99,0,0,527,528,5,111,0,0,528,529,5,110,0,0, + 529,530,5,115,0,0,530,531,5,116,0,0,531,532,5,101,0,0,532,533,5,120,0, + 0,533,534,5,112,0,0,534,535,5,114,0,0,535,46,1,0,0,0,536,537,5,99,0,0, + 537,538,5,111,0,0,538,539,5,110,0,0,539,540,5,115,0,0,540,541,5,116,0, + 0,541,542,5,95,0,0,542,543,5,99,0,0,543,544,5,97,0,0,544,545,5,115,0, + 0,545,546,5,116,0,0,546,48,1,0,0,0,547,548,5,99,0,0,548,549,5,111,0,0, + 549,550,5,110,0,0,550,551,5,116,0,0,551,552,5,105,0,0,552,553,5,110,0, + 0,553,554,5,117,0,0,554,555,5,101,0,0,555,50,1,0,0,0,556,557,5,100,0, + 0,557,558,5,101,0,0,558,559,5,99,0,0,559,560,5,108,0,0,560,561,5,116, + 0,0,561,562,5,121,0,0,562,563,5,112,0,0,563,564,5,101,0,0,564,52,1,0, + 0,0,565,566,5,100,0,0,566,567,5,101,0,0,567,568,5,102,0,0,568,569,5,97, + 0,0,569,570,5,117,0,0,570,571,5,108,0,0,571,572,5,116,0,0,572,54,1,0, + 0,0,573,574,5,100,0,0,574,575,5,101,0,0,575,576,5,108,0,0,576,577,5,101, + 0,0,577,578,5,116,0,0,578,579,5,101,0,0,579,56,1,0,0,0,580,581,5,100, + 0,0,581,582,5,111,0,0,582,58,1,0,0,0,583,584,5,100,0,0,584,585,5,111, + 0,0,585,586,5,117,0,0,586,587,5,98,0,0,587,588,5,108,0,0,588,589,5,101, + 0,0,589,60,1,0,0,0,590,591,5,100,0,0,591,592,5,121,0,0,592,593,5,110, + 0,0,593,594,5,97,0,0,594,595,5,109,0,0,595,596,5,105,0,0,596,597,5,99, + 0,0,597,598,5,95,0,0,598,599,5,99,0,0,599,600,5,97,0,0,600,601,5,115, + 0,0,601,602,5,116,0,0,602,62,1,0,0,0,603,604,5,101,0,0,604,605,5,108, + 0,0,605,606,5,115,0,0,606,607,5,101,0,0,607,64,1,0,0,0,608,609,5,101, + 0,0,609,610,5,110,0,0,610,611,5,117,0,0,611,612,5,109,0,0,612,66,1,0, + 0,0,613,614,5,101,0,0,614,615,5,120,0,0,615,616,5,112,0,0,616,617,5,108, + 0,0,617,618,5,105,0,0,618,619,5,99,0,0,619,620,5,105,0,0,620,621,5,116, + 0,0,621,68,1,0,0,0,622,623,5,101,0,0,623,624,5,120,0,0,624,625,5,112, + 0,0,625,626,5,111,0,0,626,627,5,114,0,0,627,628,5,116,0,0,628,70,1,0, + 0,0,629,630,5,101,0,0,630,631,5,120,0,0,631,632,5,116,0,0,632,633,5,101, + 0,0,633,634,5,114,0,0,634,635,5,110,0,0,635,72,1,0,0,0,636,637,5,102, + 0,0,637,638,5,97,0,0,638,639,5,108,0,0,639,640,5,115,0,0,640,641,5,101, + 0,0,641,74,1,0,0,0,642,643,5,102,0,0,643,644,5,105,0,0,644,645,5,110, + 0,0,645,646,5,97,0,0,646,647,5,108,0,0,647,76,1,0,0,0,648,649,5,102,0, + 0,649,650,5,108,0,0,650,651,5,111,0,0,651,652,5,97,0,0,652,653,5,116, + 0,0,653,78,1,0,0,0,654,655,5,102,0,0,655,656,5,111,0,0,656,657,5,114, + 0,0,657,80,1,0,0,0,658,659,5,102,0,0,659,660,5,114,0,0,660,661,5,105, + 0,0,661,662,5,101,0,0,662,663,5,110,0,0,663,664,5,100,0,0,664,82,1,0, + 0,0,665,666,5,103,0,0,666,667,5,111,0,0,667,668,5,116,0,0,668,669,5,111, + 0,0,669,84,1,0,0,0,670,671,5,105,0,0,671,672,5,102,0,0,672,86,1,0,0,0, + 673,674,5,105,0,0,674,675,5,110,0,0,675,676,5,108,0,0,676,677,5,105,0, + 0,677,678,5,110,0,0,678,679,5,101,0,0,679,88,1,0,0,0,680,681,5,105,0, + 0,681,682,5,110,0,0,682,683,5,116,0,0,683,90,1,0,0,0,684,685,5,108,0, + 0,685,686,5,111,0,0,686,687,5,110,0,0,687,688,5,103,0,0,688,92,1,0,0, + 0,689,690,5,109,0,0,690,691,5,117,0,0,691,692,5,116,0,0,692,693,5,97, + 0,0,693,694,5,98,0,0,694,695,5,108,0,0,695,696,5,101,0,0,696,94,1,0,0, + 0,697,698,5,110,0,0,698,699,5,97,0,0,699,700,5,109,0,0,700,701,5,101, + 0,0,701,702,5,115,0,0,702,703,5,112,0,0,703,704,5,97,0,0,704,705,5,99, + 0,0,705,706,5,101,0,0,706,96,1,0,0,0,707,708,5,110,0,0,708,709,5,101, + 0,0,709,710,5,119,0,0,710,98,1,0,0,0,711,712,5,110,0,0,712,713,5,111, + 0,0,713,714,5,101,0,0,714,715,5,120,0,0,715,716,5,99,0,0,716,717,5,101, + 0,0,717,718,5,112,0,0,718,719,5,116,0,0,719,100,1,0,0,0,720,721,5,110, + 0,0,721,722,5,117,0,0,722,723,5,108,0,0,723,724,5,108,0,0,724,725,5,112, + 0,0,725,726,5,116,0,0,726,727,5,114,0,0,727,102,1,0,0,0,728,729,5,111, + 0,0,729,730,5,112,0,0,730,731,5,101,0,0,731,732,5,114,0,0,732,733,5,97, + 0,0,733,734,5,116,0,0,734,735,5,111,0,0,735,736,5,114,0,0,736,104,1,0, + 0,0,737,738,5,111,0,0,738,739,5,118,0,0,739,740,5,101,0,0,740,741,5,114, + 0,0,741,742,5,114,0,0,742,743,5,105,0,0,743,744,5,100,0,0,744,745,5,101, + 0,0,745,106,1,0,0,0,746,747,5,112,0,0,747,748,5,114,0,0,748,749,5,105, + 0,0,749,750,5,118,0,0,750,751,5,97,0,0,751,752,5,116,0,0,752,753,5,101, + 0,0,753,108,1,0,0,0,754,755,5,112,0,0,755,756,5,114,0,0,756,757,5,111, + 0,0,757,758,5,116,0,0,758,759,5,101,0,0,759,760,5,99,0,0,760,761,5,116, + 0,0,761,762,5,101,0,0,762,763,5,100,0,0,763,110,1,0,0,0,764,765,5,112, + 0,0,765,766,5,117,0,0,766,767,5,98,0,0,767,768,5,108,0,0,768,769,5,105, + 0,0,769,770,5,99,0,0,770,112,1,0,0,0,771,772,5,114,0,0,772,773,5,101, + 0,0,773,774,5,103,0,0,774,775,5,105,0,0,775,776,5,115,0,0,776,777,5,116, + 0,0,777,778,5,101,0,0,778,779,5,114,0,0,779,114,1,0,0,0,780,781,5,114, + 0,0,781,782,5,101,0,0,782,783,5,105,0,0,783,784,5,110,0,0,784,785,5,116, + 0,0,785,786,5,101,0,0,786,787,5,114,0,0,787,788,5,112,0,0,788,789,5,114, + 0,0,789,790,5,101,0,0,790,791,5,116,0,0,791,792,5,95,0,0,792,793,5,99, + 0,0,793,794,5,97,0,0,794,795,5,115,0,0,795,796,5,116,0,0,796,116,1,0, + 0,0,797,798,5,114,0,0,798,799,5,101,0,0,799,800,5,116,0,0,800,801,5,117, + 0,0,801,802,5,114,0,0,802,803,5,110,0,0,803,118,1,0,0,0,804,805,5,115, + 0,0,805,806,5,104,0,0,806,807,5,111,0,0,807,808,5,114,0,0,808,809,5,116, + 0,0,809,120,1,0,0,0,810,811,5,115,0,0,811,812,5,105,0,0,812,813,5,103, + 0,0,813,814,5,110,0,0,814,815,5,101,0,0,815,816,5,100,0,0,816,122,1,0, + 0,0,817,818,5,115,0,0,818,819,5,105,0,0,819,820,5,122,0,0,820,821,5,101, + 0,0,821,822,5,111,0,0,822,823,5,102,0,0,823,124,1,0,0,0,824,825,5,115, + 0,0,825,826,5,116,0,0,826,827,5,97,0,0,827,828,5,116,0,0,828,829,5,105, + 0,0,829,830,5,99,0,0,830,126,1,0,0,0,831,832,5,115,0,0,832,833,5,116, + 0,0,833,834,5,97,0,0,834,835,5,116,0,0,835,836,5,105,0,0,836,837,5,99, + 0,0,837,838,5,95,0,0,838,839,5,97,0,0,839,840,5,115,0,0,840,841,5,115, + 0,0,841,842,5,101,0,0,842,843,5,114,0,0,843,844,5,116,0,0,844,128,1,0, + 0,0,845,846,5,115,0,0,846,847,5,116,0,0,847,848,5,97,0,0,848,849,5,116, + 0,0,849,850,5,105,0,0,850,851,5,99,0,0,851,852,5,95,0,0,852,853,5,99, + 0,0,853,854,5,97,0,0,854,855,5,115,0,0,855,856,5,116,0,0,856,130,1,0, + 0,0,857,858,5,115,0,0,858,859,5,116,0,0,859,860,5,114,0,0,860,861,5,117, + 0,0,861,862,5,99,0,0,862,863,5,116,0,0,863,132,1,0,0,0,864,865,5,115, + 0,0,865,866,5,119,0,0,866,867,5,105,0,0,867,868,5,116,0,0,868,869,5,99, + 0,0,869,870,5,104,0,0,870,134,1,0,0,0,871,872,5,116,0,0,872,873,5,101, + 0,0,873,874,5,109,0,0,874,875,5,112,0,0,875,876,5,108,0,0,876,877,5,97, + 0,0,877,878,5,116,0,0,878,879,5,101,0,0,879,136,1,0,0,0,880,881,5,116, + 0,0,881,882,5,104,0,0,882,883,5,105,0,0,883,884,5,115,0,0,884,138,1,0, + 0,0,885,886,5,116,0,0,886,887,5,104,0,0,887,888,5,114,0,0,888,889,5,101, + 0,0,889,890,5,97,0,0,890,891,5,100,0,0,891,892,5,95,0,0,892,893,5,108, + 0,0,893,894,5,111,0,0,894,895,5,99,0,0,895,896,5,97,0,0,896,897,5,108, + 0,0,897,140,1,0,0,0,898,899,5,116,0,0,899,900,5,104,0,0,900,901,5,114, + 0,0,901,902,5,111,0,0,902,903,5,119,0,0,903,142,1,0,0,0,904,905,5,116, + 0,0,905,906,5,114,0,0,906,907,5,117,0,0,907,908,5,101,0,0,908,144,1,0, + 0,0,909,910,5,116,0,0,910,911,5,114,0,0,911,912,5,121,0,0,912,146,1,0, + 0,0,913,914,5,116,0,0,914,915,5,121,0,0,915,916,5,112,0,0,916,917,5,101, + 0,0,917,918,5,100,0,0,918,919,5,101,0,0,919,920,5,102,0,0,920,148,1,0, + 0,0,921,922,5,116,0,0,922,923,5,121,0,0,923,924,5,112,0,0,924,925,5,101, + 0,0,925,926,5,105,0,0,926,927,5,100,0,0,927,150,1,0,0,0,928,929,5,116, + 0,0,929,930,5,121,0,0,930,931,5,112,0,0,931,932,5,101,0,0,932,933,5,110, + 0,0,933,934,5,97,0,0,934,935,5,109,0,0,935,936,5,101,0,0,936,152,1,0, + 0,0,937,938,5,117,0,0,938,939,5,110,0,0,939,940,5,105,0,0,940,941,5,111, + 0,0,941,942,5,110,0,0,942,154,1,0,0,0,943,944,5,117,0,0,944,945,5,110, + 0,0,945,946,5,115,0,0,946,947,5,105,0,0,947,948,5,103,0,0,948,949,5,110, + 0,0,949,950,5,101,0,0,950,951,5,100,0,0,951,156,1,0,0,0,952,953,5,117, + 0,0,953,954,5,115,0,0,954,955,5,105,0,0,955,956,5,110,0,0,956,957,5,103, + 0,0,957,158,1,0,0,0,958,959,5,118,0,0,959,960,5,105,0,0,960,961,5,114, + 0,0,961,962,5,116,0,0,962,963,5,117,0,0,963,964,5,97,0,0,964,965,5,108, + 0,0,965,160,1,0,0,0,966,967,5,118,0,0,967,968,5,111,0,0,968,969,5,105, + 0,0,969,970,5,100,0,0,970,162,1,0,0,0,971,972,5,118,0,0,972,973,5,111, + 0,0,973,974,5,108,0,0,974,975,5,97,0,0,975,976,5,116,0,0,976,977,5,105, + 0,0,977,978,5,108,0,0,978,979,5,101,0,0,979,164,1,0,0,0,980,981,5,119, + 0,0,981,982,5,99,0,0,982,983,5,104,0,0,983,984,5,97,0,0,984,985,5,114, + 0,0,985,986,5,95,0,0,986,987,5,116,0,0,987,166,1,0,0,0,988,989,5,119, + 0,0,989,990,5,104,0,0,990,991,5,105,0,0,991,992,5,108,0,0,992,993,5,101, + 0,0,993,168,1,0,0,0,994,995,5,40,0,0,995,170,1,0,0,0,996,997,5,41,0,0, + 997,172,1,0,0,0,998,999,5,91,0,0,999,174,1,0,0,0,1000,1001,5,93,0,0,1001, + 176,1,0,0,0,1002,1003,5,123,0,0,1003,178,1,0,0,0,1004,1005,5,125,0,0, + 1005,180,1,0,0,0,1006,1007,5,43,0,0,1007,182,1,0,0,0,1008,1009,5,45,0, + 0,1009,184,1,0,0,0,1010,1011,5,42,0,0,1011,186,1,0,0,0,1012,1013,5,47, + 0,0,1013,188,1,0,0,0,1014,1015,5,37,0,0,1015,190,1,0,0,0,1016,1017,5, + 94,0,0,1017,192,1,0,0,0,1018,1019,5,38,0,0,1019,194,1,0,0,0,1020,1021, + 5,124,0,0,1021,196,1,0,0,0,1022,1023,5,126,0,0,1023,198,1,0,0,0,1024, + 1029,5,33,0,0,1025,1026,5,110,0,0,1026,1027,5,111,0,0,1027,1029,5,116, + 0,0,1028,1024,1,0,0,0,1028,1025,1,0,0,0,1029,200,1,0,0,0,1030,1031,5, + 61,0,0,1031,202,1,0,0,0,1032,1033,5,60,0,0,1033,204,1,0,0,0,1034,1035, + 5,62,0,0,1035,206,1,0,0,0,1036,1037,5,43,0,0,1037,1038,5,61,0,0,1038, + 208,1,0,0,0,1039,1040,5,45,0,0,1040,1041,5,61,0,0,1041,210,1,0,0,0,1042, + 1043,5,42,0,0,1043,1044,5,61,0,0,1044,212,1,0,0,0,1045,1046,5,47,0,0, + 1046,1047,5,61,0,0,1047,214,1,0,0,0,1048,1049,5,37,0,0,1049,1050,5,61, + 0,0,1050,216,1,0,0,0,1051,1052,5,94,0,0,1052,1053,5,61,0,0,1053,218,1, + 0,0,0,1054,1055,5,38,0,0,1055,1056,5,61,0,0,1056,220,1,0,0,0,1057,1058, + 5,124,0,0,1058,1059,5,61,0,0,1059,222,1,0,0,0,1060,1061,5,60,0,0,1061, + 1062,5,60,0,0,1062,1063,5,61,0,0,1063,224,1,0,0,0,1064,1065,5,62,0,0, + 1065,1066,5,62,0,0,1066,1067,5,61,0,0,1067,226,1,0,0,0,1068,1069,5,61, + 0,0,1069,1070,5,61,0,0,1070,228,1,0,0,0,1071,1072,5,33,0,0,1072,1073, + 5,61,0,0,1073,230,1,0,0,0,1074,1075,5,60,0,0,1075,1076,5,61,0,0,1076, + 232,1,0,0,0,1077,1078,5,62,0,0,1078,1079,5,61,0,0,1079,234,1,0,0,0,1080, + 1081,5,38,0,0,1081,1086,5,38,0,0,1082,1083,5,97,0,0,1083,1084,5,110,0, + 0,1084,1086,5,100,0,0,1085,1080,1,0,0,0,1085,1082,1,0,0,0,1086,236,1, + 0,0,0,1087,1088,5,124,0,0,1088,1092,5,124,0,0,1089,1090,5,111,0,0,1090, + 1092,5,114,0,0,1091,1087,1,0,0,0,1091,1089,1,0,0,0,1092,238,1,0,0,0,1093, + 1094,5,43,0,0,1094,1095,5,43,0,0,1095,240,1,0,0,0,1096,1097,5,45,0,0, + 1097,1098,5,45,0,0,1098,242,1,0,0,0,1099,1100,5,44,0,0,1100,244,1,0,0, + 0,1101,1102,5,45,0,0,1102,1103,5,62,0,0,1103,1104,5,42,0,0,1104,246,1, + 0,0,0,1105,1106,5,45,0,0,1106,1107,5,62,0,0,1107,248,1,0,0,0,1108,1109, + 5,63,0,0,1109,250,1,0,0,0,1110,1111,5,58,0,0,1111,252,1,0,0,0,1112,1113, + 5,58,0,0,1113,1114,5,58,0,0,1114,254,1,0,0,0,1115,1116,5,59,0,0,1116, + 256,1,0,0,0,1117,1118,5,46,0,0,1118,258,1,0,0,0,1119,1120,5,46,0,0,1120, + 1121,5,42,0,0,1121,260,1,0,0,0,1122,1123,5,46,0,0,1123,1124,5,46,0,0, + 1124,1125,5,46,0,0,1125,262,1,0,0,0,1126,1127,3,287,143,0,1127,1128,3, + 287,143,0,1128,1129,3,287,143,0,1129,1130,3,287,143,0,1130,264,1,0,0, + 0,1131,1132,5,92,0,0,1132,1133,5,117,0,0,1133,1134,1,0,0,0,1134,1142, + 3,263,131,0,1135,1136,5,92,0,0,1136,1137,5,85,0,0,1137,1138,1,0,0,0,1138, + 1139,3,263,131,0,1139,1140,3,263,131,0,1140,1142,1,0,0,0,1141,1131,1, + 0,0,0,1141,1135,1,0,0,0,1142,266,1,0,0,0,1143,1148,3,269,134,0,1144,1147, + 3,269,134,0,1145,1147,3,273,136,0,1146,1144,1,0,0,0,1146,1145,1,0,0,0, + 1147,1150,1,0,0,0,1148,1146,1,0,0,0,1148,1149,1,0,0,0,1149,268,1,0,0, + 0,1150,1148,1,0,0,0,1151,1154,3,271,135,0,1152,1154,3,265,132,0,1153, + 1151,1,0,0,0,1153,1152,1,0,0,0,1154,270,1,0,0,0,1155,1156,7,2,0,0,1156, + 272,1,0,0,0,1157,1158,7,3,0,0,1158,274,1,0,0,0,1159,1166,3,283,141,0, + 1160,1162,5,39,0,0,1161,1160,1,0,0,0,1161,1162,1,0,0,0,1162,1163,1,0, + 0,0,1163,1165,3,273,136,0,1164,1161,1,0,0,0,1165,1168,1,0,0,0,1166,1164, + 1,0,0,0,1166,1167,1,0,0,0,1167,276,1,0,0,0,1168,1166,1,0,0,0,1169,1176, + 5,48,0,0,1170,1172,5,39,0,0,1171,1170,1,0,0,0,1171,1172,1,0,0,0,1172, + 1173,1,0,0,0,1173,1175,3,285,142,0,1174,1171,1,0,0,0,1175,1178,1,0,0, + 0,1176,1174,1,0,0,0,1176,1177,1,0,0,0,1177,278,1,0,0,0,1178,1176,1,0, + 0,0,1179,1180,5,48,0,0,1180,1184,5,120,0,0,1181,1182,5,48,0,0,1182,1184, + 5,88,0,0,1183,1179,1,0,0,0,1183,1181,1,0,0,0,1184,1185,1,0,0,0,1185,1192, + 3,287,143,0,1186,1188,5,39,0,0,1187,1186,1,0,0,0,1187,1188,1,0,0,0,1188, + 1189,1,0,0,0,1189,1191,3,287,143,0,1190,1187,1,0,0,0,1191,1194,1,0,0, + 0,1192,1190,1,0,0,0,1192,1193,1,0,0,0,1193,280,1,0,0,0,1194,1192,1,0, + 0,0,1195,1196,5,48,0,0,1196,1200,5,98,0,0,1197,1198,5,48,0,0,1198,1200, + 5,66,0,0,1199,1195,1,0,0,0,1199,1197,1,0,0,0,1200,1201,1,0,0,0,1201,1208, + 3,289,144,0,1202,1204,5,39,0,0,1203,1202,1,0,0,0,1203,1204,1,0,0,0,1204, + 1205,1,0,0,0,1205,1207,3,289,144,0,1206,1203,1,0,0,0,1207,1210,1,0,0, + 0,1208,1206,1,0,0,0,1208,1209,1,0,0,0,1209,282,1,0,0,0,1210,1208,1,0, + 0,0,1211,1212,7,4,0,0,1212,284,1,0,0,0,1213,1214,7,5,0,0,1214,286,1,0, + 0,0,1215,1216,7,6,0,0,1216,288,1,0,0,0,1217,1218,7,7,0,0,1218,290,1,0, + 0,0,1219,1221,3,293,146,0,1220,1222,3,295,147,0,1221,1220,1,0,0,0,1221, + 1222,1,0,0,0,1222,1236,1,0,0,0,1223,1225,3,293,146,0,1224,1226,3,297, + 148,0,1225,1224,1,0,0,0,1225,1226,1,0,0,0,1226,1236,1,0,0,0,1227,1229, + 3,295,147,0,1228,1230,3,293,146,0,1229,1228,1,0,0,0,1229,1230,1,0,0,0, + 1230,1236,1,0,0,0,1231,1233,3,297,148,0,1232,1234,3,293,146,0,1233,1232, + 1,0,0,0,1233,1234,1,0,0,0,1234,1236,1,0,0,0,1235,1219,1,0,0,0,1235,1223, + 1,0,0,0,1235,1227,1,0,0,0,1235,1231,1,0,0,0,1236,292,1,0,0,0,1237,1238, + 7,8,0,0,1238,294,1,0,0,0,1239,1240,7,9,0,0,1240,296,1,0,0,0,1241,1242, + 5,108,0,0,1242,1246,5,108,0,0,1243,1244,5,76,0,0,1244,1246,5,76,0,0,1245, + 1241,1,0,0,0,1245,1243,1,0,0,0,1246,298,1,0,0,0,1247,1251,8,10,0,0,1248, + 1251,3,301,150,0,1249,1251,3,265,132,0,1250,1247,1,0,0,0,1250,1248,1, + 0,0,0,1250,1249,1,0,0,0,1251,300,1,0,0,0,1252,1256,3,303,151,0,1253,1256, + 3,305,152,0,1254,1256,3,307,153,0,1255,1252,1,0,0,0,1255,1253,1,0,0,0, + 1255,1254,1,0,0,0,1256,302,1,0,0,0,1257,1258,5,92,0,0,1258,1288,5,39, + 0,0,1259,1260,5,92,0,0,1260,1288,5,34,0,0,1261,1262,5,92,0,0,1262,1288, + 5,63,0,0,1263,1264,5,92,0,0,1264,1288,5,92,0,0,1265,1266,5,92,0,0,1266, + 1288,5,97,0,0,1267,1268,5,92,0,0,1268,1288,5,98,0,0,1269,1270,5,92,0, + 0,1270,1288,5,102,0,0,1271,1272,5,92,0,0,1272,1288,5,110,0,0,1273,1274, + 5,92,0,0,1274,1288,5,114,0,0,1275,1281,5,92,0,0,1276,1278,5,13,0,0,1277, + 1279,5,10,0,0,1278,1277,1,0,0,0,1278,1279,1,0,0,0,1279,1282,1,0,0,0,1280, + 1282,5,10,0,0,1281,1276,1,0,0,0,1281,1280,1,0,0,0,1282,1288,1,0,0,0,1283, + 1284,5,92,0,0,1284,1288,5,116,0,0,1285,1286,5,92,0,0,1286,1288,5,118, + 0,0,1287,1257,1,0,0,0,1287,1259,1,0,0,0,1287,1261,1,0,0,0,1287,1263,1, + 0,0,0,1287,1265,1,0,0,0,1287,1267,1,0,0,0,1287,1269,1,0,0,0,1287,1271, + 1,0,0,0,1287,1273,1,0,0,0,1287,1275,1,0,0,0,1287,1283,1,0,0,0,1287,1285, + 1,0,0,0,1288,304,1,0,0,0,1289,1290,5,92,0,0,1290,1301,3,285,142,0,1291, + 1292,5,92,0,0,1292,1293,3,285,142,0,1293,1294,3,285,142,0,1294,1301,1, + 0,0,0,1295,1296,5,92,0,0,1296,1297,3,285,142,0,1297,1298,3,285,142,0, + 1298,1299,3,285,142,0,1299,1301,1,0,0,0,1300,1289,1,0,0,0,1300,1291,1, + 0,0,0,1300,1295,1,0,0,0,1301,306,1,0,0,0,1302,1303,5,92,0,0,1303,1304, + 5,120,0,0,1304,1306,1,0,0,0,1305,1307,3,287,143,0,1306,1305,1,0,0,0,1307, + 1308,1,0,0,0,1308,1306,1,0,0,0,1308,1309,1,0,0,0,1309,308,1,0,0,0,1310, + 1312,3,315,157,0,1311,1310,1,0,0,0,1311,1312,1,0,0,0,1312,1313,1,0,0, + 0,1313,1314,5,46,0,0,1314,1319,3,315,157,0,1315,1316,3,315,157,0,1316, + 1317,5,46,0,0,1317,1319,1,0,0,0,1318,1311,1,0,0,0,1318,1315,1,0,0,0,1319, + 310,1,0,0,0,1320,1322,5,101,0,0,1321,1323,3,313,156,0,1322,1321,1,0,0, + 0,1322,1323,1,0,0,0,1323,1324,1,0,0,0,1324,1331,3,315,157,0,1325,1327, + 5,69,0,0,1326,1328,3,313,156,0,1327,1326,1,0,0,0,1327,1328,1,0,0,0,1328, + 1329,1,0,0,0,1329,1331,3,315,157,0,1330,1320,1,0,0,0,1330,1325,1,0,0, + 0,1331,312,1,0,0,0,1332,1333,7,11,0,0,1333,314,1,0,0,0,1334,1341,3,273, + 136,0,1335,1337,5,39,0,0,1336,1335,1,0,0,0,1336,1337,1,0,0,0,1337,1338, + 1,0,0,0,1338,1340,3,273,136,0,1339,1336,1,0,0,0,1340,1343,1,0,0,0,1341, + 1339,1,0,0,0,1341,1342,1,0,0,0,1342,316,1,0,0,0,1343,1341,1,0,0,0,1344, + 1345,7,12,0,0,1345,318,1,0,0,0,1346,1347,5,117,0,0,1347,1350,5,56,0,0, + 1348,1350,7,0,0,0,1349,1346,1,0,0,0,1349,1348,1,0,0,0,1350,320,1,0,0, + 0,1351,1355,8,13,0,0,1352,1355,3,301,150,0,1353,1355,3,265,132,0,1354, + 1351,1,0,0,0,1354,1352,1,0,0,0,1354,1353,1,0,0,0,1355,322,1,0,0,0,1356, + 1357,5,82,0,0,1357,1358,5,34,0,0,1358,1364,1,0,0,0,1359,1360,5,92,0,0, + 1360,1363,7,14,0,0,1361,1363,8,15,0,0,1362,1359,1,0,0,0,1362,1361,1,0, + 0,0,1363,1366,1,0,0,0,1364,1365,1,0,0,0,1364,1362,1,0,0,0,1365,1367,1, + 0,0,0,1366,1364,1,0,0,0,1367,1371,5,40,0,0,1368,1370,8,16,0,0,1369,1368, + 1,0,0,0,1370,1373,1,0,0,0,1371,1372,1,0,0,0,1371,1369,1,0,0,0,1372,1374, + 1,0,0,0,1373,1371,1,0,0,0,1374,1380,5,41,0,0,1375,1376,5,92,0,0,1376, + 1379,7,14,0,0,1377,1379,8,17,0,0,1378,1375,1,0,0,0,1378,1377,1,0,0,0, + 1379,1382,1,0,0,0,1380,1381,1,0,0,0,1380,1378,1,0,0,0,1381,1383,1,0,0, + 0,1382,1380,1,0,0,0,1383,1384,5,34,0,0,1384,324,1,0,0,0,1385,1386,3,275, + 137,0,1386,1387,3,333,166,0,1387,1398,1,0,0,0,1388,1389,3,277,138,0,1389, + 1390,3,333,166,0,1390,1398,1,0,0,0,1391,1392,3,279,139,0,1392,1393,3, + 333,166,0,1393,1398,1,0,0,0,1394,1395,3,281,140,0,1395,1396,3,333,166, + 0,1396,1398,1,0,0,0,1397,1385,1,0,0,0,1397,1388,1,0,0,0,1397,1391,1,0, + 0,0,1397,1394,1,0,0,0,1398,326,1,0,0,0,1399,1401,3,309,154,0,1400,1402, + 3,311,155,0,1401,1400,1,0,0,0,1401,1402,1,0,0,0,1402,1403,1,0,0,0,1403, + 1404,3,333,166,0,1404,1410,1,0,0,0,1405,1406,3,315,157,0,1406,1407,3, + 311,155,0,1407,1408,3,333,166,0,1408,1410,1,0,0,0,1409,1399,1,0,0,0,1409, + 1405,1,0,0,0,1410,328,1,0,0,0,1411,1412,3,7,3,0,1412,1413,3,333,166,0, + 1413,330,1,0,0,0,1414,1415,3,3,1,0,1415,1416,3,333,166,0,1416,332,1,0, + 0,0,1417,1418,3,267,133,0,1418,334,1,0,0,0,1419,1421,7,18,0,0,1420,1419, + 1,0,0,0,1421,1422,1,0,0,0,1422,1420,1,0,0,0,1422,1423,1,0,0,0,1423,1424, + 1,0,0,0,1424,1425,6,167,1,0,1425,336,1,0,0,0,1426,1428,5,13,0,0,1427, + 1429,5,10,0,0,1428,1427,1,0,0,0,1428,1429,1,0,0,0,1429,1432,1,0,0,0,1430, + 1432,5,10,0,0,1431,1426,1,0,0,0,1431,1430,1,0,0,0,1432,1433,1,0,0,0,1433, + 1434,6,168,1,0,1434,338,1,0,0,0,1435,1436,5,47,0,0,1436,1437,5,42,0,0, + 1437,1441,1,0,0,0,1438,1440,9,0,0,0,1439,1438,1,0,0,0,1440,1443,1,0,0, + 0,1441,1442,1,0,0,0,1441,1439,1,0,0,0,1442,1444,1,0,0,0,1443,1441,1,0, + 0,0,1444,1445,5,42,0,0,1445,1446,5,47,0,0,1446,1447,1,0,0,0,1447,1448, + 6,169,1,0,1448,340,1,0,0,0,1449,1450,5,47,0,0,1450,1451,5,47,0,0,1451, + 1455,1,0,0,0,1452,1454,8,19,0,0,1453,1452,1,0,0,0,1454,1457,1,0,0,0,1455, + 1453,1,0,0,0,1455,1456,1,0,0,0,1456,1458,1,0,0,0,1457,1455,1,0,0,0,1458, + 1459,6,170,1,0,1459,342,1,0,0,0,74,0,345,349,353,357,359,362,368,374, + 377,382,384,387,394,398,402,410,416,421,426,431,439,1028,1085,1091,1141, + 1146,1148,1153,1161,1166,1171,1176,1183,1187,1192,1199,1203,1208,1221, + 1225,1229,1233,1235,1245,1250,1255,1278,1281,1287,1300,1308,1311,1318, + 1322,1327,1330,1336,1341,1349,1354,1362,1364,1371,1378,1380,1397,1401, + 1409,1422,1428,1431,1441,1455,2,0,1,0,6,0,0 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + cpp14lexerLexerStaticData = staticData.release(); +} + +} + +CPP14Lexer::CPP14Lexer(CharStream *input) : Lexer(input) { + CPP14Lexer::initialize(); + _interpreter = new atn::LexerATNSimulator(this, *cpp14lexerLexerStaticData->atn, cpp14lexerLexerStaticData->decisionToDFA, cpp14lexerLexerStaticData->sharedContextCache); +} + +CPP14Lexer::~CPP14Lexer() { + delete _interpreter; +} + +std::string CPP14Lexer::getGrammarFileName() const { + return "CPP14Lexer.g4"; +} + +const std::vector& CPP14Lexer::getRuleNames() const { + return cpp14lexerLexerStaticData->ruleNames; +} + +const std::vector& CPP14Lexer::getChannelNames() const { + return cpp14lexerLexerStaticData->channelNames; +} + +const std::vector& CPP14Lexer::getModeNames() const { + return cpp14lexerLexerStaticData->modeNames; +} + +const dfa::Vocabulary& CPP14Lexer::getVocabulary() const { + return cpp14lexerLexerStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView CPP14Lexer::getSerializedATN() const { + return cpp14lexerLexerStaticData->serializedATN; +} + +const atn::ATN& CPP14Lexer::getATN() const { + return *cpp14lexerLexerStaticData->atn; +} + + + + +void CPP14Lexer::initialize() { + ::antlr4::internal::call_once(cpp14lexerLexerOnceFlag, cpp14lexerLexerInitialize); +} diff --git a/server/pkg/antlr/cpp14/src/CPP14Parser.cpp b/server/pkg/antlr/cpp14/src/CPP14Parser.cpp new file mode 100644 index 0000000..87c2060 --- /dev/null +++ b/server/pkg/antlr/cpp14/src/CPP14Parser.cpp @@ -0,0 +1,18169 @@ + +// Generated from CPP14Parser.g4 by ANTLR 4.12.0 + + + +#include "CPP14Parser.h" + + +using namespace antlrcpp; +using namespace antlrcpptest; + +using namespace antlr4; + +namespace { + +struct CPP14ParserStaticData final { + CPP14ParserStaticData(std::vector ruleNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + CPP14ParserStaticData(const CPP14ParserStaticData&) = delete; + CPP14ParserStaticData(CPP14ParserStaticData&&) = delete; + CPP14ParserStaticData& operator=(const CPP14ParserStaticData&) = delete; + CPP14ParserStaticData& operator=(CPP14ParserStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag cpp14parserParserOnceFlag; +CPP14ParserStaticData *cpp14parserParserStaticData = nullptr; + +void cpp14parserParserInitialize() { + assert(cpp14parserParserStaticData == nullptr); + auto staticData = std::make_unique( + std::vector{ + "translationUnit", "primaryExpression", "idExpression", "unqualifiedId", + "qualifiedId", "nestedNameSpecifier", "lambdaExpression", "lambdaIntroducer", + "lambdaCapture", "captureDefault", "captureList", "capture", "simpleCapture", + "initcapture", "lambdaDeclarator", "postfixExpression", "typeIdOfTheTypeId", + "expressionList", "pseudoDestructorName", "unaryExpression", "unaryOperator", + "newExpression", "newPlacement", "newTypeId", "newDeclarator", "noPointerNewDeclarator", + "newInitializer", "deleteExpression", "noExceptExpression", "castExpression", + "pointerMemberExpression", "multiplicativeExpression", "additiveExpression", + "shiftExpression", "shiftOperator", "relationalExpression", "equalityExpression", + "andExpression", "exclusiveOrExpression", "inclusiveOrExpression", + "logicalAndExpression", "logicalOrExpression", "conditionalExpression", + "assignmentExpression", "assignmentOperator", "expression", "constantExpression", + "statement", "labeledStatement", "expressionStatement", "compoundStatement", + "statementSeq", "selectionStatement", "condition", "iterationStatement", + "forInitStatement", "forRangeDeclaration", "forRangeInitializer", + "jumpStatement", "declarationStatement", "declarationseq", "declaration", + "blockDeclaration", "aliasDeclaration", "simpleDeclaration", "staticAssertDeclaration", + "emptyDeclaration", "attributeDeclaration", "declSpecifier", "declSpecifierSeq", + "storageClassSpecifier", "functionSpecifier", "typedefName", "typeSpecifier", + "trailingTypeSpecifier", "typeSpecifierSeq", "trailingTypeSpecifierSeq", + "simpleTypeLengthModifier", "simpleTypeSignednessModifier", "simpleTypeSpecifier", + "theTypeName", "decltypeSpecifier", "elaboratedTypeSpecifier", "enumName", + "enumSpecifier", "enumHead", "opaqueEnumDeclaration", "enumkey", "enumbase", + "enumeratorList", "enumeratorDefinition", "enumerator", "namespaceName", + "originalNamespaceName", "namespaceDefinition", "namespaceAlias", + "namespaceAliasDefinition", "qualifiednamespacespecifier", "usingDeclaration", + "usingDirective", "asmDefinition", "linkageSpecification", "attributeSpecifierSeq", + "attributeSpecifier", "alignmentspecifier", "attributeList", "attribute", + "attributeNamespace", "attributeArgumentClause", "balancedTokenSeq", + "balancedtoken", "initDeclaratorList", "initDeclarator", "declarator", + "pointerDeclarator", "noPointerDeclarator", "parametersAndQualifiers", + "trailingReturnType", "pointerOperator", "cvqualifierseq", "cvQualifier", + "refqualifier", "declaratorid", "theTypeId", "abstractDeclarator", + "pointerAbstractDeclarator", "noPointerAbstractDeclarator", "abstractPackDeclarator", + "noPointerAbstractPackDeclarator", "parameterDeclarationClause", "parameterDeclarationList", + "parameterDeclaration", "functionDefinition", "functionBody", "initializer", + "braceOrEqualInitializer", "initializerClause", "initializerList", + "bracedInitList", "className", "classSpecifier", "classHead", "classHeadName", + "classVirtSpecifier", "classKey", "memberSpecification", "memberdeclaration", + "memberDeclaratorList", "memberDeclarator", "virtualSpecifierSeq", + "virtualSpecifier", "pureSpecifier", "baseClause", "baseSpecifierList", + "baseSpecifier", "classOrDeclType", "baseTypeSpecifier", "accessSpecifier", + "conversionFunctionId", "conversionTypeId", "conversionDeclarator", + "constructorInitializer", "memInitializerList", "memInitializer", + "meminitializerid", "operatorFunctionId", "literalOperatorId", "templateDeclaration", + "templateparameterList", "templateParameter", "typeParameter", "simpleTemplateId", + "templateId", "templateName", "templateArgumentList", "templateArgument", + "typeNameSpecifier", "explicitInstantiation", "explicitSpecialization", + "tryBlock", "functionTryBlock", "handlerSeq", "handler", "exceptionDeclaration", + "throwExpression", "exceptionSpecification", "dynamicExceptionSpecification", + "typeIdList", "noeExceptSpecification", "theOperator", "literal" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "'alignas'", "'alignof'", + "'asm'", "'auto'", "'bool'", "'break'", "'case'", "'catch'", "'char'", + "'char16_t'", "'char32_t'", "'class'", "'const'", "'constexpr'", "'const_cast'", + "'continue'", "'decltype'", "'default'", "'delete'", "'do'", "'double'", + "'dynamic_cast'", "'else'", "'enum'", "'explicit'", "'export'", "'extern'", + "'false'", "'final'", "'float'", "'for'", "'friend'", "'goto'", "'if'", + "'inline'", "'int'", "'long'", "'mutable'", "'namespace'", "'new'", + "'noexcept'", "'nullptr'", "'operator'", "'override'", "'private'", + "'protected'", "'public'", "'register'", "'reinterpret_cast'", "'return'", + "'short'", "'signed'", "'sizeof'", "'static'", "'static_assert'", + "'static_cast'", "'struct'", "'switch'", "'template'", "'this'", "'thread_local'", + "'throw'", "'true'", "'try'", "'typedef'", "'typeid'", "'typename'", + "'union'", "'unsigned'", "'using'", "'virtual'", "'void'", "'volatile'", + "'wchar_t'", "'while'", "'('", "')'", "'['", "']'", "'{'", "'}'", + "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'&'", "'|'", "'~'", "", + "'='", "'<'", "'>'", "'+='", "'-='", "'*='", "'/='", "'%='", "'^='", + "'&='", "'|='", "'<<='", "'>>='", "'=='", "'!='", "'<='", "'>='", + "", "", "'++'", "'--'", "','", "'->*'", "'->'", "'\\u003F'", "':'", + "'::'", "';'", "'.'", "'.*'", "'...'" + }, + std::vector{ + "", "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", + "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", + "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", + "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", + "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", + "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", + "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", + "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", + "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", + "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", + "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", + "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", + "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", + "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", + "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", + "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", + "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", + "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", + "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", + "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", + "Semi", "Dot", "DotStar", "Ellipsis", "Identifier", "DecimalLiteral", + "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "Integersuffix", + "UserDefinedIntegerLiteral", "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", + "UserDefinedCharacterLiteral", "Whitespace", "Newline", "BlockComment", + "LineComment" + } + ); + static const int32_t serializedATNSegment[] = { + 4,1,145,2110,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6, + 2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14, + 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21, + 7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28, + 7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35, + 7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42, + 7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49, + 7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56, + 7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63, + 7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70, + 7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77, + 7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84, + 7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,91, + 7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2,98, + 7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104, + 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110, + 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116, + 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122, + 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128, + 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134, + 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140, + 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146, + 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152, + 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,2,157,7,157,2,158, + 7,158,2,159,7,159,2,160,7,160,2,161,7,161,2,162,7,162,2,163,7,163,2,164, + 7,164,2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170, + 7,170,2,171,7,171,2,172,7,172,2,173,7,173,2,174,7,174,2,175,7,175,2,176, + 7,176,2,177,7,177,2,178,7,178,2,179,7,179,2,180,7,180,2,181,7,181,2,182, + 7,182,2,183,7,183,2,184,7,184,2,185,7,185,2,186,7,186,2,187,7,187,2,188, + 7,188,2,189,7,189,2,190,7,190,1,0,3,0,384,8,0,1,0,1,0,1,1,4,1,389,8,1, + 11,1,12,1,390,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,400,8,1,1,2,1,2,3,2,404, + 8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,413,8,3,1,3,3,3,416,8,3,1,4,1,4,3, + 4,420,8,4,1,4,1,4,1,5,1,5,1,5,1,5,3,5,428,8,5,1,5,1,5,1,5,1,5,1,5,3,5, + 435,8,5,1,5,3,5,438,8,5,1,5,5,5,441,8,5,10,5,12,5,444,9,5,1,6,1,6,3,6, + 448,8,6,1,6,1,6,1,7,1,7,3,7,454,8,7,1,7,1,7,1,8,1,8,1,8,1,8,3,8,462,8, + 8,3,8,464,8,8,1,9,1,9,1,10,1,10,1,10,5,10,471,8,10,10,10,12,10,474,9, + 10,1,10,3,10,477,8,10,1,11,1,11,3,11,481,8,11,1,12,3,12,484,8,12,1,12, + 1,12,3,12,488,8,12,1,13,3,13,491,8,13,1,13,1,13,1,13,1,14,1,14,3,14,498, + 8,14,1,14,1,14,3,14,502,8,14,1,14,3,14,505,8,14,1,14,3,14,508,8,14,1, + 14,3,14,511,8,14,1,15,1,15,1,15,1,15,3,15,517,8,15,1,15,1,15,3,15,521, + 8,15,1,15,1,15,3,15,525,8,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15, + 1,15,1,15,1,15,1,15,3,15,539,8,15,1,15,1,15,3,15,543,8,15,1,15,1,15,1, + 15,1,15,3,15,549,8,15,1,15,1,15,1,15,1,15,1,15,3,15,556,8,15,1,15,1,15, + 1,15,1,15,3,15,562,8,15,1,15,1,15,3,15,566,8,15,1,15,1,15,5,15,570,8, + 15,10,15,12,15,573,9,15,1,16,1,16,1,17,1,17,1,18,3,18,580,8,18,1,18,1, + 18,1,18,3,18,585,8,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,3,18,598,8,18,1,19,1,19,1,19,1,19,1,19,3,19,605,8,19,1,19,1,19, + 1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,617,8,19,1,19,1,19,1,19, + 1,19,1,19,1,19,1,19,1,19,3,19,627,8,19,1,20,1,20,1,21,3,21,632,8,21,1, + 21,1,21,3,21,636,8,21,1,21,1,21,1,21,1,21,1,21,3,21,643,8,21,1,21,3,21, + 646,8,21,1,22,1,22,1,22,1,22,1,23,1,23,3,23,654,8,23,1,24,1,24,3,24,658, + 8,24,1,24,3,24,661,8,24,1,25,1,25,1,25,1,25,1,25,3,25,668,8,25,1,25,1, + 25,1,25,1,25,1,25,3,25,675,8,25,5,25,677,8,25,10,25,12,25,680,9,25,1, + 26,1,26,3,26,684,8,26,1,26,1,26,3,26,688,8,26,1,27,3,27,691,8,27,1,27, + 1,27,1,27,3,27,696,8,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,29,1,29, + 1,29,1,29,1,29,1,29,3,29,711,8,29,1,30,1,30,1,30,5,30,716,8,30,10,30, + 12,30,719,9,30,1,31,1,31,1,31,5,31,724,8,31,10,31,12,31,727,9,31,1,32, + 1,32,1,32,5,32,732,8,32,10,32,12,32,735,9,32,1,33,1,33,1,33,1,33,5,33, + 741,8,33,10,33,12,33,744,9,33,1,34,1,34,1,34,1,34,3,34,750,8,34,1,35, + 1,35,1,35,5,35,755,8,35,10,35,12,35,758,9,35,1,36,1,36,1,36,5,36,763, + 8,36,10,36,12,36,766,9,36,1,37,1,37,1,37,5,37,771,8,37,10,37,12,37,774, + 9,37,1,38,1,38,1,38,5,38,779,8,38,10,38,12,38,782,9,38,1,39,1,39,1,39, + 5,39,787,8,39,10,39,12,39,790,9,39,1,40,1,40,1,40,5,40,795,8,40,10,40, + 12,40,798,9,40,1,41,1,41,1,41,5,41,803,8,41,10,41,12,41,806,9,41,1,42, + 1,42,1,42,1,42,1,42,1,42,3,42,814,8,42,1,43,1,43,1,43,1,43,1,43,1,43, + 3,43,822,8,43,1,44,1,44,1,45,1,45,1,45,5,45,829,8,45,10,45,12,45,832, + 9,45,1,46,1,46,1,47,1,47,1,47,3,47,839,8,47,1,47,1,47,1,47,1,47,1,47, + 1,47,3,47,847,8,47,3,47,849,8,47,1,48,3,48,852,8,48,1,48,1,48,1,48,1, + 48,3,48,858,8,48,1,48,1,48,1,48,1,49,3,49,864,8,49,1,49,1,49,1,50,1,50, + 3,50,870,8,50,1,50,1,50,1,51,4,51,875,8,51,11,51,12,51,876,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,3,52,886,8,52,1,52,1,52,1,52,1,52,1,52,1,52, + 3,52,894,8,52,1,53,1,53,3,53,898,8,53,1,53,1,53,1,53,1,53,1,53,3,53,905, + 8,53,3,53,907,8,53,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54, + 1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,3,54,927,8,54,1,54,1,54,3,54, + 931,8,54,1,54,1,54,1,54,1,54,3,54,937,8,54,1,54,1,54,1,54,3,54,942,8, + 54,1,55,1,55,3,55,946,8,55,1,56,3,56,949,8,56,1,56,1,56,1,56,1,57,1,57, + 3,57,956,8,57,1,58,1,58,1,58,1,58,1,58,3,58,963,8,58,1,58,1,58,3,58,967, + 8,58,1,58,1,58,1,59,1,59,1,60,4,60,974,8,60,11,60,12,60,975,1,61,1,61, + 1,61,1,61,1,61,1,61,1,61,1,61,1,61,3,61,987,8,61,1,62,1,62,1,62,1,62, + 1,62,1,62,1,62,1,62,3,62,997,8,62,1,63,1,63,1,63,3,63,1002,8,63,1,63, + 1,63,1,63,1,63,1,64,3,64,1009,8,64,1,64,3,64,1012,8,64,1,64,1,64,1,64, + 3,64,1017,8,64,1,64,1,64,1,64,3,64,1022,8,64,1,65,1,65,1,65,1,65,1,65, + 1,65,1,65,1,65,1,66,1,66,1,67,1,67,1,67,1,68,1,68,1,68,1,68,1,68,1,68, + 3,68,1043,8,68,1,69,4,69,1046,8,69,11,69,12,69,1047,1,69,3,69,1051,8, + 69,1,70,1,70,1,71,1,71,1,72,1,72,1,73,1,73,1,73,3,73,1062,8,73,1,74,1, + 74,1,74,1,74,3,74,1068,8,74,1,75,4,75,1071,8,75,11,75,12,75,1072,1,75, + 3,75,1076,8,75,1,76,4,76,1079,8,76,11,76,12,76,1080,1,76,3,76,1084,8, + 76,1,77,1,77,1,78,1,78,1,79,3,79,1091,8,79,1,79,1,79,1,79,1,79,1,79,1, + 79,1,79,3,79,1100,8,79,1,79,4,79,1103,8,79,11,79,12,79,1104,1,79,3,79, + 1108,8,79,1,79,1,79,3,79,1112,8,79,1,79,1,79,3,79,1116,8,79,1,79,1,79, + 3,79,1120,8,79,1,79,1,79,1,79,3,79,1125,8,79,1,79,5,79,1128,8,79,10,79, + 12,79,1131,9,79,1,79,1,79,1,79,3,79,1136,8,79,1,79,1,79,1,79,1,79,3,79, + 1142,8,79,1,80,1,80,1,80,1,80,3,80,1148,8,80,1,81,1,81,1,81,1,81,3,81, + 1154,8,81,1,81,1,81,1,82,1,82,3,82,1160,8,82,1,82,3,82,1163,8,82,1,82, + 1,82,1,82,1,82,3,82,1169,8,82,1,82,1,82,3,82,1173,8,82,1,82,1,82,3,82, + 1177,8,82,1,82,3,82,1180,8,82,1,83,1,83,1,84,1,84,1,84,1,84,3,84,1188, + 8,84,3,84,1190,8,84,1,84,1,84,1,85,1,85,3,85,1196,8,85,1,85,3,85,1199, + 8,85,1,85,3,85,1202,8,85,1,85,3,85,1205,8,85,1,86,1,86,3,86,1209,8,86, + 1,86,1,86,3,86,1213,8,86,1,86,1,86,1,87,1,87,3,87,1219,8,87,1,88,1,88, + 1,88,1,89,1,89,1,89,5,89,1227,8,89,10,89,12,89,1230,9,89,1,90,1,90,1, + 90,3,90,1235,8,90,1,91,1,91,1,92,1,92,3,92,1241,8,92,1,93,1,93,1,94,3, + 94,1246,8,94,1,94,1,94,1,94,3,94,1251,8,94,1,94,1,94,3,94,1255,8,94,1, + 94,1,94,1,95,1,95,1,96,1,96,1,96,1,96,1,96,1,96,1,97,3,97,1268,8,97,1, + 97,1,97,1,98,1,98,3,98,1274,8,98,1,98,1,98,3,98,1278,8,98,1,98,1,98,1, + 98,1,99,3,99,1284,8,99,1,99,1,99,1,99,3,99,1289,8,99,1,99,1,99,1,99,1, + 100,1,100,1,100,1,100,1,100,1,100,1,101,1,101,1,101,1,101,3,101,1304, + 8,101,1,101,1,101,3,101,1308,8,101,1,102,4,102,1311,8,102,11,102,12,102, + 1312,1,103,1,103,1,103,3,103,1318,8,103,1,103,1,103,1,103,3,103,1323, + 8,103,1,104,1,104,1,104,1,104,3,104,1329,8,104,1,104,3,104,1332,8,104, + 1,104,1,104,1,105,1,105,1,105,5,105,1339,8,105,10,105,12,105,1342,9,105, + 1,105,3,105,1345,8,105,1,106,1,106,1,106,3,106,1350,8,106,1,106,1,106, + 3,106,1354,8,106,1,107,1,107,1,108,1,108,3,108,1360,8,108,1,108,1,108, + 1,109,4,109,1365,8,109,11,109,12,109,1366,1,110,1,110,1,110,1,110,1,110, + 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,4,110,1382,8,110,11,110, + 12,110,1383,3,110,1386,8,110,1,111,1,111,1,111,5,111,1391,8,111,10,111, + 12,111,1394,9,111,1,112,1,112,3,112,1398,8,112,1,113,1,113,1,113,1,113, + 1,113,3,113,1405,8,113,1,114,1,114,3,114,1409,8,114,5,114,1411,8,114, + 10,114,12,114,1414,9,114,1,114,1,114,1,115,1,115,1,115,3,115,1421,8,115, + 1,115,1,115,1,115,1,115,3,115,1427,8,115,1,115,1,115,1,115,1,115,3,115, + 1433,8,115,1,115,1,115,3,115,1437,8,115,3,115,1439,8,115,5,115,1441,8, + 115,10,115,12,115,1444,9,115,1,116,1,116,3,116,1448,8,116,1,116,1,116, + 3,116,1452,8,116,1,116,3,116,1455,8,116,1,116,3,116,1458,8,116,1,116, + 3,116,1461,8,116,1,117,1,117,1,117,3,117,1466,8,117,1,118,1,118,3,118, + 1470,8,118,1,118,3,118,1473,8,118,1,118,1,118,3,118,1477,8,118,1,118, + 3,118,1480,8,118,3,118,1482,8,118,1,119,4,119,1485,8,119,11,119,12,119, + 1486,1,120,1,120,1,121,1,121,1,122,3,122,1494,8,122,1,122,1,122,1,123, + 1,123,3,123,1500,8,123,1,124,1,124,3,124,1504,8,124,1,124,1,124,1,124, + 1,124,3,124,1510,8,124,1,125,1,125,4,125,1514,8,125,11,125,12,125,1515, + 1,125,3,125,1519,8,125,3,125,1521,8,125,1,126,1,126,1,126,1,126,3,126, + 1527,8,126,1,126,1,126,3,126,1531,8,126,1,126,1,126,1,126,1,126,3,126, + 1537,8,126,1,126,1,126,1,126,1,126,1,126,3,126,1544,8,126,1,126,1,126, + 3,126,1548,8,126,3,126,1550,8,126,5,126,1552,8,126,10,126,12,126,1555, + 9,126,1,127,5,127,1558,8,127,10,127,12,127,1561,9,127,1,127,1,127,1,128, + 1,128,1,128,1,128,1,128,1,128,1,128,3,128,1572,8,128,1,128,1,128,3,128, + 1576,8,128,3,128,1578,8,128,5,128,1580,8,128,10,128,12,128,1583,9,128, + 1,129,1,129,3,129,1587,8,129,1,129,3,129,1590,8,129,1,130,1,130,1,130, + 5,130,1595,8,130,10,130,12,130,1598,9,130,1,131,3,131,1601,8,131,1,131, + 1,131,1,131,3,131,1606,8,131,3,131,1608,8,131,1,131,1,131,3,131,1612, + 8,131,1,132,3,132,1615,8,132,1,132,3,132,1618,8,132,1,132,1,132,3,132, + 1622,8,132,1,132,1,132,1,133,3,133,1627,8,133,1,133,1,133,1,133,1,133, + 1,133,3,133,1634,8,133,1,134,1,134,1,134,1,134,1,134,3,134,1641,8,134, + 1,135,1,135,1,135,3,135,1646,8,135,1,136,1,136,3,136,1650,8,136,1,137, + 1,137,3,137,1654,8,137,1,137,1,137,1,137,3,137,1659,8,137,5,137,1661, + 8,137,10,137,12,137,1664,9,137,1,138,1,138,1,138,3,138,1669,8,138,3,138, + 1671,8,138,1,138,1,138,1,139,1,139,3,139,1677,8,139,1,140,1,140,1,140, + 3,140,1682,8,140,1,140,1,140,1,141,1,141,3,141,1688,8,141,1,141,1,141, + 3,141,1692,8,141,3,141,1694,8,141,1,141,3,141,1697,8,141,1,141,1,141, + 3,141,1701,8,141,1,141,1,141,3,141,1705,8,141,3,141,1707,8,141,3,141, + 1709,8,141,1,142,3,142,1712,8,142,1,142,1,142,1,143,1,143,1,144,1,144, + 1,145,1,145,1,145,1,145,4,145,1724,8,145,11,145,12,145,1725,1,146,3,146, + 1729,8,146,1,146,3,146,1732,8,146,1,146,3,146,1735,8,146,1,146,1,146, + 1,146,1,146,1,146,1,146,1,146,3,146,1744,8,146,1,147,1,147,1,147,5,147, + 1749,8,147,10,147,12,147,1752,9,147,1,148,1,148,3,148,1756,8,148,1,148, + 3,148,1759,8,148,1,148,3,148,1762,8,148,3,148,1764,8,148,1,148,3,148, + 1767,8,148,1,148,3,148,1770,8,148,1,148,1,148,3,148,1774,8,148,1,149, + 4,149,1777,8,149,11,149,12,149,1778,1,150,1,150,1,151,1,151,1,151,1,151, + 1,152,1,152,1,152,1,153,1,153,3,153,1792,8,153,1,153,1,153,1,153,3,153, + 1797,8,153,5,153,1799,8,153,10,153,12,153,1802,9,153,1,154,3,154,1805, + 8,154,1,154,1,154,1,154,3,154,1810,8,154,1,154,1,154,1,154,3,154,1815, + 8,154,1,154,1,154,3,154,1819,8,154,1,155,3,155,1822,8,155,1,155,1,155, + 3,155,1826,8,155,1,156,1,156,1,157,1,157,1,158,1,158,1,158,1,159,1,159, + 3,159,1837,8,159,1,160,1,160,3,160,1841,8,160,1,161,1,161,1,161,1,162, + 1,162,3,162,1848,8,162,1,162,1,162,1,162,3,162,1853,8,162,5,162,1855, + 8,162,10,162,12,162,1858,9,162,1,163,1,163,1,163,3,163,1863,8,163,1,163, + 1,163,3,163,1867,8,163,1,164,1,164,3,164,1871,8,164,1,165,1,165,1,165, + 1,166,1,166,1,166,1,166,3,166,1880,8,166,1,167,1,167,1,167,1,167,1,167, + 1,167,1,168,1,168,1,168,5,168,1891,8,168,10,168,12,168,1894,9,168,1,169, + 1,169,3,169,1898,8,169,1,170,1,170,1,170,1,170,1,170,3,170,1905,8,170, + 1,170,1,170,3,170,1909,8,170,1,170,3,170,1912,8,170,1,170,3,170,1915, + 8,170,1,170,3,170,1918,8,170,1,170,1,170,3,170,1922,8,170,1,171,1,171, + 1,171,3,171,1927,8,171,1,171,1,171,1,172,1,172,1,172,3,172,1934,8,172, + 1,172,1,172,3,172,1938,8,172,1,172,1,172,3,172,1942,8,172,1,173,1,173, + 1,174,1,174,3,174,1948,8,174,1,174,1,174,1,174,3,174,1953,8,174,5,174, + 1955,8,174,10,174,12,174,1958,9,174,1,175,1,175,1,175,3,175,1963,8,175, + 1,176,1,176,1,176,1,176,3,176,1969,8,176,1,176,3,176,1972,8,176,1,177, + 3,177,1975,8,177,1,177,1,177,1,177,1,178,1,178,1,178,1,178,1,178,1,179, + 1,179,1,179,1,179,1,180,1,180,3,180,1991,8,180,1,180,1,180,1,180,1,181, + 4,181,1997,8,181,11,181,12,181,1998,1,182,1,182,1,182,1,182,1,182,1,182, + 1,183,3,183,2008,8,183,1,183,1,183,1,183,3,183,2013,8,183,1,183,3,183, + 2016,8,183,1,184,1,184,3,184,2020,8,184,1,185,1,185,3,185,2024,8,185, + 1,186,1,186,1,186,3,186,2029,8,186,1,186,1,186,1,187,1,187,3,187,2035, + 8,187,1,187,1,187,1,187,3,187,2040,8,187,5,187,2042,8,187,10,187,12,187, + 2045,9,187,1,188,1,188,1,188,1,188,1,188,1,188,3,188,2053,8,188,1,189, + 1,189,1,189,3,189,2058,8,189,1,189,1,189,1,189,3,189,2063,8,189,1,189, + 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, + 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, + 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, + 1,189,1,189,1,189,1,189,3,189,2106,8,189,1,190,1,190,1,190,1,1047,6,10, + 30,50,230,252,256,191,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34, + 36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80, + 82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120, + 122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156, + 158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192, + 194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228, + 230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264, + 266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300, + 302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336, + 338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372, + 374,376,378,380,0,23,2,0,97,97,101,101,4,0,24,24,31,31,58,58,65,65,2, + 0,124,124,129,129,1,0,120,121,2,0,91,93,97,100,2,0,123,123,130,130,1, + 0,93,95,1,0,91,92,2,0,102,103,116,117,1,0,114,115,2,0,101,101,104,113, + 5,0,36,36,47,47,57,57,63,63,70,70,3,0,34,34,44,44,80,80,2,0,46,46,60, + 60,2,0,61,61,78,78,2,0,21,21,66,66,1,0,85,90,2,0,97,97,118,118,2,0,22, + 22,82,82,1,0,27,28,2,0,38,38,53,53,1,0,54,56,1,0,1,7,2343,0,383,1,0,0, + 0,2,399,1,0,0,0,4,403,1,0,0,0,6,415,1,0,0,0,8,417,1,0,0,0,10,423,1,0, + 0,0,12,445,1,0,0,0,14,451,1,0,0,0,16,463,1,0,0,0,18,465,1,0,0,0,20,467, + 1,0,0,0,22,480,1,0,0,0,24,487,1,0,0,0,26,490,1,0,0,0,28,495,1,0,0,0,30, + 542,1,0,0,0,32,574,1,0,0,0,34,576,1,0,0,0,36,597,1,0,0,0,38,626,1,0,0, + 0,40,628,1,0,0,0,42,631,1,0,0,0,44,647,1,0,0,0,46,651,1,0,0,0,48,660, + 1,0,0,0,50,662,1,0,0,0,52,687,1,0,0,0,54,690,1,0,0,0,56,699,1,0,0,0,58, + 710,1,0,0,0,60,712,1,0,0,0,62,720,1,0,0,0,64,728,1,0,0,0,66,736,1,0,0, + 0,68,749,1,0,0,0,70,751,1,0,0,0,72,759,1,0,0,0,74,767,1,0,0,0,76,775, + 1,0,0,0,78,783,1,0,0,0,80,791,1,0,0,0,82,799,1,0,0,0,84,807,1,0,0,0,86, + 821,1,0,0,0,88,823,1,0,0,0,90,825,1,0,0,0,92,833,1,0,0,0,94,848,1,0,0, + 0,96,851,1,0,0,0,98,863,1,0,0,0,100,867,1,0,0,0,102,874,1,0,0,0,104,893, + 1,0,0,0,106,906,1,0,0,0,108,941,1,0,0,0,110,945,1,0,0,0,112,948,1,0,0, + 0,114,955,1,0,0,0,116,966,1,0,0,0,118,970,1,0,0,0,120,973,1,0,0,0,122, + 986,1,0,0,0,124,996,1,0,0,0,126,998,1,0,0,0,128,1021,1,0,0,0,130,1023, + 1,0,0,0,132,1031,1,0,0,0,134,1033,1,0,0,0,136,1042,1,0,0,0,138,1045,1, + 0,0,0,140,1052,1,0,0,0,142,1054,1,0,0,0,144,1056,1,0,0,0,146,1061,1,0, + 0,0,148,1067,1,0,0,0,150,1070,1,0,0,0,152,1078,1,0,0,0,154,1085,1,0,0, + 0,156,1087,1,0,0,0,158,1141,1,0,0,0,160,1147,1,0,0,0,162,1149,1,0,0,0, + 164,1179,1,0,0,0,166,1181,1,0,0,0,168,1183,1,0,0,0,170,1193,1,0,0,0,172, + 1206,1,0,0,0,174,1216,1,0,0,0,176,1220,1,0,0,0,178,1223,1,0,0,0,180,1231, + 1,0,0,0,182,1236,1,0,0,0,184,1240,1,0,0,0,186,1242,1,0,0,0,188,1245,1, + 0,0,0,190,1258,1,0,0,0,192,1260,1,0,0,0,194,1267,1,0,0,0,196,1271,1,0, + 0,0,198,1283,1,0,0,0,200,1293,1,0,0,0,202,1299,1,0,0,0,204,1310,1,0,0, + 0,206,1322,1,0,0,0,208,1324,1,0,0,0,210,1335,1,0,0,0,212,1349,1,0,0,0, + 214,1355,1,0,0,0,216,1357,1,0,0,0,218,1364,1,0,0,0,220,1385,1,0,0,0,222, + 1387,1,0,0,0,224,1395,1,0,0,0,226,1404,1,0,0,0,228,1412,1,0,0,0,230,1426, + 1,0,0,0,232,1445,1,0,0,0,234,1462,1,0,0,0,236,1481,1,0,0,0,238,1484,1, + 0,0,0,240,1488,1,0,0,0,242,1490,1,0,0,0,244,1493,1,0,0,0,246,1497,1,0, + 0,0,248,1509,1,0,0,0,250,1520,1,0,0,0,252,1536,1,0,0,0,254,1559,1,0,0, + 0,256,1564,1,0,0,0,258,1584,1,0,0,0,260,1591,1,0,0,0,262,1600,1,0,0,0, + 264,1614,1,0,0,0,266,1633,1,0,0,0,268,1640,1,0,0,0,270,1645,1,0,0,0,272, + 1649,1,0,0,0,274,1651,1,0,0,0,276,1665,1,0,0,0,278,1676,1,0,0,0,280,1678, + 1,0,0,0,282,1708,1,0,0,0,284,1711,1,0,0,0,286,1715,1,0,0,0,288,1717,1, + 0,0,0,290,1723,1,0,0,0,292,1743,1,0,0,0,294,1745,1,0,0,0,296,1773,1,0, + 0,0,298,1776,1,0,0,0,300,1780,1,0,0,0,302,1782,1,0,0,0,304,1786,1,0,0, + 0,306,1789,1,0,0,0,308,1804,1,0,0,0,310,1825,1,0,0,0,312,1827,1,0,0,0, + 314,1829,1,0,0,0,316,1831,1,0,0,0,318,1834,1,0,0,0,320,1838,1,0,0,0,322, + 1842,1,0,0,0,324,1845,1,0,0,0,326,1859,1,0,0,0,328,1870,1,0,0,0,330,1872, + 1,0,0,0,332,1875,1,0,0,0,334,1881,1,0,0,0,336,1887,1,0,0,0,338,1897,1, + 0,0,0,340,1908,1,0,0,0,342,1923,1,0,0,0,344,1941,1,0,0,0,346,1943,1,0, + 0,0,348,1945,1,0,0,0,350,1962,1,0,0,0,352,1964,1,0,0,0,354,1974,1,0,0, + 0,356,1979,1,0,0,0,358,1984,1,0,0,0,360,1988,1,0,0,0,362,1996,1,0,0,0, + 364,2000,1,0,0,0,366,2015,1,0,0,0,368,2017,1,0,0,0,370,2023,1,0,0,0,372, + 2025,1,0,0,0,374,2032,1,0,0,0,376,2052,1,0,0,0,378,2105,1,0,0,0,380,2107, + 1,0,0,0,382,384,3,120,60,0,383,382,1,0,0,0,383,384,1,0,0,0,384,385,1, + 0,0,0,385,386,5,0,0,1,386,1,1,0,0,0,387,389,3,380,190,0,388,387,1,0,0, + 0,389,390,1,0,0,0,390,388,1,0,0,0,390,391,1,0,0,0,391,400,1,0,0,0,392, + 400,5,69,0,0,393,394,5,85,0,0,394,395,3,90,45,0,395,396,5,86,0,0,396, + 400,1,0,0,0,397,400,3,4,2,0,398,400,3,12,6,0,399,388,1,0,0,0,399,392, + 1,0,0,0,399,393,1,0,0,0,399,397,1,0,0,0,399,398,1,0,0,0,400,3,1,0,0,0, + 401,404,3,6,3,0,402,404,3,8,4,0,403,401,1,0,0,0,403,402,1,0,0,0,404,5, + 1,0,0,0,405,416,5,132,0,0,406,416,3,330,165,0,407,416,3,316,158,0,408, + 416,3,332,166,0,409,412,5,99,0,0,410,413,3,278,139,0,411,413,3,162,81, + 0,412,410,1,0,0,0,412,411,1,0,0,0,413,416,1,0,0,0,414,416,3,344,172,0, + 415,405,1,0,0,0,415,406,1,0,0,0,415,407,1,0,0,0,415,408,1,0,0,0,415,409, + 1,0,0,0,415,414,1,0,0,0,416,7,1,0,0,0,417,419,3,10,5,0,418,420,5,68,0, + 0,419,418,1,0,0,0,419,420,1,0,0,0,420,421,1,0,0,0,421,422,3,6,3,0,422, + 9,1,0,0,0,423,427,6,5,-1,0,424,428,3,160,80,0,425,428,3,184,92,0,426, + 428,3,162,81,0,427,424,1,0,0,0,427,425,1,0,0,0,427,426,1,0,0,0,427,428, + 1,0,0,0,428,429,1,0,0,0,429,430,5,127,0,0,430,442,1,0,0,0,431,437,10, + 1,0,0,432,438,5,132,0,0,433,435,5,68,0,0,434,433,1,0,0,0,434,435,1,0, + 0,0,435,436,1,0,0,0,436,438,3,342,171,0,437,432,1,0,0,0,437,434,1,0,0, + 0,438,439,1,0,0,0,439,441,5,127,0,0,440,431,1,0,0,0,441,444,1,0,0,0,442, + 440,1,0,0,0,442,443,1,0,0,0,443,11,1,0,0,0,444,442,1,0,0,0,445,447,3, + 14,7,0,446,448,3,28,14,0,447,446,1,0,0,0,447,448,1,0,0,0,448,449,1,0, + 0,0,449,450,3,100,50,0,450,13,1,0,0,0,451,453,5,87,0,0,452,454,3,16,8, + 0,453,452,1,0,0,0,453,454,1,0,0,0,454,455,1,0,0,0,455,456,5,88,0,0,456, + 15,1,0,0,0,457,464,3,20,10,0,458,461,3,18,9,0,459,460,5,122,0,0,460,462, + 3,20,10,0,461,459,1,0,0,0,461,462,1,0,0,0,462,464,1,0,0,0,463,457,1,0, + 0,0,463,458,1,0,0,0,464,17,1,0,0,0,465,466,7,0,0,0,466,19,1,0,0,0,467, + 472,3,22,11,0,468,469,5,122,0,0,469,471,3,22,11,0,470,468,1,0,0,0,471, + 474,1,0,0,0,472,470,1,0,0,0,472,473,1,0,0,0,473,476,1,0,0,0,474,472,1, + 0,0,0,475,477,5,131,0,0,476,475,1,0,0,0,476,477,1,0,0,0,477,21,1,0,0, + 0,478,481,3,24,12,0,479,481,3,26,13,0,480,478,1,0,0,0,480,479,1,0,0,0, + 481,23,1,0,0,0,482,484,5,97,0,0,483,482,1,0,0,0,483,484,1,0,0,0,484,485, + 1,0,0,0,485,488,5,132,0,0,486,488,5,69,0,0,487,483,1,0,0,0,487,486,1, + 0,0,0,488,25,1,0,0,0,489,491,5,97,0,0,490,489,1,0,0,0,490,491,1,0,0,0, + 491,492,1,0,0,0,492,493,5,132,0,0,493,494,3,268,134,0,494,27,1,0,0,0, + 495,497,5,85,0,0,496,498,3,258,129,0,497,496,1,0,0,0,497,498,1,0,0,0, + 498,499,1,0,0,0,499,501,5,86,0,0,500,502,5,47,0,0,501,500,1,0,0,0,501, + 502,1,0,0,0,502,504,1,0,0,0,503,505,3,370,185,0,504,503,1,0,0,0,504,505, + 1,0,0,0,505,507,1,0,0,0,506,508,3,204,102,0,507,506,1,0,0,0,507,508,1, + 0,0,0,508,510,1,0,0,0,509,511,3,234,117,0,510,509,1,0,0,0,510,511,1,0, + 0,0,511,29,1,0,0,0,512,513,6,15,-1,0,513,543,3,2,1,0,514,517,3,158,79, + 0,515,517,3,352,176,0,516,514,1,0,0,0,516,515,1,0,0,0,517,524,1,0,0,0, + 518,520,5,85,0,0,519,521,3,34,17,0,520,519,1,0,0,0,520,521,1,0,0,0,521, + 522,1,0,0,0,522,525,5,86,0,0,523,525,3,276,138,0,524,518,1,0,0,0,524, + 523,1,0,0,0,525,543,1,0,0,0,526,527,7,1,0,0,527,528,5,102,0,0,528,529, + 3,246,123,0,529,530,5,103,0,0,530,531,5,85,0,0,531,532,3,90,45,0,532, + 533,5,86,0,0,533,543,1,0,0,0,534,535,3,32,16,0,535,538,5,85,0,0,536,539, + 3,90,45,0,537,539,3,246,123,0,538,536,1,0,0,0,538,537,1,0,0,0,539,540, + 1,0,0,0,540,541,5,86,0,0,541,543,1,0,0,0,542,512,1,0,0,0,542,516,1,0, + 0,0,542,526,1,0,0,0,542,534,1,0,0,0,543,571,1,0,0,0,544,545,10,7,0,0, + 545,548,5,87,0,0,546,549,3,90,45,0,547,549,3,276,138,0,548,546,1,0,0, + 0,548,547,1,0,0,0,549,550,1,0,0,0,550,551,5,88,0,0,551,570,1,0,0,0,552, + 553,10,6,0,0,553,555,5,85,0,0,554,556,3,34,17,0,555,554,1,0,0,0,555,556, + 1,0,0,0,556,557,1,0,0,0,557,570,5,86,0,0,558,559,10,4,0,0,559,565,7,2, + 0,0,560,562,5,68,0,0,561,560,1,0,0,0,561,562,1,0,0,0,562,563,1,0,0,0, + 563,566,3,4,2,0,564,566,3,36,18,0,565,561,1,0,0,0,565,564,1,0,0,0,566, + 570,1,0,0,0,567,568,10,3,0,0,568,570,7,3,0,0,569,544,1,0,0,0,569,552, + 1,0,0,0,569,558,1,0,0,0,569,567,1,0,0,0,570,573,1,0,0,0,571,569,1,0,0, + 0,571,572,1,0,0,0,572,31,1,0,0,0,573,571,1,0,0,0,574,575,5,75,0,0,575, + 33,1,0,0,0,576,577,3,274,137,0,577,35,1,0,0,0,578,580,3,10,5,0,579,578, + 1,0,0,0,579,580,1,0,0,0,580,584,1,0,0,0,581,582,3,160,80,0,582,583,5, + 127,0,0,583,585,1,0,0,0,584,581,1,0,0,0,584,585,1,0,0,0,585,586,1,0,0, + 0,586,587,5,99,0,0,587,598,3,160,80,0,588,589,3,10,5,0,589,590,5,68,0, + 0,590,591,3,342,171,0,591,592,5,127,0,0,592,593,5,99,0,0,593,594,3,160, + 80,0,594,598,1,0,0,0,595,596,5,99,0,0,596,598,3,162,81,0,597,579,1,0, + 0,0,597,588,1,0,0,0,597,595,1,0,0,0,598,37,1,0,0,0,599,627,3,30,15,0, + 600,605,5,120,0,0,601,605,5,121,0,0,602,605,3,40,20,0,603,605,5,62,0, + 0,604,600,1,0,0,0,604,601,1,0,0,0,604,602,1,0,0,0,604,603,1,0,0,0,605, + 606,1,0,0,0,606,627,3,38,19,0,607,616,5,62,0,0,608,609,5,85,0,0,609,610, + 3,246,123,0,610,611,5,86,0,0,611,617,1,0,0,0,612,613,5,131,0,0,613,614, + 5,85,0,0,614,615,5,132,0,0,615,617,5,86,0,0,616,608,1,0,0,0,616,612,1, + 0,0,0,617,627,1,0,0,0,618,619,5,11,0,0,619,620,5,85,0,0,620,621,3,246, + 123,0,621,622,5,86,0,0,622,627,1,0,0,0,623,627,3,56,28,0,624,627,3,42, + 21,0,625,627,3,54,27,0,626,599,1,0,0,0,626,604,1,0,0,0,626,607,1,0,0, + 0,626,618,1,0,0,0,626,623,1,0,0,0,626,624,1,0,0,0,626,625,1,0,0,0,627, + 39,1,0,0,0,628,629,7,4,0,0,629,41,1,0,0,0,630,632,5,127,0,0,631,630,1, + 0,0,0,631,632,1,0,0,0,632,633,1,0,0,0,633,635,5,49,0,0,634,636,3,44,22, + 0,635,634,1,0,0,0,635,636,1,0,0,0,636,642,1,0,0,0,637,643,3,46,23,0,638, + 639,5,85,0,0,639,640,3,246,123,0,640,641,5,86,0,0,641,643,1,0,0,0,642, + 637,1,0,0,0,642,638,1,0,0,0,643,645,1,0,0,0,644,646,3,52,26,0,645,644, + 1,0,0,0,645,646,1,0,0,0,646,43,1,0,0,0,647,648,5,85,0,0,648,649,3,34, + 17,0,649,650,5,86,0,0,650,45,1,0,0,0,651,653,3,150,75,0,652,654,3,48, + 24,0,653,652,1,0,0,0,653,654,1,0,0,0,654,47,1,0,0,0,655,657,3,236,118, + 0,656,658,3,48,24,0,657,656,1,0,0,0,657,658,1,0,0,0,658,661,1,0,0,0,659, + 661,3,50,25,0,660,655,1,0,0,0,660,659,1,0,0,0,661,49,1,0,0,0,662,663, + 6,25,-1,0,663,664,5,87,0,0,664,665,3,90,45,0,665,667,5,88,0,0,666,668, + 3,204,102,0,667,666,1,0,0,0,667,668,1,0,0,0,668,678,1,0,0,0,669,670,10, + 1,0,0,670,671,5,87,0,0,671,672,3,92,46,0,672,674,5,88,0,0,673,675,3,204, + 102,0,674,673,1,0,0,0,674,675,1,0,0,0,675,677,1,0,0,0,676,669,1,0,0,0, + 677,680,1,0,0,0,678,676,1,0,0,0,678,679,1,0,0,0,679,51,1,0,0,0,680,678, + 1,0,0,0,681,683,5,85,0,0,682,684,3,34,17,0,683,682,1,0,0,0,683,684,1, + 0,0,0,684,685,1,0,0,0,685,688,5,86,0,0,686,688,3,276,138,0,687,681,1, + 0,0,0,687,686,1,0,0,0,688,53,1,0,0,0,689,691,5,127,0,0,690,689,1,0,0, + 0,690,691,1,0,0,0,691,692,1,0,0,0,692,695,5,28,0,0,693,694,5,87,0,0,694, + 696,5,88,0,0,695,693,1,0,0,0,695,696,1,0,0,0,696,697,1,0,0,0,697,698, + 3,58,29,0,698,55,1,0,0,0,699,700,5,50,0,0,700,701,5,85,0,0,701,702,3, + 90,45,0,702,703,5,86,0,0,703,57,1,0,0,0,704,711,3,38,19,0,705,706,5,85, + 0,0,706,707,3,246,123,0,707,708,5,86,0,0,708,709,3,58,29,0,709,711,1, + 0,0,0,710,704,1,0,0,0,710,705,1,0,0,0,711,59,1,0,0,0,712,717,3,58,29, + 0,713,714,7,5,0,0,714,716,3,58,29,0,715,713,1,0,0,0,716,719,1,0,0,0,717, + 715,1,0,0,0,717,718,1,0,0,0,718,61,1,0,0,0,719,717,1,0,0,0,720,725,3, + 60,30,0,721,722,7,6,0,0,722,724,3,60,30,0,723,721,1,0,0,0,724,727,1,0, + 0,0,725,723,1,0,0,0,725,726,1,0,0,0,726,63,1,0,0,0,727,725,1,0,0,0,728, + 733,3,62,31,0,729,730,7,7,0,0,730,732,3,62,31,0,731,729,1,0,0,0,732,735, + 1,0,0,0,733,731,1,0,0,0,733,734,1,0,0,0,734,65,1,0,0,0,735,733,1,0,0, + 0,736,742,3,64,32,0,737,738,3,68,34,0,738,739,3,64,32,0,739,741,1,0,0, + 0,740,737,1,0,0,0,741,744,1,0,0,0,742,740,1,0,0,0,742,743,1,0,0,0,743, + 67,1,0,0,0,744,742,1,0,0,0,745,746,5,103,0,0,746,750,5,103,0,0,747,748, + 5,102,0,0,748,750,5,102,0,0,749,745,1,0,0,0,749,747,1,0,0,0,750,69,1, + 0,0,0,751,756,3,66,33,0,752,753,7,8,0,0,753,755,3,66,33,0,754,752,1,0, + 0,0,755,758,1,0,0,0,756,754,1,0,0,0,756,757,1,0,0,0,757,71,1,0,0,0,758, + 756,1,0,0,0,759,764,3,70,35,0,760,761,7,9,0,0,761,763,3,70,35,0,762,760, + 1,0,0,0,763,766,1,0,0,0,764,762,1,0,0,0,764,765,1,0,0,0,765,73,1,0,0, + 0,766,764,1,0,0,0,767,772,3,72,36,0,768,769,5,97,0,0,769,771,3,72,36, + 0,770,768,1,0,0,0,771,774,1,0,0,0,772,770,1,0,0,0,772,773,1,0,0,0,773, + 75,1,0,0,0,774,772,1,0,0,0,775,780,3,74,37,0,776,777,5,96,0,0,777,779, + 3,74,37,0,778,776,1,0,0,0,779,782,1,0,0,0,780,778,1,0,0,0,780,781,1,0, + 0,0,781,77,1,0,0,0,782,780,1,0,0,0,783,788,3,76,38,0,784,785,5,98,0,0, + 785,787,3,76,38,0,786,784,1,0,0,0,787,790,1,0,0,0,788,786,1,0,0,0,788, + 789,1,0,0,0,789,79,1,0,0,0,790,788,1,0,0,0,791,796,3,78,39,0,792,793, + 5,118,0,0,793,795,3,78,39,0,794,792,1,0,0,0,795,798,1,0,0,0,796,794,1, + 0,0,0,796,797,1,0,0,0,797,81,1,0,0,0,798,796,1,0,0,0,799,804,3,80,40, + 0,800,801,5,119,0,0,801,803,3,80,40,0,802,800,1,0,0,0,803,806,1,0,0,0, + 804,802,1,0,0,0,804,805,1,0,0,0,805,83,1,0,0,0,806,804,1,0,0,0,807,813, + 3,82,41,0,808,809,5,125,0,0,809,810,3,90,45,0,810,811,5,126,0,0,811,812, + 3,86,43,0,812,814,1,0,0,0,813,808,1,0,0,0,813,814,1,0,0,0,814,85,1,0, + 0,0,815,822,3,84,42,0,816,817,3,82,41,0,817,818,3,88,44,0,818,819,3,272, + 136,0,819,822,1,0,0,0,820,822,3,368,184,0,821,815,1,0,0,0,821,816,1,0, + 0,0,821,820,1,0,0,0,822,87,1,0,0,0,823,824,7,10,0,0,824,89,1,0,0,0,825, + 830,3,86,43,0,826,827,5,122,0,0,827,829,3,86,43,0,828,826,1,0,0,0,829, + 832,1,0,0,0,830,828,1,0,0,0,830,831,1,0,0,0,831,91,1,0,0,0,832,830,1, + 0,0,0,833,834,3,84,42,0,834,93,1,0,0,0,835,849,3,96,48,0,836,849,3,118, + 59,0,837,839,3,204,102,0,838,837,1,0,0,0,838,839,1,0,0,0,839,846,1,0, + 0,0,840,847,3,98,49,0,841,847,3,100,50,0,842,847,3,104,52,0,843,847,3, + 108,54,0,844,847,3,116,58,0,845,847,3,358,179,0,846,840,1,0,0,0,846,841, + 1,0,0,0,846,842,1,0,0,0,846,843,1,0,0,0,846,844,1,0,0,0,846,845,1,0,0, + 0,847,849,1,0,0,0,848,835,1,0,0,0,848,836,1,0,0,0,848,838,1,0,0,0,849, + 95,1,0,0,0,850,852,3,204,102,0,851,850,1,0,0,0,851,852,1,0,0,0,852,857, + 1,0,0,0,853,858,5,132,0,0,854,855,5,16,0,0,855,858,3,92,46,0,856,858, + 5,27,0,0,857,853,1,0,0,0,857,854,1,0,0,0,857,856,1,0,0,0,858,859,1,0, + 0,0,859,860,5,126,0,0,860,861,3,94,47,0,861,97,1,0,0,0,862,864,3,90,45, + 0,863,862,1,0,0,0,863,864,1,0,0,0,864,865,1,0,0,0,865,866,5,128,0,0,866, + 99,1,0,0,0,867,869,5,89,0,0,868,870,3,102,51,0,869,868,1,0,0,0,869,870, + 1,0,0,0,870,871,1,0,0,0,871,872,5,90,0,0,872,101,1,0,0,0,873,875,3,94, + 47,0,874,873,1,0,0,0,875,876,1,0,0,0,876,874,1,0,0,0,876,877,1,0,0,0, + 877,103,1,0,0,0,878,879,5,43,0,0,879,880,5,85,0,0,880,881,3,106,53,0, + 881,882,5,86,0,0,882,885,3,94,47,0,883,884,5,32,0,0,884,886,3,94,47,0, + 885,883,1,0,0,0,885,886,1,0,0,0,886,894,1,0,0,0,887,888,5,67,0,0,888, + 889,5,85,0,0,889,890,3,106,53,0,890,891,5,86,0,0,891,892,3,94,47,0,892, + 894,1,0,0,0,893,878,1,0,0,0,893,887,1,0,0,0,894,105,1,0,0,0,895,907,3, + 90,45,0,896,898,3,204,102,0,897,896,1,0,0,0,897,898,1,0,0,0,898,899,1, + 0,0,0,899,900,3,138,69,0,900,904,3,226,113,0,901,902,5,101,0,0,902,905, + 3,272,136,0,903,905,3,276,138,0,904,901,1,0,0,0,904,903,1,0,0,0,905,907, + 1,0,0,0,906,895,1,0,0,0,906,897,1,0,0,0,907,107,1,0,0,0,908,909,5,84, + 0,0,909,910,5,85,0,0,910,911,3,106,53,0,911,912,5,86,0,0,912,913,3,94, + 47,0,913,942,1,0,0,0,914,915,5,29,0,0,915,916,3,94,47,0,916,917,5,84, + 0,0,917,918,5,85,0,0,918,919,3,90,45,0,919,920,5,86,0,0,920,921,5,128, + 0,0,921,942,1,0,0,0,922,923,5,40,0,0,923,936,5,85,0,0,924,926,3,110,55, + 0,925,927,3,106,53,0,926,925,1,0,0,0,926,927,1,0,0,0,927,928,1,0,0,0, + 928,930,5,128,0,0,929,931,3,90,45,0,930,929,1,0,0,0,930,931,1,0,0,0,931, + 937,1,0,0,0,932,933,3,112,56,0,933,934,5,126,0,0,934,935,3,114,57,0,935, + 937,1,0,0,0,936,924,1,0,0,0,936,932,1,0,0,0,937,938,1,0,0,0,938,939,5, + 86,0,0,939,940,3,94,47,0,940,942,1,0,0,0,941,908,1,0,0,0,941,914,1,0, + 0,0,941,922,1,0,0,0,942,109,1,0,0,0,943,946,3,98,49,0,944,946,3,128,64, + 0,945,943,1,0,0,0,945,944,1,0,0,0,946,111,1,0,0,0,947,949,3,204,102,0, + 948,947,1,0,0,0,948,949,1,0,0,0,949,950,1,0,0,0,950,951,3,138,69,0,951, + 952,3,226,113,0,952,113,1,0,0,0,953,956,3,90,45,0,954,956,3,276,138,0, + 955,953,1,0,0,0,955,954,1,0,0,0,956,115,1,0,0,0,957,967,5,15,0,0,958, + 967,5,25,0,0,959,962,5,59,0,0,960,963,3,90,45,0,961,963,3,276,138,0,962, + 960,1,0,0,0,962,961,1,0,0,0,962,963,1,0,0,0,963,967,1,0,0,0,964,965,5, + 42,0,0,965,967,5,132,0,0,966,957,1,0,0,0,966,958,1,0,0,0,966,959,1,0, + 0,0,966,964,1,0,0,0,967,968,1,0,0,0,968,969,5,128,0,0,969,117,1,0,0,0, + 970,971,3,124,62,0,971,119,1,0,0,0,972,974,3,122,61,0,973,972,1,0,0,0, + 974,975,1,0,0,0,975,973,1,0,0,0,975,976,1,0,0,0,976,121,1,0,0,0,977,987, + 3,124,62,0,978,987,3,264,132,0,979,987,3,334,167,0,980,987,3,354,177, + 0,981,987,3,356,178,0,982,987,3,202,101,0,983,987,3,188,94,0,984,987, + 3,132,66,0,985,987,3,134,67,0,986,977,1,0,0,0,986,978,1,0,0,0,986,979, + 1,0,0,0,986,980,1,0,0,0,986,981,1,0,0,0,986,982,1,0,0,0,986,983,1,0,0, + 0,986,984,1,0,0,0,986,985,1,0,0,0,987,123,1,0,0,0,988,997,3,128,64,0, + 989,997,3,200,100,0,990,997,3,192,96,0,991,997,3,196,98,0,992,997,3,198, + 99,0,993,997,3,130,65,0,994,997,3,126,63,0,995,997,3,172,86,0,996,988, + 1,0,0,0,996,989,1,0,0,0,996,990,1,0,0,0,996,991,1,0,0,0,996,992,1,0,0, + 0,996,993,1,0,0,0,996,994,1,0,0,0,996,995,1,0,0,0,997,125,1,0,0,0,998, + 999,5,79,0,0,999,1001,5,132,0,0,1000,1002,3,204,102,0,1001,1000,1,0,0, + 0,1001,1002,1,0,0,0,1002,1003,1,0,0,0,1003,1004,5,101,0,0,1004,1005,3, + 246,123,0,1005,1006,5,128,0,0,1006,127,1,0,0,0,1007,1009,3,138,69,0,1008, + 1007,1,0,0,0,1008,1009,1,0,0,0,1009,1011,1,0,0,0,1010,1012,3,222,111, + 0,1011,1010,1,0,0,0,1011,1012,1,0,0,0,1012,1013,1,0,0,0,1013,1022,5,128, + 0,0,1014,1016,3,204,102,0,1015,1017,3,138,69,0,1016,1015,1,0,0,0,1016, + 1017,1,0,0,0,1017,1018,1,0,0,0,1018,1019,3,222,111,0,1019,1020,5,128, + 0,0,1020,1022,1,0,0,0,1021,1008,1,0,0,0,1021,1014,1,0,0,0,1022,129,1, + 0,0,0,1023,1024,5,64,0,0,1024,1025,5,85,0,0,1025,1026,3,92,46,0,1026, + 1027,5,122,0,0,1027,1028,5,4,0,0,1028,1029,5,86,0,0,1029,1030,5,128,0, + 0,1030,131,1,0,0,0,1031,1032,5,128,0,0,1032,133,1,0,0,0,1033,1034,3,204, + 102,0,1034,1035,5,128,0,0,1035,135,1,0,0,0,1036,1043,3,140,70,0,1037, + 1043,3,146,73,0,1038,1043,3,142,71,0,1039,1043,5,41,0,0,1040,1043,5,74, + 0,0,1041,1043,5,23,0,0,1042,1036,1,0,0,0,1042,1037,1,0,0,0,1042,1038, + 1,0,0,0,1042,1039,1,0,0,0,1042,1040,1,0,0,0,1042,1041,1,0,0,0,1043,137, + 1,0,0,0,1044,1046,3,136,68,0,1045,1044,1,0,0,0,1046,1047,1,0,0,0,1047, + 1048,1,0,0,0,1047,1045,1,0,0,0,1048,1050,1,0,0,0,1049,1051,3,204,102, + 0,1050,1049,1,0,0,0,1050,1051,1,0,0,0,1051,139,1,0,0,0,1052,1053,7,11, + 0,0,1053,141,1,0,0,0,1054,1055,7,12,0,0,1055,143,1,0,0,0,1056,1057,5, + 132,0,0,1057,145,1,0,0,0,1058,1062,3,148,74,0,1059,1062,3,280,140,0,1060, + 1062,3,168,84,0,1061,1058,1,0,0,0,1061,1059,1,0,0,0,1061,1060,1,0,0,0, + 1062,147,1,0,0,0,1063,1068,3,158,79,0,1064,1068,3,164,82,0,1065,1068, + 3,352,176,0,1066,1068,3,240,120,0,1067,1063,1,0,0,0,1067,1064,1,0,0,0, + 1067,1065,1,0,0,0,1067,1066,1,0,0,0,1068,149,1,0,0,0,1069,1071,3,146, + 73,0,1070,1069,1,0,0,0,1071,1072,1,0,0,0,1072,1070,1,0,0,0,1072,1073, + 1,0,0,0,1073,1075,1,0,0,0,1074,1076,3,204,102,0,1075,1074,1,0,0,0,1075, + 1076,1,0,0,0,1076,151,1,0,0,0,1077,1079,3,148,74,0,1078,1077,1,0,0,0, + 1079,1080,1,0,0,0,1080,1078,1,0,0,0,1080,1081,1,0,0,0,1081,1083,1,0,0, + 0,1082,1084,3,204,102,0,1083,1082,1,0,0,0,1083,1084,1,0,0,0,1084,153, + 1,0,0,0,1085,1086,7,13,0,0,1086,155,1,0,0,0,1087,1088,7,14,0,0,1088,157, + 1,0,0,0,1089,1091,3,10,5,0,1090,1089,1,0,0,0,1090,1091,1,0,0,0,1091,1092, + 1,0,0,0,1092,1142,3,160,80,0,1093,1094,3,10,5,0,1094,1095,5,68,0,0,1095, + 1096,3,342,171,0,1096,1142,1,0,0,0,1097,1142,3,156,78,0,1098,1100,3,156, + 78,0,1099,1098,1,0,0,0,1099,1100,1,0,0,0,1100,1102,1,0,0,0,1101,1103, + 3,154,77,0,1102,1101,1,0,0,0,1103,1104,1,0,0,0,1104,1102,1,0,0,0,1104, + 1105,1,0,0,0,1105,1142,1,0,0,0,1106,1108,3,156,78,0,1107,1106,1,0,0,0, + 1107,1108,1,0,0,0,1108,1109,1,0,0,0,1109,1142,5,18,0,0,1110,1112,3,156, + 78,0,1111,1110,1,0,0,0,1111,1112,1,0,0,0,1112,1113,1,0,0,0,1113,1142, + 5,19,0,0,1114,1116,3,156,78,0,1115,1114,1,0,0,0,1115,1116,1,0,0,0,1116, + 1117,1,0,0,0,1117,1142,5,20,0,0,1118,1120,3,156,78,0,1119,1118,1,0,0, + 0,1119,1120,1,0,0,0,1120,1121,1,0,0,0,1121,1142,5,83,0,0,1122,1142,5, + 14,0,0,1123,1125,3,156,78,0,1124,1123,1,0,0,0,1124,1125,1,0,0,0,1125, + 1129,1,0,0,0,1126,1128,3,154,77,0,1127,1126,1,0,0,0,1128,1131,1,0,0,0, + 1129,1127,1,0,0,0,1129,1130,1,0,0,0,1130,1132,1,0,0,0,1131,1129,1,0,0, + 0,1132,1142,5,45,0,0,1133,1142,5,39,0,0,1134,1136,3,154,77,0,1135,1134, + 1,0,0,0,1135,1136,1,0,0,0,1136,1137,1,0,0,0,1137,1142,5,30,0,0,1138,1142, + 5,81,0,0,1139,1142,5,13,0,0,1140,1142,3,162,81,0,1141,1090,1,0,0,0,1141, + 1093,1,0,0,0,1141,1097,1,0,0,0,1141,1099,1,0,0,0,1141,1107,1,0,0,0,1141, + 1111,1,0,0,0,1141,1115,1,0,0,0,1141,1119,1,0,0,0,1141,1122,1,0,0,0,1141, + 1124,1,0,0,0,1141,1133,1,0,0,0,1141,1135,1,0,0,0,1141,1138,1,0,0,0,1141, + 1139,1,0,0,0,1141,1140,1,0,0,0,1142,159,1,0,0,0,1143,1148,3,278,139,0, + 1144,1148,3,166,83,0,1145,1148,3,144,72,0,1146,1148,3,342,171,0,1147, + 1143,1,0,0,0,1147,1144,1,0,0,0,1147,1145,1,0,0,0,1147,1146,1,0,0,0,1148, + 161,1,0,0,0,1149,1150,5,26,0,0,1150,1153,5,85,0,0,1151,1154,3,90,45,0, + 1152,1154,5,13,0,0,1153,1151,1,0,0,0,1153,1152,1,0,0,0,1154,1155,1,0, + 0,0,1155,1156,5,86,0,0,1156,163,1,0,0,0,1157,1172,3,288,144,0,1158,1160, + 3,204,102,0,1159,1158,1,0,0,0,1159,1160,1,0,0,0,1160,1162,1,0,0,0,1161, + 1163,3,10,5,0,1162,1161,1,0,0,0,1162,1163,1,0,0,0,1163,1164,1,0,0,0,1164, + 1173,5,132,0,0,1165,1173,3,342,171,0,1166,1168,3,10,5,0,1167,1169,5,68, + 0,0,1168,1167,1,0,0,0,1168,1169,1,0,0,0,1169,1170,1,0,0,0,1170,1171,3, + 342,171,0,1171,1173,1,0,0,0,1172,1159,1,0,0,0,1172,1165,1,0,0,0,1172, + 1166,1,0,0,0,1173,1180,1,0,0,0,1174,1176,5,33,0,0,1175,1177,3,10,5,0, + 1176,1175,1,0,0,0,1176,1177,1,0,0,0,1177,1178,1,0,0,0,1178,1180,5,132, + 0,0,1179,1157,1,0,0,0,1179,1174,1,0,0,0,1180,165,1,0,0,0,1181,1182,5, + 132,0,0,1182,167,1,0,0,0,1183,1184,3,170,85,0,1184,1189,5,89,0,0,1185, + 1187,3,178,89,0,1186,1188,5,122,0,0,1187,1186,1,0,0,0,1187,1188,1,0,0, + 0,1188,1190,1,0,0,0,1189,1185,1,0,0,0,1189,1190,1,0,0,0,1190,1191,1,0, + 0,0,1191,1192,5,90,0,0,1192,169,1,0,0,0,1193,1195,3,174,87,0,1194,1196, + 3,204,102,0,1195,1194,1,0,0,0,1195,1196,1,0,0,0,1196,1201,1,0,0,0,1197, + 1199,3,10,5,0,1198,1197,1,0,0,0,1198,1199,1,0,0,0,1199,1200,1,0,0,0,1200, + 1202,5,132,0,0,1201,1198,1,0,0,0,1201,1202,1,0,0,0,1202,1204,1,0,0,0, + 1203,1205,3,176,88,0,1204,1203,1,0,0,0,1204,1205,1,0,0,0,1205,171,1,0, + 0,0,1206,1208,3,174,87,0,1207,1209,3,204,102,0,1208,1207,1,0,0,0,1208, + 1209,1,0,0,0,1209,1210,1,0,0,0,1210,1212,5,132,0,0,1211,1213,3,176,88, + 0,1212,1211,1,0,0,0,1212,1213,1,0,0,0,1213,1214,1,0,0,0,1214,1215,5,128, + 0,0,1215,173,1,0,0,0,1216,1218,5,33,0,0,1217,1219,7,15,0,0,1218,1217, + 1,0,0,0,1218,1219,1,0,0,0,1219,175,1,0,0,0,1220,1221,5,126,0,0,1221,1222, + 3,150,75,0,1222,177,1,0,0,0,1223,1228,3,180,90,0,1224,1225,5,122,0,0, + 1225,1227,3,180,90,0,1226,1224,1,0,0,0,1227,1230,1,0,0,0,1228,1226,1, + 0,0,0,1228,1229,1,0,0,0,1229,179,1,0,0,0,1230,1228,1,0,0,0,1231,1234, + 3,182,91,0,1232,1233,5,101,0,0,1233,1235,3,92,46,0,1234,1232,1,0,0,0, + 1234,1235,1,0,0,0,1235,181,1,0,0,0,1236,1237,5,132,0,0,1237,183,1,0,0, + 0,1238,1241,3,186,93,0,1239,1241,3,190,95,0,1240,1238,1,0,0,0,1240,1239, + 1,0,0,0,1241,185,1,0,0,0,1242,1243,5,132,0,0,1243,187,1,0,0,0,1244,1246, + 5,44,0,0,1245,1244,1,0,0,0,1245,1246,1,0,0,0,1246,1247,1,0,0,0,1247,1250, + 5,48,0,0,1248,1251,5,132,0,0,1249,1251,3,186,93,0,1250,1248,1,0,0,0,1250, + 1249,1,0,0,0,1250,1251,1,0,0,0,1251,1252,1,0,0,0,1252,1254,5,89,0,0,1253, + 1255,3,120,60,0,1254,1253,1,0,0,0,1254,1255,1,0,0,0,1255,1256,1,0,0,0, + 1256,1257,5,90,0,0,1257,189,1,0,0,0,1258,1259,5,132,0,0,1259,191,1,0, + 0,0,1260,1261,5,48,0,0,1261,1262,5,132,0,0,1262,1263,5,101,0,0,1263,1264, + 3,194,97,0,1264,1265,5,128,0,0,1265,193,1,0,0,0,1266,1268,3,10,5,0,1267, + 1266,1,0,0,0,1267,1268,1,0,0,0,1268,1269,1,0,0,0,1269,1270,3,184,92,0, + 1270,195,1,0,0,0,1271,1277,5,79,0,0,1272,1274,5,76,0,0,1273,1272,1,0, + 0,0,1273,1274,1,0,0,0,1274,1275,1,0,0,0,1275,1278,3,10,5,0,1276,1278, + 5,127,0,0,1277,1273,1,0,0,0,1277,1276,1,0,0,0,1278,1279,1,0,0,0,1279, + 1280,3,6,3,0,1280,1281,5,128,0,0,1281,197,1,0,0,0,1282,1284,3,204,102, + 0,1283,1282,1,0,0,0,1283,1284,1,0,0,0,1284,1285,1,0,0,0,1285,1286,5,79, + 0,0,1286,1288,5,48,0,0,1287,1289,3,10,5,0,1288,1287,1,0,0,0,1288,1289, + 1,0,0,0,1289,1290,1,0,0,0,1290,1291,3,184,92,0,1291,1292,5,128,0,0,1292, + 199,1,0,0,0,1293,1294,5,12,0,0,1294,1295,5,85,0,0,1295,1296,5,4,0,0,1296, + 1297,5,86,0,0,1297,1298,5,128,0,0,1298,201,1,0,0,0,1299,1300,5,36,0,0, + 1300,1307,5,4,0,0,1301,1303,5,89,0,0,1302,1304,3,120,60,0,1303,1302,1, + 0,0,0,1303,1304,1,0,0,0,1304,1305,1,0,0,0,1305,1308,5,90,0,0,1306,1308, + 3,122,61,0,1307,1301,1,0,0,0,1307,1306,1,0,0,0,1308,203,1,0,0,0,1309, + 1311,3,206,103,0,1310,1309,1,0,0,0,1311,1312,1,0,0,0,1312,1310,1,0,0, + 0,1312,1313,1,0,0,0,1313,205,1,0,0,0,1314,1315,5,87,0,0,1315,1317,5,87, + 0,0,1316,1318,3,210,105,0,1317,1316,1,0,0,0,1317,1318,1,0,0,0,1318,1319, + 1,0,0,0,1319,1320,5,88,0,0,1320,1323,5,88,0,0,1321,1323,3,208,104,0,1322, + 1314,1,0,0,0,1322,1321,1,0,0,0,1323,207,1,0,0,0,1324,1325,5,10,0,0,1325, + 1328,5,85,0,0,1326,1329,3,246,123,0,1327,1329,3,92,46,0,1328,1326,1,0, + 0,0,1328,1327,1,0,0,0,1329,1331,1,0,0,0,1330,1332,5,131,0,0,1331,1330, + 1,0,0,0,1331,1332,1,0,0,0,1332,1333,1,0,0,0,1333,1334,5,86,0,0,1334,209, + 1,0,0,0,1335,1340,3,212,106,0,1336,1337,5,122,0,0,1337,1339,3,212,106, + 0,1338,1336,1,0,0,0,1339,1342,1,0,0,0,1340,1338,1,0,0,0,1340,1341,1,0, + 0,0,1341,1344,1,0,0,0,1342,1340,1,0,0,0,1343,1345,5,131,0,0,1344,1343, + 1,0,0,0,1344,1345,1,0,0,0,1345,211,1,0,0,0,1346,1347,3,214,107,0,1347, + 1348,5,127,0,0,1348,1350,1,0,0,0,1349,1346,1,0,0,0,1349,1350,1,0,0,0, + 1350,1351,1,0,0,0,1351,1353,5,132,0,0,1352,1354,3,216,108,0,1353,1352, + 1,0,0,0,1353,1354,1,0,0,0,1354,213,1,0,0,0,1355,1356,5,132,0,0,1356,215, + 1,0,0,0,1357,1359,5,85,0,0,1358,1360,3,218,109,0,1359,1358,1,0,0,0,1359, + 1360,1,0,0,0,1360,1361,1,0,0,0,1361,1362,5,86,0,0,1362,217,1,0,0,0,1363, + 1365,3,220,110,0,1364,1363,1,0,0,0,1365,1366,1,0,0,0,1366,1364,1,0,0, + 0,1366,1367,1,0,0,0,1367,219,1,0,0,0,1368,1369,5,85,0,0,1369,1370,3,218, + 109,0,1370,1371,5,86,0,0,1371,1386,1,0,0,0,1372,1373,5,87,0,0,1373,1374, + 3,218,109,0,1374,1375,5,88,0,0,1375,1386,1,0,0,0,1376,1377,5,89,0,0,1377, + 1378,3,218,109,0,1378,1379,5,90,0,0,1379,1386,1,0,0,0,1380,1382,8,16, + 0,0,1381,1380,1,0,0,0,1382,1383,1,0,0,0,1383,1381,1,0,0,0,1383,1384,1, + 0,0,0,1384,1386,1,0,0,0,1385,1368,1,0,0,0,1385,1372,1,0,0,0,1385,1376, + 1,0,0,0,1385,1381,1,0,0,0,1386,221,1,0,0,0,1387,1392,3,224,112,0,1388, + 1389,5,122,0,0,1389,1391,3,224,112,0,1390,1388,1,0,0,0,1391,1394,1,0, + 0,0,1392,1390,1,0,0,0,1392,1393,1,0,0,0,1393,223,1,0,0,0,1394,1392,1, + 0,0,0,1395,1397,3,226,113,0,1396,1398,3,268,134,0,1397,1396,1,0,0,0,1397, + 1398,1,0,0,0,1398,225,1,0,0,0,1399,1405,3,228,114,0,1400,1401,3,230,115, + 0,1401,1402,3,232,116,0,1402,1403,3,234,117,0,1403,1405,1,0,0,0,1404, + 1399,1,0,0,0,1404,1400,1,0,0,0,1405,227,1,0,0,0,1406,1408,3,236,118,0, + 1407,1409,5,22,0,0,1408,1407,1,0,0,0,1408,1409,1,0,0,0,1409,1411,1,0, + 0,0,1410,1406,1,0,0,0,1411,1414,1,0,0,0,1412,1410,1,0,0,0,1412,1413,1, + 0,0,0,1413,1415,1,0,0,0,1414,1412,1,0,0,0,1415,1416,3,230,115,0,1416, + 229,1,0,0,0,1417,1418,6,115,-1,0,1418,1420,3,244,122,0,1419,1421,3,204, + 102,0,1420,1419,1,0,0,0,1420,1421,1,0,0,0,1421,1427,1,0,0,0,1422,1423, + 5,85,0,0,1423,1424,3,228,114,0,1424,1425,5,86,0,0,1425,1427,1,0,0,0,1426, + 1417,1,0,0,0,1426,1422,1,0,0,0,1427,1442,1,0,0,0,1428,1438,10,2,0,0,1429, + 1439,3,232,116,0,1430,1432,5,87,0,0,1431,1433,3,92,46,0,1432,1431,1,0, + 0,0,1432,1433,1,0,0,0,1433,1434,1,0,0,0,1434,1436,5,88,0,0,1435,1437, + 3,204,102,0,1436,1435,1,0,0,0,1436,1437,1,0,0,0,1437,1439,1,0,0,0,1438, + 1429,1,0,0,0,1438,1430,1,0,0,0,1439,1441,1,0,0,0,1440,1428,1,0,0,0,1441, + 1444,1,0,0,0,1442,1440,1,0,0,0,1442,1443,1,0,0,0,1443,231,1,0,0,0,1444, + 1442,1,0,0,0,1445,1447,5,85,0,0,1446,1448,3,258,129,0,1447,1446,1,0,0, + 0,1447,1448,1,0,0,0,1448,1449,1,0,0,0,1449,1451,5,86,0,0,1450,1452,3, + 238,119,0,1451,1450,1,0,0,0,1451,1452,1,0,0,0,1452,1454,1,0,0,0,1453, + 1455,3,242,121,0,1454,1453,1,0,0,0,1454,1455,1,0,0,0,1455,1457,1,0,0, + 0,1456,1458,3,370,185,0,1457,1456,1,0,0,0,1457,1458,1,0,0,0,1458,1460, + 1,0,0,0,1459,1461,3,204,102,0,1460,1459,1,0,0,0,1460,1461,1,0,0,0,1461, + 233,1,0,0,0,1462,1463,5,124,0,0,1463,1465,3,152,76,0,1464,1466,3,248, + 124,0,1465,1464,1,0,0,0,1465,1466,1,0,0,0,1466,235,1,0,0,0,1467,1469, + 7,17,0,0,1468,1470,3,204,102,0,1469,1468,1,0,0,0,1469,1470,1,0,0,0,1470, + 1482,1,0,0,0,1471,1473,3,10,5,0,1472,1471,1,0,0,0,1472,1473,1,0,0,0,1473, + 1474,1,0,0,0,1474,1476,5,93,0,0,1475,1477,3,204,102,0,1476,1475,1,0,0, + 0,1476,1477,1,0,0,0,1477,1479,1,0,0,0,1478,1480,3,238,119,0,1479,1478, + 1,0,0,0,1479,1480,1,0,0,0,1480,1482,1,0,0,0,1481,1467,1,0,0,0,1481,1472, + 1,0,0,0,1482,237,1,0,0,0,1483,1485,3,240,120,0,1484,1483,1,0,0,0,1485, + 1486,1,0,0,0,1486,1484,1,0,0,0,1486,1487,1,0,0,0,1487,239,1,0,0,0,1488, + 1489,7,18,0,0,1489,241,1,0,0,0,1490,1491,7,17,0,0,1491,243,1,0,0,0,1492, + 1494,5,131,0,0,1493,1492,1,0,0,0,1493,1494,1,0,0,0,1494,1495,1,0,0,0, + 1495,1496,3,4,2,0,1496,245,1,0,0,0,1497,1499,3,150,75,0,1498,1500,3,248, + 124,0,1499,1498,1,0,0,0,1499,1500,1,0,0,0,1500,247,1,0,0,0,1501,1510, + 3,250,125,0,1502,1504,3,252,126,0,1503,1502,1,0,0,0,1503,1504,1,0,0,0, + 1504,1505,1,0,0,0,1505,1506,3,232,116,0,1506,1507,3,234,117,0,1507,1510, + 1,0,0,0,1508,1510,3,254,127,0,1509,1501,1,0,0,0,1509,1503,1,0,0,0,1509, + 1508,1,0,0,0,1510,249,1,0,0,0,1511,1521,3,252,126,0,1512,1514,3,236,118, + 0,1513,1512,1,0,0,0,1514,1515,1,0,0,0,1515,1513,1,0,0,0,1515,1516,1,0, + 0,0,1516,1518,1,0,0,0,1517,1519,3,252,126,0,1518,1517,1,0,0,0,1518,1519, + 1,0,0,0,1519,1521,1,0,0,0,1520,1511,1,0,0,0,1520,1513,1,0,0,0,1521,251, + 1,0,0,0,1522,1523,6,126,-1,0,1523,1537,3,232,116,0,1524,1526,5,87,0,0, + 1525,1527,3,92,46,0,1526,1525,1,0,0,0,1526,1527,1,0,0,0,1527,1528,1,0, + 0,0,1528,1530,5,88,0,0,1529,1531,3,204,102,0,1530,1529,1,0,0,0,1530,1531, + 1,0,0,0,1531,1537,1,0,0,0,1532,1533,5,85,0,0,1533,1534,3,250,125,0,1534, + 1535,5,86,0,0,1535,1537,1,0,0,0,1536,1522,1,0,0,0,1536,1524,1,0,0,0,1536, + 1532,1,0,0,0,1537,1553,1,0,0,0,1538,1549,10,4,0,0,1539,1550,3,232,116, + 0,1540,1541,3,252,126,0,1541,1543,5,87,0,0,1542,1544,3,92,46,0,1543,1542, + 1,0,0,0,1543,1544,1,0,0,0,1544,1545,1,0,0,0,1545,1547,5,88,0,0,1546,1548, + 3,204,102,0,1547,1546,1,0,0,0,1547,1548,1,0,0,0,1548,1550,1,0,0,0,1549, + 1539,1,0,0,0,1549,1540,1,0,0,0,1550,1552,1,0,0,0,1551,1538,1,0,0,0,1552, + 1555,1,0,0,0,1553,1551,1,0,0,0,1553,1554,1,0,0,0,1554,253,1,0,0,0,1555, + 1553,1,0,0,0,1556,1558,3,236,118,0,1557,1556,1,0,0,0,1558,1561,1,0,0, + 0,1559,1557,1,0,0,0,1559,1560,1,0,0,0,1560,1562,1,0,0,0,1561,1559,1,0, + 0,0,1562,1563,3,256,128,0,1563,255,1,0,0,0,1564,1565,6,128,-1,0,1565, + 1566,5,131,0,0,1566,1581,1,0,0,0,1567,1577,10,2,0,0,1568,1578,3,232,116, + 0,1569,1571,5,87,0,0,1570,1572,3,92,46,0,1571,1570,1,0,0,0,1571,1572, + 1,0,0,0,1572,1573,1,0,0,0,1573,1575,5,88,0,0,1574,1576,3,204,102,0,1575, + 1574,1,0,0,0,1575,1576,1,0,0,0,1576,1578,1,0,0,0,1577,1568,1,0,0,0,1577, + 1569,1,0,0,0,1578,1580,1,0,0,0,1579,1567,1,0,0,0,1580,1583,1,0,0,0,1581, + 1579,1,0,0,0,1581,1582,1,0,0,0,1582,257,1,0,0,0,1583,1581,1,0,0,0,1584, + 1589,3,260,130,0,1585,1587,5,122,0,0,1586,1585,1,0,0,0,1586,1587,1,0, + 0,0,1587,1588,1,0,0,0,1588,1590,5,131,0,0,1589,1586,1,0,0,0,1589,1590, + 1,0,0,0,1590,259,1,0,0,0,1591,1596,3,262,131,0,1592,1593,5,122,0,0,1593, + 1595,3,262,131,0,1594,1592,1,0,0,0,1595,1598,1,0,0,0,1596,1594,1,0,0, + 0,1596,1597,1,0,0,0,1597,261,1,0,0,0,1598,1596,1,0,0,0,1599,1601,3,204, + 102,0,1600,1599,1,0,0,0,1600,1601,1,0,0,0,1601,1602,1,0,0,0,1602,1607, + 3,138,69,0,1603,1608,3,226,113,0,1604,1606,3,248,124,0,1605,1604,1,0, + 0,0,1605,1606,1,0,0,0,1606,1608,1,0,0,0,1607,1603,1,0,0,0,1607,1605,1, + 0,0,0,1608,1611,1,0,0,0,1609,1610,5,101,0,0,1610,1612,3,272,136,0,1611, + 1609,1,0,0,0,1611,1612,1,0,0,0,1612,263,1,0,0,0,1613,1615,3,204,102,0, + 1614,1613,1,0,0,0,1614,1615,1,0,0,0,1615,1617,1,0,0,0,1616,1618,3,138, + 69,0,1617,1616,1,0,0,0,1617,1618,1,0,0,0,1618,1619,1,0,0,0,1619,1621, + 3,226,113,0,1620,1622,3,298,149,0,1621,1620,1,0,0,0,1621,1622,1,0,0,0, + 1622,1623,1,0,0,0,1623,1624,3,266,133,0,1624,265,1,0,0,0,1625,1627,3, + 322,161,0,1626,1625,1,0,0,0,1626,1627,1,0,0,0,1627,1628,1,0,0,0,1628, + 1634,3,100,50,0,1629,1634,3,360,180,0,1630,1631,5,101,0,0,1631,1632,7, + 19,0,0,1632,1634,5,128,0,0,1633,1626,1,0,0,0,1633,1629,1,0,0,0,1633,1630, + 1,0,0,0,1634,267,1,0,0,0,1635,1641,3,270,135,0,1636,1637,5,85,0,0,1637, + 1638,3,34,17,0,1638,1639,5,86,0,0,1639,1641,1,0,0,0,1640,1635,1,0,0,0, + 1640,1636,1,0,0,0,1641,269,1,0,0,0,1642,1643,5,101,0,0,1643,1646,3,272, + 136,0,1644,1646,3,276,138,0,1645,1642,1,0,0,0,1645,1644,1,0,0,0,1646, + 271,1,0,0,0,1647,1650,3,86,43,0,1648,1650,3,276,138,0,1649,1647,1,0,0, + 0,1649,1648,1,0,0,0,1650,273,1,0,0,0,1651,1653,3,272,136,0,1652,1654, + 5,131,0,0,1653,1652,1,0,0,0,1653,1654,1,0,0,0,1654,1662,1,0,0,0,1655, + 1656,5,122,0,0,1656,1658,3,272,136,0,1657,1659,5,131,0,0,1658,1657,1, + 0,0,0,1658,1659,1,0,0,0,1659,1661,1,0,0,0,1660,1655,1,0,0,0,1661,1664, + 1,0,0,0,1662,1660,1,0,0,0,1662,1663,1,0,0,0,1663,275,1,0,0,0,1664,1662, + 1,0,0,0,1665,1670,5,89,0,0,1666,1668,3,274,137,0,1667,1669,5,122,0,0, + 1668,1667,1,0,0,0,1668,1669,1,0,0,0,1669,1671,1,0,0,0,1670,1666,1,0,0, + 0,1670,1671,1,0,0,0,1671,1672,1,0,0,0,1672,1673,5,90,0,0,1673,277,1,0, + 0,0,1674,1677,5,132,0,0,1675,1677,3,342,171,0,1676,1674,1,0,0,0,1676, + 1675,1,0,0,0,1677,279,1,0,0,0,1678,1679,3,282,141,0,1679,1681,5,89,0, + 0,1680,1682,3,290,145,0,1681,1680,1,0,0,0,1681,1682,1,0,0,0,1682,1683, + 1,0,0,0,1683,1684,5,90,0,0,1684,281,1,0,0,0,1685,1687,3,288,144,0,1686, + 1688,3,204,102,0,1687,1686,1,0,0,0,1687,1688,1,0,0,0,1688,1693,1,0,0, + 0,1689,1691,3,284,142,0,1690,1692,3,286,143,0,1691,1690,1,0,0,0,1691, + 1692,1,0,0,0,1692,1694,1,0,0,0,1693,1689,1,0,0,0,1693,1694,1,0,0,0,1694, + 1696,1,0,0,0,1695,1697,3,304,152,0,1696,1695,1,0,0,0,1696,1697,1,0,0, + 0,1697,1709,1,0,0,0,1698,1700,5,77,0,0,1699,1701,3,204,102,0,1700,1699, + 1,0,0,0,1700,1701,1,0,0,0,1701,1706,1,0,0,0,1702,1704,3,284,142,0,1703, + 1705,3,286,143,0,1704,1703,1,0,0,0,1704,1705,1,0,0,0,1705,1707,1,0,0, + 0,1706,1702,1,0,0,0,1706,1707,1,0,0,0,1707,1709,1,0,0,0,1708,1685,1,0, + 0,0,1708,1698,1,0,0,0,1709,283,1,0,0,0,1710,1712,3,10,5,0,1711,1710,1, + 0,0,0,1711,1712,1,0,0,0,1712,1713,1,0,0,0,1713,1714,3,278,139,0,1714, + 285,1,0,0,0,1715,1716,5,38,0,0,1716,287,1,0,0,0,1717,1718,7,15,0,0,1718, + 289,1,0,0,0,1719,1724,3,292,146,0,1720,1721,3,314,157,0,1721,1722,5,126, + 0,0,1722,1724,1,0,0,0,1723,1719,1,0,0,0,1723,1720,1,0,0,0,1724,1725,1, + 0,0,0,1725,1723,1,0,0,0,1725,1726,1,0,0,0,1726,291,1,0,0,0,1727,1729, + 3,204,102,0,1728,1727,1,0,0,0,1728,1729,1,0,0,0,1729,1731,1,0,0,0,1730, + 1732,3,138,69,0,1731,1730,1,0,0,0,1731,1732,1,0,0,0,1732,1734,1,0,0,0, + 1733,1735,3,294,147,0,1734,1733,1,0,0,0,1734,1735,1,0,0,0,1735,1736,1, + 0,0,0,1736,1744,5,128,0,0,1737,1744,3,264,132,0,1738,1744,3,196,98,0, + 1739,1744,3,130,65,0,1740,1744,3,334,167,0,1741,1744,3,126,63,0,1742, + 1744,3,132,66,0,1743,1728,1,0,0,0,1743,1737,1,0,0,0,1743,1738,1,0,0,0, + 1743,1739,1,0,0,0,1743,1740,1,0,0,0,1743,1741,1,0,0,0,1743,1742,1,0,0, + 0,1744,293,1,0,0,0,1745,1750,3,296,148,0,1746,1747,5,122,0,0,1747,1749, + 3,296,148,0,1748,1746,1,0,0,0,1749,1752,1,0,0,0,1750,1748,1,0,0,0,1750, + 1751,1,0,0,0,1751,295,1,0,0,0,1752,1750,1,0,0,0,1753,1763,3,226,113,0, + 1754,1756,3,298,149,0,1755,1754,1,0,0,0,1755,1756,1,0,0,0,1756,1758,1, + 0,0,0,1757,1759,3,302,151,0,1758,1757,1,0,0,0,1758,1759,1,0,0,0,1759, + 1764,1,0,0,0,1760,1762,3,270,135,0,1761,1760,1,0,0,0,1761,1762,1,0,0, + 0,1762,1764,1,0,0,0,1763,1755,1,0,0,0,1763,1761,1,0,0,0,1764,1774,1,0, + 0,0,1765,1767,5,132,0,0,1766,1765,1,0,0,0,1766,1767,1,0,0,0,1767,1769, + 1,0,0,0,1768,1770,3,204,102,0,1769,1768,1,0,0,0,1769,1770,1,0,0,0,1770, + 1771,1,0,0,0,1771,1772,5,126,0,0,1772,1774,3,92,46,0,1773,1753,1,0,0, + 0,1773,1766,1,0,0,0,1774,297,1,0,0,0,1775,1777,3,300,150,0,1776,1775, + 1,0,0,0,1777,1778,1,0,0,0,1778,1776,1,0,0,0,1778,1779,1,0,0,0,1779,299, + 1,0,0,0,1780,1781,7,20,0,0,1781,301,1,0,0,0,1782,1783,5,101,0,0,1783, + 1784,5,134,0,0,1784,1785,6,151,-1,0,1785,303,1,0,0,0,1786,1787,5,126, + 0,0,1787,1788,3,306,153,0,1788,305,1,0,0,0,1789,1791,3,308,154,0,1790, + 1792,5,131,0,0,1791,1790,1,0,0,0,1791,1792,1,0,0,0,1792,1800,1,0,0,0, + 1793,1794,5,122,0,0,1794,1796,3,308,154,0,1795,1797,5,131,0,0,1796,1795, + 1,0,0,0,1796,1797,1,0,0,0,1797,1799,1,0,0,0,1798,1793,1,0,0,0,1799,1802, + 1,0,0,0,1800,1798,1,0,0,0,1800,1801,1,0,0,0,1801,307,1,0,0,0,1802,1800, + 1,0,0,0,1803,1805,3,204,102,0,1804,1803,1,0,0,0,1804,1805,1,0,0,0,1805, + 1818,1,0,0,0,1806,1819,3,312,156,0,1807,1809,5,80,0,0,1808,1810,3,314, + 157,0,1809,1808,1,0,0,0,1809,1810,1,0,0,0,1810,1811,1,0,0,0,1811,1819, + 3,312,156,0,1812,1814,3,314,157,0,1813,1815,5,80,0,0,1814,1813,1,0,0, + 0,1814,1815,1,0,0,0,1815,1816,1,0,0,0,1816,1817,3,312,156,0,1817,1819, + 1,0,0,0,1818,1806,1,0,0,0,1818,1807,1,0,0,0,1818,1812,1,0,0,0,1819,309, + 1,0,0,0,1820,1822,3,10,5,0,1821,1820,1,0,0,0,1821,1822,1,0,0,0,1822,1823, + 1,0,0,0,1823,1826,3,278,139,0,1824,1826,3,162,81,0,1825,1821,1,0,0,0, + 1825,1824,1,0,0,0,1826,311,1,0,0,0,1827,1828,3,310,155,0,1828,313,1,0, + 0,0,1829,1830,7,21,0,0,1830,315,1,0,0,0,1831,1832,5,52,0,0,1832,1833, + 3,318,159,0,1833,317,1,0,0,0,1834,1836,3,150,75,0,1835,1837,3,320,160, + 0,1836,1835,1,0,0,0,1836,1837,1,0,0,0,1837,319,1,0,0,0,1838,1840,3,236, + 118,0,1839,1841,3,320,160,0,1840,1839,1,0,0,0,1840,1841,1,0,0,0,1841, + 321,1,0,0,0,1842,1843,5,126,0,0,1843,1844,3,324,162,0,1844,323,1,0,0, + 0,1845,1847,3,326,163,0,1846,1848,5,131,0,0,1847,1846,1,0,0,0,1847,1848, + 1,0,0,0,1848,1856,1,0,0,0,1849,1850,5,122,0,0,1850,1852,3,326,163,0,1851, + 1853,5,131,0,0,1852,1851,1,0,0,0,1852,1853,1,0,0,0,1853,1855,1,0,0,0, + 1854,1849,1,0,0,0,1855,1858,1,0,0,0,1856,1854,1,0,0,0,1856,1857,1,0,0, + 0,1857,325,1,0,0,0,1858,1856,1,0,0,0,1859,1866,3,328,164,0,1860,1862, + 5,85,0,0,1861,1863,3,34,17,0,1862,1861,1,0,0,0,1862,1863,1,0,0,0,1863, + 1864,1,0,0,0,1864,1867,5,86,0,0,1865,1867,3,276,138,0,1866,1860,1,0,0, + 0,1866,1865,1,0,0,0,1867,327,1,0,0,0,1868,1871,3,310,155,0,1869,1871, + 5,132,0,0,1870,1868,1,0,0,0,1870,1869,1,0,0,0,1871,329,1,0,0,0,1872,1873, + 5,52,0,0,1873,1874,3,378,189,0,1874,331,1,0,0,0,1875,1879,5,52,0,0,1876, + 1877,5,4,0,0,1877,1880,5,132,0,0,1878,1880,5,140,0,0,1879,1876,1,0,0, + 0,1879,1878,1,0,0,0,1880,333,1,0,0,0,1881,1882,5,68,0,0,1882,1883,5,102, + 0,0,1883,1884,3,336,168,0,1884,1885,5,103,0,0,1885,1886,3,122,61,0,1886, + 335,1,0,0,0,1887,1892,3,338,169,0,1888,1889,5,122,0,0,1889,1891,3,338, + 169,0,1890,1888,1,0,0,0,1891,1894,1,0,0,0,1892,1890,1,0,0,0,1892,1893, + 1,0,0,0,1893,337,1,0,0,0,1894,1892,1,0,0,0,1895,1898,3,340,170,0,1896, + 1898,3,262,131,0,1897,1895,1,0,0,0,1897,1896,1,0,0,0,1898,339,1,0,0,0, + 1899,1900,5,68,0,0,1900,1901,5,102,0,0,1901,1902,3,336,168,0,1902,1903, + 5,103,0,0,1903,1905,1,0,0,0,1904,1899,1,0,0,0,1904,1905,1,0,0,0,1905, + 1906,1,0,0,0,1906,1909,5,21,0,0,1907,1909,5,76,0,0,1908,1904,1,0,0,0, + 1908,1907,1,0,0,0,1909,1921,1,0,0,0,1910,1912,5,131,0,0,1911,1910,1,0, + 0,0,1911,1912,1,0,0,0,1912,1914,1,0,0,0,1913,1915,5,132,0,0,1914,1913, + 1,0,0,0,1914,1915,1,0,0,0,1915,1922,1,0,0,0,1916,1918,5,132,0,0,1917, + 1916,1,0,0,0,1917,1918,1,0,0,0,1918,1919,1,0,0,0,1919,1920,5,101,0,0, + 1920,1922,3,246,123,0,1921,1911,1,0,0,0,1921,1917,1,0,0,0,1922,341,1, + 0,0,0,1923,1924,3,346,173,0,1924,1926,5,102,0,0,1925,1927,3,348,174,0, + 1926,1925,1,0,0,0,1926,1927,1,0,0,0,1927,1928,1,0,0,0,1928,1929,5,103, + 0,0,1929,343,1,0,0,0,1930,1942,3,342,171,0,1931,1934,3,330,165,0,1932, + 1934,3,332,166,0,1933,1931,1,0,0,0,1933,1932,1,0,0,0,1934,1935,1,0,0, + 0,1935,1937,5,102,0,0,1936,1938,3,348,174,0,1937,1936,1,0,0,0,1937,1938, + 1,0,0,0,1938,1939,1,0,0,0,1939,1940,5,103,0,0,1940,1942,1,0,0,0,1941, + 1930,1,0,0,0,1941,1933,1,0,0,0,1942,345,1,0,0,0,1943,1944,5,132,0,0,1944, + 347,1,0,0,0,1945,1947,3,350,175,0,1946,1948,5,131,0,0,1947,1946,1,0,0, + 0,1947,1948,1,0,0,0,1948,1956,1,0,0,0,1949,1950,5,122,0,0,1950,1952,3, + 350,175,0,1951,1953,5,131,0,0,1952,1951,1,0,0,0,1952,1953,1,0,0,0,1953, + 1955,1,0,0,0,1954,1949,1,0,0,0,1955,1958,1,0,0,0,1956,1954,1,0,0,0,1956, + 1957,1,0,0,0,1957,349,1,0,0,0,1958,1956,1,0,0,0,1959,1963,3,246,123,0, + 1960,1963,3,92,46,0,1961,1963,3,4,2,0,1962,1959,1,0,0,0,1962,1960,1,0, + 0,0,1962,1961,1,0,0,0,1963,351,1,0,0,0,1964,1965,5,76,0,0,1965,1971,3, + 10,5,0,1966,1972,5,132,0,0,1967,1969,5,68,0,0,1968,1967,1,0,0,0,1968, + 1969,1,0,0,0,1969,1970,1,0,0,0,1970,1972,3,342,171,0,1971,1966,1,0,0, + 0,1971,1968,1,0,0,0,1972,353,1,0,0,0,1973,1975,5,36,0,0,1974,1973,1,0, + 0,0,1974,1975,1,0,0,0,1975,1976,1,0,0,0,1976,1977,5,68,0,0,1977,1978, + 3,122,61,0,1978,355,1,0,0,0,1979,1980,5,68,0,0,1980,1981,5,102,0,0,1981, + 1982,5,103,0,0,1982,1983,3,122,61,0,1983,357,1,0,0,0,1984,1985,5,73,0, + 0,1985,1986,3,100,50,0,1986,1987,3,362,181,0,1987,359,1,0,0,0,1988,1990, + 5,73,0,0,1989,1991,3,322,161,0,1990,1989,1,0,0,0,1990,1991,1,0,0,0,1991, + 1992,1,0,0,0,1992,1993,3,100,50,0,1993,1994,3,362,181,0,1994,361,1,0, + 0,0,1995,1997,3,364,182,0,1996,1995,1,0,0,0,1997,1998,1,0,0,0,1998,1996, + 1,0,0,0,1998,1999,1,0,0,0,1999,363,1,0,0,0,2000,2001,5,17,0,0,2001,2002, + 5,85,0,0,2002,2003,3,366,183,0,2003,2004,5,86,0,0,2004,2005,3,100,50, + 0,2005,365,1,0,0,0,2006,2008,3,204,102,0,2007,2006,1,0,0,0,2007,2008, + 1,0,0,0,2008,2009,1,0,0,0,2009,2012,3,150,75,0,2010,2013,3,226,113,0, + 2011,2013,3,248,124,0,2012,2010,1,0,0,0,2012,2011,1,0,0,0,2012,2013,1, + 0,0,0,2013,2016,1,0,0,0,2014,2016,5,131,0,0,2015,2007,1,0,0,0,2015,2014, + 1,0,0,0,2016,367,1,0,0,0,2017,2019,5,71,0,0,2018,2020,3,86,43,0,2019, + 2018,1,0,0,0,2019,2020,1,0,0,0,2020,369,1,0,0,0,2021,2024,3,372,186,0, + 2022,2024,3,376,188,0,2023,2021,1,0,0,0,2023,2022,1,0,0,0,2024,371,1, + 0,0,0,2025,2026,5,71,0,0,2026,2028,5,85,0,0,2027,2029,3,374,187,0,2028, + 2027,1,0,0,0,2028,2029,1,0,0,0,2029,2030,1,0,0,0,2030,2031,5,86,0,0,2031, + 373,1,0,0,0,2032,2034,3,246,123,0,2033,2035,5,131,0,0,2034,2033,1,0,0, + 0,2034,2035,1,0,0,0,2035,2043,1,0,0,0,2036,2037,5,122,0,0,2037,2039,3, + 246,123,0,2038,2040,5,131,0,0,2039,2038,1,0,0,0,2039,2040,1,0,0,0,2040, + 2042,1,0,0,0,2041,2036,1,0,0,0,2042,2045,1,0,0,0,2043,2041,1,0,0,0,2043, + 2044,1,0,0,0,2044,375,1,0,0,0,2045,2043,1,0,0,0,2046,2047,5,50,0,0,2047, + 2048,5,85,0,0,2048,2049,3,92,46,0,2049,2050,5,86,0,0,2050,2053,1,0,0, + 0,2051,2053,5,50,0,0,2052,2046,1,0,0,0,2052,2051,1,0,0,0,2053,377,1,0, + 0,0,2054,2057,5,49,0,0,2055,2056,5,87,0,0,2056,2058,5,88,0,0,2057,2055, + 1,0,0,0,2057,2058,1,0,0,0,2058,2106,1,0,0,0,2059,2062,5,28,0,0,2060,2061, + 5,87,0,0,2061,2063,5,88,0,0,2062,2060,1,0,0,0,2062,2063,1,0,0,0,2063, + 2106,1,0,0,0,2064,2106,5,91,0,0,2065,2106,5,92,0,0,2066,2106,5,93,0,0, + 2067,2106,5,94,0,0,2068,2106,5,95,0,0,2069,2106,5,96,0,0,2070,2106,5, + 97,0,0,2071,2106,5,98,0,0,2072,2106,5,99,0,0,2073,2106,5,100,0,0,2074, + 2106,5,101,0,0,2075,2106,5,103,0,0,2076,2106,5,102,0,0,2077,2106,5,117, + 0,0,2078,2106,5,104,0,0,2079,2106,5,105,0,0,2080,2106,5,106,0,0,2081, + 2106,5,108,0,0,2082,2106,5,109,0,0,2083,2106,5,110,0,0,2084,2106,5,111, + 0,0,2085,2086,5,102,0,0,2086,2106,5,102,0,0,2087,2088,5,103,0,0,2088, + 2106,5,103,0,0,2089,2106,5,113,0,0,2090,2106,5,112,0,0,2091,2106,5,114, + 0,0,2092,2106,5,115,0,0,2093,2106,5,116,0,0,2094,2106,5,118,0,0,2095, + 2106,5,119,0,0,2096,2106,5,120,0,0,2097,2106,5,121,0,0,2098,2106,5,122, + 0,0,2099,2106,5,123,0,0,2100,2106,5,124,0,0,2101,2102,5,85,0,0,2102,2106, + 5,86,0,0,2103,2104,5,87,0,0,2104,2106,5,88,0,0,2105,2054,1,0,0,0,2105, + 2059,1,0,0,0,2105,2064,1,0,0,0,2105,2065,1,0,0,0,2105,2066,1,0,0,0,2105, + 2067,1,0,0,0,2105,2068,1,0,0,0,2105,2069,1,0,0,0,2105,2070,1,0,0,0,2105, + 2071,1,0,0,0,2105,2072,1,0,0,0,2105,2073,1,0,0,0,2105,2074,1,0,0,0,2105, + 2075,1,0,0,0,2105,2076,1,0,0,0,2105,2077,1,0,0,0,2105,2078,1,0,0,0,2105, + 2079,1,0,0,0,2105,2080,1,0,0,0,2105,2081,1,0,0,0,2105,2082,1,0,0,0,2105, + 2083,1,0,0,0,2105,2084,1,0,0,0,2105,2085,1,0,0,0,2105,2087,1,0,0,0,2105, + 2089,1,0,0,0,2105,2090,1,0,0,0,2105,2091,1,0,0,0,2105,2092,1,0,0,0,2105, + 2093,1,0,0,0,2105,2094,1,0,0,0,2105,2095,1,0,0,0,2105,2096,1,0,0,0,2105, + 2097,1,0,0,0,2105,2098,1,0,0,0,2105,2099,1,0,0,0,2105,2100,1,0,0,0,2105, + 2101,1,0,0,0,2105,2103,1,0,0,0,2106,379,1,0,0,0,2107,2108,7,22,0,0,2108, + 381,1,0,0,0,306,383,390,399,403,412,415,419,427,434,437,442,447,453,461, + 463,472,476,480,483,487,490,497,501,504,507,510,516,520,524,538,542,548, + 555,561,565,569,571,579,584,597,604,616,626,631,635,642,645,653,657,660, + 667,674,678,683,687,690,695,710,717,725,733,742,749,756,764,772,780,788, + 796,804,813,821,830,838,846,848,851,857,863,869,876,885,893,897,904,906, + 926,930,936,941,945,948,955,962,966,975,986,996,1001,1008,1011,1016,1021, + 1042,1047,1050,1061,1067,1072,1075,1080,1083,1090,1099,1104,1107,1111, + 1115,1119,1124,1129,1135,1141,1147,1153,1159,1162,1168,1172,1176,1179, + 1187,1189,1195,1198,1201,1204,1208,1212,1218,1228,1234,1240,1245,1250, + 1254,1267,1273,1277,1283,1288,1303,1307,1312,1317,1322,1328,1331,1340, + 1344,1349,1353,1359,1366,1383,1385,1392,1397,1404,1408,1412,1420,1426, + 1432,1436,1438,1442,1447,1451,1454,1457,1460,1465,1469,1472,1476,1479, + 1481,1486,1493,1499,1503,1509,1515,1518,1520,1526,1530,1536,1543,1547, + 1549,1553,1559,1571,1575,1577,1581,1586,1589,1596,1600,1605,1607,1611, + 1614,1617,1621,1626,1633,1640,1645,1649,1653,1658,1662,1668,1670,1676, + 1681,1687,1691,1693,1696,1700,1704,1706,1708,1711,1723,1725,1728,1731, + 1734,1743,1750,1755,1758,1761,1763,1766,1769,1773,1778,1791,1796,1800, + 1804,1809,1814,1818,1821,1825,1836,1840,1847,1852,1856,1862,1866,1870, + 1879,1892,1897,1904,1908,1911,1914,1917,1921,1926,1933,1937,1941,1947, + 1952,1956,1962,1968,1971,1974,1990,1998,2007,2012,2015,2019,2023,2028, + 2034,2039,2043,2052,2057,2062,2105 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + cpp14parserParserStaticData = staticData.release(); +} + +} + +CPP14Parser::CPP14Parser(TokenStream *input) : CPP14Parser(input, antlr4::atn::ParserATNSimulatorOptions()) {} + +CPP14Parser::CPP14Parser(TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options) : Parser(input) { + CPP14Parser::initialize(); + _interpreter = new atn::ParserATNSimulator(this, *cpp14parserParserStaticData->atn, cpp14parserParserStaticData->decisionToDFA, cpp14parserParserStaticData->sharedContextCache, options); +} + +CPP14Parser::~CPP14Parser() { + delete _interpreter; +} + +const atn::ATN& CPP14Parser::getATN() const { + return *cpp14parserParserStaticData->atn; +} + +std::string CPP14Parser::getGrammarFileName() const { + return "CPP14Parser.g4"; +} + +const std::vector& CPP14Parser::getRuleNames() const { + return cpp14parserParserStaticData->ruleNames; +} + +const dfa::Vocabulary& CPP14Parser::getVocabulary() const { + return cpp14parserParserStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView CPP14Parser::getSerializedATN() const { + return cpp14parserParserStaticData->serializedATN; +} + + +//----------------- TranslationUnitContext ------------------------------------------------------------------ + +CPP14Parser::TranslationUnitContext::TranslationUnitContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TranslationUnitContext::EOF() { + return getToken(CPP14Parser::EOF, 0); +} + +CPP14Parser::DeclarationseqContext* CPP14Parser::TranslationUnitContext::declarationseq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TranslationUnitContext::getRuleIndex() const { + return CPP14Parser::RuleTranslationUnit; +} + + +CPP14Parser::TranslationUnitContext* CPP14Parser::translationUnit() { + TranslationUnitContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 0, CPP14Parser::RuleTranslationUnit); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(383); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { + setState(382); + declarationseq(); + } + setState(385); + match(CPP14Parser::EOF); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PrimaryExpressionContext ------------------------------------------------------------------ + +CPP14Parser::PrimaryExpressionContext::PrimaryExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::PrimaryExpressionContext::literal() { + return getRuleContexts(); +} + +CPP14Parser::LiteralContext* CPP14Parser::PrimaryExpressionContext::literal(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::This() { + return getToken(CPP14Parser::This, 0); +} + +tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::PrimaryExpressionContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::IdExpressionContext* CPP14Parser::PrimaryExpressionContext::idExpression() { + return getRuleContext(0); +} + +CPP14Parser::LambdaExpressionContext* CPP14Parser::PrimaryExpressionContext::lambdaExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::PrimaryExpressionContext::getRuleIndex() const { + return CPP14Parser::RulePrimaryExpression; +} + + +CPP14Parser::PrimaryExpressionContext* CPP14Parser::primaryExpression() { + PrimaryExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 2, CPP14Parser::RulePrimaryExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + setState(399); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: { + enterOuterAlt(_localctx, 1); + setState(388); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(387); + literal(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(390); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 1, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + break; + } + + case CPP14Parser::This: { + enterOuterAlt(_localctx, 2); + setState(392); + match(CPP14Parser::This); + break; + } + + case CPP14Parser::LeftParen: { + enterOuterAlt(_localctx, 3); + setState(393); + match(CPP14Parser::LeftParen); + setState(394); + expression(); + setState(395); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::Decltype: + case CPP14Parser::Operator: + case CPP14Parser::Tilde: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 4); + setState(397); + idExpression(); + break; + } + + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 5); + setState(398); + lambdaExpression(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- IdExpressionContext ------------------------------------------------------------------ + +CPP14Parser::IdExpressionContext::IdExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::UnqualifiedIdContext* CPP14Parser::IdExpressionContext::unqualifiedId() { + return getRuleContext(0); +} + +CPP14Parser::QualifiedIdContext* CPP14Parser::IdExpressionContext::qualifiedId() { + return getRuleContext(0); +} + + +size_t CPP14Parser::IdExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleIdExpression; +} + + +CPP14Parser::IdExpressionContext* CPP14Parser::idExpression() { + IdExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 4, CPP14Parser::RuleIdExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(403); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 3, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(401); + unqualifiedId(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(402); + qualifiedId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UnqualifiedIdContext ------------------------------------------------------------------ + +CPP14Parser::UnqualifiedIdContext::UnqualifiedIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::UnqualifiedIdContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::OperatorFunctionIdContext* CPP14Parser::UnqualifiedIdContext::operatorFunctionId() { + return getRuleContext(0); +} + +CPP14Parser::ConversionFunctionIdContext* CPP14Parser::UnqualifiedIdContext::conversionFunctionId() { + return getRuleContext(0); +} + +CPP14Parser::LiteralOperatorIdContext* CPP14Parser::UnqualifiedIdContext::literalOperatorId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UnqualifiedIdContext::Tilde() { + return getToken(CPP14Parser::Tilde, 0); +} + +CPP14Parser::ClassNameContext* CPP14Parser::UnqualifiedIdContext::className() { + return getRuleContext(0); +} + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::UnqualifiedIdContext::decltypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::TemplateIdContext* CPP14Parser::UnqualifiedIdContext::templateId() { + return getRuleContext(0); +} + + +size_t CPP14Parser::UnqualifiedIdContext::getRuleIndex() const { + return CPP14Parser::RuleUnqualifiedId; +} + + +CPP14Parser::UnqualifiedIdContext* CPP14Parser::unqualifiedId() { + UnqualifiedIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 6, CPP14Parser::RuleUnqualifiedId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(415); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 5, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(405); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(406); + operatorFunctionId(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(407); + conversionFunctionId(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(408); + literalOperatorId(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(409); + match(CPP14Parser::Tilde); + setState(412); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Identifier: { + setState(410); + className(); + break; + } + + case CPP14Parser::Decltype: { + setState(411); + decltypeSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(414); + templateId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- QualifiedIdContext ------------------------------------------------------------------ + +CPP14Parser::QualifiedIdContext::QualifiedIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::QualifiedIdContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::UnqualifiedIdContext* CPP14Parser::QualifiedIdContext::unqualifiedId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::QualifiedIdContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + + +size_t CPP14Parser::QualifiedIdContext::getRuleIndex() const { + return CPP14Parser::RuleQualifiedId; +} + + +CPP14Parser::QualifiedIdContext* CPP14Parser::qualifiedId() { + QualifiedIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 8, CPP14Parser::RuleQualifiedId); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(417); + nestedNameSpecifier(0); + setState(419); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(418); + match(CPP14Parser::Template); + } + setState(421); + unqualifiedId(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NestedNameSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::NestedNameSpecifierContext::NestedNameSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +CPP14Parser::TheTypeNameContext* CPP14Parser::NestedNameSpecifierContext::theTypeName() { + return getRuleContext(0); +} + +CPP14Parser::NamespaceNameContext* CPP14Parser::NestedNameSpecifierContext::namespaceName() { + return getRuleContext(0); +} + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::NestedNameSpecifierContext::decltypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::NestedNameSpecifierContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::NestedNameSpecifierContext::simpleTemplateId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + + +size_t CPP14Parser::NestedNameSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleNestedNameSpecifier; +} + + + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::nestedNameSpecifier() { + return nestedNameSpecifier(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::nestedNameSpecifier(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::NestedNameSpecifierContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::NestedNameSpecifierContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 10; + enterRecursionRule(_localctx, 10, CPP14Parser::RuleNestedNameSpecifier, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(427); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 7, _ctx)) { + case 1: { + setState(424); + theTypeName(); + break; + } + + case 2: { + setState(425); + namespaceName(); + break; + } + + case 3: { + setState(426); + decltypeSpecifier(); + break; + } + + default: + break; + } + setState(429); + match(CPP14Parser::Doublecolon); + _ctx->stop = _input->LT(-1); + setState(442); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RuleNestedNameSpecifier); + setState(431); + + if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(437); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 9, _ctx)) { + case 1: { + setState(432); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + setState(434); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(433); + match(CPP14Parser::Template); + } + setState(436); + simpleTemplateId(); + break; + } + + default: + break; + } + setState(439); + match(CPP14Parser::Doublecolon); + } + setState(444); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- LambdaExpressionContext ------------------------------------------------------------------ + +CPP14Parser::LambdaExpressionContext::LambdaExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::LambdaIntroducerContext* CPP14Parser::LambdaExpressionContext::lambdaIntroducer() { + return getRuleContext(0); +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::LambdaExpressionContext::compoundStatement() { + return getRuleContext(0); +} + +CPP14Parser::LambdaDeclaratorContext* CPP14Parser::LambdaExpressionContext::lambdaDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::LambdaExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleLambdaExpression; +} + + +CPP14Parser::LambdaExpressionContext* CPP14Parser::lambdaExpression() { + LambdaExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 12, CPP14Parser::RuleLambdaExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(445); + lambdaIntroducer(); + setState(447); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::LeftParen) { + setState(446); + lambdaDeclarator(); + } + setState(449); + compoundStatement(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LambdaIntroducerContext ------------------------------------------------------------------ + +CPP14Parser::LambdaIntroducerContext::LambdaIntroducerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LambdaIntroducerContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::LambdaIntroducerContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +CPP14Parser::LambdaCaptureContext* CPP14Parser::LambdaIntroducerContext::lambdaCapture() { + return getRuleContext(0); +} + + +size_t CPP14Parser::LambdaIntroducerContext::getRuleIndex() const { + return CPP14Parser::RuleLambdaIntroducer; +} + + +CPP14Parser::LambdaIntroducerContext* CPP14Parser::lambdaIntroducer() { + LambdaIntroducerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 14, CPP14Parser::RuleLambdaIntroducer); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(451); + match(CPP14Parser::LeftBracket); + setState(453); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 69) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 69)) & -9223372032291373055) != 0)) { + setState(452); + lambdaCapture(); + } + setState(455); + match(CPP14Parser::RightBracket); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LambdaCaptureContext ------------------------------------------------------------------ + +CPP14Parser::LambdaCaptureContext::LambdaCaptureContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::CaptureListContext* CPP14Parser::LambdaCaptureContext::captureList() { + return getRuleContext(0); +} + +CPP14Parser::CaptureDefaultContext* CPP14Parser::LambdaCaptureContext::captureDefault() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::LambdaCaptureContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + + +size_t CPP14Parser::LambdaCaptureContext::getRuleIndex() const { + return CPP14Parser::RuleLambdaCapture; +} + + +CPP14Parser::LambdaCaptureContext* CPP14Parser::lambdaCapture() { + LambdaCaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 16, CPP14Parser::RuleLambdaCapture); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(463); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 14, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(457); + captureList(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(458); + captureDefault(); + setState(461); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Comma) { + setState(459); + match(CPP14Parser::Comma); + setState(460); + captureList(); + } + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CaptureDefaultContext ------------------------------------------------------------------ + +CPP14Parser::CaptureDefaultContext::CaptureDefaultContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::CaptureDefaultContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::CaptureDefaultContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + + +size_t CPP14Parser::CaptureDefaultContext::getRuleIndex() const { + return CPP14Parser::RuleCaptureDefault; +} + + +CPP14Parser::CaptureDefaultContext* CPP14Parser::captureDefault() { + CaptureDefaultContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 18, CPP14Parser::RuleCaptureDefault); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(465); + _la = _input->LA(1); + if (!(_la == CPP14Parser::And + + || _la == CPP14Parser::Assign)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CaptureListContext ------------------------------------------------------------------ + +CPP14Parser::CaptureListContext::CaptureListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::CaptureListContext::capture() { + return getRuleContexts(); +} + +CPP14Parser::CaptureContext* CPP14Parser::CaptureListContext::capture(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::CaptureListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::CaptureListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + +tree::TerminalNode* CPP14Parser::CaptureListContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + + +size_t CPP14Parser::CaptureListContext::getRuleIndex() const { + return CPP14Parser::RuleCaptureList; +} + + +CPP14Parser::CaptureListContext* CPP14Parser::captureList() { + CaptureListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 20, CPP14Parser::RuleCaptureList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(467); + capture(); + setState(472); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(468); + match(CPP14Parser::Comma); + setState(469); + capture(); + setState(474); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(476); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(475); + match(CPP14Parser::Ellipsis); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CaptureContext ------------------------------------------------------------------ + +CPP14Parser::CaptureContext::CaptureContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::SimpleCaptureContext* CPP14Parser::CaptureContext::simpleCapture() { + return getRuleContext(0); +} + +CPP14Parser::InitcaptureContext* CPP14Parser::CaptureContext::initcapture() { + return getRuleContext(0); +} + + +size_t CPP14Parser::CaptureContext::getRuleIndex() const { + return CPP14Parser::RuleCapture; +} + + +CPP14Parser::CaptureContext* CPP14Parser::capture() { + CaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 22, CPP14Parser::RuleCapture); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(480); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 17, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(478); + simpleCapture(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(479); + initcapture(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleCaptureContext ------------------------------------------------------------------ + +CPP14Parser::SimpleCaptureContext::SimpleCaptureContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::SimpleCaptureContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleCaptureContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleCaptureContext::This() { + return getToken(CPP14Parser::This, 0); +} + + +size_t CPP14Parser::SimpleCaptureContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleCapture; +} + + +CPP14Parser::SimpleCaptureContext* CPP14Parser::simpleCapture() { + SimpleCaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 24, CPP14Parser::RuleSimpleCapture); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(487); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::And: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(483); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::And) { + setState(482); + match(CPP14Parser::And); + } + setState(485); + match(CPP14Parser::Identifier); + break; + } + + case CPP14Parser::This: { + enterOuterAlt(_localctx, 2); + setState(486); + match(CPP14Parser::This); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitcaptureContext ------------------------------------------------------------------ + +CPP14Parser::InitcaptureContext::InitcaptureContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::InitcaptureContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::InitializerContext* CPP14Parser::InitcaptureContext::initializer() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::InitcaptureContext::And() { + return getToken(CPP14Parser::And, 0); +} + + +size_t CPP14Parser::InitcaptureContext::getRuleIndex() const { + return CPP14Parser::RuleInitcapture; +} + + +CPP14Parser::InitcaptureContext* CPP14Parser::initcapture() { + InitcaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 26, CPP14Parser::RuleInitcapture); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(490); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::And) { + setState(489); + match(CPP14Parser::And); + } + setState(492); + match(CPP14Parser::Identifier); + setState(493); + initializer(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LambdaDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::LambdaDeclaratorContext::LambdaDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::LambdaDeclaratorContext::parameterDeclarationClause() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::Mutable() { + return getToken(CPP14Parser::Mutable, 0); +} + +CPP14Parser::ExceptionSpecificationContext* CPP14Parser::LambdaDeclaratorContext::exceptionSpecification() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::LambdaDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::TrailingReturnTypeContext* CPP14Parser::LambdaDeclaratorContext::trailingReturnType() { + return getRuleContext(0); +} + + +size_t CPP14Parser::LambdaDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleLambdaDeclarator; +} + + +CPP14Parser::LambdaDeclaratorContext* CPP14Parser::lambdaDeclarator() { + LambdaDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 28, CPP14Parser::RuleLambdaDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(495); + match(CPP14Parser::LeftParen); + setState(497); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1237504995584196377) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 297237575406461917) != 0)) { + setState(496); + parameterDeclarationClause(); + } + setState(499); + match(CPP14Parser::RightParen); + setState(501); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Mutable) { + setState(500); + match(CPP14Parser::Mutable); + } + setState(504); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Noexcept + + || _la == CPP14Parser::Throw) { + setState(503); + exceptionSpecification(); + } + setState(507); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(506); + attributeSpecifierSeq(); + } + setState(510); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Arrow) { + setState(509); + trailingReturnType(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PostfixExpressionContext ------------------------------------------------------------------ + +CPP14Parser::PostfixExpressionContext::PostfixExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PrimaryExpressionContext* CPP14Parser::PostfixExpressionContext::primaryExpression() { + return getRuleContext(0); +} + +CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::PostfixExpressionContext::simpleTypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::TypeNameSpecifierContext* CPP14Parser::PostfixExpressionContext::typeNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::PostfixExpressionContext::bracedInitList() { + return getRuleContext(0); +} + +CPP14Parser::ExpressionListContext* CPP14Parser::PostfixExpressionContext::expressionList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::PostfixExpressionContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::PostfixExpressionContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Dynamic_cast() { + return getToken(CPP14Parser::Dynamic_cast, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Static_cast() { + return getToken(CPP14Parser::Static_cast, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Reinterpret_cast() { + return getToken(CPP14Parser::Reinterpret_cast, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Const_cast() { + return getToken(CPP14Parser::Const_cast, 0); +} + +CPP14Parser::TypeIdOfTheTypeIdContext* CPP14Parser::PostfixExpressionContext::typeIdOfTheTypeId() { + return getRuleContext(0); +} + +CPP14Parser::PostfixExpressionContext* CPP14Parser::PostfixExpressionContext::postfixExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Dot() { + return getToken(CPP14Parser::Dot, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Arrow() { + return getToken(CPP14Parser::Arrow, 0); +} + +CPP14Parser::IdExpressionContext* CPP14Parser::PostfixExpressionContext::idExpression() { + return getRuleContext(0); +} + +CPP14Parser::PseudoDestructorNameContext* CPP14Parser::PostfixExpressionContext::pseudoDestructorName() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::PlusPlus() { + return getToken(CPP14Parser::PlusPlus, 0); +} + +tree::TerminalNode* CPP14Parser::PostfixExpressionContext::MinusMinus() { + return getToken(CPP14Parser::MinusMinus, 0); +} + + +size_t CPP14Parser::PostfixExpressionContext::getRuleIndex() const { + return CPP14Parser::RulePostfixExpression; +} + + + +CPP14Parser::PostfixExpressionContext* CPP14Parser::postfixExpression() { + return postfixExpression(0); +} + +CPP14Parser::PostfixExpressionContext* CPP14Parser::postfixExpression(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::PostfixExpressionContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::PostfixExpressionContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 30; + enterRecursionRule(_localctx, 30, CPP14Parser::RulePostfixExpression, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(542); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 30, _ctx)) { + case 1: { + setState(513); + primaryExpression(); + break; + } + + case 2: { + setState(516); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + setState(514); + simpleTypeSpecifier(); + break; + } + + case CPP14Parser::Typename_: { + setState(515); + typeNameSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(524); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + setState(518); + match(CPP14Parser::LeftParen); + setState(520); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { + setState(519); + expressionList(); + } + setState(522); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::LeftBrace: { + setState(523); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + case 3: { + setState(526); + _la = _input->LA(1); + if (!(((((_la - 24) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 24)) & 2216203124865) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(527); + match(CPP14Parser::Less); + setState(528); + theTypeId(); + setState(529); + match(CPP14Parser::Greater); + setState(530); + match(CPP14Parser::LeftParen); + setState(531); + expression(); + setState(532); + match(CPP14Parser::RightParen); + break; + } + + case 4: { + setState(534); + typeIdOfTheTypeId(); + setState(535); + match(CPP14Parser::LeftParen); + setState(538); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 29, _ctx)) { + case 1: { + setState(536); + expression(); + break; + } + + case 2: { + setState(537); + theTypeId(); + break; + } + + default: + break; + } + setState(540); + match(CPP14Parser::RightParen); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(571); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 36, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(569); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 35, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RulePostfixExpression); + setState(544); + + if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(545); + match(CPP14Parser::LeftBracket); + setState(548); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::Alignof: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Const_cast: + case CPP14Parser::Decltype: + case CPP14Parser::Delete: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Operator: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static_cast: + case CPP14Parser::This: + case CPP14Parser::Throw: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + setState(546); + expression(); + break; + } + + case CPP14Parser::LeftBrace: { + setState(547); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(550); + match(CPP14Parser::RightBracket); + break; + } + + case 2: { + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RulePostfixExpression); + setState(552); + + if (!(precpred(_ctx, 6))) throw FailedPredicateException(this, "precpred(_ctx, 6)"); + setState(553); + match(CPP14Parser::LeftParen); + setState(555); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { + setState(554); + expressionList(); + } + setState(557); + match(CPP14Parser::RightParen); + break; + } + + case 3: { + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RulePostfixExpression); + setState(558); + + if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); + setState(559); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Arrow + + || _la == CPP14Parser::Dot)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(565); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 34, _ctx)) { + case 1: { + setState(561); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(560); + match(CPP14Parser::Template); + } + setState(563); + idExpression(); + break; + } + + case 2: { + setState(564); + pseudoDestructorName(); + break; + } + + default: + break; + } + break; + } + + case 4: { + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RulePostfixExpression); + setState(567); + + if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(568); + _la = _input->LA(1); + if (!(_la == CPP14Parser::PlusPlus + + || _la == CPP14Parser::MinusMinus)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + default: + break; + } + } + setState(573); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 36, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- TypeIdOfTheTypeIdContext ------------------------------------------------------------------ + +CPP14Parser::TypeIdOfTheTypeIdContext::TypeIdOfTheTypeIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TypeIdOfTheTypeIdContext::Typeid_() { + return getToken(CPP14Parser::Typeid_, 0); +} + + +size_t CPP14Parser::TypeIdOfTheTypeIdContext::getRuleIndex() const { + return CPP14Parser::RuleTypeIdOfTheTypeId; +} + + +CPP14Parser::TypeIdOfTheTypeIdContext* CPP14Parser::typeIdOfTheTypeId() { + TypeIdOfTheTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 32, CPP14Parser::RuleTypeIdOfTheTypeId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(574); + match(CPP14Parser::Typeid_); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExpressionListContext ------------------------------------------------------------------ + +CPP14Parser::ExpressionListContext::ExpressionListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::InitializerListContext* CPP14Parser::ExpressionListContext::initializerList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ExpressionListContext::getRuleIndex() const { + return CPP14Parser::RuleExpressionList; +} + + +CPP14Parser::ExpressionListContext* CPP14Parser::expressionList() { + ExpressionListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 34, CPP14Parser::RuleExpressionList); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(576); + initializerList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PseudoDestructorNameContext ------------------------------------------------------------------ + +CPP14Parser::PseudoDestructorNameContext::PseudoDestructorNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Tilde() { + return getToken(CPP14Parser::Tilde, 0); +} + +std::vector CPP14Parser::PseudoDestructorNameContext::theTypeName() { + return getRuleContexts(); +} + +CPP14Parser::TheTypeNameContext* CPP14Parser::PseudoDestructorNameContext::theTypeName(size_t i) { + return getRuleContext(i); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::PseudoDestructorNameContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::PseudoDestructorNameContext::simpleTemplateId() { + return getRuleContext(0); +} + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::PseudoDestructorNameContext::decltypeSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::PseudoDestructorNameContext::getRuleIndex() const { + return CPP14Parser::RulePseudoDestructorName; +} + + +CPP14Parser::PseudoDestructorNameContext* CPP14Parser::pseudoDestructorName() { + PseudoDestructorNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 36, CPP14Parser::RulePseudoDestructorName); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(597); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 39, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(579); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 37, _ctx)) { + case 1: { + setState(578); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(584); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(581); + theTypeName(); + setState(582); + match(CPP14Parser::Doublecolon); + } + setState(586); + match(CPP14Parser::Tilde); + setState(587); + theTypeName(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(588); + nestedNameSpecifier(0); + setState(589); + match(CPP14Parser::Template); + setState(590); + simpleTemplateId(); + setState(591); + match(CPP14Parser::Doublecolon); + setState(592); + match(CPP14Parser::Tilde); + setState(593); + theTypeName(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(595); + match(CPP14Parser::Tilde); + setState(596); + decltypeSpecifier(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UnaryExpressionContext ------------------------------------------------------------------ + +CPP14Parser::UnaryExpressionContext::UnaryExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PostfixExpressionContext* CPP14Parser::UnaryExpressionContext::postfixExpression() { + return getRuleContext(0); +} + +CPP14Parser::UnaryExpressionContext* CPP14Parser::UnaryExpressionContext::unaryExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::PlusPlus() { + return getToken(CPP14Parser::PlusPlus, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::MinusMinus() { + return getToken(CPP14Parser::MinusMinus, 0); +} + +CPP14Parser::UnaryOperatorContext* CPP14Parser::UnaryExpressionContext::unaryOperator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Sizeof() { + return getToken(CPP14Parser::Sizeof, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::UnaryExpressionContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Alignof() { + return getToken(CPP14Parser::Alignof, 0); +} + +CPP14Parser::NoExceptExpressionContext* CPP14Parser::UnaryExpressionContext::noExceptExpression() { + return getRuleContext(0); +} + +CPP14Parser::NewExpressionContext* CPP14Parser::UnaryExpressionContext::newExpression() { + return getRuleContext(0); +} + +CPP14Parser::DeleteExpressionContext* CPP14Parser::UnaryExpressionContext::deleteExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::UnaryExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleUnaryExpression; +} + + +CPP14Parser::UnaryExpressionContext* CPP14Parser::unaryExpression() { + UnaryExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 38, CPP14Parser::RuleUnaryExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(626); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 42, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(599); + postfixExpression(0); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(604); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::PlusPlus: { + setState(600); + match(CPP14Parser::PlusPlus); + break; + } + + case CPP14Parser::MinusMinus: { + setState(601); + match(CPP14Parser::MinusMinus); + break; + } + + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: { + setState(602); + unaryOperator(); + break; + } + + case CPP14Parser::Sizeof: { + setState(603); + match(CPP14Parser::Sizeof); + break; + } + + default: + throw NoViableAltException(this); + } + setState(606); + unaryExpression(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(607); + match(CPP14Parser::Sizeof); + setState(616); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + setState(608); + match(CPP14Parser::LeftParen); + setState(609); + theTypeId(); + setState(610); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::Ellipsis: { + setState(612); + match(CPP14Parser::Ellipsis); + setState(613); + match(CPP14Parser::LeftParen); + setState(614); + match(CPP14Parser::Identifier); + setState(615); + match(CPP14Parser::RightParen); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(618); + match(CPP14Parser::Alignof); + setState(619); + match(CPP14Parser::LeftParen); + setState(620); + theTypeId(); + setState(621); + match(CPP14Parser::RightParen); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(623); + noExceptExpression(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(624); + newExpression(); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(625); + deleteExpression(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UnaryOperatorContext ------------------------------------------------------------------ + +CPP14Parser::UnaryOperatorContext::UnaryOperatorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Or() { + return getToken(CPP14Parser::Or, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Star() { + return getToken(CPP14Parser::Star, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Plus() { + return getToken(CPP14Parser::Plus, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Tilde() { + return getToken(CPP14Parser::Tilde, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Minus() { + return getToken(CPP14Parser::Minus, 0); +} + +tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Not() { + return getToken(CPP14Parser::Not, 0); +} + + +size_t CPP14Parser::UnaryOperatorContext::getRuleIndex() const { + return CPP14Parser::RuleUnaryOperator; +} + + +CPP14Parser::UnaryOperatorContext* CPP14Parser::unaryOperator() { + UnaryOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 40, CPP14Parser::RuleUnaryOperator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(628); + _la = _input->LA(1); + if (!(((((_la - 91) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 91)) & 967) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NewExpressionContext ------------------------------------------------------------------ + +CPP14Parser::NewExpressionContext::NewExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NewExpressionContext::New() { + return getToken(CPP14Parser::New, 0); +} + +CPP14Parser::NewTypeIdContext* CPP14Parser::NewExpressionContext::newTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NewExpressionContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +CPP14Parser::NewPlacementContext* CPP14Parser::NewExpressionContext::newPlacement() { + return getRuleContext(0); +} + +CPP14Parser::NewInitializerContext* CPP14Parser::NewExpressionContext::newInitializer() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NewExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::NewExpressionContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NewExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::NewExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleNewExpression; +} + + +CPP14Parser::NewExpressionContext* CPP14Parser::newExpression() { + NewExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 42, CPP14Parser::RuleNewExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(631); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Doublecolon) { + setState(630); + match(CPP14Parser::Doublecolon); + } + setState(633); + match(CPP14Parser::New); + setState(635); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 44, _ctx)) { + case 1: { + setState(634); + newPlacement(); + break; + } + + default: + break; + } + setState(642); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Struct: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + setState(637); + newTypeId(); + break; + } + + case CPP14Parser::LeftParen: { + setState(638); + match(CPP14Parser::LeftParen); + setState(639); + theTypeId(); + setState(640); + match(CPP14Parser::RightParen); + break; + } + + default: + throw NoViableAltException(this); + } + setState(645); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::LeftParen + + || _la == CPP14Parser::LeftBrace) { + setState(644); + newInitializer(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NewPlacementContext ------------------------------------------------------------------ + +CPP14Parser::NewPlacementContext::NewPlacementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NewPlacementContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ExpressionListContext* CPP14Parser::NewPlacementContext::expressionList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NewPlacementContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::NewPlacementContext::getRuleIndex() const { + return CPP14Parser::RuleNewPlacement; +} + + +CPP14Parser::NewPlacementContext* CPP14Parser::newPlacement() { + NewPlacementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 44, CPP14Parser::RuleNewPlacement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(647); + match(CPP14Parser::LeftParen); + setState(648); + expressionList(); + setState(649); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NewTypeIdContext ------------------------------------------------------------------ + +CPP14Parser::NewTypeIdContext::NewTypeIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::NewTypeIdContext::typeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::NewDeclaratorContext* CPP14Parser::NewTypeIdContext::newDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NewTypeIdContext::getRuleIndex() const { + return CPP14Parser::RuleNewTypeId; +} + + +CPP14Parser::NewTypeIdContext* CPP14Parser::newTypeId() { + NewTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 46, CPP14Parser::RuleNewTypeId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(651); + typeSpecifierSeq(); + setState(653); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 47, _ctx)) { + case 1: { + setState(652); + newDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NewDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::NewDeclaratorContext::NewDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PointerOperatorContext* CPP14Parser::NewDeclaratorContext::pointerOperator() { + return getRuleContext(0); +} + +CPP14Parser::NewDeclaratorContext* CPP14Parser::NewDeclaratorContext::newDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::NewDeclaratorContext::noPointerNewDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NewDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleNewDeclarator; +} + + +CPP14Parser::NewDeclaratorContext* CPP14Parser::newDeclarator() { + NewDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 48, CPP14Parser::RuleNewDeclarator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(660); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Decltype: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::AndAnd: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(655); + pointerOperator(); + setState(657); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 48, _ctx)) { + case 1: { + setState(656); + newDeclarator(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 2); + setState(659); + noPointerNewDeclarator(0); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoPointerNewDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::NoPointerNewDeclaratorContext::NoPointerNewDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NoPointerNewDeclaratorContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::NoPointerNewDeclaratorContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerNewDeclaratorContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerNewDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::NoPointerNewDeclaratorContext::noPointerNewDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerNewDeclaratorContext::constantExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NoPointerNewDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleNoPointerNewDeclarator; +} + + + +CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::noPointerNewDeclarator() { + return noPointerNewDeclarator(0); +} + +CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::noPointerNewDeclarator(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::NoPointerNewDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::NoPointerNewDeclaratorContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 50; + enterRecursionRule(_localctx, 50, CPP14Parser::RuleNoPointerNewDeclarator, precedence); + + + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(663); + match(CPP14Parser::LeftBracket); + setState(664); + expression(); + setState(665); + match(CPP14Parser::RightBracket); + setState(667); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 50, _ctx)) { + case 1: { + setState(666); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(678); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 52, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RuleNoPointerNewDeclarator); + setState(669); + + if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(670); + match(CPP14Parser::LeftBracket); + setState(671); + constantExpression(); + setState(672); + match(CPP14Parser::RightBracket); + setState(674); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 51, _ctx)) { + case 1: { + setState(673); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + } + setState(680); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 52, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- NewInitializerContext ------------------------------------------------------------------ + +CPP14Parser::NewInitializerContext::NewInitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NewInitializerContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::NewInitializerContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::ExpressionListContext* CPP14Parser::NewInitializerContext::expressionList() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::NewInitializerContext::bracedInitList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NewInitializerContext::getRuleIndex() const { + return CPP14Parser::RuleNewInitializer; +} + + +CPP14Parser::NewInitializerContext* CPP14Parser::newInitializer() { + NewInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 52, CPP14Parser::RuleNewInitializer); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(687); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + enterOuterAlt(_localctx, 1); + setState(681); + match(CPP14Parser::LeftParen); + setState(683); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { + setState(682); + expressionList(); + } + setState(685); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::LeftBrace: { + enterOuterAlt(_localctx, 2); + setState(686); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeleteExpressionContext ------------------------------------------------------------------ + +CPP14Parser::DeleteExpressionContext::DeleteExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::DeleteExpressionContext::Delete() { + return getToken(CPP14Parser::Delete, 0); +} + +CPP14Parser::CastExpressionContext* CPP14Parser::DeleteExpressionContext::castExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::DeleteExpressionContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +tree::TerminalNode* CPP14Parser::DeleteExpressionContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::DeleteExpressionContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + + +size_t CPP14Parser::DeleteExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleDeleteExpression; +} + + +CPP14Parser::DeleteExpressionContext* CPP14Parser::deleteExpression() { + DeleteExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 54, CPP14Parser::RuleDeleteExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(690); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Doublecolon) { + setState(689); + match(CPP14Parser::Doublecolon); + } + setState(692); + match(CPP14Parser::Delete); + setState(695); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 56, _ctx)) { + case 1: { + setState(693); + match(CPP14Parser::LeftBracket); + setState(694); + match(CPP14Parser::RightBracket); + break; + } + + default: + break; + } + setState(697); + castExpression(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoExceptExpressionContext ------------------------------------------------------------------ + +CPP14Parser::NoExceptExpressionContext::NoExceptExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::Noexcept() { + return getToken(CPP14Parser::Noexcept, 0); +} + +tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::NoExceptExpressionContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::NoExceptExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleNoExceptExpression; +} + + +CPP14Parser::NoExceptExpressionContext* CPP14Parser::noExceptExpression() { + NoExceptExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 56, CPP14Parser::RuleNoExceptExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(699); + match(CPP14Parser::Noexcept); + setState(700); + match(CPP14Parser::LeftParen); + setState(701); + expression(); + setState(702); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CastExpressionContext ------------------------------------------------------------------ + +CPP14Parser::CastExpressionContext::CastExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::UnaryExpressionContext* CPP14Parser::CastExpressionContext::unaryExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::CastExpressionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::CastExpressionContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::CastExpressionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::CastExpressionContext* CPP14Parser::CastExpressionContext::castExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::CastExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleCastExpression; +} + + +CPP14Parser::CastExpressionContext* CPP14Parser::castExpression() { + CastExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 58, CPP14Parser::RuleCastExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(710); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 57, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(704); + unaryExpression(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(705); + match(CPP14Parser::LeftParen); + setState(706); + theTypeId(); + setState(707); + match(CPP14Parser::RightParen); + setState(708); + castExpression(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PointerMemberExpressionContext ------------------------------------------------------------------ + +CPP14Parser::PointerMemberExpressionContext::PointerMemberExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::PointerMemberExpressionContext::castExpression() { + return getRuleContexts(); +} + +CPP14Parser::CastExpressionContext* CPP14Parser::PointerMemberExpressionContext::castExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::PointerMemberExpressionContext::DotStar() { + return getTokens(CPP14Parser::DotStar); +} + +tree::TerminalNode* CPP14Parser::PointerMemberExpressionContext::DotStar(size_t i) { + return getToken(CPP14Parser::DotStar, i); +} + +std::vector CPP14Parser::PointerMemberExpressionContext::ArrowStar() { + return getTokens(CPP14Parser::ArrowStar); +} + +tree::TerminalNode* CPP14Parser::PointerMemberExpressionContext::ArrowStar(size_t i) { + return getToken(CPP14Parser::ArrowStar, i); +} + + +size_t CPP14Parser::PointerMemberExpressionContext::getRuleIndex() const { + return CPP14Parser::RulePointerMemberExpression; +} + + +CPP14Parser::PointerMemberExpressionContext* CPP14Parser::pointerMemberExpression() { + PointerMemberExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 60, CPP14Parser::RulePointerMemberExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(712); + castExpression(); + setState(717); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::ArrowStar + + || _la == CPP14Parser::DotStar) { + setState(713); + _la = _input->LA(1); + if (!(_la == CPP14Parser::ArrowStar + + || _la == CPP14Parser::DotStar)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(714); + castExpression(); + setState(719); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MultiplicativeExpressionContext ------------------------------------------------------------------ + +CPP14Parser::MultiplicativeExpressionContext::MultiplicativeExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::MultiplicativeExpressionContext::pointerMemberExpression() { + return getRuleContexts(); +} + +CPP14Parser::PointerMemberExpressionContext* CPP14Parser::MultiplicativeExpressionContext::pointerMemberExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::MultiplicativeExpressionContext::Star() { + return getTokens(CPP14Parser::Star); +} + +tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Star(size_t i) { + return getToken(CPP14Parser::Star, i); +} + +std::vector CPP14Parser::MultiplicativeExpressionContext::Div() { + return getTokens(CPP14Parser::Div); +} + +tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Div(size_t i) { + return getToken(CPP14Parser::Div, i); +} + +std::vector CPP14Parser::MultiplicativeExpressionContext::Mod() { + return getTokens(CPP14Parser::Mod); +} + +tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Mod(size_t i) { + return getToken(CPP14Parser::Mod, i); +} + + +size_t CPP14Parser::MultiplicativeExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleMultiplicativeExpression; +} + + +CPP14Parser::MultiplicativeExpressionContext* CPP14Parser::multiplicativeExpression() { + MultiplicativeExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 62, CPP14Parser::RuleMultiplicativeExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(720); + pointerMemberExpression(); + setState(725); + _errHandler->sync(this); + _la = _input->LA(1); + while (((((_la - 93) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 93)) & 7) != 0)) { + setState(721); + _la = _input->LA(1); + if (!(((((_la - 93) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 93)) & 7) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(722); + pointerMemberExpression(); + setState(727); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AdditiveExpressionContext ------------------------------------------------------------------ + +CPP14Parser::AdditiveExpressionContext::AdditiveExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::AdditiveExpressionContext::multiplicativeExpression() { + return getRuleContexts(); +} + +CPP14Parser::MultiplicativeExpressionContext* CPP14Parser::AdditiveExpressionContext::multiplicativeExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::AdditiveExpressionContext::Plus() { + return getTokens(CPP14Parser::Plus); +} + +tree::TerminalNode* CPP14Parser::AdditiveExpressionContext::Plus(size_t i) { + return getToken(CPP14Parser::Plus, i); +} + +std::vector CPP14Parser::AdditiveExpressionContext::Minus() { + return getTokens(CPP14Parser::Minus); +} + +tree::TerminalNode* CPP14Parser::AdditiveExpressionContext::Minus(size_t i) { + return getToken(CPP14Parser::Minus, i); +} + + +size_t CPP14Parser::AdditiveExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleAdditiveExpression; +} + + +CPP14Parser::AdditiveExpressionContext* CPP14Parser::additiveExpression() { + AdditiveExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 64, CPP14Parser::RuleAdditiveExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(728); + multiplicativeExpression(); + setState(733); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Plus + + || _la == CPP14Parser::Minus) { + setState(729); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Plus + + || _la == CPP14Parser::Minus)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(730); + multiplicativeExpression(); + setState(735); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ShiftExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ShiftExpressionContext::ShiftExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::ShiftExpressionContext::additiveExpression() { + return getRuleContexts(); +} + +CPP14Parser::AdditiveExpressionContext* CPP14Parser::ShiftExpressionContext::additiveExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::ShiftExpressionContext::shiftOperator() { + return getRuleContexts(); +} + +CPP14Parser::ShiftOperatorContext* CPP14Parser::ShiftExpressionContext::shiftOperator(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::ShiftExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleShiftExpression; +} + + +CPP14Parser::ShiftExpressionContext* CPP14Parser::shiftExpression() { + ShiftExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 66, CPP14Parser::RuleShiftExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(736); + additiveExpression(); + setState(742); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 61, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(737); + shiftOperator(); + setState(738); + additiveExpression(); + } + setState(744); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 61, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ShiftOperatorContext ------------------------------------------------------------------ + +CPP14Parser::ShiftOperatorContext::ShiftOperatorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::ShiftOperatorContext::Greater() { + return getTokens(CPP14Parser::Greater); +} + +tree::TerminalNode* CPP14Parser::ShiftOperatorContext::Greater(size_t i) { + return getToken(CPP14Parser::Greater, i); +} + +std::vector CPP14Parser::ShiftOperatorContext::Less() { + return getTokens(CPP14Parser::Less); +} + +tree::TerminalNode* CPP14Parser::ShiftOperatorContext::Less(size_t i) { + return getToken(CPP14Parser::Less, i); +} + + +size_t CPP14Parser::ShiftOperatorContext::getRuleIndex() const { + return CPP14Parser::RuleShiftOperator; +} + + +CPP14Parser::ShiftOperatorContext* CPP14Parser::shiftOperator() { + ShiftOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 68, CPP14Parser::RuleShiftOperator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(749); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Greater: { + enterOuterAlt(_localctx, 1); + setState(745); + match(CPP14Parser::Greater); + setState(746); + match(CPP14Parser::Greater); + break; + } + + case CPP14Parser::Less: { + enterOuterAlt(_localctx, 2); + setState(747); + match(CPP14Parser::Less); + setState(748); + match(CPP14Parser::Less); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RelationalExpressionContext ------------------------------------------------------------------ + +CPP14Parser::RelationalExpressionContext::RelationalExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::RelationalExpressionContext::shiftExpression() { + return getRuleContexts(); +} + +CPP14Parser::ShiftExpressionContext* CPP14Parser::RelationalExpressionContext::shiftExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::RelationalExpressionContext::Less() { + return getTokens(CPP14Parser::Less); +} + +tree::TerminalNode* CPP14Parser::RelationalExpressionContext::Less(size_t i) { + return getToken(CPP14Parser::Less, i); +} + +std::vector CPP14Parser::RelationalExpressionContext::Greater() { + return getTokens(CPP14Parser::Greater); +} + +tree::TerminalNode* CPP14Parser::RelationalExpressionContext::Greater(size_t i) { + return getToken(CPP14Parser::Greater, i); +} + +std::vector CPP14Parser::RelationalExpressionContext::LessEqual() { + return getTokens(CPP14Parser::LessEqual); +} + +tree::TerminalNode* CPP14Parser::RelationalExpressionContext::LessEqual(size_t i) { + return getToken(CPP14Parser::LessEqual, i); +} + +std::vector CPP14Parser::RelationalExpressionContext::GreaterEqual() { + return getTokens(CPP14Parser::GreaterEqual); +} + +tree::TerminalNode* CPP14Parser::RelationalExpressionContext::GreaterEqual(size_t i) { + return getToken(CPP14Parser::GreaterEqual, i); +} + + +size_t CPP14Parser::RelationalExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleRelationalExpression; +} + + +CPP14Parser::RelationalExpressionContext* CPP14Parser::relationalExpression() { + RelationalExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 70, CPP14Parser::RuleRelationalExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(751); + shiftExpression(); + setState(756); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(752); + _la = _input->LA(1); + if (!(((((_la - 102) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 102)) & 49155) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(753); + shiftExpression(); + } + setState(758); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EqualityExpressionContext ------------------------------------------------------------------ + +CPP14Parser::EqualityExpressionContext::EqualityExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::EqualityExpressionContext::relationalExpression() { + return getRuleContexts(); +} + +CPP14Parser::RelationalExpressionContext* CPP14Parser::EqualityExpressionContext::relationalExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::EqualityExpressionContext::Equal() { + return getTokens(CPP14Parser::Equal); +} + +tree::TerminalNode* CPP14Parser::EqualityExpressionContext::Equal(size_t i) { + return getToken(CPP14Parser::Equal, i); +} + +std::vector CPP14Parser::EqualityExpressionContext::NotEqual() { + return getTokens(CPP14Parser::NotEqual); +} + +tree::TerminalNode* CPP14Parser::EqualityExpressionContext::NotEqual(size_t i) { + return getToken(CPP14Parser::NotEqual, i); +} + + +size_t CPP14Parser::EqualityExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleEqualityExpression; +} + + +CPP14Parser::EqualityExpressionContext* CPP14Parser::equalityExpression() { + EqualityExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 72, CPP14Parser::RuleEqualityExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(759); + relationalExpression(); + setState(764); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Equal + + || _la == CPP14Parser::NotEqual) { + setState(760); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Equal + + || _la == CPP14Parser::NotEqual)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(761); + relationalExpression(); + setState(766); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AndExpressionContext ------------------------------------------------------------------ + +CPP14Parser::AndExpressionContext::AndExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::AndExpressionContext::equalityExpression() { + return getRuleContexts(); +} + +CPP14Parser::EqualityExpressionContext* CPP14Parser::AndExpressionContext::equalityExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::AndExpressionContext::And() { + return getTokens(CPP14Parser::And); +} + +tree::TerminalNode* CPP14Parser::AndExpressionContext::And(size_t i) { + return getToken(CPP14Parser::And, i); +} + + +size_t CPP14Parser::AndExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleAndExpression; +} + + +CPP14Parser::AndExpressionContext* CPP14Parser::andExpression() { + AndExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 74, CPP14Parser::RuleAndExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(767); + equalityExpression(); + setState(772); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::And) { + setState(768); + match(CPP14Parser::And); + setState(769); + equalityExpression(); + setState(774); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExclusiveOrExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ExclusiveOrExpressionContext::ExclusiveOrExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::ExclusiveOrExpressionContext::andExpression() { + return getRuleContexts(); +} + +CPP14Parser::AndExpressionContext* CPP14Parser::ExclusiveOrExpressionContext::andExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::ExclusiveOrExpressionContext::Caret() { + return getTokens(CPP14Parser::Caret); +} + +tree::TerminalNode* CPP14Parser::ExclusiveOrExpressionContext::Caret(size_t i) { + return getToken(CPP14Parser::Caret, i); +} + + +size_t CPP14Parser::ExclusiveOrExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleExclusiveOrExpression; +} + + +CPP14Parser::ExclusiveOrExpressionContext* CPP14Parser::exclusiveOrExpression() { + ExclusiveOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 76, CPP14Parser::RuleExclusiveOrExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(775); + andExpression(); + setState(780); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Caret) { + setState(776); + match(CPP14Parser::Caret); + setState(777); + andExpression(); + setState(782); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InclusiveOrExpressionContext ------------------------------------------------------------------ + +CPP14Parser::InclusiveOrExpressionContext::InclusiveOrExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::InclusiveOrExpressionContext::exclusiveOrExpression() { + return getRuleContexts(); +} + +CPP14Parser::ExclusiveOrExpressionContext* CPP14Parser::InclusiveOrExpressionContext::exclusiveOrExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::InclusiveOrExpressionContext::Or() { + return getTokens(CPP14Parser::Or); +} + +tree::TerminalNode* CPP14Parser::InclusiveOrExpressionContext::Or(size_t i) { + return getToken(CPP14Parser::Or, i); +} + + +size_t CPP14Parser::InclusiveOrExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleInclusiveOrExpression; +} + + +CPP14Parser::InclusiveOrExpressionContext* CPP14Parser::inclusiveOrExpression() { + InclusiveOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 78, CPP14Parser::RuleInclusiveOrExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(783); + exclusiveOrExpression(); + setState(788); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Or) { + setState(784); + match(CPP14Parser::Or); + setState(785); + exclusiveOrExpression(); + setState(790); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LogicalAndExpressionContext ------------------------------------------------------------------ + +CPP14Parser::LogicalAndExpressionContext::LogicalAndExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::LogicalAndExpressionContext::inclusiveOrExpression() { + return getRuleContexts(); +} + +CPP14Parser::InclusiveOrExpressionContext* CPP14Parser::LogicalAndExpressionContext::inclusiveOrExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::LogicalAndExpressionContext::AndAnd() { + return getTokens(CPP14Parser::AndAnd); +} + +tree::TerminalNode* CPP14Parser::LogicalAndExpressionContext::AndAnd(size_t i) { + return getToken(CPP14Parser::AndAnd, i); +} + + +size_t CPP14Parser::LogicalAndExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleLogicalAndExpression; +} + + +CPP14Parser::LogicalAndExpressionContext* CPP14Parser::logicalAndExpression() { + LogicalAndExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 80, CPP14Parser::RuleLogicalAndExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(791); + inclusiveOrExpression(); + setState(796); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::AndAnd) { + setState(792); + match(CPP14Parser::AndAnd); + setState(793); + inclusiveOrExpression(); + setState(798); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LogicalOrExpressionContext ------------------------------------------------------------------ + +CPP14Parser::LogicalOrExpressionContext::LogicalOrExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::LogicalOrExpressionContext::logicalAndExpression() { + return getRuleContexts(); +} + +CPP14Parser::LogicalAndExpressionContext* CPP14Parser::LogicalOrExpressionContext::logicalAndExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::LogicalOrExpressionContext::OrOr() { + return getTokens(CPP14Parser::OrOr); +} + +tree::TerminalNode* CPP14Parser::LogicalOrExpressionContext::OrOr(size_t i) { + return getToken(CPP14Parser::OrOr, i); +} + + +size_t CPP14Parser::LogicalOrExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleLogicalOrExpression; +} + + +CPP14Parser::LogicalOrExpressionContext* CPP14Parser::logicalOrExpression() { + LogicalOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 82, CPP14Parser::RuleLogicalOrExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(799); + logicalAndExpression(); + setState(804); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::OrOr) { + setState(800); + match(CPP14Parser::OrOr); + setState(801); + logicalAndExpression(); + setState(806); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConditionalExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ConditionalExpressionContext::ConditionalExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::LogicalOrExpressionContext* CPP14Parser::ConditionalExpressionContext::logicalOrExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ConditionalExpressionContext::Question() { + return getToken(CPP14Parser::Question, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::ConditionalExpressionContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ConditionalExpressionContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::AssignmentExpressionContext* CPP14Parser::ConditionalExpressionContext::assignmentExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConditionalExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleConditionalExpression; +} + + +CPP14Parser::ConditionalExpressionContext* CPP14Parser::conditionalExpression() { + ConditionalExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 84, CPP14Parser::RuleConditionalExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(807); + logicalOrExpression(); + setState(813); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Question) { + setState(808); + match(CPP14Parser::Question); + setState(809); + expression(); + setState(810); + match(CPP14Parser::Colon); + setState(811); + assignmentExpression(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AssignmentExpressionContext ------------------------------------------------------------------ + +CPP14Parser::AssignmentExpressionContext::AssignmentExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ConditionalExpressionContext* CPP14Parser::AssignmentExpressionContext::conditionalExpression() { + return getRuleContext(0); +} + +CPP14Parser::LogicalOrExpressionContext* CPP14Parser::AssignmentExpressionContext::logicalOrExpression() { + return getRuleContext(0); +} + +CPP14Parser::AssignmentOperatorContext* CPP14Parser::AssignmentExpressionContext::assignmentOperator() { + return getRuleContext(0); +} + +CPP14Parser::InitializerClauseContext* CPP14Parser::AssignmentExpressionContext::initializerClause() { + return getRuleContext(0); +} + +CPP14Parser::ThrowExpressionContext* CPP14Parser::AssignmentExpressionContext::throwExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AssignmentExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleAssignmentExpression; +} + + +CPP14Parser::AssignmentExpressionContext* CPP14Parser::assignmentExpression() { + AssignmentExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 86, CPP14Parser::RuleAssignmentExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(821); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 71, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(815); + conditionalExpression(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(816); + logicalOrExpression(); + setState(817); + assignmentOperator(); + setState(818); + initializerClause(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(820); + throwExpression(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AssignmentOperatorContext ------------------------------------------------------------------ + +CPP14Parser::AssignmentOperatorContext::AssignmentOperatorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::StarAssign() { + return getToken(CPP14Parser::StarAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::DivAssign() { + return getToken(CPP14Parser::DivAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::ModAssign() { + return getToken(CPP14Parser::ModAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::PlusAssign() { + return getToken(CPP14Parser::PlusAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::MinusAssign() { + return getToken(CPP14Parser::MinusAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::RightShiftAssign() { + return getToken(CPP14Parser::RightShiftAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::LeftShiftAssign() { + return getToken(CPP14Parser::LeftShiftAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::AndAssign() { + return getToken(CPP14Parser::AndAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::XorAssign() { + return getToken(CPP14Parser::XorAssign, 0); +} + +tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::OrAssign() { + return getToken(CPP14Parser::OrAssign, 0); +} + + +size_t CPP14Parser::AssignmentOperatorContext::getRuleIndex() const { + return CPP14Parser::RuleAssignmentOperator; +} + + +CPP14Parser::AssignmentOperatorContext* CPP14Parser::assignmentOperator() { + AssignmentOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 88, CPP14Parser::RuleAssignmentOperator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(823); + _la = _input->LA(1); + if (!(((((_la - 101) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 101)) & 8185) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ExpressionContext::ExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::ExpressionContext::assignmentExpression() { + return getRuleContexts(); +} + +CPP14Parser::AssignmentExpressionContext* CPP14Parser::ExpressionContext::assignmentExpression(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::ExpressionContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::ExpressionContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::ExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleExpression; +} + + +CPP14Parser::ExpressionContext* CPP14Parser::expression() { + ExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 90, CPP14Parser::RuleExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(825); + assignmentExpression(); + setState(830); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(826); + match(CPP14Parser::Comma); + setState(827); + assignmentExpression(); + setState(832); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConstantExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ConstantExpressionContext::ConstantExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ConditionalExpressionContext* CPP14Parser::ConstantExpressionContext::conditionalExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConstantExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleConstantExpression; +} + + +CPP14Parser::ConstantExpressionContext* CPP14Parser::constantExpression() { + ConstantExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 92, CPP14Parser::RuleConstantExpression); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(833); + conditionalExpression(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- StatementContext ------------------------------------------------------------------ + +CPP14Parser::StatementContext::StatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::LabeledStatementContext* CPP14Parser::StatementContext::labeledStatement() { + return getRuleContext(0); +} + +CPP14Parser::DeclarationStatementContext* CPP14Parser::StatementContext::declarationStatement() { + return getRuleContext(0); +} + +CPP14Parser::ExpressionStatementContext* CPP14Parser::StatementContext::expressionStatement() { + return getRuleContext(0); +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::StatementContext::compoundStatement() { + return getRuleContext(0); +} + +CPP14Parser::SelectionStatementContext* CPP14Parser::StatementContext::selectionStatement() { + return getRuleContext(0); +} + +CPP14Parser::IterationStatementContext* CPP14Parser::StatementContext::iterationStatement() { + return getRuleContext(0); +} + +CPP14Parser::JumpStatementContext* CPP14Parser::StatementContext::jumpStatement() { + return getRuleContext(0); +} + +CPP14Parser::TryBlockContext* CPP14Parser::StatementContext::tryBlock() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::StatementContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::StatementContext::getRuleIndex() const { + return CPP14Parser::RuleStatement; +} + + +CPP14Parser::StatementContext* CPP14Parser::statement() { + StatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 94, CPP14Parser::RuleStatement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(848); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 75, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(835); + labeledStatement(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(836); + declarationStatement(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(838); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 73, _ctx)) { + case 1: { + setState(837); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + setState(846); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::Alignof: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Const_cast: + case CPP14Parser::Decltype: + case CPP14Parser::Delete: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Operator: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static_cast: + case CPP14Parser::This: + case CPP14Parser::Throw: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Doublecolon: + case CPP14Parser::Semi: + case CPP14Parser::Identifier: { + setState(840); + expressionStatement(); + break; + } + + case CPP14Parser::LeftBrace: { + setState(841); + compoundStatement(); + break; + } + + case CPP14Parser::If: + case CPP14Parser::Switch: { + setState(842); + selectionStatement(); + break; + } + + case CPP14Parser::Do: + case CPP14Parser::For: + case CPP14Parser::While: { + setState(843); + iterationStatement(); + break; + } + + case CPP14Parser::Break: + case CPP14Parser::Continue: + case CPP14Parser::Goto: + case CPP14Parser::Return: { + setState(844); + jumpStatement(); + break; + } + + case CPP14Parser::Try: { + setState(845); + tryBlock(); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LabeledStatementContext ------------------------------------------------------------------ + +CPP14Parser::LabeledStatementContext::LabeledStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LabeledStatementContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::StatementContext* CPP14Parser::LabeledStatementContext::statement() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::LabeledStatementContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::LabeledStatementContext::Case() { + return getToken(CPP14Parser::Case, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::LabeledStatementContext::constantExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::LabeledStatementContext::Default() { + return getToken(CPP14Parser::Default, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::LabeledStatementContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::LabeledStatementContext::getRuleIndex() const { + return CPP14Parser::RuleLabeledStatement; +} + + +CPP14Parser::LabeledStatementContext* CPP14Parser::labeledStatement() { + LabeledStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 96, CPP14Parser::RuleLabeledStatement); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(851); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(850); + attributeSpecifierSeq(); + } + setState(857); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Identifier: { + setState(853); + match(CPP14Parser::Identifier); + break; + } + + case CPP14Parser::Case: { + setState(854); + match(CPP14Parser::Case); + setState(855); + constantExpression(); + break; + } + + case CPP14Parser::Default: { + setState(856); + match(CPP14Parser::Default); + break; + } + + default: + throw NoViableAltException(this); + } + setState(859); + match(CPP14Parser::Colon); + setState(860); + statement(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExpressionStatementContext ------------------------------------------------------------------ + +CPP14Parser::ExpressionStatementContext::ExpressionStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ExpressionStatementContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::ExpressionStatementContext::expression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ExpressionStatementContext::getRuleIndex() const { + return CPP14Parser::RuleExpressionStatement; +} + + +CPP14Parser::ExpressionStatementContext* CPP14Parser::expressionStatement() { + ExpressionStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 98, CPP14Parser::RuleExpressionStatement); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(863); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { + setState(862); + expression(); + } + setState(865); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CompoundStatementContext ------------------------------------------------------------------ + +CPP14Parser::CompoundStatementContext::CompoundStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::CompoundStatementContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::CompoundStatementContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +CPP14Parser::StatementSeqContext* CPP14Parser::CompoundStatementContext::statementSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::CompoundStatementContext::getRuleIndex() const { + return CPP14Parser::RuleCompoundStatement; +} + + +CPP14Parser::CompoundStatementContext* CPP14Parser::compoundStatement() { + CompoundStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 100, CPP14Parser::RuleCompoundStatement); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(867); + match(CPP14Parser::LeftBrace); + setState(869); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -137360239606498050) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -8989184726396829969) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & 25) != 0)) { + setState(868); + statementSeq(); + } + setState(871); + match(CPP14Parser::RightBrace); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- StatementSeqContext ------------------------------------------------------------------ + +CPP14Parser::StatementSeqContext::StatementSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::StatementSeqContext::statement() { + return getRuleContexts(); +} + +CPP14Parser::StatementContext* CPP14Parser::StatementSeqContext::statement(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::StatementSeqContext::getRuleIndex() const { + return CPP14Parser::RuleStatementSeq; +} + + +CPP14Parser::StatementSeqContext* CPP14Parser::statementSeq() { + StatementSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 102, CPP14Parser::RuleStatementSeq); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(874); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(873); + statement(); + setState(876); + _errHandler->sync(this); + _la = _input->LA(1); + } while ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -137360239606498050) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -8989184726396829969) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & 25) != 0)); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SelectionStatementContext ------------------------------------------------------------------ + +CPP14Parser::SelectionStatementContext::SelectionStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::SelectionStatementContext::If() { + return getToken(CPP14Parser::If, 0); +} + +tree::TerminalNode* CPP14Parser::SelectionStatementContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ConditionContext* CPP14Parser::SelectionStatementContext::condition() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::SelectionStatementContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +std::vector CPP14Parser::SelectionStatementContext::statement() { + return getRuleContexts(); +} + +CPP14Parser::StatementContext* CPP14Parser::SelectionStatementContext::statement(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* CPP14Parser::SelectionStatementContext::Else() { + return getToken(CPP14Parser::Else, 0); +} + +tree::TerminalNode* CPP14Parser::SelectionStatementContext::Switch() { + return getToken(CPP14Parser::Switch, 0); +} + + +size_t CPP14Parser::SelectionStatementContext::getRuleIndex() const { + return CPP14Parser::RuleSelectionStatement; +} + + +CPP14Parser::SelectionStatementContext* CPP14Parser::selectionStatement() { + SelectionStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 104, CPP14Parser::RuleSelectionStatement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(893); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::If: { + enterOuterAlt(_localctx, 1); + setState(878); + match(CPP14Parser::If); + setState(879); + match(CPP14Parser::LeftParen); + setState(880); + condition(); + setState(881); + match(CPP14Parser::RightParen); + setState(882); + statement(); + setState(885); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 81, _ctx)) { + case 1: { + setState(883); + match(CPP14Parser::Else); + setState(884); + statement(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::Switch: { + enterOuterAlt(_localctx, 2); + setState(887); + match(CPP14Parser::Switch); + setState(888); + match(CPP14Parser::LeftParen); + setState(889); + condition(); + setState(890); + match(CPP14Parser::RightParen); + setState(891); + statement(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConditionContext ------------------------------------------------------------------ + +CPP14Parser::ConditionContext::ConditionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ExpressionContext* CPP14Parser::ConditionContext::expression() { + return getRuleContext(0); +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ConditionContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclaratorContext* CPP14Parser::ConditionContext::declarator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ConditionContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::InitializerClauseContext* CPP14Parser::ConditionContext::initializerClause() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::ConditionContext::bracedInitList() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ConditionContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConditionContext::getRuleIndex() const { + return CPP14Parser::RuleCondition; +} + + +CPP14Parser::ConditionContext* CPP14Parser::condition() { + ConditionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 106, CPP14Parser::RuleCondition); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(906); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 85, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(895); + expression(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(897); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(896); + attributeSpecifierSeq(); + } + setState(899); + declSpecifierSeq(); + setState(900); + declarator(); + setState(904); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Assign: { + setState(901); + match(CPP14Parser::Assign); + setState(902); + initializerClause(); + break; + } + + case CPP14Parser::LeftBrace: { + setState(903); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- IterationStatementContext ------------------------------------------------------------------ + +CPP14Parser::IterationStatementContext::IterationStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::While() { + return getToken(CPP14Parser::While, 0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ConditionContext* CPP14Parser::IterationStatementContext::condition() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::StatementContext* CPP14Parser::IterationStatementContext::statement() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::Do() { + return getToken(CPP14Parser::Do, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::IterationStatementContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::For() { + return getToken(CPP14Parser::For, 0); +} + +CPP14Parser::ForInitStatementContext* CPP14Parser::IterationStatementContext::forInitStatement() { + return getRuleContext(0); +} + +CPP14Parser::ForRangeDeclarationContext* CPP14Parser::IterationStatementContext::forRangeDeclaration() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::IterationStatementContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::ForRangeInitializerContext* CPP14Parser::IterationStatementContext::forRangeInitializer() { + return getRuleContext(0); +} + + +size_t CPP14Parser::IterationStatementContext::getRuleIndex() const { + return CPP14Parser::RuleIterationStatement; +} + + +CPP14Parser::IterationStatementContext* CPP14Parser::iterationStatement() { + IterationStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 108, CPP14Parser::RuleIterationStatement); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(941); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::While: { + enterOuterAlt(_localctx, 1); + setState(908); + match(CPP14Parser::While); + setState(909); + match(CPP14Parser::LeftParen); + setState(910); + condition(); + setState(911); + match(CPP14Parser::RightParen); + setState(912); + statement(); + break; + } + + case CPP14Parser::Do: { + enterOuterAlt(_localctx, 2); + setState(914); + match(CPP14Parser::Do); + setState(915); + statement(); + setState(916); + match(CPP14Parser::While); + setState(917); + match(CPP14Parser::LeftParen); + setState(918); + expression(); + setState(919); + match(CPP14Parser::RightParen); + setState(920); + match(CPP14Parser::Semi); + break; + } + + case CPP14Parser::For: { + enterOuterAlt(_localctx, 3); + setState(922); + match(CPP14Parser::For); + setState(923); + match(CPP14Parser::LeftParen); + setState(936); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 88, _ctx)) { + case 1: { + setState(924); + forInitStatement(); + setState(926); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -714116761242538754) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384301683) != 0) || _la == CPP14Parser::Identifier) { + setState(925); + condition(); + } + setState(928); + match(CPP14Parser::Semi); + setState(930); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { + setState(929); + expression(); + } + break; + } + + case 2: { + setState(932); + forRangeDeclaration(); + setState(933); + match(CPP14Parser::Colon); + setState(934); + forRangeInitializer(); + break; + } + + default: + break; + } + setState(938); + match(CPP14Parser::RightParen); + setState(939); + statement(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ForInitStatementContext ------------------------------------------------------------------ + +CPP14Parser::ForInitStatementContext::ForInitStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ExpressionStatementContext* CPP14Parser::ForInitStatementContext::expressionStatement() { + return getRuleContext(0); +} + +CPP14Parser::SimpleDeclarationContext* CPP14Parser::ForInitStatementContext::simpleDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ForInitStatementContext::getRuleIndex() const { + return CPP14Parser::RuleForInitStatement; +} + + +CPP14Parser::ForInitStatementContext* CPP14Parser::forInitStatement() { + ForInitStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 110, CPP14Parser::RuleForInitStatement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(945); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 90, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(943); + expressionStatement(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(944); + simpleDeclaration(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ForRangeDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::ForRangeDeclarationContext::ForRangeDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ForRangeDeclarationContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclaratorContext* CPP14Parser::ForRangeDeclarationContext::declarator() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ForRangeDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ForRangeDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleForRangeDeclaration; +} + + +CPP14Parser::ForRangeDeclarationContext* CPP14Parser::forRangeDeclaration() { + ForRangeDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 112, CPP14Parser::RuleForRangeDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(948); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(947); + attributeSpecifierSeq(); + } + setState(950); + declSpecifierSeq(); + setState(951); + declarator(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ForRangeInitializerContext ------------------------------------------------------------------ + +CPP14Parser::ForRangeInitializerContext::ForRangeInitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ExpressionContext* CPP14Parser::ForRangeInitializerContext::expression() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::ForRangeInitializerContext::bracedInitList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ForRangeInitializerContext::getRuleIndex() const { + return CPP14Parser::RuleForRangeInitializer; +} + + +CPP14Parser::ForRangeInitializerContext* CPP14Parser::forRangeInitializer() { + ForRangeInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 114, CPP14Parser::RuleForRangeInitializer); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(955); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::Alignof: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Const_cast: + case CPP14Parser::Decltype: + case CPP14Parser::Delete: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Operator: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static_cast: + case CPP14Parser::This: + case CPP14Parser::Throw: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(953); + expression(); + break; + } + + case CPP14Parser::LeftBrace: { + enterOuterAlt(_localctx, 2); + setState(954); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JumpStatementContext ------------------------------------------------------------------ + +CPP14Parser::JumpStatementContext::JumpStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Break() { + return getToken(CPP14Parser::Break, 0); +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Continue() { + return getToken(CPP14Parser::Continue, 0); +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Return() { + return getToken(CPP14Parser::Return, 0); +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Goto() { + return getToken(CPP14Parser::Goto, 0); +} + +tree::TerminalNode* CPP14Parser::JumpStatementContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::JumpStatementContext::expression() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::JumpStatementContext::bracedInitList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::JumpStatementContext::getRuleIndex() const { + return CPP14Parser::RuleJumpStatement; +} + + +CPP14Parser::JumpStatementContext* CPP14Parser::jumpStatement() { + JumpStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 116, CPP14Parser::RuleJumpStatement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(966); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Break: { + setState(957); + match(CPP14Parser::Break); + break; + } + + case CPP14Parser::Continue: { + setState(958); + match(CPP14Parser::Continue); + break; + } + + case CPP14Parser::Return: { + setState(959); + match(CPP14Parser::Return); + setState(962); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::Alignof: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Const_cast: + case CPP14Parser::Decltype: + case CPP14Parser::Delete: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Operator: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static_cast: + case CPP14Parser::This: + case CPP14Parser::Throw: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + setState(960); + expression(); + break; + } + + case CPP14Parser::LeftBrace: { + setState(961); + bracedInitList(); + break; + } + + case CPP14Parser::Semi: { + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::Goto: { + setState(964); + match(CPP14Parser::Goto); + setState(965); + match(CPP14Parser::Identifier); + break; + } + + default: + throw NoViableAltException(this); + } + setState(968); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclarationStatementContext ------------------------------------------------------------------ + +CPP14Parser::DeclarationStatementContext::DeclarationStatementContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::BlockDeclarationContext* CPP14Parser::DeclarationStatementContext::blockDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::DeclarationStatementContext::getRuleIndex() const { + return CPP14Parser::RuleDeclarationStatement; +} + + +CPP14Parser::DeclarationStatementContext* CPP14Parser::declarationStatement() { + DeclarationStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 118, CPP14Parser::RuleDeclarationStatement); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(970); + blockDeclaration(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclarationseqContext ------------------------------------------------------------------ + +CPP14Parser::DeclarationseqContext::DeclarationseqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::DeclarationseqContext::declaration() { + return getRuleContexts(); +} + +CPP14Parser::DeclarationContext* CPP14Parser::DeclarationseqContext::declaration(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::DeclarationseqContext::getRuleIndex() const { + return CPP14Parser::RuleDeclarationseq; +} + + +CPP14Parser::DeclarationseqContext* CPP14Parser::declarationseq() { + DeclarationseqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 120, CPP14Parser::RuleDeclarationseq); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(973); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(972); + declaration(); + setState(975); + _errHandler->sync(this); + _la = _input->LA(1); + } while (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 459384754220313597) != 0)); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclarationContext ------------------------------------------------------------------ + +CPP14Parser::DeclarationContext::DeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::BlockDeclarationContext* CPP14Parser::DeclarationContext::blockDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::FunctionDefinitionContext* CPP14Parser::DeclarationContext::functionDefinition() { + return getRuleContext(0); +} + +CPP14Parser::TemplateDeclarationContext* CPP14Parser::DeclarationContext::templateDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::ExplicitInstantiationContext* CPP14Parser::DeclarationContext::explicitInstantiation() { + return getRuleContext(0); +} + +CPP14Parser::ExplicitSpecializationContext* CPP14Parser::DeclarationContext::explicitSpecialization() { + return getRuleContext(0); +} + +CPP14Parser::LinkageSpecificationContext* CPP14Parser::DeclarationContext::linkageSpecification() { + return getRuleContext(0); +} + +CPP14Parser::NamespaceDefinitionContext* CPP14Parser::DeclarationContext::namespaceDefinition() { + return getRuleContext(0); +} + +CPP14Parser::EmptyDeclarationContext* CPP14Parser::DeclarationContext::emptyDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::AttributeDeclarationContext* CPP14Parser::DeclarationContext::attributeDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::DeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleDeclaration; +} + + +CPP14Parser::DeclarationContext* CPP14Parser::declaration() { + DeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 122, CPP14Parser::RuleDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(986); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 96, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(977); + blockDeclaration(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(978); + functionDefinition(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(979); + templateDeclaration(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(980); + explicitInstantiation(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(981); + explicitSpecialization(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(982); + linkageSpecification(); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(983); + namespaceDefinition(); + break; + } + + case 8: { + enterOuterAlt(_localctx, 8); + setState(984); + emptyDeclaration(); + break; + } + + case 9: { + enterOuterAlt(_localctx, 9); + setState(985); + attributeDeclaration(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BlockDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::BlockDeclarationContext::BlockDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::SimpleDeclarationContext* CPP14Parser::BlockDeclarationContext::simpleDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::AsmDefinitionContext* CPP14Parser::BlockDeclarationContext::asmDefinition() { + return getRuleContext(0); +} + +CPP14Parser::NamespaceAliasDefinitionContext* CPP14Parser::BlockDeclarationContext::namespaceAliasDefinition() { + return getRuleContext(0); +} + +CPP14Parser::UsingDeclarationContext* CPP14Parser::BlockDeclarationContext::usingDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::UsingDirectiveContext* CPP14Parser::BlockDeclarationContext::usingDirective() { + return getRuleContext(0); +} + +CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::BlockDeclarationContext::staticAssertDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::AliasDeclarationContext* CPP14Parser::BlockDeclarationContext::aliasDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::OpaqueEnumDeclarationContext* CPP14Parser::BlockDeclarationContext::opaqueEnumDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::BlockDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleBlockDeclaration; +} + + +CPP14Parser::BlockDeclarationContext* CPP14Parser::blockDeclaration() { + BlockDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 124, CPP14Parser::RuleBlockDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(996); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 97, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(988); + simpleDeclaration(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(989); + asmDefinition(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(990); + namespaceAliasDefinition(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(991); + usingDeclaration(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(992); + usingDirective(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(993); + staticAssertDeclaration(); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(994); + aliasDeclaration(); + break; + } + + case 8: { + enterOuterAlt(_localctx, 8); + setState(995); + opaqueEnumDeclaration(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AliasDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::AliasDeclarationContext::AliasDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Using() { + return getToken(CPP14Parser::Using, 0); +} + +tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::AliasDeclarationContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::AliasDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AliasDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleAliasDeclaration; +} + + +CPP14Parser::AliasDeclarationContext* CPP14Parser::aliasDeclaration() { + AliasDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 126, CPP14Parser::RuleAliasDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(998); + match(CPP14Parser::Using); + setState(999); + match(CPP14Parser::Identifier); + setState(1001); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1000); + attributeSpecifierSeq(); + } + setState(1003); + match(CPP14Parser::Assign); + setState(1004); + theTypeId(); + setState(1005); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::SimpleDeclarationContext::SimpleDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::SimpleDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::SimpleDeclarationContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::InitDeclaratorListContext* CPP14Parser::SimpleDeclarationContext::initDeclaratorList() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::SimpleDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::SimpleDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleDeclaration; +} + + +CPP14Parser::SimpleDeclarationContext* CPP14Parser::simpleDeclaration() { + SimpleDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 128, CPP14Parser::RuleSimpleDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1021); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Constexpr: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Explicit: + case CPP14Parser::Extern: + case CPP14Parser::Float: + case CPP14Parser::Friend: + case CPP14Parser::Inline: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Mutable: + case CPP14Parser::Operator: + case CPP14Parser::Register: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Static: + case CPP14Parser::Struct: + case CPP14Parser::Thread_local: + case CPP14Parser::Typedef: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Virtual: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Tilde: + case CPP14Parser::AndAnd: + case CPP14Parser::Doublecolon: + case CPP14Parser::Semi: + case CPP14Parser::Ellipsis: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(1008); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 99, _ctx)) { + case 1: { + setState(1007); + declSpecifierSeq(); + break; + } + + default: + break; + } + setState(1011); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Decltype + + || _la == CPP14Parser::Operator || ((((_la - 85) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 85)) & 215512868999425) != 0)) { + setState(1010); + initDeclaratorList(); + } + setState(1013); + match(CPP14Parser::Semi); + break; + } + + case CPP14Parser::Alignas: + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 2); + setState(1014); + attributeSpecifierSeq(); + setState(1016); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 101, _ctx)) { + case 1: { + setState(1015); + declSpecifierSeq(); + break; + } + + default: + break; + } + setState(1018); + initDeclaratorList(); + setState(1019); + match(CPP14Parser::Semi); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- StaticAssertDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::StaticAssertDeclarationContext::StaticAssertDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Static_assert() { + return getToken(CPP14Parser::Static_assert, 0); +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::StaticAssertDeclarationContext::constantExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::StringLiteral() { + return getToken(CPP14Parser::StringLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + + +size_t CPP14Parser::StaticAssertDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleStaticAssertDeclaration; +} + + +CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::staticAssertDeclaration() { + StaticAssertDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 130, CPP14Parser::RuleStaticAssertDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1023); + match(CPP14Parser::Static_assert); + setState(1024); + match(CPP14Parser::LeftParen); + setState(1025); + constantExpression(); + setState(1026); + match(CPP14Parser::Comma); + setState(1027); + match(CPP14Parser::StringLiteral); + setState(1028); + match(CPP14Parser::RightParen); + setState(1029); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EmptyDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::EmptyDeclarationContext::EmptyDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::EmptyDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + + +size_t CPP14Parser::EmptyDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleEmptyDeclaration; +} + + +CPP14Parser::EmptyDeclarationContext* CPP14Parser::emptyDeclaration() { + EmptyDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 132, CPP14Parser::RuleEmptyDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1031); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::AttributeDeclarationContext::AttributeDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::AttributeDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::AttributeDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + + +size_t CPP14Parser::AttributeDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeDeclaration; +} + + +CPP14Parser::AttributeDeclarationContext* CPP14Parser::attributeDeclaration() { + AttributeDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 134, CPP14Parser::RuleAttributeDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1033); + attributeSpecifierSeq(); + setState(1034); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::DeclSpecifierContext::DeclSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::StorageClassSpecifierContext* CPP14Parser::DeclSpecifierContext::storageClassSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::TypeSpecifierContext* CPP14Parser::DeclSpecifierContext::typeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::FunctionSpecifierContext* CPP14Parser::DeclSpecifierContext::functionSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Friend() { + return getToken(CPP14Parser::Friend, 0); +} + +tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Typedef() { + return getToken(CPP14Parser::Typedef, 0); +} + +tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Constexpr() { + return getToken(CPP14Parser::Constexpr, 0); +} + + +size_t CPP14Parser::DeclSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleDeclSpecifier; +} + + +CPP14Parser::DeclSpecifierContext* CPP14Parser::declSpecifier() { + DeclSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 136, CPP14Parser::RuleDeclSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1042); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Extern: + case CPP14Parser::Mutable: + case CPP14Parser::Register: + case CPP14Parser::Static: + case CPP14Parser::Thread_local: { + enterOuterAlt(_localctx, 1); + setState(1036); + storageClassSpecifier(); + break; + } + + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Struct: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 2); + setState(1037); + typeSpecifier(); + break; + } + + case CPP14Parser::Explicit: + case CPP14Parser::Inline: + case CPP14Parser::Virtual: { + enterOuterAlt(_localctx, 3); + setState(1038); + functionSpecifier(); + break; + } + + case CPP14Parser::Friend: { + enterOuterAlt(_localctx, 4); + setState(1039); + match(CPP14Parser::Friend); + break; + } + + case CPP14Parser::Typedef: { + enterOuterAlt(_localctx, 5); + setState(1040); + match(CPP14Parser::Typedef); + break; + } + + case CPP14Parser::Constexpr: { + enterOuterAlt(_localctx, 6); + setState(1041); + match(CPP14Parser::Constexpr); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclSpecifierSeqContext ------------------------------------------------------------------ + +CPP14Parser::DeclSpecifierSeqContext::DeclSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::DeclSpecifierSeqContext::declSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::DeclSpecifierContext* CPP14Parser::DeclSpecifierSeqContext::declSpecifier(size_t i) { + return getRuleContext(i); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::DeclSpecifierSeqContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::DeclSpecifierSeqContext::getRuleIndex() const { + return CPP14Parser::RuleDeclSpecifierSeq; +} + + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::declSpecifierSeq() { + DeclSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 138, CPP14Parser::RuleDeclSpecifierSeq); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1045); + _errHandler->sync(this); + alt = 1 + 1; + do { + switch (alt) { + case 1 + 1: { + setState(1044); + declSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1047); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 104, _ctx); + } while (alt != 1 && alt != atn::ATN::INVALID_ALT_NUMBER); + setState(1050); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 105, _ctx)) { + case 1: { + setState(1049); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- StorageClassSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::StorageClassSpecifierContext::StorageClassSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Register() { + return getToken(CPP14Parser::Register, 0); +} + +tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Static() { + return getToken(CPP14Parser::Static, 0); +} + +tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Thread_local() { + return getToken(CPP14Parser::Thread_local, 0); +} + +tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Extern() { + return getToken(CPP14Parser::Extern, 0); +} + +tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Mutable() { + return getToken(CPP14Parser::Mutable, 0); +} + + +size_t CPP14Parser::StorageClassSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleStorageClassSpecifier; +} + + +CPP14Parser::StorageClassSpecifierContext* CPP14Parser::storageClassSpecifier() { + StorageClassSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 140, CPP14Parser::RuleStorageClassSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1052); + _la = _input->LA(1); + if (!(((((_la - 36) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 36)) & 17316186113) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FunctionSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::FunctionSpecifierContext::FunctionSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Inline() { + return getToken(CPP14Parser::Inline, 0); +} + +tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Virtual() { + return getToken(CPP14Parser::Virtual, 0); +} + +tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Explicit() { + return getToken(CPP14Parser::Explicit, 0); +} + + +size_t CPP14Parser::FunctionSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleFunctionSpecifier; +} + + +CPP14Parser::FunctionSpecifierContext* CPP14Parser::functionSpecifier() { + FunctionSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 142, CPP14Parser::RuleFunctionSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1054); + _la = _input->LA(1); + if (!(((((_la - 34) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 34)) & 70368744178689) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypedefNameContext ------------------------------------------------------------------ + +CPP14Parser::TypedefNameContext::TypedefNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TypedefNameContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::TypedefNameContext::getRuleIndex() const { + return CPP14Parser::RuleTypedefName; +} + + +CPP14Parser::TypedefNameContext* CPP14Parser::typedefName() { + TypedefNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 144, CPP14Parser::RuleTypedefName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1056); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::TypeSpecifierContext::TypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::TypeSpecifierContext::trailingTypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::ClassSpecifierContext* CPP14Parser::TypeSpecifierContext::classSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::EnumSpecifierContext* CPP14Parser::TypeSpecifierContext::enumSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleTypeSpecifier; +} + + +CPP14Parser::TypeSpecifierContext* CPP14Parser::typeSpecifier() { + TypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 146, CPP14Parser::RuleTypeSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1061); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 106, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1058); + trailingTypeSpecifier(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1059); + classSpecifier(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1060); + enumSpecifier(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TrailingTypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::TrailingTypeSpecifierContext::TrailingTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::simpleTypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::ElaboratedTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::elaboratedTypeSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::TypeNameSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::typeNameSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::CvQualifierContext* CPP14Parser::TrailingTypeSpecifierContext::cvQualifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TrailingTypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleTrailingTypeSpecifier; +} + + +CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::trailingTypeSpecifier() { + TrailingTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 148, CPP14Parser::RuleTrailingTypeSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1067); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(1063); + simpleTypeSpecifier(); + break; + } + + case CPP14Parser::Class: + case CPP14Parser::Enum: + case CPP14Parser::Struct: { + enterOuterAlt(_localctx, 2); + setState(1064); + elaboratedTypeSpecifier(); + break; + } + + case CPP14Parser::Typename_: { + enterOuterAlt(_localctx, 3); + setState(1065); + typeNameSpecifier(); + break; + } + + case CPP14Parser::Const: + case CPP14Parser::Volatile: { + enterOuterAlt(_localctx, 4); + setState(1066); + cvQualifier(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypeSpecifierSeqContext ------------------------------------------------------------------ + +CPP14Parser::TypeSpecifierSeqContext::TypeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::TypeSpecifierSeqContext::typeSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::TypeSpecifierContext* CPP14Parser::TypeSpecifierSeqContext::typeSpecifier(size_t i) { + return getRuleContext(i); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::TypeSpecifierSeqContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TypeSpecifierSeqContext::getRuleIndex() const { + return CPP14Parser::RuleTypeSpecifierSeq; +} + + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::typeSpecifierSeq() { + TypeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 150, CPP14Parser::RuleTypeSpecifierSeq); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1070); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1069); + typeSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1072); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 108, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + setState(1075); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 109, _ctx)) { + case 1: { + setState(1074); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TrailingTypeSpecifierSeqContext ------------------------------------------------------------------ + +CPP14Parser::TrailingTypeSpecifierSeqContext::TrailingTypeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::TrailingTypeSpecifierSeqContext::trailingTypeSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierSeqContext::trailingTypeSpecifier(size_t i) { + return getRuleContext(i); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::TrailingTypeSpecifierSeqContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TrailingTypeSpecifierSeqContext::getRuleIndex() const { + return CPP14Parser::RuleTrailingTypeSpecifierSeq; +} + + +CPP14Parser::TrailingTypeSpecifierSeqContext* CPP14Parser::trailingTypeSpecifierSeq() { + TrailingTypeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 152, CPP14Parser::RuleTrailingTypeSpecifierSeq); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1078); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1077); + trailingTypeSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1080); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 110, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + setState(1083); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 111, _ctx)) { + case 1: { + setState(1082); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleTypeLengthModifierContext ------------------------------------------------------------------ + +CPP14Parser::SimpleTypeLengthModifierContext::SimpleTypeLengthModifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::SimpleTypeLengthModifierContext::Short() { + return getToken(CPP14Parser::Short, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeLengthModifierContext::Long() { + return getToken(CPP14Parser::Long, 0); +} + + +size_t CPP14Parser::SimpleTypeLengthModifierContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleTypeLengthModifier; +} + + +CPP14Parser::SimpleTypeLengthModifierContext* CPP14Parser::simpleTypeLengthModifier() { + SimpleTypeLengthModifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 154, CPP14Parser::RuleSimpleTypeLengthModifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1085); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Long + + || _la == CPP14Parser::Short)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleTypeSignednessModifierContext ------------------------------------------------------------------ + +CPP14Parser::SimpleTypeSignednessModifierContext::SimpleTypeSignednessModifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSignednessModifierContext::Unsigned() { + return getToken(CPP14Parser::Unsigned, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSignednessModifierContext::Signed() { + return getToken(CPP14Parser::Signed, 0); +} + + +size_t CPP14Parser::SimpleTypeSignednessModifierContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleTypeSignednessModifier; +} + + +CPP14Parser::SimpleTypeSignednessModifierContext* CPP14Parser::simpleTypeSignednessModifier() { + SimpleTypeSignednessModifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 156, CPP14Parser::RuleSimpleTypeSignednessModifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1087); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleTypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::SimpleTypeSpecifierContext::SimpleTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TheTypeNameContext* CPP14Parser::SimpleTypeSpecifierContext::theTypeName() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::SimpleTypeSpecifierContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTemplateId() { + return getRuleContext(0); +} + +CPP14Parser::SimpleTypeSignednessModifierContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTypeSignednessModifier() { + return getRuleContext(0); +} + +std::vector CPP14Parser::SimpleTypeSpecifierContext::simpleTypeLengthModifier() { + return getRuleContexts(); +} + +CPP14Parser::SimpleTypeLengthModifierContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTypeLengthModifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char() { + return getToken(CPP14Parser::Char, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char16() { + return getToken(CPP14Parser::Char16, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char32() { + return getToken(CPP14Parser::Char32, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Wchar() { + return getToken(CPP14Parser::Wchar, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Bool() { + return getToken(CPP14Parser::Bool, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Int() { + return getToken(CPP14Parser::Int, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Float() { + return getToken(CPP14Parser::Float, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Double() { + return getToken(CPP14Parser::Double, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Void() { + return getToken(CPP14Parser::Void, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Auto() { + return getToken(CPP14Parser::Auto, 0); +} + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::SimpleTypeSpecifierContext::decltypeSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::SimpleTypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleTypeSpecifier; +} + + +CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::simpleTypeSpecifier() { + SimpleTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 158, CPP14Parser::RuleSimpleTypeSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + setState(1141); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 122, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1090); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 112, _ctx)) { + case 1: { + setState(1089); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1092); + theTypeName(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1093); + nestedNameSpecifier(0); + setState(1094); + match(CPP14Parser::Template); + setState(1095); + simpleTemplateId(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1097); + simpleTypeSignednessModifier(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(1099); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1098); + simpleTypeSignednessModifier(); + } + setState(1102); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1101); + simpleTypeLengthModifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1104); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 114, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(1107); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1106); + simpleTypeSignednessModifier(); + } + setState(1109); + match(CPP14Parser::Char); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(1111); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1110); + simpleTypeSignednessModifier(); + } + setState(1113); + match(CPP14Parser::Char16); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(1115); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1114); + simpleTypeSignednessModifier(); + } + setState(1117); + match(CPP14Parser::Char32); + break; + } + + case 8: { + enterOuterAlt(_localctx, 8); + setState(1119); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1118); + simpleTypeSignednessModifier(); + } + setState(1121); + match(CPP14Parser::Wchar); + break; + } + + case 9: { + enterOuterAlt(_localctx, 9); + setState(1122); + match(CPP14Parser::Bool); + break; + } + + case 10: { + enterOuterAlt(_localctx, 10); + setState(1124); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Signed + + || _la == CPP14Parser::Unsigned) { + setState(1123); + simpleTypeSignednessModifier(); + } + setState(1129); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Long + + || _la == CPP14Parser::Short) { + setState(1126); + simpleTypeLengthModifier(); + setState(1131); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1132); + match(CPP14Parser::Int); + break; + } + + case 11: { + enterOuterAlt(_localctx, 11); + setState(1133); + match(CPP14Parser::Float); + break; + } + + case 12: { + enterOuterAlt(_localctx, 12); + setState(1135); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Long + + || _la == CPP14Parser::Short) { + setState(1134); + simpleTypeLengthModifier(); + } + setState(1137); + match(CPP14Parser::Double); + break; + } + + case 13: { + enterOuterAlt(_localctx, 13); + setState(1138); + match(CPP14Parser::Void); + break; + } + + case 14: { + enterOuterAlt(_localctx, 14); + setState(1139); + match(CPP14Parser::Auto); + break; + } + + case 15: { + enterOuterAlt(_localctx, 15); + setState(1140); + decltypeSpecifier(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TheTypeNameContext ------------------------------------------------------------------ + +CPP14Parser::TheTypeNameContext::TheTypeNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassNameContext* CPP14Parser::TheTypeNameContext::className() { + return getRuleContext(0); +} + +CPP14Parser::EnumNameContext* CPP14Parser::TheTypeNameContext::enumName() { + return getRuleContext(0); +} + +CPP14Parser::TypedefNameContext* CPP14Parser::TheTypeNameContext::typedefName() { + return getRuleContext(0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TheTypeNameContext::simpleTemplateId() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TheTypeNameContext::getRuleIndex() const { + return CPP14Parser::RuleTheTypeName; +} + + +CPP14Parser::TheTypeNameContext* CPP14Parser::theTypeName() { + TheTypeNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 160, CPP14Parser::RuleTheTypeName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1147); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 123, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1143); + className(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1144); + enumName(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1145); + typedefName(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(1146); + simpleTemplateId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DecltypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::DecltypeSpecifierContext::DecltypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::Decltype() { + return getToken(CPP14Parser::Decltype, 0); +} + +tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::ExpressionContext* CPP14Parser::DecltypeSpecifierContext::expression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::Auto() { + return getToken(CPP14Parser::Auto, 0); +} + + +size_t CPP14Parser::DecltypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleDecltypeSpecifier; +} + + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::decltypeSpecifier() { + DecltypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 162, CPP14Parser::RuleDecltypeSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1149); + match(CPP14Parser::Decltype); + setState(1150); + match(CPP14Parser::LeftParen); + setState(1153); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 124, _ctx)) { + case 1: { + setState(1151); + expression(); + break; + } + + case 2: { + setState(1152); + match(CPP14Parser::Auto); + break; + } + + default: + break; + } + setState(1155); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ElaboratedTypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::ElaboratedTypeSpecifierContext::ElaboratedTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassKeyContext* CPP14Parser::ElaboratedTypeSpecifierContext::classKey() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::ElaboratedTypeSpecifierContext::simpleTemplateId() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ElaboratedTypeSpecifierContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ElaboratedTypeSpecifierContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Enum() { + return getToken(CPP14Parser::Enum, 0); +} + + +size_t CPP14Parser::ElaboratedTypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleElaboratedTypeSpecifier; +} + + +CPP14Parser::ElaboratedTypeSpecifierContext* CPP14Parser::elaboratedTypeSpecifier() { + ElaboratedTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 164, CPP14Parser::RuleElaboratedTypeSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1179); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Class: + case CPP14Parser::Struct: { + enterOuterAlt(_localctx, 1); + setState(1157); + classKey(); + setState(1172); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 128, _ctx)) { + case 1: { + setState(1159); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1158); + attributeSpecifierSeq(); + } + setState(1162); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 126, _ctx)) { + case 1: { + setState(1161); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1164); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + setState(1165); + simpleTemplateId(); + break; + } + + case 3: { + setState(1166); + nestedNameSpecifier(0); + setState(1168); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(1167); + match(CPP14Parser::Template); + } + setState(1170); + simpleTemplateId(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::Enum: { + enterOuterAlt(_localctx, 2); + setState(1174); + match(CPP14Parser::Enum); + setState(1176); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 129, _ctx)) { + case 1: { + setState(1175); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1178); + match(CPP14Parser::Identifier); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumNameContext ------------------------------------------------------------------ + +CPP14Parser::EnumNameContext::EnumNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::EnumNameContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::EnumNameContext::getRuleIndex() const { + return CPP14Parser::RuleEnumName; +} + + +CPP14Parser::EnumNameContext* CPP14Parser::enumName() { + EnumNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 166, CPP14Parser::RuleEnumName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1181); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::EnumSpecifierContext::EnumSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::EnumHeadContext* CPP14Parser::EnumSpecifierContext::enumHead() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::EnumSpecifierContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::EnumSpecifierContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +CPP14Parser::EnumeratorListContext* CPP14Parser::EnumSpecifierContext::enumeratorList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::EnumSpecifierContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + + +size_t CPP14Parser::EnumSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleEnumSpecifier; +} + + +CPP14Parser::EnumSpecifierContext* CPP14Parser::enumSpecifier() { + EnumSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 168, CPP14Parser::RuleEnumSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1183); + enumHead(); + setState(1184); + match(CPP14Parser::LeftBrace); + setState(1189); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(1185); + enumeratorList(); + setState(1187); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Comma) { + setState(1186); + match(CPP14Parser::Comma); + } + } + setState(1191); + match(CPP14Parser::RightBrace); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumHeadContext ------------------------------------------------------------------ + +CPP14Parser::EnumHeadContext::EnumHeadContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::EnumkeyContext* CPP14Parser::EnumHeadContext::enumkey() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::EnumHeadContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::EnumHeadContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::EnumbaseContext* CPP14Parser::EnumHeadContext::enumbase() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::EnumHeadContext::nestedNameSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::EnumHeadContext::getRuleIndex() const { + return CPP14Parser::RuleEnumHead; +} + + +CPP14Parser::EnumHeadContext* CPP14Parser::enumHead() { + EnumHeadContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 170, CPP14Parser::RuleEnumHead); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1193); + enumkey(); + setState(1195); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1194); + attributeSpecifierSeq(); + } + setState(1201); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon + + || _la == CPP14Parser::Identifier) { + setState(1198); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 134, _ctx)) { + case 1: { + setState(1197); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1200); + match(CPP14Parser::Identifier); + } + setState(1204); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Colon) { + setState(1203); + enumbase(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OpaqueEnumDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::OpaqueEnumDeclarationContext::OpaqueEnumDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::EnumkeyContext* CPP14Parser::OpaqueEnumDeclarationContext::enumkey() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::OpaqueEnumDeclarationContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::OpaqueEnumDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::OpaqueEnumDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::EnumbaseContext* CPP14Parser::OpaqueEnumDeclarationContext::enumbase() { + return getRuleContext(0); +} + + +size_t CPP14Parser::OpaqueEnumDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleOpaqueEnumDeclaration; +} + + +CPP14Parser::OpaqueEnumDeclarationContext* CPP14Parser::opaqueEnumDeclaration() { + OpaqueEnumDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 172, CPP14Parser::RuleOpaqueEnumDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1206); + enumkey(); + setState(1208); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1207); + attributeSpecifierSeq(); + } + setState(1210); + match(CPP14Parser::Identifier); + setState(1212); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Colon) { + setState(1211); + enumbase(); + } + setState(1214); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumkeyContext ------------------------------------------------------------------ + +CPP14Parser::EnumkeyContext::EnumkeyContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::EnumkeyContext::Enum() { + return getToken(CPP14Parser::Enum, 0); +} + +tree::TerminalNode* CPP14Parser::EnumkeyContext::Class() { + return getToken(CPP14Parser::Class, 0); +} + +tree::TerminalNode* CPP14Parser::EnumkeyContext::Struct() { + return getToken(CPP14Parser::Struct, 0); +} + + +size_t CPP14Parser::EnumkeyContext::getRuleIndex() const { + return CPP14Parser::RuleEnumkey; +} + + +CPP14Parser::EnumkeyContext* CPP14Parser::enumkey() { + EnumkeyContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 174, CPP14Parser::RuleEnumkey); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1216); + match(CPP14Parser::Enum); + setState(1218); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Class + + || _la == CPP14Parser::Struct) { + setState(1217); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Class + + || _la == CPP14Parser::Struct)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumbaseContext ------------------------------------------------------------------ + +CPP14Parser::EnumbaseContext::EnumbaseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::EnumbaseContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::EnumbaseContext::typeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::EnumbaseContext::getRuleIndex() const { + return CPP14Parser::RuleEnumbase; +} + + +CPP14Parser::EnumbaseContext* CPP14Parser::enumbase() { + EnumbaseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 176, CPP14Parser::RuleEnumbase); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1220); + match(CPP14Parser::Colon); + setState(1221); + typeSpecifierSeq(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumeratorListContext ------------------------------------------------------------------ + +CPP14Parser::EnumeratorListContext::EnumeratorListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::EnumeratorListContext::enumeratorDefinition() { + return getRuleContexts(); +} + +CPP14Parser::EnumeratorDefinitionContext* CPP14Parser::EnumeratorListContext::enumeratorDefinition(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::EnumeratorListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::EnumeratorListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::EnumeratorListContext::getRuleIndex() const { + return CPP14Parser::RuleEnumeratorList; +} + + +CPP14Parser::EnumeratorListContext* CPP14Parser::enumeratorList() { + EnumeratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 178, CPP14Parser::RuleEnumeratorList); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1223); + enumeratorDefinition(); + setState(1228); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 140, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1224); + match(CPP14Parser::Comma); + setState(1225); + enumeratorDefinition(); + } + setState(1230); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 140, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumeratorDefinitionContext ------------------------------------------------------------------ + +CPP14Parser::EnumeratorDefinitionContext::EnumeratorDefinitionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::EnumeratorContext* CPP14Parser::EnumeratorDefinitionContext::enumerator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::EnumeratorDefinitionContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::EnumeratorDefinitionContext::constantExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::EnumeratorDefinitionContext::getRuleIndex() const { + return CPP14Parser::RuleEnumeratorDefinition; +} + + +CPP14Parser::EnumeratorDefinitionContext* CPP14Parser::enumeratorDefinition() { + EnumeratorDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 180, CPP14Parser::RuleEnumeratorDefinition); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1231); + enumerator(); + setState(1234); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Assign) { + setState(1232); + match(CPP14Parser::Assign); + setState(1233); + constantExpression(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumeratorContext ------------------------------------------------------------------ + +CPP14Parser::EnumeratorContext::EnumeratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::EnumeratorContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::EnumeratorContext::getRuleIndex() const { + return CPP14Parser::RuleEnumerator; +} + + +CPP14Parser::EnumeratorContext* CPP14Parser::enumerator() { + EnumeratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 182, CPP14Parser::RuleEnumerator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1236); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NamespaceNameContext ------------------------------------------------------------------ + +CPP14Parser::NamespaceNameContext::NamespaceNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::NamespaceNameContext::originalNamespaceName() { + return getRuleContext(0); +} + +CPP14Parser::NamespaceAliasContext* CPP14Parser::NamespaceNameContext::namespaceAlias() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NamespaceNameContext::getRuleIndex() const { + return CPP14Parser::RuleNamespaceName; +} + + +CPP14Parser::NamespaceNameContext* CPP14Parser::namespaceName() { + NamespaceNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 184, CPP14Parser::RuleNamespaceName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1240); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 142, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1238); + originalNamespaceName(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1239); + namespaceAlias(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OriginalNamespaceNameContext ------------------------------------------------------------------ + +CPP14Parser::OriginalNamespaceNameContext::OriginalNamespaceNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::OriginalNamespaceNameContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::OriginalNamespaceNameContext::getRuleIndex() const { + return CPP14Parser::RuleOriginalNamespaceName; +} + + +CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::originalNamespaceName() { + OriginalNamespaceNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 186, CPP14Parser::RuleOriginalNamespaceName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1242); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NamespaceDefinitionContext ------------------------------------------------------------------ + +CPP14Parser::NamespaceDefinitionContext::NamespaceDefinitionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Namespace() { + return getToken(CPP14Parser::Namespace, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Inline() { + return getToken(CPP14Parser::Inline, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::NamespaceDefinitionContext::originalNamespaceName() { + return getRuleContext(0); +} + +CPP14Parser::DeclarationseqContext* CPP14Parser::NamespaceDefinitionContext::declarationseq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NamespaceDefinitionContext::getRuleIndex() const { + return CPP14Parser::RuleNamespaceDefinition; +} + + +CPP14Parser::NamespaceDefinitionContext* CPP14Parser::namespaceDefinition() { + NamespaceDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 188, CPP14Parser::RuleNamespaceDefinition); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1245); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Inline) { + setState(1244); + match(CPP14Parser::Inline); + } + setState(1247); + match(CPP14Parser::Namespace); + setState(1250); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 144, _ctx)) { + case 1: { + setState(1248); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + setState(1249); + originalNamespaceName(); + break; + } + + default: + break; + } + setState(1252); + match(CPP14Parser::LeftBrace); + setState(1254); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { + setState(1253); + antlrcpp::downCast(_localctx)->namespaceBody = declarationseq(); + } + setState(1256); + match(CPP14Parser::RightBrace); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NamespaceAliasContext ------------------------------------------------------------------ + +CPP14Parser::NamespaceAliasContext::NamespaceAliasContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NamespaceAliasContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::NamespaceAliasContext::getRuleIndex() const { + return CPP14Parser::RuleNamespaceAlias; +} + + +CPP14Parser::NamespaceAliasContext* CPP14Parser::namespaceAlias() { + NamespaceAliasContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 190, CPP14Parser::RuleNamespaceAlias); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1258); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NamespaceAliasDefinitionContext ------------------------------------------------------------------ + +CPP14Parser::NamespaceAliasDefinitionContext::NamespaceAliasDefinitionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Namespace() { + return getToken(CPP14Parser::Namespace, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::QualifiednamespacespecifierContext* CPP14Parser::NamespaceAliasDefinitionContext::qualifiednamespacespecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + + +size_t CPP14Parser::NamespaceAliasDefinitionContext::getRuleIndex() const { + return CPP14Parser::RuleNamespaceAliasDefinition; +} + + +CPP14Parser::NamespaceAliasDefinitionContext* CPP14Parser::namespaceAliasDefinition() { + NamespaceAliasDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 192, CPP14Parser::RuleNamespaceAliasDefinition); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1260); + match(CPP14Parser::Namespace); + setState(1261); + match(CPP14Parser::Identifier); + setState(1262); + match(CPP14Parser::Assign); + setState(1263); + qualifiednamespacespecifier(); + setState(1264); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- QualifiednamespacespecifierContext ------------------------------------------------------------------ + +CPP14Parser::QualifiednamespacespecifierContext::QualifiednamespacespecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::NamespaceNameContext* CPP14Parser::QualifiednamespacespecifierContext::namespaceName() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::QualifiednamespacespecifierContext::nestedNameSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::QualifiednamespacespecifierContext::getRuleIndex() const { + return CPP14Parser::RuleQualifiednamespacespecifier; +} + + +CPP14Parser::QualifiednamespacespecifierContext* CPP14Parser::qualifiednamespacespecifier() { + QualifiednamespacespecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 194, CPP14Parser::RuleQualifiednamespacespecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1267); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 146, _ctx)) { + case 1: { + setState(1266); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1269); + namespaceName(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UsingDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::UsingDeclarationContext::UsingDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Using() { + return getToken(CPP14Parser::Using, 0); +} + +CPP14Parser::UnqualifiedIdContext* CPP14Parser::UsingDeclarationContext::unqualifiedId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::UsingDeclarationContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Typename_() { + return getToken(CPP14Parser::Typename_, 0); +} + + +size_t CPP14Parser::UsingDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleUsingDeclaration; +} + + +CPP14Parser::UsingDeclarationContext* CPP14Parser::usingDeclaration() { + UsingDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 196, CPP14Parser::RuleUsingDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1271); + match(CPP14Parser::Using); + setState(1277); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 148, _ctx)) { + case 1: { + setState(1273); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Typename_) { + setState(1272); + match(CPP14Parser::Typename_); + } + setState(1275); + nestedNameSpecifier(0); + break; + } + + case 2: { + setState(1276); + match(CPP14Parser::Doublecolon); + break; + } + + default: + break; + } + setState(1279); + unqualifiedId(); + setState(1280); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UsingDirectiveContext ------------------------------------------------------------------ + +CPP14Parser::UsingDirectiveContext::UsingDirectiveContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Using() { + return getToken(CPP14Parser::Using, 0); +} + +tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Namespace() { + return getToken(CPP14Parser::Namespace, 0); +} + +CPP14Parser::NamespaceNameContext* CPP14Parser::UsingDirectiveContext::namespaceName() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::UsingDirectiveContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::UsingDirectiveContext::nestedNameSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::UsingDirectiveContext::getRuleIndex() const { + return CPP14Parser::RuleUsingDirective; +} + + +CPP14Parser::UsingDirectiveContext* CPP14Parser::usingDirective() { + UsingDirectiveContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 198, CPP14Parser::RuleUsingDirective); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1283); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1282); + attributeSpecifierSeq(); + } + setState(1285); + match(CPP14Parser::Using); + setState(1286); + match(CPP14Parser::Namespace); + setState(1288); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 150, _ctx)) { + case 1: { + setState(1287); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1290); + namespaceName(); + setState(1291); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AsmDefinitionContext ------------------------------------------------------------------ + +CPP14Parser::AsmDefinitionContext::AsmDefinitionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AsmDefinitionContext::Asm() { + return getToken(CPP14Parser::Asm, 0); +} + +tree::TerminalNode* CPP14Parser::AsmDefinitionContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::AsmDefinitionContext::StringLiteral() { + return getToken(CPP14Parser::StringLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::AsmDefinitionContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +tree::TerminalNode* CPP14Parser::AsmDefinitionContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + + +size_t CPP14Parser::AsmDefinitionContext::getRuleIndex() const { + return CPP14Parser::RuleAsmDefinition; +} + + +CPP14Parser::AsmDefinitionContext* CPP14Parser::asmDefinition() { + AsmDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 200, CPP14Parser::RuleAsmDefinition); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1293); + match(CPP14Parser::Asm); + setState(1294); + match(CPP14Parser::LeftParen); + setState(1295); + match(CPP14Parser::StringLiteral); + setState(1296); + match(CPP14Parser::RightParen); + setState(1297); + match(CPP14Parser::Semi); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LinkageSpecificationContext ------------------------------------------------------------------ + +CPP14Parser::LinkageSpecificationContext::LinkageSpecificationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::Extern() { + return getToken(CPP14Parser::Extern, 0); +} + +tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::StringLiteral() { + return getToken(CPP14Parser::StringLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +CPP14Parser::DeclarationContext* CPP14Parser::LinkageSpecificationContext::declaration() { + return getRuleContext(0); +} + +CPP14Parser::DeclarationseqContext* CPP14Parser::LinkageSpecificationContext::declarationseq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::LinkageSpecificationContext::getRuleIndex() const { + return CPP14Parser::RuleLinkageSpecification; +} + + +CPP14Parser::LinkageSpecificationContext* CPP14Parser::linkageSpecification() { + LinkageSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 202, CPP14Parser::RuleLinkageSpecification); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1299); + match(CPP14Parser::Extern); + setState(1300); + match(CPP14Parser::StringLiteral); + setState(1307); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftBrace: { + setState(1301); + match(CPP14Parser::LeftBrace); + setState(1303); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { + setState(1302); + declarationseq(); + } + setState(1305); + match(CPP14Parser::RightBrace); + break; + } + + case CPP14Parser::Alignas: + case CPP14Parser::Asm: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Constexpr: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Explicit: + case CPP14Parser::Extern: + case CPP14Parser::Float: + case CPP14Parser::Friend: + case CPP14Parser::Inline: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Mutable: + case CPP14Parser::Namespace: + case CPP14Parser::Operator: + case CPP14Parser::Register: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Static: + case CPP14Parser::Static_assert: + case CPP14Parser::Struct: + case CPP14Parser::Template: + case CPP14Parser::Thread_local: + case CPP14Parser::Typedef: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Using: + case CPP14Parser::Virtual: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Tilde: + case CPP14Parser::AndAnd: + case CPP14Parser::Doublecolon: + case CPP14Parser::Semi: + case CPP14Parser::Ellipsis: + case CPP14Parser::Identifier: { + setState(1306); + declaration(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeSpecifierSeqContext ------------------------------------------------------------------ + +CPP14Parser::AttributeSpecifierSeqContext::AttributeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::AttributeSpecifierSeqContext::attributeSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::AttributeSpecifierContext* CPP14Parser::AttributeSpecifierSeqContext::attributeSpecifier(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::AttributeSpecifierSeqContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeSpecifierSeq; +} + + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::attributeSpecifierSeq() { + AttributeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 204, CPP14Parser::RuleAttributeSpecifierSeq); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1310); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1309); + attributeSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1312); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 153, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::AttributeSpecifierContext::AttributeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::AttributeSpecifierContext::LeftBracket() { + return getTokens(CPP14Parser::LeftBracket); +} + +tree::TerminalNode* CPP14Parser::AttributeSpecifierContext::LeftBracket(size_t i) { + return getToken(CPP14Parser::LeftBracket, i); +} + +std::vector CPP14Parser::AttributeSpecifierContext::RightBracket() { + return getTokens(CPP14Parser::RightBracket); +} + +tree::TerminalNode* CPP14Parser::AttributeSpecifierContext::RightBracket(size_t i) { + return getToken(CPP14Parser::RightBracket, i); +} + +CPP14Parser::AttributeListContext* CPP14Parser::AttributeSpecifierContext::attributeList() { + return getRuleContext(0); +} + +CPP14Parser::AlignmentspecifierContext* CPP14Parser::AttributeSpecifierContext::alignmentspecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AttributeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeSpecifier; +} + + +CPP14Parser::AttributeSpecifierContext* CPP14Parser::attributeSpecifier() { + AttributeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 206, CPP14Parser::RuleAttributeSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1322); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 1); + setState(1314); + match(CPP14Parser::LeftBracket); + setState(1315); + match(CPP14Parser::LeftBracket); + setState(1317); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(1316); + attributeList(); + } + setState(1319); + match(CPP14Parser::RightBracket); + setState(1320); + match(CPP14Parser::RightBracket); + break; + } + + case CPP14Parser::Alignas: { + enterOuterAlt(_localctx, 2); + setState(1321); + alignmentspecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AlignmentspecifierContext ------------------------------------------------------------------ + +CPP14Parser::AlignmentspecifierContext::AlignmentspecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::Alignas() { + return getToken(CPP14Parser::Alignas, 0); +} + +tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::AlignmentspecifierContext::theTypeId() { + return getRuleContext(0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::AlignmentspecifierContext::constantExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + + +size_t CPP14Parser::AlignmentspecifierContext::getRuleIndex() const { + return CPP14Parser::RuleAlignmentspecifier; +} + + +CPP14Parser::AlignmentspecifierContext* CPP14Parser::alignmentspecifier() { + AlignmentspecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 208, CPP14Parser::RuleAlignmentspecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1324); + match(CPP14Parser::Alignas); + setState(1325); + match(CPP14Parser::LeftParen); + setState(1328); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 156, _ctx)) { + case 1: { + setState(1326); + theTypeId(); + break; + } + + case 2: { + setState(1327); + constantExpression(); + break; + } + + default: + break; + } + setState(1331); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1330); + match(CPP14Parser::Ellipsis); + } + setState(1333); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeListContext ------------------------------------------------------------------ + +CPP14Parser::AttributeListContext::AttributeListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::AttributeListContext::attribute() { + return getRuleContexts(); +} + +CPP14Parser::AttributeContext* CPP14Parser::AttributeListContext::attribute(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::AttributeListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::AttributeListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + +tree::TerminalNode* CPP14Parser::AttributeListContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + + +size_t CPP14Parser::AttributeListContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeList; +} + + +CPP14Parser::AttributeListContext* CPP14Parser::attributeList() { + AttributeListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 210, CPP14Parser::RuleAttributeList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1335); + attribute(); + setState(1340); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1336); + match(CPP14Parser::Comma); + setState(1337); + attribute(); + setState(1342); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1344); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1343); + match(CPP14Parser::Ellipsis); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeContext ------------------------------------------------------------------ + +CPP14Parser::AttributeContext::AttributeContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AttributeContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::AttributeNamespaceContext* CPP14Parser::AttributeContext::attributeNamespace() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::AttributeContext::Doublecolon() { + return getToken(CPP14Parser::Doublecolon, 0); +} + +CPP14Parser::AttributeArgumentClauseContext* CPP14Parser::AttributeContext::attributeArgumentClause() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AttributeContext::getRuleIndex() const { + return CPP14Parser::RuleAttribute; +} + + +CPP14Parser::AttributeContext* CPP14Parser::attribute() { + AttributeContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 212, CPP14Parser::RuleAttribute); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1349); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 160, _ctx)) { + case 1: { + setState(1346); + attributeNamespace(); + setState(1347); + match(CPP14Parser::Doublecolon); + break; + } + + default: + break; + } + setState(1351); + match(CPP14Parser::Identifier); + setState(1353); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::LeftParen) { + setState(1352); + attributeArgumentClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeNamespaceContext ------------------------------------------------------------------ + +CPP14Parser::AttributeNamespaceContext::AttributeNamespaceContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AttributeNamespaceContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::AttributeNamespaceContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeNamespace; +} + + +CPP14Parser::AttributeNamespaceContext* CPP14Parser::attributeNamespace() { + AttributeNamespaceContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 214, CPP14Parser::RuleAttributeNamespace); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1355); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttributeArgumentClauseContext ------------------------------------------------------------------ + +CPP14Parser::AttributeArgumentClauseContext::AttributeArgumentClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AttributeArgumentClauseContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::AttributeArgumentClauseContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::BalancedTokenSeqContext* CPP14Parser::AttributeArgumentClauseContext::balancedTokenSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AttributeArgumentClauseContext::getRuleIndex() const { + return CPP14Parser::RuleAttributeArgumentClause; +} + + +CPP14Parser::AttributeArgumentClauseContext* CPP14Parser::attributeArgumentClause() { + AttributeArgumentClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 216, CPP14Parser::RuleAttributeArgumentClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1357); + match(CPP14Parser::LeftParen); + setState(1359); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -2) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -88080385) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & 262143) != 0)) { + setState(1358); + balancedTokenSeq(); + } + setState(1361); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BalancedTokenSeqContext ------------------------------------------------------------------ + +CPP14Parser::BalancedTokenSeqContext::BalancedTokenSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::BalancedTokenSeqContext::balancedtoken() { + return getRuleContexts(); +} + +CPP14Parser::BalancedtokenContext* CPP14Parser::BalancedTokenSeqContext::balancedtoken(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::BalancedTokenSeqContext::getRuleIndex() const { + return CPP14Parser::RuleBalancedTokenSeq; +} + + +CPP14Parser::BalancedTokenSeqContext* CPP14Parser::balancedTokenSeq() { + BalancedTokenSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 218, CPP14Parser::RuleBalancedTokenSeq); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1364); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1363); + balancedtoken(); + setState(1366); + _errHandler->sync(this); + _la = _input->LA(1); + } while ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -2) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -88080385) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & 262143) != 0)); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BalancedtokenContext ------------------------------------------------------------------ + +CPP14Parser::BalancedtokenContext::BalancedtokenContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::BalancedtokenContext::LeftParen() { + return getTokens(CPP14Parser::LeftParen); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftParen(size_t i) { + return getToken(CPP14Parser::LeftParen, i); +} + +CPP14Parser::BalancedTokenSeqContext* CPP14Parser::BalancedtokenContext::balancedTokenSeq() { + return getRuleContext(0); +} + +std::vector CPP14Parser::BalancedtokenContext::RightParen() { + return getTokens(CPP14Parser::RightParen); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightParen(size_t i) { + return getToken(CPP14Parser::RightParen, i); +} + +std::vector CPP14Parser::BalancedtokenContext::LeftBracket() { + return getTokens(CPP14Parser::LeftBracket); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftBracket(size_t i) { + return getToken(CPP14Parser::LeftBracket, i); +} + +std::vector CPP14Parser::BalancedtokenContext::RightBracket() { + return getTokens(CPP14Parser::RightBracket); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightBracket(size_t i) { + return getToken(CPP14Parser::RightBracket, i); +} + +std::vector CPP14Parser::BalancedtokenContext::LeftBrace() { + return getTokens(CPP14Parser::LeftBrace); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftBrace(size_t i) { + return getToken(CPP14Parser::LeftBrace, i); +} + +std::vector CPP14Parser::BalancedtokenContext::RightBrace() { + return getTokens(CPP14Parser::RightBrace); +} + +tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightBrace(size_t i) { + return getToken(CPP14Parser::RightBrace, i); +} + + +size_t CPP14Parser::BalancedtokenContext::getRuleIndex() const { + return CPP14Parser::RuleBalancedtoken; +} + + +CPP14Parser::BalancedtokenContext* CPP14Parser::balancedtoken() { + BalancedtokenContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 220, CPP14Parser::RuleBalancedtoken); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + setState(1385); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + enterOuterAlt(_localctx, 1); + setState(1368); + match(CPP14Parser::LeftParen); + setState(1369); + balancedTokenSeq(); + setState(1370); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 2); + setState(1372); + match(CPP14Parser::LeftBracket); + setState(1373); + balancedTokenSeq(); + setState(1374); + match(CPP14Parser::RightBracket); + break; + } + + case CPP14Parser::LeftBrace: { + enterOuterAlt(_localctx, 3); + setState(1376); + match(CPP14Parser::LeftBrace); + setState(1377); + balancedTokenSeq(); + setState(1378); + match(CPP14Parser::RightBrace); + break; + } + + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::MultiLineMacro: + case CPP14Parser::Directive: + case CPP14Parser::Alignas: + case CPP14Parser::Alignof: + case CPP14Parser::Asm: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Break: + case CPP14Parser::Case: + case CPP14Parser::Catch: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Constexpr: + case CPP14Parser::Const_cast: + case CPP14Parser::Continue: + case CPP14Parser::Decltype: + case CPP14Parser::Default: + case CPP14Parser::Delete: + case CPP14Parser::Do: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Else: + case CPP14Parser::Enum: + case CPP14Parser::Explicit: + case CPP14Parser::Export: + case CPP14Parser::Extern: + case CPP14Parser::False_: + case CPP14Parser::Final: + case CPP14Parser::Float: + case CPP14Parser::For: + case CPP14Parser::Friend: + case CPP14Parser::Goto: + case CPP14Parser::If: + case CPP14Parser::Inline: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Mutable: + case CPP14Parser::Namespace: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Nullptr: + case CPP14Parser::Operator: + case CPP14Parser::Override: + case CPP14Parser::Private: + case CPP14Parser::Protected: + case CPP14Parser::Public: + case CPP14Parser::Register: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Return: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static: + case CPP14Parser::Static_assert: + case CPP14Parser::Static_cast: + case CPP14Parser::Struct: + case CPP14Parser::Switch: + case CPP14Parser::Template: + case CPP14Parser::This: + case CPP14Parser::Thread_local: + case CPP14Parser::Throw: + case CPP14Parser::True_: + case CPP14Parser::Try: + case CPP14Parser::Typedef: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Using: + case CPP14Parser::Virtual: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::While: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::Div: + case CPP14Parser::Mod: + case CPP14Parser::Caret: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::Assign: + case CPP14Parser::Less: + case CPP14Parser::Greater: + case CPP14Parser::PlusAssign: + case CPP14Parser::MinusAssign: + case CPP14Parser::StarAssign: + case CPP14Parser::DivAssign: + case CPP14Parser::ModAssign: + case CPP14Parser::XorAssign: + case CPP14Parser::AndAssign: + case CPP14Parser::OrAssign: + case CPP14Parser::LeftShiftAssign: + case CPP14Parser::RightShiftAssign: + case CPP14Parser::Equal: + case CPP14Parser::NotEqual: + case CPP14Parser::LessEqual: + case CPP14Parser::GreaterEqual: + case CPP14Parser::AndAnd: + case CPP14Parser::OrOr: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Comma: + case CPP14Parser::ArrowStar: + case CPP14Parser::Arrow: + case CPP14Parser::Question: + case CPP14Parser::Colon: + case CPP14Parser::Doublecolon: + case CPP14Parser::Semi: + case CPP14Parser::Dot: + case CPP14Parser::DotStar: + case CPP14Parser::Ellipsis: + case CPP14Parser::Identifier: + case CPP14Parser::DecimalLiteral: + case CPP14Parser::OctalLiteral: + case CPP14Parser::HexadecimalLiteral: + case CPP14Parser::BinaryLiteral: + case CPP14Parser::Integersuffix: + case CPP14Parser::UserDefinedIntegerLiteral: + case CPP14Parser::UserDefinedFloatingLiteral: + case CPP14Parser::UserDefinedStringLiteral: + case CPP14Parser::UserDefinedCharacterLiteral: + case CPP14Parser::Whitespace: + case CPP14Parser::Newline: + case CPP14Parser::BlockComment: + case CPP14Parser::LineComment: { + enterOuterAlt(_localctx, 4); + setState(1381); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1380); + _la = _input->LA(1); + if (_la == 0 || _la == Token::EOF || (((((_la - 85) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 85)) & 63) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + default: + throw NoViableAltException(this); + } + setState(1383); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 164, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitDeclaratorListContext ------------------------------------------------------------------ + +CPP14Parser::InitDeclaratorListContext::InitDeclaratorListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::InitDeclaratorListContext::initDeclarator() { + return getRuleContexts(); +} + +CPP14Parser::InitDeclaratorContext* CPP14Parser::InitDeclaratorListContext::initDeclarator(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::InitDeclaratorListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::InitDeclaratorListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::InitDeclaratorListContext::getRuleIndex() const { + return CPP14Parser::RuleInitDeclaratorList; +} + + +CPP14Parser::InitDeclaratorListContext* CPP14Parser::initDeclaratorList() { + InitDeclaratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 222, CPP14Parser::RuleInitDeclaratorList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1387); + initDeclarator(); + setState(1392); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1388); + match(CPP14Parser::Comma); + setState(1389); + initDeclarator(); + setState(1394); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::InitDeclaratorContext::InitDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclaratorContext* CPP14Parser::InitDeclaratorContext::declarator() { + return getRuleContext(0); +} + +CPP14Parser::InitializerContext* CPP14Parser::InitDeclaratorContext::initializer() { + return getRuleContext(0); +} + + +size_t CPP14Parser::InitDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleInitDeclarator; +} + + +CPP14Parser::InitDeclaratorContext* CPP14Parser::initDeclarator() { + InitDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 224, CPP14Parser::RuleInitDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1395); + declarator(); + setState(1397); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 85) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 85)) & 65553) != 0)) { + setState(1396); + initializer(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::DeclaratorContext::DeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PointerDeclaratorContext* CPP14Parser::DeclaratorContext::pointerDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::DeclaratorContext::noPointerDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::DeclaratorContext::parametersAndQualifiers() { + return getRuleContext(0); +} + +CPP14Parser::TrailingReturnTypeContext* CPP14Parser::DeclaratorContext::trailingReturnType() { + return getRuleContext(0); +} + + +size_t CPP14Parser::DeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleDeclarator; +} + + +CPP14Parser::DeclaratorContext* CPP14Parser::declarator() { + DeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 226, CPP14Parser::RuleDeclarator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1404); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 168, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1399); + pointerDeclarator(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1400); + noPointerDeclarator(0); + setState(1401); + parametersAndQualifiers(); + setState(1402); + trailingReturnType(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PointerDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::PointerDeclaratorContext::PointerDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::PointerDeclaratorContext::noPointerDeclarator() { + return getRuleContext(0); +} + +std::vector CPP14Parser::PointerDeclaratorContext::pointerOperator() { + return getRuleContexts(); +} + +CPP14Parser::PointerOperatorContext* CPP14Parser::PointerDeclaratorContext::pointerOperator(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::PointerDeclaratorContext::Const() { + return getTokens(CPP14Parser::Const); +} + +tree::TerminalNode* CPP14Parser::PointerDeclaratorContext::Const(size_t i) { + return getToken(CPP14Parser::Const, i); +} + + +size_t CPP14Parser::PointerDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RulePointerDeclarator; +} + + +CPP14Parser::PointerDeclaratorContext* CPP14Parser::pointerDeclarator() { + PointerDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 228, CPP14Parser::RulePointerDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1412); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 170, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1406); + pointerOperator(); + setState(1408); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Const) { + setState(1407); + match(CPP14Parser::Const); + } + } + setState(1414); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 170, _ctx); + } + setState(1415); + noPointerDeclarator(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoPointerDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::NoPointerDeclaratorContext::NoPointerDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclaratoridContext* CPP14Parser::NoPointerDeclaratorContext::declaratorid() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::PointerDeclaratorContext* CPP14Parser::NoPointerDeclaratorContext::pointerDeclarator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::NoPointerDeclaratorContext::noPointerDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerDeclaratorContext::parametersAndQualifiers() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerDeclaratorContext::constantExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NoPointerDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleNoPointerDeclarator; +} + + + +CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::noPointerDeclarator() { + return noPointerDeclarator(0); +} + +CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::noPointerDeclarator(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::NoPointerDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::NoPointerDeclaratorContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 230; + enterRecursionRule(_localctx, 230, CPP14Parser::RuleNoPointerDeclarator, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1426); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Decltype: + case CPP14Parser::Operator: + case CPP14Parser::Tilde: + case CPP14Parser::Doublecolon: + case CPP14Parser::Ellipsis: + case CPP14Parser::Identifier: { + setState(1418); + declaratorid(); + setState(1420); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 171, _ctx)) { + case 1: { + setState(1419); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::LeftParen: { + setState(1422); + match(CPP14Parser::LeftParen); + setState(1423); + pointerDeclarator(); + setState(1424); + match(CPP14Parser::RightParen); + break; + } + + default: + throw NoViableAltException(this); + } + _ctx->stop = _input->LT(-1); + setState(1442); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 176, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RuleNoPointerDeclarator); + setState(1428); + + if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(1438); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + setState(1429); + parametersAndQualifiers(); + break; + } + + case CPP14Parser::LeftBracket: { + setState(1430); + match(CPP14Parser::LeftBracket); + setState(1432); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { + setState(1431); + constantExpression(); + } + setState(1434); + match(CPP14Parser::RightBracket); + setState(1436); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 174, _ctx)) { + case 1: { + setState(1435); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + default: + throw NoViableAltException(this); + } + } + setState(1444); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 176, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- ParametersAndQualifiersContext ------------------------------------------------------------------ + +CPP14Parser::ParametersAndQualifiersContext::ParametersAndQualifiersContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ParametersAndQualifiersContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::ParametersAndQualifiersContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::ParametersAndQualifiersContext::parameterDeclarationClause() { + return getRuleContext(0); +} + +CPP14Parser::CvqualifierseqContext* CPP14Parser::ParametersAndQualifiersContext::cvqualifierseq() { + return getRuleContext(0); +} + +CPP14Parser::RefqualifierContext* CPP14Parser::ParametersAndQualifiersContext::refqualifier() { + return getRuleContext(0); +} + +CPP14Parser::ExceptionSpecificationContext* CPP14Parser::ParametersAndQualifiersContext::exceptionSpecification() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ParametersAndQualifiersContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ParametersAndQualifiersContext::getRuleIndex() const { + return CPP14Parser::RuleParametersAndQualifiers; +} + + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::parametersAndQualifiers() { + ParametersAndQualifiersContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 232, CPP14Parser::RuleParametersAndQualifiers); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1445); + match(CPP14Parser::LeftParen); + setState(1447); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1237504995584196377) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 297237575406461917) != 0)) { + setState(1446); + parameterDeclarationClause(); + } + setState(1449); + match(CPP14Parser::RightParen); + setState(1451); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 178, _ctx)) { + case 1: { + setState(1450); + cvqualifierseq(); + break; + } + + default: + break; + } + setState(1454); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 179, _ctx)) { + case 1: { + setState(1453); + refqualifier(); + break; + } + + default: + break; + } + setState(1457); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 180, _ctx)) { + case 1: { + setState(1456); + exceptionSpecification(); + break; + } + + default: + break; + } + setState(1460); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 181, _ctx)) { + case 1: { + setState(1459); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TrailingReturnTypeContext ------------------------------------------------------------------ + +CPP14Parser::TrailingReturnTypeContext::TrailingReturnTypeContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TrailingReturnTypeContext::Arrow() { + return getToken(CPP14Parser::Arrow, 0); +} + +CPP14Parser::TrailingTypeSpecifierSeqContext* CPP14Parser::TrailingReturnTypeContext::trailingTypeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::AbstractDeclaratorContext* CPP14Parser::TrailingReturnTypeContext::abstractDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TrailingReturnTypeContext::getRuleIndex() const { + return CPP14Parser::RuleTrailingReturnType; +} + + +CPP14Parser::TrailingReturnTypeContext* CPP14Parser::trailingReturnType() { + TrailingReturnTypeContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 234, CPP14Parser::RuleTrailingReturnType); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1462); + match(CPP14Parser::Arrow); + setState(1463); + trailingTypeSpecifierSeq(); + setState(1465); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 182, _ctx)) { + case 1: { + setState(1464); + abstractDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PointerOperatorContext ------------------------------------------------------------------ + +CPP14Parser::PointerOperatorContext::PointerOperatorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::PointerOperatorContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::PointerOperatorContext::AndAnd() { + return getToken(CPP14Parser::AndAnd, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::PointerOperatorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::PointerOperatorContext::Star() { + return getToken(CPP14Parser::Star, 0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::PointerOperatorContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::CvqualifierseqContext* CPP14Parser::PointerOperatorContext::cvqualifierseq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::PointerOperatorContext::getRuleIndex() const { + return CPP14Parser::RulePointerOperator; +} + + +CPP14Parser::PointerOperatorContext* CPP14Parser::pointerOperator() { + PointerOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 236, CPP14Parser::RulePointerOperator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1481); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::And: + case CPP14Parser::AndAnd: { + enterOuterAlt(_localctx, 1); + setState(1467); + _la = _input->LA(1); + if (!(_la == CPP14Parser::And + + || _la == CPP14Parser::AndAnd)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1469); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 183, _ctx)) { + case 1: { + setState(1468); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::Decltype: + case CPP14Parser::Star: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 2); + setState(1472); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon + + || _la == CPP14Parser::Identifier) { + setState(1471); + nestedNameSpecifier(0); + } + setState(1474); + match(CPP14Parser::Star); + setState(1476); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 185, _ctx)) { + case 1: { + setState(1475); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + setState(1479); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 186, _ctx)) { + case 1: { + setState(1478); + cvqualifierseq(); + break; + } + + default: + break; + } + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CvqualifierseqContext ------------------------------------------------------------------ + +CPP14Parser::CvqualifierseqContext::CvqualifierseqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::CvqualifierseqContext::cvQualifier() { + return getRuleContexts(); +} + +CPP14Parser::CvQualifierContext* CPP14Parser::CvqualifierseqContext::cvQualifier(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::CvqualifierseqContext::getRuleIndex() const { + return CPP14Parser::RuleCvqualifierseq; +} + + +CPP14Parser::CvqualifierseqContext* CPP14Parser::cvqualifierseq() { + CvqualifierseqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 238, CPP14Parser::RuleCvqualifierseq); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1484); + _errHandler->sync(this); + alt = 1; + do { + switch (alt) { + case 1: { + setState(1483); + cvQualifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1486); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 188, _ctx); + } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CvQualifierContext ------------------------------------------------------------------ + +CPP14Parser::CvQualifierContext::CvQualifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::CvQualifierContext::Const() { + return getToken(CPP14Parser::Const, 0); +} + +tree::TerminalNode* CPP14Parser::CvQualifierContext::Volatile() { + return getToken(CPP14Parser::Volatile, 0); +} + + +size_t CPP14Parser::CvQualifierContext::getRuleIndex() const { + return CPP14Parser::RuleCvQualifier; +} + + +CPP14Parser::CvQualifierContext* CPP14Parser::cvQualifier() { + CvQualifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 240, CPP14Parser::RuleCvQualifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1488); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Const + + || _la == CPP14Parser::Volatile)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RefqualifierContext ------------------------------------------------------------------ + +CPP14Parser::RefqualifierContext::RefqualifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::RefqualifierContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::RefqualifierContext::AndAnd() { + return getToken(CPP14Parser::AndAnd, 0); +} + + +size_t CPP14Parser::RefqualifierContext::getRuleIndex() const { + return CPP14Parser::RuleRefqualifier; +} + + +CPP14Parser::RefqualifierContext* CPP14Parser::refqualifier() { + RefqualifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 242, CPP14Parser::RuleRefqualifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1490); + _la = _input->LA(1); + if (!(_la == CPP14Parser::And + + || _la == CPP14Parser::AndAnd)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DeclaratoridContext ------------------------------------------------------------------ + +CPP14Parser::DeclaratoridContext::DeclaratoridContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::IdExpressionContext* CPP14Parser::DeclaratoridContext::idExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::DeclaratoridContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + + +size_t CPP14Parser::DeclaratoridContext::getRuleIndex() const { + return CPP14Parser::RuleDeclaratorid; +} + + +CPP14Parser::DeclaratoridContext* CPP14Parser::declaratorid() { + DeclaratoridContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 244, CPP14Parser::RuleDeclaratorid); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1493); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1492); + match(CPP14Parser::Ellipsis); + } + setState(1495); + idExpression(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TheTypeIdContext ------------------------------------------------------------------ + +CPP14Parser::TheTypeIdContext::TheTypeIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::TheTypeIdContext::typeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::AbstractDeclaratorContext* CPP14Parser::TheTypeIdContext::abstractDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TheTypeIdContext::getRuleIndex() const { + return CPP14Parser::RuleTheTypeId; +} + + +CPP14Parser::TheTypeIdContext* CPP14Parser::theTypeId() { + TheTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 246, CPP14Parser::RuleTheTypeId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1497); + typeSpecifierSeq(); + setState(1499); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 190, _ctx)) { + case 1: { + setState(1498); + abstractDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AbstractDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::AbstractDeclaratorContext::AbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::pointerAbstractDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::AbstractDeclaratorContext::parametersAndQualifiers() { + return getRuleContext(0); +} + +CPP14Parser::TrailingReturnTypeContext* CPP14Parser::AbstractDeclaratorContext::trailingReturnType() { + return getRuleContext(0); +} + +CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::noPointerAbstractDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::AbstractPackDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::abstractPackDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::AbstractDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleAbstractDeclarator; +} + + +CPP14Parser::AbstractDeclaratorContext* CPP14Parser::abstractDeclarator() { + AbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 248, CPP14Parser::RuleAbstractDeclarator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1509); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 192, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1501); + pointerAbstractDeclarator(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1503); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 191, _ctx)) { + case 1: { + setState(1502); + noPointerAbstractDeclarator(0); + break; + } + + default: + break; + } + setState(1505); + parametersAndQualifiers(); + setState(1506); + trailingReturnType(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1508); + abstractPackDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PointerAbstractDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::PointerAbstractDeclaratorContext::PointerAbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::PointerAbstractDeclaratorContext::noPointerAbstractDeclarator() { + return getRuleContext(0); +} + +std::vector CPP14Parser::PointerAbstractDeclaratorContext::pointerOperator() { + return getRuleContexts(); +} + +CPP14Parser::PointerOperatorContext* CPP14Parser::PointerAbstractDeclaratorContext::pointerOperator(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::PointerAbstractDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RulePointerAbstractDeclarator; +} + + +CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::pointerAbstractDeclarator() { + PointerAbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 250, CPP14Parser::RulePointerAbstractDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1520); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: { + enterOuterAlt(_localctx, 1); + setState(1511); + noPointerAbstractDeclarator(0); + break; + } + + case CPP14Parser::Decltype: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::AndAnd: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 2); + setState(1513); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1512); + pointerOperator(); + setState(1515); + _errHandler->sync(this); + _la = _input->LA(1); + } while (_la == CPP14Parser::Decltype || ((((_la - 93) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 93)) & 566969237521) != 0)); + setState(1518); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 194, _ctx)) { + case 1: { + setState(1517); + noPointerAbstractDeclarator(0); + break; + } + + default: + break; + } + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoPointerAbstractDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::NoPointerAbstractDeclaratorContext::NoPointerAbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerAbstractDeclaratorContext::parametersAndQualifiers() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerAbstractDeclaratorContext::constantExpression() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerAbstractDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::NoPointerAbstractDeclaratorContext::pointerAbstractDeclarator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +std::vector CPP14Parser::NoPointerAbstractDeclaratorContext::noPointerAbstractDeclarator() { + return getRuleContexts(); +} + +CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::NoPointerAbstractDeclaratorContext::noPointerAbstractDeclarator(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::NoPointerAbstractDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleNoPointerAbstractDeclarator; +} + + + +CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::noPointerAbstractDeclarator() { + return noPointerAbstractDeclarator(0); +} + +CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::noPointerAbstractDeclarator(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::NoPointerAbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::NoPointerAbstractDeclaratorContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 252; + enterRecursionRule(_localctx, 252, CPP14Parser::RuleNoPointerAbstractDeclarator, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1536); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 198, _ctx)) { + case 1: { + setState(1523); + parametersAndQualifiers(); + break; + } + + case 2: { + setState(1524); + match(CPP14Parser::LeftBracket); + setState(1526); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { + setState(1525); + constantExpression(); + } + setState(1528); + match(CPP14Parser::RightBracket); + setState(1530); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 197, _ctx)) { + case 1: { + setState(1529); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + case 3: { + setState(1532); + match(CPP14Parser::LeftParen); + setState(1533); + pointerAbstractDeclarator(); + setState(1534); + match(CPP14Parser::RightParen); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(1553); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 202, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RuleNoPointerAbstractDeclarator); + setState(1538); + + if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); + setState(1549); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 201, _ctx)) { + case 1: { + setState(1539); + parametersAndQualifiers(); + break; + } + + case 2: { + setState(1540); + noPointerAbstractDeclarator(0); + setState(1541); + match(CPP14Parser::LeftBracket); + setState(1543); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { + setState(1542); + constantExpression(); + } + setState(1545); + match(CPP14Parser::RightBracket); + setState(1547); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 200, _ctx)) { + case 1: { + setState(1546); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + default: + break; + } + } + setState(1555); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 202, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- AbstractPackDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::AbstractPackDeclaratorContext::AbstractPackDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::AbstractPackDeclaratorContext::noPointerAbstractPackDeclarator() { + return getRuleContext(0); +} + +std::vector CPP14Parser::AbstractPackDeclaratorContext::pointerOperator() { + return getRuleContexts(); +} + +CPP14Parser::PointerOperatorContext* CPP14Parser::AbstractPackDeclaratorContext::pointerOperator(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::AbstractPackDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleAbstractPackDeclarator; +} + + +CPP14Parser::AbstractPackDeclaratorContext* CPP14Parser::abstractPackDeclarator() { + AbstractPackDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 254, CPP14Parser::RuleAbstractPackDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1559); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Decltype || ((((_la - 93) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 93)) & 566969237521) != 0)) { + setState(1556); + pointerOperator(); + setState(1561); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1562); + noPointerAbstractPackDeclarator(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoPointerAbstractPackDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::NoPointerAbstractPackDeclaratorContext::NoPointerAbstractPackDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + +CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::noPointerAbstractPackDeclarator() { + return getRuleContext(0); +} + +CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::parametersAndQualifiers() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::constantExpression() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::NoPointerAbstractPackDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleNoPointerAbstractPackDeclarator; +} + + + +CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::noPointerAbstractPackDeclarator() { + return noPointerAbstractPackDeclarator(0); +} + +CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::noPointerAbstractPackDeclarator(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + CPP14Parser::NoPointerAbstractPackDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); + CPP14Parser::NoPointerAbstractPackDeclaratorContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 256; + enterRecursionRule(_localctx, 256, CPP14Parser::RuleNoPointerAbstractPackDeclarator, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1565); + match(CPP14Parser::Ellipsis); + _ctx->stop = _input->LT(-1); + setState(1581); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 207, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + _localctx = _tracker.createInstance(parentContext, parentState); + pushNewRecursionContext(_localctx, startState, RuleNoPointerAbstractPackDeclarator); + setState(1567); + + if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(1577); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + setState(1568); + parametersAndQualifiers(); + break; + } + + case CPP14Parser::LeftBracket: { + setState(1569); + match(CPP14Parser::LeftBracket); + setState(1571); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { + setState(1570); + constantExpression(); + } + setState(1573); + match(CPP14Parser::RightBracket); + setState(1575); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 205, _ctx)) { + case 1: { + setState(1574); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + break; + } + + default: + throw NoViableAltException(this); + } + } + setState(1583); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 207, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- ParameterDeclarationClauseContext ------------------------------------------------------------------ + +CPP14Parser::ParameterDeclarationClauseContext::ParameterDeclarationClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ParameterDeclarationListContext* CPP14Parser::ParameterDeclarationClauseContext::parameterDeclarationList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ParameterDeclarationClauseContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + +tree::TerminalNode* CPP14Parser::ParameterDeclarationClauseContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + + +size_t CPP14Parser::ParameterDeclarationClauseContext::getRuleIndex() const { + return CPP14Parser::RuleParameterDeclarationClause; +} + + +CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::parameterDeclarationClause() { + ParameterDeclarationClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 258, CPP14Parser::RuleParameterDeclarationClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1584); + parameterDeclarationList(); + setState(1589); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Comma + + || _la == CPP14Parser::Ellipsis) { + setState(1586); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Comma) { + setState(1585); + match(CPP14Parser::Comma); + } + setState(1588); + match(CPP14Parser::Ellipsis); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ParameterDeclarationListContext ------------------------------------------------------------------ + +CPP14Parser::ParameterDeclarationListContext::ParameterDeclarationListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::ParameterDeclarationListContext::parameterDeclaration() { + return getRuleContexts(); +} + +CPP14Parser::ParameterDeclarationContext* CPP14Parser::ParameterDeclarationListContext::parameterDeclaration(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::ParameterDeclarationListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::ParameterDeclarationListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::ParameterDeclarationListContext::getRuleIndex() const { + return CPP14Parser::RuleParameterDeclarationList; +} + + +CPP14Parser::ParameterDeclarationListContext* CPP14Parser::parameterDeclarationList() { + ParameterDeclarationListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 260, CPP14Parser::RuleParameterDeclarationList); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1591); + parameterDeclaration(); + setState(1596); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 210, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1592); + match(CPP14Parser::Comma); + setState(1593); + parameterDeclaration(); + } + setState(1598); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 210, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ParameterDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::ParameterDeclarationContext::ParameterDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ParameterDeclarationContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ParameterDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclaratorContext* CPP14Parser::ParameterDeclarationContext::declarator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ParameterDeclarationContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::InitializerClauseContext* CPP14Parser::ParameterDeclarationContext::initializerClause() { + return getRuleContext(0); +} + +CPP14Parser::AbstractDeclaratorContext* CPP14Parser::ParameterDeclarationContext::abstractDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ParameterDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleParameterDeclaration; +} + + +CPP14Parser::ParameterDeclarationContext* CPP14Parser::parameterDeclaration() { + ParameterDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 262, CPP14Parser::RuleParameterDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1600); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1599); + attributeSpecifierSeq(); + } + setState(1602); + declSpecifierSeq(); + + setState(1607); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 213, _ctx)) { + case 1: { + setState(1603); + declarator(); + break; + } + + case 2: { + setState(1605); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 212, _ctx)) { + case 1: { + setState(1604); + abstractDeclarator(); + break; + } + + default: + break; + } + break; + } + + default: + break; + } + setState(1611); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Assign) { + setState(1609); + match(CPP14Parser::Assign); + setState(1610); + initializerClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FunctionDefinitionContext ------------------------------------------------------------------ + +CPP14Parser::FunctionDefinitionContext::FunctionDefinitionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclaratorContext* CPP14Parser::FunctionDefinitionContext::declarator() { + return getRuleContext(0); +} + +CPP14Parser::FunctionBodyContext* CPP14Parser::FunctionDefinitionContext::functionBody() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::virtualSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::FunctionDefinitionContext::getRuleIndex() const { + return CPP14Parser::RuleFunctionDefinition; +} + + +CPP14Parser::FunctionDefinitionContext* CPP14Parser::functionDefinition() { + FunctionDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 264, CPP14Parser::RuleFunctionDefinition); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1614); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1613); + attributeSpecifierSeq(); + } + setState(1617); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 216, _ctx)) { + case 1: { + setState(1616); + declSpecifierSeq(); + break; + } + + default: + break; + } + setState(1619); + declarator(); + setState(1621); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Final + + || _la == CPP14Parser::Override) { + setState(1620); + virtualSpecifierSeq(); + } + setState(1623); + functionBody(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FunctionBodyContext ------------------------------------------------------------------ + +CPP14Parser::FunctionBodyContext::FunctionBodyContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::FunctionBodyContext::compoundStatement() { + return getRuleContext(0); +} + +CPP14Parser::ConstructorInitializerContext* CPP14Parser::FunctionBodyContext::constructorInitializer() { + return getRuleContext(0); +} + +CPP14Parser::FunctionTryBlockContext* CPP14Parser::FunctionBodyContext::functionTryBlock() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::FunctionBodyContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +tree::TerminalNode* CPP14Parser::FunctionBodyContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +tree::TerminalNode* CPP14Parser::FunctionBodyContext::Default() { + return getToken(CPP14Parser::Default, 0); +} + +tree::TerminalNode* CPP14Parser::FunctionBodyContext::Delete() { + return getToken(CPP14Parser::Delete, 0); +} + + +size_t CPP14Parser::FunctionBodyContext::getRuleIndex() const { + return CPP14Parser::RuleFunctionBody; +} + + +CPP14Parser::FunctionBodyContext* CPP14Parser::functionBody() { + FunctionBodyContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 266, CPP14Parser::RuleFunctionBody); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1633); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftBrace: + case CPP14Parser::Colon: { + enterOuterAlt(_localctx, 1); + setState(1626); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Colon) { + setState(1625); + constructorInitializer(); + } + setState(1628); + compoundStatement(); + break; + } + + case CPP14Parser::Try: { + enterOuterAlt(_localctx, 2); + setState(1629); + functionTryBlock(); + break; + } + + case CPP14Parser::Assign: { + enterOuterAlt(_localctx, 3); + setState(1630); + match(CPP14Parser::Assign); + setState(1631); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Default + + || _la == CPP14Parser::Delete)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1632); + match(CPP14Parser::Semi); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitializerContext ------------------------------------------------------------------ + +CPP14Parser::InitializerContext::InitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::InitializerContext::braceOrEqualInitializer() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::InitializerContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ExpressionListContext* CPP14Parser::InitializerContext::expressionList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::InitializerContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::InitializerContext::getRuleIndex() const { + return CPP14Parser::RuleInitializer; +} + + +CPP14Parser::InitializerContext* CPP14Parser::initializer() { + InitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 268, CPP14Parser::RuleInitializer); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1640); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftBrace: + case CPP14Parser::Assign: { + enterOuterAlt(_localctx, 1); + setState(1635); + braceOrEqualInitializer(); + break; + } + + case CPP14Parser::LeftParen: { + enterOuterAlt(_localctx, 2); + setState(1636); + match(CPP14Parser::LeftParen); + setState(1637); + expressionList(); + setState(1638); + match(CPP14Parser::RightParen); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BraceOrEqualInitializerContext ------------------------------------------------------------------ + +CPP14Parser::BraceOrEqualInitializerContext::BraceOrEqualInitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::BraceOrEqualInitializerContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::InitializerClauseContext* CPP14Parser::BraceOrEqualInitializerContext::initializerClause() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::BraceOrEqualInitializerContext::bracedInitList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::BraceOrEqualInitializerContext::getRuleIndex() const { + return CPP14Parser::RuleBraceOrEqualInitializer; +} + + +CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::braceOrEqualInitializer() { + BraceOrEqualInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 270, CPP14Parser::RuleBraceOrEqualInitializer); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1645); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Assign: { + enterOuterAlt(_localctx, 1); + setState(1642); + match(CPP14Parser::Assign); + setState(1643); + initializerClause(); + break; + } + + case CPP14Parser::LeftBrace: { + enterOuterAlt(_localctx, 2); + setState(1644); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitializerClauseContext ------------------------------------------------------------------ + +CPP14Parser::InitializerClauseContext::InitializerClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::AssignmentExpressionContext* CPP14Parser::InitializerClauseContext::assignmentExpression() { + return getRuleContext(0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::InitializerClauseContext::bracedInitList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::InitializerClauseContext::getRuleIndex() const { + return CPP14Parser::RuleInitializerClause; +} + + +CPP14Parser::InitializerClauseContext* CPP14Parser::initializerClause() { + InitializerClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 272, CPP14Parser::RuleInitializerClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1649); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::IntegerLiteral: + case CPP14Parser::CharacterLiteral: + case CPP14Parser::FloatingLiteral: + case CPP14Parser::StringLiteral: + case CPP14Parser::BooleanLiteral: + case CPP14Parser::PointerLiteral: + case CPP14Parser::UserDefinedLiteral: + case CPP14Parser::Alignof: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Const_cast: + case CPP14Parser::Decltype: + case CPP14Parser::Delete: + case CPP14Parser::Double: + case CPP14Parser::Dynamic_cast: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::New: + case CPP14Parser::Noexcept: + case CPP14Parser::Operator: + case CPP14Parser::Reinterpret_cast: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Sizeof: + case CPP14Parser::Static_cast: + case CPP14Parser::This: + case CPP14Parser::Throw: + case CPP14Parser::Typeid_: + case CPP14Parser::Typename_: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Plus: + case CPP14Parser::Minus: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Or: + case CPP14Parser::Tilde: + case CPP14Parser::Not: + case CPP14Parser::PlusPlus: + case CPP14Parser::MinusMinus: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(1647); + assignmentExpression(); + break; + } + + case CPP14Parser::LeftBrace: { + enterOuterAlt(_localctx, 2); + setState(1648); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InitializerListContext ------------------------------------------------------------------ + +CPP14Parser::InitializerListContext::InitializerListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::InitializerListContext::initializerClause() { + return getRuleContexts(); +} + +CPP14Parser::InitializerClauseContext* CPP14Parser::InitializerListContext::initializerClause(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::InitializerListContext::Ellipsis() { + return getTokens(CPP14Parser::Ellipsis); +} + +tree::TerminalNode* CPP14Parser::InitializerListContext::Ellipsis(size_t i) { + return getToken(CPP14Parser::Ellipsis, i); +} + +std::vector CPP14Parser::InitializerListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::InitializerListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::InitializerListContext::getRuleIndex() const { + return CPP14Parser::RuleInitializerList; +} + + +CPP14Parser::InitializerListContext* CPP14Parser::initializerList() { + InitializerListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 274, CPP14Parser::RuleInitializerList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1651); + initializerClause(); + setState(1653); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1652); + match(CPP14Parser::Ellipsis); + } + setState(1662); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 225, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1655); + match(CPP14Parser::Comma); + setState(1656); + initializerClause(); + setState(1658); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1657); + match(CPP14Parser::Ellipsis); + } + } + setState(1664); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 225, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BracedInitListContext ------------------------------------------------------------------ + +CPP14Parser::BracedInitListContext::BracedInitListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::BracedInitListContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::BracedInitListContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +CPP14Parser::InitializerListContext* CPP14Parser::BracedInitListContext::initializerList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::BracedInitListContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + + +size_t CPP14Parser::BracedInitListContext::getRuleIndex() const { + return CPP14Parser::RuleBracedInitList; +} + + +CPP14Parser::BracedInitListContext* CPP14Parser::bracedInitList() { + BracedInitListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 276, CPP14Parser::RuleBracedInitList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1665); + match(CPP14Parser::LeftBrace); + setState(1670); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { + setState(1666); + initializerList(); + setState(1668); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Comma) { + setState(1667); + match(CPP14Parser::Comma); + } + } + setState(1672); + match(CPP14Parser::RightBrace); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassNameContext ------------------------------------------------------------------ + +CPP14Parser::ClassNameContext::ClassNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ClassNameContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::ClassNameContext::simpleTemplateId() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ClassNameContext::getRuleIndex() const { + return CPP14Parser::RuleClassName; +} + + +CPP14Parser::ClassNameContext* CPP14Parser::className() { + ClassNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 278, CPP14Parser::RuleClassName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1676); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 228, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1674); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1675); + simpleTemplateId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::ClassSpecifierContext::ClassSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassHeadContext* CPP14Parser::ClassSpecifierContext::classHead() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ClassSpecifierContext::LeftBrace() { + return getToken(CPP14Parser::LeftBrace, 0); +} + +tree::TerminalNode* CPP14Parser::ClassSpecifierContext::RightBrace() { + return getToken(CPP14Parser::RightBrace, 0); +} + +CPP14Parser::MemberSpecificationContext* CPP14Parser::ClassSpecifierContext::memberSpecification() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ClassSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleClassSpecifier; +} + + +CPP14Parser::ClassSpecifierContext* CPP14Parser::classSpecifier() { + ClassSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 280, CPP14Parser::RuleClassSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1678); + classHead(); + setState(1679); + match(CPP14Parser::LeftBrace); + setState(1681); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543877313594212121) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 463888353847684093) != 0)) { + setState(1680); + memberSpecification(); + } + setState(1683); + match(CPP14Parser::RightBrace); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassHeadContext ------------------------------------------------------------------ + +CPP14Parser::ClassHeadContext::ClassHeadContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassKeyContext* CPP14Parser::ClassHeadContext::classKey() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ClassHeadContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::ClassHeadNameContext* CPP14Parser::ClassHeadContext::classHeadName() { + return getRuleContext(0); +} + +CPP14Parser::BaseClauseContext* CPP14Parser::ClassHeadContext::baseClause() { + return getRuleContext(0); +} + +CPP14Parser::ClassVirtSpecifierContext* CPP14Parser::ClassHeadContext::classVirtSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ClassHeadContext::Union() { + return getToken(CPP14Parser::Union, 0); +} + + +size_t CPP14Parser::ClassHeadContext::getRuleIndex() const { + return CPP14Parser::RuleClassHead; +} + + +CPP14Parser::ClassHeadContext* CPP14Parser::classHead() { + ClassHeadContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 282, CPP14Parser::RuleClassHead); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1708); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Class: + case CPP14Parser::Struct: { + enterOuterAlt(_localctx, 1); + setState(1685); + classKey(); + setState(1687); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1686); + attributeSpecifierSeq(); + } + setState(1693); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon + + || _la == CPP14Parser::Identifier) { + setState(1689); + classHeadName(); + setState(1691); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Final) { + setState(1690); + classVirtSpecifier(); + } + } + setState(1696); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Colon) { + setState(1695); + baseClause(); + } + break; + } + + case CPP14Parser::Union: { + enterOuterAlt(_localctx, 2); + setState(1698); + match(CPP14Parser::Union); + setState(1700); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1699); + attributeSpecifierSeq(); + } + setState(1706); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon + + || _la == CPP14Parser::Identifier) { + setState(1702); + classHeadName(); + setState(1704); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Final) { + setState(1703); + classVirtSpecifier(); + } + } + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassHeadNameContext ------------------------------------------------------------------ + +CPP14Parser::ClassHeadNameContext::ClassHeadNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassNameContext* CPP14Parser::ClassHeadNameContext::className() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ClassHeadNameContext::nestedNameSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ClassHeadNameContext::getRuleIndex() const { + return CPP14Parser::RuleClassHeadName; +} + + +CPP14Parser::ClassHeadNameContext* CPP14Parser::classHeadName() { + ClassHeadNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 284, CPP14Parser::RuleClassHeadName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1711); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 238, _ctx)) { + case 1: { + setState(1710); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1713); + className(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassVirtSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::ClassVirtSpecifierContext::ClassVirtSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ClassVirtSpecifierContext::Final() { + return getToken(CPP14Parser::Final, 0); +} + + +size_t CPP14Parser::ClassVirtSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleClassVirtSpecifier; +} + + +CPP14Parser::ClassVirtSpecifierContext* CPP14Parser::classVirtSpecifier() { + ClassVirtSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 286, CPP14Parser::RuleClassVirtSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1715); + match(CPP14Parser::Final); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassKeyContext ------------------------------------------------------------------ + +CPP14Parser::ClassKeyContext::ClassKeyContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ClassKeyContext::Class() { + return getToken(CPP14Parser::Class, 0); +} + +tree::TerminalNode* CPP14Parser::ClassKeyContext::Struct() { + return getToken(CPP14Parser::Struct, 0); +} + + +size_t CPP14Parser::ClassKeyContext::getRuleIndex() const { + return CPP14Parser::RuleClassKey; +} + + +CPP14Parser::ClassKeyContext* CPP14Parser::classKey() { + ClassKeyContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 288, CPP14Parser::RuleClassKey); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1717); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Class + + || _la == CPP14Parser::Struct)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemberSpecificationContext ------------------------------------------------------------------ + +CPP14Parser::MemberSpecificationContext::MemberSpecificationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::MemberSpecificationContext::memberdeclaration() { + return getRuleContexts(); +} + +CPP14Parser::MemberdeclarationContext* CPP14Parser::MemberSpecificationContext::memberdeclaration(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::MemberSpecificationContext::accessSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::AccessSpecifierContext* CPP14Parser::MemberSpecificationContext::accessSpecifier(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::MemberSpecificationContext::Colon() { + return getTokens(CPP14Parser::Colon); +} + +tree::TerminalNode* CPP14Parser::MemberSpecificationContext::Colon(size_t i) { + return getToken(CPP14Parser::Colon, i); +} + + +size_t CPP14Parser::MemberSpecificationContext::getRuleIndex() const { + return CPP14Parser::RuleMemberSpecification; +} + + +CPP14Parser::MemberSpecificationContext* CPP14Parser::memberSpecification() { + MemberSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 290, CPP14Parser::RuleMemberSpecification); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1723); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1723); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Alignas: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Constexpr: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Explicit: + case CPP14Parser::Extern: + case CPP14Parser::Float: + case CPP14Parser::Friend: + case CPP14Parser::Inline: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Mutable: + case CPP14Parser::Operator: + case CPP14Parser::Register: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Static: + case CPP14Parser::Static_assert: + case CPP14Parser::Struct: + case CPP14Parser::Template: + case CPP14Parser::Thread_local: + case CPP14Parser::Typedef: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Using: + case CPP14Parser::Virtual: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::LeftParen: + case CPP14Parser::LeftBracket: + case CPP14Parser::Star: + case CPP14Parser::And: + case CPP14Parser::Tilde: + case CPP14Parser::AndAnd: + case CPP14Parser::Colon: + case CPP14Parser::Doublecolon: + case CPP14Parser::Semi: + case CPP14Parser::Ellipsis: + case CPP14Parser::Identifier: { + setState(1719); + memberdeclaration(); + break; + } + + case CPP14Parser::Private: + case CPP14Parser::Protected: + case CPP14Parser::Public: { + setState(1720); + accessSpecifier(); + setState(1721); + match(CPP14Parser::Colon); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1725); + _errHandler->sync(this); + _la = _input->LA(1); + } while (((((_la - 10) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 10)) & 1543877313594212121) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 74)) & 463888353847684093) != 0)); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemberdeclarationContext ------------------------------------------------------------------ + +CPP14Parser::MemberdeclarationContext::MemberdeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::MemberdeclarationContext::Semi() { + return getToken(CPP14Parser::Semi, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::MemberdeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::MemberdeclarationContext::declSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::MemberDeclaratorListContext* CPP14Parser::MemberdeclarationContext::memberDeclaratorList() { + return getRuleContext(0); +} + +CPP14Parser::FunctionDefinitionContext* CPP14Parser::MemberdeclarationContext::functionDefinition() { + return getRuleContext(0); +} + +CPP14Parser::UsingDeclarationContext* CPP14Parser::MemberdeclarationContext::usingDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::MemberdeclarationContext::staticAssertDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::TemplateDeclarationContext* CPP14Parser::MemberdeclarationContext::templateDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::AliasDeclarationContext* CPP14Parser::MemberdeclarationContext::aliasDeclaration() { + return getRuleContext(0); +} + +CPP14Parser::EmptyDeclarationContext* CPP14Parser::MemberdeclarationContext::emptyDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::MemberdeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleMemberdeclaration; +} + + +CPP14Parser::MemberdeclarationContext* CPP14Parser::memberdeclaration() { + MemberdeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 292, CPP14Parser::RuleMemberdeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1743); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 244, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1728); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 241, _ctx)) { + case 1: { + setState(1727); + attributeSpecifierSeq(); + break; + } + + default: + break; + } + setState(1731); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 242, _ctx)) { + case 1: { + setState(1730); + declSpecifierSeq(); + break; + } + + default: + break; + } + setState(1734); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4503599694480384) != 0) || ((((_la - 85) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 85)) & 217711892254981) != 0)) { + setState(1733); + memberDeclaratorList(); + } + setState(1736); + match(CPP14Parser::Semi); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1737); + functionDefinition(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1738); + usingDeclaration(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(1739); + staticAssertDeclaration(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(1740); + templateDeclaration(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(1741); + aliasDeclaration(); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(1742); + emptyDeclaration(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemberDeclaratorListContext ------------------------------------------------------------------ + +CPP14Parser::MemberDeclaratorListContext::MemberDeclaratorListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::MemberDeclaratorListContext::memberDeclarator() { + return getRuleContexts(); +} + +CPP14Parser::MemberDeclaratorContext* CPP14Parser::MemberDeclaratorListContext::memberDeclarator(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::MemberDeclaratorListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::MemberDeclaratorListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::MemberDeclaratorListContext::getRuleIndex() const { + return CPP14Parser::RuleMemberDeclaratorList; +} + + +CPP14Parser::MemberDeclaratorListContext* CPP14Parser::memberDeclaratorList() { + MemberDeclaratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 294, CPP14Parser::RuleMemberDeclaratorList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1745); + memberDeclarator(); + setState(1750); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1746); + match(CPP14Parser::Comma); + setState(1747); + memberDeclarator(); + setState(1752); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemberDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::MemberDeclaratorContext::MemberDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DeclaratorContext* CPP14Parser::MemberDeclaratorContext::declarator() { + return getRuleContext(0); +} + +CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::MemberDeclaratorContext::virtualSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::PureSpecifierContext* CPP14Parser::MemberDeclaratorContext::pureSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::MemberDeclaratorContext::braceOrEqualInitializer() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::MemberDeclaratorContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::MemberDeclaratorContext::constantExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::MemberDeclaratorContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::MemberDeclaratorContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::MemberDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleMemberDeclarator; +} + + +CPP14Parser::MemberDeclaratorContext* CPP14Parser::memberDeclarator() { + MemberDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 296, CPP14Parser::RuleMemberDeclarator); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1773); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 252, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1753); + declarator(); + setState(1763); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 249, _ctx)) { + case 1: { + setState(1755); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Final + + || _la == CPP14Parser::Override) { + setState(1754); + virtualSpecifierSeq(); + } + setState(1758); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Assign) { + setState(1757); + pureSpecifier(); + } + break; + } + + case 2: { + setState(1761); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::LeftBrace + + || _la == CPP14Parser::Assign) { + setState(1760); + braceOrEqualInitializer(); + } + break; + } + + default: + break; + } + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1766); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(1765); + match(CPP14Parser::Identifier); + } + setState(1769); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1768); + attributeSpecifierSeq(); + } + setState(1771); + match(CPP14Parser::Colon); + setState(1772); + constantExpression(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- VirtualSpecifierSeqContext ------------------------------------------------------------------ + +CPP14Parser::VirtualSpecifierSeqContext::VirtualSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::VirtualSpecifierSeqContext::virtualSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::VirtualSpecifierContext* CPP14Parser::VirtualSpecifierSeqContext::virtualSpecifier(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::VirtualSpecifierSeqContext::getRuleIndex() const { + return CPP14Parser::RuleVirtualSpecifierSeq; +} + + +CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::virtualSpecifierSeq() { + VirtualSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 298, CPP14Parser::RuleVirtualSpecifierSeq); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1776); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1775); + virtualSpecifier(); + setState(1778); + _errHandler->sync(this); + _la = _input->LA(1); + } while (_la == CPP14Parser::Final + + || _la == CPP14Parser::Override); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- VirtualSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::VirtualSpecifierContext::VirtualSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::VirtualSpecifierContext::Override() { + return getToken(CPP14Parser::Override, 0); +} + +tree::TerminalNode* CPP14Parser::VirtualSpecifierContext::Final() { + return getToken(CPP14Parser::Final, 0); +} + + +size_t CPP14Parser::VirtualSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleVirtualSpecifier; +} + + +CPP14Parser::VirtualSpecifierContext* CPP14Parser::virtualSpecifier() { + VirtualSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 300, CPP14Parser::RuleVirtualSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1780); + _la = _input->LA(1); + if (!(_la == CPP14Parser::Final + + || _la == CPP14Parser::Override)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PureSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::PureSpecifierContext::PureSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::PureSpecifierContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +tree::TerminalNode* CPP14Parser::PureSpecifierContext::OctalLiteral() { + return getToken(CPP14Parser::OctalLiteral, 0); +} + + +size_t CPP14Parser::PureSpecifierContext::getRuleIndex() const { + return CPP14Parser::RulePureSpecifier; +} + + +CPP14Parser::PureSpecifierContext* CPP14Parser::pureSpecifier() { + PureSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 302, CPP14Parser::RulePureSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1782); + match(CPP14Parser::Assign); + setState(1783); + antlrcpp::downCast(_localctx)->val = match(CPP14Parser::OctalLiteral); + if((antlrcpp::downCast(_localctx)->val != nullptr ? antlrcpp::downCast(_localctx)->val->getText() : "").compare("0")!=0) throw new InputMismatchException(this); + + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BaseClauseContext ------------------------------------------------------------------ + +CPP14Parser::BaseClauseContext::BaseClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::BaseClauseContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::BaseSpecifierListContext* CPP14Parser::BaseClauseContext::baseSpecifierList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::BaseClauseContext::getRuleIndex() const { + return CPP14Parser::RuleBaseClause; +} + + +CPP14Parser::BaseClauseContext* CPP14Parser::baseClause() { + BaseClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 304, CPP14Parser::RuleBaseClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1786); + match(CPP14Parser::Colon); + setState(1787); + baseSpecifierList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BaseSpecifierListContext ------------------------------------------------------------------ + +CPP14Parser::BaseSpecifierListContext::BaseSpecifierListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::BaseSpecifierListContext::baseSpecifier() { + return getRuleContexts(); +} + +CPP14Parser::BaseSpecifierContext* CPP14Parser::BaseSpecifierListContext::baseSpecifier(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::BaseSpecifierListContext::Ellipsis() { + return getTokens(CPP14Parser::Ellipsis); +} + +tree::TerminalNode* CPP14Parser::BaseSpecifierListContext::Ellipsis(size_t i) { + return getToken(CPP14Parser::Ellipsis, i); +} + +std::vector CPP14Parser::BaseSpecifierListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::BaseSpecifierListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::BaseSpecifierListContext::getRuleIndex() const { + return CPP14Parser::RuleBaseSpecifierList; +} + + +CPP14Parser::BaseSpecifierListContext* CPP14Parser::baseSpecifierList() { + BaseSpecifierListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 306, CPP14Parser::RuleBaseSpecifierList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1789); + baseSpecifier(); + setState(1791); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1790); + match(CPP14Parser::Ellipsis); + } + setState(1800); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1793); + match(CPP14Parser::Comma); + setState(1794); + baseSpecifier(); + setState(1796); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1795); + match(CPP14Parser::Ellipsis); + } + setState(1802); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BaseSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::BaseSpecifierContext::BaseSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::BaseTypeSpecifierContext* CPP14Parser::BaseSpecifierContext::baseTypeSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::BaseSpecifierContext::Virtual() { + return getToken(CPP14Parser::Virtual, 0); +} + +CPP14Parser::AccessSpecifierContext* CPP14Parser::BaseSpecifierContext::accessSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::BaseSpecifierContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::BaseSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleBaseSpecifier; +} + + +CPP14Parser::BaseSpecifierContext* CPP14Parser::baseSpecifier() { + BaseSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 308, CPP14Parser::RuleBaseSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1804); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(1803); + attributeSpecifierSeq(); + } + setState(1818); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Decltype: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + setState(1806); + baseTypeSpecifier(); + break; + } + + case CPP14Parser::Virtual: { + setState(1807); + match(CPP14Parser::Virtual); + setState(1809); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 126100789566373888) != 0)) { + setState(1808); + accessSpecifier(); + } + setState(1811); + baseTypeSpecifier(); + break; + } + + case CPP14Parser::Private: + case CPP14Parser::Protected: + case CPP14Parser::Public: { + setState(1812); + accessSpecifier(); + setState(1814); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Virtual) { + setState(1813); + match(CPP14Parser::Virtual); + } + setState(1816); + baseTypeSpecifier(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClassOrDeclTypeContext ------------------------------------------------------------------ + +CPP14Parser::ClassOrDeclTypeContext::ClassOrDeclTypeContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassNameContext* CPP14Parser::ClassOrDeclTypeContext::className() { + return getRuleContext(0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ClassOrDeclTypeContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +CPP14Parser::DecltypeSpecifierContext* CPP14Parser::ClassOrDeclTypeContext::decltypeSpecifier() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ClassOrDeclTypeContext::getRuleIndex() const { + return CPP14Parser::RuleClassOrDeclType; +} + + +CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::classOrDeclType() { + ClassOrDeclTypeContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 310, CPP14Parser::RuleClassOrDeclType); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1825); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 262, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1821); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 261, _ctx)) { + case 1: { + setState(1820); + nestedNameSpecifier(0); + break; + } + + default: + break; + } + setState(1823); + className(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1824); + decltypeSpecifier(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- BaseTypeSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::BaseTypeSpecifierContext::BaseTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::BaseTypeSpecifierContext::classOrDeclType() { + return getRuleContext(0); +} + + +size_t CPP14Parser::BaseTypeSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleBaseTypeSpecifier; +} + + +CPP14Parser::BaseTypeSpecifierContext* CPP14Parser::baseTypeSpecifier() { + BaseTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 312, CPP14Parser::RuleBaseTypeSpecifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1827); + classOrDeclType(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AccessSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::AccessSpecifierContext::AccessSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Private() { + return getToken(CPP14Parser::Private, 0); +} + +tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Protected() { + return getToken(CPP14Parser::Protected, 0); +} + +tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Public() { + return getToken(CPP14Parser::Public, 0); +} + + +size_t CPP14Parser::AccessSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleAccessSpecifier; +} + + +CPP14Parser::AccessSpecifierContext* CPP14Parser::accessSpecifier() { + AccessSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 314, CPP14Parser::RuleAccessSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1829); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 126100789566373888) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConversionFunctionIdContext ------------------------------------------------------------------ + +CPP14Parser::ConversionFunctionIdContext::ConversionFunctionIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ConversionFunctionIdContext::Operator() { + return getToken(CPP14Parser::Operator, 0); +} + +CPP14Parser::ConversionTypeIdContext* CPP14Parser::ConversionFunctionIdContext::conversionTypeId() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConversionFunctionIdContext::getRuleIndex() const { + return CPP14Parser::RuleConversionFunctionId; +} + + +CPP14Parser::ConversionFunctionIdContext* CPP14Parser::conversionFunctionId() { + ConversionFunctionIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 316, CPP14Parser::RuleConversionFunctionId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1831); + match(CPP14Parser::Operator); + setState(1832); + conversionTypeId(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConversionTypeIdContext ------------------------------------------------------------------ + +CPP14Parser::ConversionTypeIdContext::ConversionTypeIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::ConversionTypeIdContext::typeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::ConversionDeclaratorContext* CPP14Parser::ConversionTypeIdContext::conversionDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConversionTypeIdContext::getRuleIndex() const { + return CPP14Parser::RuleConversionTypeId; +} + + +CPP14Parser::ConversionTypeIdContext* CPP14Parser::conversionTypeId() { + ConversionTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 318, CPP14Parser::RuleConversionTypeId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1834); + typeSpecifierSeq(); + setState(1836); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 263, _ctx)) { + case 1: { + setState(1835); + conversionDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConversionDeclaratorContext ------------------------------------------------------------------ + +CPP14Parser::ConversionDeclaratorContext::ConversionDeclaratorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::PointerOperatorContext* CPP14Parser::ConversionDeclaratorContext::pointerOperator() { + return getRuleContext(0); +} + +CPP14Parser::ConversionDeclaratorContext* CPP14Parser::ConversionDeclaratorContext::conversionDeclarator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConversionDeclaratorContext::getRuleIndex() const { + return CPP14Parser::RuleConversionDeclarator; +} + + +CPP14Parser::ConversionDeclaratorContext* CPP14Parser::conversionDeclarator() { + ConversionDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 320, CPP14Parser::RuleConversionDeclarator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1838); + pointerOperator(); + setState(1840); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 264, _ctx)) { + case 1: { + setState(1839); + conversionDeclarator(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ConstructorInitializerContext ------------------------------------------------------------------ + +CPP14Parser::ConstructorInitializerContext::ConstructorInitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ConstructorInitializerContext::Colon() { + return getToken(CPP14Parser::Colon, 0); +} + +CPP14Parser::MemInitializerListContext* CPP14Parser::ConstructorInitializerContext::memInitializerList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ConstructorInitializerContext::getRuleIndex() const { + return CPP14Parser::RuleConstructorInitializer; +} + + +CPP14Parser::ConstructorInitializerContext* CPP14Parser::constructorInitializer() { + ConstructorInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 322, CPP14Parser::RuleConstructorInitializer); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1842); + match(CPP14Parser::Colon); + setState(1843); + memInitializerList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemInitializerListContext ------------------------------------------------------------------ + +CPP14Parser::MemInitializerListContext::MemInitializerListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::MemInitializerListContext::memInitializer() { + return getRuleContexts(); +} + +CPP14Parser::MemInitializerContext* CPP14Parser::MemInitializerListContext::memInitializer(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::MemInitializerListContext::Ellipsis() { + return getTokens(CPP14Parser::Ellipsis); +} + +tree::TerminalNode* CPP14Parser::MemInitializerListContext::Ellipsis(size_t i) { + return getToken(CPP14Parser::Ellipsis, i); +} + +std::vector CPP14Parser::MemInitializerListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::MemInitializerListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::MemInitializerListContext::getRuleIndex() const { + return CPP14Parser::RuleMemInitializerList; +} + + +CPP14Parser::MemInitializerListContext* CPP14Parser::memInitializerList() { + MemInitializerListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 324, CPP14Parser::RuleMemInitializerList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1845); + memInitializer(); + setState(1847); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1846); + match(CPP14Parser::Ellipsis); + } + setState(1856); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1849); + match(CPP14Parser::Comma); + setState(1850); + memInitializer(); + setState(1852); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1851); + match(CPP14Parser::Ellipsis); + } + setState(1858); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MemInitializerContext ------------------------------------------------------------------ + +CPP14Parser::MemInitializerContext::MemInitializerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::MeminitializeridContext* CPP14Parser::MemInitializerContext::meminitializerid() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::MemInitializerContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::MemInitializerContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::BracedInitListContext* CPP14Parser::MemInitializerContext::bracedInitList() { + return getRuleContext(0); +} + +CPP14Parser::ExpressionListContext* CPP14Parser::MemInitializerContext::expressionList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::MemInitializerContext::getRuleIndex() const { + return CPP14Parser::RuleMemInitializer; +} + + +CPP14Parser::MemInitializerContext* CPP14Parser::memInitializer() { + MemInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 326, CPP14Parser::RuleMemInitializer); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1859); + meminitializerid(); + setState(1866); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::LeftParen: { + setState(1860); + match(CPP14Parser::LeftParen); + setState(1862); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { + setState(1861); + expressionList(); + } + setState(1864); + match(CPP14Parser::RightParen); + break; + } + + case CPP14Parser::LeftBrace: { + setState(1865); + bracedInitList(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- MeminitializeridContext ------------------------------------------------------------------ + +CPP14Parser::MeminitializeridContext::MeminitializeridContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::MeminitializeridContext::classOrDeclType() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::MeminitializeridContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::MeminitializeridContext::getRuleIndex() const { + return CPP14Parser::RuleMeminitializerid; +} + + +CPP14Parser::MeminitializeridContext* CPP14Parser::meminitializerid() { + MeminitializeridContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 328, CPP14Parser::RuleMeminitializerid); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1870); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 270, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1868); + classOrDeclType(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1869); + match(CPP14Parser::Identifier); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OperatorFunctionIdContext ------------------------------------------------------------------ + +CPP14Parser::OperatorFunctionIdContext::OperatorFunctionIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::OperatorFunctionIdContext::Operator() { + return getToken(CPP14Parser::Operator, 0); +} + +CPP14Parser::TheOperatorContext* CPP14Parser::OperatorFunctionIdContext::theOperator() { + return getRuleContext(0); +} + + +size_t CPP14Parser::OperatorFunctionIdContext::getRuleIndex() const { + return CPP14Parser::RuleOperatorFunctionId; +} + + +CPP14Parser::OperatorFunctionIdContext* CPP14Parser::operatorFunctionId() { + OperatorFunctionIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 330, CPP14Parser::RuleOperatorFunctionId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1872); + match(CPP14Parser::Operator); + setState(1873); + theOperator(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LiteralOperatorIdContext ------------------------------------------------------------------ + +CPP14Parser::LiteralOperatorIdContext::LiteralOperatorIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::Operator() { + return getToken(CPP14Parser::Operator, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::StringLiteral() { + return getToken(CPP14Parser::StringLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::UserDefinedStringLiteral() { + return getToken(CPP14Parser::UserDefinedStringLiteral, 0); +} + + +size_t CPP14Parser::LiteralOperatorIdContext::getRuleIndex() const { + return CPP14Parser::RuleLiteralOperatorId; +} + + +CPP14Parser::LiteralOperatorIdContext* CPP14Parser::literalOperatorId() { + LiteralOperatorIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 332, CPP14Parser::RuleLiteralOperatorId); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1875); + match(CPP14Parser::Operator); + setState(1879); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::StringLiteral: { + setState(1876); + match(CPP14Parser::StringLiteral); + setState(1877); + match(CPP14Parser::Identifier); + break; + } + + case CPP14Parser::UserDefinedStringLiteral: { + setState(1878); + match(CPP14Parser::UserDefinedStringLiteral); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::TemplateDeclarationContext::TemplateDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +CPP14Parser::TemplateparameterListContext* CPP14Parser::TemplateDeclarationContext::templateparameterList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +CPP14Parser::DeclarationContext* CPP14Parser::TemplateDeclarationContext::declaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TemplateDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateDeclaration; +} + + +CPP14Parser::TemplateDeclarationContext* CPP14Parser::templateDeclaration() { + TemplateDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 334, CPP14Parser::RuleTemplateDeclaration); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1881); + match(CPP14Parser::Template); + setState(1882); + match(CPP14Parser::Less); + setState(1883); + templateparameterList(); + setState(1884); + match(CPP14Parser::Greater); + setState(1885); + declaration(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateparameterListContext ------------------------------------------------------------------ + +CPP14Parser::TemplateparameterListContext::TemplateparameterListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::TemplateparameterListContext::templateParameter() { + return getRuleContexts(); +} + +CPP14Parser::TemplateParameterContext* CPP14Parser::TemplateparameterListContext::templateParameter(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::TemplateparameterListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::TemplateparameterListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::TemplateparameterListContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateparameterList; +} + + +CPP14Parser::TemplateparameterListContext* CPP14Parser::templateparameterList() { + TemplateparameterListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 336, CPP14Parser::RuleTemplateparameterList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1887); + templateParameter(); + setState(1892); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1888); + match(CPP14Parser::Comma); + setState(1889); + templateParameter(); + setState(1894); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateParameterContext ------------------------------------------------------------------ + +CPP14Parser::TemplateParameterContext::TemplateParameterContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TypeParameterContext* CPP14Parser::TemplateParameterContext::typeParameter() { + return getRuleContext(0); +} + +CPP14Parser::ParameterDeclarationContext* CPP14Parser::TemplateParameterContext::parameterDeclaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TemplateParameterContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateParameter; +} + + +CPP14Parser::TemplateParameterContext* CPP14Parser::templateParameter() { + TemplateParameterContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 338, CPP14Parser::RuleTemplateParameter); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1897); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 273, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1895); + typeParameter(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1896); + parameterDeclaration(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypeParameterContext ------------------------------------------------------------------ + +CPP14Parser::TypeParameterContext::TypeParameterContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Class() { + return getToken(CPP14Parser::Class, 0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Typename_() { + return getToken(CPP14Parser::Typename_, 0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::TypeParameterContext::theTypeId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +CPP14Parser::TemplateparameterListContext* CPP14Parser::TypeParameterContext::templateparameterList() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + +tree::TerminalNode* CPP14Parser::TypeParameterContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::TypeParameterContext::getRuleIndex() const { + return CPP14Parser::RuleTypeParameter; +} + + +CPP14Parser::TypeParameterContext* CPP14Parser::typeParameter() { + TypeParameterContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 340, CPP14Parser::RuleTypeParameter); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1908); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Class: + case CPP14Parser::Template: { + setState(1904); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(1899); + match(CPP14Parser::Template); + setState(1900); + match(CPP14Parser::Less); + setState(1901); + templateparameterList(); + setState(1902); + match(CPP14Parser::Greater); + } + setState(1906); + match(CPP14Parser::Class); + break; + } + + case CPP14Parser::Typename_: { + setState(1907); + match(CPP14Parser::Typename_); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1921); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 279, _ctx)) { + case 1: { + setState(1911); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1910); + match(CPP14Parser::Ellipsis); + } + setState(1914); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(1913); + match(CPP14Parser::Identifier); + } + break; + } + + case 2: { + setState(1917); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Identifier) { + setState(1916); + match(CPP14Parser::Identifier); + } + setState(1919); + match(CPP14Parser::Assign); + setState(1920); + theTypeId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SimpleTemplateIdContext ------------------------------------------------------------------ + +CPP14Parser::SimpleTemplateIdContext::SimpleTemplateIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TemplateNameContext* CPP14Parser::SimpleTemplateIdContext::templateName() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::SimpleTemplateIdContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +tree::TerminalNode* CPP14Parser::SimpleTemplateIdContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +CPP14Parser::TemplateArgumentListContext* CPP14Parser::SimpleTemplateIdContext::templateArgumentList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::SimpleTemplateIdContext::getRuleIndex() const { + return CPP14Parser::RuleSimpleTemplateId; +} + + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::simpleTemplateId() { + SimpleTemplateIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 342, CPP14Parser::RuleSimpleTemplateId); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1923); + templateName(); + setState(1924); + match(CPP14Parser::Less); + setState(1926); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979472930990334) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384268307) != 0) || _la == CPP14Parser::Identifier) { + setState(1925); + templateArgumentList(); + } + setState(1928); + match(CPP14Parser::Greater); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateIdContext ------------------------------------------------------------------ + +CPP14Parser::TemplateIdContext::TemplateIdContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TemplateIdContext::simpleTemplateId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TemplateIdContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +tree::TerminalNode* CPP14Parser::TemplateIdContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +CPP14Parser::OperatorFunctionIdContext* CPP14Parser::TemplateIdContext::operatorFunctionId() { + return getRuleContext(0); +} + +CPP14Parser::LiteralOperatorIdContext* CPP14Parser::TemplateIdContext::literalOperatorId() { + return getRuleContext(0); +} + +CPP14Parser::TemplateArgumentListContext* CPP14Parser::TemplateIdContext::templateArgumentList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TemplateIdContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateId; +} + + +CPP14Parser::TemplateIdContext* CPP14Parser::templateId() { + TemplateIdContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 344, CPP14Parser::RuleTemplateId); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1941); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(1930); + simpleTemplateId(); + break; + } + + case CPP14Parser::Operator: { + enterOuterAlt(_localctx, 2); + setState(1933); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 281, _ctx)) { + case 1: { + setState(1931); + operatorFunctionId(); + break; + } + + case 2: { + setState(1932); + literalOperatorId(); + break; + } + + default: + break; + } + setState(1935); + match(CPP14Parser::Less); + setState(1937); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979472930990334) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384268307) != 0) || _la == CPP14Parser::Identifier) { + setState(1936); + templateArgumentList(); + } + setState(1939); + match(CPP14Parser::Greater); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateNameContext ------------------------------------------------------------------ + +CPP14Parser::TemplateNameContext::TemplateNameContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TemplateNameContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + + +size_t CPP14Parser::TemplateNameContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateName; +} + + +CPP14Parser::TemplateNameContext* CPP14Parser::templateName() { + TemplateNameContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 346, CPP14Parser::RuleTemplateName); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1943); + match(CPP14Parser::Identifier); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateArgumentListContext ------------------------------------------------------------------ + +CPP14Parser::TemplateArgumentListContext::TemplateArgumentListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::TemplateArgumentListContext::templateArgument() { + return getRuleContexts(); +} + +CPP14Parser::TemplateArgumentContext* CPP14Parser::TemplateArgumentListContext::templateArgument(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::TemplateArgumentListContext::Ellipsis() { + return getTokens(CPP14Parser::Ellipsis); +} + +tree::TerminalNode* CPP14Parser::TemplateArgumentListContext::Ellipsis(size_t i) { + return getToken(CPP14Parser::Ellipsis, i); +} + +std::vector CPP14Parser::TemplateArgumentListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::TemplateArgumentListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::TemplateArgumentListContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateArgumentList; +} + + +CPP14Parser::TemplateArgumentListContext* CPP14Parser::templateArgumentList() { + TemplateArgumentListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 348, CPP14Parser::RuleTemplateArgumentList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1945); + templateArgument(); + setState(1947); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1946); + match(CPP14Parser::Ellipsis); + } + setState(1956); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(1949); + match(CPP14Parser::Comma); + setState(1950); + templateArgument(); + setState(1952); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(1951); + match(CPP14Parser::Ellipsis); + } + setState(1958); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TemplateArgumentContext ------------------------------------------------------------------ + +CPP14Parser::TemplateArgumentContext::TemplateArgumentContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::TemplateArgumentContext::theTypeId() { + return getRuleContext(0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::TemplateArgumentContext::constantExpression() { + return getRuleContext(0); +} + +CPP14Parser::IdExpressionContext* CPP14Parser::TemplateArgumentContext::idExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TemplateArgumentContext::getRuleIndex() const { + return CPP14Parser::RuleTemplateArgument; +} + + +CPP14Parser::TemplateArgumentContext* CPP14Parser::templateArgument() { + TemplateArgumentContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 350, CPP14Parser::RuleTemplateArgument); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(1962); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 287, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1959); + theTypeId(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1960); + constantExpression(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1961); + idExpression(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypeNameSpecifierContext ------------------------------------------------------------------ + +CPP14Parser::TypeNameSpecifierContext::TypeNameSpecifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Typename_() { + return getToken(CPP14Parser::Typename_, 0); +} + +CPP14Parser::NestedNameSpecifierContext* CPP14Parser::TypeNameSpecifierContext::nestedNameSpecifier() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Identifier() { + return getToken(CPP14Parser::Identifier, 0); +} + +CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TypeNameSpecifierContext::simpleTemplateId() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + + +size_t CPP14Parser::TypeNameSpecifierContext::getRuleIndex() const { + return CPP14Parser::RuleTypeNameSpecifier; +} + + +CPP14Parser::TypeNameSpecifierContext* CPP14Parser::typeNameSpecifier() { + TypeNameSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 352, CPP14Parser::RuleTypeNameSpecifier); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1964); + match(CPP14Parser::Typename_); + setState(1965); + nestedNameSpecifier(0); + setState(1971); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 289, _ctx)) { + case 1: { + setState(1966); + match(CPP14Parser::Identifier); + break; + } + + case 2: { + setState(1968); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Template) { + setState(1967); + match(CPP14Parser::Template); + } + setState(1970); + simpleTemplateId(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExplicitInstantiationContext ------------------------------------------------------------------ + +CPP14Parser::ExplicitInstantiationContext::ExplicitInstantiationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ExplicitInstantiationContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +CPP14Parser::DeclarationContext* CPP14Parser::ExplicitInstantiationContext::declaration() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ExplicitInstantiationContext::Extern() { + return getToken(CPP14Parser::Extern, 0); +} + + +size_t CPP14Parser::ExplicitInstantiationContext::getRuleIndex() const { + return CPP14Parser::RuleExplicitInstantiation; +} + + +CPP14Parser::ExplicitInstantiationContext* CPP14Parser::explicitInstantiation() { + ExplicitInstantiationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 354, CPP14Parser::RuleExplicitInstantiation); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1974); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Extern) { + setState(1973); + match(CPP14Parser::Extern); + } + setState(1976); + match(CPP14Parser::Template); + setState(1977); + declaration(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExplicitSpecializationContext ------------------------------------------------------------------ + +CPP14Parser::ExplicitSpecializationContext::ExplicitSpecializationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Template() { + return getToken(CPP14Parser::Template, 0); +} + +tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Less() { + return getToken(CPP14Parser::Less, 0); +} + +tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Greater() { + return getToken(CPP14Parser::Greater, 0); +} + +CPP14Parser::DeclarationContext* CPP14Parser::ExplicitSpecializationContext::declaration() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ExplicitSpecializationContext::getRuleIndex() const { + return CPP14Parser::RuleExplicitSpecialization; +} + + +CPP14Parser::ExplicitSpecializationContext* CPP14Parser::explicitSpecialization() { + ExplicitSpecializationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 356, CPP14Parser::RuleExplicitSpecialization); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1979); + match(CPP14Parser::Template); + setState(1980); + match(CPP14Parser::Less); + setState(1981); + match(CPP14Parser::Greater); + setState(1982); + declaration(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TryBlockContext ------------------------------------------------------------------ + +CPP14Parser::TryBlockContext::TryBlockContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TryBlockContext::Try() { + return getToken(CPP14Parser::Try, 0); +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::TryBlockContext::compoundStatement() { + return getRuleContext(0); +} + +CPP14Parser::HandlerSeqContext* CPP14Parser::TryBlockContext::handlerSeq() { + return getRuleContext(0); +} + + +size_t CPP14Parser::TryBlockContext::getRuleIndex() const { + return CPP14Parser::RuleTryBlock; +} + + +CPP14Parser::TryBlockContext* CPP14Parser::tryBlock() { + TryBlockContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 358, CPP14Parser::RuleTryBlock); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1984); + match(CPP14Parser::Try); + setState(1985); + compoundStatement(); + setState(1986); + handlerSeq(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FunctionTryBlockContext ------------------------------------------------------------------ + +CPP14Parser::FunctionTryBlockContext::FunctionTryBlockContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::FunctionTryBlockContext::Try() { + return getToken(CPP14Parser::Try, 0); +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::FunctionTryBlockContext::compoundStatement() { + return getRuleContext(0); +} + +CPP14Parser::HandlerSeqContext* CPP14Parser::FunctionTryBlockContext::handlerSeq() { + return getRuleContext(0); +} + +CPP14Parser::ConstructorInitializerContext* CPP14Parser::FunctionTryBlockContext::constructorInitializer() { + return getRuleContext(0); +} + + +size_t CPP14Parser::FunctionTryBlockContext::getRuleIndex() const { + return CPP14Parser::RuleFunctionTryBlock; +} + + +CPP14Parser::FunctionTryBlockContext* CPP14Parser::functionTryBlock() { + FunctionTryBlockContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 360, CPP14Parser::RuleFunctionTryBlock); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1988); + match(CPP14Parser::Try); + setState(1990); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Colon) { + setState(1989); + constructorInitializer(); + } + setState(1992); + compoundStatement(); + setState(1993); + handlerSeq(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- HandlerSeqContext ------------------------------------------------------------------ + +CPP14Parser::HandlerSeqContext::HandlerSeqContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::HandlerSeqContext::handler() { + return getRuleContexts(); +} + +CPP14Parser::HandlerContext* CPP14Parser::HandlerSeqContext::handler(size_t i) { + return getRuleContext(i); +} + + +size_t CPP14Parser::HandlerSeqContext::getRuleIndex() const { + return CPP14Parser::RuleHandlerSeq; +} + + +CPP14Parser::HandlerSeqContext* CPP14Parser::handlerSeq() { + HandlerSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 362, CPP14Parser::RuleHandlerSeq); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1996); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1995); + handler(); + setState(1998); + _errHandler->sync(this); + _la = _input->LA(1); + } while (_la == CPP14Parser::Catch); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- HandlerContext ------------------------------------------------------------------ + +CPP14Parser::HandlerContext::HandlerContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::HandlerContext::Catch() { + return getToken(CPP14Parser::Catch, 0); +} + +tree::TerminalNode* CPP14Parser::HandlerContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ExceptionDeclarationContext* CPP14Parser::HandlerContext::exceptionDeclaration() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::HandlerContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::CompoundStatementContext* CPP14Parser::HandlerContext::compoundStatement() { + return getRuleContext(0); +} + + +size_t CPP14Parser::HandlerContext::getRuleIndex() const { + return CPP14Parser::RuleHandler; +} + + +CPP14Parser::HandlerContext* CPP14Parser::handler() { + HandlerContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 364, CPP14Parser::RuleHandler); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(2000); + match(CPP14Parser::Catch); + setState(2001); + match(CPP14Parser::LeftParen); + setState(2002); + exceptionDeclaration(); + setState(2003); + match(CPP14Parser::RightParen); + setState(2004); + compoundStatement(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExceptionDeclarationContext ------------------------------------------------------------------ + +CPP14Parser::ExceptionDeclarationContext::ExceptionDeclarationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::ExceptionDeclarationContext::typeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ExceptionDeclarationContext::attributeSpecifierSeq() { + return getRuleContext(0); +} + +CPP14Parser::DeclaratorContext* CPP14Parser::ExceptionDeclarationContext::declarator() { + return getRuleContext(0); +} + +CPP14Parser::AbstractDeclaratorContext* CPP14Parser::ExceptionDeclarationContext::abstractDeclarator() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::ExceptionDeclarationContext::Ellipsis() { + return getToken(CPP14Parser::Ellipsis, 0); +} + + +size_t CPP14Parser::ExceptionDeclarationContext::getRuleIndex() const { + return CPP14Parser::RuleExceptionDeclaration; +} + + +CPP14Parser::ExceptionDeclarationContext* CPP14Parser::exceptionDeclaration() { + ExceptionDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 366, CPP14Parser::RuleExceptionDeclaration); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(2015); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Alignas: + case CPP14Parser::Auto: + case CPP14Parser::Bool: + case CPP14Parser::Char: + case CPP14Parser::Char16: + case CPP14Parser::Char32: + case CPP14Parser::Class: + case CPP14Parser::Const: + case CPP14Parser::Decltype: + case CPP14Parser::Double: + case CPP14Parser::Enum: + case CPP14Parser::Float: + case CPP14Parser::Int: + case CPP14Parser::Long: + case CPP14Parser::Short: + case CPP14Parser::Signed: + case CPP14Parser::Struct: + case CPP14Parser::Typename_: + case CPP14Parser::Union: + case CPP14Parser::Unsigned: + case CPP14Parser::Void: + case CPP14Parser::Volatile: + case CPP14Parser::Wchar: + case CPP14Parser::LeftBracket: + case CPP14Parser::Doublecolon: + case CPP14Parser::Identifier: { + enterOuterAlt(_localctx, 1); + setState(2007); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { + setState(2006); + attributeSpecifierSeq(); + } + setState(2009); + typeSpecifierSeq(); + setState(2012); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 294, _ctx)) { + case 1: { + setState(2010); + declarator(); + break; + } + + case 2: { + setState(2011); + abstractDeclarator(); + break; + } + + default: + break; + } + break; + } + + case CPP14Parser::Ellipsis: { + enterOuterAlt(_localctx, 2); + setState(2014); + match(CPP14Parser::Ellipsis); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ThrowExpressionContext ------------------------------------------------------------------ + +CPP14Parser::ThrowExpressionContext::ThrowExpressionContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::ThrowExpressionContext::Throw() { + return getToken(CPP14Parser::Throw, 0); +} + +CPP14Parser::AssignmentExpressionContext* CPP14Parser::ThrowExpressionContext::assignmentExpression() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ThrowExpressionContext::getRuleIndex() const { + return CPP14Parser::RuleThrowExpression; +} + + +CPP14Parser::ThrowExpressionContext* CPP14Parser::throwExpression() { + ThrowExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 368, CPP14Parser::RuleThrowExpression); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(2017); + match(CPP14Parser::Throw); + setState(2019); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { + setState(2018); + assignmentExpression(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExceptionSpecificationContext ------------------------------------------------------------------ + +CPP14Parser::ExceptionSpecificationContext::ExceptionSpecificationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +CPP14Parser::DynamicExceptionSpecificationContext* CPP14Parser::ExceptionSpecificationContext::dynamicExceptionSpecification() { + return getRuleContext(0); +} + +CPP14Parser::NoeExceptSpecificationContext* CPP14Parser::ExceptionSpecificationContext::noeExceptSpecification() { + return getRuleContext(0); +} + + +size_t CPP14Parser::ExceptionSpecificationContext::getRuleIndex() const { + return CPP14Parser::RuleExceptionSpecification; +} + + +CPP14Parser::ExceptionSpecificationContext* CPP14Parser::exceptionSpecification() { + ExceptionSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 370, CPP14Parser::RuleExceptionSpecification); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(2023); + _errHandler->sync(this); + switch (_input->LA(1)) { + case CPP14Parser::Throw: { + enterOuterAlt(_localctx, 1); + setState(2021); + dynamicExceptionSpecification(); + break; + } + + case CPP14Parser::Noexcept: { + enterOuterAlt(_localctx, 2); + setState(2022); + noeExceptSpecification(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DynamicExceptionSpecificationContext ------------------------------------------------------------------ + +CPP14Parser::DynamicExceptionSpecificationContext::DynamicExceptionSpecificationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::Throw() { + return getToken(CPP14Parser::Throw, 0); +} + +tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + +CPP14Parser::TypeIdListContext* CPP14Parser::DynamicExceptionSpecificationContext::typeIdList() { + return getRuleContext(0); +} + + +size_t CPP14Parser::DynamicExceptionSpecificationContext::getRuleIndex() const { + return CPP14Parser::RuleDynamicExceptionSpecification; +} + + +CPP14Parser::DynamicExceptionSpecificationContext* CPP14Parser::dynamicExceptionSpecification() { + DynamicExceptionSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 372, CPP14Parser::RuleDynamicExceptionSpecification); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(2025); + match(CPP14Parser::Throw); + setState(2026); + match(CPP14Parser::LeftParen); + setState(2028); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 13) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 13)) & -9213942612181769245) != 0) || ((((_la - 77) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 77)) & 37154696925806707) != 0)) { + setState(2027); + typeIdList(); + } + setState(2030); + match(CPP14Parser::RightParen); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TypeIdListContext ------------------------------------------------------------------ + +CPP14Parser::TypeIdListContext::TypeIdListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector CPP14Parser::TypeIdListContext::theTypeId() { + return getRuleContexts(); +} + +CPP14Parser::TheTypeIdContext* CPP14Parser::TypeIdListContext::theTypeId(size_t i) { + return getRuleContext(i); +} + +std::vector CPP14Parser::TypeIdListContext::Ellipsis() { + return getTokens(CPP14Parser::Ellipsis); +} + +tree::TerminalNode* CPP14Parser::TypeIdListContext::Ellipsis(size_t i) { + return getToken(CPP14Parser::Ellipsis, i); +} + +std::vector CPP14Parser::TypeIdListContext::Comma() { + return getTokens(CPP14Parser::Comma); +} + +tree::TerminalNode* CPP14Parser::TypeIdListContext::Comma(size_t i) { + return getToken(CPP14Parser::Comma, i); +} + + +size_t CPP14Parser::TypeIdListContext::getRuleIndex() const { + return CPP14Parser::RuleTypeIdList; +} + + +CPP14Parser::TypeIdListContext* CPP14Parser::typeIdList() { + TypeIdListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 374, CPP14Parser::RuleTypeIdList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(2032); + theTypeId(); + setState(2034); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(2033); + match(CPP14Parser::Ellipsis); + } + setState(2043); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == CPP14Parser::Comma) { + setState(2036); + match(CPP14Parser::Comma); + setState(2037); + theTypeId(); + setState(2039); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == CPP14Parser::Ellipsis) { + setState(2038); + match(CPP14Parser::Ellipsis); + } + setState(2045); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NoeExceptSpecificationContext ------------------------------------------------------------------ + +CPP14Parser::NoeExceptSpecificationContext::NoeExceptSpecificationContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::Noexcept() { + return getToken(CPP14Parser::Noexcept, 0); +} + +tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +CPP14Parser::ConstantExpressionContext* CPP14Parser::NoeExceptSpecificationContext::constantExpression() { + return getRuleContext(0); +} + +tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::NoeExceptSpecificationContext::getRuleIndex() const { + return CPP14Parser::RuleNoeExceptSpecification; +} + + +CPP14Parser::NoeExceptSpecificationContext* CPP14Parser::noeExceptSpecification() { + NoeExceptSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 376, CPP14Parser::RuleNoeExceptSpecification); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(2052); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 302, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(2046); + match(CPP14Parser::Noexcept); + setState(2047); + match(CPP14Parser::LeftParen); + setState(2048); + constantExpression(); + setState(2049); + match(CPP14Parser::RightParen); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(2051); + match(CPP14Parser::Noexcept); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TheOperatorContext ------------------------------------------------------------------ + +CPP14Parser::TheOperatorContext::TheOperatorContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::New() { + return getToken(CPP14Parser::New, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftBracket() { + return getToken(CPP14Parser::LeftBracket, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::RightBracket() { + return getToken(CPP14Parser::RightBracket, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Delete() { + return getToken(CPP14Parser::Delete, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Plus() { + return getToken(CPP14Parser::Plus, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Minus() { + return getToken(CPP14Parser::Minus, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Star() { + return getToken(CPP14Parser::Star, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Div() { + return getToken(CPP14Parser::Div, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Mod() { + return getToken(CPP14Parser::Mod, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Caret() { + return getToken(CPP14Parser::Caret, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::And() { + return getToken(CPP14Parser::And, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Or() { + return getToken(CPP14Parser::Or, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Tilde() { + return getToken(CPP14Parser::Tilde, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Not() { + return getToken(CPP14Parser::Not, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Assign() { + return getToken(CPP14Parser::Assign, 0); +} + +std::vector CPP14Parser::TheOperatorContext::Greater() { + return getTokens(CPP14Parser::Greater); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Greater(size_t i) { + return getToken(CPP14Parser::Greater, i); +} + +std::vector CPP14Parser::TheOperatorContext::Less() { + return getTokens(CPP14Parser::Less); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Less(size_t i) { + return getToken(CPP14Parser::Less, i); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::GreaterEqual() { + return getToken(CPP14Parser::GreaterEqual, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::PlusAssign() { + return getToken(CPP14Parser::PlusAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::MinusAssign() { + return getToken(CPP14Parser::MinusAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::StarAssign() { + return getToken(CPP14Parser::StarAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::ModAssign() { + return getToken(CPP14Parser::ModAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::XorAssign() { + return getToken(CPP14Parser::XorAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::AndAssign() { + return getToken(CPP14Parser::AndAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::OrAssign() { + return getToken(CPP14Parser::OrAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::RightShiftAssign() { + return getToken(CPP14Parser::RightShiftAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftShiftAssign() { + return getToken(CPP14Parser::LeftShiftAssign, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Equal() { + return getToken(CPP14Parser::Equal, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::NotEqual() { + return getToken(CPP14Parser::NotEqual, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::LessEqual() { + return getToken(CPP14Parser::LessEqual, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::AndAnd() { + return getToken(CPP14Parser::AndAnd, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::OrOr() { + return getToken(CPP14Parser::OrOr, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::PlusPlus() { + return getToken(CPP14Parser::PlusPlus, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::MinusMinus() { + return getToken(CPP14Parser::MinusMinus, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Comma() { + return getToken(CPP14Parser::Comma, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::ArrowStar() { + return getToken(CPP14Parser::ArrowStar, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::Arrow() { + return getToken(CPP14Parser::Arrow, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftParen() { + return getToken(CPP14Parser::LeftParen, 0); +} + +tree::TerminalNode* CPP14Parser::TheOperatorContext::RightParen() { + return getToken(CPP14Parser::RightParen, 0); +} + + +size_t CPP14Parser::TheOperatorContext::getRuleIndex() const { + return CPP14Parser::RuleTheOperator; +} + + +CPP14Parser::TheOperatorContext* CPP14Parser::theOperator() { + TheOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 378, CPP14Parser::RuleTheOperator); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(2105); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 305, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(2054); + match(CPP14Parser::New); + setState(2057); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 303, _ctx)) { + case 1: { + setState(2055); + match(CPP14Parser::LeftBracket); + setState(2056); + match(CPP14Parser::RightBracket); + break; + } + + default: + break; + } + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(2059); + match(CPP14Parser::Delete); + setState(2062); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 304, _ctx)) { + case 1: { + setState(2060); + match(CPP14Parser::LeftBracket); + setState(2061); + match(CPP14Parser::RightBracket); + break; + } + + default: + break; + } + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(2064); + match(CPP14Parser::Plus); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(2065); + match(CPP14Parser::Minus); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(2066); + match(CPP14Parser::Star); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(2067); + match(CPP14Parser::Div); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(2068); + match(CPP14Parser::Mod); + break; + } + + case 8: { + enterOuterAlt(_localctx, 8); + setState(2069); + match(CPP14Parser::Caret); + break; + } + + case 9: { + enterOuterAlt(_localctx, 9); + setState(2070); + match(CPP14Parser::And); + break; + } + + case 10: { + enterOuterAlt(_localctx, 10); + setState(2071); + match(CPP14Parser::Or); + break; + } + + case 11: { + enterOuterAlt(_localctx, 11); + setState(2072); + match(CPP14Parser::Tilde); + break; + } + + case 12: { + enterOuterAlt(_localctx, 12); + setState(2073); + match(CPP14Parser::Not); + break; + } + + case 13: { + enterOuterAlt(_localctx, 13); + setState(2074); + match(CPP14Parser::Assign); + break; + } + + case 14: { + enterOuterAlt(_localctx, 14); + setState(2075); + match(CPP14Parser::Greater); + break; + } + + case 15: { + enterOuterAlt(_localctx, 15); + setState(2076); + match(CPP14Parser::Less); + break; + } + + case 16: { + enterOuterAlt(_localctx, 16); + setState(2077); + match(CPP14Parser::GreaterEqual); + break; + } + + case 17: { + enterOuterAlt(_localctx, 17); + setState(2078); + match(CPP14Parser::PlusAssign); + break; + } + + case 18: { + enterOuterAlt(_localctx, 18); + setState(2079); + match(CPP14Parser::MinusAssign); + break; + } + + case 19: { + enterOuterAlt(_localctx, 19); + setState(2080); + match(CPP14Parser::StarAssign); + break; + } + + case 20: { + enterOuterAlt(_localctx, 20); + setState(2081); + match(CPP14Parser::ModAssign); + break; + } + + case 21: { + enterOuterAlt(_localctx, 21); + setState(2082); + match(CPP14Parser::XorAssign); + break; + } + + case 22: { + enterOuterAlt(_localctx, 22); + setState(2083); + match(CPP14Parser::AndAssign); + break; + } + + case 23: { + enterOuterAlt(_localctx, 23); + setState(2084); + match(CPP14Parser::OrAssign); + break; + } + + case 24: { + enterOuterAlt(_localctx, 24); + setState(2085); + match(CPP14Parser::Less); + setState(2086); + match(CPP14Parser::Less); + break; + } + + case 25: { + enterOuterAlt(_localctx, 25); + setState(2087); + match(CPP14Parser::Greater); + setState(2088); + match(CPP14Parser::Greater); + break; + } + + case 26: { + enterOuterAlt(_localctx, 26); + setState(2089); + match(CPP14Parser::RightShiftAssign); + break; + } + + case 27: { + enterOuterAlt(_localctx, 27); + setState(2090); + match(CPP14Parser::LeftShiftAssign); + break; + } + + case 28: { + enterOuterAlt(_localctx, 28); + setState(2091); + match(CPP14Parser::Equal); + break; + } + + case 29: { + enterOuterAlt(_localctx, 29); + setState(2092); + match(CPP14Parser::NotEqual); + break; + } + + case 30: { + enterOuterAlt(_localctx, 30); + setState(2093); + match(CPP14Parser::LessEqual); + break; + } + + case 31: { + enterOuterAlt(_localctx, 31); + setState(2094); + match(CPP14Parser::AndAnd); + break; + } + + case 32: { + enterOuterAlt(_localctx, 32); + setState(2095); + match(CPP14Parser::OrOr); + break; + } + + case 33: { + enterOuterAlt(_localctx, 33); + setState(2096); + match(CPP14Parser::PlusPlus); + break; + } + + case 34: { + enterOuterAlt(_localctx, 34); + setState(2097); + match(CPP14Parser::MinusMinus); + break; + } + + case 35: { + enterOuterAlt(_localctx, 35); + setState(2098); + match(CPP14Parser::Comma); + break; + } + + case 36: { + enterOuterAlt(_localctx, 36); + setState(2099); + match(CPP14Parser::ArrowStar); + break; + } + + case 37: { + enterOuterAlt(_localctx, 37); + setState(2100); + match(CPP14Parser::Arrow); + break; + } + + case 38: { + enterOuterAlt(_localctx, 38); + setState(2101); + match(CPP14Parser::LeftParen); + setState(2102); + match(CPP14Parser::RightParen); + break; + } + + case 39: { + enterOuterAlt(_localctx, 39); + setState(2103); + match(CPP14Parser::LeftBracket); + setState(2104); + match(CPP14Parser::RightBracket); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LiteralContext ------------------------------------------------------------------ + +CPP14Parser::LiteralContext::LiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* CPP14Parser::LiteralContext::IntegerLiteral() { + return getToken(CPP14Parser::IntegerLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::CharacterLiteral() { + return getToken(CPP14Parser::CharacterLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::FloatingLiteral() { + return getToken(CPP14Parser::FloatingLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::StringLiteral() { + return getToken(CPP14Parser::StringLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::BooleanLiteral() { + return getToken(CPP14Parser::BooleanLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::PointerLiteral() { + return getToken(CPP14Parser::PointerLiteral, 0); +} + +tree::TerminalNode* CPP14Parser::LiteralContext::UserDefinedLiteral() { + return getToken(CPP14Parser::UserDefinedLiteral, 0); +} + + +size_t CPP14Parser::LiteralContext::getRuleIndex() const { + return CPP14Parser::RuleLiteral; +} + + +CPP14Parser::LiteralContext* CPP14Parser::literal() { + LiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 380, CPP14Parser::RuleLiteral); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(2107); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 254) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +bool CPP14Parser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { + switch (ruleIndex) { + case 5: return nestedNameSpecifierSempred(antlrcpp::downCast(context), predicateIndex); + case 15: return postfixExpressionSempred(antlrcpp::downCast(context), predicateIndex); + case 25: return noPointerNewDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); + case 115: return noPointerDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); + case 126: return noPointerAbstractDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); + case 128: return noPointerAbstractPackDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); + + default: + break; + } + return true; +} + +bool CPP14Parser::nestedNameSpecifierSempred(NestedNameSpecifierContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 0: return precpred(_ctx, 1); + + default: + break; + } + return true; +} + +bool CPP14Parser::postfixExpressionSempred(PostfixExpressionContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 1: return precpred(_ctx, 7); + case 2: return precpred(_ctx, 6); + case 3: return precpred(_ctx, 4); + case 4: return precpred(_ctx, 3); + + default: + break; + } + return true; +} + +bool CPP14Parser::noPointerNewDeclaratorSempred(NoPointerNewDeclaratorContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 5: return precpred(_ctx, 1); + + default: + break; + } + return true; +} + +bool CPP14Parser::noPointerDeclaratorSempred(NoPointerDeclaratorContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 6: return precpred(_ctx, 2); + + default: + break; + } + return true; +} + +bool CPP14Parser::noPointerAbstractDeclaratorSempred(NoPointerAbstractDeclaratorContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 7: return precpred(_ctx, 4); + + default: + break; + } + return true; +} + +bool CPP14Parser::noPointerAbstractPackDeclaratorSempred(NoPointerAbstractPackDeclaratorContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 8: return precpred(_ctx, 2); + + default: + break; + } + return true; +} + +void CPP14Parser::initialize() { + ::antlr4::internal::call_once(cpp14parserParserOnceFlag, cpp14parserParserInitialize); +} diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp new file mode 100644 index 0000000..bf777e3 --- /dev/null +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -0,0 +1,41 @@ +#include "MyCppAntlr.h" + +#include + +MyCppAntlr::MyCppAntlr(std::unique_ptr input, + std::unique_ptr tokenStream, + std::unique_ptr lexer, + std::unique_ptr parser) + : input_ptr(std::move(input)), + tokenStream_ptr(std::move(tokenStream)), + lexer_ptr(std::move(lexer)), + parser_ptr(std::move(parser)) {} + +std::unique_ptr MyCppAntlr::init(std::ifstream& in) { + auto input = std::make_unique(in); + auto lex = std::make_unique(&(*input)); + auto tok = std::make_unique(&(*lex)); + auto parser = std::make_unique(&(*tok)); + auto a = std::make_unique( + MyCppAntlr(std::move(input),std::move(tok), std::move(lex), + std::move(parser))); + return std::move(a); +} + +std::vector MyCppAntlr::getTokens() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->toString(); + i++; + } + + return ans; +} + +std::string MyCppAntlr::getTreeString() { + auto tree = parser_ptr->translationUnit(); + return tree->toStringTree(&(*parser_ptr)); +} \ No newline at end of file diff --git a/server/pkg/antlr/python3/Python3.g4 b/server/pkg/antlr/python3/Python3.g4 new file mode 100644 index 0000000..3f801e1 --- /dev/null +++ b/server/pkg/antlr/python3/Python3.g4 @@ -0,0 +1,1182 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2014 by Bart Kiers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Project : python3-parser; an ANTLR4 grammar for Python 3 + * https://github.com/bkiers/python3-parser + * Developed by : Bart Kiers, bart@big-o.nl + */ +grammar Python3; + +// All comments that start with "///" are copy-pasted from +// The Python Language Reference + +tokens { INDENT, DEDENT } + +@lexer::header { + #include "Python3Parser.h" +} + + +@lexer::members { + private: + // A queue where extra tokens are pushed on (see the NEWLINE lexer rule). + std::vector> m_tokens; + // The stack that keeps track of the indentation level. + std::stack m_indents; + // The amount of opened braces, brackets and parenthesis. + int m_opened = 0; + // The most recently produced token. + std::unique_ptr m_pLastToken = nullptr; + + public: + virtual void emit(std::unique_ptr newToken) override { + m_tokens.push_back(cloneToken(newToken)); + setToken(std::move(newToken)); + } + + std::unique_ptr nextToken() override { + // Check if the end-of-file is ahead and there are still some DEDENTS expected. + if (_input->LA(1) == EOF && !m_indents.empty()) { + // Remove any trailing EOF tokens from our buffer. + for (int i = m_tokens.size() - 1; i >= 0; i--) { + if (m_tokens[i]->getType() == EOF) { + m_tokens.erase(m_tokens.begin() + i); + } + } + + // First emit an extra line break that serves as the end of the statement. + emit(commonToken(Python3Parser::NEWLINE, "\n")); + + // Now emit as much DEDENT tokens as needed. + while (!m_indents.empty()) { + emit(createDedent()); + m_indents.pop(); + } + + // Put the EOF back on the token stream. + emit(commonToken(EOF, "")); + } + + std::unique_ptr next = Lexer::nextToken(); + + if (next->getChannel() == antlr4::Token::DEFAULT_CHANNEL) { + // Keep track of the last token on the default channel. + m_pLastToken = cloneToken(next); + } + + if (!m_tokens.empty()) + { + next = std::move(*m_tokens.begin()); + m_tokens.erase(m_tokens.begin()); + } + + return next; + } + + private: + std::unique_ptr createDedent() { + std::unique_ptr dedent = commonToken(Python3Parser::DEDENT, ""); + return dedent; + } + + std::unique_ptr commonToken(size_t type, const std::string& text) { + int stop = getCharIndex() - 1; + int start = text.empty() ? stop : stop - text.size() + 1; + return _factory->create({ this, _input }, type, text, DEFAULT_TOKEN_CHANNEL, start, stop, m_pLastToken ? m_pLastToken->getLine() : 0, m_pLastToken ? m_pLastToken->getCharPositionInLine() : 0); + } + + std::unique_ptr cloneToken(const std::unique_ptr& source) { + return _factory->create({ this, _input }, source->getType(), source->getText(), source->getChannel(), source->getStartIndex(), source->getStopIndex(), source->getLine(), source->getCharPositionInLine()); + } + + + // Calculates the indentation of the provided spaces, taking the + // following rules into account: + // + // "Tabs are replaced (from left to right) by one to eight spaces + // such that the total number of characters up to and including + // the replacement is a multiple of eight [...]" + // + // -- https://docs.python.org/3.1/reference/lexical_analysis.html#indentation + static int getIndentationCount(const std::string& spaces) { + int count = 0; + for (char ch : spaces) { + switch (ch) { + case '\t': + count += 8 - (count % 8); + break; + default: + // A normal space char. + count++; + } + } + + return count; + } + + bool atStartOfInput() { + return getCharPositionInLine() == 0 && getLine() == 1; + } +} + +/* + * parser rules + */ + +single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE; +file_input: (NEWLINE | stmt)* EOF; +eval_input: testlist NEWLINE* EOF; + +decorator: '@' dotted_name ( '(' (arglist)? ')' )? NEWLINE; +decorators: decorator+; +decorated: decorators (classdef | funcdef | async_funcdef); + +async_funcdef: ASYNC funcdef; +funcdef: 'def' NAME parameters ('->' test)? ':' suite; + +parameters: '(' (typedargslist)? ')'; +typedargslist: (tfpdef ('=' test)? (',' tfpdef ('=' test)?)* (',' ( + '*' (tfpdef)? (',' tfpdef ('=' test)?)* (',' ('**' tfpdef (',')?)?)? + | '**' tfpdef (',')?)?)? + | '*' (tfpdef)? (',' tfpdef ('=' test)?)* (',' ('**' tfpdef (',')?)?)? + | '**' tfpdef (',')?); +tfpdef: NAME (':' test)?; +varargslist: (vfpdef ('=' test)? (',' vfpdef ('=' test)?)* (',' ( + '*' (vfpdef)? (',' vfpdef ('=' test)?)* (',' ('**' vfpdef (',')?)?)? + | '**' vfpdef (',')?)?)? + | '*' (vfpdef)? (',' vfpdef ('=' test)?)* (',' ('**' vfpdef (',')?)?)? + | '**' vfpdef (',')? +); +vfpdef: NAME; + +stmt: simple_stmt | compound_stmt; +simple_stmt: small_stmt (';' small_stmt)* (';')? NEWLINE; +small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | + import_stmt | global_stmt | nonlocal_stmt | assert_stmt); +expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | + ('=' (yield_expr|testlist_star_expr))*); +annassign: ':' test ('=' test)?; +testlist_star_expr: (test|star_expr) (',' (test|star_expr))* (',')?; +augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | + '<<=' | '>>=' | '**=' | '//='); +// For normal and annotated assignments, additional restrictions enforced by the interpreter +del_stmt: 'del' exprlist; +pass_stmt: 'pass'; +flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt; +break_stmt: 'break'; +continue_stmt: 'continue'; +return_stmt: 'return' (testlist)?; +yield_stmt: yield_expr; +raise_stmt: 'raise' (test ('from' test)?)?; +import_stmt: import_name | import_from; +import_name: 'import' dotted_as_names; +// note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS +import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+) + 'import' ('*' | '(' import_as_names ')' | import_as_names)); +import_as_name: NAME ('as' NAME)?; +dotted_as_name: dotted_name ('as' NAME)?; +import_as_names: import_as_name (',' import_as_name)* (',')?; +dotted_as_names: dotted_as_name (',' dotted_as_name)*; +dotted_name: NAME ('.' NAME)*; +global_stmt: 'global' NAME (',' NAME)*; +nonlocal_stmt: 'nonlocal' NAME (',' NAME)*; +assert_stmt: 'assert' test (',' test)?; + +compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt; +async_stmt: ASYNC (funcdef | with_stmt | for_stmt); +if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ('else' ':' suite)?; +while_stmt: 'while' test ':' suite ('else' ':' suite)?; +for_stmt: 'for' exprlist 'in' testlist ':' suite ('else' ':' suite)?; +try_stmt: ('try' ':' suite + ((except_clause ':' suite)+ + ('else' ':' suite)? + ('finally' ':' suite)? | + 'finally' ':' suite)); +with_stmt: 'with' with_item (',' with_item)* ':' suite; +with_item: test ('as' expr)?; +// NB compile.c makes sure that the default except clause is last +except_clause: 'except' (test ('as' NAME)?)?; +suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT; + +test: or_test ('if' or_test 'else' test)? | lambdef; +test_nocond: or_test | lambdef_nocond; +lambdef: 'lambda' (varargslist)? ':' test; +lambdef_nocond: 'lambda' (varargslist)? ':' test_nocond; +or_test: and_test ('or' and_test)*; +and_test: not_test ('and' not_test)*; +not_test: 'not' not_test | comparison; +comparison: expr (comp_op expr)*; +// <> isn't actually a valid comparison operator in Python. It's here for the +// sake of a __future__ import described in PEP 401 (which really works :-) +comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'; +star_expr: '*' expr; +expr: xor_expr ('|' xor_expr)*; +xor_expr: and_expr ('^' and_expr)*; +and_expr: shift_expr ('&' shift_expr)*; +shift_expr: arith_expr (('<<'|'>>') arith_expr)*; +arith_expr: term (('+'|'-') term)*; +term: factor (('*'|'@'|'/'|'%'|'//') factor)*; +factor: ('+'|'-'|'~') factor | power; +power: atom_expr ('**' factor)?; +atom_expr: (AWAIT)? atom trailer*; +atom: ('(' (yield_expr|testlist_comp)? ')' | + '[' (testlist_comp)? ']' | + '{' (dictorsetmaker)? '}' | + NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False'); +testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* (',')? ); +trailer: '(' (arglist)? ')' | '[' subscriptlist ']' | '.' NAME; +subscriptlist: subscript (',' subscript)* (',')?; +subscript: test | (test)? ':' (test)? (sliceop)?; +sliceop: ':' (test)?; +exprlist: (expr|star_expr) (',' (expr|star_expr))* (',')?; +testlist: test (',' test)* (',')?; +dictorsetmaker: ( ((test ':' test | '**' expr) + (comp_for | (',' (test ':' test | '**' expr))* (',')?)) | + ((test | star_expr) + (comp_for | (',' (test | star_expr))* (',')?)) ); + +classdef: 'class' NAME ('(' (arglist)? ')')? ':' suite; + +arglist: argument (',' argument)* (',')?; + +// The reason that keywords are test nodes instead of NAME is that using NAME +// results in an ambiguity. ast.c makes sure it's a NAME. +// "test '=' test" is really "keyword '=' test", but we have no such token. +// These need to be in a single rule to avoid grammar that is ambiguous +// to our LL(1) parser. Even though 'test' includes '*expr' in star_expr, +// we explicitly match '*' here, too, to give it proper precedence. +// Illegal combinations and orderings are blocked in ast.c: +// multiple (test comp_for) arguments are blocked; keyword unpackings +// that precede iterable unpackings are blocked; etc. +argument: ( test (comp_for)? | + test '=' test | + '**' test | + '*' test ); + +comp_iter: comp_for | comp_if; +comp_for: (ASYNC)? 'for' exprlist 'in' or_test (comp_iter)?; +comp_if: 'if' test_nocond (comp_iter)?; + +// not used in grammar, but may appear in "node" passed from Parser to Compiler +encoding_decl: NAME; + +yield_expr: 'yield' (yield_arg)?; +yield_arg: 'from' test | testlist; + +/* + * lexer rules + */ + +STRING + : STRING_LITERAL + | BYTES_LITERAL + ; + +NUMBER + : INTEGER + | FLOAT_NUMBER + | IMAG_NUMBER + ; + +INTEGER + : DECIMAL_INTEGER + | OCT_INTEGER + | HEX_INTEGER + | BIN_INTEGER + ; + +DEF : 'def'; +RETURN : 'return'; +RAISE : 'raise'; +FROM : 'from'; +IMPORT : 'import'; +AS : 'as'; +GLOBAL : 'global'; +NONLOCAL : 'nonlocal'; +ASSERT : 'assert'; +IF : 'if'; +ELIF : 'elif'; +ELSE : 'else'; +WHILE : 'while'; +FOR : 'for'; +IN : 'in'; +TRY : 'try'; +FINALLY : 'finally'; +WITH : 'with'; +EXCEPT : 'except'; +LAMBDA : 'lambda'; +OR : 'or'; +AND : 'and'; +NOT : 'not'; +IS : 'is'; +NONE : 'None'; +TRUE : 'True'; +FALSE : 'False'; +CLASS : 'class'; +YIELD : 'yield'; +DEL : 'del'; +PASS : 'pass'; +CONTINUE : 'continue'; +BREAK : 'break'; +ASYNC : 'async'; +AWAIT : 'await'; + +NEWLINE + : ( {atStartOfInput()}? SPACES + | ( '\r'? '\n' | '\r' | '\f' ) SPACES? + ) + { + { + std::string newLine, spaces; + std::string text = getText(); + for(char c : text) + { + if ((c == '\r') || (c == '\n') || (c == '\f')) + newLine.push_back(c); + else + spaces.push_back(c); + } + + + // Strip newlines inside open clauses except if we are near EOF. We keep NEWLINEs near EOF to + // satisfy the final newline needed by the single_put rule used by the REPL. + int next = _input->LA(1); + int nextnext = _input->LA(2); + if (m_opened > 0 || (nextnext != -1 && (next == '\r' || next == '\n' || next == '\f' || next == '#'))) { + // If we're inside a list or on a blank line, ignore all indents, + // dedents and line breaks. + skip(); + } + else { + emit(commonToken(NEWLINE, newLine)); + int indent = getIndentationCount(spaces); + int previous = m_indents.empty() ? 0 : m_indents.top(); + if (indent == previous) { + // skip indents of the same size as the present indent-size + skip(); + } + else if (indent > previous) { + m_indents.push(indent); + emit(commonToken(Python3Parser::INDENT, spaces)); + } + else { + // Possibly emit more than 1 DEDENT token. + while(!m_indents.empty() && m_indents.top() > indent) { + emit(createDedent()); + m_indents.pop(); + } + } + } + } + } + ; + +/// identifier ::= id_start id_continue* +NAME + : ID_START ID_CONTINUE* + ; + +/// stringliteral ::= [stringprefix](shortstring | longstring) +/// stringprefix ::= "r" | "u" | "R" | "U" | "f" | "F" +/// | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF" +STRING_LITERAL + : ( [rR] | [uU] | [fF] | ( [fF] [rR] ) | ( [rR] [fF] ) )? ( SHORT_STRING | LONG_STRING ) + ; + +/// bytesliteral ::= bytesprefix(shortbytes | longbytes) +/// bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB" +BYTES_LITERAL + : ( [bB] | ( [bB] [rR] ) | ( [rR] [bB] ) ) ( SHORT_BYTES | LONG_BYTES ) + ; + +/// decimalinteger ::= nonzerodigit digit* | "0"+ +DECIMAL_INTEGER + : NON_ZERO_DIGIT DIGIT* + | '0'+ + ; + +/// octinteger ::= "0" ("o" | "O") octdigit+ +OCT_INTEGER + : '0' [oO] OCT_DIGIT+ + ; + +/// hexinteger ::= "0" ("x" | "X") hexdigit+ +HEX_INTEGER + : '0' [xX] HEX_DIGIT+ + ; + +/// bininteger ::= "0" ("b" | "B") bindigit+ +BIN_INTEGER + : '0' [bB] BIN_DIGIT+ + ; + +/// floatnumber ::= pointfloat | exponentfloat +FLOAT_NUMBER + : POINT_FLOAT + | EXPONENT_FLOAT + ; + +/// imagnumber ::= (floatnumber | intpart) ("j" | "J") +IMAG_NUMBER + : ( FLOAT_NUMBER | INT_PART ) [jJ] + ; + +DOT : '.'; +ELLIPSIS : '...'; +STAR : '*'; +OPEN_PAREN : '(' {m_opened++;}; +CLOSE_PAREN : ')' {m_opened--;}; +COMMA : ','; +COLON : ':'; +SEMI_COLON : ';'; +POWER : '**'; +ASSIGN : '='; +OPEN_BRACK : '[' {m_opened++;}; +CLOSE_BRACK : ']' {m_opened--;}; +OR_OP : '|'; +XOR : '^'; +AND_OP : '&'; +LEFT_SHIFT : '<<'; +RIGHT_SHIFT : '>>'; +ADD : '+'; +MINUS : '-'; +DIV : '/'; +MOD : '%'; +IDIV : '//'; +NOT_OP : '~'; +OPEN_BRACE : '{' {m_opened++;}; +CLOSE_BRACE : '}' {m_opened--;}; +LESS_THAN : '<'; +GREATER_THAN : '>'; +EQUALS : '=='; +GT_EQ : '>='; +LT_EQ : '<='; +NOT_EQ_1 : '<>'; +NOT_EQ_2 : '!='; +AT : '@'; +ARROW : '->'; +ADD_ASSIGN : '+='; +SUB_ASSIGN : '-='; +MULT_ASSIGN : '*='; +AT_ASSIGN : '@='; +DIV_ASSIGN : '/='; +MOD_ASSIGN : '%='; +AND_ASSIGN : '&='; +OR_ASSIGN : '|='; +XOR_ASSIGN : '^='; +LEFT_SHIFT_ASSIGN : '<<='; +RIGHT_SHIFT_ASSIGN : '>>='; +POWER_ASSIGN : '**='; +IDIV_ASSIGN : '//='; + +SKIP_ + : ( SPACES | COMMENT | LINE_JOINING ) -> skip + ; + +UNKNOWN_CHAR + : . + ; + +/* + * fragments + */ + +/// shortstring ::= "'" shortstringitem* "'" | '"' shortstringitem* '"' +/// shortstringitem ::= shortstringchar | stringescapeseq +/// shortstringchar ::= +fragment SHORT_STRING + : '\'' ( STRING_ESCAPE_SEQ | ~[\\\r\n\f'] )* '\'' + | '"' ( STRING_ESCAPE_SEQ | ~[\\\r\n\f"] )* '"' + ; +/// longstring ::= "'''" longstringitem* "'''" | '"""' longstringitem* '"""' +fragment LONG_STRING + : '\'\'\'' LONG_STRING_ITEM*? '\'\'\'' + | '"""' LONG_STRING_ITEM*? '"""' + ; + +/// longstringitem ::= longstringchar | stringescapeseq +fragment LONG_STRING_ITEM + : LONG_STRING_CHAR + | STRING_ESCAPE_SEQ + ; + +/// longstringchar ::= +fragment LONG_STRING_CHAR + : ~'\\' + ; + +/// stringescapeseq ::= "\" +fragment STRING_ESCAPE_SEQ + : '\\' . + | '\\' NEWLINE + ; + +/// nonzerodigit ::= "1"..."9" +fragment NON_ZERO_DIGIT + : [1-9] + ; + +/// digit ::= "0"..."9" +fragment DIGIT + : [0-9] + ; + +/// octdigit ::= "0"..."7" +fragment OCT_DIGIT + : [0-7] + ; + +/// hexdigit ::= digit | "a"..."f" | "A"..."F" +fragment HEX_DIGIT + : [0-9a-fA-F] + ; + +/// bindigit ::= "0" | "1" +fragment BIN_DIGIT + : [01] + ; + +/// pointfloat ::= [intpart] fraction | intpart "." +fragment POINT_FLOAT + : INT_PART? FRACTION + | INT_PART '.' + ; + +/// exponentfloat ::= (intpart | pointfloat) exponent +fragment EXPONENT_FLOAT + : ( INT_PART | POINT_FLOAT ) EXPONENT + ; + +/// intpart ::= digit+ +fragment INT_PART + : DIGIT+ + ; + +/// fraction ::= "." digit+ +fragment FRACTION + : '.' DIGIT+ + ; + +/// exponent ::= ("e" | "E") ["+" | "-"] digit+ +fragment EXPONENT + : [eE] [+-]? DIGIT+ + ; + +/// shortbytes ::= "'" shortbytesitem* "'" | '"' shortbytesitem* '"' +/// shortbytesitem ::= shortbyteschar | bytesescapeseq +fragment SHORT_BYTES + : '\'' ( SHORT_BYTES_CHAR_NO_SINGLE_QUOTE | BYTES_ESCAPE_SEQ )* '\'' + | '"' ( SHORT_BYTES_CHAR_NO_DOUBLE_QUOTE | BYTES_ESCAPE_SEQ )* '"' + ; + +/// longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""' +fragment LONG_BYTES + : '\'\'\'' LONG_BYTES_ITEM*? '\'\'\'' + | '"""' LONG_BYTES_ITEM*? '"""' + ; + +/// longbytesitem ::= longbyteschar | bytesescapeseq +fragment LONG_BYTES_ITEM + : LONG_BYTES_CHAR + | BYTES_ESCAPE_SEQ + ; + +/// shortbyteschar ::= +fragment SHORT_BYTES_CHAR_NO_SINGLE_QUOTE + : [\u0000-\u0009] + | [\u000B-\u000C] + | [\u000E-\u0026] + | [\u0028-\u005B] + | [\u005D-\u007F] + ; + +fragment SHORT_BYTES_CHAR_NO_DOUBLE_QUOTE + : [\u0000-\u0009] + | [\u000B-\u000C] + | [\u000E-\u0021] + | [\u0023-\u005B] + | [\u005D-\u007F] + ; + +/// longbyteschar ::= +fragment LONG_BYTES_CHAR + : [\u0000-\u005B] + | [\u005D-\u007F] + ; + +/// bytesescapeseq ::= "\" +fragment BYTES_ESCAPE_SEQ + : '\\' [\u0000-\u007F] + ; + +fragment SPACES + : [ \t]+ + ; + +fragment COMMENT + : '#' ~[\r\n\f]* + ; + +fragment LINE_JOINING + : '\\' SPACES? ( '\r'? '\n' | '\r' | '\f') + ; + +/// id_start ::= +fragment ID_START + : '_' + | [A-Z] + | [a-z] + | '\u00AA' + | '\u00B5' + | '\u00BA' + | [\u00C0-\u00D6] + | [\u00D8-\u00F6] + | [\u00F8-\u01BA] + | '\u01BB' + | [\u01BC-\u01BF] + | [\u01C0-\u01C3] + | [\u01C4-\u0241] + | [\u0250-\u02AF] + | [\u02B0-\u02C1] + | [\u02C6-\u02D1] + | [\u02E0-\u02E4] + | '\u02EE' + | '\u037A' + | '\u0386' + | [\u0388-\u038A] + | '\u038C' + | [\u038E-\u03A1] + | [\u03A3-\u03CE] + | [\u03D0-\u03F5] + | [\u03F7-\u0481] + | [\u048A-\u04CE] + | [\u04D0-\u04F9] + | [\u0500-\u050F] + | [\u0531-\u0556] + | '\u0559' + | [\u0561-\u0587] + | [\u05D0-\u05EA] + | [\u05F0-\u05F2] + | [\u0621-\u063A] + | '\u0640' + | [\u0641-\u064A] + | [\u066E-\u066F] + | [\u0671-\u06D3] + | '\u06D5' + | [\u06E5-\u06E6] + | [\u06EE-\u06EF] + | [\u06FA-\u06FC] + | '\u06FF' + | '\u0710' + | [\u0712-\u072F] + | [\u074D-\u076D] + | [\u0780-\u07A5] + | '\u07B1' + | [\u0904-\u0939] + | '\u093D' + | '\u0950' + | [\u0958-\u0961] + | '\u097D' + | [\u0985-\u098C] + | [\u098F-\u0990] + | [\u0993-\u09A8] + | [\u09AA-\u09B0] + | '\u09B2' + | [\u09B6-\u09B9] + | '\u09BD' + | '\u09CE' + | [\u09DC-\u09DD] + | [\u09DF-\u09E1] + | [\u09F0-\u09F1] + | [\u0A05-\u0A0A] + | [\u0A0F-\u0A10] + | [\u0A13-\u0A28] + | [\u0A2A-\u0A30] + | [\u0A32-\u0A33] + | [\u0A35-\u0A36] + | [\u0A38-\u0A39] + | [\u0A59-\u0A5C] + | '\u0A5E' + | [\u0A72-\u0A74] + | [\u0A85-\u0A8D] + | [\u0A8F-\u0A91] + | [\u0A93-\u0AA8] + | [\u0AAA-\u0AB0] + | [\u0AB2-\u0AB3] + | [\u0AB5-\u0AB9] + | '\u0ABD' + | '\u0AD0' + | [\u0AE0-\u0AE1] + | [\u0B05-\u0B0C] + | [\u0B0F-\u0B10] + | [\u0B13-\u0B28] + | [\u0B2A-\u0B30] + | [\u0B32-\u0B33] + | [\u0B35-\u0B39] + | '\u0B3D' + | [\u0B5C-\u0B5D] + | [\u0B5F-\u0B61] + | '\u0B71' + | '\u0B83' + | [\u0B85-\u0B8A] + | [\u0B8E-\u0B90] + | [\u0B92-\u0B95] + | [\u0B99-\u0B9A] + | '\u0B9C' + | [\u0B9E-\u0B9F] + | [\u0BA3-\u0BA4] + | [\u0BA8-\u0BAA] + | [\u0BAE-\u0BB9] + | [\u0C05-\u0C0C] + | [\u0C0E-\u0C10] + | [\u0C12-\u0C28] + | [\u0C2A-\u0C33] + | [\u0C35-\u0C39] + | [\u0C60-\u0C61] + | [\u0C85-\u0C8C] + | [\u0C8E-\u0C90] + | [\u0C92-\u0CA8] + | [\u0CAA-\u0CB3] + | [\u0CB5-\u0CB9] + | '\u0CBD' + | '\u0CDE' + | [\u0CE0-\u0CE1] + | [\u0D05-\u0D0C] + | [\u0D0E-\u0D10] + | [\u0D12-\u0D28] + | [\u0D2A-\u0D39] + | [\u0D60-\u0D61] + | [\u0D85-\u0D96] + | [\u0D9A-\u0DB1] + | [\u0DB3-\u0DBB] + | '\u0DBD' + | [\u0DC0-\u0DC6] + | [\u0E01-\u0E30] + | [\u0E32-\u0E33] + | [\u0E40-\u0E45] + | '\u0E46' + | [\u0E81-\u0E82] + | '\u0E84' + | [\u0E87-\u0E88] + | '\u0E8A' + | '\u0E8D' + | [\u0E94-\u0E97] + | [\u0E99-\u0E9F] + | [\u0EA1-\u0EA3] + | '\u0EA5' + | '\u0EA7' + | [\u0EAA-\u0EAB] + | [\u0EAD-\u0EB0] + | [\u0EB2-\u0EB3] + | '\u0EBD' + | [\u0EC0-\u0EC4] + | '\u0EC6' + | [\u0EDC-\u0EDD] + | '\u0F00' + | [\u0F40-\u0F47] + | [\u0F49-\u0F6A] + | [\u0F88-\u0F8B] + | [\u1000-\u1021] + | [\u1023-\u1027] + | [\u1029-\u102A] + | [\u1050-\u1055] + | [\u10A0-\u10C5] + | [\u10D0-\u10FA] + | '\u10FC' + | [\u1100-\u1159] + | [\u115F-\u11A2] + | [\u11A8-\u11F9] + | [\u1200-\u1248] + | [\u124A-\u124D] + | [\u1250-\u1256] + | '\u1258' + | [\u125A-\u125D] + | [\u1260-\u1288] + | [\u128A-\u128D] + | [\u1290-\u12B0] + | [\u12B2-\u12B5] + | [\u12B8-\u12BE] + | '\u12C0' + | [\u12C2-\u12C5] + | [\u12C8-\u12D6] + | [\u12D8-\u1310] + | [\u1312-\u1315] + | [\u1318-\u135A] + | [\u1380-\u138F] + | [\u13A0-\u13F4] + | [\u1401-\u166C] + | [\u166F-\u1676] + | [\u1681-\u169A] + | [\u16A0-\u16EA] + | [\u16EE-\u16F0] + | [\u1700-\u170C] + | [\u170E-\u1711] + | [\u1720-\u1731] + | [\u1740-\u1751] + | [\u1760-\u176C] + | [\u176E-\u1770] + | [\u1780-\u17B3] + | '\u17D7' + | '\u17DC' + | [\u1820-\u1842] + | '\u1843' + | [\u1844-\u1877] + | [\u1880-\u18A8] + | [\u1900-\u191C] + | [\u1950-\u196D] + | [\u1970-\u1974] + | [\u1980-\u19A9] + | [\u19C1-\u19C7] + | [\u1A00-\u1A16] + | [\u1D00-\u1D2B] + | [\u1D2C-\u1D61] + | [\u1D62-\u1D77] + | '\u1D78' + | [\u1D79-\u1D9A] + | [\u1D9B-\u1DBF] + | [\u1E00-\u1E9B] + | [\u1EA0-\u1EF9] + | [\u1F00-\u1F15] + | [\u1F18-\u1F1D] + | [\u1F20-\u1F45] + | [\u1F48-\u1F4D] + | [\u1F50-\u1F57] + | '\u1F59' + | '\u1F5B' + | '\u1F5D' + | [\u1F5F-\u1F7D] + | [\u1F80-\u1FB4] + | [\u1FB6-\u1FBC] + | '\u1FBE' + | [\u1FC2-\u1FC4] + | [\u1FC6-\u1FCC] + | [\u1FD0-\u1FD3] + | [\u1FD6-\u1FDB] + | [\u1FE0-\u1FEC] + | [\u1FF2-\u1FF4] + | [\u1FF6-\u1FFC] + | '\u2071' + | '\u207F' + | [\u2090-\u2094] + | '\u2102' + | '\u2107' + | [\u210A-\u2113] + | '\u2115' + | '\u2118' + | [\u2119-\u211D] + | '\u2124' + | '\u2126' + | '\u2128' + | [\u212A-\u212D] + | '\u212E' + | [\u212F-\u2131] + | [\u2133-\u2134] + | [\u2135-\u2138] + | '\u2139' + | [\u213C-\u213F] + | [\u2145-\u2149] + | [\u2160-\u2183] + | [\u2C00-\u2C2E] + | [\u2C30-\u2C5E] + | [\u2C80-\u2CE4] + | [\u2D00-\u2D25] + | [\u2D30-\u2D65] + | '\u2D6F' + | [\u2D80-\u2D96] + | [\u2DA0-\u2DA6] + | [\u2DA8-\u2DAE] + | [\u2DB0-\u2DB6] + | [\u2DB8-\u2DBE] + | [\u2DC0-\u2DC6] + | [\u2DC8-\u2DCE] + | [\u2DD0-\u2DD6] + | [\u2DD8-\u2DDE] + | '\u3005' + | '\u3006' + | '\u3007' + | [\u3021-\u3029] + | [\u3031-\u3035] + | [\u3038-\u303A] + | '\u303B' + | '\u303C' + | [\u3041-\u3096] + | [\u309B-\u309C] + | [\u309D-\u309E] + | '\u309F' + | [\u30A1-\u30FA] + | [\u30FC-\u30FE] + | '\u30FF' + | [\u3105-\u312C] + | [\u3131-\u318E] + | [\u31A0-\u31B7] + | [\u31F0-\u31FF] + | [\u3400-\u4DB5] + | [\u4E00-\u9FBB] + | [\uA000-\uA014] + | '\uA015' + | [\uA016-\uA48C] + | [\uA800-\uA801] + | [\uA803-\uA805] + | [\uA807-\uA80A] + | [\uA80C-\uA822] + | [\uAC00-\uD7A3] + | [\uF900-\uFA2D] + | [\uFA30-\uFA6A] + | [\uFA70-\uFAD9] + | [\uFB00-\uFB06] + | [\uFB13-\uFB17] + | '\uFB1D' + | [\uFB1F-\uFB28] + | [\uFB2A-\uFB36] + | [\uFB38-\uFB3C] + | '\uFB3E' + | [\uFB40-\uFB41] + | [\uFB43-\uFB44] + | [\uFB46-\uFBB1] + | [\uFBD3-\uFD3D] + | [\uFD50-\uFD8F] + | [\uFD92-\uFDC7] + | [\uFDF0-\uFDFB] + | [\uFE70-\uFE74] + | [\uFE76-\uFEFC] + | [\uFF21-\uFF3A] + | [\uFF41-\uFF5A] + | [\uFF66-\uFF6F] + | '\uFF70' + | [\uFF71-\uFF9D] + | [\uFF9E-\uFF9F] + | [\uFFA0-\uFFBE] + | [\uFFC2-\uFFC7] + | [\uFFCA-\uFFCF] + | [\uFFD2-\uFFD7] + | [\uFFDA-\uFFDC] + ; + +/// id_continue ::= +fragment ID_CONTINUE + : ID_START + | [0-9] + | [\u0300-\u036F] + | [\u0483-\u0486] + | [\u0591-\u05B9] + | [\u05BB-\u05BD] + | '\u05BF' + | [\u05C1-\u05C2] + | [\u05C4-\u05C5] + | '\u05C7' + | [\u0610-\u0615] + | [\u064B-\u065E] + | [\u0660-\u0669] + | '\u0670' + | [\u06D6-\u06DC] + | [\u06DF-\u06E4] + | [\u06E7-\u06E8] + | [\u06EA-\u06ED] + | [\u06F0-\u06F9] + | '\u0711' + | [\u0730-\u074A] + | [\u07A6-\u07B0] + | [\u0901-\u0902] + | '\u0903' + | '\u093C' + | [\u093E-\u0940] + | [\u0941-\u0948] + | [\u0949-\u094C] + | '\u094D' + | [\u0951-\u0954] + | [\u0962-\u0963] + | [\u0966-\u096F] + | '\u0981' + | [\u0982-\u0983] + | '\u09BC' + | [\u09BE-\u09C0] + | [\u09C1-\u09C4] + | [\u09C7-\u09C8] + | [\u09CB-\u09CC] + | '\u09CD' + | '\u09D7' + | [\u09E2-\u09E3] + | [\u09E6-\u09EF] + | [\u0A01-\u0A02] + | '\u0A03' + | '\u0A3C' + | [\u0A3E-\u0A40] + | [\u0A41-\u0A42] + | [\u0A47-\u0A48] + | [\u0A4B-\u0A4D] + | [\u0A66-\u0A6F] + | [\u0A70-\u0A71] + | [\u0A81-\u0A82] + | '\u0A83' + | '\u0ABC' + | [\u0ABE-\u0AC0] + | [\u0AC1-\u0AC5] + | [\u0AC7-\u0AC8] + | '\u0AC9' + | [\u0ACB-\u0ACC] + | '\u0ACD' + | [\u0AE2-\u0AE3] + | [\u0AE6-\u0AEF] + | '\u0B01' + | [\u0B02-\u0B03] + | '\u0B3C' + | '\u0B3E' + | '\u0B3F' + | '\u0B40' + | [\u0B41-\u0B43] + | [\u0B47-\u0B48] + | [\u0B4B-\u0B4C] + | '\u0B4D' + | '\u0B56' + | '\u0B57' + | [\u0B66-\u0B6F] + | '\u0B82' + | [\u0BBE-\u0BBF] + | '\u0BC0' + | [\u0BC1-\u0BC2] + | [\u0BC6-\u0BC8] + | [\u0BCA-\u0BCC] + | '\u0BCD' + | '\u0BD7' + | [\u0BE6-\u0BEF] + | [\u0C01-\u0C03] + | [\u0C3E-\u0C40] + | [\u0C41-\u0C44] + | [\u0C46-\u0C48] + | [\u0C4A-\u0C4D] + | [\u0C55-\u0C56] + | [\u0C66-\u0C6F] + | [\u0C82-\u0C83] + | '\u0CBC' + | '\u0CBE' + | '\u0CBF' + | [\u0CC0-\u0CC4] + | '\u0CC6' + | [\u0CC7-\u0CC8] + | [\u0CCA-\u0CCB] + | [\u0CCC-\u0CCD] + | [\u0CD5-\u0CD6] + | [\u0CE6-\u0CEF] + | [\u0D02-\u0D03] + | [\u0D3E-\u0D40] + | [\u0D41-\u0D43] + | [\u0D46-\u0D48] + | [\u0D4A-\u0D4C] + | '\u0D4D' + | '\u0D57' + | [\u0D66-\u0D6F] + | [\u0D82-\u0D83] + | '\u0DCA' + | [\u0DCF-\u0DD1] + | [\u0DD2-\u0DD4] + | '\u0DD6' + | [\u0DD8-\u0DDF] + | [\u0DF2-\u0DF3] + | '\u0E31' + | [\u0E34-\u0E3A] + | [\u0E47-\u0E4E] + | [\u0E50-\u0E59] + | '\u0EB1' + | [\u0EB4-\u0EB9] + | [\u0EBB-\u0EBC] + | [\u0EC8-\u0ECD] + | [\u0ED0-\u0ED9] + | [\u0F18-\u0F19] + | [\u0F20-\u0F29] + | '\u0F35' + | '\u0F37' + | '\u0F39' + | [\u0F3E-\u0F3F] + | [\u0F71-\u0F7E] + | '\u0F7F' + | [\u0F80-\u0F84] + | [\u0F86-\u0F87] + | [\u0F90-\u0F97] + | [\u0F99-\u0FBC] + | '\u0FC6' + | '\u102C' + | [\u102D-\u1030] + | '\u1031' + | '\u1032' + | [\u1036-\u1037] + | '\u1038' + | '\u1039' + | [\u1040-\u1049] + | [\u1056-\u1057] + | [\u1058-\u1059] + | '\u135F' + | [\u1369-\u1371] + | [\u1712-\u1714] + | [\u1732-\u1734] + | [\u1752-\u1753] + | [\u1772-\u1773] + | '\u17B6' + | [\u17B7-\u17BD] + | [\u17BE-\u17C5] + | '\u17C6' + | [\u17C7-\u17C8] + | [\u17C9-\u17D3] + | '\u17DD' + | [\u17E0-\u17E9] + | [\u180B-\u180D] + | [\u1810-\u1819] + | '\u18A9' + | [\u1920-\u1922] + | [\u1923-\u1926] + | [\u1927-\u1928] + | [\u1929-\u192B] + | [\u1930-\u1931] + | '\u1932' + | [\u1933-\u1938] + | [\u1939-\u193B] + | [\u1946-\u194F] + | [\u19B0-\u19C0] + | [\u19C8-\u19C9] + | [\u19D0-\u19D9] + | [\u1A17-\u1A18] + | [\u1A19-\u1A1B] + | [\u1DC0-\u1DC3] + | [\u203F-\u2040] + | '\u2054' + | [\u20D0-\u20DC] + | '\u20E1' + | [\u20E5-\u20EB] + | [\u302A-\u302F] + | [\u3099-\u309A] + | '\uA802' + | '\uA806' + | '\uA80B' + | [\uA823-\uA824] + | [\uA825-\uA826] + | '\uA827' + | '\uFB1E' + | [\uFE00-\uFE0F] + | [\uFE20-\uFE23] + | [\uFE33-\uFE34] + | [\uFE4D-\uFE4F] + | [\uFF10-\uFF19] + | '\uFF3F' + ; diff --git a/server/pkg/antlr/testprogs/cpp/test.cpp b/server/pkg/antlr/testprogs/cpp/test.cpp new file mode 100644 index 0000000..d43253f --- /dev/null +++ b/server/pkg/antlr/testprogs/cpp/test.cpp @@ -0,0 +1,12 @@ +#include + +using namespace std; + +int main() +{ + if (true && true) { + cout << "Hello World!"; + } + return 0; +} + diff --git a/server/pkg/antlr/testprogs/python/test.py b/server/pkg/antlr/testprogs/python/test.py new file mode 100644 index 0000000..327d900 --- /dev/null +++ b/server/pkg/antlr/testprogs/python/test.py @@ -0,0 +1,7 @@ +var_1 = 1567 +reverse = 0 +while var_1 > 0: + rest = var_1 % 10 + reverse = reverse * 10 + rest + var_1 = var_1 // 10 +print("Число в обратном порядке:", reverse) \ No newline at end of file diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h new file mode 100644 index 0000000..13b3a4d --- /dev/null +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +class IAntlrWrapper { + public: + virtual std::vector getTokens() = 0; + virtual std::string getTreeString() = 0; +}; -- GitLab From eb61846e105ff04d879c7e71e1a044325d80a36f Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 4 May 2023 01:46:45 +0300 Subject: [PATCH 037/134] add equality op --- server/internal/dbManager/src/dbManager.cpp | 6 - .../internal/entities/include/MetricStat.hpp | 36 ++--- server/internal/entities/include/Solution.hpp | 42 +++--- server/internal/entities/include/Task.hpp | 24 ++- server/internal/entities/include/User.hpp | 28 ++-- server/internal/entities/src/MetricStat.cpp | 41 +++--- server/internal/entities/src/Solution.cpp | 53 ++++--- server/internal/entities/src/Task.cpp | 34 +++-- server/internal/entities/src/User.cpp | 32 ++-- server/internal/repository/CMakeLists.txt | 3 +- .../repository/include/MetricRepository.hpp | 6 +- .../repository/include/SolutionRepository.hpp | 5 +- .../repository/include/TaskRepository.hpp | 4 +- .../repository/include/UserRepository.hpp | 11 +- .../repository/src/MetricRepository.cpp | 8 +- .../repository/src/SolutionRepository.cpp | 10 +- .../repository/src/TaskRepository.cpp | 21 ++- .../repository/src/UserRepository.cpp | 29 +++- .../internal/repository/tests/CMakeLists.txt | 50 +++++++ .../repository/tests/RepositoryTests.cpp | 138 ++++++++++++++++++ .../repository/virtual/IMetricRepository.hpp | 3 +- .../virtual/ISolutionRepository.hpp | 7 +- .../repository/virtual/ITaskRepository.hpp | 5 +- .../repository/virtual/IUserRepository.hpp | 10 +- 24 files changed, 448 insertions(+), 158 deletions(-) create mode 100644 server/internal/repository/tests/RepositoryTests.cpp diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index 1c4f71f..f1ff766 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -18,14 +18,11 @@ void dbManager::createPool() { std::shared_ptr dbManager::connection() { std::unique_lock lock_(m_mutex); - // if pool is empty, then wait until it notifies back while (connection_pool.empty()) { m_condition.wait(lock_); } - // get new connection in queue auto conn_ = connection_pool.front(); - // immediately pop as we will use it now connection_pool.pop(); return conn_; @@ -34,12 +31,9 @@ std::shared_ptr dbManager::connection() { void dbManager::freeConnection(const std::shared_ptr &conn_) { std::unique_lock lock_(m_mutex); - // push a new connection into a pool connection_pool.push(conn_); - // unlock mutex lock_.unlock(); - // notify one of thread that is waiting m_condition.notify_one(); } diff --git a/server/internal/entities/include/MetricStat.hpp b/server/internal/entities/include/MetricStat.hpp index 4d5d338..491abb7 100644 --- a/server/internal/entities/include/MetricStat.hpp +++ b/server/internal/entities/include/MetricStat.hpp @@ -5,43 +5,45 @@ class MetricStat { public: + MetricStat() noexcept; + MetricStat(size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, - float meanRes); + float meanRes) noexcept; MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, - float meanRes); + float meanRes) noexcept; - [[nodiscard]] size_t getId() const; + [[nodiscard]] size_t getId() const noexcept; void setId(size_t id); - [[nodiscard]] size_t getSolutionId() const; + [[nodiscard]] size_t getSolutionId() const noexcept; - void setSolutionId(size_t solutionId); + void setSolutionId(size_t solutionId) noexcept; - [[nodiscard]] float getTextBasedRes() const; + [[nodiscard]] float getTextBasedRes() const noexcept; - void setTextBasedRes(float textBasedRes); + void setTextBasedRes(float textBasedRes) noexcept; - [[nodiscard]] float getTokenBasedRes() const; + [[nodiscard]] float getTokenBasedRes() const noexcept; - void setTokenBasedRes(float tokenBasedRes); + void setTokenBasedRes(float tokenBasedRes) noexcept; - [[nodiscard]] float getTreeBasedRes() const; + [[nodiscard]] float getTreeBasedRes() const noexcept; - void setTreeBasedRes(float treeBasedRes); + void setTreeBasedRes(float treeBasedRes) noexcept; - [[nodiscard]] bool isVerdict() const; + [[nodiscard]] bool isVerdict() const noexcept; - void setVerdict(bool verdict); + void setVerdict(bool verdict) noexcept; - [[nodiscard]] float getMeanRes() const; + [[nodiscard]] float getMeanRes() const noexcept; - void setMeanRes(float meanRes); + void setMeanRes(float meanRes) noexcept; - bool operator==(const MetricStat &rhs) const; + bool operator==(const MetricStat &rhs) const noexcept; - bool operator!=(const MetricStat &rhs) const; + bool operator!=(const MetricStat &rhs) const noexcept; private: size_t id; diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 5c3d313..974a560 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -8,44 +8,48 @@ class Solution { public: Solution(size_t id, std::string sendDate, size_t senderId, std::string source, - std::string tokens, std::string astTree, size_t taskId, std::string result); + std::string tokens, std::string astTree, size_t taskId, std::string result) noexcept; - [[nodiscard]] size_t getId() const; + Solution(std::string sendDate, size_t senderId, std::string source, std::string tokens, std::string astTree, + size_t taskId, std::string result) noexcept; + Solution() noexcept; + [[nodiscard]] size_t getId() const noexcept; - [[nodiscard]] const std::string &getSendDate() const; - void setSendDate(const std::string &sendDate); + [[nodiscard]] const std::string &getSendDate() const noexcept; - [[nodiscard]] size_t getSenderId() const; + void setSendDate(const std::string &sendDate) noexcept; - void setSenderId(size_t senderId); + [[nodiscard]] size_t getSenderId() const noexcept; - [[nodiscard]] const std::string &getSource() const; + void setSenderId(size_t senderId) noexcept; - void setSource(const std::string &source); + [[nodiscard]] const std::string &getSource() const noexcept; - [[nodiscard]] const std::string &getTokens() const; + void setSource(const std::string &source) noexcept; - void setTokens(const std::string &tokens); + [[nodiscard]] const std::string &getTokens() const noexcept; - [[nodiscard]] const std::string &getAstTree() const; + void setTokens(const std::string &tokens) noexcept; - void setAstTree(const std::string &astTree); + [[nodiscard]] const std::string &getAstTree() const noexcept; - [[nodiscard]] size_t getTaskId() const; + void setAstTree(const std::string &astTree) noexcept; - void setTaskId(size_t taskId); + [[nodiscard]] size_t getTaskId() const noexcept; - [[nodiscard]] const std::string &getResult() const; + void setTaskId(size_t taskId) noexcept; - void setResult(const std::string &result); + [[nodiscard]] const std::string &getResult() const noexcept; - void setId(size_t id); + void setResult(const std::string &result) noexcept; - bool operator==(const Solution &rhs) const; + void setId(size_t id) noexcept; - bool operator!=(const Solution &rhs) const; + bool operator==(const Solution &rhs) const noexcept; + + bool operator!=(const Solution &rhs) const noexcept; private: size_t id; diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index 99d28e6..e551804 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -6,22 +6,30 @@ class Task{ private: size_t id; std::string description; + float treshhold; public: - Task(size_t id, std::string description); + Task(size_t id, std::string description_, float treshold_) noexcept; - explicit Task(std::string description); + Task(std::string description_, float treshold_) noexcept; - [[nodiscard]] size_t getId() const; + Task() noexcept; - [[nodiscard]] const std::string &getDescription() const; + [[nodiscard]] size_t getId() const noexcept; - void setDescription(const std::string &description); + [[nodiscard]] const std::string &getDescription() const noexcept; - void setId(size_t id); + float getTreshhold() const noexcept; - bool operator==(const Task &rhs) const; + void setTreshhold(float treshhold) noexcept; + + void setDescription(const std::string &description) noexcept; + + void setId(size_t id) noexcept; + + bool operator==(const Task &rhs) const noexcept; + + bool operator!=(const Task &rhs) const noexcept; - bool operator!=(const Task &rhs) const; }; #endif //SOURCEDOUT_TASK_HPP diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index d593cf9..82e659f 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -13,31 +13,33 @@ private: std::string username; public: - User(size_t id_, std::string login_, std::string password_, std::string username_); + User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept; - User(std::string login_, std::string password_, std::string username_); + User(std::string login_, std::string password_, std::string username_) noexcept; - [[nodiscard]] const std::string &getLogin() const; + User() noexcept; - void setLogin(const std::string &login); + [[nodiscard]] const std::string &getLogin() const noexcept; - [[nodiscard]] const std::string &getPassword() const; + void setLogin(const std::string &login) noexcept; - void setPassword(const std::string &password); + [[nodiscard]] const std::string &getPassword() const noexcept; - [[nodiscard]] const std::string &getUsername() const; + void setPassword(const std::string &password) noexcept; - void setUsername(const std::string &username); + [[nodiscard]] const std::string &getUsername() const noexcept; - [[nodiscard]] size_t getId() const; + void setUsername(const std::string &username) noexcept; - friend std::ostream &operator<<(std::ostream &os, const User &user); + [[nodiscard]] size_t getId() const noexcept; - void setId(size_t id); + friend std::ostream &operator<<(std::ostream &os, const User &user) noexcept; - bool operator==(const User &rhs) const; + void setId(size_t id) noexcept; - bool operator!=(const User &rhs) const; + bool operator==(const User &rhs) const noexcept; + + bool operator!=(const User &rhs) const noexcept; }; #endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp index 12fa3b4..aa0befc 100644 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -2,16 +2,21 @@ #include "MetricStat.hpp" MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, - bool verdict, float meanRes) : id(0), solution_id(solutionId), + bool verdict, float meanRes) noexcept : id(0), solution_id(solutionId), text_based_res(textBasedRes), token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), verdict(verdict), mean_res(meanRes) {} + tree_based_res(treeBasedRes), verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, - bool verdict, float meanRes) : id(id), solution_id(solutionId), text_based_res(textBasedRes), + bool verdict, float meanRes) noexcept : id(id), solution_id(solutionId), text_based_res(textBasedRes), token_based_res(tokenBasedRes), tree_based_res(treeBasedRes), verdict(verdict), mean_res(meanRes) {} -size_t MetricStat::getId() const { +MetricStat::MetricStat() noexcept : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), + verdict(true), mean_res(0) { +} + +size_t MetricStat::getId() const noexcept { return id; } @@ -19,58 +24,58 @@ void MetricStat::setId(size_t id_) { id = id_; } -size_t MetricStat::getSolutionId() const { +size_t MetricStat::getSolutionId() const noexcept { return solution_id; } -void MetricStat::setSolutionId(size_t solutionId) { +void MetricStat::setSolutionId(size_t solutionId) noexcept { solution_id = solutionId; } -float MetricStat::getTextBasedRes() const { +float MetricStat::getTextBasedRes() const noexcept { return text_based_res; } -void MetricStat::setTextBasedRes(float textBasedRes) { +void MetricStat::setTextBasedRes(float textBasedRes) noexcept { text_based_res = textBasedRes; } -float MetricStat::getTokenBasedRes() const { +float MetricStat::getTokenBasedRes() const noexcept { return token_based_res; } -void MetricStat::setTokenBasedRes(float tokenBasedRes) { +void MetricStat::setTokenBasedRes(float tokenBasedRes) noexcept { token_based_res = tokenBasedRes; } -float MetricStat::getTreeBasedRes() const { +float MetricStat::getTreeBasedRes() const noexcept { return tree_based_res; } -void MetricStat::setTreeBasedRes(float treeBasedRes) { +void MetricStat::setTreeBasedRes(float treeBasedRes) noexcept { tree_based_res = treeBasedRes; } -bool MetricStat::isVerdict() const { +bool MetricStat::isVerdict() const noexcept { return verdict; } -void MetricStat::setVerdict(bool verdict_) { +void MetricStat::setVerdict(bool verdict_) noexcept { verdict = verdict_; } -float MetricStat::getMeanRes() const { +float MetricStat::getMeanRes() const noexcept { return mean_res; } -void MetricStat::setMeanRes(float meanRes) { +void MetricStat::setMeanRes(float meanRes) noexcept { mean_res = meanRes; } -bool MetricStat::operator==(const MetricStat &rhs) const { +bool MetricStat::operator==(const MetricStat &rhs) const noexcept { return id == rhs.id; } -bool MetricStat::operator!=(const MetricStat &rhs) const { +bool MetricStat::operator!=(const MetricStat &rhs) const noexcept { return !(rhs == *this); } diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 331f7e9..0603c00 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -1,84 +1,95 @@ #include #include -#include "../include/Solution.hpp" +#include "Solution.hpp" -Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, +Solution::Solution(size_t id, std::string sendDate, unsigned long senderId, std::string source, std::string tokens, std::string astTree, unsigned long taskId, - std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), + std::string result) noexcept : id(id), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), tokens(std::move(tokens)), astTree(std::move(astTree)), task_id(taskId), result(std::move(result)) {} -size_t Solution::getId() const { +Solution::Solution(std::string sendDate, unsigned long senderId, + std::string source, std::string tokens, + std::string astTree, unsigned long taskId, + std::string result) noexcept : id(0), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)) {} + +Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} + +size_t Solution::getId() const noexcept { return id; } -void Solution::setId(size_t id_) { +void Solution::setId(size_t id_) noexcept { id = id_; } -const std::string &Solution::getSendDate() const { +const std::string &Solution::getSendDate() const noexcept { return send_date; } -void Solution::setSendDate(const std::string &sendDate) { +void Solution::setSendDate(const std::string &sendDate) noexcept { send_date = sendDate; } -size_t Solution::getSenderId() const { +size_t Solution::getSenderId() const noexcept { return sender_id; } -void Solution::setSenderId(size_t senderId) { +void Solution::setSenderId(size_t senderId) noexcept { sender_id = senderId; } -const std::string &Solution::getSource() const { +const std::string &Solution::getSource() const noexcept { return source; } -void Solution::setSource(const std::string &source_) { +void Solution::setSource(const std::string &source_) noexcept { Solution::source = source_; } -const std::string &Solution::getTokens() const { +const std::string &Solution::getTokens() const noexcept { return tokens; } -void Solution::setTokens(const std::string &tokens_) { +void Solution::setTokens(const std::string &tokens_) noexcept { Solution::tokens = tokens_; } -const std::string &Solution::getAstTree() const { +const std::string &Solution::getAstTree() const noexcept { return astTree; } -void Solution::setAstTree(const std::string &astTree_) { +void Solution::setAstTree(const std::string &astTree_) noexcept { Solution::astTree = astTree_; } -size_t Solution::getTaskId() const { +size_t Solution::getTaskId() const noexcept { return task_id; } -void Solution::setTaskId(size_t taskId) { +void Solution::setTaskId(size_t taskId) noexcept { task_id = taskId; } -const std::string &Solution::getResult() const { +const std::string &Solution::getResult() const noexcept { return result; } -void Solution::setResult(const std::string &result_) { +void Solution::setResult(const std::string &result_) noexcept { Solution::result = result_; } -bool Solution::operator==(const Solution &rhs) const { +bool Solution::operator==(const Solution &rhs) const noexcept { return id == rhs.id; } -bool Solution::operator!=(const Solution &rhs) const { +bool Solution::operator!=(const Solution &rhs) const noexcept { return !(rhs == *this); } + diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index 56de902..b830fe9 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -2,32 +2,44 @@ #include "../include/Task.hpp" #include -#include -unsigned long Task::getId() const { - return id; -} +Task::Task(std::string description_, float treshold_) noexcept : id(0), description(std::move(description_)), + treshhold(treshold_) {} -Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} +Task::Task(size_t id, std::string description_, float treshold_) noexcept : id(id), description(std::move(description_)), + treshhold(treshold_) {} +Task::Task() noexcept:id(0), treshhold(0) { +} -Task::Task(std::string description) : id(0), description(std::move(description)) {} +unsigned long Task::getId() const noexcept { + return id; +} -const std::string &Task::getDescription() const { +const std::string &Task::getDescription() const noexcept { return description; } -void Task::setId(size_t id_) { +void Task::setId(size_t id_) noexcept { id = id_; } -void Task::setDescription(const std::string &description_) { +void Task::setDescription(const std::string &description_) noexcept { Task::description = description_; } -bool Task::operator==(const Task &rhs) const { +bool Task::operator==(const Task &rhs) const noexcept { return id == rhs.id; } -bool Task::operator!=(const Task &rhs) const { +bool Task::operator!=(const Task &rhs) const noexcept { return !(rhs == *this); } + +float Task::getTreshhold() const noexcept { + return treshhold; +} + +void Task::setTreshhold(float treshhold_) noexcept { + Task::treshhold = treshhold_; +} + diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index b6f54d7..67f2620 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -1,55 +1,59 @@ #include #include "../include/User.hpp" -User::User(size_t id_, std::string login_, std::string password_, std::string username_) : +User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { } -User::User(std::string login_, std::string password_, std::string username_) : -id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { + +User::User(std::string login_, std::string password_, std::string username_) noexcept : + id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} + +User::User() noexcept : id(0) { } -const std::string &User::getLogin() const { +const std::string &User::getLogin() const noexcept { return login; } -void User::setId(size_t id_) { +void User::setId(size_t id_) noexcept { id = id_; } -void User::setLogin(const std::string &login_) { +void User::setLogin(const std::string &login_) noexcept { User::login = login_; } -const std::string &User::getPassword() const { +const std::string &User::getPassword() const noexcept { return password; } -void User::setPassword(const std::string &password_) { +void User::setPassword(const std::string &password_) noexcept { User::password = password_; } -const std::string &User::getUsername() const { +const std::string &User::getUsername() const noexcept { return username; } -void User::setUsername(const std::string &username_) { +void User::setUsername(const std::string &username_) noexcept { User::username = username_; } -size_t User::getId() const { +size_t User::getId() const noexcept { return id; } -std::ostream &operator<<(std::ostream &os, const User &user) { +std::ostream &operator<<(std::ostream &os, const User &user) noexcept { os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " << user.username; return os; } -bool User::operator==(const User &rhs) const { +bool User::operator==(const User &rhs) const noexcept { return id == rhs.id; } -bool User::operator!=(const User &rhs) const { +bool User::operator!=(const User &rhs) const noexcept { return !(rhs == *this); } diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index 2c08543..a8c0efe 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -12,11 +12,12 @@ message("HEADERS = ${HEADERS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ --Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") +-Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align -ftest-coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") + add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp index 4ece7fe..5d9bf96 100644 --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -4,13 +4,15 @@ #include "IMetricRepository.hpp" #include "dbManager.hpp" #include - +#include using namespace pqxx; class MetricRepository : IMetricRepository { public: - MetricStat getById(size_t id) override; + explicit MetricRepository(); + + std::optional getById(size_t id) override; size_t storeMetric(MetricStat metric) override; diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index f0b1c88..2760959 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -7,12 +7,15 @@ #include #include "ISolutionRepository.hpp" #include "dbManager.hpp" +#include + using namespace pqxx; class SolutionRepository : ISolutionRepository { public: - Solution getSolutionById(size_t id) override; + explicit SolutionRepository(); + std::optional getSolutionById(size_t id) override; std::vector getSolutionsBySenderId(size_t sender_id) override; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 308a1a6..d907481 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -6,12 +6,14 @@ #include "ITaskRepository.hpp" #include "pqxx/pqxx" #include "dbManager.hpp" +#include using namespace pqxx; class TaskRepository : ITaskRepository { public: - Task getTaskById(size_t id) override; + explicit TaskRepository(); + std::optional getTaskById(size_t id) override; void updateTask(Task task) override; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index 7a82f82..b5a52f3 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -7,15 +7,17 @@ #include #include #include +#include + using namespace pqxx; class UserRepository : IUserRepository { public: explicit UserRepository(); - User getUserById(size_t id) override; + std::optional getUserById(size_t id) override; - User getUserByLogin(std::string login) override; + std::optional getUserByLogin(std::string login) override; size_t makeUser(User user) override; @@ -25,9 +27,12 @@ public: std::vector getAllUsers() override; + void update(User user) override; + private: - static User makeUser(const result::const_iterator& c); + static User makeUser(const result::const_iterator &c); + std::shared_ptr manager; }; diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp index 0e72661..b5e17fd 100644 --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -2,13 +2,15 @@ #include "MetricRepository.hpp" #include -MetricStat MetricRepository::getById(size_t id) { +std::optional MetricRepository::getById(size_t id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM metricStat WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); + if(r.empty()) + return std::nullopt; return makeMetric(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -83,3 +85,7 @@ MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { c.at(c.column_number("mean_res")).as() }; } + +MetricRepository::MetricRepository() { + manager = std::make_shared(); +} diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 3288158..4b112b3 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -6,13 +6,15 @@ using namespace pqxx; -Solution SolutionRepository::getSolutionById(size_t id) { +std::optional SolutionRepository::getSolutionById(size_t id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); + if(r.empty()) + return std::nullopt; return makeSolution(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -120,4 +122,8 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("astTree")).as(), c.at(c.column_number("task_id")).as(), c.at(c.column_number("result")).as()}; -} \ No newline at end of file +} + +SolutionRepository::SolutionRepository() { + manager = std::make_shared(); +} diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 0f06026..7b92d31 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -5,13 +5,16 @@ #include #include "TaskRepository.hpp" -Task TaskRepository::getTaskById(size_t id) { +std::optional TaskRepository::getTaskById(size_t id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); + if (r.empty()){ + return std::nullopt; + } return makeTask(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -22,7 +25,8 @@ Task TaskRepository::getTaskById(size_t id) { void TaskRepository::updateTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE tasks SET description = '%s' ;") % task.getDescription()).str(); + std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s';") % + task.getDescription() % task.getTreshhold()).str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -35,8 +39,8 @@ void TaskRepository::updateTask(Task task) { size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO tasks (description) " \ - "VALUES ('%s') RETURNING id; ") % task.getDescription()).str(); + std::string sql = (boost::format("INSERT INTO tasks (description, treshold) " \ + "VALUES ('%s', '%s') RETURNING id; ") % task.getDescription() % task.getTreshhold()).str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -68,5 +72,10 @@ void TaskRepository::deleteTaskById(size_t task_id) { Task TaskRepository::makeTask(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), - c.at(c.column_number("description")).as()}; -} \ No newline at end of file + c.at(c.column_number("description")).as(), + c.at(c.column_number("treshold")).as()}; +} + +TaskRepository::TaskRepository() { + manager = std::make_shared(); +} diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index df85bda..51f23c5 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -5,13 +5,15 @@ #include "dbManager.hpp" #include -User UserRepository::getUserById(size_t id) { +std::optional UserRepository::getUserById(size_t id) { try { auto c = manager->connection(); std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); + if (r.empty()) + return std::nullopt; return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -19,13 +21,15 @@ User UserRepository::getUserById(size_t id) { } } -User UserRepository::getUserByLogin(std::string login) { +std::optional UserRepository::getUserByLogin(std::string login) { try { auto c = manager->connection(); - std::string sql = (boost::format("SELECT * FROM Users WHERE login= '%s'")% login).str(); + std::string sql = (boost::format("SELECT * FROM Users WHERE login= '%s'") % login).str(); nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); + if(r.empty()) + return std::nullopt; return makeUser(r.begin()); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; @@ -38,7 +42,8 @@ size_t UserRepository::makeUser(User user) { auto c = manager->connection(); std::string sql = (boost::format("INSERT INTO users (login,password,username) " \ - "VALUES ('%s', '%s', '%s') RETURNING id; ") % user.getLogin() % user.getPassword() % user.getUsername()).str(); + "VALUES ('%s', '%s', '%s') RETURNING id; ") % user.getLogin() % user.getPassword() % + user.getUsername()).str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -96,3 +101,19 @@ User UserRepository::makeUser(const result::const_iterator &c) { UserRepository::UserRepository() { manager = std::make_shared(); } + +void UserRepository::update(User user) { + try { + auto c = manager->connection(); + + std::string sql = (boost::format( + "UPDATE Users SET login = '%s', password = '%s', username = '%s';") + % user.getLogin() % user.getPassword() % user.getUsername()).str(); + work w(*c); + w.exec(sql); + manager->freeConnection(c); + } catch (const std::exception &e) { + std::cerr << e.what() << std::endl; + throw e; + } +} diff --git a/server/internal/repository/tests/CMakeLists.txt b/server/internal/repository/tests/CMakeLists.txt index e69de29..ad20fc9 100644 --- a/server/internal/repository/tests/CMakeLists.txt +++ b/server/internal/repository/tests/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.19) + +project("RepositoryTests") + +set(CMAKE_CXX_STANDARD 20) + +file(GLOB SOURCES *.cpp) + +if(BUILD_TYPE) + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fprofile-arcs -ftest-coverage -O0 -g") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov" ) +endif(BUILD_TYPE) + + +file(GLOB TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +message("${TEST_SOURCES}") +add_executable(${PROJECT_NAME} ${TEST_SOURCES}) + +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB} ${GTest_LIBRARIES} ${libRepository_LIB}) +target_include_directories(${PROJECT_NAME} PUBLIC ${libRepository_INCLUDE_DIRS}) + +target_compile_options(${PROJECT_NAME} PUBLIC --coverage) +target_link_options(${PROJECT_NAME} PUBLIC --coverage) + +gtest_discover_tests(${PROJECT_NAME}) + +add_custom_target( + ${PROJECT_NAME}_TEST + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} +) + +add_custom_target( + ${PROJECT_NAME}_COVERAGE + COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_custom_target( + ${PROJECT_NAME}_COVERAGE_FILE + COMMAND rm -r ${CMAKE_CURRENT_BINARY_DIR}/report || echo "There are no reports" + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/report + COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} --html-details report/report.html +) + +add_custom_target( + ${PROJECT_NAME}_VALGRIND + COMMAND valgrind -s --leak-check=full --show-leak-kinds=all ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} +) + + + diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp new file mode 100644 index 0000000..4af0790 --- /dev/null +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -0,0 +1,138 @@ +#include +#include +#include "MetricRepository.hpp" +#include "UserRepository.hpp" +#include "SolutionRepository.hpp" +#include "TaskRepository.hpp" +#include +TEST(UserRepository_CRUD_Test, CRUD) { + UserRepository rep; + + EXPECT_NO_FATAL_FAILURE(rep.getUserById(1)); + + User user("test@test.com", "test", "testuser"); + size_t id = rep.makeUser(user); + user.setId(id); + std::optional new_user_opt = rep.getUserById(id); + User new_user; + if (new_user_opt) { + new_user = new_user_opt.value(); + } + EXPECT_EQ(user, new_user); + new_user.setUsername("new_test_user"); + EXPECT_NO_FATAL_FAILURE(rep.update(new_user)); + + EXPECT_NO_FATAL_FAILURE(rep.deleteUser(new_user)); +} + +TEST(TaskRepository_CRUD_Test, CRUD) { + TaskRepository rep; + + Task task("test task", 0.5); + size_t id = rep.storeTask(task); + EXPECT_NO_FATAL_FAILURE(rep.getTaskById(1)); + task.setId(id); + std::optional new_task_opt = rep.getTaskById(id); + Task new_task; + if (new_task_opt) + new_task = new_task_opt.value(); + EXPECT_EQ(task, new_task); + new_task.setDescription("new_test_description"); + EXPECT_NO_FATAL_FAILURE(rep.updateTask(new_task)); + EXPECT_NO_FATAL_FAILURE(rep.deleteTask(new_task)); +} + +TEST(SolutionRepository_CRUD_Test, CRUD) { + SolutionRepository rep; + + Solution solution("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); + size_t id = rep.storeSolution(solution); + EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(1)); + solution.setId(id); + std::optional new_solution_opt = rep.getSolutionById(id); + Solution new_solution; + if (new_solution_opt) + new_solution = new_solution_opt.value(); + EXPECT_EQ(solution, new_solution); + new_solution.setSource(":/D"); + EXPECT_NO_FATAL_FAILURE(rep.updateSolution(new_solution)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(new_solution)); +} + +TEST(MetricRepository_CRUD_Test, CRUD){ + MetricRepository rep; + MetricStat metricStat(1, 0.8f, 0.9f, 0.89f, true, 0.85f); + size_t id = rep.storeMetric(metricStat); + EXPECT_NO_FATAL_FAILURE(rep.getById(1)); + metricStat.setId(id); + std::optional new_stat_opt = rep.getById(id); + MetricStat new_stat; + if (new_stat_opt) + new_stat = new_stat_opt.value(); + EXPECT_EQ(metricStat, new_stat); + new_stat.setMeanRes(1); + EXPECT_NO_FATAL_FAILURE(rep.updateMetric(new_stat)); + EXPECT_NO_FATAL_FAILURE(rep.deleteMetric(new_stat)); +} + +TEST(UserRepository_CRUD_Test, CRUD_many) { + UserRepository rep; + std::vector v = {{"test@test.com", "test", "testuser"}, {"test2@test.com", "test2", "testuser2"}}; + EXPECT_NO_FATAL_FAILURE(rep.getAllUsers()); + std::vector new_v = rep.getAllUsers(); + EXPECT_EQ(v, new_v); +} + +TEST(UserRepository_CRUD_Test, loginLikeId) { + UserRepository rep; + User user("test@test.com", "test", "testuser"); + size_t id = rep.makeUser(user); + user.setId(id); + std::optional new_user_id = rep.getUserById(id); + std::optional new_user_login = rep.getUserByLogin(user.getLogin()); + User new_user; + EXPECT_EQ(new_user_id, new_user_login); + EXPECT_NO_FATAL_FAILURE(rep.deleteUser(user)); + +} + +TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { + SolutionRepository rep; + + Solution solution1("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); + Solution solution2("01.01.1970", 1, "/home/usr","tokens.txt","tree.txt", 1, "result"); + + size_t id1 = rep.storeSolution(solution1); + solution1.setId(id1); + size_t id2 = rep.storeSolution(solution2); + solution2.setId(id2); + std::vector v = {solution1, solution2}; + std::vector new_v = rep.getSolutionsBySenderId(solution1.getId()); + EXPECT_EQ(v, new_v); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); + +} + +TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { + SolutionRepository rep; + + Solution solution1("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); + Solution solution2("01.01.1970", 1, "/home/usr","tokens.txt","tree.txt", 1, "result"); + + size_t id1 = rep.storeSolution(solution1); + solution1.setId(id1); + size_t id2 = rep.storeSolution(solution2); + solution2.setId(id2); + std::vector v = {solution1, solution2}; + std::vector new_v = rep.getSolutionsByTaskId(solution1.getId()); + EXPECT_EQ(v, new_v); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); + +} + +int main(int argc, char **argv) { + ::testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/repository/virtual/IMetricRepository.hpp b/server/internal/repository/virtual/IMetricRepository.hpp index f0911b9..fcd92fe 100644 --- a/server/internal/repository/virtual/IMetricRepository.hpp +++ b/server/internal/repository/virtual/IMetricRepository.hpp @@ -3,11 +3,12 @@ #include +#include #include "MetricStat.hpp" class IMetricRepository { public: - virtual MetricStat getById(size_t id) = 0; + virtual std::optional getById(size_t id) = 0; virtual size_t storeMetric(MetricStat metric) = 0; diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 4325a3f..d8e3b80 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -3,11 +3,12 @@ #include #include -#include "../../entities/include/Solution.hpp" +#include "Solution.hpp" +#include class ISolutionRepository { public: - virtual Solution getSolutionById(size_t id) = 0; + virtual std::optional getSolutionById(size_t id) = 0; virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; @@ -20,8 +21,6 @@ public: virtual void deleteSolutionById(size_t id) = 0; virtual void deleteSolution(Solution solution) = 0; - - }; #endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 6e97d0b..6f201ca 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -2,11 +2,12 @@ #define SOURCEDOUT_ITASKREPOSITORY_HPP #include -#include "../../entities/include/Task.hpp" +#include "Task.hpp" +#include class ITaskRepository { public: - virtual Task getTaskById(size_t id) = 0; + virtual std::optional getTaskById(size_t id) = 0; virtual void updateTask(Task task) = 0; diff --git a/server/internal/repository/virtual/IUserRepository.hpp b/server/internal/repository/virtual/IUserRepository.hpp index 8b3f7ab..6212721 100644 --- a/server/internal/repository/virtual/IUserRepository.hpp +++ b/server/internal/repository/virtual/IUserRepository.hpp @@ -2,17 +2,21 @@ #define SOURCEDOUT_IUSERREPOSITORY_HPP #include -#include "../../entities/include/User.hpp" +#include "User.hpp" +#include + class IUserRepository { public: - virtual User getUserById(size_t id) = 0; + virtual std::optional getUserById(size_t id) = 0; - virtual User getUserByLogin(std::string login) = 0; + virtual std::optional getUserByLogin(std::string login) = 0; virtual size_t makeUser(User user) = 0; virtual void deleteUser(User user) = 0; + virtual void update(User user) = 0; + virtual void deleteByUserId(size_t user_id) = 0; virtual std::vector getAllUsers() = 0; -- GitLab From 9404042b39d2194f23bdbbf396fc166814268ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 4 May 2023 09:14:37 +0300 Subject: [PATCH 038/134] Add skeleton for gui library --- client/internal/CMakeLists.txt | 6 ++- client/internal/gui/CMakeLists.txt | 24 ++++++++++ client/internal/gui/include/AuthDialog.h | 43 ++++++++++++++++++ client/internal/gui/include/EntryWindow.h | 45 +++++++++++++++++++ client/internal/gui/include/SignUpDialog.h | 46 +++++++++++++++++++ client/internal/gui/include/StatsDialog.h | 25 +++++++++++ client/internal/gui/include/UIManager.h | 21 +++++++++ client/internal/gui/include/UserWindow.h | 46 +++++++++++++++++++ client/internal/gui/src/AuthDialog.cpp | 15 +++++++ client/internal/gui/src/EntryWindow.cpp | 27 +++++++++++ client/internal/gui/src/SignUpDialog.cpp | 17 +++++++ client/internal/gui/src/UIManager.cpp | 11 +++++ client/internal/gui/src/UserWindow.cpp | 9 ++++ client/internal/gui/tests/CMakeLists.txt | 16 +++++++ client/internal/gui/tests/main.cpp | 52 ++++++++++++++++++++++ 15 files changed, 402 insertions(+), 1 deletion(-) create mode 100644 client/internal/gui/CMakeLists.txt create mode 100644 client/internal/gui/include/AuthDialog.h create mode 100644 client/internal/gui/include/EntryWindow.h create mode 100644 client/internal/gui/include/SignUpDialog.h create mode 100644 client/internal/gui/include/StatsDialog.h create mode 100644 client/internal/gui/include/UIManager.h create mode 100644 client/internal/gui/include/UserWindow.h create mode 100644 client/internal/gui/src/AuthDialog.cpp create mode 100644 client/internal/gui/src/EntryWindow.cpp create mode 100644 client/internal/gui/src/SignUpDialog.cpp create mode 100644 client/internal/gui/src/UIManager.cpp create mode 100644 client/internal/gui/src/UserWindow.cpp create mode 100644 client/internal/gui/tests/CMakeLists.txt create mode 100644 client/internal/gui/tests/main.cpp diff --git a/client/internal/CMakeLists.txt b/client/internal/CMakeLists.txt index 93fbed8..f76cc95 100644 --- a/client/internal/CMakeLists.txt +++ b/client/internal/CMakeLists.txt @@ -1,8 +1,12 @@ add_subdirectory(entities) add_subdirectory(httpClient) +add_subdirectory(gui) set(libClientEntities_LIB ${libClientEntities_LIB} PARENT_SCOPE) set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOPE) set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) -set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file +set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) + +set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) +set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/gui/CMakeLists.txt b/client/internal/gui/CMakeLists.txt new file mode 100644 index 0000000..60da13c --- /dev/null +++ b/client/internal/gui/CMakeLists.txt @@ -0,0 +1,24 @@ +project("GuiLib") + +set(CMAKE_CXX_STANDARD 20) + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) +file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +set(CMAKE_PREFIX_PATH "~/Qt/6.5.0/macos/lib/cmake") +find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui) + +include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS}) + +add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) +target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} Qt6::Widgets Qt6::Core Qt6::Gui) + +set(GUI_lib_LIB ${PROJECT_NAME}) +set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) + +set(GUI_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/client/internal/gui/include/AuthDialog.h b/client/internal/gui/include/AuthDialog.h new file mode 100644 index 0000000..76b3f9b --- /dev/null +++ b/client/internal/gui/include/AuthDialog.h @@ -0,0 +1,43 @@ +#ifndef AUTH_DIALOG_H +#define AUTH_DIALOG_H + +#include +#include +#include +#include +#include + +class AuthDialog : public QDialog { + Q_OBJECT + +public: + explicit AuthDialog(QWidget *parent = nullptr); + ~AuthDialog() override; + +signals: + void showMainWindow(); + void showUserWindow(); + +private slots: + void on_loginButton_clicked(); + void on_backButton_clicked(); + +private: + QGroupBox *groupBox = nullptr; + QWidget *layoutWidget = nullptr; + QVBoxLayout *verticalLayout = nullptr; + QHBoxLayout *horizontalLayout = nullptr; + QLabel *loginLabel = nullptr; + QLineEdit *login = nullptr; + QHBoxLayout *horizontalLayout_2 = nullptr; + QLabel *passwordLabel = nullptr; + QLineEdit *password = nullptr; + QPushButton *loginButton = nullptr; + QPushButton *backButton = nullptr; + + void setupUi(QDialog *AuthDialog); + + void setTexts(QDialog *AuthDialog); +}; + +#endif // AUTH_DIALOG_H diff --git a/client/internal/gui/include/EntryWindow.h b/client/internal/gui/include/EntryWindow.h new file mode 100644 index 0000000..b7acbd0 --- /dev/null +++ b/client/internal/gui/include/EntryWindow.h @@ -0,0 +1,45 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include + +#include "AuthDialog.h" +#include "SignUpDialog.h" + +class EntryWindow : public QMainWindow { +Q_OBJECT + +public: + EntryWindow(QWidget *parent = nullptr); + ~EntryWindow() override; + + std::shared_ptr getSignUpDialog(); + std::shared_ptr getAuthDialog(); + +private slots: + static void onExitButtonClicked(); + void onLoginButtonClicked(); + void onSignUpButtonClicked(); + +private: + std::shared_ptr authDialog = nullptr; + std::shared_ptr signUpDialog = nullptr; + QWidget *centralwidget = nullptr; + QVBoxLayout *verticalLayout = nullptr; + QLabel *introLabel = nullptr; + QPushButton *loginButton = nullptr; + QSpacerItem *horizontalSpacer = nullptr; + QPushButton *signUpButton = nullptr; + QSpacerItem *horizontalSpacer_2 = nullptr; + QPushButton *exitButton = nullptr; + QMenuBar *menubar = nullptr; + QStatusBar *statusbar = nullptr; + + void setupUi(QMainWindow *MainWindow); + void retranslateUi(QMainWindow *MainWindow); +}; + +#endif // MAINWINDOW_H diff --git a/client/internal/gui/include/SignUpDialog.h b/client/internal/gui/include/SignUpDialog.h new file mode 100644 index 0000000..2882b24 --- /dev/null +++ b/client/internal/gui/include/SignUpDialog.h @@ -0,0 +1,46 @@ +#ifndef SIGN_UP_DIALOG_H +#define SIGN_UP_DIALOG_H + +#include +#include +#include +#include +#include + +class SignUpDialog : public QDialog { +Q_OBJECT + +public: + explicit SignUpDialog(QWidget *parent = nullptr); + ~SignUpDialog() override; + +signals: + void showEntryWindow(); + void showUserWindow(); + +private slots: + void on_signUpButton_clicked() {}; + void on_backButton_clicked() {}; + +private: + QGroupBox *groupBox = nullptr; + QWidget *layoutWidget = nullptr; + QVBoxLayout *verticalLayout_2 = nullptr; + QVBoxLayout *verticalLayout = nullptr; + QGridLayout *gridLayout = nullptr; + QLabel *enterLoginLabel = nullptr; + QLineEdit *login = nullptr; + QGridLayout *gridLayout_2 = nullptr; + QLineEdit *pass = nullptr; + QLabel *enterPasswordLabel = nullptr; + QHBoxLayout *horizontalLayout_3 = nullptr; + QLabel *repeatPasswordLabel = nullptr; + QLineEdit *passRepeat = nullptr; + QPushButton *signUpButton = nullptr; + QPushButton *backButton = nullptr; + + void setupUi(QDialog *SignUpDialog); + void retranslateUi(QDialog *SignUpDialog); +}; + +#endif // SIGN_UP_DIALOG_H diff --git a/client/internal/gui/include/StatsDialog.h b/client/internal/gui/include/StatsDialog.h new file mode 100644 index 0000000..8a10038 --- /dev/null +++ b/client/internal/gui/include/StatsDialog.h @@ -0,0 +1,25 @@ +// +// Created by Николай Степанов on 04.05.2023. +// + +#ifndef SOURCEDOUT_STATSDIALOG_H +#define SOURCEDOUT_STATSDIALOG_H + +#include +#include +#include "Metric.h" + +class StatsDialog : public QDialog { + Q_OBJECT + +public: + explicit StatsDialog(QWidget *parent = nullptr) {}; + ~StatsDialog() override {}; + +private: + QTableView* tableView = nullptr; + QTableWidget* tableWidget = nullptr; + QVector metrics; +}; + +#endif //SOURCEDOUT_STATSDIALOG_H diff --git a/client/internal/gui/include/UIManager.h b/client/internal/gui/include/UIManager.h new file mode 100644 index 0000000..3d030f2 --- /dev/null +++ b/client/internal/gui/include/UIManager.h @@ -0,0 +1,21 @@ +#ifndef INCLUDE_UIMANAGER_H_ +#define INCLUDE_UIMANAGER_H_ + +#include "EntryWindow.h" +#include "UserWindow.h" + +class UIManager { +public: + UIManager(); + + ~UIManager() = default; + + void showEntryWindow(); + void showUserWindow(); + +private: + EntryWindow entryWindow; + UserWindow userWindow; +}; + +#endif // INCLUDE_UIMANAGER_H_ diff --git a/client/internal/gui/include/UserWindow.h b/client/internal/gui/include/UserWindow.h new file mode 100644 index 0000000..859d69e --- /dev/null +++ b/client/internal/gui/include/UserWindow.h @@ -0,0 +1,46 @@ +#ifndef USERWINDOW_H +#define USERWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "StatsDialog.h" + +class UserWindow : public QMainWindow { +Q_OBJECT + +public: + explicit UserWindow(QWidget *parent = nullptr); + ~UserWindow() override = default; + +signals: + void logout(); + +private slots: + void onBackButtonClicked(); + void onListElementClicked(); + void onSendButtonClicked(); + +private: + + QTabWidget* tabs = nullptr; + StatsDialog* statsDialog = nullptr; + QPushButton *backButton = nullptr; + QPushButton *sendButton = nullptr; + QComboBox* comboBox = nullptr; + QVBoxLayout* verticalLayout = nullptr; + QLabel* label = nullptr; + QLabel* description = nullptr; + QFileDialog* fileDialog = nullptr; + QStringList* list = nullptr; + + QWidget *centralwidget = nullptr; +}; + +#endif // USERWINDOW_H diff --git a/client/internal/gui/src/AuthDialog.cpp b/client/internal/gui/src/AuthDialog.cpp new file mode 100644 index 0000000..0e57d4d --- /dev/null +++ b/client/internal/gui/src/AuthDialog.cpp @@ -0,0 +1,15 @@ +#include "AuthDialog.h" + +AuthDialog::AuthDialog(QWidget *parent) : QDialog(parent) { + setupUi(this); +} + +AuthDialog::~AuthDialog() {} + +void AuthDialog::on_loginButton_clicked() {} + +void AuthDialog::setupUi(QDialog *AuthDialog) {} + +void AuthDialog::setTexts(QDialog *AuthDialog) {} + +void AuthDialog::on_backButton_clicked() {} diff --git a/client/internal/gui/src/EntryWindow.cpp b/client/internal/gui/src/EntryWindow.cpp new file mode 100644 index 0000000..8bf9bc3 --- /dev/null +++ b/client/internal/gui/src/EntryWindow.cpp @@ -0,0 +1,27 @@ +#include "EntryWindow.h" + +#include +#include +#include +#include +#include "AuthDialog.h" +#include "SignUpDialog.h" + +EntryWindow::EntryWindow(QWidget *parent) : QMainWindow(parent) {} + +EntryWindow::~EntryWindow() {} + +void EntryWindow::setupUi(QMainWindow *MainWindow) {} + +void EntryWindow::retranslateUi(QMainWindow *MainWindow) {} + +void EntryWindow::onExitButtonClicked() {} + +void EntryWindow::onLoginButtonClicked() {} + + +void EntryWindow::onSignUpButtonClicked() {} + +std::shared_ptr EntryWindow::getSignUpDialog() {} + +std::shared_ptr EntryWindow::getAuthDialog() {} diff --git a/client/internal/gui/src/SignUpDialog.cpp b/client/internal/gui/src/SignUpDialog.cpp new file mode 100644 index 0000000..8750c80 --- /dev/null +++ b/client/internal/gui/src/SignUpDialog.cpp @@ -0,0 +1,17 @@ +#include "SignUpDialog.h" + +#include +#include +#include + +//#include "Core.h" + +SignUpDialog::SignUpDialog(QWidget *parent) : QDialog(parent) {} + +SignUpDialog::~SignUpDialog() {} + +void SignUpDialog::retranslateUi(QDialog *SignUpDialog) {} + +void SignUpDialog::setupUi(QDialog *SignUpDialog) {} + +// setupUi diff --git a/client/internal/gui/src/UIManager.cpp b/client/internal/gui/src/UIManager.cpp new file mode 100644 index 0000000..fc23301 --- /dev/null +++ b/client/internal/gui/src/UIManager.cpp @@ -0,0 +1,11 @@ +#include "UIManager.h" + +#include "EntryWindow.h" +#include "UserWindow.h" +#include "SignUpDialog.h" + +void UIManager::showEntryWindow() {} + +void UIManager::showUserWindow() {} + +UIManager::UIManager() = default; diff --git a/client/internal/gui/src/UserWindow.cpp b/client/internal/gui/src/UserWindow.cpp new file mode 100644 index 0000000..8e6169b --- /dev/null +++ b/client/internal/gui/src/UserWindow.cpp @@ -0,0 +1,9 @@ +#include "UserWindow.h" + +#include +#include +#include + +UserWindow::UserWindow(QWidget *parent) : QMainWindow(parent) {} + +void UserWindow::onBackButtonClicked() {} diff --git a/client/internal/gui/tests/CMakeLists.txt b/client/internal/gui/tests/CMakeLists.txt new file mode 100644 index 0000000..5877dc8 --- /dev/null +++ b/client/internal/gui/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +project(test_gui) + +set(CMAKE_CXX_STANDARD 20) +add_compile_options(-coverage) + +file(GLOB SOURCES *.cpp) + +enable_testing() +find_package(GTest REQUIRED) + +add_executable(${PROJECT_NAME} ${SOURCES}) + +target_link_libraries(${PROJECT_NAME} ${GUI_lib_LIB} GTest::GTest GTest::gmock) +target_include_directories(${PROJECT_NAME} PUBLIC ${GUI_lib_INCLUDE_DIRS}) + +add_test(test_gui test_gui) \ No newline at end of file diff --git a/client/internal/gui/tests/main.cpp b/client/internal/gui/tests/main.cpp new file mode 100644 index 0000000..d9f4b73 --- /dev/null +++ b/client/internal/gui/tests/main.cpp @@ -0,0 +1,52 @@ +#include +#include + +#include "UIManager.h" +#include "EntryWindow.h" +#include "UserWindow.h" + +#include + +TEST(ConstructorTest, EntryWindow) { + int fake = 0; + QApplication a(fake, nullptr); + EntryWindow mw; + EXPECT_NO_FATAL_FAILURE(mw.show()); + a.exec(); +} + +TEST(ConstructorTest, UserWindow) { + int fake = 0; + QApplication a(fake, nullptr); + UserWindow uw; + EXPECT_NO_FATAL_FAILURE(uw.show()); + a.exec(); +} + +TEST(ConstructorTest, UIManagerMW) { + int fake_argc = 0; + QApplication a(fake_argc, nullptr); + UIManager um; + EXPECT_NO_FATAL_FAILURE(um.showEntryWindow()); + a.exec(); +} + +TEST(ConstructorTest, UIManagerUW) { + int fake_argc = 0; + QApplication a(fake_argc, nullptr); + UIManager um; + EXPECT_NO_FATAL_FAILURE(um.showUserWindow()); + a.exec(); +} + +TEST(ConstructorTest, MainWindow_AuthDialog) { + int fake_argc = 0; + QApplication a(fake_argc, nullptr); + EntryWindow mainWindow; + EXPECT_NO_FATAL_FAILURE(mainWindow.getAuthDialog()->show()); +} + +int main(int argc, char *argv[]) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} -- GitLab From 27a37642f0cf18cacb12d1241b79eb67b289f403 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 4 May 2023 10:23:45 +0300 Subject: [PATCH 039/134] add all for tests, add tests for Liv. and Jaccard --- CMakeLists.txt | 8 +- metrics/CMakeLists.txt | 6 +- metrics/source/TextMetricImpl.cpp | 5 +- metrics/testProgs/code2.txt | 29 ------- metrics/tests/CMakeLists.txt | 5 ++ metrics/tests/src/test-codes/code1.txt | 29 +++++++ metrics/tests/src/text_metrics_tests.cpp | 99 ++++++++++++++++++++++++ 7 files changed, 149 insertions(+), 32 deletions(-) create mode 100644 metrics/tests/CMakeLists.txt create mode 100644 metrics/tests/src/test-codes/code1.txt create mode 100644 metrics/tests/src/text_metrics_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bd3583..b959d11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,18 @@ project(SourcedOut CXX) # find_package(antlr4-runtime REQUIRED) find_package(Boost 1.8.1 REQUIRED) # find_package(libpqxx REQUIRED) -find_package(GTest REQUIRED) + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) message(STATUS ${Boost_LIBRARIES}) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") +option(BUILD_TESTS "build tests") +#if(BUILD_TESTS) +enable_testing() +find_package(GTest REQUIRED) +#endif() + add_subdirectory(metrics) add_executable(${PROJECT_NAME} src/main.cpp) diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt index 5ab0e06..23c2536 100644 --- a/metrics/CMakeLists.txt +++ b/metrics/CMakeLists.txt @@ -1,4 +1,8 @@ add_library(MetricsLib source/TextMetricImpl.cpp) target_include_directories(MetricsLib PUBLIC metrics_headers) -target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) \ No newline at end of file +target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) + +#if(BUILD_TESTS) +add_subdirectory(tests) +#endif() \ No newline at end of file diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index 6f9eba6..f9c595b 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -93,7 +93,10 @@ void LivDistTextMetric::countMetric(){ } } - metric_res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); + if (n == 0 || m == 0) + metric_res = 0; + else + metric_res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); } diff --git a/metrics/testProgs/code2.txt b/metrics/testProgs/code2.txt index 2115b76..e69de29 100644 --- a/metrics/testProgs/code2.txt +++ b/metrics/testProgs/code2.txt @@ -1,29 +0,0 @@ -// однострочный комментарий -// еще один -// вау еще один - -#include -#include -#include - -using namespace std; - -/* многострочный комм - * // внутри него однострочный - * - */ - - -int main() { - stringstream ss1; - string res1; - // ещё в код напихаю комментов - ss1 << "a bwfw ce "; - while(getline(ss, res1, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res1 << endl; /* многострочный однострочно */ - } -} \ No newline at end of file diff --git a/metrics/tests/CMakeLists.txt b/metrics/tests/CMakeLists.txt new file mode 100644 index 0000000..1bdfef1 --- /dev/null +++ b/metrics/tests/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(metrics_test src/text_metrics_tests.cpp) + +target_link_libraries(metrics_test MetricsLib GTest::gtest_main GTest::gmock) + +add_test(metrics_test metrics_test) \ No newline at end of file diff --git a/metrics/tests/src/test-codes/code1.txt b/metrics/tests/src/test-codes/code1.txt new file mode 100644 index 0000000..5fa95b8 --- /dev/null +++ b/metrics/tests/src/test-codes/code1.txt @@ -0,0 +1,29 @@ +// однострочный комментарий +// еще один +// вау еще один + +#include +#include +#include + +using namespace std; + +/* многострочный комм + * // внутри него однострочный + * + */ + + +int main() { + stringstream ss; + string res; + // ещё в код напихаю комментов + ss << "a bwfw ce "; + while(getline(ss, res, ' ')){ //комментарий после строки с кодом + /* + * летс гоу + * худшее место для многострочного коммента + */ + cout << res << endl; /* многострочный однострочно */ + } +} diff --git a/metrics/tests/src/text_metrics_tests.cpp b/metrics/tests/src/text_metrics_tests.cpp new file mode 100644 index 0000000..5cbb0cd --- /dev/null +++ b/metrics/tests/src/text_metrics_tests.cpp @@ -0,0 +1,99 @@ +// +// Created by march on 04.05.2023. +// + +#include +#include + +#include +#include + +#include "TextMetricsLib.h" + +class LivDistTextMetricTest : public ::testing::Test { +protected: + std::unique_ptr livDistTextMetric; + void SetUp(){ + livDistTextMetric = std::make_unique (); + } + void TearDown(){} +}; + +class JaccardTextMetricTest : public ::testing::Test { +protected: + std::unique_ptr jaccardTextMetric; + void SetUp(){ + jaccardTextMetric = std::make_unique (); + } + void TearDown(){} +}; + + + +TEST_F(LivDistTextMetricTest, check_eq_progs) { + std::ifstream fin1; + fin1.open("src/test-codes/code1.txt"); + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + fin1.close(); + livDistTextMetric->setData(text1, text1); + livDistTextMetric->countMetric(); + + EXPECT_EQ(livDistTextMetric->getMetric(), 1); +} + +TEST_F(LivDistTextMetricTest, check_absolutely_not_eq_progs) { + + livDistTextMetric->setData("a b c", "d e f g"); + livDistTextMetric->countMetric(); + + EXPECT_EQ(livDistTextMetric->getMetric() < 0.5, true); +} + +TEST_F(LivDistTextMetricTest, test_with_empty_prog) { + + livDistTextMetric->setData("a b c", ""); + livDistTextMetric->countMetric(); + + EXPECT_EQ(livDistTextMetric->getMetric(), 0); +} + +TEST_F(JaccardTextMetricTest, check_eq_progs){ + std::ifstream fin1; + fin1.open("src/test-codes/code1.txt"); + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + fin1.close(); + jaccardTextMetric->setData(text1, text1); + jaccardTextMetric->countMetric(); + + EXPECT_EQ(jaccardTextMetric->getMetric(), 1); +} + +TEST_F(JaccardTextMetricTest, check_absolutely_not_eq_progs) { + + jaccardTextMetric->setData("a b c", "d e f g"); + jaccardTextMetric->countMetric(); + + EXPECT_EQ(jaccardTextMetric->getMetric(), 0); +} + +TEST_F(JaccardTextMetricTest, test_with_empty_prog) { + + jaccardTextMetric->setData("a b c", ""); + jaccardTextMetric->countMetric(); + + EXPECT_EQ(jaccardTextMetric->getMetric(), 0); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} + -- GitLab From fc959658e59c8d10ea083322385201619bc44fcd Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 4 May 2023 10:58:38 +0300 Subject: [PATCH 040/134] udpade gitignore, delete cmake-build-debug --- .gitignore | 1 + metrics/cmake-build-debug/CMakeCache.txt | 419 --------- .../CMakeFiles/3.22.1/CMakeCCompiler.cmake | 72 -- .../CMakeFiles/3.22.1/CMakeCXXCompiler.cmake | 83 -- .../3.22.1/CMakeDetermineCompilerABI_C.bin | Bin 15968 -> 0 bytes .../3.22.1/CMakeDetermineCompilerABI_CXX.bin | Bin 15992 -> 0 bytes .../CMakeFiles/3.22.1/CMakeSystem.cmake | 15 - .../3.22.1/CompilerIdC/CMakeCCompilerId.c | 803 ------------------ .../CMakeFiles/3.22.1/CompilerIdC/a.out | Bin 16088 -> 0 bytes .../CompilerIdCXX/CMakeCXXCompilerId.cpp | 791 ----------------- .../CMakeFiles/3.22.1/CompilerIdCXX/a.out | Bin 16096 -> 0 bytes .../CMakeFiles/CMakeOutput.log | 451 ---------- .../CMakeFiles/clion-environment.txt | 3 - .../CMakeFiles/clion-log.txt | 62 -- .../CMakeFiles/cmake.check_cache | 1 - 15 files changed, 1 insertion(+), 2700 deletions(-) delete mode 100644 metrics/cmake-build-debug/CMakeCache.txt delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp delete mode 100644 metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out delete mode 100644 metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log delete mode 100644 metrics/cmake-build-debug/CMakeFiles/clion-environment.txt delete mode 100644 metrics/cmake-build-debug/CMakeFiles/clion-log.txt delete mode 100644 metrics/cmake-build-debug/CMakeFiles/cmake.check_cache diff --git a/.gitignore b/.gitignore index 870ca9c..392e7cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vscode .idea CMakeUserPresets.json +/metrics/cmake-build-debug" diff --git a/metrics/cmake-build-debug/CMakeCache.txt b/metrics/cmake-build-debug/CMakeCache.txt deleted file mode 100644 index 071bbc0..0000000 --- a/metrics/cmake-build-debug/CMakeCache.txt +++ /dev/null @@ -1,419 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//The directory containing a CMake configuration file for Boost. -Boost_DIR:PATH=Boost_DIR-NOTFOUND - -//Path to a file. -Boost_INCLUDE_DIR:PATH=Boost_INCLUDE_DIR-NOTFOUND - -//Path to a program. -CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line - -//Path to a program. -CMAKE_AR:FILEPATH=/usr/bin/ar - -//For backwards compatibility, what version of CMake commands and -// syntax should this version of CMake try to support. -CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4 - -//Choose the type of build, options are: None Debug Release RelWithDebInfo -// MinSizeRel ... -CMAKE_BUILD_TYPE:STRING=Debug - -//Id string of the compiler for the CodeBlocks IDE. Automatically -// detected when left empty -CMAKE_CODEBLOCKS_COMPILER_ID:STRING= - -//The CodeBlocks executable -CMAKE_CODEBLOCKS_EXECUTABLE:FILEPATH=CMAKE_CODEBLOCKS_EXECUTABLE-NOTFOUND - -//Additional command line arguments when CodeBlocks invokes make. -// Enter e.g. -j to get parallel builds -CMAKE_CODEBLOCKS_MAKE_ARGUMENTS:STRING=-j12 - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 - -//Flags used by the CXX compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the CXX compiler during DEBUG builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the CXX compiler during MINSIZEREL builds. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the CXX compiler during RELEASE builds. -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the CXX compiler during RELWITHDEBINFO builds. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//C compiler -CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc - -//A wrapper around 'ar' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-11 - -//A wrapper around 'ranlib' adding the appropriate '--plugin' option -// for the GCC compiler -CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-11 - -//Flags used by the C compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the C compiler during DEBUG builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the C compiler during MINSIZEREL builds. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the C compiler during RELEASE builds. -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the C compiler during RELWITHDEBINFO builds. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG - -//No help, variable specified on the command line. -CMAKE_DEPENDS_USE_COMPILER:UNINITIALIZED=FALSE - -//Path to a program. -CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND - -//Flags used by the linker during all build types. -CMAKE_EXE_LINKER_FLAGS:STRING= - -//Flags used by the linker during DEBUG builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during MINSIZEREL builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during RELEASE builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during RELWITHDEBINFO builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Path to a program. -CMAKE_LINKER:FILEPATH=/usr/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake - -//Flags used by the linker during the creation of modules during -// all build types. -CMAKE_MODULE_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of modules during -// DEBUG builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of modules during -// MINSIZEREL builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of modules during -// RELEASE builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of modules during -// RELWITHDEBINFO builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/usr/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump - -//Value Computed by CMake -CMAKE_PROJECT_DESCRIPTION:STATIC= - -//Value Computed by CMake -CMAKE_PROJECT_HOMEPAGE_URL:STATIC= - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=Project - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib - -//Path to a program. -CMAKE_READELF:FILEPATH=/usr/bin/readelf - -//Flags used by the linker during the creation of shared libraries -// during all build types. -CMAKE_SHARED_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of shared libraries -// during DEBUG builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of shared libraries -// during MINSIZEREL builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of shared libraries -// during RELEASE builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of shared libraries -// during RELWITHDEBINFO builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Flags used by the linker during the creation of static libraries -// during all build types. -CMAKE_STATIC_LINKER_FLAGS:STRING= - -//Flags used by the linker during the creation of static libraries -// during DEBUG builds. -CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during the creation of static libraries -// during MINSIZEREL builds. -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during the creation of static libraries -// during RELEASE builds. -CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during the creation of static libraries -// during RELWITHDEBINFO builds. -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_STRIP:FILEPATH=/usr/bin/strip - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Single output directory for building all executables. -EXECUTABLE_OUTPUT_PATH:PATH= - -//Single output directory for building all libraries. -LIBRARY_OUTPUT_PATH:PATH= - -//Path to a program. -ProcessorCount_cmd_nproc:FILEPATH=/usr/bin/nproc - -//Path to a program. -ProcessorCount_cmd_sysctl:FILEPATH=/usr/sbin/sysctl - -//Value Computed by CMake -Project_BINARY_DIR:STATIC=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug - -//Value Computed by CMake -Project_IS_TOP_LEVEL:STATIC=ON - -//Value Computed by CMake -Project_SOURCE_DIR:STATIC=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics - - -######################## -# INTERNAL cache entries -######################## - -//ADVANCED property for variable: Boost_DIR -Boost_DIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_ADDR2LINE -CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=22 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=1 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR -CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB -CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_AR -CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB -CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_DLLTOOL -CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of external makefile project generator. -CMAKE_EXTRA_GENERATOR:INTERNAL=CodeBlocks -//CXX compiler system defined macros -CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS:INTERNAL=__STDC__;1;__STDC_VERSION__;201710L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_MIN__;((double)2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;((double)2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;((double)4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L;__STDC__;1;__cplusplus;201703L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__GNUG__;11;__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_WEAK__;1;__DEPRECATED;1;__GXX_RTTI;1;__cpp_rtti;199711L;__GXX_EXPERIMENTAL_CXX0X__;1;__cpp_binary_literals;201304L;__cpp_hex_float;201603L;__cpp_runtime_arrays;198712L;__cpp_raw_strings;200710L;__cpp_unicode_literals;200710L;__cpp_user_defined_literals;200809L;__cpp_lambdas;200907L;__cpp_decltype;200707L;__cpp_attributes;200809L;__cpp_rvalue_reference;200610L;__cpp_rvalue_references;200610L;__cpp_variadic_templates;200704L;__cpp_initializer_lists;200806L;__cpp_delegating_constructors;200604L;__cpp_nsdmi;200809L;__cpp_inheriting_constructors;201511L;__cpp_ref_qualifiers;200710L;__cpp_alias_templates;200704L;__cpp_return_type_deduction;201304L;__cpp_init_captures;201304L;__cpp_generic_lambdas;201304L;__cpp_decltype_auto;201304L;__cpp_aggregate_nsdmi;201304L;__cpp_variable_templates;201304L;__cpp_digit_separators;201309L;__cpp_unicode_characters;201411L;__cpp_static_assert;201411L;__cpp_namespace_attributes;201411L;__cpp_enumerator_attributes;201411L;__cpp_nested_namespace_definitions;201411L;__cpp_fold_expressions;201603L;__cpp_nontype_template_args;201411L;__cpp_range_based_for;201603L;__cpp_constexpr;201603L;__cpp_if_constexpr;201606L;__cpp_capture_star_this;201603L;__cpp_inline_variables;201606L;__cpp_aggregate_bases;201603L;__cpp_deduction_guides;201703L;__cpp_noexcept_function_type;201510L;__cpp_template_auto;201606L;__cpp_structured_bindings;201606L;__cpp_variadic_using;201611L;__cpp_guaranteed_copy_elision;201606L;__cpp_nontype_template_parameter_auto;201606L;__cpp_sized_deallocation;201309L;__cpp_aligned_new;201606L;__STDCPP_DEFAULT_NEW_ALIGNMENT__;16;__cpp_template_template_args;201611L;__cpp_threadsafe_static_init;200806L;__STDCPP_THREADS__;1;__EXCEPTIONS;1;__cpp_exceptions;199711L;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__GLIBCXX_TYPE_INT_N_0;__int128;__GLIBCXX_BITSIZE_INT_N_0;128;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;double(1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;double(1.79769313486231570814527423731704357e+308L);__DBL_MIN__;double(2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;double(2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;double(4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_GNU_SOURCE;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L -//CXX compiler system include directories -CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS:INTERNAL=/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include -//C compiler system defined macros -CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS:INTERNAL=__STDC__;1;__STDC_VERSION__;201710L;__STDC_UTF_16__;1;__STDC_UTF_32__;1;__STDC_HOSTED__;1;__GNUC__;11;__GNUC_MINOR__;3;__GNUC_PATCHLEVEL__;0;__VERSION__;"11.3.0";__ATOMIC_RELAXED;0;__ATOMIC_SEQ_CST;5;__ATOMIC_ACQUIRE;2;__ATOMIC_RELEASE;3;__ATOMIC_ACQ_REL;4;__ATOMIC_CONSUME;1;__pic__;2;__PIC__;2;__pie__;2;__PIE__;2;__FINITE_MATH_ONLY__;0;_LP64;1;__LP64__;1;__SIZEOF_INT__;4;__SIZEOF_LONG__;8;__SIZEOF_LONG_LONG__;8;__SIZEOF_SHORT__;2;__SIZEOF_FLOAT__;4;__SIZEOF_DOUBLE__;8;__SIZEOF_LONG_DOUBLE__;16;__SIZEOF_SIZE_T__;8;__CHAR_BIT__;8;__BIGGEST_ALIGNMENT__;16;__ORDER_LITTLE_ENDIAN__;1234;__ORDER_BIG_ENDIAN__;4321;__ORDER_PDP_ENDIAN__;3412;__BYTE_ORDER__;__ORDER_LITTLE_ENDIAN__;__FLOAT_WORD_ORDER__;__ORDER_LITTLE_ENDIAN__;__SIZEOF_POINTER__;8;__GNUC_EXECUTION_CHARSET_NAME;"UTF-8";__GNUC_WIDE_EXECUTION_CHARSET_NAME;"UTF-32LE";__SIZE_TYPE__;long unsigned int;__PTRDIFF_TYPE__;long int;__WCHAR_TYPE__;int;__WINT_TYPE__;unsigned int;__INTMAX_TYPE__;long int;__UINTMAX_TYPE__;long unsigned int;__CHAR16_TYPE__;short unsigned int;__CHAR32_TYPE__;unsigned int;__SIG_ATOMIC_TYPE__;int;__INT8_TYPE__;signed char;__INT16_TYPE__;short int;__INT32_TYPE__;int;__INT64_TYPE__;long int;__UINT8_TYPE__;unsigned char;__UINT16_TYPE__;short unsigned int;__UINT32_TYPE__;unsigned int;__UINT64_TYPE__;long unsigned int;__INT_LEAST8_TYPE__;signed char;__INT_LEAST16_TYPE__;short int;__INT_LEAST32_TYPE__;int;__INT_LEAST64_TYPE__;long int;__UINT_LEAST8_TYPE__;unsigned char;__UINT_LEAST16_TYPE__;short unsigned int;__UINT_LEAST32_TYPE__;unsigned int;__UINT_LEAST64_TYPE__;long unsigned int;__INT_FAST8_TYPE__;signed char;__INT_FAST16_TYPE__;long int;__INT_FAST32_TYPE__;long int;__INT_FAST64_TYPE__;long int;__UINT_FAST8_TYPE__;unsigned char;__UINT_FAST16_TYPE__;long unsigned int;__UINT_FAST32_TYPE__;long unsigned int;__UINT_FAST64_TYPE__;long unsigned int;__INTPTR_TYPE__;long int;__UINTPTR_TYPE__;long unsigned int;__GXX_ABI_VERSION;1016;__SCHAR_MAX__;0x7f;__SHRT_MAX__;0x7fff;__INT_MAX__;0x7fffffff;__LONG_MAX__;0x7fffffffffffffffL;__LONG_LONG_MAX__;0x7fffffffffffffffLL;__WCHAR_MAX__;0x7fffffff;__WCHAR_MIN__;(-__WCHAR_MAX__ - 1);__WINT_MAX__;0xffffffffU;__WINT_MIN__;0U;__PTRDIFF_MAX__;0x7fffffffffffffffL;__SIZE_MAX__;0xffffffffffffffffUL;__SCHAR_WIDTH__;8;__SHRT_WIDTH__;16;__INT_WIDTH__;32;__LONG_WIDTH__;64;__LONG_LONG_WIDTH__;64;__WCHAR_WIDTH__;32;__WINT_WIDTH__;32;__PTRDIFF_WIDTH__;64;__SIZE_WIDTH__;64;__INTMAX_MAX__;0x7fffffffffffffffL;__INTMAX_C(c);c ## L;__UINTMAX_MAX__;0xffffffffffffffffUL;__UINTMAX_C(c);c ## UL;__INTMAX_WIDTH__;64;__SIG_ATOMIC_MAX__;0x7fffffff;__SIG_ATOMIC_MIN__;(-__SIG_ATOMIC_MAX__ - 1);__SIG_ATOMIC_WIDTH__;32;__INT8_MAX__;0x7f;__INT16_MAX__;0x7fff;__INT32_MAX__;0x7fffffff;__INT64_MAX__;0x7fffffffffffffffL;__UINT8_MAX__;0xff;__UINT16_MAX__;0xffff;__UINT32_MAX__;0xffffffffU;__UINT64_MAX__;0xffffffffffffffffUL;__INT_LEAST8_MAX__;0x7f;__INT8_C(c);c;__INT_LEAST8_WIDTH__;8;__INT_LEAST16_MAX__;0x7fff;__INT16_C(c);c;__INT_LEAST16_WIDTH__;16;__INT_LEAST32_MAX__;0x7fffffff;__INT32_C(c);c;__INT_LEAST32_WIDTH__;32;__INT_LEAST64_MAX__;0x7fffffffffffffffL;__INT64_C(c);c ## L;__INT_LEAST64_WIDTH__;64;__UINT_LEAST8_MAX__;0xff;__UINT8_C(c);c;__UINT_LEAST16_MAX__;0xffff;__UINT16_C(c);c;__UINT_LEAST32_MAX__;0xffffffffU;__UINT32_C(c);c ## U;__UINT_LEAST64_MAX__;0xffffffffffffffffUL;__UINT64_C(c);c ## UL;__INT_FAST8_MAX__;0x7f;__INT_FAST8_WIDTH__;8;__INT_FAST16_MAX__;0x7fffffffffffffffL;__INT_FAST16_WIDTH__;64;__INT_FAST32_MAX__;0x7fffffffffffffffL;__INT_FAST32_WIDTH__;64;__INT_FAST64_MAX__;0x7fffffffffffffffL;__INT_FAST64_WIDTH__;64;__UINT_FAST8_MAX__;0xff;__UINT_FAST16_MAX__;0xffffffffffffffffUL;__UINT_FAST32_MAX__;0xffffffffffffffffUL;__UINT_FAST64_MAX__;0xffffffffffffffffUL;__INTPTR_MAX__;0x7fffffffffffffffL;__INTPTR_WIDTH__;64;__UINTPTR_MAX__;0xffffffffffffffffUL;__GCC_IEC_559;2;__GCC_IEC_559_COMPLEX;2;__FLT_EVAL_METHOD__;0;__FLT_EVAL_METHOD_TS_18661_3__;0;__DEC_EVAL_METHOD__;2;__FLT_RADIX__;2;__FLT_MANT_DIG__;24;__FLT_DIG__;6;__FLT_MIN_EXP__;(-125);__FLT_MIN_10_EXP__;(-37);__FLT_MAX_EXP__;128;__FLT_MAX_10_EXP__;38;__FLT_DECIMAL_DIG__;9;__FLT_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_NORM_MAX__;3.40282346638528859811704183484516925e+38F;__FLT_MIN__;1.17549435082228750796873653722224568e-38F;__FLT_EPSILON__;1.19209289550781250000000000000000000e-7F;__FLT_DENORM_MIN__;1.40129846432481707092372958328991613e-45F;__FLT_HAS_DENORM__;1;__FLT_HAS_INFINITY__;1;__FLT_HAS_QUIET_NAN__;1;__FLT_IS_IEC_60559__;2;__DBL_MANT_DIG__;53;__DBL_DIG__;15;__DBL_MIN_EXP__;(-1021);__DBL_MIN_10_EXP__;(-307);__DBL_MAX_EXP__;1024;__DBL_MAX_10_EXP__;308;__DBL_DECIMAL_DIG__;17;__DBL_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_NORM_MAX__;((double)1.79769313486231570814527423731704357e+308L);__DBL_MIN__;((double)2.22507385850720138309023271733240406e-308L);__DBL_EPSILON__;((double)2.22044604925031308084726333618164062e-16L);__DBL_DENORM_MIN__;((double)4.94065645841246544176568792868221372e-324L);__DBL_HAS_DENORM__;1;__DBL_HAS_INFINITY__;1;__DBL_HAS_QUIET_NAN__;1;__DBL_IS_IEC_60559__;2;__LDBL_MANT_DIG__;64;__LDBL_DIG__;18;__LDBL_MIN_EXP__;(-16381);__LDBL_MIN_10_EXP__;(-4931);__LDBL_MAX_EXP__;16384;__LDBL_MAX_10_EXP__;4932;__DECIMAL_DIG__;21;__LDBL_DECIMAL_DIG__;21;__LDBL_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_NORM_MAX__;1.18973149535723176502126385303097021e+4932L;__LDBL_MIN__;3.36210314311209350626267781732175260e-4932L;__LDBL_EPSILON__;1.08420217248550443400745280086994171e-19L;__LDBL_DENORM_MIN__;3.64519953188247460252840593361941982e-4951L;__LDBL_HAS_DENORM__;1;__LDBL_HAS_INFINITY__;1;__LDBL_HAS_QUIET_NAN__;1;__LDBL_IS_IEC_60559__;2;__FLT32_MANT_DIG__;24;__FLT32_DIG__;6;__FLT32_MIN_EXP__;(-125);__FLT32_MIN_10_EXP__;(-37);__FLT32_MAX_EXP__;128;__FLT32_MAX_10_EXP__;38;__FLT32_DECIMAL_DIG__;9;__FLT32_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_NORM_MAX__;3.40282346638528859811704183484516925e+38F32;__FLT32_MIN__;1.17549435082228750796873653722224568e-38F32;__FLT32_EPSILON__;1.19209289550781250000000000000000000e-7F32;__FLT32_DENORM_MIN__;1.40129846432481707092372958328991613e-45F32;__FLT32_HAS_DENORM__;1;__FLT32_HAS_INFINITY__;1;__FLT32_HAS_QUIET_NAN__;1;__FLT32_IS_IEC_60559__;2;__FLT64_MANT_DIG__;53;__FLT64_DIG__;15;__FLT64_MIN_EXP__;(-1021);__FLT64_MIN_10_EXP__;(-307);__FLT64_MAX_EXP__;1024;__FLT64_MAX_10_EXP__;308;__FLT64_DECIMAL_DIG__;17;__FLT64_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_NORM_MAX__;1.79769313486231570814527423731704357e+308F64;__FLT64_MIN__;2.22507385850720138309023271733240406e-308F64;__FLT64_EPSILON__;2.22044604925031308084726333618164062e-16F64;__FLT64_DENORM_MIN__;4.94065645841246544176568792868221372e-324F64;__FLT64_HAS_DENORM__;1;__FLT64_HAS_INFINITY__;1;__FLT64_HAS_QUIET_NAN__;1;__FLT64_IS_IEC_60559__;2;__FLT128_MANT_DIG__;113;__FLT128_DIG__;33;__FLT128_MIN_EXP__;(-16381);__FLT128_MIN_10_EXP__;(-4931);__FLT128_MAX_EXP__;16384;__FLT128_MAX_10_EXP__;4932;__FLT128_DECIMAL_DIG__;36;__FLT128_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_NORM_MAX__;1.18973149535723176508575932662800702e+4932F128;__FLT128_MIN__;3.36210314311209350626267781732175260e-4932F128;__FLT128_EPSILON__;1.92592994438723585305597794258492732e-34F128;__FLT128_DENORM_MIN__;6.47517511943802511092443895822764655e-4966F128;__FLT128_HAS_DENORM__;1;__FLT128_HAS_INFINITY__;1;__FLT128_HAS_QUIET_NAN__;1;__FLT128_IS_IEC_60559__;2;__FLT32X_MANT_DIG__;53;__FLT32X_DIG__;15;__FLT32X_MIN_EXP__;(-1021);__FLT32X_MIN_10_EXP__;(-307);__FLT32X_MAX_EXP__;1024;__FLT32X_MAX_10_EXP__;308;__FLT32X_DECIMAL_DIG__;17;__FLT32X_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_NORM_MAX__;1.79769313486231570814527423731704357e+308F32x;__FLT32X_MIN__;2.22507385850720138309023271733240406e-308F32x;__FLT32X_EPSILON__;2.22044604925031308084726333618164062e-16F32x;__FLT32X_DENORM_MIN__;4.94065645841246544176568792868221372e-324F32x;__FLT32X_HAS_DENORM__;1;__FLT32X_HAS_INFINITY__;1;__FLT32X_HAS_QUIET_NAN__;1;__FLT32X_IS_IEC_60559__;2;__FLT64X_MANT_DIG__;64;__FLT64X_DIG__;18;__FLT64X_MIN_EXP__;(-16381);__FLT64X_MIN_10_EXP__;(-4931);__FLT64X_MAX_EXP__;16384;__FLT64X_MAX_10_EXP__;4932;__FLT64X_DECIMAL_DIG__;21;__FLT64X_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_NORM_MAX__;1.18973149535723176502126385303097021e+4932F64x;__FLT64X_MIN__;3.36210314311209350626267781732175260e-4932F64x;__FLT64X_EPSILON__;1.08420217248550443400745280086994171e-19F64x;__FLT64X_DENORM_MIN__;3.64519953188247460252840593361941982e-4951F64x;__FLT64X_HAS_DENORM__;1;__FLT64X_HAS_INFINITY__;1;__FLT64X_HAS_QUIET_NAN__;1;__FLT64X_IS_IEC_60559__;2;__DEC32_MANT_DIG__;7;__DEC32_MIN_EXP__;(-94);__DEC32_MAX_EXP__;97;__DEC32_MIN__;1E-95DF;__DEC32_MAX__;9.999999E96DF;__DEC32_EPSILON__;1E-6DF;__DEC32_SUBNORMAL_MIN__;0.000001E-95DF;__DEC64_MANT_DIG__;16;__DEC64_MIN_EXP__;(-382);__DEC64_MAX_EXP__;385;__DEC64_MIN__;1E-383DD;__DEC64_MAX__;9.999999999999999E384DD;__DEC64_EPSILON__;1E-15DD;__DEC64_SUBNORMAL_MIN__;0.000000000000001E-383DD;__DEC128_MANT_DIG__;34;__DEC128_MIN_EXP__;(-6142);__DEC128_MAX_EXP__;6145;__DEC128_MIN__;1E-6143DL;__DEC128_MAX__;9.999999999999999999999999999999999E6144DL;__DEC128_EPSILON__;1E-33DL;__DEC128_SUBNORMAL_MIN__;0.000000000000000000000000000000001E-6143DL;__REGISTER_PREFIX__; ;__USER_LABEL_PREFIX__; ;__GNUC_STDC_INLINE__;1;__NO_INLINE__;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;1;__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8;1;__GCC_ATOMIC_BOOL_LOCK_FREE;2;__GCC_ATOMIC_CHAR_LOCK_FREE;2;__GCC_ATOMIC_CHAR16_T_LOCK_FREE;2;__GCC_ATOMIC_CHAR32_T_LOCK_FREE;2;__GCC_ATOMIC_WCHAR_T_LOCK_FREE;2;__GCC_ATOMIC_SHORT_LOCK_FREE;2;__GCC_ATOMIC_INT_LOCK_FREE;2;__GCC_ATOMIC_LONG_LOCK_FREE;2;__GCC_ATOMIC_LLONG_LOCK_FREE;2;__GCC_ATOMIC_TEST_AND_SET_TRUEVAL;1;__GCC_ATOMIC_POINTER_LOCK_FREE;2;__HAVE_SPECULATION_SAFE_VALUE;1;__GCC_HAVE_DWARF2_CFI_ASM;1;__PRAGMA_REDEFINE_EXTNAME;1;__SSP_STRONG__;3;__SIZEOF_INT128__;16;__SIZEOF_WCHAR_T__;4;__SIZEOF_WINT_T__;4;__SIZEOF_PTRDIFF_T__;8;__amd64;1;__amd64__;1;__x86_64;1;__x86_64__;1;__SIZEOF_FLOAT80__;16;__SIZEOF_FLOAT128__;16;__ATOMIC_HLE_ACQUIRE;65536;__ATOMIC_HLE_RELEASE;131072;__GCC_ASM_FLAG_OUTPUTS__;1;__k8;1;__k8__;1;__code_model_small__;1;__MMX__;1;__SSE__;1;__SSE2__;1;__FXSR__;1;__SSE_MATH__;1;__SSE2_MATH__;1;__MMX_WITH_SSE__;1;__SEG_FS;1;__SEG_GS;1;__CET__;3;__gnu_linux__;1;__linux;1;__linux__;1;linux;1;__unix;1;__unix__;1;unix;1;__ELF__;1;__DECIMAL_BID_FORMAT__;1;_STDC_PREDEF_H;1;__STDC_IEC_559__;1;__STDC_IEC_60559_BFP__;201404L;__STDC_IEC_559_COMPLEX__;1;__STDC_IEC_60559_COMPLEX__;201404L;__STDC_ISO_10646__;201706L -//C compiler system include directories -CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS:INTERNAL=/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Generator instance identifier. -CMAKE_GENERATOR_INSTANCE:INTERNAL= -//Name of generator platform. -CMAKE_GENERATOR_PLATFORM:INTERNAL= -//Name of generator toolset. -CMAKE_GENERATOR_TOOLSET:INTERNAL= -//Source directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics -//Install .so files without execute permission. -CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//Platform information initialized -CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_READELF -CMAKE_READELF-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.22 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS -CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG -CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL -CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE -CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/usr/bin/uname -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: ProcessorCount_cmd_nproc -ProcessorCount_cmd_nproc-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: ProcessorCount_cmd_sysctl -ProcessorCount_cmd_sysctl-ADVANCED:INTERNAL=1 - diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake deleted file mode 100644 index 73373ba..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCCompiler.cmake +++ /dev/null @@ -1,72 +0,0 @@ -set(CMAKE_C_COMPILER "/usr/bin/cc") -set(CMAKE_C_COMPILER_ARG1 "") -set(CMAKE_C_COMPILER_ID "GNU") -set(CMAKE_C_COMPILER_VERSION "11.3.0") -set(CMAKE_C_COMPILER_VERSION_INTERNAL "") -set(CMAKE_C_COMPILER_WRAPPER "") -set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") -set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") -set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") -set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") -set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") -set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") -set(CMAKE_C17_COMPILE_FEATURES "c_std_17") -set(CMAKE_C23_COMPILE_FEATURES "c_std_23") - -set(CMAKE_C_PLATFORM_ID "Linux") -set(CMAKE_C_SIMULATE_ID "") -set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") -set(CMAKE_C_SIMULATE_VERSION "") - - - - -set(CMAKE_AR "/usr/bin/ar") -set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11") -set(CMAKE_RANLIB "/usr/bin/ranlib") -set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") -set(CMAKE_LINKER "/usr/bin/ld") -set(CMAKE_MT "") -set(CMAKE_COMPILER_IS_GNUCC 1) -set(CMAKE_C_COMPILER_LOADED 1) -set(CMAKE_C_COMPILER_WORKS TRUE) -set(CMAKE_C_ABI_COMPILED TRUE) - -set(CMAKE_C_COMPILER_ENV_VAR "CC") - -set(CMAKE_C_COMPILER_ID_RUN 1) -set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) -set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_C_LINKER_PREFERENCE 10) - -# Save compiler ABI information. -set(CMAKE_C_SIZEOF_DATA_PTR "8") -set(CMAKE_C_COMPILER_ABI "ELF") -set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") -set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") - -if(CMAKE_C_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_C_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") -endif() - -if(CMAKE_C_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") -endif() - -set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") -if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) - set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") -endif() - - - - - -set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") -set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") -set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") -set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake deleted file mode 100644 index 5cd1af7..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake +++ /dev/null @@ -1,83 +0,0 @@ -set(CMAKE_CXX_COMPILER "/usr/bin/c++") -set(CMAKE_CXX_COMPILER_ARG1 "") -set(CMAKE_CXX_COMPILER_ID "GNU") -set(CMAKE_CXX_COMPILER_VERSION "11.3.0") -set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") -set(CMAKE_CXX_COMPILER_WRAPPER "") -set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") -set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") -set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") -set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") -set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") -set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") -set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") -set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") -set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") - -set(CMAKE_CXX_PLATFORM_ID "Linux") -set(CMAKE_CXX_SIMULATE_ID "") -set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") -set(CMAKE_CXX_SIMULATE_VERSION "") - - - - -set(CMAKE_AR "/usr/bin/ar") -set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-11") -set(CMAKE_RANLIB "/usr/bin/ranlib") -set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11") -set(CMAKE_LINKER "/usr/bin/ld") -set(CMAKE_MT "") -set(CMAKE_COMPILER_IS_GNUCXX 1) -set(CMAKE_CXX_COMPILER_LOADED 1) -set(CMAKE_CXX_COMPILER_WORKS TRUE) -set(CMAKE_CXX_ABI_COMPILED TRUE) - -set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") - -set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) -set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) - -foreach (lang C OBJC OBJCXX) - if (CMAKE_${lang}_COMPILER_ID_RUN) - foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) - list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) - endforeach() - endif() -endforeach() - -set(CMAKE_CXX_LINKER_PREFERENCE 30) -set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) - -# Save compiler ABI information. -set(CMAKE_CXX_SIZEOF_DATA_PTR "8") -set(CMAKE_CXX_COMPILER_ABI "ELF") -set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") -set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") - -if(CMAKE_CXX_SIZEOF_DATA_PTR) - set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") -endif() - -if(CMAKE_CXX_COMPILER_ABI) - set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") -endif() - -if(CMAKE_CXX_LIBRARY_ARCHITECTURE) - set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") -endif() - -set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") -if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) - set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") -endif() - - - - - -set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") -set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") -set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") -set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin deleted file mode 100644 index 799c4bc62137ad2856b0f4508ffb22d789403995..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15968 zcmeHOYit}>6~4Q65{Eo?(1CD-;*r>r*D;RoE#3MwGeshtrKxvo@Iu7)khboeT z{3Lb2ob}cIG;{{i$d9?-4|6l!tn8<^&gL5BWj%5BLlOOiuI%A-C?Z~_{+M$< zF(8?p(f+~ugSW10n7O#@?#I5=JMs9Qrjsu;p$(23eb5F8 z8T&*V%*T;Cz8qO+*WZTNLfDqV)|Gtj;)fP?KmVQc4;?sT|2((2!XWq%;6pjW`DYUxr!Mln3SHGA9Mm+I;^+w?Ylv*7l|O?XIAn1RygZ`E)_zRJ1N;#{jAQd2LiX+%Zv}My0c=Cp z3oGYhYY(B}Y2sk-Nc+ucWKCC%scGYxKW;OgnW-}(&l+d0ddnfeEfk=ka&9EH7RJT? zINn2BQ7uZh?=}u^jbhW7ddXXC9Njt}gbPiTO65WZcF)dx74Ett`@naW|L^YuB?j6J zep4U4XiSyP{Wy6Ahj}!4(fF)!Y{heM-xYhRJ|6piIg-3W=yE*F7g2MnJ{mg})cmHF zX2l-@k*@4JT|GzDvw~fR6lNgIK$w9r17QZj41^g7GZ1DV%s`ldFau!*{`CytbDGzp z)IjfGhwpjQ-j*%<{PqK>!QOO-H)+~#!OrY;Q(flvfn=&@pi@XY>7SnTY_s6PBdxuC zsiC31q?sJ(Np%i@h16SVXD`$tphIL;-FxsEBR+FEeyLK~5Bvo1Bfy^oZUBE|x>7j- z90{MPB1P`sDIyc`$g0H)8jiz*AH-L~wjX@tv%H=K^2yOU!0-XqdcY;HG~Ts1;58Z>H+|GUyYE)trujSPLP)_4|0@VH`vuV*%226zPOrFkAOzDDA3l?CS6I{?Q@XRhC8`wof| ztn2QT_?rb^mu!C*;86irb>KXv0k2hmeh_etoqhaU62HD~{PTdgl;@LKif-ymEh ze8Hhvmhop}DE)%s3r*?hYfJoE#<{*;{b|5!)tR3s`(WNKk$tev{4(IwrRtdWOX2T4 z{w|-T*fs2Wt$G0pzv16D)3Zhe07b7fGNKQQYsKcKmota4+`Nb-T#Bd=up0zzYqqo$yz#4bQv|QJMKLzuiJ1It7D`%UTQZ6?ME`KAlWXb!rzYxu|Gm0hbj+MVom32HXYtPcc(L$%aJ3IU3zm6u9!{Y#P z?8SmPX5}+bRd4p(Inddk>IM{EyfBjnIT$@V0fGX2{KFDmxAzTpb@rKqy}i4VL*`It z7yOqg>-uNEj8GjYmiY_4IGOXTG;q&Ve2iO89$rTn z7ka+n+4^X{q>sCWaohDKeNejOz)Leuh9EeF%{bYl`IuE46MAMc4_zn@FEB{Whi$j$ z6!NnK6LhYfwa`K6I8}r`o>e=2v;Ymyo`AhPow{3)??LGH7|pP;4EVF8{MA%b9^8iD zR?ZoQ;oxf&I=mGjbeQ8gn7XsBpEoGr`Uoyn_>NN)eBX`NN2Hdv+(!O(*l-QQ{&T(8 zg|vcb0x{ zdHqgds_A9?{*MRz6Xd`=6F6bPcqaq?yzXJn_cvfB ziKiFKr=WpdaQ=lx8seWKkr}}(iXTAB@6YQc=J>43Pr?3ie)|2(nzCm8X}>eH`TR5d zD`?;vlJ7tGzK!394BE5I{5<%^eEz&no@oXUi0zbgO=kQOC~)p^|J8M*t~|Qhh XIQOfxxOT4XzYKp^fEEWF0;2dQots7{ diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin deleted file mode 100644 index 49a8a11254c388a5a45cf391b6970765b4c0d3c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15992 zcmeHOYit}>6~4Q65{Ee1Z5mUPq|HzolKSC54Xdc6xn53cYCQ6q0Li7s<%SPME1vnnQnCbr+3cR3dN;?H1p6zo={zXm=0G+7pXti z98Zi1e%dLXe%(aPu=evtiRahd#AA(ppzMFaN&PGR4G{0FBAXF@{dN}?thv9vz>{&I z`qxuD&HJdo#pWSO@n=op6K8q)KQVLN)pu(ASeTt96>PYmwSQ>JZ>Sb4{^2lsTPb6IoH zNTz{jrVPgbIx3eA#z-cYrM7gS_d_{lW%WYdOaUVcUwSg1XLoGAV&l7e6P;api`t@Y z6I^cH3P%uz^)&Za(I%dAR#g|Kga=5w$N!{P$Pfq&=t_eG&N&Cu^3 zL?DPj z5P={9K?MHaBk;$_J+Eq~Zq{g1OMbaU2<_pb6D~cgo%%t|C3)zjZI1)|htkF`fr@Mp z=nvL+rPVE@-TYEw^74nY$zN-yeltBV7;i2%|42Kt^BHKMRF?Y(fQVi~$#Ub+_9a1tFakp_QD`fp33+BB<8PHRv7ewX&tOqCXTTDv^! ztbqnLQUf)mYr~NZFfQifcu(%cYEjsHKs&WFj74qo1*cY<+PM^r8=Fd{(v1{+J-y^_ zaMc|;4BUDA7axF1Z0G>+CO>vln=D-WVf;1@b1HsQ`@D9h?#e2N&bO+gk?$2l@!N#1 z!NYtWYc5uYBNzQOzp7MI_d8!pw+~+`&rx|+u*?Q-hbLOOVLdhG*oT_h4}1Ol68$~N9nOSq+Bq|I$WCUI>*PZC-0}okmB&|b`hk%68x~g~LvtN8x zbN1y@=?Lg^pihH-60`>TvFTFj9B34Lriv0ewoin{qoH-R%WBTT10%%O!{-QaT&h$M+_(InQq$*?j4-~%Ax%vCFx<_DvCx0%=bf? zq53ztruYu&6{PD)*O6w$xqn5<@1t~ZF+dITIEqBzoLO$~9>Ur0uO)Z95GM)ElC4mC z@MKsX562NMO{HB;^?xCo$Hn9Pk7>>i|2G@tyvyBPT|1P91Ia?xDJad&YOC7R*j$ii z^MfrdYSY$D1iyBN7>{c4O3Ckq@eV=FCn+EbIot`ll0VKz81i$+Xg!jryuL6NxX(E58JIr9AX!2p2IPiL0NJ?aar}`Yqs<^2%??b{6KXKMQ!JeDhby-yff) zaC;8@{rToA09O_cM{ETA-U_(bKV&=2Y7R2R;clDm7$X9Jyi*t+R)@q~GP>?$^dU?~ z&tndHP9I6R+cw~)VAioG#IS8-Og&Y| zWF~;(v2^fs=DBw5F^-yD2M=~ZFIL*LJ315U(Ab#JKhWFUW@U$Sy60XbqAe~ucZX3= zS|gYeZy8xxzg@CC^=Zp-(x%6yU3x%NU~oPAI`+uBlRD(tTxf~eBLjz z9>Cy&;25#UeBS3-fZ-N|`Mm#R&HGJokwVR}Dei|7?){k0`#sh?e>{HnWBnlTaWBa> z?FZ%l~KT|1Iz9shI`y_eCFHAs%br zziof>;&C6pi3qG;kNZ7^S*~QU-y8U6#x3Y2q<>J@fV786RbZ) zCM&LH+uaw=@p-?*n%{q9e}Df!g$i%~Me2a{XPHQv=bz!{pn!WwzAoYYEWan|_h*~+ zb>K!keBM9LGy(|1ey%lVGyXDE;M(K<%lk;xWfbw?Kydw|FpuZ)tAL>k^LhVR+=AXh z#N_wf7xP)qK$VwYCN#Mm?uT1o9^11}K#cq6eOr|Het$X~ri&^75F__8&iu_~#4Rx2 ztIKQ8;~S#}zeWSY^BAwmc|834hu2{|b`M?LzzZmln6Gi}*R91pZ)JW1{$l~D^$~og F_&X6;L(KpH diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake deleted file mode 100644 index 42ff974..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CMakeSystem.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CMAKE_HOST_SYSTEM "Linux-5.15.90.1-microsoft-standard-WSL2") -set(CMAKE_HOST_SYSTEM_NAME "Linux") -set(CMAKE_HOST_SYSTEM_VERSION "5.15.90.1-microsoft-standard-WSL2") -set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") - - - -set(CMAKE_SYSTEM "Linux-5.15.90.1-microsoft-standard-WSL2") -set(CMAKE_SYSTEM_NAME "Linux") -set(CMAKE_SYSTEM_VERSION "5.15.90.1-microsoft-standard-WSL2") -set(CMAKE_SYSTEM_PROCESSOR "x86_64") - -set(CMAKE_CROSSCOMPILING "FALSE") - -set(CMAKE_SYSTEM_LOADED 1) diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c deleted file mode 100644 index 41b99d7..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c +++ /dev/null @@ -1,803 +0,0 @@ -#ifdef __cplusplus -# error "A C++ compiler has been selected for C." -#endif - -#if defined(__18CXX) -# define ID_VOID_MAIN -#endif -#if defined(__CLASSIC_C__) -/* cv-qualifiers did not exist in K&R C */ -# define const -# define volatile -#endif - -#if !defined(__has_include) -/* If the compiler does not have __has_include, pretend the answer is - always no. */ -# define __has_include(x) 0 -#endif - - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# if defined(__GNUC__) -# define SIMULATE_ID "GNU" -# endif - /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, - except that a few beta releases use the old format with V=2021. */ -# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) - /* The third version component from --version is an update index, - but no macro is provided for it. */ -# define COMPILER_VERSION_PATCH DEC(0) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -# elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) -# define COMPILER_ID "IntelLLVM" -#if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -#endif -#if defined(__GNUC__) -# define SIMULATE_ID "GNU" -#endif -/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and - * later. Look for 6 digit vs. 8 digit version number to decide encoding. - * VVVV is no smaller than the current year when a version is released. - */ -#if __INTEL_LLVM_COMPILER < 1000000L -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) -#else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) -#endif -#if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -#endif -#if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -#elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -#endif -#if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -#endif -#if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -#endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_C) -# define COMPILER_ID "SunPro" -# if __SUNPRO_C >= 0x5100 - /* __SUNPRO_C = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) -# endif - -#elif defined(__HP_cc) -# define COMPILER_ID "HP" - /* __HP_cc = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) - -#elif defined(__DECC) -# define COMPILER_ID "Compaq" - /* __DECC_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) - -#elif defined(__IBMC__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__ibmxl__) && defined(__clang__) -# define COMPILER_ID "XLClang" -# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) -# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) -# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) - - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 -# define COMPILER_ID "XL" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMC__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) - -#elif defined(__NVCOMPILER) -# define COMPILER_ID "NVHPC" -# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) -# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) -# if defined(__NVCOMPILER_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__CLANG_FUJITSU) -# define COMPILER_ID "FujitsuClang" -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# define COMPILER_VERSION_INTERNAL_STR __clang_version__ - - -#elif defined(__FUJITSU) -# define COMPILER_ID "Fujitsu" -# if defined(__FCC_version__) -# define COMPILER_VERSION __FCC_version__ -# elif defined(__FCC_major__) -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# endif -# if defined(__fcc_version) -# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) -# elif defined(__FCC_VERSION) -# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) -# endif - - -#elif defined(__ghs__) -# define COMPILER_ID "GHS" -/* __GHS_VERSION_NUMBER = VVVVRP */ -# ifdef __GHS_VERSION_NUMBER -# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) -# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) -# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) -# endif - -#elif defined(__TINYC__) -# define COMPILER_ID "TinyCC" - -#elif defined(__BCC__) -# define COMPILER_ID "Bruce" - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__ARMCC_VERSION) && !defined(__clang__) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) -# define COMPILER_ID "ARMClang" - # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) -# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__GNUC__) -# define COMPILER_ID "GNU" -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" -#if defined(__VISUALDSPVERSION__) - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" -# if defined(__VER__) && defined(__ICCARM__) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) -# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) -# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) -# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) -# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# endif - -#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) -# define COMPILER_ID "SDCC" -# if defined(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) -# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) -# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) -# else - /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__MSYS__) -# define PLATFORM_ID "MSYS" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# elif defined(__VXWORKS__) -# define PLATFORM_ID "VxWorks" - -# else /* unknown platform */ -# define PLATFORM_ID -# endif - -#elif defined(__INTEGRITY) -# if defined(INT_178B) -# define PLATFORM_ID "Integrity178" - -# else /* regular Integrity */ -# define PLATFORM_ID "Integrity" -# endif - -#else /* unknown platform */ -# define PLATFORM_ID - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_ARM64EC) -# define ARCHITECTURE_ID "ARM64EC" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM64) -# define ARCHITECTURE_ID "ARM64" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# if defined(__ICCARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__ICCRX__) -# define ARCHITECTURE_ID "RX" - -# elif defined(__ICCRH850__) -# define ARCHITECTURE_ID "RH850" - -# elif defined(__ICCRL78__) -# define ARCHITECTURE_ID "RL78" - -# elif defined(__ICCRISCV__) -# define ARCHITECTURE_ID "RISCV" - -# elif defined(__ICCAVR__) -# define ARCHITECTURE_ID "AVR" - -# elif defined(__ICC430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__ICCV850__) -# define ARCHITECTURE_ID "V850" - -# elif defined(__ICC8051__) -# define ARCHITECTURE_ID "8051" - -# elif defined(__ICCSTM8__) -# define ARCHITECTURE_ID "STM8" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__ghs__) -# if defined(__PPC64__) -# define ARCHITECTURE_ID "PPC64" - -# elif defined(__ppc__) -# define ARCHITECTURE_ID "PPC" - -# elif defined(__ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__x86_64__) -# define ARCHITECTURE_ID "x64" - -# elif defined(__i386__) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__TI_COMPILER_VERSION__) -# if defined(__TI_ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__MSP430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__TMS320C28XX__) -# define ARCHITECTURE_ID "TMS320C28x" - -# elif defined(__TMS320C6X__) || defined(_TMS320C6X) -# define ARCHITECTURE_ID "TMS320C6x" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number. */ -#ifdef COMPILER_VERSION -char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; - -/* Construct a string literal encoding the version number components. */ -#elif defined(COMPILER_VERSION_MAJOR) -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the internal version number. */ -#ifdef COMPILER_VERSION_INTERNAL -char const info_version_internal[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', - 'i','n','t','e','r','n','a','l','[', - COMPILER_VERSION_INTERNAL,']','\0'}; -#elif defined(COMPILER_VERSION_INTERNAL_STR) -char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -#if !defined(__STDC__) && !defined(__clang__) -# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) -# define C_VERSION "90" -# else -# define C_VERSION -# endif -#elif __STDC_VERSION__ > 201710L -# define C_VERSION "23" -#elif __STDC_VERSION__ >= 201710L -# define C_VERSION "17" -#elif __STDC_VERSION__ >= 201000L -# define C_VERSION "11" -#elif __STDC_VERSION__ >= 199901L -# define C_VERSION "99" -#else -# define C_VERSION "90" -#endif -const char* info_language_standard_default = - "INFO" ":" "standard_default[" C_VERSION "]"; - -const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ -#if (defined(__clang__) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__)) && \ - !defined(__STRICT_ANSI__) && !defined(_MSC_VER) - "ON" -#else - "OFF" -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -#ifdef ID_VOID_MAIN -void main() {} -#else -# if defined(__CLASSIC_C__) -int main(argc, argv) int argc; char *argv[]; -# else -int main(int argc, char* argv[]) -# endif -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; - require += info_arch[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef COMPILER_VERSION_INTERNAL - require += info_version_internal[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) - require += info_cray[argc]; -#endif - require += info_language_standard_default[argc]; - require += info_language_extensions_default[argc]; - (void)argv; - return require; -} -#endif diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out deleted file mode 100644 index 98db4768605cea2f84b7ab8615f48d02c003719e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16088 zcmeHOeQX>@6`#9&IW&nKH^wGuo28`4A@%0$eAEp}bBTSECPn?`B@LI0pqDS`@UB`TpJA_0zy0xbnK5>mr|0a_`b(3-Exlqko0Gw*jk zFXtf9{(;1f<^9e3&3kWV-^}jK?#_HRHP9E2#T3#Kb(dl(*<_fc6g+;1WC)U~Tdk(! z&FUt#oaCjNGv!GGRBF=2_(E(DehDGlwQ;5n-ehR1!6dYhk?j^sWZgdL0e6l|kU-C>g8jMN82 zJUJ%(-!1VBV?x{j!*=6h7sg((19Balj=UbE|C{;_iQUVVcB8_0yP*{j^?iiwq-#av z`hadeEcGqc4^0w(poCX#&1QyoZr_?scVsj9@?^(k_s));+wD@p?$Q-=yDa+WF}44| zQAKWMn3FK7_z5G!AD69@a@O}-?reXi`-!$q_qIKE^WA^^`Zw2gZ($v7H`}ldC-#RS z!ZPQ%PS!E;_#EYAY!hDaf0fh3A_w;0T&JvuII9ltF2d&*;kjM6*72iUcVyCYM>BaZ zo4Ma7kpev8mIALBxH&JAS1faUcdGpZ{rh^{F1yR#QO$4LuH62iK{xFe{jp3b@QXu( zJ=sFuAM%E?>~1Vq$csDIsMb~F2*&iE>8TjW++K{A^7_n5jyjJ&=Dz>fS18PJy5pII z>loLMwbt-+a(#opBn}&rrW`!vrVwvgMz1Zz7lpS%{1=385Ak0TJ`v)d75?HLr4x@G z?kl8AH9U_oq{}rt#x|GD*6=)Tk>+Z6eZNIPgi!>d2t*NxA`nF&ia->BC<6Zz5%_E4 zEpIy~uQWKPm;Gj|QqJdRf_UW>=j2ZtUeN8U?0Aakzf^Af20`OS#rh=uNK3s+%bkDf zpT6)3XZm-}$=7BN4W&9~I$w0o?0$(HR9Z@;`L|KKapQy9AMxjian39|%W&sh&_Y#z zl=D>e%F3n2jVD;~1wqn(OzZD>m|^oZXL{B-_r@OQ+}si;cHX&gEm%hmZW9L$l}n?I z8>wBe=k}i1JxIl>yyd8Ka(A4w&h+cSD(Cd>&9;x_s$psjJ*f=XA?U^rU_|b;WtyiM`VJylVXMOe}Sk__K@f->JtN2WMKI zT|-fRerZ$H%Y*f_$$LKoo%}0#O8_2t*NxA`nF&ia->B zC<0Lg{+}bj-@mSx`VaIS+%;0jO=Plu@fdxTJibtSLAiUcUo2$``C|#4Iy-HXNo+$V zaa?JOiL4il7K*uJ1N?PWNUu0DeoXT8VKATeifQ`bH|mwM!LiOeq{N>L{5;oEs+Ju* zpj#E&u;jz-)I9zkHS}hsat~pekl#E6g!EcK9iOdKzDCI3VmZa`KdfStO|cEDRx~_H zAH1J*$_;pQM_Zh*A`RC<0Lgq6kD0h$0Y0Ac{Z~fhYn| z1m4{UV7(&NCt?ktet4m(R-rmszqnfDU&}hj_lb;kkQ+qCBg}e{u^y72dpM!|@7F2? zmcJ*939&|SoFCdK@w!A#7p43?MpUN+ZxCz~Y!L*AnVOMxh%2NZAr+w=-E!iz*i$F? zyG3N^{j*})OX`}sCbC&fP9M1E%e5svUh4CkmGk+B$nYob-#x(k@OS7D>ryStIKsM9 ztTV;BQmiB0-_x_pYCk$$&Ie_S9`xx6zoWCP#m)!1y6nXE%|c(lVcZQ%)t@V2E$){X zl{_LHYKg*)g!S~f-{NYGnviiT>dF%S$q>Iycw7h2@25;mwW;o;VYq#qcr|v6p6)TO zHA#n0(?8dX>k9lS%EZ)-3fBqvrzumf{fnK~S?#A;oq9h!%ws)2KiB$nRfNXH1#Pyr zy51gMUeo&TtzIwS-=<76gc@w6fLJv$vimgOs#Fq;!EMAhsn%*dQM!xx=6IvReFc0{ z^uvAzwSQ>M<2}T$jkhX{UzB8+r<#>z7`YtPq~=>yThj2jE*}y;yl(nw;+tqZBt_p? zDb+`OGxd8?#+80oM1{|YpC-|V|Fhx;;|hMxi=WMMf7S1XsPGr;ht4ak|ElyTsrw&9^EmX$YK`IxeWmRzqqsrVgZ)(`x&ov5$D zdj~SES1fu{uAdKzQ);y6<$O0?&gG`aq(*W{GgzS7Gw6NN@9B~EnEh#Lo9p%+-aD9b zQwMro+A+}k@dJAY`+JC{mz-|Oky5AkuyXeg9Nf2ez&+U4cO*6B4(;7HkRprl4u&N5 zE&Qjw3VzxPJf+Wvys%(4E|9Qr7lWHF72I)p5z0Fp`VW#;I+J(HB|oh)`O$)lx2Q(S zdik-kH|D$l{)SXh#KZ>ga;dW6Qb{V-8!%j#wp2(swEL>V@XOfi?5|k3&7&F;-pZkS z#WYpk6B~hF`zmFZrgDKdOc)dmjw6@J({_&uW#^@C)av72XH>SrZ-J+% ztTu(?|0ycuxh3o|p9Er_j`l+j_yF1STop3rtH6X*9&SI{bcQk@ zt7OaPg!1a|jQrlIhybA>s-IAfn+W@tMFDtwRnug`_5YIS zTKhS%2YxwZkNyY!DrIObYjr;)=E2y98PZ@ERb%7 diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp deleted file mode 100644 index 25c62a8..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp +++ /dev/null @@ -1,791 +0,0 @@ -/* This source file must have a .cpp extension so that all C++ compilers - recognize the extension without flags. Borland does not know .cxx for - example. */ -#ifndef __cplusplus -# error "A C compiler has been selected for C++." -#endif - -#if !defined(__has_include) -/* If the compiler does not have __has_include, pretend the answer is - always no. */ -# define __has_include(x) 0 -#endif - - -/* Version number components: V=Version, R=Revision, P=Patch - Version date components: YYYY=Year, MM=Month, DD=Day */ - -#if defined(__COMO__) -# define COMPILER_ID "Comeau" - /* __COMO_VERSION__ = VRR */ -# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) - -#elif defined(__INTEL_COMPILER) || defined(__ICC) -# define COMPILER_ID "Intel" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# if defined(__GNUC__) -# define SIMULATE_ID "GNU" -# endif - /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, - except that a few beta releases use the old format with V=2021. */ -# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) -# if defined(__INTEL_COMPILER_UPDATE) -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) -# else -# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) -# endif -# else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) -# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) - /* The third version component from --version is an update index, - but no macro is provided for it. */ -# define COMPILER_VERSION_PATCH DEC(0) -# endif -# if defined(__INTEL_COMPILER_BUILD_DATE) - /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) -# endif -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -# elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) -# define COMPILER_ID "IntelLLVM" -#if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -#endif -#if defined(__GNUC__) -# define SIMULATE_ID "GNU" -#endif -/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and - * later. Look for 6 digit vs. 8 digit version number to decide encoding. - * VVVV is no smaller than the current year when a version is released. - */ -#if __INTEL_LLVM_COMPILER < 1000000L -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) -#else -# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) -# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) -#endif -#if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -#endif -#if defined(__GNUC__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) -#elif defined(__GNUG__) -# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) -#endif -#if defined(__GNUC_MINOR__) -# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) -#endif -#if defined(__GNUC_PATCHLEVEL__) -# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -#endif - -#elif defined(__PATHCC__) -# define COMPILER_ID "PathScale" -# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) -# if defined(__PATHCC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) -# endif - -#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) -# define COMPILER_ID "Embarcadero" -# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) - -#elif defined(__BORLANDC__) -# define COMPILER_ID "Borland" - /* __BORLANDC__ = 0xVRR */ -# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) - -#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__WATCOMC__) -# define COMPILER_ID "OpenWatcom" - /* __WATCOMC__ = VVRP + 1100 */ -# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) -# if (__WATCOMC__ % 10) > 0 -# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) -# endif - -#elif defined(__SUNPRO_CC) -# define COMPILER_ID "SunPro" -# if __SUNPRO_CC >= 0x5100 - /* __SUNPRO_CC = 0xVRRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# else - /* __SUNPRO_CC = 0xVRP */ -# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) -# endif - -#elif defined(__HP_aCC) -# define COMPILER_ID "HP" - /* __HP_aCC = VVRRPP */ -# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) - -#elif defined(__DECCXX) -# define COMPILER_ID "Compaq" - /* __DECCXX_VER = VVRRTPPPP */ -# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) - -#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) -# define COMPILER_ID "zOS" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__ibmxl__) && defined(__clang__) -# define COMPILER_ID "XLClang" -# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) -# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) -# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) -# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) - - -#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 -# define COMPILER_ID "XL" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 -# define COMPILER_ID "VisualAge" - /* __IBMCPP__ = VRP */ -# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) - -#elif defined(__NVCOMPILER) -# define COMPILER_ID "NVHPC" -# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) -# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) -# if defined(__NVCOMPILER_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) -# endif - -#elif defined(__PGI) -# define COMPILER_ID "PGI" -# define COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) -# if defined(__PGIC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) -# endif - -#elif defined(_CRAYC) -# define COMPILER_ID "Cray" -# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) -# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) - -#elif defined(__TI_COMPILER_VERSION__) -# define COMPILER_ID "TI" - /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) - -#elif defined(__CLANG_FUJITSU) -# define COMPILER_ID "FujitsuClang" -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# define COMPILER_VERSION_INTERNAL_STR __clang_version__ - - -#elif defined(__FUJITSU) -# define COMPILER_ID "Fujitsu" -# if defined(__FCC_version__) -# define COMPILER_VERSION __FCC_version__ -# elif defined(__FCC_major__) -# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) -# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) -# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) -# endif -# if defined(__fcc_version) -# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) -# elif defined(__FCC_VERSION) -# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) -# endif - - -#elif defined(__ghs__) -# define COMPILER_ID "GHS" -/* __GHS_VERSION_NUMBER = VVVVRP */ -# ifdef __GHS_VERSION_NUMBER -# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) -# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) -# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) -# endif - -#elif defined(__SCO_VERSION__) -# define COMPILER_ID "SCO" - -#elif defined(__ARMCC_VERSION) && !defined(__clang__) -# define COMPILER_ID "ARMCC" -#if __ARMCC_VERSION >= 1000000 - /* __ARMCC_VERSION = VRRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#else - /* __ARMCC_VERSION = VRPPPP */ - # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) - # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) - # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) -#endif - - -#elif defined(__clang__) && defined(__apple_build_version__) -# define COMPILER_ID "AppleClang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif -# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) - -#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) -# define COMPILER_ID "ARMClang" - # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) - # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) - # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) -# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) - -#elif defined(__clang__) -# define COMPILER_ID "Clang" -# if defined(_MSC_VER) -# define SIMULATE_ID "MSVC" -# endif -# define COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) -# if defined(_MSC_VER) - /* _MSC_VER = VVRR */ -# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) -# endif - -#elif defined(__GNUC__) || defined(__GNUG__) -# define COMPILER_ID "GNU" -# if defined(__GNUC__) -# define COMPILER_VERSION_MAJOR DEC(__GNUC__) -# else -# define COMPILER_VERSION_MAJOR DEC(__GNUG__) -# endif -# if defined(__GNUC_MINOR__) -# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) -# endif -# if defined(__GNUC_PATCHLEVEL__) -# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) -# endif - -#elif defined(_MSC_VER) -# define COMPILER_ID "MSVC" - /* _MSC_VER = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) -# if defined(_MSC_FULL_VER) -# if _MSC_VER >= 1400 - /* _MSC_FULL_VER = VVRRPPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) -# else - /* _MSC_FULL_VER = VVRRPPPP */ -# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) -# endif -# endif -# if defined(_MSC_BUILD) -# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) -# endif - -#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -# define COMPILER_ID "ADSP" -#if defined(__VISUALDSPVERSION__) - /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) -#endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# define COMPILER_ID "IAR" -# if defined(__VER__) && defined(__ICCARM__) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) -# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) -# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) -# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) -# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) -# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) -# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) -# endif - - -/* These compilers are either not known or too old to define an - identification macro. Try to identify the platform and guess that - it is the native compiler. */ -#elif defined(__hpux) || defined(__hpua) -# define COMPILER_ID "HP" - -#else /* unknown compiler */ -# define COMPILER_ID "" -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; -#ifdef SIMULATE_ID -char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; -#endif - -#ifdef __QNXNTO__ -char const* qnxnto = "INFO" ":" "qnxnto[]"; -#endif - -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) -char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; -#endif - -#define STRINGIFY_HELPER(X) #X -#define STRINGIFY(X) STRINGIFY_HELPER(X) - -/* Identify known platforms by name. */ -#if defined(__linux) || defined(__linux__) || defined(linux) -# define PLATFORM_ID "Linux" - -#elif defined(__MSYS__) -# define PLATFORM_ID "MSYS" - -#elif defined(__CYGWIN__) -# define PLATFORM_ID "Cygwin" - -#elif defined(__MINGW32__) -# define PLATFORM_ID "MinGW" - -#elif defined(__APPLE__) -# define PLATFORM_ID "Darwin" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -# define PLATFORM_ID "Windows" - -#elif defined(__FreeBSD__) || defined(__FreeBSD) -# define PLATFORM_ID "FreeBSD" - -#elif defined(__NetBSD__) || defined(__NetBSD) -# define PLATFORM_ID "NetBSD" - -#elif defined(__OpenBSD__) || defined(__OPENBSD) -# define PLATFORM_ID "OpenBSD" - -#elif defined(__sun) || defined(sun) -# define PLATFORM_ID "SunOS" - -#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) -# define PLATFORM_ID "AIX" - -#elif defined(__hpux) || defined(__hpux__) -# define PLATFORM_ID "HP-UX" - -#elif defined(__HAIKU__) -# define PLATFORM_ID "Haiku" - -#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) -# define PLATFORM_ID "BeOS" - -#elif defined(__QNX__) || defined(__QNXNTO__) -# define PLATFORM_ID "QNX" - -#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) -# define PLATFORM_ID "Tru64" - -#elif defined(__riscos) || defined(__riscos__) -# define PLATFORM_ID "RISCos" - -#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) -# define PLATFORM_ID "SINIX" - -#elif defined(__UNIX_SV__) -# define PLATFORM_ID "UNIX_SV" - -#elif defined(__bsdos__) -# define PLATFORM_ID "BSDOS" - -#elif defined(_MPRAS) || defined(MPRAS) -# define PLATFORM_ID "MP-RAS" - -#elif defined(__osf) || defined(__osf__) -# define PLATFORM_ID "OSF1" - -#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) -# define PLATFORM_ID "SCO_SV" - -#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) -# define PLATFORM_ID "ULTRIX" - -#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) -# define PLATFORM_ID "Xenix" - -#elif defined(__WATCOMC__) -# if defined(__LINUX__) -# define PLATFORM_ID "Linux" - -# elif defined(__DOS__) -# define PLATFORM_ID "DOS" - -# elif defined(__OS2__) -# define PLATFORM_ID "OS2" - -# elif defined(__WINDOWS__) -# define PLATFORM_ID "Windows3x" - -# elif defined(__VXWORKS__) -# define PLATFORM_ID "VxWorks" - -# else /* unknown platform */ -# define PLATFORM_ID -# endif - -#elif defined(__INTEGRITY) -# if defined(INT_178B) -# define PLATFORM_ID "Integrity178" - -# else /* regular Integrity */ -# define PLATFORM_ID "Integrity" -# endif - -#else /* unknown platform */ -# define PLATFORM_ID - -#endif - -/* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is because - the compilers do not have flags that can change the architecture, - but rather depend on which compiler is being used -*/ -#if defined(_WIN32) && defined(_MSC_VER) -# if defined(_M_IA64) -# define ARCHITECTURE_ID "IA64" - -# elif defined(_M_ARM64EC) -# define ARCHITECTURE_ID "ARM64EC" - -# elif defined(_M_X64) || defined(_M_AMD64) -# define ARCHITECTURE_ID "x64" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# elif defined(_M_ARM64) -# define ARCHITECTURE_ID "ARM64" - -# elif defined(_M_ARM) -# if _M_ARM == 4 -# define ARCHITECTURE_ID "ARMV4I" -# elif _M_ARM == 5 -# define ARCHITECTURE_ID "ARMV5I" -# else -# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) -# endif - -# elif defined(_M_MIPS) -# define ARCHITECTURE_ID "MIPS" - -# elif defined(_M_SH) -# define ARCHITECTURE_ID "SHx" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__WATCOMC__) -# if defined(_M_I86) -# define ARCHITECTURE_ID "I86" - -# elif defined(_M_IX86) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) -# if defined(__ICCARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__ICCRX__) -# define ARCHITECTURE_ID "RX" - -# elif defined(__ICCRH850__) -# define ARCHITECTURE_ID "RH850" - -# elif defined(__ICCRL78__) -# define ARCHITECTURE_ID "RL78" - -# elif defined(__ICCRISCV__) -# define ARCHITECTURE_ID "RISCV" - -# elif defined(__ICCAVR__) -# define ARCHITECTURE_ID "AVR" - -# elif defined(__ICC430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__ICCV850__) -# define ARCHITECTURE_ID "V850" - -# elif defined(__ICC8051__) -# define ARCHITECTURE_ID "8051" - -# elif defined(__ICCSTM8__) -# define ARCHITECTURE_ID "STM8" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__ghs__) -# if defined(__PPC64__) -# define ARCHITECTURE_ID "PPC64" - -# elif defined(__ppc__) -# define ARCHITECTURE_ID "PPC" - -# elif defined(__ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__x86_64__) -# define ARCHITECTURE_ID "x64" - -# elif defined(__i386__) -# define ARCHITECTURE_ID "X86" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#elif defined(__TI_COMPILER_VERSION__) -# if defined(__TI_ARM__) -# define ARCHITECTURE_ID "ARM" - -# elif defined(__MSP430__) -# define ARCHITECTURE_ID "MSP430" - -# elif defined(__TMS320C28XX__) -# define ARCHITECTURE_ID "TMS320C28x" - -# elif defined(__TMS320C6X__) || defined(_TMS320C6X) -# define ARCHITECTURE_ID "TMS320C6x" - -# else /* unknown architecture */ -# define ARCHITECTURE_ID "" -# endif - -#else -# define ARCHITECTURE_ID -#endif - -/* Convert integer to decimal digit literals. */ -#define DEC(n) \ - ('0' + (((n) / 10000000)%10)), \ - ('0' + (((n) / 1000000)%10)), \ - ('0' + (((n) / 100000)%10)), \ - ('0' + (((n) / 10000)%10)), \ - ('0' + (((n) / 1000)%10)), \ - ('0' + (((n) / 100)%10)), \ - ('0' + (((n) / 10)%10)), \ - ('0' + ((n) % 10)) - -/* Convert integer to hex digit literals. */ -#define HEX(n) \ - ('0' + ((n)>>28 & 0xF)), \ - ('0' + ((n)>>24 & 0xF)), \ - ('0' + ((n)>>20 & 0xF)), \ - ('0' + ((n)>>16 & 0xF)), \ - ('0' + ((n)>>12 & 0xF)), \ - ('0' + ((n)>>8 & 0xF)), \ - ('0' + ((n)>>4 & 0xF)), \ - ('0' + ((n) & 0xF)) - -/* Construct a string literal encoding the version number. */ -#ifdef COMPILER_VERSION -char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; - -/* Construct a string literal encoding the version number components. */ -#elif defined(COMPILER_VERSION_MAJOR) -char const info_version[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', - COMPILER_VERSION_MAJOR, -# ifdef COMPILER_VERSION_MINOR - '.', COMPILER_VERSION_MINOR, -# ifdef COMPILER_VERSION_PATCH - '.', COMPILER_VERSION_PATCH, -# ifdef COMPILER_VERSION_TWEAK - '.', COMPILER_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct a string literal encoding the internal version number. */ -#ifdef COMPILER_VERSION_INTERNAL -char const info_version_internal[] = { - 'I', 'N', 'F', 'O', ':', - 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', - 'i','n','t','e','r','n','a','l','[', - COMPILER_VERSION_INTERNAL,']','\0'}; -#elif defined(COMPILER_VERSION_INTERNAL_STR) -char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; -#endif - -/* Construct a string literal encoding the version number components. */ -#ifdef SIMULATE_VERSION_MAJOR -char const info_simulate_version[] = { - 'I', 'N', 'F', 'O', ':', - 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', - SIMULATE_VERSION_MAJOR, -# ifdef SIMULATE_VERSION_MINOR - '.', SIMULATE_VERSION_MINOR, -# ifdef SIMULATE_VERSION_PATCH - '.', SIMULATE_VERSION_PATCH, -# ifdef SIMULATE_VERSION_TWEAK - '.', SIMULATE_VERSION_TWEAK, -# endif -# endif -# endif - ']','\0'}; -#endif - -/* Construct the string literal in pieces to prevent the source from - getting matched. Store it in a pointer rather than an array - because some compilers will just produce instructions to fill the - array rather than assigning a pointer to a static array. */ -char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; - - - -#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L -# if defined(__INTEL_CXX11_MODE__) -# if defined(__cpp_aggregate_nsdmi) -# define CXX_STD 201402L -# else -# define CXX_STD 201103L -# endif -# else -# define CXX_STD 199711L -# endif -#elif defined(_MSC_VER) && defined(_MSVC_LANG) -# define CXX_STD _MSVC_LANG -#else -# define CXX_STD __cplusplus -#endif - -const char* info_language_standard_default = "INFO" ":" "standard_default[" -#if CXX_STD > 202002L - "23" -#elif CXX_STD > 201703L - "20" -#elif CXX_STD >= 201703L - "17" -#elif CXX_STD >= 201402L - "14" -#elif CXX_STD >= 201103L - "11" -#else - "98" -#endif -"]"; - -const char* info_language_extensions_default = "INFO" ":" "extensions_default[" -/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */ -#if (defined(__clang__) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__)) && \ - !defined(__STRICT_ANSI__) && !defined(_MSC_VER) - "ON" -#else - "OFF" -#endif -"]"; - -/*--------------------------------------------------------------------------*/ - -int main(int argc, char* argv[]) -{ - int require = 0; - require += info_compiler[argc]; - require += info_platform[argc]; -#ifdef COMPILER_VERSION_MAJOR - require += info_version[argc]; -#endif -#ifdef COMPILER_VERSION_INTERNAL - require += info_version_internal[argc]; -#endif -#ifdef SIMULATE_ID - require += info_simulate[argc]; -#endif -#ifdef SIMULATE_VERSION_MAJOR - require += info_simulate_version[argc]; -#endif -#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) - require += info_cray[argc]; -#endif - require += info_language_standard_default[argc]; - require += info_language_extensions_default[argc]; - (void)argv; - return require; -} diff --git a/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out b/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out deleted file mode 100644 index b898fe5edea70c84b145851a6b3ec03ffafcec60..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16096 zcmeHOYit}>6~4Pk8iywFCT&PaO0z9(mC$-(JCB;6kag^J#>h_6#3_L^3}f%uyJ8<^ zcb3=@v_YW|lLR#a0Y8FN6$ySIB%Vc7v^W%sQne`gMUW5*kBA_pt$E6n$jdqRo^L&# zu7iO7;Kv-xbME=h8oC^x%bNsWK%D*7aG?Re!@yL7A+(S=`^`sLZV(Z;lJj7{MXV4x z%r8g<;Lz9WOR_UjQXlL5wD^Gs{kSPpEyjLo$6RhpUiJxxAB*}FEMrgIVMzF-)CZ1y za!&ZaL-HBstr7-2?3We4Fz*&WaIS;tz*Rr<-_*BH{9a1xFe=O+Ft7qgeGieJbgfw2 zoS~cdOMUb8LqhToF6mX9^0~onTQ=o0E%{urI@U7Qv8`p>7OPUS+I7X;t|a~QnA*MP zprSC7j7b_*{J4=3k9D_;p6$Q)^0|2XiK~ytj?R4OI~TvbFA>Y%#Wvh-_F)?)j)x(_ zGMBkdwlVqm1eIiL6TjsByr6-34jg}F16>zk$p*MH4_=%H=XTxQAdYgJp)uDP&K2E! z?wCg+C3wiG_-@&E3U02bSmyk0Q@i_mcXc`KR=c&eUf#S#IlTk@PR1*HBe{z2l?VE} z@};6T;11?F+(@BRlyHtQZD`0DjOjnqQ!$dcy%;amwYepnbsm3=efR7aD9v%Y;~Bzr zjO!=4!r;?#eFMKD0h>}r4;*qLgeQ~6ZcPX;3!V(&pB8*W2>+bmts(pyf?wXLH1XKs zz5-nd;5^1a*8(`kHtVJWIFDPY)O@PCnkzck4WyfZ|xJmpV~K&ZkueoV4vCXA_b_es*vShhpp!IpVaXPKTn8#X3;au-Zky7qN*R} zGF82#cBOg!aW;HjIN6`o_FF&0Y~zeQF=d~Bb*FuPdVw8#!M-%(-%bJUl>kk(E5ps} zsa^2r_8#BSPij@Y|Db(hN1TiH#8rQ(eQL)oBwX8AtJSV$=BC?#`9ow&BV~N@lc@a{6ksi_%@NT4sxByc!XIiGS)-#a}N{rf19b5SpKFg zCd3-SEI+gn@w!B&%c6ga5!FfIw+de)e3fu8aZ{7B4so$4TBRbiqeD)d7JF(!ygNmP z-9Kxly=1PT8IjFma{9nMtJj|Nc&X2CO3vpWA|sxJfAbjDhyRZeu`V^4G=Z@06zfc} zt`zG?cXxGdPi{CkSS|Y1Bt7WU6MjouRf}zpwzpfYTQ&-O^M-LZEL4B0g{`<>Vx&1O z9hww_+lV)^=YET;7ajii* ze2o6NUR+nePf{VKZd15UfPak&joSa5woj;3(pa_|MiCm@UnD$6E4feJC58dkDE_at zJzXuK@$v`lx1zodA7NhC_HV6UN5B)5kd+VuyoK;&Kt}P9##bwq0%CYC;R&_6o@Z$H z5xz3stZ=^p{;=4G;|%Heu$tv%!dJvsD~xMs9%GzpR!M`%WvV`_@zpB4{`#EY;q}zd z5}u%Ol1d@6;g1l$lEyN-|-915U+o62~-S6Mi+27kmFunS8(za;r?)}Qy-M4pFXP>jT zr{_R=z!~V=)t4rZ@V-Jm-z?O%>%)eDH>sDjTd+q+-1-!*OV%g``7=uLlgj zqP@wki@BRW>M7w39=fkgQ~CX`QdVWW;Jbsw{j%X%lyXJd_c5xhV#)Wckz&;vEtf{U zvOgYx2CF&Rw3EvS)VZs-g$JcJ&$^YYvNGdEs={!;Y&7!XdXC_buI%Mqc2E`%DP@i3 z&A}QeQNgF2DvQS@S(bGFSzcB~Vm3qmkc__>lEwpN3howiL)0AZev7iNEb5H{4e;|h6M-~r-nT;jnAd>g`3m;o^Z&m1BmXKXmclQH2qrK@^&={A6XE}o z7=S-ew={)t{Vx+7^q&@g@Xv?*(f@#dK?PdtTHhCm`7rilhV3DP|Bif{1OAwQPqz?A z1UnjF_GO(z;rvN$Ecx|4i^hKYo=kHi18$DPZ9tC diff --git a/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log b/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log deleted file mode 100644 index f66394f..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log +++ /dev/null @@ -1,451 +0,0 @@ -The system is: Linux - 5.15.90.1-microsoft-standard-WSL2 - x86_64 -Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. -Compiler: /usr/bin/cc -Build flags: -Id flags: - -The output was: -0 - - -Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" - -The C compiler identification is GNU, found in "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdC/a.out" - -Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. -Compiler: /usr/bin/c++ -Build flags: -Id flags: - -The output was: -0 - - -Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" - -The CXX compiler identification is GNU, found in "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/3.22.1/CompilerIdCXX/a.out" - -Detecting C compiler ABI info compiled with the following output: -Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp - -Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_8749b/fast && /usr/bin/gmake -f CMakeFiles/cmTC_8749b.dir/build.make CMakeFiles/cmTC_8749b.dir/build -gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -/usr/bin/cc -v -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -Using built-in specs. -COLLECT_GCC=/usr/bin/cc -OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa -OFFLOAD_TARGET_DEFAULT=1 -Target: x86_64-linux-gnu -Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 -Thread model: posix -Supported LTO compression algorithms: zlib zstd -gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/' - /usr/lib/gcc/x86_64-linux-gnu/11/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_8749b.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc1DmWsu.s -GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) - compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP - -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" -ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed" -ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" -#include "..." search starts here: -#include <...> search starts here: - /usr/lib/gcc/x86_64-linux-gnu/11/include - /usr/local/include - /usr/include/x86_64-linux-gnu - /usr/include -End of search list. -GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) - compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP - -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -Compiler executable checksum: 3f6cb05d963ad324b8f9442822c95179 -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/' - as -v --64 -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o /tmp/cc1DmWsu.s -GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38 -COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.' -Linking C executable cmTC_8749b -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8749b.dir/link.txt --verbose=1 -/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -o cmTC_8749b -Using built-in specs. -COLLECT_GCC=/usr/bin/cc -COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa -OFFLOAD_TARGET_DEFAULT=1 -Target: x86_64-linux-gnu -Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 -Thread model: posix -Supported LTO compression algorithms: zlib zstd -gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) -COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.' - /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/cc69cHrV.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_8749b /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o -COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.' -gmake[1]: Leaving directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' - - - -Parsed C implicit include dir info from above output: rv=done - found start of include info - found start of implicit include info - add: [/usr/lib/gcc/x86_64-linux-gnu/11/include] - add: [/usr/local/include] - add: [/usr/include/x86_64-linux-gnu] - add: [/usr/include] - end of search list found - collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/11/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/11/include] - collapse include dir [/usr/local/include] ==> [/usr/local/include] - collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] - collapse include dir [/usr/include] ==> [/usr/include] - implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] - - -Parsed C implicit link information from above output: - link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] - ignore line: [Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp] - ignore line: [] - ignore line: [Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_8749b/fast && /usr/bin/gmake -f CMakeFiles/cmTC_8749b.dir/build.make CMakeFiles/cmTC_8749b.dir/build] - ignore line: [gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp'] - ignore line: [Building C object CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o] - ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/usr/bin/cc] - ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] - ignore line: [OFFLOAD_TARGET_DEFAULT=1] - ignore line: [Target: x86_64-linux-gnu] - ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] - ignore line: [Thread model: posix] - ignore line: [Supported LTO compression algorithms: zlib zstd] - ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/'] - ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.22/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_8749b.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc1DmWsu.s] - ignore line: [GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] - ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] - ignore line: [] - ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] - ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] - ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"] - ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"] - ignore line: [#include "..." search starts here:] - ignore line: [#include <...> search starts here:] - ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/include] - ignore line: [ /usr/local/include] - ignore line: [ /usr/include/x86_64-linux-gnu] - ignore line: [ /usr/include] - ignore line: [End of search list.] - ignore line: [GNU C17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] - ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] - ignore line: [] - ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] - ignore line: [Compiler executable checksum: 3f6cb05d963ad324b8f9442822c95179] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/'] - ignore line: [ as -v --64 -o CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o /tmp/cc1DmWsu.s] - ignore line: [GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38] - ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.'] - ignore line: [Linking C executable cmTC_8749b] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8749b.dir/link.txt --verbose=1] - ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -o cmTC_8749b ] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/usr/bin/cc] - ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] - ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] - ignore line: [OFFLOAD_TARGET_DEFAULT=1] - ignore line: [Target: x86_64-linux-gnu] - ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] - ignore line: [Thread model: posix] - ignore line: [Supported LTO compression algorithms: zlib zstd] - ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] - ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8749b' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_8749b.'] - link line: [ /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/cc69cHrV.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_8749b /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/collect2] ==> ignore - arg [-plugin] ==> ignore - arg [/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so] ==> ignore - arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] ==> ignore - arg [-plugin-opt=-fresolution=/tmp/cc69cHrV.res] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore - arg [-plugin-opt=-pass-through=-lc] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore - arg [--build-id] ==> ignore - arg [--eh-frame-hdr] ==> ignore - arg [-m] ==> ignore - arg [elf_x86_64] ==> ignore - arg [--hash-style=gnu] ==> ignore - arg [--as-needed] ==> ignore - arg [-export-dynamic] ==> ignore - arg [-dynamic-linker] ==> ignore - arg [/lib64/ld-linux-x86-64.so.2] ==> ignore - arg [-pie] ==> ignore - arg [-znow] ==> ignore - arg [-zrelro] ==> ignore - arg [-o] ==> ignore - arg [cmTC_8749b] ==> ignore - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] - arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] - arg [-L/lib/../lib] ==> dir [/lib/../lib] - arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] - arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] - arg [CMakeFiles/cmTC_8749b.dir/CMakeCCompilerABI.c.o] ==> ignore - arg [-lgcc] ==> lib [gcc] - arg [--push-state] ==> ignore - arg [--as-needed] ==> ignore - arg [-lgcc_s] ==> lib [gcc_s] - arg [--pop-state] ==> ignore - arg [-lc] ==> lib [c] - arg [-lgcc] ==> lib [gcc] - arg [--push-state] ==> ignore - arg [--as-needed] ==> ignore - arg [-lgcc_s] ==> lib [gcc_s] - arg [--pop-state] ==> ignore - arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11] ==> [/usr/lib/gcc/x86_64-linux-gnu/11] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> [/usr/lib] - collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] - collapse library dir [/lib/../lib] ==> [/lib] - collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] - collapse library dir [/usr/lib/../lib] ==> [/usr/lib] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> [/usr/lib] - implicit libs: [gcc;gcc_s;c;gcc;gcc_s] - implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] - implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] - implicit fwks: [] - - -Detecting CXX compiler ABI info compiled with the following output: -Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp - -Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_313d1/fast && /usr/bin/gmake -f CMakeFiles/cmTC_313d1.dir/build.make CMakeFiles/cmTC_313d1.dir/build -gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -/usr/bin/c++ -v -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp -Using built-in specs. -COLLECT_GCC=/usr/bin/c++ -OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa -OFFLOAD_TARGET_DEFAULT=1 -Target: x86_64-linux-gnu -Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 -Thread model: posix -Supported LTO compression algorithms: zlib zstd -gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/' - /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_313d1.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7F4o2Q.s -GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) - compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP - -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11" -ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" -ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed" -ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" -#include "..." search starts here: -#include <...> search starts here: - /usr/include/c++/11 - /usr/include/x86_64-linux-gnu/c++/11 - /usr/include/c++/11/backward - /usr/lib/gcc/x86_64-linux-gnu/11/include - /usr/local/include - /usr/include/x86_64-linux-gnu - /usr/include -End of search list. -GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu) - compiled by GNU C version 11.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP - -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -Compiler executable checksum: 449548cbb29044828dc7ea158b577b98 -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/' - as -v --64 -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7F4o2Q.s -GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38 -COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.' -Linking CXX executable cmTC_313d1 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_313d1.dir/link.txt --verbose=1 -/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_313d1 -Using built-in specs. -COLLECT_GCC=/usr/bin/c++ -COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa -OFFLOAD_TARGET_DEFAULT=1 -Target: x86_64-linux-gnu -Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 -Thread model: posix -Supported LTO compression algorithms: zlib zstd -gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) -COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/ -COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.' - /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccOEwjUV.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_313d1 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o -COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.' -gmake[1]: Leaving directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp' - - - -Parsed CXX implicit include dir info from above output: rv=done - found start of include info - found start of implicit include info - add: [/usr/include/c++/11] - add: [/usr/include/x86_64-linux-gnu/c++/11] - add: [/usr/include/c++/11/backward] - add: [/usr/lib/gcc/x86_64-linux-gnu/11/include] - add: [/usr/local/include] - add: [/usr/include/x86_64-linux-gnu] - add: [/usr/include] - end of search list found - collapse include dir [/usr/include/c++/11] ==> [/usr/include/c++/11] - collapse include dir [/usr/include/x86_64-linux-gnu/c++/11] ==> [/usr/include/x86_64-linux-gnu/c++/11] - collapse include dir [/usr/include/c++/11/backward] ==> [/usr/include/c++/11/backward] - collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/11/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/11/include] - collapse include dir [/usr/local/include] ==> [/usr/local/include] - collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] - collapse include dir [/usr/include] ==> [/usr/include] - implicit include dirs: [/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] - - -Parsed CXX implicit link information from above output: - link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] - ignore line: [Change Dir: /mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp] - ignore line: [] - ignore line: [Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_313d1/fast && /usr/bin/gmake -f CMakeFiles/cmTC_313d1.dir/build.make CMakeFiles/cmTC_313d1.dir/build] - ignore line: [gmake[1]: Entering directory '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeTmp'] - ignore line: [Building CXX object CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o] - ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/usr/bin/c++] - ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] - ignore line: [OFFLOAD_TARGET_DEFAULT=1] - ignore line: [Target: x86_64-linux-gnu] - ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] - ignore line: [Thread model: posix] - ignore line: [Supported LTO compression algorithms: zlib zstd] - ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/'] - ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.22/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_313d1.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7F4o2Q.s] - ignore line: [GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] - ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] - ignore line: [] - ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] - ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/11"] - ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] - ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"] - ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"] - ignore line: [#include "..." search starts here:] - ignore line: [#include <...> search starts here:] - ignore line: [ /usr/include/c++/11] - ignore line: [ /usr/include/x86_64-linux-gnu/c++/11] - ignore line: [ /usr/include/c++/11/backward] - ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/11/include] - ignore line: [ /usr/local/include] - ignore line: [ /usr/include/x86_64-linux-gnu] - ignore line: [ /usr/include] - ignore line: [End of search list.] - ignore line: [GNU C++17 (Ubuntu 11.3.0-1ubuntu1~22.04) version 11.3.0 (x86_64-linux-gnu)] - ignore line: [ compiled by GNU C version 11.3.0 GMP version 6.2.1 MPFR version 4.1.0 MPC version 1.2.1 isl version isl-0.24-GMP] - ignore line: [] - ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] - ignore line: [Compiler executable checksum: 449548cbb29044828dc7ea158b577b98] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/'] - ignore line: [ as -v --64 -o CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7F4o2Q.s] - ignore line: [GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.38] - ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.'] - ignore line: [Linking CXX executable cmTC_313d1] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_313d1.dir/link.txt --verbose=1] - ignore line: [/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_313d1 ] - ignore line: [Using built-in specs.] - ignore line: [COLLECT_GCC=/usr/bin/c++] - ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] - ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] - ignore line: [OFFLOAD_TARGET_DEFAULT=1] - ignore line: [Target: x86_64-linux-gnu] - ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] - ignore line: [Thread model: posix] - ignore line: [Supported LTO compression algorithms: zlib zstd] - ignore line: [gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) ] - ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_313d1' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_313d1.'] - link line: [ /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccOEwjUV.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_313d1 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/collect2] ==> ignore - arg [-plugin] ==> ignore - arg [/usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so] ==> ignore - arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper] ==> ignore - arg [-plugin-opt=-fresolution=/tmp/ccOEwjUV.res] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc] ==> ignore - arg [-plugin-opt=-pass-through=-lc] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore - arg [-plugin-opt=-pass-through=-lgcc] ==> ignore - arg [--build-id] ==> ignore - arg [--eh-frame-hdr] ==> ignore - arg [-m] ==> ignore - arg [elf_x86_64] ==> ignore - arg [--hash-style=gnu] ==> ignore - arg [--as-needed] ==> ignore - arg [-export-dynamic] ==> ignore - arg [-dynamic-linker] ==> ignore - arg [/lib64/ld-linux-x86-64.so.2] ==> ignore - arg [-pie] ==> ignore - arg [-znow] ==> ignore - arg [-zrelro] ==> ignore - arg [-o] ==> ignore - arg [cmTC_313d1] ==> ignore - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] - arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] - arg [-L/lib/../lib] ==> dir [/lib/../lib] - arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] - arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] - arg [-L/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] - arg [CMakeFiles/cmTC_313d1.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore - arg [-lstdc++] ==> lib [stdc++] - arg [-lm] ==> lib [m] - arg [-lgcc_s] ==> lib [gcc_s] - arg [-lgcc] ==> lib [gcc] - arg [-lc] ==> lib [c] - arg [-lgcc_s] ==> lib [gcc_s] - arg [-lgcc] ==> lib [gcc] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o] - arg [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] - collapse obj [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11] ==> [/usr/lib/gcc/x86_64-linux-gnu/11] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib] ==> [/usr/lib] - collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] - collapse library dir [/lib/../lib] ==> [/lib] - collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] - collapse library dir [/usr/lib/../lib] ==> [/usr/lib] - collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/11/../../..] ==> [/usr/lib] - implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] - implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] - implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] - implicit fwks: [] - - diff --git a/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt b/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt deleted file mode 100644 index d275d42..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/clion-environment.txt +++ /dev/null @@ -1,3 +0,0 @@ -ToolSet: Ubuntu 22.04.2 LTS (local)Options: - -Options: \ No newline at end of file diff --git a/metrics/cmake-build-debug/CMakeFiles/clion-log.txt b/metrics/cmake-build-debug/CMakeFiles/clion-log.txt deleted file mode 100644 index 656c29f..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/clion-log.txt +++ /dev/null @@ -1,62 +0,0 @@ -C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/sh -c "export CLION_IDE=TRUE && export JETBRAINS_IDE=TRUE && cd '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug' && /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G 'CodeBlocks - Unix Makefiles' '/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics'" -CMake Warning (dev) in CMakeLists.txt: - No project() command is present. The top-level CMakeLists.txt file must - contain a literal, direct call to the project() command. Add a line of - code such as - - project(ProjectName) - - near the top of the file, but after cmake_minimum_required(). - - CMake is pretending there is a "project(Project)" command on the first - line. -This warning is for project developers. Use -Wno-dev to suppress it. - --- The C compiler identification is GNU 11.3.0 --- The CXX compiler identification is GNU 11.3.0 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Detecting CXX compiler ABI info --- Detecting CXX compiler ABI info - done --- Check for working CXX compiler: /usr/bin/c++ - skipped --- Detecting CXX compile features --- Detecting CXX compile features - done -CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): - Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least - version "1.8.1") -Call Stack (most recent call first): - /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) - /usr/share/cmake-3.22/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args) - CMakeLists.txt:1 (find_package) - - -CMake Warning (dev) in /usr/share/cmake-3.22/Modules/FindBoost.cmake: - Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH - and POP. Run "cmake --help-policy CMP0011" for policy details. Use the - cmake_policy command to set the policy and suppress this warning. - - The included script - - /usr/share/cmake-3.22/Modules/FindBoost.cmake - - affects policy settings. CMake is implying the NO_POLICY_SCOPE option for - compatibility, so the effects are applied to the including context. -Call Stack (most recent call first): - CMakeLists.txt:1 (find_package) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning (dev) in CMakeLists.txt: - No cmake_minimum_required command is present. A line of code such as - - cmake_minimum_required(VERSION 3.22) - - should be added at the top of the file. The version specified may be lower - if you wish to support older CMake versions for this project. For more - information run "cmake --help-policy CMP0000". -This warning is for project developers. Use -Wno-dev to suppress it. - --- Configuring incomplete, errors occurred! -See also "/mnt/c/Users/march/materials/Technopark/semestr1/c++/2023_1_DDT/metrics/cmake-build-debug/CMakeFiles/CMakeOutput.log". diff --git a/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache b/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache deleted file mode 100644 index 3dccd73..0000000 --- a/metrics/cmake-build-debug/CMakeFiles/cmake.check_cache +++ /dev/null @@ -1 +0,0 @@ -# This file is generated by cmake for dependency checking of the CMakeCache.txt file -- GitLab From 4be443fc2b39d3c5b071148130bf92f5e3e117ed Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 4 May 2023 16:57:18 +0300 Subject: [PATCH 041/134] test improvement --- .../internal/dbManager/include/dbManager.hpp | 2 +- .../internal/dbManager/src/dbConnection.cpp | 2 +- server/internal/entities/src/Task.cpp | 4 +- server/internal/repository/CMakeLists.txt | 12 +++- .../repository/src/MetricRepository.cpp | 23 ++++---- .../repository/src/SolutionRepository.cpp | 37 ++++++------ .../repository/src/TaskRepository.cpp | 24 +++----- .../repository/src/UserRepository.cpp | 36 ++++++------ .../internal/repository/tests/CMakeLists.txt | 11 ---- .../repository/tests/RepositoryTests.cpp | 56 +++++++++++++++---- 10 files changed, 114 insertions(+), 93 deletions(-) diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp index a6d323d..d17e9ab 100644 --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -21,7 +21,7 @@ public: void freeConnection(const std::shared_ptr &); private: - const int POOL_SIZE = 10; + const size_t POOL_SIZE = 10; std::condition_variable m_condition; void createPool(); diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index 39fd7a6..fe9c04d 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -6,7 +6,7 @@ #include "../include/dbConnection.hpp" dbConnection::dbConnection() { - + establish_connection(); } std::shared_ptr dbConnection::connection() const { diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index b830fe9..e0fc107 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -1,6 +1,4 @@ -#pragma once - -#include "../include/Task.hpp" +#include "Task.hpp" #include Task::Task(std::string description_, float treshold_) noexcept : id(0), description(std::move(description_)), diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index a8c0efe..d7309fa 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -16,8 +16,16 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") - - +add_custom_target( + ${PROJECT_NAME}_COVERAGE + COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} +) +add_custom_target( + ${PROJECT_NAME}_COVERAGE_FILE + COMMAND rm -r ${CMAKE_CURRENT_BINARY_DIR}/report || echo "There are no reports" + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/report + COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} --html-details report/report.html +) add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp index b5e17fd..d6d265a 100644 --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -12,9 +12,9 @@ std::optional MetricRepository::getById(size_t id) { if(r.empty()) return std::nullopt; return makeMetric(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -34,9 +34,9 @@ size_t MetricRepository::storeMetric(MetricStat metric) { w.commit(); manager->freeConnection(c); return r["id"].as(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -51,9 +51,9 @@ void MetricRepository::updateMetric(MetricStat metric) { work w(*c); w.exec(sql); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -69,9 +69,8 @@ void MetricRepository::deleteMetricById(size_t id) { w.exec(sql); w.commit(); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 4b112b3..91ef68e 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -13,12 +13,12 @@ std::optional SolutionRepository::getSolutionById(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if(r.empty()) + if (r.empty()) return std::nullopt; return makeSolution(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -33,9 +33,9 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i for (result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -50,9 +50,9 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { for (result::const_iterator k = r.begin(); k != r.end(); ++k) solutions.push_back(makeSolution(k)); return solutions; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -70,9 +70,8 @@ size_t SolutionRepository::storeSolution(Solution solution) { w.commit(); manager->freeConnection(c); return r["id"].as(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } @@ -88,9 +87,9 @@ void SolutionRepository::updateSolution(Solution solution) { work w(*c); w.exec(sql); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -102,9 +101,9 @@ void SolutionRepository::deleteSolutionById(size_t id) { w.exec(sql); w.commit(); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 7b92d31..9974dc5 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,6 +1,4 @@ - #include -#include #include "Task.hpp" #include #include "TaskRepository.hpp" @@ -12,13 +10,12 @@ std::optional TaskRepository::getTaskById(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if (r.empty()){ + if (r.empty()) { return std::nullopt; } return makeTask(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } @@ -30,9 +27,8 @@ void TaskRepository::updateTask(Task task) { work w(*c); w.exec(sql); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } @@ -46,9 +42,8 @@ size_t TaskRepository::storeTask(Task task) { w.commit(); manager->freeConnection(c); return r["id"].as(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } @@ -64,9 +59,8 @@ void TaskRepository::deleteTaskById(size_t task_id) { w.exec(sql); w.commit(); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + throw; } } diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 51f23c5..216baef 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -15,9 +15,9 @@ std::optional UserRepository::getUserById(size_t id) { if (r.empty()) return std::nullopt; return makeUser(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -31,9 +31,9 @@ std::optional UserRepository::getUserByLogin(std::string login) { if(r.empty()) return std::nullopt; return makeUser(r.begin()); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -49,9 +49,9 @@ size_t UserRepository::makeUser(User user) { w.commit(); manager->freeConnection(c); return r["id"].as(); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -63,9 +63,9 @@ void UserRepository::deleteByUserId(size_t user_id) { w.exec(sql); w.commit(); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -85,9 +85,9 @@ std::vector UserRepository::getAllUsers() { for (result::const_iterator k = r.begin(); k != r.end(); ++k) users.push_back(makeUser(k)); return users; - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } @@ -112,8 +112,8 @@ void UserRepository::update(User user) { work w(*c); w.exec(sql); manager->freeConnection(c); - } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; - throw e; + } catch (...) { + + throw; } } diff --git a/server/internal/repository/tests/CMakeLists.txt b/server/internal/repository/tests/CMakeLists.txt index ad20fc9..23379e5 100644 --- a/server/internal/repository/tests/CMakeLists.txt +++ b/server/internal/repository/tests/CMakeLists.txt @@ -29,17 +29,6 @@ add_custom_target( COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} ) -add_custom_target( - ${PROJECT_NAME}_COVERAGE - COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - ${PROJECT_NAME}_COVERAGE_FILE - COMMAND rm -r ${CMAKE_CURRENT_BINARY_DIR}/report || echo "There are no reports" - COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/report - COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} --html-details report/report.html -) add_custom_target( ${PROJECT_NAME}_VALGRIND diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index 4af0790..b78c57c 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -5,6 +5,7 @@ #include "SolutionRepository.hpp" #include "TaskRepository.hpp" #include + TEST(UserRepository_CRUD_Test, CRUD) { UserRepository rep; @@ -45,7 +46,7 @@ TEST(TaskRepository_CRUD_Test, CRUD) { TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); + Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); size_t id = rep.storeSolution(solution); EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(1)); solution.setId(id); @@ -59,7 +60,7 @@ TEST(SolutionRepository_CRUD_Test, CRUD) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(new_solution)); } -TEST(MetricRepository_CRUD_Test, CRUD){ +TEST(MetricRepository_CRUD_Test, CRUD) { MetricRepository rep; MetricStat metricStat(1, 0.8f, 0.9f, 0.89f, true, 0.85f); size_t id = rep.storeMetric(metricStat); @@ -75,9 +76,10 @@ TEST(MetricRepository_CRUD_Test, CRUD){ EXPECT_NO_FATAL_FAILURE(rep.deleteMetric(new_stat)); } -TEST(UserRepository_CRUD_Test, CRUD_many) { +TEST(UserRepository_CRUD_Test, getAllUsers) { UserRepository rep; - std::vector v = {{"test@test.com", "test", "testuser"}, {"test2@test.com", "test2", "testuser2"}}; + std::vector v = {{"test@test.com", "test", "testuser"}, + {"test2@test.com", "test2", "testuser2"}}; EXPECT_NO_FATAL_FAILURE(rep.getAllUsers()); std::vector new_v = rep.getAllUsers(); EXPECT_EQ(v, new_v); @@ -99,15 +101,18 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); - Solution solution2("01.01.1970", 1, "/home/usr","tokens.txt","tree.txt", 1, "result"); + Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); + Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); + EXPECT_EQ(solution1, rep.getSolutionById(id1)); size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); - std::vector v = {solution1, solution2}; - std::vector new_v = rep.getSolutionsBySenderId(solution1.getId()); + EXPECT_EQ(solution2, rep.getSolutionById(id2)); + std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"}, + {id2, "01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"}}; + std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); @@ -117,21 +122,50 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users","tokens.txt","tree.txt", 1, "result"); - Solution solution2("01.01.1970", 1, "/home/usr","tokens.txt","tree.txt", 1, "result"); + Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); + Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); std::vector v = {solution1, solution2}; - std::vector new_v = rep.getSolutionsByTaskId(solution1.getId()); + std::vector new_v = rep.getSolutionsByTaskId(solution1.getTaskId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } +TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ + SolutionRepository rep; + Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 100500, "result"); + try{ + rep.storeSolution(solution); + }catch(pqxx::foreign_key_violation &e){ + std::cout< Date: Thu, 4 May 2023 16:59:07 +0300 Subject: [PATCH 042/134] add token-based part (unimplemented) and tests --- metrics/CMakeLists.txt | 2 +- metrics/metrics_headers/TextMetricsLib.h | 2 +- metrics/metrics_headers/TokenMetricLib.h | 43 ++++++++++++ metrics/source/TokenMetricImpl.cpp | 15 ++++ metrics/testProgs/code2.txt | 29 ++++++++ metrics/tests/src/text_metrics_tests.cpp | 87 ++++++++++++++++++++++++ 6 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 metrics/metrics_headers/TokenMetricLib.h create mode 100644 metrics/source/TokenMetricImpl.cpp diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt index 23c2536..73da6de 100644 --- a/metrics/CMakeLists.txt +++ b/metrics/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(MetricsLib source/TextMetricImpl.cpp) +add_library(MetricsLib source/TextMetricImpl.cpp source/TokenMetricImpl.cpp) target_include_directories(MetricsLib PUBLIC metrics_headers) target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h index 3ff4960..16f25d7 100644 --- a/metrics/metrics_headers/TextMetricsLib.h +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -27,7 +27,7 @@ public: protected: std::vector tokens1; std::vector tokens2; - double metric_res; + double metric_res{}; private: static std::string deleteComments(const std::string& text); static std::vector tbmTokenizer(const std::string &text); diff --git a/metrics/metrics_headers/TokenMetricLib.h b/metrics/metrics_headers/TokenMetricLib.h new file mode 100644 index 0000000..82c238d --- /dev/null +++ b/metrics/metrics_headers/TokenMetricLib.h @@ -0,0 +1,43 @@ +// +// Created by march on 04.05.2023. +// + +#ifndef SOURCEDOUT_TOKENMETRICLIB_H +#define SOURCEDOUT_TOKENMETRICLIB_H + +#include +#include +#include +#include +#include + +#include + + +class ITokenMetric{ + virtual void countMetric() = 0; + virtual void setData(std::vector tokens1, std::vector tokens2) = 0; + virtual double getMetric() = 0; +}; + +class PrepareDataTokenMetric : public ITokenMetric{ +public: + void setData(std::vector _tokens1, std::vector _tokens2) override; + double getMetric() override; +protected: + std::vector tokens1; + std::vector tokens2; + double metric_res{}; +}; + +class LivDistTokenMetric : public PrepareDataTokenMetric{ +public: + void countMetric() override; +}; + +class WShinglingTokenMetric : public PrepareDataTokenMetric{ +public: + void countMetric() override; +}; + +#endif //SOURCEDOUT_TOKENMETRICLIB_H diff --git a/metrics/source/TokenMetricImpl.cpp b/metrics/source/TokenMetricImpl.cpp new file mode 100644 index 0000000..2695234 --- /dev/null +++ b/metrics/source/TokenMetricImpl.cpp @@ -0,0 +1,15 @@ +// +// Created by march on 04.05.2023. +// + +#include "TokenMetricLib.h" + +void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) {} + +double PrepareDataTokenMetric::getMetric() { + return metric_res; +} + +void LivDistTokenMetric::countMetric() {} + +void WShinglingTokenMetric::countMetric() {} diff --git a/metrics/testProgs/code2.txt b/metrics/testProgs/code2.txt index e69de29..2115b76 100644 --- a/metrics/testProgs/code2.txt +++ b/metrics/testProgs/code2.txt @@ -0,0 +1,29 @@ +// однострочный комментарий +// еще один +// вау еще один + +#include +#include +#include + +using namespace std; + +/* многострочный комм + * // внутри него однострочный + * + */ + + +int main() { + stringstream ss1; + string res1; + // ещё в код напихаю комментов + ss1 << "a bwfw ce "; + while(getline(ss, res1, ' ')){ //комментарий после строки с кодом + /* + * летс гоу + * худшее место для многострочного коммента + */ + cout << res1 << endl; /* многострочный однострочно */ + } +} \ No newline at end of file diff --git a/metrics/tests/src/text_metrics_tests.cpp b/metrics/tests/src/text_metrics_tests.cpp index 5cbb0cd..c906aa5 100644 --- a/metrics/tests/src/text_metrics_tests.cpp +++ b/metrics/tests/src/text_metrics_tests.cpp @@ -9,6 +9,7 @@ #include #include "TextMetricsLib.h" +#include "TokenMetricLib.h" class LivDistTextMetricTest : public ::testing::Test { protected: @@ -28,6 +29,24 @@ protected: void TearDown(){} }; +class LivDistTokenMetricTest : public ::testing::Test { +protected: + std::unique_ptr livDistTokenMetric; + void SetUp(){ + livDistTokenMetric = std::make_unique (); + } + void TearDown(){} +}; + +class WShinglingTokenMetricTest : public ::testing::Test { +protected: + std::unique_ptr wShinglingTokenMetric; + void SetUp(){ + wShinglingTokenMetric = std::make_unique (); + } + void TearDown(){} +}; + TEST_F(LivDistTextMetricTest, check_eq_progs) { @@ -90,6 +109,74 @@ TEST_F(JaccardTextMetricTest, test_with_empty_prog) { EXPECT_EQ(jaccardTextMetric->getMetric(), 0); } + + +TEST_F(LivDistTokenMetricTest, check_eq_progs) { + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {"b", "a", "c"}; + + livDistTokenMetric->setData(tokens1, tokens1); + livDistTokenMetric->countMetric(); + + EXPECT_EQ(livDistTokenMetric->getMetric(), 1); +} + +TEST_F(LivDistTokenMetricTest, check_absolutely_not_eq_progs) { + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {"d", "e", "f", "o"}; + + livDistTokenMetric->setData(tokens1, tokens1); + livDistTokenMetric->countMetric(); + + EXPECT_EQ(livDistTokenMetric->getMetric() < 0.5, true); +} + +TEST_F(LivDistTokenMetricTest, test_with_empty_prog) { + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {}; + + livDistTokenMetric->setData(tokens1, tokens1); + livDistTokenMetric->countMetric(); + + EXPECT_EQ(livDistTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, check_eq_progs){ + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {"b", "a", "c"}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->countMetric(); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 1); +} + +TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {"d", "e", "f", "o"}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->countMetric(); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { + + std::vector tokens1 = {"a", "b", "c"}; + std::vector tokens2 = {}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->countMetric(); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); -- GitLab From 32bbd267282a0f3f4db6289b43f149d18d817d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 10 May 2023 08:37:14 +0300 Subject: [PATCH 043/134] Add realizations of server --- server/internal/httpServer/CMakeLists.txt | 2 + .../httpServer/include/HttpConnection.h | 44 ++++---- .../internal/httpServer/include/HttpServer.h | 27 +++-- server/internal/httpServer/include/Parser.h | 57 ---------- server/internal/httpServer/include/Request.h | 17 --- server/internal/httpServer/include/Response.h | 38 ------- server/internal/httpServer/include/Router.h | 26 +++-- .../internal/httpServer/include/Serializer.h | 14 ++- .../httpServer/include/SolutionManager.h | 13 ++- .../internal/httpServer/include/TaskManager.h | 7 +- .../internal/httpServer/include/UserManager.h | 7 +- server/internal/httpServer/include/Utils.h | 8 ++ server/internal/httpServer/main.cpp | 48 ++++++++ .../httpServer/src/HttpConnection.cpp | 74 +++++++++++-- server/internal/httpServer/src/HttpServer.cpp | 60 ++++++++-- server/internal/httpServer/src/Parser.cpp | 17 --- server/internal/httpServer/src/Response.cpp | 5 - server/internal/httpServer/src/Router.cpp | 52 ++++++++- server/internal/httpServer/src/Serializer.cpp | 103 ++++++++++++++++++ .../httpServer/src/SolutionManager.cpp | 59 ++++++++-- .../internal/httpServer/src/TaskManager.cpp | 34 +++--- .../internal/httpServer/src/UserManager.cpp | 45 +++++--- server/internal/httpServer/src/Utils.cpp | 6 + .../httpServer/virtual/ISolutionManager.h | 13 +-- .../httpServer/virtual/ITaskManager.h | 11 +- .../httpServer/virtual/IUserManager.h | 11 +- .../repository/include/SolutionRepository.hpp | 2 +- .../repository/include/UserRepository.hpp | 2 +- .../service/include/SolutionService.h | 2 +- server/internal/service/include/TaskService.h | 2 +- server/internal/service/include/UserService.h | 4 +- .../internal/service/src/SolutionService.cpp | 7 +- server/internal/service/src/TaskService.cpp | 7 +- server/internal/service/src/UserService.cpp | 6 +- 34 files changed, 541 insertions(+), 289 deletions(-) delete mode 100644 server/internal/httpServer/include/Parser.h delete mode 100644 server/internal/httpServer/include/Request.h delete mode 100644 server/internal/httpServer/include/Response.h create mode 100644 server/internal/httpServer/include/Utils.h create mode 100644 server/internal/httpServer/main.cpp delete mode 100644 server/internal/httpServer/src/Parser.cpp delete mode 100644 server/internal/httpServer/src/Response.cpp create mode 100644 server/internal/httpServer/src/Serializer.cpp create mode 100644 server/internal/httpServer/src/Utils.cpp diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt index 871e221..f9227f4 100644 --- a/server/internal/httpServer/CMakeLists.txt +++ b/server/internal/httpServer/CMakeLists.txt @@ -8,11 +8,13 @@ file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURC include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libEntities_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) +add_executable(HttpServer_run main.cpp) message("SERVICE_lib_LIB = ${SERVICE_lib_LIB}") message("SERVICE_lib_INCLUDE_DIRS = ${SERVICE_lib_INCLUDE_DIRS}") target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIB} ${libEntities_LIB} ${Boost_LIBRARIES}) +target_link_libraries(HttpServer_run ${PROJECT_NAME} ${Boost_LIBRARIES}) set(HTTPSERVER_lib_LIB ${PROJECT_NAME}) set(HTTPSERVER_lib_LIB ${HTTPSERVER_lib_LIB} PARENT_SCOPE) diff --git a/server/internal/httpServer/include/HttpConnection.h b/server/internal/httpServer/include/HttpConnection.h index cee5f56..86d4bbb 100644 --- a/server/internal/httpServer/include/HttpConnection.h +++ b/server/internal/httpServer/include/HttpConnection.h @@ -1,33 +1,35 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ -#define APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ +#ifndef SOURCEDOUT_HTTPSERVER_HTTPCONNECTION_H +#define SOURCEDOUT_HTTPSERVER_HTTPCONNECTION_H #include #include +#include -#include "Response.h" -#include "Request.h" #include "Router.h" -#include "Parser.h" -class HttpConnection : public std::enable_shared_from_this, - private boost::noncopyable { +namespace beast = boost::beast; +namespace http = beast::http; +namespace net = boost::asio; +using tcp = boost::asio::ip::tcp; + +class HttpConnection : public std::enable_shared_from_this { public: - explicit HttpConnection(boost::asio::io_service& io_service); - boost::asio::ip::tcp::socket& getSocket(); - void start(); - protected: - void handleRead(const boost::system::error_code& e, - std::size_t bytes_transferred); - void handleWrite(const boost::system::error_code& e); + explicit HttpConnection(tcp::socket&& socket_, + std::shared_ptr const& doc_root_); + void run(); + void read(); + void handleRead(beast::error_code e, std::size_t bytes_transferred); + void sendResponse(http::message_generator&& msg); + void handleWrite(bool keep_alive, beast::error_code e, std::size_t bytes_transferred); + void close(); - boost::asio::io_service::strand strand; - boost::asio::ip::tcp::socket socket; + private: + beast::tcp_stream stream; + beast::flat_buffer buffer; + std::shared_ptr doc_root; + http::request request; std::shared_ptr router; - std::array buffer{}; - Request request; - Parser parser; - Response response; }; -#endif // APP_HTTPSERVER_HTTPSERVER_HTTPCONNECTION_H_ +#endif // SOURCEDOUT_HTTPSERVER_HTTPCONNECTION_H diff --git a/server/internal/httpServer/include/HttpServer.h b/server/internal/httpServer/include/HttpServer.h index 083d224..422a2c8 100644 --- a/server/internal/httpServer/include/HttpServer.h +++ b/server/internal/httpServer/include/HttpServer.h @@ -1,30 +1,29 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ -#define APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ +#ifndef SOURCEDOUT_HTTPSERVER_HTTPSERVER_H +#define SOURCEDOUT_HTTPSERVER_HTTPSERVER_H #include #include #include -#include -#include #include "HttpConnection.h" #include "Router.h" -class HttpServer : private boost::noncopyable { +namespace net = boost::asio; +using tcp = boost::asio::ip::tcp; + +class HttpServer : public std::enable_shared_from_this { public: - HttpServer(const std::string& address, const std::string& port, std::size_t thread_pool_size); + HttpServer(net::io_context& io_context_, tcp::endpoint endpoint_, + std::shared_ptr const& doc_root_); void run(); private: void startAccept(); - void handleAccept(const boost::system::error_code& e); - void handleStop(); + void handleAccept(beast::error_code ec, tcp::socket socket); - std::size_t thread_pool_size; - boost::asio::io_service io_service; - boost::asio::signal_set signals; - boost::asio::ip::tcp::acceptor acceptor; - std::shared_ptr connection; + net::io_context& io_context; + tcp::acceptor acceptor; + std::shared_ptr doc_root; }; -#endif // APP_HTTPSERVER_HTTPSERVER_HTTPSERVER_H_ +#endif // SOURCEDOUT_HTTPSERVER_HTTPSERVER_H diff --git a/server/internal/httpServer/include/Parser.h b/server/internal/httpServer/include/Parser.h deleted file mode 100644 index 142f234..0000000 --- a/server/internal/httpServer/include/Parser.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_PARSER_H_ -#define APP_HTTPSERVER_HTTPSERVER_PARSER_H_ - -#include "Request.h" - -#include -#include - -class Parser { - public: - Parser(); - void reset(); - - template - boost::tuple parse(Request& req, - InputIterator begin, InputIterator end) { - while (begin != end) { - boost::tribool result = consume(req, *begin++); - if (result || !result) - return boost::make_tuple(result, begin); - } - boost::tribool result = boost::indeterminate; - return boost::make_tuple(result, begin); - } - - private: - boost::tribool consume(Request& req, char input); - static bool isChar(int c); - static bool isCtl(int c); - static bool isTspecial(int c); - static bool isDigit(int c); - - enum state { - method_start, - method, - uri, - http_version_h, - http_version_t_1, - http_version_t_2, - http_version_p, - http_version_slash, - http_version_major_start, - http_version_major, - http_version_minor_start, - http_version_minor, - expecting_newline_1, - header_line_start, - header_lws, - header_name, - space_before_header_value, - header_value, - expecting_newline_2, - expecting_newline_3 - } state; -}; - -#endif // APP_HTTPSERVER_HTTPSERVER_PARSER_H_ diff --git a/server/internal/httpServer/include/Request.h b/server/internal/httpServer/include/Request.h deleted file mode 100644 index 386f9b3..0000000 --- a/server/internal/httpServer/include/Request.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ -#define APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ - -#include -#include - -#include "Header.h" - -struct Request { - std::string method; - std::string uri; - int http_version_major; - int http_version_minor; - std::vector
headers; -}; - -#endif // APP_HTTPSERVER_HTTPSERVER_REQUEST_H_ diff --git a/server/internal/httpServer/include/Response.h b/server/internal/httpServer/include/Response.h deleted file mode 100644 index 6dd3a1d..0000000 --- a/server/internal/httpServer/include/Response.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_REPLY_H_ -#define APP_HTTPSERVER_HTTPSERVER_REPLY_H_ - -#include -#include -#include - -#include "Header.h" - -struct Response { - enum status_type { - ok = 200, - created = 201, - accepted = 202, - no_content = 204, - multiple_choices = 300, - moved_permanently = 301, - moved_temporarily = 302, - not_modified = 304, - bad_request = 400, - unauthorized = 401, - forbidden = 403, - not_found = 404, - internal_server_error = 500, - not_implemented = 501, - bad_gateway = 502, - service_unavailable = 503 - } status; - - std::vector
headers; - std::string content; - - std::vector toBuffers(); - static Response stockResponse(status_type status); -}; - - -#endif // APP_HTTPSERVER_HTTPSERVER_REPLY_H_ diff --git a/server/internal/httpServer/include/Router.h b/server/internal/httpServer/include/Router.h index 50267ea..404b44d 100644 --- a/server/internal/httpServer/include/Router.h +++ b/server/internal/httpServer/include/Router.h @@ -1,20 +1,25 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ -#define APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ +#ifndef SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H +#define SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H #include #include #include +#include #include "SolutionManager.h" #include "UserManager.h" #include "TaskManager.h" -#include "Response.h" -#include "Request.h" -class Router : private boost::noncopyable { +namespace beast = boost::beast; +namespace http = beast::http; +namespace net = boost::asio; + +class Router : public std::enable_shared_from_this { public: - Router(); - void handleRequest(const Request& req, Response& res); + explicit Router(std::string_view doc_root_); + + http::message_generator handleRequest(http::request&& req); + void setSolutionManager(std::shared_ptr mng) { solutionManager = mng; } @@ -28,8 +33,11 @@ class Router : private boost::noncopyable { std::shared_ptr solutionManager; std::shared_ptr userManager; std::shared_ptr taskManager; - static bool decodeUrl(const std::string& in, std::string& out); + std::string doc_root; + + http::response getBadRequest(const http::request& request, + beast::string_view why); }; -#endif // APP_HTTPSERVER_HTTPSERVER_ROUTER_H_ +#endif // SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index a8a68be..34cb67a 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -7,8 +7,20 @@ #include "Solution.hpp" #include "User.hpp" +#include "Task.hpp" -class Serializer {}; +class Serializer { +public: + std::tuple deserialNewSolutionData(const std::string& val); + std::tuple deserialTaskData(const std::string &val); + std::string deserialNewTaskData(const std::string &val); + size_t deserialSolutionData(const std::string& val); + std::tuple deserialUserData(const std::string& val); + std::tuple deserialNewUserData(const std::string &val); + + std::string serialSolutions(const std::vector& solutions); + std::string serialAllTasks(const std::vector& tasks); +}; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ diff --git a/server/internal/httpServer/include/SolutionManager.h b/server/internal/httpServer/include/SolutionManager.h index 5a11065..2c69a61 100644 --- a/server/internal/httpServer/include/SolutionManager.h +++ b/server/internal/httpServer/include/SolutionManager.h @@ -3,25 +3,26 @@ #include #include +#include -#include "Response.h" -#include "Request.h" #include "Serializer.h" #include "ISolutionManager.h" #include "ISolutionService.h" +namespace beast = boost::beast; +namespace http = boost::beast::http; + class SolutionManager : public ISolutionManager { public: SolutionManager(); - Response getAllSolutions(const Request &req) override; - Response createSolution(const Request &req) override; - Response getMetrics(const Request &req) override; + http::message_generator getAllSolutions(http::request&& req) override; + http::message_generator createSolution(http::request&& req) override; + http::message_generator getMetrics(http::request&& req) override; void setService(std::shared_ptr service); private: std::shared_ptr solutionService; std::shared_ptr serializer; - static std::string getParam(const std::string& path, const std::string& name); }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ diff --git a/server/internal/httpServer/include/TaskManager.h b/server/internal/httpServer/include/TaskManager.h index c49b08b..3adecd4 100644 --- a/server/internal/httpServer/include/TaskManager.h +++ b/server/internal/httpServer/include/TaskManager.h @@ -4,8 +4,6 @@ #include #include -#include "Response.h" -#include "Request.h" #include "Serializer.h" #include "ITaskManager.h" #include "ITaskService.h" @@ -13,13 +11,12 @@ class TaskManager : public ITaskManager { public: TaskManager(); - Response createTask(const Request &req) override; - Response getAllTasks(const Request &req) override; + http::message_generator createTask(http::request&& req) override; + http::message_generator getAllTasks(http::request&& req) override; void setService(std::shared_ptr service); private: std::shared_ptr taskService; std::shared_ptr serializer; - static std::string getParam(const std::string& path, const std::string& name); }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ diff --git a/server/internal/httpServer/include/UserManager.h b/server/internal/httpServer/include/UserManager.h index 9043ada..01a16de 100644 --- a/server/internal/httpServer/include/UserManager.h +++ b/server/internal/httpServer/include/UserManager.h @@ -4,8 +4,6 @@ #include #include -#include "Response.h" -#include "Request.h" #include "Serializer.h" #include "IUserManager.h" #include "IUserService.h" @@ -13,13 +11,12 @@ class UserManager : public IUserManager { public: UserManager(); - Response loginUser(const Request &req) override; - Response registerUser(const Request &req) override; + http::message_generator loginUser(http::request&& req) override; + http::message_generator registerUser(http::request&& req) override; void setService(std::shared_ptr service); private: std::shared_ptr userService; std::shared_ptr serializer; - static std::string getParam(const std::string& path, const std::string& name); }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ diff --git a/server/internal/httpServer/include/Utils.h b/server/internal/httpServer/include/Utils.h new file mode 100644 index 0000000..8311dc7 --- /dev/null +++ b/server/internal/httpServer/include/Utils.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include + +namespace beast = boost::beast; + +void fail(beast::error_code ec, char const* what); diff --git a/server/internal/httpServer/main.cpp b/server/internal/httpServer/main.cpp new file mode 100644 index 0000000..8d48c12 --- /dev/null +++ b/server/internal/httpServer/main.cpp @@ -0,0 +1,48 @@ +#include + +#include + +#include "HttpServer.h" + +namespace net = boost::asio; +using tcp = boost::asio::ip::tcp; + +int main(int argc, char* argv[]) +{ + // Check command line arguments. + if (argc != 5) + { + std::cerr << + "Usage: http-server-async
\n" << + "Example:\n" << + " http-server-async 0.0.0.0 8080 . 1\n"; + return EXIT_FAILURE; + } + auto const address = net::ip::make_address(argv[1]); + auto const port = static_cast(std::atoi(argv[2])); + auto const doc_root = std::make_shared(argv[3]); + auto const threads = std::max(1, std::atoi(argv[4])); + + // The io_context is required for all I/O + net::io_context ioc{threads}; + + // Create and launch a listening port + std::make_shared( + ioc, + tcp::endpoint{address, port}, + doc_root + )->run(); + + // Run the I/O service on the requested number of threads + std::vector v; + v.reserve(threads - 1); + for(auto i = threads - 1; i > 0; --i) + v.emplace_back( + [&ioc] + { + ioc.run(); + }); + ioc.run(); + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/server/internal/httpServer/src/HttpConnection.cpp b/server/internal/httpServer/src/HttpConnection.cpp index 412f670..084d91a 100644 --- a/server/internal/httpServer/src/HttpConnection.cpp +++ b/server/internal/httpServer/src/HttpConnection.cpp @@ -2,15 +2,73 @@ #include -HttpConnection::HttpConnection(boost::asio::io_service& io_service) - : strand(io_service), - socket(io_service) {} +#include "Utils.h" -boost::asio::ip::tcp::socket& HttpConnection::getSocket() {} +HttpConnection::HttpConnection(tcp::socket&& socket_, + std::shared_ptr const& doc_root_) + : stream(std::move(socket_)), doc_root(doc_root_) { + router = std::make_shared(*doc_root_); +} -void HttpConnection::start() {} +void HttpConnection::run() { + net::dispatch(stream.get_executor(), + beast::bind_front_handler(&HttpConnection::read, shared_from_this()) + ); +} -void HttpConnection::handleRead(const boost::system::error_code& e, - std::size_t bytes_transferred) {} +void HttpConnection::read() { + request = {}; + stream.expires_after(std::chrono::seconds(30)); + http::async_read(stream, buffer, request, + beast::bind_front_handler( + &HttpConnection::handleRead, + shared_from_this() + ) + ); +} -void HttpConnection::handleWrite(const boost::system::error_code& e) {} +void HttpConnection::handleRead(beast::error_code e, std::size_t bytes_transferred) { + boost::ignore_unused(bytes_transferred); + + if(e == http::error::end_of_stream) + return close(); + + if(e) + return fail(e, "read"); + + sendResponse( + router->handleRequest(std::move(request)) + ); +} + +void HttpConnection::sendResponse(http::message_generator &&msg) { + bool keep_alive = msg.keep_alive(); + + beast::async_write( + stream, + std::move(msg), + beast::bind_front_handler( + &HttpConnection::handleWrite, + shared_from_this(), + keep_alive + ) + ); +} + +void HttpConnection::handleWrite(bool keep_alive, beast::error_code e, std::size_t bytes_transferred) { + boost::ignore_unused(bytes_transferred); + + if(e) + return fail(e, "write"); + + if(!keep_alive) { + return close(); + } + + read(); +} + +void HttpConnection::close() { + beast::error_code e; + stream.socket().shutdown(tcp::socket::shutdown_send, e); +} \ No newline at end of file diff --git a/server/internal/httpServer/src/HttpServer.cpp b/server/internal/httpServer/src/HttpServer.cpp index 246b4f0..e00df2a 100644 --- a/server/internal/httpServer/src/HttpServer.cpp +++ b/server/internal/httpServer/src/HttpServer.cpp @@ -1,20 +1,58 @@ #include "HttpServer.h" #include -#include #include -#include -HttpServer::HttpServer(const std::string& address, const std::string& port, std::size_t thread_pool_size) - : thread_pool_size(thread_pool_size), - signals(io_service), - acceptor(io_service), - connection() {} +#include "Utils.h" -void HttpServer::run() {} +HttpServer::HttpServer(net::io_context& io_context_, tcp::endpoint endpoint_, + std::shared_ptr const& doc_root_) + : io_context(io_context_), acceptor(net::make_strand(io_context_)), doc_root(doc_root_) { -void HttpServer::startAccept() {} + beast::error_code ec; + acceptor.open(endpoint_.protocol(), ec); + if(ec) { + fail(ec, "open"); + return; + } -void HttpServer::handleAccept(const boost::system::error_code& e) {} + acceptor.set_option(net::socket_base::reuse_address(true), ec); + if(ec) { + fail(ec, "set_option"); + return; + } -void HttpServer::handleStop() {} + acceptor.bind(endpoint_, ec); + if(ec) { + fail(ec, "bind"); + return; + } + + acceptor.listen(net::socket_base::max_listen_connections, ec); + if(ec) { + fail(ec, "listen"); + return; + } +} + +void HttpServer::run() { + startAccept(); +} + +void HttpServer::startAccept() { + acceptor.async_accept( + net::make_strand(io_context), + beast::bind_front_handler(&HttpServer::handleAccept, shared_from_this()) + ); +} + +void HttpServer::handleAccept(beast::error_code ec, tcp::socket socket) { + if(ec) { + fail(ec, "accept"); + return; + } else { + std::make_shared(std::move(socket), doc_root)->run(); + } + + startAccept(); +} \ No newline at end of file diff --git a/server/internal/httpServer/src/Parser.cpp b/server/internal/httpServer/src/Parser.cpp deleted file mode 100644 index 86b9541..0000000 --- a/server/internal/httpServer/src/Parser.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "Parser.h" -#include "Request.h" - -Parser::Parser() - : state(method_start) {} - -void Parser::reset() {} - -boost::tribool Parser::consume(Request& req, char input) {} - -bool Parser::isChar(int c) {} - -bool Parser::isCtl(int c) {} - -bool Parser::isTspecial(int c) {} - -bool Parser::isDigit(int c) {} diff --git a/server/internal/httpServer/src/Response.cpp b/server/internal/httpServer/src/Response.cpp deleted file mode 100644 index f688c34..0000000 --- a/server/internal/httpServer/src/Response.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "Response.h" - -std::vector Response::toBuffers() {} - -Response Response::stockResponse(Response::status_type status) {} diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index e235dee..59b5791 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -2,14 +2,54 @@ #include #include -#include -#include "Response.h" +#include "Utils.h" -Router::Router() : +http::response Router::getBadRequest(const http::request& request, + beast::string_view why) { + http::response res{http::status::bad_request, request.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(request.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; +} + +Router::Router(std::string_view doc_root_) : solutionManager(std::make_shared()), - userManager(std::make_shared()) {} + userManager(std::make_shared()), + taskManager(std::make_shared()), + doc_root(doc_root_) {} + + +http::message_generator Router::handleRequest(http::request &&req) { + + if(req.method() != http::verb::get && req.method() != http::verb::post) + return getBadRequest(req, "Unknown HTTP-method"); + + if(req.target().empty() || req.target()[0] != '/' || + req.target().find("..") != beast::string_view::npos) { + return getBadRequest(req, "Illegal request-target"); + } + + std::cout << req.target() << std::endl; -void Router::handleRequest(const Request& req, Response& res) {} + if (req.target() == "/solution/submit") { + return solutionManager->createSolution(std::move(req)); + } else if (req.target() == "/solution/metrics") { + return solutionManager->getMetrics(std::move(req)); + } else if (req.target() == "/solution/all") { + return solutionManager->getAllSolutions(std::move(req)); + } else if (req.target() == "/user/register") { + return userManager->registerUser(std::move(req)); + } else if (req.target() == "/user/login") { + return userManager->loginUser(std::move(req)); + } else if (req.target() == "/task/create") { + return taskManager->createTask(std::move(req)); + } else if (req.target() == "/task/all") { + return taskManager->getAllTasks(std::move(req)); + } -bool Router::decodeUrl(const std::string& in, std::string& out) {} + return getBadRequest(req, "Unknown request-target"); +} \ No newline at end of file diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp new file mode 100644 index 0000000..8d2569a --- /dev/null +++ b/server/internal/httpServer/src/Serializer.cpp @@ -0,0 +1,103 @@ +#include "Serializer.h" + +#include +#include +#include + +std::tuple Serializer::deserialNewSolutionData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + std::tuple res = { + json.get("user_id"), + json.get("source"), + json.get("task_id") + }; + return res; +} + +size_t Serializer::deserialSolutionData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + return json.get("sol_id"); +} + +std::tuple Serializer::deserialTaskData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + std::tuple res = { + json.get("user_id"), + json.get("task_id") + }; + return res; +} + +std::string Serializer::deserialNewTaskData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + return json.get("description"); +} + +std::tuple Serializer::deserialUserData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + std::tuple res = { + json.get("login"), + json.get("password") + }; + return res; +} + +std::tuple Serializer::deserialNewUserData(const std::string &val) { + std::stringstream ss; + ss << val; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + std::tuple res = { + json.get("login"), + json.get("password"), + json.get("username") + }; + return res; +} + +std::string Serializer::serialSolutions(const std::vector &solutions) { + boost::property_tree::ptree json; + json.put("count", solutions.size()); + boost::property_tree::ptree solutions_nodes; + for (auto &i : solutions) { + boost::property_tree::ptree node; + node.put("sol_id", i.getId()); + node.put("task_id", i.getTaskId()); + solutions_nodes.push_back(std::make_pair("", node)); + } + json.add_child("solutions", solutions_nodes); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} + +std::string Serializer::serialAllTasks(const std::vector &tasks) { + boost::property_tree::ptree json; + json.put("count", tasks.size()); + boost::property_tree::ptree tasks_nodes; + for (auto &i : tasks) { + boost::property_tree::ptree node; + node.put("task_id", i.getId()); + node.put("description", i.getDescription()); + tasks_nodes.push_back(std::make_pair("", node)); + } + json.add_child("tasks", tasks_nodes); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 3a93e41..e83c027 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -3,24 +3,59 @@ // #include "SolutionManager.h" -SolutionManager::SolutionManager() {} +#include -Response SolutionManager::getAllSolutions(const Request &req) { - return Response(); -} +SolutionManager::SolutionManager() : + serializer(std::make_shared()) {}; -Response SolutionManager::createSolution(const Request &req) { - return Response(); +void SolutionManager::setService(std::shared_ptr service) { + solutionService = std::move(service); } -Response SolutionManager::getMetrics(const Request &req) { - return Response(); +http::message_generator SolutionManager::createSolution(http::request&& req) { + + size_t user_id, task_id; + std::string source; + std::tie(user_id, source, task_id) = serializer->deserialNewSolutionData(req.body()); + Solution sol; + sol = solutionService->createSolution(user_id, task_id, source); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = std::to_string(sol.getId()); + res.prepare_payload(); + return res; } -std::string SolutionManager::getParam(const std::string &path, const std::string &name) { - return std::string(); +http::message_generator SolutionManager::getAllSolutions(http::request&& req) { + size_t user_id, task_id; + std::tie(user_id, task_id) = serializer->deserialTaskData(req.body()); + std::vector solutions; + solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialSolutions(solutions); + res.prepare_payload(); + return res; + } -void SolutionManager::setService(std::shared_ptr service) { - solutionService = service; +http::message_generator SolutionManager::getMetrics(http::request&& req) { + auto const bad_request = + [&req](beast::string_view why) + { + http::response res{http::status::bad_request, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; + }; + + return bad_request("123"); } + diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index ca3875d..2b45867 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -3,22 +3,30 @@ // #include "TaskManager.h" -TaskManager::TaskManager() { +TaskManager::TaskManager() : serializer(std::make_shared()) {} +void TaskManager::setService(std::shared_ptr service) { + taskService = service; } -Response TaskManager::createTask(const Request &req) { - return Response(); -} - -Response TaskManager::getAllTasks(const Request &req) { - return Response(); -} - -std::string TaskManager::getParam(const std::string &path, const std::string &name) { - return std::string(); +http::message_generator TaskManager::createTask(http::request &&req) { + std::string description = serializer->deserialNewTaskData(req.body()); + taskService->createTask(description); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.prepare_payload(); + return res; } -void TaskManager::setService(std::shared_ptr service) { - taskService = service; +http::message_generator TaskManager::getAllTasks(http::request &&req) { + std::vector tasks = taskService->getAllTasks(); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialAllTasks(tasks); + res.prepare_payload(); + return res; } diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index 4137716..4048afd 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -1,24 +1,41 @@ -// -// Created by Николай Степанов on 03.05.2023. -// #include "UserManager.h" -UserManager::UserManager() { +UserManager::UserManager() : serializer(std::make_shared()) {} +void UserManager::setService(std::shared_ptr service) { + userService = service; } -Response UserManager::loginUser(const Request &req) { - return Response(); -} +http::message_generator UserManager::loginUser(http::request &&req) { -Response UserManager::registerUser(const Request &req) { - return Response(); -} + std::string login, password; + std::tie(login, password) = serializer->deserialUserData(req.body()); + /// TODO -std::string UserManager::getParam(const std::string &path, const std::string &name) { - return std::string(); + auto const bad_request = + [&req](beast::string_view why) + { + http::response res{http::status::bad_request, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/html"); + res.keep_alive(req.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; + }; + + return bad_request("123"); } -void UserManager::setService(std::shared_ptr service) { - userService = service; +http::message_generator UserManager::registerUser(http::request &&req) { + std::string login, password, username; + std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); + User user = userService->createUser(login, username, password); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = std::to_string(user.getId()); + res.prepare_payload(); + return res; } diff --git a/server/internal/httpServer/src/Utils.cpp b/server/internal/httpServer/src/Utils.cpp new file mode 100644 index 0000000..416b658 --- /dev/null +++ b/server/internal/httpServer/src/Utils.cpp @@ -0,0 +1,6 @@ +#include "Utils.h" + + +void fail(beast::error_code ec, const char *what) { + std::cerr << what << ": " << ec.message() << "\n"; +} diff --git a/server/internal/httpServer/virtual/ISolutionManager.h b/server/internal/httpServer/virtual/ISolutionManager.h index cd77215..ab86bc6 100644 --- a/server/internal/httpServer/virtual/ISolutionManager.h +++ b/server/internal/httpServer/virtual/ISolutionManager.h @@ -1,17 +1,16 @@ #ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ #define APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ -#include -#include +#include -#include "Response.h" -#include "Request.h" +namespace beast = boost::beast; +namespace http = boost::beast::http; class ISolutionManager { public: - virtual Response getAllSolutions(const Request &req) = 0; - virtual Response createSolution(const Request &req) = 0; - virtual Response getMetrics(const Request &req) = 0; + virtual http::message_generator getAllSolutions(http::request&& req) = 0; + virtual http::message_generator createSolution(http::request&& req) = 0; + virtual http::message_generator getMetrics(http::request&& req) = 0; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ diff --git a/server/internal/httpServer/virtual/ITaskManager.h b/server/internal/httpServer/virtual/ITaskManager.h index 11747f7..260e2a0 100644 --- a/server/internal/httpServer/virtual/ITaskManager.h +++ b/server/internal/httpServer/virtual/ITaskManager.h @@ -4,14 +4,15 @@ #include #include -#include "Response.h" -#include "Request.h" -#include "Serializer.h" +#include + +namespace beast = boost::beast; +namespace http = boost::beast::http; class ITaskManager { public: - virtual Response createTask(const Request &req) = 0; - virtual Response getAllTasks(const Request &req) = 0; + virtual http::message_generator createTask(http::request&& req) = 0; + virtual http::message_generator getAllTasks(http::request&& req) = 0; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ diff --git a/server/internal/httpServer/virtual/IUserManager.h b/server/internal/httpServer/virtual/IUserManager.h index 599a8ec..913e4e8 100644 --- a/server/internal/httpServer/virtual/IUserManager.h +++ b/server/internal/httpServer/virtual/IUserManager.h @@ -4,14 +4,15 @@ #include #include -#include "Response.h" -#include "Request.h" -#include "Serializer.h" +#include + +namespace beast = boost::beast; +namespace http = boost::beast::http; class IUserManager { public: - virtual Response loginUser(const Request &req) = 0; - virtual Response registerUser(const Request &req) = 0; + virtual http::message_generator loginUser(http::request&& req) = 0; + virtual http::message_generator registerUser(http::request&& req) = 0; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 04034d5..e7fb74f 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -10,7 +10,7 @@ using namespace pqxx; -class SolutionRepository : ISolutionRepository { +class SolutionRepository : public ISolutionRepository { Solution getSolutionById(size_t id) override; std::vector getSolutionsBySenderId(size_t sender_id) override; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index a8bd86d..7b67746 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -9,7 +9,7 @@ #include using namespace pqxx; -class UserRepository : IUserRepository { +class UserRepository : public IUserRepository { public: explicit UserRepository(); diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 86e432b..2ebcf72 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -10,7 +10,7 @@ class SolutionService : ISolutionService { std::unique_ptr solutionRepo; // std::unique_ptr antlr public: - explicit SolutionService(std::unique_ptr solutionRepo); + explicit SolutionService(); Solution createSolution(size_t userId, size_t taskId, std::string source) override; std::vector getSolutionsByUserAndTaskId(size_t userId, diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index bf04d3e..d2f67b9 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -10,7 +10,7 @@ class TaskService : public ITaskService { std::unique_ptr taskRepo; public: - TaskService(std::unique_ptr taskRepo); + TaskService(); ~TaskService() override = default; Task createTask(std::string desc) override; Task getTask(size_t id) override; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 719aa02..e5865c3 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -7,11 +7,11 @@ class UserService : IUserService { private: - std::unique_ptr userRepo; + std::unique_ptr userRepo = std::make_unique(); public: ~UserService() override = default; - explicit UserService(std::unique_ptr userRepo); + explicit UserService(); User createUser(std::string login, std::string username, std::string password) override; User getUserById(size_t id) override; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index ba707c3..7e3701a 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -1,8 +1,9 @@ #include "SolutionService.h" -SolutionService::SolutionService( - std::unique_ptr solutionRepo) - : solutionRepo(std::move(solutionRepo)) {} +#include "SolutionRepository.hpp" + +SolutionService::SolutionService() + : solutionRepo(std::make_unique()) {} Solution SolutionService::createSolution(size_t userId, size_t taskId, std::string source) { diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index a3ce5ef..d083a79 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -1,7 +1,10 @@ #include "TaskService.h" -TaskService::TaskService(std::unique_ptr taskRepo) - : taskRepo(std::move(taskRepo)) {} +#include "TaskRepository.hpp" + +TaskService::TaskService() + : taskRepo(std::make_unique()) { +} Task TaskService::createTask(std::string desc) { size_t id = taskRepo->storeTask(Task(desc)); diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index 270f801..c2cfa72 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -1,9 +1,11 @@ #include "UserService.h" #include "Exeptions.h" +#include "UserRepository.hpp" -UserService::UserService(std::unique_ptr userRepo) - : userRepo(std::move(userRepo)) {} +UserService::UserService() + : userRepo(std::make_unique()) { +} User UserService::createUser(std::string login, std::string username, std::string password) { -- GitLab From e9e0233c06bdfd142e83074784dbf3404baecf22 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 10 May 2023 21:48:56 +0300 Subject: [PATCH 044/134] add realization for user and task service --- server/internal/entities/include/Task.hpp | 2 + server/internal/entities/include/User.hpp | 2 + server/internal/entities/src/Task.cpp | 4 ++ server/internal/entities/src/User.cpp | 4 ++ .../virtual/ISolutionRepository.hpp | 1 + .../repository/virtual/ITaskRepository.hpp | 3 ++ .../service/include/SolutionService.h | 8 ++-- server/internal/service/include/TaskService.h | 3 +- server/internal/service/include/UserService.h | 5 ++- .../internal/service/include/UserValidator.h | 11 ++--- .../internal/service/src/SolutionService.cpp | 7 +++- server/internal/service/src/TaskService.cpp | 41 ++++++++++++++++--- server/internal/service/src/UserService.cpp | 40 ++++++++++++++---- server/internal/service/src/UserValidator.cpp | 20 ++++----- .../service/tests/TaskServiceTest.cpp | 5 ++- .../service/tests/UserServiceTest.cpp | 12 +++--- .../service/tests/UserValidatorTest.cpp | 15 +++---- .../service/virtual/ISolutionService.h | 2 +- .../internal/service/virtual/ITaskService.h | 2 +- .../internal/service/virtual/IUserService.h | 4 +- 20 files changed, 130 insertions(+), 61 deletions(-) diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index 6ad362f..e935e9a 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -16,6 +16,8 @@ public: [[nodiscard]] size_t getId() const; + void setId(size_t id); + [[nodiscard]] const std::string &getDescription() const; void setDescription(const std::string &description); diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index a597e69..bfca6e4 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -22,6 +22,8 @@ public: void setLogin(const std::string &login); + void setId(size_t id_); + [[nodiscard]] const std::string &getPassword() const; void setPassword(const std::string &password); diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index 99e0fe6..c7d252d 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -8,6 +8,10 @@ unsigned long Task::getId() const { return id; } +void Task::setId(size_t id_) { + id=id_; +} + Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} Task::Task(std::string description) : id(0), description(std::move(description)) {} diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index c048f8f..d31abba 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -41,3 +41,7 @@ std::ostream &operator<<(std::ostream &os, const User &user) { << user.username; return os; } + +void User::setId(size_t id_) { + id=id_; +} diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 8a7b035..3dfd3d9 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -13,6 +13,7 @@ class ISolutionRepository { virtual std::vector getSolutionsBySenderId(size_t sender_id) = 0; virtual std::vector getSolutions(size_t sender_id, size_t task_id) = 0; + virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; virtual size_t storeSolution(Solution solution) = 0; diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index e367c21..c8a3588 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -2,6 +2,7 @@ #define SOURCEDOUT_ITASKREPOSITORY_HPP #include +#include #include "../../entities/include/Task.hpp" class ITaskRepository { @@ -9,6 +10,8 @@ class ITaskRepository { virtual ~ITaskRepository() = default; virtual Task getTaskById(size_t id) = 0; + virtual std::vector getAllTasks() = 0; + virtual void updateTask(Task task) = 0; virtual int storeTask(Task task) = 0; diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 04ac2d8..c089d6d 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -2,22 +2,24 @@ #include -#include "ISolutionRepository.hpp" -#include "ISolutionService.h" #include "IAntlrWrapper.h" #include "IMockMetrics.h" +#include "ISolutionRepository.hpp" +#include "ISolutionService.h" class SolutionService : ISolutionService { private: std::unique_ptr solutionRepo; std::unique_ptr antlr; std::unique_ptr metrics; + public: explicit SolutionService(std::unique_ptr solutionRepo); + SolutionService(); void setAntlrWrapper(std::unique_ptr antlr_); void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, - std::string source) override; + const std::string& source) override; std::vector getSolutionsByUserAndTaskId(size_t userId, size_t taskId) override; void deleteSolutionById(size_t solId) override; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index bf04d3e..400c01b 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -11,8 +11,9 @@ class TaskService : public ITaskService { public: TaskService(std::unique_ptr taskRepo); + TaskService(); ~TaskService() override = default; - Task createTask(std::string desc) override; + Task createTask(const std::string& desc) override; Task getTask(size_t id) override; std::vector getAllTasks() override; void deleteTask(size_t id) override; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 719aa02..2a5a9fe 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -12,8 +12,9 @@ class UserService : IUserService { public: ~UserService() override = default; explicit UserService(std::unique_ptr userRepo); - User createUser(std::string login, std::string username, - std::string password) override; + UserService(); + User createUser(const std::string& login, const std::string& username, + const std::string& password) override; User getUserById(size_t id) override; void deleteUser(size_t id) override; }; diff --git a/server/internal/service/include/UserValidator.h b/server/internal/service/include/UserValidator.h index 002f450..34459b6 100644 --- a/server/internal/service/include/UserValidator.h +++ b/server/internal/service/include/UserValidator.h @@ -4,13 +4,10 @@ class UserValidator { private: - User user; - bool validateLogin(); - bool validatePassword(); - bool validateUsername(); + static bool validateLogin(const std::string& login); + static bool validatePassword(const std::string& password); + static bool validateUsername(const std::string& username); public: - explicit UserValidator(User user); - bool validateUser(); - ~UserValidator() = default; + static bool validate(const User& user); }; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 485f86b..91c0cc6 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -4,8 +4,13 @@ SolutionService::SolutionService( std::unique_ptr solutionRepo) : solutionRepo(std::move(solutionRepo)) {} +SolutionService::SolutionService(){ + //solutionRepo=std::make_unique(); +} + Solution SolutionService::createSolution(size_t userId, size_t taskId, - std::string source) { + const std::string& source) { + //antlr = std::make_unique< size_t id = solutionRepo->storeSolution( Solution(0, "", userId, source, "metrics1", "metrics2", taskId, "")); return Solution(id, "", userId, source, "", "", taskId, ""); diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index a3ce5ef..3d2a4bb 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -3,13 +3,42 @@ TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(std::move(taskRepo)) {} -Task TaskService::createTask(std::string desc) { - size_t id = taskRepo->storeTask(Task(desc)); - return Task(id, desc); +TaskService::TaskService() { + // TODO: раскоментировать, когда будет реализация + // taskRepo = std::make_unique(); +} + +Task TaskService::createTask(const std::string& desc) { + try { + Task task = Task(desc); + size_t id = taskRepo->storeTask(Task(desc)); + task.setId(id); + return task; + } catch (std::exception& e) { + throw e; + } } -std::vector TaskService::getAllTasks() { return std::vector(); } +std::vector TaskService::getAllTasks() { + try { + return taskRepo->getAllTasks(); + } catch (std::exception& e) { + throw e; + } +} -Task TaskService::getTask(size_t id) { return taskRepo->getTaskById(id); } +Task TaskService::getTask(size_t id) { + try { + return taskRepo->getTaskById(id); + } catch (std::exception& e) { + throw e; + } +} -void TaskService::deleteTask(size_t id) { taskRepo->deleteTaskById(id); } +void TaskService::deleteTask(size_t id) { + try { + taskRepo->deleteTaskById(id); + } catch (std::exception& e) { + throw e; + } +} diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index b44ecf3..b695cef 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -1,19 +1,43 @@ #include "UserService.h" #include "Exceptions.h" +#include "UserValidator.h" UserService::UserService(std::unique_ptr userRepo) : userRepo(std::move(userRepo)) {} -User UserService::createUser(std::string login, std::string username, - std::string password) { - if (login == "") { - throw ValidateException("invalid login"); +UserService::UserService() { + // TODO: раскоментировать, когда будет реализация + // userRepo = std::make_unique(); +} + +User UserService::createUser(const std::string& login, const std::string& username, + const std::string& password) { + User user = User(login, password, username); + if (!UserValidator::validate(user)) { + throw ValidateException("invalid user params"); + } + try { + size_t id = userRepo->makeUser(user); + user.setId(id); + return user; + } catch (std::exception& e) { + throw e; } - size_t id = userRepo->makeUser(User(login, password, username)); - return User(id, login, password, username); } -User UserService::getUserById(size_t id) { return userRepo->getUserById(id); } +User UserService::getUserById(size_t id) { + try { + return userRepo->getUserById(id); + } catch (std::exception& e) { + throw e; + } +} -void UserService::deleteUser(size_t id) { userRepo->deleteByUserId(id); } +void UserService::deleteUser(size_t id) { + try { + userRepo->deleteByUserId(id); + } catch (std::exception& e) { + throw e; + } +} diff --git a/server/internal/service/src/UserValidator.cpp b/server/internal/service/src/UserValidator.cpp index 6666641..b653fc9 100644 --- a/server/internal/service/src/UserValidator.cpp +++ b/server/internal/service/src/UserValidator.cpp @@ -1,34 +1,32 @@ #include "UserValidator.h" #include +#include -UserValidator::UserValidator(User user) : user(user) {} - -bool UserValidator::validateUser() { - if (validateLogin() && validatePassword() && validateUsername()) { +bool UserValidator::validate(const User& user) { + if (validateLogin(user.getLogin()) && validatePassword(user.getPassword()) && + validateUsername(user.getUsername())) { return true; } return false; } -bool UserValidator::validateLogin() { - std::string login = user.getLogin(); +bool UserValidator::validateLogin(const std::string& login) { if (login.length() < 3 || login.length() > 30) { return false; } - return true; + const std::regex pattern("(\\w+)@(\\w+)(\\.(\\w+))+"); + return std::regex_match(login, pattern); } -bool UserValidator::validatePassword() { - std::string password = user.getPassword(); +bool UserValidator::validatePassword(const std::string& password) { if (password.length() < 8 || password.length() > 30) { return false; } return true; } -bool UserValidator::validateUsername() { - std::string username = user.getUsername(); +bool UserValidator::validateUsername(const std::string& username) { if (username.length() < 3 || username.length() > 20) { return false; } diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp index 5a450d2..3067995 100644 --- a/server/internal/service/tests/TaskServiceTest.cpp +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -21,6 +21,7 @@ class TaskRepositoryMock : public ITaskRepository { MOCK_METHOD(int, storeTask, (Task task), (override)); MOCK_METHOD(void, deleteTask, (Task task), (override)); MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks,(),(override)); }; struct TaskServiceTest : public testing::Test { @@ -46,7 +47,7 @@ TEST_F(TaskServiceTest, deleteTasWithInvalidId) { EXPECT_CALL(*mock_ptr, deleteTaskById(1)) .Times(1) .WillRepeatedly(NoTaskException()); - EXPECT_THROW(ts->deleteTask(1), Exception); + EXPECT_THROW(ts->deleteTask(1), std::exception); } TEST_F(TaskServiceTest, GetTaskByIdOK) { @@ -62,7 +63,7 @@ TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { EXPECT_CALL(*mock_ptr, getTaskById(-1)) .Times(1) .WillRepeatedly(NoTaskException()); - EXPECT_THROW(ts->getTask(-1), Exception); + EXPECT_THROW(ts->getTask(-1), std::exception); } TEST_F(TaskServiceTest, CreateTask) { diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index a742351..6c3344f 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -48,7 +48,7 @@ TEST_F(UserServiceTest, deleteUserWithInvalidId) { EXPECT_CALL(*mock_ptr, deleteByUserId(1)) .Times(1) .WillRepeatedly(NoUserException()); - EXPECT_THROW(us->deleteUser(1), Exception); + EXPECT_THROW(us->deleteUser(1), std::exception); } TEST_F(UserServiceTest, getUserOk) { @@ -62,17 +62,17 @@ TEST_F(UserServiceTest, getUserOk) { EXPECT_EQ(u.getUsername(), "username"); } -TEST_F(UserServiceTest, getUserEXEPTION) { +TEST_F(UserServiceTest, getUserInvalidId) { EXPECT_CALL(*mock_ptr, getUserById(-1)).Times(1).WillOnce(NoUserException()); - EXPECT_THROW(us->getUserById(-1), Exception); + EXPECT_THROW(us->getUserById(-1), std::exception); } TEST_F(UserServiceTest, makeUserOk) { - EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) + EXPECT_CALL(*mock_ptr, makeUser(User("login@gmail.com", "password", "username"))) .Times(1) .WillOnce(::testing::Return(1)); - User u = us->createUser("login", "username", "password"); - EXPECT_EQ(u.getLogin(), "login"); + User u = us->createUser("login@gmail.com", "username", "password"); + EXPECT_EQ(u.getLogin(), "login@gmail.com"); EXPECT_EQ(u.getId(), 1); EXPECT_EQ(u.getPassword(), "password"); EXPECT_EQ(u.getUsername(), "username"); diff --git a/server/internal/service/tests/UserValidatorTest.cpp b/server/internal/service/tests/UserValidatorTest.cpp index 802b2f0..0a77c9c 100644 --- a/server/internal/service/tests/UserValidatorTest.cpp +++ b/server/internal/service/tests/UserValidatorTest.cpp @@ -4,26 +4,21 @@ #include "UserValidator.h" TEST(UserValidatorTest, validateOK) { - UserValidator uv(User("login", "password", "username")); - EXPECT_TRUE(uv.validateUser()); + EXPECT_TRUE(UserValidator::validate(User("login@gmail.com", "password", "username"))); } TEST(UserValidatorTest, invalidLogin) { - UserValidator uv(User("", "password", "username")); - EXPECT_FALSE(uv.validateUser()); + EXPECT_FALSE(UserValidator::validate(User("", "password", "username"))); } TEST(UserValidatorTest, invalidPassword) { - UserValidator uv(User("login", "", "username")); - EXPECT_FALSE(uv.validateUser()); + EXPECT_FALSE(UserValidator::validate(User("login", "", "username"))); } TEST(UserValidatorTest, invalidUsername) { - UserValidator uv(User("login", "password", "")); - EXPECT_FALSE(uv.validateUser()); + EXPECT_FALSE(UserValidator::validate(User("login", "password", ""))); } TEST(UserValidatorTest, invalidUserFields) { - UserValidator uv(User("", "", "")); - EXPECT_FALSE(uv.validateUser()); + EXPECT_FALSE(UserValidator::validate(User("", "", ""))); } \ No newline at end of file diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index a9ec548..d3a268f 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -9,7 +9,7 @@ class ISolutionService { public: virtual ~ISolutionService() = default; virtual Solution createSolution(size_t userId, size_t taskId, - std::string source) = 0; + const std::string& source) = 0; virtual std::vector getSolutionsByUserAndTaskId(size_t userId, size_t taskId) = 0; virtual void deleteSolutionById(size_t solId) = 0; diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h index 731fb0f..8d88954 100644 --- a/server/internal/service/virtual/ITaskService.h +++ b/server/internal/service/virtual/ITaskService.h @@ -6,7 +6,7 @@ class ITaskService { public: virtual ~ITaskService() = default; - virtual Task createTask(std::string desc) = 0; + virtual Task createTask(const std::string& desc) = 0; virtual Task getTask(size_t id) = 0; virtual std::vector getAllTasks() = 0; virtual void deleteTask(size_t id) = 0; diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h index 06d7972..c8e9c68 100644 --- a/server/internal/service/virtual/IUserService.h +++ b/server/internal/service/virtual/IUserService.h @@ -7,8 +7,8 @@ class IUserService { public: virtual ~IUserService() = default; - virtual User createUser(std::string login, std::string username, - std::string password) = 0; + virtual User createUser(const std::string& login, const std::string& username, + const std::string& password) = 0; virtual User getUserById(size_t id) = 0; virtual void deleteUser(size_t id) = 0; }; -- GitLab From ebfdd1ce7690ce1ccc9a71213d1fcbef3651632f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 11 May 2023 11:02:21 +0300 Subject: [PATCH 045/134] Refactor HttpClient --- .../internal/httpClient/include/ClientTypes.h | 34 ----------- .../internal/httpClient/include/HttpClient.h | 46 +++++++------- .../httpClient/include/HttpClientManager.h | 16 ++--- .../internal/httpClient/include/Serializer.h | 2 - client/internal/httpClient/src/HttpClient.cpp | 60 ++++++++++--------- .../httpClient/src/HttpClientManager.cpp | 17 +++--- .../internal/httpClient/virtual/IHttpClient.h | 25 ++++---- 7 files changed, 80 insertions(+), 120 deletions(-) delete mode 100644 client/internal/httpClient/include/ClientTypes.h diff --git a/client/internal/httpClient/include/ClientTypes.h b/client/internal/httpClient/include/ClientTypes.h deleted file mode 100644 index 9ba6e87..0000000 --- a/client/internal/httpClient/include/ClientTypes.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ -#define APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ - -#include -#include -#include -#include -#include - -using Response = boost::beast::http::response; -using Request = boost::beast::http::request; - -using Params = std::map; - -struct Header { - std::string name; - std::string values; -}; - -struct ResponseStruct { - unsigned int status; - std::string body; - std::vector
headers; -}; - -struct Host { - std::string domain; - std::string ip; - unsigned short port; - Host(std::string domain, std::string ip, unsigned short port) - : domain(std::move(domain)), ip(std::move(ip)), port(port) {} -}; - -#endif // APP_HTTPCLIENT_HTTPCLIENT_CLIENTTYPES_H_ diff --git a/client/internal/httpClient/include/HttpClient.h b/client/internal/httpClient/include/HttpClient.h index 99e7fb0..058c2b4 100644 --- a/client/internal/httpClient/include/HttpClient.h +++ b/client/internal/httpClient/include/HttpClient.h @@ -5,36 +5,30 @@ #include #include #include +#include -#include "ClientTypes.h" -#include "Serializer.h" #include "IHttpClient.h" +namespace beast = boost::beast; +namespace http = beast::http; +namespace net = boost::asio; +using tcp = net::ip::tcp; + class HttpClient : public IHttpClient { - public: - HttpClient(); - ResponseStruct makeGetRequest(const Host& host, const std::string& target, - const std::shared_ptr& params = nullptr, - const std::shared_ptr& headers = nullptr) override; - ResponseStruct makePostRequest(const Host& host, const std::string& target, - const std::shared_ptr& body, - const std::shared_ptr& headers = nullptr) override; - - private: - ResponseStruct parseResponse(Response response) override; - std::string createURL(const std::string& target, const std::shared_ptr& params = nullptr) override; - bool connect(unsigned short port) override; - ResponseStruct makeRequest(const Host& host, const std::string& target, boost::beast::http::verb method, - const std::shared_ptr& params = nullptr, - const std::shared_ptr& body = nullptr, - const std::shared_ptr& headers = nullptr) override; - - boost::asio::io_context context; - boost::asio::ip::tcp::resolver resolver; - boost::asio::ip::tcp::socket socket; - std::string ip; - boost::beast::flat_buffer flat_buffer; - Serializer serializer; +public: + HttpClient(std::string_view host, std::string_view port); + http::response makeGetRequest(std::string_view target, std::string_view body) override; + http::response makePostRequest(std::string_view target, std::string_view body) override; + +private: + http::response makeRequest(std::string_view target, + http::verb method, + std::string_view body) override; + + net::io_context io_context{}; + tcp::resolver resolver; + beast::tcp_stream stream; + std::string host; }; diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index 1d31ce3..7c3ed33 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -10,23 +10,25 @@ #include "Solution.h" #include "Task.h" #include "Metric.h" +#include "Serializer.h" class HttpClientManager { - public: - HttpClientManager(const std::string &domain, const std::string &ip, const unsigned short &port, - std::string saved_path_); +public: + HttpClientManager(std::string_view host_, std::string_view port_, std::string_view saved_path_); + unsigned int loginUser(const std::string &login, const std::string &password); unsigned int registerUser(const std::string &login, const std::string &username, const std::string &password); - unsigned int submitSolution(const int& user_id, const std::string &path_to_sound); + unsigned int submitSolution(const int& user_id, const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); std::vector getMetrics(const int& sol_id); void setHttpClient(std::shared_ptr client_); - private: +private: std::string saved_path; - Host host; + std::string host; + std::string port; std::shared_ptr client; - Serializer serializer; + std::shared_ptr serializer; }; diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index 31d4468..4f4dc32 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -5,8 +5,6 @@ #include #include -#include "ClientTypes.h" - class Serializer {}; diff --git a/client/internal/httpClient/src/HttpClient.cpp b/client/internal/httpClient/src/HttpClient.cpp index 93881ff..d9f09fe 100644 --- a/client/internal/httpClient/src/HttpClient.cpp +++ b/client/internal/httpClient/src/HttpClient.cpp @@ -1,32 +1,38 @@ #include "httpClient.h" -#include #include -#include -#include -#include #include -using Error = boost::system::system_error; - -std::string HttpClient::createURL(const std::string& target, const std::shared_ptr& params) {} - -bool HttpClient::connect(unsigned short port = 80) {} - -HttpClient::HttpClient() : socket(context), resolver(context) {} - -ResponseStruct HttpClient::makeRequest(const Host &host, const std::string &target, - const boost::beast::http::verb method, - const std::shared_ptr& params, - const std::shared_ptr& body, - const std::shared_ptr& headers) {} - -ResponseStruct HttpClient::parseResponse(Response response) {} - -ResponseStruct HttpClient::makeGetRequest(const Host &host, const std::string &target, - const std::shared_ptr& params, - const std::shared_ptr& headers) {} - -ResponseStruct HttpClient::makePostRequest(const Host &host, const std::string &target, - const std::shared_ptr& body, - const std::shared_ptr& headers) {} +HttpClient::HttpClient(std::string_view host_, std::string_view port) : + host(host_), + resolver(io_context), + stream(io_context) { + auto const results = resolver.resolve(host, port); + stream.connect(results); +} + +http::response HttpClient::makeRequest(std::string_view target, + http::verb method, + std::string_view body) { + http::request req{http::verb::get, target, 10}; + req.set(http::field::host, host); + req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); + + http::write(stream, req); + + beast::flat_buffer buffer; + http::response res; + http::read(stream, buffer, res); + + return res; +} + +http::response HttpClient::makeGetRequest(std::string_view target, + std::string_view body) { + return makeRequest(target, http::verb::get, body); +} + +http::response HttpClient::makePostRequest(std::string_view target, + std::string_view body) { + return makeRequest(target, http::verb::post, body); +} diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index 57e1a88..9d7b1e4 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -1,19 +1,18 @@ -#include "httpClientManager.h" +#include "HttpClientManager.h" -#include -#include #include #include #include -HttpClientManager::HttpClientManager(const std::string &domain, - const std::string &ip, - const unsigned short &port, - std::string saved_path_) - : host(domain, ip, port), client(), serializer(), saved_path(std::move(saved_path_)) {} +#include "HttpClient.h" + +HttpClientManager::HttpClientManager(std::string_view host_, std::string_view port_, std::string_view saved_path_) : + host(host_), port(port_), saved_path(saved_path_), + client(std::make_shared(host_, port_)), + serializer(std::make_shared()) {} unsigned int HttpClientManager::loginUser(const std::string &login, const std::string &password) { - return 0; + } unsigned int HttpClientManager::registerUser(const std::string &login, const std::string &username, diff --git a/client/internal/httpClient/virtual/IHttpClient.h b/client/internal/httpClient/virtual/IHttpClient.h index e24e15d..9de99fc 100644 --- a/client/internal/httpClient/virtual/IHttpClient.h +++ b/client/internal/httpClient/virtual/IHttpClient.h @@ -5,27 +5,22 @@ #include #include #include +#include -#include "clientTypes.h" -#include "serializer.h" +namespace beast = boost::beast; +namespace http = beast::http; +namespace net = boost::asio; +using tcp = net::ip::tcp; class IHttpClient { public: - virtual ResponseStruct makeGetRequest(const Host& host, const std::string& target, - const std::shared_ptr& params = nullptr, - const std::shared_ptr& headers = nullptr) = 0; - virtual ResponseStruct makePostRequest(const Host& host, const std::string& target, - const std::shared_ptr& body, - const std::shared_ptr& headers = nullptr) = 0; + virtual http::response makeGetRequest(std::string_view target, std::string_view body) = 0; + virtual http::response makePostRequest(std::string_view target, std::string_view body) = 0; protected: - virtual ResponseStruct parseResponse(Response response) = 0; - virtual std::string createURL(const std::string& target, const std::shared_ptr& params = nullptr) = 0; - virtual bool connect(unsigned short port) = 0; - virtual ResponseStruct makeRequest(const Host& host, const std::string& target, boost::beast::http::verb method, - const std::shared_ptr& params = nullptr, - const std::shared_ptr& body = nullptr, - const std::shared_ptr& headers = nullptr) = 0; + virtual http::response makeRequest(std::string_view target, + http::verb method, + std::string_view body) = 0; }; -- GitLab From 2e3d634c77391ae7ab2e441667378c04840030bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 11 May 2023 17:06:00 +0300 Subject: [PATCH 046/134] add gui --- client/internal/entities/include/Task.h | 22 +--- client/internal/entities/src/Task.cpp | 21 ---- client/internal/gui/CMakeLists.txt | 6 + client/internal/gui/include/AuthDialog.h | 18 +-- client/internal/gui/include/EntryWindow.h | 20 ++-- client/internal/gui/include/SignUpDialog.h | 30 ++--- client/internal/gui/include/SolutionsWindow.h | 43 +++++++ client/internal/gui/include/StatsDialog.h | 25 ---- client/internal/gui/include/TasksWindow.h | 45 ++++++++ client/internal/gui/include/UIManager.h | 17 +-- client/internal/gui/include/UserWindow.h | 46 -------- client/internal/gui/main.cpp | 13 +++ client/internal/gui/src/AuthDialog.cpp | 81 ++++++++++++- client/internal/gui/src/EntryWindow.cpp | 86 ++++++++++++-- client/internal/gui/src/SignUpDialog.cpp | 102 ++++++++++++++++- client/internal/gui/src/SolutionsWindow.cpp | 80 +++++++++++++ client/internal/gui/src/TasksWindow.cpp | 107 ++++++++++++++++++ client/internal/gui/src/UIManager.cpp | 16 ++- client/internal/gui/src/UserWindow.cpp | 9 -- client/internal/gui/tests/main.cpp | 6 +- 20 files changed, 601 insertions(+), 192 deletions(-) delete mode 100644 client/internal/entities/src/Task.cpp create mode 100644 client/internal/gui/include/SolutionsWindow.h delete mode 100644 client/internal/gui/include/StatsDialog.h create mode 100644 client/internal/gui/include/TasksWindow.h delete mode 100644 client/internal/gui/include/UserWindow.h create mode 100644 client/internal/gui/main.cpp create mode 100644 client/internal/gui/src/SolutionsWindow.cpp create mode 100644 client/internal/gui/src/TasksWindow.cpp delete mode 100644 client/internal/gui/src/UserWindow.cpp diff --git a/client/internal/entities/include/Task.h b/client/internal/entities/include/Task.h index d51c17f..9d87ca6 100644 --- a/client/internal/entities/include/Task.h +++ b/client/internal/entities/include/Task.h @@ -1,23 +1,11 @@ #ifndef SOURCEDOUT_TASK_HPP #define SOURCEDOUT_TASK_HPP -#include -#include -class Task{ -private: - size_t id; - std::string description; - -public: - Task()=default; - ~Task() = default; - Task(size_t id, std::string description); - - explicit Task(std::string description); - [[nodiscard]] size_t getId() const; - - [[nodiscard]] const std::string &getDescription() const; +#include - void setDescription(const std::string &description); +struct Task{ + std::size_t id; + std::string description; }; + #endif //SOURCEDOUT_TASK_HPP \ No newline at end of file diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp deleted file mode 100644 index 7dd9bfe..0000000 --- a/client/internal/entities/src/Task.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "Task.h" -#include -#include - -unsigned long Task::getId() const { - return id; -} - -Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} - -Task::Task(std::string description) : id(0), description(std::move(description)) {} - -const std::string &Task::getDescription() const { - return description; -} - -void Task::setDescription(const std::string &description_) { - Task::description = description_; -} \ No newline at end of file diff --git a/client/internal/gui/CMakeLists.txt b/client/internal/gui/CMakeLists.txt index 60da13c..1f206bf 100644 --- a/client/internal/gui/CMakeLists.txt +++ b/client/internal/gui/CMakeLists.txt @@ -1,6 +1,9 @@ project("GuiLib") set(CMAKE_CXX_STANDARD 20) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -20,5 +23,8 @@ set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) set(GUI_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) +add_executable(gui_run main.cpp) +target_link_libraries(gui_run ${GUI_lib_LIB}) + enable_testing() add_subdirectory(tests) \ No newline at end of file diff --git a/client/internal/gui/include/AuthDialog.h b/client/internal/gui/include/AuthDialog.h index 76b3f9b..b8917b8 100644 --- a/client/internal/gui/include/AuthDialog.h +++ b/client/internal/gui/include/AuthDialog.h @@ -6,38 +6,32 @@ #include #include #include +#include +#include class AuthDialog : public QDialog { Q_OBJECT public: explicit AuthDialog(QWidget *parent = nullptr); - ~AuthDialog() override; -signals: - void showMainWindow(); - void showUserWindow(); - -private slots: +public slots: void on_loginButton_clicked(); void on_backButton_clicked(); private: - QGroupBox *groupBox = nullptr; - QWidget *layoutWidget = nullptr; QVBoxLayout *verticalLayout = nullptr; - QHBoxLayout *horizontalLayout = nullptr; + QWidget *fields = nullptr; + QFormLayout* fieldsLayout = nullptr; QLabel *loginLabel = nullptr; QLineEdit *login = nullptr; - QHBoxLayout *horizontalLayout_2 = nullptr; QLabel *passwordLabel = nullptr; QLineEdit *password = nullptr; QPushButton *loginButton = nullptr; QPushButton *backButton = nullptr; void setupUi(QDialog *AuthDialog); - - void setTexts(QDialog *AuthDialog); + void retranslateUi(QDialog *AuthDialog); }; #endif // AUTH_DIALOG_H diff --git a/client/internal/gui/include/EntryWindow.h b/client/internal/gui/include/EntryWindow.h index b7acbd0..4bc4f11 100644 --- a/client/internal/gui/include/EntryWindow.h +++ b/client/internal/gui/include/EntryWindow.h @@ -14,19 +14,17 @@ Q_OBJECT public: EntryWindow(QWidget *parent = nullptr); - ~EntryWindow() override; - std::shared_ptr getSignUpDialog(); - std::shared_ptr getAuthDialog(); +signals: + void showTasksWindow(); -private slots: - static void onExitButtonClicked(); - void onLoginButtonClicked(); - void onSignUpButtonClicked(); +public slots: + void on_exitButton_clicked(); + void on_loginButton_clicked(); + void on_signUpButton_clicked(); private: - std::shared_ptr authDialog = nullptr; - std::shared_ptr signUpDialog = nullptr; + QWidget *centralwidget = nullptr; QVBoxLayout *verticalLayout = nullptr; QLabel *introLabel = nullptr; @@ -38,8 +36,8 @@ private: QMenuBar *menubar = nullptr; QStatusBar *statusbar = nullptr; - void setupUi(QMainWindow *MainWindow); - void retranslateUi(QMainWindow *MainWindow); + void setupUi(QMainWindow *EntryWindow); + void retranslateUi(QMainWindow *EntryWindow); }; #endif // MAINWINDOW_H diff --git a/client/internal/gui/include/SignUpDialog.h b/client/internal/gui/include/SignUpDialog.h index 2882b24..f9da4f5 100644 --- a/client/internal/gui/include/SignUpDialog.h +++ b/client/internal/gui/include/SignUpDialog.h @@ -6,36 +6,30 @@ #include #include #include +#include class SignUpDialog : public QDialog { Q_OBJECT public: explicit SignUpDialog(QWidget *parent = nullptr); - ~SignUpDialog() override; - -signals: - void showEntryWindow(); - void showUserWindow(); private slots: - void on_signUpButton_clicked() {}; - void on_backButton_clicked() {}; + void on_signUpButton_clicked(); + void on_backButton_clicked(); private: - QGroupBox *groupBox = nullptr; - QWidget *layoutWidget = nullptr; - QVBoxLayout *verticalLayout_2 = nullptr; QVBoxLayout *verticalLayout = nullptr; - QGridLayout *gridLayout = nullptr; - QLabel *enterLoginLabel = nullptr; + QWidget *fields = nullptr; + QFormLayout* fieldsLayout = nullptr; + QLabel *loginLabel = nullptr; QLineEdit *login = nullptr; - QGridLayout *gridLayout_2 = nullptr; - QLineEdit *pass = nullptr; - QLabel *enterPasswordLabel = nullptr; - QHBoxLayout *horizontalLayout_3 = nullptr; - QLabel *repeatPasswordLabel = nullptr; - QLineEdit *passRepeat = nullptr; + QLabel* usernameLabel = nullptr; + QLineEdit *username = nullptr; + QLabel *passwordLabel = nullptr; + QLineEdit *password = nullptr; + QLabel *passwordRepeatLabel = nullptr; + QLineEdit *passwordRepeat = nullptr; QPushButton *signUpButton = nullptr; QPushButton *backButton = nullptr; diff --git a/client/internal/gui/include/SolutionsWindow.h b/client/internal/gui/include/SolutionsWindow.h new file mode 100644 index 0000000..103c2fb --- /dev/null +++ b/client/internal/gui/include/SolutionsWindow.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Task.h" +#include "TasksWindow.h" + +class SolutionsWindow : public QMainWindow { +Q_OBJECT + +public: + explicit SolutionsWindow(Task task, QWidget *parent = nullptr); + +private slots: + void on_backButton_clicked(); + void on_chooseFileButton_clicked(); + void on_sendButton_clicked(); + +private: + + Task task; + std::string source; + + QWidget *centralwidget = nullptr; + QGroupBox* taskBox = nullptr; + QVBoxLayout* taskLayout = nullptr; + QVBoxLayout* verticalLayout = nullptr; + QLabel* taskDescription = nullptr; + QPushButton* chooseFileButton = nullptr; + QLabel* filename = nullptr; + QPushButton* sendButton = nullptr; + QLabel* result = nullptr; + QPushButton* backButton = nullptr; + + void setupUi(QMainWindow *UserWindow); +}; diff --git a/client/internal/gui/include/StatsDialog.h b/client/internal/gui/include/StatsDialog.h deleted file mode 100644 index 8a10038..0000000 --- a/client/internal/gui/include/StatsDialog.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Created by Николай Степанов on 04.05.2023. -// - -#ifndef SOURCEDOUT_STATSDIALOG_H -#define SOURCEDOUT_STATSDIALOG_H - -#include -#include -#include "Metric.h" - -class StatsDialog : public QDialog { - Q_OBJECT - -public: - explicit StatsDialog(QWidget *parent = nullptr) {}; - ~StatsDialog() override {}; - -private: - QTableView* tableView = nullptr; - QTableWidget* tableWidget = nullptr; - QVector metrics; -}; - -#endif //SOURCEDOUT_STATSDIALOG_H diff --git a/client/internal/gui/include/TasksWindow.h b/client/internal/gui/include/TasksWindow.h new file mode 100644 index 0000000..c8f96bd --- /dev/null +++ b/client/internal/gui/include/TasksWindow.h @@ -0,0 +1,45 @@ +#ifndef USERWINDOW_H +#define USERWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Task.h" + +class TasksWindow : public QMainWindow { +Q_OBJECT + +public: + explicit TasksWindow(QWidget *parent = nullptr); + +public slots: + void on_backButton_clicked(); + void on_goToTaskButton_clicked(); + void indexChanged(); + +private: + + QWidget *centralwidget = nullptr; + QVBoxLayout* verticalLayout = nullptr; + QGroupBox *taskChooseGroupBox = nullptr; + QVBoxLayout* taskVerticalLayout = nullptr; + QLabel* label = nullptr; + QComboBox* tasks = nullptr; + QLabel* taskDescription = nullptr; + QPushButton* goToTaskButton = nullptr; + QPushButton* backButton = nullptr; + QWidget* buttonsWidget = nullptr; + QHBoxLayout* buttonsLayout = nullptr; + + std::vector tasks_vector; + + void setupUi(QMainWindow *UserWindow); +}; + +#endif // USERWINDOW_H diff --git a/client/internal/gui/include/UIManager.h b/client/internal/gui/include/UIManager.h index 3d030f2..bc6e071 100644 --- a/client/internal/gui/include/UIManager.h +++ b/client/internal/gui/include/UIManager.h @@ -1,21 +1,22 @@ #ifndef INCLUDE_UIMANAGER_H_ #define INCLUDE_UIMANAGER_H_ +#include #include "EntryWindow.h" -#include "UserWindow.h" +#include "TasksWindow.h" -class UIManager { +class UIManager : public QWidget { +Q_OBJECT public: - UIManager(); - - ~UIManager() = default; + UIManager(QWidget *parent = nullptr); +public slots: void showEntryWindow(); - void showUserWindow(); + void showTasksWindow(); private: - EntryWindow entryWindow; - UserWindow userWindow; + EntryWindow* entryWindow = nullptr; + TasksWindow* userWindow = nullptr; }; #endif // INCLUDE_UIMANAGER_H_ diff --git a/client/internal/gui/include/UserWindow.h b/client/internal/gui/include/UserWindow.h deleted file mode 100644 index 859d69e..0000000 --- a/client/internal/gui/include/UserWindow.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef USERWINDOW_H -#define USERWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "StatsDialog.h" - -class UserWindow : public QMainWindow { -Q_OBJECT - -public: - explicit UserWindow(QWidget *parent = nullptr); - ~UserWindow() override = default; - -signals: - void logout(); - -private slots: - void onBackButtonClicked(); - void onListElementClicked(); - void onSendButtonClicked(); - -private: - - QTabWidget* tabs = nullptr; - StatsDialog* statsDialog = nullptr; - QPushButton *backButton = nullptr; - QPushButton *sendButton = nullptr; - QComboBox* comboBox = nullptr; - QVBoxLayout* verticalLayout = nullptr; - QLabel* label = nullptr; - QLabel* description = nullptr; - QFileDialog* fileDialog = nullptr; - QStringList* list = nullptr; - - QWidget *centralwidget = nullptr; -}; - -#endif // USERWINDOW_H diff --git a/client/internal/gui/main.cpp b/client/internal/gui/main.cpp new file mode 100644 index 0000000..b348568 --- /dev/null +++ b/client/internal/gui/main.cpp @@ -0,0 +1,13 @@ +#include "EntryWindow.h" +#include "TasksWindow.h" + +#include + +#include "UIManager.h" + +int main(int argc, char *argv[]) { + QApplication a(argc, argv); + UIManager uiManager; + uiManager.showEntryWindow(); + return a.exec(); +} diff --git a/client/internal/gui/src/AuthDialog.cpp b/client/internal/gui/src/AuthDialog.cpp index 0e57d4d..5227149 100644 --- a/client/internal/gui/src/AuthDialog.cpp +++ b/client/internal/gui/src/AuthDialog.cpp @@ -1,15 +1,86 @@ #include "AuthDialog.h" +#include +#include + AuthDialog::AuthDialog(QWidget *parent) : QDialog(parent) { setupUi(this); } -AuthDialog::~AuthDialog() {} +void AuthDialog::setupUi(QDialog *AuthDialog) { + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(AuthDialog->sizePolicy().hasHeightForWidth()); + AuthDialog->setSizePolicy(sizePolicy); + + verticalLayout = new QVBoxLayout(AuthDialog); + + fields = new QWidget(AuthDialog); + fields->setEnabled(true); + + fieldsLayout = new QFormLayout(fields); + + loginLabel = new QLabel(this); + login = new QLineEdit(this); + + fieldsLayout->addRow(loginLabel, login); + + passwordLabel = new QLabel(this); + password = new QLineEdit(this); + password->setEchoMode(QLineEdit::Password); + + fieldsLayout->addRow(passwordLabel, password); + + verticalLayout->addWidget(fields); -void AuthDialog::on_loginButton_clicked() {} + loginButton = new QPushButton(AuthDialog); + loginButton->setDefault(true); -void AuthDialog::setupUi(QDialog *AuthDialog) {} + verticalLayout->addWidget(loginButton); -void AuthDialog::setTexts(QDialog *AuthDialog) {} + backButton = new QPushButton(AuthDialog); -void AuthDialog::on_backButton_clicked() {} + verticalLayout->addWidget(backButton); + + retranslateUi(AuthDialog); + + connect(loginButton, &QPushButton::clicked, this, &AuthDialog::on_loginButton_clicked); + connect(backButton, &QPushButton::clicked, this, &AuthDialog::on_backButton_clicked); +} + +void AuthDialog::retranslateUi(QDialog *AuthDialog) { + AuthDialog->setWindowTitle("Вход"); + loginLabel->setText("Логин"); + passwordLabel->setText("Пароль"); + loginButton->setText("Войти"); + backButton->setText("Назад"); +} + +void AuthDialog::on_loginButton_clicked() { + std::string log = login->text().toUtf8().constData(); + std::string pass = password->text().toUtf8().constData(); + if (log.empty() || pass.empty()) { + QMessageBox::warning(this, "Ошибка авторизации", "Логин и пароль не могут быть пустыми"); + return; + } +// unsigned result = Core::login(log, pass); + unsigned result = 200; + switch (result) { + case 200: + QMessageBox::warning(this, "Успешная авторизации", "Работает"); + accept(); + close(); + break; + case 403: + QMessageBox::warning(this, "Ошибка авторизации","Неправильный логин или пароль"); + break; + default: + QMessageBox::critical(this, "Авторизация невозможна", "Нет соединения с сервером"); + } +} + +void AuthDialog::on_backButton_clicked() { + reject(); + close(); +} diff --git a/client/internal/gui/src/EntryWindow.cpp b/client/internal/gui/src/EntryWindow.cpp index 8bf9bc3..1c5d246 100644 --- a/client/internal/gui/src/EntryWindow.cpp +++ b/client/internal/gui/src/EntryWindow.cpp @@ -6,22 +6,90 @@ #include #include "AuthDialog.h" #include "SignUpDialog.h" +#include "UIManager.h" -EntryWindow::EntryWindow(QWidget *parent) : QMainWindow(parent) {} +EntryWindow::EntryWindow(QWidget *parent) : QMainWindow(parent) { + setupUi(this); +} -EntryWindow::~EntryWindow() {} +void EntryWindow::setupUi(QMainWindow *EntryWindow) { + EntryWindow->resize(600, 600); + QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(EntryWindow->sizePolicy().hasHeightForWidth()); + EntryWindow->setSizePolicy(sizePolicy); -void EntryWindow::setupUi(QMainWindow *MainWindow) {} -void EntryWindow::retranslateUi(QMainWindow *MainWindow) {} + centralwidget = new QWidget(EntryWindow); + verticalLayout = new QVBoxLayout(centralwidget); -void EntryWindow::onExitButtonClicked() {} + introLabel = new QLabel(centralwidget); + introLabel->setText("Добро пожаловать в Noiseground!"); + introLabel->setGeometry(QRect(140, 200, 331, 31)); -void EntryWindow::onLoginButtonClicked() {} + verticalLayout->addWidget(introLabel, 0, Qt::AlignHCenter); + loginButton = new QPushButton(centralwidget); + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(loginButton->sizePolicy().hasHeightForWidth()); + loginButton->setSizePolicy(sizePolicy1); + verticalLayout->addWidget(loginButton); -void EntryWindow::onSignUpButtonClicked() {} + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); -std::shared_ptr EntryWindow::getSignUpDialog() {} + verticalLayout->addItem(horizontalSpacer); -std::shared_ptr EntryWindow::getAuthDialog() {} + signUpButton = new QPushButton(centralwidget); + sizePolicy1.setHeightForWidth(signUpButton->sizePolicy().hasHeightForWidth()); + signUpButton->setSizePolicy(sizePolicy1); + + verticalLayout->addWidget(signUpButton); + + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + verticalLayout->addItem(horizontalSpacer_2); + + exitButton = new QPushButton(centralwidget); + sizePolicy1.setHeightForWidth(exitButton->sizePolicy().hasHeightForWidth()); + exitButton->setSizePolicy(sizePolicy1); + + verticalLayout->addWidget(exitButton); + + EntryWindow->setCentralWidget(centralwidget); + + connect(signUpButton, &QPushButton::clicked, this, &EntryWindow::on_signUpButton_clicked); + connect(loginButton, &QPushButton::clicked, this, &EntryWindow::on_loginButton_clicked); + connect(exitButton, &QPushButton::clicked, this, &EntryWindow::on_exitButton_clicked); + + retranslateUi(EntryWindow); +} + +void EntryWindow::retranslateUi(QMainWindow *EntryWindow) { + EntryWindow->setWindowTitle(QCoreApplication::translate("EntryWindow", "Главное окно", nullptr)); + loginButton->setText(QCoreApplication::translate("EntryWindow", "Войти", nullptr)); + signUpButton->setText(QCoreApplication::translate("EntryWindow", "Зарегистрироваться", nullptr)); + exitButton->setText(QCoreApplication::translate("EntryWindow", "Выйти", nullptr)); +} + +void EntryWindow::on_exitButton_clicked() { + QApplication::quit(); +} + +void EntryWindow::on_loginButton_clicked() { + AuthDialog authDialog(this); + if (authDialog.exec() == QDialog::Accepted) { + hide(); + qobject_cast(parent())->showTasksWindow(); + } +} + +void EntryWindow::on_signUpButton_clicked() { + SignUpDialog signupDialog( this ); + if (signupDialog.exec() == QDialog::Accepted) { + hide(); + qobject_cast(parent())->showTasksWindow(); + } +} diff --git a/client/internal/gui/src/SignUpDialog.cpp b/client/internal/gui/src/SignUpDialog.cpp index 8750c80..015f65f 100644 --- a/client/internal/gui/src/SignUpDialog.cpp +++ b/client/internal/gui/src/SignUpDialog.cpp @@ -6,12 +6,106 @@ //#include "Core.h" -SignUpDialog::SignUpDialog(QWidget *parent) : QDialog(parent) {} +SignUpDialog::SignUpDialog(QWidget *parent) : QDialog(parent) { + setupUi(this); +} -SignUpDialog::~SignUpDialog() {} +void SignUpDialog::setupUi(QDialog *SignUpDialog) { + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(SignUpDialog->sizePolicy().hasHeightForWidth()); + SignUpDialog->setSizePolicy(sizePolicy); -void SignUpDialog::retranslateUi(QDialog *SignUpDialog) {} + verticalLayout = new QVBoxLayout(SignUpDialog); -void SignUpDialog::setupUi(QDialog *SignUpDialog) {} + fields = new QWidget(SignUpDialog); + fields->setEnabled(true); + + fieldsLayout = new QFormLayout(fields); + + loginLabel = new QLabel(this); + login = new QLineEdit(this); + + fieldsLayout->addRow(loginLabel, login); + + usernameLabel = new QLabel(this); + username = new QLineEdit(this); + + fieldsLayout->addRow(usernameLabel, username); + + passwordLabel = new QLabel(this); + password = new QLineEdit(this); + password->setEchoMode(QLineEdit::Password); + + fieldsLayout->addRow(passwordLabel, password); + + passwordRepeatLabel = new QLabel(this); + passwordRepeat = new QLineEdit(this); + passwordRepeat->setEchoMode(QLineEdit::Password); + + fieldsLayout->addRow(passwordRepeatLabel, passwordRepeat); + + verticalLayout->addWidget(fields); + + signUpButton = new QPushButton(SignUpDialog); + signUpButton->setDefault(true); + + verticalLayout->addWidget(signUpButton); + + backButton = new QPushButton(SignUpDialog); + + verticalLayout->addWidget(backButton); + + retranslateUi(SignUpDialog); + + connect(signUpButton, &QPushButton::clicked, this, &SignUpDialog::on_signUpButton_clicked); + connect(backButton, &QPushButton::clicked, this, &SignUpDialog::on_backButton_clicked); +} + +void SignUpDialog::retranslateUi(QDialog *SignUpDialog) { + SignUpDialog->setWindowTitle("Регистрация"); + loginLabel->setText("Введите логин"); + usernameLabel->setText("Введите имя"); + passwordLabel->setText("Введите пароль"); + passwordRepeatLabel->setText("Повторите пароль"); + signUpButton->setText("Зарегистрироваться"); + backButton->setText("Назад"); +} + +void SignUpDialog::on_signUpButton_clicked() { + std::string login = this->login->text().toUtf8().constData(); + std::string username = this->username->text().toUtf8().constData(); + std::string password = this->password->text().toUtf8().constData(); + std::string passwordRepeat = this->passwordRepeat->text().toUtf8().constData(); + if (password == passwordRepeat && !login.empty() && !username.empty()) { +// unsigned response = Core::signUp(log.toStdString(), pass.toStdString()); + unsigned response = 200; + switch (response) { + case 200: + QMessageBox::information(this, "Успех!", "Вы успешно зарегистрированы!"); + accept(); + close(); + break; + case 403: + QMessageBox::warning(this, "Регистрация невозможна", "Логин уже занят!"); + break; + default: + QMessageBox::critical(this, "Регистрация невозможна!", "Нет соединения с сервером!"); + } + + } else if (login.empty()) { + QMessageBox::warning(this, "Ошибка!", "Логин не может быть пустым!"); + } else if (username.empty()) { + QMessageBox::warning(this, "Ошибка!", "Имя не может быть пустым!"); + } else { + QMessageBox::warning(this, "Ошибка!", "Пароли не совпадают!"); + } +} + +void SignUpDialog::on_backButton_clicked() { + reject(); + close(); +} // setupUi diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp new file mode 100644 index 0000000..33743ee --- /dev/null +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -0,0 +1,80 @@ +#include "SolutionsWindow.h" + +#include +#include +#include +#include + +SolutionsWindow::SolutionsWindow(Task task, QWidget *parent) : QMainWindow(parent), task(std::move(task)) { + setupUi(this); + connect(backButton, &QPushButton::clicked, this, &SolutionsWindow::on_backButton_clicked); + connect(chooseFileButton, &QPushButton::clicked, this, &SolutionsWindow::on_chooseFileButton_clicked); + connect(sendButton, &QPushButton::clicked, this, &SolutionsWindow::on_sendButton_clicked); +} + +void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(SolutionsWindow->sizePolicy().hasHeightForWidth()); + SolutionsWindow->setSizePolicy(sizePolicy); + + centralwidget = new QWidget(SolutionsWindow); + verticalLayout = new QVBoxLayout(centralwidget); + + taskBox = new QGroupBox(centralwidget); + taskLayout = new QVBoxLayout(taskBox); + + taskDescription = new QLabel(taskBox); + std::string description = task.description; + taskDescription->setText(QString(description.c_str())); + + taskLayout->addWidget(taskDescription); + + filename = new QLabel(this); + + chooseFileButton = new QPushButton(this); + chooseFileButton->setText(QString::fromUtf8("Выбирите файл")); + + sendButton = new QPushButton(this); + sendButton->setText(QString::fromUtf8("Отправить")); + + result = new QLabel(this); + result->setText(QString::fromUtf8("Отправьте для принятия решения")); + + backButton = new QPushButton(this); + backButton->setText(QString::fromUtf8("Назад")); + + verticalLayout->addWidget(taskBox); + verticalLayout->addWidget(filename); + verticalLayout->addWidget(chooseFileButton); + verticalLayout->addWidget(sendButton); + verticalLayout->addWidget(result); + verticalLayout->addWidget(backButton); + + SolutionsWindow->setCentralWidget(centralwidget); +} + +void SolutionsWindow::on_backButton_clicked() { + close(); + qobject_cast(parent())->show(); +} + +void SolutionsWindow::on_chooseFileButton_clicked() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a file to send"), QDir::homePath()); + filename->setText(QFileInfo(fileName).fileName()); + std::ifstream file(fileName.toUtf8().constData()); + std::ostringstream sstr; + sstr << file.rdbuf(); + source = sstr.str(); +} + +void SolutionsWindow::on_sendButton_clicked() { + if (source.empty()) { + QMessageBox::warning(this, "Ошибка отправки", "Нельзя отправить пустое решение"); + return; + } + std::cout << source; +} + + diff --git a/client/internal/gui/src/TasksWindow.cpp b/client/internal/gui/src/TasksWindow.cpp new file mode 100644 index 0000000..f5c4884 --- /dev/null +++ b/client/internal/gui/src/TasksWindow.cpp @@ -0,0 +1,107 @@ +#include "TasksWindow.h" + +#include +#include +#include + +#include "SolutionsWindow.h" +#include "UIManager.h" + +TasksWindow::TasksWindow(QWidget *parent) : QMainWindow(parent) { + tasks_vector.push_back({1, "1 description 1\n" + "1\n" + "2\n" + "3\n" + "4\n" + "5\n" + "6\n" + "7\n" + "8\n" + "9\n" + "10\n" + "11\n" + "12\n" + "13\n" + "14\n"}); + tasks_vector.push_back({2, "2 description"}); + tasks_vector.push_back({3, "3 description"}); + + setupUi(this); + connect(tasks, &QComboBox::currentIndexChanged, this, &TasksWindow::indexChanged); + connect(goToTaskButton, &QPushButton::clicked, this, &TasksWindow::on_goToTaskButton_clicked); + connect(backButton, &QPushButton::clicked, this, &TasksWindow::on_backButton_clicked); +} + + + +void TasksWindow::setupUi(QMainWindow *UserWindow) { + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(UserWindow->sizePolicy().hasHeightForWidth()); + UserWindow->setSizePolicy(sizePolicy); + + centralwidget = new QWidget(UserWindow); + verticalLayout = new QVBoxLayout(centralwidget); + + taskChooseGroupBox = new QGroupBox(centralwidget); + sizePolicy.setHeightForWidth(taskChooseGroupBox->sizePolicy().hasHeightForWidth()); + taskChooseGroupBox->setFixedHeight(85); + taskChooseGroupBox->setSizePolicy(sizePolicy); + + taskVerticalLayout = new QVBoxLayout(taskChooseGroupBox); + + label = new QLabel(this); + label->setText(QString::fromUtf8("Выберите номер задания:")); + + tasks = new QComboBox(this); + for (int i = 0; i < tasks_vector.size(); i++) { + tasks->insertItem(i, QString::number(tasks_vector[i].id)); + } + tasks->setCurrentIndex(0); + + taskVerticalLayout->addWidget(label); + taskVerticalLayout->addWidget(tasks); + + taskDescription = new QLabel(this); + std::string description = tasks_vector[0].description; + taskDescription->setText(QString(description.c_str())); + + buttonsWidget = new QWidget(centralwidget); + sizePolicy.setHeightForWidth(buttonsWidget->sizePolicy().hasHeightForWidth()); + buttonsWidget->setFixedHeight(45); + + buttonsLayout = new QHBoxLayout(buttonsWidget); + + goToTaskButton = new QPushButton(this); + goToTaskButton->setText(QString::fromUtf8("Перейти к сдаче")); + + backButton = new QPushButton(this); + backButton->setText(QString::fromUtf8("Выйти")); + + buttonsLayout->addWidget(goToTaskButton); + buttonsLayout->addWidget(backButton); + + verticalLayout->addWidget(taskChooseGroupBox); + verticalLayout->addWidget(taskDescription); + verticalLayout->addWidget(buttonsWidget); + + UserWindow->setCentralWidget(centralwidget); +} + +void TasksWindow::indexChanged() { + std::string description = tasks_vector[tasks->currentIndex()].description; + taskDescription->setText(QString(description.c_str())); +} + +void TasksWindow::on_backButton_clicked() { + // Core::logout(); + close(); + qobject_cast(parent())->showEntryWindow(); +} + +void TasksWindow::on_goToTaskButton_clicked() { + hide(); + auto* solutionsWindow = new SolutionsWindow(tasks_vector[tasks->currentIndex()], this); + solutionsWindow->show(); +} diff --git a/client/internal/gui/src/UIManager.cpp b/client/internal/gui/src/UIManager.cpp index fc23301..101e034 100644 --- a/client/internal/gui/src/UIManager.cpp +++ b/client/internal/gui/src/UIManager.cpp @@ -1,11 +1,19 @@ #include "UIManager.h" #include "EntryWindow.h" -#include "UserWindow.h" +#include "TasksWindow.h" #include "SignUpDialog.h" +#include "AuthDialog.h" -void UIManager::showEntryWindow() {} +void UIManager::showEntryWindow() { + entryWindow->show(); +} -void UIManager::showUserWindow() {} +void UIManager::showTasksWindow() { + userWindow->show(); +} -UIManager::UIManager() = default; +UIManager::UIManager(QWidget *parent) : QWidget(parent) { + userWindow = new TasksWindow(this); + entryWindow = new EntryWindow(this); +} diff --git a/client/internal/gui/src/UserWindow.cpp b/client/internal/gui/src/UserWindow.cpp deleted file mode 100644 index 8e6169b..0000000 --- a/client/internal/gui/src/UserWindow.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "UserWindow.h" - -#include -#include -#include - -UserWindow::UserWindow(QWidget *parent) : QMainWindow(parent) {} - -void UserWindow::onBackButtonClicked() {} diff --git a/client/internal/gui/tests/main.cpp b/client/internal/gui/tests/main.cpp index d9f4b73..2348fac 100644 --- a/client/internal/gui/tests/main.cpp +++ b/client/internal/gui/tests/main.cpp @@ -3,7 +3,7 @@ #include "UIManager.h" #include "EntryWindow.h" -#include "UserWindow.h" +#include "TasksWindow.h" #include @@ -18,7 +18,7 @@ TEST(ConstructorTest, EntryWindow) { TEST(ConstructorTest, UserWindow) { int fake = 0; QApplication a(fake, nullptr); - UserWindow uw; + TasksWindow uw; EXPECT_NO_FATAL_FAILURE(uw.show()); a.exec(); } @@ -35,7 +35,7 @@ TEST(ConstructorTest, UIManagerUW) { int fake_argc = 0; QApplication a(fake_argc, nullptr); UIManager um; - EXPECT_NO_FATAL_FAILURE(um.showUserWindow()); + EXPECT_NO_FATAL_FAILURE(um.showTasksWindow()); a.exec(); } -- GitLab From 22700025bb6d7dd8fd8cd97687753cdb3b70e5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 11 May 2023 19:41:13 +0300 Subject: [PATCH 047/134] add core and login/register requests on client --- client/internal/CMakeLists.txt | 6 +- client/internal/core/CMakeLists.txt | 18 +++++ client/internal/core/include/Core.h | 20 +++++ client/internal/core/src/Core.cpp | 26 +++++++ client/internal/entities/include/Metric.h | 5 +- client/internal/entities/include/Solution.h | 54 +------------- client/internal/entities/include/Task.h | 7 +- client/internal/entities/include/User.h | 33 +-------- client/internal/entities/src/Solution.cpp | 73 ------------------- client/internal/entities/src/Task.cpp | 3 + client/internal/entities/src/User.cpp | 43 ----------- .../httpClient/include/HttpClientManager.h | 8 +- .../internal/httpClient/include/Serializer.h | 14 ++-- .../httpClient/src/HttpClientManager.cpp | 30 ++++++-- client/internal/httpClient/src/Serializer.cpp | 39 ++++++++++ 15 files changed, 157 insertions(+), 222 deletions(-) create mode 100644 client/internal/core/CMakeLists.txt create mode 100644 client/internal/core/include/Core.h create mode 100644 client/internal/core/src/Core.cpp delete mode 100644 client/internal/entities/src/Solution.cpp create mode 100644 client/internal/entities/src/Task.cpp delete mode 100644 client/internal/entities/src/User.cpp create mode 100644 client/internal/httpClient/src/Serializer.cpp diff --git a/client/internal/CMakeLists.txt b/client/internal/CMakeLists.txt index f76cc95..790ec14 100644 --- a/client/internal/CMakeLists.txt +++ b/client/internal/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(entities) add_subdirectory(httpClient) add_subdirectory(gui) +add_subdirectory(core) set(libClientEntities_LIB ${libClientEntities_LIB} PARENT_SCOPE) set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOPE) @@ -9,4 +10,7 @@ set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) -set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file +set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) + +set(CORE_lib_LIB ${CORE_lib_LIB} PARENT_SCOPE) +set(CORE_lib_INCLUDE_DIRS ${CORE_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/core/CMakeLists.txt b/client/internal/core/CMakeLists.txt new file mode 100644 index 0000000..8a2af66 --- /dev/null +++ b/client/internal/core/CMakeLists.txt @@ -0,0 +1,18 @@ +project("CoreLib") + +set(CMAKE_CXX_STANDARD 20) + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) +file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) + +include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS} ${HTTPCLIENT_lib_INCLUDE_DIRS}) + +add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) +target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} ${HTTPCLIENT_lib_LIB}) + +set(CORE_lib_LIB ${PROJECT_NAME}) +set(CORE_lib_LIB ${CORE_lib_LIB} PARENT_SCOPE) + +set(CORE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(CORE_lib_INCLUDE_DIRS ${CORE_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/core/include/Core.h b/client/internal/core/include/Core.h new file mode 100644 index 0000000..d88af4d --- /dev/null +++ b/client/internal/core/include/Core.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include + +#include "Task.h" + +class Core { +public: + Core() { user_id = -1; }; + + static unsigned signUp(const std::string &login, const std::string &username, const std::string &pass); + + static unsigned login(const std::string &login, const std::string &pass); + + static void logout(); + +private: + static std::size_t user_id; +}; diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp new file mode 100644 index 0000000..bf3d43d --- /dev/null +++ b/client/internal/core/src/Core.cpp @@ -0,0 +1,26 @@ +// +// Created by Николай Степанов on 11.05.2023. +// +#include "Core.h" +#include "HttpClientManager.h" + +const std::string CLIENT_IP = "0.0.0.0"; +const std::string CLIENT_PORT = "80"; +HttpClientManager client(CLIENT_IP, CLIENT_PORT); + +unsigned Core::signUp(const std::string &login, const std::string &username, const std::string &pass) { + auto res = client.registerUser(login, username, pass); + user_id = res.second.id; + return res.first; +} + +unsigned Core::login(const std::string &login, const std::string &pass) { + auto res = client.loginUser(login, pass); + user_id = res.second.id; + return res.first; +} + +void Core::logout() { + user_id = -1; +} + diff --git a/client/internal/entities/include/Metric.h b/client/internal/entities/include/Metric.h index 3ab8ea7..db320cf 100644 --- a/client/internal/entities/include/Metric.h +++ b/client/internal/entities/include/Metric.h @@ -1,5 +1,4 @@ -#ifndef SOURCEDOUT_METRIC_H -#define SOURCEDOUT_METRIC_H +#pragma once #include @@ -7,5 +6,3 @@ struct Metric { std::string name; unsigned int value; }; - -#endif //SOURCEDOUT_METRIC_H diff --git a/client/internal/entities/include/Solution.h b/client/internal/entities/include/Solution.h index 6282f47..384e648 100644 --- a/client/internal/entities/include/Solution.h +++ b/client/internal/entities/include/Solution.h @@ -1,58 +1,10 @@ -#ifndef SOURCEDOUT_SOLUTION_HPP -#define SOURCEDOUT_SOLUTION_HPP +#pragma once #include #include #include -class Solution { -public: - Solution() =default; - Solution(size_t id, std::string sendDate, size_t senderId, std::string source, - std::string tokens, std::string astTree, size_t taskId, std::string result); - - [[nodiscard]] size_t getId() const; - - - [[nodiscard]] const std::string &getSendDate() const; - - void setSendDate(const std::string &sendDate); - - [[nodiscard]] size_t getSenderId() const; - - void setSenderId(size_t senderId); - - [[nodiscard]] const std::string &getSource() const; - - void setSource(const std::string &source); - - [[nodiscard]] const std::string &getTokens() const; - - void setTokens(const std::string &tokens); - - [[nodiscard]] const std::string &getAstTree() const; - - void setAstTree(const std::string &astTree); - - [[nodiscard]] size_t getTaskId() const; - - void setTaskId(size_t taskId); - - [[nodiscard]] const std::string &getResult() const; - - void setResult(const std::string &result); - -private: +struct Solution { size_t id; - std::string send_date; - size_t sender_id; std::string source; - std::string tokens; - std::string astTree; - size_t task_id; - std::string result; -public: - -}; - -#endif //SOURCEDOUT_SOLUTION_HPP \ No newline at end of file +}; \ No newline at end of file diff --git a/client/internal/entities/include/Task.h b/client/internal/entities/include/Task.h index 9d87ca6..de9c488 100644 --- a/client/internal/entities/include/Task.h +++ b/client/internal/entities/include/Task.h @@ -1,11 +1,10 @@ -#ifndef SOURCEDOUT_TASK_HPP -#define SOURCEDOUT_TASK_HPP +#pragma once #include struct Task{ std::size_t id; std::string description; -}; -#endif //SOURCEDOUT_TASK_HPP \ No newline at end of file + Task(std::size_t id, std::string_view desc); +}; diff --git a/client/internal/entities/include/User.h b/client/internal/entities/include/User.h index 5802df2..9482540 100644 --- a/client/internal/entities/include/User.h +++ b/client/internal/entities/include/User.h @@ -1,38 +1,11 @@ -#ifndef SOURCEDOUT_USER_HPP +#pragma once #include #include -#define SOURCEDOUT_USER_HPP - -class User { -private: +struct User { size_t id; std::string login; std::string password; std::string username; - -public: - User()=default; - User(size_t id_, std::string login_, std::string password_, std::string username_); - - User(std::string login_, std::string password_, std::string username_); - - [[nodiscard]] const std::string &getLogin() const; - - void setLogin(const std::string &login); - - [[nodiscard]] const std::string &getPassword() const; - - void setPassword(const std::string &password); - - [[nodiscard]] const std::string &getUsername() const; - - void setUsername(const std::string &username); - - [[nodiscard]] size_t getId() const; - - friend std::ostream &operator<<(std::ostream &os, const User &user); -}; - -#endif //SOURCEDOUT_USER_HPP \ No newline at end of file +}; \ No newline at end of file diff --git a/client/internal/entities/src/Solution.cpp b/client/internal/entities/src/Solution.cpp deleted file mode 100644 index 2e9b1e8..0000000 --- a/client/internal/entities/src/Solution.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -#include -#include -#include "Solution.h" - -Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, - std::string source, std::string tokens, - std::string astTree, unsigned long taskId, - std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), - source(std::move(source)), tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)) {} - -size_t Solution::getId() const { - return id; -} - - -const std::string &Solution::getSendDate() const { - return send_date; -} - -void Solution::setSendDate(const std::string &sendDate) { - send_date = sendDate; -} - -size_t Solution::getSenderId() const { - return sender_id; -} - -void Solution::setSenderId(size_t senderId) { - sender_id = senderId; -} - -const std::string &Solution::getSource() const { - return source; -} - -void Solution::setSource(const std::string &source_) { - Solution::source = source_; -} - -const std::string &Solution::getTokens() const { - return tokens; -} - -void Solution::setTokens(const std::string &tokens_) { - Solution::tokens = tokens_; -} - -const std::string &Solution::getAstTree() const { - return astTree; -} - -void Solution::setAstTree(const std::string &astTree_) { - Solution::astTree = astTree_; -} - -size_t Solution::getTaskId() const { - return task_id; -} - -void Solution::setTaskId(size_t taskId) { - task_id = taskId; -} - -const std::string &Solution::getResult() const { - return result; -} - -void Solution::setResult(const std::string &result_) { - Solution::result = result_; -} \ No newline at end of file diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp new file mode 100644 index 0000000..496fddc --- /dev/null +++ b/client/internal/entities/src/Task.cpp @@ -0,0 +1,3 @@ +#include "Task.h" + +Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc); \ No newline at end of file diff --git a/client/internal/entities/src/User.cpp b/client/internal/entities/src/User.cpp deleted file mode 100644 index 53706e2..0000000 --- a/client/internal/entities/src/User.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include "User.h" - -User::User(size_t id_, std::string login_, std::string password_, std::string username_) : - id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { -} -User::User(std::string login_, std::string password_, std::string username_) : - id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { -} - -const std::string &User::getLogin() const { - return login; -} - -void User::setLogin(const std::string &login_) { - User::login = login_; -} - -const std::string &User::getPassword() const { - return password; -} - -void User::setPassword(const std::string &password_) { - User::password = password_; -} - -const std::string &User::getUsername() const { - return username; -} - -void User::setUsername(const std::string &username_) { - User::username = username_; -} - -size_t User::getId() const { - return id; -} - -std::ostream &operator<<(std::ostream &os, const User &user) { - os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " - << user.username; - return os; -} \ No newline at end of file diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index 7c3ed33..eb93fcb 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -14,17 +14,17 @@ class HttpClientManager { public: - HttpClientManager(std::string_view host_, std::string_view port_, std::string_view saved_path_); + HttpClientManager(std::string_view host_, std::string_view port_); - unsigned int loginUser(const std::string &login, const std::string &password); - unsigned int registerUser(const std::string &login, const std::string &username, const std::string &password); + std::pair loginUser(const std::string &login, const std::string &password); + std::pair registerUser(const std::string &login, const std::string &username, + const std::string &password); unsigned int submitSolution(const int& user_id, const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); std::vector getMetrics(const int& sol_id); void setHttpClient(std::shared_ptr client_); private: - std::string saved_path; std::string host; std::string port; std::shared_ptr client; diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index 4f4dc32..42be6c8 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -1,12 +1,14 @@ -#ifndef APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ -#define APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ +#pragma once #include #include #include +#include "User.h" -class Serializer {}; +class Serializer { +public: + std::string serialLoginData(std::string_view login, std::string_view password); + std::string serialRegisterData(std::string_view login, std::string_view username, std::string_view password); + User deserialUserData(std::string_view body); +}; - - -#endif // APP_HTTPCLIENT_HTTPCLIENT_SERIALIZER_H_ diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index 9d7b1e4..a269f65 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -6,18 +6,36 @@ #include "HttpClient.h" -HttpClientManager::HttpClientManager(std::string_view host_, std::string_view port_, std::string_view saved_path_) : - host(host_), port(port_), saved_path(saved_path_), +HttpClientManager::HttpClientManager(std::string_view host_, std::string_view port_) : + host(host_), port(port_), client(std::make_shared(host_, port_)), serializer(std::make_shared()) {} -unsigned int HttpClientManager::loginUser(const std::string &login, const std::string &password) { - +std::pair HttpClientManager::loginUser(const std::string &login, const std::string &password) { + std::string body = serializer->serialLoginData(login, password); + http::response res = client->makeGetRequest("/user/login", body); + unsigned status = res.result_int(); + std::string res_body; + for (auto seq : res.body().data()) { + auto* cbuf = boost::asio::buffer_cast(seq); + res_body.append(cbuf, boost::asio::buffer_size(seq)); + } + User user = serializer->deserialUserData(res_body); + return {status, user}; } -unsigned int HttpClientManager::registerUser(const std::string &login, const std::string &username, +std::pair HttpClientManager::registerUser(const std::string &login, const std::string &username, const std::string &password) { - return 0; + std::string body = serializer->serialRegisterData(login, username, password); + http::response res = client->makeGetRequest("/user/register", body); + unsigned status = res.result_int(); + std::string res_body; + for (auto seq : res.body().data()) { + auto* cbuf = boost::asio::buffer_cast(seq); + res_body.append(cbuf, boost::asio::buffer_size(seq)); + } + User user = serializer->deserialUserData(res_body); + return {status, user}; } unsigned int HttpClientManager::submitSolution(const int &user_id, const std::string &path_to_sound) { diff --git a/client/internal/httpClient/src/Serializer.cpp b/client/internal/httpClient/src/Serializer.cpp new file mode 100644 index 0000000..c2d5567 --- /dev/null +++ b/client/internal/httpClient/src/Serializer.cpp @@ -0,0 +1,39 @@ +#include "Serializer.h" + +#include +#include +#include + +std::string Serializer::serialLoginData(std::string_view login, std::string_view password) { + boost::property_tree::ptree json; + json.put("login", login); + json.put("password", password); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} + +User Serializer::deserialUserData(std::string_view body) { + std::stringstream ss; + ss << body; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + User res = { + json.get("user_id"), + json.get("login"), + json.get("password"), + json.get("username") + }; + return res; +} + +std::string +Serializer::serialRegisterData(std::string_view login, std::string_view username, std::string_view password) { + boost::property_tree::ptree json; + json.put("login", login); + json.put("username", username); + json.put("password", password); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} -- GitLab From d7b3cad1f97abaa4fe1f7de0f1ff9c52ae0cf170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 11 May 2023 19:54:36 +0300 Subject: [PATCH 048/134] fix login/register on server --- .../internal/httpServer/include/Serializer.h | 1 + .../internal/httpServer/include/UserManager.h | 4 ++ server/internal/httpServer/src/Serializer.cpp | 11 +++++ .../internal/httpServer/src/UserManager.cpp | 48 ++++++++++++------- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 34cb67a..9af1b01 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -20,6 +20,7 @@ public: std::string serialSolutions(const std::vector& solutions); std::string serialAllTasks(const std::vector& tasks); + std::string serialUserData(const User& user); }; diff --git a/server/internal/httpServer/include/UserManager.h b/server/internal/httpServer/include/UserManager.h index 01a16de..9cf0900 100644 --- a/server/internal/httpServer/include/UserManager.h +++ b/server/internal/httpServer/include/UserManager.h @@ -17,6 +17,10 @@ class UserManager : public IUserManager { private: std::shared_ptr userService; std::shared_ptr serializer; + + // for tests with client + int count = 0; + std::vector users; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index 8d2569a..108430a 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -101,3 +101,14 @@ std::string Serializer::serialAllTasks(const std::vector &tasks) { boost::property_tree::write_json(out, json); return out.str(); } + +std::string Serializer::serialUserData(const User &user) { + boost::property_tree::ptree json; + json.put("id", user.getId()); + json.put("login", user.getLogin()); + json.put("username", user.getUsername()); + json.put("password", user.getPassword()); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index 4048afd..335ad4d 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -10,32 +10,46 @@ http::message_generator UserManager::loginUser(http::request std::string login, password; std::tie(login, password) = serializer->deserialUserData(req.body()); - /// TODO - - auto const bad_request = - [&req](beast::string_view why) - { - http::response res{http::status::bad_request, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - return bad_request("123"); + bool found = false; + User user; + for (const auto& i : users) { + if (i.getPassword() == password && i.getLogin() == login && !found) { + user = i; + found = true; + } + } + if (found) { + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialUserData(user); + res.prepare_payload(); + return res; + } else { + http::response res{http::status::not_found, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialUserData(user); + res.prepare_payload(); + return res; + } } http::message_generator UserManager::registerUser(http::request &&req) { std::string login, password, username; std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); - User user = userService->createUser(login, username, password); +// User user = userService->createUser(login, username, password); + count++; + User user = User(count, login, password, username); + std::cout << user << std::endl; + users.push_back(user); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = std::to_string(user.getId()); + res.body() = serializer->serialUserData(user); res.prepare_payload(); return res; } -- GitLab From b1ceee88ff01fd20d39533b52d80f8fd29f15c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sun, 14 May 2023 14:15:17 +0300 Subject: [PATCH 049/134] Create mvp for http_server, http_client and gui --- client/internal/CMakeLists.txt | 10 ++-- client/internal/core/CMakeLists.txt | 6 +- client/internal/core/include/Core.h | 9 ++- client/internal/core/src/Core.cpp | 22 +++++-- client/internal/entities/include/Solution.h | 1 + client/internal/entities/src/Task.cpp | 2 +- client/internal/gui/CMakeLists.txt | 4 +- client/internal/gui/include/AddTaskDialog.h | 29 +++++++++ client/internal/gui/include/SolutionsWindow.h | 2 +- client/internal/gui/include/TasksWindow.h | 3 + client/internal/gui/src/AddTaskDialog.cpp | 60 +++++++++++++++++++ client/internal/gui/src/AuthDialog.cpp | 8 +-- client/internal/gui/src/SignUpDialog.cpp | 19 +++--- client/internal/gui/src/SolutionsWindow.cpp | 15 ++--- client/internal/gui/src/TasksWindow.cpp | 48 +++++++++------ .../internal/httpClient/include/HttpClient.h | 3 +- .../httpClient/include/HttpClientManager.h | 5 +- .../internal/httpClient/include/Serializer.h | 7 +++ client/internal/httpClient/src/HttpClient.cpp | 15 +++-- .../httpClient/src/HttpClientManager.cpp | 37 +++++++++--- client/internal/httpClient/src/Serializer.cpp | 49 +++++++++++++++ .../internal/httpServer/include/Serializer.h | 1 + .../httpServer/include/SolutionManager.h | 1 - .../internal/httpServer/include/TaskManager.h | 5 +- .../httpServer/include/TmpSolutionService.h | 25 ++++++++ .../httpServer/include/TmpTaskService.h | 40 +++++++++++++ .../httpServer/include/TmpUserService.h | 34 +++++++++++ server/internal/httpServer/src/Router.cpp | 4 -- server/internal/httpServer/src/Serializer.cpp | 12 +++- .../httpServer/src/SolutionManager.cpp | 25 ++------ .../internal/httpServer/src/TaskManager.cpp | 7 ++- .../internal/httpServer/src/UserManager.cpp | 22 +++---- .../httpServer/virtual/ISolutionManager.h | 1 - 33 files changed, 405 insertions(+), 126 deletions(-) create mode 100644 client/internal/gui/include/AddTaskDialog.h create mode 100644 client/internal/gui/src/AddTaskDialog.cpp create mode 100644 server/internal/httpServer/include/TmpSolutionService.h create mode 100644 server/internal/httpServer/include/TmpTaskService.h create mode 100644 server/internal/httpServer/include/TmpUserService.h diff --git a/client/internal/CMakeLists.txt b/client/internal/CMakeLists.txt index 790ec14..b540366 100644 --- a/client/internal/CMakeLists.txt +++ b/client/internal/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(entities) add_subdirectory(httpClient) -add_subdirectory(gui) add_subdirectory(core) +add_subdirectory(gui) set(libClientEntities_LIB ${libClientEntities_LIB} PARENT_SCOPE) set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOPE) @@ -9,8 +9,8 @@ set(libClientEntities_INCLUDE_DIRS ${libClientEntities_INCLUDE_DIRS} PARENT_SCOP set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) -set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) -set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) - set(CORE_lib_LIB ${CORE_lib_LIB} PARENT_SCOPE) -set(CORE_lib_INCLUDE_DIRS ${CORE_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file +set(CORE_lib_INCLUDE_DIRS ${CORE_lib_INCLUDE_DIRS} PARENT_SCOPE) + +set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) +set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/core/CMakeLists.txt b/client/internal/core/CMakeLists.txt index 8a2af66..a493beb 100644 --- a/client/internal/core/CMakeLists.txt +++ b/client/internal/core/CMakeLists.txt @@ -6,13 +6,13 @@ file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) -include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS} ${HTTPCLIENT_lib_INCLUDE_DIRS}) +include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS} ${HTTPCLIENT_lib_INCLUDE_DIRS} ${Boost_INCLUDE_DIR}) add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) -target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} ${HTTPCLIENT_lib_LIB}) +target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} ${HTTPCLIENT_lib_LIB} ${Boost_LIBRARIES}) set(CORE_lib_LIB ${PROJECT_NAME}) set(CORE_lib_LIB ${CORE_lib_LIB} PARENT_SCOPE) -set(CORE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(CORE_lib_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) set(CORE_lib_INCLUDE_DIRS ${CORE_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/core/include/Core.h b/client/internal/core/include/Core.h index d88af4d..f28be4a 100644 --- a/client/internal/core/include/Core.h +++ b/client/internal/core/include/Core.h @@ -4,15 +4,20 @@ #include #include "Task.h" +#include "Solution.h" class Core { public: - Core() { user_id = -1; }; - static unsigned signUp(const std::string &login, const std::string &username, const std::string &pass); static unsigned login(const std::string &login, const std::string &pass); + static std::vector getAllTasks(); + + static Solution submitSolution(const int& task_id, const std::string& path_to_file); + + static unsigned int createTask(const std::string &desc); + static void logout(); private: diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index bf3d43d..52baa40 100644 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -5,22 +5,36 @@ #include "HttpClientManager.h" const std::string CLIENT_IP = "0.0.0.0"; -const std::string CLIENT_PORT = "80"; +const std::string CLIENT_PORT = "8080"; HttpClientManager client(CLIENT_IP, CLIENT_PORT); +std::size_t Core::user_id = -1; + unsigned Core::signUp(const std::string &login, const std::string &username, const std::string &pass) { auto res = client.registerUser(login, username, pass); - user_id = res.second.id; + Core::user_id = res.second.id; return res.first; } unsigned Core::login(const std::string &login, const std::string &pass) { auto res = client.loginUser(login, pass); - user_id = res.second.id; + Core::user_id = res.second.id; return res.first; } void Core::logout() { - user_id = -1; + Core::user_id = -1; +} + +std::vector Core::getAllTasks() { + return client.getAllTasks(); +} + +Solution Core::submitSolution(const int &task_id, const std::string &path_to_file) { + return client.submitSolution(user_id, task_id, path_to_file); +} + +unsigned int Core::createTask(const std::string &desc) { + return client.createTask(desc); } diff --git a/client/internal/entities/include/Solution.h b/client/internal/entities/include/Solution.h index 384e648..4cf7061 100644 --- a/client/internal/entities/include/Solution.h +++ b/client/internal/entities/include/Solution.h @@ -7,4 +7,5 @@ struct Solution { size_t id; std::string source; + std::string result; }; \ No newline at end of file diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp index 496fddc..e1de440 100644 --- a/client/internal/entities/src/Task.cpp +++ b/client/internal/entities/src/Task.cpp @@ -1,3 +1,3 @@ #include "Task.h" -Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc); \ No newline at end of file +Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc) {}; \ No newline at end of file diff --git a/client/internal/gui/CMakeLists.txt b/client/internal/gui/CMakeLists.txt index 1f206bf..419c4dd 100644 --- a/client/internal/gui/CMakeLists.txt +++ b/client/internal/gui/CMakeLists.txt @@ -12,10 +12,10 @@ file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) set(CMAKE_PREFIX_PATH "~/Qt/6.5.0/macos/lib/cmake") find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui) -include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS}) +include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS} ${CORE_lib_INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) -target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} Qt6::Widgets Qt6::Core Qt6::Gui) +target_link_libraries(${PROJECT_NAME} ${libClientEntities_LIB} ${CORE_lib_LIB} Qt6::Widgets Qt6::Core Qt6::Gui) set(GUI_lib_LIB ${PROJECT_NAME}) set(GUI_lib_LIB ${GUI_lib_LIB} PARENT_SCOPE) diff --git a/client/internal/gui/include/AddTaskDialog.h b/client/internal/gui/include/AddTaskDialog.h new file mode 100644 index 0000000..c5b6547 --- /dev/null +++ b/client/internal/gui/include/AddTaskDialog.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class AddTaskDialog : public QDialog { +Q_OBJECT + +public: + explicit AddTaskDialog(QWidget *parent = nullptr); + +public slots: + void on_createButton_clicked(); + void on_backButton_clicked(); + +private: + QVBoxLayout* verticalLayout = nullptr; + QLabel* label = nullptr; + QTextEdit* editor = nullptr; + QPushButton *createButton = nullptr; + QPushButton *backButton = nullptr; + + void setupUi(QDialog *AddTaskDialog); +}; diff --git a/client/internal/gui/include/SolutionsWindow.h b/client/internal/gui/include/SolutionsWindow.h index 103c2fb..80544e5 100644 --- a/client/internal/gui/include/SolutionsWindow.h +++ b/client/internal/gui/include/SolutionsWindow.h @@ -26,7 +26,7 @@ private slots: private: Task task; - std::string source; + std::string path_to_file; QWidget *centralwidget = nullptr; QGroupBox* taskBox = nullptr; diff --git a/client/internal/gui/include/TasksWindow.h b/client/internal/gui/include/TasksWindow.h index c8f96bd..1a897fd 100644 --- a/client/internal/gui/include/TasksWindow.h +++ b/client/internal/gui/include/TasksWindow.h @@ -20,6 +20,7 @@ public: public slots: void on_backButton_clicked(); + void on_addTaskButton_clicked(); void on_goToTaskButton_clicked(); void indexChanged(); @@ -33,6 +34,7 @@ private: QComboBox* tasks = nullptr; QLabel* taskDescription = nullptr; QPushButton* goToTaskButton = nullptr; + QPushButton* addTaskButton = nullptr; QPushButton* backButton = nullptr; QWidget* buttonsWidget = nullptr; QHBoxLayout* buttonsLayout = nullptr; @@ -40,6 +42,7 @@ private: std::vector tasks_vector; void setupUi(QMainWindow *UserWindow); + void updateTasks(); }; #endif // USERWINDOW_H diff --git a/client/internal/gui/src/AddTaskDialog.cpp b/client/internal/gui/src/AddTaskDialog.cpp new file mode 100644 index 0000000..3fefa31 --- /dev/null +++ b/client/internal/gui/src/AddTaskDialog.cpp @@ -0,0 +1,60 @@ +#include "AddTaskDialog.h" + +#include +#include + +#include "Core.h" + +AddTaskDialog::AddTaskDialog(QWidget *parent) : QDialog(parent) { + setupUi(this); + + connect(createButton, &QPushButton::clicked, this, &AddTaskDialog::on_createButton_clicked); + connect(backButton, &QPushButton::clicked, this, &AddTaskDialog::on_backButton_clicked); +} + +void AddTaskDialog::setupUi(QDialog *AddTaskDialog) { + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(AddTaskDialog->sizePolicy().hasHeightForWidth()); + AddTaskDialog->setSizePolicy(sizePolicy); + + verticalLayout = new QVBoxLayout(AddTaskDialog); + + label = new QLabel(AddTaskDialog); + label->setText(QString::fromUtf8("Введите текст задания")); + verticalLayout->addWidget(label); + + editor = new QTextEdit(AddTaskDialog); + verticalLayout->addWidget(editor); + + createButton = new QPushButton(AddTaskDialog); + createButton->setText(QString::fromUtf8("Создать задание")); + verticalLayout->addWidget(createButton); + + backButton = new QPushButton(AddTaskDialog); + backButton->setText(QString::fromUtf8("Назад")); + verticalLayout->addWidget(backButton); +} + +void AddTaskDialog::on_createButton_clicked() { + std::string desc = editor->toPlainText().toUtf8().constData(); + if (desc.empty()) { + QMessageBox::warning(this, "Ошибка отправки", "Описание не может быть пустыми"); + return; + } + unsigned result = Core::createTask(desc); + switch (result) { + case 200: + accept(); + close(); + break; + default: + QMessageBox::critical(this, "Отправка невозможна", "Нет соединения с сервером"); + } +} + +void AddTaskDialog::on_backButton_clicked() { + reject(); + close(); +} diff --git a/client/internal/gui/src/AuthDialog.cpp b/client/internal/gui/src/AuthDialog.cpp index 5227149..2f35768 100644 --- a/client/internal/gui/src/AuthDialog.cpp +++ b/client/internal/gui/src/AuthDialog.cpp @@ -3,6 +3,8 @@ #include #include +#include "Core.h" + AuthDialog::AuthDialog(QWidget *parent) : QDialog(parent) { setupUi(this); } @@ -64,15 +66,13 @@ void AuthDialog::on_loginButton_clicked() { QMessageBox::warning(this, "Ошибка авторизации", "Логин и пароль не могут быть пустыми"); return; } -// unsigned result = Core::login(log, pass); - unsigned result = 200; + unsigned result = Core::login(std::string(log), std::string(pass)); switch (result) { case 200: - QMessageBox::warning(this, "Успешная авторизации", "Работает"); accept(); close(); break; - case 403: + case 404: QMessageBox::warning(this, "Ошибка авторизации","Неправильный логин или пароль"); break; default: diff --git a/client/internal/gui/src/SignUpDialog.cpp b/client/internal/gui/src/SignUpDialog.cpp index 015f65f..1cdc2a3 100644 --- a/client/internal/gui/src/SignUpDialog.cpp +++ b/client/internal/gui/src/SignUpDialog.cpp @@ -4,7 +4,7 @@ #include #include -//#include "Core.h" +#include "Core.h" SignUpDialog::SignUpDialog(QWidget *parent) : QDialog(parent) { setupUi(this); @@ -74,13 +74,12 @@ void SignUpDialog::retranslateUi(QDialog *SignUpDialog) { } void SignUpDialog::on_signUpButton_clicked() { - std::string login = this->login->text().toUtf8().constData(); - std::string username = this->username->text().toUtf8().constData(); - std::string password = this->password->text().toUtf8().constData(); - std::string passwordRepeat = this->passwordRepeat->text().toUtf8().constData(); - if (password == passwordRepeat && !login.empty() && !username.empty()) { -// unsigned response = Core::signUp(log.toStdString(), pass.toStdString()); - unsigned response = 200; + std::string log = this->login->text().toUtf8().constData(); + std::string usr = this->username->text().toUtf8().constData(); + std::string pass = this->password->text().toUtf8().constData(); + std::string passRepeat = this->passwordRepeat->text().toUtf8().constData(); + if (pass == passRepeat && !log.empty() && !usr.empty()) { + unsigned response = Core::signUp(log, usr, pass); switch (response) { case 200: QMessageBox::information(this, "Успех!", "Вы успешно зарегистрированы!"); @@ -94,9 +93,9 @@ void SignUpDialog::on_signUpButton_clicked() { QMessageBox::critical(this, "Регистрация невозможна!", "Нет соединения с сервером!"); } - } else if (login.empty()) { + } else if (log.empty()) { QMessageBox::warning(this, "Ошибка!", "Логин не может быть пустым!"); - } else if (username.empty()) { + } else if (usr.empty()) { QMessageBox::warning(this, "Ошибка!", "Имя не может быть пустым!"); } else { QMessageBox::warning(this, "Ошибка!", "Пароли не совпадают!"); diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index 33743ee..17832a3 100644 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -5,6 +5,9 @@ #include #include +#include "Solution.h" +#include "Core.h" + SolutionsWindow::SolutionsWindow(Task task, QWidget *parent) : QMainWindow(parent), task(std::move(task)) { setupUi(this); connect(backButton, &QPushButton::clicked, this, &SolutionsWindow::on_backButton_clicked); @@ -63,18 +66,12 @@ void SolutionsWindow::on_backButton_clicked() { void SolutionsWindow::on_chooseFileButton_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a file to send"), QDir::homePath()); filename->setText(QFileInfo(fileName).fileName()); - std::ifstream file(fileName.toUtf8().constData()); - std::ostringstream sstr; - sstr << file.rdbuf(); - source = sstr.str(); + path_to_file = fileName.toUtf8().constData(); } void SolutionsWindow::on_sendButton_clicked() { - if (source.empty()) { - QMessageBox::warning(this, "Ошибка отправки", "Нельзя отправить пустое решение"); - return; - } - std::cout << source; + Solution sol = Core::submitSolution(task.id, path_to_file); + result->setText(QString::fromStdString(sol.result)); } diff --git a/client/internal/gui/src/TasksWindow.cpp b/client/internal/gui/src/TasksWindow.cpp index f5c4884..04cebc7 100644 --- a/client/internal/gui/src/TasksWindow.cpp +++ b/client/internal/gui/src/TasksWindow.cpp @@ -5,36 +5,23 @@ #include #include "SolutionsWindow.h" +#include "AddTaskDialog.h" #include "UIManager.h" +#include "Core.h" TasksWindow::TasksWindow(QWidget *parent) : QMainWindow(parent) { - tasks_vector.push_back({1, "1 description 1\n" - "1\n" - "2\n" - "3\n" - "4\n" - "5\n" - "6\n" - "7\n" - "8\n" - "9\n" - "10\n" - "11\n" - "12\n" - "13\n" - "14\n"}); - tasks_vector.push_back({2, "2 description"}); - tasks_vector.push_back({3, "3 description"}); - setupUi(this); connect(tasks, &QComboBox::currentIndexChanged, this, &TasksWindow::indexChanged); connect(goToTaskButton, &QPushButton::clicked, this, &TasksWindow::on_goToTaskButton_clicked); connect(backButton, &QPushButton::clicked, this, &TasksWindow::on_backButton_clicked); + connect(addTaskButton, &QPushButton::clicked, this, &TasksWindow::on_addTaskButton_clicked); } void TasksWindow::setupUi(QMainWindow *UserWindow) { + tasks_vector = Core::getAllTasks(); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); @@ -76,10 +63,14 @@ void TasksWindow::setupUi(QMainWindow *UserWindow) { goToTaskButton = new QPushButton(this); goToTaskButton->setText(QString::fromUtf8("Перейти к сдаче")); + addTaskButton = new QPushButton(this); + addTaskButton->setText(QString::fromUtf8("Добавить задание")); + backButton = new QPushButton(this); backButton->setText(QString::fromUtf8("Выйти")); buttonsLayout->addWidget(goToTaskButton); + buttonsLayout->addWidget(addTaskButton); buttonsLayout->addWidget(backButton); verticalLayout->addWidget(taskChooseGroupBox); @@ -95,7 +86,7 @@ void TasksWindow::indexChanged() { } void TasksWindow::on_backButton_clicked() { - // Core::logout(); + Core::logout(); close(); qobject_cast(parent())->showEntryWindow(); } @@ -105,3 +96,22 @@ void TasksWindow::on_goToTaskButton_clicked() { auto* solutionsWindow = new SolutionsWindow(tasks_vector[tasks->currentIndex()], this); solutionsWindow->show(); } + +void TasksWindow::on_addTaskButton_clicked() { + AddTaskDialog addTaskDialog(this); + if (addTaskDialog.exec() == QDialog::Accepted) { + updateTasks(); + } +} + +void TasksWindow::updateTasks() { + tasks_vector = Core::getAllTasks(); + tasks->clear(); + for (int i = 0; i < tasks_vector.size(); i++) { + tasks->insertItem(i, QString::number(tasks_vector[i].id)); + } + tasks->setCurrentIndex(0); + + std::string description = tasks_vector[0].description; + taskDescription->setText(QString(description.c_str())); +} diff --git a/client/internal/httpClient/include/HttpClient.h b/client/internal/httpClient/include/HttpClient.h index 058c2b4..42c5f6d 100644 --- a/client/internal/httpClient/include/HttpClient.h +++ b/client/internal/httpClient/include/HttpClient.h @@ -16,7 +16,7 @@ using tcp = net::ip::tcp; class HttpClient : public IHttpClient { public: - HttpClient(std::string_view host, std::string_view port); + HttpClient(std::string_view host_, std::string_view port_); http::response makeGetRequest(std::string_view target, std::string_view body) override; http::response makePostRequest(std::string_view target, std::string_view body) override; @@ -29,6 +29,7 @@ private: tcp::resolver resolver; beast::tcp_stream stream; std::string host; + std::string port; }; diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index eb93fcb..80e73b9 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -19,10 +19,11 @@ public: std::pair loginUser(const std::string &login, const std::string &password); std::pair registerUser(const std::string &login, const std::string &username, const std::string &password); - unsigned int submitSolution(const int& user_id, const std::string &path_to_solution); + Solution submitSolution(const int& user_id, const int &task_id, const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); - std::vector getMetrics(const int& sol_id); + unsigned int createTask(const std::string& desc); +// std::vector getMetrics(const int& sol_id); void setHttpClient(std::shared_ptr client_); private: std::string host; diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index 42be6c8..80bdb42 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -4,11 +4,18 @@ #include #include #include "User.h" +#include "Task.h" +#include "Solution.h" class Serializer { public: std::string serialLoginData(std::string_view login, std::string_view password); std::string serialRegisterData(std::string_view login, std::string_view username, std::string_view password); + std::string serialSolutionData(const int& user_id, const int& task_id, const std::string& path_to_file); + std::string serialNewTaskData(std::string_view desc); + User deserialUserData(std::string_view body); + Solution deserialSolutionData(std::string_view body); + std::vector deserialAllTasks(std::string_view body); }; diff --git a/client/internal/httpClient/src/HttpClient.cpp b/client/internal/httpClient/src/HttpClient.cpp index d9f09fe..2dd0245 100644 --- a/client/internal/httpClient/src/HttpClient.cpp +++ b/client/internal/httpClient/src/HttpClient.cpp @@ -3,20 +3,23 @@ #include #include -HttpClient::HttpClient(std::string_view host_, std::string_view port) : +HttpClient::HttpClient(std::string_view host_, std::string_view port_) : host(host_), + port(port_), resolver(io_context), - stream(io_context) { - auto const results = resolver.resolve(host, port); - stream.connect(results); -} + stream(io_context) {} http::response HttpClient::makeRequest(std::string_view target, http::verb method, std::string_view body) { - http::request req{http::verb::get, target, 10}; + auto const results = resolver.resolve(host, port); + stream.connect(results); + http::request req{http::verb::get, target, 11}; req.set(http::field::host, host); req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); + req.set(http::field::content_type, "text/plain"); + req.content_length(body.size()); + req.body() = body; http::write(stream, req); diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index a269f65..7d6da4f 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -20,7 +20,9 @@ std::pair HttpClientManager::loginUser(const std::string &login, auto* cbuf = boost::asio::buffer_cast(seq); res_body.append(cbuf, boost::asio::buffer_size(seq)); } - User user = serializer->deserialUserData(res_body); + User user{0, "", "", ""}; + if (status == 200) + user = serializer->deserialUserData(res_body); return {status, user}; } @@ -38,22 +40,41 @@ std::pair HttpClientManager::registerUser(const std::string &log return {status, user}; } -unsigned int HttpClientManager::submitSolution(const int &user_id, const std::string &path_to_sound) { - return 0; +Solution HttpClientManager::submitSolution(const int &user_id, const int &task_id, const std::string &path_to_sound) { + std::string body = serializer->serialSolutionData(user_id, task_id, path_to_sound); + http::response res = client->makeGetRequest("/solution/submit", body); + unsigned status = res.result_int(); + std::string res_body; + for (auto seq : res.body().data()) { + auto* cbuf = boost::asio::buffer_cast(seq); + res_body.append(cbuf, boost::asio::buffer_size(seq)); + } + Solution sol = serializer->deserialSolutionData(res_body); + return sol; } unsigned int HttpClientManager::getAllSolutionsForTask(const int &user_id, const int &task_id) { return 0; } -std::vector HttpClientManager::getMetrics(const int &sol_id) { - return std::vector(); -} - void HttpClientManager::setHttpClient(std::shared_ptr client_) { client = client_; } std::vector HttpClientManager::getAllTasks() { - return std::vector(); + http::response res = client->makeGetRequest("/task/all", ""); + std::string res_body; + for (auto seq : res.body().data()) { + auto* cbuf = boost::asio::buffer_cast(seq); + res_body.append(cbuf, boost::asio::buffer_size(seq)); + } + std::vector tasks = serializer->deserialAllTasks(res_body); + return tasks; +} + +unsigned int HttpClientManager::createTask(const std::string &desc) { + std::string body = serializer->serialNewTaskData(desc); + http::response res = client->makeGetRequest("/task/create", body); + unsigned int result = res.result_int(); + return result; } diff --git a/client/internal/httpClient/src/Serializer.cpp b/client/internal/httpClient/src/Serializer.cpp index c2d5567..e76eca4 100644 --- a/client/internal/httpClient/src/Serializer.cpp +++ b/client/internal/httpClient/src/Serializer.cpp @@ -1,6 +1,7 @@ #include "Serializer.h" #include +#include #include #include @@ -37,3 +38,51 @@ Serializer::serialRegisterData(std::string_view login, std::string_view username boost::property_tree::write_json(out, json); return out.str(); } + +std::vector Serializer::deserialAllTasks(std::string_view body) { + std::stringstream ss; + ss << body; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + std::vector tasks; + for (auto &sound : json.get_child("tasks")) { + Task new_task(sound.second.get("task_id"), sound.second.get("description")); + tasks.push_back(new_task); + } + return tasks; +} + +std::string Serializer::serialSolutionData(const int &user_id, const int &task_id, const std::string& path_to_file) { + boost::property_tree::ptree json; + json.put("user_id", user_id); + json.put("task_id", task_id); + std::ifstream file(path_to_file); + std::ostringstream sstr; + sstr << file.rdbuf(); + std::string source = sstr.str(); + json.put("source", source); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} + +Solution Serializer::deserialSolutionData(std::string_view body) { + std::stringstream ss; + ss << body; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + Solution res = { + json.get("sol_id"), + json.get("source"), + json.get("result"), + }; + return res; +} + +std::string Serializer::serialNewTaskData(std::string_view desc) { + boost::property_tree::ptree json; + json.put("description", desc); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 9af1b01..19120d1 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -21,6 +21,7 @@ public: std::string serialSolutions(const std::vector& solutions); std::string serialAllTasks(const std::vector& tasks); std::string serialUserData(const User& user); + std::string serialSolution(const Solution& sol); }; diff --git a/server/internal/httpServer/include/SolutionManager.h b/server/internal/httpServer/include/SolutionManager.h index 2c69a61..166aee3 100644 --- a/server/internal/httpServer/include/SolutionManager.h +++ b/server/internal/httpServer/include/SolutionManager.h @@ -17,7 +17,6 @@ class SolutionManager : public ISolutionManager { SolutionManager(); http::message_generator getAllSolutions(http::request&& req) override; http::message_generator createSolution(http::request&& req) override; - http::message_generator getMetrics(http::request&& req) override; void setService(std::shared_ptr service); private: diff --git a/server/internal/httpServer/include/TaskManager.h b/server/internal/httpServer/include/TaskManager.h index 3adecd4..361c7a8 100644 --- a/server/internal/httpServer/include/TaskManager.h +++ b/server/internal/httpServer/include/TaskManager.h @@ -1,5 +1,4 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ -#define APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ +#pragma once #include #include @@ -18,5 +17,3 @@ private: std::shared_ptr taskService; std::shared_ptr serializer; }; - -#endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_TaskMANAGER_H_ diff --git a/server/internal/httpServer/include/TmpSolutionService.h b/server/internal/httpServer/include/TmpSolutionService.h new file mode 100644 index 0000000..63cab8d --- /dev/null +++ b/server/internal/httpServer/include/TmpSolutionService.h @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include "Solution.hpp" + +class TmpSolutionService { +public: + static Solution createSolution(std::size_t user_id, std::size_t task_id, std::string source) { + count++; + Solution sol(count, "", user_id, source, "", "", task_id, "ok"); + for (auto& i: solutions) { + if (i.getSource() == source && i.getTaskId() == task_id && i.getSenderId() != user_id) + sol.setResult("plagiat"); + } + solutions.push_back(sol); + return sol; + } + + static std::size_t count; + static std::vector solutions; +}; + +std::vector TmpSolutionService::solutions = {}; +std::size_t TmpSolutionService::count = 3; diff --git a/server/internal/httpServer/include/TmpTaskService.h b/server/internal/httpServer/include/TmpTaskService.h new file mode 100644 index 0000000..90f2f76 --- /dev/null +++ b/server/internal/httpServer/include/TmpTaskService.h @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include "Task.hpp" + +class TmpTaskService { +public: + static void createTask(std::string description) { + count++; + Task task(count, description); + tasks.push_back(task); + } + + static std::vector getAllTasks() { + return tasks; + } + + static std::size_t count; + static std::vector tasks; +}; + +std::vector TmpTaskService::tasks = {Task(1, "1 description 1\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "14\n"), + Task(2, "2 description"), + Task(3, "3 description")}; +std::size_t TmpTaskService::count = 3; \ No newline at end of file diff --git a/server/internal/httpServer/include/TmpUserService.h b/server/internal/httpServer/include/TmpUserService.h new file mode 100644 index 0000000..cd60903 --- /dev/null +++ b/server/internal/httpServer/include/TmpUserService.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include "User.hpp" + +class TmpUserService { +public: + static std::pair login(std::string_view login, std::string_view password) { + bool found = false; + User user; + for (const auto& i : tasks) { + if (i.getPassword() == password && i.getLogin() == login && !found) { + user = i; + found = true; + } + } + return {user, found}; + } + + static User registerUser(std::string login, std::string password, std::string username) { + count++; + User user(count, login, password, username); + std::cout << user << std::endl; + tasks.push_back(user); + return user; + } + + static std::size_t count; + static std::vector tasks; +}; + +std::vector TmpUserService::tasks = {}; +std::size_t TmpUserService::count = 0; diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index 59b5791..88d83c2 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -33,12 +33,8 @@ http::message_generator Router::handleRequest(http::request & return getBadRequest(req, "Illegal request-target"); } - std::cout << req.target() << std::endl; - if (req.target() == "/solution/submit") { return solutionManager->createSolution(std::move(req)); - } else if (req.target() == "/solution/metrics") { - return solutionManager->getMetrics(std::move(req)); } else if (req.target() == "/solution/all") { return solutionManager->getAllSolutions(std::move(req)); } else if (req.target() == "/user/register") { diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index 108430a..8d1905c 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -104,7 +104,7 @@ std::string Serializer::serialAllTasks(const std::vector &tasks) { std::string Serializer::serialUserData(const User &user) { boost::property_tree::ptree json; - json.put("id", user.getId()); + json.put("user_id", user.getId()); json.put("login", user.getLogin()); json.put("username", user.getUsername()); json.put("password", user.getPassword()); @@ -112,3 +112,13 @@ std::string Serializer::serialUserData(const User &user) { boost::property_tree::write_json(out, json); return out.str(); } + +std::string Serializer::serialSolution(const Solution &sol) { + boost::property_tree::ptree json; + json.put("sol_id", sol.getId()); + json.put("source", sol.getSource()); + json.put("result", sol.getResult()); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index e83c027..c85dc98 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -4,6 +4,7 @@ #include "SolutionManager.h" #include +#include "TmpSolutionService.h" SolutionManager::SolutionManager() : serializer(std::make_shared()) {}; @@ -13,17 +14,16 @@ void SolutionManager::setService(std::shared_ptr service) { } http::message_generator SolutionManager::createSolution(http::request&& req) { - size_t user_id, task_id; std::string source; std::tie(user_id, source, task_id) = serializer->deserialNewSolutionData(req.body()); - Solution sol; - sol = solutionService->createSolution(user_id, task_id, source); + Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); +// sol = solutionService->createSolution(user_id, task_id, source); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = std::to_string(sol.getId()); + res.body() = serializer->serialSolution(sol); res.prepare_payload(); return res; } @@ -40,22 +40,5 @@ http::message_generator SolutionManager::getAllSolutions(http::requestserialSolutions(solutions); res.prepare_payload(); return res; - -} - -http::message_generator SolutionManager::getMetrics(http::request&& req) { - auto const bad_request = - [&req](beast::string_view why) - { - http::response res{http::status::bad_request, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/html"); - res.keep_alive(req.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; - }; - - return bad_request("123"); } diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index 2b45867..91ca64b 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -2,6 +2,7 @@ // Created by Николай Степанов on 03.05.2023. // #include "TaskManager.h" +#include "TmpTaskService.h" TaskManager::TaskManager() : serializer(std::make_shared()) {} @@ -11,7 +12,8 @@ void TaskManager::setService(std::shared_ptr service) { http::message_generator TaskManager::createTask(http::request &&req) { std::string description = serializer->deserialNewTaskData(req.body()); - taskService->createTask(description); +// taskService->createTask(description); + TmpTaskService::createTask(description); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); @@ -21,7 +23,8 @@ http::message_generator TaskManager::createTask(http::request &&req) { - std::vector tasks = taskService->getAllTasks(); +// std::vector tasks = taskService->getAllTasks(); + std::vector tasks = TmpTaskService::getAllTasks(); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index 335ad4d..dcff74b 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -1,5 +1,7 @@ #include "UserManager.h" +#include "TmpUserService.h" + UserManager::UserManager() : serializer(std::make_shared()) {} void UserManager::setService(std::shared_ptr service) { @@ -10,20 +12,13 @@ http::message_generator UserManager::loginUser(http::request std::string login, password; std::tie(login, password) = serializer->deserialUserData(req.body()); - bool found = false; - User user; - for (const auto& i : users) { - if (i.getPassword() == password && i.getLogin() == login && !found) { - user = i; - found = true; - } - } - if (found) { + auto result = TmpUserService::login(login, password); + if (result.second) { http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = serializer->serialUserData(user); + res.body() = serializer->serialUserData(result.first); res.prepare_payload(); return res; } else { @@ -31,7 +26,7 @@ http::message_generator UserManager::loginUser(http::request res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = serializer->serialUserData(user); + res.body() = serializer->serialUserData(result.first); res.prepare_payload(); return res; } @@ -41,10 +36,7 @@ http::message_generator UserManager::registerUser(http::request deserialNewUserData(req.body()); // User user = userService->createUser(login, username, password); - count++; - User user = User(count, login, password, username); - std::cout << user << std::endl; - users.push_back(user); + User user = TmpUserService::registerUser(login, password, username); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/virtual/ISolutionManager.h b/server/internal/httpServer/virtual/ISolutionManager.h index ab86bc6..62f0f2a 100644 --- a/server/internal/httpServer/virtual/ISolutionManager.h +++ b/server/internal/httpServer/virtual/ISolutionManager.h @@ -10,7 +10,6 @@ class ISolutionManager { public: virtual http::message_generator getAllSolutions(http::request&& req) = 0; virtual http::message_generator createSolution(http::request&& req) = 0; - virtual http::message_generator getMetrics(http::request&& req) = 0; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_ISolutionMANAGER_H_ -- GitLab From 258161bff291a0ca98324a617163bfe6729c6585 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 14 May 2023 20:40:22 +0300 Subject: [PATCH 050/134] add python antlr, add some realization of services --- .gitignore | 1 + server/CMakeLists.txt | 1 + server/cmd/CMakeLists.txt | 5 +- server/cmd/main.cpp | 29 +- server/internal/CMakeLists.txt | 4 +- server/internal/entities/CMakeLists.txt | 5 + .../internal/entities/include/MetricStat.hpp | 58 + server/internal/entities/include/Solution.hpp | 43 +- server/internal/entities/include/Task.hpp | 26 +- server/internal/entities/include/User.hpp | 29 +- server/internal/entities/src/MetricStat.cpp | 81 + server/internal/entities/src/Solution.cpp | 58 +- server/internal/entities/src/Task.cpp | 44 +- server/internal/entities/src/User.cpp | 38 +- server/internal/entities/tests/CMakeLists.txt | 0 .../repository/virtual/IMetricRepository.hpp | 22 + .../service/include/SolutionService.h | 6 +- server/internal/service/include/TaskService.h | 2 +- server/internal/service/include/UserService.h | 1 + .../internal/service/src/SolutionService.cpp | 53 +- server/internal/service/src/TaskService.cpp | 6 +- .../service/tests/SolutionServiceTest.cpp | 7 +- .../service/tests/TaskServiceTest.cpp | 11 +- .../service/tests/UserServiceTest.cpp | 1 - .../internal/service/virtual/ITaskService.h | 2 +- server/pkg/antlr/CMakeLists.txt | 9 +- server/pkg/antlr/cpp14/CMakeLists.txt | 17 +- server/pkg/antlr/cpp14/CPP14Parser.g4 | 2 +- server/pkg/antlr/cpp14/include/CPP14Lexer.h | 79 - server/pkg/antlr/cpp14/include/CPP14Parser.h | 3149 --- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 17 +- server/pkg/antlr/cpp14/src/CPP14Lexer.cpp | 718 - server/pkg/antlr/cpp14/src/CPP14Parser.cpp | 18169 ---------------- server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 42 +- server/pkg/antlr/python3/CMakeLists.txt | 28 + .../pkg/antlr/python3/include/PythonAntlr.h | 26 + server/pkg/antlr/python3/src/PythonAntlr.cpp | 45 + server/pkg/antlr/virtual/IAntlrWrapper.h | 6 +- 38 files changed, 567 insertions(+), 22273 deletions(-) create mode 100644 server/internal/entities/include/MetricStat.hpp create mode 100644 server/internal/entities/src/MetricStat.cpp create mode 100644 server/internal/entities/tests/CMakeLists.txt create mode 100644 server/internal/repository/virtual/IMetricRepository.hpp delete mode 100644 server/pkg/antlr/cpp14/include/CPP14Lexer.h delete mode 100644 server/pkg/antlr/cpp14/include/CPP14Parser.h delete mode 100644 server/pkg/antlr/cpp14/src/CPP14Lexer.cpp delete mode 100644 server/pkg/antlr/cpp14/src/CPP14Parser.cpp create mode 100644 server/pkg/antlr/python3/CMakeLists.txt create mode 100644 server/pkg/antlr/python3/include/PythonAntlr.h create mode 100644 server/pkg/antlr/python3/src/PythonAntlr.cpp diff --git a/.gitignore b/.gitignore index 870ca9c..2750700 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /cmake-build-debug/ /build/ +/build1/ .vscode .idea CMakeUserPresets.json diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index a860480..c33d848 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -13,6 +13,7 @@ find_package(Threads REQUIRED) add_subdirectory(pkg) add_subdirectory(internal) +add_subdirectory(cmd) message(STATUS ${Boost_LIBRARIES}) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread -pthread") diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index 446f2a8..8826a8d 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -4,7 +4,8 @@ project(${PROJECT_NAME}) add_executable(Server main.cpp) message(STATUS ${libusers}) -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${antlr4-runtime_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libRepository_LIB}) -target_include_directories(Server PUBLIC ${libusers_INCLUDE_DIRS}) +message("${SERVICE_LIB}") +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${SERVICE_LIB}) +target_include_directories(Server PUBLIC ${SERVICE_lib_INCLUDE_DIRS}) message("Built server") diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 177490d..938c0a1 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,10 +1,21 @@ -//#include "dotenv.h" -#include "UserRepository.hpp" -#include "User.hpp" - -//using namespace dotenv; -int main(){ - User user{"qwerty200468@gmail.com", "123", "tolik"}; - UserRepository repo; - std::cout< + +#include "PythonAntlr.h" + +int main(int argc, const char* argv[]) { + // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); + std::ifstream ins("/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/python/test.py"); + + PythonAntlr pA = PythonAntlr(ins); + + std::vector tokens = pA.getTokensArray(); + + std::cout << "Tokens:" << std::endl; + for (std::string token : tokens) { + std::cout << token << std::endl; + } + + std::cout << pA.getTreeString() << std::endl; + + return 0; } \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index 89c9478..ef68e73 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -6,9 +6,11 @@ add_subdirectory(service) set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) -set(SERVICE_LIB ${SERVICE_lib_LIB} PARENT_SCOPE) + +set(SERVICE_LIB ${SERVICE_lib_LIBRARY} PARENT_SCOPE) set(SERVICE_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/entities/CMakeLists.txt b/server/internal/entities/CMakeLists.txt index fc7e628..08858c7 100644 --- a/server/internal/entities/CMakeLists.txt +++ b/server/internal/entities/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.19) + project("EntitiesLib") set(LIB_NAME libEntities) @@ -26,3 +28,6 @@ set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) message("libEntities_LIB = ${libEntities_LIB}") message("libEntities_INCLUDE_DIRS = ${libEntities_INCLUDE_DIRS}") + +enable_testing() +add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/entities/include/MetricStat.hpp b/server/internal/entities/include/MetricStat.hpp new file mode 100644 index 0000000..491abb7 --- /dev/null +++ b/server/internal/entities/include/MetricStat.hpp @@ -0,0 +1,58 @@ +#ifndef SOURCEDOUT_METRICSTAT_HPP +#define SOURCEDOUT_METRICSTAT_HPP + +#include + +class MetricStat { +public: + MetricStat() noexcept; + + MetricStat(size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, + float meanRes) noexcept; + + MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, + float meanRes) noexcept; + + [[nodiscard]] size_t getId() const noexcept; + + void setId(size_t id); + + [[nodiscard]] size_t getSolutionId() const noexcept; + + void setSolutionId(size_t solutionId) noexcept; + + [[nodiscard]] float getTextBasedRes() const noexcept; + + void setTextBasedRes(float textBasedRes) noexcept; + + [[nodiscard]] float getTokenBasedRes() const noexcept; + + void setTokenBasedRes(float tokenBasedRes) noexcept; + + [[nodiscard]] float getTreeBasedRes() const noexcept; + + void setTreeBasedRes(float treeBasedRes) noexcept; + + [[nodiscard]] bool isVerdict() const noexcept; + + void setVerdict(bool verdict) noexcept; + + [[nodiscard]] float getMeanRes() const noexcept; + + void setMeanRes(float meanRes) noexcept; + + bool operator==(const MetricStat &rhs) const noexcept; + + bool operator!=(const MetricStat &rhs) const noexcept; + +private: + size_t id; + size_t solution_id; + float text_based_res; + float token_based_res; + float tree_based_res; + bool verdict; + float mean_res; +}; + +#endif //SOURCEDOUT_METRICSTAT_HPP diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 5c39ef5..974a560 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -7,40 +7,49 @@ class Solution { public: - Solution() =default; Solution(size_t id, std::string sendDate, size_t senderId, std::string source, - std::string tokens, std::string astTree, size_t taskId, std::string result); + std::string tokens, std::string astTree, size_t taskId, std::string result) noexcept; - [[nodiscard]] size_t getId() const; + Solution(std::string sendDate, size_t senderId, std::string source, std::string tokens, std::string astTree, + size_t taskId, std::string result) noexcept; + Solution() noexcept; + [[nodiscard]] size_t getId() const noexcept; - [[nodiscard]] const std::string &getSendDate() const; - void setSendDate(const std::string &sendDate); + [[nodiscard]] const std::string &getSendDate() const noexcept; - [[nodiscard]] size_t getSenderId() const; + void setSendDate(const std::string &sendDate) noexcept; - void setSenderId(size_t senderId); + [[nodiscard]] size_t getSenderId() const noexcept; - [[nodiscard]] const std::string &getSource() const; + void setSenderId(size_t senderId) noexcept; - void setSource(const std::string &source); + [[nodiscard]] const std::string &getSource() const noexcept; - [[nodiscard]] const std::string &getTokens() const; + void setSource(const std::string &source) noexcept; - void setTokens(const std::string &tokens); + [[nodiscard]] const std::string &getTokens() const noexcept; - [[nodiscard]] const std::string &getAstTree() const; + void setTokens(const std::string &tokens) noexcept; - void setAstTree(const std::string &astTree); + [[nodiscard]] const std::string &getAstTree() const noexcept; - [[nodiscard]] size_t getTaskId() const; + void setAstTree(const std::string &astTree) noexcept; - void setTaskId(size_t taskId); + [[nodiscard]] size_t getTaskId() const noexcept; - [[nodiscard]] const std::string &getResult() const; + void setTaskId(size_t taskId) noexcept; - void setResult(const std::string &result); + [[nodiscard]] const std::string &getResult() const noexcept; + + void setResult(const std::string &result) noexcept; + + void setId(size_t id) noexcept; + + bool operator==(const Solution &rhs) const noexcept; + + bool operator!=(const Solution &rhs) const noexcept; private: size_t id; diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index e935e9a..e551804 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -6,20 +6,30 @@ class Task{ private: size_t id; std::string description; + float treshhold; public: - Task()=default; - ~Task() = default; - Task(size_t id, std::string description); + Task(size_t id, std::string description_, float treshold_) noexcept; - explicit Task(std::string description); + Task(std::string description_, float treshold_) noexcept; - [[nodiscard]] size_t getId() const; + Task() noexcept; - void setId(size_t id); + [[nodiscard]] size_t getId() const noexcept; - [[nodiscard]] const std::string &getDescription() const; + [[nodiscard]] const std::string &getDescription() const noexcept; + + float getTreshhold() const noexcept; + + void setTreshhold(float treshhold) noexcept; + + void setDescription(const std::string &description) noexcept; + + void setId(size_t id) noexcept; + + bool operator==(const Task &rhs) const noexcept; + + bool operator!=(const Task &rhs) const noexcept; - void setDescription(const std::string &description); }; #endif //SOURCEDOUT_TASK_HPP diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index bfca6e4..82e659f 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -13,28 +13,33 @@ private: std::string username; public: - User()=default; - User(size_t id_, std::string login_, std::string password_, std::string username_); + User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept; - User(std::string login_, std::string password_, std::string username_); + User(std::string login_, std::string password_, std::string username_) noexcept; - [[nodiscard]] const std::string &getLogin() const; + User() noexcept; - void setLogin(const std::string &login); + [[nodiscard]] const std::string &getLogin() const noexcept; - void setId(size_t id_); + void setLogin(const std::string &login) noexcept; - [[nodiscard]] const std::string &getPassword() const; + [[nodiscard]] const std::string &getPassword() const noexcept; - void setPassword(const std::string &password); + void setPassword(const std::string &password) noexcept; - [[nodiscard]] const std::string &getUsername() const; + [[nodiscard]] const std::string &getUsername() const noexcept; - void setUsername(const std::string &username); + void setUsername(const std::string &username) noexcept; - [[nodiscard]] size_t getId() const; + [[nodiscard]] size_t getId() const noexcept; - friend std::ostream &operator<<(std::ostream &os, const User &user); + friend std::ostream &operator<<(std::ostream &os, const User &user) noexcept; + + void setId(size_t id) noexcept; + + bool operator==(const User &rhs) const noexcept; + + bool operator!=(const User &rhs) const noexcept; }; #endif //SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp new file mode 100644 index 0000000..aa0befc --- /dev/null +++ b/server/internal/entities/src/MetricStat.cpp @@ -0,0 +1,81 @@ + +#include "MetricStat.hpp" + +MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, + bool verdict, float meanRes) noexcept : id(0), solution_id(solutionId), + text_based_res(textBasedRes), token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), verdict(verdict), + mean_res(meanRes) {} + +MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, + bool verdict, float meanRes) noexcept : id(id), solution_id(solutionId), text_based_res(textBasedRes), + token_based_res(tokenBasedRes), tree_based_res(treeBasedRes), + verdict(verdict), mean_res(meanRes) {} + +MetricStat::MetricStat() noexcept : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), + verdict(true), mean_res(0) { +} + +size_t MetricStat::getId() const noexcept { + return id; +} + +void MetricStat::setId(size_t id_) { + id = id_; +} + +size_t MetricStat::getSolutionId() const noexcept { + return solution_id; +} + +void MetricStat::setSolutionId(size_t solutionId) noexcept { + solution_id = solutionId; +} + +float MetricStat::getTextBasedRes() const noexcept { + return text_based_res; +} + +void MetricStat::setTextBasedRes(float textBasedRes) noexcept { + text_based_res = textBasedRes; +} + +float MetricStat::getTokenBasedRes() const noexcept { + return token_based_res; +} + +void MetricStat::setTokenBasedRes(float tokenBasedRes) noexcept { + token_based_res = tokenBasedRes; +} + +float MetricStat::getTreeBasedRes() const noexcept { + return tree_based_res; +} + +void MetricStat::setTreeBasedRes(float treeBasedRes) noexcept { + tree_based_res = treeBasedRes; +} + +bool MetricStat::isVerdict() const noexcept { + return verdict; +} + +void MetricStat::setVerdict(bool verdict_) noexcept { + verdict = verdict_; +} + +float MetricStat::getMeanRes() const noexcept { + return mean_res; +} + +void MetricStat::setMeanRes(float meanRes) noexcept { + mean_res = meanRes; +} + +bool MetricStat::operator==(const MetricStat &rhs) const noexcept { + return id == rhs.id; +} + +bool MetricStat::operator!=(const MetricStat &rhs) const noexcept { + return !(rhs == *this); +} diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index dd8a542..0603c00 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -1,73 +1,95 @@ #include #include -#include "../include/Solution.hpp" +#include "Solution.hpp" -Solution::Solution(unsigned long id, std::string sendDate, unsigned long senderId, +Solution::Solution(size_t id, std::string sendDate, unsigned long senderId, std::string source, std::string tokens, std::string astTree, unsigned long taskId, - std::string result) : id(id), send_date(std::move(sendDate)), sender_id(senderId), + std::string result) noexcept : id(id), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), tokens(std::move(tokens)), astTree(std::move(astTree)), task_id(taskId), result(std::move(result)) {} -size_t Solution::getId() const { +Solution::Solution(std::string sendDate, unsigned long senderId, + std::string source, std::string tokens, + std::string astTree, unsigned long taskId, + std::string result) noexcept : id(0), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)) {} + +Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} + +size_t Solution::getId() const noexcept { return id; } +void Solution::setId(size_t id_) noexcept { + id = id_; +} -const std::string &Solution::getSendDate() const { +const std::string &Solution::getSendDate() const noexcept { return send_date; } -void Solution::setSendDate(const std::string &sendDate) { +void Solution::setSendDate(const std::string &sendDate) noexcept { send_date = sendDate; } -size_t Solution::getSenderId() const { +size_t Solution::getSenderId() const noexcept { return sender_id; } -void Solution::setSenderId(size_t senderId) { +void Solution::setSenderId(size_t senderId) noexcept { sender_id = senderId; } -const std::string &Solution::getSource() const { +const std::string &Solution::getSource() const noexcept { return source; } -void Solution::setSource(const std::string &source_) { +void Solution::setSource(const std::string &source_) noexcept { Solution::source = source_; } -const std::string &Solution::getTokens() const { +const std::string &Solution::getTokens() const noexcept { return tokens; } -void Solution::setTokens(const std::string &tokens_) { +void Solution::setTokens(const std::string &tokens_) noexcept { Solution::tokens = tokens_; } -const std::string &Solution::getAstTree() const { +const std::string &Solution::getAstTree() const noexcept { return astTree; } -void Solution::setAstTree(const std::string &astTree_) { +void Solution::setAstTree(const std::string &astTree_) noexcept { Solution::astTree = astTree_; } -size_t Solution::getTaskId() const { +size_t Solution::getTaskId() const noexcept { return task_id; } -void Solution::setTaskId(size_t taskId) { +void Solution::setTaskId(size_t taskId) noexcept { task_id = taskId; } -const std::string &Solution::getResult() const { +const std::string &Solution::getResult() const noexcept { return result; } -void Solution::setResult(const std::string &result_) { +void Solution::setResult(const std::string &result_) noexcept { Solution::result = result_; } + +bool Solution::operator==(const Solution &rhs) const noexcept { + return id == rhs.id; +} + +bool Solution::operator!=(const Solution &rhs) const noexcept { + return !(rhs == *this); +} + diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index c7d252d..e0fc107 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -1,25 +1,43 @@ -#pragma once - -#include "../include/Task.hpp" +#include "Task.hpp" #include -#include -unsigned long Task::getId() const { +Task::Task(std::string description_, float treshold_) noexcept : id(0), description(std::move(description_)), + treshhold(treshold_) {} + +Task::Task(size_t id, std::string description_, float treshold_) noexcept : id(id), description(std::move(description_)), + treshhold(treshold_) {} +Task::Task() noexcept:id(0), treshhold(0) { +} + +unsigned long Task::getId() const noexcept { return id; } -void Task::setId(size_t id_) { - id=id_; +const std::string &Task::getDescription() const noexcept { + return description; } -Task::Task(size_t id, std::string description) : id(id), description(std::move(description)) {} +void Task::setId(size_t id_) noexcept { + id = id_; +} -Task::Task(std::string description) : id(0), description(std::move(description)) {} +void Task::setDescription(const std::string &description_) noexcept { + Task::description = description_; +} -const std::string &Task::getDescription() const { - return description; +bool Task::operator==(const Task &rhs) const noexcept { + return id == rhs.id; } -void Task::setDescription(const std::string &description_) { - Task::description = description_; +bool Task::operator!=(const Task &rhs) const noexcept { + return !(rhs == *this); +} + +float Task::getTreshhold() const noexcept { + return treshhold; } + +void Task::setTreshhold(float treshhold_) noexcept { + Task::treshhold = treshhold_; +} + diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index d31abba..67f2620 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -1,47 +1,59 @@ #include #include "../include/User.hpp" -User::User(size_t id_, std::string login_, std::string password_, std::string username_) : +User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { } -User::User(std::string login_, std::string password_, std::string username_) : -id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { + +User::User(std::string login_, std::string password_, std::string username_) noexcept : + id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { +} + +User::User() noexcept : id(0) { } -const std::string &User::getLogin() const { +const std::string &User::getLogin() const noexcept { return login; } -void User::setLogin(const std::string &login_) { +void User::setId(size_t id_) noexcept { + id = id_; +} + +void User::setLogin(const std::string &login_) noexcept { User::login = login_; } -const std::string &User::getPassword() const { +const std::string &User::getPassword() const noexcept { return password; } -void User::setPassword(const std::string &password_) { +void User::setPassword(const std::string &password_) noexcept { User::password = password_; } -const std::string &User::getUsername() const { +const std::string &User::getUsername() const noexcept { return username; } -void User::setUsername(const std::string &username_) { +void User::setUsername(const std::string &username_) noexcept { User::username = username_; } -size_t User::getId() const { +size_t User::getId() const noexcept { return id; } -std::ostream &operator<<(std::ostream &os, const User &user) { +std::ostream &operator<<(std::ostream &os, const User &user) noexcept { os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " << user.username; return os; } -void User::setId(size_t id_) { - id=id_; +bool User::operator==(const User &rhs) const noexcept { + return id == rhs.id; +} + +bool User::operator!=(const User &rhs) const noexcept { + return !(rhs == *this); } diff --git a/server/internal/entities/tests/CMakeLists.txt b/server/internal/entities/tests/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/internal/repository/virtual/IMetricRepository.hpp b/server/internal/repository/virtual/IMetricRepository.hpp new file mode 100644 index 0000000..fcd92fe --- /dev/null +++ b/server/internal/repository/virtual/IMetricRepository.hpp @@ -0,0 +1,22 @@ +#ifndef SOURCEDOUT_IMETRICREPOSITORY_HPP +#define SOURCEDOUT_IMETRICREPOSITORY_HPP + + +#include +#include +#include "MetricStat.hpp" + +class IMetricRepository { +public: + virtual std::optional getById(size_t id) = 0; + + virtual size_t storeMetric(MetricStat metric) = 0; + + virtual void updateMetric(MetricStat metric) = 0; + + virtual void deleteMetric(MetricStat metric) = 0; + + virtual void deleteMetricById(size_t id) = 0; +}; + +#endif //SOURCEDOUT_IMETRICREPOSITORY_HPP diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index c089d6d..f3c4944 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -1,8 +1,10 @@ #pragma once #include +#include #include "IAntlrWrapper.h" +#include "IMetricRepository.hpp" #include "IMockMetrics.h" #include "ISolutionRepository.hpp" #include "ISolutionService.h" @@ -10,13 +12,15 @@ class SolutionService : ISolutionService { private: std::unique_ptr solutionRepo; + std::unique_ptr metricRepo; + // taskRepo std::unique_ptr antlr; std::unique_ptr metrics; + void setAntlrWrapper(const std::string& source, std::ifstream& in); public: explicit SolutionService(std::unique_ptr solutionRepo); SolutionService(); - void setAntlrWrapper(std::unique_ptr antlr_); void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, const std::string& source) override; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index 400c01b..f8cbd3a 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -13,7 +13,7 @@ class TaskService : public ITaskService { TaskService(std::unique_ptr taskRepo); TaskService(); ~TaskService() override = default; - Task createTask(const std::string& desc) override; + Task createTask(const std::string& desc, float treshold = 0.5f) override; Task getTask(size_t id) override; std::vector getAllTasks() override; void deleteTask(size_t id) override; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 2a5a9fe..98ee105 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -15,6 +15,7 @@ class UserService : IUserService { UserService(); User createUser(const std::string& login, const std::string& username, const std::string& password) override; + // TODO login User getUserById(size_t id) override; void deleteUser(size_t id) override; }; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 91c0cc6..fc9aece 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -1,19 +1,54 @@ #include "SolutionService.h" +#include + +#include "MyCppAntlr.h" + SolutionService::SolutionService( std::unique_ptr solutionRepo) : solutionRepo(std::move(solutionRepo)) {} -SolutionService::SolutionService(){ - //solutionRepo=std::make_unique(); -} +SolutionService::SolutionService() { + // solutionRepo=std::make_unique(); + // taskRepo = std::make_unique(); + // metricRepo = std::make_unique(); +} + +void SolutionService::setAntlrWrapper(const std::string& source, + std::ifstream& in) { + if (source.substr(source.find_last_of(".") + 1) == "cpp") { + antlr = std::make_unique(in); + } else { + throw "exception"; + } +} +// Вердикт функция +// treshhold хардкод + +//TODO "filename" "data" - string -> создать файл Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& source) { - //antlr = std::make_unique< - size_t id = solutionRepo->storeSolution( - Solution(0, "", userId, source, "metrics1", "metrics2", taskId, "")); - return Solution(id, "", userId, source, "", "", taskId, ""); + try { + std::ifstream in(source); + setAntlrWrapper(source, in); + std::pair codeParse = antlr->getTokensAndTree(); + + std::time_t now = + std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + + // TODO: вызов метрик + // получил результат + + + Solution sol = Solution(std::ctime(&now), userId, source, codeParse.first, + codeParse.second, taskId, ""); + size_t id = solutionRepo->storeSolution(sol); + sol.setId(id); + return sol; + } catch (std::exception& e) { + throw e; + } } std::vector SolutionService::getSolutionsByUserAndTaskId( @@ -44,10 +79,6 @@ std::pair SolutionService::getMetrics(size_t solId) { } } -void SolutionService::setAntlrWrapper(std::unique_ptr antlr_) { - antlr = std::move(antlr_); -} - void SolutionService::setMetrics(std::unique_ptr metrics_) { metrics = std::move(metrics_); } diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 3d2a4bb..c7d1bbf 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -8,10 +8,10 @@ TaskService::TaskService() { // taskRepo = std::make_unique(); } -Task TaskService::createTask(const std::string& desc) { +Task TaskService::createTask(const std::string& desc, float treshold) { try { - Task task = Task(desc); - size_t id = taskRepo->storeTask(Task(desc)); + Task task = Task(desc,treshold); + size_t id = taskRepo->storeTask(task); task.setId(id); return task; } catch (std::exception& e) { diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index 2dcb91f..2136eee 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -11,8 +11,6 @@ class Exception : public std::exception { virtual const char* what() const noexcept override { return _msg.c_str(); } }; -bool operator==(Solution s1, Solution s2) { return s1.getId() == s2.getId(); } - class SolutionRepositoryMock : public ISolutionRepository { public: ~SolutionRepositoryMock() override = default; @@ -90,7 +88,8 @@ TEST_F(SolutionServiceTest, createSolution) { storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) .Times(1) .WillRepeatedly(::testing::Return(1)); - Solution sol = ss->createSolution(2, 1, "source"); + Solution sol = ss->createSolution(2, 1, "main.cpp"); EXPECT_EQ(sol.getId(), 1); - EXPECT_EQ(sol.getSource(), "source"); + EXPECT_EQ(sol.getSource(), "main.cpp"); + EXPECT_EQ(sol.getTokens(),"[@0,0:-1='',<-1>,1:0] "); } \ No newline at end of file diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp index 3067995..ccf2c38 100644 --- a/server/internal/service/tests/TaskServiceTest.cpp +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -3,7 +3,6 @@ #include "TaskService.h" -bool operator==(Task t1, Task t2) { return t1.getId() == t2.getId(); } class Exception : public std::exception { std::string _msg; @@ -53,7 +52,7 @@ TEST_F(TaskServiceTest, deleteTasWithInvalidId) { TEST_F(TaskServiceTest, GetTaskByIdOK) { EXPECT_CALL(*mock_ptr, getTaskById(1)) .Times(1) - .WillOnce(::testing::Return(Task(1, "desription"))); + .WillOnce(::testing::Return(Task(1, "desription",0.7f))); Task t = ts->getTask(1); EXPECT_EQ(t.getId(), 1); EXPECT_EQ(t.getDescription(), "desription"); @@ -67,17 +66,17 @@ TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { } TEST_F(TaskServiceTest, CreateTask) { - EXPECT_CALL(*mock_ptr, storeTask(Task("desc"))) + EXPECT_CALL(*mock_ptr, storeTask(Task("desc",0.5f))) .Times(1) .WillOnce(::testing::Return(1)); - Task t = ts->createTask("desc"); + Task t = ts->createTask("desc",0.5f); EXPECT_EQ(t.getId(), 1); EXPECT_EQ(t.getDescription(), "desc"); - EXPECT_CALL(*mock_ptr, storeTask(Task("desc2"))) + EXPECT_CALL(*mock_ptr, storeTask(Task("desc2",0.8f))) .Times(1) .WillOnce(::testing::Return(2)); - t = ts->createTask("desc2"); + t = ts->createTask("desc2",0.8f); EXPECT_EQ(t.getId(), 2); EXPECT_EQ(t.getDescription(), "desc2"); } diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index 6c3344f..9038fd3 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -4,7 +4,6 @@ #include "Exceptions.h" #include "UserService.h" -bool operator==(User u1, User u2) { return u1.getId() == u2.getId(); } class Exception : public std::exception { std::string _msg; diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h index 8d88954..4150124 100644 --- a/server/internal/service/virtual/ITaskService.h +++ b/server/internal/service/virtual/ITaskService.h @@ -6,7 +6,7 @@ class ITaskService { public: virtual ~ITaskService() = default; - virtual Task createTask(const std::string& desc) = 0; + virtual Task createTask(const std::string& desc,float treshold) = 0; virtual Task getTask(size_t id) = 0; virtual std::vector getAllTasks() = 0; virtual void deleteTask(size_t id) = 0; diff --git a/server/pkg/antlr/CMakeLists.txt b/server/pkg/antlr/CMakeLists.txt index c80b455..bcf317f 100644 --- a/server/pkg/antlr/CMakeLists.txt +++ b/server/pkg/antlr/CMakeLists.txt @@ -14,10 +14,13 @@ set(ANTLR_EXECUTABLE /usr/local/lib/antlr-4.12.0-complete.jar) find_package(ANTLR REQUIRED) add_subdirectory(cpp14) -# add_subdirectory(python3) +add_subdirectory(python3) -set(ANTLR4_LIB ${CPP_ANTLR_LIBRARY}) +message("CPP_ANTLR_LIBRARY=${CPP_ANTLR_LIBRARY}") +message("PYTHON3_ANTLR_LIBRARY=${PYTHON3_ANTLR_LIBRARY}") + +set(ANTLR4_LIB ${CPP_ANTLR_LIBRARY} ${PYTHON3_ANTLR_LIBRARY}) set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) -set(ANTLR4_LIB_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS}) +set(ANTLR4_LIB_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} ${PYTHON3_ANTLR_INCLUDE_DIRS}) set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/pkg/antlr/cpp14/CMakeLists.txt b/server/pkg/antlr/cpp14/CMakeLists.txt index c883479..5c3100f 100644 --- a/server/pkg/antlr/cpp14/CMakeLists.txt +++ b/server/pkg/antlr/cpp14/CMakeLists.txt @@ -5,8 +5,21 @@ file(GLOB SOURCES ./src/*.cpp) file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) +antlr_target(CPP14GrammarLexer CPP14Lexer.g4 LEXER + PACKAGE antlrcpptest) +antlr_target(CPP14GrammarParser CPP14Parser.g4 PARSER + PACKAGE antlrcpptest + DEPENDS_ANTLR CPP14GrammarLexer + COMPILE_FLAGS -lib ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) + +include_directories(${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) +include_directories(${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) + + +message("ANTLR_CPP14GrammarParser_OUTPUT_DIR=${ANTLR_CPP14GrammarParser_OUTPUT_DIR}") + include_directories(${INCLUDE_DIRS}) -add_library(${PROJECT_NAME} ${SOURCES}) +add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_CPP14GrammarLexer_CXX_OUTPUTS} ${ANTLR_CPP14GrammarParser_CXX_OUTPUTS}) target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) @@ -14,7 +27,7 @@ target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) set(CPP_ANTLR_LIBRARY ${PROJECT_NAME}) set(CPP_ANTLR_LIBRARY ${CPP_ANTLR_LIBRARY} PARENT_SCOPE) -set(CPP_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(CPP_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR} ${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) set(CPP_ANTLR_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) message("CPP_ANTLR = ${CPP_ANTLR_INCLUDE_DIRS} ") \ No newline at end of file diff --git a/server/pkg/antlr/cpp14/CPP14Parser.g4 b/server/pkg/antlr/cpp14/CPP14Parser.g4 index 6c4d848..19c9aa5 100644 --- a/server/pkg/antlr/cpp14/CPP14Parser.g4 +++ b/server/pkg/antlr/cpp14/CPP14Parser.g4 @@ -643,7 +643,7 @@ virtualSpecifier: Override | Final; */ pureSpecifier: - Assign val = OctalLiteral {if($val.text.compareTo("0")!=0) throw new InputMismatchException(this); + Assign val = OctalLiteral {if($val.text.compare("0")!=0) throw new InputMismatchException(this); }; /*Derived classes*/ diff --git a/server/pkg/antlr/cpp14/include/CPP14Lexer.h b/server/pkg/antlr/cpp14/include/CPP14Lexer.h deleted file mode 100644 index d8f3103..0000000 --- a/server/pkg/antlr/cpp14/include/CPP14Lexer.h +++ /dev/null @@ -1,79 +0,0 @@ - -// Generated from CPP14Lexer.g4 by ANTLR 4.12.0 - -#pragma once - - -#include "antlr4-runtime.h" - - -namespace antlrcpptest { - - -class CPP14Lexer : public antlr4::Lexer { -public: - enum { - IntegerLiteral = 1, CharacterLiteral = 2, FloatingLiteral = 3, StringLiteral = 4, - BooleanLiteral = 5, PointerLiteral = 6, UserDefinedLiteral = 7, MultiLineMacro = 8, - Directive = 9, Alignas = 10, Alignof = 11, Asm = 12, Auto = 13, Bool = 14, - Break = 15, Case = 16, Catch = 17, Char = 18, Char16 = 19, Char32 = 20, - Class = 21, Const = 22, Constexpr = 23, Const_cast = 24, Continue = 25, - Decltype = 26, Default = 27, Delete = 28, Do = 29, Double = 30, Dynamic_cast = 31, - Else = 32, Enum = 33, Explicit = 34, Export = 35, Extern = 36, False_ = 37, - Final = 38, Float = 39, For = 40, Friend = 41, Goto = 42, If = 43, Inline = 44, - Int = 45, Long = 46, Mutable = 47, Namespace = 48, New = 49, Noexcept = 50, - Nullptr = 51, Operator = 52, Override = 53, Private = 54, Protected = 55, - Public = 56, Register = 57, Reinterpret_cast = 58, Return = 59, Short = 60, - Signed = 61, Sizeof = 62, Static = 63, Static_assert = 64, Static_cast = 65, - Struct = 66, Switch = 67, Template = 68, This = 69, Thread_local = 70, - Throw = 71, True_ = 72, Try = 73, Typedef = 74, Typeid_ = 75, Typename_ = 76, - Union = 77, Unsigned = 78, Using = 79, Virtual = 80, Void = 81, Volatile = 82, - Wchar = 83, While = 84, LeftParen = 85, RightParen = 86, LeftBracket = 87, - RightBracket = 88, LeftBrace = 89, RightBrace = 90, Plus = 91, Minus = 92, - Star = 93, Div = 94, Mod = 95, Caret = 96, And = 97, Or = 98, Tilde = 99, - Not = 100, Assign = 101, Less = 102, Greater = 103, PlusAssign = 104, - MinusAssign = 105, StarAssign = 106, DivAssign = 107, ModAssign = 108, - XorAssign = 109, AndAssign = 110, OrAssign = 111, LeftShiftAssign = 112, - RightShiftAssign = 113, Equal = 114, NotEqual = 115, LessEqual = 116, - GreaterEqual = 117, AndAnd = 118, OrOr = 119, PlusPlus = 120, MinusMinus = 121, - Comma = 122, ArrowStar = 123, Arrow = 124, Question = 125, Colon = 126, - Doublecolon = 127, Semi = 128, Dot = 129, DotStar = 130, Ellipsis = 131, - Identifier = 132, DecimalLiteral = 133, OctalLiteral = 134, HexadecimalLiteral = 135, - BinaryLiteral = 136, Integersuffix = 137, UserDefinedIntegerLiteral = 138, - UserDefinedFloatingLiteral = 139, UserDefinedStringLiteral = 140, UserDefinedCharacterLiteral = 141, - Whitespace = 142, Newline = 143, BlockComment = 144, LineComment = 145 - }; - - explicit CPP14Lexer(antlr4::CharStream *input); - - ~CPP14Lexer() override; - - - std::string getGrammarFileName() const override; - - const std::vector& getRuleNames() const override; - - const std::vector& getChannelNames() const override; - - const std::vector& getModeNames() const override; - - const antlr4::dfa::Vocabulary& getVocabulary() const override; - - antlr4::atn::SerializedATNView getSerializedATN() const override; - - const antlr4::atn::ATN& getATN() const override; - - // By default the static state used to implement the lexer is lazily initialized during the first - // call to the constructor. You can call this function if you wish to initialize the static state - // ahead of time. - static void initialize(); - -private: - - // Individual action functions triggered by action() above. - - // Individual semantic predicate functions triggered by sempred() above. - -}; - -} // namespace antlrcpptest diff --git a/server/pkg/antlr/cpp14/include/CPP14Parser.h b/server/pkg/antlr/cpp14/include/CPP14Parser.h deleted file mode 100644 index 6b00d6b..0000000 --- a/server/pkg/antlr/cpp14/include/CPP14Parser.h +++ /dev/null @@ -1,3149 +0,0 @@ - -// Generated from CPP14Parser.g4 by ANTLR 4.12.0 - -#pragma once - - -#include "antlr4-runtime.h" - - -namespace antlrcpptest { - - -class CPP14Parser : public antlr4::Parser { -public: - enum { - IntegerLiteral = 1, CharacterLiteral = 2, FloatingLiteral = 3, StringLiteral = 4, - BooleanLiteral = 5, PointerLiteral = 6, UserDefinedLiteral = 7, MultiLineMacro = 8, - Directive = 9, Alignas = 10, Alignof = 11, Asm = 12, Auto = 13, Bool = 14, - Break = 15, Case = 16, Catch = 17, Char = 18, Char16 = 19, Char32 = 20, - Class = 21, Const = 22, Constexpr = 23, Const_cast = 24, Continue = 25, - Decltype = 26, Default = 27, Delete = 28, Do = 29, Double = 30, Dynamic_cast = 31, - Else = 32, Enum = 33, Explicit = 34, Export = 35, Extern = 36, False_ = 37, - Final = 38, Float = 39, For = 40, Friend = 41, Goto = 42, If = 43, Inline = 44, - Int = 45, Long = 46, Mutable = 47, Namespace = 48, New = 49, Noexcept = 50, - Nullptr = 51, Operator = 52, Override = 53, Private = 54, Protected = 55, - Public = 56, Register = 57, Reinterpret_cast = 58, Return = 59, Short = 60, - Signed = 61, Sizeof = 62, Static = 63, Static_assert = 64, Static_cast = 65, - Struct = 66, Switch = 67, Template = 68, This = 69, Thread_local = 70, - Throw = 71, True_ = 72, Try = 73, Typedef = 74, Typeid_ = 75, Typename_ = 76, - Union = 77, Unsigned = 78, Using = 79, Virtual = 80, Void = 81, Volatile = 82, - Wchar = 83, While = 84, LeftParen = 85, RightParen = 86, LeftBracket = 87, - RightBracket = 88, LeftBrace = 89, RightBrace = 90, Plus = 91, Minus = 92, - Star = 93, Div = 94, Mod = 95, Caret = 96, And = 97, Or = 98, Tilde = 99, - Not = 100, Assign = 101, Less = 102, Greater = 103, PlusAssign = 104, - MinusAssign = 105, StarAssign = 106, DivAssign = 107, ModAssign = 108, - XorAssign = 109, AndAssign = 110, OrAssign = 111, LeftShiftAssign = 112, - RightShiftAssign = 113, Equal = 114, NotEqual = 115, LessEqual = 116, - GreaterEqual = 117, AndAnd = 118, OrOr = 119, PlusPlus = 120, MinusMinus = 121, - Comma = 122, ArrowStar = 123, Arrow = 124, Question = 125, Colon = 126, - Doublecolon = 127, Semi = 128, Dot = 129, DotStar = 130, Ellipsis = 131, - Identifier = 132, DecimalLiteral = 133, OctalLiteral = 134, HexadecimalLiteral = 135, - BinaryLiteral = 136, Integersuffix = 137, UserDefinedIntegerLiteral = 138, - UserDefinedFloatingLiteral = 139, UserDefinedStringLiteral = 140, UserDefinedCharacterLiteral = 141, - Whitespace = 142, Newline = 143, BlockComment = 144, LineComment = 145 - }; - - enum { - RuleTranslationUnit = 0, RulePrimaryExpression = 1, RuleIdExpression = 2, - RuleUnqualifiedId = 3, RuleQualifiedId = 4, RuleNestedNameSpecifier = 5, - RuleLambdaExpression = 6, RuleLambdaIntroducer = 7, RuleLambdaCapture = 8, - RuleCaptureDefault = 9, RuleCaptureList = 10, RuleCapture = 11, RuleSimpleCapture = 12, - RuleInitcapture = 13, RuleLambdaDeclarator = 14, RulePostfixExpression = 15, - RuleTypeIdOfTheTypeId = 16, RuleExpressionList = 17, RulePseudoDestructorName = 18, - RuleUnaryExpression = 19, RuleUnaryOperator = 20, RuleNewExpression = 21, - RuleNewPlacement = 22, RuleNewTypeId = 23, RuleNewDeclarator = 24, RuleNoPointerNewDeclarator = 25, - RuleNewInitializer = 26, RuleDeleteExpression = 27, RuleNoExceptExpression = 28, - RuleCastExpression = 29, RulePointerMemberExpression = 30, RuleMultiplicativeExpression = 31, - RuleAdditiveExpression = 32, RuleShiftExpression = 33, RuleShiftOperator = 34, - RuleRelationalExpression = 35, RuleEqualityExpression = 36, RuleAndExpression = 37, - RuleExclusiveOrExpression = 38, RuleInclusiveOrExpression = 39, RuleLogicalAndExpression = 40, - RuleLogicalOrExpression = 41, RuleConditionalExpression = 42, RuleAssignmentExpression = 43, - RuleAssignmentOperator = 44, RuleExpression = 45, RuleConstantExpression = 46, - RuleStatement = 47, RuleLabeledStatement = 48, RuleExpressionStatement = 49, - RuleCompoundStatement = 50, RuleStatementSeq = 51, RuleSelectionStatement = 52, - RuleCondition = 53, RuleIterationStatement = 54, RuleForInitStatement = 55, - RuleForRangeDeclaration = 56, RuleForRangeInitializer = 57, RuleJumpStatement = 58, - RuleDeclarationStatement = 59, RuleDeclarationseq = 60, RuleDeclaration = 61, - RuleBlockDeclaration = 62, RuleAliasDeclaration = 63, RuleSimpleDeclaration = 64, - RuleStaticAssertDeclaration = 65, RuleEmptyDeclaration = 66, RuleAttributeDeclaration = 67, - RuleDeclSpecifier = 68, RuleDeclSpecifierSeq = 69, RuleStorageClassSpecifier = 70, - RuleFunctionSpecifier = 71, RuleTypedefName = 72, RuleTypeSpecifier = 73, - RuleTrailingTypeSpecifier = 74, RuleTypeSpecifierSeq = 75, RuleTrailingTypeSpecifierSeq = 76, - RuleSimpleTypeLengthModifier = 77, RuleSimpleTypeSignednessModifier = 78, - RuleSimpleTypeSpecifier = 79, RuleTheTypeName = 80, RuleDecltypeSpecifier = 81, - RuleElaboratedTypeSpecifier = 82, RuleEnumName = 83, RuleEnumSpecifier = 84, - RuleEnumHead = 85, RuleOpaqueEnumDeclaration = 86, RuleEnumkey = 87, - RuleEnumbase = 88, RuleEnumeratorList = 89, RuleEnumeratorDefinition = 90, - RuleEnumerator = 91, RuleNamespaceName = 92, RuleOriginalNamespaceName = 93, - RuleNamespaceDefinition = 94, RuleNamespaceAlias = 95, RuleNamespaceAliasDefinition = 96, - RuleQualifiednamespacespecifier = 97, RuleUsingDeclaration = 98, RuleUsingDirective = 99, - RuleAsmDefinition = 100, RuleLinkageSpecification = 101, RuleAttributeSpecifierSeq = 102, - RuleAttributeSpecifier = 103, RuleAlignmentspecifier = 104, RuleAttributeList = 105, - RuleAttribute = 106, RuleAttributeNamespace = 107, RuleAttributeArgumentClause = 108, - RuleBalancedTokenSeq = 109, RuleBalancedtoken = 110, RuleInitDeclaratorList = 111, - RuleInitDeclarator = 112, RuleDeclarator = 113, RulePointerDeclarator = 114, - RuleNoPointerDeclarator = 115, RuleParametersAndQualifiers = 116, RuleTrailingReturnType = 117, - RulePointerOperator = 118, RuleCvqualifierseq = 119, RuleCvQualifier = 120, - RuleRefqualifier = 121, RuleDeclaratorid = 122, RuleTheTypeId = 123, - RuleAbstractDeclarator = 124, RulePointerAbstractDeclarator = 125, RuleNoPointerAbstractDeclarator = 126, - RuleAbstractPackDeclarator = 127, RuleNoPointerAbstractPackDeclarator = 128, - RuleParameterDeclarationClause = 129, RuleParameterDeclarationList = 130, - RuleParameterDeclaration = 131, RuleFunctionDefinition = 132, RuleFunctionBody = 133, - RuleInitializer = 134, RuleBraceOrEqualInitializer = 135, RuleInitializerClause = 136, - RuleInitializerList = 137, RuleBracedInitList = 138, RuleClassName = 139, - RuleClassSpecifier = 140, RuleClassHead = 141, RuleClassHeadName = 142, - RuleClassVirtSpecifier = 143, RuleClassKey = 144, RuleMemberSpecification = 145, - RuleMemberdeclaration = 146, RuleMemberDeclaratorList = 147, RuleMemberDeclarator = 148, - RuleVirtualSpecifierSeq = 149, RuleVirtualSpecifier = 150, RulePureSpecifier = 151, - RuleBaseClause = 152, RuleBaseSpecifierList = 153, RuleBaseSpecifier = 154, - RuleClassOrDeclType = 155, RuleBaseTypeSpecifier = 156, RuleAccessSpecifier = 157, - RuleConversionFunctionId = 158, RuleConversionTypeId = 159, RuleConversionDeclarator = 160, - RuleConstructorInitializer = 161, RuleMemInitializerList = 162, RuleMemInitializer = 163, - RuleMeminitializerid = 164, RuleOperatorFunctionId = 165, RuleLiteralOperatorId = 166, - RuleTemplateDeclaration = 167, RuleTemplateparameterList = 168, RuleTemplateParameter = 169, - RuleTypeParameter = 170, RuleSimpleTemplateId = 171, RuleTemplateId = 172, - RuleTemplateName = 173, RuleTemplateArgumentList = 174, RuleTemplateArgument = 175, - RuleTypeNameSpecifier = 176, RuleExplicitInstantiation = 177, RuleExplicitSpecialization = 178, - RuleTryBlock = 179, RuleFunctionTryBlock = 180, RuleHandlerSeq = 181, - RuleHandler = 182, RuleExceptionDeclaration = 183, RuleThrowExpression = 184, - RuleExceptionSpecification = 185, RuleDynamicExceptionSpecification = 186, - RuleTypeIdList = 187, RuleNoeExceptSpecification = 188, RuleTheOperator = 189, - RuleLiteral = 190 - }; - - explicit CPP14Parser(antlr4::TokenStream *input); - - CPP14Parser(antlr4::TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options); - - ~CPP14Parser() override; - - std::string getGrammarFileName() const override; - - const antlr4::atn::ATN& getATN() const override; - - const std::vector& getRuleNames() const override; - - const antlr4::dfa::Vocabulary& getVocabulary() const override; - - antlr4::atn::SerializedATNView getSerializedATN() const override; - - - class TranslationUnitContext; - class PrimaryExpressionContext; - class IdExpressionContext; - class UnqualifiedIdContext; - class QualifiedIdContext; - class NestedNameSpecifierContext; - class LambdaExpressionContext; - class LambdaIntroducerContext; - class LambdaCaptureContext; - class CaptureDefaultContext; - class CaptureListContext; - class CaptureContext; - class SimpleCaptureContext; - class InitcaptureContext; - class LambdaDeclaratorContext; - class PostfixExpressionContext; - class TypeIdOfTheTypeIdContext; - class ExpressionListContext; - class PseudoDestructorNameContext; - class UnaryExpressionContext; - class UnaryOperatorContext; - class NewExpressionContext; - class NewPlacementContext; - class NewTypeIdContext; - class NewDeclaratorContext; - class NoPointerNewDeclaratorContext; - class NewInitializerContext; - class DeleteExpressionContext; - class NoExceptExpressionContext; - class CastExpressionContext; - class PointerMemberExpressionContext; - class MultiplicativeExpressionContext; - class AdditiveExpressionContext; - class ShiftExpressionContext; - class ShiftOperatorContext; - class RelationalExpressionContext; - class EqualityExpressionContext; - class AndExpressionContext; - class ExclusiveOrExpressionContext; - class InclusiveOrExpressionContext; - class LogicalAndExpressionContext; - class LogicalOrExpressionContext; - class ConditionalExpressionContext; - class AssignmentExpressionContext; - class AssignmentOperatorContext; - class ExpressionContext; - class ConstantExpressionContext; - class StatementContext; - class LabeledStatementContext; - class ExpressionStatementContext; - class CompoundStatementContext; - class StatementSeqContext; - class SelectionStatementContext; - class ConditionContext; - class IterationStatementContext; - class ForInitStatementContext; - class ForRangeDeclarationContext; - class ForRangeInitializerContext; - class JumpStatementContext; - class DeclarationStatementContext; - class DeclarationseqContext; - class DeclarationContext; - class BlockDeclarationContext; - class AliasDeclarationContext; - class SimpleDeclarationContext; - class StaticAssertDeclarationContext; - class EmptyDeclarationContext; - class AttributeDeclarationContext; - class DeclSpecifierContext; - class DeclSpecifierSeqContext; - class StorageClassSpecifierContext; - class FunctionSpecifierContext; - class TypedefNameContext; - class TypeSpecifierContext; - class TrailingTypeSpecifierContext; - class TypeSpecifierSeqContext; - class TrailingTypeSpecifierSeqContext; - class SimpleTypeLengthModifierContext; - class SimpleTypeSignednessModifierContext; - class SimpleTypeSpecifierContext; - class TheTypeNameContext; - class DecltypeSpecifierContext; - class ElaboratedTypeSpecifierContext; - class EnumNameContext; - class EnumSpecifierContext; - class EnumHeadContext; - class OpaqueEnumDeclarationContext; - class EnumkeyContext; - class EnumbaseContext; - class EnumeratorListContext; - class EnumeratorDefinitionContext; - class EnumeratorContext; - class NamespaceNameContext; - class OriginalNamespaceNameContext; - class NamespaceDefinitionContext; - class NamespaceAliasContext; - class NamespaceAliasDefinitionContext; - class QualifiednamespacespecifierContext; - class UsingDeclarationContext; - class UsingDirectiveContext; - class AsmDefinitionContext; - class LinkageSpecificationContext; - class AttributeSpecifierSeqContext; - class AttributeSpecifierContext; - class AlignmentspecifierContext; - class AttributeListContext; - class AttributeContext; - class AttributeNamespaceContext; - class AttributeArgumentClauseContext; - class BalancedTokenSeqContext; - class BalancedtokenContext; - class InitDeclaratorListContext; - class InitDeclaratorContext; - class DeclaratorContext; - class PointerDeclaratorContext; - class NoPointerDeclaratorContext; - class ParametersAndQualifiersContext; - class TrailingReturnTypeContext; - class PointerOperatorContext; - class CvqualifierseqContext; - class CvQualifierContext; - class RefqualifierContext; - class DeclaratoridContext; - class TheTypeIdContext; - class AbstractDeclaratorContext; - class PointerAbstractDeclaratorContext; - class NoPointerAbstractDeclaratorContext; - class AbstractPackDeclaratorContext; - class NoPointerAbstractPackDeclaratorContext; - class ParameterDeclarationClauseContext; - class ParameterDeclarationListContext; - class ParameterDeclarationContext; - class FunctionDefinitionContext; - class FunctionBodyContext; - class InitializerContext; - class BraceOrEqualInitializerContext; - class InitializerClauseContext; - class InitializerListContext; - class BracedInitListContext; - class ClassNameContext; - class ClassSpecifierContext; - class ClassHeadContext; - class ClassHeadNameContext; - class ClassVirtSpecifierContext; - class ClassKeyContext; - class MemberSpecificationContext; - class MemberdeclarationContext; - class MemberDeclaratorListContext; - class MemberDeclaratorContext; - class VirtualSpecifierSeqContext; - class VirtualSpecifierContext; - class PureSpecifierContext; - class BaseClauseContext; - class BaseSpecifierListContext; - class BaseSpecifierContext; - class ClassOrDeclTypeContext; - class BaseTypeSpecifierContext; - class AccessSpecifierContext; - class ConversionFunctionIdContext; - class ConversionTypeIdContext; - class ConversionDeclaratorContext; - class ConstructorInitializerContext; - class MemInitializerListContext; - class MemInitializerContext; - class MeminitializeridContext; - class OperatorFunctionIdContext; - class LiteralOperatorIdContext; - class TemplateDeclarationContext; - class TemplateparameterListContext; - class TemplateParameterContext; - class TypeParameterContext; - class SimpleTemplateIdContext; - class TemplateIdContext; - class TemplateNameContext; - class TemplateArgumentListContext; - class TemplateArgumentContext; - class TypeNameSpecifierContext; - class ExplicitInstantiationContext; - class ExplicitSpecializationContext; - class TryBlockContext; - class FunctionTryBlockContext; - class HandlerSeqContext; - class HandlerContext; - class ExceptionDeclarationContext; - class ThrowExpressionContext; - class ExceptionSpecificationContext; - class DynamicExceptionSpecificationContext; - class TypeIdListContext; - class NoeExceptSpecificationContext; - class TheOperatorContext; - class LiteralContext; - - class TranslationUnitContext : public antlr4::ParserRuleContext { - public: - TranslationUnitContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *EOF(); - DeclarationseqContext *declarationseq(); - - - }; - - TranslationUnitContext* translationUnit(); - - class PrimaryExpressionContext : public antlr4::ParserRuleContext { - public: - PrimaryExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector literal(); - LiteralContext* literal(size_t i); - antlr4::tree::TerminalNode *This(); - antlr4::tree::TerminalNode *LeftParen(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *RightParen(); - IdExpressionContext *idExpression(); - LambdaExpressionContext *lambdaExpression(); - - - }; - - PrimaryExpressionContext* primaryExpression(); - - class IdExpressionContext : public antlr4::ParserRuleContext { - public: - IdExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - UnqualifiedIdContext *unqualifiedId(); - QualifiedIdContext *qualifiedId(); - - - }; - - IdExpressionContext* idExpression(); - - class UnqualifiedIdContext : public antlr4::ParserRuleContext { - public: - UnqualifiedIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - OperatorFunctionIdContext *operatorFunctionId(); - ConversionFunctionIdContext *conversionFunctionId(); - LiteralOperatorIdContext *literalOperatorId(); - antlr4::tree::TerminalNode *Tilde(); - ClassNameContext *className(); - DecltypeSpecifierContext *decltypeSpecifier(); - TemplateIdContext *templateId(); - - - }; - - UnqualifiedIdContext* unqualifiedId(); - - class QualifiedIdContext : public antlr4::ParserRuleContext { - public: - QualifiedIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NestedNameSpecifierContext *nestedNameSpecifier(); - UnqualifiedIdContext *unqualifiedId(); - antlr4::tree::TerminalNode *Template(); - - - }; - - QualifiedIdContext* qualifiedId(); - - class NestedNameSpecifierContext : public antlr4::ParserRuleContext { - public: - NestedNameSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Doublecolon(); - TheTypeNameContext *theTypeName(); - NamespaceNameContext *namespaceName(); - DecltypeSpecifierContext *decltypeSpecifier(); - NestedNameSpecifierContext *nestedNameSpecifier(); - antlr4::tree::TerminalNode *Identifier(); - SimpleTemplateIdContext *simpleTemplateId(); - antlr4::tree::TerminalNode *Template(); - - - }; - - NestedNameSpecifierContext* nestedNameSpecifier(); - NestedNameSpecifierContext* nestedNameSpecifier(int precedence); - class LambdaExpressionContext : public antlr4::ParserRuleContext { - public: - LambdaExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - LambdaIntroducerContext *lambdaIntroducer(); - CompoundStatementContext *compoundStatement(); - LambdaDeclaratorContext *lambdaDeclarator(); - - - }; - - LambdaExpressionContext* lambdaExpression(); - - class LambdaIntroducerContext : public antlr4::ParserRuleContext { - public: - LambdaIntroducerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - LambdaCaptureContext *lambdaCapture(); - - - }; - - LambdaIntroducerContext* lambdaIntroducer(); - - class LambdaCaptureContext : public antlr4::ParserRuleContext { - public: - LambdaCaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - CaptureListContext *captureList(); - CaptureDefaultContext *captureDefault(); - antlr4::tree::TerminalNode *Comma(); - - - }; - - LambdaCaptureContext* lambdaCapture(); - - class CaptureDefaultContext : public antlr4::ParserRuleContext { - public: - CaptureDefaultContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *Assign(); - - - }; - - CaptureDefaultContext* captureDefault(); - - class CaptureListContext : public antlr4::ParserRuleContext { - public: - CaptureListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector capture(); - CaptureContext* capture(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - antlr4::tree::TerminalNode *Ellipsis(); - - - }; - - CaptureListContext* captureList(); - - class CaptureContext : public antlr4::ParserRuleContext { - public: - CaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - SimpleCaptureContext *simpleCapture(); - InitcaptureContext *initcapture(); - - - }; - - CaptureContext* capture(); - - class SimpleCaptureContext : public antlr4::ParserRuleContext { - public: - SimpleCaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *This(); - - - }; - - SimpleCaptureContext* simpleCapture(); - - class InitcaptureContext : public antlr4::ParserRuleContext { - public: - InitcaptureContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - InitializerContext *initializer(); - antlr4::tree::TerminalNode *And(); - - - }; - - InitcaptureContext* initcapture(); - - class LambdaDeclaratorContext : public antlr4::ParserRuleContext { - public: - LambdaDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - ParameterDeclarationClauseContext *parameterDeclarationClause(); - antlr4::tree::TerminalNode *Mutable(); - ExceptionSpecificationContext *exceptionSpecification(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - TrailingReturnTypeContext *trailingReturnType(); - - - }; - - LambdaDeclaratorContext* lambdaDeclarator(); - - class PostfixExpressionContext : public antlr4::ParserRuleContext { - public: - PostfixExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PrimaryExpressionContext *primaryExpression(); - SimpleTypeSpecifierContext *simpleTypeSpecifier(); - TypeNameSpecifierContext *typeNameSpecifier(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - BracedInitListContext *bracedInitList(); - ExpressionListContext *expressionList(); - antlr4::tree::TerminalNode *Less(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *Greater(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *Dynamic_cast(); - antlr4::tree::TerminalNode *Static_cast(); - antlr4::tree::TerminalNode *Reinterpret_cast(); - antlr4::tree::TerminalNode *Const_cast(); - TypeIdOfTheTypeIdContext *typeIdOfTheTypeId(); - PostfixExpressionContext *postfixExpression(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - antlr4::tree::TerminalNode *Dot(); - antlr4::tree::TerminalNode *Arrow(); - IdExpressionContext *idExpression(); - PseudoDestructorNameContext *pseudoDestructorName(); - antlr4::tree::TerminalNode *Template(); - antlr4::tree::TerminalNode *PlusPlus(); - antlr4::tree::TerminalNode *MinusMinus(); - - - }; - - PostfixExpressionContext* postfixExpression(); - PostfixExpressionContext* postfixExpression(int precedence); - class TypeIdOfTheTypeIdContext : public antlr4::ParserRuleContext { - public: - TypeIdOfTheTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Typeid_(); - - - }; - - TypeIdOfTheTypeIdContext* typeIdOfTheTypeId(); - - class ExpressionListContext : public antlr4::ParserRuleContext { - public: - ExpressionListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - InitializerListContext *initializerList(); - - - }; - - ExpressionListContext* expressionList(); - - class PseudoDestructorNameContext : public antlr4::ParserRuleContext { - public: - PseudoDestructorNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Tilde(); - std::vector theTypeName(); - TheTypeNameContext* theTypeName(size_t i); - NestedNameSpecifierContext *nestedNameSpecifier(); - antlr4::tree::TerminalNode *Doublecolon(); - antlr4::tree::TerminalNode *Template(); - SimpleTemplateIdContext *simpleTemplateId(); - DecltypeSpecifierContext *decltypeSpecifier(); - - - }; - - PseudoDestructorNameContext* pseudoDestructorName(); - - class UnaryExpressionContext : public antlr4::ParserRuleContext { - public: - UnaryExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PostfixExpressionContext *postfixExpression(); - UnaryExpressionContext *unaryExpression(); - antlr4::tree::TerminalNode *PlusPlus(); - antlr4::tree::TerminalNode *MinusMinus(); - UnaryOperatorContext *unaryOperator(); - antlr4::tree::TerminalNode *Sizeof(); - antlr4::tree::TerminalNode *LeftParen(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *RightParen(); - antlr4::tree::TerminalNode *Ellipsis(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *Alignof(); - NoExceptExpressionContext *noExceptExpression(); - NewExpressionContext *newExpression(); - DeleteExpressionContext *deleteExpression(); - - - }; - - UnaryExpressionContext* unaryExpression(); - - class UnaryOperatorContext : public antlr4::ParserRuleContext { - public: - UnaryOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Or(); - antlr4::tree::TerminalNode *Star(); - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *Plus(); - antlr4::tree::TerminalNode *Tilde(); - antlr4::tree::TerminalNode *Minus(); - antlr4::tree::TerminalNode *Not(); - - - }; - - UnaryOperatorContext* unaryOperator(); - - class NewExpressionContext : public antlr4::ParserRuleContext { - public: - NewExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *New(); - NewTypeIdContext *newTypeId(); - antlr4::tree::TerminalNode *Doublecolon(); - NewPlacementContext *newPlacement(); - NewInitializerContext *newInitializer(); - antlr4::tree::TerminalNode *LeftParen(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - NewExpressionContext* newExpression(); - - class NewPlacementContext : public antlr4::ParserRuleContext { - public: - NewPlacementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftParen(); - ExpressionListContext *expressionList(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - NewPlacementContext* newPlacement(); - - class NewTypeIdContext : public antlr4::ParserRuleContext { - public: - NewTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TypeSpecifierSeqContext *typeSpecifierSeq(); - NewDeclaratorContext *newDeclarator(); - - - }; - - NewTypeIdContext* newTypeId(); - - class NewDeclaratorContext : public antlr4::ParserRuleContext { - public: - NewDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PointerOperatorContext *pointerOperator(); - NewDeclaratorContext *newDeclarator(); - NoPointerNewDeclaratorContext *noPointerNewDeclarator(); - - - }; - - NewDeclaratorContext* newDeclarator(); - - class NoPointerNewDeclaratorContext : public antlr4::ParserRuleContext { - public: - NoPointerNewDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftBracket(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *RightBracket(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - NoPointerNewDeclaratorContext *noPointerNewDeclarator(); - ConstantExpressionContext *constantExpression(); - - - }; - - NoPointerNewDeclaratorContext* noPointerNewDeclarator(); - NoPointerNewDeclaratorContext* noPointerNewDeclarator(int precedence); - class NewInitializerContext : public antlr4::ParserRuleContext { - public: - NewInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - ExpressionListContext *expressionList(); - BracedInitListContext *bracedInitList(); - - - }; - - NewInitializerContext* newInitializer(); - - class DeleteExpressionContext : public antlr4::ParserRuleContext { - public: - DeleteExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Delete(); - CastExpressionContext *castExpression(); - antlr4::tree::TerminalNode *Doublecolon(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - - - }; - - DeleteExpressionContext* deleteExpression(); - - class NoExceptExpressionContext : public antlr4::ParserRuleContext { - public: - NoExceptExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Noexcept(); - antlr4::tree::TerminalNode *LeftParen(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - NoExceptExpressionContext* noExceptExpression(); - - class CastExpressionContext : public antlr4::ParserRuleContext { - public: - CastExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - UnaryExpressionContext *unaryExpression(); - antlr4::tree::TerminalNode *LeftParen(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *RightParen(); - CastExpressionContext *castExpression(); - - - }; - - CastExpressionContext* castExpression(); - - class PointerMemberExpressionContext : public antlr4::ParserRuleContext { - public: - PointerMemberExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector castExpression(); - CastExpressionContext* castExpression(size_t i); - std::vector DotStar(); - antlr4::tree::TerminalNode* DotStar(size_t i); - std::vector ArrowStar(); - antlr4::tree::TerminalNode* ArrowStar(size_t i); - - - }; - - PointerMemberExpressionContext* pointerMemberExpression(); - - class MultiplicativeExpressionContext : public antlr4::ParserRuleContext { - public: - MultiplicativeExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector pointerMemberExpression(); - PointerMemberExpressionContext* pointerMemberExpression(size_t i); - std::vector Star(); - antlr4::tree::TerminalNode* Star(size_t i); - std::vector Div(); - antlr4::tree::TerminalNode* Div(size_t i); - std::vector Mod(); - antlr4::tree::TerminalNode* Mod(size_t i); - - - }; - - MultiplicativeExpressionContext* multiplicativeExpression(); - - class AdditiveExpressionContext : public antlr4::ParserRuleContext { - public: - AdditiveExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector multiplicativeExpression(); - MultiplicativeExpressionContext* multiplicativeExpression(size_t i); - std::vector Plus(); - antlr4::tree::TerminalNode* Plus(size_t i); - std::vector Minus(); - antlr4::tree::TerminalNode* Minus(size_t i); - - - }; - - AdditiveExpressionContext* additiveExpression(); - - class ShiftExpressionContext : public antlr4::ParserRuleContext { - public: - ShiftExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector additiveExpression(); - AdditiveExpressionContext* additiveExpression(size_t i); - std::vector shiftOperator(); - ShiftOperatorContext* shiftOperator(size_t i); - - - }; - - ShiftExpressionContext* shiftExpression(); - - class ShiftOperatorContext : public antlr4::ParserRuleContext { - public: - ShiftOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector Greater(); - antlr4::tree::TerminalNode* Greater(size_t i); - std::vector Less(); - antlr4::tree::TerminalNode* Less(size_t i); - - - }; - - ShiftOperatorContext* shiftOperator(); - - class RelationalExpressionContext : public antlr4::ParserRuleContext { - public: - RelationalExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector shiftExpression(); - ShiftExpressionContext* shiftExpression(size_t i); - std::vector Less(); - antlr4::tree::TerminalNode* Less(size_t i); - std::vector Greater(); - antlr4::tree::TerminalNode* Greater(size_t i); - std::vector LessEqual(); - antlr4::tree::TerminalNode* LessEqual(size_t i); - std::vector GreaterEqual(); - antlr4::tree::TerminalNode* GreaterEqual(size_t i); - - - }; - - RelationalExpressionContext* relationalExpression(); - - class EqualityExpressionContext : public antlr4::ParserRuleContext { - public: - EqualityExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector relationalExpression(); - RelationalExpressionContext* relationalExpression(size_t i); - std::vector Equal(); - antlr4::tree::TerminalNode* Equal(size_t i); - std::vector NotEqual(); - antlr4::tree::TerminalNode* NotEqual(size_t i); - - - }; - - EqualityExpressionContext* equalityExpression(); - - class AndExpressionContext : public antlr4::ParserRuleContext { - public: - AndExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector equalityExpression(); - EqualityExpressionContext* equalityExpression(size_t i); - std::vector And(); - antlr4::tree::TerminalNode* And(size_t i); - - - }; - - AndExpressionContext* andExpression(); - - class ExclusiveOrExpressionContext : public antlr4::ParserRuleContext { - public: - ExclusiveOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector andExpression(); - AndExpressionContext* andExpression(size_t i); - std::vector Caret(); - antlr4::tree::TerminalNode* Caret(size_t i); - - - }; - - ExclusiveOrExpressionContext* exclusiveOrExpression(); - - class InclusiveOrExpressionContext : public antlr4::ParserRuleContext { - public: - InclusiveOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector exclusiveOrExpression(); - ExclusiveOrExpressionContext* exclusiveOrExpression(size_t i); - std::vector Or(); - antlr4::tree::TerminalNode* Or(size_t i); - - - }; - - InclusiveOrExpressionContext* inclusiveOrExpression(); - - class LogicalAndExpressionContext : public antlr4::ParserRuleContext { - public: - LogicalAndExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector inclusiveOrExpression(); - InclusiveOrExpressionContext* inclusiveOrExpression(size_t i); - std::vector AndAnd(); - antlr4::tree::TerminalNode* AndAnd(size_t i); - - - }; - - LogicalAndExpressionContext* logicalAndExpression(); - - class LogicalOrExpressionContext : public antlr4::ParserRuleContext { - public: - LogicalOrExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector logicalAndExpression(); - LogicalAndExpressionContext* logicalAndExpression(size_t i); - std::vector OrOr(); - antlr4::tree::TerminalNode* OrOr(size_t i); - - - }; - - LogicalOrExpressionContext* logicalOrExpression(); - - class ConditionalExpressionContext : public antlr4::ParserRuleContext { - public: - ConditionalExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - LogicalOrExpressionContext *logicalOrExpression(); - antlr4::tree::TerminalNode *Question(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *Colon(); - AssignmentExpressionContext *assignmentExpression(); - - - }; - - ConditionalExpressionContext* conditionalExpression(); - - class AssignmentExpressionContext : public antlr4::ParserRuleContext { - public: - AssignmentExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ConditionalExpressionContext *conditionalExpression(); - LogicalOrExpressionContext *logicalOrExpression(); - AssignmentOperatorContext *assignmentOperator(); - InitializerClauseContext *initializerClause(); - ThrowExpressionContext *throwExpression(); - - - }; - - AssignmentExpressionContext* assignmentExpression(); - - class AssignmentOperatorContext : public antlr4::ParserRuleContext { - public: - AssignmentOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Assign(); - antlr4::tree::TerminalNode *StarAssign(); - antlr4::tree::TerminalNode *DivAssign(); - antlr4::tree::TerminalNode *ModAssign(); - antlr4::tree::TerminalNode *PlusAssign(); - antlr4::tree::TerminalNode *MinusAssign(); - antlr4::tree::TerminalNode *RightShiftAssign(); - antlr4::tree::TerminalNode *LeftShiftAssign(); - antlr4::tree::TerminalNode *AndAssign(); - antlr4::tree::TerminalNode *XorAssign(); - antlr4::tree::TerminalNode *OrAssign(); - - - }; - - AssignmentOperatorContext* assignmentOperator(); - - class ExpressionContext : public antlr4::ParserRuleContext { - public: - ExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector assignmentExpression(); - AssignmentExpressionContext* assignmentExpression(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - ExpressionContext* expression(); - - class ConstantExpressionContext : public antlr4::ParserRuleContext { - public: - ConstantExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ConditionalExpressionContext *conditionalExpression(); - - - }; - - ConstantExpressionContext* constantExpression(); - - class StatementContext : public antlr4::ParserRuleContext { - public: - StatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - LabeledStatementContext *labeledStatement(); - DeclarationStatementContext *declarationStatement(); - ExpressionStatementContext *expressionStatement(); - CompoundStatementContext *compoundStatement(); - SelectionStatementContext *selectionStatement(); - IterationStatementContext *iterationStatement(); - JumpStatementContext *jumpStatement(); - TryBlockContext *tryBlock(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - StatementContext* statement(); - - class LabeledStatementContext : public antlr4::ParserRuleContext { - public: - LabeledStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Colon(); - StatementContext *statement(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *Case(); - ConstantExpressionContext *constantExpression(); - antlr4::tree::TerminalNode *Default(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - LabeledStatementContext* labeledStatement(); - - class ExpressionStatementContext : public antlr4::ParserRuleContext { - public: - ExpressionStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Semi(); - ExpressionContext *expression(); - - - }; - - ExpressionStatementContext* expressionStatement(); - - class CompoundStatementContext : public antlr4::ParserRuleContext { - public: - CompoundStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - StatementSeqContext *statementSeq(); - - - }; - - CompoundStatementContext* compoundStatement(); - - class StatementSeqContext : public antlr4::ParserRuleContext { - public: - StatementSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector statement(); - StatementContext* statement(size_t i); - - - }; - - StatementSeqContext* statementSeq(); - - class SelectionStatementContext : public antlr4::ParserRuleContext { - public: - SelectionStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *If(); - antlr4::tree::TerminalNode *LeftParen(); - ConditionContext *condition(); - antlr4::tree::TerminalNode *RightParen(); - std::vector statement(); - StatementContext* statement(size_t i); - antlr4::tree::TerminalNode *Else(); - antlr4::tree::TerminalNode *Switch(); - - - }; - - SelectionStatementContext* selectionStatement(); - - class ConditionContext : public antlr4::ParserRuleContext { - public: - ConditionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ExpressionContext *expression(); - DeclSpecifierSeqContext *declSpecifierSeq(); - DeclaratorContext *declarator(); - antlr4::tree::TerminalNode *Assign(); - InitializerClauseContext *initializerClause(); - BracedInitListContext *bracedInitList(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - ConditionContext* condition(); - - class IterationStatementContext : public antlr4::ParserRuleContext { - public: - IterationStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *While(); - antlr4::tree::TerminalNode *LeftParen(); - ConditionContext *condition(); - antlr4::tree::TerminalNode *RightParen(); - StatementContext *statement(); - antlr4::tree::TerminalNode *Do(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *Semi(); - antlr4::tree::TerminalNode *For(); - ForInitStatementContext *forInitStatement(); - ForRangeDeclarationContext *forRangeDeclaration(); - antlr4::tree::TerminalNode *Colon(); - ForRangeInitializerContext *forRangeInitializer(); - - - }; - - IterationStatementContext* iterationStatement(); - - class ForInitStatementContext : public antlr4::ParserRuleContext { - public: - ForInitStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ExpressionStatementContext *expressionStatement(); - SimpleDeclarationContext *simpleDeclaration(); - - - }; - - ForInitStatementContext* forInitStatement(); - - class ForRangeDeclarationContext : public antlr4::ParserRuleContext { - public: - ForRangeDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclSpecifierSeqContext *declSpecifierSeq(); - DeclaratorContext *declarator(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - ForRangeDeclarationContext* forRangeDeclaration(); - - class ForRangeInitializerContext : public antlr4::ParserRuleContext { - public: - ForRangeInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ExpressionContext *expression(); - BracedInitListContext *bracedInitList(); - - - }; - - ForRangeInitializerContext* forRangeInitializer(); - - class JumpStatementContext : public antlr4::ParserRuleContext { - public: - JumpStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Semi(); - antlr4::tree::TerminalNode *Break(); - antlr4::tree::TerminalNode *Continue(); - antlr4::tree::TerminalNode *Return(); - antlr4::tree::TerminalNode *Goto(); - antlr4::tree::TerminalNode *Identifier(); - ExpressionContext *expression(); - BracedInitListContext *bracedInitList(); - - - }; - - JumpStatementContext* jumpStatement(); - - class DeclarationStatementContext : public antlr4::ParserRuleContext { - public: - DeclarationStatementContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - BlockDeclarationContext *blockDeclaration(); - - - }; - - DeclarationStatementContext* declarationStatement(); - - class DeclarationseqContext : public antlr4::ParserRuleContext { - public: - DeclarationseqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector declaration(); - DeclarationContext* declaration(size_t i); - - - }; - - DeclarationseqContext* declarationseq(); - - class DeclarationContext : public antlr4::ParserRuleContext { - public: - DeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - BlockDeclarationContext *blockDeclaration(); - FunctionDefinitionContext *functionDefinition(); - TemplateDeclarationContext *templateDeclaration(); - ExplicitInstantiationContext *explicitInstantiation(); - ExplicitSpecializationContext *explicitSpecialization(); - LinkageSpecificationContext *linkageSpecification(); - NamespaceDefinitionContext *namespaceDefinition(); - EmptyDeclarationContext *emptyDeclaration(); - AttributeDeclarationContext *attributeDeclaration(); - - - }; - - DeclarationContext* declaration(); - - class BlockDeclarationContext : public antlr4::ParserRuleContext { - public: - BlockDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - SimpleDeclarationContext *simpleDeclaration(); - AsmDefinitionContext *asmDefinition(); - NamespaceAliasDefinitionContext *namespaceAliasDefinition(); - UsingDeclarationContext *usingDeclaration(); - UsingDirectiveContext *usingDirective(); - StaticAssertDeclarationContext *staticAssertDeclaration(); - AliasDeclarationContext *aliasDeclaration(); - OpaqueEnumDeclarationContext *opaqueEnumDeclaration(); - - - }; - - BlockDeclarationContext* blockDeclaration(); - - class AliasDeclarationContext : public antlr4::ParserRuleContext { - public: - AliasDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Using(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *Assign(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *Semi(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - AliasDeclarationContext* aliasDeclaration(); - - class SimpleDeclarationContext : public antlr4::ParserRuleContext { - public: - SimpleDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Semi(); - DeclSpecifierSeqContext *declSpecifierSeq(); - InitDeclaratorListContext *initDeclaratorList(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - SimpleDeclarationContext* simpleDeclaration(); - - class StaticAssertDeclarationContext : public antlr4::ParserRuleContext { - public: - StaticAssertDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Static_assert(); - antlr4::tree::TerminalNode *LeftParen(); - ConstantExpressionContext *constantExpression(); - antlr4::tree::TerminalNode *Comma(); - antlr4::tree::TerminalNode *StringLiteral(); - antlr4::tree::TerminalNode *RightParen(); - antlr4::tree::TerminalNode *Semi(); - - - }; - - StaticAssertDeclarationContext* staticAssertDeclaration(); - - class EmptyDeclarationContext : public antlr4::ParserRuleContext { - public: - EmptyDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Semi(); - - - }; - - EmptyDeclarationContext* emptyDeclaration(); - - class AttributeDeclarationContext : public antlr4::ParserRuleContext { - public: - AttributeDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *Semi(); - - - }; - - AttributeDeclarationContext* attributeDeclaration(); - - class DeclSpecifierContext : public antlr4::ParserRuleContext { - public: - DeclSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - StorageClassSpecifierContext *storageClassSpecifier(); - TypeSpecifierContext *typeSpecifier(); - FunctionSpecifierContext *functionSpecifier(); - antlr4::tree::TerminalNode *Friend(); - antlr4::tree::TerminalNode *Typedef(); - antlr4::tree::TerminalNode *Constexpr(); - - - }; - - DeclSpecifierContext* declSpecifier(); - - class DeclSpecifierSeqContext : public antlr4::ParserRuleContext { - public: - DeclSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector declSpecifier(); - DeclSpecifierContext* declSpecifier(size_t i); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - DeclSpecifierSeqContext* declSpecifierSeq(); - - class StorageClassSpecifierContext : public antlr4::ParserRuleContext { - public: - StorageClassSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Register(); - antlr4::tree::TerminalNode *Static(); - antlr4::tree::TerminalNode *Thread_local(); - antlr4::tree::TerminalNode *Extern(); - antlr4::tree::TerminalNode *Mutable(); - - - }; - - StorageClassSpecifierContext* storageClassSpecifier(); - - class FunctionSpecifierContext : public antlr4::ParserRuleContext { - public: - FunctionSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Inline(); - antlr4::tree::TerminalNode *Virtual(); - antlr4::tree::TerminalNode *Explicit(); - - - }; - - FunctionSpecifierContext* functionSpecifier(); - - class TypedefNameContext : public antlr4::ParserRuleContext { - public: - TypedefNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - TypedefNameContext* typedefName(); - - class TypeSpecifierContext : public antlr4::ParserRuleContext { - public: - TypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TrailingTypeSpecifierContext *trailingTypeSpecifier(); - ClassSpecifierContext *classSpecifier(); - EnumSpecifierContext *enumSpecifier(); - - - }; - - TypeSpecifierContext* typeSpecifier(); - - class TrailingTypeSpecifierContext : public antlr4::ParserRuleContext { - public: - TrailingTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - SimpleTypeSpecifierContext *simpleTypeSpecifier(); - ElaboratedTypeSpecifierContext *elaboratedTypeSpecifier(); - TypeNameSpecifierContext *typeNameSpecifier(); - CvQualifierContext *cvQualifier(); - - - }; - - TrailingTypeSpecifierContext* trailingTypeSpecifier(); - - class TypeSpecifierSeqContext : public antlr4::ParserRuleContext { - public: - TypeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector typeSpecifier(); - TypeSpecifierContext* typeSpecifier(size_t i); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - TypeSpecifierSeqContext* typeSpecifierSeq(); - - class TrailingTypeSpecifierSeqContext : public antlr4::ParserRuleContext { - public: - TrailingTypeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector trailingTypeSpecifier(); - TrailingTypeSpecifierContext* trailingTypeSpecifier(size_t i); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - TrailingTypeSpecifierSeqContext* trailingTypeSpecifierSeq(); - - class SimpleTypeLengthModifierContext : public antlr4::ParserRuleContext { - public: - SimpleTypeLengthModifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Short(); - antlr4::tree::TerminalNode *Long(); - - - }; - - SimpleTypeLengthModifierContext* simpleTypeLengthModifier(); - - class SimpleTypeSignednessModifierContext : public antlr4::ParserRuleContext { - public: - SimpleTypeSignednessModifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Unsigned(); - antlr4::tree::TerminalNode *Signed(); - - - }; - - SimpleTypeSignednessModifierContext* simpleTypeSignednessModifier(); - - class SimpleTypeSpecifierContext : public antlr4::ParserRuleContext { - public: - SimpleTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TheTypeNameContext *theTypeName(); - NestedNameSpecifierContext *nestedNameSpecifier(); - antlr4::tree::TerminalNode *Template(); - SimpleTemplateIdContext *simpleTemplateId(); - SimpleTypeSignednessModifierContext *simpleTypeSignednessModifier(); - std::vector simpleTypeLengthModifier(); - SimpleTypeLengthModifierContext* simpleTypeLengthModifier(size_t i); - antlr4::tree::TerminalNode *Char(); - antlr4::tree::TerminalNode *Char16(); - antlr4::tree::TerminalNode *Char32(); - antlr4::tree::TerminalNode *Wchar(); - antlr4::tree::TerminalNode *Bool(); - antlr4::tree::TerminalNode *Int(); - antlr4::tree::TerminalNode *Float(); - antlr4::tree::TerminalNode *Double(); - antlr4::tree::TerminalNode *Void(); - antlr4::tree::TerminalNode *Auto(); - DecltypeSpecifierContext *decltypeSpecifier(); - - - }; - - SimpleTypeSpecifierContext* simpleTypeSpecifier(); - - class TheTypeNameContext : public antlr4::ParserRuleContext { - public: - TheTypeNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassNameContext *className(); - EnumNameContext *enumName(); - TypedefNameContext *typedefName(); - SimpleTemplateIdContext *simpleTemplateId(); - - - }; - - TheTypeNameContext* theTypeName(); - - class DecltypeSpecifierContext : public antlr4::ParserRuleContext { - public: - DecltypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Decltype(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - ExpressionContext *expression(); - antlr4::tree::TerminalNode *Auto(); - - - }; - - DecltypeSpecifierContext* decltypeSpecifier(); - - class ElaboratedTypeSpecifierContext : public antlr4::ParserRuleContext { - public: - ElaboratedTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassKeyContext *classKey(); - antlr4::tree::TerminalNode *Identifier(); - SimpleTemplateIdContext *simpleTemplateId(); - NestedNameSpecifierContext *nestedNameSpecifier(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *Template(); - antlr4::tree::TerminalNode *Enum(); - - - }; - - ElaboratedTypeSpecifierContext* elaboratedTypeSpecifier(); - - class EnumNameContext : public antlr4::ParserRuleContext { - public: - EnumNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - EnumNameContext* enumName(); - - class EnumSpecifierContext : public antlr4::ParserRuleContext { - public: - EnumSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - EnumHeadContext *enumHead(); - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - EnumeratorListContext *enumeratorList(); - antlr4::tree::TerminalNode *Comma(); - - - }; - - EnumSpecifierContext* enumSpecifier(); - - class EnumHeadContext : public antlr4::ParserRuleContext { - public: - EnumHeadContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - EnumkeyContext *enumkey(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *Identifier(); - EnumbaseContext *enumbase(); - NestedNameSpecifierContext *nestedNameSpecifier(); - - - }; - - EnumHeadContext* enumHead(); - - class OpaqueEnumDeclarationContext : public antlr4::ParserRuleContext { - public: - OpaqueEnumDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - EnumkeyContext *enumkey(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *Semi(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - EnumbaseContext *enumbase(); - - - }; - - OpaqueEnumDeclarationContext* opaqueEnumDeclaration(); - - class EnumkeyContext : public antlr4::ParserRuleContext { - public: - EnumkeyContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Enum(); - antlr4::tree::TerminalNode *Class(); - antlr4::tree::TerminalNode *Struct(); - - - }; - - EnumkeyContext* enumkey(); - - class EnumbaseContext : public antlr4::ParserRuleContext { - public: - EnumbaseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Colon(); - TypeSpecifierSeqContext *typeSpecifierSeq(); - - - }; - - EnumbaseContext* enumbase(); - - class EnumeratorListContext : public antlr4::ParserRuleContext { - public: - EnumeratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector enumeratorDefinition(); - EnumeratorDefinitionContext* enumeratorDefinition(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - EnumeratorListContext* enumeratorList(); - - class EnumeratorDefinitionContext : public antlr4::ParserRuleContext { - public: - EnumeratorDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - EnumeratorContext *enumerator(); - antlr4::tree::TerminalNode *Assign(); - ConstantExpressionContext *constantExpression(); - - - }; - - EnumeratorDefinitionContext* enumeratorDefinition(); - - class EnumeratorContext : public antlr4::ParserRuleContext { - public: - EnumeratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - EnumeratorContext* enumerator(); - - class NamespaceNameContext : public antlr4::ParserRuleContext { - public: - NamespaceNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - OriginalNamespaceNameContext *originalNamespaceName(); - NamespaceAliasContext *namespaceAlias(); - - - }; - - NamespaceNameContext* namespaceName(); - - class OriginalNamespaceNameContext : public antlr4::ParserRuleContext { - public: - OriginalNamespaceNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - OriginalNamespaceNameContext* originalNamespaceName(); - - class NamespaceDefinitionContext : public antlr4::ParserRuleContext { - public: - CPP14Parser::DeclarationseqContext *namespaceBody = nullptr; - NamespaceDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Namespace(); - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - antlr4::tree::TerminalNode *Inline(); - antlr4::tree::TerminalNode *Identifier(); - OriginalNamespaceNameContext *originalNamespaceName(); - DeclarationseqContext *declarationseq(); - - - }; - - NamespaceDefinitionContext* namespaceDefinition(); - - class NamespaceAliasContext : public antlr4::ParserRuleContext { - public: - NamespaceAliasContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - NamespaceAliasContext* namespaceAlias(); - - class NamespaceAliasDefinitionContext : public antlr4::ParserRuleContext { - public: - NamespaceAliasDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Namespace(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *Assign(); - QualifiednamespacespecifierContext *qualifiednamespacespecifier(); - antlr4::tree::TerminalNode *Semi(); - - - }; - - NamespaceAliasDefinitionContext* namespaceAliasDefinition(); - - class QualifiednamespacespecifierContext : public antlr4::ParserRuleContext { - public: - QualifiednamespacespecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NamespaceNameContext *namespaceName(); - NestedNameSpecifierContext *nestedNameSpecifier(); - - - }; - - QualifiednamespacespecifierContext* qualifiednamespacespecifier(); - - class UsingDeclarationContext : public antlr4::ParserRuleContext { - public: - UsingDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Using(); - UnqualifiedIdContext *unqualifiedId(); - antlr4::tree::TerminalNode *Semi(); - antlr4::tree::TerminalNode *Doublecolon(); - NestedNameSpecifierContext *nestedNameSpecifier(); - antlr4::tree::TerminalNode *Typename_(); - - - }; - - UsingDeclarationContext* usingDeclaration(); - - class UsingDirectiveContext : public antlr4::ParserRuleContext { - public: - UsingDirectiveContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Using(); - antlr4::tree::TerminalNode *Namespace(); - NamespaceNameContext *namespaceName(); - antlr4::tree::TerminalNode *Semi(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - NestedNameSpecifierContext *nestedNameSpecifier(); - - - }; - - UsingDirectiveContext* usingDirective(); - - class AsmDefinitionContext : public antlr4::ParserRuleContext { - public: - AsmDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Asm(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *StringLiteral(); - antlr4::tree::TerminalNode *RightParen(); - antlr4::tree::TerminalNode *Semi(); - - - }; - - AsmDefinitionContext* asmDefinition(); - - class LinkageSpecificationContext : public antlr4::ParserRuleContext { - public: - LinkageSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Extern(); - antlr4::tree::TerminalNode *StringLiteral(); - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - DeclarationContext *declaration(); - DeclarationseqContext *declarationseq(); - - - }; - - LinkageSpecificationContext* linkageSpecification(); - - class AttributeSpecifierSeqContext : public antlr4::ParserRuleContext { - public: - AttributeSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector attributeSpecifier(); - AttributeSpecifierContext* attributeSpecifier(size_t i); - - - }; - - AttributeSpecifierSeqContext* attributeSpecifierSeq(); - - class AttributeSpecifierContext : public antlr4::ParserRuleContext { - public: - AttributeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector LeftBracket(); - antlr4::tree::TerminalNode* LeftBracket(size_t i); - std::vector RightBracket(); - antlr4::tree::TerminalNode* RightBracket(size_t i); - AttributeListContext *attributeList(); - AlignmentspecifierContext *alignmentspecifier(); - - - }; - - AttributeSpecifierContext* attributeSpecifier(); - - class AlignmentspecifierContext : public antlr4::ParserRuleContext { - public: - AlignmentspecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Alignas(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - TheTypeIdContext *theTypeId(); - ConstantExpressionContext *constantExpression(); - antlr4::tree::TerminalNode *Ellipsis(); - - - }; - - AlignmentspecifierContext* alignmentspecifier(); - - class AttributeListContext : public antlr4::ParserRuleContext { - public: - AttributeListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector attribute(); - AttributeContext* attribute(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - antlr4::tree::TerminalNode *Ellipsis(); - - - }; - - AttributeListContext* attributeList(); - - class AttributeContext : public antlr4::ParserRuleContext { - public: - AttributeContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - AttributeNamespaceContext *attributeNamespace(); - antlr4::tree::TerminalNode *Doublecolon(); - AttributeArgumentClauseContext *attributeArgumentClause(); - - - }; - - AttributeContext* attribute(); - - class AttributeNamespaceContext : public antlr4::ParserRuleContext { - public: - AttributeNamespaceContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - AttributeNamespaceContext* attributeNamespace(); - - class AttributeArgumentClauseContext : public antlr4::ParserRuleContext { - public: - AttributeArgumentClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - BalancedTokenSeqContext *balancedTokenSeq(); - - - }; - - AttributeArgumentClauseContext* attributeArgumentClause(); - - class BalancedTokenSeqContext : public antlr4::ParserRuleContext { - public: - BalancedTokenSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector balancedtoken(); - BalancedtokenContext* balancedtoken(size_t i); - - - }; - - BalancedTokenSeqContext* balancedTokenSeq(); - - class BalancedtokenContext : public antlr4::ParserRuleContext { - public: - BalancedtokenContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector LeftParen(); - antlr4::tree::TerminalNode* LeftParen(size_t i); - BalancedTokenSeqContext *balancedTokenSeq(); - std::vector RightParen(); - antlr4::tree::TerminalNode* RightParen(size_t i); - std::vector LeftBracket(); - antlr4::tree::TerminalNode* LeftBracket(size_t i); - std::vector RightBracket(); - antlr4::tree::TerminalNode* RightBracket(size_t i); - std::vector LeftBrace(); - antlr4::tree::TerminalNode* LeftBrace(size_t i); - std::vector RightBrace(); - antlr4::tree::TerminalNode* RightBrace(size_t i); - - - }; - - BalancedtokenContext* balancedtoken(); - - class InitDeclaratorListContext : public antlr4::ParserRuleContext { - public: - InitDeclaratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector initDeclarator(); - InitDeclaratorContext* initDeclarator(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - InitDeclaratorListContext* initDeclaratorList(); - - class InitDeclaratorContext : public antlr4::ParserRuleContext { - public: - InitDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclaratorContext *declarator(); - InitializerContext *initializer(); - - - }; - - InitDeclaratorContext* initDeclarator(); - - class DeclaratorContext : public antlr4::ParserRuleContext { - public: - DeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PointerDeclaratorContext *pointerDeclarator(); - NoPointerDeclaratorContext *noPointerDeclarator(); - ParametersAndQualifiersContext *parametersAndQualifiers(); - TrailingReturnTypeContext *trailingReturnType(); - - - }; - - DeclaratorContext* declarator(); - - class PointerDeclaratorContext : public antlr4::ParserRuleContext { - public: - PointerDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NoPointerDeclaratorContext *noPointerDeclarator(); - std::vector pointerOperator(); - PointerOperatorContext* pointerOperator(size_t i); - std::vector Const(); - antlr4::tree::TerminalNode* Const(size_t i); - - - }; - - PointerDeclaratorContext* pointerDeclarator(); - - class NoPointerDeclaratorContext : public antlr4::ParserRuleContext { - public: - NoPointerDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclaratoridContext *declaratorid(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *LeftParen(); - PointerDeclaratorContext *pointerDeclarator(); - antlr4::tree::TerminalNode *RightParen(); - NoPointerDeclaratorContext *noPointerDeclarator(); - ParametersAndQualifiersContext *parametersAndQualifiers(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - ConstantExpressionContext *constantExpression(); - - - }; - - NoPointerDeclaratorContext* noPointerDeclarator(); - NoPointerDeclaratorContext* noPointerDeclarator(int precedence); - class ParametersAndQualifiersContext : public antlr4::ParserRuleContext { - public: - ParametersAndQualifiersContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - ParameterDeclarationClauseContext *parameterDeclarationClause(); - CvqualifierseqContext *cvqualifierseq(); - RefqualifierContext *refqualifier(); - ExceptionSpecificationContext *exceptionSpecification(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - ParametersAndQualifiersContext* parametersAndQualifiers(); - - class TrailingReturnTypeContext : public antlr4::ParserRuleContext { - public: - TrailingReturnTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Arrow(); - TrailingTypeSpecifierSeqContext *trailingTypeSpecifierSeq(); - AbstractDeclaratorContext *abstractDeclarator(); - - - }; - - TrailingReturnTypeContext* trailingReturnType(); - - class PointerOperatorContext : public antlr4::ParserRuleContext { - public: - PointerOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *AndAnd(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *Star(); - NestedNameSpecifierContext *nestedNameSpecifier(); - CvqualifierseqContext *cvqualifierseq(); - - - }; - - PointerOperatorContext* pointerOperator(); - - class CvqualifierseqContext : public antlr4::ParserRuleContext { - public: - CvqualifierseqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector cvQualifier(); - CvQualifierContext* cvQualifier(size_t i); - - - }; - - CvqualifierseqContext* cvqualifierseq(); - - class CvQualifierContext : public antlr4::ParserRuleContext { - public: - CvQualifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Const(); - antlr4::tree::TerminalNode *Volatile(); - - - }; - - CvQualifierContext* cvQualifier(); - - class RefqualifierContext : public antlr4::ParserRuleContext { - public: - RefqualifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *AndAnd(); - - - }; - - RefqualifierContext* refqualifier(); - - class DeclaratoridContext : public antlr4::ParserRuleContext { - public: - DeclaratoridContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - IdExpressionContext *idExpression(); - antlr4::tree::TerminalNode *Ellipsis(); - - - }; - - DeclaratoridContext* declaratorid(); - - class TheTypeIdContext : public antlr4::ParserRuleContext { - public: - TheTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TypeSpecifierSeqContext *typeSpecifierSeq(); - AbstractDeclaratorContext *abstractDeclarator(); - - - }; - - TheTypeIdContext* theTypeId(); - - class AbstractDeclaratorContext : public antlr4::ParserRuleContext { - public: - AbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PointerAbstractDeclaratorContext *pointerAbstractDeclarator(); - ParametersAndQualifiersContext *parametersAndQualifiers(); - TrailingReturnTypeContext *trailingReturnType(); - NoPointerAbstractDeclaratorContext *noPointerAbstractDeclarator(); - AbstractPackDeclaratorContext *abstractPackDeclarator(); - - - }; - - AbstractDeclaratorContext* abstractDeclarator(); - - class PointerAbstractDeclaratorContext : public antlr4::ParserRuleContext { - public: - PointerAbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NoPointerAbstractDeclaratorContext *noPointerAbstractDeclarator(); - std::vector pointerOperator(); - PointerOperatorContext* pointerOperator(size_t i); - - - }; - - PointerAbstractDeclaratorContext* pointerAbstractDeclarator(); - - class NoPointerAbstractDeclaratorContext : public antlr4::ParserRuleContext { - public: - NoPointerAbstractDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ParametersAndQualifiersContext *parametersAndQualifiers(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - ConstantExpressionContext *constantExpression(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - antlr4::tree::TerminalNode *LeftParen(); - PointerAbstractDeclaratorContext *pointerAbstractDeclarator(); - antlr4::tree::TerminalNode *RightParen(); - std::vector noPointerAbstractDeclarator(); - NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(size_t i); - - - }; - - NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(); - NoPointerAbstractDeclaratorContext* noPointerAbstractDeclarator(int precedence); - class AbstractPackDeclaratorContext : public antlr4::ParserRuleContext { - public: - AbstractPackDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NoPointerAbstractPackDeclaratorContext *noPointerAbstractPackDeclarator(); - std::vector pointerOperator(); - PointerOperatorContext* pointerOperator(size_t i); - - - }; - - AbstractPackDeclaratorContext* abstractPackDeclarator(); - - class NoPointerAbstractPackDeclaratorContext : public antlr4::ParserRuleContext { - public: - NoPointerAbstractPackDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Ellipsis(); - NoPointerAbstractPackDeclaratorContext *noPointerAbstractPackDeclarator(); - ParametersAndQualifiersContext *parametersAndQualifiers(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - ConstantExpressionContext *constantExpression(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - NoPointerAbstractPackDeclaratorContext* noPointerAbstractPackDeclarator(); - NoPointerAbstractPackDeclaratorContext* noPointerAbstractPackDeclarator(int precedence); - class ParameterDeclarationClauseContext : public antlr4::ParserRuleContext { - public: - ParameterDeclarationClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ParameterDeclarationListContext *parameterDeclarationList(); - antlr4::tree::TerminalNode *Ellipsis(); - antlr4::tree::TerminalNode *Comma(); - - - }; - - ParameterDeclarationClauseContext* parameterDeclarationClause(); - - class ParameterDeclarationListContext : public antlr4::ParserRuleContext { - public: - ParameterDeclarationListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector parameterDeclaration(); - ParameterDeclarationContext* parameterDeclaration(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - ParameterDeclarationListContext* parameterDeclarationList(); - - class ParameterDeclarationContext : public antlr4::ParserRuleContext { - public: - ParameterDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclSpecifierSeqContext *declSpecifierSeq(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - DeclaratorContext *declarator(); - antlr4::tree::TerminalNode *Assign(); - InitializerClauseContext *initializerClause(); - AbstractDeclaratorContext *abstractDeclarator(); - - - }; - - ParameterDeclarationContext* parameterDeclaration(); - - class FunctionDefinitionContext : public antlr4::ParserRuleContext { - public: - FunctionDefinitionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclaratorContext *declarator(); - FunctionBodyContext *functionBody(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - DeclSpecifierSeqContext *declSpecifierSeq(); - VirtualSpecifierSeqContext *virtualSpecifierSeq(); - - - }; - - FunctionDefinitionContext* functionDefinition(); - - class FunctionBodyContext : public antlr4::ParserRuleContext { - public: - FunctionBodyContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - CompoundStatementContext *compoundStatement(); - ConstructorInitializerContext *constructorInitializer(); - FunctionTryBlockContext *functionTryBlock(); - antlr4::tree::TerminalNode *Assign(); - antlr4::tree::TerminalNode *Semi(); - antlr4::tree::TerminalNode *Default(); - antlr4::tree::TerminalNode *Delete(); - - - }; - - FunctionBodyContext* functionBody(); - - class InitializerContext : public antlr4::ParserRuleContext { - public: - InitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - BraceOrEqualInitializerContext *braceOrEqualInitializer(); - antlr4::tree::TerminalNode *LeftParen(); - ExpressionListContext *expressionList(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - InitializerContext* initializer(); - - class BraceOrEqualInitializerContext : public antlr4::ParserRuleContext { - public: - BraceOrEqualInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Assign(); - InitializerClauseContext *initializerClause(); - BracedInitListContext *bracedInitList(); - - - }; - - BraceOrEqualInitializerContext* braceOrEqualInitializer(); - - class InitializerClauseContext : public antlr4::ParserRuleContext { - public: - InitializerClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - AssignmentExpressionContext *assignmentExpression(); - BracedInitListContext *bracedInitList(); - - - }; - - InitializerClauseContext* initializerClause(); - - class InitializerListContext : public antlr4::ParserRuleContext { - public: - InitializerListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector initializerClause(); - InitializerClauseContext* initializerClause(size_t i); - std::vector Ellipsis(); - antlr4::tree::TerminalNode* Ellipsis(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - InitializerListContext* initializerList(); - - class BracedInitListContext : public antlr4::ParserRuleContext { - public: - BracedInitListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - InitializerListContext *initializerList(); - antlr4::tree::TerminalNode *Comma(); - - - }; - - BracedInitListContext* bracedInitList(); - - class ClassNameContext : public antlr4::ParserRuleContext { - public: - ClassNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - SimpleTemplateIdContext *simpleTemplateId(); - - - }; - - ClassNameContext* className(); - - class ClassSpecifierContext : public antlr4::ParserRuleContext { - public: - ClassSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassHeadContext *classHead(); - antlr4::tree::TerminalNode *LeftBrace(); - antlr4::tree::TerminalNode *RightBrace(); - MemberSpecificationContext *memberSpecification(); - - - }; - - ClassSpecifierContext* classSpecifier(); - - class ClassHeadContext : public antlr4::ParserRuleContext { - public: - ClassHeadContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassKeyContext *classKey(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - ClassHeadNameContext *classHeadName(); - BaseClauseContext *baseClause(); - ClassVirtSpecifierContext *classVirtSpecifier(); - antlr4::tree::TerminalNode *Union(); - - - }; - - ClassHeadContext* classHead(); - - class ClassHeadNameContext : public antlr4::ParserRuleContext { - public: - ClassHeadNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassNameContext *className(); - NestedNameSpecifierContext *nestedNameSpecifier(); - - - }; - - ClassHeadNameContext* classHeadName(); - - class ClassVirtSpecifierContext : public antlr4::ParserRuleContext { - public: - ClassVirtSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Final(); - - - }; - - ClassVirtSpecifierContext* classVirtSpecifier(); - - class ClassKeyContext : public antlr4::ParserRuleContext { - public: - ClassKeyContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Class(); - antlr4::tree::TerminalNode *Struct(); - - - }; - - ClassKeyContext* classKey(); - - class MemberSpecificationContext : public antlr4::ParserRuleContext { - public: - MemberSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector memberdeclaration(); - MemberdeclarationContext* memberdeclaration(size_t i); - std::vector accessSpecifier(); - AccessSpecifierContext* accessSpecifier(size_t i); - std::vector Colon(); - antlr4::tree::TerminalNode* Colon(size_t i); - - - }; - - MemberSpecificationContext* memberSpecification(); - - class MemberdeclarationContext : public antlr4::ParserRuleContext { - public: - MemberdeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Semi(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - DeclSpecifierSeqContext *declSpecifierSeq(); - MemberDeclaratorListContext *memberDeclaratorList(); - FunctionDefinitionContext *functionDefinition(); - UsingDeclarationContext *usingDeclaration(); - StaticAssertDeclarationContext *staticAssertDeclaration(); - TemplateDeclarationContext *templateDeclaration(); - AliasDeclarationContext *aliasDeclaration(); - EmptyDeclarationContext *emptyDeclaration(); - - - }; - - MemberdeclarationContext* memberdeclaration(); - - class MemberDeclaratorListContext : public antlr4::ParserRuleContext { - public: - MemberDeclaratorListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector memberDeclarator(); - MemberDeclaratorContext* memberDeclarator(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - MemberDeclaratorListContext* memberDeclaratorList(); - - class MemberDeclaratorContext : public antlr4::ParserRuleContext { - public: - MemberDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DeclaratorContext *declarator(); - VirtualSpecifierSeqContext *virtualSpecifierSeq(); - PureSpecifierContext *pureSpecifier(); - BraceOrEqualInitializerContext *braceOrEqualInitializer(); - antlr4::tree::TerminalNode *Colon(); - ConstantExpressionContext *constantExpression(); - antlr4::tree::TerminalNode *Identifier(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - MemberDeclaratorContext* memberDeclarator(); - - class VirtualSpecifierSeqContext : public antlr4::ParserRuleContext { - public: - VirtualSpecifierSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector virtualSpecifier(); - VirtualSpecifierContext* virtualSpecifier(size_t i); - - - }; - - VirtualSpecifierSeqContext* virtualSpecifierSeq(); - - class VirtualSpecifierContext : public antlr4::ParserRuleContext { - public: - VirtualSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Override(); - antlr4::tree::TerminalNode *Final(); - - - }; - - VirtualSpecifierContext* virtualSpecifier(); - - class PureSpecifierContext : public antlr4::ParserRuleContext { - public: - antlr4::Token *val = nullptr; - PureSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Assign(); - antlr4::tree::TerminalNode *OctalLiteral(); - - - }; - - PureSpecifierContext* pureSpecifier(); - - class BaseClauseContext : public antlr4::ParserRuleContext { - public: - BaseClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Colon(); - BaseSpecifierListContext *baseSpecifierList(); - - - }; - - BaseClauseContext* baseClause(); - - class BaseSpecifierListContext : public antlr4::ParserRuleContext { - public: - BaseSpecifierListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector baseSpecifier(); - BaseSpecifierContext* baseSpecifier(size_t i); - std::vector Ellipsis(); - antlr4::tree::TerminalNode* Ellipsis(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - BaseSpecifierListContext* baseSpecifierList(); - - class BaseSpecifierContext : public antlr4::ParserRuleContext { - public: - BaseSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - BaseTypeSpecifierContext *baseTypeSpecifier(); - antlr4::tree::TerminalNode *Virtual(); - AccessSpecifierContext *accessSpecifier(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - - - }; - - BaseSpecifierContext* baseSpecifier(); - - class ClassOrDeclTypeContext : public antlr4::ParserRuleContext { - public: - ClassOrDeclTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassNameContext *className(); - NestedNameSpecifierContext *nestedNameSpecifier(); - DecltypeSpecifierContext *decltypeSpecifier(); - - - }; - - ClassOrDeclTypeContext* classOrDeclType(); - - class BaseTypeSpecifierContext : public antlr4::ParserRuleContext { - public: - BaseTypeSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassOrDeclTypeContext *classOrDeclType(); - - - }; - - BaseTypeSpecifierContext* baseTypeSpecifier(); - - class AccessSpecifierContext : public antlr4::ParserRuleContext { - public: - AccessSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Private(); - antlr4::tree::TerminalNode *Protected(); - antlr4::tree::TerminalNode *Public(); - - - }; - - AccessSpecifierContext* accessSpecifier(); - - class ConversionFunctionIdContext : public antlr4::ParserRuleContext { - public: - ConversionFunctionIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Operator(); - ConversionTypeIdContext *conversionTypeId(); - - - }; - - ConversionFunctionIdContext* conversionFunctionId(); - - class ConversionTypeIdContext : public antlr4::ParserRuleContext { - public: - ConversionTypeIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TypeSpecifierSeqContext *typeSpecifierSeq(); - ConversionDeclaratorContext *conversionDeclarator(); - - - }; - - ConversionTypeIdContext* conversionTypeId(); - - class ConversionDeclaratorContext : public antlr4::ParserRuleContext { - public: - ConversionDeclaratorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - PointerOperatorContext *pointerOperator(); - ConversionDeclaratorContext *conversionDeclarator(); - - - }; - - ConversionDeclaratorContext* conversionDeclarator(); - - class ConstructorInitializerContext : public antlr4::ParserRuleContext { - public: - ConstructorInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Colon(); - MemInitializerListContext *memInitializerList(); - - - }; - - ConstructorInitializerContext* constructorInitializer(); - - class MemInitializerListContext : public antlr4::ParserRuleContext { - public: - MemInitializerListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector memInitializer(); - MemInitializerContext* memInitializer(size_t i); - std::vector Ellipsis(); - antlr4::tree::TerminalNode* Ellipsis(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - MemInitializerListContext* memInitializerList(); - - class MemInitializerContext : public antlr4::ParserRuleContext { - public: - MemInitializerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - MeminitializeridContext *meminitializerid(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - BracedInitListContext *bracedInitList(); - ExpressionListContext *expressionList(); - - - }; - - MemInitializerContext* memInitializer(); - - class MeminitializeridContext : public antlr4::ParserRuleContext { - public: - MeminitializeridContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - ClassOrDeclTypeContext *classOrDeclType(); - antlr4::tree::TerminalNode *Identifier(); - - - }; - - MeminitializeridContext* meminitializerid(); - - class OperatorFunctionIdContext : public antlr4::ParserRuleContext { - public: - OperatorFunctionIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Operator(); - TheOperatorContext *theOperator(); - - - }; - - OperatorFunctionIdContext* operatorFunctionId(); - - class LiteralOperatorIdContext : public antlr4::ParserRuleContext { - public: - LiteralOperatorIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Operator(); - antlr4::tree::TerminalNode *StringLiteral(); - antlr4::tree::TerminalNode *Identifier(); - antlr4::tree::TerminalNode *UserDefinedStringLiteral(); - - - }; - - LiteralOperatorIdContext* literalOperatorId(); - - class TemplateDeclarationContext : public antlr4::ParserRuleContext { - public: - TemplateDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Template(); - antlr4::tree::TerminalNode *Less(); - TemplateparameterListContext *templateparameterList(); - antlr4::tree::TerminalNode *Greater(); - DeclarationContext *declaration(); - - - }; - - TemplateDeclarationContext* templateDeclaration(); - - class TemplateparameterListContext : public antlr4::ParserRuleContext { - public: - TemplateparameterListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector templateParameter(); - TemplateParameterContext* templateParameter(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - TemplateparameterListContext* templateparameterList(); - - class TemplateParameterContext : public antlr4::ParserRuleContext { - public: - TemplateParameterContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TypeParameterContext *typeParameter(); - ParameterDeclarationContext *parameterDeclaration(); - - - }; - - TemplateParameterContext* templateParameter(); - - class TypeParameterContext : public antlr4::ParserRuleContext { - public: - TypeParameterContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Class(); - antlr4::tree::TerminalNode *Typename_(); - antlr4::tree::TerminalNode *Assign(); - TheTypeIdContext *theTypeId(); - antlr4::tree::TerminalNode *Template(); - antlr4::tree::TerminalNode *Less(); - TemplateparameterListContext *templateparameterList(); - antlr4::tree::TerminalNode *Greater(); - antlr4::tree::TerminalNode *Ellipsis(); - antlr4::tree::TerminalNode *Identifier(); - - - }; - - TypeParameterContext* typeParameter(); - - class SimpleTemplateIdContext : public antlr4::ParserRuleContext { - public: - SimpleTemplateIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TemplateNameContext *templateName(); - antlr4::tree::TerminalNode *Less(); - antlr4::tree::TerminalNode *Greater(); - TemplateArgumentListContext *templateArgumentList(); - - - }; - - SimpleTemplateIdContext* simpleTemplateId(); - - class TemplateIdContext : public antlr4::ParserRuleContext { - public: - TemplateIdContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - SimpleTemplateIdContext *simpleTemplateId(); - antlr4::tree::TerminalNode *Less(); - antlr4::tree::TerminalNode *Greater(); - OperatorFunctionIdContext *operatorFunctionId(); - LiteralOperatorIdContext *literalOperatorId(); - TemplateArgumentListContext *templateArgumentList(); - - - }; - - TemplateIdContext* templateId(); - - class TemplateNameContext : public antlr4::ParserRuleContext { - public: - TemplateNameContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Identifier(); - - - }; - - TemplateNameContext* templateName(); - - class TemplateArgumentListContext : public antlr4::ParserRuleContext { - public: - TemplateArgumentListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector templateArgument(); - TemplateArgumentContext* templateArgument(size_t i); - std::vector Ellipsis(); - antlr4::tree::TerminalNode* Ellipsis(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - TemplateArgumentListContext* templateArgumentList(); - - class TemplateArgumentContext : public antlr4::ParserRuleContext { - public: - TemplateArgumentContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TheTypeIdContext *theTypeId(); - ConstantExpressionContext *constantExpression(); - IdExpressionContext *idExpression(); - - - }; - - TemplateArgumentContext* templateArgument(); - - class TypeNameSpecifierContext : public antlr4::ParserRuleContext { - public: - TypeNameSpecifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Typename_(); - NestedNameSpecifierContext *nestedNameSpecifier(); - antlr4::tree::TerminalNode *Identifier(); - SimpleTemplateIdContext *simpleTemplateId(); - antlr4::tree::TerminalNode *Template(); - - - }; - - TypeNameSpecifierContext* typeNameSpecifier(); - - class ExplicitInstantiationContext : public antlr4::ParserRuleContext { - public: - ExplicitInstantiationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Template(); - DeclarationContext *declaration(); - antlr4::tree::TerminalNode *Extern(); - - - }; - - ExplicitInstantiationContext* explicitInstantiation(); - - class ExplicitSpecializationContext : public antlr4::ParserRuleContext { - public: - ExplicitSpecializationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Template(); - antlr4::tree::TerminalNode *Less(); - antlr4::tree::TerminalNode *Greater(); - DeclarationContext *declaration(); - - - }; - - ExplicitSpecializationContext* explicitSpecialization(); - - class TryBlockContext : public antlr4::ParserRuleContext { - public: - TryBlockContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Try(); - CompoundStatementContext *compoundStatement(); - HandlerSeqContext *handlerSeq(); - - - }; - - TryBlockContext* tryBlock(); - - class FunctionTryBlockContext : public antlr4::ParserRuleContext { - public: - FunctionTryBlockContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Try(); - CompoundStatementContext *compoundStatement(); - HandlerSeqContext *handlerSeq(); - ConstructorInitializerContext *constructorInitializer(); - - - }; - - FunctionTryBlockContext* functionTryBlock(); - - class HandlerSeqContext : public antlr4::ParserRuleContext { - public: - HandlerSeqContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector handler(); - HandlerContext* handler(size_t i); - - - }; - - HandlerSeqContext* handlerSeq(); - - class HandlerContext : public antlr4::ParserRuleContext { - public: - HandlerContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Catch(); - antlr4::tree::TerminalNode *LeftParen(); - ExceptionDeclarationContext *exceptionDeclaration(); - antlr4::tree::TerminalNode *RightParen(); - CompoundStatementContext *compoundStatement(); - - - }; - - HandlerContext* handler(); - - class ExceptionDeclarationContext : public antlr4::ParserRuleContext { - public: - ExceptionDeclarationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - TypeSpecifierSeqContext *typeSpecifierSeq(); - AttributeSpecifierSeqContext *attributeSpecifierSeq(); - DeclaratorContext *declarator(); - AbstractDeclaratorContext *abstractDeclarator(); - antlr4::tree::TerminalNode *Ellipsis(); - - - }; - - ExceptionDeclarationContext* exceptionDeclaration(); - - class ThrowExpressionContext : public antlr4::ParserRuleContext { - public: - ThrowExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Throw(); - AssignmentExpressionContext *assignmentExpression(); - - - }; - - ThrowExpressionContext* throwExpression(); - - class ExceptionSpecificationContext : public antlr4::ParserRuleContext { - public: - ExceptionSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - DynamicExceptionSpecificationContext *dynamicExceptionSpecification(); - NoeExceptSpecificationContext *noeExceptSpecification(); - - - }; - - ExceptionSpecificationContext* exceptionSpecification(); - - class DynamicExceptionSpecificationContext : public antlr4::ParserRuleContext { - public: - DynamicExceptionSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Throw(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - TypeIdListContext *typeIdList(); - - - }; - - DynamicExceptionSpecificationContext* dynamicExceptionSpecification(); - - class TypeIdListContext : public antlr4::ParserRuleContext { - public: - TypeIdListContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - std::vector theTypeId(); - TheTypeIdContext* theTypeId(size_t i); - std::vector Ellipsis(); - antlr4::tree::TerminalNode* Ellipsis(size_t i); - std::vector Comma(); - antlr4::tree::TerminalNode* Comma(size_t i); - - - }; - - TypeIdListContext* typeIdList(); - - class NoeExceptSpecificationContext : public antlr4::ParserRuleContext { - public: - NoeExceptSpecificationContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *Noexcept(); - antlr4::tree::TerminalNode *LeftParen(); - ConstantExpressionContext *constantExpression(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - NoeExceptSpecificationContext* noeExceptSpecification(); - - class TheOperatorContext : public antlr4::ParserRuleContext { - public: - TheOperatorContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *New(); - antlr4::tree::TerminalNode *LeftBracket(); - antlr4::tree::TerminalNode *RightBracket(); - antlr4::tree::TerminalNode *Delete(); - antlr4::tree::TerminalNode *Plus(); - antlr4::tree::TerminalNode *Minus(); - antlr4::tree::TerminalNode *Star(); - antlr4::tree::TerminalNode *Div(); - antlr4::tree::TerminalNode *Mod(); - antlr4::tree::TerminalNode *Caret(); - antlr4::tree::TerminalNode *And(); - antlr4::tree::TerminalNode *Or(); - antlr4::tree::TerminalNode *Tilde(); - antlr4::tree::TerminalNode *Not(); - antlr4::tree::TerminalNode *Assign(); - std::vector Greater(); - antlr4::tree::TerminalNode* Greater(size_t i); - std::vector Less(); - antlr4::tree::TerminalNode* Less(size_t i); - antlr4::tree::TerminalNode *GreaterEqual(); - antlr4::tree::TerminalNode *PlusAssign(); - antlr4::tree::TerminalNode *MinusAssign(); - antlr4::tree::TerminalNode *StarAssign(); - antlr4::tree::TerminalNode *ModAssign(); - antlr4::tree::TerminalNode *XorAssign(); - antlr4::tree::TerminalNode *AndAssign(); - antlr4::tree::TerminalNode *OrAssign(); - antlr4::tree::TerminalNode *RightShiftAssign(); - antlr4::tree::TerminalNode *LeftShiftAssign(); - antlr4::tree::TerminalNode *Equal(); - antlr4::tree::TerminalNode *NotEqual(); - antlr4::tree::TerminalNode *LessEqual(); - antlr4::tree::TerminalNode *AndAnd(); - antlr4::tree::TerminalNode *OrOr(); - antlr4::tree::TerminalNode *PlusPlus(); - antlr4::tree::TerminalNode *MinusMinus(); - antlr4::tree::TerminalNode *Comma(); - antlr4::tree::TerminalNode *ArrowStar(); - antlr4::tree::TerminalNode *Arrow(); - antlr4::tree::TerminalNode *LeftParen(); - antlr4::tree::TerminalNode *RightParen(); - - - }; - - TheOperatorContext* theOperator(); - - class LiteralContext : public antlr4::ParserRuleContext { - public: - LiteralContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *IntegerLiteral(); - antlr4::tree::TerminalNode *CharacterLiteral(); - antlr4::tree::TerminalNode *FloatingLiteral(); - antlr4::tree::TerminalNode *StringLiteral(); - antlr4::tree::TerminalNode *BooleanLiteral(); - antlr4::tree::TerminalNode *PointerLiteral(); - antlr4::tree::TerminalNode *UserDefinedLiteral(); - - - }; - - LiteralContext* literal(); - - - bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override; - - bool nestedNameSpecifierSempred(NestedNameSpecifierContext *_localctx, size_t predicateIndex); - bool postfixExpressionSempred(PostfixExpressionContext *_localctx, size_t predicateIndex); - bool noPointerNewDeclaratorSempred(NoPointerNewDeclaratorContext *_localctx, size_t predicateIndex); - bool noPointerDeclaratorSempred(NoPointerDeclaratorContext *_localctx, size_t predicateIndex); - bool noPointerAbstractDeclaratorSempred(NoPointerAbstractDeclaratorContext *_localctx, size_t predicateIndex); - bool noPointerAbstractPackDeclaratorSempred(NoPointerAbstractPackDeclaratorContext *_localctx, size_t predicateIndex); - - // By default the static state used to implement the parser is lazily initialized during the first - // call to the constructor. You can call this function if you wish to initialize the static state - // ahead of time. - static void initialize(); - -private: -}; - -} // namespace antlrcpptest diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 561ba34..34132c6 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -9,7 +9,7 @@ #include "IAntlrWrapper.h" #include "antlr4-runtime.h" -class MyCppAntlr:IAntlrWrapper { +class MyCppAntlr:public IAntlrWrapper { private: std::unique_ptr lexer_ptr; std::unique_ptr parser_ptr; @@ -17,15 +17,10 @@ class MyCppAntlr:IAntlrWrapper { std::unique_ptr tokenStream_ptr; public: - MyCppAntlr(std::unique_ptr input, - std::unique_ptr tokenStream, - std::unique_ptr lexer, - std::unique_ptr parser); - - static std::unique_ptr init(std::ifstream &in); - - std::vector getTokens() override; - - // antlr4::tree::ParseTree *getTree(); + MyCppAntlr(std::ifstream &in); + ~MyCppAntlr() override = default; + std::vector getTokensArray() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; std::string getTreeString() override; }; diff --git a/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp b/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp deleted file mode 100644 index f2c8623..0000000 --- a/server/pkg/antlr/cpp14/src/CPP14Lexer.cpp +++ /dev/null @@ -1,718 +0,0 @@ - -// Generated from CPP14Lexer.g4 by ANTLR 4.12.0 - - -#include "CPP14Lexer.h" - - -using namespace antlr4; - -using namespace antlrcpptest; - - -using namespace antlr4; - -namespace { - -struct CPP14LexerStaticData final { - CPP14LexerStaticData(std::vector ruleNames, - std::vector channelNames, - std::vector modeNames, - std::vector literalNames, - std::vector symbolicNames) - : ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)), - modeNames(std::move(modeNames)), literalNames(std::move(literalNames)), - symbolicNames(std::move(symbolicNames)), - vocabulary(this->literalNames, this->symbolicNames) {} - - CPP14LexerStaticData(const CPP14LexerStaticData&) = delete; - CPP14LexerStaticData(CPP14LexerStaticData&&) = delete; - CPP14LexerStaticData& operator=(const CPP14LexerStaticData&) = delete; - CPP14LexerStaticData& operator=(CPP14LexerStaticData&&) = delete; - - std::vector decisionToDFA; - antlr4::atn::PredictionContextCache sharedContextCache; - const std::vector ruleNames; - const std::vector channelNames; - const std::vector modeNames; - const std::vector literalNames; - const std::vector symbolicNames; - const antlr4::dfa::Vocabulary vocabulary; - antlr4::atn::SerializedATNView serializedATN; - std::unique_ptr atn; -}; - -::antlr4::internal::OnceFlag cpp14lexerLexerOnceFlag; -CPP14LexerStaticData *cpp14lexerLexerStaticData = nullptr; - -void cpp14lexerLexerInitialize() { - assert(cpp14lexerLexerStaticData == nullptr); - auto staticData = std::make_unique( - std::vector{ - "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", - "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", - "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", - "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", - "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", - "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", - "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", - "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", - "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", - "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", - "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", - "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", - "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", - "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", - "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", - "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", - "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", - "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", - "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", - "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", - "Semi", "Dot", "DotStar", "Ellipsis", "Hexquad", "Universalcharactername", - "Identifier", "Identifiernondigit", "NONDIGIT", "DIGIT", "DecimalLiteral", - "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "NONZERODIGIT", - "OCTALDIGIT", "HEXADECIMALDIGIT", "BINARYDIGIT", "Integersuffix", - "Unsignedsuffix", "Longsuffix", "Longlongsuffix", "Cchar", "Escapesequence", - "Simpleescapesequence", "Octalescapesequence", "Hexadecimalescapesequence", - "Fractionalconstant", "Exponentpart", "SIGN", "Digitsequence", "Floatingsuffix", - "Encodingprefix", "Schar", "Rawstring", "UserDefinedIntegerLiteral", - "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", "UserDefinedCharacterLiteral", - "Udsuffix", "Whitespace", "Newline", "BlockComment", "LineComment" - }, - std::vector{ - "DEFAULT_TOKEN_CHANNEL", "HIDDEN" - }, - std::vector{ - "DEFAULT_MODE" - }, - std::vector{ - "", "", "", "", "", "", "", "", "", "", "'alignas'", "'alignof'", - "'asm'", "'auto'", "'bool'", "'break'", "'case'", "'catch'", "'char'", - "'char16_t'", "'char32_t'", "'class'", "'const'", "'constexpr'", "'const_cast'", - "'continue'", "'decltype'", "'default'", "'delete'", "'do'", "'double'", - "'dynamic_cast'", "'else'", "'enum'", "'explicit'", "'export'", "'extern'", - "'false'", "'final'", "'float'", "'for'", "'friend'", "'goto'", "'if'", - "'inline'", "'int'", "'long'", "'mutable'", "'namespace'", "'new'", - "'noexcept'", "'nullptr'", "'operator'", "'override'", "'private'", - "'protected'", "'public'", "'register'", "'reinterpret_cast'", "'return'", - "'short'", "'signed'", "'sizeof'", "'static'", "'static_assert'", - "'static_cast'", "'struct'", "'switch'", "'template'", "'this'", "'thread_local'", - "'throw'", "'true'", "'try'", "'typedef'", "'typeid'", "'typename'", - "'union'", "'unsigned'", "'using'", "'virtual'", "'void'", "'volatile'", - "'wchar_t'", "'while'", "'('", "')'", "'['", "']'", "'{'", "'}'", - "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'&'", "'|'", "'~'", "", - "'='", "'<'", "'>'", "'+='", "'-='", "'*='", "'/='", "'%='", "'^='", - "'&='", "'|='", "'<<='", "'>>='", "'=='", "'!='", "'<='", "'>='", - "", "", "'++'", "'--'", "','", "'->*'", "'->'", "'\\u003F'", "':'", - "'::'", "';'", "'.'", "'.*'", "'...'" - }, - std::vector{ - "", "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", - "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", - "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", - "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", - "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", - "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", - "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", - "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", - "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", - "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", - "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", - "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", - "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", - "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", - "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", - "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", - "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", - "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", - "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", - "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", - "Semi", "Dot", "DotStar", "Ellipsis", "Identifier", "DecimalLiteral", - "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "Integersuffix", - "UserDefinedIntegerLiteral", "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", - "UserDefinedCharacterLiteral", "Whitespace", "Newline", "BlockComment", - "LineComment" - } - ); - static const int32_t serializedATNSegment[] = { - 4,0,145,1460,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, - 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2, - 14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2, - 21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2, - 28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2, - 35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2, - 42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2, - 49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2, - 56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2, - 63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2, - 70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2, - 77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2, - 84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, - 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2, - 98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104, - 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110, - 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116, - 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122, - 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128, - 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134, - 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140, - 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146, - 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152, - 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,2,157,7,157,2,158, - 7,158,2,159,7,159,2,160,7,160,2,161,7,161,2,162,7,162,2,163,7,163,2,164, - 7,164,2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170, - 7,170,1,0,1,0,3,0,346,8,0,1,0,1,0,3,0,350,8,0,1,0,1,0,3,0,354,8,0,1,0, - 1,0,3,0,358,8,0,3,0,360,8,0,1,1,3,1,363,8,1,1,1,1,1,4,1,367,8,1,11,1, - 12,1,368,1,1,1,1,1,2,1,2,3,2,375,8,2,1,2,3,2,378,8,2,1,2,1,2,1,2,3,2, - 383,8,2,3,2,385,8,2,1,3,3,3,388,8,3,1,3,1,3,1,3,5,3,393,8,3,10,3,12,3, - 396,9,3,1,3,3,3,399,8,3,1,4,1,4,3,4,403,8,4,1,5,1,5,1,6,1,6,1,6,1,6,3, - 6,411,8,6,1,7,1,7,5,7,415,8,7,10,7,12,7,418,9,7,1,7,1,7,3,7,422,8,7,1, - 7,4,7,425,8,7,11,7,12,7,426,1,7,4,7,430,8,7,11,7,12,7,431,1,7,1,7,1,8, - 1,8,5,8,438,8,8,10,8,12,8,441,9,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9, - 1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,12, - 1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14, - 1,14,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17, - 1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19, - 1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,21, - 1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22, - 1,22,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,24,1,24, - 1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25, - 1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27, - 1,27,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30, - 1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31, - 1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33, - 1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35, - 1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37, - 1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40, - 1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,43,1,43, - 1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45, - 1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47, - 1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49, - 1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51, - 1,51,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, - 1,52,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54, - 1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,56,1,56, - 1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,1,57,1,57, - 1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,58,1,58,1,58,1,58, - 1,58,1,58,1,58,1,59,1,59,1,59,1,59,1,59,1,59,1,60,1,60,1,60,1,60,1,60, - 1,60,1,60,1,61,1,61,1,61,1,61,1,61,1,61,1,61,1,62,1,62,1,62,1,62,1,62, - 1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63, - 1,63,1,63,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64, - 1,65,1,65,1,65,1,65,1,65,1,65,1,65,1,66,1,66,1,66,1,66,1,66,1,66,1,66, - 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,68,1,68,1,68,1,68,1,68, - 1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,70, - 1,70,1,70,1,70,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,72,1,72,1,72,1,72, - 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,74,1,74,1,74,1,74,1,74,1,74, - 1,74,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,76,1,76,1,76,1,76, - 1,76,1,76,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,77,1,78,1,78,1,78, - 1,78,1,78,1,78,1,79,1,79,1,79,1,79,1,79,1,79,1,79,1,79,1,80,1,80,1,80, - 1,80,1,80,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,82,1,82,1,82, - 1,82,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,85, - 1,85,1,86,1,86,1,87,1,87,1,88,1,88,1,89,1,89,1,90,1,90,1,91,1,91,1,92, - 1,92,1,93,1,93,1,94,1,94,1,95,1,95,1,96,1,96,1,97,1,97,1,98,1,98,1,99, - 1,99,1,99,1,99,3,99,1029,8,99,1,100,1,100,1,101,1,101,1,102,1,102,1,103, - 1,103,1,103,1,104,1,104,1,104,1,105,1,105,1,105,1,106,1,106,1,106,1,107, - 1,107,1,107,1,108,1,108,1,108,1,109,1,109,1,109,1,110,1,110,1,110,1,111, - 1,111,1,111,1,111,1,112,1,112,1,112,1,112,1,113,1,113,1,113,1,114,1,114, - 1,114,1,115,1,115,1,115,1,116,1,116,1,116,1,117,1,117,1,117,1,117,1,117, - 3,117,1086,8,117,1,118,1,118,1,118,1,118,3,118,1092,8,118,1,119,1,119, - 1,119,1,120,1,120,1,120,1,121,1,121,1,122,1,122,1,122,1,122,1,123,1,123, - 1,123,1,124,1,124,1,125,1,125,1,126,1,126,1,126,1,127,1,127,1,128,1,128, - 1,129,1,129,1,129,1,130,1,130,1,130,1,130,1,131,1,131,1,131,1,131,1,131, - 1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,1,132,3,132,1142, - 8,132,1,133,1,133,1,133,5,133,1147,8,133,10,133,12,133,1150,9,133,1,134, - 1,134,3,134,1154,8,134,1,135,1,135,1,136,1,136,1,137,1,137,3,137,1162, - 8,137,1,137,5,137,1165,8,137,10,137,12,137,1168,9,137,1,138,1,138,3,138, - 1172,8,138,1,138,5,138,1175,8,138,10,138,12,138,1178,9,138,1,139,1,139, - 1,139,1,139,3,139,1184,8,139,1,139,1,139,3,139,1188,8,139,1,139,5,139, - 1191,8,139,10,139,12,139,1194,9,139,1,140,1,140,1,140,1,140,3,140,1200, - 8,140,1,140,1,140,3,140,1204,8,140,1,140,5,140,1207,8,140,10,140,12,140, - 1210,9,140,1,141,1,141,1,142,1,142,1,143,1,143,1,144,1,144,1,145,1,145, - 3,145,1222,8,145,1,145,1,145,3,145,1226,8,145,1,145,1,145,3,145,1230, - 8,145,1,145,1,145,3,145,1234,8,145,3,145,1236,8,145,1,146,1,146,1,147, - 1,147,1,148,1,148,1,148,1,148,3,148,1246,8,148,1,149,1,149,1,149,3,149, - 1251,8,149,1,150,1,150,1,150,3,150,1256,8,150,1,151,1,151,1,151,1,151, - 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, - 1,151,1,151,1,151,1,151,1,151,3,151,1279,8,151,1,151,3,151,1282,8,151, - 1,151,1,151,1,151,1,151,3,151,1288,8,151,1,152,1,152,1,152,1,152,1,152, - 1,152,1,152,1,152,1,152,1,152,1,152,3,152,1301,8,152,1,153,1,153,1,153, - 1,153,4,153,1307,8,153,11,153,12,153,1308,1,154,3,154,1312,8,154,1,154, - 1,154,1,154,1,154,1,154,3,154,1319,8,154,1,155,1,155,3,155,1323,8,155, - 1,155,1,155,1,155,3,155,1328,8,155,1,155,3,155,1331,8,155,1,156,1,156, - 1,157,1,157,3,157,1337,8,157,1,157,5,157,1340,8,157,10,157,12,157,1343, - 9,157,1,158,1,158,1,159,1,159,1,159,3,159,1350,8,159,1,160,1,160,1,160, - 3,160,1355,8,160,1,161,1,161,1,161,1,161,1,161,1,161,5,161,1363,8,161, - 10,161,12,161,1366,9,161,1,161,1,161,5,161,1370,8,161,10,161,12,161,1373, - 9,161,1,161,1,161,1,161,1,161,5,161,1379,8,161,10,161,12,161,1382,9,161, - 1,161,1,161,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162,1,162, - 1,162,1,162,3,162,1398,8,162,1,163,1,163,3,163,1402,8,163,1,163,1,163, - 1,163,1,163,1,163,1,163,3,163,1410,8,163,1,164,1,164,1,164,1,165,1,165, - 1,165,1,166,1,166,1,167,4,167,1421,8,167,11,167,12,167,1422,1,167,1,167, - 1,168,1,168,3,168,1429,8,168,1,168,3,168,1432,8,168,1,168,1,168,1,169, - 1,169,1,169,1,169,5,169,1440,8,169,10,169,12,169,1443,9,169,1,169,1,169, - 1,169,1,169,1,169,1,170,1,170,1,170,1,170,5,170,1454,8,170,10,170,12, - 170,1457,9,170,1,170,1,170,5,416,1364,1371,1380,1441,0,171,1,1,3,2,5, - 3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31, - 16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27, - 55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77, - 39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50, - 101,51,103,52,105,53,107,54,109,55,111,56,113,57,115,58,117,59,119,60, - 121,61,123,62,125,63,127,64,129,65,131,66,133,67,135,68,137,69,139,70, - 141,71,143,72,145,73,147,74,149,75,151,76,153,77,155,78,157,79,159,80, - 161,81,163,82,165,83,167,84,169,85,171,86,173,87,175,88,177,89,179,90, - 181,91,183,92,185,93,187,94,189,95,191,96,193,97,195,98,197,99,199,100, - 201,101,203,102,205,103,207,104,209,105,211,106,213,107,215,108,217,109, - 219,110,221,111,223,112,225,113,227,114,229,115,231,116,233,117,235,118, - 237,119,239,120,241,121,243,122,245,123,247,124,249,125,251,126,253,127, - 255,128,257,129,259,130,261,131,263,0,265,0,267,132,269,0,271,0,273,0, - 275,133,277,134,279,135,281,136,283,0,285,0,287,0,289,0,291,137,293,0, - 295,0,297,0,299,0,301,0,303,0,305,0,307,0,309,0,311,0,313,0,315,0,317, - 0,319,0,321,0,323,0,325,138,327,139,329,140,331,141,333,0,335,142,337, - 143,339,144,341,145,1,0,20,3,0,76,76,85,85,117,117,1,0,10,10,3,0,65,90, - 95,95,97,122,1,0,48,57,1,0,49,57,1,0,48,55,3,0,48,57,65,70,97,102,1,0, - 48,49,2,0,85,85,117,117,2,0,76,76,108,108,4,0,10,10,13,13,39,39,92,92, - 2,0,43,43,45,45,4,0,70,70,76,76,102,102,108,108,4,0,10,10,13,13,34,34, - 92,92,2,0,34,34,40,41,4,0,10,10,13,13,32,32,40,40,1,0,41,41,4,0,10,10, - 13,13,32,32,34,34,2,0,9,9,32,32,2,0,10,10,13,13,1528,0,1,1,0,0,0,0,3, - 1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0, - 0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25, - 1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0, - 0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0, - 0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57, - 1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0, - 0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0, - 0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89, - 1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0, - 0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0, - 0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,0,119,1,0, - 0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0, - 0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0, - 0,0,0,141,1,0,0,0,0,143,1,0,0,0,0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0, - 0,0,0,151,1,0,0,0,0,153,1,0,0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0, - 0,0,0,161,1,0,0,0,0,163,1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0, - 0,0,0,171,1,0,0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0, - 0,0,0,181,1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0,0,189,1,0, - 0,0,0,191,1,0,0,0,0,193,1,0,0,0,0,195,1,0,0,0,0,197,1,0,0,0,0,199,1,0, - 0,0,0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0,0,0,0,209,1,0, - 0,0,0,211,1,0,0,0,0,213,1,0,0,0,0,215,1,0,0,0,0,217,1,0,0,0,0,219,1,0, - 0,0,0,221,1,0,0,0,0,223,1,0,0,0,0,225,1,0,0,0,0,227,1,0,0,0,0,229,1,0, - 0,0,0,231,1,0,0,0,0,233,1,0,0,0,0,235,1,0,0,0,0,237,1,0,0,0,0,239,1,0, - 0,0,0,241,1,0,0,0,0,243,1,0,0,0,0,245,1,0,0,0,0,247,1,0,0,0,0,249,1,0, - 0,0,0,251,1,0,0,0,0,253,1,0,0,0,0,255,1,0,0,0,0,257,1,0,0,0,0,259,1,0, - 0,0,0,261,1,0,0,0,0,267,1,0,0,0,0,275,1,0,0,0,0,277,1,0,0,0,0,279,1,0, - 0,0,0,281,1,0,0,0,0,291,1,0,0,0,0,325,1,0,0,0,0,327,1,0,0,0,0,329,1,0, - 0,0,0,331,1,0,0,0,0,335,1,0,0,0,0,337,1,0,0,0,0,339,1,0,0,0,0,341,1,0, - 0,0,1,359,1,0,0,0,3,362,1,0,0,0,5,384,1,0,0,0,7,387,1,0,0,0,9,402,1,0, - 0,0,11,404,1,0,0,0,13,410,1,0,0,0,15,412,1,0,0,0,17,435,1,0,0,0,19,444, - 1,0,0,0,21,452,1,0,0,0,23,460,1,0,0,0,25,464,1,0,0,0,27,469,1,0,0,0,29, - 474,1,0,0,0,31,480,1,0,0,0,33,485,1,0,0,0,35,491,1,0,0,0,37,496,1,0,0, - 0,39,505,1,0,0,0,41,514,1,0,0,0,43,520,1,0,0,0,45,526,1,0,0,0,47,536, - 1,0,0,0,49,547,1,0,0,0,51,556,1,0,0,0,53,565,1,0,0,0,55,573,1,0,0,0,57, - 580,1,0,0,0,59,583,1,0,0,0,61,590,1,0,0,0,63,603,1,0,0,0,65,608,1,0,0, - 0,67,613,1,0,0,0,69,622,1,0,0,0,71,629,1,0,0,0,73,636,1,0,0,0,75,642, - 1,0,0,0,77,648,1,0,0,0,79,654,1,0,0,0,81,658,1,0,0,0,83,665,1,0,0,0,85, - 670,1,0,0,0,87,673,1,0,0,0,89,680,1,0,0,0,91,684,1,0,0,0,93,689,1,0,0, - 0,95,697,1,0,0,0,97,707,1,0,0,0,99,711,1,0,0,0,101,720,1,0,0,0,103,728, - 1,0,0,0,105,737,1,0,0,0,107,746,1,0,0,0,109,754,1,0,0,0,111,764,1,0,0, - 0,113,771,1,0,0,0,115,780,1,0,0,0,117,797,1,0,0,0,119,804,1,0,0,0,121, - 810,1,0,0,0,123,817,1,0,0,0,125,824,1,0,0,0,127,831,1,0,0,0,129,845,1, - 0,0,0,131,857,1,0,0,0,133,864,1,0,0,0,135,871,1,0,0,0,137,880,1,0,0,0, - 139,885,1,0,0,0,141,898,1,0,0,0,143,904,1,0,0,0,145,909,1,0,0,0,147,913, - 1,0,0,0,149,921,1,0,0,0,151,928,1,0,0,0,153,937,1,0,0,0,155,943,1,0,0, - 0,157,952,1,0,0,0,159,958,1,0,0,0,161,966,1,0,0,0,163,971,1,0,0,0,165, - 980,1,0,0,0,167,988,1,0,0,0,169,994,1,0,0,0,171,996,1,0,0,0,173,998,1, - 0,0,0,175,1000,1,0,0,0,177,1002,1,0,0,0,179,1004,1,0,0,0,181,1006,1,0, - 0,0,183,1008,1,0,0,0,185,1010,1,0,0,0,187,1012,1,0,0,0,189,1014,1,0,0, - 0,191,1016,1,0,0,0,193,1018,1,0,0,0,195,1020,1,0,0,0,197,1022,1,0,0,0, - 199,1028,1,0,0,0,201,1030,1,0,0,0,203,1032,1,0,0,0,205,1034,1,0,0,0,207, - 1036,1,0,0,0,209,1039,1,0,0,0,211,1042,1,0,0,0,213,1045,1,0,0,0,215,1048, - 1,0,0,0,217,1051,1,0,0,0,219,1054,1,0,0,0,221,1057,1,0,0,0,223,1060,1, - 0,0,0,225,1064,1,0,0,0,227,1068,1,0,0,0,229,1071,1,0,0,0,231,1074,1,0, - 0,0,233,1077,1,0,0,0,235,1085,1,0,0,0,237,1091,1,0,0,0,239,1093,1,0,0, - 0,241,1096,1,0,0,0,243,1099,1,0,0,0,245,1101,1,0,0,0,247,1105,1,0,0,0, - 249,1108,1,0,0,0,251,1110,1,0,0,0,253,1112,1,0,0,0,255,1115,1,0,0,0,257, - 1117,1,0,0,0,259,1119,1,0,0,0,261,1122,1,0,0,0,263,1126,1,0,0,0,265,1141, - 1,0,0,0,267,1143,1,0,0,0,269,1153,1,0,0,0,271,1155,1,0,0,0,273,1157,1, - 0,0,0,275,1159,1,0,0,0,277,1169,1,0,0,0,279,1183,1,0,0,0,281,1199,1,0, - 0,0,283,1211,1,0,0,0,285,1213,1,0,0,0,287,1215,1,0,0,0,289,1217,1,0,0, - 0,291,1235,1,0,0,0,293,1237,1,0,0,0,295,1239,1,0,0,0,297,1245,1,0,0,0, - 299,1250,1,0,0,0,301,1255,1,0,0,0,303,1287,1,0,0,0,305,1300,1,0,0,0,307, - 1302,1,0,0,0,309,1318,1,0,0,0,311,1330,1,0,0,0,313,1332,1,0,0,0,315,1334, - 1,0,0,0,317,1344,1,0,0,0,319,1349,1,0,0,0,321,1354,1,0,0,0,323,1356,1, - 0,0,0,325,1397,1,0,0,0,327,1409,1,0,0,0,329,1411,1,0,0,0,331,1414,1,0, - 0,0,333,1417,1,0,0,0,335,1420,1,0,0,0,337,1431,1,0,0,0,339,1435,1,0,0, - 0,341,1449,1,0,0,0,343,345,3,275,137,0,344,346,3,291,145,0,345,344,1, - 0,0,0,345,346,1,0,0,0,346,360,1,0,0,0,347,349,3,277,138,0,348,350,3,291, - 145,0,349,348,1,0,0,0,349,350,1,0,0,0,350,360,1,0,0,0,351,353,3,279,139, - 0,352,354,3,291,145,0,353,352,1,0,0,0,353,354,1,0,0,0,354,360,1,0,0,0, - 355,357,3,281,140,0,356,358,3,291,145,0,357,356,1,0,0,0,357,358,1,0,0, - 0,358,360,1,0,0,0,359,343,1,0,0,0,359,347,1,0,0,0,359,351,1,0,0,0,359, - 355,1,0,0,0,360,2,1,0,0,0,361,363,7,0,0,0,362,361,1,0,0,0,362,363,1,0, - 0,0,363,364,1,0,0,0,364,366,5,39,0,0,365,367,3,299,149,0,366,365,1,0, - 0,0,367,368,1,0,0,0,368,366,1,0,0,0,368,369,1,0,0,0,369,370,1,0,0,0,370, - 371,5,39,0,0,371,4,1,0,0,0,372,374,3,309,154,0,373,375,3,311,155,0,374, - 373,1,0,0,0,374,375,1,0,0,0,375,377,1,0,0,0,376,378,3,317,158,0,377,376, - 1,0,0,0,377,378,1,0,0,0,378,385,1,0,0,0,379,380,3,315,157,0,380,382,3, - 311,155,0,381,383,3,317,158,0,382,381,1,0,0,0,382,383,1,0,0,0,383,385, - 1,0,0,0,384,372,1,0,0,0,384,379,1,0,0,0,385,6,1,0,0,0,386,388,3,319,159, - 0,387,386,1,0,0,0,387,388,1,0,0,0,388,398,1,0,0,0,389,399,3,323,161,0, - 390,394,5,34,0,0,391,393,3,321,160,0,392,391,1,0,0,0,393,396,1,0,0,0, - 394,392,1,0,0,0,394,395,1,0,0,0,395,397,1,0,0,0,396,394,1,0,0,0,397,399, - 5,34,0,0,398,389,1,0,0,0,398,390,1,0,0,0,399,8,1,0,0,0,400,403,3,73,36, - 0,401,403,3,143,71,0,402,400,1,0,0,0,402,401,1,0,0,0,403,10,1,0,0,0,404, - 405,3,101,50,0,405,12,1,0,0,0,406,411,3,325,162,0,407,411,3,327,163,0, - 408,411,3,329,164,0,409,411,3,331,165,0,410,406,1,0,0,0,410,407,1,0,0, - 0,410,408,1,0,0,0,410,409,1,0,0,0,411,14,1,0,0,0,412,424,5,35,0,0,413, - 415,8,1,0,0,414,413,1,0,0,0,415,418,1,0,0,0,416,417,1,0,0,0,416,414,1, - 0,0,0,417,419,1,0,0,0,418,416,1,0,0,0,419,421,5,92,0,0,420,422,5,13,0, - 0,421,420,1,0,0,0,421,422,1,0,0,0,422,423,1,0,0,0,423,425,5,10,0,0,424, - 416,1,0,0,0,425,426,1,0,0,0,426,424,1,0,0,0,426,427,1,0,0,0,427,429,1, - 0,0,0,428,430,8,1,0,0,429,428,1,0,0,0,430,431,1,0,0,0,431,429,1,0,0,0, - 431,432,1,0,0,0,432,433,1,0,0,0,433,434,6,7,0,0,434,16,1,0,0,0,435,439, - 5,35,0,0,436,438,8,1,0,0,437,436,1,0,0,0,438,441,1,0,0,0,439,437,1,0, - 0,0,439,440,1,0,0,0,440,442,1,0,0,0,441,439,1,0,0,0,442,443,6,8,0,0,443, - 18,1,0,0,0,444,445,5,97,0,0,445,446,5,108,0,0,446,447,5,105,0,0,447,448, - 5,103,0,0,448,449,5,110,0,0,449,450,5,97,0,0,450,451,5,115,0,0,451,20, - 1,0,0,0,452,453,5,97,0,0,453,454,5,108,0,0,454,455,5,105,0,0,455,456, - 5,103,0,0,456,457,5,110,0,0,457,458,5,111,0,0,458,459,5,102,0,0,459,22, - 1,0,0,0,460,461,5,97,0,0,461,462,5,115,0,0,462,463,5,109,0,0,463,24,1, - 0,0,0,464,465,5,97,0,0,465,466,5,117,0,0,466,467,5,116,0,0,467,468,5, - 111,0,0,468,26,1,0,0,0,469,470,5,98,0,0,470,471,5,111,0,0,471,472,5,111, - 0,0,472,473,5,108,0,0,473,28,1,0,0,0,474,475,5,98,0,0,475,476,5,114,0, - 0,476,477,5,101,0,0,477,478,5,97,0,0,478,479,5,107,0,0,479,30,1,0,0,0, - 480,481,5,99,0,0,481,482,5,97,0,0,482,483,5,115,0,0,483,484,5,101,0,0, - 484,32,1,0,0,0,485,486,5,99,0,0,486,487,5,97,0,0,487,488,5,116,0,0,488, - 489,5,99,0,0,489,490,5,104,0,0,490,34,1,0,0,0,491,492,5,99,0,0,492,493, - 5,104,0,0,493,494,5,97,0,0,494,495,5,114,0,0,495,36,1,0,0,0,496,497,5, - 99,0,0,497,498,5,104,0,0,498,499,5,97,0,0,499,500,5,114,0,0,500,501,5, - 49,0,0,501,502,5,54,0,0,502,503,5,95,0,0,503,504,5,116,0,0,504,38,1,0, - 0,0,505,506,5,99,0,0,506,507,5,104,0,0,507,508,5,97,0,0,508,509,5,114, - 0,0,509,510,5,51,0,0,510,511,5,50,0,0,511,512,5,95,0,0,512,513,5,116, - 0,0,513,40,1,0,0,0,514,515,5,99,0,0,515,516,5,108,0,0,516,517,5,97,0, - 0,517,518,5,115,0,0,518,519,5,115,0,0,519,42,1,0,0,0,520,521,5,99,0,0, - 521,522,5,111,0,0,522,523,5,110,0,0,523,524,5,115,0,0,524,525,5,116,0, - 0,525,44,1,0,0,0,526,527,5,99,0,0,527,528,5,111,0,0,528,529,5,110,0,0, - 529,530,5,115,0,0,530,531,5,116,0,0,531,532,5,101,0,0,532,533,5,120,0, - 0,533,534,5,112,0,0,534,535,5,114,0,0,535,46,1,0,0,0,536,537,5,99,0,0, - 537,538,5,111,0,0,538,539,5,110,0,0,539,540,5,115,0,0,540,541,5,116,0, - 0,541,542,5,95,0,0,542,543,5,99,0,0,543,544,5,97,0,0,544,545,5,115,0, - 0,545,546,5,116,0,0,546,48,1,0,0,0,547,548,5,99,0,0,548,549,5,111,0,0, - 549,550,5,110,0,0,550,551,5,116,0,0,551,552,5,105,0,0,552,553,5,110,0, - 0,553,554,5,117,0,0,554,555,5,101,0,0,555,50,1,0,0,0,556,557,5,100,0, - 0,557,558,5,101,0,0,558,559,5,99,0,0,559,560,5,108,0,0,560,561,5,116, - 0,0,561,562,5,121,0,0,562,563,5,112,0,0,563,564,5,101,0,0,564,52,1,0, - 0,0,565,566,5,100,0,0,566,567,5,101,0,0,567,568,5,102,0,0,568,569,5,97, - 0,0,569,570,5,117,0,0,570,571,5,108,0,0,571,572,5,116,0,0,572,54,1,0, - 0,0,573,574,5,100,0,0,574,575,5,101,0,0,575,576,5,108,0,0,576,577,5,101, - 0,0,577,578,5,116,0,0,578,579,5,101,0,0,579,56,1,0,0,0,580,581,5,100, - 0,0,581,582,5,111,0,0,582,58,1,0,0,0,583,584,5,100,0,0,584,585,5,111, - 0,0,585,586,5,117,0,0,586,587,5,98,0,0,587,588,5,108,0,0,588,589,5,101, - 0,0,589,60,1,0,0,0,590,591,5,100,0,0,591,592,5,121,0,0,592,593,5,110, - 0,0,593,594,5,97,0,0,594,595,5,109,0,0,595,596,5,105,0,0,596,597,5,99, - 0,0,597,598,5,95,0,0,598,599,5,99,0,0,599,600,5,97,0,0,600,601,5,115, - 0,0,601,602,5,116,0,0,602,62,1,0,0,0,603,604,5,101,0,0,604,605,5,108, - 0,0,605,606,5,115,0,0,606,607,5,101,0,0,607,64,1,0,0,0,608,609,5,101, - 0,0,609,610,5,110,0,0,610,611,5,117,0,0,611,612,5,109,0,0,612,66,1,0, - 0,0,613,614,5,101,0,0,614,615,5,120,0,0,615,616,5,112,0,0,616,617,5,108, - 0,0,617,618,5,105,0,0,618,619,5,99,0,0,619,620,5,105,0,0,620,621,5,116, - 0,0,621,68,1,0,0,0,622,623,5,101,0,0,623,624,5,120,0,0,624,625,5,112, - 0,0,625,626,5,111,0,0,626,627,5,114,0,0,627,628,5,116,0,0,628,70,1,0, - 0,0,629,630,5,101,0,0,630,631,5,120,0,0,631,632,5,116,0,0,632,633,5,101, - 0,0,633,634,5,114,0,0,634,635,5,110,0,0,635,72,1,0,0,0,636,637,5,102, - 0,0,637,638,5,97,0,0,638,639,5,108,0,0,639,640,5,115,0,0,640,641,5,101, - 0,0,641,74,1,0,0,0,642,643,5,102,0,0,643,644,5,105,0,0,644,645,5,110, - 0,0,645,646,5,97,0,0,646,647,5,108,0,0,647,76,1,0,0,0,648,649,5,102,0, - 0,649,650,5,108,0,0,650,651,5,111,0,0,651,652,5,97,0,0,652,653,5,116, - 0,0,653,78,1,0,0,0,654,655,5,102,0,0,655,656,5,111,0,0,656,657,5,114, - 0,0,657,80,1,0,0,0,658,659,5,102,0,0,659,660,5,114,0,0,660,661,5,105, - 0,0,661,662,5,101,0,0,662,663,5,110,0,0,663,664,5,100,0,0,664,82,1,0, - 0,0,665,666,5,103,0,0,666,667,5,111,0,0,667,668,5,116,0,0,668,669,5,111, - 0,0,669,84,1,0,0,0,670,671,5,105,0,0,671,672,5,102,0,0,672,86,1,0,0,0, - 673,674,5,105,0,0,674,675,5,110,0,0,675,676,5,108,0,0,676,677,5,105,0, - 0,677,678,5,110,0,0,678,679,5,101,0,0,679,88,1,0,0,0,680,681,5,105,0, - 0,681,682,5,110,0,0,682,683,5,116,0,0,683,90,1,0,0,0,684,685,5,108,0, - 0,685,686,5,111,0,0,686,687,5,110,0,0,687,688,5,103,0,0,688,92,1,0,0, - 0,689,690,5,109,0,0,690,691,5,117,0,0,691,692,5,116,0,0,692,693,5,97, - 0,0,693,694,5,98,0,0,694,695,5,108,0,0,695,696,5,101,0,0,696,94,1,0,0, - 0,697,698,5,110,0,0,698,699,5,97,0,0,699,700,5,109,0,0,700,701,5,101, - 0,0,701,702,5,115,0,0,702,703,5,112,0,0,703,704,5,97,0,0,704,705,5,99, - 0,0,705,706,5,101,0,0,706,96,1,0,0,0,707,708,5,110,0,0,708,709,5,101, - 0,0,709,710,5,119,0,0,710,98,1,0,0,0,711,712,5,110,0,0,712,713,5,111, - 0,0,713,714,5,101,0,0,714,715,5,120,0,0,715,716,5,99,0,0,716,717,5,101, - 0,0,717,718,5,112,0,0,718,719,5,116,0,0,719,100,1,0,0,0,720,721,5,110, - 0,0,721,722,5,117,0,0,722,723,5,108,0,0,723,724,5,108,0,0,724,725,5,112, - 0,0,725,726,5,116,0,0,726,727,5,114,0,0,727,102,1,0,0,0,728,729,5,111, - 0,0,729,730,5,112,0,0,730,731,5,101,0,0,731,732,5,114,0,0,732,733,5,97, - 0,0,733,734,5,116,0,0,734,735,5,111,0,0,735,736,5,114,0,0,736,104,1,0, - 0,0,737,738,5,111,0,0,738,739,5,118,0,0,739,740,5,101,0,0,740,741,5,114, - 0,0,741,742,5,114,0,0,742,743,5,105,0,0,743,744,5,100,0,0,744,745,5,101, - 0,0,745,106,1,0,0,0,746,747,5,112,0,0,747,748,5,114,0,0,748,749,5,105, - 0,0,749,750,5,118,0,0,750,751,5,97,0,0,751,752,5,116,0,0,752,753,5,101, - 0,0,753,108,1,0,0,0,754,755,5,112,0,0,755,756,5,114,0,0,756,757,5,111, - 0,0,757,758,5,116,0,0,758,759,5,101,0,0,759,760,5,99,0,0,760,761,5,116, - 0,0,761,762,5,101,0,0,762,763,5,100,0,0,763,110,1,0,0,0,764,765,5,112, - 0,0,765,766,5,117,0,0,766,767,5,98,0,0,767,768,5,108,0,0,768,769,5,105, - 0,0,769,770,5,99,0,0,770,112,1,0,0,0,771,772,5,114,0,0,772,773,5,101, - 0,0,773,774,5,103,0,0,774,775,5,105,0,0,775,776,5,115,0,0,776,777,5,116, - 0,0,777,778,5,101,0,0,778,779,5,114,0,0,779,114,1,0,0,0,780,781,5,114, - 0,0,781,782,5,101,0,0,782,783,5,105,0,0,783,784,5,110,0,0,784,785,5,116, - 0,0,785,786,5,101,0,0,786,787,5,114,0,0,787,788,5,112,0,0,788,789,5,114, - 0,0,789,790,5,101,0,0,790,791,5,116,0,0,791,792,5,95,0,0,792,793,5,99, - 0,0,793,794,5,97,0,0,794,795,5,115,0,0,795,796,5,116,0,0,796,116,1,0, - 0,0,797,798,5,114,0,0,798,799,5,101,0,0,799,800,5,116,0,0,800,801,5,117, - 0,0,801,802,5,114,0,0,802,803,5,110,0,0,803,118,1,0,0,0,804,805,5,115, - 0,0,805,806,5,104,0,0,806,807,5,111,0,0,807,808,5,114,0,0,808,809,5,116, - 0,0,809,120,1,0,0,0,810,811,5,115,0,0,811,812,5,105,0,0,812,813,5,103, - 0,0,813,814,5,110,0,0,814,815,5,101,0,0,815,816,5,100,0,0,816,122,1,0, - 0,0,817,818,5,115,0,0,818,819,5,105,0,0,819,820,5,122,0,0,820,821,5,101, - 0,0,821,822,5,111,0,0,822,823,5,102,0,0,823,124,1,0,0,0,824,825,5,115, - 0,0,825,826,5,116,0,0,826,827,5,97,0,0,827,828,5,116,0,0,828,829,5,105, - 0,0,829,830,5,99,0,0,830,126,1,0,0,0,831,832,5,115,0,0,832,833,5,116, - 0,0,833,834,5,97,0,0,834,835,5,116,0,0,835,836,5,105,0,0,836,837,5,99, - 0,0,837,838,5,95,0,0,838,839,5,97,0,0,839,840,5,115,0,0,840,841,5,115, - 0,0,841,842,5,101,0,0,842,843,5,114,0,0,843,844,5,116,0,0,844,128,1,0, - 0,0,845,846,5,115,0,0,846,847,5,116,0,0,847,848,5,97,0,0,848,849,5,116, - 0,0,849,850,5,105,0,0,850,851,5,99,0,0,851,852,5,95,0,0,852,853,5,99, - 0,0,853,854,5,97,0,0,854,855,5,115,0,0,855,856,5,116,0,0,856,130,1,0, - 0,0,857,858,5,115,0,0,858,859,5,116,0,0,859,860,5,114,0,0,860,861,5,117, - 0,0,861,862,5,99,0,0,862,863,5,116,0,0,863,132,1,0,0,0,864,865,5,115, - 0,0,865,866,5,119,0,0,866,867,5,105,0,0,867,868,5,116,0,0,868,869,5,99, - 0,0,869,870,5,104,0,0,870,134,1,0,0,0,871,872,5,116,0,0,872,873,5,101, - 0,0,873,874,5,109,0,0,874,875,5,112,0,0,875,876,5,108,0,0,876,877,5,97, - 0,0,877,878,5,116,0,0,878,879,5,101,0,0,879,136,1,0,0,0,880,881,5,116, - 0,0,881,882,5,104,0,0,882,883,5,105,0,0,883,884,5,115,0,0,884,138,1,0, - 0,0,885,886,5,116,0,0,886,887,5,104,0,0,887,888,5,114,0,0,888,889,5,101, - 0,0,889,890,5,97,0,0,890,891,5,100,0,0,891,892,5,95,0,0,892,893,5,108, - 0,0,893,894,5,111,0,0,894,895,5,99,0,0,895,896,5,97,0,0,896,897,5,108, - 0,0,897,140,1,0,0,0,898,899,5,116,0,0,899,900,5,104,0,0,900,901,5,114, - 0,0,901,902,5,111,0,0,902,903,5,119,0,0,903,142,1,0,0,0,904,905,5,116, - 0,0,905,906,5,114,0,0,906,907,5,117,0,0,907,908,5,101,0,0,908,144,1,0, - 0,0,909,910,5,116,0,0,910,911,5,114,0,0,911,912,5,121,0,0,912,146,1,0, - 0,0,913,914,5,116,0,0,914,915,5,121,0,0,915,916,5,112,0,0,916,917,5,101, - 0,0,917,918,5,100,0,0,918,919,5,101,0,0,919,920,5,102,0,0,920,148,1,0, - 0,0,921,922,5,116,0,0,922,923,5,121,0,0,923,924,5,112,0,0,924,925,5,101, - 0,0,925,926,5,105,0,0,926,927,5,100,0,0,927,150,1,0,0,0,928,929,5,116, - 0,0,929,930,5,121,0,0,930,931,5,112,0,0,931,932,5,101,0,0,932,933,5,110, - 0,0,933,934,5,97,0,0,934,935,5,109,0,0,935,936,5,101,0,0,936,152,1,0, - 0,0,937,938,5,117,0,0,938,939,5,110,0,0,939,940,5,105,0,0,940,941,5,111, - 0,0,941,942,5,110,0,0,942,154,1,0,0,0,943,944,5,117,0,0,944,945,5,110, - 0,0,945,946,5,115,0,0,946,947,5,105,0,0,947,948,5,103,0,0,948,949,5,110, - 0,0,949,950,5,101,0,0,950,951,5,100,0,0,951,156,1,0,0,0,952,953,5,117, - 0,0,953,954,5,115,0,0,954,955,5,105,0,0,955,956,5,110,0,0,956,957,5,103, - 0,0,957,158,1,0,0,0,958,959,5,118,0,0,959,960,5,105,0,0,960,961,5,114, - 0,0,961,962,5,116,0,0,962,963,5,117,0,0,963,964,5,97,0,0,964,965,5,108, - 0,0,965,160,1,0,0,0,966,967,5,118,0,0,967,968,5,111,0,0,968,969,5,105, - 0,0,969,970,5,100,0,0,970,162,1,0,0,0,971,972,5,118,0,0,972,973,5,111, - 0,0,973,974,5,108,0,0,974,975,5,97,0,0,975,976,5,116,0,0,976,977,5,105, - 0,0,977,978,5,108,0,0,978,979,5,101,0,0,979,164,1,0,0,0,980,981,5,119, - 0,0,981,982,5,99,0,0,982,983,5,104,0,0,983,984,5,97,0,0,984,985,5,114, - 0,0,985,986,5,95,0,0,986,987,5,116,0,0,987,166,1,0,0,0,988,989,5,119, - 0,0,989,990,5,104,0,0,990,991,5,105,0,0,991,992,5,108,0,0,992,993,5,101, - 0,0,993,168,1,0,0,0,994,995,5,40,0,0,995,170,1,0,0,0,996,997,5,41,0,0, - 997,172,1,0,0,0,998,999,5,91,0,0,999,174,1,0,0,0,1000,1001,5,93,0,0,1001, - 176,1,0,0,0,1002,1003,5,123,0,0,1003,178,1,0,0,0,1004,1005,5,125,0,0, - 1005,180,1,0,0,0,1006,1007,5,43,0,0,1007,182,1,0,0,0,1008,1009,5,45,0, - 0,1009,184,1,0,0,0,1010,1011,5,42,0,0,1011,186,1,0,0,0,1012,1013,5,47, - 0,0,1013,188,1,0,0,0,1014,1015,5,37,0,0,1015,190,1,0,0,0,1016,1017,5, - 94,0,0,1017,192,1,0,0,0,1018,1019,5,38,0,0,1019,194,1,0,0,0,1020,1021, - 5,124,0,0,1021,196,1,0,0,0,1022,1023,5,126,0,0,1023,198,1,0,0,0,1024, - 1029,5,33,0,0,1025,1026,5,110,0,0,1026,1027,5,111,0,0,1027,1029,5,116, - 0,0,1028,1024,1,0,0,0,1028,1025,1,0,0,0,1029,200,1,0,0,0,1030,1031,5, - 61,0,0,1031,202,1,0,0,0,1032,1033,5,60,0,0,1033,204,1,0,0,0,1034,1035, - 5,62,0,0,1035,206,1,0,0,0,1036,1037,5,43,0,0,1037,1038,5,61,0,0,1038, - 208,1,0,0,0,1039,1040,5,45,0,0,1040,1041,5,61,0,0,1041,210,1,0,0,0,1042, - 1043,5,42,0,0,1043,1044,5,61,0,0,1044,212,1,0,0,0,1045,1046,5,47,0,0, - 1046,1047,5,61,0,0,1047,214,1,0,0,0,1048,1049,5,37,0,0,1049,1050,5,61, - 0,0,1050,216,1,0,0,0,1051,1052,5,94,0,0,1052,1053,5,61,0,0,1053,218,1, - 0,0,0,1054,1055,5,38,0,0,1055,1056,5,61,0,0,1056,220,1,0,0,0,1057,1058, - 5,124,0,0,1058,1059,5,61,0,0,1059,222,1,0,0,0,1060,1061,5,60,0,0,1061, - 1062,5,60,0,0,1062,1063,5,61,0,0,1063,224,1,0,0,0,1064,1065,5,62,0,0, - 1065,1066,5,62,0,0,1066,1067,5,61,0,0,1067,226,1,0,0,0,1068,1069,5,61, - 0,0,1069,1070,5,61,0,0,1070,228,1,0,0,0,1071,1072,5,33,0,0,1072,1073, - 5,61,0,0,1073,230,1,0,0,0,1074,1075,5,60,0,0,1075,1076,5,61,0,0,1076, - 232,1,0,0,0,1077,1078,5,62,0,0,1078,1079,5,61,0,0,1079,234,1,0,0,0,1080, - 1081,5,38,0,0,1081,1086,5,38,0,0,1082,1083,5,97,0,0,1083,1084,5,110,0, - 0,1084,1086,5,100,0,0,1085,1080,1,0,0,0,1085,1082,1,0,0,0,1086,236,1, - 0,0,0,1087,1088,5,124,0,0,1088,1092,5,124,0,0,1089,1090,5,111,0,0,1090, - 1092,5,114,0,0,1091,1087,1,0,0,0,1091,1089,1,0,0,0,1092,238,1,0,0,0,1093, - 1094,5,43,0,0,1094,1095,5,43,0,0,1095,240,1,0,0,0,1096,1097,5,45,0,0, - 1097,1098,5,45,0,0,1098,242,1,0,0,0,1099,1100,5,44,0,0,1100,244,1,0,0, - 0,1101,1102,5,45,0,0,1102,1103,5,62,0,0,1103,1104,5,42,0,0,1104,246,1, - 0,0,0,1105,1106,5,45,0,0,1106,1107,5,62,0,0,1107,248,1,0,0,0,1108,1109, - 5,63,0,0,1109,250,1,0,0,0,1110,1111,5,58,0,0,1111,252,1,0,0,0,1112,1113, - 5,58,0,0,1113,1114,5,58,0,0,1114,254,1,0,0,0,1115,1116,5,59,0,0,1116, - 256,1,0,0,0,1117,1118,5,46,0,0,1118,258,1,0,0,0,1119,1120,5,46,0,0,1120, - 1121,5,42,0,0,1121,260,1,0,0,0,1122,1123,5,46,0,0,1123,1124,5,46,0,0, - 1124,1125,5,46,0,0,1125,262,1,0,0,0,1126,1127,3,287,143,0,1127,1128,3, - 287,143,0,1128,1129,3,287,143,0,1129,1130,3,287,143,0,1130,264,1,0,0, - 0,1131,1132,5,92,0,0,1132,1133,5,117,0,0,1133,1134,1,0,0,0,1134,1142, - 3,263,131,0,1135,1136,5,92,0,0,1136,1137,5,85,0,0,1137,1138,1,0,0,0,1138, - 1139,3,263,131,0,1139,1140,3,263,131,0,1140,1142,1,0,0,0,1141,1131,1, - 0,0,0,1141,1135,1,0,0,0,1142,266,1,0,0,0,1143,1148,3,269,134,0,1144,1147, - 3,269,134,0,1145,1147,3,273,136,0,1146,1144,1,0,0,0,1146,1145,1,0,0,0, - 1147,1150,1,0,0,0,1148,1146,1,0,0,0,1148,1149,1,0,0,0,1149,268,1,0,0, - 0,1150,1148,1,0,0,0,1151,1154,3,271,135,0,1152,1154,3,265,132,0,1153, - 1151,1,0,0,0,1153,1152,1,0,0,0,1154,270,1,0,0,0,1155,1156,7,2,0,0,1156, - 272,1,0,0,0,1157,1158,7,3,0,0,1158,274,1,0,0,0,1159,1166,3,283,141,0, - 1160,1162,5,39,0,0,1161,1160,1,0,0,0,1161,1162,1,0,0,0,1162,1163,1,0, - 0,0,1163,1165,3,273,136,0,1164,1161,1,0,0,0,1165,1168,1,0,0,0,1166,1164, - 1,0,0,0,1166,1167,1,0,0,0,1167,276,1,0,0,0,1168,1166,1,0,0,0,1169,1176, - 5,48,0,0,1170,1172,5,39,0,0,1171,1170,1,0,0,0,1171,1172,1,0,0,0,1172, - 1173,1,0,0,0,1173,1175,3,285,142,0,1174,1171,1,0,0,0,1175,1178,1,0,0, - 0,1176,1174,1,0,0,0,1176,1177,1,0,0,0,1177,278,1,0,0,0,1178,1176,1,0, - 0,0,1179,1180,5,48,0,0,1180,1184,5,120,0,0,1181,1182,5,48,0,0,1182,1184, - 5,88,0,0,1183,1179,1,0,0,0,1183,1181,1,0,0,0,1184,1185,1,0,0,0,1185,1192, - 3,287,143,0,1186,1188,5,39,0,0,1187,1186,1,0,0,0,1187,1188,1,0,0,0,1188, - 1189,1,0,0,0,1189,1191,3,287,143,0,1190,1187,1,0,0,0,1191,1194,1,0,0, - 0,1192,1190,1,0,0,0,1192,1193,1,0,0,0,1193,280,1,0,0,0,1194,1192,1,0, - 0,0,1195,1196,5,48,0,0,1196,1200,5,98,0,0,1197,1198,5,48,0,0,1198,1200, - 5,66,0,0,1199,1195,1,0,0,0,1199,1197,1,0,0,0,1200,1201,1,0,0,0,1201,1208, - 3,289,144,0,1202,1204,5,39,0,0,1203,1202,1,0,0,0,1203,1204,1,0,0,0,1204, - 1205,1,0,0,0,1205,1207,3,289,144,0,1206,1203,1,0,0,0,1207,1210,1,0,0, - 0,1208,1206,1,0,0,0,1208,1209,1,0,0,0,1209,282,1,0,0,0,1210,1208,1,0, - 0,0,1211,1212,7,4,0,0,1212,284,1,0,0,0,1213,1214,7,5,0,0,1214,286,1,0, - 0,0,1215,1216,7,6,0,0,1216,288,1,0,0,0,1217,1218,7,7,0,0,1218,290,1,0, - 0,0,1219,1221,3,293,146,0,1220,1222,3,295,147,0,1221,1220,1,0,0,0,1221, - 1222,1,0,0,0,1222,1236,1,0,0,0,1223,1225,3,293,146,0,1224,1226,3,297, - 148,0,1225,1224,1,0,0,0,1225,1226,1,0,0,0,1226,1236,1,0,0,0,1227,1229, - 3,295,147,0,1228,1230,3,293,146,0,1229,1228,1,0,0,0,1229,1230,1,0,0,0, - 1230,1236,1,0,0,0,1231,1233,3,297,148,0,1232,1234,3,293,146,0,1233,1232, - 1,0,0,0,1233,1234,1,0,0,0,1234,1236,1,0,0,0,1235,1219,1,0,0,0,1235,1223, - 1,0,0,0,1235,1227,1,0,0,0,1235,1231,1,0,0,0,1236,292,1,0,0,0,1237,1238, - 7,8,0,0,1238,294,1,0,0,0,1239,1240,7,9,0,0,1240,296,1,0,0,0,1241,1242, - 5,108,0,0,1242,1246,5,108,0,0,1243,1244,5,76,0,0,1244,1246,5,76,0,0,1245, - 1241,1,0,0,0,1245,1243,1,0,0,0,1246,298,1,0,0,0,1247,1251,8,10,0,0,1248, - 1251,3,301,150,0,1249,1251,3,265,132,0,1250,1247,1,0,0,0,1250,1248,1, - 0,0,0,1250,1249,1,0,0,0,1251,300,1,0,0,0,1252,1256,3,303,151,0,1253,1256, - 3,305,152,0,1254,1256,3,307,153,0,1255,1252,1,0,0,0,1255,1253,1,0,0,0, - 1255,1254,1,0,0,0,1256,302,1,0,0,0,1257,1258,5,92,0,0,1258,1288,5,39, - 0,0,1259,1260,5,92,0,0,1260,1288,5,34,0,0,1261,1262,5,92,0,0,1262,1288, - 5,63,0,0,1263,1264,5,92,0,0,1264,1288,5,92,0,0,1265,1266,5,92,0,0,1266, - 1288,5,97,0,0,1267,1268,5,92,0,0,1268,1288,5,98,0,0,1269,1270,5,92,0, - 0,1270,1288,5,102,0,0,1271,1272,5,92,0,0,1272,1288,5,110,0,0,1273,1274, - 5,92,0,0,1274,1288,5,114,0,0,1275,1281,5,92,0,0,1276,1278,5,13,0,0,1277, - 1279,5,10,0,0,1278,1277,1,0,0,0,1278,1279,1,0,0,0,1279,1282,1,0,0,0,1280, - 1282,5,10,0,0,1281,1276,1,0,0,0,1281,1280,1,0,0,0,1282,1288,1,0,0,0,1283, - 1284,5,92,0,0,1284,1288,5,116,0,0,1285,1286,5,92,0,0,1286,1288,5,118, - 0,0,1287,1257,1,0,0,0,1287,1259,1,0,0,0,1287,1261,1,0,0,0,1287,1263,1, - 0,0,0,1287,1265,1,0,0,0,1287,1267,1,0,0,0,1287,1269,1,0,0,0,1287,1271, - 1,0,0,0,1287,1273,1,0,0,0,1287,1275,1,0,0,0,1287,1283,1,0,0,0,1287,1285, - 1,0,0,0,1288,304,1,0,0,0,1289,1290,5,92,0,0,1290,1301,3,285,142,0,1291, - 1292,5,92,0,0,1292,1293,3,285,142,0,1293,1294,3,285,142,0,1294,1301,1, - 0,0,0,1295,1296,5,92,0,0,1296,1297,3,285,142,0,1297,1298,3,285,142,0, - 1298,1299,3,285,142,0,1299,1301,1,0,0,0,1300,1289,1,0,0,0,1300,1291,1, - 0,0,0,1300,1295,1,0,0,0,1301,306,1,0,0,0,1302,1303,5,92,0,0,1303,1304, - 5,120,0,0,1304,1306,1,0,0,0,1305,1307,3,287,143,0,1306,1305,1,0,0,0,1307, - 1308,1,0,0,0,1308,1306,1,0,0,0,1308,1309,1,0,0,0,1309,308,1,0,0,0,1310, - 1312,3,315,157,0,1311,1310,1,0,0,0,1311,1312,1,0,0,0,1312,1313,1,0,0, - 0,1313,1314,5,46,0,0,1314,1319,3,315,157,0,1315,1316,3,315,157,0,1316, - 1317,5,46,0,0,1317,1319,1,0,0,0,1318,1311,1,0,0,0,1318,1315,1,0,0,0,1319, - 310,1,0,0,0,1320,1322,5,101,0,0,1321,1323,3,313,156,0,1322,1321,1,0,0, - 0,1322,1323,1,0,0,0,1323,1324,1,0,0,0,1324,1331,3,315,157,0,1325,1327, - 5,69,0,0,1326,1328,3,313,156,0,1327,1326,1,0,0,0,1327,1328,1,0,0,0,1328, - 1329,1,0,0,0,1329,1331,3,315,157,0,1330,1320,1,0,0,0,1330,1325,1,0,0, - 0,1331,312,1,0,0,0,1332,1333,7,11,0,0,1333,314,1,0,0,0,1334,1341,3,273, - 136,0,1335,1337,5,39,0,0,1336,1335,1,0,0,0,1336,1337,1,0,0,0,1337,1338, - 1,0,0,0,1338,1340,3,273,136,0,1339,1336,1,0,0,0,1340,1343,1,0,0,0,1341, - 1339,1,0,0,0,1341,1342,1,0,0,0,1342,316,1,0,0,0,1343,1341,1,0,0,0,1344, - 1345,7,12,0,0,1345,318,1,0,0,0,1346,1347,5,117,0,0,1347,1350,5,56,0,0, - 1348,1350,7,0,0,0,1349,1346,1,0,0,0,1349,1348,1,0,0,0,1350,320,1,0,0, - 0,1351,1355,8,13,0,0,1352,1355,3,301,150,0,1353,1355,3,265,132,0,1354, - 1351,1,0,0,0,1354,1352,1,0,0,0,1354,1353,1,0,0,0,1355,322,1,0,0,0,1356, - 1357,5,82,0,0,1357,1358,5,34,0,0,1358,1364,1,0,0,0,1359,1360,5,92,0,0, - 1360,1363,7,14,0,0,1361,1363,8,15,0,0,1362,1359,1,0,0,0,1362,1361,1,0, - 0,0,1363,1366,1,0,0,0,1364,1365,1,0,0,0,1364,1362,1,0,0,0,1365,1367,1, - 0,0,0,1366,1364,1,0,0,0,1367,1371,5,40,0,0,1368,1370,8,16,0,0,1369,1368, - 1,0,0,0,1370,1373,1,0,0,0,1371,1372,1,0,0,0,1371,1369,1,0,0,0,1372,1374, - 1,0,0,0,1373,1371,1,0,0,0,1374,1380,5,41,0,0,1375,1376,5,92,0,0,1376, - 1379,7,14,0,0,1377,1379,8,17,0,0,1378,1375,1,0,0,0,1378,1377,1,0,0,0, - 1379,1382,1,0,0,0,1380,1381,1,0,0,0,1380,1378,1,0,0,0,1381,1383,1,0,0, - 0,1382,1380,1,0,0,0,1383,1384,5,34,0,0,1384,324,1,0,0,0,1385,1386,3,275, - 137,0,1386,1387,3,333,166,0,1387,1398,1,0,0,0,1388,1389,3,277,138,0,1389, - 1390,3,333,166,0,1390,1398,1,0,0,0,1391,1392,3,279,139,0,1392,1393,3, - 333,166,0,1393,1398,1,0,0,0,1394,1395,3,281,140,0,1395,1396,3,333,166, - 0,1396,1398,1,0,0,0,1397,1385,1,0,0,0,1397,1388,1,0,0,0,1397,1391,1,0, - 0,0,1397,1394,1,0,0,0,1398,326,1,0,0,0,1399,1401,3,309,154,0,1400,1402, - 3,311,155,0,1401,1400,1,0,0,0,1401,1402,1,0,0,0,1402,1403,1,0,0,0,1403, - 1404,3,333,166,0,1404,1410,1,0,0,0,1405,1406,3,315,157,0,1406,1407,3, - 311,155,0,1407,1408,3,333,166,0,1408,1410,1,0,0,0,1409,1399,1,0,0,0,1409, - 1405,1,0,0,0,1410,328,1,0,0,0,1411,1412,3,7,3,0,1412,1413,3,333,166,0, - 1413,330,1,0,0,0,1414,1415,3,3,1,0,1415,1416,3,333,166,0,1416,332,1,0, - 0,0,1417,1418,3,267,133,0,1418,334,1,0,0,0,1419,1421,7,18,0,0,1420,1419, - 1,0,0,0,1421,1422,1,0,0,0,1422,1420,1,0,0,0,1422,1423,1,0,0,0,1423,1424, - 1,0,0,0,1424,1425,6,167,1,0,1425,336,1,0,0,0,1426,1428,5,13,0,0,1427, - 1429,5,10,0,0,1428,1427,1,0,0,0,1428,1429,1,0,0,0,1429,1432,1,0,0,0,1430, - 1432,5,10,0,0,1431,1426,1,0,0,0,1431,1430,1,0,0,0,1432,1433,1,0,0,0,1433, - 1434,6,168,1,0,1434,338,1,0,0,0,1435,1436,5,47,0,0,1436,1437,5,42,0,0, - 1437,1441,1,0,0,0,1438,1440,9,0,0,0,1439,1438,1,0,0,0,1440,1443,1,0,0, - 0,1441,1442,1,0,0,0,1441,1439,1,0,0,0,1442,1444,1,0,0,0,1443,1441,1,0, - 0,0,1444,1445,5,42,0,0,1445,1446,5,47,0,0,1446,1447,1,0,0,0,1447,1448, - 6,169,1,0,1448,340,1,0,0,0,1449,1450,5,47,0,0,1450,1451,5,47,0,0,1451, - 1455,1,0,0,0,1452,1454,8,19,0,0,1453,1452,1,0,0,0,1454,1457,1,0,0,0,1455, - 1453,1,0,0,0,1455,1456,1,0,0,0,1456,1458,1,0,0,0,1457,1455,1,0,0,0,1458, - 1459,6,170,1,0,1459,342,1,0,0,0,74,0,345,349,353,357,359,362,368,374, - 377,382,384,387,394,398,402,410,416,421,426,431,439,1028,1085,1091,1141, - 1146,1148,1153,1161,1166,1171,1176,1183,1187,1192,1199,1203,1208,1221, - 1225,1229,1233,1235,1245,1250,1255,1278,1281,1287,1300,1308,1311,1318, - 1322,1327,1330,1336,1341,1349,1354,1362,1364,1371,1378,1380,1397,1401, - 1409,1422,1428,1431,1441,1455,2,0,1,0,6,0,0 - }; - staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); - - antlr4::atn::ATNDeserializer deserializer; - staticData->atn = deserializer.deserialize(staticData->serializedATN); - - const size_t count = staticData->atn->getNumberOfDecisions(); - staticData->decisionToDFA.reserve(count); - for (size_t i = 0; i < count; i++) { - staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); - } - cpp14lexerLexerStaticData = staticData.release(); -} - -} - -CPP14Lexer::CPP14Lexer(CharStream *input) : Lexer(input) { - CPP14Lexer::initialize(); - _interpreter = new atn::LexerATNSimulator(this, *cpp14lexerLexerStaticData->atn, cpp14lexerLexerStaticData->decisionToDFA, cpp14lexerLexerStaticData->sharedContextCache); -} - -CPP14Lexer::~CPP14Lexer() { - delete _interpreter; -} - -std::string CPP14Lexer::getGrammarFileName() const { - return "CPP14Lexer.g4"; -} - -const std::vector& CPP14Lexer::getRuleNames() const { - return cpp14lexerLexerStaticData->ruleNames; -} - -const std::vector& CPP14Lexer::getChannelNames() const { - return cpp14lexerLexerStaticData->channelNames; -} - -const std::vector& CPP14Lexer::getModeNames() const { - return cpp14lexerLexerStaticData->modeNames; -} - -const dfa::Vocabulary& CPP14Lexer::getVocabulary() const { - return cpp14lexerLexerStaticData->vocabulary; -} - -antlr4::atn::SerializedATNView CPP14Lexer::getSerializedATN() const { - return cpp14lexerLexerStaticData->serializedATN; -} - -const atn::ATN& CPP14Lexer::getATN() const { - return *cpp14lexerLexerStaticData->atn; -} - - - - -void CPP14Lexer::initialize() { - ::antlr4::internal::call_once(cpp14lexerLexerOnceFlag, cpp14lexerLexerInitialize); -} diff --git a/server/pkg/antlr/cpp14/src/CPP14Parser.cpp b/server/pkg/antlr/cpp14/src/CPP14Parser.cpp deleted file mode 100644 index 87c2060..0000000 --- a/server/pkg/antlr/cpp14/src/CPP14Parser.cpp +++ /dev/null @@ -1,18169 +0,0 @@ - -// Generated from CPP14Parser.g4 by ANTLR 4.12.0 - - - -#include "CPP14Parser.h" - - -using namespace antlrcpp; -using namespace antlrcpptest; - -using namespace antlr4; - -namespace { - -struct CPP14ParserStaticData final { - CPP14ParserStaticData(std::vector ruleNames, - std::vector literalNames, - std::vector symbolicNames) - : ruleNames(std::move(ruleNames)), literalNames(std::move(literalNames)), - symbolicNames(std::move(symbolicNames)), - vocabulary(this->literalNames, this->symbolicNames) {} - - CPP14ParserStaticData(const CPP14ParserStaticData&) = delete; - CPP14ParserStaticData(CPP14ParserStaticData&&) = delete; - CPP14ParserStaticData& operator=(const CPP14ParserStaticData&) = delete; - CPP14ParserStaticData& operator=(CPP14ParserStaticData&&) = delete; - - std::vector decisionToDFA; - antlr4::atn::PredictionContextCache sharedContextCache; - const std::vector ruleNames; - const std::vector literalNames; - const std::vector symbolicNames; - const antlr4::dfa::Vocabulary vocabulary; - antlr4::atn::SerializedATNView serializedATN; - std::unique_ptr atn; -}; - -::antlr4::internal::OnceFlag cpp14parserParserOnceFlag; -CPP14ParserStaticData *cpp14parserParserStaticData = nullptr; - -void cpp14parserParserInitialize() { - assert(cpp14parserParserStaticData == nullptr); - auto staticData = std::make_unique( - std::vector{ - "translationUnit", "primaryExpression", "idExpression", "unqualifiedId", - "qualifiedId", "nestedNameSpecifier", "lambdaExpression", "lambdaIntroducer", - "lambdaCapture", "captureDefault", "captureList", "capture", "simpleCapture", - "initcapture", "lambdaDeclarator", "postfixExpression", "typeIdOfTheTypeId", - "expressionList", "pseudoDestructorName", "unaryExpression", "unaryOperator", - "newExpression", "newPlacement", "newTypeId", "newDeclarator", "noPointerNewDeclarator", - "newInitializer", "deleteExpression", "noExceptExpression", "castExpression", - "pointerMemberExpression", "multiplicativeExpression", "additiveExpression", - "shiftExpression", "shiftOperator", "relationalExpression", "equalityExpression", - "andExpression", "exclusiveOrExpression", "inclusiveOrExpression", - "logicalAndExpression", "logicalOrExpression", "conditionalExpression", - "assignmentExpression", "assignmentOperator", "expression", "constantExpression", - "statement", "labeledStatement", "expressionStatement", "compoundStatement", - "statementSeq", "selectionStatement", "condition", "iterationStatement", - "forInitStatement", "forRangeDeclaration", "forRangeInitializer", - "jumpStatement", "declarationStatement", "declarationseq", "declaration", - "blockDeclaration", "aliasDeclaration", "simpleDeclaration", "staticAssertDeclaration", - "emptyDeclaration", "attributeDeclaration", "declSpecifier", "declSpecifierSeq", - "storageClassSpecifier", "functionSpecifier", "typedefName", "typeSpecifier", - "trailingTypeSpecifier", "typeSpecifierSeq", "trailingTypeSpecifierSeq", - "simpleTypeLengthModifier", "simpleTypeSignednessModifier", "simpleTypeSpecifier", - "theTypeName", "decltypeSpecifier", "elaboratedTypeSpecifier", "enumName", - "enumSpecifier", "enumHead", "opaqueEnumDeclaration", "enumkey", "enumbase", - "enumeratorList", "enumeratorDefinition", "enumerator", "namespaceName", - "originalNamespaceName", "namespaceDefinition", "namespaceAlias", - "namespaceAliasDefinition", "qualifiednamespacespecifier", "usingDeclaration", - "usingDirective", "asmDefinition", "linkageSpecification", "attributeSpecifierSeq", - "attributeSpecifier", "alignmentspecifier", "attributeList", "attribute", - "attributeNamespace", "attributeArgumentClause", "balancedTokenSeq", - "balancedtoken", "initDeclaratorList", "initDeclarator", "declarator", - "pointerDeclarator", "noPointerDeclarator", "parametersAndQualifiers", - "trailingReturnType", "pointerOperator", "cvqualifierseq", "cvQualifier", - "refqualifier", "declaratorid", "theTypeId", "abstractDeclarator", - "pointerAbstractDeclarator", "noPointerAbstractDeclarator", "abstractPackDeclarator", - "noPointerAbstractPackDeclarator", "parameterDeclarationClause", "parameterDeclarationList", - "parameterDeclaration", "functionDefinition", "functionBody", "initializer", - "braceOrEqualInitializer", "initializerClause", "initializerList", - "bracedInitList", "className", "classSpecifier", "classHead", "classHeadName", - "classVirtSpecifier", "classKey", "memberSpecification", "memberdeclaration", - "memberDeclaratorList", "memberDeclarator", "virtualSpecifierSeq", - "virtualSpecifier", "pureSpecifier", "baseClause", "baseSpecifierList", - "baseSpecifier", "classOrDeclType", "baseTypeSpecifier", "accessSpecifier", - "conversionFunctionId", "conversionTypeId", "conversionDeclarator", - "constructorInitializer", "memInitializerList", "memInitializer", - "meminitializerid", "operatorFunctionId", "literalOperatorId", "templateDeclaration", - "templateparameterList", "templateParameter", "typeParameter", "simpleTemplateId", - "templateId", "templateName", "templateArgumentList", "templateArgument", - "typeNameSpecifier", "explicitInstantiation", "explicitSpecialization", - "tryBlock", "functionTryBlock", "handlerSeq", "handler", "exceptionDeclaration", - "throwExpression", "exceptionSpecification", "dynamicExceptionSpecification", - "typeIdList", "noeExceptSpecification", "theOperator", "literal" - }, - std::vector{ - "", "", "", "", "", "", "", "", "", "", "'alignas'", "'alignof'", - "'asm'", "'auto'", "'bool'", "'break'", "'case'", "'catch'", "'char'", - "'char16_t'", "'char32_t'", "'class'", "'const'", "'constexpr'", "'const_cast'", - "'continue'", "'decltype'", "'default'", "'delete'", "'do'", "'double'", - "'dynamic_cast'", "'else'", "'enum'", "'explicit'", "'export'", "'extern'", - "'false'", "'final'", "'float'", "'for'", "'friend'", "'goto'", "'if'", - "'inline'", "'int'", "'long'", "'mutable'", "'namespace'", "'new'", - "'noexcept'", "'nullptr'", "'operator'", "'override'", "'private'", - "'protected'", "'public'", "'register'", "'reinterpret_cast'", "'return'", - "'short'", "'signed'", "'sizeof'", "'static'", "'static_assert'", - "'static_cast'", "'struct'", "'switch'", "'template'", "'this'", "'thread_local'", - "'throw'", "'true'", "'try'", "'typedef'", "'typeid'", "'typename'", - "'union'", "'unsigned'", "'using'", "'virtual'", "'void'", "'volatile'", - "'wchar_t'", "'while'", "'('", "')'", "'['", "']'", "'{'", "'}'", - "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "'&'", "'|'", "'~'", "", - "'='", "'<'", "'>'", "'+='", "'-='", "'*='", "'/='", "'%='", "'^='", - "'&='", "'|='", "'<<='", "'>>='", "'=='", "'!='", "'<='", "'>='", - "", "", "'++'", "'--'", "','", "'->*'", "'->'", "'\\u003F'", "':'", - "'::'", "';'", "'.'", "'.*'", "'...'" - }, - std::vector{ - "", "IntegerLiteral", "CharacterLiteral", "FloatingLiteral", "StringLiteral", - "BooleanLiteral", "PointerLiteral", "UserDefinedLiteral", "MultiLineMacro", - "Directive", "Alignas", "Alignof", "Asm", "Auto", "Bool", "Break", - "Case", "Catch", "Char", "Char16", "Char32", "Class", "Const", "Constexpr", - "Const_cast", "Continue", "Decltype", "Default", "Delete", "Do", "Double", - "Dynamic_cast", "Else", "Enum", "Explicit", "Export", "Extern", "False_", - "Final", "Float", "For", "Friend", "Goto", "If", "Inline", "Int", - "Long", "Mutable", "Namespace", "New", "Noexcept", "Nullptr", "Operator", - "Override", "Private", "Protected", "Public", "Register", "Reinterpret_cast", - "Return", "Short", "Signed", "Sizeof", "Static", "Static_assert", - "Static_cast", "Struct", "Switch", "Template", "This", "Thread_local", - "Throw", "True_", "Try", "Typedef", "Typeid_", "Typename_", "Union", - "Unsigned", "Using", "Virtual", "Void", "Volatile", "Wchar", "While", - "LeftParen", "RightParen", "LeftBracket", "RightBracket", "LeftBrace", - "RightBrace", "Plus", "Minus", "Star", "Div", "Mod", "Caret", "And", - "Or", "Tilde", "Not", "Assign", "Less", "Greater", "PlusAssign", "MinusAssign", - "StarAssign", "DivAssign", "ModAssign", "XorAssign", "AndAssign", - "OrAssign", "LeftShiftAssign", "RightShiftAssign", "Equal", "NotEqual", - "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PlusPlus", "MinusMinus", - "Comma", "ArrowStar", "Arrow", "Question", "Colon", "Doublecolon", - "Semi", "Dot", "DotStar", "Ellipsis", "Identifier", "DecimalLiteral", - "OctalLiteral", "HexadecimalLiteral", "BinaryLiteral", "Integersuffix", - "UserDefinedIntegerLiteral", "UserDefinedFloatingLiteral", "UserDefinedStringLiteral", - "UserDefinedCharacterLiteral", "Whitespace", "Newline", "BlockComment", - "LineComment" - } - ); - static const int32_t serializedATNSegment[] = { - 4,1,145,2110,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6, - 2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14, - 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21, - 7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28, - 7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35, - 7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42, - 7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49, - 7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56, - 7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63, - 7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70, - 7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77, - 7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84, - 7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,91, - 7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2,98, - 7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104, - 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110, - 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116, - 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122, - 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128, - 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134, - 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140, - 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146, - 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152, - 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,2,157,7,157,2,158, - 7,158,2,159,7,159,2,160,7,160,2,161,7,161,2,162,7,162,2,163,7,163,2,164, - 7,164,2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170, - 7,170,2,171,7,171,2,172,7,172,2,173,7,173,2,174,7,174,2,175,7,175,2,176, - 7,176,2,177,7,177,2,178,7,178,2,179,7,179,2,180,7,180,2,181,7,181,2,182, - 7,182,2,183,7,183,2,184,7,184,2,185,7,185,2,186,7,186,2,187,7,187,2,188, - 7,188,2,189,7,189,2,190,7,190,1,0,3,0,384,8,0,1,0,1,0,1,1,4,1,389,8,1, - 11,1,12,1,390,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,400,8,1,1,2,1,2,3,2,404, - 8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,413,8,3,1,3,3,3,416,8,3,1,4,1,4,3, - 4,420,8,4,1,4,1,4,1,5,1,5,1,5,1,5,3,5,428,8,5,1,5,1,5,1,5,1,5,1,5,3,5, - 435,8,5,1,5,3,5,438,8,5,1,5,5,5,441,8,5,10,5,12,5,444,9,5,1,6,1,6,3,6, - 448,8,6,1,6,1,6,1,7,1,7,3,7,454,8,7,1,7,1,7,1,8,1,8,1,8,1,8,3,8,462,8, - 8,3,8,464,8,8,1,9,1,9,1,10,1,10,1,10,5,10,471,8,10,10,10,12,10,474,9, - 10,1,10,3,10,477,8,10,1,11,1,11,3,11,481,8,11,1,12,3,12,484,8,12,1,12, - 1,12,3,12,488,8,12,1,13,3,13,491,8,13,1,13,1,13,1,13,1,14,1,14,3,14,498, - 8,14,1,14,1,14,3,14,502,8,14,1,14,3,14,505,8,14,1,14,3,14,508,8,14,1, - 14,3,14,511,8,14,1,15,1,15,1,15,1,15,3,15,517,8,15,1,15,1,15,3,15,521, - 8,15,1,15,1,15,3,15,525,8,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15, - 1,15,1,15,1,15,1,15,3,15,539,8,15,1,15,1,15,3,15,543,8,15,1,15,1,15,1, - 15,1,15,3,15,549,8,15,1,15,1,15,1,15,1,15,1,15,3,15,556,8,15,1,15,1,15, - 1,15,1,15,3,15,562,8,15,1,15,1,15,3,15,566,8,15,1,15,1,15,5,15,570,8, - 15,10,15,12,15,573,9,15,1,16,1,16,1,17,1,17,1,18,3,18,580,8,18,1,18,1, - 18,1,18,3,18,585,8,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, - 18,1,18,3,18,598,8,18,1,19,1,19,1,19,1,19,1,19,3,19,605,8,19,1,19,1,19, - 1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,3,19,617,8,19,1,19,1,19,1,19, - 1,19,1,19,1,19,1,19,1,19,3,19,627,8,19,1,20,1,20,1,21,3,21,632,8,21,1, - 21,1,21,3,21,636,8,21,1,21,1,21,1,21,1,21,1,21,3,21,643,8,21,1,21,3,21, - 646,8,21,1,22,1,22,1,22,1,22,1,23,1,23,3,23,654,8,23,1,24,1,24,3,24,658, - 8,24,1,24,3,24,661,8,24,1,25,1,25,1,25,1,25,1,25,3,25,668,8,25,1,25,1, - 25,1,25,1,25,1,25,3,25,675,8,25,5,25,677,8,25,10,25,12,25,680,9,25,1, - 26,1,26,3,26,684,8,26,1,26,1,26,3,26,688,8,26,1,27,3,27,691,8,27,1,27, - 1,27,1,27,3,27,696,8,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,29,1,29, - 1,29,1,29,1,29,1,29,3,29,711,8,29,1,30,1,30,1,30,5,30,716,8,30,10,30, - 12,30,719,9,30,1,31,1,31,1,31,5,31,724,8,31,10,31,12,31,727,9,31,1,32, - 1,32,1,32,5,32,732,8,32,10,32,12,32,735,9,32,1,33,1,33,1,33,1,33,5,33, - 741,8,33,10,33,12,33,744,9,33,1,34,1,34,1,34,1,34,3,34,750,8,34,1,35, - 1,35,1,35,5,35,755,8,35,10,35,12,35,758,9,35,1,36,1,36,1,36,5,36,763, - 8,36,10,36,12,36,766,9,36,1,37,1,37,1,37,5,37,771,8,37,10,37,12,37,774, - 9,37,1,38,1,38,1,38,5,38,779,8,38,10,38,12,38,782,9,38,1,39,1,39,1,39, - 5,39,787,8,39,10,39,12,39,790,9,39,1,40,1,40,1,40,5,40,795,8,40,10,40, - 12,40,798,9,40,1,41,1,41,1,41,5,41,803,8,41,10,41,12,41,806,9,41,1,42, - 1,42,1,42,1,42,1,42,1,42,3,42,814,8,42,1,43,1,43,1,43,1,43,1,43,1,43, - 3,43,822,8,43,1,44,1,44,1,45,1,45,1,45,5,45,829,8,45,10,45,12,45,832, - 9,45,1,46,1,46,1,47,1,47,1,47,3,47,839,8,47,1,47,1,47,1,47,1,47,1,47, - 1,47,3,47,847,8,47,3,47,849,8,47,1,48,3,48,852,8,48,1,48,1,48,1,48,1, - 48,3,48,858,8,48,1,48,1,48,1,48,1,49,3,49,864,8,49,1,49,1,49,1,50,1,50, - 3,50,870,8,50,1,50,1,50,1,51,4,51,875,8,51,11,51,12,51,876,1,52,1,52, - 1,52,1,52,1,52,1,52,1,52,3,52,886,8,52,1,52,1,52,1,52,1,52,1,52,1,52, - 3,52,894,8,52,1,53,1,53,3,53,898,8,53,1,53,1,53,1,53,1,53,1,53,3,53,905, - 8,53,3,53,907,8,53,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54, - 1,54,1,54,1,54,1,54,1,54,1,54,1,54,1,54,3,54,927,8,54,1,54,1,54,3,54, - 931,8,54,1,54,1,54,1,54,1,54,3,54,937,8,54,1,54,1,54,1,54,3,54,942,8, - 54,1,55,1,55,3,55,946,8,55,1,56,3,56,949,8,56,1,56,1,56,1,56,1,57,1,57, - 3,57,956,8,57,1,58,1,58,1,58,1,58,1,58,3,58,963,8,58,1,58,1,58,3,58,967, - 8,58,1,58,1,58,1,59,1,59,1,60,4,60,974,8,60,11,60,12,60,975,1,61,1,61, - 1,61,1,61,1,61,1,61,1,61,1,61,1,61,3,61,987,8,61,1,62,1,62,1,62,1,62, - 1,62,1,62,1,62,1,62,3,62,997,8,62,1,63,1,63,1,63,3,63,1002,8,63,1,63, - 1,63,1,63,1,63,1,64,3,64,1009,8,64,1,64,3,64,1012,8,64,1,64,1,64,1,64, - 3,64,1017,8,64,1,64,1,64,1,64,3,64,1022,8,64,1,65,1,65,1,65,1,65,1,65, - 1,65,1,65,1,65,1,66,1,66,1,67,1,67,1,67,1,68,1,68,1,68,1,68,1,68,1,68, - 3,68,1043,8,68,1,69,4,69,1046,8,69,11,69,12,69,1047,1,69,3,69,1051,8, - 69,1,70,1,70,1,71,1,71,1,72,1,72,1,73,1,73,1,73,3,73,1062,8,73,1,74,1, - 74,1,74,1,74,3,74,1068,8,74,1,75,4,75,1071,8,75,11,75,12,75,1072,1,75, - 3,75,1076,8,75,1,76,4,76,1079,8,76,11,76,12,76,1080,1,76,3,76,1084,8, - 76,1,77,1,77,1,78,1,78,1,79,3,79,1091,8,79,1,79,1,79,1,79,1,79,1,79,1, - 79,1,79,3,79,1100,8,79,1,79,4,79,1103,8,79,11,79,12,79,1104,1,79,3,79, - 1108,8,79,1,79,1,79,3,79,1112,8,79,1,79,1,79,3,79,1116,8,79,1,79,1,79, - 3,79,1120,8,79,1,79,1,79,1,79,3,79,1125,8,79,1,79,5,79,1128,8,79,10,79, - 12,79,1131,9,79,1,79,1,79,1,79,3,79,1136,8,79,1,79,1,79,1,79,1,79,3,79, - 1142,8,79,1,80,1,80,1,80,1,80,3,80,1148,8,80,1,81,1,81,1,81,1,81,3,81, - 1154,8,81,1,81,1,81,1,82,1,82,3,82,1160,8,82,1,82,3,82,1163,8,82,1,82, - 1,82,1,82,1,82,3,82,1169,8,82,1,82,1,82,3,82,1173,8,82,1,82,1,82,3,82, - 1177,8,82,1,82,3,82,1180,8,82,1,83,1,83,1,84,1,84,1,84,1,84,3,84,1188, - 8,84,3,84,1190,8,84,1,84,1,84,1,85,1,85,3,85,1196,8,85,1,85,3,85,1199, - 8,85,1,85,3,85,1202,8,85,1,85,3,85,1205,8,85,1,86,1,86,3,86,1209,8,86, - 1,86,1,86,3,86,1213,8,86,1,86,1,86,1,87,1,87,3,87,1219,8,87,1,88,1,88, - 1,88,1,89,1,89,1,89,5,89,1227,8,89,10,89,12,89,1230,9,89,1,90,1,90,1, - 90,3,90,1235,8,90,1,91,1,91,1,92,1,92,3,92,1241,8,92,1,93,1,93,1,94,3, - 94,1246,8,94,1,94,1,94,1,94,3,94,1251,8,94,1,94,1,94,3,94,1255,8,94,1, - 94,1,94,1,95,1,95,1,96,1,96,1,96,1,96,1,96,1,96,1,97,3,97,1268,8,97,1, - 97,1,97,1,98,1,98,3,98,1274,8,98,1,98,1,98,3,98,1278,8,98,1,98,1,98,1, - 98,1,99,3,99,1284,8,99,1,99,1,99,1,99,3,99,1289,8,99,1,99,1,99,1,99,1, - 100,1,100,1,100,1,100,1,100,1,100,1,101,1,101,1,101,1,101,3,101,1304, - 8,101,1,101,1,101,3,101,1308,8,101,1,102,4,102,1311,8,102,11,102,12,102, - 1312,1,103,1,103,1,103,3,103,1318,8,103,1,103,1,103,1,103,3,103,1323, - 8,103,1,104,1,104,1,104,1,104,3,104,1329,8,104,1,104,3,104,1332,8,104, - 1,104,1,104,1,105,1,105,1,105,5,105,1339,8,105,10,105,12,105,1342,9,105, - 1,105,3,105,1345,8,105,1,106,1,106,1,106,3,106,1350,8,106,1,106,1,106, - 3,106,1354,8,106,1,107,1,107,1,108,1,108,3,108,1360,8,108,1,108,1,108, - 1,109,4,109,1365,8,109,11,109,12,109,1366,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,4,110,1382,8,110,11,110, - 12,110,1383,3,110,1386,8,110,1,111,1,111,1,111,5,111,1391,8,111,10,111, - 12,111,1394,9,111,1,112,1,112,3,112,1398,8,112,1,113,1,113,1,113,1,113, - 1,113,3,113,1405,8,113,1,114,1,114,3,114,1409,8,114,5,114,1411,8,114, - 10,114,12,114,1414,9,114,1,114,1,114,1,115,1,115,1,115,3,115,1421,8,115, - 1,115,1,115,1,115,1,115,3,115,1427,8,115,1,115,1,115,1,115,1,115,3,115, - 1433,8,115,1,115,1,115,3,115,1437,8,115,3,115,1439,8,115,5,115,1441,8, - 115,10,115,12,115,1444,9,115,1,116,1,116,3,116,1448,8,116,1,116,1,116, - 3,116,1452,8,116,1,116,3,116,1455,8,116,1,116,3,116,1458,8,116,1,116, - 3,116,1461,8,116,1,117,1,117,1,117,3,117,1466,8,117,1,118,1,118,3,118, - 1470,8,118,1,118,3,118,1473,8,118,1,118,1,118,3,118,1477,8,118,1,118, - 3,118,1480,8,118,3,118,1482,8,118,1,119,4,119,1485,8,119,11,119,12,119, - 1486,1,120,1,120,1,121,1,121,1,122,3,122,1494,8,122,1,122,1,122,1,123, - 1,123,3,123,1500,8,123,1,124,1,124,3,124,1504,8,124,1,124,1,124,1,124, - 1,124,3,124,1510,8,124,1,125,1,125,4,125,1514,8,125,11,125,12,125,1515, - 1,125,3,125,1519,8,125,3,125,1521,8,125,1,126,1,126,1,126,1,126,3,126, - 1527,8,126,1,126,1,126,3,126,1531,8,126,1,126,1,126,1,126,1,126,3,126, - 1537,8,126,1,126,1,126,1,126,1,126,1,126,3,126,1544,8,126,1,126,1,126, - 3,126,1548,8,126,3,126,1550,8,126,5,126,1552,8,126,10,126,12,126,1555, - 9,126,1,127,5,127,1558,8,127,10,127,12,127,1561,9,127,1,127,1,127,1,128, - 1,128,1,128,1,128,1,128,1,128,1,128,3,128,1572,8,128,1,128,1,128,3,128, - 1576,8,128,3,128,1578,8,128,5,128,1580,8,128,10,128,12,128,1583,9,128, - 1,129,1,129,3,129,1587,8,129,1,129,3,129,1590,8,129,1,130,1,130,1,130, - 5,130,1595,8,130,10,130,12,130,1598,9,130,1,131,3,131,1601,8,131,1,131, - 1,131,1,131,3,131,1606,8,131,3,131,1608,8,131,1,131,1,131,3,131,1612, - 8,131,1,132,3,132,1615,8,132,1,132,3,132,1618,8,132,1,132,1,132,3,132, - 1622,8,132,1,132,1,132,1,133,3,133,1627,8,133,1,133,1,133,1,133,1,133, - 1,133,3,133,1634,8,133,1,134,1,134,1,134,1,134,1,134,3,134,1641,8,134, - 1,135,1,135,1,135,3,135,1646,8,135,1,136,1,136,3,136,1650,8,136,1,137, - 1,137,3,137,1654,8,137,1,137,1,137,1,137,3,137,1659,8,137,5,137,1661, - 8,137,10,137,12,137,1664,9,137,1,138,1,138,1,138,3,138,1669,8,138,3,138, - 1671,8,138,1,138,1,138,1,139,1,139,3,139,1677,8,139,1,140,1,140,1,140, - 3,140,1682,8,140,1,140,1,140,1,141,1,141,3,141,1688,8,141,1,141,1,141, - 3,141,1692,8,141,3,141,1694,8,141,1,141,3,141,1697,8,141,1,141,1,141, - 3,141,1701,8,141,1,141,1,141,3,141,1705,8,141,3,141,1707,8,141,3,141, - 1709,8,141,1,142,3,142,1712,8,142,1,142,1,142,1,143,1,143,1,144,1,144, - 1,145,1,145,1,145,1,145,4,145,1724,8,145,11,145,12,145,1725,1,146,3,146, - 1729,8,146,1,146,3,146,1732,8,146,1,146,3,146,1735,8,146,1,146,1,146, - 1,146,1,146,1,146,1,146,1,146,3,146,1744,8,146,1,147,1,147,1,147,5,147, - 1749,8,147,10,147,12,147,1752,9,147,1,148,1,148,3,148,1756,8,148,1,148, - 3,148,1759,8,148,1,148,3,148,1762,8,148,3,148,1764,8,148,1,148,3,148, - 1767,8,148,1,148,3,148,1770,8,148,1,148,1,148,3,148,1774,8,148,1,149, - 4,149,1777,8,149,11,149,12,149,1778,1,150,1,150,1,151,1,151,1,151,1,151, - 1,152,1,152,1,152,1,153,1,153,3,153,1792,8,153,1,153,1,153,1,153,3,153, - 1797,8,153,5,153,1799,8,153,10,153,12,153,1802,9,153,1,154,3,154,1805, - 8,154,1,154,1,154,1,154,3,154,1810,8,154,1,154,1,154,1,154,3,154,1815, - 8,154,1,154,1,154,3,154,1819,8,154,1,155,3,155,1822,8,155,1,155,1,155, - 3,155,1826,8,155,1,156,1,156,1,157,1,157,1,158,1,158,1,158,1,159,1,159, - 3,159,1837,8,159,1,160,1,160,3,160,1841,8,160,1,161,1,161,1,161,1,162, - 1,162,3,162,1848,8,162,1,162,1,162,1,162,3,162,1853,8,162,5,162,1855, - 8,162,10,162,12,162,1858,9,162,1,163,1,163,1,163,3,163,1863,8,163,1,163, - 1,163,3,163,1867,8,163,1,164,1,164,3,164,1871,8,164,1,165,1,165,1,165, - 1,166,1,166,1,166,1,166,3,166,1880,8,166,1,167,1,167,1,167,1,167,1,167, - 1,167,1,168,1,168,1,168,5,168,1891,8,168,10,168,12,168,1894,9,168,1,169, - 1,169,3,169,1898,8,169,1,170,1,170,1,170,1,170,1,170,3,170,1905,8,170, - 1,170,1,170,3,170,1909,8,170,1,170,3,170,1912,8,170,1,170,3,170,1915, - 8,170,1,170,3,170,1918,8,170,1,170,1,170,3,170,1922,8,170,1,171,1,171, - 1,171,3,171,1927,8,171,1,171,1,171,1,172,1,172,1,172,3,172,1934,8,172, - 1,172,1,172,3,172,1938,8,172,1,172,1,172,3,172,1942,8,172,1,173,1,173, - 1,174,1,174,3,174,1948,8,174,1,174,1,174,1,174,3,174,1953,8,174,5,174, - 1955,8,174,10,174,12,174,1958,9,174,1,175,1,175,1,175,3,175,1963,8,175, - 1,176,1,176,1,176,1,176,3,176,1969,8,176,1,176,3,176,1972,8,176,1,177, - 3,177,1975,8,177,1,177,1,177,1,177,1,178,1,178,1,178,1,178,1,178,1,179, - 1,179,1,179,1,179,1,180,1,180,3,180,1991,8,180,1,180,1,180,1,180,1,181, - 4,181,1997,8,181,11,181,12,181,1998,1,182,1,182,1,182,1,182,1,182,1,182, - 1,183,3,183,2008,8,183,1,183,1,183,1,183,3,183,2013,8,183,1,183,3,183, - 2016,8,183,1,184,1,184,3,184,2020,8,184,1,185,1,185,3,185,2024,8,185, - 1,186,1,186,1,186,3,186,2029,8,186,1,186,1,186,1,187,1,187,3,187,2035, - 8,187,1,187,1,187,1,187,3,187,2040,8,187,5,187,2042,8,187,10,187,12,187, - 2045,9,187,1,188,1,188,1,188,1,188,1,188,1,188,3,188,2053,8,188,1,189, - 1,189,1,189,3,189,2058,8,189,1,189,1,189,1,189,3,189,2063,8,189,1,189, - 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, - 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, - 1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, - 1,189,1,189,1,189,1,189,3,189,2106,8,189,1,190,1,190,1,190,1,1047,6,10, - 30,50,230,252,256,191,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34, - 36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80, - 82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120, - 122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156, - 158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192, - 194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228, - 230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,260,262,264, - 266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300, - 302,304,306,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336, - 338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372, - 374,376,378,380,0,23,2,0,97,97,101,101,4,0,24,24,31,31,58,58,65,65,2, - 0,124,124,129,129,1,0,120,121,2,0,91,93,97,100,2,0,123,123,130,130,1, - 0,93,95,1,0,91,92,2,0,102,103,116,117,1,0,114,115,2,0,101,101,104,113, - 5,0,36,36,47,47,57,57,63,63,70,70,3,0,34,34,44,44,80,80,2,0,46,46,60, - 60,2,0,61,61,78,78,2,0,21,21,66,66,1,0,85,90,2,0,97,97,118,118,2,0,22, - 22,82,82,1,0,27,28,2,0,38,38,53,53,1,0,54,56,1,0,1,7,2343,0,383,1,0,0, - 0,2,399,1,0,0,0,4,403,1,0,0,0,6,415,1,0,0,0,8,417,1,0,0,0,10,423,1,0, - 0,0,12,445,1,0,0,0,14,451,1,0,0,0,16,463,1,0,0,0,18,465,1,0,0,0,20,467, - 1,0,0,0,22,480,1,0,0,0,24,487,1,0,0,0,26,490,1,0,0,0,28,495,1,0,0,0,30, - 542,1,0,0,0,32,574,1,0,0,0,34,576,1,0,0,0,36,597,1,0,0,0,38,626,1,0,0, - 0,40,628,1,0,0,0,42,631,1,0,0,0,44,647,1,0,0,0,46,651,1,0,0,0,48,660, - 1,0,0,0,50,662,1,0,0,0,52,687,1,0,0,0,54,690,1,0,0,0,56,699,1,0,0,0,58, - 710,1,0,0,0,60,712,1,0,0,0,62,720,1,0,0,0,64,728,1,0,0,0,66,736,1,0,0, - 0,68,749,1,0,0,0,70,751,1,0,0,0,72,759,1,0,0,0,74,767,1,0,0,0,76,775, - 1,0,0,0,78,783,1,0,0,0,80,791,1,0,0,0,82,799,1,0,0,0,84,807,1,0,0,0,86, - 821,1,0,0,0,88,823,1,0,0,0,90,825,1,0,0,0,92,833,1,0,0,0,94,848,1,0,0, - 0,96,851,1,0,0,0,98,863,1,0,0,0,100,867,1,0,0,0,102,874,1,0,0,0,104,893, - 1,0,0,0,106,906,1,0,0,0,108,941,1,0,0,0,110,945,1,0,0,0,112,948,1,0,0, - 0,114,955,1,0,0,0,116,966,1,0,0,0,118,970,1,0,0,0,120,973,1,0,0,0,122, - 986,1,0,0,0,124,996,1,0,0,0,126,998,1,0,0,0,128,1021,1,0,0,0,130,1023, - 1,0,0,0,132,1031,1,0,0,0,134,1033,1,0,0,0,136,1042,1,0,0,0,138,1045,1, - 0,0,0,140,1052,1,0,0,0,142,1054,1,0,0,0,144,1056,1,0,0,0,146,1061,1,0, - 0,0,148,1067,1,0,0,0,150,1070,1,0,0,0,152,1078,1,0,0,0,154,1085,1,0,0, - 0,156,1087,1,0,0,0,158,1141,1,0,0,0,160,1147,1,0,0,0,162,1149,1,0,0,0, - 164,1179,1,0,0,0,166,1181,1,0,0,0,168,1183,1,0,0,0,170,1193,1,0,0,0,172, - 1206,1,0,0,0,174,1216,1,0,0,0,176,1220,1,0,0,0,178,1223,1,0,0,0,180,1231, - 1,0,0,0,182,1236,1,0,0,0,184,1240,1,0,0,0,186,1242,1,0,0,0,188,1245,1, - 0,0,0,190,1258,1,0,0,0,192,1260,1,0,0,0,194,1267,1,0,0,0,196,1271,1,0, - 0,0,198,1283,1,0,0,0,200,1293,1,0,0,0,202,1299,1,0,0,0,204,1310,1,0,0, - 0,206,1322,1,0,0,0,208,1324,1,0,0,0,210,1335,1,0,0,0,212,1349,1,0,0,0, - 214,1355,1,0,0,0,216,1357,1,0,0,0,218,1364,1,0,0,0,220,1385,1,0,0,0,222, - 1387,1,0,0,0,224,1395,1,0,0,0,226,1404,1,0,0,0,228,1412,1,0,0,0,230,1426, - 1,0,0,0,232,1445,1,0,0,0,234,1462,1,0,0,0,236,1481,1,0,0,0,238,1484,1, - 0,0,0,240,1488,1,0,0,0,242,1490,1,0,0,0,244,1493,1,0,0,0,246,1497,1,0, - 0,0,248,1509,1,0,0,0,250,1520,1,0,0,0,252,1536,1,0,0,0,254,1559,1,0,0, - 0,256,1564,1,0,0,0,258,1584,1,0,0,0,260,1591,1,0,0,0,262,1600,1,0,0,0, - 264,1614,1,0,0,0,266,1633,1,0,0,0,268,1640,1,0,0,0,270,1645,1,0,0,0,272, - 1649,1,0,0,0,274,1651,1,0,0,0,276,1665,1,0,0,0,278,1676,1,0,0,0,280,1678, - 1,0,0,0,282,1708,1,0,0,0,284,1711,1,0,0,0,286,1715,1,0,0,0,288,1717,1, - 0,0,0,290,1723,1,0,0,0,292,1743,1,0,0,0,294,1745,1,0,0,0,296,1773,1,0, - 0,0,298,1776,1,0,0,0,300,1780,1,0,0,0,302,1782,1,0,0,0,304,1786,1,0,0, - 0,306,1789,1,0,0,0,308,1804,1,0,0,0,310,1825,1,0,0,0,312,1827,1,0,0,0, - 314,1829,1,0,0,0,316,1831,1,0,0,0,318,1834,1,0,0,0,320,1838,1,0,0,0,322, - 1842,1,0,0,0,324,1845,1,0,0,0,326,1859,1,0,0,0,328,1870,1,0,0,0,330,1872, - 1,0,0,0,332,1875,1,0,0,0,334,1881,1,0,0,0,336,1887,1,0,0,0,338,1897,1, - 0,0,0,340,1908,1,0,0,0,342,1923,1,0,0,0,344,1941,1,0,0,0,346,1943,1,0, - 0,0,348,1945,1,0,0,0,350,1962,1,0,0,0,352,1964,1,0,0,0,354,1974,1,0,0, - 0,356,1979,1,0,0,0,358,1984,1,0,0,0,360,1988,1,0,0,0,362,1996,1,0,0,0, - 364,2000,1,0,0,0,366,2015,1,0,0,0,368,2017,1,0,0,0,370,2023,1,0,0,0,372, - 2025,1,0,0,0,374,2032,1,0,0,0,376,2052,1,0,0,0,378,2105,1,0,0,0,380,2107, - 1,0,0,0,382,384,3,120,60,0,383,382,1,0,0,0,383,384,1,0,0,0,384,385,1, - 0,0,0,385,386,5,0,0,1,386,1,1,0,0,0,387,389,3,380,190,0,388,387,1,0,0, - 0,389,390,1,0,0,0,390,388,1,0,0,0,390,391,1,0,0,0,391,400,1,0,0,0,392, - 400,5,69,0,0,393,394,5,85,0,0,394,395,3,90,45,0,395,396,5,86,0,0,396, - 400,1,0,0,0,397,400,3,4,2,0,398,400,3,12,6,0,399,388,1,0,0,0,399,392, - 1,0,0,0,399,393,1,0,0,0,399,397,1,0,0,0,399,398,1,0,0,0,400,3,1,0,0,0, - 401,404,3,6,3,0,402,404,3,8,4,0,403,401,1,0,0,0,403,402,1,0,0,0,404,5, - 1,0,0,0,405,416,5,132,0,0,406,416,3,330,165,0,407,416,3,316,158,0,408, - 416,3,332,166,0,409,412,5,99,0,0,410,413,3,278,139,0,411,413,3,162,81, - 0,412,410,1,0,0,0,412,411,1,0,0,0,413,416,1,0,0,0,414,416,3,344,172,0, - 415,405,1,0,0,0,415,406,1,0,0,0,415,407,1,0,0,0,415,408,1,0,0,0,415,409, - 1,0,0,0,415,414,1,0,0,0,416,7,1,0,0,0,417,419,3,10,5,0,418,420,5,68,0, - 0,419,418,1,0,0,0,419,420,1,0,0,0,420,421,1,0,0,0,421,422,3,6,3,0,422, - 9,1,0,0,0,423,427,6,5,-1,0,424,428,3,160,80,0,425,428,3,184,92,0,426, - 428,3,162,81,0,427,424,1,0,0,0,427,425,1,0,0,0,427,426,1,0,0,0,427,428, - 1,0,0,0,428,429,1,0,0,0,429,430,5,127,0,0,430,442,1,0,0,0,431,437,10, - 1,0,0,432,438,5,132,0,0,433,435,5,68,0,0,434,433,1,0,0,0,434,435,1,0, - 0,0,435,436,1,0,0,0,436,438,3,342,171,0,437,432,1,0,0,0,437,434,1,0,0, - 0,438,439,1,0,0,0,439,441,5,127,0,0,440,431,1,0,0,0,441,444,1,0,0,0,442, - 440,1,0,0,0,442,443,1,0,0,0,443,11,1,0,0,0,444,442,1,0,0,0,445,447,3, - 14,7,0,446,448,3,28,14,0,447,446,1,0,0,0,447,448,1,0,0,0,448,449,1,0, - 0,0,449,450,3,100,50,0,450,13,1,0,0,0,451,453,5,87,0,0,452,454,3,16,8, - 0,453,452,1,0,0,0,453,454,1,0,0,0,454,455,1,0,0,0,455,456,5,88,0,0,456, - 15,1,0,0,0,457,464,3,20,10,0,458,461,3,18,9,0,459,460,5,122,0,0,460,462, - 3,20,10,0,461,459,1,0,0,0,461,462,1,0,0,0,462,464,1,0,0,0,463,457,1,0, - 0,0,463,458,1,0,0,0,464,17,1,0,0,0,465,466,7,0,0,0,466,19,1,0,0,0,467, - 472,3,22,11,0,468,469,5,122,0,0,469,471,3,22,11,0,470,468,1,0,0,0,471, - 474,1,0,0,0,472,470,1,0,0,0,472,473,1,0,0,0,473,476,1,0,0,0,474,472,1, - 0,0,0,475,477,5,131,0,0,476,475,1,0,0,0,476,477,1,0,0,0,477,21,1,0,0, - 0,478,481,3,24,12,0,479,481,3,26,13,0,480,478,1,0,0,0,480,479,1,0,0,0, - 481,23,1,0,0,0,482,484,5,97,0,0,483,482,1,0,0,0,483,484,1,0,0,0,484,485, - 1,0,0,0,485,488,5,132,0,0,486,488,5,69,0,0,487,483,1,0,0,0,487,486,1, - 0,0,0,488,25,1,0,0,0,489,491,5,97,0,0,490,489,1,0,0,0,490,491,1,0,0,0, - 491,492,1,0,0,0,492,493,5,132,0,0,493,494,3,268,134,0,494,27,1,0,0,0, - 495,497,5,85,0,0,496,498,3,258,129,0,497,496,1,0,0,0,497,498,1,0,0,0, - 498,499,1,0,0,0,499,501,5,86,0,0,500,502,5,47,0,0,501,500,1,0,0,0,501, - 502,1,0,0,0,502,504,1,0,0,0,503,505,3,370,185,0,504,503,1,0,0,0,504,505, - 1,0,0,0,505,507,1,0,0,0,506,508,3,204,102,0,507,506,1,0,0,0,507,508,1, - 0,0,0,508,510,1,0,0,0,509,511,3,234,117,0,510,509,1,0,0,0,510,511,1,0, - 0,0,511,29,1,0,0,0,512,513,6,15,-1,0,513,543,3,2,1,0,514,517,3,158,79, - 0,515,517,3,352,176,0,516,514,1,0,0,0,516,515,1,0,0,0,517,524,1,0,0,0, - 518,520,5,85,0,0,519,521,3,34,17,0,520,519,1,0,0,0,520,521,1,0,0,0,521, - 522,1,0,0,0,522,525,5,86,0,0,523,525,3,276,138,0,524,518,1,0,0,0,524, - 523,1,0,0,0,525,543,1,0,0,0,526,527,7,1,0,0,527,528,5,102,0,0,528,529, - 3,246,123,0,529,530,5,103,0,0,530,531,5,85,0,0,531,532,3,90,45,0,532, - 533,5,86,0,0,533,543,1,0,0,0,534,535,3,32,16,0,535,538,5,85,0,0,536,539, - 3,90,45,0,537,539,3,246,123,0,538,536,1,0,0,0,538,537,1,0,0,0,539,540, - 1,0,0,0,540,541,5,86,0,0,541,543,1,0,0,0,542,512,1,0,0,0,542,516,1,0, - 0,0,542,526,1,0,0,0,542,534,1,0,0,0,543,571,1,0,0,0,544,545,10,7,0,0, - 545,548,5,87,0,0,546,549,3,90,45,0,547,549,3,276,138,0,548,546,1,0,0, - 0,548,547,1,0,0,0,549,550,1,0,0,0,550,551,5,88,0,0,551,570,1,0,0,0,552, - 553,10,6,0,0,553,555,5,85,0,0,554,556,3,34,17,0,555,554,1,0,0,0,555,556, - 1,0,0,0,556,557,1,0,0,0,557,570,5,86,0,0,558,559,10,4,0,0,559,565,7,2, - 0,0,560,562,5,68,0,0,561,560,1,0,0,0,561,562,1,0,0,0,562,563,1,0,0,0, - 563,566,3,4,2,0,564,566,3,36,18,0,565,561,1,0,0,0,565,564,1,0,0,0,566, - 570,1,0,0,0,567,568,10,3,0,0,568,570,7,3,0,0,569,544,1,0,0,0,569,552, - 1,0,0,0,569,558,1,0,0,0,569,567,1,0,0,0,570,573,1,0,0,0,571,569,1,0,0, - 0,571,572,1,0,0,0,572,31,1,0,0,0,573,571,1,0,0,0,574,575,5,75,0,0,575, - 33,1,0,0,0,576,577,3,274,137,0,577,35,1,0,0,0,578,580,3,10,5,0,579,578, - 1,0,0,0,579,580,1,0,0,0,580,584,1,0,0,0,581,582,3,160,80,0,582,583,5, - 127,0,0,583,585,1,0,0,0,584,581,1,0,0,0,584,585,1,0,0,0,585,586,1,0,0, - 0,586,587,5,99,0,0,587,598,3,160,80,0,588,589,3,10,5,0,589,590,5,68,0, - 0,590,591,3,342,171,0,591,592,5,127,0,0,592,593,5,99,0,0,593,594,3,160, - 80,0,594,598,1,0,0,0,595,596,5,99,0,0,596,598,3,162,81,0,597,579,1,0, - 0,0,597,588,1,0,0,0,597,595,1,0,0,0,598,37,1,0,0,0,599,627,3,30,15,0, - 600,605,5,120,0,0,601,605,5,121,0,0,602,605,3,40,20,0,603,605,5,62,0, - 0,604,600,1,0,0,0,604,601,1,0,0,0,604,602,1,0,0,0,604,603,1,0,0,0,605, - 606,1,0,0,0,606,627,3,38,19,0,607,616,5,62,0,0,608,609,5,85,0,0,609,610, - 3,246,123,0,610,611,5,86,0,0,611,617,1,0,0,0,612,613,5,131,0,0,613,614, - 5,85,0,0,614,615,5,132,0,0,615,617,5,86,0,0,616,608,1,0,0,0,616,612,1, - 0,0,0,617,627,1,0,0,0,618,619,5,11,0,0,619,620,5,85,0,0,620,621,3,246, - 123,0,621,622,5,86,0,0,622,627,1,0,0,0,623,627,3,56,28,0,624,627,3,42, - 21,0,625,627,3,54,27,0,626,599,1,0,0,0,626,604,1,0,0,0,626,607,1,0,0, - 0,626,618,1,0,0,0,626,623,1,0,0,0,626,624,1,0,0,0,626,625,1,0,0,0,627, - 39,1,0,0,0,628,629,7,4,0,0,629,41,1,0,0,0,630,632,5,127,0,0,631,630,1, - 0,0,0,631,632,1,0,0,0,632,633,1,0,0,0,633,635,5,49,0,0,634,636,3,44,22, - 0,635,634,1,0,0,0,635,636,1,0,0,0,636,642,1,0,0,0,637,643,3,46,23,0,638, - 639,5,85,0,0,639,640,3,246,123,0,640,641,5,86,0,0,641,643,1,0,0,0,642, - 637,1,0,0,0,642,638,1,0,0,0,643,645,1,0,0,0,644,646,3,52,26,0,645,644, - 1,0,0,0,645,646,1,0,0,0,646,43,1,0,0,0,647,648,5,85,0,0,648,649,3,34, - 17,0,649,650,5,86,0,0,650,45,1,0,0,0,651,653,3,150,75,0,652,654,3,48, - 24,0,653,652,1,0,0,0,653,654,1,0,0,0,654,47,1,0,0,0,655,657,3,236,118, - 0,656,658,3,48,24,0,657,656,1,0,0,0,657,658,1,0,0,0,658,661,1,0,0,0,659, - 661,3,50,25,0,660,655,1,0,0,0,660,659,1,0,0,0,661,49,1,0,0,0,662,663, - 6,25,-1,0,663,664,5,87,0,0,664,665,3,90,45,0,665,667,5,88,0,0,666,668, - 3,204,102,0,667,666,1,0,0,0,667,668,1,0,0,0,668,678,1,0,0,0,669,670,10, - 1,0,0,670,671,5,87,0,0,671,672,3,92,46,0,672,674,5,88,0,0,673,675,3,204, - 102,0,674,673,1,0,0,0,674,675,1,0,0,0,675,677,1,0,0,0,676,669,1,0,0,0, - 677,680,1,0,0,0,678,676,1,0,0,0,678,679,1,0,0,0,679,51,1,0,0,0,680,678, - 1,0,0,0,681,683,5,85,0,0,682,684,3,34,17,0,683,682,1,0,0,0,683,684,1, - 0,0,0,684,685,1,0,0,0,685,688,5,86,0,0,686,688,3,276,138,0,687,681,1, - 0,0,0,687,686,1,0,0,0,688,53,1,0,0,0,689,691,5,127,0,0,690,689,1,0,0, - 0,690,691,1,0,0,0,691,692,1,0,0,0,692,695,5,28,0,0,693,694,5,87,0,0,694, - 696,5,88,0,0,695,693,1,0,0,0,695,696,1,0,0,0,696,697,1,0,0,0,697,698, - 3,58,29,0,698,55,1,0,0,0,699,700,5,50,0,0,700,701,5,85,0,0,701,702,3, - 90,45,0,702,703,5,86,0,0,703,57,1,0,0,0,704,711,3,38,19,0,705,706,5,85, - 0,0,706,707,3,246,123,0,707,708,5,86,0,0,708,709,3,58,29,0,709,711,1, - 0,0,0,710,704,1,0,0,0,710,705,1,0,0,0,711,59,1,0,0,0,712,717,3,58,29, - 0,713,714,7,5,0,0,714,716,3,58,29,0,715,713,1,0,0,0,716,719,1,0,0,0,717, - 715,1,0,0,0,717,718,1,0,0,0,718,61,1,0,0,0,719,717,1,0,0,0,720,725,3, - 60,30,0,721,722,7,6,0,0,722,724,3,60,30,0,723,721,1,0,0,0,724,727,1,0, - 0,0,725,723,1,0,0,0,725,726,1,0,0,0,726,63,1,0,0,0,727,725,1,0,0,0,728, - 733,3,62,31,0,729,730,7,7,0,0,730,732,3,62,31,0,731,729,1,0,0,0,732,735, - 1,0,0,0,733,731,1,0,0,0,733,734,1,0,0,0,734,65,1,0,0,0,735,733,1,0,0, - 0,736,742,3,64,32,0,737,738,3,68,34,0,738,739,3,64,32,0,739,741,1,0,0, - 0,740,737,1,0,0,0,741,744,1,0,0,0,742,740,1,0,0,0,742,743,1,0,0,0,743, - 67,1,0,0,0,744,742,1,0,0,0,745,746,5,103,0,0,746,750,5,103,0,0,747,748, - 5,102,0,0,748,750,5,102,0,0,749,745,1,0,0,0,749,747,1,0,0,0,750,69,1, - 0,0,0,751,756,3,66,33,0,752,753,7,8,0,0,753,755,3,66,33,0,754,752,1,0, - 0,0,755,758,1,0,0,0,756,754,1,0,0,0,756,757,1,0,0,0,757,71,1,0,0,0,758, - 756,1,0,0,0,759,764,3,70,35,0,760,761,7,9,0,0,761,763,3,70,35,0,762,760, - 1,0,0,0,763,766,1,0,0,0,764,762,1,0,0,0,764,765,1,0,0,0,765,73,1,0,0, - 0,766,764,1,0,0,0,767,772,3,72,36,0,768,769,5,97,0,0,769,771,3,72,36, - 0,770,768,1,0,0,0,771,774,1,0,0,0,772,770,1,0,0,0,772,773,1,0,0,0,773, - 75,1,0,0,0,774,772,1,0,0,0,775,780,3,74,37,0,776,777,5,96,0,0,777,779, - 3,74,37,0,778,776,1,0,0,0,779,782,1,0,0,0,780,778,1,0,0,0,780,781,1,0, - 0,0,781,77,1,0,0,0,782,780,1,0,0,0,783,788,3,76,38,0,784,785,5,98,0,0, - 785,787,3,76,38,0,786,784,1,0,0,0,787,790,1,0,0,0,788,786,1,0,0,0,788, - 789,1,0,0,0,789,79,1,0,0,0,790,788,1,0,0,0,791,796,3,78,39,0,792,793, - 5,118,0,0,793,795,3,78,39,0,794,792,1,0,0,0,795,798,1,0,0,0,796,794,1, - 0,0,0,796,797,1,0,0,0,797,81,1,0,0,0,798,796,1,0,0,0,799,804,3,80,40, - 0,800,801,5,119,0,0,801,803,3,80,40,0,802,800,1,0,0,0,803,806,1,0,0,0, - 804,802,1,0,0,0,804,805,1,0,0,0,805,83,1,0,0,0,806,804,1,0,0,0,807,813, - 3,82,41,0,808,809,5,125,0,0,809,810,3,90,45,0,810,811,5,126,0,0,811,812, - 3,86,43,0,812,814,1,0,0,0,813,808,1,0,0,0,813,814,1,0,0,0,814,85,1,0, - 0,0,815,822,3,84,42,0,816,817,3,82,41,0,817,818,3,88,44,0,818,819,3,272, - 136,0,819,822,1,0,0,0,820,822,3,368,184,0,821,815,1,0,0,0,821,816,1,0, - 0,0,821,820,1,0,0,0,822,87,1,0,0,0,823,824,7,10,0,0,824,89,1,0,0,0,825, - 830,3,86,43,0,826,827,5,122,0,0,827,829,3,86,43,0,828,826,1,0,0,0,829, - 832,1,0,0,0,830,828,1,0,0,0,830,831,1,0,0,0,831,91,1,0,0,0,832,830,1, - 0,0,0,833,834,3,84,42,0,834,93,1,0,0,0,835,849,3,96,48,0,836,849,3,118, - 59,0,837,839,3,204,102,0,838,837,1,0,0,0,838,839,1,0,0,0,839,846,1,0, - 0,0,840,847,3,98,49,0,841,847,3,100,50,0,842,847,3,104,52,0,843,847,3, - 108,54,0,844,847,3,116,58,0,845,847,3,358,179,0,846,840,1,0,0,0,846,841, - 1,0,0,0,846,842,1,0,0,0,846,843,1,0,0,0,846,844,1,0,0,0,846,845,1,0,0, - 0,847,849,1,0,0,0,848,835,1,0,0,0,848,836,1,0,0,0,848,838,1,0,0,0,849, - 95,1,0,0,0,850,852,3,204,102,0,851,850,1,0,0,0,851,852,1,0,0,0,852,857, - 1,0,0,0,853,858,5,132,0,0,854,855,5,16,0,0,855,858,3,92,46,0,856,858, - 5,27,0,0,857,853,1,0,0,0,857,854,1,0,0,0,857,856,1,0,0,0,858,859,1,0, - 0,0,859,860,5,126,0,0,860,861,3,94,47,0,861,97,1,0,0,0,862,864,3,90,45, - 0,863,862,1,0,0,0,863,864,1,0,0,0,864,865,1,0,0,0,865,866,5,128,0,0,866, - 99,1,0,0,0,867,869,5,89,0,0,868,870,3,102,51,0,869,868,1,0,0,0,869,870, - 1,0,0,0,870,871,1,0,0,0,871,872,5,90,0,0,872,101,1,0,0,0,873,875,3,94, - 47,0,874,873,1,0,0,0,875,876,1,0,0,0,876,874,1,0,0,0,876,877,1,0,0,0, - 877,103,1,0,0,0,878,879,5,43,0,0,879,880,5,85,0,0,880,881,3,106,53,0, - 881,882,5,86,0,0,882,885,3,94,47,0,883,884,5,32,0,0,884,886,3,94,47,0, - 885,883,1,0,0,0,885,886,1,0,0,0,886,894,1,0,0,0,887,888,5,67,0,0,888, - 889,5,85,0,0,889,890,3,106,53,0,890,891,5,86,0,0,891,892,3,94,47,0,892, - 894,1,0,0,0,893,878,1,0,0,0,893,887,1,0,0,0,894,105,1,0,0,0,895,907,3, - 90,45,0,896,898,3,204,102,0,897,896,1,0,0,0,897,898,1,0,0,0,898,899,1, - 0,0,0,899,900,3,138,69,0,900,904,3,226,113,0,901,902,5,101,0,0,902,905, - 3,272,136,0,903,905,3,276,138,0,904,901,1,0,0,0,904,903,1,0,0,0,905,907, - 1,0,0,0,906,895,1,0,0,0,906,897,1,0,0,0,907,107,1,0,0,0,908,909,5,84, - 0,0,909,910,5,85,0,0,910,911,3,106,53,0,911,912,5,86,0,0,912,913,3,94, - 47,0,913,942,1,0,0,0,914,915,5,29,0,0,915,916,3,94,47,0,916,917,5,84, - 0,0,917,918,5,85,0,0,918,919,3,90,45,0,919,920,5,86,0,0,920,921,5,128, - 0,0,921,942,1,0,0,0,922,923,5,40,0,0,923,936,5,85,0,0,924,926,3,110,55, - 0,925,927,3,106,53,0,926,925,1,0,0,0,926,927,1,0,0,0,927,928,1,0,0,0, - 928,930,5,128,0,0,929,931,3,90,45,0,930,929,1,0,0,0,930,931,1,0,0,0,931, - 937,1,0,0,0,932,933,3,112,56,0,933,934,5,126,0,0,934,935,3,114,57,0,935, - 937,1,0,0,0,936,924,1,0,0,0,936,932,1,0,0,0,937,938,1,0,0,0,938,939,5, - 86,0,0,939,940,3,94,47,0,940,942,1,0,0,0,941,908,1,0,0,0,941,914,1,0, - 0,0,941,922,1,0,0,0,942,109,1,0,0,0,943,946,3,98,49,0,944,946,3,128,64, - 0,945,943,1,0,0,0,945,944,1,0,0,0,946,111,1,0,0,0,947,949,3,204,102,0, - 948,947,1,0,0,0,948,949,1,0,0,0,949,950,1,0,0,0,950,951,3,138,69,0,951, - 952,3,226,113,0,952,113,1,0,0,0,953,956,3,90,45,0,954,956,3,276,138,0, - 955,953,1,0,0,0,955,954,1,0,0,0,956,115,1,0,0,0,957,967,5,15,0,0,958, - 967,5,25,0,0,959,962,5,59,0,0,960,963,3,90,45,0,961,963,3,276,138,0,962, - 960,1,0,0,0,962,961,1,0,0,0,962,963,1,0,0,0,963,967,1,0,0,0,964,965,5, - 42,0,0,965,967,5,132,0,0,966,957,1,0,0,0,966,958,1,0,0,0,966,959,1,0, - 0,0,966,964,1,0,0,0,967,968,1,0,0,0,968,969,5,128,0,0,969,117,1,0,0,0, - 970,971,3,124,62,0,971,119,1,0,0,0,972,974,3,122,61,0,973,972,1,0,0,0, - 974,975,1,0,0,0,975,973,1,0,0,0,975,976,1,0,0,0,976,121,1,0,0,0,977,987, - 3,124,62,0,978,987,3,264,132,0,979,987,3,334,167,0,980,987,3,354,177, - 0,981,987,3,356,178,0,982,987,3,202,101,0,983,987,3,188,94,0,984,987, - 3,132,66,0,985,987,3,134,67,0,986,977,1,0,0,0,986,978,1,0,0,0,986,979, - 1,0,0,0,986,980,1,0,0,0,986,981,1,0,0,0,986,982,1,0,0,0,986,983,1,0,0, - 0,986,984,1,0,0,0,986,985,1,0,0,0,987,123,1,0,0,0,988,997,3,128,64,0, - 989,997,3,200,100,0,990,997,3,192,96,0,991,997,3,196,98,0,992,997,3,198, - 99,0,993,997,3,130,65,0,994,997,3,126,63,0,995,997,3,172,86,0,996,988, - 1,0,0,0,996,989,1,0,0,0,996,990,1,0,0,0,996,991,1,0,0,0,996,992,1,0,0, - 0,996,993,1,0,0,0,996,994,1,0,0,0,996,995,1,0,0,0,997,125,1,0,0,0,998, - 999,5,79,0,0,999,1001,5,132,0,0,1000,1002,3,204,102,0,1001,1000,1,0,0, - 0,1001,1002,1,0,0,0,1002,1003,1,0,0,0,1003,1004,5,101,0,0,1004,1005,3, - 246,123,0,1005,1006,5,128,0,0,1006,127,1,0,0,0,1007,1009,3,138,69,0,1008, - 1007,1,0,0,0,1008,1009,1,0,0,0,1009,1011,1,0,0,0,1010,1012,3,222,111, - 0,1011,1010,1,0,0,0,1011,1012,1,0,0,0,1012,1013,1,0,0,0,1013,1022,5,128, - 0,0,1014,1016,3,204,102,0,1015,1017,3,138,69,0,1016,1015,1,0,0,0,1016, - 1017,1,0,0,0,1017,1018,1,0,0,0,1018,1019,3,222,111,0,1019,1020,5,128, - 0,0,1020,1022,1,0,0,0,1021,1008,1,0,0,0,1021,1014,1,0,0,0,1022,129,1, - 0,0,0,1023,1024,5,64,0,0,1024,1025,5,85,0,0,1025,1026,3,92,46,0,1026, - 1027,5,122,0,0,1027,1028,5,4,0,0,1028,1029,5,86,0,0,1029,1030,5,128,0, - 0,1030,131,1,0,0,0,1031,1032,5,128,0,0,1032,133,1,0,0,0,1033,1034,3,204, - 102,0,1034,1035,5,128,0,0,1035,135,1,0,0,0,1036,1043,3,140,70,0,1037, - 1043,3,146,73,0,1038,1043,3,142,71,0,1039,1043,5,41,0,0,1040,1043,5,74, - 0,0,1041,1043,5,23,0,0,1042,1036,1,0,0,0,1042,1037,1,0,0,0,1042,1038, - 1,0,0,0,1042,1039,1,0,0,0,1042,1040,1,0,0,0,1042,1041,1,0,0,0,1043,137, - 1,0,0,0,1044,1046,3,136,68,0,1045,1044,1,0,0,0,1046,1047,1,0,0,0,1047, - 1048,1,0,0,0,1047,1045,1,0,0,0,1048,1050,1,0,0,0,1049,1051,3,204,102, - 0,1050,1049,1,0,0,0,1050,1051,1,0,0,0,1051,139,1,0,0,0,1052,1053,7,11, - 0,0,1053,141,1,0,0,0,1054,1055,7,12,0,0,1055,143,1,0,0,0,1056,1057,5, - 132,0,0,1057,145,1,0,0,0,1058,1062,3,148,74,0,1059,1062,3,280,140,0,1060, - 1062,3,168,84,0,1061,1058,1,0,0,0,1061,1059,1,0,0,0,1061,1060,1,0,0,0, - 1062,147,1,0,0,0,1063,1068,3,158,79,0,1064,1068,3,164,82,0,1065,1068, - 3,352,176,0,1066,1068,3,240,120,0,1067,1063,1,0,0,0,1067,1064,1,0,0,0, - 1067,1065,1,0,0,0,1067,1066,1,0,0,0,1068,149,1,0,0,0,1069,1071,3,146, - 73,0,1070,1069,1,0,0,0,1071,1072,1,0,0,0,1072,1070,1,0,0,0,1072,1073, - 1,0,0,0,1073,1075,1,0,0,0,1074,1076,3,204,102,0,1075,1074,1,0,0,0,1075, - 1076,1,0,0,0,1076,151,1,0,0,0,1077,1079,3,148,74,0,1078,1077,1,0,0,0, - 1079,1080,1,0,0,0,1080,1078,1,0,0,0,1080,1081,1,0,0,0,1081,1083,1,0,0, - 0,1082,1084,3,204,102,0,1083,1082,1,0,0,0,1083,1084,1,0,0,0,1084,153, - 1,0,0,0,1085,1086,7,13,0,0,1086,155,1,0,0,0,1087,1088,7,14,0,0,1088,157, - 1,0,0,0,1089,1091,3,10,5,0,1090,1089,1,0,0,0,1090,1091,1,0,0,0,1091,1092, - 1,0,0,0,1092,1142,3,160,80,0,1093,1094,3,10,5,0,1094,1095,5,68,0,0,1095, - 1096,3,342,171,0,1096,1142,1,0,0,0,1097,1142,3,156,78,0,1098,1100,3,156, - 78,0,1099,1098,1,0,0,0,1099,1100,1,0,0,0,1100,1102,1,0,0,0,1101,1103, - 3,154,77,0,1102,1101,1,0,0,0,1103,1104,1,0,0,0,1104,1102,1,0,0,0,1104, - 1105,1,0,0,0,1105,1142,1,0,0,0,1106,1108,3,156,78,0,1107,1106,1,0,0,0, - 1107,1108,1,0,0,0,1108,1109,1,0,0,0,1109,1142,5,18,0,0,1110,1112,3,156, - 78,0,1111,1110,1,0,0,0,1111,1112,1,0,0,0,1112,1113,1,0,0,0,1113,1142, - 5,19,0,0,1114,1116,3,156,78,0,1115,1114,1,0,0,0,1115,1116,1,0,0,0,1116, - 1117,1,0,0,0,1117,1142,5,20,0,0,1118,1120,3,156,78,0,1119,1118,1,0,0, - 0,1119,1120,1,0,0,0,1120,1121,1,0,0,0,1121,1142,5,83,0,0,1122,1142,5, - 14,0,0,1123,1125,3,156,78,0,1124,1123,1,0,0,0,1124,1125,1,0,0,0,1125, - 1129,1,0,0,0,1126,1128,3,154,77,0,1127,1126,1,0,0,0,1128,1131,1,0,0,0, - 1129,1127,1,0,0,0,1129,1130,1,0,0,0,1130,1132,1,0,0,0,1131,1129,1,0,0, - 0,1132,1142,5,45,0,0,1133,1142,5,39,0,0,1134,1136,3,154,77,0,1135,1134, - 1,0,0,0,1135,1136,1,0,0,0,1136,1137,1,0,0,0,1137,1142,5,30,0,0,1138,1142, - 5,81,0,0,1139,1142,5,13,0,0,1140,1142,3,162,81,0,1141,1090,1,0,0,0,1141, - 1093,1,0,0,0,1141,1097,1,0,0,0,1141,1099,1,0,0,0,1141,1107,1,0,0,0,1141, - 1111,1,0,0,0,1141,1115,1,0,0,0,1141,1119,1,0,0,0,1141,1122,1,0,0,0,1141, - 1124,1,0,0,0,1141,1133,1,0,0,0,1141,1135,1,0,0,0,1141,1138,1,0,0,0,1141, - 1139,1,0,0,0,1141,1140,1,0,0,0,1142,159,1,0,0,0,1143,1148,3,278,139,0, - 1144,1148,3,166,83,0,1145,1148,3,144,72,0,1146,1148,3,342,171,0,1147, - 1143,1,0,0,0,1147,1144,1,0,0,0,1147,1145,1,0,0,0,1147,1146,1,0,0,0,1148, - 161,1,0,0,0,1149,1150,5,26,0,0,1150,1153,5,85,0,0,1151,1154,3,90,45,0, - 1152,1154,5,13,0,0,1153,1151,1,0,0,0,1153,1152,1,0,0,0,1154,1155,1,0, - 0,0,1155,1156,5,86,0,0,1156,163,1,0,0,0,1157,1172,3,288,144,0,1158,1160, - 3,204,102,0,1159,1158,1,0,0,0,1159,1160,1,0,0,0,1160,1162,1,0,0,0,1161, - 1163,3,10,5,0,1162,1161,1,0,0,0,1162,1163,1,0,0,0,1163,1164,1,0,0,0,1164, - 1173,5,132,0,0,1165,1173,3,342,171,0,1166,1168,3,10,5,0,1167,1169,5,68, - 0,0,1168,1167,1,0,0,0,1168,1169,1,0,0,0,1169,1170,1,0,0,0,1170,1171,3, - 342,171,0,1171,1173,1,0,0,0,1172,1159,1,0,0,0,1172,1165,1,0,0,0,1172, - 1166,1,0,0,0,1173,1180,1,0,0,0,1174,1176,5,33,0,0,1175,1177,3,10,5,0, - 1176,1175,1,0,0,0,1176,1177,1,0,0,0,1177,1178,1,0,0,0,1178,1180,5,132, - 0,0,1179,1157,1,0,0,0,1179,1174,1,0,0,0,1180,165,1,0,0,0,1181,1182,5, - 132,0,0,1182,167,1,0,0,0,1183,1184,3,170,85,0,1184,1189,5,89,0,0,1185, - 1187,3,178,89,0,1186,1188,5,122,0,0,1187,1186,1,0,0,0,1187,1188,1,0,0, - 0,1188,1190,1,0,0,0,1189,1185,1,0,0,0,1189,1190,1,0,0,0,1190,1191,1,0, - 0,0,1191,1192,5,90,0,0,1192,169,1,0,0,0,1193,1195,3,174,87,0,1194,1196, - 3,204,102,0,1195,1194,1,0,0,0,1195,1196,1,0,0,0,1196,1201,1,0,0,0,1197, - 1199,3,10,5,0,1198,1197,1,0,0,0,1198,1199,1,0,0,0,1199,1200,1,0,0,0,1200, - 1202,5,132,0,0,1201,1198,1,0,0,0,1201,1202,1,0,0,0,1202,1204,1,0,0,0, - 1203,1205,3,176,88,0,1204,1203,1,0,0,0,1204,1205,1,0,0,0,1205,171,1,0, - 0,0,1206,1208,3,174,87,0,1207,1209,3,204,102,0,1208,1207,1,0,0,0,1208, - 1209,1,0,0,0,1209,1210,1,0,0,0,1210,1212,5,132,0,0,1211,1213,3,176,88, - 0,1212,1211,1,0,0,0,1212,1213,1,0,0,0,1213,1214,1,0,0,0,1214,1215,5,128, - 0,0,1215,173,1,0,0,0,1216,1218,5,33,0,0,1217,1219,7,15,0,0,1218,1217, - 1,0,0,0,1218,1219,1,0,0,0,1219,175,1,0,0,0,1220,1221,5,126,0,0,1221,1222, - 3,150,75,0,1222,177,1,0,0,0,1223,1228,3,180,90,0,1224,1225,5,122,0,0, - 1225,1227,3,180,90,0,1226,1224,1,0,0,0,1227,1230,1,0,0,0,1228,1226,1, - 0,0,0,1228,1229,1,0,0,0,1229,179,1,0,0,0,1230,1228,1,0,0,0,1231,1234, - 3,182,91,0,1232,1233,5,101,0,0,1233,1235,3,92,46,0,1234,1232,1,0,0,0, - 1234,1235,1,0,0,0,1235,181,1,0,0,0,1236,1237,5,132,0,0,1237,183,1,0,0, - 0,1238,1241,3,186,93,0,1239,1241,3,190,95,0,1240,1238,1,0,0,0,1240,1239, - 1,0,0,0,1241,185,1,0,0,0,1242,1243,5,132,0,0,1243,187,1,0,0,0,1244,1246, - 5,44,0,0,1245,1244,1,0,0,0,1245,1246,1,0,0,0,1246,1247,1,0,0,0,1247,1250, - 5,48,0,0,1248,1251,5,132,0,0,1249,1251,3,186,93,0,1250,1248,1,0,0,0,1250, - 1249,1,0,0,0,1250,1251,1,0,0,0,1251,1252,1,0,0,0,1252,1254,5,89,0,0,1253, - 1255,3,120,60,0,1254,1253,1,0,0,0,1254,1255,1,0,0,0,1255,1256,1,0,0,0, - 1256,1257,5,90,0,0,1257,189,1,0,0,0,1258,1259,5,132,0,0,1259,191,1,0, - 0,0,1260,1261,5,48,0,0,1261,1262,5,132,0,0,1262,1263,5,101,0,0,1263,1264, - 3,194,97,0,1264,1265,5,128,0,0,1265,193,1,0,0,0,1266,1268,3,10,5,0,1267, - 1266,1,0,0,0,1267,1268,1,0,0,0,1268,1269,1,0,0,0,1269,1270,3,184,92,0, - 1270,195,1,0,0,0,1271,1277,5,79,0,0,1272,1274,5,76,0,0,1273,1272,1,0, - 0,0,1273,1274,1,0,0,0,1274,1275,1,0,0,0,1275,1278,3,10,5,0,1276,1278, - 5,127,0,0,1277,1273,1,0,0,0,1277,1276,1,0,0,0,1278,1279,1,0,0,0,1279, - 1280,3,6,3,0,1280,1281,5,128,0,0,1281,197,1,0,0,0,1282,1284,3,204,102, - 0,1283,1282,1,0,0,0,1283,1284,1,0,0,0,1284,1285,1,0,0,0,1285,1286,5,79, - 0,0,1286,1288,5,48,0,0,1287,1289,3,10,5,0,1288,1287,1,0,0,0,1288,1289, - 1,0,0,0,1289,1290,1,0,0,0,1290,1291,3,184,92,0,1291,1292,5,128,0,0,1292, - 199,1,0,0,0,1293,1294,5,12,0,0,1294,1295,5,85,0,0,1295,1296,5,4,0,0,1296, - 1297,5,86,0,0,1297,1298,5,128,0,0,1298,201,1,0,0,0,1299,1300,5,36,0,0, - 1300,1307,5,4,0,0,1301,1303,5,89,0,0,1302,1304,3,120,60,0,1303,1302,1, - 0,0,0,1303,1304,1,0,0,0,1304,1305,1,0,0,0,1305,1308,5,90,0,0,1306,1308, - 3,122,61,0,1307,1301,1,0,0,0,1307,1306,1,0,0,0,1308,203,1,0,0,0,1309, - 1311,3,206,103,0,1310,1309,1,0,0,0,1311,1312,1,0,0,0,1312,1310,1,0,0, - 0,1312,1313,1,0,0,0,1313,205,1,0,0,0,1314,1315,5,87,0,0,1315,1317,5,87, - 0,0,1316,1318,3,210,105,0,1317,1316,1,0,0,0,1317,1318,1,0,0,0,1318,1319, - 1,0,0,0,1319,1320,5,88,0,0,1320,1323,5,88,0,0,1321,1323,3,208,104,0,1322, - 1314,1,0,0,0,1322,1321,1,0,0,0,1323,207,1,0,0,0,1324,1325,5,10,0,0,1325, - 1328,5,85,0,0,1326,1329,3,246,123,0,1327,1329,3,92,46,0,1328,1326,1,0, - 0,0,1328,1327,1,0,0,0,1329,1331,1,0,0,0,1330,1332,5,131,0,0,1331,1330, - 1,0,0,0,1331,1332,1,0,0,0,1332,1333,1,0,0,0,1333,1334,5,86,0,0,1334,209, - 1,0,0,0,1335,1340,3,212,106,0,1336,1337,5,122,0,0,1337,1339,3,212,106, - 0,1338,1336,1,0,0,0,1339,1342,1,0,0,0,1340,1338,1,0,0,0,1340,1341,1,0, - 0,0,1341,1344,1,0,0,0,1342,1340,1,0,0,0,1343,1345,5,131,0,0,1344,1343, - 1,0,0,0,1344,1345,1,0,0,0,1345,211,1,0,0,0,1346,1347,3,214,107,0,1347, - 1348,5,127,0,0,1348,1350,1,0,0,0,1349,1346,1,0,0,0,1349,1350,1,0,0,0, - 1350,1351,1,0,0,0,1351,1353,5,132,0,0,1352,1354,3,216,108,0,1353,1352, - 1,0,0,0,1353,1354,1,0,0,0,1354,213,1,0,0,0,1355,1356,5,132,0,0,1356,215, - 1,0,0,0,1357,1359,5,85,0,0,1358,1360,3,218,109,0,1359,1358,1,0,0,0,1359, - 1360,1,0,0,0,1360,1361,1,0,0,0,1361,1362,5,86,0,0,1362,217,1,0,0,0,1363, - 1365,3,220,110,0,1364,1363,1,0,0,0,1365,1366,1,0,0,0,1366,1364,1,0,0, - 0,1366,1367,1,0,0,0,1367,219,1,0,0,0,1368,1369,5,85,0,0,1369,1370,3,218, - 109,0,1370,1371,5,86,0,0,1371,1386,1,0,0,0,1372,1373,5,87,0,0,1373,1374, - 3,218,109,0,1374,1375,5,88,0,0,1375,1386,1,0,0,0,1376,1377,5,89,0,0,1377, - 1378,3,218,109,0,1378,1379,5,90,0,0,1379,1386,1,0,0,0,1380,1382,8,16, - 0,0,1381,1380,1,0,0,0,1382,1383,1,0,0,0,1383,1381,1,0,0,0,1383,1384,1, - 0,0,0,1384,1386,1,0,0,0,1385,1368,1,0,0,0,1385,1372,1,0,0,0,1385,1376, - 1,0,0,0,1385,1381,1,0,0,0,1386,221,1,0,0,0,1387,1392,3,224,112,0,1388, - 1389,5,122,0,0,1389,1391,3,224,112,0,1390,1388,1,0,0,0,1391,1394,1,0, - 0,0,1392,1390,1,0,0,0,1392,1393,1,0,0,0,1393,223,1,0,0,0,1394,1392,1, - 0,0,0,1395,1397,3,226,113,0,1396,1398,3,268,134,0,1397,1396,1,0,0,0,1397, - 1398,1,0,0,0,1398,225,1,0,0,0,1399,1405,3,228,114,0,1400,1401,3,230,115, - 0,1401,1402,3,232,116,0,1402,1403,3,234,117,0,1403,1405,1,0,0,0,1404, - 1399,1,0,0,0,1404,1400,1,0,0,0,1405,227,1,0,0,0,1406,1408,3,236,118,0, - 1407,1409,5,22,0,0,1408,1407,1,0,0,0,1408,1409,1,0,0,0,1409,1411,1,0, - 0,0,1410,1406,1,0,0,0,1411,1414,1,0,0,0,1412,1410,1,0,0,0,1412,1413,1, - 0,0,0,1413,1415,1,0,0,0,1414,1412,1,0,0,0,1415,1416,3,230,115,0,1416, - 229,1,0,0,0,1417,1418,6,115,-1,0,1418,1420,3,244,122,0,1419,1421,3,204, - 102,0,1420,1419,1,0,0,0,1420,1421,1,0,0,0,1421,1427,1,0,0,0,1422,1423, - 5,85,0,0,1423,1424,3,228,114,0,1424,1425,5,86,0,0,1425,1427,1,0,0,0,1426, - 1417,1,0,0,0,1426,1422,1,0,0,0,1427,1442,1,0,0,0,1428,1438,10,2,0,0,1429, - 1439,3,232,116,0,1430,1432,5,87,0,0,1431,1433,3,92,46,0,1432,1431,1,0, - 0,0,1432,1433,1,0,0,0,1433,1434,1,0,0,0,1434,1436,5,88,0,0,1435,1437, - 3,204,102,0,1436,1435,1,0,0,0,1436,1437,1,0,0,0,1437,1439,1,0,0,0,1438, - 1429,1,0,0,0,1438,1430,1,0,0,0,1439,1441,1,0,0,0,1440,1428,1,0,0,0,1441, - 1444,1,0,0,0,1442,1440,1,0,0,0,1442,1443,1,0,0,0,1443,231,1,0,0,0,1444, - 1442,1,0,0,0,1445,1447,5,85,0,0,1446,1448,3,258,129,0,1447,1446,1,0,0, - 0,1447,1448,1,0,0,0,1448,1449,1,0,0,0,1449,1451,5,86,0,0,1450,1452,3, - 238,119,0,1451,1450,1,0,0,0,1451,1452,1,0,0,0,1452,1454,1,0,0,0,1453, - 1455,3,242,121,0,1454,1453,1,0,0,0,1454,1455,1,0,0,0,1455,1457,1,0,0, - 0,1456,1458,3,370,185,0,1457,1456,1,0,0,0,1457,1458,1,0,0,0,1458,1460, - 1,0,0,0,1459,1461,3,204,102,0,1460,1459,1,0,0,0,1460,1461,1,0,0,0,1461, - 233,1,0,0,0,1462,1463,5,124,0,0,1463,1465,3,152,76,0,1464,1466,3,248, - 124,0,1465,1464,1,0,0,0,1465,1466,1,0,0,0,1466,235,1,0,0,0,1467,1469, - 7,17,0,0,1468,1470,3,204,102,0,1469,1468,1,0,0,0,1469,1470,1,0,0,0,1470, - 1482,1,0,0,0,1471,1473,3,10,5,0,1472,1471,1,0,0,0,1472,1473,1,0,0,0,1473, - 1474,1,0,0,0,1474,1476,5,93,0,0,1475,1477,3,204,102,0,1476,1475,1,0,0, - 0,1476,1477,1,0,0,0,1477,1479,1,0,0,0,1478,1480,3,238,119,0,1479,1478, - 1,0,0,0,1479,1480,1,0,0,0,1480,1482,1,0,0,0,1481,1467,1,0,0,0,1481,1472, - 1,0,0,0,1482,237,1,0,0,0,1483,1485,3,240,120,0,1484,1483,1,0,0,0,1485, - 1486,1,0,0,0,1486,1484,1,0,0,0,1486,1487,1,0,0,0,1487,239,1,0,0,0,1488, - 1489,7,18,0,0,1489,241,1,0,0,0,1490,1491,7,17,0,0,1491,243,1,0,0,0,1492, - 1494,5,131,0,0,1493,1492,1,0,0,0,1493,1494,1,0,0,0,1494,1495,1,0,0,0, - 1495,1496,3,4,2,0,1496,245,1,0,0,0,1497,1499,3,150,75,0,1498,1500,3,248, - 124,0,1499,1498,1,0,0,0,1499,1500,1,0,0,0,1500,247,1,0,0,0,1501,1510, - 3,250,125,0,1502,1504,3,252,126,0,1503,1502,1,0,0,0,1503,1504,1,0,0,0, - 1504,1505,1,0,0,0,1505,1506,3,232,116,0,1506,1507,3,234,117,0,1507,1510, - 1,0,0,0,1508,1510,3,254,127,0,1509,1501,1,0,0,0,1509,1503,1,0,0,0,1509, - 1508,1,0,0,0,1510,249,1,0,0,0,1511,1521,3,252,126,0,1512,1514,3,236,118, - 0,1513,1512,1,0,0,0,1514,1515,1,0,0,0,1515,1513,1,0,0,0,1515,1516,1,0, - 0,0,1516,1518,1,0,0,0,1517,1519,3,252,126,0,1518,1517,1,0,0,0,1518,1519, - 1,0,0,0,1519,1521,1,0,0,0,1520,1511,1,0,0,0,1520,1513,1,0,0,0,1521,251, - 1,0,0,0,1522,1523,6,126,-1,0,1523,1537,3,232,116,0,1524,1526,5,87,0,0, - 1525,1527,3,92,46,0,1526,1525,1,0,0,0,1526,1527,1,0,0,0,1527,1528,1,0, - 0,0,1528,1530,5,88,0,0,1529,1531,3,204,102,0,1530,1529,1,0,0,0,1530,1531, - 1,0,0,0,1531,1537,1,0,0,0,1532,1533,5,85,0,0,1533,1534,3,250,125,0,1534, - 1535,5,86,0,0,1535,1537,1,0,0,0,1536,1522,1,0,0,0,1536,1524,1,0,0,0,1536, - 1532,1,0,0,0,1537,1553,1,0,0,0,1538,1549,10,4,0,0,1539,1550,3,232,116, - 0,1540,1541,3,252,126,0,1541,1543,5,87,0,0,1542,1544,3,92,46,0,1543,1542, - 1,0,0,0,1543,1544,1,0,0,0,1544,1545,1,0,0,0,1545,1547,5,88,0,0,1546,1548, - 3,204,102,0,1547,1546,1,0,0,0,1547,1548,1,0,0,0,1548,1550,1,0,0,0,1549, - 1539,1,0,0,0,1549,1540,1,0,0,0,1550,1552,1,0,0,0,1551,1538,1,0,0,0,1552, - 1555,1,0,0,0,1553,1551,1,0,0,0,1553,1554,1,0,0,0,1554,253,1,0,0,0,1555, - 1553,1,0,0,0,1556,1558,3,236,118,0,1557,1556,1,0,0,0,1558,1561,1,0,0, - 0,1559,1557,1,0,0,0,1559,1560,1,0,0,0,1560,1562,1,0,0,0,1561,1559,1,0, - 0,0,1562,1563,3,256,128,0,1563,255,1,0,0,0,1564,1565,6,128,-1,0,1565, - 1566,5,131,0,0,1566,1581,1,0,0,0,1567,1577,10,2,0,0,1568,1578,3,232,116, - 0,1569,1571,5,87,0,0,1570,1572,3,92,46,0,1571,1570,1,0,0,0,1571,1572, - 1,0,0,0,1572,1573,1,0,0,0,1573,1575,5,88,0,0,1574,1576,3,204,102,0,1575, - 1574,1,0,0,0,1575,1576,1,0,0,0,1576,1578,1,0,0,0,1577,1568,1,0,0,0,1577, - 1569,1,0,0,0,1578,1580,1,0,0,0,1579,1567,1,0,0,0,1580,1583,1,0,0,0,1581, - 1579,1,0,0,0,1581,1582,1,0,0,0,1582,257,1,0,0,0,1583,1581,1,0,0,0,1584, - 1589,3,260,130,0,1585,1587,5,122,0,0,1586,1585,1,0,0,0,1586,1587,1,0, - 0,0,1587,1588,1,0,0,0,1588,1590,5,131,0,0,1589,1586,1,0,0,0,1589,1590, - 1,0,0,0,1590,259,1,0,0,0,1591,1596,3,262,131,0,1592,1593,5,122,0,0,1593, - 1595,3,262,131,0,1594,1592,1,0,0,0,1595,1598,1,0,0,0,1596,1594,1,0,0, - 0,1596,1597,1,0,0,0,1597,261,1,0,0,0,1598,1596,1,0,0,0,1599,1601,3,204, - 102,0,1600,1599,1,0,0,0,1600,1601,1,0,0,0,1601,1602,1,0,0,0,1602,1607, - 3,138,69,0,1603,1608,3,226,113,0,1604,1606,3,248,124,0,1605,1604,1,0, - 0,0,1605,1606,1,0,0,0,1606,1608,1,0,0,0,1607,1603,1,0,0,0,1607,1605,1, - 0,0,0,1608,1611,1,0,0,0,1609,1610,5,101,0,0,1610,1612,3,272,136,0,1611, - 1609,1,0,0,0,1611,1612,1,0,0,0,1612,263,1,0,0,0,1613,1615,3,204,102,0, - 1614,1613,1,0,0,0,1614,1615,1,0,0,0,1615,1617,1,0,0,0,1616,1618,3,138, - 69,0,1617,1616,1,0,0,0,1617,1618,1,0,0,0,1618,1619,1,0,0,0,1619,1621, - 3,226,113,0,1620,1622,3,298,149,0,1621,1620,1,0,0,0,1621,1622,1,0,0,0, - 1622,1623,1,0,0,0,1623,1624,3,266,133,0,1624,265,1,0,0,0,1625,1627,3, - 322,161,0,1626,1625,1,0,0,0,1626,1627,1,0,0,0,1627,1628,1,0,0,0,1628, - 1634,3,100,50,0,1629,1634,3,360,180,0,1630,1631,5,101,0,0,1631,1632,7, - 19,0,0,1632,1634,5,128,0,0,1633,1626,1,0,0,0,1633,1629,1,0,0,0,1633,1630, - 1,0,0,0,1634,267,1,0,0,0,1635,1641,3,270,135,0,1636,1637,5,85,0,0,1637, - 1638,3,34,17,0,1638,1639,5,86,0,0,1639,1641,1,0,0,0,1640,1635,1,0,0,0, - 1640,1636,1,0,0,0,1641,269,1,0,0,0,1642,1643,5,101,0,0,1643,1646,3,272, - 136,0,1644,1646,3,276,138,0,1645,1642,1,0,0,0,1645,1644,1,0,0,0,1646, - 271,1,0,0,0,1647,1650,3,86,43,0,1648,1650,3,276,138,0,1649,1647,1,0,0, - 0,1649,1648,1,0,0,0,1650,273,1,0,0,0,1651,1653,3,272,136,0,1652,1654, - 5,131,0,0,1653,1652,1,0,0,0,1653,1654,1,0,0,0,1654,1662,1,0,0,0,1655, - 1656,5,122,0,0,1656,1658,3,272,136,0,1657,1659,5,131,0,0,1658,1657,1, - 0,0,0,1658,1659,1,0,0,0,1659,1661,1,0,0,0,1660,1655,1,0,0,0,1661,1664, - 1,0,0,0,1662,1660,1,0,0,0,1662,1663,1,0,0,0,1663,275,1,0,0,0,1664,1662, - 1,0,0,0,1665,1670,5,89,0,0,1666,1668,3,274,137,0,1667,1669,5,122,0,0, - 1668,1667,1,0,0,0,1668,1669,1,0,0,0,1669,1671,1,0,0,0,1670,1666,1,0,0, - 0,1670,1671,1,0,0,0,1671,1672,1,0,0,0,1672,1673,5,90,0,0,1673,277,1,0, - 0,0,1674,1677,5,132,0,0,1675,1677,3,342,171,0,1676,1674,1,0,0,0,1676, - 1675,1,0,0,0,1677,279,1,0,0,0,1678,1679,3,282,141,0,1679,1681,5,89,0, - 0,1680,1682,3,290,145,0,1681,1680,1,0,0,0,1681,1682,1,0,0,0,1682,1683, - 1,0,0,0,1683,1684,5,90,0,0,1684,281,1,0,0,0,1685,1687,3,288,144,0,1686, - 1688,3,204,102,0,1687,1686,1,0,0,0,1687,1688,1,0,0,0,1688,1693,1,0,0, - 0,1689,1691,3,284,142,0,1690,1692,3,286,143,0,1691,1690,1,0,0,0,1691, - 1692,1,0,0,0,1692,1694,1,0,0,0,1693,1689,1,0,0,0,1693,1694,1,0,0,0,1694, - 1696,1,0,0,0,1695,1697,3,304,152,0,1696,1695,1,0,0,0,1696,1697,1,0,0, - 0,1697,1709,1,0,0,0,1698,1700,5,77,0,0,1699,1701,3,204,102,0,1700,1699, - 1,0,0,0,1700,1701,1,0,0,0,1701,1706,1,0,0,0,1702,1704,3,284,142,0,1703, - 1705,3,286,143,0,1704,1703,1,0,0,0,1704,1705,1,0,0,0,1705,1707,1,0,0, - 0,1706,1702,1,0,0,0,1706,1707,1,0,0,0,1707,1709,1,0,0,0,1708,1685,1,0, - 0,0,1708,1698,1,0,0,0,1709,283,1,0,0,0,1710,1712,3,10,5,0,1711,1710,1, - 0,0,0,1711,1712,1,0,0,0,1712,1713,1,0,0,0,1713,1714,3,278,139,0,1714, - 285,1,0,0,0,1715,1716,5,38,0,0,1716,287,1,0,0,0,1717,1718,7,15,0,0,1718, - 289,1,0,0,0,1719,1724,3,292,146,0,1720,1721,3,314,157,0,1721,1722,5,126, - 0,0,1722,1724,1,0,0,0,1723,1719,1,0,0,0,1723,1720,1,0,0,0,1724,1725,1, - 0,0,0,1725,1723,1,0,0,0,1725,1726,1,0,0,0,1726,291,1,0,0,0,1727,1729, - 3,204,102,0,1728,1727,1,0,0,0,1728,1729,1,0,0,0,1729,1731,1,0,0,0,1730, - 1732,3,138,69,0,1731,1730,1,0,0,0,1731,1732,1,0,0,0,1732,1734,1,0,0,0, - 1733,1735,3,294,147,0,1734,1733,1,0,0,0,1734,1735,1,0,0,0,1735,1736,1, - 0,0,0,1736,1744,5,128,0,0,1737,1744,3,264,132,0,1738,1744,3,196,98,0, - 1739,1744,3,130,65,0,1740,1744,3,334,167,0,1741,1744,3,126,63,0,1742, - 1744,3,132,66,0,1743,1728,1,0,0,0,1743,1737,1,0,0,0,1743,1738,1,0,0,0, - 1743,1739,1,0,0,0,1743,1740,1,0,0,0,1743,1741,1,0,0,0,1743,1742,1,0,0, - 0,1744,293,1,0,0,0,1745,1750,3,296,148,0,1746,1747,5,122,0,0,1747,1749, - 3,296,148,0,1748,1746,1,0,0,0,1749,1752,1,0,0,0,1750,1748,1,0,0,0,1750, - 1751,1,0,0,0,1751,295,1,0,0,0,1752,1750,1,0,0,0,1753,1763,3,226,113,0, - 1754,1756,3,298,149,0,1755,1754,1,0,0,0,1755,1756,1,0,0,0,1756,1758,1, - 0,0,0,1757,1759,3,302,151,0,1758,1757,1,0,0,0,1758,1759,1,0,0,0,1759, - 1764,1,0,0,0,1760,1762,3,270,135,0,1761,1760,1,0,0,0,1761,1762,1,0,0, - 0,1762,1764,1,0,0,0,1763,1755,1,0,0,0,1763,1761,1,0,0,0,1764,1774,1,0, - 0,0,1765,1767,5,132,0,0,1766,1765,1,0,0,0,1766,1767,1,0,0,0,1767,1769, - 1,0,0,0,1768,1770,3,204,102,0,1769,1768,1,0,0,0,1769,1770,1,0,0,0,1770, - 1771,1,0,0,0,1771,1772,5,126,0,0,1772,1774,3,92,46,0,1773,1753,1,0,0, - 0,1773,1766,1,0,0,0,1774,297,1,0,0,0,1775,1777,3,300,150,0,1776,1775, - 1,0,0,0,1777,1778,1,0,0,0,1778,1776,1,0,0,0,1778,1779,1,0,0,0,1779,299, - 1,0,0,0,1780,1781,7,20,0,0,1781,301,1,0,0,0,1782,1783,5,101,0,0,1783, - 1784,5,134,0,0,1784,1785,6,151,-1,0,1785,303,1,0,0,0,1786,1787,5,126, - 0,0,1787,1788,3,306,153,0,1788,305,1,0,0,0,1789,1791,3,308,154,0,1790, - 1792,5,131,0,0,1791,1790,1,0,0,0,1791,1792,1,0,0,0,1792,1800,1,0,0,0, - 1793,1794,5,122,0,0,1794,1796,3,308,154,0,1795,1797,5,131,0,0,1796,1795, - 1,0,0,0,1796,1797,1,0,0,0,1797,1799,1,0,0,0,1798,1793,1,0,0,0,1799,1802, - 1,0,0,0,1800,1798,1,0,0,0,1800,1801,1,0,0,0,1801,307,1,0,0,0,1802,1800, - 1,0,0,0,1803,1805,3,204,102,0,1804,1803,1,0,0,0,1804,1805,1,0,0,0,1805, - 1818,1,0,0,0,1806,1819,3,312,156,0,1807,1809,5,80,0,0,1808,1810,3,314, - 157,0,1809,1808,1,0,0,0,1809,1810,1,0,0,0,1810,1811,1,0,0,0,1811,1819, - 3,312,156,0,1812,1814,3,314,157,0,1813,1815,5,80,0,0,1814,1813,1,0,0, - 0,1814,1815,1,0,0,0,1815,1816,1,0,0,0,1816,1817,3,312,156,0,1817,1819, - 1,0,0,0,1818,1806,1,0,0,0,1818,1807,1,0,0,0,1818,1812,1,0,0,0,1819,309, - 1,0,0,0,1820,1822,3,10,5,0,1821,1820,1,0,0,0,1821,1822,1,0,0,0,1822,1823, - 1,0,0,0,1823,1826,3,278,139,0,1824,1826,3,162,81,0,1825,1821,1,0,0,0, - 1825,1824,1,0,0,0,1826,311,1,0,0,0,1827,1828,3,310,155,0,1828,313,1,0, - 0,0,1829,1830,7,21,0,0,1830,315,1,0,0,0,1831,1832,5,52,0,0,1832,1833, - 3,318,159,0,1833,317,1,0,0,0,1834,1836,3,150,75,0,1835,1837,3,320,160, - 0,1836,1835,1,0,0,0,1836,1837,1,0,0,0,1837,319,1,0,0,0,1838,1840,3,236, - 118,0,1839,1841,3,320,160,0,1840,1839,1,0,0,0,1840,1841,1,0,0,0,1841, - 321,1,0,0,0,1842,1843,5,126,0,0,1843,1844,3,324,162,0,1844,323,1,0,0, - 0,1845,1847,3,326,163,0,1846,1848,5,131,0,0,1847,1846,1,0,0,0,1847,1848, - 1,0,0,0,1848,1856,1,0,0,0,1849,1850,5,122,0,0,1850,1852,3,326,163,0,1851, - 1853,5,131,0,0,1852,1851,1,0,0,0,1852,1853,1,0,0,0,1853,1855,1,0,0,0, - 1854,1849,1,0,0,0,1855,1858,1,0,0,0,1856,1854,1,0,0,0,1856,1857,1,0,0, - 0,1857,325,1,0,0,0,1858,1856,1,0,0,0,1859,1866,3,328,164,0,1860,1862, - 5,85,0,0,1861,1863,3,34,17,0,1862,1861,1,0,0,0,1862,1863,1,0,0,0,1863, - 1864,1,0,0,0,1864,1867,5,86,0,0,1865,1867,3,276,138,0,1866,1860,1,0,0, - 0,1866,1865,1,0,0,0,1867,327,1,0,0,0,1868,1871,3,310,155,0,1869,1871, - 5,132,0,0,1870,1868,1,0,0,0,1870,1869,1,0,0,0,1871,329,1,0,0,0,1872,1873, - 5,52,0,0,1873,1874,3,378,189,0,1874,331,1,0,0,0,1875,1879,5,52,0,0,1876, - 1877,5,4,0,0,1877,1880,5,132,0,0,1878,1880,5,140,0,0,1879,1876,1,0,0, - 0,1879,1878,1,0,0,0,1880,333,1,0,0,0,1881,1882,5,68,0,0,1882,1883,5,102, - 0,0,1883,1884,3,336,168,0,1884,1885,5,103,0,0,1885,1886,3,122,61,0,1886, - 335,1,0,0,0,1887,1892,3,338,169,0,1888,1889,5,122,0,0,1889,1891,3,338, - 169,0,1890,1888,1,0,0,0,1891,1894,1,0,0,0,1892,1890,1,0,0,0,1892,1893, - 1,0,0,0,1893,337,1,0,0,0,1894,1892,1,0,0,0,1895,1898,3,340,170,0,1896, - 1898,3,262,131,0,1897,1895,1,0,0,0,1897,1896,1,0,0,0,1898,339,1,0,0,0, - 1899,1900,5,68,0,0,1900,1901,5,102,0,0,1901,1902,3,336,168,0,1902,1903, - 5,103,0,0,1903,1905,1,0,0,0,1904,1899,1,0,0,0,1904,1905,1,0,0,0,1905, - 1906,1,0,0,0,1906,1909,5,21,0,0,1907,1909,5,76,0,0,1908,1904,1,0,0,0, - 1908,1907,1,0,0,0,1909,1921,1,0,0,0,1910,1912,5,131,0,0,1911,1910,1,0, - 0,0,1911,1912,1,0,0,0,1912,1914,1,0,0,0,1913,1915,5,132,0,0,1914,1913, - 1,0,0,0,1914,1915,1,0,0,0,1915,1922,1,0,0,0,1916,1918,5,132,0,0,1917, - 1916,1,0,0,0,1917,1918,1,0,0,0,1918,1919,1,0,0,0,1919,1920,5,101,0,0, - 1920,1922,3,246,123,0,1921,1911,1,0,0,0,1921,1917,1,0,0,0,1922,341,1, - 0,0,0,1923,1924,3,346,173,0,1924,1926,5,102,0,0,1925,1927,3,348,174,0, - 1926,1925,1,0,0,0,1926,1927,1,0,0,0,1927,1928,1,0,0,0,1928,1929,5,103, - 0,0,1929,343,1,0,0,0,1930,1942,3,342,171,0,1931,1934,3,330,165,0,1932, - 1934,3,332,166,0,1933,1931,1,0,0,0,1933,1932,1,0,0,0,1934,1935,1,0,0, - 0,1935,1937,5,102,0,0,1936,1938,3,348,174,0,1937,1936,1,0,0,0,1937,1938, - 1,0,0,0,1938,1939,1,0,0,0,1939,1940,5,103,0,0,1940,1942,1,0,0,0,1941, - 1930,1,0,0,0,1941,1933,1,0,0,0,1942,345,1,0,0,0,1943,1944,5,132,0,0,1944, - 347,1,0,0,0,1945,1947,3,350,175,0,1946,1948,5,131,0,0,1947,1946,1,0,0, - 0,1947,1948,1,0,0,0,1948,1956,1,0,0,0,1949,1950,5,122,0,0,1950,1952,3, - 350,175,0,1951,1953,5,131,0,0,1952,1951,1,0,0,0,1952,1953,1,0,0,0,1953, - 1955,1,0,0,0,1954,1949,1,0,0,0,1955,1958,1,0,0,0,1956,1954,1,0,0,0,1956, - 1957,1,0,0,0,1957,349,1,0,0,0,1958,1956,1,0,0,0,1959,1963,3,246,123,0, - 1960,1963,3,92,46,0,1961,1963,3,4,2,0,1962,1959,1,0,0,0,1962,1960,1,0, - 0,0,1962,1961,1,0,0,0,1963,351,1,0,0,0,1964,1965,5,76,0,0,1965,1971,3, - 10,5,0,1966,1972,5,132,0,0,1967,1969,5,68,0,0,1968,1967,1,0,0,0,1968, - 1969,1,0,0,0,1969,1970,1,0,0,0,1970,1972,3,342,171,0,1971,1966,1,0,0, - 0,1971,1968,1,0,0,0,1972,353,1,0,0,0,1973,1975,5,36,0,0,1974,1973,1,0, - 0,0,1974,1975,1,0,0,0,1975,1976,1,0,0,0,1976,1977,5,68,0,0,1977,1978, - 3,122,61,0,1978,355,1,0,0,0,1979,1980,5,68,0,0,1980,1981,5,102,0,0,1981, - 1982,5,103,0,0,1982,1983,3,122,61,0,1983,357,1,0,0,0,1984,1985,5,73,0, - 0,1985,1986,3,100,50,0,1986,1987,3,362,181,0,1987,359,1,0,0,0,1988,1990, - 5,73,0,0,1989,1991,3,322,161,0,1990,1989,1,0,0,0,1990,1991,1,0,0,0,1991, - 1992,1,0,0,0,1992,1993,3,100,50,0,1993,1994,3,362,181,0,1994,361,1,0, - 0,0,1995,1997,3,364,182,0,1996,1995,1,0,0,0,1997,1998,1,0,0,0,1998,1996, - 1,0,0,0,1998,1999,1,0,0,0,1999,363,1,0,0,0,2000,2001,5,17,0,0,2001,2002, - 5,85,0,0,2002,2003,3,366,183,0,2003,2004,5,86,0,0,2004,2005,3,100,50, - 0,2005,365,1,0,0,0,2006,2008,3,204,102,0,2007,2006,1,0,0,0,2007,2008, - 1,0,0,0,2008,2009,1,0,0,0,2009,2012,3,150,75,0,2010,2013,3,226,113,0, - 2011,2013,3,248,124,0,2012,2010,1,0,0,0,2012,2011,1,0,0,0,2012,2013,1, - 0,0,0,2013,2016,1,0,0,0,2014,2016,5,131,0,0,2015,2007,1,0,0,0,2015,2014, - 1,0,0,0,2016,367,1,0,0,0,2017,2019,5,71,0,0,2018,2020,3,86,43,0,2019, - 2018,1,0,0,0,2019,2020,1,0,0,0,2020,369,1,0,0,0,2021,2024,3,372,186,0, - 2022,2024,3,376,188,0,2023,2021,1,0,0,0,2023,2022,1,0,0,0,2024,371,1, - 0,0,0,2025,2026,5,71,0,0,2026,2028,5,85,0,0,2027,2029,3,374,187,0,2028, - 2027,1,0,0,0,2028,2029,1,0,0,0,2029,2030,1,0,0,0,2030,2031,5,86,0,0,2031, - 373,1,0,0,0,2032,2034,3,246,123,0,2033,2035,5,131,0,0,2034,2033,1,0,0, - 0,2034,2035,1,0,0,0,2035,2043,1,0,0,0,2036,2037,5,122,0,0,2037,2039,3, - 246,123,0,2038,2040,5,131,0,0,2039,2038,1,0,0,0,2039,2040,1,0,0,0,2040, - 2042,1,0,0,0,2041,2036,1,0,0,0,2042,2045,1,0,0,0,2043,2041,1,0,0,0,2043, - 2044,1,0,0,0,2044,375,1,0,0,0,2045,2043,1,0,0,0,2046,2047,5,50,0,0,2047, - 2048,5,85,0,0,2048,2049,3,92,46,0,2049,2050,5,86,0,0,2050,2053,1,0,0, - 0,2051,2053,5,50,0,0,2052,2046,1,0,0,0,2052,2051,1,0,0,0,2053,377,1,0, - 0,0,2054,2057,5,49,0,0,2055,2056,5,87,0,0,2056,2058,5,88,0,0,2057,2055, - 1,0,0,0,2057,2058,1,0,0,0,2058,2106,1,0,0,0,2059,2062,5,28,0,0,2060,2061, - 5,87,0,0,2061,2063,5,88,0,0,2062,2060,1,0,0,0,2062,2063,1,0,0,0,2063, - 2106,1,0,0,0,2064,2106,5,91,0,0,2065,2106,5,92,0,0,2066,2106,5,93,0,0, - 2067,2106,5,94,0,0,2068,2106,5,95,0,0,2069,2106,5,96,0,0,2070,2106,5, - 97,0,0,2071,2106,5,98,0,0,2072,2106,5,99,0,0,2073,2106,5,100,0,0,2074, - 2106,5,101,0,0,2075,2106,5,103,0,0,2076,2106,5,102,0,0,2077,2106,5,117, - 0,0,2078,2106,5,104,0,0,2079,2106,5,105,0,0,2080,2106,5,106,0,0,2081, - 2106,5,108,0,0,2082,2106,5,109,0,0,2083,2106,5,110,0,0,2084,2106,5,111, - 0,0,2085,2086,5,102,0,0,2086,2106,5,102,0,0,2087,2088,5,103,0,0,2088, - 2106,5,103,0,0,2089,2106,5,113,0,0,2090,2106,5,112,0,0,2091,2106,5,114, - 0,0,2092,2106,5,115,0,0,2093,2106,5,116,0,0,2094,2106,5,118,0,0,2095, - 2106,5,119,0,0,2096,2106,5,120,0,0,2097,2106,5,121,0,0,2098,2106,5,122, - 0,0,2099,2106,5,123,0,0,2100,2106,5,124,0,0,2101,2102,5,85,0,0,2102,2106, - 5,86,0,0,2103,2104,5,87,0,0,2104,2106,5,88,0,0,2105,2054,1,0,0,0,2105, - 2059,1,0,0,0,2105,2064,1,0,0,0,2105,2065,1,0,0,0,2105,2066,1,0,0,0,2105, - 2067,1,0,0,0,2105,2068,1,0,0,0,2105,2069,1,0,0,0,2105,2070,1,0,0,0,2105, - 2071,1,0,0,0,2105,2072,1,0,0,0,2105,2073,1,0,0,0,2105,2074,1,0,0,0,2105, - 2075,1,0,0,0,2105,2076,1,0,0,0,2105,2077,1,0,0,0,2105,2078,1,0,0,0,2105, - 2079,1,0,0,0,2105,2080,1,0,0,0,2105,2081,1,0,0,0,2105,2082,1,0,0,0,2105, - 2083,1,0,0,0,2105,2084,1,0,0,0,2105,2085,1,0,0,0,2105,2087,1,0,0,0,2105, - 2089,1,0,0,0,2105,2090,1,0,0,0,2105,2091,1,0,0,0,2105,2092,1,0,0,0,2105, - 2093,1,0,0,0,2105,2094,1,0,0,0,2105,2095,1,0,0,0,2105,2096,1,0,0,0,2105, - 2097,1,0,0,0,2105,2098,1,0,0,0,2105,2099,1,0,0,0,2105,2100,1,0,0,0,2105, - 2101,1,0,0,0,2105,2103,1,0,0,0,2106,379,1,0,0,0,2107,2108,7,22,0,0,2108, - 381,1,0,0,0,306,383,390,399,403,412,415,419,427,434,437,442,447,453,461, - 463,472,476,480,483,487,490,497,501,504,507,510,516,520,524,538,542,548, - 555,561,565,569,571,579,584,597,604,616,626,631,635,642,645,653,657,660, - 667,674,678,683,687,690,695,710,717,725,733,742,749,756,764,772,780,788, - 796,804,813,821,830,838,846,848,851,857,863,869,876,885,893,897,904,906, - 926,930,936,941,945,948,955,962,966,975,986,996,1001,1008,1011,1016,1021, - 1042,1047,1050,1061,1067,1072,1075,1080,1083,1090,1099,1104,1107,1111, - 1115,1119,1124,1129,1135,1141,1147,1153,1159,1162,1168,1172,1176,1179, - 1187,1189,1195,1198,1201,1204,1208,1212,1218,1228,1234,1240,1245,1250, - 1254,1267,1273,1277,1283,1288,1303,1307,1312,1317,1322,1328,1331,1340, - 1344,1349,1353,1359,1366,1383,1385,1392,1397,1404,1408,1412,1420,1426, - 1432,1436,1438,1442,1447,1451,1454,1457,1460,1465,1469,1472,1476,1479, - 1481,1486,1493,1499,1503,1509,1515,1518,1520,1526,1530,1536,1543,1547, - 1549,1553,1559,1571,1575,1577,1581,1586,1589,1596,1600,1605,1607,1611, - 1614,1617,1621,1626,1633,1640,1645,1649,1653,1658,1662,1668,1670,1676, - 1681,1687,1691,1693,1696,1700,1704,1706,1708,1711,1723,1725,1728,1731, - 1734,1743,1750,1755,1758,1761,1763,1766,1769,1773,1778,1791,1796,1800, - 1804,1809,1814,1818,1821,1825,1836,1840,1847,1852,1856,1862,1866,1870, - 1879,1892,1897,1904,1908,1911,1914,1917,1921,1926,1933,1937,1941,1947, - 1952,1956,1962,1968,1971,1974,1990,1998,2007,2012,2015,2019,2023,2028, - 2034,2039,2043,2052,2057,2062,2105 - }; - staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); - - antlr4::atn::ATNDeserializer deserializer; - staticData->atn = deserializer.deserialize(staticData->serializedATN); - - const size_t count = staticData->atn->getNumberOfDecisions(); - staticData->decisionToDFA.reserve(count); - for (size_t i = 0; i < count; i++) { - staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); - } - cpp14parserParserStaticData = staticData.release(); -} - -} - -CPP14Parser::CPP14Parser(TokenStream *input) : CPP14Parser(input, antlr4::atn::ParserATNSimulatorOptions()) {} - -CPP14Parser::CPP14Parser(TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options) : Parser(input) { - CPP14Parser::initialize(); - _interpreter = new atn::ParserATNSimulator(this, *cpp14parserParserStaticData->atn, cpp14parserParserStaticData->decisionToDFA, cpp14parserParserStaticData->sharedContextCache, options); -} - -CPP14Parser::~CPP14Parser() { - delete _interpreter; -} - -const atn::ATN& CPP14Parser::getATN() const { - return *cpp14parserParserStaticData->atn; -} - -std::string CPP14Parser::getGrammarFileName() const { - return "CPP14Parser.g4"; -} - -const std::vector& CPP14Parser::getRuleNames() const { - return cpp14parserParserStaticData->ruleNames; -} - -const dfa::Vocabulary& CPP14Parser::getVocabulary() const { - return cpp14parserParserStaticData->vocabulary; -} - -antlr4::atn::SerializedATNView CPP14Parser::getSerializedATN() const { - return cpp14parserParserStaticData->serializedATN; -} - - -//----------------- TranslationUnitContext ------------------------------------------------------------------ - -CPP14Parser::TranslationUnitContext::TranslationUnitContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TranslationUnitContext::EOF() { - return getToken(CPP14Parser::EOF, 0); -} - -CPP14Parser::DeclarationseqContext* CPP14Parser::TranslationUnitContext::declarationseq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TranslationUnitContext::getRuleIndex() const { - return CPP14Parser::RuleTranslationUnit; -} - - -CPP14Parser::TranslationUnitContext* CPP14Parser::translationUnit() { - TranslationUnitContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 0, CPP14Parser::RuleTranslationUnit); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(383); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { - setState(382); - declarationseq(); - } - setState(385); - match(CPP14Parser::EOF); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PrimaryExpressionContext ------------------------------------------------------------------ - -CPP14Parser::PrimaryExpressionContext::PrimaryExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::PrimaryExpressionContext::literal() { - return getRuleContexts(); -} - -CPP14Parser::LiteralContext* CPP14Parser::PrimaryExpressionContext::literal(size_t i) { - return getRuleContext(i); -} - -tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::This() { - return getToken(CPP14Parser::This, 0); -} - -tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::PrimaryExpressionContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PrimaryExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::IdExpressionContext* CPP14Parser::PrimaryExpressionContext::idExpression() { - return getRuleContext(0); -} - -CPP14Parser::LambdaExpressionContext* CPP14Parser::PrimaryExpressionContext::lambdaExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::PrimaryExpressionContext::getRuleIndex() const { - return CPP14Parser::RulePrimaryExpression; -} - - -CPP14Parser::PrimaryExpressionContext* CPP14Parser::primaryExpression() { - PrimaryExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 2, CPP14Parser::RulePrimaryExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - setState(399); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: { - enterOuterAlt(_localctx, 1); - setState(388); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(387); - literal(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(390); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 1, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - break; - } - - case CPP14Parser::This: { - enterOuterAlt(_localctx, 2); - setState(392); - match(CPP14Parser::This); - break; - } - - case CPP14Parser::LeftParen: { - enterOuterAlt(_localctx, 3); - setState(393); - match(CPP14Parser::LeftParen); - setState(394); - expression(); - setState(395); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::Decltype: - case CPP14Parser::Operator: - case CPP14Parser::Tilde: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 4); - setState(397); - idExpression(); - break; - } - - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 5); - setState(398); - lambdaExpression(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- IdExpressionContext ------------------------------------------------------------------ - -CPP14Parser::IdExpressionContext::IdExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::UnqualifiedIdContext* CPP14Parser::IdExpressionContext::unqualifiedId() { - return getRuleContext(0); -} - -CPP14Parser::QualifiedIdContext* CPP14Parser::IdExpressionContext::qualifiedId() { - return getRuleContext(0); -} - - -size_t CPP14Parser::IdExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleIdExpression; -} - - -CPP14Parser::IdExpressionContext* CPP14Parser::idExpression() { - IdExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 4, CPP14Parser::RuleIdExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(403); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 3, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(401); - unqualifiedId(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(402); - qualifiedId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- UnqualifiedIdContext ------------------------------------------------------------------ - -CPP14Parser::UnqualifiedIdContext::UnqualifiedIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::UnqualifiedIdContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::OperatorFunctionIdContext* CPP14Parser::UnqualifiedIdContext::operatorFunctionId() { - return getRuleContext(0); -} - -CPP14Parser::ConversionFunctionIdContext* CPP14Parser::UnqualifiedIdContext::conversionFunctionId() { - return getRuleContext(0); -} - -CPP14Parser::LiteralOperatorIdContext* CPP14Parser::UnqualifiedIdContext::literalOperatorId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UnqualifiedIdContext::Tilde() { - return getToken(CPP14Parser::Tilde, 0); -} - -CPP14Parser::ClassNameContext* CPP14Parser::UnqualifiedIdContext::className() { - return getRuleContext(0); -} - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::UnqualifiedIdContext::decltypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::TemplateIdContext* CPP14Parser::UnqualifiedIdContext::templateId() { - return getRuleContext(0); -} - - -size_t CPP14Parser::UnqualifiedIdContext::getRuleIndex() const { - return CPP14Parser::RuleUnqualifiedId; -} - - -CPP14Parser::UnqualifiedIdContext* CPP14Parser::unqualifiedId() { - UnqualifiedIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 6, CPP14Parser::RuleUnqualifiedId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(415); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 5, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(405); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(406); - operatorFunctionId(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(407); - conversionFunctionId(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(408); - literalOperatorId(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(409); - match(CPP14Parser::Tilde); - setState(412); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Identifier: { - setState(410); - className(); - break; - } - - case CPP14Parser::Decltype: { - setState(411); - decltypeSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(414); - templateId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- QualifiedIdContext ------------------------------------------------------------------ - -CPP14Parser::QualifiedIdContext::QualifiedIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::QualifiedIdContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::UnqualifiedIdContext* CPP14Parser::QualifiedIdContext::unqualifiedId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::QualifiedIdContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - - -size_t CPP14Parser::QualifiedIdContext::getRuleIndex() const { - return CPP14Parser::RuleQualifiedId; -} - - -CPP14Parser::QualifiedIdContext* CPP14Parser::qualifiedId() { - QualifiedIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 8, CPP14Parser::RuleQualifiedId); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(417); - nestedNameSpecifier(0); - setState(419); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(418); - match(CPP14Parser::Template); - } - setState(421); - unqualifiedId(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NestedNameSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::NestedNameSpecifierContext::NestedNameSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -CPP14Parser::TheTypeNameContext* CPP14Parser::NestedNameSpecifierContext::theTypeName() { - return getRuleContext(0); -} - -CPP14Parser::NamespaceNameContext* CPP14Parser::NestedNameSpecifierContext::namespaceName() { - return getRuleContext(0); -} - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::NestedNameSpecifierContext::decltypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::NestedNameSpecifierContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::NestedNameSpecifierContext::simpleTemplateId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NestedNameSpecifierContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - - -size_t CPP14Parser::NestedNameSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleNestedNameSpecifier; -} - - - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::nestedNameSpecifier() { - return nestedNameSpecifier(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::nestedNameSpecifier(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::NestedNameSpecifierContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::NestedNameSpecifierContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 10; - enterRecursionRule(_localctx, 10, CPP14Parser::RuleNestedNameSpecifier, precedence); - - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(427); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 7, _ctx)) { - case 1: { - setState(424); - theTypeName(); - break; - } - - case 2: { - setState(425); - namespaceName(); - break; - } - - case 3: { - setState(426); - decltypeSpecifier(); - break; - } - - default: - break; - } - setState(429); - match(CPP14Parser::Doublecolon); - _ctx->stop = _input->LT(-1); - setState(442); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RuleNestedNameSpecifier); - setState(431); - - if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(437); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 9, _ctx)) { - case 1: { - setState(432); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - setState(434); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(433); - match(CPP14Parser::Template); - } - setState(436); - simpleTemplateId(); - break; - } - - default: - break; - } - setState(439); - match(CPP14Parser::Doublecolon); - } - setState(444); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- LambdaExpressionContext ------------------------------------------------------------------ - -CPP14Parser::LambdaExpressionContext::LambdaExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::LambdaIntroducerContext* CPP14Parser::LambdaExpressionContext::lambdaIntroducer() { - return getRuleContext(0); -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::LambdaExpressionContext::compoundStatement() { - return getRuleContext(0); -} - -CPP14Parser::LambdaDeclaratorContext* CPP14Parser::LambdaExpressionContext::lambdaDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::LambdaExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleLambdaExpression; -} - - -CPP14Parser::LambdaExpressionContext* CPP14Parser::lambdaExpression() { - LambdaExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 12, CPP14Parser::RuleLambdaExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(445); - lambdaIntroducer(); - setState(447); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::LeftParen) { - setState(446); - lambdaDeclarator(); - } - setState(449); - compoundStatement(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LambdaIntroducerContext ------------------------------------------------------------------ - -CPP14Parser::LambdaIntroducerContext::LambdaIntroducerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LambdaIntroducerContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::LambdaIntroducerContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -CPP14Parser::LambdaCaptureContext* CPP14Parser::LambdaIntroducerContext::lambdaCapture() { - return getRuleContext(0); -} - - -size_t CPP14Parser::LambdaIntroducerContext::getRuleIndex() const { - return CPP14Parser::RuleLambdaIntroducer; -} - - -CPP14Parser::LambdaIntroducerContext* CPP14Parser::lambdaIntroducer() { - LambdaIntroducerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 14, CPP14Parser::RuleLambdaIntroducer); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(451); - match(CPP14Parser::LeftBracket); - setState(453); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 69) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 69)) & -9223372032291373055) != 0)) { - setState(452); - lambdaCapture(); - } - setState(455); - match(CPP14Parser::RightBracket); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LambdaCaptureContext ------------------------------------------------------------------ - -CPP14Parser::LambdaCaptureContext::LambdaCaptureContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::CaptureListContext* CPP14Parser::LambdaCaptureContext::captureList() { - return getRuleContext(0); -} - -CPP14Parser::CaptureDefaultContext* CPP14Parser::LambdaCaptureContext::captureDefault() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::LambdaCaptureContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - - -size_t CPP14Parser::LambdaCaptureContext::getRuleIndex() const { - return CPP14Parser::RuleLambdaCapture; -} - - -CPP14Parser::LambdaCaptureContext* CPP14Parser::lambdaCapture() { - LambdaCaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 16, CPP14Parser::RuleLambdaCapture); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(463); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 14, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(457); - captureList(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(458); - captureDefault(); - setState(461); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Comma) { - setState(459); - match(CPP14Parser::Comma); - setState(460); - captureList(); - } - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CaptureDefaultContext ------------------------------------------------------------------ - -CPP14Parser::CaptureDefaultContext::CaptureDefaultContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::CaptureDefaultContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::CaptureDefaultContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - - -size_t CPP14Parser::CaptureDefaultContext::getRuleIndex() const { - return CPP14Parser::RuleCaptureDefault; -} - - -CPP14Parser::CaptureDefaultContext* CPP14Parser::captureDefault() { - CaptureDefaultContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 18, CPP14Parser::RuleCaptureDefault); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(465); - _la = _input->LA(1); - if (!(_la == CPP14Parser::And - - || _la == CPP14Parser::Assign)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CaptureListContext ------------------------------------------------------------------ - -CPP14Parser::CaptureListContext::CaptureListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::CaptureListContext::capture() { - return getRuleContexts(); -} - -CPP14Parser::CaptureContext* CPP14Parser::CaptureListContext::capture(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::CaptureListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::CaptureListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - -tree::TerminalNode* CPP14Parser::CaptureListContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - - -size_t CPP14Parser::CaptureListContext::getRuleIndex() const { - return CPP14Parser::RuleCaptureList; -} - - -CPP14Parser::CaptureListContext* CPP14Parser::captureList() { - CaptureListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 20, CPP14Parser::RuleCaptureList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(467); - capture(); - setState(472); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(468); - match(CPP14Parser::Comma); - setState(469); - capture(); - setState(474); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(476); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(475); - match(CPP14Parser::Ellipsis); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CaptureContext ------------------------------------------------------------------ - -CPP14Parser::CaptureContext::CaptureContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::SimpleCaptureContext* CPP14Parser::CaptureContext::simpleCapture() { - return getRuleContext(0); -} - -CPP14Parser::InitcaptureContext* CPP14Parser::CaptureContext::initcapture() { - return getRuleContext(0); -} - - -size_t CPP14Parser::CaptureContext::getRuleIndex() const { - return CPP14Parser::RuleCapture; -} - - -CPP14Parser::CaptureContext* CPP14Parser::capture() { - CaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 22, CPP14Parser::RuleCapture); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(480); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 17, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(478); - simpleCapture(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(479); - initcapture(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleCaptureContext ------------------------------------------------------------------ - -CPP14Parser::SimpleCaptureContext::SimpleCaptureContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::SimpleCaptureContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleCaptureContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleCaptureContext::This() { - return getToken(CPP14Parser::This, 0); -} - - -size_t CPP14Parser::SimpleCaptureContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleCapture; -} - - -CPP14Parser::SimpleCaptureContext* CPP14Parser::simpleCapture() { - SimpleCaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 24, CPP14Parser::RuleSimpleCapture); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(487); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::And: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(483); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::And) { - setState(482); - match(CPP14Parser::And); - } - setState(485); - match(CPP14Parser::Identifier); - break; - } - - case CPP14Parser::This: { - enterOuterAlt(_localctx, 2); - setState(486); - match(CPP14Parser::This); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitcaptureContext ------------------------------------------------------------------ - -CPP14Parser::InitcaptureContext::InitcaptureContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::InitcaptureContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::InitializerContext* CPP14Parser::InitcaptureContext::initializer() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::InitcaptureContext::And() { - return getToken(CPP14Parser::And, 0); -} - - -size_t CPP14Parser::InitcaptureContext::getRuleIndex() const { - return CPP14Parser::RuleInitcapture; -} - - -CPP14Parser::InitcaptureContext* CPP14Parser::initcapture() { - InitcaptureContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 26, CPP14Parser::RuleInitcapture); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(490); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::And) { - setState(489); - match(CPP14Parser::And); - } - setState(492); - match(CPP14Parser::Identifier); - setState(493); - initializer(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LambdaDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::LambdaDeclaratorContext::LambdaDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::LambdaDeclaratorContext::parameterDeclarationClause() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::LambdaDeclaratorContext::Mutable() { - return getToken(CPP14Parser::Mutable, 0); -} - -CPP14Parser::ExceptionSpecificationContext* CPP14Parser::LambdaDeclaratorContext::exceptionSpecification() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::LambdaDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::TrailingReturnTypeContext* CPP14Parser::LambdaDeclaratorContext::trailingReturnType() { - return getRuleContext(0); -} - - -size_t CPP14Parser::LambdaDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleLambdaDeclarator; -} - - -CPP14Parser::LambdaDeclaratorContext* CPP14Parser::lambdaDeclarator() { - LambdaDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 28, CPP14Parser::RuleLambdaDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(495); - match(CPP14Parser::LeftParen); - setState(497); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1237504995584196377) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 297237575406461917) != 0)) { - setState(496); - parameterDeclarationClause(); - } - setState(499); - match(CPP14Parser::RightParen); - setState(501); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Mutable) { - setState(500); - match(CPP14Parser::Mutable); - } - setState(504); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Noexcept - - || _la == CPP14Parser::Throw) { - setState(503); - exceptionSpecification(); - } - setState(507); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(506); - attributeSpecifierSeq(); - } - setState(510); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Arrow) { - setState(509); - trailingReturnType(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PostfixExpressionContext ------------------------------------------------------------------ - -CPP14Parser::PostfixExpressionContext::PostfixExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PrimaryExpressionContext* CPP14Parser::PostfixExpressionContext::primaryExpression() { - return getRuleContext(0); -} - -CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::PostfixExpressionContext::simpleTypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::TypeNameSpecifierContext* CPP14Parser::PostfixExpressionContext::typeNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::PostfixExpressionContext::bracedInitList() { - return getRuleContext(0); -} - -CPP14Parser::ExpressionListContext* CPP14Parser::PostfixExpressionContext::expressionList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::PostfixExpressionContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::PostfixExpressionContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Dynamic_cast() { - return getToken(CPP14Parser::Dynamic_cast, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Static_cast() { - return getToken(CPP14Parser::Static_cast, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Reinterpret_cast() { - return getToken(CPP14Parser::Reinterpret_cast, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Const_cast() { - return getToken(CPP14Parser::Const_cast, 0); -} - -CPP14Parser::TypeIdOfTheTypeIdContext* CPP14Parser::PostfixExpressionContext::typeIdOfTheTypeId() { - return getRuleContext(0); -} - -CPP14Parser::PostfixExpressionContext* CPP14Parser::PostfixExpressionContext::postfixExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Dot() { - return getToken(CPP14Parser::Dot, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Arrow() { - return getToken(CPP14Parser::Arrow, 0); -} - -CPP14Parser::IdExpressionContext* CPP14Parser::PostfixExpressionContext::idExpression() { - return getRuleContext(0); -} - -CPP14Parser::PseudoDestructorNameContext* CPP14Parser::PostfixExpressionContext::pseudoDestructorName() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::PlusPlus() { - return getToken(CPP14Parser::PlusPlus, 0); -} - -tree::TerminalNode* CPP14Parser::PostfixExpressionContext::MinusMinus() { - return getToken(CPP14Parser::MinusMinus, 0); -} - - -size_t CPP14Parser::PostfixExpressionContext::getRuleIndex() const { - return CPP14Parser::RulePostfixExpression; -} - - - -CPP14Parser::PostfixExpressionContext* CPP14Parser::postfixExpression() { - return postfixExpression(0); -} - -CPP14Parser::PostfixExpressionContext* CPP14Parser::postfixExpression(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::PostfixExpressionContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::PostfixExpressionContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 30; - enterRecursionRule(_localctx, 30, CPP14Parser::RulePostfixExpression, precedence); - - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(542); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 30, _ctx)) { - case 1: { - setState(513); - primaryExpression(); - break; - } - - case 2: { - setState(516); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - setState(514); - simpleTypeSpecifier(); - break; - } - - case CPP14Parser::Typename_: { - setState(515); - typeNameSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(524); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - setState(518); - match(CPP14Parser::LeftParen); - setState(520); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { - setState(519); - expressionList(); - } - setState(522); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::LeftBrace: { - setState(523); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - case 3: { - setState(526); - _la = _input->LA(1); - if (!(((((_la - 24) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 24)) & 2216203124865) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(527); - match(CPP14Parser::Less); - setState(528); - theTypeId(); - setState(529); - match(CPP14Parser::Greater); - setState(530); - match(CPP14Parser::LeftParen); - setState(531); - expression(); - setState(532); - match(CPP14Parser::RightParen); - break; - } - - case 4: { - setState(534); - typeIdOfTheTypeId(); - setState(535); - match(CPP14Parser::LeftParen); - setState(538); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 29, _ctx)) { - case 1: { - setState(536); - expression(); - break; - } - - case 2: { - setState(537); - theTypeId(); - break; - } - - default: - break; - } - setState(540); - match(CPP14Parser::RightParen); - break; - } - - default: - break; - } - _ctx->stop = _input->LT(-1); - setState(571); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 36, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - setState(569); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 35, _ctx)) { - case 1: { - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RulePostfixExpression); - setState(544); - - if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(545); - match(CPP14Parser::LeftBracket); - setState(548); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::Alignof: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Const_cast: - case CPP14Parser::Decltype: - case CPP14Parser::Delete: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Operator: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static_cast: - case CPP14Parser::This: - case CPP14Parser::Throw: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - setState(546); - expression(); - break; - } - - case CPP14Parser::LeftBrace: { - setState(547); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(550); - match(CPP14Parser::RightBracket); - break; - } - - case 2: { - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RulePostfixExpression); - setState(552); - - if (!(precpred(_ctx, 6))) throw FailedPredicateException(this, "precpred(_ctx, 6)"); - setState(553); - match(CPP14Parser::LeftParen); - setState(555); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { - setState(554); - expressionList(); - } - setState(557); - match(CPP14Parser::RightParen); - break; - } - - case 3: { - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RulePostfixExpression); - setState(558); - - if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); - setState(559); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Arrow - - || _la == CPP14Parser::Dot)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(565); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 34, _ctx)) { - case 1: { - setState(561); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(560); - match(CPP14Parser::Template); - } - setState(563); - idExpression(); - break; - } - - case 2: { - setState(564); - pseudoDestructorName(); - break; - } - - default: - break; - } - break; - } - - case 4: { - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RulePostfixExpression); - setState(567); - - if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)"); - setState(568); - _la = _input->LA(1); - if (!(_la == CPP14Parser::PlusPlus - - || _la == CPP14Parser::MinusMinus)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - break; - } - - default: - break; - } - } - setState(573); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 36, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- TypeIdOfTheTypeIdContext ------------------------------------------------------------------ - -CPP14Parser::TypeIdOfTheTypeIdContext::TypeIdOfTheTypeIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TypeIdOfTheTypeIdContext::Typeid_() { - return getToken(CPP14Parser::Typeid_, 0); -} - - -size_t CPP14Parser::TypeIdOfTheTypeIdContext::getRuleIndex() const { - return CPP14Parser::RuleTypeIdOfTheTypeId; -} - - -CPP14Parser::TypeIdOfTheTypeIdContext* CPP14Parser::typeIdOfTheTypeId() { - TypeIdOfTheTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 32, CPP14Parser::RuleTypeIdOfTheTypeId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(574); - match(CPP14Parser::Typeid_); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExpressionListContext ------------------------------------------------------------------ - -CPP14Parser::ExpressionListContext::ExpressionListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::InitializerListContext* CPP14Parser::ExpressionListContext::initializerList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ExpressionListContext::getRuleIndex() const { - return CPP14Parser::RuleExpressionList; -} - - -CPP14Parser::ExpressionListContext* CPP14Parser::expressionList() { - ExpressionListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 34, CPP14Parser::RuleExpressionList); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(576); - initializerList(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PseudoDestructorNameContext ------------------------------------------------------------------ - -CPP14Parser::PseudoDestructorNameContext::PseudoDestructorNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Tilde() { - return getToken(CPP14Parser::Tilde, 0); -} - -std::vector CPP14Parser::PseudoDestructorNameContext::theTypeName() { - return getRuleContexts(); -} - -CPP14Parser::TheTypeNameContext* CPP14Parser::PseudoDestructorNameContext::theTypeName(size_t i) { - return getRuleContext(i); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::PseudoDestructorNameContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -tree::TerminalNode* CPP14Parser::PseudoDestructorNameContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::PseudoDestructorNameContext::simpleTemplateId() { - return getRuleContext(0); -} - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::PseudoDestructorNameContext::decltypeSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::PseudoDestructorNameContext::getRuleIndex() const { - return CPP14Parser::RulePseudoDestructorName; -} - - -CPP14Parser::PseudoDestructorNameContext* CPP14Parser::pseudoDestructorName() { - PseudoDestructorNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 36, CPP14Parser::RulePseudoDestructorName); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(597); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 39, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(579); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 37, _ctx)) { - case 1: { - setState(578); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(584); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(581); - theTypeName(); - setState(582); - match(CPP14Parser::Doublecolon); - } - setState(586); - match(CPP14Parser::Tilde); - setState(587); - theTypeName(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(588); - nestedNameSpecifier(0); - setState(589); - match(CPP14Parser::Template); - setState(590); - simpleTemplateId(); - setState(591); - match(CPP14Parser::Doublecolon); - setState(592); - match(CPP14Parser::Tilde); - setState(593); - theTypeName(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(595); - match(CPP14Parser::Tilde); - setState(596); - decltypeSpecifier(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- UnaryExpressionContext ------------------------------------------------------------------ - -CPP14Parser::UnaryExpressionContext::UnaryExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PostfixExpressionContext* CPP14Parser::UnaryExpressionContext::postfixExpression() { - return getRuleContext(0); -} - -CPP14Parser::UnaryExpressionContext* CPP14Parser::UnaryExpressionContext::unaryExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::PlusPlus() { - return getToken(CPP14Parser::PlusPlus, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::MinusMinus() { - return getToken(CPP14Parser::MinusMinus, 0); -} - -CPP14Parser::UnaryOperatorContext* CPP14Parser::UnaryExpressionContext::unaryOperator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Sizeof() { - return getToken(CPP14Parser::Sizeof, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::UnaryExpressionContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryExpressionContext::Alignof() { - return getToken(CPP14Parser::Alignof, 0); -} - -CPP14Parser::NoExceptExpressionContext* CPP14Parser::UnaryExpressionContext::noExceptExpression() { - return getRuleContext(0); -} - -CPP14Parser::NewExpressionContext* CPP14Parser::UnaryExpressionContext::newExpression() { - return getRuleContext(0); -} - -CPP14Parser::DeleteExpressionContext* CPP14Parser::UnaryExpressionContext::deleteExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::UnaryExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleUnaryExpression; -} - - -CPP14Parser::UnaryExpressionContext* CPP14Parser::unaryExpression() { - UnaryExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 38, CPP14Parser::RuleUnaryExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(626); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 42, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(599); - postfixExpression(0); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(604); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::PlusPlus: { - setState(600); - match(CPP14Parser::PlusPlus); - break; - } - - case CPP14Parser::MinusMinus: { - setState(601); - match(CPP14Parser::MinusMinus); - break; - } - - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: { - setState(602); - unaryOperator(); - break; - } - - case CPP14Parser::Sizeof: { - setState(603); - match(CPP14Parser::Sizeof); - break; - } - - default: - throw NoViableAltException(this); - } - setState(606); - unaryExpression(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(607); - match(CPP14Parser::Sizeof); - setState(616); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - setState(608); - match(CPP14Parser::LeftParen); - setState(609); - theTypeId(); - setState(610); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::Ellipsis: { - setState(612); - match(CPP14Parser::Ellipsis); - setState(613); - match(CPP14Parser::LeftParen); - setState(614); - match(CPP14Parser::Identifier); - setState(615); - match(CPP14Parser::RightParen); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(618); - match(CPP14Parser::Alignof); - setState(619); - match(CPP14Parser::LeftParen); - setState(620); - theTypeId(); - setState(621); - match(CPP14Parser::RightParen); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(623); - noExceptExpression(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(624); - newExpression(); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(625); - deleteExpression(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- UnaryOperatorContext ------------------------------------------------------------------ - -CPP14Parser::UnaryOperatorContext::UnaryOperatorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Or() { - return getToken(CPP14Parser::Or, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Star() { - return getToken(CPP14Parser::Star, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Plus() { - return getToken(CPP14Parser::Plus, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Tilde() { - return getToken(CPP14Parser::Tilde, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Minus() { - return getToken(CPP14Parser::Minus, 0); -} - -tree::TerminalNode* CPP14Parser::UnaryOperatorContext::Not() { - return getToken(CPP14Parser::Not, 0); -} - - -size_t CPP14Parser::UnaryOperatorContext::getRuleIndex() const { - return CPP14Parser::RuleUnaryOperator; -} - - -CPP14Parser::UnaryOperatorContext* CPP14Parser::unaryOperator() { - UnaryOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 40, CPP14Parser::RuleUnaryOperator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(628); - _la = _input->LA(1); - if (!(((((_la - 91) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 91)) & 967) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NewExpressionContext ------------------------------------------------------------------ - -CPP14Parser::NewExpressionContext::NewExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NewExpressionContext::New() { - return getToken(CPP14Parser::New, 0); -} - -CPP14Parser::NewTypeIdContext* CPP14Parser::NewExpressionContext::newTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NewExpressionContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -CPP14Parser::NewPlacementContext* CPP14Parser::NewExpressionContext::newPlacement() { - return getRuleContext(0); -} - -CPP14Parser::NewInitializerContext* CPP14Parser::NewExpressionContext::newInitializer() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NewExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::NewExpressionContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NewExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::NewExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleNewExpression; -} - - -CPP14Parser::NewExpressionContext* CPP14Parser::newExpression() { - NewExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 42, CPP14Parser::RuleNewExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(631); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Doublecolon) { - setState(630); - match(CPP14Parser::Doublecolon); - } - setState(633); - match(CPP14Parser::New); - setState(635); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 44, _ctx)) { - case 1: { - setState(634); - newPlacement(); - break; - } - - default: - break; - } - setState(642); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Struct: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - setState(637); - newTypeId(); - break; - } - - case CPP14Parser::LeftParen: { - setState(638); - match(CPP14Parser::LeftParen); - setState(639); - theTypeId(); - setState(640); - match(CPP14Parser::RightParen); - break; - } - - default: - throw NoViableAltException(this); - } - setState(645); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::LeftParen - - || _la == CPP14Parser::LeftBrace) { - setState(644); - newInitializer(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NewPlacementContext ------------------------------------------------------------------ - -CPP14Parser::NewPlacementContext::NewPlacementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NewPlacementContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ExpressionListContext* CPP14Parser::NewPlacementContext::expressionList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NewPlacementContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::NewPlacementContext::getRuleIndex() const { - return CPP14Parser::RuleNewPlacement; -} - - -CPP14Parser::NewPlacementContext* CPP14Parser::newPlacement() { - NewPlacementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 44, CPP14Parser::RuleNewPlacement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(647); - match(CPP14Parser::LeftParen); - setState(648); - expressionList(); - setState(649); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NewTypeIdContext ------------------------------------------------------------------ - -CPP14Parser::NewTypeIdContext::NewTypeIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::NewTypeIdContext::typeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::NewDeclaratorContext* CPP14Parser::NewTypeIdContext::newDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NewTypeIdContext::getRuleIndex() const { - return CPP14Parser::RuleNewTypeId; -} - - -CPP14Parser::NewTypeIdContext* CPP14Parser::newTypeId() { - NewTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 46, CPP14Parser::RuleNewTypeId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(651); - typeSpecifierSeq(); - setState(653); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 47, _ctx)) { - case 1: { - setState(652); - newDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NewDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::NewDeclaratorContext::NewDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PointerOperatorContext* CPP14Parser::NewDeclaratorContext::pointerOperator() { - return getRuleContext(0); -} - -CPP14Parser::NewDeclaratorContext* CPP14Parser::NewDeclaratorContext::newDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::NewDeclaratorContext::noPointerNewDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NewDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleNewDeclarator; -} - - -CPP14Parser::NewDeclaratorContext* CPP14Parser::newDeclarator() { - NewDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 48, CPP14Parser::RuleNewDeclarator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(660); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Decltype: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::AndAnd: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(655); - pointerOperator(); - setState(657); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 48, _ctx)) { - case 1: { - setState(656); - newDeclarator(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 2); - setState(659); - noPointerNewDeclarator(0); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoPointerNewDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::NoPointerNewDeclaratorContext::NoPointerNewDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NoPointerNewDeclaratorContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::NoPointerNewDeclaratorContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerNewDeclaratorContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerNewDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::NoPointerNewDeclaratorContext::noPointerNewDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerNewDeclaratorContext::constantExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NoPointerNewDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleNoPointerNewDeclarator; -} - - - -CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::noPointerNewDeclarator() { - return noPointerNewDeclarator(0); -} - -CPP14Parser::NoPointerNewDeclaratorContext* CPP14Parser::noPointerNewDeclarator(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::NoPointerNewDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::NoPointerNewDeclaratorContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 50; - enterRecursionRule(_localctx, 50, CPP14Parser::RuleNoPointerNewDeclarator, precedence); - - - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(663); - match(CPP14Parser::LeftBracket); - setState(664); - expression(); - setState(665); - match(CPP14Parser::RightBracket); - setState(667); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 50, _ctx)) { - case 1: { - setState(666); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - _ctx->stop = _input->LT(-1); - setState(678); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 52, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RuleNoPointerNewDeclarator); - setState(669); - - if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(670); - match(CPP14Parser::LeftBracket); - setState(671); - constantExpression(); - setState(672); - match(CPP14Parser::RightBracket); - setState(674); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 51, _ctx)) { - case 1: { - setState(673); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - } - setState(680); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 52, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- NewInitializerContext ------------------------------------------------------------------ - -CPP14Parser::NewInitializerContext::NewInitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NewInitializerContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::NewInitializerContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::ExpressionListContext* CPP14Parser::NewInitializerContext::expressionList() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::NewInitializerContext::bracedInitList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NewInitializerContext::getRuleIndex() const { - return CPP14Parser::RuleNewInitializer; -} - - -CPP14Parser::NewInitializerContext* CPP14Parser::newInitializer() { - NewInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 52, CPP14Parser::RuleNewInitializer); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(687); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - enterOuterAlt(_localctx, 1); - setState(681); - match(CPP14Parser::LeftParen); - setState(683); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { - setState(682); - expressionList(); - } - setState(685); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::LeftBrace: { - enterOuterAlt(_localctx, 2); - setState(686); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeleteExpressionContext ------------------------------------------------------------------ - -CPP14Parser::DeleteExpressionContext::DeleteExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::DeleteExpressionContext::Delete() { - return getToken(CPP14Parser::Delete, 0); -} - -CPP14Parser::CastExpressionContext* CPP14Parser::DeleteExpressionContext::castExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::DeleteExpressionContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -tree::TerminalNode* CPP14Parser::DeleteExpressionContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::DeleteExpressionContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - - -size_t CPP14Parser::DeleteExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleDeleteExpression; -} - - -CPP14Parser::DeleteExpressionContext* CPP14Parser::deleteExpression() { - DeleteExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 54, CPP14Parser::RuleDeleteExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(690); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Doublecolon) { - setState(689); - match(CPP14Parser::Doublecolon); - } - setState(692); - match(CPP14Parser::Delete); - setState(695); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 56, _ctx)) { - case 1: { - setState(693); - match(CPP14Parser::LeftBracket); - setState(694); - match(CPP14Parser::RightBracket); - break; - } - - default: - break; - } - setState(697); - castExpression(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoExceptExpressionContext ------------------------------------------------------------------ - -CPP14Parser::NoExceptExpressionContext::NoExceptExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::Noexcept() { - return getToken(CPP14Parser::Noexcept, 0); -} - -tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::NoExceptExpressionContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoExceptExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::NoExceptExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleNoExceptExpression; -} - - -CPP14Parser::NoExceptExpressionContext* CPP14Parser::noExceptExpression() { - NoExceptExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 56, CPP14Parser::RuleNoExceptExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(699); - match(CPP14Parser::Noexcept); - setState(700); - match(CPP14Parser::LeftParen); - setState(701); - expression(); - setState(702); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CastExpressionContext ------------------------------------------------------------------ - -CPP14Parser::CastExpressionContext::CastExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::UnaryExpressionContext* CPP14Parser::CastExpressionContext::unaryExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::CastExpressionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::CastExpressionContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::CastExpressionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::CastExpressionContext* CPP14Parser::CastExpressionContext::castExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::CastExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleCastExpression; -} - - -CPP14Parser::CastExpressionContext* CPP14Parser::castExpression() { - CastExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 58, CPP14Parser::RuleCastExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(710); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 57, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(704); - unaryExpression(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(705); - match(CPP14Parser::LeftParen); - setState(706); - theTypeId(); - setState(707); - match(CPP14Parser::RightParen); - setState(708); - castExpression(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PointerMemberExpressionContext ------------------------------------------------------------------ - -CPP14Parser::PointerMemberExpressionContext::PointerMemberExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::PointerMemberExpressionContext::castExpression() { - return getRuleContexts(); -} - -CPP14Parser::CastExpressionContext* CPP14Parser::PointerMemberExpressionContext::castExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::PointerMemberExpressionContext::DotStar() { - return getTokens(CPP14Parser::DotStar); -} - -tree::TerminalNode* CPP14Parser::PointerMemberExpressionContext::DotStar(size_t i) { - return getToken(CPP14Parser::DotStar, i); -} - -std::vector CPP14Parser::PointerMemberExpressionContext::ArrowStar() { - return getTokens(CPP14Parser::ArrowStar); -} - -tree::TerminalNode* CPP14Parser::PointerMemberExpressionContext::ArrowStar(size_t i) { - return getToken(CPP14Parser::ArrowStar, i); -} - - -size_t CPP14Parser::PointerMemberExpressionContext::getRuleIndex() const { - return CPP14Parser::RulePointerMemberExpression; -} - - -CPP14Parser::PointerMemberExpressionContext* CPP14Parser::pointerMemberExpression() { - PointerMemberExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 60, CPP14Parser::RulePointerMemberExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(712); - castExpression(); - setState(717); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::ArrowStar - - || _la == CPP14Parser::DotStar) { - setState(713); - _la = _input->LA(1); - if (!(_la == CPP14Parser::ArrowStar - - || _la == CPP14Parser::DotStar)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(714); - castExpression(); - setState(719); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MultiplicativeExpressionContext ------------------------------------------------------------------ - -CPP14Parser::MultiplicativeExpressionContext::MultiplicativeExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::MultiplicativeExpressionContext::pointerMemberExpression() { - return getRuleContexts(); -} - -CPP14Parser::PointerMemberExpressionContext* CPP14Parser::MultiplicativeExpressionContext::pointerMemberExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::MultiplicativeExpressionContext::Star() { - return getTokens(CPP14Parser::Star); -} - -tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Star(size_t i) { - return getToken(CPP14Parser::Star, i); -} - -std::vector CPP14Parser::MultiplicativeExpressionContext::Div() { - return getTokens(CPP14Parser::Div); -} - -tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Div(size_t i) { - return getToken(CPP14Parser::Div, i); -} - -std::vector CPP14Parser::MultiplicativeExpressionContext::Mod() { - return getTokens(CPP14Parser::Mod); -} - -tree::TerminalNode* CPP14Parser::MultiplicativeExpressionContext::Mod(size_t i) { - return getToken(CPP14Parser::Mod, i); -} - - -size_t CPP14Parser::MultiplicativeExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleMultiplicativeExpression; -} - - -CPP14Parser::MultiplicativeExpressionContext* CPP14Parser::multiplicativeExpression() { - MultiplicativeExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 62, CPP14Parser::RuleMultiplicativeExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(720); - pointerMemberExpression(); - setState(725); - _errHandler->sync(this); - _la = _input->LA(1); - while (((((_la - 93) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 93)) & 7) != 0)) { - setState(721); - _la = _input->LA(1); - if (!(((((_la - 93) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 93)) & 7) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(722); - pointerMemberExpression(); - setState(727); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AdditiveExpressionContext ------------------------------------------------------------------ - -CPP14Parser::AdditiveExpressionContext::AdditiveExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::AdditiveExpressionContext::multiplicativeExpression() { - return getRuleContexts(); -} - -CPP14Parser::MultiplicativeExpressionContext* CPP14Parser::AdditiveExpressionContext::multiplicativeExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::AdditiveExpressionContext::Plus() { - return getTokens(CPP14Parser::Plus); -} - -tree::TerminalNode* CPP14Parser::AdditiveExpressionContext::Plus(size_t i) { - return getToken(CPP14Parser::Plus, i); -} - -std::vector CPP14Parser::AdditiveExpressionContext::Minus() { - return getTokens(CPP14Parser::Minus); -} - -tree::TerminalNode* CPP14Parser::AdditiveExpressionContext::Minus(size_t i) { - return getToken(CPP14Parser::Minus, i); -} - - -size_t CPP14Parser::AdditiveExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleAdditiveExpression; -} - - -CPP14Parser::AdditiveExpressionContext* CPP14Parser::additiveExpression() { - AdditiveExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 64, CPP14Parser::RuleAdditiveExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(728); - multiplicativeExpression(); - setState(733); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Plus - - || _la == CPP14Parser::Minus) { - setState(729); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Plus - - || _la == CPP14Parser::Minus)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(730); - multiplicativeExpression(); - setState(735); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ShiftExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ShiftExpressionContext::ShiftExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::ShiftExpressionContext::additiveExpression() { - return getRuleContexts(); -} - -CPP14Parser::AdditiveExpressionContext* CPP14Parser::ShiftExpressionContext::additiveExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::ShiftExpressionContext::shiftOperator() { - return getRuleContexts(); -} - -CPP14Parser::ShiftOperatorContext* CPP14Parser::ShiftExpressionContext::shiftOperator(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::ShiftExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleShiftExpression; -} - - -CPP14Parser::ShiftExpressionContext* CPP14Parser::shiftExpression() { - ShiftExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 66, CPP14Parser::RuleShiftExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(736); - additiveExpression(); - setState(742); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 61, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(737); - shiftOperator(); - setState(738); - additiveExpression(); - } - setState(744); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 61, _ctx); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ShiftOperatorContext ------------------------------------------------------------------ - -CPP14Parser::ShiftOperatorContext::ShiftOperatorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::ShiftOperatorContext::Greater() { - return getTokens(CPP14Parser::Greater); -} - -tree::TerminalNode* CPP14Parser::ShiftOperatorContext::Greater(size_t i) { - return getToken(CPP14Parser::Greater, i); -} - -std::vector CPP14Parser::ShiftOperatorContext::Less() { - return getTokens(CPP14Parser::Less); -} - -tree::TerminalNode* CPP14Parser::ShiftOperatorContext::Less(size_t i) { - return getToken(CPP14Parser::Less, i); -} - - -size_t CPP14Parser::ShiftOperatorContext::getRuleIndex() const { - return CPP14Parser::RuleShiftOperator; -} - - -CPP14Parser::ShiftOperatorContext* CPP14Parser::shiftOperator() { - ShiftOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 68, CPP14Parser::RuleShiftOperator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(749); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Greater: { - enterOuterAlt(_localctx, 1); - setState(745); - match(CPP14Parser::Greater); - setState(746); - match(CPP14Parser::Greater); - break; - } - - case CPP14Parser::Less: { - enterOuterAlt(_localctx, 2); - setState(747); - match(CPP14Parser::Less); - setState(748); - match(CPP14Parser::Less); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- RelationalExpressionContext ------------------------------------------------------------------ - -CPP14Parser::RelationalExpressionContext::RelationalExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::RelationalExpressionContext::shiftExpression() { - return getRuleContexts(); -} - -CPP14Parser::ShiftExpressionContext* CPP14Parser::RelationalExpressionContext::shiftExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::RelationalExpressionContext::Less() { - return getTokens(CPP14Parser::Less); -} - -tree::TerminalNode* CPP14Parser::RelationalExpressionContext::Less(size_t i) { - return getToken(CPP14Parser::Less, i); -} - -std::vector CPP14Parser::RelationalExpressionContext::Greater() { - return getTokens(CPP14Parser::Greater); -} - -tree::TerminalNode* CPP14Parser::RelationalExpressionContext::Greater(size_t i) { - return getToken(CPP14Parser::Greater, i); -} - -std::vector CPP14Parser::RelationalExpressionContext::LessEqual() { - return getTokens(CPP14Parser::LessEqual); -} - -tree::TerminalNode* CPP14Parser::RelationalExpressionContext::LessEqual(size_t i) { - return getToken(CPP14Parser::LessEqual, i); -} - -std::vector CPP14Parser::RelationalExpressionContext::GreaterEqual() { - return getTokens(CPP14Parser::GreaterEqual); -} - -tree::TerminalNode* CPP14Parser::RelationalExpressionContext::GreaterEqual(size_t i) { - return getToken(CPP14Parser::GreaterEqual, i); -} - - -size_t CPP14Parser::RelationalExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleRelationalExpression; -} - - -CPP14Parser::RelationalExpressionContext* CPP14Parser::relationalExpression() { - RelationalExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 70, CPP14Parser::RuleRelationalExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(751); - shiftExpression(); - setState(756); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(752); - _la = _input->LA(1); - if (!(((((_la - 102) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 102)) & 49155) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(753); - shiftExpression(); - } - setState(758); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EqualityExpressionContext ------------------------------------------------------------------ - -CPP14Parser::EqualityExpressionContext::EqualityExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::EqualityExpressionContext::relationalExpression() { - return getRuleContexts(); -} - -CPP14Parser::RelationalExpressionContext* CPP14Parser::EqualityExpressionContext::relationalExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::EqualityExpressionContext::Equal() { - return getTokens(CPP14Parser::Equal); -} - -tree::TerminalNode* CPP14Parser::EqualityExpressionContext::Equal(size_t i) { - return getToken(CPP14Parser::Equal, i); -} - -std::vector CPP14Parser::EqualityExpressionContext::NotEqual() { - return getTokens(CPP14Parser::NotEqual); -} - -tree::TerminalNode* CPP14Parser::EqualityExpressionContext::NotEqual(size_t i) { - return getToken(CPP14Parser::NotEqual, i); -} - - -size_t CPP14Parser::EqualityExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleEqualityExpression; -} - - -CPP14Parser::EqualityExpressionContext* CPP14Parser::equalityExpression() { - EqualityExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 72, CPP14Parser::RuleEqualityExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(759); - relationalExpression(); - setState(764); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Equal - - || _la == CPP14Parser::NotEqual) { - setState(760); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Equal - - || _la == CPP14Parser::NotEqual)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(761); - relationalExpression(); - setState(766); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AndExpressionContext ------------------------------------------------------------------ - -CPP14Parser::AndExpressionContext::AndExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::AndExpressionContext::equalityExpression() { - return getRuleContexts(); -} - -CPP14Parser::EqualityExpressionContext* CPP14Parser::AndExpressionContext::equalityExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::AndExpressionContext::And() { - return getTokens(CPP14Parser::And); -} - -tree::TerminalNode* CPP14Parser::AndExpressionContext::And(size_t i) { - return getToken(CPP14Parser::And, i); -} - - -size_t CPP14Parser::AndExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleAndExpression; -} - - -CPP14Parser::AndExpressionContext* CPP14Parser::andExpression() { - AndExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 74, CPP14Parser::RuleAndExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(767); - equalityExpression(); - setState(772); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::And) { - setState(768); - match(CPP14Parser::And); - setState(769); - equalityExpression(); - setState(774); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExclusiveOrExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ExclusiveOrExpressionContext::ExclusiveOrExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::ExclusiveOrExpressionContext::andExpression() { - return getRuleContexts(); -} - -CPP14Parser::AndExpressionContext* CPP14Parser::ExclusiveOrExpressionContext::andExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::ExclusiveOrExpressionContext::Caret() { - return getTokens(CPP14Parser::Caret); -} - -tree::TerminalNode* CPP14Parser::ExclusiveOrExpressionContext::Caret(size_t i) { - return getToken(CPP14Parser::Caret, i); -} - - -size_t CPP14Parser::ExclusiveOrExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleExclusiveOrExpression; -} - - -CPP14Parser::ExclusiveOrExpressionContext* CPP14Parser::exclusiveOrExpression() { - ExclusiveOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 76, CPP14Parser::RuleExclusiveOrExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(775); - andExpression(); - setState(780); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Caret) { - setState(776); - match(CPP14Parser::Caret); - setState(777); - andExpression(); - setState(782); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InclusiveOrExpressionContext ------------------------------------------------------------------ - -CPP14Parser::InclusiveOrExpressionContext::InclusiveOrExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::InclusiveOrExpressionContext::exclusiveOrExpression() { - return getRuleContexts(); -} - -CPP14Parser::ExclusiveOrExpressionContext* CPP14Parser::InclusiveOrExpressionContext::exclusiveOrExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::InclusiveOrExpressionContext::Or() { - return getTokens(CPP14Parser::Or); -} - -tree::TerminalNode* CPP14Parser::InclusiveOrExpressionContext::Or(size_t i) { - return getToken(CPP14Parser::Or, i); -} - - -size_t CPP14Parser::InclusiveOrExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleInclusiveOrExpression; -} - - -CPP14Parser::InclusiveOrExpressionContext* CPP14Parser::inclusiveOrExpression() { - InclusiveOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 78, CPP14Parser::RuleInclusiveOrExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(783); - exclusiveOrExpression(); - setState(788); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Or) { - setState(784); - match(CPP14Parser::Or); - setState(785); - exclusiveOrExpression(); - setState(790); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LogicalAndExpressionContext ------------------------------------------------------------------ - -CPP14Parser::LogicalAndExpressionContext::LogicalAndExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::LogicalAndExpressionContext::inclusiveOrExpression() { - return getRuleContexts(); -} - -CPP14Parser::InclusiveOrExpressionContext* CPP14Parser::LogicalAndExpressionContext::inclusiveOrExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::LogicalAndExpressionContext::AndAnd() { - return getTokens(CPP14Parser::AndAnd); -} - -tree::TerminalNode* CPP14Parser::LogicalAndExpressionContext::AndAnd(size_t i) { - return getToken(CPP14Parser::AndAnd, i); -} - - -size_t CPP14Parser::LogicalAndExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleLogicalAndExpression; -} - - -CPP14Parser::LogicalAndExpressionContext* CPP14Parser::logicalAndExpression() { - LogicalAndExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 80, CPP14Parser::RuleLogicalAndExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(791); - inclusiveOrExpression(); - setState(796); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::AndAnd) { - setState(792); - match(CPP14Parser::AndAnd); - setState(793); - inclusiveOrExpression(); - setState(798); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LogicalOrExpressionContext ------------------------------------------------------------------ - -CPP14Parser::LogicalOrExpressionContext::LogicalOrExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::LogicalOrExpressionContext::logicalAndExpression() { - return getRuleContexts(); -} - -CPP14Parser::LogicalAndExpressionContext* CPP14Parser::LogicalOrExpressionContext::logicalAndExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::LogicalOrExpressionContext::OrOr() { - return getTokens(CPP14Parser::OrOr); -} - -tree::TerminalNode* CPP14Parser::LogicalOrExpressionContext::OrOr(size_t i) { - return getToken(CPP14Parser::OrOr, i); -} - - -size_t CPP14Parser::LogicalOrExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleLogicalOrExpression; -} - - -CPP14Parser::LogicalOrExpressionContext* CPP14Parser::logicalOrExpression() { - LogicalOrExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 82, CPP14Parser::RuleLogicalOrExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(799); - logicalAndExpression(); - setState(804); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::OrOr) { - setState(800); - match(CPP14Parser::OrOr); - setState(801); - logicalAndExpression(); - setState(806); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConditionalExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ConditionalExpressionContext::ConditionalExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::LogicalOrExpressionContext* CPP14Parser::ConditionalExpressionContext::logicalOrExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ConditionalExpressionContext::Question() { - return getToken(CPP14Parser::Question, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::ConditionalExpressionContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ConditionalExpressionContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::AssignmentExpressionContext* CPP14Parser::ConditionalExpressionContext::assignmentExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConditionalExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleConditionalExpression; -} - - -CPP14Parser::ConditionalExpressionContext* CPP14Parser::conditionalExpression() { - ConditionalExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 84, CPP14Parser::RuleConditionalExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(807); - logicalOrExpression(); - setState(813); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Question) { - setState(808); - match(CPP14Parser::Question); - setState(809); - expression(); - setState(810); - match(CPP14Parser::Colon); - setState(811); - assignmentExpression(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AssignmentExpressionContext ------------------------------------------------------------------ - -CPP14Parser::AssignmentExpressionContext::AssignmentExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ConditionalExpressionContext* CPP14Parser::AssignmentExpressionContext::conditionalExpression() { - return getRuleContext(0); -} - -CPP14Parser::LogicalOrExpressionContext* CPP14Parser::AssignmentExpressionContext::logicalOrExpression() { - return getRuleContext(0); -} - -CPP14Parser::AssignmentOperatorContext* CPP14Parser::AssignmentExpressionContext::assignmentOperator() { - return getRuleContext(0); -} - -CPP14Parser::InitializerClauseContext* CPP14Parser::AssignmentExpressionContext::initializerClause() { - return getRuleContext(0); -} - -CPP14Parser::ThrowExpressionContext* CPP14Parser::AssignmentExpressionContext::throwExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AssignmentExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleAssignmentExpression; -} - - -CPP14Parser::AssignmentExpressionContext* CPP14Parser::assignmentExpression() { - AssignmentExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 86, CPP14Parser::RuleAssignmentExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(821); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 71, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(815); - conditionalExpression(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(816); - logicalOrExpression(); - setState(817); - assignmentOperator(); - setState(818); - initializerClause(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(820); - throwExpression(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AssignmentOperatorContext ------------------------------------------------------------------ - -CPP14Parser::AssignmentOperatorContext::AssignmentOperatorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::StarAssign() { - return getToken(CPP14Parser::StarAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::DivAssign() { - return getToken(CPP14Parser::DivAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::ModAssign() { - return getToken(CPP14Parser::ModAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::PlusAssign() { - return getToken(CPP14Parser::PlusAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::MinusAssign() { - return getToken(CPP14Parser::MinusAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::RightShiftAssign() { - return getToken(CPP14Parser::RightShiftAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::LeftShiftAssign() { - return getToken(CPP14Parser::LeftShiftAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::AndAssign() { - return getToken(CPP14Parser::AndAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::XorAssign() { - return getToken(CPP14Parser::XorAssign, 0); -} - -tree::TerminalNode* CPP14Parser::AssignmentOperatorContext::OrAssign() { - return getToken(CPP14Parser::OrAssign, 0); -} - - -size_t CPP14Parser::AssignmentOperatorContext::getRuleIndex() const { - return CPP14Parser::RuleAssignmentOperator; -} - - -CPP14Parser::AssignmentOperatorContext* CPP14Parser::assignmentOperator() { - AssignmentOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 88, CPP14Parser::RuleAssignmentOperator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(823); - _la = _input->LA(1); - if (!(((((_la - 101) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 101)) & 8185) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ExpressionContext::ExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::ExpressionContext::assignmentExpression() { - return getRuleContexts(); -} - -CPP14Parser::AssignmentExpressionContext* CPP14Parser::ExpressionContext::assignmentExpression(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::ExpressionContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::ExpressionContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::ExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleExpression; -} - - -CPP14Parser::ExpressionContext* CPP14Parser::expression() { - ExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 90, CPP14Parser::RuleExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(825); - assignmentExpression(); - setState(830); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(826); - match(CPP14Parser::Comma); - setState(827); - assignmentExpression(); - setState(832); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConstantExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ConstantExpressionContext::ConstantExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ConditionalExpressionContext* CPP14Parser::ConstantExpressionContext::conditionalExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConstantExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleConstantExpression; -} - - -CPP14Parser::ConstantExpressionContext* CPP14Parser::constantExpression() { - ConstantExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 92, CPP14Parser::RuleConstantExpression); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(833); - conditionalExpression(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- StatementContext ------------------------------------------------------------------ - -CPP14Parser::StatementContext::StatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::LabeledStatementContext* CPP14Parser::StatementContext::labeledStatement() { - return getRuleContext(0); -} - -CPP14Parser::DeclarationStatementContext* CPP14Parser::StatementContext::declarationStatement() { - return getRuleContext(0); -} - -CPP14Parser::ExpressionStatementContext* CPP14Parser::StatementContext::expressionStatement() { - return getRuleContext(0); -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::StatementContext::compoundStatement() { - return getRuleContext(0); -} - -CPP14Parser::SelectionStatementContext* CPP14Parser::StatementContext::selectionStatement() { - return getRuleContext(0); -} - -CPP14Parser::IterationStatementContext* CPP14Parser::StatementContext::iterationStatement() { - return getRuleContext(0); -} - -CPP14Parser::JumpStatementContext* CPP14Parser::StatementContext::jumpStatement() { - return getRuleContext(0); -} - -CPP14Parser::TryBlockContext* CPP14Parser::StatementContext::tryBlock() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::StatementContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::StatementContext::getRuleIndex() const { - return CPP14Parser::RuleStatement; -} - - -CPP14Parser::StatementContext* CPP14Parser::statement() { - StatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 94, CPP14Parser::RuleStatement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(848); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 75, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(835); - labeledStatement(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(836); - declarationStatement(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(838); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 73, _ctx)) { - case 1: { - setState(837); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - setState(846); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::Alignof: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Const_cast: - case CPP14Parser::Decltype: - case CPP14Parser::Delete: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Operator: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static_cast: - case CPP14Parser::This: - case CPP14Parser::Throw: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Doublecolon: - case CPP14Parser::Semi: - case CPP14Parser::Identifier: { - setState(840); - expressionStatement(); - break; - } - - case CPP14Parser::LeftBrace: { - setState(841); - compoundStatement(); - break; - } - - case CPP14Parser::If: - case CPP14Parser::Switch: { - setState(842); - selectionStatement(); - break; - } - - case CPP14Parser::Do: - case CPP14Parser::For: - case CPP14Parser::While: { - setState(843); - iterationStatement(); - break; - } - - case CPP14Parser::Break: - case CPP14Parser::Continue: - case CPP14Parser::Goto: - case CPP14Parser::Return: { - setState(844); - jumpStatement(); - break; - } - - case CPP14Parser::Try: { - setState(845); - tryBlock(); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LabeledStatementContext ------------------------------------------------------------------ - -CPP14Parser::LabeledStatementContext::LabeledStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LabeledStatementContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::StatementContext* CPP14Parser::LabeledStatementContext::statement() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::LabeledStatementContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::LabeledStatementContext::Case() { - return getToken(CPP14Parser::Case, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::LabeledStatementContext::constantExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::LabeledStatementContext::Default() { - return getToken(CPP14Parser::Default, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::LabeledStatementContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::LabeledStatementContext::getRuleIndex() const { - return CPP14Parser::RuleLabeledStatement; -} - - -CPP14Parser::LabeledStatementContext* CPP14Parser::labeledStatement() { - LabeledStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 96, CPP14Parser::RuleLabeledStatement); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(851); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(850); - attributeSpecifierSeq(); - } - setState(857); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Identifier: { - setState(853); - match(CPP14Parser::Identifier); - break; - } - - case CPP14Parser::Case: { - setState(854); - match(CPP14Parser::Case); - setState(855); - constantExpression(); - break; - } - - case CPP14Parser::Default: { - setState(856); - match(CPP14Parser::Default); - break; - } - - default: - throw NoViableAltException(this); - } - setState(859); - match(CPP14Parser::Colon); - setState(860); - statement(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExpressionStatementContext ------------------------------------------------------------------ - -CPP14Parser::ExpressionStatementContext::ExpressionStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ExpressionStatementContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::ExpressionStatementContext::expression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ExpressionStatementContext::getRuleIndex() const { - return CPP14Parser::RuleExpressionStatement; -} - - -CPP14Parser::ExpressionStatementContext* CPP14Parser::expressionStatement() { - ExpressionStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 98, CPP14Parser::RuleExpressionStatement); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(863); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { - setState(862); - expression(); - } - setState(865); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CompoundStatementContext ------------------------------------------------------------------ - -CPP14Parser::CompoundStatementContext::CompoundStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::CompoundStatementContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::CompoundStatementContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -CPP14Parser::StatementSeqContext* CPP14Parser::CompoundStatementContext::statementSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::CompoundStatementContext::getRuleIndex() const { - return CPP14Parser::RuleCompoundStatement; -} - - -CPP14Parser::CompoundStatementContext* CPP14Parser::compoundStatement() { - CompoundStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 100, CPP14Parser::RuleCompoundStatement); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(867); - match(CPP14Parser::LeftBrace); - setState(869); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & -137360239606498050) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & -8989184726396829969) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & 25) != 0)) { - setState(868); - statementSeq(); - } - setState(871); - match(CPP14Parser::RightBrace); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- StatementSeqContext ------------------------------------------------------------------ - -CPP14Parser::StatementSeqContext::StatementSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::StatementSeqContext::statement() { - return getRuleContexts(); -} - -CPP14Parser::StatementContext* CPP14Parser::StatementSeqContext::statement(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::StatementSeqContext::getRuleIndex() const { - return CPP14Parser::RuleStatementSeq; -} - - -CPP14Parser::StatementSeqContext* CPP14Parser::statementSeq() { - StatementSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 102, CPP14Parser::RuleStatementSeq); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(874); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(873); - statement(); - setState(876); - _errHandler->sync(this); - _la = _input->LA(1); - } while ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & -137360239606498050) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & -8989184726396829969) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & 25) != 0)); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SelectionStatementContext ------------------------------------------------------------------ - -CPP14Parser::SelectionStatementContext::SelectionStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::SelectionStatementContext::If() { - return getToken(CPP14Parser::If, 0); -} - -tree::TerminalNode* CPP14Parser::SelectionStatementContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ConditionContext* CPP14Parser::SelectionStatementContext::condition() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::SelectionStatementContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -std::vector CPP14Parser::SelectionStatementContext::statement() { - return getRuleContexts(); -} - -CPP14Parser::StatementContext* CPP14Parser::SelectionStatementContext::statement(size_t i) { - return getRuleContext(i); -} - -tree::TerminalNode* CPP14Parser::SelectionStatementContext::Else() { - return getToken(CPP14Parser::Else, 0); -} - -tree::TerminalNode* CPP14Parser::SelectionStatementContext::Switch() { - return getToken(CPP14Parser::Switch, 0); -} - - -size_t CPP14Parser::SelectionStatementContext::getRuleIndex() const { - return CPP14Parser::RuleSelectionStatement; -} - - -CPP14Parser::SelectionStatementContext* CPP14Parser::selectionStatement() { - SelectionStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 104, CPP14Parser::RuleSelectionStatement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(893); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::If: { - enterOuterAlt(_localctx, 1); - setState(878); - match(CPP14Parser::If); - setState(879); - match(CPP14Parser::LeftParen); - setState(880); - condition(); - setState(881); - match(CPP14Parser::RightParen); - setState(882); - statement(); - setState(885); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 81, _ctx)) { - case 1: { - setState(883); - match(CPP14Parser::Else); - setState(884); - statement(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::Switch: { - enterOuterAlt(_localctx, 2); - setState(887); - match(CPP14Parser::Switch); - setState(888); - match(CPP14Parser::LeftParen); - setState(889); - condition(); - setState(890); - match(CPP14Parser::RightParen); - setState(891); - statement(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConditionContext ------------------------------------------------------------------ - -CPP14Parser::ConditionContext::ConditionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ExpressionContext* CPP14Parser::ConditionContext::expression() { - return getRuleContext(0); -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ConditionContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclaratorContext* CPP14Parser::ConditionContext::declarator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ConditionContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::InitializerClauseContext* CPP14Parser::ConditionContext::initializerClause() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::ConditionContext::bracedInitList() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ConditionContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConditionContext::getRuleIndex() const { - return CPP14Parser::RuleCondition; -} - - -CPP14Parser::ConditionContext* CPP14Parser::condition() { - ConditionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 106, CPP14Parser::RuleCondition); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(906); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 85, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(895); - expression(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(897); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(896); - attributeSpecifierSeq(); - } - setState(899); - declSpecifierSeq(); - setState(900); - declarator(); - setState(904); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Assign: { - setState(901); - match(CPP14Parser::Assign); - setState(902); - initializerClause(); - break; - } - - case CPP14Parser::LeftBrace: { - setState(903); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- IterationStatementContext ------------------------------------------------------------------ - -CPP14Parser::IterationStatementContext::IterationStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::While() { - return getToken(CPP14Parser::While, 0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ConditionContext* CPP14Parser::IterationStatementContext::condition() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::StatementContext* CPP14Parser::IterationStatementContext::statement() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::Do() { - return getToken(CPP14Parser::Do, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::IterationStatementContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::For() { - return getToken(CPP14Parser::For, 0); -} - -CPP14Parser::ForInitStatementContext* CPP14Parser::IterationStatementContext::forInitStatement() { - return getRuleContext(0); -} - -CPP14Parser::ForRangeDeclarationContext* CPP14Parser::IterationStatementContext::forRangeDeclaration() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::IterationStatementContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::ForRangeInitializerContext* CPP14Parser::IterationStatementContext::forRangeInitializer() { - return getRuleContext(0); -} - - -size_t CPP14Parser::IterationStatementContext::getRuleIndex() const { - return CPP14Parser::RuleIterationStatement; -} - - -CPP14Parser::IterationStatementContext* CPP14Parser::iterationStatement() { - IterationStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 108, CPP14Parser::RuleIterationStatement); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(941); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::While: { - enterOuterAlt(_localctx, 1); - setState(908); - match(CPP14Parser::While); - setState(909); - match(CPP14Parser::LeftParen); - setState(910); - condition(); - setState(911); - match(CPP14Parser::RightParen); - setState(912); - statement(); - break; - } - - case CPP14Parser::Do: { - enterOuterAlt(_localctx, 2); - setState(914); - match(CPP14Parser::Do); - setState(915); - statement(); - setState(916); - match(CPP14Parser::While); - setState(917); - match(CPP14Parser::LeftParen); - setState(918); - expression(); - setState(919); - match(CPP14Parser::RightParen); - setState(920); - match(CPP14Parser::Semi); - break; - } - - case CPP14Parser::For: { - enterOuterAlt(_localctx, 3); - setState(922); - match(CPP14Parser::For); - setState(923); - match(CPP14Parser::LeftParen); - setState(936); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 88, _ctx)) { - case 1: { - setState(924); - forInitStatement(); - setState(926); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & -714116761242538754) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384301683) != 0) || _la == CPP14Parser::Identifier) { - setState(925); - condition(); - } - setState(928); - match(CPP14Parser::Semi); - setState(930); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { - setState(929); - expression(); - } - break; - } - - case 2: { - setState(932); - forRangeDeclaration(); - setState(933); - match(CPP14Parser::Colon); - setState(934); - forRangeInitializer(); - break; - } - - default: - break; - } - setState(938); - match(CPP14Parser::RightParen); - setState(939); - statement(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ForInitStatementContext ------------------------------------------------------------------ - -CPP14Parser::ForInitStatementContext::ForInitStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ExpressionStatementContext* CPP14Parser::ForInitStatementContext::expressionStatement() { - return getRuleContext(0); -} - -CPP14Parser::SimpleDeclarationContext* CPP14Parser::ForInitStatementContext::simpleDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ForInitStatementContext::getRuleIndex() const { - return CPP14Parser::RuleForInitStatement; -} - - -CPP14Parser::ForInitStatementContext* CPP14Parser::forInitStatement() { - ForInitStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 110, CPP14Parser::RuleForInitStatement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(945); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 90, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(943); - expressionStatement(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(944); - simpleDeclaration(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ForRangeDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::ForRangeDeclarationContext::ForRangeDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ForRangeDeclarationContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclaratorContext* CPP14Parser::ForRangeDeclarationContext::declarator() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ForRangeDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ForRangeDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleForRangeDeclaration; -} - - -CPP14Parser::ForRangeDeclarationContext* CPP14Parser::forRangeDeclaration() { - ForRangeDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 112, CPP14Parser::RuleForRangeDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(948); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(947); - attributeSpecifierSeq(); - } - setState(950); - declSpecifierSeq(); - setState(951); - declarator(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ForRangeInitializerContext ------------------------------------------------------------------ - -CPP14Parser::ForRangeInitializerContext::ForRangeInitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ExpressionContext* CPP14Parser::ForRangeInitializerContext::expression() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::ForRangeInitializerContext::bracedInitList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ForRangeInitializerContext::getRuleIndex() const { - return CPP14Parser::RuleForRangeInitializer; -} - - -CPP14Parser::ForRangeInitializerContext* CPP14Parser::forRangeInitializer() { - ForRangeInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 114, CPP14Parser::RuleForRangeInitializer); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(955); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::Alignof: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Const_cast: - case CPP14Parser::Decltype: - case CPP14Parser::Delete: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Operator: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static_cast: - case CPP14Parser::This: - case CPP14Parser::Throw: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(953); - expression(); - break; - } - - case CPP14Parser::LeftBrace: { - enterOuterAlt(_localctx, 2); - setState(954); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- JumpStatementContext ------------------------------------------------------------------ - -CPP14Parser::JumpStatementContext::JumpStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Break() { - return getToken(CPP14Parser::Break, 0); -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Continue() { - return getToken(CPP14Parser::Continue, 0); -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Return() { - return getToken(CPP14Parser::Return, 0); -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Goto() { - return getToken(CPP14Parser::Goto, 0); -} - -tree::TerminalNode* CPP14Parser::JumpStatementContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::JumpStatementContext::expression() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::JumpStatementContext::bracedInitList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::JumpStatementContext::getRuleIndex() const { - return CPP14Parser::RuleJumpStatement; -} - - -CPP14Parser::JumpStatementContext* CPP14Parser::jumpStatement() { - JumpStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 116, CPP14Parser::RuleJumpStatement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(966); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Break: { - setState(957); - match(CPP14Parser::Break); - break; - } - - case CPP14Parser::Continue: { - setState(958); - match(CPP14Parser::Continue); - break; - } - - case CPP14Parser::Return: { - setState(959); - match(CPP14Parser::Return); - setState(962); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::Alignof: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Const_cast: - case CPP14Parser::Decltype: - case CPP14Parser::Delete: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Operator: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static_cast: - case CPP14Parser::This: - case CPP14Parser::Throw: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - setState(960); - expression(); - break; - } - - case CPP14Parser::LeftBrace: { - setState(961); - bracedInitList(); - break; - } - - case CPP14Parser::Semi: { - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::Goto: { - setState(964); - match(CPP14Parser::Goto); - setState(965); - match(CPP14Parser::Identifier); - break; - } - - default: - throw NoViableAltException(this); - } - setState(968); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclarationStatementContext ------------------------------------------------------------------ - -CPP14Parser::DeclarationStatementContext::DeclarationStatementContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::BlockDeclarationContext* CPP14Parser::DeclarationStatementContext::blockDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::DeclarationStatementContext::getRuleIndex() const { - return CPP14Parser::RuleDeclarationStatement; -} - - -CPP14Parser::DeclarationStatementContext* CPP14Parser::declarationStatement() { - DeclarationStatementContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 118, CPP14Parser::RuleDeclarationStatement); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(970); - blockDeclaration(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclarationseqContext ------------------------------------------------------------------ - -CPP14Parser::DeclarationseqContext::DeclarationseqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::DeclarationseqContext::declaration() { - return getRuleContexts(); -} - -CPP14Parser::DeclarationContext* CPP14Parser::DeclarationseqContext::declaration(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::DeclarationseqContext::getRuleIndex() const { - return CPP14Parser::RuleDeclarationseq; -} - - -CPP14Parser::DeclarationseqContext* CPP14Parser::declarationseq() { - DeclarationseqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 120, CPP14Parser::RuleDeclarationseq); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(973); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(972); - declaration(); - setState(975); - _errHandler->sync(this); - _la = _input->LA(1); - } while (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 459384754220313597) != 0)); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclarationContext ------------------------------------------------------------------ - -CPP14Parser::DeclarationContext::DeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::BlockDeclarationContext* CPP14Parser::DeclarationContext::blockDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::FunctionDefinitionContext* CPP14Parser::DeclarationContext::functionDefinition() { - return getRuleContext(0); -} - -CPP14Parser::TemplateDeclarationContext* CPP14Parser::DeclarationContext::templateDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::ExplicitInstantiationContext* CPP14Parser::DeclarationContext::explicitInstantiation() { - return getRuleContext(0); -} - -CPP14Parser::ExplicitSpecializationContext* CPP14Parser::DeclarationContext::explicitSpecialization() { - return getRuleContext(0); -} - -CPP14Parser::LinkageSpecificationContext* CPP14Parser::DeclarationContext::linkageSpecification() { - return getRuleContext(0); -} - -CPP14Parser::NamespaceDefinitionContext* CPP14Parser::DeclarationContext::namespaceDefinition() { - return getRuleContext(0); -} - -CPP14Parser::EmptyDeclarationContext* CPP14Parser::DeclarationContext::emptyDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::AttributeDeclarationContext* CPP14Parser::DeclarationContext::attributeDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::DeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleDeclaration; -} - - -CPP14Parser::DeclarationContext* CPP14Parser::declaration() { - DeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 122, CPP14Parser::RuleDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(986); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 96, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(977); - blockDeclaration(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(978); - functionDefinition(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(979); - templateDeclaration(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(980); - explicitInstantiation(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(981); - explicitSpecialization(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(982); - linkageSpecification(); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(983); - namespaceDefinition(); - break; - } - - case 8: { - enterOuterAlt(_localctx, 8); - setState(984); - emptyDeclaration(); - break; - } - - case 9: { - enterOuterAlt(_localctx, 9); - setState(985); - attributeDeclaration(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BlockDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::BlockDeclarationContext::BlockDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::SimpleDeclarationContext* CPP14Parser::BlockDeclarationContext::simpleDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::AsmDefinitionContext* CPP14Parser::BlockDeclarationContext::asmDefinition() { - return getRuleContext(0); -} - -CPP14Parser::NamespaceAliasDefinitionContext* CPP14Parser::BlockDeclarationContext::namespaceAliasDefinition() { - return getRuleContext(0); -} - -CPP14Parser::UsingDeclarationContext* CPP14Parser::BlockDeclarationContext::usingDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::UsingDirectiveContext* CPP14Parser::BlockDeclarationContext::usingDirective() { - return getRuleContext(0); -} - -CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::BlockDeclarationContext::staticAssertDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::AliasDeclarationContext* CPP14Parser::BlockDeclarationContext::aliasDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::OpaqueEnumDeclarationContext* CPP14Parser::BlockDeclarationContext::opaqueEnumDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::BlockDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleBlockDeclaration; -} - - -CPP14Parser::BlockDeclarationContext* CPP14Parser::blockDeclaration() { - BlockDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 124, CPP14Parser::RuleBlockDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(996); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 97, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(988); - simpleDeclaration(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(989); - asmDefinition(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(990); - namespaceAliasDefinition(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(991); - usingDeclaration(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(992); - usingDirective(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(993); - staticAssertDeclaration(); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(994); - aliasDeclaration(); - break; - } - - case 8: { - enterOuterAlt(_localctx, 8); - setState(995); - opaqueEnumDeclaration(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AliasDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::AliasDeclarationContext::AliasDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Using() { - return getToken(CPP14Parser::Using, 0); -} - -tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::AliasDeclarationContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::AliasDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::AliasDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AliasDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleAliasDeclaration; -} - - -CPP14Parser::AliasDeclarationContext* CPP14Parser::aliasDeclaration() { - AliasDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 126, CPP14Parser::RuleAliasDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(998); - match(CPP14Parser::Using); - setState(999); - match(CPP14Parser::Identifier); - setState(1001); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1000); - attributeSpecifierSeq(); - } - setState(1003); - match(CPP14Parser::Assign); - setState(1004); - theTypeId(); - setState(1005); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::SimpleDeclarationContext::SimpleDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::SimpleDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::SimpleDeclarationContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::InitDeclaratorListContext* CPP14Parser::SimpleDeclarationContext::initDeclaratorList() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::SimpleDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::SimpleDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleDeclaration; -} - - -CPP14Parser::SimpleDeclarationContext* CPP14Parser::simpleDeclaration() { - SimpleDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 128, CPP14Parser::RuleSimpleDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1021); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Constexpr: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Explicit: - case CPP14Parser::Extern: - case CPP14Parser::Float: - case CPP14Parser::Friend: - case CPP14Parser::Inline: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Mutable: - case CPP14Parser::Operator: - case CPP14Parser::Register: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Static: - case CPP14Parser::Struct: - case CPP14Parser::Thread_local: - case CPP14Parser::Typedef: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Virtual: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Tilde: - case CPP14Parser::AndAnd: - case CPP14Parser::Doublecolon: - case CPP14Parser::Semi: - case CPP14Parser::Ellipsis: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(1008); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 99, _ctx)) { - case 1: { - setState(1007); - declSpecifierSeq(); - break; - } - - default: - break; - } - setState(1011); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Decltype - - || _la == CPP14Parser::Operator || ((((_la - 85) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 85)) & 215512868999425) != 0)) { - setState(1010); - initDeclaratorList(); - } - setState(1013); - match(CPP14Parser::Semi); - break; - } - - case CPP14Parser::Alignas: - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 2); - setState(1014); - attributeSpecifierSeq(); - setState(1016); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 101, _ctx)) { - case 1: { - setState(1015); - declSpecifierSeq(); - break; - } - - default: - break; - } - setState(1018); - initDeclaratorList(); - setState(1019); - match(CPP14Parser::Semi); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- StaticAssertDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::StaticAssertDeclarationContext::StaticAssertDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Static_assert() { - return getToken(CPP14Parser::Static_assert, 0); -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::StaticAssertDeclarationContext::constantExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::StringLiteral() { - return getToken(CPP14Parser::StringLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -tree::TerminalNode* CPP14Parser::StaticAssertDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - - -size_t CPP14Parser::StaticAssertDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleStaticAssertDeclaration; -} - - -CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::staticAssertDeclaration() { - StaticAssertDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 130, CPP14Parser::RuleStaticAssertDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1023); - match(CPP14Parser::Static_assert); - setState(1024); - match(CPP14Parser::LeftParen); - setState(1025); - constantExpression(); - setState(1026); - match(CPP14Parser::Comma); - setState(1027); - match(CPP14Parser::StringLiteral); - setState(1028); - match(CPP14Parser::RightParen); - setState(1029); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EmptyDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::EmptyDeclarationContext::EmptyDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::EmptyDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - - -size_t CPP14Parser::EmptyDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleEmptyDeclaration; -} - - -CPP14Parser::EmptyDeclarationContext* CPP14Parser::emptyDeclaration() { - EmptyDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 132, CPP14Parser::RuleEmptyDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1031); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::AttributeDeclarationContext::AttributeDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::AttributeDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::AttributeDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - - -size_t CPP14Parser::AttributeDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeDeclaration; -} - - -CPP14Parser::AttributeDeclarationContext* CPP14Parser::attributeDeclaration() { - AttributeDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 134, CPP14Parser::RuleAttributeDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1033); - attributeSpecifierSeq(); - setState(1034); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::DeclSpecifierContext::DeclSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::StorageClassSpecifierContext* CPP14Parser::DeclSpecifierContext::storageClassSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::TypeSpecifierContext* CPP14Parser::DeclSpecifierContext::typeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::FunctionSpecifierContext* CPP14Parser::DeclSpecifierContext::functionSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Friend() { - return getToken(CPP14Parser::Friend, 0); -} - -tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Typedef() { - return getToken(CPP14Parser::Typedef, 0); -} - -tree::TerminalNode* CPP14Parser::DeclSpecifierContext::Constexpr() { - return getToken(CPP14Parser::Constexpr, 0); -} - - -size_t CPP14Parser::DeclSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleDeclSpecifier; -} - - -CPP14Parser::DeclSpecifierContext* CPP14Parser::declSpecifier() { - DeclSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 136, CPP14Parser::RuleDeclSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1042); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Extern: - case CPP14Parser::Mutable: - case CPP14Parser::Register: - case CPP14Parser::Static: - case CPP14Parser::Thread_local: { - enterOuterAlt(_localctx, 1); - setState(1036); - storageClassSpecifier(); - break; - } - - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Struct: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 2); - setState(1037); - typeSpecifier(); - break; - } - - case CPP14Parser::Explicit: - case CPP14Parser::Inline: - case CPP14Parser::Virtual: { - enterOuterAlt(_localctx, 3); - setState(1038); - functionSpecifier(); - break; - } - - case CPP14Parser::Friend: { - enterOuterAlt(_localctx, 4); - setState(1039); - match(CPP14Parser::Friend); - break; - } - - case CPP14Parser::Typedef: { - enterOuterAlt(_localctx, 5); - setState(1040); - match(CPP14Parser::Typedef); - break; - } - - case CPP14Parser::Constexpr: { - enterOuterAlt(_localctx, 6); - setState(1041); - match(CPP14Parser::Constexpr); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclSpecifierSeqContext ------------------------------------------------------------------ - -CPP14Parser::DeclSpecifierSeqContext::DeclSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::DeclSpecifierSeqContext::declSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::DeclSpecifierContext* CPP14Parser::DeclSpecifierSeqContext::declSpecifier(size_t i) { - return getRuleContext(i); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::DeclSpecifierSeqContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::DeclSpecifierSeqContext::getRuleIndex() const { - return CPP14Parser::RuleDeclSpecifierSeq; -} - - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::declSpecifierSeq() { - DeclSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 138, CPP14Parser::RuleDeclSpecifierSeq); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1045); - _errHandler->sync(this); - alt = 1 + 1; - do { - switch (alt) { - case 1 + 1: { - setState(1044); - declSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1047); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 104, _ctx); - } while (alt != 1 && alt != atn::ATN::INVALID_ALT_NUMBER); - setState(1050); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 105, _ctx)) { - case 1: { - setState(1049); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- StorageClassSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::StorageClassSpecifierContext::StorageClassSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Register() { - return getToken(CPP14Parser::Register, 0); -} - -tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Static() { - return getToken(CPP14Parser::Static, 0); -} - -tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Thread_local() { - return getToken(CPP14Parser::Thread_local, 0); -} - -tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Extern() { - return getToken(CPP14Parser::Extern, 0); -} - -tree::TerminalNode* CPP14Parser::StorageClassSpecifierContext::Mutable() { - return getToken(CPP14Parser::Mutable, 0); -} - - -size_t CPP14Parser::StorageClassSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleStorageClassSpecifier; -} - - -CPP14Parser::StorageClassSpecifierContext* CPP14Parser::storageClassSpecifier() { - StorageClassSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 140, CPP14Parser::RuleStorageClassSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1052); - _la = _input->LA(1); - if (!(((((_la - 36) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 36)) & 17316186113) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- FunctionSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::FunctionSpecifierContext::FunctionSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Inline() { - return getToken(CPP14Parser::Inline, 0); -} - -tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Virtual() { - return getToken(CPP14Parser::Virtual, 0); -} - -tree::TerminalNode* CPP14Parser::FunctionSpecifierContext::Explicit() { - return getToken(CPP14Parser::Explicit, 0); -} - - -size_t CPP14Parser::FunctionSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleFunctionSpecifier; -} - - -CPP14Parser::FunctionSpecifierContext* CPP14Parser::functionSpecifier() { - FunctionSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 142, CPP14Parser::RuleFunctionSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1054); - _la = _input->LA(1); - if (!(((((_la - 34) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 34)) & 70368744178689) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypedefNameContext ------------------------------------------------------------------ - -CPP14Parser::TypedefNameContext::TypedefNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TypedefNameContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::TypedefNameContext::getRuleIndex() const { - return CPP14Parser::RuleTypedefName; -} - - -CPP14Parser::TypedefNameContext* CPP14Parser::typedefName() { - TypedefNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 144, CPP14Parser::RuleTypedefName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1056); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::TypeSpecifierContext::TypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::TypeSpecifierContext::trailingTypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::ClassSpecifierContext* CPP14Parser::TypeSpecifierContext::classSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::EnumSpecifierContext* CPP14Parser::TypeSpecifierContext::enumSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleTypeSpecifier; -} - - -CPP14Parser::TypeSpecifierContext* CPP14Parser::typeSpecifier() { - TypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 146, CPP14Parser::RuleTypeSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1061); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 106, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1058); - trailingTypeSpecifier(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1059); - classSpecifier(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1060); - enumSpecifier(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TrailingTypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::TrailingTypeSpecifierContext::TrailingTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::simpleTypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::ElaboratedTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::elaboratedTypeSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::TypeNameSpecifierContext* CPP14Parser::TrailingTypeSpecifierContext::typeNameSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::CvQualifierContext* CPP14Parser::TrailingTypeSpecifierContext::cvQualifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TrailingTypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleTrailingTypeSpecifier; -} - - -CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::trailingTypeSpecifier() { - TrailingTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 148, CPP14Parser::RuleTrailingTypeSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1067); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(1063); - simpleTypeSpecifier(); - break; - } - - case CPP14Parser::Class: - case CPP14Parser::Enum: - case CPP14Parser::Struct: { - enterOuterAlt(_localctx, 2); - setState(1064); - elaboratedTypeSpecifier(); - break; - } - - case CPP14Parser::Typename_: { - enterOuterAlt(_localctx, 3); - setState(1065); - typeNameSpecifier(); - break; - } - - case CPP14Parser::Const: - case CPP14Parser::Volatile: { - enterOuterAlt(_localctx, 4); - setState(1066); - cvQualifier(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypeSpecifierSeqContext ------------------------------------------------------------------ - -CPP14Parser::TypeSpecifierSeqContext::TypeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::TypeSpecifierSeqContext::typeSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::TypeSpecifierContext* CPP14Parser::TypeSpecifierSeqContext::typeSpecifier(size_t i) { - return getRuleContext(i); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::TypeSpecifierSeqContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TypeSpecifierSeqContext::getRuleIndex() const { - return CPP14Parser::RuleTypeSpecifierSeq; -} - - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::typeSpecifierSeq() { - TypeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 150, CPP14Parser::RuleTypeSpecifierSeq); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1070); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1069); - typeSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1072); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 108, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - setState(1075); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 109, _ctx)) { - case 1: { - setState(1074); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TrailingTypeSpecifierSeqContext ------------------------------------------------------------------ - -CPP14Parser::TrailingTypeSpecifierSeqContext::TrailingTypeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::TrailingTypeSpecifierSeqContext::trailingTypeSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::TrailingTypeSpecifierContext* CPP14Parser::TrailingTypeSpecifierSeqContext::trailingTypeSpecifier(size_t i) { - return getRuleContext(i); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::TrailingTypeSpecifierSeqContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TrailingTypeSpecifierSeqContext::getRuleIndex() const { - return CPP14Parser::RuleTrailingTypeSpecifierSeq; -} - - -CPP14Parser::TrailingTypeSpecifierSeqContext* CPP14Parser::trailingTypeSpecifierSeq() { - TrailingTypeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 152, CPP14Parser::RuleTrailingTypeSpecifierSeq); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1078); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1077); - trailingTypeSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1080); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 110, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - setState(1083); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 111, _ctx)) { - case 1: { - setState(1082); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleTypeLengthModifierContext ------------------------------------------------------------------ - -CPP14Parser::SimpleTypeLengthModifierContext::SimpleTypeLengthModifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::SimpleTypeLengthModifierContext::Short() { - return getToken(CPP14Parser::Short, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeLengthModifierContext::Long() { - return getToken(CPP14Parser::Long, 0); -} - - -size_t CPP14Parser::SimpleTypeLengthModifierContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleTypeLengthModifier; -} - - -CPP14Parser::SimpleTypeLengthModifierContext* CPP14Parser::simpleTypeLengthModifier() { - SimpleTypeLengthModifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 154, CPP14Parser::RuleSimpleTypeLengthModifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1085); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Long - - || _la == CPP14Parser::Short)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleTypeSignednessModifierContext ------------------------------------------------------------------ - -CPP14Parser::SimpleTypeSignednessModifierContext::SimpleTypeSignednessModifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSignednessModifierContext::Unsigned() { - return getToken(CPP14Parser::Unsigned, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSignednessModifierContext::Signed() { - return getToken(CPP14Parser::Signed, 0); -} - - -size_t CPP14Parser::SimpleTypeSignednessModifierContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleTypeSignednessModifier; -} - - -CPP14Parser::SimpleTypeSignednessModifierContext* CPP14Parser::simpleTypeSignednessModifier() { - SimpleTypeSignednessModifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 156, CPP14Parser::RuleSimpleTypeSignednessModifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1087); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleTypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::SimpleTypeSpecifierContext::SimpleTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TheTypeNameContext* CPP14Parser::SimpleTypeSpecifierContext::theTypeName() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::SimpleTypeSpecifierContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTemplateId() { - return getRuleContext(0); -} - -CPP14Parser::SimpleTypeSignednessModifierContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTypeSignednessModifier() { - return getRuleContext(0); -} - -std::vector CPP14Parser::SimpleTypeSpecifierContext::simpleTypeLengthModifier() { - return getRuleContexts(); -} - -CPP14Parser::SimpleTypeLengthModifierContext* CPP14Parser::SimpleTypeSpecifierContext::simpleTypeLengthModifier(size_t i) { - return getRuleContext(i); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char() { - return getToken(CPP14Parser::Char, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char16() { - return getToken(CPP14Parser::Char16, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Char32() { - return getToken(CPP14Parser::Char32, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Wchar() { - return getToken(CPP14Parser::Wchar, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Bool() { - return getToken(CPP14Parser::Bool, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Int() { - return getToken(CPP14Parser::Int, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Float() { - return getToken(CPP14Parser::Float, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Double() { - return getToken(CPP14Parser::Double, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Void() { - return getToken(CPP14Parser::Void, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTypeSpecifierContext::Auto() { - return getToken(CPP14Parser::Auto, 0); -} - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::SimpleTypeSpecifierContext::decltypeSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::SimpleTypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleTypeSpecifier; -} - - -CPP14Parser::SimpleTypeSpecifierContext* CPP14Parser::simpleTypeSpecifier() { - SimpleTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 158, CPP14Parser::RuleSimpleTypeSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - setState(1141); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 122, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1090); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 112, _ctx)) { - case 1: { - setState(1089); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1092); - theTypeName(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1093); - nestedNameSpecifier(0); - setState(1094); - match(CPP14Parser::Template); - setState(1095); - simpleTemplateId(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1097); - simpleTypeSignednessModifier(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(1099); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1098); - simpleTypeSignednessModifier(); - } - setState(1102); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1101); - simpleTypeLengthModifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1104); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 114, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(1107); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1106); - simpleTypeSignednessModifier(); - } - setState(1109); - match(CPP14Parser::Char); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(1111); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1110); - simpleTypeSignednessModifier(); - } - setState(1113); - match(CPP14Parser::Char16); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(1115); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1114); - simpleTypeSignednessModifier(); - } - setState(1117); - match(CPP14Parser::Char32); - break; - } - - case 8: { - enterOuterAlt(_localctx, 8); - setState(1119); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1118); - simpleTypeSignednessModifier(); - } - setState(1121); - match(CPP14Parser::Wchar); - break; - } - - case 9: { - enterOuterAlt(_localctx, 9); - setState(1122); - match(CPP14Parser::Bool); - break; - } - - case 10: { - enterOuterAlt(_localctx, 10); - setState(1124); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Signed - - || _la == CPP14Parser::Unsigned) { - setState(1123); - simpleTypeSignednessModifier(); - } - setState(1129); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Long - - || _la == CPP14Parser::Short) { - setState(1126); - simpleTypeLengthModifier(); - setState(1131); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1132); - match(CPP14Parser::Int); - break; - } - - case 11: { - enterOuterAlt(_localctx, 11); - setState(1133); - match(CPP14Parser::Float); - break; - } - - case 12: { - enterOuterAlt(_localctx, 12); - setState(1135); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Long - - || _la == CPP14Parser::Short) { - setState(1134); - simpleTypeLengthModifier(); - } - setState(1137); - match(CPP14Parser::Double); - break; - } - - case 13: { - enterOuterAlt(_localctx, 13); - setState(1138); - match(CPP14Parser::Void); - break; - } - - case 14: { - enterOuterAlt(_localctx, 14); - setState(1139); - match(CPP14Parser::Auto); - break; - } - - case 15: { - enterOuterAlt(_localctx, 15); - setState(1140); - decltypeSpecifier(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TheTypeNameContext ------------------------------------------------------------------ - -CPP14Parser::TheTypeNameContext::TheTypeNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassNameContext* CPP14Parser::TheTypeNameContext::className() { - return getRuleContext(0); -} - -CPP14Parser::EnumNameContext* CPP14Parser::TheTypeNameContext::enumName() { - return getRuleContext(0); -} - -CPP14Parser::TypedefNameContext* CPP14Parser::TheTypeNameContext::typedefName() { - return getRuleContext(0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TheTypeNameContext::simpleTemplateId() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TheTypeNameContext::getRuleIndex() const { - return CPP14Parser::RuleTheTypeName; -} - - -CPP14Parser::TheTypeNameContext* CPP14Parser::theTypeName() { - TheTypeNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 160, CPP14Parser::RuleTheTypeName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1147); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 123, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1143); - className(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1144); - enumName(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1145); - typedefName(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(1146); - simpleTemplateId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DecltypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::DecltypeSpecifierContext::DecltypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::Decltype() { - return getToken(CPP14Parser::Decltype, 0); -} - -tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::ExpressionContext* CPP14Parser::DecltypeSpecifierContext::expression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::DecltypeSpecifierContext::Auto() { - return getToken(CPP14Parser::Auto, 0); -} - - -size_t CPP14Parser::DecltypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleDecltypeSpecifier; -} - - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::decltypeSpecifier() { - DecltypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 162, CPP14Parser::RuleDecltypeSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1149); - match(CPP14Parser::Decltype); - setState(1150); - match(CPP14Parser::LeftParen); - setState(1153); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 124, _ctx)) { - case 1: { - setState(1151); - expression(); - break; - } - - case 2: { - setState(1152); - match(CPP14Parser::Auto); - break; - } - - default: - break; - } - setState(1155); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ElaboratedTypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::ElaboratedTypeSpecifierContext::ElaboratedTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassKeyContext* CPP14Parser::ElaboratedTypeSpecifierContext::classKey() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::ElaboratedTypeSpecifierContext::simpleTemplateId() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ElaboratedTypeSpecifierContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ElaboratedTypeSpecifierContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -tree::TerminalNode* CPP14Parser::ElaboratedTypeSpecifierContext::Enum() { - return getToken(CPP14Parser::Enum, 0); -} - - -size_t CPP14Parser::ElaboratedTypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleElaboratedTypeSpecifier; -} - - -CPP14Parser::ElaboratedTypeSpecifierContext* CPP14Parser::elaboratedTypeSpecifier() { - ElaboratedTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 164, CPP14Parser::RuleElaboratedTypeSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1179); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Class: - case CPP14Parser::Struct: { - enterOuterAlt(_localctx, 1); - setState(1157); - classKey(); - setState(1172); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 128, _ctx)) { - case 1: { - setState(1159); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1158); - attributeSpecifierSeq(); - } - setState(1162); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 126, _ctx)) { - case 1: { - setState(1161); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1164); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - setState(1165); - simpleTemplateId(); - break; - } - - case 3: { - setState(1166); - nestedNameSpecifier(0); - setState(1168); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(1167); - match(CPP14Parser::Template); - } - setState(1170); - simpleTemplateId(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::Enum: { - enterOuterAlt(_localctx, 2); - setState(1174); - match(CPP14Parser::Enum); - setState(1176); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 129, _ctx)) { - case 1: { - setState(1175); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1178); - match(CPP14Parser::Identifier); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumNameContext ------------------------------------------------------------------ - -CPP14Parser::EnumNameContext::EnumNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::EnumNameContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::EnumNameContext::getRuleIndex() const { - return CPP14Parser::RuleEnumName; -} - - -CPP14Parser::EnumNameContext* CPP14Parser::enumName() { - EnumNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 166, CPP14Parser::RuleEnumName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1181); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::EnumSpecifierContext::EnumSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::EnumHeadContext* CPP14Parser::EnumSpecifierContext::enumHead() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::EnumSpecifierContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::EnumSpecifierContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -CPP14Parser::EnumeratorListContext* CPP14Parser::EnumSpecifierContext::enumeratorList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::EnumSpecifierContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - - -size_t CPP14Parser::EnumSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleEnumSpecifier; -} - - -CPP14Parser::EnumSpecifierContext* CPP14Parser::enumSpecifier() { - EnumSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 168, CPP14Parser::RuleEnumSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1183); - enumHead(); - setState(1184); - match(CPP14Parser::LeftBrace); - setState(1189); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(1185); - enumeratorList(); - setState(1187); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Comma) { - setState(1186); - match(CPP14Parser::Comma); - } - } - setState(1191); - match(CPP14Parser::RightBrace); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumHeadContext ------------------------------------------------------------------ - -CPP14Parser::EnumHeadContext::EnumHeadContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::EnumkeyContext* CPP14Parser::EnumHeadContext::enumkey() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::EnumHeadContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::EnumHeadContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::EnumbaseContext* CPP14Parser::EnumHeadContext::enumbase() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::EnumHeadContext::nestedNameSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::EnumHeadContext::getRuleIndex() const { - return CPP14Parser::RuleEnumHead; -} - - -CPP14Parser::EnumHeadContext* CPP14Parser::enumHead() { - EnumHeadContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 170, CPP14Parser::RuleEnumHead); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1193); - enumkey(); - setState(1195); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1194); - attributeSpecifierSeq(); - } - setState(1201); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon - - || _la == CPP14Parser::Identifier) { - setState(1198); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 134, _ctx)) { - case 1: { - setState(1197); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1200); - match(CPP14Parser::Identifier); - } - setState(1204); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Colon) { - setState(1203); - enumbase(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- OpaqueEnumDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::OpaqueEnumDeclarationContext::OpaqueEnumDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::EnumkeyContext* CPP14Parser::OpaqueEnumDeclarationContext::enumkey() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::OpaqueEnumDeclarationContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::OpaqueEnumDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::OpaqueEnumDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::EnumbaseContext* CPP14Parser::OpaqueEnumDeclarationContext::enumbase() { - return getRuleContext(0); -} - - -size_t CPP14Parser::OpaqueEnumDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleOpaqueEnumDeclaration; -} - - -CPP14Parser::OpaqueEnumDeclarationContext* CPP14Parser::opaqueEnumDeclaration() { - OpaqueEnumDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 172, CPP14Parser::RuleOpaqueEnumDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1206); - enumkey(); - setState(1208); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1207); - attributeSpecifierSeq(); - } - setState(1210); - match(CPP14Parser::Identifier); - setState(1212); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Colon) { - setState(1211); - enumbase(); - } - setState(1214); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumkeyContext ------------------------------------------------------------------ - -CPP14Parser::EnumkeyContext::EnumkeyContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::EnumkeyContext::Enum() { - return getToken(CPP14Parser::Enum, 0); -} - -tree::TerminalNode* CPP14Parser::EnumkeyContext::Class() { - return getToken(CPP14Parser::Class, 0); -} - -tree::TerminalNode* CPP14Parser::EnumkeyContext::Struct() { - return getToken(CPP14Parser::Struct, 0); -} - - -size_t CPP14Parser::EnumkeyContext::getRuleIndex() const { - return CPP14Parser::RuleEnumkey; -} - - -CPP14Parser::EnumkeyContext* CPP14Parser::enumkey() { - EnumkeyContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 174, CPP14Parser::RuleEnumkey); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1216); - match(CPP14Parser::Enum); - setState(1218); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Class - - || _la == CPP14Parser::Struct) { - setState(1217); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Class - - || _la == CPP14Parser::Struct)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumbaseContext ------------------------------------------------------------------ - -CPP14Parser::EnumbaseContext::EnumbaseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::EnumbaseContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::EnumbaseContext::typeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::EnumbaseContext::getRuleIndex() const { - return CPP14Parser::RuleEnumbase; -} - - -CPP14Parser::EnumbaseContext* CPP14Parser::enumbase() { - EnumbaseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 176, CPP14Parser::RuleEnumbase); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1220); - match(CPP14Parser::Colon); - setState(1221); - typeSpecifierSeq(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumeratorListContext ------------------------------------------------------------------ - -CPP14Parser::EnumeratorListContext::EnumeratorListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::EnumeratorListContext::enumeratorDefinition() { - return getRuleContexts(); -} - -CPP14Parser::EnumeratorDefinitionContext* CPP14Parser::EnumeratorListContext::enumeratorDefinition(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::EnumeratorListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::EnumeratorListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::EnumeratorListContext::getRuleIndex() const { - return CPP14Parser::RuleEnumeratorList; -} - - -CPP14Parser::EnumeratorListContext* CPP14Parser::enumeratorList() { - EnumeratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 178, CPP14Parser::RuleEnumeratorList); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1223); - enumeratorDefinition(); - setState(1228); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 140, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1224); - match(CPP14Parser::Comma); - setState(1225); - enumeratorDefinition(); - } - setState(1230); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 140, _ctx); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumeratorDefinitionContext ------------------------------------------------------------------ - -CPP14Parser::EnumeratorDefinitionContext::EnumeratorDefinitionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::EnumeratorContext* CPP14Parser::EnumeratorDefinitionContext::enumerator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::EnumeratorDefinitionContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::EnumeratorDefinitionContext::constantExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::EnumeratorDefinitionContext::getRuleIndex() const { - return CPP14Parser::RuleEnumeratorDefinition; -} - - -CPP14Parser::EnumeratorDefinitionContext* CPP14Parser::enumeratorDefinition() { - EnumeratorDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 180, CPP14Parser::RuleEnumeratorDefinition); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1231); - enumerator(); - setState(1234); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Assign) { - setState(1232); - match(CPP14Parser::Assign); - setState(1233); - constantExpression(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- EnumeratorContext ------------------------------------------------------------------ - -CPP14Parser::EnumeratorContext::EnumeratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::EnumeratorContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::EnumeratorContext::getRuleIndex() const { - return CPP14Parser::RuleEnumerator; -} - - -CPP14Parser::EnumeratorContext* CPP14Parser::enumerator() { - EnumeratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 182, CPP14Parser::RuleEnumerator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1236); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NamespaceNameContext ------------------------------------------------------------------ - -CPP14Parser::NamespaceNameContext::NamespaceNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::NamespaceNameContext::originalNamespaceName() { - return getRuleContext(0); -} - -CPP14Parser::NamespaceAliasContext* CPP14Parser::NamespaceNameContext::namespaceAlias() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NamespaceNameContext::getRuleIndex() const { - return CPP14Parser::RuleNamespaceName; -} - - -CPP14Parser::NamespaceNameContext* CPP14Parser::namespaceName() { - NamespaceNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 184, CPP14Parser::RuleNamespaceName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1240); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 142, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1238); - originalNamespaceName(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1239); - namespaceAlias(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- OriginalNamespaceNameContext ------------------------------------------------------------------ - -CPP14Parser::OriginalNamespaceNameContext::OriginalNamespaceNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::OriginalNamespaceNameContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::OriginalNamespaceNameContext::getRuleIndex() const { - return CPP14Parser::RuleOriginalNamespaceName; -} - - -CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::originalNamespaceName() { - OriginalNamespaceNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 186, CPP14Parser::RuleOriginalNamespaceName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1242); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NamespaceDefinitionContext ------------------------------------------------------------------ - -CPP14Parser::NamespaceDefinitionContext::NamespaceDefinitionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Namespace() { - return getToken(CPP14Parser::Namespace, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Inline() { - return getToken(CPP14Parser::Inline, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceDefinitionContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::OriginalNamespaceNameContext* CPP14Parser::NamespaceDefinitionContext::originalNamespaceName() { - return getRuleContext(0); -} - -CPP14Parser::DeclarationseqContext* CPP14Parser::NamespaceDefinitionContext::declarationseq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NamespaceDefinitionContext::getRuleIndex() const { - return CPP14Parser::RuleNamespaceDefinition; -} - - -CPP14Parser::NamespaceDefinitionContext* CPP14Parser::namespaceDefinition() { - NamespaceDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 188, CPP14Parser::RuleNamespaceDefinition); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1245); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Inline) { - setState(1244); - match(CPP14Parser::Inline); - } - setState(1247); - match(CPP14Parser::Namespace); - setState(1250); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 144, _ctx)) { - case 1: { - setState(1248); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - setState(1249); - originalNamespaceName(); - break; - } - - default: - break; - } - setState(1252); - match(CPP14Parser::LeftBrace); - setState(1254); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { - setState(1253); - antlrcpp::downCast(_localctx)->namespaceBody = declarationseq(); - } - setState(1256); - match(CPP14Parser::RightBrace); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NamespaceAliasContext ------------------------------------------------------------------ - -CPP14Parser::NamespaceAliasContext::NamespaceAliasContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NamespaceAliasContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::NamespaceAliasContext::getRuleIndex() const { - return CPP14Parser::RuleNamespaceAlias; -} - - -CPP14Parser::NamespaceAliasContext* CPP14Parser::namespaceAlias() { - NamespaceAliasContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 190, CPP14Parser::RuleNamespaceAlias); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1258); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NamespaceAliasDefinitionContext ------------------------------------------------------------------ - -CPP14Parser::NamespaceAliasDefinitionContext::NamespaceAliasDefinitionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Namespace() { - return getToken(CPP14Parser::Namespace, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::QualifiednamespacespecifierContext* CPP14Parser::NamespaceAliasDefinitionContext::qualifiednamespacespecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NamespaceAliasDefinitionContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - - -size_t CPP14Parser::NamespaceAliasDefinitionContext::getRuleIndex() const { - return CPP14Parser::RuleNamespaceAliasDefinition; -} - - -CPP14Parser::NamespaceAliasDefinitionContext* CPP14Parser::namespaceAliasDefinition() { - NamespaceAliasDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 192, CPP14Parser::RuleNamespaceAliasDefinition); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1260); - match(CPP14Parser::Namespace); - setState(1261); - match(CPP14Parser::Identifier); - setState(1262); - match(CPP14Parser::Assign); - setState(1263); - qualifiednamespacespecifier(); - setState(1264); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- QualifiednamespacespecifierContext ------------------------------------------------------------------ - -CPP14Parser::QualifiednamespacespecifierContext::QualifiednamespacespecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::NamespaceNameContext* CPP14Parser::QualifiednamespacespecifierContext::namespaceName() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::QualifiednamespacespecifierContext::nestedNameSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::QualifiednamespacespecifierContext::getRuleIndex() const { - return CPP14Parser::RuleQualifiednamespacespecifier; -} - - -CPP14Parser::QualifiednamespacespecifierContext* CPP14Parser::qualifiednamespacespecifier() { - QualifiednamespacespecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 194, CPP14Parser::RuleQualifiednamespacespecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1267); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 146, _ctx)) { - case 1: { - setState(1266); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1269); - namespaceName(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- UsingDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::UsingDeclarationContext::UsingDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Using() { - return getToken(CPP14Parser::Using, 0); -} - -CPP14Parser::UnqualifiedIdContext* CPP14Parser::UsingDeclarationContext::unqualifiedId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::UsingDeclarationContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UsingDeclarationContext::Typename_() { - return getToken(CPP14Parser::Typename_, 0); -} - - -size_t CPP14Parser::UsingDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleUsingDeclaration; -} - - -CPP14Parser::UsingDeclarationContext* CPP14Parser::usingDeclaration() { - UsingDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 196, CPP14Parser::RuleUsingDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1271); - match(CPP14Parser::Using); - setState(1277); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 148, _ctx)) { - case 1: { - setState(1273); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Typename_) { - setState(1272); - match(CPP14Parser::Typename_); - } - setState(1275); - nestedNameSpecifier(0); - break; - } - - case 2: { - setState(1276); - match(CPP14Parser::Doublecolon); - break; - } - - default: - break; - } - setState(1279); - unqualifiedId(); - setState(1280); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- UsingDirectiveContext ------------------------------------------------------------------ - -CPP14Parser::UsingDirectiveContext::UsingDirectiveContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Using() { - return getToken(CPP14Parser::Using, 0); -} - -tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Namespace() { - return getToken(CPP14Parser::Namespace, 0); -} - -CPP14Parser::NamespaceNameContext* CPP14Parser::UsingDirectiveContext::namespaceName() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::UsingDirectiveContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::UsingDirectiveContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::UsingDirectiveContext::nestedNameSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::UsingDirectiveContext::getRuleIndex() const { - return CPP14Parser::RuleUsingDirective; -} - - -CPP14Parser::UsingDirectiveContext* CPP14Parser::usingDirective() { - UsingDirectiveContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 198, CPP14Parser::RuleUsingDirective); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1283); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1282); - attributeSpecifierSeq(); - } - setState(1285); - match(CPP14Parser::Using); - setState(1286); - match(CPP14Parser::Namespace); - setState(1288); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 150, _ctx)) { - case 1: { - setState(1287); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1290); - namespaceName(); - setState(1291); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AsmDefinitionContext ------------------------------------------------------------------ - -CPP14Parser::AsmDefinitionContext::AsmDefinitionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AsmDefinitionContext::Asm() { - return getToken(CPP14Parser::Asm, 0); -} - -tree::TerminalNode* CPP14Parser::AsmDefinitionContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::AsmDefinitionContext::StringLiteral() { - return getToken(CPP14Parser::StringLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::AsmDefinitionContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -tree::TerminalNode* CPP14Parser::AsmDefinitionContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - - -size_t CPP14Parser::AsmDefinitionContext::getRuleIndex() const { - return CPP14Parser::RuleAsmDefinition; -} - - -CPP14Parser::AsmDefinitionContext* CPP14Parser::asmDefinition() { - AsmDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 200, CPP14Parser::RuleAsmDefinition); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1293); - match(CPP14Parser::Asm); - setState(1294); - match(CPP14Parser::LeftParen); - setState(1295); - match(CPP14Parser::StringLiteral); - setState(1296); - match(CPP14Parser::RightParen); - setState(1297); - match(CPP14Parser::Semi); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LinkageSpecificationContext ------------------------------------------------------------------ - -CPP14Parser::LinkageSpecificationContext::LinkageSpecificationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::Extern() { - return getToken(CPP14Parser::Extern, 0); -} - -tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::StringLiteral() { - return getToken(CPP14Parser::StringLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::LinkageSpecificationContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -CPP14Parser::DeclarationContext* CPP14Parser::LinkageSpecificationContext::declaration() { - return getRuleContext(0); -} - -CPP14Parser::DeclarationseqContext* CPP14Parser::LinkageSpecificationContext::declarationseq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::LinkageSpecificationContext::getRuleIndex() const { - return CPP14Parser::RuleLinkageSpecification; -} - - -CPP14Parser::LinkageSpecificationContext* CPP14Parser::linkageSpecification() { - LinkageSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 202, CPP14Parser::RuleLinkageSpecification); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1299); - match(CPP14Parser::Extern); - setState(1300); - match(CPP14Parser::StringLiteral); - setState(1307); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftBrace: { - setState(1301); - match(CPP14Parser::LeftBrace); - setState(1303); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543754443169808157) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 459384754220313597) != 0)) { - setState(1302); - declarationseq(); - } - setState(1305); - match(CPP14Parser::RightBrace); - break; - } - - case CPP14Parser::Alignas: - case CPP14Parser::Asm: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Constexpr: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Explicit: - case CPP14Parser::Extern: - case CPP14Parser::Float: - case CPP14Parser::Friend: - case CPP14Parser::Inline: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Mutable: - case CPP14Parser::Namespace: - case CPP14Parser::Operator: - case CPP14Parser::Register: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Static: - case CPP14Parser::Static_assert: - case CPP14Parser::Struct: - case CPP14Parser::Template: - case CPP14Parser::Thread_local: - case CPP14Parser::Typedef: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Using: - case CPP14Parser::Virtual: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Tilde: - case CPP14Parser::AndAnd: - case CPP14Parser::Doublecolon: - case CPP14Parser::Semi: - case CPP14Parser::Ellipsis: - case CPP14Parser::Identifier: { - setState(1306); - declaration(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeSpecifierSeqContext ------------------------------------------------------------------ - -CPP14Parser::AttributeSpecifierSeqContext::AttributeSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::AttributeSpecifierSeqContext::attributeSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::AttributeSpecifierContext* CPP14Parser::AttributeSpecifierSeqContext::attributeSpecifier(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::AttributeSpecifierSeqContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeSpecifierSeq; -} - - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::attributeSpecifierSeq() { - AttributeSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 204, CPP14Parser::RuleAttributeSpecifierSeq); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1310); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1309); - attributeSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1312); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 153, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::AttributeSpecifierContext::AttributeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::AttributeSpecifierContext::LeftBracket() { - return getTokens(CPP14Parser::LeftBracket); -} - -tree::TerminalNode* CPP14Parser::AttributeSpecifierContext::LeftBracket(size_t i) { - return getToken(CPP14Parser::LeftBracket, i); -} - -std::vector CPP14Parser::AttributeSpecifierContext::RightBracket() { - return getTokens(CPP14Parser::RightBracket); -} - -tree::TerminalNode* CPP14Parser::AttributeSpecifierContext::RightBracket(size_t i) { - return getToken(CPP14Parser::RightBracket, i); -} - -CPP14Parser::AttributeListContext* CPP14Parser::AttributeSpecifierContext::attributeList() { - return getRuleContext(0); -} - -CPP14Parser::AlignmentspecifierContext* CPP14Parser::AttributeSpecifierContext::alignmentspecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AttributeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeSpecifier; -} - - -CPP14Parser::AttributeSpecifierContext* CPP14Parser::attributeSpecifier() { - AttributeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 206, CPP14Parser::RuleAttributeSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1322); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 1); - setState(1314); - match(CPP14Parser::LeftBracket); - setState(1315); - match(CPP14Parser::LeftBracket); - setState(1317); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(1316); - attributeList(); - } - setState(1319); - match(CPP14Parser::RightBracket); - setState(1320); - match(CPP14Parser::RightBracket); - break; - } - - case CPP14Parser::Alignas: { - enterOuterAlt(_localctx, 2); - setState(1321); - alignmentspecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AlignmentspecifierContext ------------------------------------------------------------------ - -CPP14Parser::AlignmentspecifierContext::AlignmentspecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::Alignas() { - return getToken(CPP14Parser::Alignas, 0); -} - -tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::AlignmentspecifierContext::theTypeId() { - return getRuleContext(0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::AlignmentspecifierContext::constantExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::AlignmentspecifierContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - - -size_t CPP14Parser::AlignmentspecifierContext::getRuleIndex() const { - return CPP14Parser::RuleAlignmentspecifier; -} - - -CPP14Parser::AlignmentspecifierContext* CPP14Parser::alignmentspecifier() { - AlignmentspecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 208, CPP14Parser::RuleAlignmentspecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1324); - match(CPP14Parser::Alignas); - setState(1325); - match(CPP14Parser::LeftParen); - setState(1328); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 156, _ctx)) { - case 1: { - setState(1326); - theTypeId(); - break; - } - - case 2: { - setState(1327); - constantExpression(); - break; - } - - default: - break; - } - setState(1331); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1330); - match(CPP14Parser::Ellipsis); - } - setState(1333); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeListContext ------------------------------------------------------------------ - -CPP14Parser::AttributeListContext::AttributeListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::AttributeListContext::attribute() { - return getRuleContexts(); -} - -CPP14Parser::AttributeContext* CPP14Parser::AttributeListContext::attribute(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::AttributeListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::AttributeListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - -tree::TerminalNode* CPP14Parser::AttributeListContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - - -size_t CPP14Parser::AttributeListContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeList; -} - - -CPP14Parser::AttributeListContext* CPP14Parser::attributeList() { - AttributeListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 210, CPP14Parser::RuleAttributeList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1335); - attribute(); - setState(1340); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1336); - match(CPP14Parser::Comma); - setState(1337); - attribute(); - setState(1342); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1344); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1343); - match(CPP14Parser::Ellipsis); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeContext ------------------------------------------------------------------ - -CPP14Parser::AttributeContext::AttributeContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AttributeContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::AttributeNamespaceContext* CPP14Parser::AttributeContext::attributeNamespace() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::AttributeContext::Doublecolon() { - return getToken(CPP14Parser::Doublecolon, 0); -} - -CPP14Parser::AttributeArgumentClauseContext* CPP14Parser::AttributeContext::attributeArgumentClause() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AttributeContext::getRuleIndex() const { - return CPP14Parser::RuleAttribute; -} - - -CPP14Parser::AttributeContext* CPP14Parser::attribute() { - AttributeContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 212, CPP14Parser::RuleAttribute); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1349); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 160, _ctx)) { - case 1: { - setState(1346); - attributeNamespace(); - setState(1347); - match(CPP14Parser::Doublecolon); - break; - } - - default: - break; - } - setState(1351); - match(CPP14Parser::Identifier); - setState(1353); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::LeftParen) { - setState(1352); - attributeArgumentClause(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeNamespaceContext ------------------------------------------------------------------ - -CPP14Parser::AttributeNamespaceContext::AttributeNamespaceContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AttributeNamespaceContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::AttributeNamespaceContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeNamespace; -} - - -CPP14Parser::AttributeNamespaceContext* CPP14Parser::attributeNamespace() { - AttributeNamespaceContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 214, CPP14Parser::RuleAttributeNamespace); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1355); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AttributeArgumentClauseContext ------------------------------------------------------------------ - -CPP14Parser::AttributeArgumentClauseContext::AttributeArgumentClauseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AttributeArgumentClauseContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::AttributeArgumentClauseContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::BalancedTokenSeqContext* CPP14Parser::AttributeArgumentClauseContext::balancedTokenSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AttributeArgumentClauseContext::getRuleIndex() const { - return CPP14Parser::RuleAttributeArgumentClause; -} - - -CPP14Parser::AttributeArgumentClauseContext* CPP14Parser::attributeArgumentClause() { - AttributeArgumentClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 216, CPP14Parser::RuleAttributeArgumentClause); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1357); - match(CPP14Parser::LeftParen); - setState(1359); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & -2) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & -88080385) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & 262143) != 0)) { - setState(1358); - balancedTokenSeq(); - } - setState(1361); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BalancedTokenSeqContext ------------------------------------------------------------------ - -CPP14Parser::BalancedTokenSeqContext::BalancedTokenSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::BalancedTokenSeqContext::balancedtoken() { - return getRuleContexts(); -} - -CPP14Parser::BalancedtokenContext* CPP14Parser::BalancedTokenSeqContext::balancedtoken(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::BalancedTokenSeqContext::getRuleIndex() const { - return CPP14Parser::RuleBalancedTokenSeq; -} - - -CPP14Parser::BalancedTokenSeqContext* CPP14Parser::balancedTokenSeq() { - BalancedTokenSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 218, CPP14Parser::RuleBalancedTokenSeq); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1364); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1363); - balancedtoken(); - setState(1366); - _errHandler->sync(this); - _la = _input->LA(1); - } while ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & -2) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & -88080385) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & 262143) != 0)); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BalancedtokenContext ------------------------------------------------------------------ - -CPP14Parser::BalancedtokenContext::BalancedtokenContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::BalancedtokenContext::LeftParen() { - return getTokens(CPP14Parser::LeftParen); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftParen(size_t i) { - return getToken(CPP14Parser::LeftParen, i); -} - -CPP14Parser::BalancedTokenSeqContext* CPP14Parser::BalancedtokenContext::balancedTokenSeq() { - return getRuleContext(0); -} - -std::vector CPP14Parser::BalancedtokenContext::RightParen() { - return getTokens(CPP14Parser::RightParen); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightParen(size_t i) { - return getToken(CPP14Parser::RightParen, i); -} - -std::vector CPP14Parser::BalancedtokenContext::LeftBracket() { - return getTokens(CPP14Parser::LeftBracket); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftBracket(size_t i) { - return getToken(CPP14Parser::LeftBracket, i); -} - -std::vector CPP14Parser::BalancedtokenContext::RightBracket() { - return getTokens(CPP14Parser::RightBracket); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightBracket(size_t i) { - return getToken(CPP14Parser::RightBracket, i); -} - -std::vector CPP14Parser::BalancedtokenContext::LeftBrace() { - return getTokens(CPP14Parser::LeftBrace); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::LeftBrace(size_t i) { - return getToken(CPP14Parser::LeftBrace, i); -} - -std::vector CPP14Parser::BalancedtokenContext::RightBrace() { - return getTokens(CPP14Parser::RightBrace); -} - -tree::TerminalNode* CPP14Parser::BalancedtokenContext::RightBrace(size_t i) { - return getToken(CPP14Parser::RightBrace, i); -} - - -size_t CPP14Parser::BalancedtokenContext::getRuleIndex() const { - return CPP14Parser::RuleBalancedtoken; -} - - -CPP14Parser::BalancedtokenContext* CPP14Parser::balancedtoken() { - BalancedtokenContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 220, CPP14Parser::RuleBalancedtoken); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - setState(1385); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - enterOuterAlt(_localctx, 1); - setState(1368); - match(CPP14Parser::LeftParen); - setState(1369); - balancedTokenSeq(); - setState(1370); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 2); - setState(1372); - match(CPP14Parser::LeftBracket); - setState(1373); - balancedTokenSeq(); - setState(1374); - match(CPP14Parser::RightBracket); - break; - } - - case CPP14Parser::LeftBrace: { - enterOuterAlt(_localctx, 3); - setState(1376); - match(CPP14Parser::LeftBrace); - setState(1377); - balancedTokenSeq(); - setState(1378); - match(CPP14Parser::RightBrace); - break; - } - - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::MultiLineMacro: - case CPP14Parser::Directive: - case CPP14Parser::Alignas: - case CPP14Parser::Alignof: - case CPP14Parser::Asm: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Break: - case CPP14Parser::Case: - case CPP14Parser::Catch: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Constexpr: - case CPP14Parser::Const_cast: - case CPP14Parser::Continue: - case CPP14Parser::Decltype: - case CPP14Parser::Default: - case CPP14Parser::Delete: - case CPP14Parser::Do: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Else: - case CPP14Parser::Enum: - case CPP14Parser::Explicit: - case CPP14Parser::Export: - case CPP14Parser::Extern: - case CPP14Parser::False_: - case CPP14Parser::Final: - case CPP14Parser::Float: - case CPP14Parser::For: - case CPP14Parser::Friend: - case CPP14Parser::Goto: - case CPP14Parser::If: - case CPP14Parser::Inline: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Mutable: - case CPP14Parser::Namespace: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Nullptr: - case CPP14Parser::Operator: - case CPP14Parser::Override: - case CPP14Parser::Private: - case CPP14Parser::Protected: - case CPP14Parser::Public: - case CPP14Parser::Register: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Return: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static: - case CPP14Parser::Static_assert: - case CPP14Parser::Static_cast: - case CPP14Parser::Struct: - case CPP14Parser::Switch: - case CPP14Parser::Template: - case CPP14Parser::This: - case CPP14Parser::Thread_local: - case CPP14Parser::Throw: - case CPP14Parser::True_: - case CPP14Parser::Try: - case CPP14Parser::Typedef: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Using: - case CPP14Parser::Virtual: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::While: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::Div: - case CPP14Parser::Mod: - case CPP14Parser::Caret: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::Assign: - case CPP14Parser::Less: - case CPP14Parser::Greater: - case CPP14Parser::PlusAssign: - case CPP14Parser::MinusAssign: - case CPP14Parser::StarAssign: - case CPP14Parser::DivAssign: - case CPP14Parser::ModAssign: - case CPP14Parser::XorAssign: - case CPP14Parser::AndAssign: - case CPP14Parser::OrAssign: - case CPP14Parser::LeftShiftAssign: - case CPP14Parser::RightShiftAssign: - case CPP14Parser::Equal: - case CPP14Parser::NotEqual: - case CPP14Parser::LessEqual: - case CPP14Parser::GreaterEqual: - case CPP14Parser::AndAnd: - case CPP14Parser::OrOr: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Comma: - case CPP14Parser::ArrowStar: - case CPP14Parser::Arrow: - case CPP14Parser::Question: - case CPP14Parser::Colon: - case CPP14Parser::Doublecolon: - case CPP14Parser::Semi: - case CPP14Parser::Dot: - case CPP14Parser::DotStar: - case CPP14Parser::Ellipsis: - case CPP14Parser::Identifier: - case CPP14Parser::DecimalLiteral: - case CPP14Parser::OctalLiteral: - case CPP14Parser::HexadecimalLiteral: - case CPP14Parser::BinaryLiteral: - case CPP14Parser::Integersuffix: - case CPP14Parser::UserDefinedIntegerLiteral: - case CPP14Parser::UserDefinedFloatingLiteral: - case CPP14Parser::UserDefinedStringLiteral: - case CPP14Parser::UserDefinedCharacterLiteral: - case CPP14Parser::Whitespace: - case CPP14Parser::Newline: - case CPP14Parser::BlockComment: - case CPP14Parser::LineComment: { - enterOuterAlt(_localctx, 4); - setState(1381); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1380); - _la = _input->LA(1); - if (_la == 0 || _la == Token::EOF || (((((_la - 85) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 85)) & 63) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - break; - } - - default: - throw NoViableAltException(this); - } - setState(1383); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 164, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitDeclaratorListContext ------------------------------------------------------------------ - -CPP14Parser::InitDeclaratorListContext::InitDeclaratorListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::InitDeclaratorListContext::initDeclarator() { - return getRuleContexts(); -} - -CPP14Parser::InitDeclaratorContext* CPP14Parser::InitDeclaratorListContext::initDeclarator(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::InitDeclaratorListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::InitDeclaratorListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::InitDeclaratorListContext::getRuleIndex() const { - return CPP14Parser::RuleInitDeclaratorList; -} - - -CPP14Parser::InitDeclaratorListContext* CPP14Parser::initDeclaratorList() { - InitDeclaratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 222, CPP14Parser::RuleInitDeclaratorList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1387); - initDeclarator(); - setState(1392); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1388); - match(CPP14Parser::Comma); - setState(1389); - initDeclarator(); - setState(1394); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::InitDeclaratorContext::InitDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclaratorContext* CPP14Parser::InitDeclaratorContext::declarator() { - return getRuleContext(0); -} - -CPP14Parser::InitializerContext* CPP14Parser::InitDeclaratorContext::initializer() { - return getRuleContext(0); -} - - -size_t CPP14Parser::InitDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleInitDeclarator; -} - - -CPP14Parser::InitDeclaratorContext* CPP14Parser::initDeclarator() { - InitDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 224, CPP14Parser::RuleInitDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1395); - declarator(); - setState(1397); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 85) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 85)) & 65553) != 0)) { - setState(1396); - initializer(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::DeclaratorContext::DeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PointerDeclaratorContext* CPP14Parser::DeclaratorContext::pointerDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::DeclaratorContext::noPointerDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::DeclaratorContext::parametersAndQualifiers() { - return getRuleContext(0); -} - -CPP14Parser::TrailingReturnTypeContext* CPP14Parser::DeclaratorContext::trailingReturnType() { - return getRuleContext(0); -} - - -size_t CPP14Parser::DeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleDeclarator; -} - - -CPP14Parser::DeclaratorContext* CPP14Parser::declarator() { - DeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 226, CPP14Parser::RuleDeclarator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1404); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 168, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1399); - pointerDeclarator(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1400); - noPointerDeclarator(0); - setState(1401); - parametersAndQualifiers(); - setState(1402); - trailingReturnType(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PointerDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::PointerDeclaratorContext::PointerDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::PointerDeclaratorContext::noPointerDeclarator() { - return getRuleContext(0); -} - -std::vector CPP14Parser::PointerDeclaratorContext::pointerOperator() { - return getRuleContexts(); -} - -CPP14Parser::PointerOperatorContext* CPP14Parser::PointerDeclaratorContext::pointerOperator(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::PointerDeclaratorContext::Const() { - return getTokens(CPP14Parser::Const); -} - -tree::TerminalNode* CPP14Parser::PointerDeclaratorContext::Const(size_t i) { - return getToken(CPP14Parser::Const, i); -} - - -size_t CPP14Parser::PointerDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RulePointerDeclarator; -} - - -CPP14Parser::PointerDeclaratorContext* CPP14Parser::pointerDeclarator() { - PointerDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 228, CPP14Parser::RulePointerDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1412); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 170, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1406); - pointerOperator(); - setState(1408); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Const) { - setState(1407); - match(CPP14Parser::Const); - } - } - setState(1414); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 170, _ctx); - } - setState(1415); - noPointerDeclarator(0); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoPointerDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::NoPointerDeclaratorContext::NoPointerDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclaratoridContext* CPP14Parser::NoPointerDeclaratorContext::declaratorid() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::PointerDeclaratorContext* CPP14Parser::NoPointerDeclaratorContext::pointerDeclarator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::NoPointerDeclaratorContext::noPointerDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerDeclaratorContext::parametersAndQualifiers() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::NoPointerDeclaratorContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerDeclaratorContext::constantExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NoPointerDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleNoPointerDeclarator; -} - - - -CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::noPointerDeclarator() { - return noPointerDeclarator(0); -} - -CPP14Parser::NoPointerDeclaratorContext* CPP14Parser::noPointerDeclarator(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::NoPointerDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::NoPointerDeclaratorContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 230; - enterRecursionRule(_localctx, 230, CPP14Parser::RuleNoPointerDeclarator, precedence); - - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1426); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Decltype: - case CPP14Parser::Operator: - case CPP14Parser::Tilde: - case CPP14Parser::Doublecolon: - case CPP14Parser::Ellipsis: - case CPP14Parser::Identifier: { - setState(1418); - declaratorid(); - setState(1420); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 171, _ctx)) { - case 1: { - setState(1419); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::LeftParen: { - setState(1422); - match(CPP14Parser::LeftParen); - setState(1423); - pointerDeclarator(); - setState(1424); - match(CPP14Parser::RightParen); - break; - } - - default: - throw NoViableAltException(this); - } - _ctx->stop = _input->LT(-1); - setState(1442); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 176, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RuleNoPointerDeclarator); - setState(1428); - - if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(1438); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - setState(1429); - parametersAndQualifiers(); - break; - } - - case CPP14Parser::LeftBracket: { - setState(1430); - match(CPP14Parser::LeftBracket); - setState(1432); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { - setState(1431); - constantExpression(); - } - setState(1434); - match(CPP14Parser::RightBracket); - setState(1436); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 174, _ctx)) { - case 1: { - setState(1435); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - default: - throw NoViableAltException(this); - } - } - setState(1444); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 176, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- ParametersAndQualifiersContext ------------------------------------------------------------------ - -CPP14Parser::ParametersAndQualifiersContext::ParametersAndQualifiersContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ParametersAndQualifiersContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::ParametersAndQualifiersContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::ParametersAndQualifiersContext::parameterDeclarationClause() { - return getRuleContext(0); -} - -CPP14Parser::CvqualifierseqContext* CPP14Parser::ParametersAndQualifiersContext::cvqualifierseq() { - return getRuleContext(0); -} - -CPP14Parser::RefqualifierContext* CPP14Parser::ParametersAndQualifiersContext::refqualifier() { - return getRuleContext(0); -} - -CPP14Parser::ExceptionSpecificationContext* CPP14Parser::ParametersAndQualifiersContext::exceptionSpecification() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ParametersAndQualifiersContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ParametersAndQualifiersContext::getRuleIndex() const { - return CPP14Parser::RuleParametersAndQualifiers; -} - - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::parametersAndQualifiers() { - ParametersAndQualifiersContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 232, CPP14Parser::RuleParametersAndQualifiers); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1445); - match(CPP14Parser::LeftParen); - setState(1447); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1237504995584196377) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 297237575406461917) != 0)) { - setState(1446); - parameterDeclarationClause(); - } - setState(1449); - match(CPP14Parser::RightParen); - setState(1451); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 178, _ctx)) { - case 1: { - setState(1450); - cvqualifierseq(); - break; - } - - default: - break; - } - setState(1454); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 179, _ctx)) { - case 1: { - setState(1453); - refqualifier(); - break; - } - - default: - break; - } - setState(1457); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 180, _ctx)) { - case 1: { - setState(1456); - exceptionSpecification(); - break; - } - - default: - break; - } - setState(1460); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 181, _ctx)) { - case 1: { - setState(1459); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TrailingReturnTypeContext ------------------------------------------------------------------ - -CPP14Parser::TrailingReturnTypeContext::TrailingReturnTypeContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TrailingReturnTypeContext::Arrow() { - return getToken(CPP14Parser::Arrow, 0); -} - -CPP14Parser::TrailingTypeSpecifierSeqContext* CPP14Parser::TrailingReturnTypeContext::trailingTypeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::AbstractDeclaratorContext* CPP14Parser::TrailingReturnTypeContext::abstractDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TrailingReturnTypeContext::getRuleIndex() const { - return CPP14Parser::RuleTrailingReturnType; -} - - -CPP14Parser::TrailingReturnTypeContext* CPP14Parser::trailingReturnType() { - TrailingReturnTypeContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 234, CPP14Parser::RuleTrailingReturnType); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1462); - match(CPP14Parser::Arrow); - setState(1463); - trailingTypeSpecifierSeq(); - setState(1465); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 182, _ctx)) { - case 1: { - setState(1464); - abstractDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PointerOperatorContext ------------------------------------------------------------------ - -CPP14Parser::PointerOperatorContext::PointerOperatorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::PointerOperatorContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::PointerOperatorContext::AndAnd() { - return getToken(CPP14Parser::AndAnd, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::PointerOperatorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::PointerOperatorContext::Star() { - return getToken(CPP14Parser::Star, 0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::PointerOperatorContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::CvqualifierseqContext* CPP14Parser::PointerOperatorContext::cvqualifierseq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::PointerOperatorContext::getRuleIndex() const { - return CPP14Parser::RulePointerOperator; -} - - -CPP14Parser::PointerOperatorContext* CPP14Parser::pointerOperator() { - PointerOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 236, CPP14Parser::RulePointerOperator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1481); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::And: - case CPP14Parser::AndAnd: { - enterOuterAlt(_localctx, 1); - setState(1467); - _la = _input->LA(1); - if (!(_la == CPP14Parser::And - - || _la == CPP14Parser::AndAnd)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1469); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 183, _ctx)) { - case 1: { - setState(1468); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::Decltype: - case CPP14Parser::Star: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 2); - setState(1472); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon - - || _la == CPP14Parser::Identifier) { - setState(1471); - nestedNameSpecifier(0); - } - setState(1474); - match(CPP14Parser::Star); - setState(1476); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 185, _ctx)) { - case 1: { - setState(1475); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - setState(1479); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 186, _ctx)) { - case 1: { - setState(1478); - cvqualifierseq(); - break; - } - - default: - break; - } - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CvqualifierseqContext ------------------------------------------------------------------ - -CPP14Parser::CvqualifierseqContext::CvqualifierseqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::CvqualifierseqContext::cvQualifier() { - return getRuleContexts(); -} - -CPP14Parser::CvQualifierContext* CPP14Parser::CvqualifierseqContext::cvQualifier(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::CvqualifierseqContext::getRuleIndex() const { - return CPP14Parser::RuleCvqualifierseq; -} - - -CPP14Parser::CvqualifierseqContext* CPP14Parser::cvqualifierseq() { - CvqualifierseqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 238, CPP14Parser::RuleCvqualifierseq); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1484); - _errHandler->sync(this); - alt = 1; - do { - switch (alt) { - case 1: { - setState(1483); - cvQualifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1486); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 188, _ctx); - } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- CvQualifierContext ------------------------------------------------------------------ - -CPP14Parser::CvQualifierContext::CvQualifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::CvQualifierContext::Const() { - return getToken(CPP14Parser::Const, 0); -} - -tree::TerminalNode* CPP14Parser::CvQualifierContext::Volatile() { - return getToken(CPP14Parser::Volatile, 0); -} - - -size_t CPP14Parser::CvQualifierContext::getRuleIndex() const { - return CPP14Parser::RuleCvQualifier; -} - - -CPP14Parser::CvQualifierContext* CPP14Parser::cvQualifier() { - CvQualifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 240, CPP14Parser::RuleCvQualifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1488); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Const - - || _la == CPP14Parser::Volatile)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- RefqualifierContext ------------------------------------------------------------------ - -CPP14Parser::RefqualifierContext::RefqualifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::RefqualifierContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::RefqualifierContext::AndAnd() { - return getToken(CPP14Parser::AndAnd, 0); -} - - -size_t CPP14Parser::RefqualifierContext::getRuleIndex() const { - return CPP14Parser::RuleRefqualifier; -} - - -CPP14Parser::RefqualifierContext* CPP14Parser::refqualifier() { - RefqualifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 242, CPP14Parser::RuleRefqualifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1490); - _la = _input->LA(1); - if (!(_la == CPP14Parser::And - - || _la == CPP14Parser::AndAnd)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DeclaratoridContext ------------------------------------------------------------------ - -CPP14Parser::DeclaratoridContext::DeclaratoridContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::IdExpressionContext* CPP14Parser::DeclaratoridContext::idExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::DeclaratoridContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - - -size_t CPP14Parser::DeclaratoridContext::getRuleIndex() const { - return CPP14Parser::RuleDeclaratorid; -} - - -CPP14Parser::DeclaratoridContext* CPP14Parser::declaratorid() { - DeclaratoridContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 244, CPP14Parser::RuleDeclaratorid); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1493); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1492); - match(CPP14Parser::Ellipsis); - } - setState(1495); - idExpression(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TheTypeIdContext ------------------------------------------------------------------ - -CPP14Parser::TheTypeIdContext::TheTypeIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::TheTypeIdContext::typeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::AbstractDeclaratorContext* CPP14Parser::TheTypeIdContext::abstractDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TheTypeIdContext::getRuleIndex() const { - return CPP14Parser::RuleTheTypeId; -} - - -CPP14Parser::TheTypeIdContext* CPP14Parser::theTypeId() { - TheTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 246, CPP14Parser::RuleTheTypeId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1497); - typeSpecifierSeq(); - setState(1499); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 190, _ctx)) { - case 1: { - setState(1498); - abstractDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AbstractDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::AbstractDeclaratorContext::AbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::pointerAbstractDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::AbstractDeclaratorContext::parametersAndQualifiers() { - return getRuleContext(0); -} - -CPP14Parser::TrailingReturnTypeContext* CPP14Parser::AbstractDeclaratorContext::trailingReturnType() { - return getRuleContext(0); -} - -CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::noPointerAbstractDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::AbstractPackDeclaratorContext* CPP14Parser::AbstractDeclaratorContext::abstractPackDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::AbstractDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleAbstractDeclarator; -} - - -CPP14Parser::AbstractDeclaratorContext* CPP14Parser::abstractDeclarator() { - AbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 248, CPP14Parser::RuleAbstractDeclarator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1509); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 192, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1501); - pointerAbstractDeclarator(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1503); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 191, _ctx)) { - case 1: { - setState(1502); - noPointerAbstractDeclarator(0); - break; - } - - default: - break; - } - setState(1505); - parametersAndQualifiers(); - setState(1506); - trailingReturnType(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1508); - abstractPackDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PointerAbstractDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::PointerAbstractDeclaratorContext::PointerAbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::PointerAbstractDeclaratorContext::noPointerAbstractDeclarator() { - return getRuleContext(0); -} - -std::vector CPP14Parser::PointerAbstractDeclaratorContext::pointerOperator() { - return getRuleContexts(); -} - -CPP14Parser::PointerOperatorContext* CPP14Parser::PointerAbstractDeclaratorContext::pointerOperator(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::PointerAbstractDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RulePointerAbstractDeclarator; -} - - -CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::pointerAbstractDeclarator() { - PointerAbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 250, CPP14Parser::RulePointerAbstractDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1520); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: { - enterOuterAlt(_localctx, 1); - setState(1511); - noPointerAbstractDeclarator(0); - break; - } - - case CPP14Parser::Decltype: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::AndAnd: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 2); - setState(1513); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1512); - pointerOperator(); - setState(1515); - _errHandler->sync(this); - _la = _input->LA(1); - } while (_la == CPP14Parser::Decltype || ((((_la - 93) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 93)) & 566969237521) != 0)); - setState(1518); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 194, _ctx)) { - case 1: { - setState(1517); - noPointerAbstractDeclarator(0); - break; - } - - default: - break; - } - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoPointerAbstractDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::NoPointerAbstractDeclaratorContext::NoPointerAbstractDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerAbstractDeclaratorContext::parametersAndQualifiers() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerAbstractDeclaratorContext::constantExpression() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerAbstractDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::PointerAbstractDeclaratorContext* CPP14Parser::NoPointerAbstractDeclaratorContext::pointerAbstractDeclarator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractDeclaratorContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -std::vector CPP14Parser::NoPointerAbstractDeclaratorContext::noPointerAbstractDeclarator() { - return getRuleContexts(); -} - -CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::NoPointerAbstractDeclaratorContext::noPointerAbstractDeclarator(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::NoPointerAbstractDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleNoPointerAbstractDeclarator; -} - - - -CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::noPointerAbstractDeclarator() { - return noPointerAbstractDeclarator(0); -} - -CPP14Parser::NoPointerAbstractDeclaratorContext* CPP14Parser::noPointerAbstractDeclarator(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::NoPointerAbstractDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::NoPointerAbstractDeclaratorContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 252; - enterRecursionRule(_localctx, 252, CPP14Parser::RuleNoPointerAbstractDeclarator, precedence); - - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1536); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 198, _ctx)) { - case 1: { - setState(1523); - parametersAndQualifiers(); - break; - } - - case 2: { - setState(1524); - match(CPP14Parser::LeftBracket); - setState(1526); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { - setState(1525); - constantExpression(); - } - setState(1528); - match(CPP14Parser::RightBracket); - setState(1530); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 197, _ctx)) { - case 1: { - setState(1529); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - case 3: { - setState(1532); - match(CPP14Parser::LeftParen); - setState(1533); - pointerAbstractDeclarator(); - setState(1534); - match(CPP14Parser::RightParen); - break; - } - - default: - break; - } - _ctx->stop = _input->LT(-1); - setState(1553); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 202, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RuleNoPointerAbstractDeclarator); - setState(1538); - - if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); - setState(1549); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 201, _ctx)) { - case 1: { - setState(1539); - parametersAndQualifiers(); - break; - } - - case 2: { - setState(1540); - noPointerAbstractDeclarator(0); - setState(1541); - match(CPP14Parser::LeftBracket); - setState(1543); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { - setState(1542); - constantExpression(); - } - setState(1545); - match(CPP14Parser::RightBracket); - setState(1547); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 200, _ctx)) { - case 1: { - setState(1546); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - default: - break; - } - } - setState(1555); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 202, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- AbstractPackDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::AbstractPackDeclaratorContext::AbstractPackDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::AbstractPackDeclaratorContext::noPointerAbstractPackDeclarator() { - return getRuleContext(0); -} - -std::vector CPP14Parser::AbstractPackDeclaratorContext::pointerOperator() { - return getRuleContexts(); -} - -CPP14Parser::PointerOperatorContext* CPP14Parser::AbstractPackDeclaratorContext::pointerOperator(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::AbstractPackDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleAbstractPackDeclarator; -} - - -CPP14Parser::AbstractPackDeclaratorContext* CPP14Parser::abstractPackDeclarator() { - AbstractPackDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 254, CPP14Parser::RuleAbstractPackDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1559); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Decltype || ((((_la - 93) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 93)) & 566969237521) != 0)) { - setState(1556); - pointerOperator(); - setState(1561); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1562); - noPointerAbstractPackDeclarator(0); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoPointerAbstractPackDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::NoPointerAbstractPackDeclaratorContext::NoPointerAbstractPackDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - -CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::noPointerAbstractPackDeclarator() { - return getRuleContext(0); -} - -CPP14Parser::ParametersAndQualifiersContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::parametersAndQualifiers() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::NoPointerAbstractPackDeclaratorContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::constantExpression() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::NoPointerAbstractPackDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::NoPointerAbstractPackDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleNoPointerAbstractPackDeclarator; -} - - - -CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::noPointerAbstractPackDeclarator() { - return noPointerAbstractPackDeclarator(0); -} - -CPP14Parser::NoPointerAbstractPackDeclaratorContext* CPP14Parser::noPointerAbstractPackDeclarator(int precedence) { - ParserRuleContext *parentContext = _ctx; - size_t parentState = getState(); - CPP14Parser::NoPointerAbstractPackDeclaratorContext *_localctx = _tracker.createInstance(_ctx, parentState); - CPP14Parser::NoPointerAbstractPackDeclaratorContext *previousContext = _localctx; - (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 256; - enterRecursionRule(_localctx, 256, CPP14Parser::RuleNoPointerAbstractPackDeclarator, precedence); - - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1565); - match(CPP14Parser::Ellipsis); - _ctx->stop = _input->LT(-1); - setState(1581); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 207, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - _localctx = _tracker.createInstance(parentContext, parentState); - pushNewRecursionContext(_localctx, startState, RuleNoPointerAbstractPackDeclarator); - setState(1567); - - if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(1577); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - setState(1568); - parametersAndQualifiers(); - break; - } - - case CPP14Parser::LeftBracket: { - setState(1569); - match(CPP14Parser::LeftBracket); - setState(1571); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133137) != 0) || _la == CPP14Parser::Identifier) { - setState(1570); - constantExpression(); - } - setState(1573); - match(CPP14Parser::RightBracket); - setState(1575); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 205, _ctx)) { - case 1: { - setState(1574); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - break; - } - - default: - throw NoViableAltException(this); - } - } - setState(1583); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 207, _ctx); - } - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - return _localctx; -} - -//----------------- ParameterDeclarationClauseContext ------------------------------------------------------------------ - -CPP14Parser::ParameterDeclarationClauseContext::ParameterDeclarationClauseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ParameterDeclarationListContext* CPP14Parser::ParameterDeclarationClauseContext::parameterDeclarationList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ParameterDeclarationClauseContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - -tree::TerminalNode* CPP14Parser::ParameterDeclarationClauseContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - - -size_t CPP14Parser::ParameterDeclarationClauseContext::getRuleIndex() const { - return CPP14Parser::RuleParameterDeclarationClause; -} - - -CPP14Parser::ParameterDeclarationClauseContext* CPP14Parser::parameterDeclarationClause() { - ParameterDeclarationClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 258, CPP14Parser::RuleParameterDeclarationClause); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1584); - parameterDeclarationList(); - setState(1589); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Comma - - || _la == CPP14Parser::Ellipsis) { - setState(1586); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Comma) { - setState(1585); - match(CPP14Parser::Comma); - } - setState(1588); - match(CPP14Parser::Ellipsis); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ParameterDeclarationListContext ------------------------------------------------------------------ - -CPP14Parser::ParameterDeclarationListContext::ParameterDeclarationListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::ParameterDeclarationListContext::parameterDeclaration() { - return getRuleContexts(); -} - -CPP14Parser::ParameterDeclarationContext* CPP14Parser::ParameterDeclarationListContext::parameterDeclaration(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::ParameterDeclarationListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::ParameterDeclarationListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::ParameterDeclarationListContext::getRuleIndex() const { - return CPP14Parser::RuleParameterDeclarationList; -} - - -CPP14Parser::ParameterDeclarationListContext* CPP14Parser::parameterDeclarationList() { - ParameterDeclarationListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 260, CPP14Parser::RuleParameterDeclarationList); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1591); - parameterDeclaration(); - setState(1596); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 210, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1592); - match(CPP14Parser::Comma); - setState(1593); - parameterDeclaration(); - } - setState(1598); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 210, _ctx); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ParameterDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::ParameterDeclarationContext::ParameterDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::ParameterDeclarationContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ParameterDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclaratorContext* CPP14Parser::ParameterDeclarationContext::declarator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ParameterDeclarationContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::InitializerClauseContext* CPP14Parser::ParameterDeclarationContext::initializerClause() { - return getRuleContext(0); -} - -CPP14Parser::AbstractDeclaratorContext* CPP14Parser::ParameterDeclarationContext::abstractDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ParameterDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleParameterDeclaration; -} - - -CPP14Parser::ParameterDeclarationContext* CPP14Parser::parameterDeclaration() { - ParameterDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 262, CPP14Parser::RuleParameterDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1600); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1599); - attributeSpecifierSeq(); - } - setState(1602); - declSpecifierSeq(); - - setState(1607); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 213, _ctx)) { - case 1: { - setState(1603); - declarator(); - break; - } - - case 2: { - setState(1605); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 212, _ctx)) { - case 1: { - setState(1604); - abstractDeclarator(); - break; - } - - default: - break; - } - break; - } - - default: - break; - } - setState(1611); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Assign) { - setState(1609); - match(CPP14Parser::Assign); - setState(1610); - initializerClause(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- FunctionDefinitionContext ------------------------------------------------------------------ - -CPP14Parser::FunctionDefinitionContext::FunctionDefinitionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclaratorContext* CPP14Parser::FunctionDefinitionContext::declarator() { - return getRuleContext(0); -} - -CPP14Parser::FunctionBodyContext* CPP14Parser::FunctionDefinitionContext::functionBody() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::FunctionDefinitionContext::virtualSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::FunctionDefinitionContext::getRuleIndex() const { - return CPP14Parser::RuleFunctionDefinition; -} - - -CPP14Parser::FunctionDefinitionContext* CPP14Parser::functionDefinition() { - FunctionDefinitionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 264, CPP14Parser::RuleFunctionDefinition); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1614); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1613); - attributeSpecifierSeq(); - } - setState(1617); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 216, _ctx)) { - case 1: { - setState(1616); - declSpecifierSeq(); - break; - } - - default: - break; - } - setState(1619); - declarator(); - setState(1621); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Final - - || _la == CPP14Parser::Override) { - setState(1620); - virtualSpecifierSeq(); - } - setState(1623); - functionBody(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- FunctionBodyContext ------------------------------------------------------------------ - -CPP14Parser::FunctionBodyContext::FunctionBodyContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::FunctionBodyContext::compoundStatement() { - return getRuleContext(0); -} - -CPP14Parser::ConstructorInitializerContext* CPP14Parser::FunctionBodyContext::constructorInitializer() { - return getRuleContext(0); -} - -CPP14Parser::FunctionTryBlockContext* CPP14Parser::FunctionBodyContext::functionTryBlock() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::FunctionBodyContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -tree::TerminalNode* CPP14Parser::FunctionBodyContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -tree::TerminalNode* CPP14Parser::FunctionBodyContext::Default() { - return getToken(CPP14Parser::Default, 0); -} - -tree::TerminalNode* CPP14Parser::FunctionBodyContext::Delete() { - return getToken(CPP14Parser::Delete, 0); -} - - -size_t CPP14Parser::FunctionBodyContext::getRuleIndex() const { - return CPP14Parser::RuleFunctionBody; -} - - -CPP14Parser::FunctionBodyContext* CPP14Parser::functionBody() { - FunctionBodyContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 266, CPP14Parser::RuleFunctionBody); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1633); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftBrace: - case CPP14Parser::Colon: { - enterOuterAlt(_localctx, 1); - setState(1626); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Colon) { - setState(1625); - constructorInitializer(); - } - setState(1628); - compoundStatement(); - break; - } - - case CPP14Parser::Try: { - enterOuterAlt(_localctx, 2); - setState(1629); - functionTryBlock(); - break; - } - - case CPP14Parser::Assign: { - enterOuterAlt(_localctx, 3); - setState(1630); - match(CPP14Parser::Assign); - setState(1631); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Default - - || _la == CPP14Parser::Delete)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1632); - match(CPP14Parser::Semi); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitializerContext ------------------------------------------------------------------ - -CPP14Parser::InitializerContext::InitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::InitializerContext::braceOrEqualInitializer() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::InitializerContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ExpressionListContext* CPP14Parser::InitializerContext::expressionList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::InitializerContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::InitializerContext::getRuleIndex() const { - return CPP14Parser::RuleInitializer; -} - - -CPP14Parser::InitializerContext* CPP14Parser::initializer() { - InitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 268, CPP14Parser::RuleInitializer); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1640); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftBrace: - case CPP14Parser::Assign: { - enterOuterAlt(_localctx, 1); - setState(1635); - braceOrEqualInitializer(); - break; - } - - case CPP14Parser::LeftParen: { - enterOuterAlt(_localctx, 2); - setState(1636); - match(CPP14Parser::LeftParen); - setState(1637); - expressionList(); - setState(1638); - match(CPP14Parser::RightParen); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BraceOrEqualInitializerContext ------------------------------------------------------------------ - -CPP14Parser::BraceOrEqualInitializerContext::BraceOrEqualInitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::BraceOrEqualInitializerContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::InitializerClauseContext* CPP14Parser::BraceOrEqualInitializerContext::initializerClause() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::BraceOrEqualInitializerContext::bracedInitList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::BraceOrEqualInitializerContext::getRuleIndex() const { - return CPP14Parser::RuleBraceOrEqualInitializer; -} - - -CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::braceOrEqualInitializer() { - BraceOrEqualInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 270, CPP14Parser::RuleBraceOrEqualInitializer); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1645); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Assign: { - enterOuterAlt(_localctx, 1); - setState(1642); - match(CPP14Parser::Assign); - setState(1643); - initializerClause(); - break; - } - - case CPP14Parser::LeftBrace: { - enterOuterAlt(_localctx, 2); - setState(1644); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitializerClauseContext ------------------------------------------------------------------ - -CPP14Parser::InitializerClauseContext::InitializerClauseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::AssignmentExpressionContext* CPP14Parser::InitializerClauseContext::assignmentExpression() { - return getRuleContext(0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::InitializerClauseContext::bracedInitList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::InitializerClauseContext::getRuleIndex() const { - return CPP14Parser::RuleInitializerClause; -} - - -CPP14Parser::InitializerClauseContext* CPP14Parser::initializerClause() { - InitializerClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 272, CPP14Parser::RuleInitializerClause); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1649); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::IntegerLiteral: - case CPP14Parser::CharacterLiteral: - case CPP14Parser::FloatingLiteral: - case CPP14Parser::StringLiteral: - case CPP14Parser::BooleanLiteral: - case CPP14Parser::PointerLiteral: - case CPP14Parser::UserDefinedLiteral: - case CPP14Parser::Alignof: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Const_cast: - case CPP14Parser::Decltype: - case CPP14Parser::Delete: - case CPP14Parser::Double: - case CPP14Parser::Dynamic_cast: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::New: - case CPP14Parser::Noexcept: - case CPP14Parser::Operator: - case CPP14Parser::Reinterpret_cast: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Sizeof: - case CPP14Parser::Static_cast: - case CPP14Parser::This: - case CPP14Parser::Throw: - case CPP14Parser::Typeid_: - case CPP14Parser::Typename_: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Plus: - case CPP14Parser::Minus: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Or: - case CPP14Parser::Tilde: - case CPP14Parser::Not: - case CPP14Parser::PlusPlus: - case CPP14Parser::MinusMinus: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(1647); - assignmentExpression(); - break; - } - - case CPP14Parser::LeftBrace: { - enterOuterAlt(_localctx, 2); - setState(1648); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- InitializerListContext ------------------------------------------------------------------ - -CPP14Parser::InitializerListContext::InitializerListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::InitializerListContext::initializerClause() { - return getRuleContexts(); -} - -CPP14Parser::InitializerClauseContext* CPP14Parser::InitializerListContext::initializerClause(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::InitializerListContext::Ellipsis() { - return getTokens(CPP14Parser::Ellipsis); -} - -tree::TerminalNode* CPP14Parser::InitializerListContext::Ellipsis(size_t i) { - return getToken(CPP14Parser::Ellipsis, i); -} - -std::vector CPP14Parser::InitializerListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::InitializerListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::InitializerListContext::getRuleIndex() const { - return CPP14Parser::RuleInitializerList; -} - - -CPP14Parser::InitializerListContext* CPP14Parser::initializerList() { - InitializerListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 274, CPP14Parser::RuleInitializerList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1651); - initializerClause(); - setState(1653); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1652); - match(CPP14Parser::Ellipsis); - } - setState(1662); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 225, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1655); - match(CPP14Parser::Comma); - setState(1656); - initializerClause(); - setState(1658); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1657); - match(CPP14Parser::Ellipsis); - } - } - setState(1664); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 225, _ctx); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BracedInitListContext ------------------------------------------------------------------ - -CPP14Parser::BracedInitListContext::BracedInitListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::BracedInitListContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::BracedInitListContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -CPP14Parser::InitializerListContext* CPP14Parser::BracedInitListContext::initializerList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::BracedInitListContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - - -size_t CPP14Parser::BracedInitListContext::getRuleIndex() const { - return CPP14Parser::RuleBracedInitList; -} - - -CPP14Parser::BracedInitListContext* CPP14Parser::bracedInitList() { - BracedInitListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 276, CPP14Parser::RuleBracedInitList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1665); - match(CPP14Parser::LeftBrace); - setState(1670); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { - setState(1666); - initializerList(); - setState(1668); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Comma) { - setState(1667); - match(CPP14Parser::Comma); - } - } - setState(1672); - match(CPP14Parser::RightBrace); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassNameContext ------------------------------------------------------------------ - -CPP14Parser::ClassNameContext::ClassNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ClassNameContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::ClassNameContext::simpleTemplateId() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ClassNameContext::getRuleIndex() const { - return CPP14Parser::RuleClassName; -} - - -CPP14Parser::ClassNameContext* CPP14Parser::className() { - ClassNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 278, CPP14Parser::RuleClassName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1676); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 228, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1674); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1675); - simpleTemplateId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::ClassSpecifierContext::ClassSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassHeadContext* CPP14Parser::ClassSpecifierContext::classHead() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ClassSpecifierContext::LeftBrace() { - return getToken(CPP14Parser::LeftBrace, 0); -} - -tree::TerminalNode* CPP14Parser::ClassSpecifierContext::RightBrace() { - return getToken(CPP14Parser::RightBrace, 0); -} - -CPP14Parser::MemberSpecificationContext* CPP14Parser::ClassSpecifierContext::memberSpecification() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ClassSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleClassSpecifier; -} - - -CPP14Parser::ClassSpecifierContext* CPP14Parser::classSpecifier() { - ClassSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 280, CPP14Parser::RuleClassSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1678); - classHead(); - setState(1679); - match(CPP14Parser::LeftBrace); - setState(1681); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543877313594212121) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 463888353847684093) != 0)) { - setState(1680); - memberSpecification(); - } - setState(1683); - match(CPP14Parser::RightBrace); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassHeadContext ------------------------------------------------------------------ - -CPP14Parser::ClassHeadContext::ClassHeadContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassKeyContext* CPP14Parser::ClassHeadContext::classKey() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ClassHeadContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::ClassHeadNameContext* CPP14Parser::ClassHeadContext::classHeadName() { - return getRuleContext(0); -} - -CPP14Parser::BaseClauseContext* CPP14Parser::ClassHeadContext::baseClause() { - return getRuleContext(0); -} - -CPP14Parser::ClassVirtSpecifierContext* CPP14Parser::ClassHeadContext::classVirtSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ClassHeadContext::Union() { - return getToken(CPP14Parser::Union, 0); -} - - -size_t CPP14Parser::ClassHeadContext::getRuleIndex() const { - return CPP14Parser::RuleClassHead; -} - - -CPP14Parser::ClassHeadContext* CPP14Parser::classHead() { - ClassHeadContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 282, CPP14Parser::RuleClassHead); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1708); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Class: - case CPP14Parser::Struct: { - enterOuterAlt(_localctx, 1); - setState(1685); - classKey(); - setState(1687); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1686); - attributeSpecifierSeq(); - } - setState(1693); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon - - || _la == CPP14Parser::Identifier) { - setState(1689); - classHeadName(); - setState(1691); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Final) { - setState(1690); - classVirtSpecifier(); - } - } - setState(1696); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Colon) { - setState(1695); - baseClause(); - } - break; - } - - case CPP14Parser::Union: { - enterOuterAlt(_localctx, 2); - setState(1698); - match(CPP14Parser::Union); - setState(1700); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1699); - attributeSpecifierSeq(); - } - setState(1706); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Decltype || _la == CPP14Parser::Doublecolon - - || _la == CPP14Parser::Identifier) { - setState(1702); - classHeadName(); - setState(1704); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Final) { - setState(1703); - classVirtSpecifier(); - } - } - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassHeadNameContext ------------------------------------------------------------------ - -CPP14Parser::ClassHeadNameContext::ClassHeadNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassNameContext* CPP14Parser::ClassHeadNameContext::className() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ClassHeadNameContext::nestedNameSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ClassHeadNameContext::getRuleIndex() const { - return CPP14Parser::RuleClassHeadName; -} - - -CPP14Parser::ClassHeadNameContext* CPP14Parser::classHeadName() { - ClassHeadNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 284, CPP14Parser::RuleClassHeadName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1711); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 238, _ctx)) { - case 1: { - setState(1710); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1713); - className(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassVirtSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::ClassVirtSpecifierContext::ClassVirtSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ClassVirtSpecifierContext::Final() { - return getToken(CPP14Parser::Final, 0); -} - - -size_t CPP14Parser::ClassVirtSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleClassVirtSpecifier; -} - - -CPP14Parser::ClassVirtSpecifierContext* CPP14Parser::classVirtSpecifier() { - ClassVirtSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 286, CPP14Parser::RuleClassVirtSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1715); - match(CPP14Parser::Final); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassKeyContext ------------------------------------------------------------------ - -CPP14Parser::ClassKeyContext::ClassKeyContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ClassKeyContext::Class() { - return getToken(CPP14Parser::Class, 0); -} - -tree::TerminalNode* CPP14Parser::ClassKeyContext::Struct() { - return getToken(CPP14Parser::Struct, 0); -} - - -size_t CPP14Parser::ClassKeyContext::getRuleIndex() const { - return CPP14Parser::RuleClassKey; -} - - -CPP14Parser::ClassKeyContext* CPP14Parser::classKey() { - ClassKeyContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 288, CPP14Parser::RuleClassKey); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1717); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Class - - || _la == CPP14Parser::Struct)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemberSpecificationContext ------------------------------------------------------------------ - -CPP14Parser::MemberSpecificationContext::MemberSpecificationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::MemberSpecificationContext::memberdeclaration() { - return getRuleContexts(); -} - -CPP14Parser::MemberdeclarationContext* CPP14Parser::MemberSpecificationContext::memberdeclaration(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::MemberSpecificationContext::accessSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::AccessSpecifierContext* CPP14Parser::MemberSpecificationContext::accessSpecifier(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::MemberSpecificationContext::Colon() { - return getTokens(CPP14Parser::Colon); -} - -tree::TerminalNode* CPP14Parser::MemberSpecificationContext::Colon(size_t i) { - return getToken(CPP14Parser::Colon, i); -} - - -size_t CPP14Parser::MemberSpecificationContext::getRuleIndex() const { - return CPP14Parser::RuleMemberSpecification; -} - - -CPP14Parser::MemberSpecificationContext* CPP14Parser::memberSpecification() { - MemberSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 290, CPP14Parser::RuleMemberSpecification); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1723); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1723); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Alignas: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Constexpr: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Explicit: - case CPP14Parser::Extern: - case CPP14Parser::Float: - case CPP14Parser::Friend: - case CPP14Parser::Inline: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Mutable: - case CPP14Parser::Operator: - case CPP14Parser::Register: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Static: - case CPP14Parser::Static_assert: - case CPP14Parser::Struct: - case CPP14Parser::Template: - case CPP14Parser::Thread_local: - case CPP14Parser::Typedef: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Using: - case CPP14Parser::Virtual: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::LeftParen: - case CPP14Parser::LeftBracket: - case CPP14Parser::Star: - case CPP14Parser::And: - case CPP14Parser::Tilde: - case CPP14Parser::AndAnd: - case CPP14Parser::Colon: - case CPP14Parser::Doublecolon: - case CPP14Parser::Semi: - case CPP14Parser::Ellipsis: - case CPP14Parser::Identifier: { - setState(1719); - memberdeclaration(); - break; - } - - case CPP14Parser::Private: - case CPP14Parser::Protected: - case CPP14Parser::Public: { - setState(1720); - accessSpecifier(); - setState(1721); - match(CPP14Parser::Colon); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1725); - _errHandler->sync(this); - _la = _input->LA(1); - } while (((((_la - 10) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 10)) & 1543877313594212121) != 0) || ((((_la - 74) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 74)) & 463888353847684093) != 0)); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemberdeclarationContext ------------------------------------------------------------------ - -CPP14Parser::MemberdeclarationContext::MemberdeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::MemberdeclarationContext::Semi() { - return getToken(CPP14Parser::Semi, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::MemberdeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclSpecifierSeqContext* CPP14Parser::MemberdeclarationContext::declSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::MemberDeclaratorListContext* CPP14Parser::MemberdeclarationContext::memberDeclaratorList() { - return getRuleContext(0); -} - -CPP14Parser::FunctionDefinitionContext* CPP14Parser::MemberdeclarationContext::functionDefinition() { - return getRuleContext(0); -} - -CPP14Parser::UsingDeclarationContext* CPP14Parser::MemberdeclarationContext::usingDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::StaticAssertDeclarationContext* CPP14Parser::MemberdeclarationContext::staticAssertDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::TemplateDeclarationContext* CPP14Parser::MemberdeclarationContext::templateDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::AliasDeclarationContext* CPP14Parser::MemberdeclarationContext::aliasDeclaration() { - return getRuleContext(0); -} - -CPP14Parser::EmptyDeclarationContext* CPP14Parser::MemberdeclarationContext::emptyDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::MemberdeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleMemberdeclaration; -} - - -CPP14Parser::MemberdeclarationContext* CPP14Parser::memberdeclaration() { - MemberdeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 292, CPP14Parser::RuleMemberdeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1743); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 244, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1728); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 241, _ctx)) { - case 1: { - setState(1727); - attributeSpecifierSeq(); - break; - } - - default: - break; - } - setState(1731); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 242, _ctx)) { - case 1: { - setState(1730); - declSpecifierSeq(); - break; - } - - default: - break; - } - setState(1734); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 4503599694480384) != 0) || ((((_la - 85) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 85)) & 217711892254981) != 0)) { - setState(1733); - memberDeclaratorList(); - } - setState(1736); - match(CPP14Parser::Semi); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1737); - functionDefinition(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1738); - usingDeclaration(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(1739); - staticAssertDeclaration(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(1740); - templateDeclaration(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(1741); - aliasDeclaration(); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(1742); - emptyDeclaration(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemberDeclaratorListContext ------------------------------------------------------------------ - -CPP14Parser::MemberDeclaratorListContext::MemberDeclaratorListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::MemberDeclaratorListContext::memberDeclarator() { - return getRuleContexts(); -} - -CPP14Parser::MemberDeclaratorContext* CPP14Parser::MemberDeclaratorListContext::memberDeclarator(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::MemberDeclaratorListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::MemberDeclaratorListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::MemberDeclaratorListContext::getRuleIndex() const { - return CPP14Parser::RuleMemberDeclaratorList; -} - - -CPP14Parser::MemberDeclaratorListContext* CPP14Parser::memberDeclaratorList() { - MemberDeclaratorListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 294, CPP14Parser::RuleMemberDeclaratorList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1745); - memberDeclarator(); - setState(1750); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1746); - match(CPP14Parser::Comma); - setState(1747); - memberDeclarator(); - setState(1752); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemberDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::MemberDeclaratorContext::MemberDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DeclaratorContext* CPP14Parser::MemberDeclaratorContext::declarator() { - return getRuleContext(0); -} - -CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::MemberDeclaratorContext::virtualSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::PureSpecifierContext* CPP14Parser::MemberDeclaratorContext::pureSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::BraceOrEqualInitializerContext* CPP14Parser::MemberDeclaratorContext::braceOrEqualInitializer() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::MemberDeclaratorContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::MemberDeclaratorContext::constantExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::MemberDeclaratorContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::MemberDeclaratorContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::MemberDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleMemberDeclarator; -} - - -CPP14Parser::MemberDeclaratorContext* CPP14Parser::memberDeclarator() { - MemberDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 296, CPP14Parser::RuleMemberDeclarator); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1773); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 252, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1753); - declarator(); - setState(1763); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 249, _ctx)) { - case 1: { - setState(1755); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Final - - || _la == CPP14Parser::Override) { - setState(1754); - virtualSpecifierSeq(); - } - setState(1758); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Assign) { - setState(1757); - pureSpecifier(); - } - break; - } - - case 2: { - setState(1761); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::LeftBrace - - || _la == CPP14Parser::Assign) { - setState(1760); - braceOrEqualInitializer(); - } - break; - } - - default: - break; - } - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1766); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(1765); - match(CPP14Parser::Identifier); - } - setState(1769); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1768); - attributeSpecifierSeq(); - } - setState(1771); - match(CPP14Parser::Colon); - setState(1772); - constantExpression(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- VirtualSpecifierSeqContext ------------------------------------------------------------------ - -CPP14Parser::VirtualSpecifierSeqContext::VirtualSpecifierSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::VirtualSpecifierSeqContext::virtualSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::VirtualSpecifierContext* CPP14Parser::VirtualSpecifierSeqContext::virtualSpecifier(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::VirtualSpecifierSeqContext::getRuleIndex() const { - return CPP14Parser::RuleVirtualSpecifierSeq; -} - - -CPP14Parser::VirtualSpecifierSeqContext* CPP14Parser::virtualSpecifierSeq() { - VirtualSpecifierSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 298, CPP14Parser::RuleVirtualSpecifierSeq); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1776); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1775); - virtualSpecifier(); - setState(1778); - _errHandler->sync(this); - _la = _input->LA(1); - } while (_la == CPP14Parser::Final - - || _la == CPP14Parser::Override); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- VirtualSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::VirtualSpecifierContext::VirtualSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::VirtualSpecifierContext::Override() { - return getToken(CPP14Parser::Override, 0); -} - -tree::TerminalNode* CPP14Parser::VirtualSpecifierContext::Final() { - return getToken(CPP14Parser::Final, 0); -} - - -size_t CPP14Parser::VirtualSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleVirtualSpecifier; -} - - -CPP14Parser::VirtualSpecifierContext* CPP14Parser::virtualSpecifier() { - VirtualSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 300, CPP14Parser::RuleVirtualSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1780); - _la = _input->LA(1); - if (!(_la == CPP14Parser::Final - - || _la == CPP14Parser::Override)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- PureSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::PureSpecifierContext::PureSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::PureSpecifierContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -tree::TerminalNode* CPP14Parser::PureSpecifierContext::OctalLiteral() { - return getToken(CPP14Parser::OctalLiteral, 0); -} - - -size_t CPP14Parser::PureSpecifierContext::getRuleIndex() const { - return CPP14Parser::RulePureSpecifier; -} - - -CPP14Parser::PureSpecifierContext* CPP14Parser::pureSpecifier() { - PureSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 302, CPP14Parser::RulePureSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1782); - match(CPP14Parser::Assign); - setState(1783); - antlrcpp::downCast(_localctx)->val = match(CPP14Parser::OctalLiteral); - if((antlrcpp::downCast(_localctx)->val != nullptr ? antlrcpp::downCast(_localctx)->val->getText() : "").compare("0")!=0) throw new InputMismatchException(this); - - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BaseClauseContext ------------------------------------------------------------------ - -CPP14Parser::BaseClauseContext::BaseClauseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::BaseClauseContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::BaseSpecifierListContext* CPP14Parser::BaseClauseContext::baseSpecifierList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::BaseClauseContext::getRuleIndex() const { - return CPP14Parser::RuleBaseClause; -} - - -CPP14Parser::BaseClauseContext* CPP14Parser::baseClause() { - BaseClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 304, CPP14Parser::RuleBaseClause); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1786); - match(CPP14Parser::Colon); - setState(1787); - baseSpecifierList(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BaseSpecifierListContext ------------------------------------------------------------------ - -CPP14Parser::BaseSpecifierListContext::BaseSpecifierListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::BaseSpecifierListContext::baseSpecifier() { - return getRuleContexts(); -} - -CPP14Parser::BaseSpecifierContext* CPP14Parser::BaseSpecifierListContext::baseSpecifier(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::BaseSpecifierListContext::Ellipsis() { - return getTokens(CPP14Parser::Ellipsis); -} - -tree::TerminalNode* CPP14Parser::BaseSpecifierListContext::Ellipsis(size_t i) { - return getToken(CPP14Parser::Ellipsis, i); -} - -std::vector CPP14Parser::BaseSpecifierListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::BaseSpecifierListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::BaseSpecifierListContext::getRuleIndex() const { - return CPP14Parser::RuleBaseSpecifierList; -} - - -CPP14Parser::BaseSpecifierListContext* CPP14Parser::baseSpecifierList() { - BaseSpecifierListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 306, CPP14Parser::RuleBaseSpecifierList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1789); - baseSpecifier(); - setState(1791); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1790); - match(CPP14Parser::Ellipsis); - } - setState(1800); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1793); - match(CPP14Parser::Comma); - setState(1794); - baseSpecifier(); - setState(1796); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1795); - match(CPP14Parser::Ellipsis); - } - setState(1802); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BaseSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::BaseSpecifierContext::BaseSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::BaseTypeSpecifierContext* CPP14Parser::BaseSpecifierContext::baseTypeSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::BaseSpecifierContext::Virtual() { - return getToken(CPP14Parser::Virtual, 0); -} - -CPP14Parser::AccessSpecifierContext* CPP14Parser::BaseSpecifierContext::accessSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::BaseSpecifierContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::BaseSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleBaseSpecifier; -} - - -CPP14Parser::BaseSpecifierContext* CPP14Parser::baseSpecifier() { - BaseSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 308, CPP14Parser::RuleBaseSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1804); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(1803); - attributeSpecifierSeq(); - } - setState(1818); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Decltype: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - setState(1806); - baseTypeSpecifier(); - break; - } - - case CPP14Parser::Virtual: { - setState(1807); - match(CPP14Parser::Virtual); - setState(1809); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 126100789566373888) != 0)) { - setState(1808); - accessSpecifier(); - } - setState(1811); - baseTypeSpecifier(); - break; - } - - case CPP14Parser::Private: - case CPP14Parser::Protected: - case CPP14Parser::Public: { - setState(1812); - accessSpecifier(); - setState(1814); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Virtual) { - setState(1813); - match(CPP14Parser::Virtual); - } - setState(1816); - baseTypeSpecifier(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ClassOrDeclTypeContext ------------------------------------------------------------------ - -CPP14Parser::ClassOrDeclTypeContext::ClassOrDeclTypeContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassNameContext* CPP14Parser::ClassOrDeclTypeContext::className() { - return getRuleContext(0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::ClassOrDeclTypeContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -CPP14Parser::DecltypeSpecifierContext* CPP14Parser::ClassOrDeclTypeContext::decltypeSpecifier() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ClassOrDeclTypeContext::getRuleIndex() const { - return CPP14Parser::RuleClassOrDeclType; -} - - -CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::classOrDeclType() { - ClassOrDeclTypeContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 310, CPP14Parser::RuleClassOrDeclType); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1825); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 262, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1821); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 261, _ctx)) { - case 1: { - setState(1820); - nestedNameSpecifier(0); - break; - } - - default: - break; - } - setState(1823); - className(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1824); - decltypeSpecifier(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- BaseTypeSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::BaseTypeSpecifierContext::BaseTypeSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::BaseTypeSpecifierContext::classOrDeclType() { - return getRuleContext(0); -} - - -size_t CPP14Parser::BaseTypeSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleBaseTypeSpecifier; -} - - -CPP14Parser::BaseTypeSpecifierContext* CPP14Parser::baseTypeSpecifier() { - BaseTypeSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 312, CPP14Parser::RuleBaseTypeSpecifier); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1827); - classOrDeclType(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- AccessSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::AccessSpecifierContext::AccessSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Private() { - return getToken(CPP14Parser::Private, 0); -} - -tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Protected() { - return getToken(CPP14Parser::Protected, 0); -} - -tree::TerminalNode* CPP14Parser::AccessSpecifierContext::Public() { - return getToken(CPP14Parser::Public, 0); -} - - -size_t CPP14Parser::AccessSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleAccessSpecifier; -} - - -CPP14Parser::AccessSpecifierContext* CPP14Parser::accessSpecifier() { - AccessSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 314, CPP14Parser::RuleAccessSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1829); - _la = _input->LA(1); - if (!((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 126100789566373888) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConversionFunctionIdContext ------------------------------------------------------------------ - -CPP14Parser::ConversionFunctionIdContext::ConversionFunctionIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ConversionFunctionIdContext::Operator() { - return getToken(CPP14Parser::Operator, 0); -} - -CPP14Parser::ConversionTypeIdContext* CPP14Parser::ConversionFunctionIdContext::conversionTypeId() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConversionFunctionIdContext::getRuleIndex() const { - return CPP14Parser::RuleConversionFunctionId; -} - - -CPP14Parser::ConversionFunctionIdContext* CPP14Parser::conversionFunctionId() { - ConversionFunctionIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 316, CPP14Parser::RuleConversionFunctionId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1831); - match(CPP14Parser::Operator); - setState(1832); - conversionTypeId(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConversionTypeIdContext ------------------------------------------------------------------ - -CPP14Parser::ConversionTypeIdContext::ConversionTypeIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::ConversionTypeIdContext::typeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::ConversionDeclaratorContext* CPP14Parser::ConversionTypeIdContext::conversionDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConversionTypeIdContext::getRuleIndex() const { - return CPP14Parser::RuleConversionTypeId; -} - - -CPP14Parser::ConversionTypeIdContext* CPP14Parser::conversionTypeId() { - ConversionTypeIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 318, CPP14Parser::RuleConversionTypeId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1834); - typeSpecifierSeq(); - setState(1836); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 263, _ctx)) { - case 1: { - setState(1835); - conversionDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConversionDeclaratorContext ------------------------------------------------------------------ - -CPP14Parser::ConversionDeclaratorContext::ConversionDeclaratorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::PointerOperatorContext* CPP14Parser::ConversionDeclaratorContext::pointerOperator() { - return getRuleContext(0); -} - -CPP14Parser::ConversionDeclaratorContext* CPP14Parser::ConversionDeclaratorContext::conversionDeclarator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConversionDeclaratorContext::getRuleIndex() const { - return CPP14Parser::RuleConversionDeclarator; -} - - -CPP14Parser::ConversionDeclaratorContext* CPP14Parser::conversionDeclarator() { - ConversionDeclaratorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 320, CPP14Parser::RuleConversionDeclarator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1838); - pointerOperator(); - setState(1840); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 264, _ctx)) { - case 1: { - setState(1839); - conversionDeclarator(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ConstructorInitializerContext ------------------------------------------------------------------ - -CPP14Parser::ConstructorInitializerContext::ConstructorInitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ConstructorInitializerContext::Colon() { - return getToken(CPP14Parser::Colon, 0); -} - -CPP14Parser::MemInitializerListContext* CPP14Parser::ConstructorInitializerContext::memInitializerList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ConstructorInitializerContext::getRuleIndex() const { - return CPP14Parser::RuleConstructorInitializer; -} - - -CPP14Parser::ConstructorInitializerContext* CPP14Parser::constructorInitializer() { - ConstructorInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 322, CPP14Parser::RuleConstructorInitializer); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1842); - match(CPP14Parser::Colon); - setState(1843); - memInitializerList(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemInitializerListContext ------------------------------------------------------------------ - -CPP14Parser::MemInitializerListContext::MemInitializerListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::MemInitializerListContext::memInitializer() { - return getRuleContexts(); -} - -CPP14Parser::MemInitializerContext* CPP14Parser::MemInitializerListContext::memInitializer(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::MemInitializerListContext::Ellipsis() { - return getTokens(CPP14Parser::Ellipsis); -} - -tree::TerminalNode* CPP14Parser::MemInitializerListContext::Ellipsis(size_t i) { - return getToken(CPP14Parser::Ellipsis, i); -} - -std::vector CPP14Parser::MemInitializerListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::MemInitializerListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::MemInitializerListContext::getRuleIndex() const { - return CPP14Parser::RuleMemInitializerList; -} - - -CPP14Parser::MemInitializerListContext* CPP14Parser::memInitializerList() { - MemInitializerListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 324, CPP14Parser::RuleMemInitializerList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1845); - memInitializer(); - setState(1847); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1846); - match(CPP14Parser::Ellipsis); - } - setState(1856); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1849); - match(CPP14Parser::Comma); - setState(1850); - memInitializer(); - setState(1852); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1851); - match(CPP14Parser::Ellipsis); - } - setState(1858); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MemInitializerContext ------------------------------------------------------------------ - -CPP14Parser::MemInitializerContext::MemInitializerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::MeminitializeridContext* CPP14Parser::MemInitializerContext::meminitializerid() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::MemInitializerContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::MemInitializerContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::BracedInitListContext* CPP14Parser::MemInitializerContext::bracedInitList() { - return getRuleContext(0); -} - -CPP14Parser::ExpressionListContext* CPP14Parser::MemInitializerContext::expressionList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::MemInitializerContext::getRuleIndex() const { - return CPP14Parser::RuleMemInitializer; -} - - -CPP14Parser::MemInitializerContext* CPP14Parser::memInitializer() { - MemInitializerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 326, CPP14Parser::RuleMemInitializer); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1859); - meminitializerid(); - setState(1866); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::LeftParen: { - setState(1860); - match(CPP14Parser::LeftParen); - setState(1862); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474400910417) != 0) || _la == CPP14Parser::Identifier) { - setState(1861); - expressionList(); - } - setState(1864); - match(CPP14Parser::RightParen); - break; - } - - case CPP14Parser::LeftBrace: { - setState(1865); - bracedInitList(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- MeminitializeridContext ------------------------------------------------------------------ - -CPP14Parser::MeminitializeridContext::MeminitializeridContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::ClassOrDeclTypeContext* CPP14Parser::MeminitializeridContext::classOrDeclType() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::MeminitializeridContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::MeminitializeridContext::getRuleIndex() const { - return CPP14Parser::RuleMeminitializerid; -} - - -CPP14Parser::MeminitializeridContext* CPP14Parser::meminitializerid() { - MeminitializeridContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 328, CPP14Parser::RuleMeminitializerid); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1870); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 270, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1868); - classOrDeclType(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1869); - match(CPP14Parser::Identifier); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- OperatorFunctionIdContext ------------------------------------------------------------------ - -CPP14Parser::OperatorFunctionIdContext::OperatorFunctionIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::OperatorFunctionIdContext::Operator() { - return getToken(CPP14Parser::Operator, 0); -} - -CPP14Parser::TheOperatorContext* CPP14Parser::OperatorFunctionIdContext::theOperator() { - return getRuleContext(0); -} - - -size_t CPP14Parser::OperatorFunctionIdContext::getRuleIndex() const { - return CPP14Parser::RuleOperatorFunctionId; -} - - -CPP14Parser::OperatorFunctionIdContext* CPP14Parser::operatorFunctionId() { - OperatorFunctionIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 330, CPP14Parser::RuleOperatorFunctionId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1872); - match(CPP14Parser::Operator); - setState(1873); - theOperator(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LiteralOperatorIdContext ------------------------------------------------------------------ - -CPP14Parser::LiteralOperatorIdContext::LiteralOperatorIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::Operator() { - return getToken(CPP14Parser::Operator, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::StringLiteral() { - return getToken(CPP14Parser::StringLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralOperatorIdContext::UserDefinedStringLiteral() { - return getToken(CPP14Parser::UserDefinedStringLiteral, 0); -} - - -size_t CPP14Parser::LiteralOperatorIdContext::getRuleIndex() const { - return CPP14Parser::RuleLiteralOperatorId; -} - - -CPP14Parser::LiteralOperatorIdContext* CPP14Parser::literalOperatorId() { - LiteralOperatorIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 332, CPP14Parser::RuleLiteralOperatorId); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1875); - match(CPP14Parser::Operator); - setState(1879); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::StringLiteral: { - setState(1876); - match(CPP14Parser::StringLiteral); - setState(1877); - match(CPP14Parser::Identifier); - break; - } - - case CPP14Parser::UserDefinedStringLiteral: { - setState(1878); - match(CPP14Parser::UserDefinedStringLiteral); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::TemplateDeclarationContext::TemplateDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -CPP14Parser::TemplateparameterListContext* CPP14Parser::TemplateDeclarationContext::templateparameterList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TemplateDeclarationContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -CPP14Parser::DeclarationContext* CPP14Parser::TemplateDeclarationContext::declaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TemplateDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateDeclaration; -} - - -CPP14Parser::TemplateDeclarationContext* CPP14Parser::templateDeclaration() { - TemplateDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 334, CPP14Parser::RuleTemplateDeclaration); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1881); - match(CPP14Parser::Template); - setState(1882); - match(CPP14Parser::Less); - setState(1883); - templateparameterList(); - setState(1884); - match(CPP14Parser::Greater); - setState(1885); - declaration(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateparameterListContext ------------------------------------------------------------------ - -CPP14Parser::TemplateparameterListContext::TemplateparameterListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::TemplateparameterListContext::templateParameter() { - return getRuleContexts(); -} - -CPP14Parser::TemplateParameterContext* CPP14Parser::TemplateparameterListContext::templateParameter(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::TemplateparameterListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::TemplateparameterListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::TemplateparameterListContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateparameterList; -} - - -CPP14Parser::TemplateparameterListContext* CPP14Parser::templateparameterList() { - TemplateparameterListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 336, CPP14Parser::RuleTemplateparameterList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1887); - templateParameter(); - setState(1892); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1888); - match(CPP14Parser::Comma); - setState(1889); - templateParameter(); - setState(1894); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateParameterContext ------------------------------------------------------------------ - -CPP14Parser::TemplateParameterContext::TemplateParameterContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TypeParameterContext* CPP14Parser::TemplateParameterContext::typeParameter() { - return getRuleContext(0); -} - -CPP14Parser::ParameterDeclarationContext* CPP14Parser::TemplateParameterContext::parameterDeclaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TemplateParameterContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateParameter; -} - - -CPP14Parser::TemplateParameterContext* CPP14Parser::templateParameter() { - TemplateParameterContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 338, CPP14Parser::RuleTemplateParameter); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1897); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 273, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1895); - typeParameter(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1896); - parameterDeclaration(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypeParameterContext ------------------------------------------------------------------ - -CPP14Parser::TypeParameterContext::TypeParameterContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Class() { - return getToken(CPP14Parser::Class, 0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Typename_() { - return getToken(CPP14Parser::Typename_, 0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::TypeParameterContext::theTypeId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -CPP14Parser::TemplateparameterListContext* CPP14Parser::TypeParameterContext::templateparameterList() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - -tree::TerminalNode* CPP14Parser::TypeParameterContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::TypeParameterContext::getRuleIndex() const { - return CPP14Parser::RuleTypeParameter; -} - - -CPP14Parser::TypeParameterContext* CPP14Parser::typeParameter() { - TypeParameterContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 340, CPP14Parser::RuleTypeParameter); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1908); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Class: - case CPP14Parser::Template: { - setState(1904); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(1899); - match(CPP14Parser::Template); - setState(1900); - match(CPP14Parser::Less); - setState(1901); - templateparameterList(); - setState(1902); - match(CPP14Parser::Greater); - } - setState(1906); - match(CPP14Parser::Class); - break; - } - - case CPP14Parser::Typename_: { - setState(1907); - match(CPP14Parser::Typename_); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1921); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 279, _ctx)) { - case 1: { - setState(1911); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1910); - match(CPP14Parser::Ellipsis); - } - setState(1914); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(1913); - match(CPP14Parser::Identifier); - } - break; - } - - case 2: { - setState(1917); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Identifier) { - setState(1916); - match(CPP14Parser::Identifier); - } - setState(1919); - match(CPP14Parser::Assign); - setState(1920); - theTypeId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- SimpleTemplateIdContext ------------------------------------------------------------------ - -CPP14Parser::SimpleTemplateIdContext::SimpleTemplateIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TemplateNameContext* CPP14Parser::SimpleTemplateIdContext::templateName() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::SimpleTemplateIdContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -tree::TerminalNode* CPP14Parser::SimpleTemplateIdContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -CPP14Parser::TemplateArgumentListContext* CPP14Parser::SimpleTemplateIdContext::templateArgumentList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::SimpleTemplateIdContext::getRuleIndex() const { - return CPP14Parser::RuleSimpleTemplateId; -} - - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::simpleTemplateId() { - SimpleTemplateIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 342, CPP14Parser::RuleSimpleTemplateId); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1923); - templateName(); - setState(1924); - match(CPP14Parser::Less); - setState(1926); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979472930990334) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384268307) != 0) || _la == CPP14Parser::Identifier) { - setState(1925); - templateArgumentList(); - } - setState(1928); - match(CPP14Parser::Greater); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateIdContext ------------------------------------------------------------------ - -CPP14Parser::TemplateIdContext::TemplateIdContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TemplateIdContext::simpleTemplateId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TemplateIdContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -tree::TerminalNode* CPP14Parser::TemplateIdContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -CPP14Parser::OperatorFunctionIdContext* CPP14Parser::TemplateIdContext::operatorFunctionId() { - return getRuleContext(0); -} - -CPP14Parser::LiteralOperatorIdContext* CPP14Parser::TemplateIdContext::literalOperatorId() { - return getRuleContext(0); -} - -CPP14Parser::TemplateArgumentListContext* CPP14Parser::TemplateIdContext::templateArgumentList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TemplateIdContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateId; -} - - -CPP14Parser::TemplateIdContext* CPP14Parser::templateId() { - TemplateIdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 344, CPP14Parser::RuleTemplateId); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1941); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(1930); - simpleTemplateId(); - break; - } - - case CPP14Parser::Operator: { - enterOuterAlt(_localctx, 2); - setState(1933); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 281, _ctx)) { - case 1: { - setState(1931); - operatorFunctionId(); - break; - } - - case 2: { - setState(1932); - literalOperatorId(); - break; - } - - default: - break; - } - setState(1935); - match(CPP14Parser::Less); - setState(1937); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979472930990334) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384268307) != 0) || _la == CPP14Parser::Identifier) { - setState(1936); - templateArgumentList(); - } - setState(1939); - match(CPP14Parser::Greater); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateNameContext ------------------------------------------------------------------ - -CPP14Parser::TemplateNameContext::TemplateNameContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TemplateNameContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - - -size_t CPP14Parser::TemplateNameContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateName; -} - - -CPP14Parser::TemplateNameContext* CPP14Parser::templateName() { - TemplateNameContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 346, CPP14Parser::RuleTemplateName); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1943); - match(CPP14Parser::Identifier); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateArgumentListContext ------------------------------------------------------------------ - -CPP14Parser::TemplateArgumentListContext::TemplateArgumentListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::TemplateArgumentListContext::templateArgument() { - return getRuleContexts(); -} - -CPP14Parser::TemplateArgumentContext* CPP14Parser::TemplateArgumentListContext::templateArgument(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::TemplateArgumentListContext::Ellipsis() { - return getTokens(CPP14Parser::Ellipsis); -} - -tree::TerminalNode* CPP14Parser::TemplateArgumentListContext::Ellipsis(size_t i) { - return getToken(CPP14Parser::Ellipsis, i); -} - -std::vector CPP14Parser::TemplateArgumentListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::TemplateArgumentListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::TemplateArgumentListContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateArgumentList; -} - - -CPP14Parser::TemplateArgumentListContext* CPP14Parser::templateArgumentList() { - TemplateArgumentListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 348, CPP14Parser::RuleTemplateArgumentList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1945); - templateArgument(); - setState(1947); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1946); - match(CPP14Parser::Ellipsis); - } - setState(1956); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(1949); - match(CPP14Parser::Comma); - setState(1950); - templateArgument(); - setState(1952); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(1951); - match(CPP14Parser::Ellipsis); - } - setState(1958); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TemplateArgumentContext ------------------------------------------------------------------ - -CPP14Parser::TemplateArgumentContext::TemplateArgumentContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::TemplateArgumentContext::theTypeId() { - return getRuleContext(0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::TemplateArgumentContext::constantExpression() { - return getRuleContext(0); -} - -CPP14Parser::IdExpressionContext* CPP14Parser::TemplateArgumentContext::idExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TemplateArgumentContext::getRuleIndex() const { - return CPP14Parser::RuleTemplateArgument; -} - - -CPP14Parser::TemplateArgumentContext* CPP14Parser::templateArgument() { - TemplateArgumentContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 350, CPP14Parser::RuleTemplateArgument); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(1962); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 287, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1959); - theTypeId(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1960); - constantExpression(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1961); - idExpression(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypeNameSpecifierContext ------------------------------------------------------------------ - -CPP14Parser::TypeNameSpecifierContext::TypeNameSpecifierContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Typename_() { - return getToken(CPP14Parser::Typename_, 0); -} - -CPP14Parser::NestedNameSpecifierContext* CPP14Parser::TypeNameSpecifierContext::nestedNameSpecifier() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Identifier() { - return getToken(CPP14Parser::Identifier, 0); -} - -CPP14Parser::SimpleTemplateIdContext* CPP14Parser::TypeNameSpecifierContext::simpleTemplateId() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::TypeNameSpecifierContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - - -size_t CPP14Parser::TypeNameSpecifierContext::getRuleIndex() const { - return CPP14Parser::RuleTypeNameSpecifier; -} - - -CPP14Parser::TypeNameSpecifierContext* CPP14Parser::typeNameSpecifier() { - TypeNameSpecifierContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 352, CPP14Parser::RuleTypeNameSpecifier); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1964); - match(CPP14Parser::Typename_); - setState(1965); - nestedNameSpecifier(0); - setState(1971); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 289, _ctx)) { - case 1: { - setState(1966); - match(CPP14Parser::Identifier); - break; - } - - case 2: { - setState(1968); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Template) { - setState(1967); - match(CPP14Parser::Template); - } - setState(1970); - simpleTemplateId(); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExplicitInstantiationContext ------------------------------------------------------------------ - -CPP14Parser::ExplicitInstantiationContext::ExplicitInstantiationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ExplicitInstantiationContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -CPP14Parser::DeclarationContext* CPP14Parser::ExplicitInstantiationContext::declaration() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ExplicitInstantiationContext::Extern() { - return getToken(CPP14Parser::Extern, 0); -} - - -size_t CPP14Parser::ExplicitInstantiationContext::getRuleIndex() const { - return CPP14Parser::RuleExplicitInstantiation; -} - - -CPP14Parser::ExplicitInstantiationContext* CPP14Parser::explicitInstantiation() { - ExplicitInstantiationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 354, CPP14Parser::RuleExplicitInstantiation); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1974); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Extern) { - setState(1973); - match(CPP14Parser::Extern); - } - setState(1976); - match(CPP14Parser::Template); - setState(1977); - declaration(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExplicitSpecializationContext ------------------------------------------------------------------ - -CPP14Parser::ExplicitSpecializationContext::ExplicitSpecializationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Template() { - return getToken(CPP14Parser::Template, 0); -} - -tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Less() { - return getToken(CPP14Parser::Less, 0); -} - -tree::TerminalNode* CPP14Parser::ExplicitSpecializationContext::Greater() { - return getToken(CPP14Parser::Greater, 0); -} - -CPP14Parser::DeclarationContext* CPP14Parser::ExplicitSpecializationContext::declaration() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ExplicitSpecializationContext::getRuleIndex() const { - return CPP14Parser::RuleExplicitSpecialization; -} - - -CPP14Parser::ExplicitSpecializationContext* CPP14Parser::explicitSpecialization() { - ExplicitSpecializationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 356, CPP14Parser::RuleExplicitSpecialization); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1979); - match(CPP14Parser::Template); - setState(1980); - match(CPP14Parser::Less); - setState(1981); - match(CPP14Parser::Greater); - setState(1982); - declaration(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TryBlockContext ------------------------------------------------------------------ - -CPP14Parser::TryBlockContext::TryBlockContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TryBlockContext::Try() { - return getToken(CPP14Parser::Try, 0); -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::TryBlockContext::compoundStatement() { - return getRuleContext(0); -} - -CPP14Parser::HandlerSeqContext* CPP14Parser::TryBlockContext::handlerSeq() { - return getRuleContext(0); -} - - -size_t CPP14Parser::TryBlockContext::getRuleIndex() const { - return CPP14Parser::RuleTryBlock; -} - - -CPP14Parser::TryBlockContext* CPP14Parser::tryBlock() { - TryBlockContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 358, CPP14Parser::RuleTryBlock); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1984); - match(CPP14Parser::Try); - setState(1985); - compoundStatement(); - setState(1986); - handlerSeq(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- FunctionTryBlockContext ------------------------------------------------------------------ - -CPP14Parser::FunctionTryBlockContext::FunctionTryBlockContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::FunctionTryBlockContext::Try() { - return getToken(CPP14Parser::Try, 0); -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::FunctionTryBlockContext::compoundStatement() { - return getRuleContext(0); -} - -CPP14Parser::HandlerSeqContext* CPP14Parser::FunctionTryBlockContext::handlerSeq() { - return getRuleContext(0); -} - -CPP14Parser::ConstructorInitializerContext* CPP14Parser::FunctionTryBlockContext::constructorInitializer() { - return getRuleContext(0); -} - - -size_t CPP14Parser::FunctionTryBlockContext::getRuleIndex() const { - return CPP14Parser::RuleFunctionTryBlock; -} - - -CPP14Parser::FunctionTryBlockContext* CPP14Parser::functionTryBlock() { - FunctionTryBlockContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 360, CPP14Parser::RuleFunctionTryBlock); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1988); - match(CPP14Parser::Try); - setState(1990); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Colon) { - setState(1989); - constructorInitializer(); - } - setState(1992); - compoundStatement(); - setState(1993); - handlerSeq(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- HandlerSeqContext ------------------------------------------------------------------ - -CPP14Parser::HandlerSeqContext::HandlerSeqContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::HandlerSeqContext::handler() { - return getRuleContexts(); -} - -CPP14Parser::HandlerContext* CPP14Parser::HandlerSeqContext::handler(size_t i) { - return getRuleContext(i); -} - - -size_t CPP14Parser::HandlerSeqContext::getRuleIndex() const { - return CPP14Parser::RuleHandlerSeq; -} - - -CPP14Parser::HandlerSeqContext* CPP14Parser::handlerSeq() { - HandlerSeqContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 362, CPP14Parser::RuleHandlerSeq); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1996); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1995); - handler(); - setState(1998); - _errHandler->sync(this); - _la = _input->LA(1); - } while (_la == CPP14Parser::Catch); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- HandlerContext ------------------------------------------------------------------ - -CPP14Parser::HandlerContext::HandlerContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::HandlerContext::Catch() { - return getToken(CPP14Parser::Catch, 0); -} - -tree::TerminalNode* CPP14Parser::HandlerContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ExceptionDeclarationContext* CPP14Parser::HandlerContext::exceptionDeclaration() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::HandlerContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::CompoundStatementContext* CPP14Parser::HandlerContext::compoundStatement() { - return getRuleContext(0); -} - - -size_t CPP14Parser::HandlerContext::getRuleIndex() const { - return CPP14Parser::RuleHandler; -} - - -CPP14Parser::HandlerContext* CPP14Parser::handler() { - HandlerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 364, CPP14Parser::RuleHandler); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(2000); - match(CPP14Parser::Catch); - setState(2001); - match(CPP14Parser::LeftParen); - setState(2002); - exceptionDeclaration(); - setState(2003); - match(CPP14Parser::RightParen); - setState(2004); - compoundStatement(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExceptionDeclarationContext ------------------------------------------------------------------ - -CPP14Parser::ExceptionDeclarationContext::ExceptionDeclarationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::TypeSpecifierSeqContext* CPP14Parser::ExceptionDeclarationContext::typeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::AttributeSpecifierSeqContext* CPP14Parser::ExceptionDeclarationContext::attributeSpecifierSeq() { - return getRuleContext(0); -} - -CPP14Parser::DeclaratorContext* CPP14Parser::ExceptionDeclarationContext::declarator() { - return getRuleContext(0); -} - -CPP14Parser::AbstractDeclaratorContext* CPP14Parser::ExceptionDeclarationContext::abstractDeclarator() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::ExceptionDeclarationContext::Ellipsis() { - return getToken(CPP14Parser::Ellipsis, 0); -} - - -size_t CPP14Parser::ExceptionDeclarationContext::getRuleIndex() const { - return CPP14Parser::RuleExceptionDeclaration; -} - - -CPP14Parser::ExceptionDeclarationContext* CPP14Parser::exceptionDeclaration() { - ExceptionDeclarationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 366, CPP14Parser::RuleExceptionDeclaration); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(2015); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Alignas: - case CPP14Parser::Auto: - case CPP14Parser::Bool: - case CPP14Parser::Char: - case CPP14Parser::Char16: - case CPP14Parser::Char32: - case CPP14Parser::Class: - case CPP14Parser::Const: - case CPP14Parser::Decltype: - case CPP14Parser::Double: - case CPP14Parser::Enum: - case CPP14Parser::Float: - case CPP14Parser::Int: - case CPP14Parser::Long: - case CPP14Parser::Short: - case CPP14Parser::Signed: - case CPP14Parser::Struct: - case CPP14Parser::Typename_: - case CPP14Parser::Union: - case CPP14Parser::Unsigned: - case CPP14Parser::Void: - case CPP14Parser::Volatile: - case CPP14Parser::Wchar: - case CPP14Parser::LeftBracket: - case CPP14Parser::Doublecolon: - case CPP14Parser::Identifier: { - enterOuterAlt(_localctx, 1); - setState(2007); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Alignas || _la == CPP14Parser::LeftBracket) { - setState(2006); - attributeSpecifierSeq(); - } - setState(2009); - typeSpecifierSeq(); - setState(2012); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 294, _ctx)) { - case 1: { - setState(2010); - declarator(); - break; - } - - case 2: { - setState(2011); - abstractDeclarator(); - break; - } - - default: - break; - } - break; - } - - case CPP14Parser::Ellipsis: { - enterOuterAlt(_localctx, 2); - setState(2014); - match(CPP14Parser::Ellipsis); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ThrowExpressionContext ------------------------------------------------------------------ - -CPP14Parser::ThrowExpressionContext::ThrowExpressionContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::ThrowExpressionContext::Throw() { - return getToken(CPP14Parser::Throw, 0); -} - -CPP14Parser::AssignmentExpressionContext* CPP14Parser::ThrowExpressionContext::assignmentExpression() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ThrowExpressionContext::getRuleIndex() const { - return CPP14Parser::RuleThrowExpression; -} - - -CPP14Parser::ThrowExpressionContext* CPP14Parser::throwExpression() { - ThrowExpressionContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 368, CPP14Parser::RuleThrowExpression); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(2017); - match(CPP14Parser::Throw); - setState(2019); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 8364979464334764286) != 0) || ((((_la - 65) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 65)) & 4719772474384133201) != 0) || _la == CPP14Parser::Identifier) { - setState(2018); - assignmentExpression(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ExceptionSpecificationContext ------------------------------------------------------------------ - -CPP14Parser::ExceptionSpecificationContext::ExceptionSpecificationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -CPP14Parser::DynamicExceptionSpecificationContext* CPP14Parser::ExceptionSpecificationContext::dynamicExceptionSpecification() { - return getRuleContext(0); -} - -CPP14Parser::NoeExceptSpecificationContext* CPP14Parser::ExceptionSpecificationContext::noeExceptSpecification() { - return getRuleContext(0); -} - - -size_t CPP14Parser::ExceptionSpecificationContext::getRuleIndex() const { - return CPP14Parser::RuleExceptionSpecification; -} - - -CPP14Parser::ExceptionSpecificationContext* CPP14Parser::exceptionSpecification() { - ExceptionSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 370, CPP14Parser::RuleExceptionSpecification); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(2023); - _errHandler->sync(this); - switch (_input->LA(1)) { - case CPP14Parser::Throw: { - enterOuterAlt(_localctx, 1); - setState(2021); - dynamicExceptionSpecification(); - break; - } - - case CPP14Parser::Noexcept: { - enterOuterAlt(_localctx, 2); - setState(2022); - noeExceptSpecification(); - break; - } - - default: - throw NoViableAltException(this); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- DynamicExceptionSpecificationContext ------------------------------------------------------------------ - -CPP14Parser::DynamicExceptionSpecificationContext::DynamicExceptionSpecificationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::Throw() { - return getToken(CPP14Parser::Throw, 0); -} - -tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::DynamicExceptionSpecificationContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - -CPP14Parser::TypeIdListContext* CPP14Parser::DynamicExceptionSpecificationContext::typeIdList() { - return getRuleContext(0); -} - - -size_t CPP14Parser::DynamicExceptionSpecificationContext::getRuleIndex() const { - return CPP14Parser::RuleDynamicExceptionSpecification; -} - - -CPP14Parser::DynamicExceptionSpecificationContext* CPP14Parser::dynamicExceptionSpecification() { - DynamicExceptionSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 372, CPP14Parser::RuleDynamicExceptionSpecification); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(2025); - match(CPP14Parser::Throw); - setState(2026); - match(CPP14Parser::LeftParen); - setState(2028); - _errHandler->sync(this); - - _la = _input->LA(1); - if (((((_la - 13) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 13)) & -9213942612181769245) != 0) || ((((_la - 77) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 77)) & 37154696925806707) != 0)) { - setState(2027); - typeIdList(); - } - setState(2030); - match(CPP14Parser::RightParen); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TypeIdListContext ------------------------------------------------------------------ - -CPP14Parser::TypeIdListContext::TypeIdListContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -std::vector CPP14Parser::TypeIdListContext::theTypeId() { - return getRuleContexts(); -} - -CPP14Parser::TheTypeIdContext* CPP14Parser::TypeIdListContext::theTypeId(size_t i) { - return getRuleContext(i); -} - -std::vector CPP14Parser::TypeIdListContext::Ellipsis() { - return getTokens(CPP14Parser::Ellipsis); -} - -tree::TerminalNode* CPP14Parser::TypeIdListContext::Ellipsis(size_t i) { - return getToken(CPP14Parser::Ellipsis, i); -} - -std::vector CPP14Parser::TypeIdListContext::Comma() { - return getTokens(CPP14Parser::Comma); -} - -tree::TerminalNode* CPP14Parser::TypeIdListContext::Comma(size_t i) { - return getToken(CPP14Parser::Comma, i); -} - - -size_t CPP14Parser::TypeIdListContext::getRuleIndex() const { - return CPP14Parser::RuleTypeIdList; -} - - -CPP14Parser::TypeIdListContext* CPP14Parser::typeIdList() { - TypeIdListContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 374, CPP14Parser::RuleTypeIdList); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(2032); - theTypeId(); - setState(2034); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(2033); - match(CPP14Parser::Ellipsis); - } - setState(2043); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == CPP14Parser::Comma) { - setState(2036); - match(CPP14Parser::Comma); - setState(2037); - theTypeId(); - setState(2039); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == CPP14Parser::Ellipsis) { - setState(2038); - match(CPP14Parser::Ellipsis); - } - setState(2045); - _errHandler->sync(this); - _la = _input->LA(1); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- NoeExceptSpecificationContext ------------------------------------------------------------------ - -CPP14Parser::NoeExceptSpecificationContext::NoeExceptSpecificationContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::Noexcept() { - return getToken(CPP14Parser::Noexcept, 0); -} - -tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -CPP14Parser::ConstantExpressionContext* CPP14Parser::NoeExceptSpecificationContext::constantExpression() { - return getRuleContext(0); -} - -tree::TerminalNode* CPP14Parser::NoeExceptSpecificationContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::NoeExceptSpecificationContext::getRuleIndex() const { - return CPP14Parser::RuleNoeExceptSpecification; -} - - -CPP14Parser::NoeExceptSpecificationContext* CPP14Parser::noeExceptSpecification() { - NoeExceptSpecificationContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 376, CPP14Parser::RuleNoeExceptSpecification); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(2052); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 302, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(2046); - match(CPP14Parser::Noexcept); - setState(2047); - match(CPP14Parser::LeftParen); - setState(2048); - constantExpression(); - setState(2049); - match(CPP14Parser::RightParen); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(2051); - match(CPP14Parser::Noexcept); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TheOperatorContext ------------------------------------------------------------------ - -CPP14Parser::TheOperatorContext::TheOperatorContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::New() { - return getToken(CPP14Parser::New, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftBracket() { - return getToken(CPP14Parser::LeftBracket, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::RightBracket() { - return getToken(CPP14Parser::RightBracket, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Delete() { - return getToken(CPP14Parser::Delete, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Plus() { - return getToken(CPP14Parser::Plus, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Minus() { - return getToken(CPP14Parser::Minus, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Star() { - return getToken(CPP14Parser::Star, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Div() { - return getToken(CPP14Parser::Div, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Mod() { - return getToken(CPP14Parser::Mod, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Caret() { - return getToken(CPP14Parser::Caret, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::And() { - return getToken(CPP14Parser::And, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Or() { - return getToken(CPP14Parser::Or, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Tilde() { - return getToken(CPP14Parser::Tilde, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Not() { - return getToken(CPP14Parser::Not, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Assign() { - return getToken(CPP14Parser::Assign, 0); -} - -std::vector CPP14Parser::TheOperatorContext::Greater() { - return getTokens(CPP14Parser::Greater); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Greater(size_t i) { - return getToken(CPP14Parser::Greater, i); -} - -std::vector CPP14Parser::TheOperatorContext::Less() { - return getTokens(CPP14Parser::Less); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Less(size_t i) { - return getToken(CPP14Parser::Less, i); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::GreaterEqual() { - return getToken(CPP14Parser::GreaterEqual, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::PlusAssign() { - return getToken(CPP14Parser::PlusAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::MinusAssign() { - return getToken(CPP14Parser::MinusAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::StarAssign() { - return getToken(CPP14Parser::StarAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::ModAssign() { - return getToken(CPP14Parser::ModAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::XorAssign() { - return getToken(CPP14Parser::XorAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::AndAssign() { - return getToken(CPP14Parser::AndAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::OrAssign() { - return getToken(CPP14Parser::OrAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::RightShiftAssign() { - return getToken(CPP14Parser::RightShiftAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftShiftAssign() { - return getToken(CPP14Parser::LeftShiftAssign, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Equal() { - return getToken(CPP14Parser::Equal, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::NotEqual() { - return getToken(CPP14Parser::NotEqual, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::LessEqual() { - return getToken(CPP14Parser::LessEqual, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::AndAnd() { - return getToken(CPP14Parser::AndAnd, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::OrOr() { - return getToken(CPP14Parser::OrOr, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::PlusPlus() { - return getToken(CPP14Parser::PlusPlus, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::MinusMinus() { - return getToken(CPP14Parser::MinusMinus, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Comma() { - return getToken(CPP14Parser::Comma, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::ArrowStar() { - return getToken(CPP14Parser::ArrowStar, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::Arrow() { - return getToken(CPP14Parser::Arrow, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::LeftParen() { - return getToken(CPP14Parser::LeftParen, 0); -} - -tree::TerminalNode* CPP14Parser::TheOperatorContext::RightParen() { - return getToken(CPP14Parser::RightParen, 0); -} - - -size_t CPP14Parser::TheOperatorContext::getRuleIndex() const { - return CPP14Parser::RuleTheOperator; -} - - -CPP14Parser::TheOperatorContext* CPP14Parser::theOperator() { - TheOperatorContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 378, CPP14Parser::RuleTheOperator); - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - setState(2105); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 305, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(2054); - match(CPP14Parser::New); - setState(2057); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 303, _ctx)) { - case 1: { - setState(2055); - match(CPP14Parser::LeftBracket); - setState(2056); - match(CPP14Parser::RightBracket); - break; - } - - default: - break; - } - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(2059); - match(CPP14Parser::Delete); - setState(2062); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 304, _ctx)) { - case 1: { - setState(2060); - match(CPP14Parser::LeftBracket); - setState(2061); - match(CPP14Parser::RightBracket); - break; - } - - default: - break; - } - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(2064); - match(CPP14Parser::Plus); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(2065); - match(CPP14Parser::Minus); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(2066); - match(CPP14Parser::Star); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(2067); - match(CPP14Parser::Div); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(2068); - match(CPP14Parser::Mod); - break; - } - - case 8: { - enterOuterAlt(_localctx, 8); - setState(2069); - match(CPP14Parser::Caret); - break; - } - - case 9: { - enterOuterAlt(_localctx, 9); - setState(2070); - match(CPP14Parser::And); - break; - } - - case 10: { - enterOuterAlt(_localctx, 10); - setState(2071); - match(CPP14Parser::Or); - break; - } - - case 11: { - enterOuterAlt(_localctx, 11); - setState(2072); - match(CPP14Parser::Tilde); - break; - } - - case 12: { - enterOuterAlt(_localctx, 12); - setState(2073); - match(CPP14Parser::Not); - break; - } - - case 13: { - enterOuterAlt(_localctx, 13); - setState(2074); - match(CPP14Parser::Assign); - break; - } - - case 14: { - enterOuterAlt(_localctx, 14); - setState(2075); - match(CPP14Parser::Greater); - break; - } - - case 15: { - enterOuterAlt(_localctx, 15); - setState(2076); - match(CPP14Parser::Less); - break; - } - - case 16: { - enterOuterAlt(_localctx, 16); - setState(2077); - match(CPP14Parser::GreaterEqual); - break; - } - - case 17: { - enterOuterAlt(_localctx, 17); - setState(2078); - match(CPP14Parser::PlusAssign); - break; - } - - case 18: { - enterOuterAlt(_localctx, 18); - setState(2079); - match(CPP14Parser::MinusAssign); - break; - } - - case 19: { - enterOuterAlt(_localctx, 19); - setState(2080); - match(CPP14Parser::StarAssign); - break; - } - - case 20: { - enterOuterAlt(_localctx, 20); - setState(2081); - match(CPP14Parser::ModAssign); - break; - } - - case 21: { - enterOuterAlt(_localctx, 21); - setState(2082); - match(CPP14Parser::XorAssign); - break; - } - - case 22: { - enterOuterAlt(_localctx, 22); - setState(2083); - match(CPP14Parser::AndAssign); - break; - } - - case 23: { - enterOuterAlt(_localctx, 23); - setState(2084); - match(CPP14Parser::OrAssign); - break; - } - - case 24: { - enterOuterAlt(_localctx, 24); - setState(2085); - match(CPP14Parser::Less); - setState(2086); - match(CPP14Parser::Less); - break; - } - - case 25: { - enterOuterAlt(_localctx, 25); - setState(2087); - match(CPP14Parser::Greater); - setState(2088); - match(CPP14Parser::Greater); - break; - } - - case 26: { - enterOuterAlt(_localctx, 26); - setState(2089); - match(CPP14Parser::RightShiftAssign); - break; - } - - case 27: { - enterOuterAlt(_localctx, 27); - setState(2090); - match(CPP14Parser::LeftShiftAssign); - break; - } - - case 28: { - enterOuterAlt(_localctx, 28); - setState(2091); - match(CPP14Parser::Equal); - break; - } - - case 29: { - enterOuterAlt(_localctx, 29); - setState(2092); - match(CPP14Parser::NotEqual); - break; - } - - case 30: { - enterOuterAlt(_localctx, 30); - setState(2093); - match(CPP14Parser::LessEqual); - break; - } - - case 31: { - enterOuterAlt(_localctx, 31); - setState(2094); - match(CPP14Parser::AndAnd); - break; - } - - case 32: { - enterOuterAlt(_localctx, 32); - setState(2095); - match(CPP14Parser::OrOr); - break; - } - - case 33: { - enterOuterAlt(_localctx, 33); - setState(2096); - match(CPP14Parser::PlusPlus); - break; - } - - case 34: { - enterOuterAlt(_localctx, 34); - setState(2097); - match(CPP14Parser::MinusMinus); - break; - } - - case 35: { - enterOuterAlt(_localctx, 35); - setState(2098); - match(CPP14Parser::Comma); - break; - } - - case 36: { - enterOuterAlt(_localctx, 36); - setState(2099); - match(CPP14Parser::ArrowStar); - break; - } - - case 37: { - enterOuterAlt(_localctx, 37); - setState(2100); - match(CPP14Parser::Arrow); - break; - } - - case 38: { - enterOuterAlt(_localctx, 38); - setState(2101); - match(CPP14Parser::LeftParen); - setState(2102); - match(CPP14Parser::RightParen); - break; - } - - case 39: { - enterOuterAlt(_localctx, 39); - setState(2103); - match(CPP14Parser::LeftBracket); - setState(2104); - match(CPP14Parser::RightBracket); - break; - } - - default: - break; - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- LiteralContext ------------------------------------------------------------------ - -CPP14Parser::LiteralContext::LiteralContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* CPP14Parser::LiteralContext::IntegerLiteral() { - return getToken(CPP14Parser::IntegerLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::CharacterLiteral() { - return getToken(CPP14Parser::CharacterLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::FloatingLiteral() { - return getToken(CPP14Parser::FloatingLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::StringLiteral() { - return getToken(CPP14Parser::StringLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::BooleanLiteral() { - return getToken(CPP14Parser::BooleanLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::PointerLiteral() { - return getToken(CPP14Parser::PointerLiteral, 0); -} - -tree::TerminalNode* CPP14Parser::LiteralContext::UserDefinedLiteral() { - return getToken(CPP14Parser::UserDefinedLiteral, 0); -} - - -size_t CPP14Parser::LiteralContext::getRuleIndex() const { - return CPP14Parser::RuleLiteral; -} - - -CPP14Parser::LiteralContext* CPP14Parser::literal() { - LiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 380, CPP14Parser::RuleLiteral); - size_t _la = 0; - -#if __cplusplus > 201703L - auto onExit = finally([=, this] { -#else - auto onExit = finally([=] { -#endif - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(2107); - _la = _input->LA(1); - if (!((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & 254) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -bool CPP14Parser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { - switch (ruleIndex) { - case 5: return nestedNameSpecifierSempred(antlrcpp::downCast(context), predicateIndex); - case 15: return postfixExpressionSempred(antlrcpp::downCast(context), predicateIndex); - case 25: return noPointerNewDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); - case 115: return noPointerDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); - case 126: return noPointerAbstractDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); - case 128: return noPointerAbstractPackDeclaratorSempred(antlrcpp::downCast(context), predicateIndex); - - default: - break; - } - return true; -} - -bool CPP14Parser::nestedNameSpecifierSempred(NestedNameSpecifierContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 0: return precpred(_ctx, 1); - - default: - break; - } - return true; -} - -bool CPP14Parser::postfixExpressionSempred(PostfixExpressionContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 1: return precpred(_ctx, 7); - case 2: return precpred(_ctx, 6); - case 3: return precpred(_ctx, 4); - case 4: return precpred(_ctx, 3); - - default: - break; - } - return true; -} - -bool CPP14Parser::noPointerNewDeclaratorSempred(NoPointerNewDeclaratorContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 5: return precpred(_ctx, 1); - - default: - break; - } - return true; -} - -bool CPP14Parser::noPointerDeclaratorSempred(NoPointerDeclaratorContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 6: return precpred(_ctx, 2); - - default: - break; - } - return true; -} - -bool CPP14Parser::noPointerAbstractDeclaratorSempred(NoPointerAbstractDeclaratorContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 7: return precpred(_ctx, 4); - - default: - break; - } - return true; -} - -bool CPP14Parser::noPointerAbstractPackDeclaratorSempred(NoPointerAbstractPackDeclaratorContext *_localctx, size_t predicateIndex) { - switch (predicateIndex) { - case 8: return precpred(_ctx, 2); - - default: - break; - } - return true; -} - -void CPP14Parser::initialize() { - ::antlr4::internal::call_once(cpp14parserParserOnceFlag, cpp14parserParserInitialize); -} diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index bf777e3..892d038 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -2,27 +2,14 @@ #include -MyCppAntlr::MyCppAntlr(std::unique_ptr input, - std::unique_ptr tokenStream, - std::unique_ptr lexer, - std::unique_ptr parser) - : input_ptr(std::move(input)), - tokenStream_ptr(std::move(tokenStream)), - lexer_ptr(std::move(lexer)), - parser_ptr(std::move(parser)) {} - -std::unique_ptr MyCppAntlr::init(std::ifstream& in) { - auto input = std::make_unique(in); - auto lex = std::make_unique(&(*input)); - auto tok = std::make_unique(&(*lex)); - auto parser = std::make_unique(&(*tok)); - auto a = std::make_unique( - MyCppAntlr(std::move(input),std::move(tok), std::move(lex), - std::move(parser))); - return std::move(a); +MyCppAntlr::MyCppAntlr(std::ifstream& in) { + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); } -std::vector MyCppAntlr::getTokens() { +std::vector MyCppAntlr::getTokensArray() { tokenStream_ptr->fill(); std::vector ans(tokenStream_ptr->size()); @@ -35,7 +22,24 @@ std::vector MyCppAntlr::getTokens() { return ans; } +std::string MyCppAntlr::getTokensString() { + tokenStream_ptr->fill(); + std::string res; + + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString()+" "; + } + + return res; +} + std::string MyCppAntlr::getTreeString() { auto tree = parser_ptr->translationUnit(); return tree->toStringTree(&(*parser_ptr)); +} + +std::pair MyCppAntlr::getTokensAndTree() { + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); } \ No newline at end of file diff --git a/server/pkg/antlr/python3/CMakeLists.txt b/server/pkg/antlr/python3/CMakeLists.txt new file mode 100644 index 0000000..e60ee23 --- /dev/null +++ b/server/pkg/antlr/python3/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.7) +project(python_antlr_lib) + +file(GLOB SOURCES ./src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) + + +antlr_target(Python3Grammar Python3.g4 + PACKAGE antlrcpptest) + +include_directories(${ANTLR_Python3Grammar_OUTPUT_DIR}) + + +message("ANTLR_Python3Grammar_OUTPUT_DIR=${ANTLR_Python3Grammar_OUTPUT_DIR}") + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_Python3Grammar_CXX_OUTPUTS}) + + +target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) + +set(PYTHON3_ANTLR_LIBRARY ${PROJECT_NAME}) +set(PYTHON3_ANTLR_LIBRARY ${PYTHON3_ANTLR_LIBRARY} PARENT_SCOPE) + +set(PYTHON3_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_Python3Grammar_OUTPUT_DIR}) +set(PYTHON3_ANTLR_INCLUDE_DIRS ${PYTHON3_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) + +message("PYTHON3_ANTLR = ${PYTHON3_ANTLR_INCLUDE_DIRS} ") \ No newline at end of file diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h new file mode 100644 index 0000000..c6302e7 --- /dev/null +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include + +#include "Python3Lexer.h" +#include "Python3Parser.h" +#include "IAntlrWrapper.h" +#include "antlr4-runtime.h" + +class PythonAntlr:public IAntlrWrapper { + private: + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; + + public: + PythonAntlr(std::ifstream &in); + ~PythonAntlr() override = default; + std::vector getTokensArray() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; + std::string getTreeString() override; +}; \ No newline at end of file diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp new file mode 100644 index 0000000..dac34bc --- /dev/null +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -0,0 +1,45 @@ +#include "PythonAntlr.h" + +#include + +PythonAntlr::PythonAntlr(std::ifstream& in) { + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); +} + +std::vector PythonAntlr::getTokensArray() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->toString(); + i++; + } + + return ans; +} + +std::string PythonAntlr::getTokensString() { + tokenStream_ptr->fill(); + std::string res; + + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString()+" "; + } + + return res; +} + +std::string PythonAntlr::getTreeString() { + auto tree = parser_ptr->file_input(); + return tree->toStringTree(&(*parser_ptr)); +} + +std::pair PythonAntlr::getTokensAndTree() { + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); +} \ No newline at end of file diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index 13b3a4d..61958f7 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -1,9 +1,13 @@ #pragma once #include +#include class IAntlrWrapper { public: - virtual std::vector getTokens() = 0; + virtual ~IAntlrWrapper() = default; + virtual std::vector getTokensArray() = 0; + virtual std::pair getTokensAndTree()=0; + virtual std::string getTokensString() = 0; virtual std::string getTreeString() = 0; }; -- GitLab From 71a93975c2b59a11678fc4258234abacf1973345 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 14 May 2023 22:03:29 +0300 Subject: [PATCH 051/134] add login function --- server/internal/service/include/Exceptions.h | 9 +++++++++ server/internal/service/include/UserService.h | 3 +-- server/internal/service/src/UserService.cpp | 9 +++++++-- .../service/tests/UserServiceTest.cpp | 19 +++++++++++++------ .../internal/service/virtual/IUserService.h | 2 +- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/server/internal/service/include/Exceptions.h b/server/internal/service/include/Exceptions.h index a032c21..0d108ab 100644 --- a/server/internal/service/include/Exceptions.h +++ b/server/internal/service/include/Exceptions.h @@ -6,4 +6,13 @@ class ValidateException : public std::exception { public: ValidateException(const std::string& msg) : _msg(msg) {} virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + + +class LoginException : public std::exception { + std::string _msg; + + public: + LoginException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; \ No newline at end of file diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 98ee105..1a889b8 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -15,7 +15,6 @@ class UserService : IUserService { UserService(); User createUser(const std::string& login, const std::string& username, const std::string& password) override; - // TODO login - User getUserById(size_t id) override; + User login(const std::string& login, const std::string& password) override; void deleteUser(size_t id) override; }; diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index b695cef..b6b1666 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -26,14 +26,19 @@ User UserService::createUser(const std::string& login, const std::string& userna } } -User UserService::getUserById(size_t id) { +User UserService::login(const std::string& login, const std::string& password) { try { - return userRepo->getUserById(id); + User u = userRepo->getUserByLogin(login); + if (u.getPassword() != password){ + throw LoginException("incorrect password"); + } + return u; } catch (std::exception& e) { throw e; } } + void UserService::deleteUser(size_t id) { try { userRepo->deleteByUserId(id); diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index 9038fd3..e576a99 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -50,20 +50,27 @@ TEST_F(UserServiceTest, deleteUserWithInvalidId) { EXPECT_THROW(us->deleteUser(1), std::exception); } -TEST_F(UserServiceTest, getUserOk) { - EXPECT_CALL(*mock_ptr, getUserById(1)) +TEST_F(UserServiceTest, loginOk) { + EXPECT_CALL(*mock_ptr, getUserByLogin("login")) .Times(1) .WillOnce(::testing::Return(User(1, "login", "password", "username"))); - User u = us->getUserById(1); + User u = us->login("login","password"); EXPECT_EQ(u.getLogin(), "login"); EXPECT_EQ(u.getId(), 1); EXPECT_EQ(u.getPassword(), "password"); EXPECT_EQ(u.getUsername(), "username"); } -TEST_F(UserServiceTest, getUserInvalidId) { - EXPECT_CALL(*mock_ptr, getUserById(-1)).Times(1).WillOnce(NoUserException()); - EXPECT_THROW(us->getUserById(-1), std::exception); +TEST_F(UserServiceTest, loginInvalidLogin) { + EXPECT_CALL(*mock_ptr, getUserByLogin("loginnn")).Times(1).WillOnce(NoUserException()); + EXPECT_THROW(us->login("loginnn","password"), std::exception); +} + +TEST_F(UserServiceTest, loginInvalidPass) { + EXPECT_CALL(*mock_ptr, getUserByLogin("login")) + .Times(1) + .WillOnce(::testing::Return(User(1, "login", "password", "username"))); + EXPECT_THROW(us->login("login","password1"), std::exception); } TEST_F(UserServiceTest, makeUserOk) { diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h index c8e9c68..b3a0ab5 100644 --- a/server/internal/service/virtual/IUserService.h +++ b/server/internal/service/virtual/IUserService.h @@ -9,6 +9,6 @@ class IUserService { virtual ~IUserService() = default; virtual User createUser(const std::string& login, const std::string& username, const std::string& password) = 0; - virtual User getUserById(size_t id) = 0; + virtual User login(const std::string& login, const std::string& password) = 0; virtual void deleteUser(size_t id) = 0; }; -- GitLab From 1c99bf23be7fb9784776a097807c1fec6a1f9e5b Mon Sep 17 00:00:00 2001 From: marcheanin Date: Sun, 14 May 2023 22:09:32 +0300 Subject: [PATCH 052/134] rename and fixes --- metrics/CMakeLists.txt | 5 +++++ metrics/metrics_headers/TextMetricsLib.h | 3 +-- metrics/source/TextMetricImpl.cpp | 7 +++++-- metrics/tests/src/text_metrics_tests.cpp | 4 ++-- src/main.cpp | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt index 73da6de..83bc97d 100644 --- a/metrics/CMakeLists.txt +++ b/metrics/CMakeLists.txt @@ -3,6 +3,11 @@ add_library(MetricsLib source/TextMetricImpl.cpp source/TokenMetricImpl.cpp) target_include_directories(MetricsLib PUBLIC metrics_headers) target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) +add_custom_target( + ${PROJECT_NAME}_COVERAGE + COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} +) + #if(BUILD_TESTS) add_subdirectory(tests) #endif() \ No newline at end of file diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h index 16f25d7..bae3a7e 100644 --- a/metrics/metrics_headers/TextMetricsLib.h +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -13,7 +13,6 @@ #include - class ITextMetric{ virtual void countMetric() = 0; virtual void setData(std::string text1, std::string text2) = 0; @@ -33,7 +32,7 @@ private: static std::vector tbmTokenizer(const std::string &text); }; -class LivDistTextMetric : public PrepareDataTextMetric{ +class LevDistTextMetric : public PrepareDataTextMetric{ public: void countMetric() override; }; diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index f9c595b..0727ad0 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -69,7 +69,7 @@ double PrepareDataTextMetric::getMetric() { return metric_res; } -void LivDistTextMetric::countMetric(){ +void LevDistTextMetric::countMetric(){ unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); int x, y, z; @@ -116,5 +116,8 @@ void JaccardTextMetric::countMetric() { set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(union_sets, union_sets.begin())); - metric_res = static_cast (intersect_sets.size()) / static_cast (union_sets.size()); + if (union_sets.empty()) + metric_res = 0; + else + metric_res = static_cast (intersect_sets.size()) / static_cast (union_sets.size()); } diff --git a/metrics/tests/src/text_metrics_tests.cpp b/metrics/tests/src/text_metrics_tests.cpp index c906aa5..e8317dd 100644 --- a/metrics/tests/src/text_metrics_tests.cpp +++ b/metrics/tests/src/text_metrics_tests.cpp @@ -13,9 +13,9 @@ class LivDistTextMetricTest : public ::testing::Test { protected: - std::unique_ptr livDistTextMetric; + std::unique_ptr livDistTextMetric; void SetUp(){ - livDistTextMetric = std::make_unique (); + livDistTextMetric = std::make_unique (); } void TearDown(){} }; diff --git a/src/main.cpp b/src/main.cpp index b2d44b0..7caaf2e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,7 @@ int main(){ fin1.close(); fin2.close(); - LivDistTextMetric livDistTextMetric; + LevDistTextMetric livDistTextMetric; JaccardTextMetric jaccardTextMetric; livDistTextMetric.setData(text1, text2); -- GitLab From b9f7d8fb40b16ba1eba5b670c85d0f2b0f0225b3 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Sun, 14 May 2023 22:17:22 +0300 Subject: [PATCH 053/134] delete count_metric method --- metrics/metrics_headers/TextMetricsLib.h | 7 ++----- metrics/source/TextMetricImpl.cpp | 16 ++++++---------- src/main.cpp | 3 --- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/metrics/metrics_headers/TextMetricsLib.h b/metrics/metrics_headers/TextMetricsLib.h index bae3a7e..574a964 100644 --- a/metrics/metrics_headers/TextMetricsLib.h +++ b/metrics/metrics_headers/TextMetricsLib.h @@ -14,7 +14,6 @@ #include class ITextMetric{ - virtual void countMetric() = 0; virtual void setData(std::string text1, std::string text2) = 0; virtual double getMetric() = 0; }; @@ -22,11 +21,9 @@ class ITextMetric{ class PrepareDataTextMetric : public ITextMetric{ public: void setData(std::string text1, std::string text2) override; - double getMetric() override; protected: std::vector tokens1; std::vector tokens2; - double metric_res{}; private: static std::string deleteComments(const std::string& text); static std::vector tbmTokenizer(const std::string &text); @@ -34,12 +31,12 @@ private: class LevDistTextMetric : public PrepareDataTextMetric{ public: - void countMetric() override; + double getMetric() override; }; class JaccardTextMetric : public PrepareDataTextMetric{ public: - void countMetric() override; + double getMetric() override; }; diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index 0727ad0..319023a 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -65,11 +65,7 @@ std::vector PrepareDataTextMetric::tbmTokenizer(const std::string return res; } -double PrepareDataTextMetric::getMetric() { - return metric_res; -} - -void LevDistTextMetric::countMetric(){ +double LevDistTextMetric::getMetric(){ unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); int x, y, z; @@ -94,13 +90,13 @@ void LevDistTextMetric::countMetric(){ } if (n == 0 || m == 0) - metric_res = 0; + return 0; else - metric_res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); + return 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); } -void JaccardTextMetric::countMetric() { +double JaccardTextMetric::getMetric() { std::set s1; std::set s2; @@ -117,7 +113,7 @@ void JaccardTextMetric::countMetric() { std::inserter(union_sets, union_sets.begin())); if (union_sets.empty()) - metric_res = 0; + return 0; else - metric_res = static_cast (intersect_sets.size()) / static_cast (union_sets.size()); + return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); } diff --git a/src/main.cpp b/src/main.cpp index 7caaf2e..2eade44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,8 +26,5 @@ int main(){ livDistTextMetric.setData(text1, text2); jaccardTextMetric.setData(text1, text2); - livDistTextMetric.countMetric(); - jaccardTextMetric.countMetric(); - std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric(); } \ No newline at end of file -- GitLab From d92ce59b3028c95657175016bbf0753092cbbf5d Mon Sep 17 00:00:00 2001 From: marcheanin Date: Sun, 14 May 2023 23:13:55 +0300 Subject: [PATCH 054/134] fix delete comms --- metrics/source/TextMetricImpl.cpp | 8 +++----- metrics/testProgs/code2.txt | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/metrics/source/TextMetricImpl.cpp b/metrics/source/TextMetricImpl.cpp index 319023a..4b2cabc 100644 --- a/metrics/source/TextMetricImpl.cpp +++ b/metrics/source/TextMetricImpl.cpp @@ -23,7 +23,6 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { ss << text; while(getline(ss, line)){ - line.pop_back(); line.push_back('\0'); modif += line; } @@ -45,9 +44,8 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { else if (modif[i] != '\0') res += modif[i]; - else{ + else if (res.size() > 0 && res[res.size() - 1] != '\n') res += '\n'; - } } return res; } @@ -91,8 +89,8 @@ double LevDistTextMetric::getMetric(){ if (n == 0 || m == 0) return 0; - else - return 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); + double res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); + return res; } diff --git a/metrics/testProgs/code2.txt b/metrics/testProgs/code2.txt index 2115b76..76fc711 100644 --- a/metrics/testProgs/code2.txt +++ b/metrics/testProgs/code2.txt @@ -1,5 +1,6 @@ // однострочный комментарий // еще один + // вау еще один #include -- GitLab From 9b72395a1745226a03f96d8d98863fd846401bec Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 14 May 2023 23:31:15 +0300 Subject: [PATCH 055/134] refactor createSolution --- server/internal/service/include/Exceptions.h | 8 +++++ server/internal/service/include/FileMethods.h | 14 ++++++++ .../service/include/SolutionService.h | 10 ++++-- server/internal/service/src/FileMethods.cpp | 15 ++++++++ .../internal/service/src/SolutionService.cpp | 35 ++++++++++++------- .../service/tests/SolutionServiceTest.cpp | 9 +++-- .../service/virtual/ISolutionService.h | 3 +- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 2 +- server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 2 +- .../pkg/antlr/python3/include/PythonAntlr.h | 2 +- server/pkg/antlr/python3/src/PythonAntlr.cpp | 2 +- 11 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 server/internal/service/include/FileMethods.h create mode 100644 server/internal/service/src/FileMethods.cpp diff --git a/server/internal/service/include/Exceptions.h b/server/internal/service/include/Exceptions.h index 0d108ab..b15d632 100644 --- a/server/internal/service/include/Exceptions.h +++ b/server/internal/service/include/Exceptions.h @@ -15,4 +15,12 @@ class LoginException : public std::exception { public: LoginException(const std::string& msg) : _msg(msg) {} virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +class FileExtensionException : public std::exception { + std::string _msg; + + public: + FileExtensionException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; \ No newline at end of file diff --git a/server/internal/service/include/FileMethods.h b/server/internal/service/include/FileMethods.h new file mode 100644 index 0000000..0ff8df3 --- /dev/null +++ b/server/internal/service/include/FileMethods.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +inline const std::string CPP_EXTENSION = "cpp"; +inline const std::string PYTHON_EXTENSION = "py"; +inline const std::string UNKNOWN_EXTENSION = ""; + +class FileMethods { + public: + static std::pair checkFileExtension( + const std::string& filename); +}; \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index f3c4944..a1c6880 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -8,22 +8,26 @@ #include "IMockMetrics.h" #include "ISolutionRepository.hpp" #include "ISolutionService.h" +#include "ITaskRepository.hpp" class SolutionService : ISolutionService { private: std::unique_ptr solutionRepo; std::unique_ptr metricRepo; - // taskRepo + std::unique_ptr taskRepo; std::unique_ptr antlr; std::unique_ptr metrics; - void setAntlrWrapper(const std::string& source, std::ifstream& in); + void setAntlrWrapper(const std::string& fileExtension, + const std::string& filename, + const std::string& filedata); public: explicit SolutionService(std::unique_ptr solutionRepo); SolutionService(); void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, - const std::string& source) override; + const std::string& filename, + const std::string& filedata) override; std::vector getSolutionsByUserAndTaskId(size_t userId, size_t taskId) override; void deleteSolutionById(size_t solId) override; diff --git a/server/internal/service/src/FileMethods.cpp b/server/internal/service/src/FileMethods.cpp new file mode 100644 index 0000000..6304eea --- /dev/null +++ b/server/internal/service/src/FileMethods.cpp @@ -0,0 +1,15 @@ +#include "FileMethods.h" + +#include +#include + +std::pair FileMethods::checkFileExtension( + const std::string& filename) { + if (filename.substr(filename.find_last_of(".") + 1) == CPP_EXTENSION) { + return std::make_pair(CPP_EXTENSION, true); + } + if (filename.substr(filename.find_last_of(".") + 1) == PYTHON_EXTENSION) { + return std::make_pair(PYTHON_EXTENSION, true); + } + return std::make_pair(UNKNOWN_EXTENSION, false); +} \ No newline at end of file diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index fc9aece..8432a53 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -1,8 +1,12 @@ #include "SolutionService.h" #include +#include +#include +#include "FileMethods.h" #include "MyCppAntlr.h" +#include "PythonAntlr.h" SolutionService::SolutionService( std::unique_ptr solutionRepo) @@ -14,34 +18,41 @@ SolutionService::SolutionService() { // metricRepo = std::make_unique(); } -void SolutionService::setAntlrWrapper(const std::string& source, - std::ifstream& in) { - if (source.substr(source.find_last_of(".") + 1) == "cpp") { +void SolutionService::setAntlrWrapper(const std::string& fileExtension, + const std::string& filename, + const std::string& filedata) { + std::istringstream in(filedata); + if (fileExtension == CPP_EXTENSION) { + antlr = std::make_unique(in); + } else if (fileExtension == PYTHON_EXTENSION) { antlr = std::make_unique(in); - } else { - throw "exception"; } } // Вердикт функция // treshhold хардкод -//TODO "filename" "data" - string -> создать файл Solution SolutionService::createSolution(size_t userId, size_t taskId, - const std::string& source) { + const std::string& filename, + const std::string& filedata) { try { - std::ifstream in(source); - setAntlrWrapper(source, in); + std::pair fileExtension = + FileMethods::checkFileExtension(filename); + if (!fileExtension.second) { + throw FileExtensionException("unknown file extension"); + } + + setAntlrWrapper(fileExtension.first, filename, filedata); + std::pair codeParse = antlr->getTokensAndTree(); std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - + // TODO: вызов метрик // получил результат - - Solution sol = Solution(std::ctime(&now), userId, source, codeParse.first, + Solution sol = Solution(std::ctime(&now), userId, filename, codeParse.first, codeParse.second, taskId, ""); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index 2136eee..d0eacf4 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -88,8 +88,13 @@ TEST_F(SolutionServiceTest, createSolution) { storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) .Times(1) .WillRepeatedly(::testing::Return(1)); - Solution sol = ss->createSolution(2, 1, "main.cpp"); + Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); EXPECT_EQ(sol.getId(), 1); EXPECT_EQ(sol.getSource(), "main.cpp"); - EXPECT_EQ(sol.getTokens(),"[@0,0:-1='',<-1>,1:0] "); + EXPECT_EQ(sol.getTokens(), + "[@0,0:2='int',<45>,1:0] [@1,4:7='main',<132>,1:4] " + "[@2,8:8='(',<85>,1:8] [@3,9:9=')',<86>,1:9] " + "[@4,10:10='{',<89>,1:10] [@5,11:16='return',<59>,1:11] " + "[@6,18:18='0',<1>,1:18] [@7,19:19=';',<128>,1:19] " + "[@8,20:20='}',<90>,1:20] [@9,21:20='',<-1>,1:21] "); } \ No newline at end of file diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index d3a268f..7c39d9c 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -9,7 +9,8 @@ class ISolutionService { public: virtual ~ISolutionService() = default; virtual Solution createSolution(size_t userId, size_t taskId, - const std::string& source) = 0; + const std::string& filename, + const std::string& filedata) = 0; virtual std::vector getSolutionsByUserAndTaskId(size_t userId, size_t taskId) = 0; virtual void deleteSolutionById(size_t solId) = 0; diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 34132c6..59c7336 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -17,7 +17,7 @@ class MyCppAntlr:public IAntlrWrapper { std::unique_ptr tokenStream_ptr; public: - MyCppAntlr(std::ifstream &in); + MyCppAntlr(std::istream &in); ~MyCppAntlr() override = default; std::vector getTokensArray() override; std::pair getTokensAndTree() override; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 892d038..6a5ac79 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -2,7 +2,7 @@ #include -MyCppAntlr::MyCppAntlr(std::ifstream& in) { +MyCppAntlr::MyCppAntlr(std::istream& in) { input_ptr = std::make_unique(in); lexer_ptr = std::make_unique(&(*input_ptr)); tokenStream_ptr = std::make_unique(&(*lexer_ptr)); diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index c6302e7..32116a8 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -17,7 +17,7 @@ class PythonAntlr:public IAntlrWrapper { std::unique_ptr tokenStream_ptr; public: - PythonAntlr(std::ifstream &in); + PythonAntlr(std::istream &in); ~PythonAntlr() override = default; std::vector getTokensArray() override; std::pair getTokensAndTree() override; diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index dac34bc..7c5417e 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -2,7 +2,7 @@ #include -PythonAntlr::PythonAntlr(std::ifstream& in) { +PythonAntlr::PythonAntlr(std::istream& in) { input_ptr = std::make_unique(in); lexer_ptr = std::make_unique(&(*input_ptr)); tokenStream_ptr = std::make_unique(&(*lexer_ptr)); -- GitLab From cb8f448635943ef70b867dd39eb78be62c4d4bd1 Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 14 May 2023 23:53:10 +0300 Subject: [PATCH 056/134] fix some details of merge --- CMakeLists.txt | 1 - metrics/CMakeLists.txt | 13 --------- server/internal/CMakeLists.txt | 6 ++++ server/internal/metrics/CMakeLists.txt | 28 +++++++++++++++++++ .../metrics/include}/TextMetricsLib.h | 0 .../metrics/include}/TokenMetricLib.h | 0 .../internal/metrics/src}/TextMetricImpl.cpp | 0 .../internal/metrics/src}/TokenMetricImpl.cpp | 0 .../internal/metrics}/testProgs/code1.txt | 0 .../internal/metrics}/testProgs/code2.txt | 0 .../internal/metrics}/tests/CMakeLists.txt | 0 .../metrics}/tests/src/test-codes/code1.txt | 0 .../metrics}/tests/src/text_metrics_tests.cpp | 0 server/internal/service/CMakeLists.txt | 7 +++-- .../service/include/SolutionService.h | 1 + 15 files changed, 40 insertions(+), 16 deletions(-) delete mode 100644 metrics/CMakeLists.txt create mode 100644 server/internal/metrics/CMakeLists.txt rename {metrics/metrics_headers => server/internal/metrics/include}/TextMetricsLib.h (100%) rename {metrics/metrics_headers => server/internal/metrics/include}/TokenMetricLib.h (100%) rename {metrics/source => server/internal/metrics/src}/TextMetricImpl.cpp (100%) rename {metrics/source => server/internal/metrics/src}/TokenMetricImpl.cpp (100%) rename {metrics => server/internal/metrics}/testProgs/code1.txt (100%) rename {metrics => server/internal/metrics}/testProgs/code2.txt (100%) rename {metrics => server/internal/metrics}/tests/CMakeLists.txt (100%) rename {metrics => server/internal/metrics}/tests/src/test-codes/code1.txt (100%) rename {metrics => server/internal/metrics}/tests/src/text_metrics_tests.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef5a104..e51f2bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.16) -<<<<<<< HEAD set(PROJECT_NAME "SourcedOut") diff --git a/metrics/CMakeLists.txt b/metrics/CMakeLists.txt deleted file mode 100644 index 83bc97d..0000000 --- a/metrics/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_library(MetricsLib source/TextMetricImpl.cpp source/TokenMetricImpl.cpp) - -target_include_directories(MetricsLib PUBLIC metrics_headers) -target_link_libraries(MetricsLib PUBLIC ${Boost_LIBRARIES}) - -add_custom_target( - ${PROJECT_NAME}_COVERAGE - COMMAND gcovr ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_SOURCE_DIR} -) - -#if(BUILD_TESTS) -add_subdirectory(tests) -#endif() \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index ef68e73..8fe4e6a 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -1,11 +1,17 @@ add_subdirectory(entities) add_subdirectory(repository) +add_subdirectory(metrics) add_subdirectory(service) set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) set(libEntities_INCLUDE_DIRS ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) +set(METRICS_LIBRARY ${METRICS_LIBRARY} PARENT_SCOPE) +set(METRICS_lib_INCLUDE_DIRS ${METRICS_lib_INCLUDE_DIRS} PARENT_SCOPE) + + + set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/internal/metrics/CMakeLists.txt b/server/internal/metrics/CMakeLists.txt new file mode 100644 index 0000000..bea052a --- /dev/null +++ b/server/internal/metrics/CMakeLists.txt @@ -0,0 +1,28 @@ +project("MetricsLib") + +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) + + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES}) + +message("ANTLR4_LIB = ${ANTLR4_LIB}") +message("ANTLR4_LIB_INCLUDE_DIRS = ${ANTLR4_LIB_INCLUDE_DIRS}") + +target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) + + +set(METRICS_LIBRARY ${PROJECT_NAME}) +set(METRICS_LIBRARY ${METRICS_LIBRARY} PARENT_SCOPE) + + +set(METRICS_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(METRICS_lib_INCLUDE_DIRS ${METRICS_lib_INCLUDE_DIRS} PARENT_SCOPE) + + +enable_testing() +#if(BUILD_TESTS) +# add_subdirectory(tests) +#endif() \ No newline at end of file diff --git a/metrics/metrics_headers/TextMetricsLib.h b/server/internal/metrics/include/TextMetricsLib.h similarity index 100% rename from metrics/metrics_headers/TextMetricsLib.h rename to server/internal/metrics/include/TextMetricsLib.h diff --git a/metrics/metrics_headers/TokenMetricLib.h b/server/internal/metrics/include/TokenMetricLib.h similarity index 100% rename from metrics/metrics_headers/TokenMetricLib.h rename to server/internal/metrics/include/TokenMetricLib.h diff --git a/metrics/source/TextMetricImpl.cpp b/server/internal/metrics/src/TextMetricImpl.cpp similarity index 100% rename from metrics/source/TextMetricImpl.cpp rename to server/internal/metrics/src/TextMetricImpl.cpp diff --git a/metrics/source/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp similarity index 100% rename from metrics/source/TokenMetricImpl.cpp rename to server/internal/metrics/src/TokenMetricImpl.cpp diff --git a/metrics/testProgs/code1.txt b/server/internal/metrics/testProgs/code1.txt similarity index 100% rename from metrics/testProgs/code1.txt rename to server/internal/metrics/testProgs/code1.txt diff --git a/metrics/testProgs/code2.txt b/server/internal/metrics/testProgs/code2.txt similarity index 100% rename from metrics/testProgs/code2.txt rename to server/internal/metrics/testProgs/code2.txt diff --git a/metrics/tests/CMakeLists.txt b/server/internal/metrics/tests/CMakeLists.txt similarity index 100% rename from metrics/tests/CMakeLists.txt rename to server/internal/metrics/tests/CMakeLists.txt diff --git a/metrics/tests/src/test-codes/code1.txt b/server/internal/metrics/tests/src/test-codes/code1.txt similarity index 100% rename from metrics/tests/src/test-codes/code1.txt rename to server/internal/metrics/tests/src/test-codes/code1.txt diff --git a/metrics/tests/src/text_metrics_tests.cpp b/server/internal/metrics/tests/src/text_metrics_tests.cpp similarity index 100% rename from metrics/tests/src/text_metrics_tests.cpp rename to server/internal/metrics/tests/src/text_metrics_tests.cpp diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index ed9f415..05699f7 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -10,8 +10,11 @@ add_library(${PROJECT_NAME} ${SOURCES}) message("ANTLR4_LIB = ${ANTLR4_LIB}") message("ANTLR4_LIB_INCLUDE_DIRS = ${ANTLR4_LIB_INCLUDE_DIRS}") -target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB}) +message("METRICS_lib_INCLUDE_DIRS=${METRICS_lib_INCLUDE_DIRS}") +message("METRICS_LIBRARY=${METRICS_LIBRARY}") + +target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) set(SERVICE_lib_LIBRARY ${PROJECT_NAME}) set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index a1c6880..86595fa 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -9,6 +9,7 @@ #include "ISolutionRepository.hpp" #include "ISolutionService.h" #include "ITaskRepository.hpp" +#include "TextMetricsLib.h" class SolutionService : ISolutionService { private: -- GitLab From 8138d3e3d8069dcd6babad380cb4c31a3affcf7e Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 10:44:20 +0300 Subject: [PATCH 057/134] add textBased metric call --- .../service/include/SolutionService.h | 10 ++-- server/internal/service/include/TaskService.h | 1 - server/internal/service/include/UserService.h | 1 - .../internal/service/src/SolutionService.cpp | 59 +++++++++++++++---- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index a1c6880..9e5b898 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -4,7 +4,6 @@ #include #include "IAntlrWrapper.h" -#include "IMetricRepository.hpp" #include "IMockMetrics.h" #include "ISolutionRepository.hpp" #include "ISolutionService.h" @@ -13,13 +12,16 @@ class SolutionService : ISolutionService { private: std::unique_ptr solutionRepo; - std::unique_ptr metricRepo; std::unique_ptr taskRepo; std::unique_ptr antlr; - std::unique_ptr metrics; + std::unique_ptr textMetric; + std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, - const std::string& filename, const std::string& filedata); + std::string setResultVerdict(float textBasedRes, float tokenBasedRes, + float treshold); + std::pair getMaxTextResMetric(std::vector& solutions, + const std::string& filedata); public: explicit SolutionService(std::unique_ptr solutionRepo); diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index f8cbd3a..d826e9a 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -12,7 +12,6 @@ class TaskService : public ITaskService { public: TaskService(std::unique_ptr taskRepo); TaskService(); - ~TaskService() override = default; Task createTask(const std::string& desc, float treshold = 0.5f) override; Task getTask(size_t id) override; std::vector getAllTasks() override; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 1a889b8..9a26617 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -10,7 +10,6 @@ class UserService : IUserService { std::unique_ptr userRepo; public: - ~UserService() override = default; explicit UserService(std::unique_ptr userRepo); UserService(); User createUser(const std::string& login, const std::string& username, diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 8432a53..79c7f2c 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -8,6 +8,10 @@ #include "MyCppAntlr.h" #include "PythonAntlr.h" +const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; +const std::string NOT_PLAGIAT_VERDICT = + "Красивое решение. А главное уникальное !"; + SolutionService::SolutionService( std::unique_ptr solutionRepo) : solutionRepo(std::move(solutionRepo)) {} @@ -15,22 +19,50 @@ SolutionService::SolutionService( SolutionService::SolutionService() { // solutionRepo=std::make_unique(); // taskRepo = std::make_unique(); - // metricRepo = std::make_unique(); } void SolutionService::setAntlrWrapper(const std::string& fileExtension, - const std::string& filename, const std::string& filedata) { std::istringstream in(filedata); if (fileExtension == CPP_EXTENSION) { antlr = std::make_unique(in); } else if (fileExtension == PYTHON_EXTENSION) { - antlr = std::make_unique(in); + antlr = std::make_unique(in); + } +} + +std::string SolutionService::setResultVerdict(float textBasedRes, + float tokenBasedRes, + float treshold = 0.5f) { + float meanRes = (tokenBasedRes + textBasedRes) / 2; + if (meanRes < treshold) { + return NOT_PLAGIAT_VERDICT; } + return PLAGIAT_VERDICT; } -// Вердикт функция -// treshhold хардкод +std::pair SolutionService::getMaxTextResMetric( + std::vector& solutions, const std::string& filedata) { + std::pair maxMatch = (0, 0); + for (auto sol : solutions) { + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + float textBasedRes = textMetric->getMetric(); + + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + textBasedRes = (textBasedRes + textMetric->getMetric()) / 2; + + if (textBasedRes > treshold) { + break; + } + if (maxMatch.first < textBasedRes) { + maxMatch.first = textBasedRes; + maxMatch.second = sol.getSenderId(); + } + } + return maxMatch; +} Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, @@ -42,17 +74,24 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, throw FileExtensionException("unknown file extension"); } - setAntlrWrapper(fileExtension.first, filename, filedata); - + setAntlrWrapper(fileExtension.first, filedata); std::pair codeParse = antlr->getTokensAndTree(); std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + float treshold = taskRepo->getTaskById(taskId).getTreshhold(); + + std::vector solutions = + solutionRepo->getSolutionsByTaskId(taskId); + + // float textBasedRes = getMaxTextResMetric(solutions, filedata); // TODO: вызов метрик // получил результат - Solution sol = Solution(std::ctime(&now), userId, filename, codeParse.first, + std::string result = setResultVerdict(0, 0, treshold); + + Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, codeParse.second, taskId, ""); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); @@ -89,7 +128,3 @@ std::pair SolutionService::getMetrics(size_t solId) { throw e; } } - -void SolutionService::setMetrics(std::unique_ptr metrics_) { - metrics = std::move(metrics_); -} -- GitLab From 0745844ad0c7971df126d33fb8539d97ecb2e910 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 15 May 2023 11:18:13 +0300 Subject: [PATCH 058/134] added original_solution field --- server/config.sh | 8 + server/internal/entities/include/Solution.hpp | 14 +- server/internal/entities/src/Solution.cpp | 28 ++-- .../repository/include/SolutionRepository.hpp | 2 + .../repository/include/TaskRepository.hpp | 4 +- .../repository/src/SolutionRepository.cpp | 20 ++- .../repository/src/TaskRepository.cpp | 19 ++- .../virtual/ISolutionRepository.hpp | 2 + .../repository/virtual/ITaskRepository.hpp | 2 + server/text-basic-metrics/code1.txt | 0 server/text-basic-metrics/code2.txt | 0 server/text-basic-metrics/tbm_main.cpp | 153 ++++++++++++++++++ 12 files changed, 236 insertions(+), 16 deletions(-) create mode 100644 server/config.sh create mode 100644 server/text-basic-metrics/code1.txt create mode 100644 server/text-basic-metrics/code2.txt create mode 100644 server/text-basic-metrics/tbm_main.cpp diff --git a/server/config.sh b/server/config.sh new file mode 100644 index 0000000..b05efd5 --- /dev/null +++ b/server/config.sh @@ -0,0 +1,8 @@ +pip install conan +conan profile detect --force +#------------- +mkdir "build" +cd build/ +#------------ +conan install . --build=missing -s build_type=Debug +cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 974a560..a8aeaf3 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -8,10 +8,12 @@ class Solution { public: Solution(size_t id, std::string sendDate, size_t senderId, std::string source, - std::string tokens, std::string astTree, size_t taskId, std::string result) noexcept; + std::string tokens, std::string astTree, + size_t taskId, std::string result, size_t orig_solution) noexcept; + + Solution(std::string sendDate, size_t senderId, std::string source, std::string tokens, + std::string astTree, size_t taskId, std::string result, size_t orig_solution) noexcept; - Solution(std::string sendDate, size_t senderId, std::string source, std::string tokens, std::string astTree, - size_t taskId, std::string result) noexcept; Solution() noexcept; [[nodiscard]] size_t getId() const noexcept; @@ -45,6 +47,10 @@ public: void setResult(const std::string &result) noexcept; + [[nodiscard]] size_t getOrigSolution() const; + + void setOrigSolution(size_t origSolution); + void setId(size_t id) noexcept; bool operator==(const Solution &rhs) const noexcept; @@ -60,7 +66,7 @@ private: std::string astTree; size_t task_id; std::string result; -public: + size_t orig_solution = 0; }; diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 0603c00..12a7102 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -6,20 +6,22 @@ Solution::Solution(size_t id, std::string sendDate, unsigned long senderId, std::string source, std::string tokens, std::string astTree, unsigned long taskId, - std::string result) noexcept : id(id), send_date(std::move(sendDate)), sender_id(senderId), - source(std::move(source)), tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)) {} + std::string result, size_t orig_solution_) noexcept: + id(id), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)), orig_solution(orig_solution_) {} Solution::Solution(std::string sendDate, unsigned long senderId, std::string source, std::string tokens, std::string astTree, unsigned long taskId, - std::string result) noexcept : id(0), send_date(std::move(sendDate)), sender_id(senderId), - source(std::move(source)), tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)) {} + std::string result, size_t orig_solution_) noexcept: + id(0), send_date(std::move(sendDate)), sender_id(senderId), + source(std::move(source)), tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), result(std::move(result)), orig_solution(orig_solution_) {} -Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} +Solution::Solution() noexcept: id(0), sender_id(0), task_id(0), orig_solution(0) {} size_t Solution::getId() const noexcept { return id; @@ -93,3 +95,11 @@ bool Solution::operator!=(const Solution &rhs) const noexcept { return !(rhs == *this); } +size_t Solution::getOrigSolution() const { + return orig_solution; +} + +void Solution::setOrigSolution(size_t origSolution) { + orig_solution = origSolution; +} + diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 2760959..50d9552 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -29,6 +29,8 @@ public: void deleteSolution(Solution solution) override; + std::optional getOriginalSolution(size_t id) override; + private: static Solution makeSolution(const result::const_iterator& c); std::shared_ptr manager; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index d907481..83e5135 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -15,7 +15,9 @@ public: explicit TaskRepository(); std::optional getTaskById(size_t id) override; - void updateTask(Task task) override; + std::vector getAllTasks() override; + + void updateTask(const Task& task) override; size_t storeTask(Task task) override; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 91ef68e..441bab7 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -56,6 +56,23 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { } } +std::optional SolutionRepository::getOriginalSolution(size_t id) { + try { + auto c = manager->connection(); + std::string sql = "SELECT * FROM solutions WHERE original_solution_id=" + std::to_string(id); + nontransaction n(*c); + result r(n.exec(sql)); + manager->freeConnection(c); + if (r.empty()) + return std::nullopt; + return makeSolution(r.begin()); + } catch (...) { + + throw; + } +} + + size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); @@ -120,7 +137,8 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("tokens")).as(), c.at(c.column_number("astTree")).as(), c.at(c.column_number("task_id")).as(), - c.at(c.column_number("result")).as()}; + c.at(c.column_number("result")).as(), + c.at(c.column_number("original_solution_id")).as()}; } SolutionRepository::SolutionRepository() { diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 9974dc5..f20dffb 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -19,7 +19,24 @@ std::optional TaskRepository::getTaskById(size_t id) { } } -void TaskRepository::updateTask(Task task) { +std::vector TaskRepository::getAllTasks() { + try { + auto c = manager->connection(); + std::string sql = "SELECT * FROM tasks"; + nontransaction n(*c); + result r(n.exec(sql)); + manager->freeConnection(c); + std::vector users; + for (result::const_iterator k = r.begin(); k != r.end(); ++k) + users.push_back(makeTask(k)); + return users; + } catch (...) { + + throw; + } +} + +void TaskRepository::updateTask(const Task &task) { try { auto c = manager->connection(); std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s';") % diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index d8e3b80..a634f47 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -21,6 +21,8 @@ public: virtual void deleteSolutionById(size_t id) = 0; virtual void deleteSolution(Solution solution) = 0; + + virtual std::optional getOriginalSolution(size_t id) = 0; }; #endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 6f201ca..62ee8a2 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -9,6 +9,8 @@ class ITaskRepository { public: virtual std::optional getTaskById(size_t id) = 0; + virtual std::vector getAllTasks() = 0; + virtual void updateTask(Task task) = 0; virtual size_t storeTask(Task task) = 0; diff --git a/server/text-basic-metrics/code1.txt b/server/text-basic-metrics/code1.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/text-basic-metrics/code2.txt b/server/text-basic-metrics/code2.txt new file mode 100644 index 0000000..e69de29 diff --git a/server/text-basic-metrics/tbm_main.cpp b/server/text-basic-metrics/tbm_main.cpp new file mode 100644 index 0000000..fdd4253 --- /dev/null +++ b/server/text-basic-metrics/tbm_main.cpp @@ -0,0 +1,153 @@ +// +// Created by march on 21.04.2023. +// + +#include +#include +#include +#include +#include +#include +#include + +#include + + +std::string deleteComms(const std::string& text){ + std::string modif; + std::string res; + + std::stringstream ss; + std::string line; + + ss << text; + + while(getline(ss, line)){ + line.pop_back(); + line.push_back('\0'); + modif += line; + } + + bool s_comm = false; + bool m_comm = false; + + for (int i = 0; i < modif.size(); i++){ + if (s_comm && modif[i] == '\0') + s_comm = false; + else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') + m_comm = false, i++; + else if (s_comm || m_comm) + continue; + else if (modif[i] == '/' && modif[i+1] == '/') + s_comm = true, i++; + else if (modif[i] == '/' && modif[i+1] == '*') + m_comm = true, i++; + + else if (modif[i] != '\0') + res += modif[i]; + else{ + res += '\n'; + } + } + return res; +} + +std::vector tbm_tokenizer(const std::string &text){ + boost::char_separator sep(" {}();,\"\0\'"); + std::vector res; + boost::tokenizer < boost::char_separator > tokens(text, sep); + + for (const std::string &s: tokens) { + if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ + res.push_back(s); + } + } + return res; +} + +// % = intersection(A, B) / union(A, B) +double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ + std::set s1; + std::set s2; + + for (auto &i : tokens1) s1.insert(i); + for (auto &i : tokens2) s2.insert(i); + + + std::set intersect_sets; + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(intersect_sets, intersect_sets.begin())); + + std::set union_sets; + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(union_sets, union_sets.begin())); + + std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; + + return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); +} + +double Livenstain_dist(std::vector tokens1, std::vector tokens2){ + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + int x, y, z; + + std::vector > lev (n, std::vector (m, 0)); + + for (int i = 0; i < n; i++){ + for (int j = 0; j < m; j++){ + if (std::min(i, j) == 0){ + lev[i][j] = std::max(i, j); + } + else{ + x = lev[i-1][j]; + y = lev[i][j-1]; + z = lev[i-1][j-1]; + lev[i][j] = std::min(x, std::min(y, z)); + if (tokens1[i] != tokens2[j]){ + lev[i][j]++; + } + } + } + } + + return lev[n-1][m-1]; +} + +std::pair textCompare(std::istream& fin1, std::istream& fin2){ + std::string line; + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); + + std::string non_comm_text1 = deleteComms(text1); + std::string non_comm_text2 = deleteComms(text2); + + std::vector tokens1 = tbm_tokenizer(non_comm_text1); + std::vector tokens2 = tbm_tokenizer(non_comm_text2); + + double res1 = Jaccard_metric(tokens1, tokens2); + double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); + + return {res1, res2}; +} + +int main(){ + + std::ifstream fin1; + fin1.open("text-basic-metrics/code1.txt"); + assert(fin1.is_open()); + + std::ifstream fin2; + fin2.open("text-basic-metrics/code2.txt"); + assert(fin2.is_open()); + + std::pair metrics_res = textCompare(fin1, fin2); + + std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; + fin1.close(); + fin2.close(); +} \ No newline at end of file -- GitLab From 662e9afe99701414f3c765f7ea538053f698ffee Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 11:21:08 +0300 Subject: [PATCH 059/134] fix and test metrics with service --- .../internal/metrics/include/TextMetricsLib.h | 52 ++++++++++--------- .../internal/metrics/include/TokenMetricLib.h | 1 + .../service/include/SolutionService.h | 8 +-- .../internal/service/src/SolutionService.cpp | 21 +++++--- .../service/tests/SolutionServiceTest.cpp | 48 +++++++++++++---- 5 files changed, 83 insertions(+), 47 deletions(-) diff --git a/server/internal/metrics/include/TextMetricsLib.h b/server/internal/metrics/include/TextMetricsLib.h index 574a964..4db863f 100644 --- a/server/internal/metrics/include/TextMetricsLib.h +++ b/server/internal/metrics/include/TextMetricsLib.h @@ -5,39 +5,41 @@ #ifndef SOURCEDOUT_DECLARATION_H #define SOURCEDOUT_DECLARATION_H +#include #include -#include -#include -#include #include +#include +#include +#include -#include - -class ITextMetric{ - virtual void setData(std::string text1, std::string text2) = 0; - virtual double getMetric() = 0; +class ITextMetric { + public: + virtual ~ITextMetric() = default; + virtual void setData(std::string text1, std::string text2) = 0; + virtual double getMetric() = 0; }; -class PrepareDataTextMetric : public ITextMetric{ -public: - void setData(std::string text1, std::string text2) override; -protected: - std::vector tokens1; - std::vector tokens2; -private: - static std::string deleteComments(const std::string& text); - static std::vector tbmTokenizer(const std::string &text); -}; +class PrepareDataTextMetric : public ITextMetric { + public: + void setData(std::string text1, std::string text2) override; + + protected: + std::vector tokens1; + std::vector tokens2; -class LevDistTextMetric : public PrepareDataTextMetric{ -public: - double getMetric() override; + private: + static std::string deleteComments(const std::string& text); + static std::vector tbmTokenizer(const std::string& text); }; -class JaccardTextMetric : public PrepareDataTextMetric{ -public: - double getMetric() override; +class LevDistTextMetric : public PrepareDataTextMetric { + public: + double getMetric() override; }; +class JaccardTextMetric : public PrepareDataTextMetric { + public: + double getMetric() override; +}; -#endif //SOURCEDOUT_DECLARATION_H +#endif // SOURCEDOUT_DECLARATION_H diff --git a/server/internal/metrics/include/TokenMetricLib.h b/server/internal/metrics/include/TokenMetricLib.h index 82c238d..59ee7a0 100644 --- a/server/internal/metrics/include/TokenMetricLib.h +++ b/server/internal/metrics/include/TokenMetricLib.h @@ -15,6 +15,7 @@ class ITokenMetric{ + virtual ~ITokenMetric() = default; virtual void countMetric() = 0; virtual void setData(std::vector tokens1, std::vector tokens2) = 0; virtual double getMetric() = 0; diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index b60f8d9..0e4fe56 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -15,17 +15,19 @@ class SolutionService : ISolutionService { std::unique_ptr solutionRepo; std::unique_ptr taskRepo; std::unique_ptr antlr; - std::unique_ptr textMetric; + std::unique_ptr textMetric; std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); std::string setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold); std::pair getMaxTextResMetric(std::vector& solutions, - const std::string& filedata); + const std::string& filedata, + float treshold); public: - explicit SolutionService(std::unique_ptr solutionRepo); + explicit SolutionService(std::unique_ptr solutionRepo, + std::unique_ptr taskRepo); SolutionService(); void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 79c7f2c..290f244 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -13,8 +13,9 @@ const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; SolutionService::SolutionService( - std::unique_ptr solutionRepo) - : solutionRepo(std::move(solutionRepo)) {} + std::unique_ptr solutionRepo, + std::unique_ptr taskRepo) + : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} SolutionService::SolutionService() { // solutionRepo=std::make_unique(); @@ -42,16 +43,18 @@ std::string SolutionService::setResultVerdict(float textBasedRes, } std::pair SolutionService::getMaxTextResMetric( - std::vector& solutions, const std::string& filedata) { - std::pair maxMatch = (0, 0); + std::vector& solutions, const std::string& filedata, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); for (auto sol : solutions) { textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); - float textBasedRes = textMetric->getMetric(); + float textBasedRes = float(textMetric->getMetric()); + std::cout << textBasedRes << std::endl; textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); - textBasedRes = (textBasedRes + textMetric->getMetric()) / 2; + textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; if (textBasedRes > treshold) { break; @@ -85,11 +88,13 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); - // float textBasedRes = getMaxTextResMetric(solutions, filedata); + std::pair textBasedRes = + getMaxTextResMetric(solutions, filedata, treshold); + // TODO: вызов метрик // получил результат - std::string result = setResultVerdict(0, 0, treshold); + std::string result = setResultVerdict(textBasedRes.first, 0.5, treshold); Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, codeParse.second, taskId, ""); diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index d0eacf4..473842a 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -27,14 +27,28 @@ class SolutionRepositoryMock : public ISolutionRepository { MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); }; +class TaskRepositoryMock : public ITaskRepository { + public: + ~TaskRepositoryMock() override = default; + MOCK_METHOD(Task, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (Task task), (override)); + MOCK_METHOD(int, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks, (), (override)); +}; + struct SolutionServiceTest : public testing::Test { SolutionService* ss; - SolutionRepositoryMock* mock_ptr; + SolutionRepositoryMock* solutionMockPtr; + TaskRepositoryMock* taskMockPtr; void SetUp() { - auto mock = std::make_unique(); - mock_ptr = mock.get(); - ss = new SolutionService(std::move(mock)); + auto sMock = std::make_unique(); + solutionMockPtr = sMock.get(); + auto tMock = std::make_unique(); + taskMockPtr = tMock.get(); + ss = new SolutionService(std::move(sMock), std::move(tMock)); } void TearDown() { delete ss; } }; @@ -47,7 +61,7 @@ TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { std::vector solutions; solutions.push_back(Solution(0, "", 1, "", "", "", 1, "")); solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); - EXPECT_CALL(*mock_ptr, getSolutions(1, 1)) + EXPECT_CALL(*solutionMockPtr, getSolutions(1, 1)) .Times(1) .WillOnce(::testing::Return(solutions)); std::vector sols = ss->getSolutionsByUserAndTaskId(1, 1); @@ -55,19 +69,19 @@ TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { } TEST_F(SolutionServiceTest, deleteSolution) { - EXPECT_CALL(*mock_ptr, deleteSolutionById(1)).Times(1); + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(1)).Times(1); ss->deleteSolutionById(1); } TEST_F(SolutionServiceTest, deleteSolutionException) { - EXPECT_CALL(*mock_ptr, deleteSolutionById(-1)) + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(-1)) .Times(1) .WillRepeatedly(NoSolutionException()); EXPECT_THROW(ss->deleteSolutionById(-1), std::exception); } TEST_F(SolutionServiceTest, getMetrics) { - EXPECT_CALL(*mock_ptr, getSolutionById(1)) + EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) .Times(1) .WillOnce(::testing::Return( Solution(1, "", 1, "", "tokens", "astTree", 1, ""))); @@ -77,20 +91,32 @@ TEST_F(SolutionServiceTest, getMetrics) { } TEST_F(SolutionServiceTest, getMetricsException) { - EXPECT_CALL(*mock_ptr, getSolutionById(-1)) + EXPECT_CALL(*solutionMockPtr, getSolutionById(-1)) .Times(1) .WillRepeatedly(NoSolutionException()); EXPECT_THROW(ss->getMetrics(-1), std::exception); } TEST_F(SolutionServiceTest, createSolution) { - EXPECT_CALL(*mock_ptr, + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) .Times(1) .WillRepeatedly(::testing::Return(1)); + + std::vector solutions; + solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); + solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) + .Times(1) + .WillOnce(::testing::Return(solutions)); + + EXPECT_CALL(*taskMockPtr, getTaskById(1)) + .Times(1) + .WillOnce(::testing::Return(Task(1, "desription", 0.7f))); + Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); EXPECT_EQ(sol.getId(), 1); - EXPECT_EQ(sol.getSource(), "main.cpp"); + EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); EXPECT_EQ(sol.getTokens(), "[@0,0:2='int',<45>,1:0] [@1,4:7='main',<132>,1:4] " "[@2,8:8='(',<85>,1:8] [@3,9:9=')',<86>,1:9] " -- GitLab From 3efd3f12481336474203daec86d6b5075747e8c0 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 12:33:11 +0300 Subject: [PATCH 060/134] add token metric call --- .../service/include/SolutionService.h | 10 ++++- .../internal/service/src/SolutionService.cpp | 44 +++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 9e5b898..dce242d 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -8,6 +8,8 @@ #include "ISolutionRepository.hpp" #include "ISolutionService.h" #include "ITaskRepository.hpp" +// #include "TextMetricsLib.h" +// #include "TokenMetricsLib.h" class SolutionService : ISolutionService { private: @@ -16,12 +18,18 @@ class SolutionService : ISolutionService { std::unique_ptr antlr; std::unique_ptr textMetric; std::unique_ptr tokenMetric; + // std::unique_ptr textMetric; + // std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); std::string setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold); std::pair getMaxTextResMetric(std::vector& solutions, - const std::string& filedata); + const std::string& filedata, + float treshold); + std::pair getMaxTokenResMetric( + std::vector& solutions, const std::string& tokens, + float treshold); public: explicit SolutionService(std::unique_ptr solutionRepo); diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 79c7f2c..9ab8416 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -42,16 +42,18 @@ std::string SolutionService::setResultVerdict(float textBasedRes, } std::pair SolutionService::getMaxTextResMetric( - std::vector& solutions, const std::string& filedata) { - std::pair maxMatch = (0, 0); + std::vector& solutions, const std::string& filedata, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); for (auto sol : solutions) { textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); - float textBasedRes = textMetric->getMetric(); + float textBasedRes = float(textMetric->getMetric()); + std::cout << textBasedRes << std::endl; textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); - textBasedRes = (textBasedRes + textMetric->getMetric()) / 2; + textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; if (textBasedRes > treshold) { break; @@ -64,6 +66,31 @@ std::pair SolutionService::getMaxTextResMetric( return maxMatch; } +std::pair SolutionService::getMaxTokenResMetric( + std::vector& solutions, const std::string& tokens, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); + for (auto sol : solutions) { + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, sol.getTokens()); + float tokenBasedRes = float(tokenMetric->getMetric()); + std::cout << tokenBasedRes << std::endl; + + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, sol.getSource()); + tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; + + if (tokenBasedRes > treshold) { + break; + } + if (maxMatch.first < tokenBasedRes) { + maxMatch.first = tokenBasedRes; + maxMatch.second = sol.getSenderId(); + } + } + return maxMatch; +} + Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) { @@ -85,14 +112,15 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); - // float textBasedRes = getMaxTextResMetric(solutions, filedata); - // TODO: вызов метрик - // получил результат + // float textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); + // float tokenBasedRes getMaxTokenResMetric(solutions, codeParse.first, + // treshold); std::string result = setResultVerdict(0, 0, treshold); + // std::string result = setResultVerdict(textBasedRes, tokenBasedRes, treshold); Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, - codeParse.second, taskId, ""); + codeParse.second, taskId, result); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; -- GitLab From fe495374d848b65bc98a56ca8cf05aa471952151 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 12:39:41 +0300 Subject: [PATCH 061/134] fix merge --- server/internal/metrics/include/TokenMetricLib.h | 1 + server/internal/service/include/SolutionService.h | 10 ++-------- server/internal/service/src/SolutionService.cpp | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/server/internal/metrics/include/TokenMetricLib.h b/server/internal/metrics/include/TokenMetricLib.h index 59ee7a0..2140b58 100644 --- a/server/internal/metrics/include/TokenMetricLib.h +++ b/server/internal/metrics/include/TokenMetricLib.h @@ -15,6 +15,7 @@ class ITokenMetric{ + public: virtual ~ITokenMetric() = default; virtual void countMetric() = 0; virtual void setData(std::vector tokens1, std::vector tokens2) = 0; diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 9f8940b..5e6994c 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -8,12 +8,8 @@ #include "ISolutionRepository.hpp" #include "ISolutionService.h" #include "ITaskRepository.hpp" -<<<<<<< HEAD #include "TextMetricsLib.h" -======= -// #include "TextMetricsLib.h" -// #include "TokenMetricsLib.h" ->>>>>>> 3efd3f12481336474203daec86d6b5075747e8c0 +#include "TokenMetricLib.h" class SolutionService : ISolutionService { private: @@ -21,9 +17,7 @@ class SolutionService : ISolutionService { std::unique_ptr taskRepo; std::unique_ptr antlr; std::unique_ptr textMetric; - std::unique_ptr tokenMetric; - // std::unique_ptr textMetric; - // std::unique_ptr tokenMetric; + std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); std::string setResultVerdict(float textBasedRes, float tokenBasedRes, diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 6c59f15..25c4a2d 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -118,8 +118,8 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, // float tokenBasedRes getMaxTokenResMetric(solutions, codeParse.first, // treshold); - std::string result = setResultVerdict(0, 0, treshold); - // std::string result = setResultVerdict(textBasedRes, tokenBasedRes, treshold); + std::string result = setResultVerdict(textBasedRes.first, 0, treshold); + // std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, codeParse.second, taskId, result); size_t id = solutionRepo->storeSolution(sol); -- GitLab From a295b64198dc1bf5e874b8ca1031b934ff95dc92 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 12:52:59 +0300 Subject: [PATCH 062/134] fix test :) --- .../internal/service/src/SolutionService.cpp | 50 +++++++++---------- .../service/tests/SolutionServiceTest.cpp | 4 +- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 25c4a2d..0e78f70 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -61,36 +61,36 @@ std::pair SolutionService::getMaxTextResMetric( } if (maxMatch.first < textBasedRes) { maxMatch.first = textBasedRes; - maxMatch.second = sol.getSenderId(); + maxMatch.second = sol.getId(); } } return maxMatch; } -std::pair SolutionService::getMaxTokenResMetric( - std::vector& solutions, const std::string& tokens, - float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); - for (auto sol : solutions) { - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, sol.getTokens()); - float tokenBasedRes = float(tokenMetric->getMetric()); - std::cout << tokenBasedRes << std::endl; - - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, sol.getSource()); - tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; - - if (tokenBasedRes > treshold) { - break; - } - if (maxMatch.first < tokenBasedRes) { - maxMatch.first = tokenBasedRes; - maxMatch.second = sol.getSenderId(); - } - } - return maxMatch; -} +// std::pair SolutionService::getMaxTokenResMetric( +// std::vector& solutions, const std::string& tokens, +// float treshold) { +// std::pair maxMatch = std::make_pair(0.0, 0ul); +// for (auto sol : solutions) { +// tokenMetric = std::make_unique(); +// tokenMetric->setData(tokens, sol.getTokens()); +// float tokenBasedRes = float(tokenMetric->getMetric()); +// std::cout << tokenBasedRes << std::endl; + +// tokenMetric = std::make_unique(); +// tokenMetric->setData(tokens, sol.getSource()); +// tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; + +// if (tokenBasedRes > treshold) { +// break; +// } +// if (maxMatch.first < tokenBasedRes) { +// maxMatch.first = tokenBasedRes; +// maxMatch.second = sol.getId(); +// } +// } +// return maxMatch; +// } Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index 473842a..b7b0e70 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -104,7 +104,8 @@ TEST_F(SolutionServiceTest, createSolution) { .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); + solutions.push_back( + Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) .Times(1) @@ -123,4 +124,5 @@ TEST_F(SolutionServiceTest, createSolution) { "[@4,10:10='{',<89>,1:10] [@5,11:16='return',<59>,1:11] " "[@6,18:18='0',<1>,1:18] [@7,19:19=';',<128>,1:19] " "[@8,20:20='}',<90>,1:20] [@9,21:20='',<-1>,1:21] "); + EXPECT_EQ(sol.getResult(), "Красивое решение. А главное уникальное !"); } \ No newline at end of file -- GitLab From 9192d7ee0721c5685bb32c0a05e3e66d88f8439f Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 20:21:00 +0300 Subject: [PATCH 063/134] add docker --- .dockerignore | 6 +++ Dockerfile | 60 ++++++++++++------------- Makefile | 32 +++++++++++++ server/cmd/main.cpp | 4 +- server/internal/entities/CMakeLists.txt | 2 - server/pkg/antlr/CMakeLists.txt | 1 + 6 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 .dockerignore create mode 100644 Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..10be693 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +/cmake-build-debug/ +/build/ +/build1/ +.vscode +.idea +CMakeUserPresets.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fd9957b..e9f5099 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,42 @@ -FROM ubuntu:20.04 AS base +FROM ubuntu:20.04 AS base ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt update -y -RUN apt install -y gcc -RUN apt install -y libpqxx-dev -RUN apt install -y clang-tidy -RUN apt install -y nlohmann-json3-dev -RUN apt install -y python3-pip -RUN apt install -y cppcheck -RUN apt install -y git -RUN apt-get update -y -RUN apt install -y xvfb -RUN pip install gcovr -RUN pip install cpplint +RUN apt update -y +RUN apt install -y gcc +RUN apt install -y libpqxx-dev +RUN apt install -y clang-tidy +RUN apt install -y python3-pip +RUN apt install -y cppcheck +RUN apt-get update +RUN apt install -y cmake +RUN apt-get update +RUN apt install -y libboost-all-dev +RUN apt install -y nlohmann-json3-dev +RUN apt install -y git +RUN apt install -y qt5-default +RUN apt-get update +RUN apt install -y default-jre +RUN apt -y install curl + +RUN pwd +WORKDIR /usr/local/lib +RUN curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar + +RUN apt install -y xvfb +RUN pip install gcovr +RUN pip install cpplint -RUN apt-get install wget -RUN apt-get install libssl-dev - -RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz -RUN tar -zxvf cmake-3.26.3.tar.gz -WORKDIR cmake-3.26.3 -RUN ./bootstrap -RUN make -RUN make install -RUN cd .. - -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz -RUN tar xvf boost_1_82_0.tar.gz -WORKDIR boost_1_82_0 -RUN ./bootstrap.sh --prefix=/usr/ -RUN ./b2 install RUN git clone https://github.com/google/googletest.git -b release-1.11.0 WORKDIR googletest/build -RUN cmake .. -DBUILD_GMOCK=OFF +RUN cmake .. -DBUILD_GMOCK=ON RUN make RUN make install WORKDIR /project -COPY . . \ No newline at end of file +COPY . . + +EXPOSE 8080 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b226212 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +generate: + mkdir build + cmake -B build/ + +build-project: + cd ./build && make + +clean: + rm -rf build + +rebuild: clean generate build-project + +server-run: + ./build/server/cmd/Server + +test: + ctest --verbose --output-on-failure --test-dir build/ + +build-docker: + docker build . -f Dockerfile -t ddt-project + +dev: + docker run --rm -it \ + -v $(PWD):/project \ + --name app \ + ddt-project + +stop-docker: + docker stop app + + + diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 938c0a1..685eb7a 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -4,7 +4,8 @@ int main(int argc, const char* argv[]) { // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); - std::ifstream ins("/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/python/test.py"); + std::ifstream ins( + "/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/python/test.py"); PythonAntlr pA = PythonAntlr(ins); @@ -16,6 +17,7 @@ int main(int argc, const char* argv[]) { } std::cout << pA.getTreeString() << std::endl; + std::cout << "test" << std::endl; return 0; } \ No newline at end of file diff --git a/server/internal/entities/CMakeLists.txt b/server/internal/entities/CMakeLists.txt index 08858c7..7b6ad66 100644 --- a/server/internal/entities/CMakeLists.txt +++ b/server/internal/entities/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("EntitiesLib") set(LIB_NAME libEntities) diff --git a/server/pkg/antlr/CMakeLists.txt b/server/pkg/antlr/CMakeLists.txt index bcf317f..7c69be3 100644 --- a/server/pkg/antlr/CMakeLists.txt +++ b/server/pkg/antlr/CMakeLists.txt @@ -10,6 +10,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) include(ExternalAntlr4Cpp) include_directories(${ANTLR4_INCLUDE_DIRS}) + set(ANTLR_EXECUTABLE /usr/local/lib/antlr-4.12.0-complete.jar) find_package(ANTLR REQUIRED) -- GitLab From acdd9328cc7ca1247b9b44c05c8d976b7e33f184 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 15 May 2023 22:18:49 +0300 Subject: [PATCH 064/134] test fix --- .../repository/include/MetricRepository.hpp | 2 +- .../repository/include/SolutionRepository.hpp | 2 +- .../repository/include/TaskRepository.hpp | 2 +- .../repository/include/UserRepository.hpp | 2 +- .../repository/tests/RepositoryTests.cpp | 18 +++++++++--------- .../repository/virtual/ITaskRepository.hpp | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp index 5d9bf96..6e23e90 100644 --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -8,7 +8,7 @@ using namespace pqxx; -class MetricRepository : IMetricRepository { +class MetricRepository :public IMetricRepository { public: explicit MetricRepository(); diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 50d9552..c7face4 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -12,7 +12,7 @@ using namespace pqxx; -class SolutionRepository : ISolutionRepository { +class SolutionRepository :public ISolutionRepository { public: explicit SolutionRepository(); std::optional getSolutionById(size_t id) override; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 83e5135..4fbc8d1 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -10,7 +10,7 @@ using namespace pqxx; -class TaskRepository : ITaskRepository { +class TaskRepository :public ITaskRepository { public: explicit TaskRepository(); std::optional getTaskById(size_t id) override; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index b5a52f3..70ceaf0 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -11,7 +11,7 @@ using namespace pqxx; -class UserRepository : IUserRepository { +class UserRepository :public IUserRepository { public: explicit UserRepository(); diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index b78c57c..1e2cab7 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -46,7 +46,7 @@ TEST(TaskRepository_CRUD_Test, CRUD) { TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); + Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); size_t id = rep.storeSolution(solution); EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(1)); solution.setId(id); @@ -101,8 +101,8 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); - Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"); + Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); @@ -110,8 +110,8 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); EXPECT_EQ(solution2, rep.getSolutionById(id2)); - std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"}, - {id2, "01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"}}; + std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1}, + {id2, "01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); @@ -122,8 +122,8 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); - Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result"); + Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); @@ -139,7 +139,7 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 100500, "result"); + Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 100500, "result", 1); try{ rep.storeSolution(solution); }catch(pqxx::foreign_key_violation &e){ @@ -150,7 +150,7 @@ TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ TEST(SolutionRepository_CRUD_Test, tryToStoreWithNotExistingSender){ SolutionRepository rep; - Solution solution("01.01.1970", 100500, ":/C/Users", "tokens.txt", "tree.txt", 1, "result"); + Solution solution("01.01.1970", 100500, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); try{ rep.storeSolution(solution); }catch(pqxx::foreign_key_violation &keyViolation){ diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 62ee8a2..dec4862 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -11,7 +11,7 @@ public: virtual std::vector getAllTasks() = 0; - virtual void updateTask(Task task) = 0; + virtual void updateTask(const Task& task) = 0; virtual size_t storeTask(Task task) = 0; -- GitLab From 858badd6caff31ac036babf805f44f652577be58 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 15 May 2023 22:26:07 +0300 Subject: [PATCH 065/134] fix merge --- CMakeLists.txt | 5 +-- server/internal/dbManager/CMakeLists.txt | 2 - .../repository/include/SolutionRepository.hpp | 2 +- .../repository/include/TaskRepository.hpp | 2 +- .../repository/include/UserRepository.hpp | 2 +- .../repository/virtual/ITaskRepository.hpp | 3 +- .../service/include/SolutionService.h | 2 - .../internal/service/src/SolutionService.cpp | 45 +++++++++---------- server/internal/service/src/TaskService.cpp | 26 +++++------ server/internal/service/src/UserService.cpp | 18 ++++---- .../service/tests/SolutionServiceTest.cpp | 30 ++++--------- .../service/tests/TaskServiceTest.cpp | 6 +-- .../service/tests/UserServiceTest.cpp | 5 ++- .../service/virtual/ISolutionService.h | 2 - 14 files changed, 62 insertions(+), 88 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8760718..cbf42b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,6 @@ set(CMAKE_CXX_STANDARD 20) -<<<<<<< HEAD cmake_minimum_required(VERSION 3.16) -======= -cmake_minimum_required(VERSION 3.19) ->>>>>>> 0745844ad0c7971df126d33fb8539d97ecb2e910 + set(PROJECT_NAME "SourcedOut") diff --git a/server/internal/dbManager/CMakeLists.txt b/server/internal/dbManager/CMakeLists.txt index 432484e..3299f96 100644 --- a/server/internal/dbManager/CMakeLists.txt +++ b/server/internal/dbManager/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.19) - project("DbManagerLib") set(LIB_NAME libDbManager) diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 50d9552..6ac4137 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -12,7 +12,7 @@ using namespace pqxx; -class SolutionRepository : ISolutionRepository { +class SolutionRepository : public ISolutionRepository { public: explicit SolutionRepository(); std::optional getSolutionById(size_t id) override; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 83e5135..1c41e2c 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -10,7 +10,7 @@ using namespace pqxx; -class TaskRepository : ITaskRepository { +class TaskRepository : public ITaskRepository { public: explicit TaskRepository(); std::optional getTaskById(size_t id) override; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index b5a52f3..3c4c813 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -11,7 +11,7 @@ using namespace pqxx; -class UserRepository : IUserRepository { +class UserRepository : public IUserRepository { public: explicit UserRepository(); diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index 5565a02..b5db645 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -2,6 +2,7 @@ #define SOURCEDOUT_ITASKREPOSITORY_HPP #include +#include #include "Task.hpp" #include @@ -13,7 +14,7 @@ public: virtual std::vector getAllTasks() = 0; - virtual void updateTask(Task task) = 0; + virtual void updateTask(const Task&) = 0; virtual size_t storeTask(Task task) = 0; diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 5e6994c..2ccd201 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -38,8 +38,6 @@ class SolutionService : ISolutionService { Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) override; - std::vector getSolutionsByUserAndTaskId(size_t userId, - size_t taskId) override; void deleteSolutionById(size_t solId) override; std::pair getMetrics(size_t solId) override; }; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 0e78f70..231d0a1 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -7,6 +7,8 @@ #include "FileMethods.h" #include "MyCppAntlr.h" #include "PythonAntlr.h" +#include "SolutionRepository.hpp" +#include "TaskRepository.hpp" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = @@ -18,8 +20,8 @@ SolutionService::SolutionService( : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} SolutionService::SolutionService() { - // solutionRepo=std::make_unique(); - // taskRepo = std::make_unique(); + solutionRepo = std::make_unique(); + taskRepo = std::make_unique(); } void SolutionService::setAntlrWrapper(const std::string& fileExtension, @@ -45,7 +47,7 @@ std::string SolutionService::setResultVerdict(float textBasedRes, std::pair SolutionService::getMaxTextResMetric( std::vector& solutions, const std::string& filedata, float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); + std::pair maxMatch = std::make_pair(0.0, 0); for (auto sol : solutions) { textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); @@ -70,7 +72,7 @@ std::pair SolutionService::getMaxTextResMetric( // std::pair SolutionService::getMaxTokenResMetric( // std::vector& solutions, const std::string& tokens, // float treshold) { -// std::pair maxMatch = std::make_pair(0.0, 0ul); +// std::pair maxMatch = std::make_pair(0.0, 0); // for (auto sol : solutions) { // tokenMetric = std::make_unique(); // tokenMetric->setData(tokens, sol.getTokens()); @@ -108,52 +110,45 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - float treshold = taskRepo->getTaskById(taskId).getTreshhold(); + float treshold = taskRepo->getTaskById(taskId).value().getTreshhold(); std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); - std::pair textBasedRes = + std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); // float tokenBasedRes getMaxTokenResMetric(solutions, codeParse.first, // treshold); std::string result = setResultVerdict(textBasedRes.first, 0, treshold); - // std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); - Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, - codeParse.second, taskId, result); + // std::string result = setResultVerdict(textBasedRes.first, + // tokenBasedRes.first, treshold); + Solution sol = + Solution(std::ctime(&now), userId, filedata, codeParse.first, + codeParse.second, taskId, result, textBasedRes.second); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; - } catch (std::exception& e) { - throw e; - } -} - -std::vector SolutionService::getSolutionsByUserAndTaskId( - size_t userId, size_t taskId) { - try { - return solutionRepo->getSolutions(userId, taskId); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } void SolutionService::deleteSolutionById(size_t solId) { try { solutionRepo->deleteSolutionById(solId); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } std::pair SolutionService::getMetrics(size_t solId) { try { - Solution sol = solutionRepo->getSolutionById(solId); + Solution sol = solutionRepo->getSolutionById(solId).value(); std::string tokens = sol.getTokens(); std::string astTree = sol.getAstTree(); return std::make_pair(tokens, astTree); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index c7d1bbf..1e1f445 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -1,44 +1,42 @@ #include "TaskService.h" +#include "TaskRepository.hpp" TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(std::move(taskRepo)) {} -TaskService::TaskService() { - // TODO: раскоментировать, когда будет реализация - // taskRepo = std::make_unique(); -} +TaskService::TaskService() { taskRepo = std::make_unique(); } Task TaskService::createTask(const std::string& desc, float treshold) { try { - Task task = Task(desc,treshold); + Task task = Task(desc, treshold); size_t id = taskRepo->storeTask(task); task.setId(id); return task; - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } std::vector TaskService::getAllTasks() { try { return taskRepo->getAllTasks(); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } Task TaskService::getTask(size_t id) { try { - return taskRepo->getTaskById(id); - } catch (std::exception& e) { - throw e; + return taskRepo->getTaskById(id).value(); + } catch (...) { + throw; } } void TaskService::deleteTask(size_t id) { try { taskRepo->deleteTaskById(id); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index b6b1666..ab9f3a6 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -2,13 +2,13 @@ #include "Exceptions.h" #include "UserValidator.h" +#include "UserRepository.hpp" UserService::UserService(std::unique_ptr userRepo) : userRepo(std::move(userRepo)) {} UserService::UserService() { - // TODO: раскоментировать, когда будет реализация - // userRepo = std::make_unique(); + userRepo = std::make_unique(); } User UserService::createUser(const std::string& login, const std::string& username, @@ -21,20 +21,20 @@ User UserService::createUser(const std::string& login, const std::string& userna size_t id = userRepo->makeUser(user); user.setId(id); return user; - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } User UserService::login(const std::string& login, const std::string& password) { try { - User u = userRepo->getUserByLogin(login); + User u = userRepo->getUserByLogin(login).value(); if (u.getPassword() != password){ throw LoginException("incorrect password"); } return u; - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } @@ -42,7 +42,7 @@ User UserService::login(const std::string& login, const std::string& password) { void UserService::deleteUser(size_t id) { try { userRepo->deleteByUserId(id); - } catch (std::exception& e) { - throw e; + } catch (...) { + throw; } } diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index b7b0e70..eb38c67 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -14,25 +14,24 @@ class Exception : public std::exception { class SolutionRepositoryMock : public ISolutionRepository { public: ~SolutionRepositoryMock() override = default; - MOCK_METHOD(Solution, getSolutionById, (size_t id), (override)); + MOCK_METHOD(std::optional, getSolutionById, (size_t id), (override)); MOCK_METHOD(std::vector, getSolutionsBySenderId, (size_t sender_id), (override)); MOCK_METHOD(std::vector, getSolutionsByTaskId, (size_t task_id), (override)); - MOCK_METHOD(std::vector, getSolutions, - (size_t sender_id, size_t task_id), (override)); MOCK_METHOD(size_t, storeSolution, (Solution solution), (override)); MOCK_METHOD(void, updateSolution, (Solution solution), (override)); MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); + MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), (override)); }; class TaskRepositoryMock : public ITaskRepository { public: ~TaskRepositoryMock() override = default; - MOCK_METHOD(Task, getTaskById, (size_t id), (override)); - MOCK_METHOD(void, updateTask, (Task task), (override)); - MOCK_METHOD(int, storeTask, (Task task), (override)); + MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (const Task& task), (override)); + MOCK_METHOD(size_t, storeTask, (Task task), (override)); MOCK_METHOD(void, deleteTask, (Task task), (override)); MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); MOCK_METHOD(std::vector, getAllTasks, (), (override)); @@ -57,17 +56,6 @@ ACTION(NoSolutionException) { throw Exception("no solution with this id in db"); } -TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { - std::vector solutions; - solutions.push_back(Solution(0, "", 1, "", "", "", 1, "")); - solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); - EXPECT_CALL(*solutionMockPtr, getSolutions(1, 1)) - .Times(1) - .WillOnce(::testing::Return(solutions)); - std::vector sols = ss->getSolutionsByUserAndTaskId(1, 1); - EXPECT_EQ(sols.size(), 2); -} - TEST_F(SolutionServiceTest, deleteSolution) { EXPECT_CALL(*solutionMockPtr, deleteSolutionById(1)).Times(1); ss->deleteSolutionById(1); @@ -84,7 +72,7 @@ TEST_F(SolutionServiceTest, getMetrics) { EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) .Times(1) .WillOnce(::testing::Return( - Solution(1, "", 1, "", "tokens", "astTree", 1, ""))); + Solution(1, "", 1, "", "tokens", "astTree", 1, "", 1))); std::pair metrics = ss->getMetrics(1); EXPECT_EQ(metrics.first, "tokens"); EXPECT_EQ(metrics.second, "astTree"); @@ -99,14 +87,14 @@ TEST_F(SolutionServiceTest, getMetricsException) { TEST_F(SolutionServiceTest, createSolution) { EXPECT_CALL(*solutionMockPtr, - storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) + storeSolution(Solution(0, "", 2, "source", "", "", 1, "", 1))) .Times(1) .WillRepeatedly(::testing::Return(1)); std::vector solutions; solutions.push_back( - Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); - solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "", 1)); + solutions.push_back(Solution(1, "", 1, "", "", "", 1, "", 1)); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) .Times(1) .WillOnce(::testing::Return(solutions)); diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp index ccf2c38..3e81339 100644 --- a/server/internal/service/tests/TaskServiceTest.cpp +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -15,9 +15,9 @@ class Exception : public std::exception { class TaskRepositoryMock : public ITaskRepository { public: ~TaskRepositoryMock() override = default; - MOCK_METHOD(Task, getTaskById, (size_t id), (override)); - MOCK_METHOD(void, updateTask, (Task task), (override)); - MOCK_METHOD(int, storeTask, (Task task), (override)); + MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (const Task& task), (override)); + MOCK_METHOD(size_t, storeTask, (Task task), (override)); MOCK_METHOD(void, deleteTask, (Task task), (override)); MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); MOCK_METHOD(std::vector, getAllTasks,(),(override)); diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index e576a99..86d76de 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -16,12 +16,13 @@ class Exception : public std::exception { class UserRepositoryMock : public IUserRepository { public: ~UserRepositoryMock() override = default; - MOCK_METHOD(User, getUserById, (size_t id), (override)); - MOCK_METHOD(User, getUserByLogin, (std::string login), (override)); + MOCK_METHOD(std::optional, getUserById, (size_t id), (override)); + MOCK_METHOD(std::optional, getUserByLogin, (std::string login), (override)); MOCK_METHOD(size_t, makeUser, (User user), (override)); MOCK_METHOD(void, deleteUser, (User user), (override)); MOCK_METHOD(void, deleteByUserId, (size_t id), (override)); MOCK_METHOD(std::vector, getAllUsers, (), (override)); + MOCK_METHOD(void, update, (User user),(override)); }; struct UserServiceTest : public testing::Test { diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index 7c39d9c..4764c82 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -11,8 +11,6 @@ class ISolutionService { virtual Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) = 0; - virtual std::vector getSolutionsByUserAndTaskId(size_t userId, - size_t taskId) = 0; virtual void deleteSolutionById(size_t solId) = 0; virtual std::pair getMetrics(size_t solId) = 0; -- GitLab From 9d26b74162a7106cc1cdb461f46a12bea2e22ddf Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Mon, 15 May 2023 23:40:23 +0300 Subject: [PATCH 066/134] added dbdump --- server/internal/CMakeLists.txt | 1 - server/internal/src/CMakeLists.txt | 5 - server/internal/src/db/CMakeLists.txt | 29 - server/internal/src/db/config.json | 7 - server/internal/src/db/include/conn.hpp | 22 - server/internal/src/db/src/conn.cpp | 27 - sql/database.sql | 678 ++++++++++++++++++++++++ 7 files changed, 678 insertions(+), 91 deletions(-) delete mode 100644 server/internal/src/CMakeLists.txt delete mode 100644 server/internal/src/db/CMakeLists.txt delete mode 100644 server/internal/src/db/config.json delete mode 100644 server/internal/src/db/include/conn.hpp delete mode 100644 server/internal/src/db/src/conn.cpp create mode 100644 sql/database.sql diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index 930ea1a..bac9135 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -1,6 +1,5 @@ set(CMAKE_CXX_STANDARD 20) cmake_minimum_required(VERSION 3.19) -add_subdirectory(src) add_subdirectory(entities) add_subdirectory(dbManager) add_subdirectory(repository) diff --git a/server/internal/src/CMakeLists.txt b/server/internal/src/CMakeLists.txt deleted file mode 100644 index 72e4c50..0000000 --- a/server/internal/src/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.19) -add_subdirectory(db) -set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) -set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/server/internal/src/db/CMakeLists.txt b/server/internal/src/db/CMakeLists.txt deleted file mode 100644 index df02471..0000000 --- a/server/internal/src/db/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -project("DBLib") - -set(LIB_NAME DB_Lib) - -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) - -message("SOURCES = ${SOURCES}") -message("HEADERS = ${HEADERS}") - - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -O2 -pedantic -Wformat=2 -Wfloat-equal -Wconversion \ --Wlogical-op -Wshift-overflow=2 -Wduplicated-cond -Wcast-qual -Wcast-align") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) -target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_link_libraries(${LIB_NAME} ${libpqxx_LIBRARIES} nlohmann_json::nlohmann_json) - -set(DB_Lib_LIB ${LIB_NAME}) -set(DB_Lib_LIB ${DB_Lib_LIB} PARENT_SCOPE) -set(DB_Lib_INCLUDE_DIRS ${LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/include) -set(DB_Lib_INCLUDE_DIRS ${DB_Lib_INCLUDE_DIRS} PARENT_SCOPE) - -message("DB_Lib_LIB = ${DB_Lib_LIB}") -message("DB_Lib_INCLUDE_DIRS = ${DB_Lib_INCLUDE_DIRS}") diff --git a/server/internal/src/db/config.json b/server/internal/src/db/config.json deleted file mode 100644 index 81007a5..0000000 --- a/server/internal/src/db/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dbname": "mydb", - "user": "postgres", - "password": "root", - "hostaddr": "127.0.0.1", - "port": "5432" -} diff --git a/server/internal/src/db/include/conn.hpp b/server/internal/src/db/include/conn.hpp deleted file mode 100644 index 1468361..0000000 --- a/server/internal/src/db/include/conn.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SOURCEDOUT_CONN_HPP -#define SOURCEDOUT_CONN_HPP - -#include -#include -#include - -using json = nlohmann::json; - -struct conn { - std::string dbname; - std::string user; - std::string password; - std::string hostaddr; - std::string port; - - conn(); - - [[nodiscard]] std::string getData() const; -}; - -#endif //SOURCEDOUT_CONN_HPP diff --git a/server/internal/src/db/src/conn.cpp b/server/internal/src/db/src/conn.cpp deleted file mode 100644 index 9fe5074..0000000 --- a/server/internal/src/db/src/conn.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include "conn.hpp" -#include -conn::conn() { - std::ifstream f("../config.json"); - json data = json::parse(R"( -{ - "dbname": "mydb", - "user": "postgres", - "password": "root", - "hostaddr": "172.28.224.1", - "port": "5432" -} -)"); - data.at("dbname").get_to(dbname); - data.at("user").get_to(user); - data.at("password").get_to(password); - data.at("hostaddr").get_to(hostaddr); - data.at("port").get_to(port); -} - -std::string conn::getData() const { - return "dbname = " + dbname + " user = " + user + " password = " + password + - " hostaddr = " + hostaddr + " port = " + port; -} \ No newline at end of file diff --git a/sql/database.sql b/sql/database.sql new file mode 100644 index 0000000..5266ba2 --- /dev/null +++ b/sql/database.sql @@ -0,0 +1,678 @@ +-- +-- PostgreSQL database cluster dump +-- + +-- Started on 2023-05-15 22:49:08 + +SET default_transaction_read_only = off; + +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; + +-- +-- Roles +-- + +CREATE ROLE postgres; +ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:nOmjHrNPdaIcnCeed7FgbQ==$U+pukPiYK1tBvbNsPjn4d9zV4IXLekf/OMW5+ZDzgrY=:1f9vBcPgoAcX5hmUUOkjkXLp0FRCqsnlQRmYs2U29pU='; + +-- +-- User Configurations +-- + + + + + + + + +-- +-- Databases +-- + +-- +-- Database "template1" dump +-- + +\connect template1 + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- Completed on 2023-05-15 22:49:08 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "mydb" dump +-- + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 3362 (class 1262 OID 16565) +-- Name: mydb; Type: DATABASE; Schema: -; Owner: postgres +-- + +CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Russian_Russia.1251'; + + +ALTER DATABASE mydb OWNER TO postgres; + +\connect mydb + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- TOC entry 215 (class 1259 OID 16574) +-- Name: users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.users ( + id integer NOT NULL, + login character varying(255), + password character varying(255), + username character varying(255) +); + + +ALTER TABLE public.users OWNER TO postgres; + +-- +-- TOC entry 214 (class 1259 OID 16573) +-- Name: Users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public."Users_id_seq" + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public."Users_id_seq" OWNER TO postgres; + +-- +-- TOC entry 3363 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public."Users_id_seq" OWNED BY public.users.id; + + +-- +-- TOC entry 219 (class 1259 OID 16613) +-- Name: metricstat; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.metricstat ( + id integer NOT NULL, + solution_id integer, + text_based_res real, + token_based_res real, + tree_based_res real, + verdict boolean, + mean_res real +); + + +ALTER TABLE public.metricstat OWNER TO postgres; + +-- +-- TOC entry 221 (class 1259 OID 16626) +-- Name: metricstat_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.metricstat_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.metricstat_id_seq OWNER TO postgres; + +-- +-- TOC entry 3364 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.metricstat_id_seq OWNED BY public.metricstat.id; + + +-- +-- TOC entry 217 (class 1259 OID 16583) +-- Name: solutions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.solutions ( + id integer NOT NULL, + send_date date NOT NULL, + sender_id integer, + source character varying(255), + task_id integer, + result character varying, + tokens character varying, + asttree character varying, + original_solution_id integer +); + + +ALTER TABLE public.solutions OWNER TO postgres; + +-- +-- TOC entry 216 (class 1259 OID 16582) +-- Name: solutions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.solutions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.solutions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3365 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.solutions_id_seq OWNED BY public.solutions.id; + + +-- +-- TOC entry 218 (class 1259 OID 16598) +-- Name: tasks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tasks ( + id integer NOT NULL, + description text, + treshold real +); + + +ALTER TABLE public.tasks OWNER TO postgres; + +-- +-- TOC entry 220 (class 1259 OID 16623) +-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.tasks_id_seq OWNER TO postgres; + +-- +-- TOC entry 3366 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; + + +-- +-- TOC entry 3191 (class 2604 OID 16628) +-- Name: metricstat id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat ALTER COLUMN id SET DEFAULT nextval('public.metricstat_id_seq'::regclass); + + +-- +-- TOC entry 3189 (class 2604 OID 16586) +-- Name: solutions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions ALTER COLUMN id SET DEFAULT nextval('public.solutions_id_seq'::regclass); + + +-- +-- TOC entry 3190 (class 2604 OID 16625) +-- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); + + +-- +-- TOC entry 3188 (class 2604 OID 16577) +-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public."Users_id_seq"'::regclass); + + +-- +-- TOC entry 3354 (class 0 OID 16613) +-- Dependencies: 219 +-- Data for Name: metricstat; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.metricstat (id, solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) FROM stdin; +15 1 1 1 1 t 1 +\. + + +-- +-- TOC entry 3352 (class 0 OID 16583) +-- Dependencies: 217 +-- Data for Name: solutions; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.solutions (id, send_date, sender_id, source, task_id, result, tokens, asttree, original_solution_id) FROM stdin; +1 2023-05-02 10 0.1 27 0.1 0.1 0.1 1 +\. + + +-- +-- TOC entry 3353 (class 0 OID 16598) +-- Dependencies: 218 +-- Data for Name: tasks; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.tasks (id, description, treshold) FROM stdin; +27 orher_description 0.1 +1 description 0.5 +\. + + +-- +-- TOC entry 3350 (class 0 OID 16574) +-- Dependencies: 215 +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.users (id, login, password, username) FROM stdin; +1 qwerty200468@gmail.com 123 tolik +2 qwerty200468@gmail.com 123 tolik +3 qwerty200468@gmail.com 123 tolik +4 qwerty200468@gmail.com 123 tolik +5 qwerty200468@gmail.com 123 tolik +6 qwerty200468@gmail.com 123 tolik +7 qwerty200468@gmail.com 123 tolik +8 qwerty200468@gmail.com 123 tolik +9 qwerty200468@gmail.com 123 tolik +10 qwerty200468@gmail.com 123 tolik +52 qwerty200468@gmail.com 123 tolik +\. + + +-- +-- TOC entry 3367 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public."Users_id_seq"', 78, true); + + +-- +-- TOC entry 3368 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.metricstat_id_seq', 36, true); + + +-- +-- TOC entry 3369 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.solutions_id_seq', 150, true); + + +-- +-- TOC entry 3370 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.tasks_id_seq', 34, true); + + +-- +-- TOC entry 3193 (class 2606 OID 16581) +-- Name: users Users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT "Users_pkey" PRIMARY KEY (id); + + +-- +-- TOC entry 3202 (class 2606 OID 16617) +-- Name: metricstat metricStat_pk; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT "metricStat_pk" PRIMARY KEY (id); + + +-- +-- TOC entry 3198 (class 2606 OID 16588) +-- Name: solutions solutions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT solutions_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3200 (class 2606 OID 16604) +-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks + ADD CONSTRAINT tasks_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3194 (class 1259 OID 16637) +-- Name: fki_original_solution_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_original_solution_id ON public.solutions USING btree (original_solution_id); + + +-- +-- TOC entry 3195 (class 1259 OID 16594) +-- Name: fki_sender_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_sender_id ON public.solutions USING btree (sender_id); + + +-- +-- TOC entry 3196 (class 1259 OID 16610) +-- Name: fki_task_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_task_id ON public.solutions USING btree (task_id); + + +-- +-- TOC entry 3203 (class 2606 OID 16632) +-- Name: solutions original_solution_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT original_solution_id FOREIGN KEY (original_solution_id) REFERENCES public.solutions(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3204 (class 2606 OID 16589) +-- Name: solutions sender_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT sender_id FOREIGN KEY (sender_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3206 (class 2606 OID 16618) +-- Name: metricstat solutions_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT solutions_id FOREIGN KEY (solution_id) REFERENCES public.solutions(id); + + +-- +-- TOC entry 3205 (class 2606 OID 16605) +-- Name: solutions task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT task_id FOREIGN KEY (task_id) REFERENCES public.tasks(id) NOT VALID; + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "postgres" dump +-- + +\connect postgres + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:09 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 8 (class 2615 OID 16398) +-- Name: pgagent; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA pgagent; + + +ALTER SCHEMA pgagent OWNER TO postgres; + +-- +-- TOC entry 3437 (class 0 OID 0) +-- Dependencies: 8 +-- Name: SCHEMA pgagent; Type: COMMENT; Schema: -; Owner: postgres +-- + +COMMENT ON SCHEMA pgagent IS 'pgAgent system tables'; + + +-- +-- TOC entry 2 (class 3079 OID 16384) +-- Name: adminpack; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog; + + +-- +-- TOC entry 3438 (class 0 OID 0) +-- Dependencies: 2 +-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL'; + + +-- +-- TOC entry 3 (class 3079 OID 16399) +-- Name: pgagent; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgagent WITH SCHEMA pgagent; + + +-- +-- TOC entry 3439 (class 0 OID 0) +-- Dependencies: 3 +-- Name: EXTENSION pgagent; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgagent IS 'A PostgreSQL job scheduler'; + + +-- +-- TOC entry 3218 (class 0 OID 16400) +-- Dependencies: 219 +-- Data for Name: pga_jobagent; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobagent (jagpid, jaglogintime, jagstation) FROM stdin; +7380 2023-05-09 17:32:50.44529+03 DESKTOP-CLI5MDC +\. + + +-- +-- TOC entry 3219 (class 0 OID 16409) +-- Dependencies: 221 +-- Data for Name: pga_jobclass; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobclass (jclid, jclname) FROM stdin; +\. + + +-- +-- TOC entry 3220 (class 0 OID 16419) +-- Dependencies: 223 +-- Data for Name: pga_job; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_job (jobid, jobjclid, jobname, jobdesc, jobhostagent, jobenabled, jobcreated, jobchanged, jobagentid, jobnextrun, joblastrun) FROM stdin; +\. + + +-- +-- TOC entry 3222 (class 0 OID 16467) +-- Dependencies: 227 +-- Data for Name: pga_schedule; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_schedule (jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths) FROM stdin; +\. + + +-- +-- TOC entry 3223 (class 0 OID 16495) +-- Dependencies: 229 +-- Data for Name: pga_exception; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_exception (jexid, jexscid, jexdate, jextime) FROM stdin; +\. + + +-- +-- TOC entry 3224 (class 0 OID 16509) +-- Dependencies: 231 +-- Data for Name: pga_joblog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_joblog (jlgid, jlgjobid, jlgstatus, jlgstart, jlgduration) FROM stdin; +\. + + +-- +-- TOC entry 3221 (class 0 OID 16443) +-- Dependencies: 225 +-- Data for Name: pga_jobstep; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobstep (jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind, jstcode, jstconnstr, jstdbname, jstonerror, jscnextrun) FROM stdin; +\. + + +-- +-- TOC entry 3225 (class 0 OID 16525) +-- Dependencies: 233 +-- Data for Name: pga_jobsteplog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobsteplog (jslid, jsljlgid, jsljstid, jslstatus, jslresult, jslstart, jslduration, jsloutput) FROM stdin; +\. + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database cluster dump complete +-- + -- GitLab From c9d967b9b87b8ff628254d8cd7f39a8ca918aec4 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 16 May 2023 00:03:41 +0300 Subject: [PATCH 067/134] add docker and some methods to antlr lib --- .dockerignore | 6 + Dockerfile | 60 +++++---- Makefile | 29 +++++ server/cmd/main.cpp | 12 +- .../service/include/SolutionService.h | 5 +- .../internal/service/src/SolutionService.cpp | 119 +++++++++--------- .../service/tests/SolutionServiceTest.cpp | 50 ++++++-- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 4 +- server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 21 +++- .../pkg/antlr/python3/include/PythonAntlr.h | 3 +- server/pkg/antlr/python3/src/PythonAntlr.cpp | 21 +++- server/pkg/antlr/testprogs/cpp/test.cpp | 5 +- server/pkg/antlr/virtual/IAntlrWrapper.h | 9 +- 13 files changed, 222 insertions(+), 122 deletions(-) create mode 100644 .dockerignore create mode 100644 Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..10be693 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +/cmake-build-debug/ +/build/ +/build1/ +.vscode +.idea +CMakeUserPresets.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fd9957b..e9f5099 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,42 @@ -FROM ubuntu:20.04 AS base +FROM ubuntu:20.04 AS base ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt update -y -RUN apt install -y gcc -RUN apt install -y libpqxx-dev -RUN apt install -y clang-tidy -RUN apt install -y nlohmann-json3-dev -RUN apt install -y python3-pip -RUN apt install -y cppcheck -RUN apt install -y git -RUN apt-get update -y -RUN apt install -y xvfb -RUN pip install gcovr -RUN pip install cpplint +RUN apt update -y +RUN apt install -y gcc +RUN apt install -y libpqxx-dev +RUN apt install -y clang-tidy +RUN apt install -y python3-pip +RUN apt install -y cppcheck +RUN apt-get update +RUN apt install -y cmake +RUN apt-get update +RUN apt install -y libboost-all-dev +RUN apt install -y nlohmann-json3-dev +RUN apt install -y git +RUN apt install -y qt5-default +RUN apt-get update +RUN apt install -y default-jre +RUN apt -y install curl + +RUN pwd +WORKDIR /usr/local/lib +RUN curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar + +RUN apt install -y xvfb +RUN pip install gcovr +RUN pip install cpplint -RUN apt-get install wget -RUN apt-get install libssl-dev - -RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz -RUN tar -zxvf cmake-3.26.3.tar.gz -WORKDIR cmake-3.26.3 -RUN ./bootstrap -RUN make -RUN make install -RUN cd .. - -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz -RUN tar xvf boost_1_82_0.tar.gz -WORKDIR boost_1_82_0 -RUN ./bootstrap.sh --prefix=/usr/ -RUN ./b2 install RUN git clone https://github.com/google/googletest.git -b release-1.11.0 WORKDIR googletest/build -RUN cmake .. -DBUILD_GMOCK=OFF +RUN cmake .. -DBUILD_GMOCK=ON RUN make RUN make install WORKDIR /project -COPY . . \ No newline at end of file +COPY . . + +EXPOSE 8080 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac63634 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +generate: + mkdir build + cmake -B build/ + +build-project: + cd ./build && make + +clean: + rm -rf build + +rebuild: clean generate build-project + +server-run: + ./build/server/cmd/Server + +test: + ctest --verbose --test-dir build/ + +build-docker: + docker build . -f Dockerfile -t ddt-project + +dev: + docker run --rm -it \ + -v $(PWD):/project \ + --name app \ + ddt-project + +stop-docker: + docker stop app diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 938c0a1..9d4b6b3 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,21 +1,23 @@ #include #include "PythonAntlr.h" +#include "MyCppAntlr.h" int main(int argc, const char* argv[]) { // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); - std::ifstream ins("/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/python/test.py"); + std::ifstream ins( + "/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/cpp/test.cpp"); - PythonAntlr pA = PythonAntlr(ins); + MyCppAntlr pA = MyCppAntlr(ins); - std::vector tokens = pA.getTokensArray(); + std::vector tokens = pA.getTokensTypes(); std::cout << "Tokens:" << std::endl; - for (std::string token : tokens) { + for (int token : tokens) { std::cout << token << std::endl; } - std::cout << pA.getTreeString() << std::endl; + // std::cout << pA.getTreeString() << std::endl; return 0; } \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index dce242d..c7b5261 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -28,11 +28,12 @@ class SolutionService : ISolutionService { const std::string& filedata, float treshold); std::pair getMaxTokenResMetric( - std::vector& solutions, const std::string& tokens, + std::vector& solutions, std::vector& tokens, float treshold); public: - explicit SolutionService(std::unique_ptr solutionRepo); + explicit SolutionService(std::unique_ptr solutionRepo, + std::unique_ptr taskRepo); SolutionService(); void setMetrics(std::unique_ptr metrics_); Solution createSolution(size_t userId, size_t taskId, diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 9ab8416..c1f9c2d 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -13,8 +13,9 @@ const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; SolutionService::SolutionService( - std::unique_ptr solutionRepo) - : solutionRepo(std::move(solutionRepo)) {} + std::unique_ptr solutionRepo, + std::unique_ptr taskRepo) + : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} SolutionService::SolutionService() { // solutionRepo=std::make_unique(); @@ -41,55 +42,55 @@ std::string SolutionService::setResultVerdict(float textBasedRes, return PLAGIAT_VERDICT; } -std::pair SolutionService::getMaxTextResMetric( - std::vector& solutions, const std::string& filedata, - float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); - for (auto sol : solutions) { - textMetric = std::make_unique(); - textMetric->setData(filedata, sol.getSource()); - float textBasedRes = float(textMetric->getMetric()); - std::cout << textBasedRes << std::endl; - - textMetric = std::make_unique(); - textMetric->setData(filedata, sol.getSource()); - textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; - - if (textBasedRes > treshold) { - break; - } - if (maxMatch.first < textBasedRes) { - maxMatch.first = textBasedRes; - maxMatch.second = sol.getSenderId(); - } - } - return maxMatch; -} - -std::pair SolutionService::getMaxTokenResMetric( - std::vector& solutions, const std::string& tokens, - float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); - for (auto sol : solutions) { - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, sol.getTokens()); - float tokenBasedRes = float(tokenMetric->getMetric()); - std::cout << tokenBasedRes << std::endl; - - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, sol.getSource()); - tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; - - if (tokenBasedRes > treshold) { - break; - } - if (maxMatch.first < tokenBasedRes) { - maxMatch.first = tokenBasedRes; - maxMatch.second = sol.getSenderId(); - } - } - return maxMatch; -} +// std::pair SolutionService::getMaxTextResMetric( +// std::vector& solutions, const std::string& filedata, +// float treshold) { +// std::pair maxMatch = std::make_pair(0.0, 0ul); +// for (auto sol : solutions) { +// textMetric = std::make_unique(); +// textMetric->setData(filedata, sol.getSource()); +// float textBasedRes = float(textMetric->getMetric()); +// std::cout << textBasedRes << std::endl; + +// textMetric = std::make_unique(); +// textMetric->setData(filedata, sol.getSource()); +// textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; + +// if (textBasedRes > treshold) { +// break; +// } +// if (maxMatch.first < textBasedRes) { +// maxMatch.first = textBasedRes; +// maxMatch.second = sol.getSenderId(); +// } +// } +// return maxMatch; +// } + +// std::pair SolutionService::getMaxTokenResMetric( +// std::vector& solutions, std::vector& tokens, +// float treshold) { +// std::pair maxMatch = std::make_pair(0.0, 0ul); +// for (auto sol : solutions) { +// tokenMetric = std::make_unique(); +// tokenMetric->setData(tokens, sol.getTokens()); +// float tokenBasedRes = float(tokenMetric->getMetric()); +// std::cout << tokenBasedRes << std::endl; + +// tokenMetric = std::make_unique(); +// tokenMetric->setData(tokens, sol.getSource()); +// tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; + +// if (tokenBasedRes > treshold) { +// break; +// } +// if (maxMatch.first < tokenBasedRes) { +// maxMatch.first = tokenBasedRes; +// maxMatch.second = sol.getSenderId(); +// } +// } +// return maxMatch; +// } Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, @@ -102,25 +103,29 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, } setAntlrWrapper(fileExtension.first, filedata); - std::pair codeParse = antlr->getTokensAndTree(); + std::vector tokensTypes = antlr->getTokensTypes(); + std::string astTree = antlr->getTreeString(); std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + float treshold = taskRepo->getTaskById(taskId).getTreshhold(); + std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); // float textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); - // float tokenBasedRes getMaxTokenResMetric(solutions, codeParse.first, + // float tokenBasedRes getMaxTokenResMetric(solutions, tokensTypes, // treshold); std::string result = setResultVerdict(0, 0, treshold); - // std::string result = setResultVerdict(textBasedRes, tokenBasedRes, treshold); - - Solution sol = Solution(std::ctime(&now), userId, filedata, codeParse.first, - codeParse.second, taskId, result); + // std::string result = setResultVerdict(textBasedRes, tokenBasedRes, + // treshold); + Solution sol = + Solution(std::ctime(&now), userId, filedata, antlr->getTokensString(), + astTree, taskId, result); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index d0eacf4..b7b0e70 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -27,14 +27,28 @@ class SolutionRepositoryMock : public ISolutionRepository { MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); }; +class TaskRepositoryMock : public ITaskRepository { + public: + ~TaskRepositoryMock() override = default; + MOCK_METHOD(Task, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (Task task), (override)); + MOCK_METHOD(int, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks, (), (override)); +}; + struct SolutionServiceTest : public testing::Test { SolutionService* ss; - SolutionRepositoryMock* mock_ptr; + SolutionRepositoryMock* solutionMockPtr; + TaskRepositoryMock* taskMockPtr; void SetUp() { - auto mock = std::make_unique(); - mock_ptr = mock.get(); - ss = new SolutionService(std::move(mock)); + auto sMock = std::make_unique(); + solutionMockPtr = sMock.get(); + auto tMock = std::make_unique(); + taskMockPtr = tMock.get(); + ss = new SolutionService(std::move(sMock), std::move(tMock)); } void TearDown() { delete ss; } }; @@ -47,7 +61,7 @@ TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { std::vector solutions; solutions.push_back(Solution(0, "", 1, "", "", "", 1, "")); solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); - EXPECT_CALL(*mock_ptr, getSolutions(1, 1)) + EXPECT_CALL(*solutionMockPtr, getSolutions(1, 1)) .Times(1) .WillOnce(::testing::Return(solutions)); std::vector sols = ss->getSolutionsByUserAndTaskId(1, 1); @@ -55,19 +69,19 @@ TEST_F(SolutionServiceTest, getSolutionsByUserAndTaskId) { } TEST_F(SolutionServiceTest, deleteSolution) { - EXPECT_CALL(*mock_ptr, deleteSolutionById(1)).Times(1); + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(1)).Times(1); ss->deleteSolutionById(1); } TEST_F(SolutionServiceTest, deleteSolutionException) { - EXPECT_CALL(*mock_ptr, deleteSolutionById(-1)) + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(-1)) .Times(1) .WillRepeatedly(NoSolutionException()); EXPECT_THROW(ss->deleteSolutionById(-1), std::exception); } TEST_F(SolutionServiceTest, getMetrics) { - EXPECT_CALL(*mock_ptr, getSolutionById(1)) + EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) .Times(1) .WillOnce(::testing::Return( Solution(1, "", 1, "", "tokens", "astTree", 1, ""))); @@ -77,24 +91,38 @@ TEST_F(SolutionServiceTest, getMetrics) { } TEST_F(SolutionServiceTest, getMetricsException) { - EXPECT_CALL(*mock_ptr, getSolutionById(-1)) + EXPECT_CALL(*solutionMockPtr, getSolutionById(-1)) .Times(1) .WillRepeatedly(NoSolutionException()); EXPECT_THROW(ss->getMetrics(-1), std::exception); } TEST_F(SolutionServiceTest, createSolution) { - EXPECT_CALL(*mock_ptr, + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", "", "", 1, ""))) .Times(1) .WillRepeatedly(::testing::Return(1)); + + std::vector solutions; + solutions.push_back( + Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); + solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) + .Times(1) + .WillOnce(::testing::Return(solutions)); + + EXPECT_CALL(*taskMockPtr, getTaskById(1)) + .Times(1) + .WillOnce(::testing::Return(Task(1, "desription", 0.7f))); + Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); EXPECT_EQ(sol.getId(), 1); - EXPECT_EQ(sol.getSource(), "main.cpp"); + EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); EXPECT_EQ(sol.getTokens(), "[@0,0:2='int',<45>,1:0] [@1,4:7='main',<132>,1:4] " "[@2,8:8='(',<85>,1:8] [@3,9:9=')',<86>,1:9] " "[@4,10:10='{',<89>,1:10] [@5,11:16='return',<59>,1:11] " "[@6,18:18='0',<1>,1:18] [@7,19:19=';',<128>,1:19] " "[@8,20:20='}',<90>,1:20] [@9,21:20='',<-1>,1:21] "); + EXPECT_EQ(sol.getResult(), "Красивое решение. А главное уникальное !"); } \ No newline at end of file diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 59c7336..90c6096 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -7,7 +7,6 @@ #include "CPP14Lexer.h" #include "CPP14Parser.h" #include "IAntlrWrapper.h" -#include "antlr4-runtime.h" class MyCppAntlr:public IAntlrWrapper { private: @@ -19,7 +18,8 @@ class MyCppAntlr:public IAntlrWrapper { public: MyCppAntlr(std::istream &in); ~MyCppAntlr() override = default; - std::vector getTokensArray() override; + std::vector getTokens() override; + std::vector getTokensTypes() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 6a5ac79..a6dcf1c 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -9,13 +9,26 @@ MyCppAntlr::MyCppAntlr(std::istream& in) { parser_ptr = std::make_unique(&(*tokenStream_ptr)); } -std::vector MyCppAntlr::getTokensArray() { +std::vector MyCppAntlr::getTokens() { tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + std::vector ans(tokenStream_ptr->size()); int i = 0; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->toString(); + ans[i] = token; + i++; + } + + return ans; +} + +std::vector MyCppAntlr::getTokensTypes() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + ans[i] = token->getType(); i++; } @@ -27,7 +40,7 @@ std::string MyCppAntlr::getTokensString() { std::string res; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - res += token->toString()+" "; + res += token->toString() + " "; } return res; diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index 32116a8..16fe1b4 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -19,7 +19,8 @@ class PythonAntlr:public IAntlrWrapper { public: PythonAntlr(std::istream &in); ~PythonAntlr() override = default; - std::vector getTokensArray() override; + std::vector getTokens() override; + std::vector getTokensTypes() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index 7c5417e..eae822d 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -9,13 +9,26 @@ PythonAntlr::PythonAntlr(std::istream& in) { parser_ptr = std::make_unique(&(*tokenStream_ptr)); } -std::vector PythonAntlr::getTokensArray() { +std::vector PythonAntlr::getTokens() { tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + std::vector ans(tokenStream_ptr->size()); int i = 0; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->toString(); + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + ans[i] = token; + i++; + } + + return ans; +} + +std::vector PythonAntlr::getTokensTypes() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + ans[i] = token->getType(); i++; } diff --git a/server/pkg/antlr/testprogs/cpp/test.cpp b/server/pkg/antlr/testprogs/cpp/test.cpp index d43253f..708f54f 100644 --- a/server/pkg/antlr/testprogs/cpp/test.cpp +++ b/server/pkg/antlr/testprogs/cpp/test.cpp @@ -1,11 +1,12 @@ #include -using namespace std; int main() { + std::string res; + int a; if (true && true) { - cout << "Hello World!"; + std::cout << "Hello World!"; } return 0; } diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index 61958f7..c30efcf 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -1,13 +1,16 @@ #pragma once -#include #include +#include + +#include "antlr4-runtime.h" class IAntlrWrapper { public: virtual ~IAntlrWrapper() = default; - virtual std::vector getTokensArray() = 0; - virtual std::pair getTokensAndTree()=0; + virtual std::vector getTokens() = 0; + virtual std::vector getTokensTypes() = 0; + virtual std::pair getTokensAndTree() = 0; virtual std::string getTokensString() = 0; virtual std::string getTreeString() = 0; }; -- GitLab From 72e71bd131d81b8290d2c85899b9c0a27ad9edc0 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 16 May 2023 00:12:50 +0300 Subject: [PATCH 068/134] main changes --- server/CMakeLists.txt | 2 +- server/cmd/main.cpp | 58 +++++++++++++++---- .../internal/metrics/src/TextMetricImpl.cpp | 10 ++-- .../metrics/testProgs/{ => cpp}/code1.txt | 0 .../metrics/testProgs/{ => cpp}/code2.txt | 0 .../metrics/testProgs/python/pycode1.txt | 18 ++++++ .../metrics/testProgs/python/pycode2.txt | 21 +++++++ 7 files changed, 93 insertions(+), 16 deletions(-) rename server/internal/metrics/testProgs/{ => cpp}/code1.txt (100%) rename server/internal/metrics/testProgs/{ => cpp}/code2.txt (100%) create mode 100644 server/internal/metrics/testProgs/python/pycode1.txt create mode 100644 server/internal/metrics/testProgs/python/pycode2.txt diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index c33d848..83583f1 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -5,7 +5,7 @@ find_package(Boost 1.8.1 REQUIRED) find_package(Threads REQUIRED) find_library(PQXX_LIB pqxx) find_package(GTest REQUIRED) -find_package(nlohmann_json REQUIRED) +#find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 938c0a1..f5729d4 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,21 +1,59 @@ #include #include "PythonAntlr.h" +#include "MyCppAntlr.h" +#include "TextMetricsLib.h" int main(int argc, const char* argv[]) { - // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); - std::ifstream ins("/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/python/test.py"); + // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); + std::ifstream fin1("internal/metrics/testProgs/cpp/code1.txt"); + std::ifstream fin2("internal/metrics/testProgs/cpp/code2.txt"); - PythonAntlr pA = PythonAntlr(ins); + assert(fin1.is_open()); + assert(fin2.is_open()); - std::vector tokens = pA.getTokensArray(); + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); - std::cout << "Tokens:" << std::endl; - for (std::string token : tokens) { - std::cout << token << std::endl; - } + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); - std::cout << pA.getTreeString() << std::endl; + LevDistTextMetric livDistTextMetric; + JaccardTextMetric jaccardTextMetric; - return 0; + std::cout << "Text-based results:" << std::endl; + livDistTextMetric.setData(text1, text2); + jaccardTextMetric.setData(text1, text2); + + std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric() << std::endl; + + fin1.close(); + fin2.close(); + + std::ifstream fin3("internal/metrics/testProgs/cpp/code1.txt"); + std::ifstream fin4("internal/metrics/testProgs/cpp/code2.txt"); + + + MyCppAntlr cppA1 = MyCppAntlr(fin3); + MyCppAntlr cppA2 = MyCppAntlr(fin4); + + std::vector tokens1 = cppA1.getTokensArray(); + std::vector tokens2 = cppA2.getTokensArray(); + + std::cout << "Tokens1:" << std::endl; + for (const std::string& token : tokens1) { + std::cout << token << std::endl; + } + std::cout << "Tokens2:" << std::endl; + for (const std::string& token : tokens2) { + std::cout << token << std::endl; + } + + std::cout << cppA1.getTreeString() << std::endl; + std::cout << cppA2.getTreeString() << std::endl; + + fin3.close(); + fin4.close(); + + return 0; } \ No newline at end of file diff --git a/server/internal/metrics/src/TextMetricImpl.cpp b/server/internal/metrics/src/TextMetricImpl.cpp index 4b2cabc..848c36b 100644 --- a/server/internal/metrics/src/TextMetricImpl.cpp +++ b/server/internal/metrics/src/TextMetricImpl.cpp @@ -30,7 +30,7 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { bool s_comm = false; bool m_comm = false; - for (int i = 0; i < modif.size(); i++){ + for (size_t i = 0; i < modif.size(); i++){ if (s_comm && modif[i] == '\0') s_comm = false; else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') @@ -44,7 +44,7 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { else if (modif[i] != '\0') res += modif[i]; - else if (res.size() > 0 && res[res.size() - 1] != '\n') + else if (!res.empty() && res[res.size() - 1] != '\n') res += '\n'; } return res; @@ -70,10 +70,10 @@ double LevDistTextMetric::getMetric(){ std::vector > lev (n, std::vector (m, 0)); - for (int i = 0; i < n; i++){ - for (int j = 0; j < m; j++){ + for (size_t i = 0; i < n; i++){ + for (size_t j = 0; j < m; j++){ if (std::min(i, j) == 0){ - lev[i][j] = std::max(i, j); + lev[i][j] = static_cast (std::max(i, j)); } else{ x = lev[i-1][j]; diff --git a/server/internal/metrics/testProgs/code1.txt b/server/internal/metrics/testProgs/cpp/code1.txt similarity index 100% rename from server/internal/metrics/testProgs/code1.txt rename to server/internal/metrics/testProgs/cpp/code1.txt diff --git a/server/internal/metrics/testProgs/code2.txt b/server/internal/metrics/testProgs/cpp/code2.txt similarity index 100% rename from server/internal/metrics/testProgs/code2.txt rename to server/internal/metrics/testProgs/cpp/code2.txt diff --git a/server/internal/metrics/testProgs/python/pycode1.txt b/server/internal/metrics/testProgs/python/pycode1.txt new file mode 100644 index 0000000..987fe46 --- /dev/null +++ b/server/internal/metrics/testProgs/python/pycode1.txt @@ -0,0 +1,18 @@ +n, m = map(int, input()).split() +arr = [[0 for _ in range(m)] for _ in range(n)] +current_element = 1 + +for diag_id in range(n + m): + if diag_id % 2 == 0: + for x in range(n): + if 0 <= diag_id - x < m: + arr[x][diag_id - x] = current_element + current_element += 1 + else: + for x in reversed(range(n)): + if 0 <= diag_id - x < m: + arr[x][diag_id - x] = current_element + current_element += 1 + +for line in arr: + print(*line) \ No newline at end of file diff --git a/server/internal/metrics/testProgs/python/pycode2.txt b/server/internal/metrics/testProgs/python/pycode2.txt new file mode 100644 index 0000000..3ddbf28 --- /dev/null +++ b/server/internal/metrics/testProgs/python/pycode2.txt @@ -0,0 +1,21 @@ +n, m = map(int, input()).split() +arr = [[0 for _ in range(m)] for _ in range(n)] +current_element1 = 1 + +for i in range(n): + print(i) + +for diag_id in range(n + m): + if diag_id % 2 == 0: + for x in range(n): + if 0 <= diag_id - x < m: + arr[x][diag_id - x] = current_element + current_element += 1 + else: + for x in reversed(range(n)): + if 0 <= diag_id - x < m: + arr[x][diag_id - x] = current_element + current_element += 1 + +for line in arr: + print(*line) \ No newline at end of file -- GitLab From d0daca0415946f5baaf630aa84af51df7f6a9a23 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 16 May 2023 02:48:00 +0300 Subject: [PATCH 069/134] add LevDistTokenMetric impl --- server/cmd/main.cpp | 30 +++++++++++---- .../internal/metrics/include/TokenMetricLib.h | 17 ++++----- .../internal/metrics/src/TokenMetricImpl.cpp | 37 ++++++++++++++++--- 3 files changed, 61 insertions(+), 23 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 9d4b6b3..712feec 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -2,22 +2,36 @@ #include "PythonAntlr.h" #include "MyCppAntlr.h" +#include "TokenMetricLib.h" int main(int argc, const char* argv[]) { // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); - std::ifstream ins( - "/home/denis/2023_1_DDT/server/pkg/antlr/testprogs/cpp/test.cpp"); + std::ifstream fin1("internal/metrics/testProgs/cpp/code1.txt"); + std::ifstream fin2("internal/metrics/testProgs/cpp/code2.txt"); - MyCppAntlr pA = MyCppAntlr(ins); + MyCppAntlr cppA1 = MyCppAntlr(fin1); + MyCppAntlr cppA2 = MyCppAntlr(fin2); - std::vector tokens = pA.getTokensTypes(); + std::vector tokens1 = cppA1.getTokensTypes(); + std::vector tokens2 = cppA2.getTokensTypes(); - std::cout << "Tokens:" << std::endl; - for (int token : tokens) { - std::cout << token << std::endl; + LevDistTokenMetric lev; + lev.setData(tokens1, tokens2); + + std::cout << "Tokens1:" << std::endl; + for (int token : tokens1) { + std::cout << token << " "; + } + std::cout << std::endl; + + std::cout << "Tokens2:" << std::endl; + for (int token : tokens2) { + std::cout << token << " "; } + std::cout << std::endl; + - // std::cout << pA.getTreeString() << std::endl; + std::cout << lev.getMetric() << std::endl; return 0; } \ No newline at end of file diff --git a/server/internal/metrics/include/TokenMetricLib.h b/server/internal/metrics/include/TokenMetricLib.h index 2140b58..c333fe2 100644 --- a/server/internal/metrics/include/TokenMetricLib.h +++ b/server/internal/metrics/include/TokenMetricLib.h @@ -17,29 +17,26 @@ class ITokenMetric{ public: virtual ~ITokenMetric() = default; - virtual void countMetric() = 0; - virtual void setData(std::vector tokens1, std::vector tokens2) = 0; + virtual void setData(std::vector tokens1, std::vector tokens2) = 0; virtual double getMetric() = 0; }; class PrepareDataTokenMetric : public ITokenMetric{ public: - void setData(std::vector _tokens1, std::vector _tokens2) override; - double getMetric() override; + void setData(std::vector _tokens1, std::vector _tokens2) override; protected: - std::vector tokens1; - std::vector tokens2; - double metric_res{}; + std::vector tokens1; + std::vector tokens2; }; -class LivDistTokenMetric : public PrepareDataTokenMetric{ +class LevDistTokenMetric : public PrepareDataTokenMetric{ public: - void countMetric() override; + double getMetric() override; }; class WShinglingTokenMetric : public PrepareDataTokenMetric{ public: - void countMetric() override; + double getMetric() override; }; #endif //SOURCEDOUT_TOKENMETRICLIB_H diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 2695234..100acff 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -4,12 +4,39 @@ #include "TokenMetricLib.h" -void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) {} +double LevDistTokenMetric::getMetric() { + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + int x, y, z; -double PrepareDataTokenMetric::getMetric() { - return metric_res; + std::vector > lev (n, std::vector (m, 0)); + + for (size_t i = 0; i < n; i++){ + for (size_t j = 0; j < m; j++){ + if (std::min(i, j) == 0){ + lev[i][j] = static_cast (std::max(i, j)); + } + else{ + x = lev[i-1][j]; + y = lev[i][j-1]; + z = lev[i-1][j-1]; + lev[i][j] = std::min(x, std::min(y, z)); + if (tokens1[i] != tokens2[j]){ + lev[i][j]++; + } + } + } + } + + if (n == 0 || m == 0) + return 0; + double res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); + return res; } -void LivDistTokenMetric::countMetric() {} +double WShinglingTokenMetric::getMetric() {} -void WShinglingTokenMetric::countMetric() {} +void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) { + tokens1 = _tokens1; + tokens2 = _tokens2; +} -- GitLab From 55d2d13f98a2ef431164350e7c361b90949bb8f9 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 16 May 2023 03:15:07 +0300 Subject: [PATCH 070/134] add WShingling metric --- server/cmd/main.cpp | 6 ++- .../internal/metrics/src/TokenMetricImpl.cpp | 39 ++++++++++++++++++- .../internal/metrics/testProgs/cpp/code2.txt | 2 + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 712feec..132040d 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -16,7 +16,9 @@ int main(int argc, const char* argv[]) { std::vector tokens2 = cppA2.getTokensTypes(); LevDistTokenMetric lev; + WShinglingTokenMetric wsh; lev.setData(tokens1, tokens2); + wsh.setData(tokens1, tokens2); std::cout << "Tokens1:" << std::endl; for (int token : tokens1) { @@ -30,8 +32,10 @@ int main(int argc, const char* argv[]) { } std::cout << std::endl; + std::cout << lev.getMetric() << std::endl << wsh.getMetric() << std::endl; - std::cout << lev.getMetric() << std::endl; + fin1.close(); + fin2.close(); return 0; } \ No newline at end of file diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 100acff..70cba71 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -34,7 +34,44 @@ double LevDistTokenMetric::getMetric() { return res; } -double WShinglingTokenMetric::getMetric() {} +double WShinglingTokenMetric::getMetric() { + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + + if (n == 0 || m == 0 || (n < 3 && m < 3)) + return 0; + + std::vector > sh1; + std::vector > sh2; + + for (size_t i = 0; i < n - 3; i++){ + sh1.emplace_back(tokens1[i], tokens1[i+1], tokens1[i+2]); + } + for (size_t i = 0; i < m - 3; i++){ + sh2.emplace_back(tokens2[i], tokens2[i+1], tokens2[i+2]); + } + + std::set > s1; + std::set > s2; + + for (auto &i : sh1) s1.insert(i); + for (auto &i : sh2) s2.insert(i); + + + std::set> intersect_sets; + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(intersect_sets, intersect_sets.begin())); + + std::set> union_sets; + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), + std::inserter(union_sets, union_sets.begin())); + + if (union_sets.empty()) + return 0; + else + return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); + +} void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) { tokens1 = _tokens1; diff --git a/server/internal/metrics/testProgs/cpp/code2.txt b/server/internal/metrics/testProgs/cpp/code2.txt index 76fc711..bd5977a 100644 --- a/server/internal/metrics/testProgs/cpp/code2.txt +++ b/server/internal/metrics/testProgs/cpp/code2.txt @@ -20,11 +20,13 @@ int main() { string res1; // ещё в код напихаю комментов ss1 << "a bwfw ce "; + cout << "mem"; while(getline(ss, res1, ' ')){ //комментарий после строки с кодом /* * летс гоу * худшее место для многострочного коммента */ cout << res1 << endl; /* многострочный однострочно */ + cout << "mem2" << endl; } } \ No newline at end of file -- GitLab From 096dc69bfcd5a49dfed53e1f193ea2872d8ba624 Mon Sep 17 00:00:00 2001 From: Sarahdeep Date: Tue, 16 May 2023 03:54:36 +0300 Subject: [PATCH 071/134] refactoring --- .../repository/include/SolutionRepository.hpp | 12 +- .../repository/tests/RepositoryTests.cpp | 45 +++--- server/text-basic-metrics/code1.txt | 0 server/text-basic-metrics/code2.txt | 0 server/text-basic-metrics/tbm_main.cpp | 153 ------------------ 5 files changed, 31 insertions(+), 179 deletions(-) delete mode 100644 server/text-basic-metrics/code1.txt delete mode 100644 server/text-basic-metrics/code2.txt delete mode 100644 server/text-basic-metrics/tbm_main.cpp diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index c7face4..8e178cf 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -12,27 +12,29 @@ using namespace pqxx; -class SolutionRepository :public ISolutionRepository { +class SolutionRepository : public ISolutionRepository { public: explicit SolutionRepository(); + std::optional getSolutionById(size_t id) override; std::vector getSolutionsBySenderId(size_t sender_id) override; - std::vector getSolutionsByTaskId(size_t task_id) override; + std::vector getSolutionsByTaskId(size_t task_id) override; size_t storeSolution(Solution solution) override; void updateSolution(Solution solution) override; - void deleteSolutionById(size_t id) override; + void deleteSolutionById(size_t id) override; - void deleteSolution(Solution solution) override; + void deleteSolution(Solution solution) override; std::optional getOriginalSolution(size_t id) override; private: - static Solution makeSolution(const result::const_iterator& c); + static Solution makeSolution(const result::const_iterator &c); + std::shared_ptr manager; }; diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index b34518a..fa77602 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -46,7 +46,7 @@ TEST(TaskRepository_CRUD_Test, CRUD) { TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); + Solution solution("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); size_t id = rep.storeSolution(solution); EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(163)); solution.setId(id); @@ -101,8 +101,8 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); - Solution solution2("01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); size_t id1 = rep.storeSolution(solution1); @@ -111,8 +111,8 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); EXPECT_EQ(solution2, rep.getSolutionById(id2)); - std::vector v = {{id1,"01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1}, - {id2, "01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1}}; + std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1}, + {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); @@ -123,8 +123,8 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); - Solution solution2("01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); size_t id1 = rep.storeSolution(solution1); @@ -138,35 +138,38 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } -TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ + +TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result","tokens.txt", "tree.txt", 1); - try{ + Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1); + try { rep.storeSolution(solution); - }catch(pqxx::foreign_key_violation &e){ - std::cout< -#include -#include -#include -#include -#include -#include - -#include - - -std::string deleteComms(const std::string& text){ - std::string modif; - std::string res; - - std::stringstream ss; - std::string line; - - ss << text; - - while(getline(ss, line)){ - line.pop_back(); - line.push_back('\0'); - modif += line; - } - - bool s_comm = false; - bool m_comm = false; - - for (int i = 0; i < modif.size(); i++){ - if (s_comm && modif[i] == '\0') - s_comm = false; - else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') - m_comm = false, i++; - else if (s_comm || m_comm) - continue; - else if (modif[i] == '/' && modif[i+1] == '/') - s_comm = true, i++; - else if (modif[i] == '/' && modif[i+1] == '*') - m_comm = true, i++; - - else if (modif[i] != '\0') - res += modif[i]; - else{ - res += '\n'; - } - } - return res; -} - -std::vector tbm_tokenizer(const std::string &text){ - boost::char_separator sep(" {}();,\"\0\'"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); - - for (const std::string &s: tokens) { - if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ - res.push_back(s); - } - } - return res; -} - -// % = intersection(A, B) / union(A, B) -double Jaccard_metric(const std::vector & tokens1, const std::vector & tokens2){ - std::set s1; - std::set s2; - - for (auto &i : tokens1) s1.insert(i); - for (auto &i : tokens2) s2.insert(i); - - - std::set intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); - - std::set union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); - - std::cout << intersect_sets.size() << " " << union_sets.size() << std::endl; - - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); -} - -double Livenstain_dist(std::vector tokens1, std::vector tokens2){ - unsigned long n = tokens1.size(); - unsigned long m = tokens2.size(); - int x, y, z; - - std::vector > lev (n, std::vector (m, 0)); - - for (int i = 0; i < n; i++){ - for (int j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = std::max(i, j); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; - lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ - lev[i][j]++; - } - } - } - } - - return lev[n-1][m-1]; -} - -std::pair textCompare(std::istream& fin1, std::istream& fin2){ - std::string line; - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - - std::string non_comm_text1 = deleteComms(text1); - std::string non_comm_text2 = deleteComms(text2); - - std::vector tokens1 = tbm_tokenizer(non_comm_text1); - std::vector tokens2 = tbm_tokenizer(non_comm_text2); - - double res1 = Jaccard_metric(tokens1, tokens2); - double res2 = 1 - Livenstain_dist(tokens1, tokens2) / std::max(tokens1.size(), tokens2.size()); - - return {res1, res2}; -} - -int main(){ - - std::ifstream fin1; - fin1.open("text-basic-metrics/code1.txt"); - assert(fin1.is_open()); - - std::ifstream fin2; - fin2.open("text-basic-metrics/code2.txt"); - assert(fin2.is_open()); - - std::pair metrics_res = textCompare(fin1, fin2); - - std::cout << "Jaccard metric "<< metrics_res.first << "\nLivenstein distance: " << metrics_res.second; - fin1.close(); - fin2.close(); -} \ No newline at end of file -- GitLab From 68402b51545ebd198adf8a3d0c4836212da9a543 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Tue, 16 May 2023 09:39:26 +0300 Subject: [PATCH 072/134] optimised work with large data --- server/internal/entities/include/Solution.hpp | 11 +++-- server/internal/entities/src/Solution.cpp | 25 ++++++----- .../repository/include/TaskRepository.hpp | 1 + .../repository/src/SolutionRepository.cpp | 43 +++++++++++++------ .../repository/src/TaskRepository.cpp | 15 ++++--- .../repository/src/UserRepository.cpp | 11 +++-- .../repository/tests/RepositoryTests.cpp | 23 +++++----- 7 files changed, 81 insertions(+), 48 deletions(-) diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index a8aeaf3..f2cdda0 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -7,12 +7,15 @@ class Solution { public: - Solution(size_t id, std::string sendDate, size_t senderId, std::string source, + Solution(size_t id, std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, - size_t taskId, std::string result, size_t orig_solution) noexcept; + size_t orig_solution) noexcept; - Solution(std::string sendDate, size_t senderId, std::string source, std::string tokens, - std::string astTree, size_t taskId, std::string result, size_t orig_solution) noexcept; + Solution(std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution) noexcept; Solution() noexcept; diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 12a7102..ca5fa0d 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -3,25 +3,24 @@ #include #include "Solution.hpp" -Solution::Solution(size_t id, std::string sendDate, unsigned long senderId, - std::string source, std::string tokens, - std::string astTree, unsigned long taskId, - std::string result, size_t orig_solution_) noexcept: +Solution::Solution(size_t id, std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution) noexcept: id(id), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), tokens(std::move(tokens)), astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)), orig_solution(orig_solution_) {} + task_id(taskId), result(std::move(result)), orig_solution(orig_solution) {} -Solution::Solution(std::string sendDate, unsigned long senderId, - std::string source, std::string tokens, - std::string astTree, unsigned long taskId, - std::string result, size_t orig_solution_) noexcept: +Solution::Solution(std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution) noexcept: id(0), send_date(std::move(sendDate)), sender_id(senderId), source(std::move(source)), tokens(std::move(tokens)), astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)), orig_solution(orig_solution_) {} + task_id(taskId), result(std::move(result)), orig_solution(orig_solution) {} -Solution::Solution() noexcept: id(0), sender_id(0), task_id(0), orig_solution(0) {} size_t Solution::getId() const noexcept { return id; @@ -103,3 +102,7 @@ void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSolution; } +Solution::Solution()noexcept :id(0), sender_id(0), task_id(0){ + +} + diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 4fbc8d1..467fadd 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -27,6 +27,7 @@ public: private: static Task makeTask(const result::const_iterator &c); + std::shared_ptr manager; }; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 441bab7..353ad9b 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -27,11 +27,19 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); nontransaction n(*c); - result r(n.exec(sql)); + auto stream = stream_from::query(n, sql); std::vector solutions; + std::tuple row; + while (stream >> row) { + solutions.emplace_back( + get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row)); + } + stream.complete(); manager->freeConnection(c); - for (result::const_iterator k = r.begin(); k != r.end(); ++k) - solutions.push_back(makeSolution(k)); return solutions; } catch (...) { @@ -44,11 +52,19 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { auto c = manager->connection(); std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); nontransaction n(*c); - result r(n.exec(sql)); + auto stream = stream_from::query(n, sql); std::vector solutions; + std::tuple row; + while (stream >> row) { + solutions.emplace_back( + get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row)); + } + stream.complete(); manager->freeConnection(c); - for (result::const_iterator k = r.begin(); k != r.end(); ++k) - solutions.push_back(makeSolution(k)); return solutions; } catch (...) { @@ -78,10 +94,10 @@ size_t SolutionRepository::storeSolution(Solution solution) { auto c = manager->connection(); std::string sql = ( - boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree) " \ - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % + boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree, original_solution_id) " \ + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % - solution.getTokens() % solution.getAstTree()).str(); + solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()).str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -97,10 +113,11 @@ void SolutionRepository::updateSolution(Solution solution) { auto c = manager->connection(); std::string sql = (boost::format( - "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s', task_id = '%s', result = '%s', tokens = '%s', astTree = '%s';") + "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', original_solution_id = '%s';") % solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % solution.getTokens() % - solution.getAstTree()).str(); + solution.getAstTree() % solution.getOrigSolution()).str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -134,10 +151,10 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("send_date")).as(), c.at(c.column_number("sender_id")).as(), c.at(c.column_number("source")).as(), - c.at(c.column_number("tokens")).as(), - c.at(c.column_number("astTree")).as(), c.at(c.column_number("task_id")).as(), c.at(c.column_number("result")).as(), + c.at(c.column_number("tokens")).as(), + c.at(c.column_number("astTree")).as(), c.at(c.column_number("original_solution_id")).as()}; } diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index f20dffb..261436c 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,6 +1,7 @@ #include #include "Task.hpp" #include +#include #include "TaskRepository.hpp" std::optional TaskRepository::getTaskById(size_t id) { @@ -24,12 +25,15 @@ std::vector TaskRepository::getAllTasks() { auto c = manager->connection(); std::string sql = "SELECT * FROM tasks"; nontransaction n(*c); - result r(n.exec(sql)); + auto stream = stream_from::query(n, sql); + std::vector tasks; + std::tuple row; + while(stream >> row){ + tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row)); + } + stream.complete(); manager->freeConnection(c); - std::vector users; - for (result::const_iterator k = r.begin(); k != r.end(); ++k) - users.push_back(makeTask(k)); - return users; + return tasks; } catch (...) { throw; @@ -87,6 +91,7 @@ Task TaskRepository::makeTask(const result::const_iterator &c) { c.at(c.column_number("treshold")).as()}; } + TaskRepository::TaskRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 216baef..71e05a5 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -79,11 +79,14 @@ std::vector UserRepository::getAllUsers() { auto c = manager->connection(); std::string sql = "SELECT * FROM Users"; nontransaction n(*c); - result r(n.exec(sql)); - manager->freeConnection(c); + auto stream = stream_from::query(n, sql); std::vector users; - for (result::const_iterator k = r.begin(); k != r.end(); ++k) - users.push_back(makeUser(k)); + std::tuple row; + while(stream >> row){ + users.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); + } + stream.complete(); + manager->freeConnection(c); return users; } catch (...) { diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index 1e2cab7..b34518a 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -46,9 +46,9 @@ TEST(TaskRepository_CRUD_Test, CRUD) { TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); size_t id = rep.storeSolution(solution); - EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(1)); + EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(163)); solution.setId(id); std::optional new_solution_opt = rep.getSolutionById(id); Solution new_solution; @@ -101,8 +101,9 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); - Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1); + size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); @@ -110,8 +111,8 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); EXPECT_EQ(solution2, rep.getSolutionById(id2)); - std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1}, - {id2, "01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1}}; + std::vector v = {{id1,"01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1}, + {id2, "01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); @@ -122,8 +123,9 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); - Solution solution2("01.01.1970", 1, "/home/usr", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result","tokens.txt", "tree.txt", 1); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result","tokens.txt", "tree.txt", 1); + size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); @@ -138,8 +140,7 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { } TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ SolutionRepository rep; - - Solution solution("01.01.1970", 1, ":/C/Users", "tokens.txt", "tree.txt", 100500, "result", 1); + Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result","tokens.txt", "tree.txt", 1); try{ rep.storeSolution(solution); }catch(pqxx::foreign_key_violation &e){ @@ -150,7 +151,7 @@ TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask){ TEST(SolutionRepository_CRUD_Test, tryToStoreWithNotExistingSender){ SolutionRepository rep; - Solution solution("01.01.1970", 100500, ":/C/Users", "tokens.txt", "tree.txt", 1, "result", 1); + Solution solution("01.01.1970", 100500,":/C/Users", 100500, "result","tokens.txt", "tree.txt", 1); try{ rep.storeSolution(solution); }catch(pqxx::foreign_key_violation &keyViolation){ -- GitLab From 9c1f6559b8f30e531d5af219b1df360c0c2b124b Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 16 May 2023 12:55:23 +0300 Subject: [PATCH 073/134] add tokenmetrics in service --- Dockerfile | 25 +++- server/internal/service/include/Utils.h | 10 ++ .../internal/service/src/SolutionService.cpp | 139 ++++++++++-------- server/internal/service/src/Utils.cpp | 23 +++ .../service/tests/SolutionServiceTest.cpp | 15 +- 5 files changed, 136 insertions(+), 76 deletions(-) create mode 100644 server/internal/service/include/Utils.h create mode 100644 server/internal/service/src/Utils.cpp diff --git a/Dockerfile b/Dockerfile index e9f5099..b1c981d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 AS base +FROM ubuntu:latest ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -6,16 +6,23 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt update -y RUN apt install -y gcc RUN apt install -y libpqxx-dev -RUN apt install -y clang-tidy +RUN apt install -y clang-tidy +RUN apt-get install -y wget +RUN apt install -y g++ +RUN apt install -y cmake + +RUN wget https://github.com/jtv/libpqxx/archive/refs/tags/7.7.5.tar.gz +RUN tar -zxvf 7.7.5.tar.gz +WORKDIR libpqxx-7.7.5 +RUN ./configure CXXFLAGS=-std=c++17 --disable-dependency-tracking +RUN make +RUN make install + RUN apt install -y python3-pip RUN apt install -y cppcheck RUN apt-get update -RUN apt install -y cmake -RUN apt-get update -RUN apt install -y libboost-all-dev RUN apt install -y nlohmann-json3-dev RUN apt install -y git -RUN apt install -y qt5-default RUN apt-get update RUN apt install -y default-jre RUN apt -y install curl @@ -34,6 +41,12 @@ WORKDIR googletest/build RUN cmake .. -DBUILD_GMOCK=ON RUN make RUN make install + +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz +RUN tar xvf boost_1_82_0.tar.gz +WORKDIR boost_1_82_0 +RUN ./bootstrap.sh --prefix=/usr/ +RUN ./b2 install WORKDIR /project diff --git a/server/internal/service/include/Utils.h b/server/internal/service/include/Utils.h new file mode 100644 index 0000000..20c67c8 --- /dev/null +++ b/server/internal/service/include/Utils.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +class Utils { + public: + static std::string convertIntArrayIntoString(std::vector& arr); + static std::vector convertStringIntoIntArray(const std::string& str); +}; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index c1f9c2d..8aa704b 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -7,6 +7,7 @@ #include "FileMethods.h" #include "MyCppAntlr.h" #include "PythonAntlr.h" +#include "Utils.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = @@ -42,55 +43,72 @@ std::string SolutionService::setResultVerdict(float textBasedRes, return PLAGIAT_VERDICT; } -// std::pair SolutionService::getMaxTextResMetric( -// std::vector& solutions, const std::string& filedata, -// float treshold) { -// std::pair maxMatch = std::make_pair(0.0, 0ul); -// for (auto sol : solutions) { -// textMetric = std::make_unique(); -// textMetric->setData(filedata, sol.getSource()); -// float textBasedRes = float(textMetric->getMetric()); -// std::cout << textBasedRes << std::endl; - -// textMetric = std::make_unique(); -// textMetric->setData(filedata, sol.getSource()); -// textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; - -// if (textBasedRes > treshold) { -// break; -// } -// if (maxMatch.first < textBasedRes) { -// maxMatch.first = textBasedRes; -// maxMatch.second = sol.getSenderId(); -// } -// } -// return maxMatch; -// } - -// std::pair SolutionService::getMaxTokenResMetric( -// std::vector& solutions, std::vector& tokens, -// float treshold) { -// std::pair maxMatch = std::make_pair(0.0, 0ul); -// for (auto sol : solutions) { -// tokenMetric = std::make_unique(); -// tokenMetric->setData(tokens, sol.getTokens()); -// float tokenBasedRes = float(tokenMetric->getMetric()); -// std::cout << tokenBasedRes << std::endl; - -// tokenMetric = std::make_unique(); -// tokenMetric->setData(tokens, sol.getSource()); -// tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; - -// if (tokenBasedRes > treshold) { -// break; -// } -// if (maxMatch.first < tokenBasedRes) { -// maxMatch.first = tokenBasedRes; -// maxMatch.second = sol.getSenderId(); -// } -// } -// return maxMatch; -// } +std::pair SolutionService::getMaxTextResMetric( + std::vector& solutions, const std::string& filedata, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); + for (auto sol : solutions) { + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + float textBasedRes = float(textMetric->getMetric()); + + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; + + if (maxMatch.first < textBasedRes) { + maxMatch.first = textBasedRes; + maxMatch.second = sol.getSenderId(); + } + + if (textBasedRes > treshold) { + break; + } + } + return maxMatch; +} + +std::pair SolutionService::getMaxTokenResMetric( + std::vector& solutions, std::vector& tokens, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); + for (auto sol : solutions) { + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, + Utils::convertStringIntoIntArray(sol.getTokens())); + float tokenBasedRes = float(tokenMetric->getMetric()); + std::cout << tokenBasedRes << std::endl; + + std::cout << "Tokens from tokens" << std::endl; + for (int t : tokens) { + std::cout << t << " "; + } + std::cout << std::endl; + + std::cout << "Tokens from BD" << std::endl; + for (int t : Utils::convertStringIntoIntArray(sol.getTokens())) { + std::cout << t << " "; + } + std::cout << std::endl; + + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, + Utils::convertStringIntoIntArray(sol.getTokens())); + tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; + + std::cout << tokenBasedRes << std::endl; + + if (maxMatch.first < tokenBasedRes) { + maxMatch.first = tokenBasedRes; + maxMatch.second = sol.getSenderId(); + } + + if (tokenBasedRes > treshold) { + break; + } + } + return maxMatch; +} Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, @@ -109,23 +127,24 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - float treshold = taskRepo->getTaskById(taskId).getTreshhold(); - std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); - // float textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); - // float tokenBasedRes getMaxTokenResMetric(solutions, tokensTypes, - // treshold); + std::pair textBasedRes = + getMaxTextResMetric(solutions, filedata, treshold); + std::pair tokenBasedRes = + getMaxTokenResMetric(solutions, tokensTypes, treshold); + + std::cout << textBasedRes.first << " " << tokenBasedRes.first << std::endl; + + std::string result = + setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); - std::string result = setResultVerdict(0, 0, treshold); - // std::string result = setResultVerdict(textBasedRes, tokenBasedRes, - // treshold); - Solution sol = - Solution(std::ctime(&now), userId, filedata, antlr->getTokensString(), - astTree, taskId, result); + Solution sol = Solution(std::ctime(&now), userId, filedata, + Utils::convertIntArrayIntoString(tokensTypes), + astTree, taskId, result); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; diff --git a/server/internal/service/src/Utils.cpp b/server/internal/service/src/Utils.cpp new file mode 100644 index 0000000..005748f --- /dev/null +++ b/server/internal/service/src/Utils.cpp @@ -0,0 +1,23 @@ +#include "Utils.h" + +#include +#include +#include +#include +#include + +std::string Utils::convertIntArrayIntoString(std::vector& arr) { + std::string str; + for (size_t i = 0; i < arr.size(); i++) { + str += std::to_string(arr[i]) + " "; + } + return str; +} + +std::vector Utils::convertStringIntoIntArray(const std::string& str) { + std::stringstream ss(str); + std::vector v; + + std::copy(std::istream_iterator(ss), {}, back_inserter(v)); + return v; +} diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index b7b0e70..4370110 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -105,24 +105,19 @@ TEST_F(SolutionServiceTest, createSolution) { std::vector solutions; solutions.push_back( - Solution(0, "", 1, "int main(){return 0;}", "", "", 1, "")); - solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + Solution(0, "", 1, "int main(){return 0;}", "45 132 85 86 89 59 1 128 90 -1", "", 1, "")); + //solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) .Times(1) .WillOnce(::testing::Return(solutions)); EXPECT_CALL(*taskMockPtr, getTaskById(1)) .Times(1) - .WillOnce(::testing::Return(Task(1, "desription", 0.7f))); + .WillOnce(::testing::Return(Task(1, "desription", 0.5f))); Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); EXPECT_EQ(sol.getId(), 1); EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); - EXPECT_EQ(sol.getTokens(), - "[@0,0:2='int',<45>,1:0] [@1,4:7='main',<132>,1:4] " - "[@2,8:8='(',<85>,1:8] [@3,9:9=')',<86>,1:9] " - "[@4,10:10='{',<89>,1:10] [@5,11:16='return',<59>,1:11] " - "[@6,18:18='0',<1>,1:18] [@7,19:19=';',<128>,1:19] " - "[@8,20:20='}',<90>,1:20] [@9,21:20='',<-1>,1:21] "); - EXPECT_EQ(sol.getResult(), "Красивое решение. А главное уникальное !"); + EXPECT_EQ(sol.getTokens(), "45 132 85 86 89 59 1 128 90 -1 "); + EXPECT_EQ(sol.getResult(), "Не, ну вы не палитесь. Плагиат."); } \ No newline at end of file -- GitLab From 287d2204e25f28f747229883c41797ed90f97e79 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 16 May 2023 13:07:21 +0300 Subject: [PATCH 074/134] fix tests --- server/internal/metrics/CMakeLists.txt | 2 +- .../metrics/tests/src/text_metrics_tests.cpp | 83 ++++++++----------- 2 files changed, 36 insertions(+), 49 deletions(-) diff --git a/server/internal/metrics/CMakeLists.txt b/server/internal/metrics/CMakeLists.txt index bea052a..531f6f6 100644 --- a/server/internal/metrics/CMakeLists.txt +++ b/server/internal/metrics/CMakeLists.txt @@ -24,5 +24,5 @@ set(METRICS_lib_INCLUDE_DIRS ${METRICS_lib_INCLUDE_DIRS} PARENT_SCOPE) enable_testing() #if(BUILD_TESTS) -# add_subdirectory(tests) +add_subdirectory(tests) #endif() \ No newline at end of file diff --git a/server/internal/metrics/tests/src/text_metrics_tests.cpp b/server/internal/metrics/tests/src/text_metrics_tests.cpp index e8317dd..1014fec 100644 --- a/server/internal/metrics/tests/src/text_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/text_metrics_tests.cpp @@ -11,11 +11,11 @@ #include "TextMetricsLib.h" #include "TokenMetricLib.h" -class LivDistTextMetricTest : public ::testing::Test { +class LevDistTextMetricTest : public ::testing::Test { protected: - std::unique_ptr livDistTextMetric; + std::unique_ptr levDistTextMetric; void SetUp(){ - livDistTextMetric = std::make_unique (); + levDistTextMetric = std::make_unique (); } void TearDown(){} }; @@ -29,11 +29,11 @@ protected: void TearDown(){} }; -class LivDistTokenMetricTest : public ::testing::Test { +class LevDistTokenMetricTest : public ::testing::Test { protected: - std::unique_ptr livDistTokenMetric; + std::unique_ptr levDistTokenMetric; void SetUp(){ - livDistTokenMetric = std::make_unique (); + levDistTokenMetric = std::make_unique (); } void TearDown(){} }; @@ -49,7 +49,7 @@ protected: -TEST_F(LivDistTextMetricTest, check_eq_progs) { +TEST_F(LevDistTextMetricTest, check_eq_progs) { std::ifstream fin1; fin1.open("src/test-codes/code1.txt"); @@ -57,26 +57,23 @@ TEST_F(LivDistTextMetricTest, check_eq_progs) { (std::istreambuf_iterator() ) ); fin1.close(); - livDistTextMetric->setData(text1, text1); - livDistTextMetric->countMetric(); + levDistTextMetric->setData(text1, text1); - EXPECT_EQ(livDistTextMetric->getMetric(), 1); + EXPECT_EQ(levDistTextMetric->getMetric(), 1); } -TEST_F(LivDistTextMetricTest, check_absolutely_not_eq_progs) { +TEST_F(LevDistTextMetricTest, check_absolutely_not_eq_progs) { - livDistTextMetric->setData("a b c", "d e f g"); - livDistTextMetric->countMetric(); + levDistTextMetric->setData("a b c", "d e f g"); - EXPECT_EQ(livDistTextMetric->getMetric() < 0.5, true); + EXPECT_EQ(levDistTextMetric->getMetric() < 0.5, true); } -TEST_F(LivDistTextMetricTest, test_with_empty_prog) { +TEST_F(LevDistTextMetricTest, test_with_empty_prog) { - livDistTextMetric->setData("a b c", ""); - livDistTextMetric->countMetric(); + levDistTextMetric->setData("a b c", ""); - EXPECT_EQ(livDistTextMetric->getMetric(), 0); + EXPECT_EQ(levDistTextMetric->getMetric(), 0); } TEST_F(JaccardTextMetricTest, check_eq_progs){ @@ -88,7 +85,6 @@ TEST_F(JaccardTextMetricTest, check_eq_progs){ fin1.close(); jaccardTextMetric->setData(text1, text1); - jaccardTextMetric->countMetric(); EXPECT_EQ(jaccardTextMetric->getMetric(), 1); } @@ -96,7 +92,6 @@ TEST_F(JaccardTextMetricTest, check_eq_progs){ TEST_F(JaccardTextMetricTest, check_absolutely_not_eq_progs) { jaccardTextMetric->setData("a b c", "d e f g"); - jaccardTextMetric->countMetric(); EXPECT_EQ(jaccardTextMetric->getMetric(), 0); } @@ -104,75 +99,67 @@ TEST_F(JaccardTextMetricTest, check_absolutely_not_eq_progs) { TEST_F(JaccardTextMetricTest, test_with_empty_prog) { jaccardTextMetric->setData("a b c", ""); - jaccardTextMetric->countMetric(); EXPECT_EQ(jaccardTextMetric->getMetric(), 0); } -TEST_F(LivDistTokenMetricTest, check_eq_progs) { +TEST_F(LevDistTokenMetricTest, check_eq_progs) { - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {"b", "a", "c"}; + std::vector tokens1 = {1, 2, 3}; - livDistTokenMetric->setData(tokens1, tokens1); - livDistTokenMetric->countMetric(); + levDistTokenMetric->setData(tokens1, tokens1); - EXPECT_EQ(livDistTokenMetric->getMetric(), 1); + EXPECT_EQ(levDistTokenMetric->getMetric(), 1); } -TEST_F(LivDistTokenMetricTest, check_absolutely_not_eq_progs) { +TEST_F(LevDistTokenMetricTest, check_absolutely_not_eq_progs) { - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {"d", "e", "f", "o"}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {3, 4, 5, 6}; - livDistTokenMetric->setData(tokens1, tokens1); - livDistTokenMetric->countMetric(); + levDistTokenMetric->setData(tokens1, tokens2); - EXPECT_EQ(livDistTokenMetric->getMetric() < 0.5, true); + EXPECT_EQ(levDistTokenMetric->getMetric() < 0.5, true); } -TEST_F(LivDistTokenMetricTest, test_with_empty_prog) { +TEST_F(LevDistTokenMetricTest, test_with_empty_prog) { - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; - livDistTokenMetric->setData(tokens1, tokens1); - livDistTokenMetric->countMetric(); + levDistTokenMetric->setData(tokens1, tokens2); - EXPECT_EQ(livDistTokenMetric->getMetric(), 0); + EXPECT_EQ(levDistTokenMetric->getMetric(), 0); } TEST_F(WShinglingTokenMetricTest, check_eq_progs){ - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {"b", "a", "c"}; + std::vector tokens1 = {1, 2, 3, 4, 5, 6}; + std::vector tokens2 = {1, 2, 3, 4, 5, 6}; wShinglingTokenMetric->setData(tokens1, tokens1); - wShinglingTokenMetric->countMetric(); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 1); } TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {"d", "e", "f", "o"}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {4, 5, 6, 1}; wShinglingTokenMetric->setData(tokens1, tokens1); - wShinglingTokenMetric->countMetric(); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { - std::vector tokens1 = {"a", "b", "c"}; - std::vector tokens2 = {}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; wShinglingTokenMetric->setData(tokens1, tokens1); - wShinglingTokenMetric->countMetric(); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } -- GitLab From ba625ba2d248bb0143bf971be3f4af262c2033c6 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 16 May 2023 13:45:07 +0300 Subject: [PATCH 075/134] fix new solution constructor --- .../internal/service/src/SolutionService.cpp | 22 ++++--------------- .../service/tests/SolutionServiceTest.cpp | 15 +++++++------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index d87109f..28957b5 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -79,27 +79,12 @@ std::pair SolutionService::getMaxTokenResMetric( tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); float tokenBasedRes = float(tokenMetric->getMetric()); - std::cout << tokenBasedRes << std::endl; - - std::cout << "Tokens from tokens" << std::endl; - for (int t : tokens) { - std::cout << t << " "; - } - std::cout << std::endl; - - std::cout << "Tokens from BD" << std::endl; - for (int t : Utils::convertStringIntoIntArray(sol.getTokens())) { - std::cout << t << " "; - } - std::cout << std::endl; tokenMetric = std::make_unique(); tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; - std::cout << tokenBasedRes << std::endl; - if (maxMatch.first < tokenBasedRes) { maxMatch.first = tokenBasedRes; maxMatch.second = sol.getSenderId(); @@ -151,9 +136,10 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, } } - Solution sol = Solution(std::ctime(&now), userId, filedata, - Utils::convertIntArrayIntoString(tokensTypes), - astTree, taskId, result, plagiatUserId); + Solution sol = + Solution(std::ctime(&now), userId, filedata, taskId, + result, Utils::convertIntArrayIntoString(tokensTypes), astTree, + plagiatUserId); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index bad39d6..d4b3479 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -14,7 +14,8 @@ class Exception : public std::exception { class SolutionRepositoryMock : public ISolutionRepository { public: ~SolutionRepositoryMock() override = default; - MOCK_METHOD(std::optional, getSolutionById, (size_t id), (override)); + MOCK_METHOD(std::optional, getSolutionById, (size_t id), + (override)); MOCK_METHOD(std::vector, getSolutionsBySenderId, (size_t sender_id), (override)); MOCK_METHOD(std::vector, getSolutionsByTaskId, (size_t task_id), @@ -23,7 +24,8 @@ class SolutionRepositoryMock : public ISolutionRepository { MOCK_METHOD(void, updateSolution, (Solution solution), (override)); MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); - MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), (override)); + MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), + (override)); }; class TaskRepositoryMock : public ITaskRepository { @@ -72,7 +74,7 @@ TEST_F(SolutionServiceTest, getMetrics) { EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) .Times(1) .WillOnce(::testing::Return( - Solution(1, "", 1, "", "tokens", "astTree", 1, "", 1))); + Solution(1, "", 1, "", 1, "", "tokens", "astTree", 1))); std::pair metrics = ss->getMetrics(1); EXPECT_EQ(metrics.first, "tokens"); EXPECT_EQ(metrics.second, "astTree"); @@ -87,14 +89,13 @@ TEST_F(SolutionServiceTest, getMetricsException) { TEST_F(SolutionServiceTest, createSolution) { EXPECT_CALL(*solutionMockPtr, - storeSolution(Solution(0, "", 2, "source", "", "", 1, "", 1))) + storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) .Times(1) .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back( - Solution(0, "", 1, "int main(){return 0;}", "45 132 85 86 89 59 1 128 90 -1", "", 1, "",-1)); - //solutions.push_back(Solution(1, "", 1, "", "", "", 1, "")); + solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", + "45 132 85 86 89 59 1 128 90 -1", "", -1)); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) .Times(1) .WillOnce(::testing::Return(solutions)); -- GitLab From 2e775505c2439af291c06088ab84fa06706696ff Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 16 May 2023 14:59:33 +0300 Subject: [PATCH 076/134] add public inheritance --- server/internal/service/CMakeLists.txt | 4 ++-- server/internal/service/include/SolutionService.h | 2 +- server/internal/service/include/UserService.h | 2 +- server/internal/service/tests/CMakeLists.txt | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 05699f7..8afbe09 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -22,5 +22,5 @@ set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) -enable_testing() -add_subdirectory(tests) \ No newline at end of file +# enable_testing() +# add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index fc44fbc..4b991d6 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -11,7 +11,7 @@ #include "TextMetricsLib.h" #include "TokenMetricLib.h" -class SolutionService : ISolutionService { +class SolutionService : public ISolutionService { private: std::unique_ptr solutionRepo; std::unique_ptr taskRepo; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 9a26617..a03b773 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -5,7 +5,7 @@ #include "IUserService.h" #include "UserValidator.h" -class UserService : IUserService { +class UserService : public IUserService { private: std::unique_ptr userRepo; diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt index 5dc8740..e1cdd49 100644 --- a/server/internal/service/tests/CMakeLists.txt +++ b/server/internal/service/tests/CMakeLists.txt @@ -1,8 +1,5 @@ project(test_service) -set(CMAKE_CXX_STANDARD 20) -add_compile_options(-coverage) - file(GLOB SOURCES *.cpp) enable_testing() -- GitLab From 75336b5f4a7509b6ba318ccb216bd6ce5e4314f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 16 May 2023 15:56:22 +0300 Subject: [PATCH 077/134] start integration --- Makefile | 5 +- client/internal/core/include/Core.h | 2 +- client/internal/core/src/Core.cpp | 4 +- .../httpClient/include/HttpClientManager.h | 3 +- .../internal/httpClient/include/Serializer.h | 3 +- .../httpClient/src/HttpClientManager.cpp | 5 +- client/internal/httpClient/src/Serializer.cpp | 6 +- server/CMakeLists.txt | 13 ++- server/cmd/CMakeLists.txt | 9 +- server/cmd/main.cpp | 55 ++++++++++-- server/internal/CMakeLists.txt | 11 ++- .../internal/dbManager/src/dbConnection.cpp | 2 +- server/internal/entities/include/Solution.hpp | 1 - server/internal/httpServer/CMakeLists.txt | 19 ++-- server/internal/httpServer/include/Header.h | 11 --- server/internal/httpServer/include/Router.h | 3 - .../internal/httpServer/include/Serializer.h | 2 +- .../httpServer/include/SolutionManager.h | 2 +- .../internal/httpServer/include/TaskManager.h | 2 +- .../httpServer/include/TmpSolutionService.h | 2 +- .../httpServer/include/TmpTaskService.h | 8 +- .../internal/httpServer/include/UserManager.h | 6 +- server/internal/httpServer/include/Utils.h | 4 + server/internal/httpServer/main.cpp | 24 ++--- server/internal/httpServer/src/Router.cpp | 11 --- server/internal/httpServer/src/Serializer.cpp | 10 ++- .../httpServer/src/SolutionManager.cpp | 36 +++++--- .../internal/httpServer/src/TaskManager.cpp | 50 +++++++---- .../internal/httpServer/src/UserManager.cpp | 46 ++++++---- server/internal/httpServer/src/Utils.cpp | 11 +++ server/internal/service/CMakeLists.txt | 4 +- .../service/include/SolutionService.h | 10 +-- server/internal/service/include/TaskService.h | 2 +- server/internal/service/include/UserService.h | 4 +- .../internal/service/src/SolutionService.cpp | 8 +- server/internal/service/src/TaskService.cpp | 4 +- server/internal/service/src/UserService.cpp | 4 +- server/pkg/CMakeLists.txt | 8 +- server/pkg/antlr/CMakeLists.txt | 54 ++++++------ server/pkg/antlr/cpp14/CMakeLists.txt | 64 +++++++------- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 52 +++++------ server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 88 +++++++++---------- server/pkg/antlr/python3/CMakeLists.txt | 54 ++++++------ .../pkg/antlr/python3/include/PythonAntlr.h | 50 +++++------ server/pkg/antlr/python3/src/PythonAntlr.cpp | 88 +++++++++---------- server/pkg/antlr/testprogs/python/test.py | 12 +-- server/pkg/antlr/virtual/IAntlrWrapper.h | 26 +++--- 47 files changed, 490 insertions(+), 408 deletions(-) delete mode 100644 server/internal/httpServer/include/Header.h diff --git a/Makefile b/Makefile index b226212..e5803ac 100644 --- a/Makefile +++ b/Makefile @@ -16,14 +16,11 @@ server-run: test: ctest --verbose --output-on-failure --test-dir build/ -build-docker: - docker build . -f Dockerfile -t ddt-project - dev: docker run --rm -it \ -v $(PWD):/project \ --name app \ - ddt-project + raiden454/cpp-app stop-docker: docker stop app diff --git a/client/internal/core/include/Core.h b/client/internal/core/include/Core.h index f28be4a..c837a25 100644 --- a/client/internal/core/include/Core.h +++ b/client/internal/core/include/Core.h @@ -14,7 +14,7 @@ public: static std::vector getAllTasks(); - static Solution submitSolution(const int& task_id, const std::string& path_to_file); + static Solution submitSolution(const int& task_id, const std::string& filename, const std::string& path_to_file); static unsigned int createTask(const std::string &desc); diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index 52baa40..e200e63 100644 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -30,8 +30,8 @@ std::vector Core::getAllTasks() { return client.getAllTasks(); } -Solution Core::submitSolution(const int &task_id, const std::string &path_to_file) { - return client.submitSolution(user_id, task_id, path_to_file); +Solution Core::submitSolution(const int &task_id, const std::string& filename, const std::string &path_to_file) { + return client.submitSolution(user_id, task_id, filename, path_to_file); } unsigned int Core::createTask(const std::string &desc) { diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index 80e73b9..9007351 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -19,7 +19,8 @@ public: std::pair loginUser(const std::string &login, const std::string &password); std::pair registerUser(const std::string &login, const std::string &username, const std::string &password); - Solution submitSolution(const int& user_id, const int &task_id, const std::string &path_to_solution); + Solution submitSolution(const int& user_id, const int &task_id, const std::string& filename, + const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); unsigned int createTask(const std::string& desc); diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index 80bdb42..0e874c1 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -11,7 +11,8 @@ class Serializer { public: std::string serialLoginData(std::string_view login, std::string_view password); std::string serialRegisterData(std::string_view login, std::string_view username, std::string_view password); - std::string serialSolutionData(const int& user_id, const int& task_id, const std::string& path_to_file); + std::string serialSolutionData(const int& user_id, const int& task_id, const std::string& filename, + const std::string& path_to_file); std::string serialNewTaskData(std::string_view desc); User deserialUserData(std::string_view body); diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index 7d6da4f..f40017a 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -40,8 +40,9 @@ std::pair HttpClientManager::registerUser(const std::string &log return {status, user}; } -Solution HttpClientManager::submitSolution(const int &user_id, const int &task_id, const std::string &path_to_sound) { - std::string body = serializer->serialSolutionData(user_id, task_id, path_to_sound); +Solution HttpClientManager::submitSolution(const int &user_id, const int &task_id, const std::string& filename, + const std::string &path_to_sound) { + std::string body = serializer->serialSolutionData(user_id, task_id, filename, path_to_sound); http::response res = client->makeGetRequest("/solution/submit", body); unsigned status = res.result_int(); std::string res_body; diff --git a/client/internal/httpClient/src/Serializer.cpp b/client/internal/httpClient/src/Serializer.cpp index e76eca4..859db2c 100644 --- a/client/internal/httpClient/src/Serializer.cpp +++ b/client/internal/httpClient/src/Serializer.cpp @@ -52,15 +52,17 @@ std::vector Serializer::deserialAllTasks(std::string_view body) { return tasks; } -std::string Serializer::serialSolutionData(const int &user_id, const int &task_id, const std::string& path_to_file) { +std::string Serializer::serialSolutionData(const int &user_id, const int &task_id, const std::string& filename, + const std::string& path_to_file) { boost::property_tree::ptree json; json.put("user_id", user_id); json.put("task_id", task_id); + json.put("filename", filename); std::ifstream file(path_to_file); std::ostringstream sstr; sstr << file.rdbuf(); std::string source = sstr.str(); - json.put("source", source); + json.put("filedata", source); std::stringstream out; boost::property_tree::write_json(out, json); return out.str(); diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index aeee19b..f608f66 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,7 +1,16 @@ set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) -find_package(Boost 1.8.1 REQUIRED) -find_package(Threads REQUIRED) +find_package(Boost 1.81.0 REQUIRED) +IF(APPLE) + set(CMAKE_THREAD_LIBS_INIT "-lpthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(CMAKE_USE_WIN32_THREADS_INIT 0) + set(CMAKE_USE_PTHREADS_INIT 1) + set(THREADS_PREFER_PTHREAD_FLAG ON) +ELSE() + find_package(Threads REQUIRED) +ENDIF() + find_library(PQXX_LIB pqxx) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index b262044..2f92a68 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -3,10 +3,11 @@ set(PROJECT_NAME "Server") project(${PROJECT_NAME}) add_executable(Server main.cpp) -message(STATUS ${libusers}) -message("${SERVICE_LIB}") -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${SERVICE_LIB} ${libEntities_LIB} ${libRepository_LIB}) -target_include_directories(Server PUBLIC ${SERVICE_lib_INCLUDE_DIRS} ${libusers_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${HTTPSERVER_LIB} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} + ${libDbManager_LIB} ${METRICS_lib_LIBRARY} ${libEntities_LIB} ${ANTLR4_LIB_LIB} ${libpqxx_LIBRARIES}) +message("a = ${SERVICE_lib_INCLUDE_DIRS}") +target_include_directories(Server PUBLIC ${Boost_INCLUDE_DIR} ${HTTPSERVER_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} + ${libDbManager_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS}) message("Built server") diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 13257c6..8ad9178 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,9 +1,48 @@ -#include "UserRepository.hpp" -#include "User.hpp" - -//using namespace dotenv; -int main(){ - User user{"qwerty200468@gmail.com", "123", "tolik"}; - UserRepository repo; - std::cout< + +#include + +#include "HttpServer.h" + +namespace net = boost::asio; +using tcp = boost::asio::ip::tcp; + +int main(int argc, char* argv[]) +{ + // Check command line arguments. +// if (argc != 5) +// { +// std::cerr << +// "Usage: http-server-async
\n" << +// "Example:\n" << +// " http-server-async 0.0.0.0 8080 . 1\n"; +// return EXIT_FAILURE; +// } + auto const address = net::ip::make_address("0.0.0.0"); + auto const port = static_cast(std::atoi("8080")); + auto const doc_root = std::make_shared("."); + auto const threads = std::max(1, std::atoi("1")); + + // The io_context is required for all I/O + net::io_context ioc{threads}; + + // Create and launch a listening port + std::make_shared( + ioc, + tcp::endpoint{address, port}, + doc_root + )->run(); + + // Run the I/O service on the requested number of threads + std::vector v; + v.reserve(threads - 1); + for(auto i = threads - 1; i > 0; --i) + v.emplace_back( + [&ioc] + { + ioc.run(); + }); + ioc.run(); + + return EXIT_SUCCESS; } \ No newline at end of file diff --git a/server/internal/CMakeLists.txt b/server/internal/CMakeLists.txt index ef70128..cf13b8a 100644 --- a/server/internal/CMakeLists.txt +++ b/server/internal/CMakeLists.txt @@ -3,6 +3,7 @@ add_subdirectory(dbManager) add_subdirectory(repository) add_subdirectory(metrics) add_subdirectory(service) +add_subdirectory(httpServer) set(libEntities_LIB ${libEntities_LIB} PARENT_SCOPE) @@ -17,7 +18,13 @@ set(libDbManager_INCLUDE_DIRS ${libDbManager_INCLUDE_DIRS} PARENT_SCOPE) set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) set(libRepository_INCLUDE_DIRS ${libRepository_INCLUDE_DIRS} PARENT_SCOPE) +set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) +set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) -set(SERVICE_LIB ${SERVICE_lib_LIBRARY} PARENT_SCOPE) -set(SERVICE_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) +set(HTTPSERVER_LIB ${HTTPSERVER_LIB} PARENT_SCOPE) +set(HTTPSERVER_INCLUDE_DIRS ${HTTPSERVER_INCLUDE_DIRS} PARENT_SCOPE) +set(ALL_INCLUDE_DIRS ${HTTPSERVER_INCLUDE_DIRS}; ${SERVICE_lib_INCLUDE_DIRS}; ${libRepository_INCLUDE_DIRS}; + ${libDbManager_INCLUDE_DIRS}; ${METRICS_lib_INCLUDE_DIRS}; ${libEntities_INCLUDE_DIRS} PARENT_SCOPE) + +message("b = ${SERVICE_lib_INCLUDE_DIRS}") \ No newline at end of file diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index fe9c04d..b319dfd 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -14,7 +14,7 @@ std::shared_ptr dbConnection::connection() const { } void dbConnection::establish_connection() { - pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =172.28.224.1 port = 5432"); + pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =127.0.0.0 port = 5432"); m_connection.reset(&c); } diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index c737bab..a8aeaf3 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -7,7 +7,6 @@ class Solution { public: - Solution() =default; Solution(size_t id, std::string sendDate, size_t senderId, std::string source, std::string tokens, std::string astTree, size_t taskId, std::string result, size_t orig_solution) noexcept; diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt index f9227f4..8dc47b3 100644 --- a/server/internal/httpServer/CMakeLists.txt +++ b/server/internal/httpServer/CMakeLists.txt @@ -6,21 +6,18 @@ file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/virtual/*.h) -include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libEntities_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS}) +include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libRepository_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) add_executable(HttpServer_run main.cpp) -message("SERVICE_lib_LIB = ${SERVICE_lib_LIB}") -message("SERVICE_lib_INCLUDE_DIRS = ${SERVICE_lib_INCLUDE_DIRS}") - target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIB} ${libEntities_LIB} ${Boost_LIBRARIES}) -target_link_libraries(HttpServer_run ${PROJECT_NAME} ${Boost_LIBRARIES}) +target_link_libraries(HttpServer_run ${PROJECT_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${SERVICE_lib_LIB} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) -set(HTTPSERVER_lib_LIB ${PROJECT_NAME}) -set(HTTPSERVER_lib_LIB ${HTTPSERVER_lib_LIB} PARENT_SCOPE) +set(HTTPSERVER_LIB ${PROJECT_NAME}) +set(HTTPSERVER_LIB ${HTTPSERVER_LIB} PARENT_SCOPE) -set(HTTPSERVER_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) -set(HTTPSERVER_lib_INCLUDE_DIRS ${HTTPSERVER_lib_INCLUDE_DIRS} PARENT_SCOPE) +set(HTTPSERVER_INCLUDE_DIRS ${INCLUDE_DIRS}) +set(HTTPSERVER_INCLUDE_DIRS ${HTTPSERVER_INCLUDE_DIRS} PARENT_SCOPE) -enable_testing() -add_subdirectory(tests) \ No newline at end of file +#enable_testing() +#add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/httpServer/include/Header.h b/server/internal/httpServer/include/Header.h deleted file mode 100644 index a3e50dd..0000000 --- a/server/internal/httpServer/include/Header.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef APP_HTTPSERVER_HTTPSERVER_HEADER_H_ -#define APP_HTTPSERVER_HTTPSERVER_HEADER_H_ - -#include - -struct Header { - std::string name; - std::string value; -}; - -#endif // APP_HTTPSERVER_HTTPSERVER_HEADER_H_ diff --git a/server/internal/httpServer/include/Router.h b/server/internal/httpServer/include/Router.h index 404b44d..dc3bb2e 100644 --- a/server/internal/httpServer/include/Router.h +++ b/server/internal/httpServer/include/Router.h @@ -34,9 +34,6 @@ class Router : public std::enable_shared_from_this { std::shared_ptr userManager; std::shared_ptr taskManager; std::string doc_root; - - http::response getBadRequest(const http::request& request, - beast::string_view why); }; diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 19120d1..4ff56df 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -11,7 +11,7 @@ class Serializer { public: - std::tuple deserialNewSolutionData(const std::string& val); + std::tuple deserialNewSolutionData(const std::string& val); std::tuple deserialTaskData(const std::string &val); std::string deserialNewTaskData(const std::string &val); size_t deserialSolutionData(const std::string& val); diff --git a/server/internal/httpServer/include/SolutionManager.h b/server/internal/httpServer/include/SolutionManager.h index 166aee3..5cf0da4 100644 --- a/server/internal/httpServer/include/SolutionManager.h +++ b/server/internal/httpServer/include/SolutionManager.h @@ -7,7 +7,7 @@ #include "Serializer.h" #include "ISolutionManager.h" -#include "ISolutionService.h" +#include "SolutionService.h" namespace beast = boost::beast; namespace http = boost::beast::http; diff --git a/server/internal/httpServer/include/TaskManager.h b/server/internal/httpServer/include/TaskManager.h index 361c7a8..88f1b76 100644 --- a/server/internal/httpServer/include/TaskManager.h +++ b/server/internal/httpServer/include/TaskManager.h @@ -5,7 +5,7 @@ #include "Serializer.h" #include "ITaskManager.h" -#include "ITaskService.h" +#include "TaskService.h" class TaskManager : public ITaskManager { public: diff --git a/server/internal/httpServer/include/TmpSolutionService.h b/server/internal/httpServer/include/TmpSolutionService.h index 63cab8d..263886e 100644 --- a/server/internal/httpServer/include/TmpSolutionService.h +++ b/server/internal/httpServer/include/TmpSolutionService.h @@ -8,7 +8,7 @@ class TmpSolutionService { public: static Solution createSolution(std::size_t user_id, std::size_t task_id, std::string source) { count++; - Solution sol(count, "", user_id, source, "", "", task_id, "ok"); + Solution sol(count, "", user_id, source, "", "", task_id, "ok", 1); for (auto& i: solutions) { if (i.getSource() == source && i.getTaskId() == task_id && i.getSenderId() != user_id) sol.setResult("plagiat"); diff --git a/server/internal/httpServer/include/TmpTaskService.h b/server/internal/httpServer/include/TmpTaskService.h index 90f2f76..bfdb535 100644 --- a/server/internal/httpServer/include/TmpTaskService.h +++ b/server/internal/httpServer/include/TmpTaskService.h @@ -8,7 +8,7 @@ class TmpTaskService { public: static void createTask(std::string description) { count++; - Task task(count, description); + Task task(count, description, 0.5); tasks.push_back(task); } @@ -34,7 +34,7 @@ std::vector TmpTaskService::tasks = {Task(1, "1 description "\n" "\n" "\n" - "14\n"), - Task(2, "2 description"), - Task(3, "3 description")}; + "14\n", 0.5), + Task(2, "2 description", 0.5), + Task(3, "3 description", 0.5)}; std::size_t TmpTaskService::count = 3; \ No newline at end of file diff --git a/server/internal/httpServer/include/UserManager.h b/server/internal/httpServer/include/UserManager.h index 9cf0900..59e0564 100644 --- a/server/internal/httpServer/include/UserManager.h +++ b/server/internal/httpServer/include/UserManager.h @@ -6,7 +6,7 @@ #include "Serializer.h" #include "IUserManager.h" -#include "IUserService.h" +#include "UserService.h" class UserManager : public IUserManager { public: @@ -17,10 +17,6 @@ class UserManager : public IUserManager { private: std::shared_ptr userService; std::shared_ptr serializer; - - // for tests with client - int count = 0; - std::vector users; }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_USERMANAGER_H_ diff --git a/server/internal/httpServer/include/Utils.h b/server/internal/httpServer/include/Utils.h index 8311dc7..a817790 100644 --- a/server/internal/httpServer/include/Utils.h +++ b/server/internal/httpServer/include/Utils.h @@ -4,5 +4,9 @@ #include namespace beast = boost::beast; +namespace http = beast::http; void fail(beast::error_code ec, char const* what); + +http::response getBadRequest(const http::request& request, + beast::string_view why); diff --git a/server/internal/httpServer/main.cpp b/server/internal/httpServer/main.cpp index 8d48c12..8ad9178 100644 --- a/server/internal/httpServer/main.cpp +++ b/server/internal/httpServer/main.cpp @@ -10,18 +10,18 @@ using tcp = boost::asio::ip::tcp; int main(int argc, char* argv[]) { // Check command line arguments. - if (argc != 5) - { - std::cerr << - "Usage: http-server-async
\n" << - "Example:\n" << - " http-server-async 0.0.0.0 8080 . 1\n"; - return EXIT_FAILURE; - } - auto const address = net::ip::make_address(argv[1]); - auto const port = static_cast(std::atoi(argv[2])); - auto const doc_root = std::make_shared(argv[3]); - auto const threads = std::max(1, std::atoi(argv[4])); +// if (argc != 5) +// { +// std::cerr << +// "Usage: http-server-async
\n" << +// "Example:\n" << +// " http-server-async 0.0.0.0 8080 . 1\n"; +// return EXIT_FAILURE; +// } + auto const address = net::ip::make_address("0.0.0.0"); + auto const port = static_cast(std::atoi("8080")); + auto const doc_root = std::make_shared("."); + auto const threads = std::max(1, std::atoi("1")); // The io_context is required for all I/O net::io_context ioc{threads}; diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index 88d83c2..ea5821e 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -5,17 +5,6 @@ #include "Utils.h" -http::response Router::getBadRequest(const http::request& request, - beast::string_view why) { - http::response res{http::status::bad_request, request.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(request.keep_alive()); - res.body() = std::string(why); - res.prepare_payload(); - return res; -} - Router::Router(std::string_view doc_root_) : solutionManager(std::make_shared()), userManager(std::make_shared()), diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index 8d1905c..9dc7ffc 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -4,15 +4,17 @@ #include #include -std::tuple Serializer::deserialNewSolutionData(const std::string &val) { +std::tuple +Serializer::deserialNewSolutionData(const std::string &val) { std::stringstream ss; ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - std::tuple res = { + std::tuple res = { json.get("user_id"), - json.get("source"), - json.get("task_id") + json.get("task_id"), + json.get("filename"), + json.get("filedata") }; return res; } diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index c85dc98..fe73593 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -3,11 +3,15 @@ // #include "SolutionManager.h" +#include #include +#include "SolutionService.h" #include "TmpSolutionService.h" +#include "Utils.h" SolutionManager::SolutionManager() : - serializer(std::make_shared()) {}; + serializer(std::make_shared()), + solutionService(std::make_shared()) {}; void SolutionManager::setService(std::shared_ptr service) { solutionService = std::move(service); @@ -15,24 +19,30 @@ void SolutionManager::setService(std::shared_ptr service) { http::message_generator SolutionManager::createSolution(http::request&& req) { size_t user_id, task_id; - std::string source; - std::tie(user_id, source, task_id) = serializer->deserialNewSolutionData(req.body()); - Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); -// sol = solutionService->createSolution(user_id, task_id, source); - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(req.keep_alive()); - res.body() = serializer->serialSolution(sol); - res.prepare_payload(); - return res; + std::string filename, filedata; + std::tie(user_id, task_id, filename, filedata) = serializer->deserialNewSolutionData(req.body()); +// Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); + try { + Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata); + + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialSolution(sol); + res.prepare_payload(); + return res; + + } catch (const std::exception& e) { + return getBadRequest(req, e.what()); + } } http::message_generator SolutionManager::getAllSolutions(http::request&& req) { size_t user_id, task_id; std::tie(user_id, task_id) = serializer->deserialTaskData(req.body()); std::vector solutions; - solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); +// solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index 91ca64b..657c883 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -2,9 +2,13 @@ // Created by Николай Степанов on 03.05.2023. // #include "TaskManager.h" +#include "TaskService.h" #include "TmpTaskService.h" +#include "Utils.h" -TaskManager::TaskManager() : serializer(std::make_shared()) {} +TaskManager::TaskManager() : + serializer(std::make_shared()), + taskService(std::make_shared()){} void TaskManager::setService(std::shared_ptr service) { taskService = service; @@ -12,24 +16,34 @@ void TaskManager::setService(std::shared_ptr service) { http::message_generator TaskManager::createTask(http::request &&req) { std::string description = serializer->deserialNewTaskData(req.body()); -// taskService->createTask(description); - TmpTaskService::createTask(description); - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(req.keep_alive()); - res.prepare_payload(); - return res; + + try { + + taskService->createTask(description, 0.5); +// TmpTaskService::createTask(description); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.prepare_payload(); + return res; + } catch (...) { + return getBadRequest(req, "Something went wrong!"); + } } http::message_generator TaskManager::getAllTasks(http::request &&req) { -// std::vector tasks = taskService->getAllTasks(); - std::vector tasks = TmpTaskService::getAllTasks(); - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(req.keep_alive()); - res.body() = serializer->serialAllTasks(tasks); - res.prepare_payload(); - return res; + try { + std::vector tasks = taskService->getAllTasks(); +// std::vector tasks = TmpTaskService::getAllTasks(); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialAllTasks(tasks); + res.prepare_payload(); + return res; + } catch (...) { + return getBadRequest(req, "Something went wrong!"); + } } diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index dcff74b..8fe3ac9 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -1,8 +1,11 @@ #include "UserManager.h" #include "TmpUserService.h" +#include "Utils.h" -UserManager::UserManager() : serializer(std::make_shared()) {} +UserManager::UserManager() : + serializer(std::make_shared()), + userService(std::make_shared()) {}; void UserManager::setService(std::shared_ptr service) { userService = service; @@ -12,13 +15,22 @@ http::message_generator UserManager::loginUser(http::request std::string login, password; std::tie(login, password) = serializer->deserialUserData(req.body()); - auto result = TmpUserService::login(login, password); - if (result.second) { + + User user; + bool flag = true; + + try { + auto result = userService->login(login, password); + } catch (...) { + flag = false; + } + + if (flag) { http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = serializer->serialUserData(result.first); + res.body() = serializer->serialUserData(user); res.prepare_payload(); return res; } else { @@ -26,7 +38,7 @@ http::message_generator UserManager::loginUser(http::request res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = serializer->serialUserData(result.first); + res.body() = serializer->serialUserData(user); res.prepare_payload(); return res; } @@ -34,14 +46,18 @@ http::message_generator UserManager::loginUser(http::request http::message_generator UserManager::registerUser(http::request &&req) { std::string login, password, username; - std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); -// User user = userService->createUser(login, username, password); - User user = TmpUserService::registerUser(login, password, username); - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(req.keep_alive()); - res.body() = serializer->serialUserData(user); - res.prepare_payload(); - return res; + std::tie(login, password, username) = serializer->deserialNewUserData(req.body());\ + + try { + User user = userService->createUser(login, username, password); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialUserData(user); + res.prepare_payload(); + return res; + } catch (...) { + return getBadRequest(req, "Something went wrong!"); + } } diff --git a/server/internal/httpServer/src/Utils.cpp b/server/internal/httpServer/src/Utils.cpp index 416b658..18d89ae 100644 --- a/server/internal/httpServer/src/Utils.cpp +++ b/server/internal/httpServer/src/Utils.cpp @@ -4,3 +4,14 @@ void fail(beast::error_code ec, const char *what) { std::cerr << what << ": " << ec.message() << "\n"; } + +http::response getBadRequest(const http::request& request, + beast::string_view why) { + http::response res{http::status::bad_request, request.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(request.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; +} diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 05699f7..1f30816 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -22,5 +22,5 @@ set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) -enable_testing() -add_subdirectory(tests) \ No newline at end of file +#enable_testing() +#add_subdirectory(tests) \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 2ccd201..06524eb 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -11,7 +11,7 @@ #include "TextMetricsLib.h" #include "TokenMetricLib.h" -class SolutionService : ISolutionService { +class SolutionService : public ISolutionService { private: std::unique_ptr solutionRepo; std::unique_ptr taskRepo; @@ -28,13 +28,13 @@ class SolutionService : ISolutionService { std::pair getMaxTokenResMetric( std::vector& solutions, const std::string& tokens, - float treshold); + float treshold) {}; public: - explicit SolutionService(std::unique_ptr solutionRepo, - std::unique_ptr taskRepo); +// explicit SolutionService(std::unique_ptr solutionRepo, +// std::unique_ptr taskRepo); SolutionService(); - void setMetrics(std::unique_ptr metrics_); + void setMetrics(std::unique_ptr metrics_) {}; Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) override; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index d826e9a..7be361f 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -10,7 +10,7 @@ class TaskService : public ITaskService { std::unique_ptr taskRepo; public: - TaskService(std::unique_ptr taskRepo); +// TaskService(std::unique_ptr taskRepo); TaskService(); Task createTask(const std::string& desc, float treshold = 0.5f) override; Task getTask(size_t id) override; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index 9a26617..c9c0e82 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -5,12 +5,12 @@ #include "IUserService.h" #include "UserValidator.h" -class UserService : IUserService { +class UserService : public IUserService { private: std::unique_ptr userRepo; public: - explicit UserService(std::unique_ptr userRepo); +// explicit UserService(std::unique_ptr userRepo); UserService(); User createUser(const std::string& login, const std::string& username, const std::string& password) override; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 231d0a1..7f416f6 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -14,10 +14,10 @@ const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Пл const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; -SolutionService::SolutionService( - std::unique_ptr solutionRepo, - std::unique_ptr taskRepo) - : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} +//SolutionService::SolutionService( +// std::unique_ptr solutionRepo, +// std::unique_ptr taskRepo) +// : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} SolutionService::SolutionService() { solutionRepo = std::make_unique(); diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 1e1f445..9103ca4 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -1,8 +1,8 @@ #include "TaskService.h" #include "TaskRepository.hpp" -TaskService::TaskService(std::unique_ptr taskRepo) - : taskRepo(std::move(taskRepo)) {} +//TaskService::TaskService(std::unique_ptr taskRepo) +// : taskRepo(std::move(taskRepo)) {} TaskService::TaskService() { taskRepo = std::make_unique(); } diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index ab9f3a6..c7c745a 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -4,8 +4,8 @@ #include "UserValidator.h" #include "UserRepository.hpp" -UserService::UserService(std::unique_ptr userRepo) - : userRepo(std::move(userRepo)) {} +//UserService::UserService(std::unique_ptr userRepo) +// : userRepo(std::move(userRepo)) {} UserService::UserService() { userRepo = std::make_unique(); diff --git a/server/pkg/CMakeLists.txt b/server/pkg/CMakeLists.txt index f105ad5..b1b2099 100644 --- a/server/pkg/CMakeLists.txt +++ b/server/pkg/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory(antlr) - -set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) -set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) +add_subdirectory(antlr) + +set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) +set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/server/pkg/antlr/CMakeLists.txt b/server/pkg/antlr/CMakeLists.txt index 7c69be3..0d97574 100644 --- a/server/pkg/antlr/CMakeLists.txt +++ b/server/pkg/antlr/CMakeLists.txt @@ -1,27 +1,27 @@ -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -set(CMAKE_CXX_STANDARD 20) - - -# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread") -set(THREADS_PREFER_PTHREAD_FLAG ON) - - -include(ExternalAntlr4Cpp) -include_directories(${ANTLR4_INCLUDE_DIRS}) - - -set(ANTLR_EXECUTABLE /usr/local/lib/antlr-4.12.0-complete.jar) -find_package(ANTLR REQUIRED) - -add_subdirectory(cpp14) -add_subdirectory(python3) - -message("CPP_ANTLR_LIBRARY=${CPP_ANTLR_LIBRARY}") -message("PYTHON3_ANTLR_LIBRARY=${PYTHON3_ANTLR_LIBRARY}") - -set(ANTLR4_LIB ${CPP_ANTLR_LIBRARY} ${PYTHON3_ANTLR_LIBRARY}) -set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) -set(ANTLR4_LIB_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} ${PYTHON3_ANTLR_INCLUDE_DIRS}) -set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) - +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + +set(CMAKE_CXX_STANDARD 20) + + +# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-lpthread") +set(THREADS_PREFER_PTHREAD_FLAG ON) + + +include(ExternalAntlr4Cpp) +include_directories(${ANTLR4_INCLUDE_DIRS}) + + +set(ANTLR_EXECUTABLE /usr/local/lib/antlr-4.12.0-complete.jar) +find_package(ANTLR REQUIRED) + +add_subdirectory(cpp14) +add_subdirectory(python3) + +message("CPP_ANTLR_LIBRARY=${CPP_ANTLR_LIBRARY}") +message("PYTHON3_ANTLR_LIBRARY=${PYTHON3_ANTLR_LIBRARY}") + +set(ANTLR4_LIB ${CPP_ANTLR_LIBRARY} ${PYTHON3_ANTLR_LIBRARY}) +set(ANTLR4_LIB ${ANTLR4_LIB} PARENT_SCOPE) +set(ANTLR4_LIB_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} ${PYTHON3_ANTLR_INCLUDE_DIRS}) +set(ANTLR4_LIB_INCLUDE_DIRS ${ANTLR4_LIB_INCLUDE_DIRS} PARENT_SCOPE) + diff --git a/server/pkg/antlr/cpp14/CMakeLists.txt b/server/pkg/antlr/cpp14/CMakeLists.txt index 5c3100f..30e332d 100644 --- a/server/pkg/antlr/cpp14/CMakeLists.txt +++ b/server/pkg/antlr/cpp14/CMakeLists.txt @@ -1,33 +1,33 @@ -cmake_minimum_required(VERSION 3.7) -project(cpp_antlr_lib) - -file(GLOB SOURCES ./src/*.cpp) -file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) - - -antlr_target(CPP14GrammarLexer CPP14Lexer.g4 LEXER - PACKAGE antlrcpptest) -antlr_target(CPP14GrammarParser CPP14Parser.g4 PARSER - PACKAGE antlrcpptest - DEPENDS_ANTLR CPP14GrammarLexer - COMPILE_FLAGS -lib ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) - -include_directories(${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) -include_directories(${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) - - -message("ANTLR_CPP14GrammarParser_OUTPUT_DIR=${ANTLR_CPP14GrammarParser_OUTPUT_DIR}") - -include_directories(${INCLUDE_DIRS}) -add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_CPP14GrammarLexer_CXX_OUTPUTS} ${ANTLR_CPP14GrammarParser_CXX_OUTPUTS}) - - -target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) - -set(CPP_ANTLR_LIBRARY ${PROJECT_NAME}) -set(CPP_ANTLR_LIBRARY ${CPP_ANTLR_LIBRARY} PARENT_SCOPE) - -set(CPP_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR} ${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) -set(CPP_ANTLR_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) - +cmake_minimum_required(VERSION 3.7) +project(cpp_antlr_lib) + +file(GLOB SOURCES ./src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) + + +antlr_target(CPP14GrammarLexer CPP14Lexer.g4 LEXER + PACKAGE antlrcpptest) +antlr_target(CPP14GrammarParser CPP14Parser.g4 PARSER + PACKAGE antlrcpptest + DEPENDS_ANTLR CPP14GrammarLexer + COMPILE_FLAGS -lib ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) + +include_directories(${ANTLR_CPP14GrammarLexer_OUTPUT_DIR}) +include_directories(${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) + + +message("ANTLR_CPP14GrammarParser_OUTPUT_DIR=${ANTLR_CPP14GrammarParser_OUTPUT_DIR}") + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_CPP14GrammarLexer_CXX_OUTPUTS} ${ANTLR_CPP14GrammarParser_CXX_OUTPUTS}) + + +target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) + +set(CPP_ANTLR_LIBRARY ${PROJECT_NAME}) +set(CPP_ANTLR_LIBRARY ${CPP_ANTLR_LIBRARY} PARENT_SCOPE) + +set(CPP_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_CPP14GrammarLexer_OUTPUT_DIR} ${ANTLR_CPP14GrammarParser_OUTPUT_DIR}) +set(CPP_ANTLR_INCLUDE_DIRS ${CPP_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) + message("CPP_ANTLR = ${CPP_ANTLR_INCLUDE_DIRS} ") \ No newline at end of file diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 59c7336..d09d1bb 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -1,26 +1,26 @@ -#pragma once - -#include -#include -#include - -#include "CPP14Lexer.h" -#include "CPP14Parser.h" -#include "IAntlrWrapper.h" -#include "antlr4-runtime.h" - -class MyCppAntlr:public IAntlrWrapper { - private: - std::unique_ptr lexer_ptr; - std::unique_ptr parser_ptr; - std::unique_ptr input_ptr; - std::unique_ptr tokenStream_ptr; - - public: - MyCppAntlr(std::istream &in); - ~MyCppAntlr() override = default; - std::vector getTokensArray() override; - std::pair getTokensAndTree() override; - std::string getTokensString() override; - std::string getTreeString() override; -}; +#pragma once + +#include +#include +#include + +#include "CPP14Lexer.h" +#include "CPP14Parser.h" +#include "IAntlrWrapper.h" +#include "antlr4-runtime.h" + +class MyCppAntlr:public IAntlrWrapper { + private: + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; + + public: + MyCppAntlr(std::istream &in); + ~MyCppAntlr() override = default; + std::vector getTokensArray() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; + std::string getTreeString() override; +}; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 6a5ac79..d6fc13b 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -1,45 +1,45 @@ -#include "MyCppAntlr.h" - -#include - -MyCppAntlr::MyCppAntlr(std::istream& in) { - input_ptr = std::make_unique(in); - lexer_ptr = std::make_unique(&(*input_ptr)); - tokenStream_ptr = std::make_unique(&(*lexer_ptr)); - parser_ptr = std::make_unique(&(*tokenStream_ptr)); -} - -std::vector MyCppAntlr::getTokensArray() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); - - int i = 0; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->toString(); - i++; - } - - return ans; -} - -std::string MyCppAntlr::getTokensString() { - tokenStream_ptr->fill(); - std::string res; - - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - res += token->toString()+" "; - } - - return res; -} - -std::string MyCppAntlr::getTreeString() { - auto tree = parser_ptr->translationUnit(); - return tree->toStringTree(&(*parser_ptr)); -} - -std::pair MyCppAntlr::getTokensAndTree() { - std::string tokens = getTokensString(); - std::string astTree = getTreeString(); - return std::make_pair(tokens, astTree); +#include "MyCppAntlr.h" + +#include + +MyCppAntlr::MyCppAntlr(std::istream& in) { + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); +} + +std::vector MyCppAntlr::getTokensArray() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->toString(); + i++; + } + + return ans; +} + +std::string MyCppAntlr::getTokensString() { + tokenStream_ptr->fill(); + std::string res; + + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString()+" "; + } + + return res; +} + +std::string MyCppAntlr::getTreeString() { + auto tree = parser_ptr->translationUnit(); + return tree->toStringTree(&(*parser_ptr)); +} + +std::pair MyCppAntlr::getTokensAndTree() { + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); } \ No newline at end of file diff --git a/server/pkg/antlr/python3/CMakeLists.txt b/server/pkg/antlr/python3/CMakeLists.txt index e60ee23..4a90e0b 100644 --- a/server/pkg/antlr/python3/CMakeLists.txt +++ b/server/pkg/antlr/python3/CMakeLists.txt @@ -1,28 +1,28 @@ -cmake_minimum_required(VERSION 3.7) -project(python_antlr_lib) - -file(GLOB SOURCES ./src/*.cpp) -file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) - - -antlr_target(Python3Grammar Python3.g4 - PACKAGE antlrcpptest) - -include_directories(${ANTLR_Python3Grammar_OUTPUT_DIR}) - - -message("ANTLR_Python3Grammar_OUTPUT_DIR=${ANTLR_Python3Grammar_OUTPUT_DIR}") - -include_directories(${INCLUDE_DIRS}) -add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_Python3Grammar_CXX_OUTPUTS}) - - -target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) - -set(PYTHON3_ANTLR_LIBRARY ${PROJECT_NAME}) -set(PYTHON3_ANTLR_LIBRARY ${PYTHON3_ANTLR_LIBRARY} PARENT_SCOPE) - -set(PYTHON3_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_Python3Grammar_OUTPUT_DIR}) -set(PYTHON3_ANTLR_INCLUDE_DIRS ${PYTHON3_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) - +cmake_minimum_required(VERSION 3.7) +project(python_antlr_lib) + +file(GLOB SOURCES ./src/*.cpp) +file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../virtual) + + +antlr_target(Python3Grammar Python3.g4 + PACKAGE antlrcpptest) + +include_directories(${ANTLR_Python3Grammar_OUTPUT_DIR}) + + +message("ANTLR_Python3Grammar_OUTPUT_DIR=${ANTLR_Python3Grammar_OUTPUT_DIR}") + +include_directories(${INCLUDE_DIRS}) +add_library(${PROJECT_NAME} ${SOURCES} ${ANTLR_Python3Grammar_CXX_OUTPUTS}) + + +target_link_libraries(${PROJECT_NAME} antlr4_static Threads::Threads) + +set(PYTHON3_ANTLR_LIBRARY ${PROJECT_NAME}) +set(PYTHON3_ANTLR_LIBRARY ${PYTHON3_ANTLR_LIBRARY} PARENT_SCOPE) + +set(PYTHON3_ANTLR_INCLUDE_DIRS ${INCLUDE_DIRS} ${ANTLR_Python3Grammar_OUTPUT_DIR}) +set(PYTHON3_ANTLR_INCLUDE_DIRS ${PYTHON3_ANTLR_INCLUDE_DIRS} PARENT_SCOPE) + message("PYTHON3_ANTLR = ${PYTHON3_ANTLR_INCLUDE_DIRS} ") \ No newline at end of file diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index 32116a8..4f4e1a4 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -1,26 +1,26 @@ -#pragma once - -#include -#include -#include - -#include "Python3Lexer.h" -#include "Python3Parser.h" -#include "IAntlrWrapper.h" -#include "antlr4-runtime.h" - -class PythonAntlr:public IAntlrWrapper { - private: - std::unique_ptr lexer_ptr; - std::unique_ptr parser_ptr; - std::unique_ptr input_ptr; - std::unique_ptr tokenStream_ptr; - - public: - PythonAntlr(std::istream &in); - ~PythonAntlr() override = default; - std::vector getTokensArray() override; - std::pair getTokensAndTree() override; - std::string getTokensString() override; - std::string getTreeString() override; +#pragma once + +#include +#include +#include + +#include "Python3Lexer.h" +#include "Python3Parser.h" +#include "IAntlrWrapper.h" +#include "antlr4-runtime.h" + +class PythonAntlr:public IAntlrWrapper { + private: + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; + + public: + PythonAntlr(std::istream &in); + ~PythonAntlr() override = default; + std::vector getTokensArray() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; + std::string getTreeString() override; }; \ No newline at end of file diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index 7c5417e..8927947 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -1,45 +1,45 @@ -#include "PythonAntlr.h" - -#include - -PythonAntlr::PythonAntlr(std::istream& in) { - input_ptr = std::make_unique(in); - lexer_ptr = std::make_unique(&(*input_ptr)); - tokenStream_ptr = std::make_unique(&(*lexer_ptr)); - parser_ptr = std::make_unique(&(*tokenStream_ptr)); -} - -std::vector PythonAntlr::getTokensArray() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); - - int i = 0; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->toString(); - i++; - } - - return ans; -} - -std::string PythonAntlr::getTokensString() { - tokenStream_ptr->fill(); - std::string res; - - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - res += token->toString()+" "; - } - - return res; -} - -std::string PythonAntlr::getTreeString() { - auto tree = parser_ptr->file_input(); - return tree->toStringTree(&(*parser_ptr)); -} - -std::pair PythonAntlr::getTokensAndTree() { - std::string tokens = getTokensString(); - std::string astTree = getTreeString(); - return std::make_pair(tokens, astTree); +#include "PythonAntlr.h" + +#include + +PythonAntlr::PythonAntlr(std::istream& in) { + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); +} + +std::vector PythonAntlr::getTokensArray() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->toString(); + i++; + } + + return ans; +} + +std::string PythonAntlr::getTokensString() { + tokenStream_ptr->fill(); + std::string res; + + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString()+" "; + } + + return res; +} + +std::string PythonAntlr::getTreeString() { + auto tree = parser_ptr->file_input(); + return tree->toStringTree(&(*parser_ptr)); +} + +std::pair PythonAntlr::getTokensAndTree() { + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); } \ No newline at end of file diff --git a/server/pkg/antlr/testprogs/python/test.py b/server/pkg/antlr/testprogs/python/test.py index 327d900..b385b2a 100644 --- a/server/pkg/antlr/testprogs/python/test.py +++ b/server/pkg/antlr/testprogs/python/test.py @@ -1,7 +1,7 @@ -var_1 = 1567 -reverse = 0 -while var_1 > 0: - rest = var_1 % 10 - reverse = reverse * 10 + rest - var_1 = var_1 // 10 +var_1 = 1567 +reverse = 0 +while var_1 > 0: + rest = var_1 % 10 + reverse = reverse * 10 + rest + var_1 = var_1 // 10 print("Число в обратном порядке:", reverse) \ No newline at end of file diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index 61958f7..9efb997 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -1,13 +1,13 @@ -#pragma once - -#include -#include - -class IAntlrWrapper { - public: - virtual ~IAntlrWrapper() = default; - virtual std::vector getTokensArray() = 0; - virtual std::pair getTokensAndTree()=0; - virtual std::string getTokensString() = 0; - virtual std::string getTreeString() = 0; -}; +#pragma once + +#include +#include + +class IAntlrWrapper { + public: + virtual ~IAntlrWrapper() = default; + virtual std::vector getTokensArray() = 0; + virtual std::pair getTokensAndTree()=0; + virtual std::string getTokensString() = 0; + virtual std::string getTreeString() = 0; +}; -- GitLab From d232311dac854fc05be61609c25062828800b87a Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 16 May 2023 16:07:04 +0300 Subject: [PATCH 078/134] split tests to 2 files --- server/internal/metrics/tests/CMakeLists.txt | 4 +- server/internal/metrics/tests/src/main.cpp | 13 +++ .../metrics/tests/src/text_metrics_tests.cpp | 87 ----------------- .../metrics/tests/src/token_metrics_tests.cpp | 93 +++++++++++++++++++ 4 files changed, 109 insertions(+), 88 deletions(-) create mode 100644 server/internal/metrics/tests/src/main.cpp create mode 100644 server/internal/metrics/tests/src/token_metrics_tests.cpp diff --git a/server/internal/metrics/tests/CMakeLists.txt b/server/internal/metrics/tests/CMakeLists.txt index 1bdfef1..0b5a55d 100644 --- a/server/internal/metrics/tests/CMakeLists.txt +++ b/server/internal/metrics/tests/CMakeLists.txt @@ -1,4 +1,6 @@ -add_executable(metrics_test src/text_metrics_tests.cpp) +file(GLOB SOURCES src/*.cpp) + +add_executable(metrics_test ${SOURCES}) target_link_libraries(metrics_test MetricsLib GTest::gtest_main GTest::gmock) diff --git a/server/internal/metrics/tests/src/main.cpp b/server/internal/metrics/tests/src/main.cpp new file mode 100644 index 0000000..70cfa61 --- /dev/null +++ b/server/internal/metrics/tests/src/main.cpp @@ -0,0 +1,13 @@ +// +// Created by march on 16.05.2023. +// + +#include +#include + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/server/internal/metrics/tests/src/text_metrics_tests.cpp b/server/internal/metrics/tests/src/text_metrics_tests.cpp index 1014fec..aae644d 100644 --- a/server/internal/metrics/tests/src/text_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/text_metrics_tests.cpp @@ -9,7 +9,6 @@ #include #include "TextMetricsLib.h" -#include "TokenMetricLib.h" class LevDistTextMetricTest : public ::testing::Test { protected: @@ -29,26 +28,6 @@ protected: void TearDown(){} }; -class LevDistTokenMetricTest : public ::testing::Test { -protected: - std::unique_ptr levDistTokenMetric; - void SetUp(){ - levDistTokenMetric = std::make_unique (); - } - void TearDown(){} -}; - -class WShinglingTokenMetricTest : public ::testing::Test { -protected: - std::unique_ptr wShinglingTokenMetric; - void SetUp(){ - wShinglingTokenMetric = std::make_unique (); - } - void TearDown(){} -}; - - - TEST_F(LevDistTextMetricTest, check_eq_progs) { std::ifstream fin1; fin1.open("src/test-codes/code1.txt"); @@ -105,69 +84,3 @@ TEST_F(JaccardTextMetricTest, test_with_empty_prog) { -TEST_F(LevDistTokenMetricTest, check_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; - - levDistTokenMetric->setData(tokens1, tokens1); - - EXPECT_EQ(levDistTokenMetric->getMetric(), 1); -} - -TEST_F(LevDistTokenMetricTest, check_absolutely_not_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {3, 4, 5, 6}; - - levDistTokenMetric->setData(tokens1, tokens2); - - EXPECT_EQ(levDistTokenMetric->getMetric() < 0.5, true); -} - -TEST_F(LevDistTokenMetricTest, test_with_empty_prog) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {}; - - levDistTokenMetric->setData(tokens1, tokens2); - - EXPECT_EQ(levDistTokenMetric->getMetric(), 0); -} - -TEST_F(WShinglingTokenMetricTest, check_eq_progs){ - - std::vector tokens1 = {1, 2, 3, 4, 5, 6}; - std::vector tokens2 = {1, 2, 3, 4, 5, 6}; - - wShinglingTokenMetric->setData(tokens1, tokens1); - - EXPECT_EQ(wShinglingTokenMetric->getMetric(), 1); -} - -TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {4, 5, 6, 1}; - - wShinglingTokenMetric->setData(tokens1, tokens1); - - EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); -} - -TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {}; - - wShinglingTokenMetric->setData(tokens1, tokens1); - - EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); -} - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} - diff --git a/server/internal/metrics/tests/src/token_metrics_tests.cpp b/server/internal/metrics/tests/src/token_metrics_tests.cpp new file mode 100644 index 0000000..0e50eed --- /dev/null +++ b/server/internal/metrics/tests/src/token_metrics_tests.cpp @@ -0,0 +1,93 @@ +// +// Created by march on 16.05.2023. +// + +#include +#include + +#include +#include + +#include "TokenMetricLib.h" + +class LevDistTokenMetricTest : public ::testing::Test { +protected: + std::unique_ptr levDistTokenMetric; + void SetUp(){ + levDistTokenMetric = std::make_unique (); + } + void TearDown(){} +}; + +class WShinglingTokenMetricTest : public ::testing::Test { +protected: + std::unique_ptr wShinglingTokenMetric; + void SetUp(){ + wShinglingTokenMetric = std::make_unique (); + } + void TearDown(){} +}; + +TEST_F(LevDistTokenMetricTest, check_eq_progs) { + + std::vector tokens1 = {1, 2, 3}; + + levDistTokenMetric->setData(tokens1, tokens1); + + EXPECT_EQ(levDistTokenMetric->getMetric(), 1); +} + +TEST_F(LevDistTokenMetricTest, check_absolutely_not_eq_progs) { + + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {3, 4, 5, 6}; + + levDistTokenMetric->setData(tokens1, tokens2); + + EXPECT_EQ(levDistTokenMetric->getMetric() < 0.5, true); +} + +TEST_F(LevDistTokenMetricTest, test_with_empty_prog) { + + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; + + levDistTokenMetric->setData(tokens1, tokens2); + + EXPECT_EQ(levDistTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, check_eq_progs){ + + std::vector tokens1 = {1, 2, 3, 4, 5, 6}; + std::vector tokens2 = {1, 2, 3, 4, 5, 6}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 1); +} + +TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { + + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {4, 5, 6, 1}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { + + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; + + wShinglingTokenMetric->setData(tokens1, tokens1); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + + + + + -- GitLab From d0b97f8f38b298c7c32c06ea046847b0ec25f08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 16 May 2023 16:27:02 +0300 Subject: [PATCH 079/134] add finding of libpqxx --- server/CMakeLists.txt | 1 + server/internal/httpServer/CMakeLists.txt | 11 +++++++++-- server/internal/service/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index f608f66..0a3eefb 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -12,6 +12,7 @@ ELSE() ENDIF() find_library(PQXX_LIB pqxx) +find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt index 8dc47b3..0a6a4e3 100644 --- a/server/internal/httpServer/CMakeLists.txt +++ b/server/internal/httpServer/CMakeLists.txt @@ -10,8 +10,15 @@ include_directories(${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libRepository_INCLUDE add_library(${PROJECT_NAME} ${SOURCES} ${INCLUDES}) add_executable(HttpServer_run main.cpp) -target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIB} ${libEntities_LIB} ${Boost_LIBRARIES}) -target_link_libraries(HttpServer_run ${PROJECT_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${SERVICE_lib_LIB} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) +target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIBRARY} ${libEntities_LIB} ${Boost_LIBRARIES}) + +message("a = ${SERVICE_lib_LIBRARY}") +message("a = ${libRepository_LIB}") +message("a = ${libEntities_LIB}") +message("a = ${ANTLR4_LIB}") +message("a = ${METRICS_LIBRARY}") + +target_link_libraries(HttpServer_run ${libpqxx_LIBRARIES} ${Boost_LIBRARIES} ${PROJECT_NAME} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) set(HTTPSERVER_LIB ${PROJECT_NAME}) set(HTTPSERVER_LIB ${HTTPSERVER_LIB} PARENT_SCOPE) diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 1f30816..927bdce 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -14,7 +14,7 @@ message("METRICS_lib_INCLUDE_DIRS=${METRICS_lib_INCLUDE_DIRS}") message("METRICS_LIBRARY=${METRICS_LIBRARY}") target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) +target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY} ${libpqxx_LIBRARIES}) set(SERVICE_lib_LIBRARY ${PROJECT_NAME}) set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) -- GitLab From 19920af3c026d7921d32e5bea593c4d79d122485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 16 May 2023 17:00:38 +0300 Subject: [PATCH 080/134] fix linking --- Makefile | 3 ++- server/CMakeLists.txt | 2 +- server/cmd/CMakeLists.txt | 26 +++++++++---------- server/internal/dbManager/CMakeLists.txt | 2 +- .../internal/dbManager/src/dbConnection.cpp | 2 +- server/internal/httpServer/CMakeLists.txt | 2 +- server/internal/httpServer/main.cpp | 3 +++ server/internal/httpServer/src/Router.cpp | 2 ++ server/internal/repository/CMakeLists.txt | 2 +- server/internal/service/CMakeLists.txt | 2 +- 10 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e5803ac..88a10d0 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ clean: rebuild: clean generate build-project server-run: - ./build/server/cmd/Server + ./build/server/internal/httpServer/HttpServer_run test: ctest --verbose --output-on-failure --test-dir build/ @@ -20,6 +20,7 @@ dev: docker run --rm -it \ -v $(PWD):/project \ --name app \ + -p 8080:8080 \ raiden454/cpp-app stop-docker: diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 0a3eefb..0239a93 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -12,7 +12,7 @@ ELSE() ENDIF() find_library(PQXX_LIB pqxx) -find_package(libpqxx REQUIRED) +#find_package(libpqxx REQUIRED) find_package(GTest REQUIRED) find_package(nlohmann_json REQUIRED) message(STATUS ${nlohmann_json_LIBRARIES}) diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index 2f92a68..331691f 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -1,13 +1,13 @@ -set(PROJECT_NAME "Server") - -project(${PROJECT_NAME}) - -add_executable(Server main.cpp) -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${HTTPSERVER_LIB} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} - ${libDbManager_LIB} ${METRICS_lib_LIBRARY} ${libEntities_LIB} ${ANTLR4_LIB_LIB} ${libpqxx_LIBRARIES}) -message("a = ${SERVICE_lib_INCLUDE_DIRS}") -target_include_directories(Server PUBLIC ${Boost_INCLUDE_DIR} ${HTTPSERVER_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} - ${libDbManager_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS}) - -message("Built server") - +#set(PROJECT_NAME "Server") +# +#project(${PROJECT_NAME}) +# +#add_executable(Server main.cpp) +#target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${HTTPSERVER_LIB} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} +# ${libDbManager_LIB} ${METRICS_lib_LIBRARY} ${libEntities_LIB} ${ANTLR4_LIB_LIB} ${libpqxx_LIBRARIES}) +#message("a = ${SERVICE_lib_INCLUDE_DIRS}") +#target_include_directories(Server PUBLIC ${Boost_INCLUDE_DIR} ${HTTPSERVER_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} +# ${libDbManager_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS}) +# +#message("Built server") +# diff --git a/server/internal/dbManager/CMakeLists.txt b/server/internal/dbManager/CMakeLists.txt index 3299f96..9bb5cfa 100644 --- a/server/internal/dbManager/CMakeLists.txt +++ b/server/internal/dbManager/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lboost_filesystem") add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES}) +target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${PQXX_LIB}) set(libDbManager_LIB ${LIB_NAME}) set(libDbManager_LIB ${libDbManager_LIB} PARENT_SCOPE) diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index b319dfd..e89f6e7 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -14,7 +14,7 @@ std::shared_ptr dbConnection::connection() const { } void dbConnection::establish_connection() { - pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =127.0.0.0 port = 5432"); + pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =127.0.0.1 port = 5432"); m_connection.reset(&c); } diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt index 0a6a4e3..75b3e0d 100644 --- a/server/internal/httpServer/CMakeLists.txt +++ b/server/internal/httpServer/CMakeLists.txt @@ -18,7 +18,7 @@ message("a = ${libEntities_LIB}") message("a = ${ANTLR4_LIB}") message("a = ${METRICS_LIBRARY}") -target_link_libraries(HttpServer_run ${libpqxx_LIBRARIES} ${Boost_LIBRARIES} ${PROJECT_NAME} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) +target_link_libraries(HttpServer_run ${PQXX_LIB} ${Boost_LIBRARIES} ${PROJECT_NAME} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY}) set(HTTPSERVER_LIB ${PROJECT_NAME}) set(HTTPSERVER_LIB ${HTTPSERVER_LIB} PARENT_SCOPE) diff --git a/server/internal/httpServer/main.cpp b/server/internal/httpServer/main.cpp index 8ad9178..a4b3e8e 100644 --- a/server/internal/httpServer/main.cpp +++ b/server/internal/httpServer/main.cpp @@ -18,6 +18,9 @@ int main(int argc, char* argv[]) // " http-server-async 0.0.0.0 8080 . 1\n"; // return EXIT_FAILURE; // } + + std::cout << "SERVER RUN" << std::endl; + auto const address = net::ip::make_address("0.0.0.0"); auto const port = static_cast(std::atoi("8080")); auto const doc_root = std::make_shared("."); diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index ea5821e..617dd96 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -22,6 +22,8 @@ http::message_generator Router::handleRequest(http::request & return getBadRequest(req, "Illegal request-target"); } + std::cout << req.target() << std::endl; + if (req.target() == "/solution/submit") { return solutionManager->createSolution(std::move(req)); } else if (req.target() == "/solution/all") { diff --git a/server/internal/repository/CMakeLists.txt b/server/internal/repository/CMakeLists.txt index 78409d7..61bdcd7 100644 --- a/server/internal/repository/CMakeLists.txt +++ b/server/internal/repository/CMakeLists.txt @@ -28,7 +28,7 @@ add_custom_target( add_library(${LIB_NAME} ${SOURCES} ${HEADERS}) target_include_directories(${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/virtual) -target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${libpqxx_LIBRARIES} ${libEntities_LIB} ${libDbManager_LIB}) +target_link_libraries(${LIB_NAME} ${Boost_LIBRARIES} ${PQXX_LIB} ${libEntities_LIB} ${libDbManager_LIB}) set(libRepository_LIB ${LIB_NAME}) set(libRepository_LIB ${libRepository_LIB} PARENT_SCOPE) diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index 927bdce..94f11dd 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -14,7 +14,7 @@ message("METRICS_lib_INCLUDE_DIRS=${METRICS_lib_INCLUDE_DIRS}") message("METRICS_LIBRARY=${METRICS_LIBRARY}") target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY} ${libpqxx_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} ${libRepository_LIB} ${libEntities_LIB} ${ANTLR4_LIB} ${METRICS_LIBRARY} ${PQXX_LIB}) set(SERVICE_lib_LIBRARY ${PROJECT_NAME}) set(SERVICE_lib_LIBRARY ${SERVICE_lib_LIBRARY} PARENT_SCOPE) -- GitLab From 5c2833ecc0db1b175761ad5ab40de0a60482be66 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 16 May 2023 18:34:37 +0300 Subject: [PATCH 081/134] add docker-compose demo --- Docker/db.Dockerfile | 2 + Docker/init.sql | 677 +++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 31 ++ 3 files changed, 710 insertions(+) create mode 100644 Docker/db.Dockerfile create mode 100644 Docker/init.sql create mode 100644 docker-compose.yml diff --git a/Docker/db.Dockerfile b/Docker/db.Dockerfile new file mode 100644 index 0000000..1668143 --- /dev/null +++ b/Docker/db.Dockerfile @@ -0,0 +1,2 @@ +FROM postgres:15 +COPY init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/Docker/init.sql b/Docker/init.sql new file mode 100644 index 0000000..3755388 --- /dev/null +++ b/Docker/init.sql @@ -0,0 +1,677 @@ +-- +-- PostgreSQL database cluster dump +-- + +-- Started on 2023-05-15 22:49:08 + +SET default_transaction_read_only = off; + +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; + +-- +-- Roles +-- + +CREATE ROLE postgres; +ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:nOmjHrNPdaIcnCeed7FgbQ==$U+pukPiYK1tBvbNsPjn4d9zV4IXLekf/OMW5+ZDzgrY=:1f9vBcPgoAcX5hmUUOkjkXLp0FRCqsnlQRmYs2U29pU='; + +-- +-- User Configurations +-- + + + + + + + + +-- +-- Databases +-- + +-- +-- Database "template1" dump +-- + +\connect template1 + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- Completed on 2023-05-15 22:49:08 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "mydb" dump +-- + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 3362 (class 1262 OID 16565) +-- Name: mydb; Type: DATABASE; Schema: -; Owner: postgres +-- + +CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Russian_Russia.1251'; + + +ALTER DATABASE mydb OWNER TO postgres; + +\connect mydb + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- TOC entry 215 (class 1259 OID 16574) +-- Name: users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.users ( + id integer NOT NULL, + login character varying(255), + password character varying(255), + username character varying(255) +); + + +ALTER TABLE public.users OWNER TO postgres; + +-- +-- TOC entry 214 (class 1259 OID 16573) +-- Name: Users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public."Users_id_seq" + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public."Users_id_seq" OWNER TO postgres; + +-- +-- TOC entry 3363 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public."Users_id_seq" OWNED BY public.users.id; + + +-- +-- TOC entry 219 (class 1259 OID 16613) +-- Name: metricstat; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.metricstat ( + id integer NOT NULL, + solution_id integer, + text_based_res real, + token_based_res real, + tree_based_res real, + verdict boolean, + mean_res real +); + + +ALTER TABLE public.metricstat OWNER TO postgres; + +-- +-- TOC entry 221 (class 1259 OID 16626) +-- Name: metricstat_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.metricstat_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.metricstat_id_seq OWNER TO postgres; + +-- +-- TOC entry 3364 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.metricstat_id_seq OWNED BY public.metricstat.id; + + +-- +-- TOC entry 217 (class 1259 OID 16583) +-- Name: solutions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.solutions ( + id integer NOT NULL, + send_date date NOT NULL, + sender_id integer, + source character varying(255), + task_id integer, + result character varying, + tokens character varying, + asttree character varying, + original_solution_id integer +); + + +ALTER TABLE public.solutions OWNER TO postgres; + +-- +-- TOC entry 216 (class 1259 OID 16582) +-- Name: solutions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.solutions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.solutions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3365 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.solutions_id_seq OWNED BY public.solutions.id; + + +-- +-- TOC entry 218 (class 1259 OID 16598) +-- Name: tasks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tasks ( + id integer NOT NULL, + description text, + treshold real +); + + +ALTER TABLE public.tasks OWNER TO postgres; + +-- +-- TOC entry 220 (class 1259 OID 16623) +-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.tasks_id_seq OWNER TO postgres; + +-- +-- TOC entry 3366 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; + + +-- +-- TOC entry 3191 (class 2604 OID 16628) +-- Name: metricstat id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat ALTER COLUMN id SET DEFAULT nextval('public.metricstat_id_seq'::regclass); + + +-- +-- TOC entry 3189 (class 2604 OID 16586) +-- Name: solutions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions ALTER COLUMN id SET DEFAULT nextval('public.solutions_id_seq'::regclass); + + +-- +-- TOC entry 3190 (class 2604 OID 16625) +-- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); + + +-- +-- TOC entry 3188 (class 2604 OID 16577) +-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public."Users_id_seq"'::regclass); + + +-- +-- TOC entry 3354 (class 0 OID 16613) +-- Dependencies: 219 +-- Data for Name: metricstat; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.metricstat (id, solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) FROM stdin; +15 1 1 1 1 t 1 +\. + + +-- +-- TOC entry 3352 (class 0 OID 16583) +-- Dependencies: 217 +-- Data for Name: solutions; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.solutions (id, send_date, sender_id, source, task_id, result, tokens, asttree, original_solution_id) FROM stdin; +1 2023-05-02 10 0.1 27 0.1 0.1 0.1 1 +\. + + +-- +-- TOC entry 3353 (class 0 OID 16598) +-- Dependencies: 218 +-- Data for Name: tasks; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.tasks (id, description, treshold) FROM stdin; +27 orher_description 0.1 +1 description 0.5 +\. + + +-- +-- TOC entry 3350 (class 0 OID 16574) +-- Dependencies: 215 +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.users (id, login, password, username) FROM stdin; +1 qwerty200468@gmail.com 123 tolik +2 qwerty200468@gmail.com 123 tolik +3 qwerty200468@gmail.com 123 tolik +4 qwerty200468@gmail.com 123 tolik +5 qwerty200468@gmail.com 123 tolik +6 qwerty200468@gmail.com 123 tolik +7 qwerty200468@gmail.com 123 tolik +8 qwerty200468@gmail.com 123 tolik +9 qwerty200468@gmail.com 123 tolik +10 qwerty200468@gmail.com 123 tolik +52 qwerty200468@gmail.com 123 tolik +\. + + +-- +-- TOC entry 3367 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public."Users_id_seq"', 78, true); + + +-- +-- TOC entry 3368 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.metricstat_id_seq', 36, true); + + +-- +-- TOC entry 3369 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.solutions_id_seq', 150, true); + + +-- +-- TOC entry 3370 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.tasks_id_seq', 34, true); + + +-- +-- TOC entry 3193 (class 2606 OID 16581) +-- Name: users Users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT "Users_pkey" PRIMARY KEY (id); + + +-- +-- TOC entry 3202 (class 2606 OID 16617) +-- Name: metricstat metricStat_pk; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT "metricStat_pk" PRIMARY KEY (id); + + +-- +-- TOC entry 3198 (class 2606 OID 16588) +-- Name: solutions solutions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT solutions_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3200 (class 2606 OID 16604) +-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks + ADD CONSTRAINT tasks_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3194 (class 1259 OID 16637) +-- Name: fki_original_solution_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_original_solution_id ON public.solutions USING btree (original_solution_id); + + +-- +-- TOC entry 3195 (class 1259 OID 16594) +-- Name: fki_sender_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_sender_id ON public.solutions USING btree (sender_id); + + +-- +-- TOC entry 3196 (class 1259 OID 16610) +-- Name: fki_task_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_task_id ON public.solutions USING btree (task_id); + + +-- +-- TOC entry 3203 (class 2606 OID 16632) +-- Name: solutions original_solution_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT original_solution_id FOREIGN KEY (original_solution_id) REFERENCES public.solutions(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3204 (class 2606 OID 16589) +-- Name: solutions sender_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT sender_id FOREIGN KEY (sender_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3206 (class 2606 OID 16618) +-- Name: metricstat solutions_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT solutions_id FOREIGN KEY (solution_id) REFERENCES public.solutions(id); + + +-- +-- TOC entry 3205 (class 2606 OID 16605) +-- Name: solutions task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT task_id FOREIGN KEY (task_id) REFERENCES public.tasks(id) NOT VALID; + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "postgres" dump +-- + +\connect postgres + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:09 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 8 (class 2615 OID 16398) +-- Name: pgagent; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA pgagent; + + +ALTER SCHEMA pgagent OWNER TO postgres; + +-- +-- TOC entry 3437 (class 0 OID 0) +-- Dependencies: 8 +-- Name: SCHEMA pgagent; Type: COMMENT; Schema: -; Owner: postgres +-- + +COMMENT ON SCHEMA pgagent IS 'pgAgent system tables'; + + +-- +-- TOC entry 2 (class 3079 OID 16384) +-- Name: adminpack; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog; + + +-- +-- TOC entry 3438 (class 0 OID 0) +-- Dependencies: 2 +-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL'; + + +-- +-- TOC entry 3 (class 3079 OID 16399) +-- Name: pgagent; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgagent WITH SCHEMA pgagent; + + +-- +-- TOC entry 3439 (class 0 OID 0) +-- Dependencies: 3 +-- Name: EXTENSION pgagent; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgagent IS 'A PostgreSQL job scheduler'; + + +-- +-- TOC entry 3218 (class 0 OID 16400) +-- Dependencies: 219 +-- Data for Name: pga_jobagent; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobagent (jagpid, jaglogintime, jagstation) FROM stdin; +7380 2023-05-09 17:32:50.44529+03 DESKTOP-CLI5MDC +\. + + +-- +-- TOC entry 3219 (class 0 OID 16409) +-- Dependencies: 221 +-- Data for Name: pga_jobclass; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobclass (jclid, jclname) FROM stdin; +\. + + +-- +-- TOC entry 3220 (class 0 OID 16419) +-- Dependencies: 223 +-- Data for Name: pga_job; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_job (jobid, jobjclid, jobname, jobdesc, jobhostagent, jobenabled, jobcreated, jobchanged, jobagentid, jobnextrun, joblastrun) FROM stdin; +\. + + +-- +-- TOC entry 3222 (class 0 OID 16467) +-- Dependencies: 227 +-- Data for Name: pga_schedule; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_schedule (jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths) FROM stdin; +\. + + +-- +-- TOC entry 3223 (class 0 OID 16495) +-- Dependencies: 229 +-- Data for Name: pga_exception; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_exception (jexid, jexscid, jexdate, jextime) FROM stdin; +\. + + +-- +-- TOC entry 3224 (class 0 OID 16509) +-- Dependencies: 231 +-- Data for Name: pga_joblog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_joblog (jlgid, jlgjobid, jlgstatus, jlgstart, jlgduration) FROM stdin; +\. + + +-- +-- TOC entry 3221 (class 0 OID 16443) +-- Dependencies: 225 +-- Data for Name: pga_jobstep; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobstep (jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind, jstcode, jstconnstr, jstdbname, jstonerror, jscnextrun) FROM stdin; +\. + + +-- +-- TOC entry 3225 (class 0 OID 16525) +-- Dependencies: 233 +-- Data for Name: pga_jobsteplog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobsteplog (jslid, jsljlgid, jsljstid, jslstatus, jslresult, jslstart, jslduration, jsloutput) FROM stdin; +\. + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database cluster dump complete +-- diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d2bc0c6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: "3.9" + +volumes: + database-volume: + server-volume: + +services: + postgres: + build: + context: ./Docker + dockerfile: db.Dockerfile + restart: always + image: postgres + environment: + POSTGRES_DB: "test" + POSTGRES_USER: "postgres" + POSTGRES_PASSWORD: "asdwasd4545" + ports: + - "5431:5431" + volumes: + - database-volume:/var/lib/postgresql/data + server: + image: raiden454/cpp-app:latest + volumes: + - server-volume:/project + command: make server-run + restart: always + ports: + - "8081:8081" + depends_on: + - postgres -- GitLab From 29a66421a9babd44ca55534850660684465007da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 17 May 2023 21:28:58 +0300 Subject: [PATCH 082/134] fix db in docker --- Docker/db.Dockerfile | 3 ++- Docker/init.sql | 2 +- docker-compose.yml | 11 +++++------ 3 files changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 Docker/init.sql diff --git a/Docker/db.Dockerfile b/Docker/db.Dockerfile index 1668143..03d32ce 100644 --- a/Docker/db.Dockerfile +++ b/Docker/db.Dockerfile @@ -1,2 +1,3 @@ FROM postgres:15 -COPY init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file +RUN apt-get update && apt-get -y install pgagent +COPY init.sql /docker-entrypoint-initdb.d/init.sql \ No newline at end of file diff --git a/Docker/init.sql b/Docker/init.sql old mode 100644 new mode 100755 index 3755388..c31afbb --- a/Docker/init.sql +++ b/Docker/init.sql @@ -92,7 +92,7 @@ SET row_security = off; -- Name: mydb; Type: DATABASE; Schema: -; Owner: postgres -- -CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Russian_Russia.1251'; +CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.utf8'; ALTER DATABASE mydb OWNER TO postgres; diff --git a/docker-compose.yml b/docker-compose.yml index d2bc0c6..1f9cc2a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,6 @@ version: "3.9" volumes: database-volume: - server-volume: services: postgres: @@ -12,17 +11,17 @@ services: restart: always image: postgres environment: - POSTGRES_DB: "test" - POSTGRES_USER: "postgres" - POSTGRES_PASSWORD: "asdwasd4545" + POSTGRES_DB: "tmp" + POSTGRES_USER: "tmp" + POSTGRES_PASSWORD: "tmp" ports: - - "5431:5431" + - "5432:5432" volumes: - database-volume:/var/lib/postgresql/data server: image: raiden454/cpp-app:latest volumes: - - server-volume:/project + - .:/project command: make server-run restart: always ports: -- GitLab From 08ebe2dbb8ec6909ab3dc4a1c2876966cc353d67 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 09:01:18 +0300 Subject: [PATCH 083/134] change docker-compose --- docker-compose.yml | 33 ++++++++++++------- .../internal/dbManager/src/dbConnection.cpp | 2 +- server/internal/dbManager/src/dbManager.cpp | 2 +- server/internal/httpServer/main.cpp | 4 ++- server/internal/httpServer/src/Router.cpp | 2 +- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1f9cc2a..b4df00d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,27 +4,38 @@ volumes: database-volume: services: - postgres: + db: + image: postgres + container_name: db + restart: always build: context: ./Docker dockerfile: db.Dockerfile - restart: always - image: postgres environment: - POSTGRES_DB: "tmp" - POSTGRES_USER: "tmp" - POSTGRES_PASSWORD: "tmp" + POSTGRES_DB: "temp" + POSTGRES_USER: "temp" + POSTGRES_PASSWORD: "temp" + volumes: + - database-volume:/var/lib/postgresql/data ports: - "5432:5432" - volumes: - - database-volume:/var/lib/postgresql/data + networks: + - db-network server: image: raiden454/cpp-app:latest + networks: + - db-network volumes: - .:/project command: make server-run - restart: always ports: - - "8081:8081" + - "8080:8080" depends_on: - - postgres + - db + links: + - db:db + +networks: + db-network: + driver: bridge + name: db_network diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index e89f6e7..dc44025 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -14,7 +14,7 @@ std::shared_ptr dbConnection::connection() const { } void dbConnection::establish_connection() { - pqxx::connection c("dbname =mydb" "user = postgres password =root hostaddr =127.0.0.1 port = 5432"); + pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); m_connection.reset(&c); } diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index f1ff766..d508587 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -11,7 +11,7 @@ void dbManager::createPool() { for (auto i = 0; i < POOL_SIZE; i++) { connection_pool.emplace(std::make_shared( - "dbname =mydb user = postgres password =root hostaddr =172.28.224.1 port = 5432")); + "dbname =mydb user = temp password =temp hostaddr =db port = 5432")); } } diff --git a/server/internal/httpServer/main.cpp b/server/internal/httpServer/main.cpp index a4b3e8e..edab174 100644 --- a/server/internal/httpServer/main.cpp +++ b/server/internal/httpServer/main.cpp @@ -19,13 +19,15 @@ int main(int argc, char* argv[]) // return EXIT_FAILURE; // } - std::cout << "SERVER RUN" << std::endl; + std::cout << "SERVER RUN12" << std::endl; auto const address = net::ip::make_address("0.0.0.0"); auto const port = static_cast(std::atoi("8080")); auto const doc_root = std::make_shared("."); auto const threads = std::max(1, std::atoi("1")); + std::cout << "SERVER INIT" << std::endl; + // The io_context is required for all I/O net::io_context ioc{threads}; diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index 617dd96..8daae03 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -13,7 +13,7 @@ Router::Router(std::string_view doc_root_) : http::message_generator Router::handleRequest(http::request &&req) { - + std::cout << req << std::endl; if(req.method() != http::verb::get && req.method() != http::verb::post) return getBadRequest(req, "Unknown HTTP-method"); -- GitLab From ffb4ec0a0d0205ca4f35f93bbaad7bc5e9adc9b7 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 09:20:13 +0300 Subject: [PATCH 084/134] docker works --- .env | 7 +++---- docker-compose.yml | 2 ++ server/internal/dbManager/src/dbConnection.cpp | 8 ++++---- server/internal/dbManager/src/dbManager.cpp | 3 +-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 3281990..5ec0414 100644 --- a/.env +++ b/.env @@ -1,6 +1,5 @@ -PGHOSTADDR=0.0.0.0 +PGHOST=db PGPORT=5432 PGDATABASE=mydb -PGUSER=postgres -PGPASSWORD=root -POOLSIZE=10 \ No newline at end of file +PGUSER=temp +PGPASSWORD=temp \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b4df00d..d09967e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,8 @@ services: image: raiden454/cpp-app:latest networks: - db-network + env_file: + - .env volumes: - .:/project command: make server-run diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index dc44025..f83063d 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -13,8 +13,8 @@ std::shared_ptr dbConnection::connection() const { return m_connection; } -void dbConnection::establish_connection() { - pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); - m_connection.reset(&c); +// void dbConnection::establish_connection() { +// pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); +// m_connection.reset(&c); -} +// } diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index d508587..9acca01 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -10,8 +10,7 @@ void dbManager::createPool() { std::lock_guard locker_(m_mutex); for (auto i = 0; i < POOL_SIZE; i++) { - connection_pool.emplace(std::make_shared( - "dbname =mydb user = temp password =temp hostaddr =db port = 5432")); + connection_pool.emplace(std::make_shared()); } } -- GitLab From 1b6d44405cef8b3ecf78375dbce44aa11c5bc159 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 09:29:33 +0300 Subject: [PATCH 085/134] update server build command in docker --- Makefile | 3 --- docker-compose.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 88a10d0..75ec8c6 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,3 @@ dev: stop-docker: docker stop app - - - diff --git a/docker-compose.yml b/docker-compose.yml index d09967e..e101d36 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: - .env volumes: - .:/project - command: make server-run + command: bash -c "make build-project && make server-run" ports: - "8080:8080" depends_on: -- GitLab From 8df840f666ea8fe4ff7e8c7ed3159f7a7af6807f Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 09:31:24 +0300 Subject: [PATCH 086/134] add new command to makefile --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 75ec8c6..10aed27 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,7 @@ dev: stop-docker: docker stop app + +run-docker-compose: + docker compose down --volumes + docker compose up -d --build \ No newline at end of file -- GitLab From 0e81895eb5b06c4db9dc595c315c51c20f753ec8 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 10:47:07 +0300 Subject: [PATCH 087/134] change ci --- .github/workflows/ci.yml | 26 ++++---------------------- Makefile | 7 +++++++ 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c7b798..96480b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,34 +16,16 @@ jobs: container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - - name: Installing - run: | - apt update - git clone https://github.com/google/googletest.git -b release-1.11.0 - cd googletest - mkdir build - cd build - cmake .. -DBUILD_GMOCK=ON - make - make install - cd ../.. - name: Building - run: | - mkdir build - cd build - cmake .. - make + run: make rebuild - name: Run-Tests - run: | - ./build/server/internal/service/tests/test_service + run: make test linters: runs-on: ubuntu-latest container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - name: Cppcheck - run: | - cppcheck server --std=c++17 --enable=all + run: make check - name: Cpplint - run: | - cpplint --extensions=cpp,hpp,h --recursive ./server/* \ No newline at end of file + run: make lint \ No newline at end of file diff --git a/Makefile b/Makefile index 10aed27..b13afed 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,13 @@ server-run: test: ctest --verbose --output-on-failure --test-dir build/ +check: + cppcheck server --std=c++17 --enable=all + +lint: + cpplint --extensions=cpp,hpp,h --recursive ./server/* ./client/* + + dev: docker run --rm -it \ -v $(PWD):/project \ -- GitLab From a872f92f2c37977ce418a57de4587f84b4b474e2 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 18 May 2023 11:23:08 +0300 Subject: [PATCH 088/134] delete file using in metrics tests --- .../metrics/tests/src/text_metrics_tests.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/server/internal/metrics/tests/src/text_metrics_tests.cpp b/server/internal/metrics/tests/src/text_metrics_tests.cpp index aae644d..2e79320 100644 --- a/server/internal/metrics/tests/src/text_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/text_metrics_tests.cpp @@ -5,9 +5,6 @@ #include #include -#include -#include - #include "TextMetricsLib.h" class LevDistTextMetricTest : public ::testing::Test { @@ -29,14 +26,8 @@ protected: }; TEST_F(LevDistTextMetricTest, check_eq_progs) { - std::ifstream fin1; - fin1.open("src/test-codes/code1.txt"); - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - fin1.close(); - levDistTextMetric->setData(text1, text1); + levDistTextMetric->setData("a b c d e f", "a b c d e f"); EXPECT_EQ(levDistTextMetric->getMetric(), 1); } @@ -56,14 +47,8 @@ TEST_F(LevDistTextMetricTest, test_with_empty_prog) { } TEST_F(JaccardTextMetricTest, check_eq_progs){ - std::ifstream fin1; - fin1.open("src/test-codes/code1.txt"); - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - fin1.close(); - jaccardTextMetric->setData(text1, text1); + jaccardTextMetric->setData("a b c d e f", "d e a b c f"); EXPECT_EQ(jaccardTextMetric->getMetric(), 1); } -- GitLab From ac89c26d567576562b78c93c098e59938dff6db4 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 12:55:02 +0300 Subject: [PATCH 089/134] add linters and formatters --- .github/workflows/ci.yml | 24 ++++++++++++++---------- CPPLINT.cfg | 11 +++++++++++ Dockerfile | 2 ++ Makefile | 7 +++++-- clang-format.txt | 6 ++++++ run_format.sh | 10 ++++++++++ run_linters.sh | 30 ++++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 CPPLINT.cfg create mode 100644 clang-format.txt create mode 100755 run_format.sh create mode 100755 run_linters.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96480b0..98d52f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,21 +11,25 @@ defaults: shell: bash jobs: - build: + Format: runs-on: ubuntu-latest container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - - name: Building - run: make rebuild - - name: Run-Tests - run: make test - linters: + - run: make format + Lint: + runs-on: ubuntu-latest + container: raiden454/cpp-app + needs: [Format] + steps: + - uses: actions/checkout@v3 + - run: make lint + build: runs-on: ubuntu-latest container: raiden454/cpp-app steps: - uses: actions/checkout@v3 - - name: Cppcheck - run: make check - - name: Cpplint - run: make lint \ No newline at end of file + - name: Building + run: make rebuild + - name: Run-Tests + run: make test \ No newline at end of file diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 0000000..0f6c156 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,11 @@ +headers=h,hpp +linelength=120 +filter=-whitespace/tab +filter=-runtime/int +filter=-legal/copyright +filter=-build/include_subdir +filter=-build/include +filter=-readability/casting +filter=-runtime/references +filter=-build/header_guard +filter=-build/c++17 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b1c981d..75baccc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,8 @@ RUN tar xvf boost_1_82_0.tar.gz WORKDIR boost_1_82_0 RUN ./bootstrap.sh --prefix=/usr/ RUN ./b2 install + +RUN apt install -y clang-format WORKDIR /project diff --git a/Makefile b/Makefile index b979d60..13e9c42 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ clean: rebuild: clean generate build-project server-run: - ./build/server/cmd/Server + ./build/server/cmd/ test: ctest --verbose --test-dir build/ @@ -20,7 +20,10 @@ check: cppcheck server --std=c++17 --enable=all lint: - cpplint --extensions=cpp,hpp,h --recursive ./server/* ./client/* + ./run_linters.sh + +format: + ./run_format.sh dev: docker run --rm -it \ diff --git a/clang-format.txt b/clang-format.txt new file mode 100644 index 0000000..523f17c --- /dev/null +++ b/clang-format.txt @@ -0,0 +1,6 @@ +--- +Language: Cpp +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 0 +AccessModifierOffset: -3 diff --git a/run_format.sh b/run_format.sh new file mode 100755 index 0000000..1eef155 --- /dev/null +++ b/run_format.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +THIS_PATH="$(realpath "$0")" +THIS_DIR="$(dirname "$THIS_PATH")" + +FILE_LIST="$(find "$THIS_DIR/server" | grep -E ".*(\.cpp|\.h|\.hpp|\.hh)$")" + +echo -e "Files found to format = \n\"\"\"\n$FILE_LIST\n\"\"\"" + +clang-format --verbose -i --style=file $FILE_LIST \ No newline at end of file diff --git a/run_linters.sh b/run_linters.sh new file mode 100755 index 0000000..f7c4d12 --- /dev/null +++ b/run_linters.sh @@ -0,0 +1,30 @@ +#!/bin/bash + + +#!/bin/bash +set -o pipefail + +function check_log() { + LOG=$( { ${1}; } 2>&1 ) + STATUS=$? + echo "$LOG" + if echo "$LOG" | grep -q -E "${2}" + then + exit 1 + fi + + if [ $STATUS -ne 0 ] + then + exit $STATUS + fi +} + +echo -e "\nRun linters" + +echo -e "\nRUN cpplint.py" +check_log "cpplint --extensions=cpp,hpp --recursive ./server/* ./client/*" "Can't open for reading" + +echo - e "\nRUN cppcheck" +check_log "cppcheck src --std=c++17 --enable=all --inconclusive --error-exitcode=1 -I src/ --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=functionStatic --suppress=uninitMemberVar --suppress=unmatchedSuppression" "\(information\)" + +echo -e "SUCCESS" \ No newline at end of file -- GitLab From 663899357b24f34d517483933c9c2181769e6969 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 13:52:58 +0300 Subject: [PATCH 090/134] fix linters --- clang-format.txt => .clang-format | 4 +- CPPLINT.cfg | 4 +- client/internal/entities/src/Task.cpp | 2 +- client/internal/gui/src/AuthDialog.cpp | 6 +- client/internal/gui/src/EntryWindow.cpp | 20 +- .../httpClient/src/HttpClientManager.cpp | 2 +- .../tests/HttpClientManagerSuite.cpp | 49 ++-- .../httpClient/tests/HttpClientSuite.cpp | 2 +- client/internal/httpClient/tests/main.cpp | 2 +- run_linters.sh | 2 +- server/cmd/main.cpp | 35 +-- .../dbManager/include/dbConnection.hpp | 17 +- .../internal/dbManager/include/dbManager.hpp | 19 +- .../internal/dbManager/src/dbConnection.cpp | 11 +- server/internal/dbManager/src/dbManager.cpp | 5 +- .../internal/entities/include/MetricStat.hpp | 6 +- server/internal/entities/include/Solution.hpp | 20 +- server/internal/entities/include/Task.hpp | 11 +- server/internal/entities/include/User.hpp | 6 +- server/internal/entities/src/MetricStat.cpp | 92 +++---- server/internal/entities/src/Solution.cpp | 127 ++++----- server/internal/entities/src/Task.cpp | 45 +--- server/internal/entities/src/User.cpp | 60 ++--- .../httpServer/include/HttpConnection.h | 6 +- .../internal/httpServer/include/HttpServer.h | 4 +- server/internal/httpServer/include/Router.h | 22 +- .../internal/httpServer/include/Serializer.h | 15 +- .../httpServer/include/SolutionManager.h | 4 +- .../internal/httpServer/include/TaskManager.h | 7 +- .../httpServer/include/TmpSolutionService.h | 9 +- .../httpServer/include/TmpTaskService.h | 44 ++-- .../httpServer/include/TmpUserService.h | 5 +- .../internal/httpServer/include/UserManager.h | 3 +- .../httpServer/src/HttpConnection.cpp | 45 +--- server/internal/httpServer/src/HttpServer.cpp | 27 +- server/internal/httpServer/src/Router.cpp | 18 +- server/internal/httpServer/src/Serializer.cpp | 30 +-- .../httpServer/src/SolutionManager.cpp | 16 +- .../internal/httpServer/src/TaskManager.cpp | 18 +- .../internal/httpServer/src/UserManager.cpp | 15 +- server/internal/httpServer/src/Utils.cpp | 7 +- .../internal/httpServer/tests/RouterSuite.cpp | 18 +- .../httpServer/tests/SolutionManagerSuite.cpp | 12 +- .../httpServer/tests/TaskManagerSuite.cpp | 12 +- .../httpServer/tests/UserManagerSuite.cpp | 12 +- server/internal/httpServer/tests/main.cpp | 8 +- .../httpServer/virtual/ISolutionManager.h | 2 +- .../httpServer/virtual/ITaskManager.h | 5 +- .../httpServer/virtual/IUserManager.h | 5 +- .../internal/metrics/include/TextMetricsLib.h | 20 +- .../internal/metrics/include/TokenMetricLib.h | 35 ++- .../internal/metrics/src/TextMetricImpl.cpp | 73 +++--- .../internal/metrics/src/TokenMetricImpl.cpp | 63 ++--- server/internal/metrics/tests/src/main.cpp | 5 +- .../metrics/tests/src/text_metrics_tests.cpp | 28 +- .../metrics/tests/src/token_metrics_tests.cpp | 55 ++-- .../repository/include/MetricRepository.hpp | 15 +- .../repository/include/SolutionRepository.hpp | 14 +- .../repository/include/TaskRepository.hpp | 16 +- .../repository/include/UserRepository.hpp | 19 +- .../repository/src/MetricRepository.cpp | 50 ++-- .../repository/src/SolutionRepository.cpp | 73 ++---- .../repository/src/TaskRepository.cpp | 30 +-- .../repository/src/UserRepository.cpp | 48 ++-- .../repository/tests/RepositoryTests.cpp | 29 +-- .../repository/virtual/IMetricRepository.hpp | 6 +- .../virtual/ISolutionRepository.hpp | 7 +- .../repository/virtual/ITaskRepository.hpp | 8 +- .../repository/virtual/IUserRepository.hpp | 8 +- server/internal/service/include/Exceptions.h | 19 +- server/internal/service/include/Exeptions.h | 6 +- server/internal/service/include/FileMethods.h | 3 +- .../service/include/SolutionService.h | 43 ++-- server/internal/service/include/TaskService.h | 14 +- server/internal/service/include/UserService.h | 13 +- .../internal/service/include/UserValidator.h | 8 +- server/internal/service/include/Utils.h | 6 +- server/internal/service/src/FileMethods.cpp | 19 +- .../internal/service/src/SolutionService.cpp | 242 ++++++++---------- server/internal/service/src/TaskService.cpp | 50 ++-- server/internal/service/src/UserService.cpp | 61 ++--- server/internal/service/src/UserValidator.cpp | 36 +-- server/internal/service/src/Utils.cpp | 18 +- .../service/tests/SolutionServiceTest.cpp | 137 +++++----- .../service/tests/TaskServiceTest.cpp | 83 +++--- .../service/tests/UserServiceTest.cpp | 98 ++++--- .../service/tests/UserValidatorTest.cpp | 18 +- server/internal/service/tests/main.cpp | 6 +- .../internal/service/virtual/IMockMetrics.h | 2 +- .../service/virtual/ISolutionService.h | 11 +- .../internal/service/virtual/ITaskService.h | 10 +- .../internal/service/virtual/IUserService.h | 9 +- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 24 +- server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 64 ++--- .../pkg/antlr/python3/include/PythonAntlr.h | 26 +- server/pkg/antlr/python3/src/PythonAntlr.cpp | 64 ++--- server/pkg/antlr/testprogs/cpp/test.cpp | 5 +- server/pkg/antlr/virtual/IAntlrWrapper.h | 12 +- 98 files changed, 1133 insertions(+), 1492 deletions(-) rename clang-format.txt => .clang-format (56%) diff --git a/clang-format.txt b/.clang-format similarity index 56% rename from clang-format.txt rename to .clang-format index 523f17c..7f47431 100644 --- a/clang-format.txt +++ b/.clang-format @@ -2,5 +2,5 @@ Language: Cpp BasedOnStyle: Google IndentWidth: 4 -ColumnLimit: 0 -AccessModifierOffset: -3 +ColumnLimit: 120 +AccessModifierOffset: -3 \ No newline at end of file diff --git a/CPPLINT.cfg b/CPPLINT.cfg index 0f6c156..9d70c29 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -7,5 +7,7 @@ filter=-build/include_subdir filter=-build/include filter=-readability/casting filter=-runtime/references +filter=-runtime/string filter=-build/header_guard -filter=-build/c++17 \ No newline at end of file +filter=-build/c++11 +filter=-build/namespaces diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp index e1de440..38e9e6e 100644 --- a/client/internal/entities/src/Task.cpp +++ b/client/internal/entities/src/Task.cpp @@ -1,3 +1,3 @@ #include "Task.h" -Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc) {}; \ No newline at end of file +Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc) {} diff --git a/client/internal/gui/src/AuthDialog.cpp b/client/internal/gui/src/AuthDialog.cpp index 2f35768..619f2e6 100644 --- a/client/internal/gui/src/AuthDialog.cpp +++ b/client/internal/gui/src/AuthDialog.cpp @@ -5,9 +5,7 @@ #include "Core.h" -AuthDialog::AuthDialog(QWidget *parent) : QDialog(parent) { - setupUi(this); -} +AuthDialog::AuthDialog(QWidget *parent) : QDialog(parent) { setupUi(this); } void AuthDialog::setupUi(QDialog *AuthDialog) { QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -73,7 +71,7 @@ void AuthDialog::on_loginButton_clicked() { close(); break; case 404: - QMessageBox::warning(this, "Ошибка авторизации","Неправильный логин или пароль"); + QMessageBox::warning(this, "Ошибка авторизации", "Неправильный логин или пароль"); break; default: QMessageBox::critical(this, "Авторизация невозможна", "Нет соединения с сервером"); diff --git a/client/internal/gui/src/EntryWindow.cpp b/client/internal/gui/src/EntryWindow.cpp index 1c5d246..a781f17 100644 --- a/client/internal/gui/src/EntryWindow.cpp +++ b/client/internal/gui/src/EntryWindow.cpp @@ -1,16 +1,15 @@ #include "EntryWindow.h" -#include -#include #include #include +#include +#include + #include "AuthDialog.h" #include "SignUpDialog.h" #include "UIManager.h" -EntryWindow::EntryWindow(QWidget *parent) : QMainWindow(parent) { - setupUi(this); -} +EntryWindow::EntryWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); } void EntryWindow::setupUi(QMainWindow *EntryWindow) { EntryWindow->resize(600, 600); @@ -20,7 +19,6 @@ void EntryWindow::setupUi(QMainWindow *EntryWindow) { sizePolicy.setHeightForWidth(EntryWindow->sizePolicy().hasHeightForWidth()); EntryWindow->setSizePolicy(sizePolicy); - centralwidget = new QWidget(EntryWindow); verticalLayout = new QVBoxLayout(centralwidget); @@ -74,22 +72,20 @@ void EntryWindow::retranslateUi(QMainWindow *EntryWindow) { exitButton->setText(QCoreApplication::translate("EntryWindow", "Выйти", nullptr)); } -void EntryWindow::on_exitButton_clicked() { - QApplication::quit(); -} +void EntryWindow::on_exitButton_clicked() { QApplication::quit(); } void EntryWindow::on_loginButton_clicked() { AuthDialog authDialog(this); if (authDialog.exec() == QDialog::Accepted) { hide(); - qobject_cast(parent())->showTasksWindow(); + qobject_cast(parent())->showTasksWindow(); } } void EntryWindow::on_signUpButton_clicked() { - SignUpDialog signupDialog( this ); + SignUpDialog signupDialog(this); if (signupDialog.exec() == QDialog::Accepted) { hide(); - qobject_cast(parent())->showTasksWindow(); + qobject_cast(parent())->showTasksWindow(); } } diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index f40017a..18de286 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -44,7 +44,7 @@ Solution HttpClientManager::submitSolution(const int &user_id, const int &task_i const std::string &path_to_sound) { std::string body = serializer->serialSolutionData(user_id, task_id, filename, path_to_sound); http::response res = client->makeGetRequest("/solution/submit", body); - unsigned status = res.result_int(); + // unsigned status = res.result_int(); std::string res_body; for (auto seq : res.body().data()) { auto* cbuf = boost::asio::buffer_cast(seq); diff --git a/client/internal/httpClient/tests/HttpClientManagerSuite.cpp b/client/internal/httpClient/tests/HttpClientManagerSuite.cpp index 44de182..9959566 100644 --- a/client/internal/httpClient/tests/HttpClientManagerSuite.cpp +++ b/client/internal/httpClient/tests/HttpClientManagerSuite.cpp @@ -1,64 +1,63 @@ #include #include - -#include "IHttpClient.h" #include "HttpClientManager.h" +#include "IHttpClient.h" class HttpClientMock : public IHttpClient { -public: + public: HttpClientMock() = default; - MOCK_METHOD(ResponseStruct, makeGetRequest, (const Host& host, const std::string& target, - const std::shared_ptr& params, - const std::shared_ptr& headers), (override)); - MOCK_METHOD(ResponseStruct, makePostRequest, (const Host& host, const std::string& target, - const std::shared_ptr& body, - const std::shared_ptr& headers), (override)); - MOCK_METHOD(ResponseStruct, parseResponse, (Response response), (override)); - MOCK_METHOD(std::string, createURL, (const std::string& target, const std::shared_ptr& params), + MOCK_METHOD(ResponseStruct, makeGetRequest, + (const Host& host, const std::string& target, const std::shared_ptr& params, + const std::shared_ptr& headers), (override)); + MOCK_METHOD(ResponseStruct, makePostRequest, + (const Host& host, const std::string& target, const std::shared_ptr& body, + const std::shared_ptr& headers), + (override)); + MOCK_METHOD(ResponseStruct, parseResponse, (Response response), (override)); + MOCK_METHOD(std::string, createURL, (const std::string& target, const std::shared_ptr& params), (override)); MOCK_METHOD(bool, connect, (unsigned short port), (override)); - MOCK_METHOD(ResponseStruct, makeRequest, (const Host& host, const std::string& target, boost::beast::http::verb method, - const std::shared_ptr& params, - const std::shared_ptr& body, - const std::shared_ptr& headers), (override)); + MOCK_METHOD(ResponseStruct, makeRequest, + (const Host& host, const std::string& target, boost::beast::http::verb method, + const std::shared_ptr& params, const std::shared_ptr& body, + const std::shared_ptr& headers), + (override)); }; class HttpClientManagerSuite : public ::testing::Test { -protected: - void SetUp() override { - manager.setHttpClient(client); - } + protected: + void SetUp() override { manager.setHttpClient(client); } std::shared_ptr client = std::make_shared(); HttpClientManager manager = HttpClientManager("1", "1.1.1.1", 1, "."); }; -TEST_F(HttpClientManagerSuite, LoginUserTest){ +TEST_F(HttpClientManagerSuite, LoginUserTest) { EXPECT_CALL(*client, makeGetRequest); manager.loginUser("1", "2"); } -TEST_F(HttpClientManagerSuite, RegisterUserTest){ +TEST_F(HttpClientManagerSuite, RegisterUserTest) { EXPECT_CALL(*client, makePostRequest); manager.registerUser("1", "2", "3"); } -TEST_F(HttpClientManagerSuite, SubmitSolutionTest){ +TEST_F(HttpClientManagerSuite, SubmitSolutionTest) { EXPECT_CALL(*client, makePostRequest); manager.submitSolution(1, "2234"); } -TEST_F(HttpClientManagerSuite, GetAllSolutionsForTaskTest){ +TEST_F(HttpClientManagerSuite, GetAllSolutionsForTaskTest) { EXPECT_CALL(*client, makeGetRequest); manager.getAllSolutionsForTask(1, 2); } -TEST_F(HttpClientManagerSuite, GetAllTasksTest){ +TEST_F(HttpClientManagerSuite, GetAllTasksTest) { EXPECT_CALL(*client, makeGetRequest); manager.getAllTasks(); } -TEST_F(HttpClientManagerSuite, GetMetricsTest){ +TEST_F(HttpClientManagerSuite, GetMetricsTest) { EXPECT_CALL(*client, makeGetRequest); manager.getMetrics(1); } diff --git a/client/internal/httpClient/tests/HttpClientSuite.cpp b/client/internal/httpClient/tests/HttpClientSuite.cpp index 7ff26c2..fc3efbf 100644 --- a/client/internal/httpClient/tests/HttpClientSuite.cpp +++ b/client/internal/httpClient/tests/HttpClientSuite.cpp @@ -8,4 +8,4 @@ TEST(HttpClientSuite, WrongGetTest) { Host h("1", "1.1.1.1", 80); ResponseStruct res = client.makeGetRequest(h, "/ser/login"); EXPECT_EQ(res.status, 500); -} \ No newline at end of file +} diff --git a/client/internal/httpClient/tests/main.cpp b/client/internal/httpClient/tests/main.cpp index 21bd133..e9c20e8 100644 --- a/client/internal/httpClient/tests/main.cpp +++ b/client/internal/httpClient/tests/main.cpp @@ -5,4 +5,4 @@ int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/run_linters.sh b/run_linters.sh index f7c4d12..058bda2 100755 --- a/run_linters.sh +++ b/run_linters.sh @@ -25,6 +25,6 @@ echo -e "\nRUN cpplint.py" check_log "cpplint --extensions=cpp,hpp --recursive ./server/* ./client/*" "Can't open for reading" echo - e "\nRUN cppcheck" -check_log "cppcheck src --std=c++17 --enable=all --inconclusive --error-exitcode=1 -I src/ --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=functionStatic --suppress=uninitMemberVar --suppress=unmatchedSuppression" "\(information\)" +check_log "cppcheck server --std=c++17 --enable=all" "\(information\)" echo -e "SUCCESS" \ No newline at end of file diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 9e88fe5..5a7fa95 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -1,23 +1,21 @@ -#include - #include +#include #include "HttpServer.h" namespace net = boost::asio; using tcp = boost::asio::ip::tcp; -int main(int argc, char* argv[]) -{ +int main(int argc, char* argv[]) { // Check command line arguments. -// if (argc != 5) -// { -// std::cerr << -// "Usage: http-server-async
\n" << -// "Example:\n" << -// " http-server-async 0.0.0.0 8080 . 1\n"; -// return EXIT_FAILURE; -// } + // if (argc != 5) + // { + // std::cerr << + // "Usage: http-server-async
\n" << + // "Example:\n" << + // " http-server-async 0.0.0.0 8080 . 1\n"; + // return EXIT_FAILURE; + // } std::cout << "SERVER RUN12" << std::endl; auto const address = net::ip::make_address("0.0.0.0"); auto const port = static_cast(std::atoi("8080")); @@ -28,21 +26,12 @@ int main(int argc, char* argv[]) net::io_context ioc{threads}; // Create and launch a listening port - std::make_shared( - ioc, - tcp::endpoint{address, port}, - doc_root - )->run(); + std::make_shared(ioc, tcp::endpoint{address, port}, doc_root)->run(); // Run the I/O service on the requested number of threads std::vector v; v.reserve(threads - 1); - for(auto i = threads - 1; i > 0; --i) - v.emplace_back( - [&ioc] - { - ioc.run(); - }); + for (auto i = threads - 1; i > 0; --i) v.emplace_back([&ioc] { ioc.run(); }); ioc.run(); return EXIT_SUCCESS; diff --git a/server/internal/dbManager/include/dbConnection.hpp b/server/internal/dbManager/include/dbConnection.hpp index c47a751..375aecb 100644 --- a/server/internal/dbManager/include/dbConnection.hpp +++ b/server/internal/dbManager/include/dbConnection.hpp @@ -3,24 +3,23 @@ #define SOURCEDOUT_DBCONNECTION_HPP #include -//#include "dotenv.h" -//using namespace dotenv; +// #include "dotenv.h" +// using namespace dotenv; class dbConnection { -public: + public: dbConnection(); [[nodiscard]] std::shared_ptr connection() const; -private: + + private: void establish_connection(); std::string m_dbhost = "localhost"; - int m_dbport = 5432; + int m_dbport = 5432; std::string m_dbname = "demo"; std::string m_dbuser = "postgres"; std::string m_dbpass = "postgres"; - std::shared_ptr m_connection; - + std::shared_ptr m_connection; }; - -#endif //SOURCEDOUT_DBCONNECTION_HPP +#endif // SOURCEDOUT_DBCONNECTION_HPP diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp index d17e9ab..7c0202a 100644 --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -1,26 +1,26 @@ #ifndef SOURCEDOUT_DBMANAGER_HPP #define SOURCEDOUT_DBMANAGER_HPP +#include +#include +#include #include +#include #include -#include #include -#include #include -#include -#include -//#include "dotenv.h" -//using namespace dotenv; +// #include "dotenv.h" +// using namespace dotenv; class dbManager { -public: + public: dbManager(); std::shared_ptr connection(); void freeConnection(const std::shared_ptr &); -private: + private: const size_t POOL_SIZE = 10; std::condition_variable m_condition; @@ -30,5 +30,4 @@ private: std::mutex m_mutex; }; - -#endif //SOURCEDOUT_DBMANAGER_HPP +#endif // SOURCEDOUT_DBMANAGER_HPP diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index f83063d..728d68d 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -2,16 +2,13 @@ // Created by qwert on 01.05.2023. // -#include #include "../include/dbConnection.hpp" -dbConnection::dbConnection() { - establish_connection(); -} +#include + +dbConnection::dbConnection() { establish_connection(); } -std::shared_ptr dbConnection::connection() const { - return m_connection; -} +std::shared_ptr dbConnection::connection() const { return m_connection; } // void dbConnection::establish_connection() { // pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index 9acca01..7a1f017 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -1,10 +1,7 @@ #include "dbManager.hpp" - -dbManager::dbManager() { - createPool(); -} +dbManager::dbManager() { createPool(); } void dbManager::createPool() { std::lock_guard locker_(m_mutex); diff --git a/server/internal/entities/include/MetricStat.hpp b/server/internal/entities/include/MetricStat.hpp index 491abb7..b04001e 100644 --- a/server/internal/entities/include/MetricStat.hpp +++ b/server/internal/entities/include/MetricStat.hpp @@ -4,7 +4,7 @@ #include class MetricStat { -public: + public: MetricStat() noexcept; MetricStat(size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, @@ -45,7 +45,7 @@ public: bool operator!=(const MetricStat &rhs) const noexcept; -private: + private: size_t id; size_t solution_id; float text_based_res; @@ -55,4 +55,4 @@ private: float mean_res; }; -#endif //SOURCEDOUT_METRICSTAT_HPP +#endif // SOURCEDOUT_METRICSTAT_HPP diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index f2cdda0..15a6908 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -6,22 +6,17 @@ #include class Solution { -public: - Solution(size_t id, std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution) noexcept; + public: + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution) noexcept; - Solution(std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution) noexcept; + Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution) noexcept; Solution() noexcept; [[nodiscard]] size_t getId() const noexcept; - [[nodiscard]] const std::string &getSendDate() const noexcept; void setSendDate(const std::string &sendDate) noexcept; @@ -60,7 +55,7 @@ public: bool operator!=(const Solution &rhs) const noexcept; -private: + private: size_t id; std::string send_date; size_t sender_id; @@ -70,7 +65,6 @@ private: size_t task_id; std::string result; size_t orig_solution = 0; - }; -#endif //SOURCEDOUT_SOLUTION_HPP +#endif // SOURCEDOUT_SOLUTION_HPP diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index e551804..65e1b06 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -2,14 +2,14 @@ #define SOURCEDOUT_TASK_HPP #include #include -class Task{ -private: +class Task { + private: size_t id; std::string description; float treshhold; -public: - Task(size_t id, std::string description_, float treshold_) noexcept; + public: + Task(size_t id, std::string description_, float treshold_) noexcept; Task(std::string description_, float treshold_) noexcept; @@ -30,6 +30,5 @@ public: bool operator==(const Task &rhs) const noexcept; bool operator!=(const Task &rhs) const noexcept; - }; -#endif //SOURCEDOUT_TASK_HPP +#endif // SOURCEDOUT_TASK_HPP diff --git a/server/internal/entities/include/User.hpp b/server/internal/entities/include/User.hpp index 82e659f..1c4f6a3 100644 --- a/server/internal/entities/include/User.hpp +++ b/server/internal/entities/include/User.hpp @@ -6,13 +6,13 @@ #define SOURCEDOUT_USER_HPP class User { -private: + private: size_t id; std::string login; std::string password; std::string username; -public: + public: User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept; User(std::string login_, std::string password_, std::string username_) noexcept; @@ -42,4 +42,4 @@ public: bool operator!=(const User &rhs) const noexcept; }; -#endif //SOURCEDOUT_USER_HPP +#endif // SOURCEDOUT_USER_HPP diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp index aa0befc..86fed05 100644 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -2,80 +2,56 @@ #include "MetricStat.hpp" MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, - bool verdict, float meanRes) noexcept : id(0), solution_id(solutionId), - text_based_res(textBasedRes), token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), verdict(verdict), - mean_res(meanRes) {} + bool verdict, float meanRes) noexcept + : id(0), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, - bool verdict, float meanRes) noexcept : id(id), solution_id(solutionId), text_based_res(textBasedRes), - token_based_res(tokenBasedRes), tree_based_res(treeBasedRes), - verdict(verdict), mean_res(meanRes) {} + bool verdict, float meanRes) noexcept + : id(id), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} -MetricStat::MetricStat() noexcept : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), - verdict(true), mean_res(0) { -} +MetricStat::MetricStat() noexcept + : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), verdict(true), mean_res(0) {} -size_t MetricStat::getId() const noexcept { - return id; -} +size_t MetricStat::getId() const noexcept { return id; } -void MetricStat::setId(size_t id_) { - id = id_; -} +void MetricStat::setId(size_t id_) { id = id_; } -size_t MetricStat::getSolutionId() const noexcept { - return solution_id; -} +size_t MetricStat::getSolutionId() const noexcept { return solution_id; } -void MetricStat::setSolutionId(size_t solutionId) noexcept { - solution_id = solutionId; -} +void MetricStat::setSolutionId(size_t solutionId) noexcept { solution_id = solutionId; } -float MetricStat::getTextBasedRes() const noexcept { - return text_based_res; -} +float MetricStat::getTextBasedRes() const noexcept { return text_based_res; } -void MetricStat::setTextBasedRes(float textBasedRes) noexcept { - text_based_res = textBasedRes; -} +void MetricStat::setTextBasedRes(float textBasedRes) noexcept { text_based_res = textBasedRes; } -float MetricStat::getTokenBasedRes() const noexcept { - return token_based_res; -} +float MetricStat::getTokenBasedRes() const noexcept { return token_based_res; } -void MetricStat::setTokenBasedRes(float tokenBasedRes) noexcept { - token_based_res = tokenBasedRes; -} +void MetricStat::setTokenBasedRes(float tokenBasedRes) noexcept { token_based_res = tokenBasedRes; } -float MetricStat::getTreeBasedRes() const noexcept { - return tree_based_res; -} +float MetricStat::getTreeBasedRes() const noexcept { return tree_based_res; } -void MetricStat::setTreeBasedRes(float treeBasedRes) noexcept { - tree_based_res = treeBasedRes; -} +void MetricStat::setTreeBasedRes(float treeBasedRes) noexcept { tree_based_res = treeBasedRes; } -bool MetricStat::isVerdict() const noexcept { - return verdict; -} +bool MetricStat::isVerdict() const noexcept { return verdict; } -void MetricStat::setVerdict(bool verdict_) noexcept { - verdict = verdict_; -} +void MetricStat::setVerdict(bool verdict_) noexcept { verdict = verdict_; } -float MetricStat::getMeanRes() const noexcept { - return mean_res; -} +float MetricStat::getMeanRes() const noexcept { return mean_res; } -void MetricStat::setMeanRes(float meanRes) noexcept { - mean_res = meanRes; -} +void MetricStat::setMeanRes(float meanRes) noexcept { mean_res = meanRes; } -bool MetricStat::operator==(const MetricStat &rhs) const noexcept { - return id == rhs.id; -} +bool MetricStat::operator==(const MetricStat &rhs) const noexcept { return id == rhs.id; } -bool MetricStat::operator!=(const MetricStat &rhs) const noexcept { - return !(rhs == *this); -} +bool MetricStat::operator!=(const MetricStat &rhs) const noexcept { return !(rhs == *this); } diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index ca5fa0d..ec74455 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -1,108 +1,71 @@ -#include -#include #include "Solution.hpp" -Solution::Solution(size_t id, std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution) noexcept: - id(id), send_date(std::move(sendDate)), sender_id(senderId), - source(std::move(source)), tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)), orig_solution(orig_solution) {} - -Solution::Solution(std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution) noexcept: - id(0), send_date(std::move(sendDate)), sender_id(senderId), - source(std::move(source)), tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), result(std::move(result)), orig_solution(orig_solution) {} - +#include +#include -size_t Solution::getId() const noexcept { - return id; -} +Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, + std::string result, std::string tokens, std::string astTree, size_t orig_solution) noexcept + : id(id), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution) {} -void Solution::setId(size_t id_) noexcept { - id = id_; -} +Solution::Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution) noexcept + : id(0), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution) {} -const std::string &Solution::getSendDate() const noexcept { - return send_date; -} +size_t Solution::getId() const noexcept { return id; } -void Solution::setSendDate(const std::string &sendDate) noexcept { - send_date = sendDate; -} +void Solution::setId(size_t id_) noexcept { id = id_; } -size_t Solution::getSenderId() const noexcept { - return sender_id; -} +const std::string &Solution::getSendDate() const noexcept { return send_date; } -void Solution::setSenderId(size_t senderId) noexcept { - sender_id = senderId; -} +void Solution::setSendDate(const std::string &sendDate) noexcept { send_date = sendDate; } -const std::string &Solution::getSource() const noexcept { - return source; -} +size_t Solution::getSenderId() const noexcept { return sender_id; } -void Solution::setSource(const std::string &source_) noexcept { - Solution::source = source_; -} +void Solution::setSenderId(size_t senderId) noexcept { sender_id = senderId; } -const std::string &Solution::getTokens() const noexcept { - return tokens; -} +const std::string &Solution::getSource() const noexcept { return source; } -void Solution::setTokens(const std::string &tokens_) noexcept { - Solution::tokens = tokens_; -} +void Solution::setSource(const std::string &source_) noexcept { Solution::source = source_; } -const std::string &Solution::getAstTree() const noexcept { - return astTree; -} +const std::string &Solution::getTokens() const noexcept { return tokens; } -void Solution::setAstTree(const std::string &astTree_) noexcept { - Solution::astTree = astTree_; -} +void Solution::setTokens(const std::string &tokens_) noexcept { Solution::tokens = tokens_; } -size_t Solution::getTaskId() const noexcept { - return task_id; -} +const std::string &Solution::getAstTree() const noexcept { return astTree; } -void Solution::setTaskId(size_t taskId) noexcept { - task_id = taskId; -} +void Solution::setAstTree(const std::string &astTree_) noexcept { Solution::astTree = astTree_; } -const std::string &Solution::getResult() const noexcept { - return result; -} +size_t Solution::getTaskId() const noexcept { return task_id; } -void Solution::setResult(const std::string &result_) noexcept { - Solution::result = result_; -} +void Solution::setTaskId(size_t taskId) noexcept { task_id = taskId; } -bool Solution::operator==(const Solution &rhs) const noexcept { - return id == rhs.id; -} +const std::string &Solution::getResult() const noexcept { return result; } -bool Solution::operator!=(const Solution &rhs) const noexcept { - return !(rhs == *this); -} +void Solution::setResult(const std::string &result_) noexcept { Solution::result = result_; } -size_t Solution::getOrigSolution() const { - return orig_solution; -} +bool Solution::operator==(const Solution &rhs) const noexcept { return id == rhs.id; } -void Solution::setOrigSolution(size_t origSolution) { - orig_solution = origSolution; -} +bool Solution::operator!=(const Solution &rhs) const noexcept { return !(rhs == *this); } -Solution::Solution()noexcept :id(0), sender_id(0), task_id(0){ +size_t Solution::getOrigSolution() const { return orig_solution; } -} +void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSolution; } +Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index e0fc107..b6ec08a 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -1,43 +1,26 @@ #include "Task.hpp" -#include -Task::Task(std::string description_, float treshold_) noexcept : id(0), description(std::move(description_)), - treshhold(treshold_) {} +#include -Task::Task(size_t id, std::string description_, float treshold_) noexcept : id(id), description(std::move(description_)), - treshhold(treshold_) {} -Task::Task() noexcept:id(0), treshhold(0) { -} +Task::Task(std::string description_, float treshold_) noexcept + : id(0), description(std::move(description_)), treshhold(treshold_) {} -unsigned long Task::getId() const noexcept { - return id; -} +Task::Task(size_t id, std::string description_, float treshold_) noexcept + : id(id), description(std::move(description_)), treshhold(treshold_) {} +Task::Task() noexcept : id(0), treshhold(0) {} -const std::string &Task::getDescription() const noexcept { - return description; -} +unsigned long Task::getId() const noexcept { return id; } -void Task::setId(size_t id_) noexcept { - id = id_; -} +const std::string &Task::getDescription() const noexcept { return description; } -void Task::setDescription(const std::string &description_) noexcept { - Task::description = description_; -} +void Task::setId(size_t id_) noexcept { id = id_; } -bool Task::operator==(const Task &rhs) const noexcept { - return id == rhs.id; -} +void Task::setDescription(const std::string &description_) noexcept { Task::description = description_; } -bool Task::operator!=(const Task &rhs) const noexcept { - return !(rhs == *this); -} +bool Task::operator==(const Task &rhs) const noexcept { return id == rhs.id; } -float Task::getTreshhold() const noexcept { - return treshhold; -} +bool Task::operator!=(const Task &rhs) const noexcept { return !(rhs == *this); } -void Task::setTreshhold(float treshhold_) noexcept { - Task::treshhold = treshhold_; -} +float Task::getTreshhold() const noexcept { return treshhold; } +void Task::setTreshhold(float treshhold_) noexcept { Task::treshhold = treshhold_; } diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index 67f2620..f4795d7 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -1,59 +1,37 @@ -#include #include "../include/User.hpp" -User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept : - id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { -} +#include -User::User(std::string login_, std::string password_, std::string username_) noexcept : - id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) { -} +User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept + : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} -User::User() noexcept : id(0) { -} +User::User(std::string login_, std::string password_, std::string username_) noexcept + : id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} -const std::string &User::getLogin() const noexcept { - return login; -} +User::User() noexcept : id(0) {} -void User::setId(size_t id_) noexcept { - id = id_; -} +const std::string &User::getLogin() const noexcept { return login; } -void User::setLogin(const std::string &login_) noexcept { - User::login = login_; -} +void User::setId(size_t id_) noexcept { id = id_; } -const std::string &User::getPassword() const noexcept { - return password; -} +void User::setLogin(const std::string &login_) noexcept { User::login = login_; } -void User::setPassword(const std::string &password_) noexcept { - User::password = password_; -} +const std::string &User::getPassword() const noexcept { return password; } -const std::string &User::getUsername() const noexcept { - return username; -} +void User::setPassword(const std::string &password_) noexcept { User::password = password_; } -void User::setUsername(const std::string &username_) noexcept { - User::username = username_; -} +const std::string &User::getUsername() const noexcept { return username; } -size_t User::getId() const noexcept { - return id; -} +void User::setUsername(const std::string &username_) noexcept { User::username = username_; } + +size_t User::getId() const noexcept { return id; } std::ostream &operator<<(std::ostream &os, const User &user) noexcept { - os << "id: " << user.id << " login: " << user.login << " password: " << user.password << " username: " - << user.username; + os << "id: " << user.id << " login: " << user.login << " password: " << user.password + << " username: " << user.username; return os; } -bool User::operator==(const User &rhs) const noexcept { - return id == rhs.id; -} +bool User::operator==(const User &rhs) const noexcept { return id == rhs.id; } -bool User::operator!=(const User &rhs) const noexcept { - return !(rhs == *this); -} +bool User::operator!=(const User &rhs) const noexcept { return !(rhs == *this); } diff --git a/server/internal/httpServer/include/HttpConnection.h b/server/internal/httpServer/include/HttpConnection.h index 86d4bbb..e2b5f73 100644 --- a/server/internal/httpServer/include/HttpConnection.h +++ b/server/internal/httpServer/include/HttpConnection.h @@ -1,10 +1,9 @@ #ifndef SOURCEDOUT_HTTPSERVER_HTTPCONNECTION_H #define SOURCEDOUT_HTTPSERVER_HTTPCONNECTION_H - #include -#include #include +#include #include "Router.h" @@ -15,8 +14,7 @@ using tcp = boost::asio::ip::tcp; class HttpConnection : public std::enable_shared_from_this { public: - explicit HttpConnection(tcp::socket&& socket_, - std::shared_ptr const& doc_root_); + explicit HttpConnection(tcp::socket&& socket_, std::shared_ptr const& doc_root_); void run(); void read(); void handleRead(beast::error_code e, std::size_t bytes_transferred); diff --git a/server/internal/httpServer/include/HttpServer.h b/server/internal/httpServer/include/HttpServer.h index 422a2c8..6e8536f 100644 --- a/server/internal/httpServer/include/HttpServer.h +++ b/server/internal/httpServer/include/HttpServer.h @@ -1,9 +1,9 @@ #ifndef SOURCEDOUT_HTTPSERVER_HTTPSERVER_H #define SOURCEDOUT_HTTPSERVER_HTTPSERVER_H +#include #include #include -#include #include "HttpConnection.h" #include "Router.h" @@ -16,6 +16,7 @@ class HttpServer : public std::enable_shared_from_this { HttpServer(net::io_context& io_context_, tcp::endpoint endpoint_, std::shared_ptr const& doc_root_); void run(); + private: void startAccept(); void handleAccept(beast::error_code ec, tcp::socket socket); @@ -25,5 +26,4 @@ class HttpServer : public std::enable_shared_from_this { std::shared_ptr doc_root; }; - #endif // SOURCEDOUT_HTTPSERVER_HTTPSERVER_H diff --git a/server/internal/httpServer/include/Router.h b/server/internal/httpServer/include/Router.h index dc3bb2e..4f9c4fa 100644 --- a/server/internal/httpServer/include/Router.h +++ b/server/internal/httpServer/include/Router.h @@ -1,14 +1,14 @@ #ifndef SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H #define SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H -#include -#include -#include #include +#include +#include +#include #include "SolutionManager.h" -#include "UserManager.h" #include "TaskManager.h" +#include "UserManager.h" namespace beast = boost::beast; namespace http = beast::http; @@ -20,15 +20,10 @@ class Router : public std::enable_shared_from_this { http::message_generator handleRequest(http::request&& req); - void setSolutionManager(std::shared_ptr mng) { - solutionManager = mng; - } - void setUserManager(std::shared_ptr mng) { - userManager = mng; - } - void setTaskManager(std::shared_ptr mng) { - taskManager = mng; - } + void setSolutionManager(std::shared_ptr mng) { solutionManager = mng; } + void setUserManager(std::shared_ptr mng) { userManager = mng; } + void setTaskManager(std::shared_ptr mng) { taskManager = mng; } + private: std::shared_ptr solutionManager; std::shared_ptr userManager; @@ -36,5 +31,4 @@ class Router : public std::enable_shared_from_this { std::string doc_root; }; - #endif // SOURCEDOUT_HTTPSERVER_ROUTER_UTILS_H diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 4ff56df..1398b05 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -1,22 +1,22 @@ #ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ #define APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ -#include -#include #include +#include +#include #include "Solution.hpp" -#include "User.hpp" #include "Task.hpp" +#include "User.hpp" class Serializer { -public: + public: std::tuple deserialNewSolutionData(const std::string& val); - std::tuple deserialTaskData(const std::string &val); - std::string deserialNewTaskData(const std::string &val); + std::tuple deserialTaskData(const std::string& val); + std::string deserialNewTaskData(const std::string& val); size_t deserialSolutionData(const std::string& val); std::tuple deserialUserData(const std::string& val); - std::tuple deserialNewUserData(const std::string &val); + std::tuple deserialNewUserData(const std::string& val); std::string serialSolutions(const std::vector& solutions); std::string serialAllTasks(const std::vector& tasks); @@ -24,5 +24,4 @@ public: std::string serialSolution(const Solution& sol); }; - #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ diff --git a/server/internal/httpServer/include/SolutionManager.h b/server/internal/httpServer/include/SolutionManager.h index 5cf0da4..a6b9c3c 100644 --- a/server/internal/httpServer/include/SolutionManager.h +++ b/server/internal/httpServer/include/SolutionManager.h @@ -1,12 +1,12 @@ #ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ #define APP_HTTPSERVER_HTTPSERVER_MANAGERS_SolutionMANAGER_H_ +#include #include #include -#include -#include "Serializer.h" #include "ISolutionManager.h" +#include "Serializer.h" #include "SolutionService.h" namespace beast = boost::beast; diff --git a/server/internal/httpServer/include/TaskManager.h b/server/internal/httpServer/include/TaskManager.h index 88f1b76..1f5f5fb 100644 --- a/server/internal/httpServer/include/TaskManager.h +++ b/server/internal/httpServer/include/TaskManager.h @@ -3,17 +3,18 @@ #include #include -#include "Serializer.h" #include "ITaskManager.h" +#include "Serializer.h" #include "TaskService.h" class TaskManager : public ITaskManager { -public: + public: TaskManager(); http::message_generator createTask(http::request&& req) override; http::message_generator getAllTasks(http::request&& req) override; void setService(std::shared_ptr service); -private: + + private: std::shared_ptr taskService; std::shared_ptr serializer; }; diff --git a/server/internal/httpServer/include/TmpSolutionService.h b/server/internal/httpServer/include/TmpSolutionService.h index a77efe2..26761c0 100644 --- a/server/internal/httpServer/include/TmpSolutionService.h +++ b/server/internal/httpServer/include/TmpSolutionService.h @@ -1,15 +1,16 @@ #pragma once -#include #include +#include + #include "Solution.hpp" class TmpSolutionService { -public: + public: static Solution createSolution(std::size_t user_id, std::size_t task_id, std::string source) { count++; - Solution sol(count, "", user_id, source, task_id,"ok", "", "", 1); - for (auto& i: solutions) { + Solution sol(count, "", user_id, source, task_id, "ok", "", "", 1); + for (auto& i : solutions) { if (i.getSource() == source && i.getTaskId() == task_id && i.getSenderId() != user_id) sol.setResult("plagiat"); } diff --git a/server/internal/httpServer/include/TmpTaskService.h b/server/internal/httpServer/include/TmpTaskService.h index bfdb535..9740a2d 100644 --- a/server/internal/httpServer/include/TmpTaskService.h +++ b/server/internal/httpServer/include/TmpTaskService.h @@ -1,40 +1,40 @@ #pragma once -#include #include +#include + #include "Task.hpp" class TmpTaskService { -public: + public: static void createTask(std::string description) { count++; Task task(count, description, 0.5); tasks.push_back(task); } - static std::vector getAllTasks() { - return tasks; - } + static std::vector getAllTasks() { return tasks; } static std::size_t count; static std::vector tasks; }; -std::vector TmpTaskService::tasks = {Task(1, "1 description 1\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "14\n", 0.5), - Task(2, "2 description", 0.5), - Task(3, "3 description", 0.5)}; +std::vector TmpTaskService::tasks = {Task(1, + "1 description 1\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "14\n", + 0.5), + Task(2, "2 description", 0.5), Task(3, "3 description", 0.5)}; std::size_t TmpTaskService::count = 3; \ No newline at end of file diff --git a/server/internal/httpServer/include/TmpUserService.h b/server/internal/httpServer/include/TmpUserService.h index cd60903..65cda81 100644 --- a/server/internal/httpServer/include/TmpUserService.h +++ b/server/internal/httpServer/include/TmpUserService.h @@ -1,11 +1,12 @@ #pragma once -#include #include +#include + #include "User.hpp" class TmpUserService { -public: + public: static std::pair login(std::string_view login, std::string_view password) { bool found = false; User user; diff --git a/server/internal/httpServer/include/UserManager.h b/server/internal/httpServer/include/UserManager.h index 59e0564..66c231e 100644 --- a/server/internal/httpServer/include/UserManager.h +++ b/server/internal/httpServer/include/UserManager.h @@ -4,8 +4,8 @@ #include #include -#include "Serializer.h" #include "IUserManager.h" +#include "Serializer.h" #include "UserService.h" class UserManager : public IUserManager { @@ -14,6 +14,7 @@ class UserManager : public IUserManager { http::message_generator loginUser(http::request&& req) override; http::message_generator registerUser(http::request&& req) override; void setService(std::shared_ptr service); + private: std::shared_ptr userService; std::shared_ptr serializer; diff --git a/server/internal/httpServer/src/HttpConnection.cpp b/server/internal/httpServer/src/HttpConnection.cpp index 084d91a..6b6b408 100644 --- a/server/internal/httpServer/src/HttpConnection.cpp +++ b/server/internal/httpServer/src/HttpConnection.cpp @@ -4,64 +4,45 @@ #include "Utils.h" -HttpConnection::HttpConnection(tcp::socket&& socket_, - std::shared_ptr const& doc_root_) - : stream(std::move(socket_)), doc_root(doc_root_) { +HttpConnection::HttpConnection(tcp::socket&& socket_, std::shared_ptr const& doc_root_) + : stream(std::move(socket_)), doc_root(doc_root_) { router = std::make_shared(*doc_root_); } void HttpConnection::run() { - net::dispatch(stream.get_executor(), - beast::bind_front_handler(&HttpConnection::read, shared_from_this()) - ); + net::dispatch(stream.get_executor(), beast::bind_front_handler(&HttpConnection::read, shared_from_this())); } void HttpConnection::read() { request = {}; stream.expires_after(std::chrono::seconds(30)); http::async_read(stream, buffer, request, - beast::bind_front_handler( - &HttpConnection::handleRead, - shared_from_this() - ) - ); + beast::bind_front_handler(&HttpConnection::handleRead, shared_from_this())); } void HttpConnection::handleRead(beast::error_code e, std::size_t bytes_transferred) { boost::ignore_unused(bytes_transferred); - if(e == http::error::end_of_stream) - return close(); + if (e == http::error::end_of_stream) return close(); - if(e) - return fail(e, "read"); + if (e) return fail(e, "read"); - sendResponse( - router->handleRequest(std::move(request)) - ); + sendResponse(router->handleRequest(std::move(request))); } -void HttpConnection::sendResponse(http::message_generator &&msg) { +void HttpConnection::sendResponse(http::message_generator&& msg) { bool keep_alive = msg.keep_alive(); - beast::async_write( - stream, - std::move(msg), - beast::bind_front_handler( - &HttpConnection::handleWrite, - shared_from_this(), - keep_alive - ) - ); + beast::async_write(stream, std::move(msg), + beast::bind_front_handler(&HttpConnection::handleWrite, shared_from_this(), keep_alive)); } void HttpConnection::handleWrite(bool keep_alive, beast::error_code e, std::size_t bytes_transferred) { boost::ignore_unused(bytes_transferred); - if(e) - return fail(e, "write"); + if (e) return fail(e, "write"); - if(!keep_alive) { + if (!keep_alive) { return close(); } @@ -71,4 +52,4 @@ void HttpConnection::handleWrite(bool keep_alive, beast::error_code e, std::size void HttpConnection::close() { beast::error_code e; stream.socket().shutdown(tcp::socket::shutdown_send, e); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/src/HttpServer.cpp b/server/internal/httpServer/src/HttpServer.cpp index e00df2a..e8256d6 100644 --- a/server/internal/httpServer/src/HttpServer.cpp +++ b/server/internal/httpServer/src/HttpServer.cpp @@ -1,53 +1,48 @@ #include "HttpServer.h" -#include #include +#include #include "Utils.h" HttpServer::HttpServer(net::io_context& io_context_, tcp::endpoint endpoint_, std::shared_ptr const& doc_root_) - : io_context(io_context_), acceptor(net::make_strand(io_context_)), doc_root(doc_root_) { - + : io_context(io_context_), acceptor(net::make_strand(io_context_)), doc_root(doc_root_) { beast::error_code ec; acceptor.open(endpoint_.protocol(), ec); - if(ec) { + if (ec) { fail(ec, "open"); return; } acceptor.set_option(net::socket_base::reuse_address(true), ec); - if(ec) { + if (ec) { fail(ec, "set_option"); return; } acceptor.bind(endpoint_, ec); - if(ec) { + if (ec) { fail(ec, "bind"); return; } acceptor.listen(net::socket_base::max_listen_connections, ec); - if(ec) { + if (ec) { fail(ec, "listen"); return; } } -void HttpServer::run() { - startAccept(); -} +void HttpServer::run() { startAccept(); } void HttpServer::startAccept() { - acceptor.async_accept( - net::make_strand(io_context), - beast::bind_front_handler(&HttpServer::handleAccept, shared_from_this()) - ); + acceptor.async_accept(net::make_strand(io_context), + beast::bind_front_handler(&HttpServer::handleAccept, shared_from_this())); } void HttpServer::handleAccept(beast::error_code ec, tcp::socket socket) { - if(ec) { + if (ec) { fail(ec, "accept"); return; } else { @@ -55,4 +50,4 @@ void HttpServer::handleAccept(beast::error_code ec, tcp::socket socket) { } startAccept(); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index 8daae03..b4e3f61 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -5,20 +5,18 @@ #include "Utils.h" -Router::Router(std::string_view doc_root_) : - solutionManager(std::make_shared()), - userManager(std::make_shared()), - taskManager(std::make_shared()), - doc_root(doc_root_) {} - +Router::Router(std::string_view doc_root_) + : solutionManager(std::make_shared()), + userManager(std::make_shared()), + taskManager(std::make_shared()), + doc_root(doc_root_) {} http::message_generator Router::handleRequest(http::request &&req) { std::cout << req << std::endl; - if(req.method() != http::verb::get && req.method() != http::verb::post) + if (req.method() != http::verb::get && req.method() != http::verb::post) return getBadRequest(req, "Unknown HTTP-method"); - if(req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) { + if (req.target().empty() || req.target()[0] != '/' || req.target().find("..") != beast::string_view::npos) { return getBadRequest(req, "Illegal request-target"); } @@ -39,4 +37,4 @@ http::message_generator Router::handleRequest(http::request & } return getBadRequest(req, "Unknown request-target"); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index 9dc7ffc..de400b7 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -1,21 +1,18 @@ #include "Serializer.h" -#include -#include #include +#include +#include -std::tuple -Serializer::deserialNewSolutionData(const std::string &val) { +std::tuple Serializer::deserialNewSolutionData( + const std::string &val) { std::stringstream ss; ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); std::tuple res = { - json.get("user_id"), - json.get("task_id"), - json.get("filename"), - json.get("filedata") - }; + json.get("user_id"), json.get("task_id"), json.get("filename"), + json.get("filedata")}; return res; } @@ -32,10 +29,7 @@ std::tuple Serializer::deserialTaskData(const std::str ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - std::tuple res = { - json.get("user_id"), - json.get("task_id") - }; + std::tuple res = {json.get("user_id"), json.get("task_id")}; return res; } @@ -52,10 +46,7 @@ std::tuple Serializer::deserialUserData(const std::str ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - std::tuple res = { - json.get("login"), - json.get("password") - }; + std::tuple res = {json.get("login"), json.get("password")}; return res; } @@ -65,10 +56,7 @@ std::tuple Serializer::deserialNewUserDat boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); std::tuple res = { - json.get("login"), - json.get("password"), - json.get("username") - }; + json.get("login"), json.get("password"), json.get("username")}; return res; } diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index fe73593..2a6b9c1 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -5,23 +5,21 @@ #include #include + #include "SolutionService.h" #include "TmpSolutionService.h" #include "Utils.h" -SolutionManager::SolutionManager() : - serializer(std::make_shared()), - solutionService(std::make_shared()) {}; +SolutionManager::SolutionManager() + : serializer(std::make_shared()), solutionService(std::make_shared()) {} -void SolutionManager::setService(std::shared_ptr service) { - solutionService = std::move(service); -} +void SolutionManager::setService(std::shared_ptr service) { solutionService = std::move(service); } http::message_generator SolutionManager::createSolution(http::request&& req) { size_t user_id, task_id; std::string filename, filedata; std::tie(user_id, task_id, filename, filedata) = serializer->deserialNewSolutionData(req.body()); -// Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); + // Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); try { Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata); @@ -32,7 +30,6 @@ http::message_generator SolutionManager::createSolution(http::requestserialSolution(sol); res.prepare_payload(); return res; - } catch (const std::exception& e) { return getBadRequest(req, e.what()); } @@ -42,7 +39,7 @@ http::message_generator SolutionManager::getAllSolutions(http::requestdeserialTaskData(req.body()); std::vector solutions; -// solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); + // solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); @@ -51,4 +48,3 @@ http::message_generator SolutionManager::getAllSolutions(http::request()), - taskService(std::make_shared()){} +TaskManager::TaskManager() : serializer(std::make_shared()), taskService(std::make_shared()) {} -void TaskManager::setService(std::shared_ptr service) { - taskService = service; -} +void TaskManager::setService(std::shared_ptr service) { taskService = service; } -http::message_generator TaskManager::createTask(http::request &&req) { +http::message_generator TaskManager::createTask(http::request &&req) { std::string description = serializer->deserialNewTaskData(req.body()); try { - taskService->createTask(description, 0.5); -// TmpTaskService::createTask(description); + // TmpTaskService::createTask(description); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); @@ -32,10 +28,10 @@ http::message_generator TaskManager::createTask(http::request &&req) { +http::message_generator TaskManager::getAllTasks(http::request &&req) { try { std::vector tasks = taskService->getAllTasks(); -// std::vector tasks = TmpTaskService::getAllTasks(); + // std::vector tasks = TmpTaskService::getAllTasks(); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index 8fe3ac9..881dd8b 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -3,16 +3,11 @@ #include "TmpUserService.h" #include "Utils.h" -UserManager::UserManager() : - serializer(std::make_shared()), - userService(std::make_shared()) {}; +UserManager::UserManager() : serializer(std::make_shared()), userService(std::make_shared()) {} -void UserManager::setService(std::shared_ptr service) { - userService = service; -} - -http::message_generator UserManager::loginUser(http::request &&req) { +void UserManager::setService(std::shared_ptr service) { userService = service; } +http::message_generator UserManager::loginUser(http::request &&req) { std::string login, password; std::tie(login, password) = serializer->deserialUserData(req.body()); @@ -44,9 +39,9 @@ http::message_generator UserManager::loginUser(http::request } } -http::message_generator UserManager::registerUser(http::request &&req) { +http::message_generator UserManager::registerUser(http::request &&req) { std::string login, password, username; - std::tie(login, password, username) = serializer->deserialNewUserData(req.body());\ + std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); try { User user = userService->createUser(login, username, password); diff --git a/server/internal/httpServer/src/Utils.cpp b/server/internal/httpServer/src/Utils.cpp index 18d89ae..a7f999f 100644 --- a/server/internal/httpServer/src/Utils.cpp +++ b/server/internal/httpServer/src/Utils.cpp @@ -1,12 +1,9 @@ #include "Utils.h" - -void fail(beast::error_code ec, const char *what) { - std::cerr << what << ": " << ec.message() << "\n"; -} +void fail(beast::error_code ec, const char* what) { std::cerr << what << ": " << ec.message() << "\n"; } http::response getBadRequest(const http::request& request, - beast::string_view why) { + beast::string_view why) { http::response res{http::status::bad_request, request.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/tests/RouterSuite.cpp b/server/internal/httpServer/tests/RouterSuite.cpp index 6fd7331..88f4f11 100644 --- a/server/internal/httpServer/tests/RouterSuite.cpp +++ b/server/internal/httpServer/tests/RouterSuite.cpp @@ -1,35 +1,35 @@ #include #include -#include "Router.h" #include "ISolutionManager.h" #include "ITaskManager.h" #include "IUserManager.h" +#include "Router.h" class SolutionManagerMock : public ISolutionManager { -public: + public: SolutionManagerMock() = default; - MOCK_METHOD(Response, getAllSolutions, (const Request &req), (override)); + MOCK_METHOD(Response, getAllSolutions, (const Request& req), (override)); MOCK_METHOD(Response, createSolution, (const Request& req), (override)); MOCK_METHOD(Response, getMetrics, (const Request& req), (override)); }; class TaskManagerMock : public ITaskManager { -public: + public: TaskManagerMock() = default; - MOCK_METHOD(Response, createTask, (const Request &req), (override)); + MOCK_METHOD(Response, createTask, (const Request& req), (override)); MOCK_METHOD(Response, getAllTasks, (const Request& req), (override)); }; class UserManagerMock : public IUserManager { -public: + public: UserManagerMock() = default; - MOCK_METHOD(Response, loginUser, (const Request &req), (override)); + MOCK_METHOD(Response, loginUser, (const Request& req), (override)); MOCK_METHOD(Response, registerUser, (const Request& req), (override)); }; class RouterSuite : public ::testing::Test { -protected: + protected: void SetUp() override { router.setSolutionManager(solutionManager); router.setUserManager(userManager); @@ -121,4 +121,4 @@ TEST_F(RouterSuite, BadUriTest) { Response res; router.handleRequest(req, res); EXPECT_EQ(res.status, 500); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/tests/SolutionManagerSuite.cpp b/server/internal/httpServer/tests/SolutionManagerSuite.cpp index fb5cc54..2a478f3 100644 --- a/server/internal/httpServer/tests/SolutionManagerSuite.cpp +++ b/server/internal/httpServer/tests/SolutionManagerSuite.cpp @@ -1,11 +1,11 @@ #include #include -#include "SolutionManager.h" #include "ISolutionService.h" +#include "SolutionManager.h" class SolutionServiceMock : public ISolutionService { -public: + public: SolutionServiceMock() = default; MOCK_METHOD(Solution, createSolution, (size_t userId, size_t taskId, std::string source), (override)); MOCK_METHOD(std::vector, getSolutionsByUserAndTaskId, (size_t userId, size_t taskId), (override)); @@ -14,10 +14,8 @@ public: }; class SolutionManagerSuite : public ::testing::Test { -protected: - void SetUp() override { - manager.setService(solutionService); - } + protected: + void SetUp() override { manager.setService(solutionService); } std::shared_ptr solutionService = std::make_shared(); SolutionManager manager; @@ -57,4 +55,4 @@ TEST_F(SolutionManagerSuite, CreateSolutionTest) { req.headers = {h1, h2, h3}; EXPECT_CALL(*solutionService, createSolution(1, 2, "int main() { return 0; }")); manager.createSolution(req); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/tests/TaskManagerSuite.cpp b/server/internal/httpServer/tests/TaskManagerSuite.cpp index f4822d2..9442619 100644 --- a/server/internal/httpServer/tests/TaskManagerSuite.cpp +++ b/server/internal/httpServer/tests/TaskManagerSuite.cpp @@ -1,11 +1,11 @@ #include #include -#include "TaskManager.h" #include "ITaskService.h" +#include "TaskManager.h" class TaskServiceMock : public ITaskService { -public: + public: TaskServiceMock() = default; ~TaskServiceMock() = default; @@ -16,10 +16,8 @@ public: }; class TaskManagerSuite : public ::testing::Test { -protected: - void SetUp() override { - manager.setService(taskService); - } + protected: + void SetUp() override { manager.setService(taskService); } std::shared_ptr taskService = std::make_shared(); TaskManager manager; @@ -39,4 +37,4 @@ TEST_F(TaskManagerSuite, GetAllTaskTest) { Request req; EXPECT_CALL(*taskService, getAllTasks); manager.getAllTasks(req); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/tests/UserManagerSuite.cpp b/server/internal/httpServer/tests/UserManagerSuite.cpp index ad6b9d4..26f5095 100644 --- a/server/internal/httpServer/tests/UserManagerSuite.cpp +++ b/server/internal/httpServer/tests/UserManagerSuite.cpp @@ -1,11 +1,11 @@ #include #include -#include "UserManager.h" #include "IUserService.h" +#include "UserManager.h" class UserServiceMock : public IUserService { -public: + public: UserServiceMock() = default; ~UserServiceMock() = default; MOCK_METHOD(User, createUser, (std::string login, std::string username, std::string password), (override)); @@ -14,10 +14,8 @@ public: }; class UserManagerSuite : public ::testing::Test { -protected: - void SetUp() override { - manager.setService(userService); - } + protected: + void SetUp() override { manager.setService(userService); } std::shared_ptr userService = std::make_shared(); UserManager manager; @@ -45,4 +43,4 @@ TEST_F(UserManagerSuite, RgisterUserTest) { req.headers = {h1, h2, h3}; EXPECT_CALL(*userService, createUser("1", "2", "3")); manager.registerUser(req); -} \ No newline at end of file +} diff --git a/server/internal/httpServer/tests/main.cpp b/server/internal/httpServer/tests/main.cpp index b8dd7bc..3d29e70 100644 --- a/server/internal/httpServer/tests/main.cpp +++ b/server/internal/httpServer/tests/main.cpp @@ -1,8 +1,8 @@ -#include #include +#include int main(int argc, char** argv) { - ::testing::InitGoogleMock(&argc, argv); + ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file + return RUN_ALL_TESTS(); +} diff --git a/server/internal/httpServer/virtual/ISolutionManager.h b/server/internal/httpServer/virtual/ISolutionManager.h index 62f0f2a..6ff52fe 100644 --- a/server/internal/httpServer/virtual/ISolutionManager.h +++ b/server/internal/httpServer/virtual/ISolutionManager.h @@ -7,7 +7,7 @@ namespace beast = boost::beast; namespace http = boost::beast::http; class ISolutionManager { -public: + public: virtual http::message_generator getAllSolutions(http::request&& req) = 0; virtual http::message_generator createSolution(http::request&& req) = 0; }; diff --git a/server/internal/httpServer/virtual/ITaskManager.h b/server/internal/httpServer/virtual/ITaskManager.h index 260e2a0..0b01c8a 100644 --- a/server/internal/httpServer/virtual/ITaskManager.h +++ b/server/internal/httpServer/virtual/ITaskManager.h @@ -1,16 +1,15 @@ #ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ #define APP_HTTPSERVER_HTTPSERVER_MANAGERS_ITaskMANAGER_H_ +#include #include #include -#include - namespace beast = boost::beast; namespace http = boost::beast::http; class ITaskManager { -public: + public: virtual http::message_generator createTask(http::request&& req) = 0; virtual http::message_generator getAllTasks(http::request&& req) = 0; }; diff --git a/server/internal/httpServer/virtual/IUserManager.h b/server/internal/httpServer/virtual/IUserManager.h index 913e4e8..5a467d4 100644 --- a/server/internal/httpServer/virtual/IUserManager.h +++ b/server/internal/httpServer/virtual/IUserManager.h @@ -1,16 +1,15 @@ #ifndef APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ #define APP_HTTPSERVER_HTTPSERVER_MANAGERS_IUserMANAGER_H_ +#include #include #include -#include - namespace beast = boost::beast; namespace http = boost::beast::http; class IUserManager { -public: + public: virtual http::message_generator loginUser(http::request&& req) = 0; virtual http::message_generator registerUser(http::request&& req) = 0; }; diff --git a/server/internal/metrics/include/TextMetricsLib.h b/server/internal/metrics/include/TextMetricsLib.h index 4db863f..b55f18a 100644 --- a/server/internal/metrics/include/TextMetricsLib.h +++ b/server/internal/metrics/include/TextMetricsLib.h @@ -14,32 +14,32 @@ class ITextMetric { public: - virtual ~ITextMetric() = default; - virtual void setData(std::string text1, std::string text2) = 0; - virtual double getMetric() = 0; + virtual ~ITextMetric() = default; + virtual void setData(std::string text1, std::string text2) = 0; + virtual double getMetric() = 0; }; class PrepareDataTextMetric : public ITextMetric { public: - void setData(std::string text1, std::string text2) override; + void setData(std::string text1, std::string text2) override; protected: - std::vector tokens1; - std::vector tokens2; + std::vector tokens1; + std::vector tokens2; private: - static std::string deleteComments(const std::string& text); - static std::vector tbmTokenizer(const std::string& text); + static std::string deleteComments(const std::string& text); + static std::vector tbmTokenizer(const std::string& text); }; class LevDistTextMetric : public PrepareDataTextMetric { public: - double getMetric() override; + double getMetric() override; }; class JaccardTextMetric : public PrepareDataTextMetric { public: - double getMetric() override; + double getMetric() override; }; #endif // SOURCEDOUT_DECLARATION_H diff --git a/server/internal/metrics/include/TokenMetricLib.h b/server/internal/metrics/include/TokenMetricLib.h index c333fe2..1edd676 100644 --- a/server/internal/metrics/include/TokenMetricLib.h +++ b/server/internal/metrics/include/TokenMetricLib.h @@ -5,38 +5,37 @@ #ifndef SOURCEDOUT_TOKENMETRICLIB_H #define SOURCEDOUT_TOKENMETRICLIB_H +#include #include -#include -#include -#include #include +#include +#include +#include -#include - - -class ITokenMetric{ - public: +class ITokenMetric { + public: virtual ~ITokenMetric() = default; virtual void setData(std::vector tokens1, std::vector tokens2) = 0; virtual double getMetric() = 0; }; -class PrepareDataTokenMetric : public ITokenMetric{ -public: +class PrepareDataTokenMetric : public ITokenMetric { + public: void setData(std::vector _tokens1, std::vector _tokens2) override; -protected: - std::vector tokens1; - std::vector tokens2; + + protected: + std::vector tokens1; + std::vector tokens2; }; -class LevDistTokenMetric : public PrepareDataTokenMetric{ -public: +class LevDistTokenMetric : public PrepareDataTokenMetric { + public: double getMetric() override; }; -class WShinglingTokenMetric : public PrepareDataTokenMetric{ -public: +class WShinglingTokenMetric : public PrepareDataTokenMetric { + public: double getMetric() override; }; -#endif //SOURCEDOUT_TOKENMETRICLIB_H +#endif // SOURCEDOUT_TOKENMETRICLIB_H diff --git a/server/internal/metrics/src/TextMetricImpl.cpp b/server/internal/metrics/src/TextMetricImpl.cpp index 848c36b..f886e3b 100644 --- a/server/internal/metrics/src/TextMetricImpl.cpp +++ b/server/internal/metrics/src/TextMetricImpl.cpp @@ -4,7 +4,6 @@ #include "TextMetricsLib.h" - void PrepareDataTextMetric::setData(std::string text1, std::string text2) { std::string non_comm_text1 = deleteComments(text1); std::string non_comm_text2 = deleteComments(text2); @@ -13,7 +12,7 @@ void PrepareDataTextMetric::setData(std::string text1, std::string text2) { tokens2 = tbmTokenizer(non_comm_text2); } -std::string PrepareDataTextMetric::deleteComments(const std::string& text) { +std::string PrepareDataTextMetric::deleteComments(const std::string &text) { std::string modif; std::string res; @@ -22,7 +21,7 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { ss << text; - while(getline(ss, line)){ + while (getline(ss, line)) { line.push_back('\0'); modif += line; } @@ -30,17 +29,17 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { bool s_comm = false; bool m_comm = false; - for (size_t i = 0; i < modif.size(); i++){ + for (size_t i = 0; i < modif.size(); i++) { if (s_comm && modif[i] == '\0') s_comm = false; - else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') - m_comm = false, i++; + else if (m_comm && modif[i] == '*' && modif[i + 1] == '/') + m_comm = false, i++; else if (s_comm || m_comm) continue; - else if (modif[i] == '/' && modif[i+1] == '/') + else if (modif[i] == '/' && modif[i + 1] == '/') s_comm = true, i++; - else if (modif[i] == '/' && modif[i+1] == '*') - m_comm = true, i++; + else if (modif[i] == '/' && modif[i + 1] == '*') + m_comm = true, i++; else if (modif[i] != '\0') res += modif[i]; @@ -50,68 +49,62 @@ std::string PrepareDataTextMetric::deleteComments(const std::string& text) { return res; } -std::vector PrepareDataTextMetric::tbmTokenizer(const std::string &text) { - boost::char_separator sep(" {}();,\"\0\'"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); +std::vector PrepareDataTextMetric::tbmTokenizer(const std::string &text) { + boost::char_separator sep(" {}();,\"\0\'"); + std::vector res; + boost::tokenizer > tokens(text, sep); - for (const std::string &s: tokens) { - if (!s.empty() && s[0] != '\n' && s[0] != '\0'){ + for (const std::string &s : tokens) { + if (!s.empty() && s[0] != '\n' && s[0] != '\0') { res.push_back(s); } } return res; } -double LevDistTextMetric::getMetric(){ +double LevDistTextMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); int x, y, z; - std::vector > lev (n, std::vector (m, 0)); + std::vector > lev(n, std::vector(m, 0)); - for (size_t i = 0; i < n; i++){ - for (size_t j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = static_cast (std::max(i, j)); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; + for (size_t i = 0; i < n; i++) { + for (size_t j = 0; j < m; j++) { + if (std::min(i, j) == 0) { + lev[i][j] = static_cast(std::max(i, j)); + } else { + x = lev[i - 1][j]; + y = lev[i][j - 1]; + z = lev[i - 1][j - 1]; lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ + if (tokens1[i] != tokens2[j]) { lev[i][j]++; } } } } - if (n == 0 || m == 0) - return 0; - double res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); - return res; + if (n == 0 || m == 0) return 0; + double res = 1.0 - static_cast(lev[n - 1][m - 1]) / static_cast(std::max(n, m)); + return res; } - double JaccardTextMetric::getMetric() { - std::set s1; - std::set s2; + std::set s1; + std::set s2; for (auto &i : tokens1) s1.insert(i); for (auto &i : tokens2) s2.insert(i); - std::set intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(intersect_sets, intersect_sets.begin())); std::set union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(union_sets, union_sets.begin())); if (union_sets.empty()) return 0; else - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); + return static_cast(intersect_sets.size()) / static_cast(union_sets.size()); } diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 70cba71..5e27fe8 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -9,68 +9,61 @@ double LevDistTokenMetric::getMetric() { unsigned long m = tokens2.size(); int x, y, z; - std::vector > lev (n, std::vector (m, 0)); - - for (size_t i = 0; i < n; i++){ - for (size_t j = 0; j < m; j++){ - if (std::min(i, j) == 0){ - lev[i][j] = static_cast (std::max(i, j)); - } - else{ - x = lev[i-1][j]; - y = lev[i][j-1]; - z = lev[i-1][j-1]; + std::vector> lev(n, std::vector(m, 0)); + + for (size_t i = 0; i < n; i++) { + for (size_t j = 0; j < m; j++) { + if (std::min(i, j) == 0) { + lev[i][j] = static_cast(std::max(i, j)); + } else { + x = lev[i - 1][j]; + y = lev[i][j - 1]; + z = lev[i - 1][j - 1]; lev[i][j] = std::min(x, std::min(y, z)); - if (tokens1[i] != tokens2[j]){ + if (tokens1[i] != tokens2[j]) { lev[i][j]++; } } } } - if (n == 0 || m == 0) - return 0; - double res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); - return res; + if (n == 0 || m == 0) return 0; + double res = 1.0 - static_cast(lev[n - 1][m - 1]) / static_cast(std::max(n, m)); + return res; } double WShinglingTokenMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); - if (n == 0 || m == 0 || (n < 3 && m < 3)) - return 0; + if (n == 0 || m == 0 || (n < 3 && m < 3)) return 0; - std::vector > sh1; - std::vector > sh2; + std::vector> sh1; + std::vector> sh2; - for (size_t i = 0; i < n - 3; i++){ - sh1.emplace_back(tokens1[i], tokens1[i+1], tokens1[i+2]); + for (size_t i = 0; i < n - 3; i++) { + sh1.emplace_back(tokens1[i], tokens1[i + 1], tokens1[i + 2]); } - for (size_t i = 0; i < m - 3; i++){ - sh2.emplace_back(tokens2[i], tokens2[i+1], tokens2[i+2]); + for (size_t i = 0; i < m - 3; i++) { + sh2.emplace_back(tokens2[i], tokens2[i + 1], tokens2[i + 2]); } - std::set > s1; - std::set > s2; + std::set> s1; + std::set> s2; for (auto &i : sh1) s1.insert(i); for (auto &i : sh2) s2.insert(i); + std::set> intersect_sets; + set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(intersect_sets, intersect_sets.begin())); - std::set> intersect_sets; - set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(intersect_sets, intersect_sets.begin())); - - std::set> union_sets; - set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), - std::inserter(union_sets, union_sets.begin())); + std::set> union_sets; + set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(union_sets, union_sets.begin())); if (union_sets.empty()) return 0; else - return static_cast (intersect_sets.size()) / static_cast (union_sets.size()); - + return static_cast(intersect_sets.size()) / static_cast(union_sets.size()); } void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) { diff --git a/server/internal/metrics/tests/src/main.cpp b/server/internal/metrics/tests/src/main.cpp index 70cfa61..50ba1ce 100644 --- a/server/internal/metrics/tests/src/main.cpp +++ b/server/internal/metrics/tests/src/main.cpp @@ -5,9 +5,8 @@ #include #include -int main(int argc, char **argv) -{ +int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/server/internal/metrics/tests/src/text_metrics_tests.cpp b/server/internal/metrics/tests/src/text_metrics_tests.cpp index 70560d7..35f5dbf 100644 --- a/server/internal/metrics/tests/src/text_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/text_metrics_tests.cpp @@ -8,60 +8,50 @@ #include "TextMetricsLib.h" class LevDistTextMetricTest : public ::testing::Test { -protected: - std::unique_ptr levDistTextMetric; - void SetUp(){ - levDistTextMetric = std::make_unique (); - } - void TearDown(){} + protected: + std::unique_ptr levDistTextMetric; + void SetUp() { levDistTextMetric = std::make_unique(); } + void TearDown() {} }; class JaccardTextMetricTest : public ::testing::Test { -protected: - std::unique_ptr jaccardTextMetric; - void SetUp(){ - jaccardTextMetric = std::make_unique (); - } - void TearDown(){} + protected: + std::unique_ptr jaccardTextMetric; + void SetUp() { jaccardTextMetric = std::make_unique(); } + void TearDown() {} }; TEST_F(LevDistTextMetricTest, check_eq_progs) { - levDistTextMetric->setData("a b c d e f", "a b c d e f"); EXPECT_EQ(levDistTextMetric->getMetric(), 1); } TEST_F(LevDistTextMetricTest, check_absolutely_not_eq_progs) { - levDistTextMetric->setData("a b c", "d e f g"); EXPECT_EQ(levDistTextMetric->getMetric() < 0.5, true); } TEST_F(LevDistTextMetricTest, test_with_empty_prog) { - levDistTextMetric->setData("a b c", ""); EXPECT_EQ(levDistTextMetric->getMetric(), 0); } -TEST_F(JaccardTextMetricTest, check_eq_progs){ - +TEST_F(JaccardTextMetricTest, check_eq_progs) { jaccardTextMetric->setData("a b c d e f", "d e a b c f"); EXPECT_EQ(jaccardTextMetric->getMetric(), 1); } TEST_F(JaccardTextMetricTest, check_absolutely_not_eq_progs) { - jaccardTextMetric->setData("a b c", "d e f g"); EXPECT_EQ(jaccardTextMetric->getMetric(), 0); } TEST_F(JaccardTextMetricTest, test_with_empty_prog) { - jaccardTextMetric->setData("a b c", ""); EXPECT_EQ(jaccardTextMetric->getMetric(), 0); diff --git a/server/internal/metrics/tests/src/token_metrics_tests.cpp b/server/internal/metrics/tests/src/token_metrics_tests.cpp index 0e50eed..608e11b 100644 --- a/server/internal/metrics/tests/src/token_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/token_metrics_tests.cpp @@ -11,26 +11,21 @@ #include "TokenMetricLib.h" class LevDistTokenMetricTest : public ::testing::Test { -protected: - std::unique_ptr levDistTokenMetric; - void SetUp(){ - levDistTokenMetric = std::make_unique (); - } - void TearDown(){} + protected: + std::unique_ptr levDistTokenMetric; + void SetUp() { levDistTokenMetric = std::make_unique(); } + void TearDown() {} }; class WShinglingTokenMetricTest : public ::testing::Test { -protected: - std::unique_ptr wShinglingTokenMetric; - void SetUp(){ - wShinglingTokenMetric = std::make_unique (); - } - void TearDown(){} + protected: + std::unique_ptr wShinglingTokenMetric; + void SetUp() { wShinglingTokenMetric = std::make_unique(); } + void TearDown() {} }; TEST_F(LevDistTokenMetricTest, check_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; + std::vector tokens1 = {1, 2, 3}; levDistTokenMetric->setData(tokens1, tokens1); @@ -38,9 +33,8 @@ TEST_F(LevDistTokenMetricTest, check_eq_progs) { } TEST_F(LevDistTokenMetricTest, check_absolutely_not_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {3, 4, 5, 6}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {3, 4, 5, 6}; levDistTokenMetric->setData(tokens1, tokens2); @@ -48,19 +42,17 @@ TEST_F(LevDistTokenMetricTest, check_absolutely_not_eq_progs) { } TEST_F(LevDistTokenMetricTest, test_with_empty_prog) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; levDistTokenMetric->setData(tokens1, tokens2); EXPECT_EQ(levDistTokenMetric->getMetric(), 0); } -TEST_F(WShinglingTokenMetricTest, check_eq_progs){ - - std::vector tokens1 = {1, 2, 3, 4, 5, 6}; - std::vector tokens2 = {1, 2, 3, 4, 5, 6}; +TEST_F(WShinglingTokenMetricTest, check_eq_progs) { + std::vector tokens1 = {1, 2, 3, 4, 5, 6}; + std::vector tokens2 = {1, 2, 3, 4, 5, 6}; wShinglingTokenMetric->setData(tokens1, tokens1); @@ -68,9 +60,8 @@ TEST_F(WShinglingTokenMetricTest, check_eq_progs){ } TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {4, 5, 6, 1}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {4, 5, 6, 1}; wShinglingTokenMetric->setData(tokens1, tokens1); @@ -78,16 +69,10 @@ TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { } TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { - - std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {}; + std::vector tokens1 = {1, 2, 3}; + std::vector tokens2 = {}; wShinglingTokenMetric->setData(tokens1, tokens1); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } - - - - - diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp index 6e23e90..ca0fa5f 100644 --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -1,16 +1,17 @@ #ifndef SOURCEDOUT_METRICREPOSITORY_HPP #define SOURCEDOUT_METRICREPOSITORY_HPP +#include +#include + #include "IMetricRepository.hpp" #include "dbManager.hpp" -#include -#include using namespace pqxx; -class MetricRepository :public IMetricRepository { -public: - explicit MetricRepository(); +class MetricRepository : public IMetricRepository { + public: + MetricRepository(); std::optional getById(size_t id) override; @@ -22,10 +23,10 @@ public: void deleteMetricById(size_t id) override; -private: + private: std::shared_ptr manager; static MetricStat makeMetric(const result::const_iterator &c); }; -#endif //SOURCEDOUT_METRICREPOSITORY_HPP +#endif // SOURCEDOUT_METRICREPOSITORY_HPP diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 8e178cf..07a04ff 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -1,20 +1,20 @@ #ifndef SOURCEDOUT_SOLUTIONREPOSITORY_HPP #define SOURCEDOUT_SOLUTIONREPOSITORY_HPP -#include -#include #include #include -#include "ISolutionRepository.hpp" -#include "dbManager.hpp" +#include #include +#include +#include "ISolutionRepository.hpp" +#include "dbManager.hpp" using namespace pqxx; class SolutionRepository : public ISolutionRepository { -public: - explicit SolutionRepository(); + public: + SolutionRepository(); std::optional getSolutionById(size_t id) override; @@ -32,7 +32,7 @@ public: std::optional getOriginalSolution(size_t id) override; -private: + private: static Solution makeSolution(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 8542887..3bc409b 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -3,17 +3,17 @@ #include #include +#include + #include "ITaskRepository.hpp" -#include "pqxx/pqxx" #include "dbManager.hpp" -#include +#include "pqxx/pqxx" using namespace pqxx; - class TaskRepository : public ITaskRepository { -public: - explicit TaskRepository(); + public: + TaskRepository(); std::optional getTaskById(size_t id) override; std::vector getAllTasks() override; @@ -26,10 +26,10 @@ public: void deleteTaskById(size_t task_id) override; -private: - static Task makeTask(const result::const_iterator &c); + private: + static Task makeTask(const result::const_iterator& c); std::shared_ptr manager; }; -#endif //SOURCEDOUT_TASKREPOSITORY_HPP +#endif // SOURCEDOUT_TASKREPOSITORY_HPP diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index b55d3a9..136e5cd 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -1,20 +1,20 @@ #ifndef SOURCEDOUT_USERREPOSITORY_HPP #define SOURCEDOUT_USERREPOSITORY_HPP -#include -#include "IUserRepository.hpp" -#include "dbManager.hpp" -#include #include #include +#include #include +#include -using namespace pqxx; +#include "IUserRepository.hpp" +#include "dbManager.hpp" +using namespace pqxx; class UserRepository : public IUserRepository { -public: - explicit UserRepository(); + public: + UserRepository(); std::optional getUserById(size_t id) override; @@ -30,11 +30,10 @@ public: void update(User user) override; - -private: + private: static User makeUser(const result::const_iterator &c); std::shared_ptr manager; }; -#endif //SOURCEDOUT_USERREPOSITORY_HPP +#endif // SOURCEDOUT_USERREPOSITORY_HPP diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp index d6d265a..33189de 100644 --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -1,7 +1,9 @@ -#include "MetricStat.hpp" #include "MetricRepository.hpp" + #include +#include "MetricStat.hpp" + std::optional MetricRepository::getById(size_t id) { try { auto c = manager->connection(); @@ -9,34 +11,30 @@ std::optional MetricRepository::getById(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if(r.empty()) - return std::nullopt; + if (r.empty()) return std::nullopt; return makeMetric(r.begin()); } catch (...) { - - throw; + throw; } } - size_t MetricRepository::storeMetric(MetricStat metric) { try { auto c = manager->connection(); - std::string sql = ( - boost::format( - "INSERT INTO metricStat (solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) " \ - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % metric.getSolutionId() % - metric.getTextBasedRes() % metric.getTokenBasedRes() % metric.getTreeBasedRes() % metric.isVerdict() % - metric.getMeanRes()).str(); + std::string sql = (boost::format("INSERT INTO metricStat (solution_id, text_based_res, token_based_res, " + "tree_based_res, verdict, mean_res) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % + metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()) + .str(); work w(*c); row r = (w.exec1(sql)); w.commit(); manager->freeConnection(c); return r["id"].as(); } catch (...) { - - throw; + throw; } } @@ -44,22 +42,21 @@ void MetricRepository::updateMetric(MetricStat metric) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE metricStat SET solution_id = '%s', text_based_res = '%s', token_based_res = '%s', tree_based_res = '%s', verdict = '%s', mean_res = '%s';") - % metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % - metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()).str(); + std::string sql = + (boost::format("UPDATE metricStat SET solution_id = '%s', text_based_res = '%s', token_based_res " + "= '%s', tree_based_res = '%s', verdict = '%s', mean_res = '%s';") % + metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % metric.getTreeBasedRes() % + metric.isVerdict() % metric.getMeanRes()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); } catch (...) { - - throw; + throw; } } -void MetricRepository::deleteMetric(MetricStat metric) { - deleteMetricById(metric.getId()); -} +void MetricRepository::deleteMetric(MetricStat metric) { deleteMetricById(metric.getId()); } void MetricRepository::deleteMetricById(size_t id) { try { @@ -81,10 +78,7 @@ MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { c.at(c.column_number("token_based_res")).as(), c.at(c.column_number("tree_based_res")).as(), c.at(c.column_number("verdict")).as(), - c.at(c.column_number("mean_res")).as() - }; + c.at(c.column_number("mean_res")).as()}; } -MetricRepository::MetricRepository() { - manager = std::make_shared(); -} +MetricRepository::MetricRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 353ad9b..c3adfca 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -1,8 +1,10 @@ +#include "SolutionRepository.hpp" + +#include #include #include -#include + #include "Solution.hpp" -#include "SolutionRepository.hpp" using namespace pqxx; @@ -13,11 +15,9 @@ std::optional SolutionRepository::getSolutionById(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if (r.empty()) - return std::nullopt; + if (r.empty()) return std::nullopt; return makeSolution(r.begin()); } catch (...) { - throw; } } @@ -29,20 +29,15 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple row; while (stream >> row) { - solutions.emplace_back( - get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row)); } stream.complete(); manager->freeConnection(c); return solutions; } catch (...) { - throw; } } @@ -54,20 +49,15 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple row; while (stream >> row) { - solutions.emplace_back( - get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row)); } stream.complete(); manager->freeConnection(c); return solutions; } catch (...) { - throw; } } @@ -79,25 +69,24 @@ std::optional SolutionRepository::getOriginalSolution(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if (r.empty()) - return std::nullopt; + if (r.empty()) return std::nullopt; return makeSolution(r.begin()); } catch (...) { - throw; } } - size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = ( - boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, astTree, original_solution_id) " \ - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % solution.getSendDate() % - solution.getSenderId() % solution.getSource() % solution.getTaskId() % solution.getResult() % - solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()).str(); + std::string sql = + (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " + "astTree, original_solution_id) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()) + .str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -112,17 +101,17 @@ void SolutionRepository::updateSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," - " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', original_solution_id = '%s';") - % solution.getSendDate() % solution.getSenderId() % solution.getSource() % - solution.getTaskId() % solution.getResult() % solution.getTokens() % - solution.getAstTree() % solution.getOrigSolution()).str(); + std::string sql = + (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " + "original_solution_id = '%s';") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); } catch (...) { - throw; } } @@ -136,15 +125,11 @@ void SolutionRepository::deleteSolutionById(size_t id) { w.commit(); manager->freeConnection(c); } catch (...) { - throw; } } -void SolutionRepository::deleteSolution(Solution solution) { - deleteSolutionById(solution.getId()); -} - +void SolutionRepository::deleteSolution(Solution solution) { deleteSolutionById(solution.getId()); } Solution SolutionRepository::makeSolution(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), @@ -158,6 +143,4 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("original_solution_id")).as()}; } -SolutionRepository::SolutionRepository() { - manager = std::make_shared(); -} +SolutionRepository::SolutionRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 261436c..dd123f2 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,8 +1,10 @@ +#include "TaskRepository.hpp" + #include -#include "Task.hpp" #include #include -#include "TaskRepository.hpp" + +#include "Task.hpp" std::optional TaskRepository::getTaskById(size_t id) { try { @@ -28,14 +30,13 @@ std::vector TaskRepository::getAllTasks() { auto stream = stream_from::query(n, sql); std::vector tasks; std::tuple row; - while(stream >> row){ + while (stream >> row) { tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row)); } stream.complete(); manager->freeConnection(c); return tasks; } catch (...) { - throw; } } @@ -44,7 +45,8 @@ void TaskRepository::updateTask(const Task &task) { try { auto c = manager->connection(); std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s';") % - task.getDescription() % task.getTreshhold()).str(); + task.getDescription() % task.getTreshhold()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -56,8 +58,10 @@ void TaskRepository::updateTask(const Task &task) { size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO tasks (description, treshold) " \ - "VALUES ('%s', '%s') RETURNING id; ") % task.getDescription() % task.getTreshhold()).str(); + std::string sql = (boost::format("INSERT INTO tasks (description, treshold) " + "VALUES ('%s', '%s') RETURNING id; ") % + task.getDescription() % task.getTreshhold()) + .str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -68,9 +72,7 @@ size_t TaskRepository::storeTask(Task task) { } } -void TaskRepository::deleteTask(Task task) { - deleteTaskById(task.getId()); -} +void TaskRepository::deleteTask(Task task) { deleteTaskById(task.getId()); } void TaskRepository::deleteTaskById(size_t task_id) { try { @@ -86,12 +88,8 @@ void TaskRepository::deleteTaskById(size_t task_id) { } Task TaskRepository::makeTask(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("description")).as(), + return {c.at(c.column_number("id")).as(), c.at(c.column_number("description")).as(), c.at(c.column_number("treshold")).as()}; } - -TaskRepository::TaskRepository() { - manager = std::make_shared(); -} +TaskRepository::TaskRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 71e05a5..4d647b9 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -1,9 +1,11 @@ +#include "UserRepository.hpp" + #include +#include + #include "User.hpp" -#include "UserRepository.hpp" #include "dbManager.hpp" -#include std::optional UserRepository::getUserById(size_t id) { try { @@ -12,11 +14,9 @@ std::optional UserRepository::getUserById(size_t id) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if (r.empty()) - return std::nullopt; + if (r.empty()) return std::nullopt; return makeUser(r.begin()); } catch (...) { - throw; } } @@ -28,11 +28,9 @@ std::optional UserRepository::getUserByLogin(std::string login) { nontransaction n(*c); result r(n.exec(sql)); manager->freeConnection(c); - if(r.empty()) - return std::nullopt; + if (r.empty()) return std::nullopt; return makeUser(r.begin()); } catch (...) { - throw; } } @@ -41,16 +39,16 @@ size_t UserRepository::makeUser(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO users (login,password,username) " \ - "VALUES ('%s', '%s', '%s') RETURNING id; ") % user.getLogin() % user.getPassword() % - user.getUsername()).str(); + std::string sql = (boost::format("INSERT INTO users (login,password,username) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + user.getLogin() % user.getPassword() % user.getUsername()) + .str(); work w(*c); row r = w.exec1(sql); w.commit(); manager->freeConnection(c); return r["id"].as(); } catch (...) { - throw; } } @@ -64,15 +62,11 @@ void UserRepository::deleteByUserId(size_t user_id) { w.commit(); manager->freeConnection(c); } catch (...) { - throw; } } - -void UserRepository::deleteUser(User user) { - deleteByUserId(user.getId()); -} +void UserRepository::deleteUser(User user) { deleteByUserId(user.getId()); } std::vector UserRepository::getAllUsers() { try { @@ -82,41 +76,35 @@ std::vector UserRepository::getAllUsers() { auto stream = stream_from::query(n, sql); std::vector users; std::tuple row; - while(stream >> row){ + while (stream >> row) { users.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); } stream.complete(); manager->freeConnection(c); return users; } catch (...) { - throw; } } User UserRepository::makeUser(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("login")).as(), - c.at(c.column_number("password")).as(), - c.at(c.column_number("username")).as()}; + return {c.at(c.column_number("id")).as(), c.at(c.column_number("login")).as(), + c.at(c.column_number("password")).as(), c.at(c.column_number("username")).as()}; } -UserRepository::UserRepository() { - manager = std::make_shared(); -} +UserRepository::UserRepository() { manager = std::make_shared(); } void UserRepository::update(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE Users SET login = '%s', password = '%s', username = '%s';") - % user.getLogin() % user.getPassword() % user.getUsername()).str(); + std::string sql = (boost::format("UPDATE Users SET login = '%s', password = '%s', username = '%s';") % + user.getLogin() % user.getPassword() % user.getUsername()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); } catch (...) { - throw; } } diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index fa77602..c14d237 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -1,10 +1,12 @@ -#include #include +#include + +#include + #include "MetricRepository.hpp" -#include "UserRepository.hpp" #include "SolutionRepository.hpp" #include "TaskRepository.hpp" -#include +#include "UserRepository.hpp" TEST(UserRepository_CRUD_Test, CRUD) { UserRepository rep; @@ -35,8 +37,7 @@ TEST(TaskRepository_CRUD_Test, CRUD) { task.setId(id); std::optional new_task_opt = rep.getTaskById(id); Task new_task; - if (new_task_opt) - new_task = new_task_opt.value(); + if (new_task_opt) new_task = new_task_opt.value(); EXPECT_EQ(task, new_task); new_task.setDescription("new_test_description"); EXPECT_NO_FATAL_FAILURE(rep.updateTask(new_task)); @@ -52,8 +53,7 @@ TEST(SolutionRepository_CRUD_Test, CRUD) { solution.setId(id); std::optional new_solution_opt = rep.getSolutionById(id); Solution new_solution; - if (new_solution_opt) - new_solution = new_solution_opt.value(); + if (new_solution_opt) new_solution = new_solution_opt.value(); EXPECT_EQ(solution, new_solution); new_solution.setSource(":/D"); EXPECT_NO_FATAL_FAILURE(rep.updateSolution(new_solution)); @@ -68,8 +68,7 @@ TEST(MetricRepository_CRUD_Test, CRUD) { metricStat.setId(id); std::optional new_stat_opt = rep.getById(id); MetricStat new_stat; - if (new_stat_opt) - new_stat = new_stat_opt.value(); + if (new_stat_opt) new_stat = new_stat_opt.value(); EXPECT_EQ(metricStat, new_stat); new_stat.setMeanRes(1); EXPECT_NO_FATAL_FAILURE(rep.updateMetric(new_stat)); @@ -78,8 +77,7 @@ TEST(MetricRepository_CRUD_Test, CRUD) { TEST(UserRepository_CRUD_Test, getAllUsers) { UserRepository rep; - std::vector v = {{"test@test.com", "test", "testuser"}, - {"test2@test.com", "test2", "testuser2"}}; + std::vector v = {{"test@test.com", "test", "testuser"}, {"test2@test.com", "test2", "testuser2"}}; EXPECT_NO_FATAL_FAILURE(rep.getAllUsers()); std::vector new_v = rep.getAllUsers(); EXPECT_EQ(v, new_v); @@ -95,7 +93,6 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { User new_user; EXPECT_EQ(new_user_id, new_user_login); EXPECT_NO_FATAL_FAILURE(rep.deleteUser(user)); - } TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { @@ -104,7 +101,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); - size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); EXPECT_EQ(solution1, rep.getSolutionById(id1)); @@ -112,12 +108,11 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { solution2.setId(id2); EXPECT_EQ(solution2, rep.getSolutionById(id2)); std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1}, - {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1}}; + {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); - } TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { @@ -126,7 +121,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); - size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); size_t id2 = rep.storeSolution(solution2); @@ -136,7 +130,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); - } TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { @@ -173,4 +166,4 @@ TEST(MetricRepository_CRUD_Test, tryToStoreWithNotExistingSolution) { int main(int argc, char **argv) { ::testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/server/internal/repository/virtual/IMetricRepository.hpp b/server/internal/repository/virtual/IMetricRepository.hpp index fcd92fe..0034b50 100644 --- a/server/internal/repository/virtual/IMetricRepository.hpp +++ b/server/internal/repository/virtual/IMetricRepository.hpp @@ -1,13 +1,13 @@ #ifndef SOURCEDOUT_IMETRICREPOSITORY_HPP #define SOURCEDOUT_IMETRICREPOSITORY_HPP - #include #include + #include "MetricStat.hpp" class IMetricRepository { -public: + public: virtual std::optional getById(size_t id) = 0; virtual size_t storeMetric(MetricStat metric) = 0; @@ -19,4 +19,4 @@ public: virtual void deleteMetricById(size_t id) = 0; }; -#endif //SOURCEDOUT_IMETRICREPOSITORY_HPP +#endif // SOURCEDOUT_IMETRICREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 383d04d..42f9eb5 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -2,12 +2,13 @@ #define SOURCEDOUT_ISOLUTIONREPOSITORY_HPP #include +#include #include + #include "Solution.hpp" -#include class ISolutionRepository { -public: + public: virtual ~ISolutionRepository() = default; virtual std::optional getSolutionById(size_t id) = 0; @@ -27,4 +28,4 @@ public: virtual std::optional getOriginalSolution(size_t id) = 0; }; -#endif //SOURCEDOUT_ISOLUTIONREPOSITORY_HPP +#endif // SOURCEDOUT_ISOLUTIONREPOSITORY_HPP diff --git a/server/internal/repository/virtual/ITaskRepository.hpp b/server/internal/repository/virtual/ITaskRepository.hpp index b265946..f1fa1c6 100644 --- a/server/internal/repository/virtual/ITaskRepository.hpp +++ b/server/internal/repository/virtual/ITaskRepository.hpp @@ -2,19 +2,19 @@ #define SOURCEDOUT_ITASKREPOSITORY_HPP #include +#include #include + #include "Task.hpp" -#include class ITaskRepository { -public: + public: virtual ~ITaskRepository() = default; virtual std::optional getTaskById(size_t id) = 0; virtual std::vector getAllTasks() = 0; - virtual void updateTask(const Task& task) = 0; virtual size_t storeTask(Task task) = 0; @@ -24,4 +24,4 @@ public: virtual void deleteTaskById(size_t task_id) = 0; }; -#endif //SOURCEDOUT_ITASKREPOSITORY_HPP +#endif // SOURCEDOUT_ITASKREPOSITORY_HPP diff --git a/server/internal/repository/virtual/IUserRepository.hpp b/server/internal/repository/virtual/IUserRepository.hpp index feb2326..f723358 100644 --- a/server/internal/repository/virtual/IUserRepository.hpp +++ b/server/internal/repository/virtual/IUserRepository.hpp @@ -1,12 +1,13 @@ #ifndef SOURCEDOUT_IUSERREPOSITORY_HPP #define SOURCEDOUT_IUSERREPOSITORY_HPP +#include #include + #include "User.hpp" -#include class IUserRepository { -public: + public: virtual ~IUserRepository() = default; virtual std::optional getUserById(size_t id) = 0; @@ -22,7 +23,6 @@ public: virtual void deleteByUserId(size_t user_id) = 0; virtual std::vector getAllUsers() = 0; - }; -#endif //SOURCEDOUT_IUSERREPOSITORY_HPP +#endif // SOURCEDOUT_IUSERREPOSITORY_HPP diff --git a/server/internal/service/include/Exceptions.h b/server/internal/service/include/Exceptions.h index b15d632..5e52658 100644 --- a/server/internal/service/include/Exceptions.h +++ b/server/internal/service/include/Exceptions.h @@ -1,26 +1,25 @@ #pragma once class ValidateException : public std::exception { - std::string _msg; + std::string _msg; public: - ValidateException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + ValidateException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; - class LoginException : public std::exception { - std::string _msg; + std::string _msg; public: - LoginException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + LoginException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; class FileExtensionException : public std::exception { - std::string _msg; + std::string _msg; public: - FileExtensionException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + FileExtensionException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; \ No newline at end of file diff --git a/server/internal/service/include/Exeptions.h b/server/internal/service/include/Exeptions.h index 43925ff..d0c4c5e 100644 --- a/server/internal/service/include/Exeptions.h +++ b/server/internal/service/include/Exeptions.h @@ -1,9 +1,9 @@ #pragma once class ValidateExeption : public std::exception { - std::string _msg; + std::string _msg; public: - ValidateExeption(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + ValidateExeption(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; \ No newline at end of file diff --git a/server/internal/service/include/FileMethods.h b/server/internal/service/include/FileMethods.h index 0ff8df3..94e6f41 100644 --- a/server/internal/service/include/FileMethods.h +++ b/server/internal/service/include/FileMethods.h @@ -9,6 +9,5 @@ inline const std::string UNKNOWN_EXTENSION = ""; class FileMethods { public: - static std::pair checkFileExtension( - const std::string& filename); + static std::pair checkFileExtension(const std::string& filename); }; \ No newline at end of file diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index fba866b..7028696 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -13,31 +13,26 @@ class SolutionService : public ISolutionService { private: - std::unique_ptr solutionRepo; - std::unique_ptr taskRepo; - std::unique_ptr antlr; - std::unique_ptr textMetric; - std::unique_ptr tokenMetric; - void setAntlrWrapper(const std::string& fileExtension, - const std::string& filedata); - std::string setResultVerdict(float textBasedRes, float tokenBasedRes, - float treshold); - std::pair getMaxTextResMetric(std::vector& solutions, - const std::string& filedata, - float treshold); + std::unique_ptr solutionRepo; + std::unique_ptr taskRepo; + std::unique_ptr antlr; + std::unique_ptr textMetric; + std::unique_ptr tokenMetric; + void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); + std::string setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold); + std::pair getMaxTextResMetric(std::vector& solutions, const std::string& filedata, + float treshold); - std::pair getMaxTokenResMetric( - std::vector& solutions, std::vector& tokens, - float treshold); + std::pair getMaxTokenResMetric(std::vector& solutions, std::vector& tokens, + float treshold); public: - explicit SolutionService(std::unique_ptr solutionRepo, - std::unique_ptr taskRepo); - SolutionService(); - void setMetrics(std::unique_ptr metrics_) {}; - Solution createSolution(size_t userId, size_t taskId, - const std::string& filename, - const std::string& filedata) override; - void deleteSolutionById(size_t solId) override; - std::pair getMetrics(size_t solId) override; + explicit SolutionService(std::unique_ptr solutionRepo, + std::unique_ptr taskRepo); + SolutionService(); + void setMetrics(std::unique_ptr metrics_){}; + Solution createSolution(size_t userId, size_t taskId, const std::string& filename, + const std::string& filedata) override; + void deleteSolutionById(size_t solId) override; + std::pair getMetrics(size_t solId) override; }; diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index f4a60b7..e8867d3 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -7,13 +7,13 @@ class TaskService : public ITaskService { private: - std::unique_ptr taskRepo; + std::unique_ptr taskRepo; public: - explicit TaskService(std::unique_ptr taskRepo); - TaskService(); - Task createTask(const std::string& desc, float treshold = 0.5f) override; - Task getTask(size_t id) override; - std::vector getAllTasks() override; - void deleteTask(size_t id) override; + explicit TaskService(std::unique_ptr taskRepo); + TaskService(); + Task createTask(const std::string& desc, float treshold = 0.5f) override; + Task getTask(size_t id) override; + std::vector getAllTasks() override; + void deleteTask(size_t id) override; }; diff --git a/server/internal/service/include/UserService.h b/server/internal/service/include/UserService.h index a03b773..9223b77 100644 --- a/server/internal/service/include/UserService.h +++ b/server/internal/service/include/UserService.h @@ -7,13 +7,12 @@ class UserService : public IUserService { private: - std::unique_ptr userRepo; + std::unique_ptr userRepo; public: - explicit UserService(std::unique_ptr userRepo); - UserService(); - User createUser(const std::string& login, const std::string& username, - const std::string& password) override; - User login(const std::string& login, const std::string& password) override; - void deleteUser(size_t id) override; + explicit UserService(std::unique_ptr userRepo); + UserService(); + User createUser(const std::string& login, const std::string& username, const std::string& password) override; + User login(const std::string& login, const std::string& password) override; + void deleteUser(size_t id) override; }; diff --git a/server/internal/service/include/UserValidator.h b/server/internal/service/include/UserValidator.h index 34459b6..f506abb 100644 --- a/server/internal/service/include/UserValidator.h +++ b/server/internal/service/include/UserValidator.h @@ -4,10 +4,10 @@ class UserValidator { private: - static bool validateLogin(const std::string& login); - static bool validatePassword(const std::string& password); - static bool validateUsername(const std::string& username); + static bool validateLogin(const std::string& login); + static bool validatePassword(const std::string& password); + static bool validateUsername(const std::string& username); public: - static bool validate(const User& user); + static bool validate(const User& user); }; diff --git a/server/internal/service/include/Utils.h b/server/internal/service/include/Utils.h index 20c67c8..432521e 100644 --- a/server/internal/service/include/Utils.h +++ b/server/internal/service/include/Utils.h @@ -1,10 +1,10 @@ #pragma once -#include #include +#include class Utils { public: - static std::string convertIntArrayIntoString(std::vector& arr); - static std::vector convertStringIntoIntArray(const std::string& str); + static std::string convertIntArrayIntoString(std::vector& arr); + static std::vector convertStringIntoIntArray(const std::string& str); }; diff --git a/server/internal/service/src/FileMethods.cpp b/server/internal/service/src/FileMethods.cpp index 6304eea..0a5b695 100644 --- a/server/internal/service/src/FileMethods.cpp +++ b/server/internal/service/src/FileMethods.cpp @@ -3,13 +3,12 @@ #include #include -std::pair FileMethods::checkFileExtension( - const std::string& filename) { - if (filename.substr(filename.find_last_of(".") + 1) == CPP_EXTENSION) { - return std::make_pair(CPP_EXTENSION, true); - } - if (filename.substr(filename.find_last_of(".") + 1) == PYTHON_EXTENSION) { - return std::make_pair(PYTHON_EXTENSION, true); - } - return std::make_pair(UNKNOWN_EXTENSION, false); -} \ No newline at end of file +std::pair FileMethods::checkFileExtension(const std::string& filename) { + if (filename.substr(filename.find_last_of(".") + 1) == CPP_EXTENSION) { + return std::make_pair(CPP_EXTENSION, true); + } + if (filename.substr(filename.find_last_of(".") + 1) == PYTHON_EXTENSION) { + return std::make_pair(PYTHON_EXTENSION, true); + } + return std::make_pair(UNKNOWN_EXTENSION, false); +} diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 3071846..1d6d4e2 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -12,157 +12,139 @@ #include "Utils.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; -const std::string NOT_PLAGIAT_VERDICT = - "Красивое решение. А главное уникальное !"; +const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; -SolutionService::SolutionService( - std::unique_ptr solutionRepo, - std::unique_ptr taskRepo) - : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} +SolutionService::SolutionService(std::unique_ptr solutionRepo, + std::unique_ptr taskRepo) + : solutionRepo(std::move(solutionRepo)), taskRepo(std::move(taskRepo)) {} SolutionService::SolutionService() { - solutionRepo = std::make_unique(); - taskRepo = std::make_unique(); + solutionRepo = std::make_unique(); + taskRepo = std::make_unique(); } -void SolutionService::setAntlrWrapper(const std::string& fileExtension, - const std::string& filedata) { - std::istringstream in(filedata); - if (fileExtension == CPP_EXTENSION) { - antlr = std::make_unique(in); - } else if (fileExtension == PYTHON_EXTENSION) { - antlr = std::make_unique(in); - } -} - -std::string SolutionService::setResultVerdict(float textBasedRes, - float tokenBasedRes, - float treshold = 0.5f) { - float meanRes = (tokenBasedRes + textBasedRes) / 2; - if (meanRes < treshold) { - return NOT_PLAGIAT_VERDICT; - } - return PLAGIAT_VERDICT; -} - -std::pair SolutionService::getMaxTextResMetric( - std::vector& solutions, const std::string& filedata, - float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0); - for (auto sol : solutions) { - textMetric = std::make_unique(); - textMetric->setData(filedata, sol.getSource()); - float textBasedRes = float(textMetric->getMetric()); - - textMetric = std::make_unique(); - textMetric->setData(filedata, sol.getSource()); - textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; - - if (maxMatch.first < textBasedRes) { - maxMatch.first = textBasedRes; - maxMatch.second = sol.getSenderId(); +void SolutionService::setAntlrWrapper(const std::string& fileExtension, const std::string& filedata) { + std::istringstream in(filedata); + if (fileExtension == CPP_EXTENSION) { + antlr = std::make_unique(in); + } else if (fileExtension == PYTHON_EXTENSION) { + antlr = std::make_unique(in); } +} - if (textBasedRes > treshold) { - break; +std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold = 0.5f) { + float meanRes = (tokenBasedRes + textBasedRes) / 2; + if (meanRes < treshold) { + return NOT_PLAGIAT_VERDICT; } - } - return maxMatch; + return PLAGIAT_VERDICT; } -std::pair SolutionService::getMaxTokenResMetric( - std::vector& solutions, std::vector& tokens, - float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); - for (auto sol : solutions) { - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, - Utils::convertStringIntoIntArray(sol.getTokens())); - float tokenBasedRes = float(tokenMetric->getMetric()); - - tokenMetric = std::make_unique(); - tokenMetric->setData(tokens, - Utils::convertStringIntoIntArray(sol.getTokens())); - tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; - - if (maxMatch.first < tokenBasedRes) { - maxMatch.first = tokenBasedRes; - maxMatch.second = sol.getSenderId(); +std::pair SolutionService::getMaxTextResMetric(std::vector& solutions, + const std::string& filedata, float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0); + for (auto sol : solutions) { + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + float textBasedRes = float(textMetric->getMetric()); + + textMetric = std::make_unique(); + textMetric->setData(filedata, sol.getSource()); + textBasedRes = (textBasedRes + float(textMetric->getMetric())) / 2; + + if (maxMatch.first < textBasedRes) { + maxMatch.first = textBasedRes; + maxMatch.second = sol.getSenderId(); + } + + if (textBasedRes > treshold) { + break; + } } + return maxMatch; +} - if (tokenBasedRes > treshold) { - break; +std::pair SolutionService::getMaxTokenResMetric(std::vector& solutions, + std::vector& tokens, float treshold) { + std::pair maxMatch = std::make_pair(0.0, 0ul); + for (auto sol : solutions) { + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); + float tokenBasedRes = float(tokenMetric->getMetric()); + + tokenMetric = std::make_unique(); + tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); + tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; + + if (maxMatch.first < tokenBasedRes) { + maxMatch.first = tokenBasedRes; + maxMatch.second = sol.getSenderId(); + } + + if (tokenBasedRes > treshold) { + break; + } } - } - return maxMatch; + return maxMatch; } -Solution SolutionService::createSolution(size_t userId, size_t taskId, - const std::string& filename, +Solution SolutionService::createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) { - try { - std::pair fileExtension = - FileMethods::checkFileExtension(filename); - if (!fileExtension.second) { - throw FileExtensionException("unknown file extension"); + try { + std::pair fileExtension = FileMethods::checkFileExtension(filename); + if (!fileExtension.second) { + throw FileExtensionException("unknown file extension"); + } + + setAntlrWrapper(fileExtension.first, filedata); + std::vector tokensTypes = antlr->getTokensTypes(); + std::string astTree = antlr->getTreeString(); + + std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + + float treshold = taskRepo->getTaskById(taskId).value().getTreshhold(); + + std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); + + std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); + std::pair tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, treshold); + + std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); + + size_t plagiatUserId = -1; + if (result == PLAGIAT_VERDICT) { + if (textBasedRes.first > tokenBasedRes.first) { + plagiatUserId = textBasedRes.second; + } else { + plagiatUserId = tokenBasedRes.second; + } + } + + Solution sol = Solution(std::ctime(&now), userId, filedata, taskId, result, + Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatUserId); + size_t id = solutionRepo->storeSolution(sol); + sol.setId(id); + return sol; + } catch (...) { + throw; } - - setAntlrWrapper(fileExtension.first, filedata); - std::vector tokensTypes = antlr->getTokensTypes(); - std::string astTree = antlr->getTreeString(); - - std::time_t now = - std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - - float treshold = taskRepo->getTaskById(taskId).value().getTreshhold(); - - std::vector solutions = - solutionRepo->getSolutionsByTaskId(taskId); - - std::pair textBasedRes = - getMaxTextResMetric(solutions, filedata, treshold); - std::pair tokenBasedRes = - getMaxTokenResMetric(solutions, tokensTypes, treshold); - - std::string result = - setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); - - size_t plagiatUserId = -1; - if (result == PLAGIAT_VERDICT) { - if (textBasedRes.first > tokenBasedRes.first) { - plagiatUserId = textBasedRes.second; - } else { - plagiatUserId = tokenBasedRes.second; - } - } - - Solution sol = - Solution(std::ctime(&now), userId, filedata, taskId, - result, Utils::convertIntArrayIntoString(tokensTypes), astTree, - plagiatUserId); - size_t id = solutionRepo->storeSolution(sol); - sol.setId(id); - return sol; - } catch (...) { - throw; - } } void SolutionService::deleteSolutionById(size_t solId) { - try { - solutionRepo->deleteSolutionById(solId); - } catch (...) { - throw; - } + try { + solutionRepo->deleteSolutionById(solId); + } catch (...) { + throw; + } } std::pair SolutionService::getMetrics(size_t solId) { - try { - Solution sol = solutionRepo->getSolutionById(solId).value(); - std::string tokens = sol.getTokens(); - std::string astTree = sol.getAstTree(); - return std::make_pair(tokens, astTree); - } catch (...) { - throw; - } + try { + Solution sol = solutionRepo->getSolutionById(solId).value(); + std::string tokens = sol.getTokens(); + std::string astTree = sol.getAstTree(); + return std::make_pair(tokens, astTree); + } catch (...) { + throw; + } } diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 860bcf3..1e06979 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -1,42 +1,42 @@ #include "TaskService.h" + #include "TaskRepository.hpp" -TaskService::TaskService(std::unique_ptr taskRepo) - : taskRepo(std::move(taskRepo)) {} +TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(std::move(taskRepo)) {} TaskService::TaskService() { taskRepo = std::make_unique(); } Task TaskService::createTask(const std::string& desc, float treshold) { - try { - Task task = Task(desc, treshold); - size_t id = taskRepo->storeTask(task); - task.setId(id); - return task; - } catch (...) { - throw; - } + try { + Task task = Task(desc, treshold); + size_t id = taskRepo->storeTask(task); + task.setId(id); + return task; + } catch (...) { + throw; + } } std::vector TaskService::getAllTasks() { - try { - return taskRepo->getAllTasks(); - } catch (...) { - throw; - } + try { + return taskRepo->getAllTasks(); + } catch (...) { + throw; + } } Task TaskService::getTask(size_t id) { - try { - return taskRepo->getTaskById(id).value(); - } catch (...) { - throw; - } + try { + return taskRepo->getTaskById(id).value(); + } catch (...) { + throw; + } } void TaskService::deleteTask(size_t id) { - try { - taskRepo->deleteTaskById(id); - } catch (...) { - throw; - } + try { + taskRepo->deleteTaskById(id); + } catch (...) { + throw; + } } diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index 2757f18..f6dc444 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -1,48 +1,43 @@ #include "UserService.h" #include "Exceptions.h" -#include "UserValidator.h" #include "UserRepository.hpp" +#include "UserValidator.h" -UserService::UserService(std::unique_ptr userRepo) - : userRepo(std::move(userRepo)) {} +UserService::UserService(std::unique_ptr userRepo) : userRepo(std::move(userRepo)) {} -UserService::UserService() { - userRepo = std::make_unique(); -} +UserService::UserService() { userRepo = std::make_unique(); } -User UserService::createUser(const std::string& login, const std::string& username, - const std::string& password) { - User user = User(login, password, username); - if (!UserValidator::validate(user)) { - throw ValidateException("invalid user params"); - } - try { - size_t id = userRepo->makeUser(user); - user.setId(id); - return user; - } catch (...) { - throw; - } +User UserService::createUser(const std::string& login, const std::string& username, const std::string& password) { + User user = User(login, password, username); + if (!UserValidator::validate(user)) { + throw ValidateException("invalid user params"); + } + try { + size_t id = userRepo->makeUser(user); + user.setId(id); + return user; + } catch (...) { + throw; + } } User UserService::login(const std::string& login, const std::string& password) { - try { - User u = userRepo->getUserByLogin(login).value(); - if (u.getPassword() != password){ - throw LoginException("incorrect password"); + try { + User u = userRepo->getUserByLogin(login).value(); + if (u.getPassword() != password) { + throw LoginException("incorrect password"); + } + return u; + } catch (...) { + throw; } - return u; - } catch (...) { - throw; - } } - void UserService::deleteUser(size_t id) { - try { - userRepo->deleteByUserId(id); - } catch (...) { - throw; - } + try { + userRepo->deleteByUserId(id); + } catch (...) { + throw; + } } diff --git a/server/internal/service/src/UserValidator.cpp b/server/internal/service/src/UserValidator.cpp index b653fc9..0530fc0 100644 --- a/server/internal/service/src/UserValidator.cpp +++ b/server/internal/service/src/UserValidator.cpp @@ -4,31 +4,31 @@ #include bool UserValidator::validate(const User& user) { - if (validateLogin(user.getLogin()) && validatePassword(user.getPassword()) && - validateUsername(user.getUsername())) { - return true; - } - return false; + if (validateLogin(user.getLogin()) && validatePassword(user.getPassword()) && + validateUsername(user.getUsername())) { + return true; + } + return false; } bool UserValidator::validateLogin(const std::string& login) { - if (login.length() < 3 || login.length() > 30) { - return false; - } - const std::regex pattern("(\\w+)@(\\w+)(\\.(\\w+))+"); - return std::regex_match(login, pattern); + if (login.length() < 3 || login.length() > 30) { + return false; + } + const std::regex pattern("(\\w+)@(\\w+)(\\.(\\w+))+"); + return std::regex_match(login, pattern); } bool UserValidator::validatePassword(const std::string& password) { - if (password.length() < 8 || password.length() > 30) { - return false; - } - return true; + if (password.length() < 8 || password.length() > 30) { + return false; + } + return true; } bool UserValidator::validateUsername(const std::string& username) { - if (username.length() < 3 || username.length() > 20) { - return false; - } - return true; + if (username.length() < 3 || username.length() > 20) { + return false; + } + return true; } diff --git a/server/internal/service/src/Utils.cpp b/server/internal/service/src/Utils.cpp index 005748f..95a1629 100644 --- a/server/internal/service/src/Utils.cpp +++ b/server/internal/service/src/Utils.cpp @@ -7,17 +7,17 @@ #include std::string Utils::convertIntArrayIntoString(std::vector& arr) { - std::string str; - for (size_t i = 0; i < arr.size(); i++) { - str += std::to_string(arr[i]) + " "; - } - return str; + std::string str; + for (size_t i = 0; i < arr.size(); i++) { + str += std::to_string(arr[i]) + " "; + } + return str; } std::vector Utils::convertStringIntoIntArray(const std::string& str) { - std::stringstream ss(str); - std::vector v; + std::stringstream ss(str); + std::vector v; - std::copy(std::istream_iterator(ss), {}, back_inserter(v)); - return v; + std::copy(std::istream_iterator(ss), {}, back_inserter(v)); + return v; } diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index d4b3479..cd3ef23 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -4,109 +4,92 @@ #include "SolutionService.h" class Exception : public std::exception { - std::string _msg; + std::string _msg; public: - Exception(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + explicit Exception(const std::string& msg) : _msg(msg) {} + const char* what() const noexcept override { return _msg.c_str(); } }; class SolutionRepositoryMock : public ISolutionRepository { public: - ~SolutionRepositoryMock() override = default; - MOCK_METHOD(std::optional, getSolutionById, (size_t id), - (override)); - MOCK_METHOD(std::vector, getSolutionsBySenderId, (size_t sender_id), - (override)); - MOCK_METHOD(std::vector, getSolutionsByTaskId, (size_t task_id), - (override)); - MOCK_METHOD(size_t, storeSolution, (Solution solution), (override)); - MOCK_METHOD(void, updateSolution, (Solution solution), (override)); - MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); - MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); - MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), - (override)); + ~SolutionRepositoryMock() override = default; + MOCK_METHOD(std::optional, getSolutionById, (size_t id), (override)); + MOCK_METHOD(std::vector, getSolutionsBySenderId, (size_t sender_id), (override)); + MOCK_METHOD(std::vector, getSolutionsByTaskId, (size_t task_id), (override)); + MOCK_METHOD(size_t, storeSolution, (Solution solution), (override)); + MOCK_METHOD(void, updateSolution, (Solution solution), (override)); + MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); + MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); + MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), (override)); }; class TaskRepositoryMock : public ITaskRepository { public: - ~TaskRepositoryMock() override = default; - MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); - MOCK_METHOD(void, updateTask, (const Task& task), (override)); - MOCK_METHOD(size_t, storeTask, (Task task), (override)); - MOCK_METHOD(void, deleteTask, (Task task), (override)); - MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); - MOCK_METHOD(std::vector, getAllTasks, (), (override)); + ~TaskRepositoryMock() override = default; + MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (const Task& task), (override)); + MOCK_METHOD(size_t, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks, (), (override)); }; struct SolutionServiceTest : public testing::Test { - SolutionService* ss; - SolutionRepositoryMock* solutionMockPtr; - TaskRepositoryMock* taskMockPtr; - - void SetUp() { - auto sMock = std::make_unique(); - solutionMockPtr = sMock.get(); - auto tMock = std::make_unique(); - taskMockPtr = tMock.get(); - ss = new SolutionService(std::move(sMock), std::move(tMock)); - } - void TearDown() { delete ss; } + SolutionService* ss; + SolutionRepositoryMock* solutionMockPtr; + TaskRepositoryMock* taskMockPtr; + + void SetUp() { + auto sMock = std::make_unique(); + solutionMockPtr = sMock.get(); + auto tMock = std::make_unique(); + taskMockPtr = tMock.get(); + ss = new SolutionService(std::move(sMock), std::move(tMock)); + } + void TearDown() { delete ss; } }; -ACTION(NoSolutionException) { - throw Exception("no solution with this id in db"); -} +ACTION(NoSolutionException) { throw Exception("no solution with this id in db"); } TEST_F(SolutionServiceTest, deleteSolution) { - EXPECT_CALL(*solutionMockPtr, deleteSolutionById(1)).Times(1); - ss->deleteSolutionById(1); + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(1)).Times(1); + ss->deleteSolutionById(1); } TEST_F(SolutionServiceTest, deleteSolutionException) { - EXPECT_CALL(*solutionMockPtr, deleteSolutionById(-1)) - .Times(1) - .WillRepeatedly(NoSolutionException()); - EXPECT_THROW(ss->deleteSolutionById(-1), std::exception); + EXPECT_CALL(*solutionMockPtr, deleteSolutionById(-1)).Times(1).WillRepeatedly(NoSolutionException()); + EXPECT_THROW(ss->deleteSolutionById(-1), std::exception); } TEST_F(SolutionServiceTest, getMetrics) { - EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) - .Times(1) - .WillOnce(::testing::Return( - Solution(1, "", 1, "", 1, "", "tokens", "astTree", 1))); - std::pair metrics = ss->getMetrics(1); - EXPECT_EQ(metrics.first, "tokens"); - EXPECT_EQ(metrics.second, "astTree"); + EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) + .Times(1) + .WillOnce(::testing::Return(Solution(1, "", 1, "", 1, "", "tokens", "astTree", 1))); + std::pair metrics = ss->getMetrics(1); + EXPECT_EQ(metrics.first, "tokens"); + EXPECT_EQ(metrics.second, "astTree"); } TEST_F(SolutionServiceTest, getMetricsException) { - EXPECT_CALL(*solutionMockPtr, getSolutionById(-1)) - .Times(1) - .WillRepeatedly(NoSolutionException()); - EXPECT_THROW(ss->getMetrics(-1), std::exception); + EXPECT_CALL(*solutionMockPtr, getSolutionById(-1)).Times(1).WillRepeatedly(NoSolutionException()); + EXPECT_THROW(ss->getMetrics(-1), std::exception); } TEST_F(SolutionServiceTest, createSolution) { - EXPECT_CALL(*solutionMockPtr, - storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) - .Times(1) - .WillRepeatedly(::testing::Return(1)); - - std::vector solutions; - solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", - "45 132 85 86 89 59 1 128 90 -1", "", -1)); - EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)) - .Times(1) - .WillOnce(::testing::Return(solutions)); - - EXPECT_CALL(*taskMockPtr, getTaskById(1)) - .Times(1) - .WillOnce(::testing::Return(Task(1, "desription", 0.5f))); - - Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); - EXPECT_EQ(sol.getId(), 1); - EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); - EXPECT_EQ(sol.getTokens(), "45 132 85 86 89 59 1 128 90 -1 "); - EXPECT_EQ(sol.getResult(), "Не, ну вы не палитесь. Плагиат."); -} \ No newline at end of file + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) + .Times(1) + .WillRepeatedly(::testing::Return(1)); + + std::vector solutions; + solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); + + EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); + + Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); + EXPECT_EQ(sol.getId(), 1); + EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); + EXPECT_EQ(sol.getTokens(), "45 132 85 86 89 59 1 128 90 -1 "); + EXPECT_EQ(sol.getResult(), "Не, ну вы не палитесь. Плагиат."); +} diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp index 3e81339..d38eb3e 100644 --- a/server/internal/service/tests/TaskServiceTest.cpp +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -3,80 +3,69 @@ #include "TaskService.h" - class Exception : public std::exception { - std::string _msg; + std::string _msg; public: - Exception(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + explicit Exception(const std::string& msg) : _msg(msg) {} + const char* what() const noexcept override { return _msg.c_str(); } }; class TaskRepositoryMock : public ITaskRepository { public: - ~TaskRepositoryMock() override = default; - MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); - MOCK_METHOD(void, updateTask, (const Task& task), (override)); - MOCK_METHOD(size_t, storeTask, (Task task), (override)); - MOCK_METHOD(void, deleteTask, (Task task), (override)); - MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); - MOCK_METHOD(std::vector, getAllTasks,(),(override)); + ~TaskRepositoryMock() override = default; + MOCK_METHOD(std::optional, getTaskById, (size_t id), (override)); + MOCK_METHOD(void, updateTask, (const Task& task), (override)); + MOCK_METHOD(size_t, storeTask, (Task task), (override)); + MOCK_METHOD(void, deleteTask, (Task task), (override)); + MOCK_METHOD(void, deleteTaskById, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllTasks, (), (override)); }; struct TaskServiceTest : public testing::Test { - TaskService* ts; - TaskRepositoryMock* mock_ptr; + TaskService* ts; + TaskRepositoryMock* mock_ptr; - void SetUp() { - auto mock = std::make_unique(); - mock_ptr = mock.get(); - ts = new TaskService(std::move(mock)); - } - void TearDown() { delete ts; } + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + ts = new TaskService(std::move(mock)); + } + void TearDown() { delete ts; } }; ACTION(NoTaskException) { throw Exception("no task with this id in db"); } TEST_F(TaskServiceTest, deleteTaskById) { - EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1); - ts->deleteTask(1); + EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1); + ts->deleteTask(1); } TEST_F(TaskServiceTest, deleteTasWithInvalidId) { - EXPECT_CALL(*mock_ptr, deleteTaskById(1)) - .Times(1) - .WillRepeatedly(NoTaskException()); - EXPECT_THROW(ts->deleteTask(1), std::exception); + EXPECT_CALL(*mock_ptr, deleteTaskById(1)).Times(1).WillRepeatedly(NoTaskException()); + EXPECT_THROW(ts->deleteTask(1), std::exception); } TEST_F(TaskServiceTest, GetTaskByIdOK) { - EXPECT_CALL(*mock_ptr, getTaskById(1)) - .Times(1) - .WillOnce(::testing::Return(Task(1, "desription",0.7f))); - Task t = ts->getTask(1); - EXPECT_EQ(t.getId(), 1); - EXPECT_EQ(t.getDescription(), "desription"); + EXPECT_CALL(*mock_ptr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.7f))); + Task t = ts->getTask(1); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desription"); } TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { - EXPECT_CALL(*mock_ptr, getTaskById(-1)) - .Times(1) - .WillRepeatedly(NoTaskException()); - EXPECT_THROW(ts->getTask(-1), std::exception); + EXPECT_CALL(*mock_ptr, getTaskById(-1)).Times(1).WillRepeatedly(NoTaskException()); + EXPECT_THROW(ts->getTask(-1), std::exception); } TEST_F(TaskServiceTest, CreateTask) { - EXPECT_CALL(*mock_ptr, storeTask(Task("desc",0.5f))) - .Times(1) - .WillOnce(::testing::Return(1)); - Task t = ts->createTask("desc",0.5f); - EXPECT_EQ(t.getId(), 1); - EXPECT_EQ(t.getDescription(), "desc"); + EXPECT_CALL(*mock_ptr, storeTask(Task("desc", 0.5f))).Times(1).WillOnce(::testing::Return(1)); + Task t = ts->createTask("desc", 0.5f); + EXPECT_EQ(t.getId(), 1); + EXPECT_EQ(t.getDescription(), "desc"); - EXPECT_CALL(*mock_ptr, storeTask(Task("desc2",0.8f))) - .Times(1) - .WillOnce(::testing::Return(2)); - t = ts->createTask("desc2",0.8f); - EXPECT_EQ(t.getId(), 2); - EXPECT_EQ(t.getDescription(), "desc2"); + EXPECT_CALL(*mock_ptr, storeTask(Task("desc2", 0.8f))).Times(1).WillOnce(::testing::Return(2)); + t = ts->createTask("desc2", 0.8f); + EXPECT_EQ(t.getId(), 2); + EXPECT_EQ(t.getDescription(), "desc2"); } diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index 86d76de..f4828a7 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -4,89 +4,85 @@ #include "Exceptions.h" #include "UserService.h" - class Exception : public std::exception { - std::string _msg; + std::string _msg; public: - Exception(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } + explicit Exception(const std::string& msg) : _msg(msg) {} + const char* what() const noexcept override { return _msg.c_str(); } }; class UserRepositoryMock : public IUserRepository { public: - ~UserRepositoryMock() override = default; - MOCK_METHOD(std::optional, getUserById, (size_t id), (override)); - MOCK_METHOD(std::optional, getUserByLogin, (std::string login), (override)); - MOCK_METHOD(size_t, makeUser, (User user), (override)); - MOCK_METHOD(void, deleteUser, (User user), (override)); - MOCK_METHOD(void, deleteByUserId, (size_t id), (override)); - MOCK_METHOD(std::vector, getAllUsers, (), (override)); - MOCK_METHOD(void, update, (User user),(override)); + ~UserRepositoryMock() override = default; + MOCK_METHOD(std::optional, getUserById, (size_t id), (override)); + MOCK_METHOD(std::optional, getUserByLogin, (std::string login), (override)); + MOCK_METHOD(size_t, makeUser, (User user), (override)); + MOCK_METHOD(void, deleteUser, (User user), (override)); + MOCK_METHOD(void, deleteByUserId, (size_t id), (override)); + MOCK_METHOD(std::vector, getAllUsers, (), (override)); + MOCK_METHOD(void, update, (User user), (override)); }; struct UserServiceTest : public testing::Test { - UserService* us; - UserRepositoryMock* mock_ptr; + UserService* us; + UserRepositoryMock* mock_ptr; - void SetUp() { - auto mock = std::make_unique(); - mock_ptr = mock.get(); - us = new UserService(std::move(mock)); - } - void TearDown() { delete us; } + void SetUp() { + auto mock = std::make_unique(); + mock_ptr = mock.get(); + us = new UserService(std::move(mock)); + } + void TearDown() { delete us; } }; ACTION(NoUserException) { throw Exception("no user with this id in db"); } TEST_F(UserServiceTest, deleteUser) { - EXPECT_CALL(*mock_ptr, deleteByUserId(1)).Times(1); - us->deleteUser(1); + EXPECT_CALL(*mock_ptr, deleteByUserId(1)).Times(1); + us->deleteUser(1); } TEST_F(UserServiceTest, deleteUserWithInvalidId) { - EXPECT_CALL(*mock_ptr, deleteByUserId(1)) - .Times(1) - .WillRepeatedly(NoUserException()); - EXPECT_THROW(us->deleteUser(1), std::exception); + EXPECT_CALL(*mock_ptr, deleteByUserId(1)).Times(1).WillRepeatedly(NoUserException()); + EXPECT_THROW(us->deleteUser(1), std::exception); } TEST_F(UserServiceTest, loginOk) { - EXPECT_CALL(*mock_ptr, getUserByLogin("login")) - .Times(1) - .WillOnce(::testing::Return(User(1, "login", "password", "username"))); - User u = us->login("login","password"); - EXPECT_EQ(u.getLogin(), "login"); - EXPECT_EQ(u.getId(), 1); - EXPECT_EQ(u.getPassword(), "password"); - EXPECT_EQ(u.getUsername(), "username"); + EXPECT_CALL(*mock_ptr, getUserByLogin("login")) + .Times(1) + .WillOnce(::testing::Return(User(1, "login", "password", "username"))); + User u = us->login("login", "password"); + EXPECT_EQ(u.getLogin(), "login"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); } TEST_F(UserServiceTest, loginInvalidLogin) { - EXPECT_CALL(*mock_ptr, getUserByLogin("loginnn")).Times(1).WillOnce(NoUserException()); - EXPECT_THROW(us->login("loginnn","password"), std::exception); + EXPECT_CALL(*mock_ptr, getUserByLogin("loginnn")).Times(1).WillOnce(NoUserException()); + EXPECT_THROW(us->login("loginnn", "password"), std::exception); } TEST_F(UserServiceTest, loginInvalidPass) { EXPECT_CALL(*mock_ptr, getUserByLogin("login")) - .Times(1) - .WillOnce(::testing::Return(User(1, "login", "password", "username"))); - EXPECT_THROW(us->login("login","password1"), std::exception); + .Times(1) + .WillOnce(::testing::Return(User(1, "login", "password", "username"))); + EXPECT_THROW(us->login("login", "password1"), std::exception); } TEST_F(UserServiceTest, makeUserOk) { - EXPECT_CALL(*mock_ptr, makeUser(User("login@gmail.com", "password", "username"))) - .Times(1) - .WillOnce(::testing::Return(1)); - User u = us->createUser("login@gmail.com", "username", "password"); - EXPECT_EQ(u.getLogin(), "login@gmail.com"); - EXPECT_EQ(u.getId(), 1); - EXPECT_EQ(u.getPassword(), "password"); - EXPECT_EQ(u.getUsername(), "username"); + EXPECT_CALL(*mock_ptr, makeUser(User("login@gmail.com", "password", "username"))) + .Times(1) + .WillOnce(::testing::Return(1)); + User u = us->createUser("login@gmail.com", "username", "password"); + EXPECT_EQ(u.getLogin(), "login@gmail.com"); + EXPECT_EQ(u.getId(), 1); + EXPECT_EQ(u.getPassword(), "password"); + EXPECT_EQ(u.getUsername(), "username"); } TEST_F(UserServiceTest, makeUserInvalidData) { - EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))) - .Times(0); - EXPECT_THROW(us->createUser("", "", ""), ValidateException); -} \ No newline at end of file + EXPECT_CALL(*mock_ptr, makeUser(User("login", "password", "username"))).Times(0); + EXPECT_THROW(us->createUser("", "", ""), ValidateException); +} diff --git a/server/internal/service/tests/UserValidatorTest.cpp b/server/internal/service/tests/UserValidatorTest.cpp index 0a77c9c..a831504 100644 --- a/server/internal/service/tests/UserValidatorTest.cpp +++ b/server/internal/service/tests/UserValidatorTest.cpp @@ -4,21 +4,13 @@ #include "UserValidator.h" TEST(UserValidatorTest, validateOK) { - EXPECT_TRUE(UserValidator::validate(User("login@gmail.com", "password", "username"))); + EXPECT_TRUE(UserValidator::validate(User("login@gmail.com", "password", "username"))); } -TEST(UserValidatorTest, invalidLogin) { - EXPECT_FALSE(UserValidator::validate(User("", "password", "username"))); -} +TEST(UserValidatorTest, invalidLogin) { EXPECT_FALSE(UserValidator::validate(User("", "password", "username"))); } -TEST(UserValidatorTest, invalidPassword) { - EXPECT_FALSE(UserValidator::validate(User("login", "", "username"))); -} +TEST(UserValidatorTest, invalidPassword) { EXPECT_FALSE(UserValidator::validate(User("login", "", "username"))); } -TEST(UserValidatorTest, invalidUsername) { - EXPECT_FALSE(UserValidator::validate(User("login", "password", ""))); -} +TEST(UserValidatorTest, invalidUsername) { EXPECT_FALSE(UserValidator::validate(User("login", "password", ""))); } -TEST(UserValidatorTest, invalidUserFields) { - EXPECT_FALSE(UserValidator::validate(User("", "", ""))); -} \ No newline at end of file +TEST(UserValidatorTest, invalidUserFields) { EXPECT_FALSE(UserValidator::validate(User("", "", ""))); } diff --git a/server/internal/service/tests/main.cpp b/server/internal/service/tests/main.cpp index 4ccb037..6b0c247 100644 --- a/server/internal/service/tests/main.cpp +++ b/server/internal/service/tests/main.cpp @@ -2,7 +2,7 @@ #include int main(int argc, char** argv) { - ::testing::InitGoogleMock(&argc, argv); + ::testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file + return RUN_ALL_TESTS(); +} diff --git a/server/internal/service/virtual/IMockMetrics.h b/server/internal/service/virtual/IMockMetrics.h index d86a0f6..fc0a93f 100644 --- a/server/internal/service/virtual/IMockMetrics.h +++ b/server/internal/service/virtual/IMockMetrics.h @@ -2,5 +2,5 @@ class IMockMetrics { public: - virtual void countMetric(); + virtual void countMetric(); }; diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index 4764c82..84c2895 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -7,11 +7,10 @@ class ISolutionService { public: - virtual ~ISolutionService() = default; - virtual Solution createSolution(size_t userId, size_t taskId, - const std::string& filename, - const std::string& filedata) = 0; - virtual void deleteSolutionById(size_t solId) = 0; + virtual ~ISolutionService() = default; + virtual Solution createSolution(size_t userId, size_t taskId, const std::string& filename, + const std::string& filedata) = 0; + virtual void deleteSolutionById(size_t solId) = 0; - virtual std::pair getMetrics(size_t solId) = 0; + virtual std::pair getMetrics(size_t solId) = 0; }; diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h index 4150124..54bb278 100644 --- a/server/internal/service/virtual/ITaskService.h +++ b/server/internal/service/virtual/ITaskService.h @@ -5,9 +5,9 @@ class ITaskService { public: - virtual ~ITaskService() = default; - virtual Task createTask(const std::string& desc,float treshold) = 0; - virtual Task getTask(size_t id) = 0; - virtual std::vector getAllTasks() = 0; - virtual void deleteTask(size_t id) = 0; + virtual ~ITaskService() = default; + virtual Task createTask(const std::string& desc, float treshold) = 0; + virtual Task getTask(size_t id) = 0; + virtual std::vector getAllTasks() = 0; + virtual void deleteTask(size_t id) = 0; }; diff --git a/server/internal/service/virtual/IUserService.h b/server/internal/service/virtual/IUserService.h index b3a0ab5..c683152 100644 --- a/server/internal/service/virtual/IUserService.h +++ b/server/internal/service/virtual/IUserService.h @@ -6,9 +6,8 @@ class IUserService { public: - virtual ~IUserService() = default; - virtual User createUser(const std::string& login, const std::string& username, - const std::string& password) = 0; - virtual User login(const std::string& login, const std::string& password) = 0; - virtual void deleteUser(size_t id) = 0; + virtual ~IUserService() = default; + virtual User createUser(const std::string& login, const std::string& username, const std::string& password) = 0; + virtual User login(const std::string& login, const std::string& password) = 0; + virtual void deleteUser(size_t id) = 0; }; diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 2971655..8e2d328 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -8,19 +8,19 @@ #include "CPP14Parser.h" #include "IAntlrWrapper.h" -class MyCppAntlr:public IAntlrWrapper { +class MyCppAntlr : public IAntlrWrapper { private: - std::unique_ptr lexer_ptr; - std::unique_ptr parser_ptr; - std::unique_ptr input_ptr; - std::unique_ptr tokenStream_ptr; + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; public: - MyCppAntlr(std::istream &in); - ~MyCppAntlr() override = default; - std::vector getTokens() override; - std::vector getTokensTypes() override; - std::pair getTokensAndTree() override; - std::string getTokensString() override; - std::string getTreeString() override; + MyCppAntlr(std::istream &in); + ~MyCppAntlr() override = default; + std::vector getTokens() override; + std::vector getTokensTypes() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; + std::string getTreeString() override; }; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index a6dcf1c..7ac12a9 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -3,56 +3,56 @@ #include MyCppAntlr::MyCppAntlr(std::istream& in) { - input_ptr = std::make_unique(in); - lexer_ptr = std::make_unique(&(*input_ptr)); - tokenStream_ptr = std::make_unique(&(*lexer_ptr)); - parser_ptr = std::make_unique(&(*tokenStream_ptr)); + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); } std::vector MyCppAntlr::getTokens() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); - int i = 0; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token; - i++; - } + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token; + i++; + } - return ans; + return ans; } std::vector MyCppAntlr::getTokensTypes() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); - int i = 0; - for (antlr4::Token *token : tokenStream_ptr->getTokens()) { - ans[i] = token->getType(); - i++; - } + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->getType(); + i++; + } - return ans; + return ans; } std::string MyCppAntlr::getTokensString() { - tokenStream_ptr->fill(); - std::string res; + tokenStream_ptr->fill(); + std::string res; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - res += token->toString() + " "; - } + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString() + " "; + } - return res; + return res; } std::string MyCppAntlr::getTreeString() { - auto tree = parser_ptr->translationUnit(); - return tree->toStringTree(&(*parser_ptr)); + auto tree = parser_ptr->translationUnit(); + return tree->toStringTree(&(*parser_ptr)); } std::pair MyCppAntlr::getTokensAndTree() { - std::string tokens = getTokensString(); - std::string astTree = getTreeString(); - return std::make_pair(tokens, astTree); -} \ No newline at end of file + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); +} diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index edb29e3..aee2aa3 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -4,24 +4,24 @@ #include #include +#include "IAntlrWrapper.h" #include "Python3Lexer.h" #include "Python3Parser.h" -#include "IAntlrWrapper.h" #include "antlr4-runtime.h" -class PythonAntlr:public IAntlrWrapper { +class PythonAntlr : public IAntlrWrapper { private: - std::unique_ptr lexer_ptr; - std::unique_ptr parser_ptr; - std::unique_ptr input_ptr; - std::unique_ptr tokenStream_ptr; + std::unique_ptr lexer_ptr; + std::unique_ptr parser_ptr; + std::unique_ptr input_ptr; + std::unique_ptr tokenStream_ptr; public: - PythonAntlr(std::istream &in); - ~PythonAntlr() override = default; - std::vector getTokens() override; - std::vector getTokensTypes() override; - std::pair getTokensAndTree() override; - std::string getTokensString() override; - std::string getTreeString() override; + PythonAntlr(std::istream &in); + ~PythonAntlr() override = default; + std::vector getTokens() override; + std::vector getTokensTypes() override; + std::pair getTokensAndTree() override; + std::string getTokensString() override; + std::string getTreeString() override; }; diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index eae822d..a291540 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -3,56 +3,56 @@ #include PythonAntlr::PythonAntlr(std::istream& in) { - input_ptr = std::make_unique(in); - lexer_ptr = std::make_unique(&(*input_ptr)); - tokenStream_ptr = std::make_unique(&(*lexer_ptr)); - parser_ptr = std::make_unique(&(*tokenStream_ptr)); + input_ptr = std::make_unique(in); + lexer_ptr = std::make_unique(&(*input_ptr)); + tokenStream_ptr = std::make_unique(&(*lexer_ptr)); + parser_ptr = std::make_unique(&(*tokenStream_ptr)); } std::vector PythonAntlr::getTokens() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); - int i = 0; - for (antlr4::Token *token : tokenStream_ptr->getTokens()) { - ans[i] = token; - i++; - } + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token; + i++; + } - return ans; + return ans; } std::vector PythonAntlr::getTokensTypes() { - tokenStream_ptr->fill(); - std::vector ans(tokenStream_ptr->size()); + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); - int i = 0; - for (antlr4::Token *token : tokenStream_ptr->getTokens()) { - ans[i] = token->getType(); - i++; - } + int i = 0; + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + ans[i] = token->getType(); + i++; + } - return ans; + return ans; } std::string PythonAntlr::getTokensString() { - tokenStream_ptr->fill(); - std::string res; + tokenStream_ptr->fill(); + std::string res; - for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - res += token->toString()+" "; - } + for (antlr4::Token* token : tokenStream_ptr->getTokens()) { + res += token->toString() + " "; + } - return res; + return res; } std::string PythonAntlr::getTreeString() { - auto tree = parser_ptr->file_input(); - return tree->toStringTree(&(*parser_ptr)); + auto tree = parser_ptr->file_input(); + return tree->toStringTree(&(*parser_ptr)); } std::pair PythonAntlr::getTokensAndTree() { - std::string tokens = getTokensString(); - std::string astTree = getTreeString(); - return std::make_pair(tokens, astTree); -} \ No newline at end of file + std::string tokens = getTokensString(); + std::string astTree = getTreeString(); + return std::make_pair(tokens, astTree); +} diff --git a/server/pkg/antlr/testprogs/cpp/test.cpp b/server/pkg/antlr/testprogs/cpp/test.cpp index 708f54f..7d31b35 100644 --- a/server/pkg/antlr/testprogs/cpp/test.cpp +++ b/server/pkg/antlr/testprogs/cpp/test.cpp @@ -1,8 +1,6 @@ #include - -int main() -{ +int main() { std::string res; int a; if (true && true) { @@ -10,4 +8,3 @@ int main() } return 0; } - diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index b818ef6..824119e 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -7,10 +7,10 @@ class IAntlrWrapper { public: - virtual ~IAntlrWrapper() = default; - virtual std::vector getTokens() = 0; - virtual std::vector getTokensTypes() = 0; - virtual std::pair getTokensAndTree() = 0; - virtual std::string getTokensString() = 0; - virtual std::string getTreeString() = 0; + virtual ~IAntlrWrapper() = default; + virtual std::vector getTokens() = 0; + virtual std::vector getTokensTypes() = 0; + virtual std::pair getTokensAndTree() = 0; + virtual std::string getTokensString() = 0; + virtual std::string getTreeString() = 0; }; -- GitLab From 3d381d8dbcbd711e5a9987771f4d206f6e844827 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 14:07:21 +0300 Subject: [PATCH 091/134] fix build problem --- Makefile | 2 +- server/internal/dbManager/src/dbConnection.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 13e9c42..9ebe554 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ generate: cmake -B build/ build-project: - cd ./build && make + cd ./build && make --no-print-directory clean: rm -rf build diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp index 728d68d..3a6afad 100644 --- a/server/internal/dbManager/src/dbConnection.cpp +++ b/server/internal/dbManager/src/dbConnection.cpp @@ -2,16 +2,16 @@ // Created by qwert on 01.05.2023. // -#include "../include/dbConnection.hpp" +// #include "../include/dbConnection.hpp" -#include +// #include -dbConnection::dbConnection() { establish_connection(); } +// dbConnection::dbConnection() { establish_connection(); } -std::shared_ptr dbConnection::connection() const { return m_connection; } +// std::shared_ptr dbConnection::connection() const { return m_connection; } -// void dbConnection::establish_connection() { -// pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); -// m_connection.reset(&c); +// // void dbConnection::establish_connection() { +// // pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); +// // m_connection.reset(&c); -// } +// // } -- GitLab From 81d856363d1115374d98a563a1ef3addeb55d307 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 18 May 2023 21:31:51 +0300 Subject: [PATCH 092/134] some realiz fix, add new tests --- server/cmd/main.cpp | 7 +++ .../internal/metrics/src/TokenMetricImpl.cpp | 6 +-- .../metrics/tests/src/token_metrics_tests.cpp | 43 +++++++++++++++++-- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 132040d..0e2da95 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -37,5 +37,12 @@ int main(int argc, const char* argv[]) { fin1.close(); fin2.close(); + std::vector tokens3 = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, + 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, + 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, 90, + 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; + + wsh.setData(tokens3, tokens3); + std::cout << wsh.getMetric() << std::endl; return 0; } \ No newline at end of file diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 70cba71..0db790d 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -31,7 +31,7 @@ double LevDistTokenMetric::getMetric() { if (n == 0 || m == 0) return 0; double res = 1.0 - static_cast (lev[n-1][m-1]) / static_cast (std::max(n ,m)); - return res; + return res; } double WShinglingTokenMetric::getMetric() { @@ -44,10 +44,10 @@ double WShinglingTokenMetric::getMetric() { std::vector > sh1; std::vector > sh2; - for (size_t i = 0; i < n - 3; i++){ + for (size_t i = 0; i < n - 2; i++){ sh1.emplace_back(tokens1[i], tokens1[i+1], tokens1[i+2]); } - for (size_t i = 0; i < m - 3; i++){ + for (size_t i = 0; i < m - 2; i++){ sh2.emplace_back(tokens2[i], tokens2[i+1], tokens2[i+2]); } diff --git a/server/internal/metrics/tests/src/token_metrics_tests.cpp b/server/internal/metrics/tests/src/token_metrics_tests.cpp index 0e50eed..e023d6b 100644 --- a/server/internal/metrics/tests/src/token_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/token_metrics_tests.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include "TokenMetricLib.h" @@ -70,9 +69,9 @@ TEST_F(WShinglingTokenMetricTest, check_eq_progs){ TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {4, 5, 6, 1}; + std::vector tokens2 = {4, 5, 6}; - wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->setData(tokens1, tokens2); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } @@ -82,11 +81,47 @@ TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { std::vector tokens1 = {1, 2, 3}; std::vector tokens2 = {}; - wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->setData(tokens1, tokens2); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } +TEST_F(WShinglingTokenMetricTest, test_with_empty_progs) { + + std::vector tokens1 = {}; + std::vector tokens2 = {}; + + wShinglingTokenMetric->setData(tokens1, tokens2); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, test_with_small_size) { + + std::vector tokens1 = {1}; + std::vector tokens2 = {2, 3}; + + wShinglingTokenMetric->setData(tokens1, tokens2); + + double res = wShinglingTokenMetric->getMetric(); + EXPECT_EQ(res, 0); +} + +TEST_F(WShinglingTokenMetricTest, test_with_big_size) { + + std::vector tokens = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, + 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, + 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, 90, + 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; + + wShinglingTokenMetric->setData(tokens, tokens); + + double res = wShinglingTokenMetric->getMetric(); + EXPECT_EQ(res, 1); +} + + + -- GitLab From 32b76380af8c387ea83d87af1e1c7224658fa0f9 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 18 May 2023 22:54:57 +0300 Subject: [PATCH 093/134] add new service method --- CMakeLists.txt | 2 +- Makefile | 2 +- server/cmd/main.cpp | 0 .../httpServer/src/SolutionManager.cpp | 2 +- .../service/include/SolutionService.h | 1 + .../internal/service/src/SolutionService.cpp | 31 +++++++++++++++---- .../service/tests/SolutionServiceTest.cpp | 22 ++++++++++--- server/internal/service/tests/task1.cpp | 13 ++++++++ .../service/virtual/ISolutionService.h | 1 - server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 7 ++++- server/pkg/antlr/python3/src/PythonAntlr.cpp | 7 ++++- 11 files changed, 72 insertions(+), 16 deletions(-) mode change 100644 => 100755 server/cmd/main.cpp create mode 100644 server/internal/service/tests/task1.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf42b3..28f2148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,4 +38,4 @@ endif() if((BUILD_MODE STREQUAL ${BUILD_SERVER}) OR (BUILD_MODE STREQUAL ${BUILD_ALL})) add_subdirectory(server) -endif() +endif() \ No newline at end of file diff --git a/Makefile b/Makefile index 9ebe554..6c3ea37 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ clean: rebuild: clean generate build-project server-run: - ./build/server/cmd/ + ./build/server/cmd/Server test: ctest --verbose --test-dir build/ diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp old mode 100644 new mode 100755 diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 2a6b9c1..f8e1dcf 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -39,7 +39,7 @@ http::message_generator SolutionManager::getAllSolutions(http::requestdeserialTaskData(req.body()); std::vector solutions; - // solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); + solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index 7028696..e78f431 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -34,5 +34,6 @@ class SolutionService : public ISolutionService { Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) override; void deleteSolutionById(size_t solId) override; + std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id); std::pair getMetrics(size_t solId) override; }; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 1d6d4e2..89e754a 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -54,7 +54,7 @@ std::pair SolutionService::getMaxTextResMetric(std::vector treshold) { @@ -68,6 +68,10 @@ std::pair SolutionService::getMaxTokenResMetric(std::vector& tokens, float treshold) { std::pair maxMatch = std::make_pair(0.0, 0ul); for (auto sol : solutions) { + std::cout << "Convert to string" << std::endl; + std::cout << Utils::convertIntArrayIntoString(tokens) << std::endl; + std::cout << sol.getTokens() << std::endl; + tokenMetric = std::make_unique(); tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); float tokenBasedRes = float(tokenMetric->getMetric()); @@ -78,7 +82,7 @@ std::pair SolutionService::getMaxTokenResMetric(std::vector treshold) { @@ -111,17 +115,24 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); - size_t plagiatUserId = -1; + int plagiatSolId = 1; if (result == PLAGIAT_VERDICT) { if (textBasedRes.first > tokenBasedRes.first) { - plagiatUserId = textBasedRes.second; + plagiatSolId = textBasedRes.second; } else { - plagiatUserId = tokenBasedRes.second; + plagiatSolId = tokenBasedRes.second; } } + std::cout << "Plagiat" << std::endl; + std::cout << plagiatSolId << std::endl; + Solution sol = Solution(std::ctime(&now), userId, filedata, taskId, result, - Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatUserId); + Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatSolId); + + std::cout << "Dick" << std::endl; + std::cout << sol.getOrigSolution() << std::endl; + size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; @@ -148,3 +159,11 @@ std::pair SolutionService::getMetrics(size_t solId) { throw; } } + +std::vector SolutionService::getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) { + try { + return solutionRepo->getSolutionsByTaskIdAndSenderId(user_id,task_id); + } catch (...) { + throw; + } +} diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index cd3ef23..bb0c8ae 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -1,6 +1,10 @@ #include #include +#include +#include +#include + #include "SolutionService.h" class Exception : public std::exception { @@ -82,14 +86,24 @@ TEST_F(SolutionServiceTest, createSolution) { .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); + solutions.push_back( + Solution(0, "", 1, "int main(){return 0;}", 1, "", + "9 45 132 85 86 89 78 45 132 128 45 132 101 1 128 132 127 132 103 103 132 128 84 85 132 115 1 86 89 " + "43 85 132 97 1 86 132 120 128 132 113 1 128 90 132 127 132 102 102 132 128 59 1 128 90 -1", + "", -1)); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); + std::string line; + // std::ifstream in("/project/server/internal/service/tests/task1.cpp"); // окрываем файл для чтения + // std::stringstream sst; + // sst << in.rdbuf(); - Solution sol = ss->createSolution(2, 1, "main.cpp", "int main(){return 0;}"); + Solution sol = ss->createSolution(2, 1, "main.cpp", "int main() { return 0; }"); EXPECT_EQ(sol.getId(), 1); - EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); - EXPECT_EQ(sol.getTokens(), "45 132 85 86 89 59 1 128 90 -1 "); + // EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); + EXPECT_EQ(sol.getTokens(), + "9 45 132 85 86 89 78 45 132 128 45 132 101 1 128 132 127 132 103 103 132 128 84 85 132 115 1 86 89 43 " + "85 132 97 1 86 132 120 128 132 113 1 128 90 132 127 132 102 102 132 128 59 1 128 90 -1 "); EXPECT_EQ(sol.getResult(), "Не, ну вы не палитесь. Плагиат."); } diff --git a/server/internal/service/tests/task1.cpp b/server/internal/service/tests/task1.cpp new file mode 100644 index 0000000..729043e --- /dev/null +++ b/server/internal/service/tests/task1.cpp @@ -0,0 +1,13 @@ +#include + +int main() { + unsigned int n; + int count = 0; + std::cin >> n; + while (n != 0) { + if (n & 1) count++; + n >>= 2; + } + std::cout << count; + return 0; +} diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index 84c2895..a952116 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -11,6 +11,5 @@ class ISolutionService { virtual Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) = 0; virtual void deleteSolutionById(size_t solId) = 0; - virtual std::pair getMetrics(size_t solId) = 0; }; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 7ac12a9..7bccf1d 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -28,7 +28,12 @@ std::vector MyCppAntlr::getTokensTypes() { int i = 0; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->getType(); + if (token->getText() == "") { + std::cout << "\nHERE\n" << std::endl; + ans[i] = -1; + } else { + ans[i] = token->getType(); + } i++; } diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index a291540..559ed3d 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -28,7 +28,12 @@ std::vector PythonAntlr::getTokensTypes() { int i = 0; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { - ans[i] = token->getType(); + if (token->getText() == "") { + std::cout << "\nHERE\n" << std::endl; + ans[i] = -1; + } else { + ans[i] = token->getType(); + } i++; } -- GitLab From b639fd73bd713b79cf9aa9937586eaf07bf6be6b Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 18 May 2023 23:00:55 +0300 Subject: [PATCH 094/134] new SolutionRepository method --- Docker/init.sql | 21 +++++------------- .../repository/include/SolutionRepository.hpp | 2 ++ .../repository/src/SolutionRepository.cpp | 22 +++++++++++++++++++ .../virtual/ISolutionRepository.hpp | 2 ++ 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Docker/init.sql b/Docker/init.sql index c31afbb..ab6b0bf 100755 --- a/Docker/init.sql +++ b/Docker/init.sql @@ -318,7 +318,7 @@ ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public."Users -- COPY public.metricstat (id, solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) FROM stdin; -15 1 1 1 1 t 1 +1 1 1 1 1 t 1 \. @@ -340,7 +340,7 @@ COPY public.solutions (id, send_date, sender_id, source, task_id, result, tokens -- COPY public.tasks (id, description, treshold) FROM stdin; -27 orher_description 0.1 +2 orher_description 0.1 1 description 0.5 \. @@ -354,15 +354,6 @@ COPY public.tasks (id, description, treshold) FROM stdin; COPY public.users (id, login, password, username) FROM stdin; 1 qwerty200468@gmail.com 123 tolik 2 qwerty200468@gmail.com 123 tolik -3 qwerty200468@gmail.com 123 tolik -4 qwerty200468@gmail.com 123 tolik -5 qwerty200468@gmail.com 123 tolik -6 qwerty200468@gmail.com 123 tolik -7 qwerty200468@gmail.com 123 tolik -8 qwerty200468@gmail.com 123 tolik -9 qwerty200468@gmail.com 123 tolik -10 qwerty200468@gmail.com 123 tolik -52 qwerty200468@gmail.com 123 tolik \. @@ -372,7 +363,7 @@ COPY public.users (id, login, password, username) FROM stdin; -- Name: Users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- -SELECT pg_catalog.setval('public."Users_id_seq"', 78, true); +SELECT pg_catalog.setval('public."Users_id_seq"', 1, true); -- @@ -381,7 +372,7 @@ SELECT pg_catalog.setval('public."Users_id_seq"', 78, true); -- Name: metricstat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- -SELECT pg_catalog.setval('public.metricstat_id_seq', 36, true); +SELECT pg_catalog.setval('public.metricstat_id_seq', 1, true); -- @@ -390,7 +381,7 @@ SELECT pg_catalog.setval('public.metricstat_id_seq', 36, true); -- Name: solutions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- -SELECT pg_catalog.setval('public.solutions_id_seq', 150, true); +SELECT pg_catalog.setval('public.solutions_id_seq', 1, true); -- @@ -399,7 +390,7 @@ SELECT pg_catalog.setval('public.solutions_id_seq', 150, true); -- Name: tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- -SELECT pg_catalog.setval('public.tasks_id_seq', 34, true); +SELECT pg_catalog.setval('public.tasks_id_seq', 1, true); -- diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 07a04ff..c3d912b 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -22,6 +22,8 @@ class SolutionRepository : public ISolutionRepository { std::vector getSolutionsByTaskId(size_t task_id) override; + std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) override; + size_t storeSolution(Solution solution) override; void updateSolution(Solution solution) override; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index c3adfca..47ce337 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -62,6 +62,27 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { } } +std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t task_id, size_t sender_id) { + try { + auto c = manager->connection(); + std::string sql = (boost::format ("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s';") % task_id % sender_id).str(); + nontransaction n(*c); + auto stream = stream_from::query(n, sql); + std::vector solutions; + std::tuple row; + while (stream >> row) { + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row)); + } + stream.complete(); + manager->freeConnection(c); + return solutions; + } catch (...) { + throw; + } +} + + std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); @@ -144,3 +165,4 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { } SolutionRepository::SolutionRepository() { manager = std::make_shared(); } + diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 42f9eb5..397b516 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -17,6 +17,8 @@ class ISolutionRepository { virtual std::vector getSolutionsByTaskId(size_t task_id) = 0; + virtual std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) = 0; + virtual size_t storeSolution(Solution solution) = 0; virtual void updateSolution(Solution solution) = 0; -- GitLab From c5cd871b4c488ef554ee4e66a7083fcc6600d52f Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 18 May 2023 23:24:32 +0300 Subject: [PATCH 095/134] new SolutionRepository method --- server/internal/repository/src/SolutionRepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 47ce337..380fef1 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -65,7 +65,7 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t task_id, size_t sender_id) { try { auto c = manager->connection(); - std::string sql = (boost::format ("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s';") % task_id % sender_id).str(); + std::string sql = (boost::format ("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id).str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; -- GitLab From 6c768f37cfcce2a5a2f533ad789793b3186eede9 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 18 May 2023 23:49:01 +0300 Subject: [PATCH 096/134] new SolutionRepository method --- Docker/init.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker/init.sql b/Docker/init.sql index ab6b0bf..880e420 100755 --- a/Docker/init.sql +++ b/Docker/init.sql @@ -205,7 +205,7 @@ CREATE TABLE public.solutions ( id integer NOT NULL, send_date date NOT NULL, sender_id integer, - source character varying(255), + source character varying, task_id integer, result character varying, tokens character varying, -- GitLab From 9e84c9e0aaefb81046266a44b8a5089acf2490f8 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Fri, 19 May 2023 01:06:58 +0300 Subject: [PATCH 097/134] fix bug --- server/internal/metrics/src/TokenMetricImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 0db790d..5c92a85 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -38,7 +38,7 @@ double WShinglingTokenMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); - if (n == 0 || m == 0 || (n < 3 && m < 3)) + if (n == 0 || m == 0 || (n < 3 || m < 3)) return 0; std::vector > sh1; -- GitLab From 858618cc0779bb6df5bfa6c43671ee7c29361250 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Fri, 19 May 2023 02:08:34 +0300 Subject: [PATCH 098/134] fixs bugs, add some tests to metrics --- .../internal/metrics/src/TokenMetricImpl.cpp | 11 ++++---- .../metrics/tests/src/token_metrics_tests.cpp | 27 ++++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 5e27fe8..980cacf 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -36,15 +36,16 @@ double WShinglingTokenMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); - if (n == 0 || m == 0 || (n < 3 && m < 3)) return 0; + if (n < 3 || m < 3) + return 0; std::vector> sh1; std::vector> sh2; - for (size_t i = 0; i < n - 3; i++) { + for (size_t i = 0; i < n - 2; i++) { sh1.emplace_back(tokens1[i], tokens1[i + 1], tokens1[i + 2]); } - for (size_t i = 0; i < m - 3; i++) { + for (size_t i = 0; i < m - 2; i++) { sh2.emplace_back(tokens2[i], tokens2[i + 1], tokens2[i + 2]); } @@ -67,6 +68,6 @@ double WShinglingTokenMetric::getMetric() { } void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) { - tokens1 = _tokens1; - tokens2 = _tokens2; + tokens1 = std::move(_tokens1); + tokens2 = std::move(_tokens2); } diff --git a/server/internal/metrics/tests/src/token_metrics_tests.cpp b/server/internal/metrics/tests/src/token_metrics_tests.cpp index 608e11b..77a1e69 100644 --- a/server/internal/metrics/tests/src/token_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/token_metrics_tests.cpp @@ -61,9 +61,9 @@ TEST_F(WShinglingTokenMetricTest, check_eq_progs) { TEST_F(WShinglingTokenMetricTest, check_absolutely_not_eq_progs) { std::vector tokens1 = {1, 2, 3}; - std::vector tokens2 = {4, 5, 6, 1}; + std::vector tokens2 = {4, 5, 6, 9}; - wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->setData(tokens1, tokens2); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } @@ -72,7 +72,28 @@ TEST_F(WShinglingTokenMetricTest, test_with_empty_prog) { std::vector tokens1 = {1, 2, 3}; std::vector tokens2 = {}; - wShinglingTokenMetric->setData(tokens1, tokens1); + wShinglingTokenMetric->setData(tokens1, tokens2); EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); } + +TEST_F(WShinglingTokenMetricTest, test_with_small_prog) { + std::vector tokens1 = {1, 2, 3, 4}; + std::vector tokens2 = {9}; + + wShinglingTokenMetric->setData(tokens1, tokens2); + + EXPECT_EQ(wShinglingTokenMetric->getMetric(), 0); +} + +TEST_F(WShinglingTokenMetricTest, test_with_big_size) { + std::vector tokens = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, + 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, + 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, 90, + 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; + + wShinglingTokenMetric->setData(tokens, tokens); + + double res = wShinglingTokenMetric->getMetric(); + EXPECT_EQ(res, 1); +} -- GitLab From fe721d8d64208d0db2d82cfe4c9e3c95fae51020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 19 May 2023 11:32:58 +0300 Subject: [PATCH 099/134] integration works))))) --- Dockerfile | 24 +++++----- Makefile | 3 +- client/internal/gui/src/SolutionsWindow.cpp | 2 +- .../httpClient/src/HttpClientManager.cpp | 6 ++- docker-compose.yml | 2 +- server/cmd/CMakeLists.txt | 2 +- server/internal/httpServer/CMakeLists.txt | 2 +- server/internal/httpServer/src/Router.cpp | 3 -- .../httpServer/src/SolutionManager.cpp | 33 +++++++------ .../internal/httpServer/src/TaskManager.cpp | 2 +- .../internal/httpServer/src/UserManager.cpp | 16 +++++-- server/internal/service/CMakeLists.txt | 4 +- .../include/{Utils.h => ServiceUtils.h} | 20 ++++---- .../src/{Utils.cpp => ServiceUtils.cpp} | 46 +++++++++---------- .../internal/service/src/SolutionService.cpp | 15 ++---- server/internal/service/tests/CMakeLists.txt | 2 +- 16 files changed, 92 insertions(+), 90 deletions(-) rename server/internal/service/include/{Utils.h => ServiceUtils.h} (95%) rename server/internal/service/src/{Utils.cpp => ServiceUtils.cpp} (92%) diff --git a/Dockerfile b/Dockerfile index 75baccc..d6343d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ FROM ubuntu:latest - -ENV TZ=Europe/Moscow -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - + +ENV TZ=Europe/Moscow +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + RUN apt update -y RUN apt install -y gcc RUN apt install -y libpqxx-dev RUN apt install -y clang-tidy RUN apt-get install -y wget RUN apt install -y g++ -RUN apt install -y cmake +RUN apt install -y cmake RUN wget https://github.com/jtv/libpqxx/archive/refs/tags/7.7.5.tar.gz RUN tar -zxvf 7.7.5.tar.gz @@ -18,7 +18,7 @@ RUN ./configure CXXFLAGS=-std=c++17 --disable-dependency-tracking RUN make RUN make install -RUN apt install -y python3-pip +RUN apt install -y python3-pip RUN apt install -y cppcheck RUN apt-get update RUN apt install -y nlohmann-json3-dev @@ -40,16 +40,16 @@ RUN git clone https://github.com/google/googletest.git -b release-1.11.0 WORKDIR googletest/build RUN cmake .. -DBUILD_GMOCK=ON RUN make -RUN make install +RUN make install -RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz -RUN tar xvf boost_1_82_0.tar.gz -WORKDIR boost_1_82_0 -RUN ./bootstrap.sh --prefix=/usr/ +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz +RUN tar xvf boost_1_82_0.tar.gz +WORKDIR boost_1_82_0 +RUN ./bootstrap.sh --prefix=/usr/ RUN ./b2 install RUN apt install -y clang-format - + WORKDIR /project COPY . . diff --git a/Makefile b/Makefile index 6c3ea37..64180d7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ generate: cmake -B build/ build-project: - cd ./build && make --no-print-directory + cd ./build && cmake .. && make --no-print-directory clean: rm -rf build @@ -36,6 +36,5 @@ stop-docker: docker stop app run-docker-compose: - docker compose down --volumes docker compose up -d --build diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index 17832a3..ccbc7e5 100644 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -70,7 +70,7 @@ void SolutionsWindow::on_chooseFileButton_clicked() { } void SolutionsWindow::on_sendButton_clicked() { - Solution sol = Core::submitSolution(task.id, path_to_file); + Solution sol = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); result->setText(QString::fromStdString(sol.result)); } diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index 18de286..9f9f7cd 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -36,7 +36,10 @@ std::pair HttpClientManager::registerUser(const std::string &log auto* cbuf = boost::asio::buffer_cast(seq); res_body.append(cbuf, boost::asio::buffer_size(seq)); } - User user = serializer->deserialUserData(res_body); + User user; + if (status == 200) { + user = serializer->deserialUserData(res_body); + } return {status, user}; } @@ -44,6 +47,7 @@ Solution HttpClientManager::submitSolution(const int &user_id, const int &task_i const std::string &path_to_sound) { std::string body = serializer->serialSolutionData(user_id, task_id, filename, path_to_sound); http::response res = client->makeGetRequest("/solution/submit", body); + std::cout << res << std::endl; // unsigned status = res.result_int(); std::string res_body; for (auto seq : res.body().data()) { diff --git a/docker-compose.yml b/docker-compose.yml index e101d36..77be625 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: networks: - db-network server: - image: raiden454/cpp-app:latest + image: kodkio/cpp_app:latest # use raiden454/cpp_app:latest networks: - db-network env_file: diff --git a/server/cmd/CMakeLists.txt b/server/cmd/CMakeLists.txt index e8ea8b4..fa268c2 100644 --- a/server/cmd/CMakeLists.txt +++ b/server/cmd/CMakeLists.txt @@ -4,7 +4,7 @@ project(${PROJECT_NAME}) add_executable(Server main.cpp) target_link_libraries(${PROJECT_NAME} ${HTTPSERVER_LIB} ${SERVICE_lib_LIBRARY} ${libRepository_LIB} - ${METRICS_LIBRARY} ${libEntities_LIB} ${ANTLR4_LIB} ${libDbManager_LIB}) + ${METRICS_LIBRARY} ${libEntities_LIB} ${ANTLR4_LIB} ${libDbManager_LIB} ${PQXX_LIB}) message("a = ${SERVICE_lib_INCLUDE_DIRS}") target_include_directories(Server PUBLIC ${Boost_INCLUDE_DIR} ${HTTPSERVER_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS} ${libRepository_INCLUDE_DIRS} ${libDbManager_INCLUDE_DIRS} ${METRICS_lib_INCLUDE_DIRS} ${libEntities_INCLUDE_DIRS} ${ANTLR4_LIB_INCLUDE_DIRS}) diff --git a/server/internal/httpServer/CMakeLists.txt b/server/internal/httpServer/CMakeLists.txt index a0fdd28..b49f36a 100644 --- a/server/internal/httpServer/CMakeLists.txt +++ b/server/internal/httpServer/CMakeLists.txt @@ -9,7 +9,7 @@ include_directories(${INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${SOURCES}) target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${libEntities_INCLUDE_DIRS} ${SERVICE_lib_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${SERVICE_lib_LIBRARY} ${libEntities_LIB}) +target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${SERVICE_lib_LIBRARY} ${libEntities_LIB} ${PQXX_LIB}) set(HTTPSERVER_LIB ${PROJECT_NAME}) set(HTTPSERVER_LIB ${HTTPSERVER_LIB} PARENT_SCOPE) diff --git a/server/internal/httpServer/src/Router.cpp b/server/internal/httpServer/src/Router.cpp index b4e3f61..68aba41 100644 --- a/server/internal/httpServer/src/Router.cpp +++ b/server/internal/httpServer/src/Router.cpp @@ -12,7 +12,6 @@ Router::Router(std::string_view doc_root_) doc_root(doc_root_) {} http::message_generator Router::handleRequest(http::request &&req) { - std::cout << req << std::endl; if (req.method() != http::verb::get && req.method() != http::verb::post) return getBadRequest(req, "Unknown HTTP-method"); @@ -20,8 +19,6 @@ http::message_generator Router::handleRequest(http::request & return getBadRequest(req, "Illegal request-target"); } - std::cout << req.target() << std::endl; - if (req.target() == "/solution/submit") { return solutionManager->createSolution(std::move(req)); } else if (req.target() == "/solution/all") { diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index f8e1dcf..9e08d63 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -16,11 +16,10 @@ SolutionManager::SolutionManager() void SolutionManager::setService(std::shared_ptr service) { solutionService = std::move(service); } http::message_generator SolutionManager::createSolution(http::request&& req) { - size_t user_id, task_id; - std::string filename, filedata; - std::tie(user_id, task_id, filename, filedata) = serializer->deserialNewSolutionData(req.body()); - // Solution sol = TmpSolutionService::createSolution(user_id, task_id, source); try { + size_t user_id, task_id; + std::string filename, filedata; + std::tie(user_id, task_id, filename, filedata) = serializer->deserialNewSolutionData(req.body()); Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata); http::response res{http::status::ok, req.version()}; @@ -36,15 +35,19 @@ http::message_generator SolutionManager::createSolution(http::request&& req) { - size_t user_id, task_id; - std::tie(user_id, task_id) = serializer->deserialTaskData(req.body()); - std::vector solutions; - solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); - http::response res{http::status::ok, req.version()}; - res.set(http::field::server, BOOST_BEAST_VERSION_STRING); - res.set(http::field::content_type, "text/plain"); - res.keep_alive(req.keep_alive()); - res.body() = serializer->serialSolutions(solutions); - res.prepare_payload(); - return res; + try { + size_t user_id, task_id; + std::tie(user_id, task_id) = serializer->deserialTaskData(req.body()); + std::vector solutions; + // solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); + http::response res{http::status::ok, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = serializer->serialSolutions(solutions); + res.prepare_payload(); + return res; + } catch (const std::exception& e) { + return getBadRequest(req, e.what()); + } } diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index 4a6fd97..6c24bbf 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -12,9 +12,9 @@ TaskManager::TaskManager() : serializer(std::make_shared()), taskSer void TaskManager::setService(std::shared_ptr service) { taskService = service; } http::message_generator TaskManager::createTask(http::request &&req) { - std::string description = serializer->deserialNewTaskData(req.body()); try { + std::string description = serializer->deserialNewTaskData(req.body()); taskService->createTask(description, 0.5); // TmpTaskService::createTask(description); http::response res{http::status::ok, req.version()}; diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index 881dd8b..b94bca7 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -9,13 +9,18 @@ void UserManager::setService(std::shared_ptr service) { userServic http::message_generator UserManager::loginUser(http::request &&req) { std::string login, password; - std::tie(login, password) = serializer->deserialUserData(req.body()); + + try { + std::tie(login, password) = serializer->deserialUserData(req.body()); + } catch (...) { + return getBadRequest(req, "Something went wrong!"); + } User user; bool flag = true; try { - auto result = userService->login(login, password); + user = userService->login(login, password); } catch (...) { flag = false; } @@ -26,6 +31,7 @@ http::message_generator UserManager::loginUser(http::request res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); res.body() = serializer->serialUserData(user); + std::cout << serializer->serialUserData(user) << std::endl; res.prepare_payload(); return res; } else { @@ -34,16 +40,16 @@ http::message_generator UserManager::loginUser(http::request res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); res.body() = serializer->serialUserData(user); + std::cout << serializer->serialUserData(user) << std::endl; res.prepare_payload(); return res; } } http::message_generator UserManager::registerUser(http::request &&req) { - std::string login, password, username; - std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); - try { + std::string login, password, username; + std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); User user = userService->createUser(login, username, password); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index ab9c04c..b598428 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -23,6 +23,6 @@ set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) -enable_testing() -add_subdirectory(tests) +#enable_testing() +#add_subdirectory(tests) diff --git a/server/internal/service/include/Utils.h b/server/internal/service/include/ServiceUtils.h similarity index 95% rename from server/internal/service/include/Utils.h rename to server/internal/service/include/ServiceUtils.h index 432521e..4361070 100644 --- a/server/internal/service/include/Utils.h +++ b/server/internal/service/include/ServiceUtils.h @@ -1,10 +1,10 @@ -#pragma once - -#include -#include - -class Utils { - public: - static std::string convertIntArrayIntoString(std::vector& arr); - static std::vector convertStringIntoIntArray(const std::string& str); -}; +#pragma once + +#include +#include + +class Utils { + public: + static std::string convertIntArrayIntoString(std::vector& arr); + static std::vector convertStringIntoIntArray(const std::string& str); +}; diff --git a/server/internal/service/src/Utils.cpp b/server/internal/service/src/ServiceUtils.cpp similarity index 92% rename from server/internal/service/src/Utils.cpp rename to server/internal/service/src/ServiceUtils.cpp index 95a1629..02671b1 100644 --- a/server/internal/service/src/Utils.cpp +++ b/server/internal/service/src/ServiceUtils.cpp @@ -1,23 +1,23 @@ -#include "Utils.h" - -#include -#include -#include -#include -#include - -std::string Utils::convertIntArrayIntoString(std::vector& arr) { - std::string str; - for (size_t i = 0; i < arr.size(); i++) { - str += std::to_string(arr[i]) + " "; - } - return str; -} - -std::vector Utils::convertStringIntoIntArray(const std::string& str) { - std::stringstream ss(str); - std::vector v; - - std::copy(std::istream_iterator(ss), {}, back_inserter(v)); - return v; -} +#include "ServiceUtils.h" + +#include +#include +#include +#include +#include + +std::string Utils::convertIntArrayIntoString(std::vector& arr) { + std::string str; + for (size_t i = 0; i < arr.size(); i++) { + str += std::to_string(arr[i]) + " "; + } + return str; +} + +std::vector Utils::convertStringIntoIntArray(const std::string& str) { + std::stringstream ss(str); + std::vector v; + + std::copy(std::istream_iterator(ss), {}, back_inserter(v)); + return v; +} diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 89e754a..20e6af0 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -9,7 +9,7 @@ #include "PythonAntlr.h" #include "SolutionRepository.hpp" #include "TaskRepository.hpp" -#include "Utils.h" +#include "ServiceUtils.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; @@ -67,15 +67,14 @@ std::pair SolutionService::getMaxTextResMetric(std::vector SolutionService::getMaxTokenResMetric(std::vector& solutions, std::vector& tokens, float treshold) { std::pair maxMatch = std::make_pair(0.0, 0ul); - for (auto sol : solutions) { - std::cout << "Convert to string" << std::endl; - std::cout << Utils::convertIntArrayIntoString(tokens) << std::endl; - std::cout << sol.getTokens() << std::endl; + for (auto sol : solutions) { tokenMetric = std::make_unique(); tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); float tokenBasedRes = float(tokenMetric->getMetric()); + auto sol_tokens = Utils::convertStringIntoIntArray(sol.getTokens()); + tokenMetric = std::make_unique(); tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); tokenBasedRes = (tokenBasedRes + float(tokenMetric->getMetric())) / 2; @@ -124,15 +123,9 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std } } - std::cout << "Plagiat" << std::endl; - std::cout << plagiatSolId << std::endl; - Solution sol = Solution(std::ctime(&now), userId, filedata, taskId, result, Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatSolId); - std::cout << "Dick" << std::endl; - std::cout << sol.getOrigSolution() << std::endl; - size_t id = solutionRepo->storeSolution(sol); sol.setId(id); return sol; diff --git a/server/internal/service/tests/CMakeLists.txt b/server/internal/service/tests/CMakeLists.txt index e1cdd49..2b5223f 100644 --- a/server/internal/service/tests/CMakeLists.txt +++ b/server/internal/service/tests/CMakeLists.txt @@ -7,7 +7,7 @@ find_package(GTest REQUIRED) add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIBRARY} GTest::GTest gmock) +target_link_libraries(${PROJECT_NAME} ${SERVICE_lib_LIBRARY} GTest::GTest gmock ${PQXX_LIB}) target_include_directories(${PROJECT_NAME} PUBLIC ${SERVICE_lib_INCLUDE_DIRS}) -- GitLab From d1a1d1512f2b34edfc246ba7496f02d973555a1b Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 13:06:50 +0300 Subject: [PATCH 100/134] add more informative result string --- .../internal/httpServer/src/TaskManager.cpp | 1 - .../repository/src/SolutionRepository.cpp | 6 +- server/internal/service/CMakeLists.txt | 4 +- .../service/include/SolutionService.h | 9 ++- .../internal/service/src/SolutionService.cpp | 60 ++++++++++++------- .../service/tests/SolutionServiceTest.cpp | 46 +++++++++----- server/internal/service/tests/task1.cpp | 13 ---- .../service/virtual/ISolutionService.h | 1 + server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 1 - server/pkg/antlr/python3/src/PythonAntlr.cpp | 1 - 10 files changed, 80 insertions(+), 62 deletions(-) delete mode 100644 server/internal/service/tests/task1.cpp diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index 6c24bbf..c56a962 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -12,7 +12,6 @@ TaskManager::TaskManager() : serializer(std::make_shared()), taskSer void TaskManager::setService(std::shared_ptr service) { taskService = service; } http::message_generator TaskManager::createTask(http::request &&req) { - try { std::string description = serializer->deserialNewTaskData(req.body()); taskService->createTask(description, 0.5); diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 380fef1..e2a9540 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -65,7 +65,9 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t task_id, size_t sender_id) { try { auto c = manager->connection(); - std::string sql = (boost::format ("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id).str(); + std::string sql = + (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; @@ -82,7 +84,6 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t } } - std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); @@ -165,4 +166,3 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { } SolutionRepository::SolutionRepository() { manager = std::make_shared(); } - diff --git a/server/internal/service/CMakeLists.txt b/server/internal/service/CMakeLists.txt index b598428..ab9c04c 100644 --- a/server/internal/service/CMakeLists.txt +++ b/server/internal/service/CMakeLists.txt @@ -23,6 +23,6 @@ set(SERVICE_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(SERVICE_lib_INCLUDE_DIRS ${SERVICE_lib_INCLUDE_DIRS} PARENT_SCOPE) -#enable_testing() -#add_subdirectory(tests) +enable_testing() +add_subdirectory(tests) diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index e78f431..d89a651 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -19,21 +19,20 @@ class SolutionService : public ISolutionService { std::unique_ptr textMetric; std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); - std::string setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold); + std::string setResultVerdict(float textBasedRes, float tokenBasedRes, size_t plagiatSolId, float treshold); std::pair getMaxTextResMetric(std::vector& solutions, const std::string& filedata, - float treshold); + size_t userId, float treshold); std::pair getMaxTokenResMetric(std::vector& solutions, std::vector& tokens, - float treshold); + size_t userId, float treshold); public: explicit SolutionService(std::unique_ptr solutionRepo, std::unique_ptr taskRepo); SolutionService(); - void setMetrics(std::unique_ptr metrics_){}; Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) override; void deleteSolutionById(size_t solId) override; - std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id); + std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) override; std::pair getMetrics(size_t solId) override; }; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 20e6af0..54fb3d1 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -1,15 +1,16 @@ #include "SolutionService.h" #include +#include #include #include #include "FileMethods.h" #include "MyCppAntlr.h" #include "PythonAntlr.h" +#include "ServiceUtils.h" #include "SolutionRepository.hpp" #include "TaskRepository.hpp" -#include "ServiceUtils.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; @@ -32,18 +33,34 @@ void SolutionService::setAntlrWrapper(const std::string& fileExtension, const st } } -std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold = 0.5f) { +std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBasedRes, size_t plagiatSolId, + float treshold = 0.5f) { float meanRes = (tokenBasedRes + textBasedRes) / 2; if (meanRes < treshold) { - return NOT_PLAGIAT_VERDICT; + return (boost::format("\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f") % + NOT_PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes) + .str(); + } + try { + std::string closestCode = solutionRepo->getSolutionById(plagiatSolId).value().getSource(); + return (boost::format( + "\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f\nОчень похоже на " + "решение, отправленное до вас:\n%s") % + PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes % closestCode) + .str(); + } catch (...) { + throw; } - return PLAGIAT_VERDICT; } std::pair SolutionService::getMaxTextResMetric(std::vector& solutions, - const std::string& filedata, float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0); + const std::string& filedata, size_t userId, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 1); for (auto sol : solutions) { + if (sol.getSenderId() == userId) { + continue; + } textMetric = std::make_unique(); textMetric->setData(filedata, sol.getSource()); float textBasedRes = float(textMetric->getMetric()); @@ -65,10 +82,14 @@ std::pair SolutionService::getMaxTextResMetric(std::vector SolutionService::getMaxTokenResMetric(std::vector& solutions, - std::vector& tokens, float treshold) { - std::pair maxMatch = std::make_pair(0.0, 0ul); + std::vector& tokens, size_t userId, + float treshold) { + std::pair maxMatch = std::make_pair(0.0, 1); for (auto sol : solutions) { + if (sol.getSenderId() == userId) { + continue; + } tokenMetric = std::make_unique(); tokenMetric->setData(tokens, Utils::convertStringIntoIntArray(sol.getTokens())); float tokenBasedRes = float(tokenMetric->getMetric()); @@ -109,19 +130,18 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); - std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, treshold); - std::pair tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, treshold); + std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, userId, treshold); + std::pair tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, userId, treshold); - std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); - - int plagiatSolId = 1; - if (result == PLAGIAT_VERDICT) { - if (textBasedRes.first > tokenBasedRes.first) { - plagiatSolId = textBasedRes.second; - } else { - plagiatSolId = tokenBasedRes.second; - } + size_t plagiatSolId = 1; + if (textBasedRes.first > tokenBasedRes.first) { + plagiatSolId = textBasedRes.second; + } else { + plagiatSolId = tokenBasedRes.second; } + std::cout << plagiatSolId << std::endl; + + std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, plagiatSolId, treshold); Solution sol = Solution(std::ctime(&now), userId, filedata, taskId, result, Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatSolId); @@ -155,7 +175,7 @@ std::pair SolutionService::getMetrics(size_t solId) { std::vector SolutionService::getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) { try { - return solutionRepo->getSolutionsByTaskIdAndSenderId(user_id,task_id); + return solutionRepo->getSolutionsByTaskIdAndSenderId(task_id, user_id); } catch (...) { throw; } diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index bb0c8ae..af21a7b 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -26,6 +26,7 @@ class SolutionRepositoryMock : public ISolutionRepository { MOCK_METHOD(void, deleteSolutionById, (size_t id), (override)); MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), (override)); + MOCK_METHOD(std::vector, getSolutionsByTaskIdAndSenderId, (size_t user_id, size_t task_id), (override)); }; class TaskRepositoryMock : public ITaskRepository { @@ -80,30 +81,43 @@ TEST_F(SolutionServiceTest, getMetricsException) { EXPECT_THROW(ss->getMetrics(-1), std::exception); } -TEST_F(SolutionServiceTest, createSolution) { +TEST_F(SolutionServiceTest, createSolutionPlagiat) { EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) .Times(1) .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back( - Solution(0, "", 1, "int main(){return 0;}", 1, "", - "9 45 132 85 86 89 78 45 132 128 45 132 101 1 128 132 127 132 103 103 132 128 84 85 132 115 1 86 89 " - "43 85 132 97 1 86 132 120 128 132 113 1 128 90 132 127 132 102 102 132 128 59 1 128 90 -1", - "", -1)); + solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); - std::string line; - // std::ifstream in("/project/server/internal/service/tests/task1.cpp"); // окрываем файл для чтения - // std::stringstream sst; - // sst << in.rdbuf(); - Solution sol = ss->createSolution(2, 1, "main.cpp", "int main() { return 0; }"); + EXPECT_CALL(*solutionMockPtr, getSolutionById(0)) + .Times(1) + .WillOnce(::testing::Return(std::make_optional( + Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)))); + + Solution sol = ss->createSolution(2, 1, "main.cpp", "size_t main(){return 1;}"); EXPECT_EQ(sol.getId(), 1); - // EXPECT_EQ(sol.getSource(), "int main(){return 0;}"); - EXPECT_EQ(sol.getTokens(), - "9 45 132 85 86 89 78 45 132 128 45 132 101 1 128 132 127 132 103 103 132 128 84 85 132 115 1 86 89 43 " - "85 132 97 1 86 132 120 128 132 113 1 128 90 132 127 132 102 102 132 128 59 1 128 90 -1 "); - EXPECT_EQ(sol.getResult(), "Не, ну вы не палитесь. Плагиат."); + EXPECT_EQ( + sol.getResult(), + "\nНе, ну вы не палитесь. Плагиат.\nРезультаты метрик: 0.72\n\tАнализ текста: 0.54\n\tАнализ токенов: 0.89" + "\nОчень похоже на решение, отправленное до вас:\nint main(){return 0;}"); +} + +TEST_F(SolutionServiceTest, createSolutionNonPlagiat) { + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) + .Times(1) + .WillRepeatedly(::testing::Return(1)); + + std::vector solutions; + solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); + + EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); + + Solution sol = ss->createSolution(1, 1, "main.cpp", "int main(){return 0;}"); + EXPECT_EQ(sol.getResult(), + "\nКрасивое решение. А главное уникальное !\nРезультаты метрик: 0.00\n\tАнализ текста: 0.00\n\tАнализ " + "токенов: 0.00"); } diff --git a/server/internal/service/tests/task1.cpp b/server/internal/service/tests/task1.cpp deleted file mode 100644 index 729043e..0000000 --- a/server/internal/service/tests/task1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int main() { - unsigned int n; - int count = 0; - std::cin >> n; - while (n != 0) { - if (n & 1) count++; - n >>= 2; - } - std::cout << count; - return 0; -} diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index a952116..7c1294d 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -11,5 +11,6 @@ class ISolutionService { virtual Solution createSolution(size_t userId, size_t taskId, const std::string& filename, const std::string& filedata) = 0; virtual void deleteSolutionById(size_t solId) = 0; + virtual std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) = 0; virtual std::pair getMetrics(size_t solId) = 0; }; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 7bccf1d..fcbc519 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -29,7 +29,6 @@ std::vector MyCppAntlr::getTokensTypes() { int i = 0; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { if (token->getText() == "") { - std::cout << "\nHERE\n" << std::endl; ans[i] = -1; } else { ans[i] = token->getType(); diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index 559ed3d..013966f 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -29,7 +29,6 @@ std::vector PythonAntlr::getTokensTypes() { int i = 0; for (antlr4::Token* token : tokenStream_ptr->getTokens()) { if (token->getText() == "") { - std::cout << "\nHERE\n" << std::endl; ans[i] = -1; } else { ans[i] = token->getType(); -- GitLab From e84a4f777130fa62a3f90becbd805cf48042a3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 19 May 2023 13:49:05 +0300 Subject: [PATCH 101/134] add some beauty to registration --- client/internal/gui/src/EntryWindow.cpp | 2 +- client/internal/gui/src/SignUpDialog.cpp | 6 ++- client/internal/gui/src/SolutionsWindow.cpp | 2 +- .../internal/httpServer/src/UserManager.cpp | 20 ++++++-- .../{Exceptions.h => ServiceExceptions.h} | 48 +++++++++---------- .../internal/service/src/SolutionService.cpp | 1 + server/internal/service/src/UserService.cpp | 2 +- .../service/tests/UserServiceTest.cpp | 2 +- 8 files changed, 51 insertions(+), 32 deletions(-) rename server/internal/service/include/{Exceptions.h => ServiceExceptions.h} (96%) diff --git a/client/internal/gui/src/EntryWindow.cpp b/client/internal/gui/src/EntryWindow.cpp index a781f17..9a0a4db 100644 --- a/client/internal/gui/src/EntryWindow.cpp +++ b/client/internal/gui/src/EntryWindow.cpp @@ -23,7 +23,7 @@ void EntryWindow::setupUi(QMainWindow *EntryWindow) { verticalLayout = new QVBoxLayout(centralwidget); introLabel = new QLabel(centralwidget); - introLabel->setText("Добро пожаловать в Noiseground!"); + introLabel->setText("Добро пожаловать в SourcedOut!"); introLabel->setGeometry(QRect(140, 200, 331, 31)); verticalLayout->addWidget(introLabel, 0, Qt::AlignHCenter); diff --git a/client/internal/gui/src/SignUpDialog.cpp b/client/internal/gui/src/SignUpDialog.cpp index 1cdc2a3..7d34cb5 100644 --- a/client/internal/gui/src/SignUpDialog.cpp +++ b/client/internal/gui/src/SignUpDialog.cpp @@ -87,7 +87,11 @@ void SignUpDialog::on_signUpButton_clicked() { close(); break; case 403: - QMessageBox::warning(this, "Регистрация невозможна", "Логин уже занят!"); + QMessageBox::warning(this, "Регистрация невозможна", "Произошла ошибка! Попробуйте ещё раз. \n" + "\n" + "Логин должен быть в виде: example@mail.ru \n" + "Имя от 3 до 20 символов \n" + "Пароль от 8 до 30 символов"); break; default: QMessageBox::critical(this, "Регистрация невозможна!", "Нет соединения с сервером!"); diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index ccbc7e5..854f5ff 100644 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -37,7 +37,7 @@ void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { filename = new QLabel(this); chooseFileButton = new QPushButton(this); - chooseFileButton->setText(QString::fromUtf8("Выбирите файл")); + chooseFileButton->setText(QString::fromUtf8("Выберите файл")); sendButton = new QPushButton(this); sendButton->setText(QString::fromUtf8("Отправить")); diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index b94bca7..b9e68e3 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -1,6 +1,7 @@ #include "UserManager.h" #include "TmpUserService.h" +#include "ServiceExceptions.h" #include "Utils.h" UserManager::UserManager() : serializer(std::make_shared()), userService(std::make_shared()) {} @@ -13,7 +14,7 @@ http::message_generator UserManager::loginUser(http::request try { std::tie(login, password) = serializer->deserialUserData(req.body()); } catch (...) { - return getBadRequest(req, "Something went wrong!"); + return getBadRequest(req, "Неправильные параметры!"); } User user; @@ -40,16 +41,21 @@ http::message_generator UserManager::loginUser(http::request res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); res.body() = serializer->serialUserData(user); - std::cout << serializer->serialUserData(user) << std::endl; res.prepare_payload(); return res; } } http::message_generator UserManager::registerUser(http::request &&req) { + std::string login, password, username; + try { - std::string login, password, username; std::tie(login, password, username) = serializer->deserialNewUserData(req.body()); + } catch (...) { + return getBadRequest(req, "Неправильные параметры!"); + } + + try { User user = userService->createUser(login, username, password); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -58,6 +64,14 @@ http::message_generator UserManager::registerUser(http::requestserialUserData(user); res.prepare_payload(); return res; + } catch (const ValidateException& e) { + http::response res{http::status::forbidden, req.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(req.keep_alive()); + res.body() = "Не валидные данные"; + res.prepare_payload(); + return res; } catch (...) { return getBadRequest(req, "Something went wrong!"); } diff --git a/server/internal/service/include/Exceptions.h b/server/internal/service/include/ServiceExceptions.h similarity index 96% rename from server/internal/service/include/Exceptions.h rename to server/internal/service/include/ServiceExceptions.h index 5e52658..aabf3c1 100644 --- a/server/internal/service/include/Exceptions.h +++ b/server/internal/service/include/ServiceExceptions.h @@ -1,25 +1,25 @@ -#pragma once - -class ValidateException : public std::exception { - std::string _msg; - - public: - ValidateException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } -}; - -class LoginException : public std::exception { - std::string _msg; - - public: - LoginException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } -}; - -class FileExtensionException : public std::exception { - std::string _msg; - - public: - FileExtensionException(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } +#pragma once + +class ValidateException : public std::exception { + std::string _msg; + + public: + ValidateException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +class LoginException : public std::exception { + std::string _msg; + + public: + LoginException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } +}; + +class FileExtensionException : public std::exception { + std::string _msg; + + public: + FileExtensionException(const std::string& msg) : _msg(msg) {} + virtual const char* what() const noexcept override { return _msg.c_str(); } }; \ No newline at end of file diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 54fb3d1..b48e53f 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -11,6 +11,7 @@ #include "ServiceUtils.h" #include "SolutionRepository.hpp" #include "TaskRepository.hpp" +#include "ServiceExceptions.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; diff --git a/server/internal/service/src/UserService.cpp b/server/internal/service/src/UserService.cpp index f6dc444..11ceadd 100644 --- a/server/internal/service/src/UserService.cpp +++ b/server/internal/service/src/UserService.cpp @@ -1,6 +1,6 @@ #include "UserService.h" -#include "Exceptions.h" +#include "ServiceExceptions.h" #include "UserRepository.hpp" #include "UserValidator.h" diff --git a/server/internal/service/tests/UserServiceTest.cpp b/server/internal/service/tests/UserServiceTest.cpp index f4828a7..afb6fe6 100644 --- a/server/internal/service/tests/UserServiceTest.cpp +++ b/server/internal/service/tests/UserServiceTest.cpp @@ -1,7 +1,7 @@ #include #include -#include "Exceptions.h" +#include "ServiceExceptions.h" #include "UserService.h" class Exception : public std::exception { -- GitLab From 606c093a2860fb88094fbcb809a60bd596f03756 Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Fri, 19 May 2023 17:50:55 +0300 Subject: [PATCH 102/134] add field to solution and task --- Docker/init.sql | 1339 +++++++++-------- server/internal/entities/include/Solution.hpp | 21 +- server/internal/entities/include/Task.hpp | 10 +- server/internal/entities/src/Solution.cpp | 26 +- server/internal/entities/src/Task.cpp | 23 +- .../repository/include/SolutionRepository.hpp | 7 +- .../repository/src/SolutionRepository.cpp | 66 +- .../repository/src/TaskRepository.cpp | 24 +- .../virtual/ISolutionRepository.hpp | 6 +- 9 files changed, 800 insertions(+), 722 deletions(-) mode change 100755 => 100644 Docker/init.sql diff --git a/Docker/init.sql b/Docker/init.sql old mode 100755 new mode 100644 index 880e420..8a1e8fd --- a/Docker/init.sql +++ b/Docker/init.sql @@ -1,668 +1,671 @@ --- --- PostgreSQL database cluster dump --- - --- Started on 2023-05-15 22:49:08 - -SET default_transaction_read_only = off; - -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; - --- --- Roles --- - -CREATE ROLE postgres; -ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:nOmjHrNPdaIcnCeed7FgbQ==$U+pukPiYK1tBvbNsPjn4d9zV4IXLekf/OMW5+ZDzgrY=:1f9vBcPgoAcX5hmUUOkjkXLp0FRCqsnlQRmYs2U29pU='; - --- --- User Configurations --- - - - - - - - - --- --- Databases --- - --- --- Database "template1" dump --- - -\connect template1 - --- --- PostgreSQL database dump --- - --- Dumped from database version 15.2 --- Dumped by pg_dump version 15.2 - --- Started on 2023-05-15 22:49:08 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- Completed on 2023-05-15 22:49:08 - --- --- PostgreSQL database dump complete --- - --- --- Database "mydb" dump --- - --- --- PostgreSQL database dump --- - --- Dumped from database version 15.2 --- Dumped by pg_dump version 15.2 - --- Started on 2023-05-15 22:49:08 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- TOC entry 3362 (class 1262 OID 16565) --- Name: mydb; Type: DATABASE; Schema: -; Owner: postgres --- - -CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.utf8'; - - -ALTER DATABASE mydb OWNER TO postgres; - -\connect mydb - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- TOC entry 215 (class 1259 OID 16574) --- Name: users; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.users ( - id integer NOT NULL, - login character varying(255), - password character varying(255), - username character varying(255) -); - - -ALTER TABLE public.users OWNER TO postgres; - --- --- TOC entry 214 (class 1259 OID 16573) --- Name: Users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public."Users_id_seq" - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public."Users_id_seq" OWNER TO postgres; - --- --- TOC entry 3363 (class 0 OID 0) --- Dependencies: 214 --- Name: Users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public."Users_id_seq" OWNED BY public.users.id; - - --- --- TOC entry 219 (class 1259 OID 16613) --- Name: metricstat; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.metricstat ( - id integer NOT NULL, - solution_id integer, - text_based_res real, - token_based_res real, - tree_based_res real, - verdict boolean, - mean_res real -); - - -ALTER TABLE public.metricstat OWNER TO postgres; - --- --- TOC entry 221 (class 1259 OID 16626) --- Name: metricstat_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.metricstat_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - MAXVALUE 2147483647 - CACHE 1; - - -ALTER TABLE public.metricstat_id_seq OWNER TO postgres; - --- --- TOC entry 3364 (class 0 OID 0) --- Dependencies: 221 --- Name: metricstat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.metricstat_id_seq OWNED BY public.metricstat.id; - - --- --- TOC entry 217 (class 1259 OID 16583) --- Name: solutions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.solutions ( - id integer NOT NULL, - send_date date NOT NULL, - sender_id integer, - source character varying, - task_id integer, - result character varying, - tokens character varying, - asttree character varying, - original_solution_id integer -); - - -ALTER TABLE public.solutions OWNER TO postgres; - --- --- TOC entry 216 (class 1259 OID 16582) --- Name: solutions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.solutions_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.solutions_id_seq OWNER TO postgres; - --- --- TOC entry 3365 (class 0 OID 0) --- Dependencies: 216 --- Name: solutions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.solutions_id_seq OWNED BY public.solutions.id; - - --- --- TOC entry 218 (class 1259 OID 16598) --- Name: tasks; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.tasks ( - id integer NOT NULL, - description text, - treshold real -); - - -ALTER TABLE public.tasks OWNER TO postgres; - --- --- TOC entry 220 (class 1259 OID 16623) --- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.tasks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - MAXVALUE 2147483647 - CACHE 1; - - -ALTER TABLE public.tasks_id_seq OWNER TO postgres; - --- --- TOC entry 3366 (class 0 OID 0) --- Dependencies: 220 --- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; - - --- --- TOC entry 3191 (class 2604 OID 16628) --- Name: metricstat id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.metricstat ALTER COLUMN id SET DEFAULT nextval('public.metricstat_id_seq'::regclass); - - --- --- TOC entry 3189 (class 2604 OID 16586) --- Name: solutions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.solutions ALTER COLUMN id SET DEFAULT nextval('public.solutions_id_seq'::regclass); - - --- --- TOC entry 3190 (class 2604 OID 16625) --- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); - - --- --- TOC entry 3188 (class 2604 OID 16577) --- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public."Users_id_seq"'::regclass); - - --- --- TOC entry 3354 (class 0 OID 16613) --- Dependencies: 219 --- Data for Name: metricstat; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.metricstat (id, solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) FROM stdin; -1 1 1 1 1 t 1 -\. - - --- --- TOC entry 3352 (class 0 OID 16583) --- Dependencies: 217 --- Data for Name: solutions; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.solutions (id, send_date, sender_id, source, task_id, result, tokens, asttree, original_solution_id) FROM stdin; -1 2023-05-02 10 0.1 27 0.1 0.1 0.1 1 -\. - - --- --- TOC entry 3353 (class 0 OID 16598) --- Dependencies: 218 --- Data for Name: tasks; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.tasks (id, description, treshold) FROM stdin; -2 orher_description 0.1 -1 description 0.5 -\. - - --- --- TOC entry 3350 (class 0 OID 16574) --- Dependencies: 215 --- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres --- - -COPY public.users (id, login, password, username) FROM stdin; -1 qwerty200468@gmail.com 123 tolik -2 qwerty200468@gmail.com 123 tolik -\. - - --- --- TOC entry 3367 (class 0 OID 0) --- Dependencies: 214 --- Name: Users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres --- - -SELECT pg_catalog.setval('public."Users_id_seq"', 1, true); - - --- --- TOC entry 3368 (class 0 OID 0) --- Dependencies: 221 --- Name: metricstat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres --- - -SELECT pg_catalog.setval('public.metricstat_id_seq', 1, true); - - --- --- TOC entry 3369 (class 0 OID 0) --- Dependencies: 216 --- Name: solutions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres --- - -SELECT pg_catalog.setval('public.solutions_id_seq', 1, true); - - --- --- TOC entry 3370 (class 0 OID 0) --- Dependencies: 220 --- Name: tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres --- - -SELECT pg_catalog.setval('public.tasks_id_seq', 1, true); - - --- --- TOC entry 3193 (class 2606 OID 16581) --- Name: users Users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.users - ADD CONSTRAINT "Users_pkey" PRIMARY KEY (id); - - --- --- TOC entry 3202 (class 2606 OID 16617) --- Name: metricstat metricStat_pk; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.metricstat - ADD CONSTRAINT "metricStat_pk" PRIMARY KEY (id); - - --- --- TOC entry 3198 (class 2606 OID 16588) --- Name: solutions solutions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.solutions - ADD CONSTRAINT solutions_pkey PRIMARY KEY (id); - - --- --- TOC entry 3200 (class 2606 OID 16604) --- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks - ADD CONSTRAINT tasks_pkey PRIMARY KEY (id); - - --- --- TOC entry 3194 (class 1259 OID 16637) --- Name: fki_original_solution_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX fki_original_solution_id ON public.solutions USING btree (original_solution_id); - - --- --- TOC entry 3195 (class 1259 OID 16594) --- Name: fki_sender_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX fki_sender_id ON public.solutions USING btree (sender_id); - - --- --- TOC entry 3196 (class 1259 OID 16610) --- Name: fki_task_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX fki_task_id ON public.solutions USING btree (task_id); - - --- --- TOC entry 3203 (class 2606 OID 16632) --- Name: solutions original_solution_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.solutions - ADD CONSTRAINT original_solution_id FOREIGN KEY (original_solution_id) REFERENCES public.solutions(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID; - - --- --- TOC entry 3204 (class 2606 OID 16589) --- Name: solutions sender_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.solutions - ADD CONSTRAINT sender_id FOREIGN KEY (sender_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE NOT VALID; - - --- --- TOC entry 3206 (class 2606 OID 16618) --- Name: metricstat solutions_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.metricstat - ADD CONSTRAINT solutions_id FOREIGN KEY (solution_id) REFERENCES public.solutions(id); - - --- --- TOC entry 3205 (class 2606 OID 16605) --- Name: solutions task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.solutions - ADD CONSTRAINT task_id FOREIGN KEY (task_id) REFERENCES public.tasks(id) NOT VALID; - - --- Completed on 2023-05-15 22:49:09 - --- --- PostgreSQL database dump complete --- - --- --- Database "postgres" dump --- - -\connect postgres - --- --- PostgreSQL database dump --- - --- Dumped from database version 15.2 --- Dumped by pg_dump version 15.2 - --- Started on 2023-05-15 22:49:09 - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - --- --- TOC entry 8 (class 2615 OID 16398) --- Name: pgagent; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA pgagent; - - -ALTER SCHEMA pgagent OWNER TO postgres; - --- --- TOC entry 3437 (class 0 OID 0) --- Dependencies: 8 --- Name: SCHEMA pgagent; Type: COMMENT; Schema: -; Owner: postgres --- - -COMMENT ON SCHEMA pgagent IS 'pgAgent system tables'; - - --- --- TOC entry 2 (class 3079 OID 16384) --- Name: adminpack; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog; - - --- --- TOC entry 3438 (class 0 OID 0) --- Dependencies: 2 --- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL'; - - --- --- TOC entry 3 (class 3079 OID 16399) --- Name: pgagent; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgagent WITH SCHEMA pgagent; - - --- --- TOC entry 3439 (class 0 OID 0) --- Dependencies: 3 --- Name: EXTENSION pgagent; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgagent IS 'A PostgreSQL job scheduler'; - - --- --- TOC entry 3218 (class 0 OID 16400) --- Dependencies: 219 --- Data for Name: pga_jobagent; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_jobagent (jagpid, jaglogintime, jagstation) FROM stdin; -7380 2023-05-09 17:32:50.44529+03 DESKTOP-CLI5MDC -\. - - --- --- TOC entry 3219 (class 0 OID 16409) --- Dependencies: 221 --- Data for Name: pga_jobclass; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_jobclass (jclid, jclname) FROM stdin; -\. - - --- --- TOC entry 3220 (class 0 OID 16419) --- Dependencies: 223 --- Data for Name: pga_job; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_job (jobid, jobjclid, jobname, jobdesc, jobhostagent, jobenabled, jobcreated, jobchanged, jobagentid, jobnextrun, joblastrun) FROM stdin; -\. - - --- --- TOC entry 3222 (class 0 OID 16467) --- Dependencies: 227 --- Data for Name: pga_schedule; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_schedule (jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths) FROM stdin; -\. - - --- --- TOC entry 3223 (class 0 OID 16495) --- Dependencies: 229 --- Data for Name: pga_exception; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_exception (jexid, jexscid, jexdate, jextime) FROM stdin; -\. - - --- --- TOC entry 3224 (class 0 OID 16509) --- Dependencies: 231 --- Data for Name: pga_joblog; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_joblog (jlgid, jlgjobid, jlgstatus, jlgstart, jlgduration) FROM stdin; -\. - - --- --- TOC entry 3221 (class 0 OID 16443) --- Dependencies: 225 --- Data for Name: pga_jobstep; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_jobstep (jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind, jstcode, jstconnstr, jstdbname, jstonerror, jscnextrun) FROM stdin; -\. - - --- --- TOC entry 3225 (class 0 OID 16525) --- Dependencies: 233 --- Data for Name: pga_jobsteplog; Type: TABLE DATA; Schema: pgagent; Owner: postgres --- - -COPY pgagent.pga_jobsteplog (jslid, jsljlgid, jsljstid, jslstatus, jslresult, jslstart, jslduration, jsloutput) FROM stdin; -\. - - --- Completed on 2023-05-15 22:49:09 - --- --- PostgreSQL database dump complete --- - --- Completed on 2023-05-15 22:49:09 - --- --- PostgreSQL database cluster dump complete --- +-- +-- PostgreSQL database cluster dump +-- + +-- Started on 2023-05-15 22:49:08 + +SET default_transaction_read_only = off; + +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; + +-- +-- Roles +-- + +CREATE ROLE postgres; +ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:nOmjHrNPdaIcnCeed7FgbQ==$U+pukPiYK1tBvbNsPjn4d9zV4IXLekf/OMW5+ZDzgrY=:1f9vBcPgoAcX5hmUUOkjkXLp0FRCqsnlQRmYs2U29pU='; + +-- +-- User Configurations +-- + + + + + + + + +-- +-- Databases +-- + +-- +-- Database "template1" dump +-- + +\connect template1 + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- Completed on 2023-05-15 22:49:08 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "mydb" dump +-- + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:08 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 3362 (class 1262 OID 16565) +-- Name: mydb; Type: DATABASE; Schema: -; Owner: postgres +-- + +CREATE DATABASE mydb WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.utf8'; + + +ALTER DATABASE mydb OWNER TO postgres; + +\connect mydb + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- TOC entry 215 (class 1259 OID 16574) +-- Name: users; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.users ( + id integer NOT NULL, + login character varying(255), + password character varying(255), + username character varying(255) +); + + +ALTER TABLE public.users OWNER TO postgres; + +-- +-- TOC entry 214 (class 1259 OID 16573) +-- Name: Users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public."Users_id_seq" + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public."Users_id_seq" OWNER TO postgres; + +-- +-- TOC entry 3363 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public."Users_id_seq" OWNED BY public.users.id; + + +-- +-- TOC entry 219 (class 1259 OID 16613) +-- Name: metricstat; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.metricstat ( + id integer NOT NULL, + solution_id integer, + text_based_res real, + token_based_res real, + tree_based_res real, + verdict boolean, + mean_res real +); + + +ALTER TABLE public.metricstat OWNER TO postgres; + +-- +-- TOC entry 221 (class 1259 OID 16626) +-- Name: metricstat_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.metricstat_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.metricstat_id_seq OWNER TO postgres; + +-- +-- TOC entry 3364 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.metricstat_id_seq OWNED BY public.metricstat.id; + + +-- +-- TOC entry 217 (class 1259 OID 16583) +-- Name: solutions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.solutions ( + id integer NOT NULL, + send_date date NOT NULL, + sender_id integer, + source character varying, + task_id integer, + result character varying, + tokens character varying, + asttree character varying, + original_solution_id integer, + language character varying(255) +); + + +ALTER TABLE public.solutions OWNER TO postgres; + +-- +-- TOC entry 216 (class 1259 OID 16582) +-- Name: solutions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.solutions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.solutions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3365 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.solutions_id_seq OWNED BY public.solutions.id; + + +-- +-- TOC entry 218 (class 1259 OID 16598) +-- Name: tasks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tasks ( + id integer NOT NULL, + description text, + treshold real, + name character varying(255) +); + + +ALTER TABLE public.tasks OWNER TO postgres; + +-- +-- TOC entry 220 (class 1259 OID 16623) +-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + MAXVALUE 2147483647 + CACHE 1; + + +ALTER TABLE public.tasks_id_seq OWNER TO postgres; + +-- +-- TOC entry 3366 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; + + +-- +-- TOC entry 3191 (class 2604 OID 16628) +-- Name: metricstat id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat ALTER COLUMN id SET DEFAULT nextval('public.metricstat_id_seq'::regclass); + + +-- +-- TOC entry 3189 (class 2604 OID 16586) +-- Name: solutions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions ALTER COLUMN id SET DEFAULT nextval('public.solutions_id_seq'::regclass); + + +-- +-- TOC entry 3190 (class 2604 OID 16625) +-- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); + + +-- +-- TOC entry 3188 (class 2604 OID 16577) +-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public."Users_id_seq"'::regclass); + + +-- +-- TOC entry 3354 (class 0 OID 16613) +-- Dependencies: 219 +-- Data for Name: metricstat; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.metricstat (id, solution_id, text_based_res, token_based_res, tree_based_res, verdict, mean_res) FROM stdin; +0 0 1 1 1 t 1 +\. + + +-- +-- TOC entry 3352 (class 0 OID 16583) +-- Dependencies: 217 +-- Data for Name: solutions; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.solutions (id, send_date, sender_id, source, task_id, result, tokens, asttree, original_solution_id, language) FROM stdin; +0 2023-05-02 0 0.1 0 0.1 0.1 0.1 0 unknown +\. + + +-- +-- TOC entry 3353 (class 0 OID 16598) +-- Dependencies: 218 +-- Data for Name: tasks; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.tasks (id, description, treshold, name) FROM stdin; +2 other_description 0.1 second_task +1 description 0.5 first_task +0 zero 0 zero +\. + + +-- +-- TOC entry 3350 (class 0 OID 16574) +-- Dependencies: 215 +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres +-- + +COPY public.users (id, login, password, username) FROM stdin; +0 deleted_user 0000 DELETED_USER +1 qwerty200468@gmail.com 123 tolik +\. + + +-- +-- TOC entry 3367 (class 0 OID 0) +-- Dependencies: 214 +-- Name: Users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public."Users_id_seq"', 1, true); + + +-- +-- TOC entry 3368 (class 0 OID 0) +-- Dependencies: 221 +-- Name: metricstat_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.metricstat_id_seq', 1, true); + + +-- +-- TOC entry 3369 (class 0 OID 0) +-- Dependencies: 216 +-- Name: solutions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.solutions_id_seq', 1, true); + + +-- +-- TOC entry 3370 (class 0 OID 0) +-- Dependencies: 220 +-- Name: tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres +-- + +SELECT pg_catalog.setval('public.tasks_id_seq', 1, true); + + +-- +-- TOC entry 3193 (class 2606 OID 16581) +-- Name: users Users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT "Users_pkey" PRIMARY KEY (id); + + +-- +-- TOC entry 3202 (class 2606 OID 16617) +-- Name: metricstat metricStat_pk; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT "metricStat_pk" PRIMARY KEY (id); + + +-- +-- TOC entry 3198 (class 2606 OID 16588) +-- Name: solutions solutions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT solutions_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3200 (class 2606 OID 16604) +-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks + ADD CONSTRAINT tasks_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3194 (class 1259 OID 16637) +-- Name: fki_original_solution_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_original_solution_id ON public.solutions USING btree (original_solution_id); + + +-- +-- TOC entry 3195 (class 1259 OID 16594) +-- Name: fki_sender_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_sender_id ON public.solutions USING btree (sender_id); + + +-- +-- TOC entry 3196 (class 1259 OID 16610) +-- Name: fki_task_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX fki_task_id ON public.solutions USING btree (task_id); + + +-- +-- TOC entry 3203 (class 2606 OID 16632) +-- Name: solutions original_solution_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT original_solution_id FOREIGN KEY (original_solution_id) REFERENCES public.solutions(id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3204 (class 2606 OID 16589) +-- Name: solutions sender_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT sender_id FOREIGN KEY (sender_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE NOT VALID; + + +-- +-- TOC entry 3206 (class 2606 OID 16618) +-- Name: metricstat solutions_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.metricstat + ADD CONSTRAINT solutions_id FOREIGN KEY (solution_id) REFERENCES public.solutions(id); + + +-- +-- TOC entry 3205 (class 2606 OID 16605) +-- Name: solutions task_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.solutions + ADD CONSTRAINT task_id FOREIGN KEY (task_id) REFERENCES public.tasks(id) NOT VALID; + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- +-- Database "postgres" dump +-- + +\connect postgres + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.2 +-- Dumped by pg_dump version 15.2 + +-- Started on 2023-05-15 22:49:09 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- TOC entry 8 (class 2615 OID 16398) +-- Name: pgagent; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA pgagent; + + +ALTER SCHEMA pgagent OWNER TO postgres; + +-- +-- TOC entry 3437 (class 0 OID 0) +-- Dependencies: 8 +-- Name: SCHEMA pgagent; Type: COMMENT; Schema: -; Owner: postgres +-- + +COMMENT ON SCHEMA pgagent IS 'pgAgent system tables'; + + +-- +-- TOC entry 2 (class 3079 OID 16384) +-- Name: adminpack; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog; + + +-- +-- TOC entry 3438 (class 0 OID 0) +-- Dependencies: 2 +-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL'; + + +-- +-- TOC entry 3 (class 3079 OID 16399) +-- Name: pgagent; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pgagent WITH SCHEMA pgagent; + + +-- +-- TOC entry 3439 (class 0 OID 0) +-- Dependencies: 3 +-- Name: EXTENSION pgagent; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pgagent IS 'A PostgreSQL job scheduler'; + + +-- +-- TOC entry 3218 (class 0 OID 16400) +-- Dependencies: 219 +-- Data for Name: pga_jobagent; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobagent (jagpid, jaglogintime, jagstation) FROM stdin; +7380 2023-05-09 17:32:50.44529+03 DESKTOP-CLI5MDC +\. + + +-- +-- TOC entry 3219 (class 0 OID 16409) +-- Dependencies: 221 +-- Data for Name: pga_jobclass; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobclass (jclid, jclname) FROM stdin; +\. + + +-- +-- TOC entry 3220 (class 0 OID 16419) +-- Dependencies: 223 +-- Data for Name: pga_job; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_job (jobid, jobjclid, jobname, jobdesc, jobhostagent, jobenabled, jobcreated, jobchanged, jobagentid, jobnextrun, joblastrun) FROM stdin; +\. + + +-- +-- TOC entry 3222 (class 0 OID 16467) +-- Dependencies: 227 +-- Data for Name: pga_schedule; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_schedule (jscid, jscjobid, jscname, jscdesc, jscenabled, jscstart, jscend, jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths) FROM stdin; +\. + + +-- +-- TOC entry 3223 (class 0 OID 16495) +-- Dependencies: 229 +-- Data for Name: pga_exception; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_exception (jexid, jexscid, jexdate, jextime) FROM stdin; +\. + + +-- +-- TOC entry 3224 (class 0 OID 16509) +-- Dependencies: 231 +-- Data for Name: pga_joblog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_joblog (jlgid, jlgjobid, jlgstatus, jlgstart, jlgduration) FROM stdin; +\. + + +-- +-- TOC entry 3221 (class 0 OID 16443) +-- Dependencies: 225 +-- Data for Name: pga_jobstep; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobstep (jstid, jstjobid, jstname, jstdesc, jstenabled, jstkind, jstcode, jstconnstr, jstdbname, jstonerror, jscnextrun) FROM stdin; +\. + + +-- +-- TOC entry 3225 (class 0 OID 16525) +-- Dependencies: 233 +-- Data for Name: pga_jobsteplog; Type: TABLE DATA; Schema: pgagent; Owner: postgres +-- + +COPY pgagent.pga_jobsteplog (jslid, jsljlgid, jsljstid, jslstatus, jslresult, jslstart, jslduration, jsloutput) FROM stdin; +\. + + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database dump complete +-- + +-- Completed on 2023-05-15 22:49:09 + +-- +-- PostgreSQL database cluster dump complete +-- diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 15a6908..2d4e1d8 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -6,12 +6,16 @@ #include class Solution { - public: - Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, size_t orig_solution) noexcept; +public: + Solution(size_t id, std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution, std::string language) noexcept; - Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, size_t orig_solution) noexcept; + Solution(std::string sendDate, size_t senderId, std::string source, + size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution, std::string language) noexcept; Solution() noexcept; @@ -49,13 +53,17 @@ class Solution { void setOrigSolution(size_t origSolution); + [[nodiscard]] const std::string &getLanguage() const; + + void setLanguage(const std::string &language); + void setId(size_t id) noexcept; bool operator==(const Solution &rhs) const noexcept; bool operator!=(const Solution &rhs) const noexcept; - private: +private: size_t id; std::string send_date; size_t sender_id; @@ -65,6 +73,7 @@ class Solution { size_t task_id; std::string result; size_t orig_solution = 0; + std::string language; }; #endif // SOURCEDOUT_SOLUTION_HPP diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index 65e1b06..991e029 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -7,11 +7,13 @@ class Task { size_t id; std::string description; float treshhold; + std::string name; public: - Task(size_t id, std::string description_, float treshold_) noexcept; + Task(size_t id, std::string description_, + float treshold_, std::string name) noexcept; - Task(std::string description_, float treshold_) noexcept; + Task(std::string description_, float treshold_, std::string name) noexcept; Task() noexcept; @@ -27,6 +29,10 @@ class Task { void setId(size_t id) noexcept; + [[nodiscard]] const std::string &getName() const; + + void setName(const std::string &name); + bool operator==(const Task &rhs) const noexcept; bool operator!=(const Task &rhs) const noexcept; diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index ec74455..320907e 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -4,8 +4,10 @@ #include #include -Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, - std::string result, std::string tokens, std::string astTree, size_t orig_solution) noexcept +Solution::Solution(size_t id, std::string sendDate, size_t senderId, + std::string source, size_t taskId, + std::string result, std::string tokens, + std::string astTree, size_t orig_solution, std::string language_) noexcept : id(id), send_date(std::move(sendDate)), sender_id(senderId), @@ -14,10 +16,13 @@ Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string astTree(std::move(astTree)), task_id(taskId), result(std::move(result)), - orig_solution(orig_solution) {} + orig_solution(orig_solution), + language(std::move(language_)){} -Solution::Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, size_t orig_solution) noexcept +Solution::Solution(std::string sendDate, size_t senderId, std::string source, + size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution, std::string language_) noexcept : id(0), send_date(std::move(sendDate)), sender_id(senderId), @@ -26,7 +31,8 @@ Solution::Solution(std::string sendDate, size_t senderId, std::string source, si astTree(std::move(astTree)), task_id(taskId), result(std::move(result)), - orig_solution(orig_solution) {} + orig_solution(orig_solution), + language(std::move(language_)) {} size_t Solution::getId() const noexcept { return id; } @@ -69,3 +75,11 @@ size_t Solution::getOrigSolution() const { return orig_solution; } void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSolution; } Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} + +const std::string &Solution::getLanguage() const { + return language; +} + +void Solution::setLanguage(const std::string &language_) { + Solution::language = language_; +} diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index b6ec08a..4b14564 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -1,13 +1,18 @@ #include "Task.hpp" #include +#include -Task::Task(std::string description_, float treshold_) noexcept - : id(0), description(std::move(description_)), treshhold(treshold_) {} +Task::Task(std::string description_, float treshold_, std::string name_) noexcept + : id(0), description(std::move(description_)), + treshhold(treshold_), name(std::move(name_)) {} -Task::Task(size_t id, std::string description_, float treshold_) noexcept - : id(id), description(std::move(description_)), treshhold(treshold_) {} -Task::Task() noexcept : id(0), treshhold(0) {} +Task::Task(size_t id, std::string description_, + float treshold_, std::string name_) noexcept + : id(id), description(std::move(description_)), + treshhold(treshold_), name(std::move(name_)) {} + +Task::Task() noexcept: id(0), treshhold(0) {} unsigned long Task::getId() const noexcept { return id; } @@ -24,3 +29,11 @@ bool Task::operator!=(const Task &rhs) const noexcept { return !(rhs == *this); float Task::getTreshhold() const noexcept { return treshhold; } void Task::setTreshhold(float treshhold_) noexcept { Task::treshhold = treshhold_; } + +const std::string &Task::getName() const { + return name; +} + +void Task::setName(const std::string &name_) { + Task::name = name_; +} diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index c3d912b..7daeeb3 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class SolutionRepository : public ISolutionRepository { - public: +public: SolutionRepository(); std::optional getSolutionById(size_t id) override; @@ -24,6 +24,9 @@ class SolutionRepository : public ISolutionRepository { std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) override; + std::vector getSolutionsByTaskIdAndLanguage( + size_t task_id, std::string lang) override; + size_t storeSolution(Solution solution) override; void updateSolution(Solution solution) override; @@ -34,7 +37,7 @@ class SolutionRepository : public ISolutionRepository { std::optional getOriginalSolution(size_t id) override; - private: +private: static Solution makeSolution(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index e2a9540..cbff3f1 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -29,10 +29,10 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row)); + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); manager->freeConnection(c); @@ -49,10 +49,10 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row)); + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); manager->freeConnection(c); @@ -66,15 +66,15 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t try { auto c = manager->connection(); std::string sql = - (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) - .str(); + (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row)); + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); manager->freeConnection(c); @@ -84,6 +84,29 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t } } +std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t task_id, std::string lang) { + try { + auto c = manager->connection(); + std::string sql = + (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND language='%s'") % task_id % lang) + .str(); + nontransaction n(*c); + auto stream = stream_from::query(n, sql); + std::vector solutions; + std::tuple row; + while (stream >> row) { + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); + } + stream.complete(); + manager->freeConnection(c); + return solutions; + } catch (...) { + throw; + } +} + + std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); @@ -103,12 +126,12 @@ size_t SolutionRepository::storeSolution(Solution solution) { auto c = manager->connection(); std::string sql = - (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " - "astTree, original_solution_id) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()) - .str(); + (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " + "astTree, original_solution_id, language) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % + solution.getOrigSolution() % solution.getLanguage()).str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -124,12 +147,12 @@ void SolutionRepository::updateSolution(Solution solution) { auto c = manager->connection(); std::string sql = - (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," - " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " - "original_solution_id = '%s';") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution()) - .str(); + (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " + "original_solution_id = '%s', language = '%s';") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % + solution.getOrigSolution() % solution.getLanguage()).str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -162,7 +185,8 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("result")).as(), c.at(c.column_number("tokens")).as(), c.at(c.column_number("astTree")).as(), - c.at(c.column_number("original_solution_id")).as()}; + c.at(c.column_number("original_solution_id")).as(), + c.at(c.column_number("language")).as()}; } SolutionRepository::SolutionRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index dd123f2..1c4da18 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -29,9 +29,9 @@ std::vector TaskRepository::getAllTasks() { nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector tasks; - std::tuple row; + std::tuple row; while (stream >> row) { - tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row)); + tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); } stream.complete(); manager->freeConnection(c); @@ -44,9 +44,9 @@ std::vector TaskRepository::getAllTasks() { void TaskRepository::updateTask(const Task &task) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s';") % - task.getDescription() % task.getTreshhold()) - .str(); + std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % + task.getDescription() % task.getTreshhold() % task.getName()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -58,10 +58,10 @@ void TaskRepository::updateTask(const Task &task) { size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO tasks (description, treshold) " - "VALUES ('%s', '%s') RETURNING id; ") % - task.getDescription() % task.getTreshhold()) - .str(); + std::string sql = (boost::format("INSERT INTO tasks (description, treshold, name) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + task.getDescription() % task.getTreshhold() % task.getName()) + .str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -88,8 +88,10 @@ void TaskRepository::deleteTaskById(size_t task_id) { } Task TaskRepository::makeTask(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), c.at(c.column_number("description")).as(), - c.at(c.column_number("treshold")).as()}; + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("description")).as(), + c.at(c.column_number("treshold")).as(), + c.at(c.column_number("name")).as()}; } TaskRepository::TaskRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 397b516..72bda42 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -8,7 +8,7 @@ #include "Solution.hpp" class ISolutionRepository { - public: +public: virtual ~ISolutionRepository() = default; virtual std::optional getSolutionById(size_t id) = 0; @@ -19,6 +19,10 @@ class ISolutionRepository { virtual std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) = 0; + virtual std::vector getSolutionsByTaskIdAndLanguage( + size_t, std::string) = 0; + + virtual size_t storeSolution(Solution solution) = 0; virtual void updateSolution(Solution solution) = 0; -- GitLab From 2a508fdca0b4296057233697666101e74d9b8591 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 19 May 2023 20:08:00 +0300 Subject: [PATCH 103/134] delete legacy code, make format and add new logic to service --- docker-compose.yml | 2 +- server/internal/entities/include/Solution.hpp | 16 +++--- server/internal/entities/include/Task.hpp | 3 +- server/internal/entities/src/Solution.cpp | 23 +++------ server/internal/entities/src/Task.cpp | 19 +++---- .../httpServer/include/TmpSolutionService.h | 26 ---------- .../httpServer/include/TmpTaskService.h | 40 --------------- .../httpServer/include/TmpUserService.h | 35 ------------- .../httpServer/src/SolutionManager.cpp | 4 +- .../internal/httpServer/src/TaskManager.cpp | 4 +- .../internal/httpServer/src/UserManager.cpp | 3 +- .../internal/metrics/src/TokenMetricImpl.cpp | 3 +- .../metrics/tests/src/token_metrics_tests.cpp | 8 +-- .../repository/include/SolutionRepository.hpp | 7 ++- .../repository/src/SolutionRepository.cpp | 51 +++++++++++-------- .../repository/src/TaskRepository.cpp | 10 ++-- .../virtual/ISolutionRepository.hpp | 6 +-- server/internal/service/include/Exeptions.h | 9 ---- server/internal/service/include/TaskService.h | 2 +- .../internal/service/src/SolutionService.cpp | 15 +++--- server/internal/service/src/TaskService.cpp | 4 +- .../service/tests/SolutionServiceTest.cpp | 27 ++++++---- .../service/tests/TaskServiceTest.cpp | 10 ++-- .../internal/service/virtual/ITaskService.h | 3 +- 24 files changed, 104 insertions(+), 226 deletions(-) delete mode 100644 server/internal/httpServer/include/TmpSolutionService.h delete mode 100644 server/internal/httpServer/include/TmpTaskService.h delete mode 100644 server/internal/httpServer/include/TmpUserService.h delete mode 100644 server/internal/service/include/Exeptions.h diff --git a/docker-compose.yml b/docker-compose.yml index 77be625..e101d36 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: networks: - db-network server: - image: kodkio/cpp_app:latest # use raiden454/cpp_app:latest + image: raiden454/cpp-app:latest networks: - db-network env_file: diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 2d4e1d8..9a0b49e 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -6,16 +6,12 @@ #include class Solution { -public: - Solution(size_t id, std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution, std::string language) noexcept; + public: + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; - Solution(std::string sendDate, size_t senderId, std::string source, - size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution, std::string language) noexcept; + Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; Solution() noexcept; @@ -63,7 +59,7 @@ public: bool operator!=(const Solution &rhs) const noexcept; -private: + private: size_t id; std::string send_date; size_t sender_id; diff --git a/server/internal/entities/include/Task.hpp b/server/internal/entities/include/Task.hpp index 991e029..d34ffe1 100644 --- a/server/internal/entities/include/Task.hpp +++ b/server/internal/entities/include/Task.hpp @@ -10,8 +10,7 @@ class Task { std::string name; public: - Task(size_t id, std::string description_, - float treshold_, std::string name) noexcept; + Task(size_t id, std::string description_, float treshold_, std::string name) noexcept; Task(std::string description_, float treshold_, std::string name) noexcept; diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 320907e..0dfebf1 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -4,10 +4,9 @@ #include #include -Solution::Solution(size_t id, std::string sendDate, size_t senderId, - std::string source, size_t taskId, - std::string result, std::string tokens, - std::string astTree, size_t orig_solution, std::string language_) noexcept +Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, + std::string result, std::string tokens, std::string astTree, size_t orig_solution, + std::string language_) noexcept : id(id), send_date(std::move(sendDate)), sender_id(senderId), @@ -17,12 +16,10 @@ Solution::Solution(size_t id, std::string sendDate, size_t senderId, task_id(taskId), result(std::move(result)), orig_solution(orig_solution), - language(std::move(language_)){} + language(std::move(language_)) {} -Solution::Solution(std::string sendDate, size_t senderId, std::string source, - size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution, std::string language_) noexcept +Solution::Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept : id(0), send_date(std::move(sendDate)), sender_id(senderId), @@ -76,10 +73,6 @@ void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSoluti Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} -const std::string &Solution::getLanguage() const { - return language; -} +const std::string &Solution::getLanguage() const { return language; } -void Solution::setLanguage(const std::string &language_) { - Solution::language = language_; -} +void Solution::setLanguage(const std::string &language_) { Solution::language = language_; } diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index 4b14564..c0c3586 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -4,15 +4,12 @@ #include Task::Task(std::string description_, float treshold_, std::string name_) noexcept - : id(0), description(std::move(description_)), - treshhold(treshold_), name(std::move(name_)) {} + : id(0), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} -Task::Task(size_t id, std::string description_, - float treshold_, std::string name_) noexcept - : id(id), description(std::move(description_)), - treshhold(treshold_), name(std::move(name_)) {} +Task::Task(size_t id, std::string description_, float treshold_, std::string name_) noexcept + : id(id), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} -Task::Task() noexcept: id(0), treshhold(0) {} +Task::Task() noexcept : id(0), treshhold(0) {} unsigned long Task::getId() const noexcept { return id; } @@ -30,10 +27,6 @@ float Task::getTreshhold() const noexcept { return treshhold; } void Task::setTreshhold(float treshhold_) noexcept { Task::treshhold = treshhold_; } -const std::string &Task::getName() const { - return name; -} +const std::string &Task::getName() const { return name; } -void Task::setName(const std::string &name_) { - Task::name = name_; -} +void Task::setName(const std::string &name_) { Task::name = name_; } diff --git a/server/internal/httpServer/include/TmpSolutionService.h b/server/internal/httpServer/include/TmpSolutionService.h deleted file mode 100644 index 26761c0..0000000 --- a/server/internal/httpServer/include/TmpSolutionService.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -#include "Solution.hpp" - -class TmpSolutionService { - public: - static Solution createSolution(std::size_t user_id, std::size_t task_id, std::string source) { - count++; - Solution sol(count, "", user_id, source, task_id, "ok", "", "", 1); - for (auto& i : solutions) { - if (i.getSource() == source && i.getTaskId() == task_id && i.getSenderId() != user_id) - sol.setResult("plagiat"); - } - solutions.push_back(sol); - return sol; - } - - static std::size_t count; - static std::vector solutions; -}; - -std::vector TmpSolutionService::solutions = {}; -std::size_t TmpSolutionService::count = 3; diff --git a/server/internal/httpServer/include/TmpTaskService.h b/server/internal/httpServer/include/TmpTaskService.h deleted file mode 100644 index 9740a2d..0000000 --- a/server/internal/httpServer/include/TmpTaskService.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include - -#include "Task.hpp" - -class TmpTaskService { - public: - static void createTask(std::string description) { - count++; - Task task(count, description, 0.5); - tasks.push_back(task); - } - - static std::vector getAllTasks() { return tasks; } - - static std::size_t count; - static std::vector tasks; -}; - -std::vector TmpTaskService::tasks = {Task(1, - "1 description 1\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "14\n", - 0.5), - Task(2, "2 description", 0.5), Task(3, "3 description", 0.5)}; -std::size_t TmpTaskService::count = 3; \ No newline at end of file diff --git a/server/internal/httpServer/include/TmpUserService.h b/server/internal/httpServer/include/TmpUserService.h deleted file mode 100644 index 65cda81..0000000 --- a/server/internal/httpServer/include/TmpUserService.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include - -#include "User.hpp" - -class TmpUserService { - public: - static std::pair login(std::string_view login, std::string_view password) { - bool found = false; - User user; - for (const auto& i : tasks) { - if (i.getPassword() == password && i.getLogin() == login && !found) { - user = i; - found = true; - } - } - return {user, found}; - } - - static User registerUser(std::string login, std::string password, std::string username) { - count++; - User user(count, login, password, username); - std::cout << user << std::endl; - tasks.push_back(user); - return user; - } - - static std::size_t count; - static std::vector tasks; -}; - -std::vector TmpUserService::tasks = {}; -std::size_t TmpUserService::count = 0; diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 9e08d63..6174c7e 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -7,7 +7,6 @@ #include #include "SolutionService.h" -#include "TmpSolutionService.h" #include "Utils.h" SolutionManager::SolutionManager() @@ -39,8 +38,7 @@ http::message_generator SolutionManager::getAllSolutions(http::requestdeserialTaskData(req.body()); std::vector solutions; - // solutions = solutionService->getSolutionsByUserAndTaskId(user_id, task_id); - http::response res{http::status::ok, req.version()}; + http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index c56a962..9f8f579 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -4,7 +4,6 @@ #include "TaskManager.h" #include "TaskService.h" -#include "TmpTaskService.h" #include "Utils.h" TaskManager::TaskManager() : serializer(std::make_shared()), taskService(std::make_shared()) {} @@ -14,8 +13,7 @@ void TaskManager::setService(std::shared_ptr service) { taskServic http::message_generator TaskManager::createTask(http::request &&req) { try { std::string description = serializer->deserialNewTaskData(req.body()); - taskService->createTask(description, 0.5); - // TmpTaskService::createTask(description); + taskService->createTask(description); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/src/UserManager.cpp b/server/internal/httpServer/src/UserManager.cpp index b9e68e3..ed55c41 100644 --- a/server/internal/httpServer/src/UserManager.cpp +++ b/server/internal/httpServer/src/UserManager.cpp @@ -1,6 +1,5 @@ #include "UserManager.h" -#include "TmpUserService.h" #include "ServiceExceptions.h" #include "Utils.h" @@ -64,7 +63,7 @@ http::message_generator UserManager::registerUser(http::requestserialUserData(user); res.prepare_payload(); return res; - } catch (const ValidateException& e) { + } catch (const ValidateException &e) { http::response res{http::status::forbidden, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 980cacf..6277387 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -36,8 +36,7 @@ double WShinglingTokenMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); - if (n < 3 || m < 3) - return 0; + if (n < 3 || m < 3) return 0; std::vector> sh1; std::vector> sh2; diff --git a/server/internal/metrics/tests/src/token_metrics_tests.cpp b/server/internal/metrics/tests/src/token_metrics_tests.cpp index 77a1e69..8125295 100644 --- a/server/internal/metrics/tests/src/token_metrics_tests.cpp +++ b/server/internal/metrics/tests/src/token_metrics_tests.cpp @@ -87,10 +87,10 @@ TEST_F(WShinglingTokenMetricTest, test_with_small_prog) { } TEST_F(WShinglingTokenMetricTest, test_with_big_size) { - std::vector tokens = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, - 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, - 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, 90, - 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; + std::vector tokens = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, + 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, + 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, + 90, 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; wShinglingTokenMetric->setData(tokens, tokens); diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 7daeeb3..04f5ae8 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class SolutionRepository : public ISolutionRepository { -public: + public: SolutionRepository(); std::optional getSolutionById(size_t id) override; @@ -24,8 +24,7 @@ public: std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) override; - std::vector getSolutionsByTaskIdAndLanguage( - size_t task_id, std::string lang) override; + std::vector getSolutionsByTaskIdAndLanguage(size_t task_id, std::string lang) override; size_t storeSolution(Solution solution) override; @@ -37,7 +36,7 @@ public: std::optional getOriginalSolution(size_t id) override; -private: + private: static Solution makeSolution(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index cbff3f1..44b3b0b 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -29,7 +29,9 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), get<6>(row), get<7>(row), get<8>(row), get<9>(row)); @@ -49,7 +51,9 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), get<6>(row), get<7>(row), get<8>(row), get<9>(row)); @@ -66,12 +70,14 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t try { auto c = manager->connection(); std::string sql = - (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) - .str(); + (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), get<6>(row), get<7>(row), get<8>(row), get<9>(row)); @@ -88,12 +94,13 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t try { auto c = manager->connection(); std::string sql = - (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND language='%s'") % task_id % lang) - .str(); + (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND language='%s'") % task_id % lang).str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), get<6>(row), get<7>(row), get<8>(row), get<9>(row)); @@ -106,7 +113,6 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t } } - std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); @@ -126,12 +132,13 @@ size_t SolutionRepository::storeSolution(Solution solution) { auto c = manager->connection(); std::string sql = - (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " - "astTree, original_solution_id, language) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % solution.getAstTree() % - solution.getOrigSolution() % solution.getLanguage()).str(); + (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " + "astTree, original_solution_id, language) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution() % + solution.getLanguage()) + .str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -146,13 +153,13 @@ void SolutionRepository::updateSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = - (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," - " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " - "original_solution_id = '%s', language = '%s';") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % solution.getAstTree() % - solution.getOrigSolution() % solution.getLanguage()).str(); + std::string sql = (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " + "original_solution_id = '%s', language = '%s';") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % + solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree() % + solution.getOrigSolution() % solution.getLanguage()) + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 1c4da18..813f009 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -46,7 +46,7 @@ void TaskRepository::updateTask(const Task &task) { auto c = manager->connection(); std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % task.getDescription() % task.getTreshhold() % task.getName()) - .str(); + .str(); work w(*c); w.exec(sql); manager->freeConnection(c); @@ -61,7 +61,7 @@ size_t TaskRepository::storeTask(Task task) { std::string sql = (boost::format("INSERT INTO tasks (description, treshold, name) " "VALUES ('%s', '%s', '%s') RETURNING id; ") % task.getDescription() % task.getTreshhold() % task.getName()) - .str(); + .str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -88,10 +88,8 @@ void TaskRepository::deleteTaskById(size_t task_id) { } Task TaskRepository::makeTask(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("description")).as(), - c.at(c.column_number("treshold")).as(), - c.at(c.column_number("name")).as()}; + return {c.at(c.column_number("id")).as(), c.at(c.column_number("description")).as(), + c.at(c.column_number("treshold")).as(), c.at(c.column_number("name")).as()}; } TaskRepository::TaskRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/virtual/ISolutionRepository.hpp b/server/internal/repository/virtual/ISolutionRepository.hpp index 72bda42..3122a2e 100644 --- a/server/internal/repository/virtual/ISolutionRepository.hpp +++ b/server/internal/repository/virtual/ISolutionRepository.hpp @@ -8,7 +8,7 @@ #include "Solution.hpp" class ISolutionRepository { -public: + public: virtual ~ISolutionRepository() = default; virtual std::optional getSolutionById(size_t id) = 0; @@ -19,9 +19,7 @@ public: virtual std::vector getSolutionsByTaskIdAndSenderId(size_t, size_t) = 0; - virtual std::vector getSolutionsByTaskIdAndLanguage( - size_t, std::string) = 0; - + virtual std::vector getSolutionsByTaskIdAndLanguage(size_t, std::string) = 0; virtual size_t storeSolution(Solution solution) = 0; diff --git a/server/internal/service/include/Exeptions.h b/server/internal/service/include/Exeptions.h deleted file mode 100644 index d0c4c5e..0000000 --- a/server/internal/service/include/Exeptions.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -class ValidateExeption : public std::exception { - std::string _msg; - - public: - ValidateExeption(const std::string& msg) : _msg(msg) {} - virtual const char* what() const noexcept override { return _msg.c_str(); } -}; \ No newline at end of file diff --git a/server/internal/service/include/TaskService.h b/server/internal/service/include/TaskService.h index e8867d3..c8a8881 100644 --- a/server/internal/service/include/TaskService.h +++ b/server/internal/service/include/TaskService.h @@ -12,7 +12,7 @@ class TaskService : public ITaskService { public: explicit TaskService(std::unique_ptr taskRepo); TaskService(); - Task createTask(const std::string& desc, float treshold = 0.5f) override; + Task createTask(const std::string& desc, const std::string& name = "Default name", float treshold = 0.5f) override; Task getTask(size_t id) override; std::vector getAllTasks() override; void deleteTask(size_t id) override; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index b48e53f..1a1b3d2 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -8,10 +8,10 @@ #include "FileMethods.h" #include "MyCppAntlr.h" #include "PythonAntlr.h" +#include "ServiceExceptions.h" #include "ServiceUtils.h" #include "SolutionRepository.hpp" #include "TaskRepository.hpp" -#include "ServiceExceptions.h" const std::string PLAGIAT_VERDICT = "Не, ну вы не палитесь. Плагиат."; const std::string NOT_PLAGIAT_VERDICT = "Красивое решение. А главное уникальное !"; @@ -57,7 +57,7 @@ std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBas std::pair SolutionService::getMaxTextResMetric(std::vector& solutions, const std::string& filedata, size_t userId, float treshold) { - std::pair maxMatch = std::make_pair(0.0, 1); + std::pair maxMatch = std::make_pair(0.0, 0); for (auto sol : solutions) { if (sol.getSenderId() == userId) { continue; @@ -85,7 +85,7 @@ std::pair SolutionService::getMaxTextResMetric(std::vector SolutionService::getMaxTokenResMetric(std::vector& solutions, std::vector& tokens, size_t userId, float treshold) { - std::pair maxMatch = std::make_pair(0.0, 1); + std::pair maxMatch = std::make_pair(0.0, 0); for (auto sol : solutions) { if (sol.getSenderId() == userId) { @@ -116,6 +116,7 @@ std::pair SolutionService::getMaxTokenResMetric(std::vector fileExtension = FileMethods::checkFileExtension(filename); if (!fileExtension.second) { throw FileExtensionException("unknown file extension"); @@ -128,8 +129,9 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); float treshold = taskRepo->getTaskById(taskId).value().getTreshhold(); + std::cout << "OK" << std::endl; - std::vector solutions = solutionRepo->getSolutionsByTaskId(taskId); + std::vector solutions = solutionRepo->getSolutionsByTaskIdAndLanguage(taskId, fileExtension.first); std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, userId, treshold); std::pair tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, userId, treshold); @@ -144,8 +146,9 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, plagiatSolId, treshold); - Solution sol = Solution(std::ctime(&now), userId, filedata, taskId, result, - Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatSolId); + Solution sol = + Solution(std::ctime(&now), userId, filedata, taskId, result, Utils::convertIntArrayIntoString(tokensTypes), + astTree, plagiatSolId, fileExtension.first); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); diff --git a/server/internal/service/src/TaskService.cpp b/server/internal/service/src/TaskService.cpp index 1e06979..873b668 100644 --- a/server/internal/service/src/TaskService.cpp +++ b/server/internal/service/src/TaskService.cpp @@ -6,9 +6,9 @@ TaskService::TaskService(std::unique_ptr taskRepo) : taskRepo(s TaskService::TaskService() { taskRepo = std::make_unique(); } -Task TaskService::createTask(const std::string& desc, float treshold) { +Task TaskService::createTask(const std::string& desc, const std::string& name, float treshold) { try { - Task task = Task(desc, treshold); + Task task = Task(desc, treshold, name); size_t id = taskRepo->storeTask(task); task.setId(id); return task; diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index af21a7b..e8f9130 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -27,6 +27,7 @@ class SolutionRepositoryMock : public ISolutionRepository { MOCK_METHOD(void, deleteSolution, (Solution solution), (override)); MOCK_METHOD(std::optional, getOriginalSolution, (size_t id), (override)); MOCK_METHOD(std::vector, getSolutionsByTaskIdAndSenderId, (size_t user_id, size_t task_id), (override)); + MOCK_METHOD(std::vector, getSolutionsByTaskIdAndLanguage, (size_t, std::string), (override)); }; class TaskRepositoryMock : public ITaskRepository { @@ -70,7 +71,7 @@ TEST_F(SolutionServiceTest, deleteSolutionException) { TEST_F(SolutionServiceTest, getMetrics) { EXPECT_CALL(*solutionMockPtr, getSolutionById(1)) .Times(1) - .WillOnce(::testing::Return(Solution(1, "", 1, "", 1, "", "tokens", "astTree", 1))); + .WillOnce(::testing::Return(Solution(1, "", 1, "", 1, "", "tokens", "astTree", 1, "cpp"))); std::pair metrics = ss->getMetrics(1); EXPECT_EQ(metrics.first, "tokens"); EXPECT_EQ(metrics.second, "astTree"); @@ -82,20 +83,23 @@ TEST_F(SolutionServiceTest, getMetricsException) { } TEST_F(SolutionServiceTest, createSolutionPlagiat) { - EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1, "cpp"))) .Times(1) .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); - EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); + solutions.push_back( + Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1, "cpp")); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskIdAndLanguage(1, "cpp")) + .Times(1) + .WillOnce(::testing::Return(solutions)); - EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); + EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f, "name"))); EXPECT_CALL(*solutionMockPtr, getSolutionById(0)) .Times(1) .WillOnce(::testing::Return(std::make_optional( - Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)))); + Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1, "cpp")))); Solution sol = ss->createSolution(2, 1, "main.cpp", "size_t main(){return 1;}"); EXPECT_EQ(sol.getId(), 1); @@ -106,15 +110,18 @@ TEST_F(SolutionServiceTest, createSolutionPlagiat) { } TEST_F(SolutionServiceTest, createSolutionNonPlagiat) { - EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1))) + EXPECT_CALL(*solutionMockPtr, storeSolution(Solution(0, "", 2, "source", 1, "", "", "", 1, "cpp"))) .Times(1) .WillRepeatedly(::testing::Return(1)); std::vector solutions; - solutions.push_back(Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1)); - EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskId(1)).Times(1).WillOnce(::testing::Return(solutions)); + solutions.push_back( + Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1, "cpp")); + EXPECT_CALL(*solutionMockPtr, getSolutionsByTaskIdAndLanguage(1, "cpp")) + .Times(1) + .WillOnce(::testing::Return(solutions)); - EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f))); + EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f, "name"))); Solution sol = ss->createSolution(1, 1, "main.cpp", "int main(){return 0;}"); EXPECT_EQ(sol.getResult(), diff --git a/server/internal/service/tests/TaskServiceTest.cpp b/server/internal/service/tests/TaskServiceTest.cpp index d38eb3e..821e701 100644 --- a/server/internal/service/tests/TaskServiceTest.cpp +++ b/server/internal/service/tests/TaskServiceTest.cpp @@ -47,7 +47,7 @@ TEST_F(TaskServiceTest, deleteTasWithInvalidId) { } TEST_F(TaskServiceTest, GetTaskByIdOK) { - EXPECT_CALL(*mock_ptr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.7f))); + EXPECT_CALL(*mock_ptr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.7f, "name"))); Task t = ts->getTask(1); EXPECT_EQ(t.getId(), 1); EXPECT_EQ(t.getDescription(), "desription"); @@ -59,13 +59,13 @@ TEST_F(TaskServiceTest, GetTaskByIdEXEPTION) { } TEST_F(TaskServiceTest, CreateTask) { - EXPECT_CALL(*mock_ptr, storeTask(Task("desc", 0.5f))).Times(1).WillOnce(::testing::Return(1)); - Task t = ts->createTask("desc", 0.5f); + EXPECT_CALL(*mock_ptr, storeTask(Task("desc", 0.5f, "name"))).Times(1).WillOnce(::testing::Return(1)); + Task t = ts->createTask("desc"); EXPECT_EQ(t.getId(), 1); EXPECT_EQ(t.getDescription(), "desc"); - EXPECT_CALL(*mock_ptr, storeTask(Task("desc2", 0.8f))).Times(1).WillOnce(::testing::Return(2)); - t = ts->createTask("desc2", 0.8f); + EXPECT_CALL(*mock_ptr, storeTask(Task("desc2", 0.8f, "name"))).Times(1).WillOnce(::testing::Return(2)); + t = ts->createTask("desc2"); EXPECT_EQ(t.getId(), 2); EXPECT_EQ(t.getDescription(), "desc2"); } diff --git a/server/internal/service/virtual/ITaskService.h b/server/internal/service/virtual/ITaskService.h index 54bb278..54bbb67 100644 --- a/server/internal/service/virtual/ITaskService.h +++ b/server/internal/service/virtual/ITaskService.h @@ -6,7 +6,8 @@ class ITaskService { public: virtual ~ITaskService() = default; - virtual Task createTask(const std::string& desc, float treshold) = 0; + virtual Task createTask(const std::string& desc, const std::string& name = "Default name", + float treshold = 0.5f) = 0; virtual Task getTask(size_t id) = 0; virtual std::vector getAllTasks() = 0; virtual void deleteTask(size_t id) = 0; -- GitLab From 9186486e2668094bf89520a72fc1520d12ea2a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 20 May 2023 09:16:28 +0300 Subject: [PATCH 104/134] fix error on client if database in empty --- client/internal/gui/src/AddTaskDialog.cpp | 1 - client/internal/gui/src/TasksWindow.cpp | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/internal/gui/src/AddTaskDialog.cpp b/client/internal/gui/src/AddTaskDialog.cpp index 3fefa31..4955001 100644 --- a/client/internal/gui/src/AddTaskDialog.cpp +++ b/client/internal/gui/src/AddTaskDialog.cpp @@ -7,7 +7,6 @@ AddTaskDialog::AddTaskDialog(QWidget *parent) : QDialog(parent) { setupUi(this); - connect(createButton, &QPushButton::clicked, this, &AddTaskDialog::on_createButton_clicked); connect(backButton, &QPushButton::clicked, this, &AddTaskDialog::on_backButton_clicked); } diff --git a/client/internal/gui/src/TasksWindow.cpp b/client/internal/gui/src/TasksWindow.cpp index 04cebc7..05e6fea 100644 --- a/client/internal/gui/src/TasksWindow.cpp +++ b/client/internal/gui/src/TasksWindow.cpp @@ -45,13 +45,17 @@ void TasksWindow::setupUi(QMainWindow *UserWindow) { for (int i = 0; i < tasks_vector.size(); i++) { tasks->insertItem(i, QString::number(tasks_vector[i].id)); } + + if (tasks_vector.empty()) { + tasks->insertItem(0, QString::fromUtf8("Пока заданий нет")); + } tasks->setCurrentIndex(0); taskVerticalLayout->addWidget(label); taskVerticalLayout->addWidget(tasks); taskDescription = new QLabel(this); - std::string description = tasks_vector[0].description; + std::string description = tasks_vector.empty() ? "" : tasks_vector[0].description; taskDescription->setText(QString(description.c_str())); buttonsWidget = new QWidget(centralwidget); @@ -63,6 +67,9 @@ void TasksWindow::setupUi(QMainWindow *UserWindow) { goToTaskButton = new QPushButton(this); goToTaskButton->setText(QString::fromUtf8("Перейти к сдаче")); + if (tasks_vector.empty()) + goToTaskButton->setDisabled(true); + addTaskButton = new QPushButton(this); addTaskButton->setText(QString::fromUtf8("Добавить задание")); @@ -114,4 +121,6 @@ void TasksWindow::updateTasks() { std::string description = tasks_vector[0].description; taskDescription->setText(QString(description.c_str())); + + goToTaskButton->setDisabled(false); } -- GitLab From 834e5f07430f5bc92042e46f895474414c0c6283 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 20 May 2023 12:47:55 +0300 Subject: [PATCH 105/134] add multithreading metrics call --- .../internal/service/src/SolutionService.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 1a1b3d2..bf63eac 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "FileMethods.h" #include "MyCppAntlr.h" @@ -57,6 +58,7 @@ std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBas std::pair SolutionService::getMaxTextResMetric(std::vector& solutions, const std::string& filedata, size_t userId, float treshold) { + // std::cout << "getMaxTextResMetric start" << std::endl; std::pair maxMatch = std::make_pair(0.0, 0); for (auto sol : solutions) { if (sol.getSenderId() == userId) { @@ -79,6 +81,7 @@ std::pair SolutionService::getMaxTextResMetric(std::vector SolutionService::getMaxTokenResMetric(std::vector& tokens, size_t userId, float treshold) { std::pair maxMatch = std::make_pair(0.0, 0); - + // std::cout << "getMaxTokenResMetric start" << std::endl; for (auto sol : solutions) { if (sol.getSenderId() == userId) { continue; @@ -110,13 +113,13 @@ std::pair SolutionService::getMaxTokenResMetric(std::vector fileExtension = FileMethods::checkFileExtension(filename); if (!fileExtension.second) { throw FileExtensionException("unknown file extension"); @@ -129,12 +132,20 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); float treshold = taskRepo->getTaskById(taskId).value().getTreshhold(); - std::cout << "OK" << std::endl; std::vector solutions = solutionRepo->getSolutionsByTaskIdAndLanguage(taskId, fileExtension.first); - std::pair textBasedRes = getMaxTextResMetric(solutions, filedata, userId, treshold); - std::pair tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, userId, treshold); + std::pair textBasedRes; + std::pair tokenBasedRes; + + std::thread t1([&textBasedRes, this, &solutions, &filedata, &userId, &treshold]() { + textBasedRes = getMaxTextResMetric(solutions, filedata, userId, treshold); + }); + std::thread t2([&tokenBasedRes, this, &solutions, &tokensTypes, &userId, &treshold]() { + tokenBasedRes = getMaxTokenResMetric(solutions, tokensTypes, userId, treshold); + }); + t1.join(); + t2.join(); size_t plagiatSolId = 1; if (textBasedRes.first > tokenBasedRes.first) { @@ -142,7 +153,6 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std } else { plagiatSolId = tokenBasedRes.second; } - std::cout << plagiatSolId << std::endl; std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, plagiatSolId, treshold); -- GitLab From 6022f652901d60a3a929829a897fde11671a6af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 20 May 2023 18:49:35 +0300 Subject: [PATCH 106/134] some fixes on client --- client/internal/gui/include/SolutionsWindow.h | 3 ++- client/internal/gui/include/TasksWindow.h | 3 ++- client/internal/gui/src/SolutionsWindow.cpp | 7 ++++++- client/internal/gui/src/TasksWindow.cpp | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/internal/gui/include/SolutionsWindow.h b/client/internal/gui/include/SolutionsWindow.h index 80544e5..3107c18 100644 --- a/client/internal/gui/include/SolutionsWindow.h +++ b/client/internal/gui/include/SolutionsWindow.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "Task.h" #include "TasksWindow.h" @@ -36,7 +37,7 @@ private: QPushButton* chooseFileButton = nullptr; QLabel* filename = nullptr; QPushButton* sendButton = nullptr; - QLabel* result = nullptr; + QTextEdit* result = nullptr; QPushButton* backButton = nullptr; void setupUi(QMainWindow *UserWindow); diff --git a/client/internal/gui/include/TasksWindow.h b/client/internal/gui/include/TasksWindow.h index 1a897fd..3ba92af 100644 --- a/client/internal/gui/include/TasksWindow.h +++ b/client/internal/gui/include/TasksWindow.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "Task.h" class TasksWindow : public QMainWindow { @@ -32,7 +33,7 @@ private: QVBoxLayout* taskVerticalLayout = nullptr; QLabel* label = nullptr; QComboBox* tasks = nullptr; - QLabel* taskDescription = nullptr; + QTextEdit* taskDescription = nullptr; QPushButton* goToTaskButton = nullptr; QPushButton* addTaskButton = nullptr; QPushButton* backButton = nullptr; diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index 854f5ff..af3d1f4 100644 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -42,7 +42,8 @@ void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { sendButton = new QPushButton(this); sendButton->setText(QString::fromUtf8("Отправить")); - result = new QLabel(this); + result = new QTextEdit(this); + result->setReadOnly(true); result->setText(QString::fromUtf8("Отправьте для принятия решения")); backButton = new QPushButton(this); @@ -70,6 +71,10 @@ void SolutionsWindow::on_chooseFileButton_clicked() { } void SolutionsWindow::on_sendButton_clicked() { + if (path_to_file.empty()) { + QMessageBox::warning(this, "Ошибка отправки", "Файл должен быть указан"); + return; + } Solution sol = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); result->setText(QString::fromStdString(sol.result)); } diff --git a/client/internal/gui/src/TasksWindow.cpp b/client/internal/gui/src/TasksWindow.cpp index 05e6fea..3f14654 100644 --- a/client/internal/gui/src/TasksWindow.cpp +++ b/client/internal/gui/src/TasksWindow.cpp @@ -54,7 +54,8 @@ void TasksWindow::setupUi(QMainWindow *UserWindow) { taskVerticalLayout->addWidget(label); taskVerticalLayout->addWidget(tasks); - taskDescription = new QLabel(this); + taskDescription = new QTextEdit(this); + taskDescription->setReadOnly(true); std::string description = tasks_vector.empty() ? "" : tasks_vector[0].description; taskDescription->setText(QString(description.c_str())); -- GitLab From 367e2fa0c93c6ff0a117d51007639f04b2536f85 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Sat, 20 May 2023 18:57:58 +0300 Subject: [PATCH 107/134] new test codes --- server/cmd/main.cpp | 44 +++++++++---- .../internal/metrics/src/TokenMetricImpl.cpp | 6 +- .../internal/metrics/testProgs/cpp/code1.txt | 56 +++++++++------- .../internal/metrics/testProgs/cpp/code2.txt | 65 ++++++++++++------- .../internal/metrics/testProgs/cpp/code3.txt | 65 +++++++++++++++++++ .../internal/metrics/testProgs/cpp/code4.txt | 45 +++++++++++++ .../metrics/testProgs/python/pycode2.txt | 5 ++ .../metrics/testProgs/python/pycode3.txt | 19 ++++++ .../metrics/testProgs/python/pycode4.txt | 22 +++++++ 9 files changed, 264 insertions(+), 63 deletions(-) create mode 100644 server/internal/metrics/testProgs/cpp/code3.txt create mode 100644 server/internal/metrics/testProgs/cpp/code4.txt create mode 100644 server/internal/metrics/testProgs/python/pycode3.txt create mode 100644 server/internal/metrics/testProgs/python/pycode4.txt diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 0e2da95..9b3fc04 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -3,14 +3,39 @@ #include "PythonAntlr.h" #include "MyCppAntlr.h" #include "TokenMetricLib.h" +#include "TextMetricsLib.h" int main(int argc, const char* argv[]) { // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); std::ifstream fin1("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin2("internal/metrics/testProgs/cpp/code2.txt"); + std::ifstream fin2("internal/metrics/testProgs/cpp/code4.txt"); - MyCppAntlr cppA1 = MyCppAntlr(fin1); - MyCppAntlr cppA2 = MyCppAntlr(fin2); + + std::string text1( (std::istreambuf_iterator(fin1) ), + (std::istreambuf_iterator() ) ); + + std::string text2( (std::istreambuf_iterator(fin2) ), + (std::istreambuf_iterator() ) ); + + LevDistTextMetric livDistTextMetric; + JaccardTextMetric jaccardTextMetric; + + livDistTextMetric.setData(text1, text2); + jaccardTextMetric.setData(text1, text2); + + std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric() << std::endl; + + fin1.close(); + fin2.close(); + + std::ifstream fin3("internal/metrics/testProgs/cpp/code1.txt"); + std::ifstream fin4("internal/metrics/testProgs/cpp/code4.txt"); + + MyCppAntlr cppA1 = MyCppAntlr(fin3); + MyCppAntlr cppA2 = MyCppAntlr(fin4); + + //PythonAntlr pyA1 = PythonAntlr(fin3); + //PythonAntlr pyA2 = PythonAntlr(fin4); std::vector tokens1 = cppA1.getTokensTypes(); std::vector tokens2 = cppA2.getTokensTypes(); @@ -33,16 +58,7 @@ int main(int argc, const char* argv[]) { std::cout << std::endl; std::cout << lev.getMetric() << std::endl << wsh.getMetric() << std::endl; - - fin1.close(); - fin2.close(); - - std::vector tokens3 = {9, 45, 132, 85, 86, 89, 78, 45, 132, 128, 45, 132, 101, 1, - 128, 132, 127, 132, 103, 103, 132, 128, 84, 85, 132, 115, 1, 86, - 89, 43, 85, 132, 97, 1, 86, 132, 120, 128, 132, 113, 1, 128, 90, - 132, 127, 132, 102, 102, 132, 128, 59, 1, 128, 90, -1}; - - wsh.setData(tokens3, tokens3); - std::cout << wsh.getMetric() << std::endl; + fin3.close(); + fin4.close(); return 0; } \ No newline at end of file diff --git a/server/internal/metrics/src/TokenMetricImpl.cpp b/server/internal/metrics/src/TokenMetricImpl.cpp index 5c92a85..42e0d44 100644 --- a/server/internal/metrics/src/TokenMetricImpl.cpp +++ b/server/internal/metrics/src/TokenMetricImpl.cpp @@ -38,7 +38,7 @@ double WShinglingTokenMetric::getMetric() { unsigned long n = tokens1.size(); unsigned long m = tokens2.size(); - if (n == 0 || m == 0 || (n < 3 || m < 3)) + if (n < 3 || m < 3) return 0; std::vector > sh1; @@ -74,6 +74,6 @@ double WShinglingTokenMetric::getMetric() { } void PrepareDataTokenMetric::setData(std::vector _tokens1, std::vector _tokens2) { - tokens1 = _tokens1; - tokens2 = _tokens2; + tokens1 = std::move(_tokens1); + tokens2 = std::move(_tokens2); } diff --git a/server/internal/metrics/testProgs/cpp/code1.txt b/server/internal/metrics/testProgs/cpp/code1.txt index 5fa95b8..24c4633 100644 --- a/server/internal/metrics/testProgs/cpp/code1.txt +++ b/server/internal/metrics/testProgs/cpp/code1.txt @@ -1,29 +1,41 @@ -// однострочный комментарий -// еще один -// вау еще один - #include -#include -#include +#include using namespace std; -/* многострочный комм - * // внутри него однострочный - * - */ +bool check(vector s, int i, int j){ + for (int k = 0; k < s.size(); k++){ + if (s[k] != i && s[k] != j && s[k] % i == 0 && j % s[k] == 0){ + return 0; + } + } + return 1; +} +int main(){ + long long n; + cin >> n; + vector s; + for (int i = 1; i <= n; i++){ + if (n % i == 0){ + s.push_back(i); + } + } + vector > ans; + for (int i = 0; i < s.size(); i++){ + for (int j = i + 1; j < s.size(); j++){ + if (s[j] % s[i] == 0 && check(s, s[i], s[j])){ + ans.push_back({s[i], s[j]}); + } + } + } + cout << "graph {" << endl; + for (int i = 0; i < s.size(); i++){ + cout << s[i] << endl; + } -int main() { - stringstream ss; - string res; - // ещё в код напихаю комментов - ss << "a bwfw ce "; - while(getline(ss, res, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res << endl; /* многострочный однострочно */ + for (int i = 0; i < ans.size(); i++){ + cout << ans[i].first << "--" << ans[i].second << endl; } -} + cout << "}"; +} \ No newline at end of file diff --git a/server/internal/metrics/testProgs/cpp/code2.txt b/server/internal/metrics/testProgs/cpp/code2.txt index bd5977a..d387566 100644 --- a/server/internal/metrics/testProgs/cpp/code2.txt +++ b/server/internal/metrics/testProgs/cpp/code2.txt @@ -1,32 +1,49 @@ -// однострочный комментарий -// еще один - -// вау еще один - #include -#include -#include +#include using namespace std; -/* многострочный комм - * // внутри него однострочный - * - */ +bool check1(vector s, int i, int j){ + for (int k = 0; k < s.size(); k++){ + if (s[k] != i && s[k] != j && s[k] % i == 0 && j % s[k] == 0){ + return 0; + } + } + return 1; +} + +int main(){ + long long n1; + cin >> n1; + vector s2; + for (int k = 1; k <= n1; k++){ + if (n1 % k == 0){ + s2.push_back(k); + } + } + if (n % 2 == 0) { + n+=1; + n-=1; + } + + vector > ans; + for (int i = 0; i < s2.size(); i++){ + for (int j = i + 1; j < s2.size(); j++){ + if (s2[j] % s2[i] == 0 && check1(s2, s2[i], s2[j])){ + ans.push_back({s[i], s[j]}); + } + } + } + cout << "graph {"; + cout << '\n'; + for (int k = 0; k < s2.size(); k++){ + cout << s[k] << endl; + } -int main() { - stringstream ss1; - string res1; - // ещё в код напихаю комментов - ss1 << "a bwfw ce "; - cout << "mem"; - while(getline(ss, res1, ' ')){ //комментарий после строки с кодом - /* - * летс гоу - * худшее место для многострочного коммента - */ - cout << res1 << endl; /* многострочный однострочно */ - cout << "mem2" << endl; + for (int i = 0; i < ans.size(); i++){ + cout << ans[i].first << "--" << ans[i].second << endl; } + cout << "}"; + cout << '\n'; } \ No newline at end of file diff --git a/server/internal/metrics/testProgs/cpp/code3.txt b/server/internal/metrics/testProgs/cpp/code3.txt new file mode 100644 index 0000000..4ae8f50 --- /dev/null +++ b/server/internal/metrics/testProgs/cpp/code3.txt @@ -0,0 +1,65 @@ +#include +#include + +using namespace std; + +bool check1(vector s1, int i, int j){ + for (int k = 0; k < s1.size(); k++){ + if (s1[k] != i && s1[k] != j && s1[k] % i == 0 && j % s1[k] == 0){ + return 0; + } + } + if (i % 2 == 0) { + i+=1; + i-=1; + } + return 1; +} + +int main(){ + long long n1; + cin >> n1; + vector s2; + for (int k = 1; k <= n1; k++){ + if (n1 % k == 0){ + s2.push_back(k); + } + } + + if (n % 2 == 0) { + n+=1; + n-=1; + } + + vector > ans; + for (int i = 0; i < s2.size(); i++){ + if (n % 2 == 0) { + n+=1; + n-=1; + } + } + for (int j = i + 1; j < s2.size(); j++){ + if (s2[j] % s2[i] == 0 && check1(s2, s2[i], s2[j])){ + ans.push_back({s[i], s[j]}); + } + if (n % 2 == 0) { + n+=1; + n-=1; + } + } + } + cout << "graph {"; + cout << '\n'; + for (int k = 0; k < s2.size(); k++){ + cout << s[k] << endl; + } + if (n % 2 == 0) { + n+=1; + n-=1; + } + for (int i = 0; i < ans.size(); i++){ + cout << ans[i].first << "--" << ans[i].second << endl; + } + cout << "}"; + cout << '\n'; +} \ No newline at end of file diff --git a/server/internal/metrics/testProgs/cpp/code4.txt b/server/internal/metrics/testProgs/cpp/code4.txt new file mode 100644 index 0000000..844d2cd --- /dev/null +++ b/server/internal/metrics/testProgs/cpp/code4.txt @@ -0,0 +1,45 @@ +#include +#include +#include +#include +using namespace std; +const int inf = 1e9; + + +int main() { + int n, s, f; + cin >> n >> s >> f; + s--; f--; + vector d(n, inf), p(n); + vector u(n); + vector < vector > > g(n); + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { + int q; + scanf("%d", &q); + if (i > 0) { + + } + } + } + d[s] = 0; + for (int i = 0; i < n; ++i) { + int v = -1; + for (int j = 0; j < n; ++j) + if (!u[j] && (v == -1 || d[j] < d[v])) + v = j; + if (d[v] == inf) break; + u[v] = true; + for (auto j : g[v]) { + int to = j.first; + int len = j.second; + if (d[v] + len < d[to]) { + d[to] = d[v] + len; + p[to] = v; + } + } + + } + cout << (d[f] == inf ? -1 : d[f]) << endl; + return 0; +} \ No newline at end of file diff --git a/server/internal/metrics/testProgs/python/pycode2.txt b/server/internal/metrics/testProgs/python/pycode2.txt index 3ddbf28..e6058de 100644 --- a/server/internal/metrics/testProgs/python/pycode2.txt +++ b/server/internal/metrics/testProgs/python/pycode2.txt @@ -16,6 +16,11 @@ for diag_id in range(n + m): if 0 <= diag_id - x < m: arr[x][diag_id - x] = current_element current_element += 1 + if 0 <= diag_id - x < m: + arr[x][diag_id - x] = current_element + current_element += 0 + + for line in arr: print(*line) \ No newline at end of file diff --git a/server/internal/metrics/testProgs/python/pycode3.txt b/server/internal/metrics/testProgs/python/pycode3.txt new file mode 100644 index 0000000..0b49d05 --- /dev/null +++ b/server/internal/metrics/testProgs/python/pycode3.txt @@ -0,0 +1,19 @@ +n2, m2 = map(int, input()).split() +arr = [[0 for _ in range(m2)] for _ in range(n2)] +current_element = 1 + +for diag_id1 in range(n2 + m2): + if diag_id1 % 2 == 0: + for x in range(n): + if 0 <= diag_id1 - x < m2: + arr[x][diag_id1 - x] = current_element + current_element += 1 + else: + for x1 in reversed(range(n2)): + if 0 <= diag_id1 - x < m2: + arr[x][diag_id1 - x1] = current_element + current_element += 2 + current_element -= 1 + +for line1 in arr: + print(*line1) \ No newline at end of file diff --git a/server/internal/metrics/testProgs/python/pycode4.txt b/server/internal/metrics/testProgs/python/pycode4.txt new file mode 100644 index 0000000..a7f0145 --- /dev/null +++ b/server/internal/metrics/testProgs/python/pycode4.txt @@ -0,0 +1,22 @@ +table = '' + + +def reverse_table(n): + global table + if n != 0: + str = input() + reverse_table(n - 1) + table += str[::-1] + '\n' + + + +n, m = map(int, input().split()) +reverse_table(n) +table = list(table) + +for i in range(len(table) - 1, 0, -1): + if table[i] == '\\' or table[i] == '/': + table[i + m + 1] = table[i] + table[i] = table[i - m - 1] + +print(''.join(table)) \ No newline at end of file -- GitLab From 878b4ee5d02ef05b5398b0f969c86d5875a6c25a Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 21 May 2023 19:29:46 +0300 Subject: [PATCH 108/134] add swagger dock, change server port to 8081 --- docker-compose.yml | 22 ++- docs/.spectral.yml | 1 + docs/Makefile | 5 + docs/index.html | 30 ++++ docs/openapi.yml | 336 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 391 insertions(+), 3 deletions(-) create mode 100644 docs/.spectral.yml create mode 100644 docs/Makefile create mode 100755 docs/index.html create mode 100755 docs/openapi.yml diff --git a/docker-compose.yml b/docker-compose.yml index e101d36..ee7e7d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,24 +20,40 @@ services: ports: - "5432:5432" networks: - - db-network + - db-network + server: image: raiden454/cpp-app:latest networks: - db-network + - nginx-network env_file: - .env volumes: - .:/project command: bash -c "make build-project && make server-run" ports: - - "8080:8080" + - "8081:8080" depends_on: - db links: - - db:db + - db:db + + docs: + image: nginx + container_name: docs + volumes: + - ./docs/index.html:/usr/share/nginx/html/index.html + - ./docs/openapi.yml:/usr/share/nginx/html/openapi.yml + ports: + - 8080:80 + networks: + - nginx-network networks: db-network: driver: bridge name: db_network + nginx-network: + driver: bridge + name: nginx_network diff --git a/docs/.spectral.yml b/docs/.spectral.yml new file mode 100644 index 0000000..2b7eadf --- /dev/null +++ b/docs/.spectral.yml @@ -0,0 +1 @@ +extends: [[spectral:oas, all]] \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..530a08a --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,5 @@ +all: lint + +.PHONY: lint +lint: + @docker run --rm -t -v "$(PWD)":/tmp stoplight/spectral lint -v --ruleset "/tmp/.spectral.yml" "/tmp/openapi.yaml" \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100755 index 0000000..6b39db1 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,30 @@ + + + + + + + + Sourced Out API v1 + + + +
+ + + + + + \ No newline at end of file diff --git a/docs/openapi.yml b/docs/openapi.yml new file mode 100755 index 0000000..c4e7a47 --- /dev/null +++ b/docs/openapi.yml @@ -0,0 +1,336 @@ +openapi: '3.0.2' +info: + title: Sourced Out API + description: Anti-plagiarism system API. + version: '0.1.0' + contact: + name: Denis Okutin + url: https://t.me/raiden4545 + + +servers: + - url: http://localhost:8081 +tags: + - name: User + - name: Task + - name: Solution + +paths: + /user/register: + post: + summary: Create new user + description: > + Creates a new user. Login - email should be unique. + requestBody: + required: true + content: + application/json: + schema: + allOf: + - properties: + login: + $ref: '#/components/schemas/User/properties/login' + - properties: + username: + $ref: '#/components/schemas/User/properties/username' + - properties: + password: + $ref: '#/components/schemas/Password' + tags: + - User + responses: + '200': + description: OK + content: + text/plain: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad request + content: + text/plain: + schema: + type: string + '403': + description: Forbidden + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string + /user/login: + post: + summary: Login user + description: > + Logins an existing user. + requestBody: + required: true + content: + application/json: + schema: + allOf: + - properties: + login: + $ref: '#/components/schemas/User/properties/login' + - properties: + username: + $ref: '#/components/schemas/User/properties/username' + - properties: + password: + $ref: '#/components/schemas/Password' + tags: + - User + responses: + '200': + description: OK + content: + text/plain: + schema: + $ref: '#/components/schemas/User' + '400': + description: Bad request + content: + text/plain: + schema: + type: string + '404': + description: Not found + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string + /task/create: + post: + summary: Create new task + description: > + Creates a new task. + requestBody: + required: true + content: + application/json: + schema: + allOf: + - properties: + description: + type: string + name: + type: string + treshold: + type: number + format: float + tags: + - Task + responses: + '200': + description: OK + content: + text/plain: + schema: + $ref: '#/components/schemas/Task' + '400': + description: Bad request + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string + /task/all: + get: + summary: Get all tasks + description: > + Get all tasks from db. + tags: + - Task + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + count: + type: integer + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + '400': + description: Bad request + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string + /solution/submit: + post: + summary: Create new solution + requestBody: + required: true + content: + application/json: + schema: + allOf: + - properties: + user_id: + type: integer + task_id: + type: integer + filename: + type: string + filedata: + type: string + tags: + - Solution + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - properties: + sol_id: + type: integer + source: + type: string + result: + type: string + '400': + description: Bad request + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string + /solution/all: + post: + summary: Get all solutions + description: > + Get all solutions by user ans task id + requestBody: + required: true + content: + application/json: + schema: + allOf: + - properties: + user_id: + type: integer + task_id: + type: integer + tags: + - Solution + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + count: + type: integer + tasks: + type: array + items: + $ref: '#/components/schemas/Solution' + '400': + description: Bad request + content: + text/plain: + schema: + type: string + default: + description: Internal server error + content: + text/plain: + schema: + type: string +components: + schemas: + Login: + type: string + format: email + pattern: '(\\w+)@(\\w+)(\\.(\\w+))+' + minLength: 3 + maxLength: 30 + Username: + type: string + minLength: 3 + maxLength: 20 + Password: + type: string + format: password + minLength: 8 + maxLength: 30 + User: + type: object + properties: + id: + type: integer + login: + $ref: '#/components/schemas/Login' + username: + $ref: '#/components/schemas/Username' + Task: + type: object + properties: + id: + type: integer + description: + type: string + treshold: + type: number + format: float + name: + type: string + Solution: + type: object + properties: + id: + type: integer + send_date: + type: string + sender_id: + type: integer + source: + type: string + tokens: + type: array + astTree: + type: string + task_id: + type: integer + result: + type: string + orig_solution: + type: integer + language: + type: string \ No newline at end of file -- GitLab From c0753dec07bf434dca7643422049ddf435838b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sun, 21 May 2023 20:02:54 +0300 Subject: [PATCH 109/134] add advanced task creation --- client/internal/core/include/Core.h | 3 ++- client/internal/core/src/Core.cpp | 5 ++-- client/internal/entities/include/Task.h | 4 ++- client/internal/entities/src/Task.cpp | 3 ++- client/internal/gui/include/AddTaskDialog.h | 5 ++++ client/internal/gui/src/AddTaskDialog.cpp | 23 +++++++++++++--- client/internal/gui/src/TasksWindow.cpp | 4 +-- .../httpClient/include/HttpClientManager.h | 4 +-- .../internal/httpClient/include/Serializer.h | 2 +- .../httpClient/src/HttpClientManager.cpp | 5 ++-- client/internal/httpClient/src/Serializer.cpp | 11 +++++--- .../internal/httpServer/include/Serializer.h | 3 ++- server/internal/httpServer/include/Utils.h | 3 +++ server/internal/httpServer/src/Serializer.cpp | 27 ++++++++++++++++--- .../httpServer/src/SolutionManager.cpp | 20 ++++++++++---- .../internal/httpServer/src/TaskManager.cpp | 19 ++++++++----- .../internal/httpServer/src/UserManager.cpp | 8 +++--- server/internal/httpServer/src/Utils.cpp | 11 ++++++++ 18 files changed, 121 insertions(+), 39 deletions(-) diff --git a/client/internal/core/include/Core.h b/client/internal/core/include/Core.h index c837a25..31d3cee 100644 --- a/client/internal/core/include/Core.h +++ b/client/internal/core/include/Core.h @@ -16,7 +16,8 @@ public: static Solution submitSolution(const int& task_id, const std::string& filename, const std::string& path_to_file); - static unsigned int createTask(const std::string &desc); + static unsigned int createTask(const std::string& name, const std::string &desc, + const double& threshold); static void logout(); diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index e200e63..3f8acb6 100644 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -34,7 +34,8 @@ Solution Core::submitSolution(const int &task_id, const std::string& filename, c return client.submitSolution(user_id, task_id, filename, path_to_file); } -unsigned int Core::createTask(const std::string &desc) { - return client.createTask(desc); +unsigned int Core::createTask(const std::string& name, const std::string &desc, + const double& threshold) { + return client.createTask(name, desc, threshold); } diff --git a/client/internal/entities/include/Task.h b/client/internal/entities/include/Task.h index de9c488..c9b2325 100644 --- a/client/internal/entities/include/Task.h +++ b/client/internal/entities/include/Task.h @@ -4,7 +4,9 @@ struct Task{ std::size_t id; + std::string name; std::string description; + double threshold; - Task(std::size_t id, std::string_view desc); + Task(std::size_t id, std::string_view desc, std::string_view name, double threshold); }; diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp index 38e9e6e..e58c116 100644 --- a/client/internal/entities/src/Task.cpp +++ b/client/internal/entities/src/Task.cpp @@ -1,3 +1,4 @@ #include "Task.h" -Task::Task(std::size_t id, std::string_view desc) : id(id), description(desc) {} +Task::Task(std::size_t id, std::string_view desc, std::string_view name, double threshold) : + id(id), description(desc), name(name), threshold(threshold) {}; diff --git a/client/internal/gui/include/AddTaskDialog.h b/client/internal/gui/include/AddTaskDialog.h index c5b6547..0a63513 100644 --- a/client/internal/gui/include/AddTaskDialog.h +++ b/client/internal/gui/include/AddTaskDialog.h @@ -7,6 +7,7 @@ #include #include #include +#include class AddTaskDialog : public QDialog { Q_OBJECT @@ -20,6 +21,10 @@ public slots: private: QVBoxLayout* verticalLayout = nullptr; + QLineEdit* name = nullptr; + QLabel* nameLabel = nullptr; + QLineEdit* threshold = nullptr; + QLabel* thresholLabel = nullptr; QLabel* label = nullptr; QTextEdit* editor = nullptr; QPushButton *createButton = nullptr; diff --git a/client/internal/gui/src/AddTaskDialog.cpp b/client/internal/gui/src/AddTaskDialog.cpp index 4955001..7d72d99 100644 --- a/client/internal/gui/src/AddTaskDialog.cpp +++ b/client/internal/gui/src/AddTaskDialog.cpp @@ -20,6 +20,20 @@ void AddTaskDialog::setupUi(QDialog *AddTaskDialog) { verticalLayout = new QVBoxLayout(AddTaskDialog); + nameLabel = new QLabel(AddTaskDialog); + nameLabel->setText(QString::fromUtf8("Имя задания:")); + verticalLayout->addWidget(nameLabel); + + name = new QLineEdit(AddTaskDialog); + verticalLayout->addWidget(name); + + thresholLabel = new QLabel(AddTaskDialog); + thresholLabel->setText(QString::fromUtf8("Порог:")); + verticalLayout->addWidget(thresholLabel); + + threshold = new QLineEdit(AddTaskDialog); + verticalLayout->addWidget(threshold); + label = new QLabel(AddTaskDialog); label->setText(QString::fromUtf8("Введите текст задания")); verticalLayout->addWidget(label); @@ -38,11 +52,14 @@ void AddTaskDialog::setupUi(QDialog *AddTaskDialog) { void AddTaskDialog::on_createButton_clicked() { std::string desc = editor->toPlainText().toUtf8().constData(); - if (desc.empty()) { - QMessageBox::warning(this, "Ошибка отправки", "Описание не может быть пустыми"); + double th = threshold->text().toDouble(); + std::string n = name->text().toUtf8().constData(); + if (desc.empty() || n.empty() || threshold->text().isEmpty()) { + QMessageBox::warning(this, "Ошибка отправки", "Поля не могут быть пустыми"); return; } - unsigned result = Core::createTask(desc); + + unsigned result = Core::createTask(n, desc, th); switch (result) { case 200: accept(); diff --git a/client/internal/gui/src/TasksWindow.cpp b/client/internal/gui/src/TasksWindow.cpp index 3f14654..a74b63c 100644 --- a/client/internal/gui/src/TasksWindow.cpp +++ b/client/internal/gui/src/TasksWindow.cpp @@ -43,7 +43,7 @@ void TasksWindow::setupUi(QMainWindow *UserWindow) { tasks = new QComboBox(this); for (int i = 0; i < tasks_vector.size(); i++) { - tasks->insertItem(i, QString::number(tasks_vector[i].id)); + tasks->insertItem(i, QString::fromUtf8(tasks_vector[i].name)); } if (tasks_vector.empty()) { @@ -116,7 +116,7 @@ void TasksWindow::updateTasks() { tasks_vector = Core::getAllTasks(); tasks->clear(); for (int i = 0; i < tasks_vector.size(); i++) { - tasks->insertItem(i, QString::number(tasks_vector[i].id)); + tasks->insertItem(i, QString::fromUtf8(tasks_vector[i].name)); } tasks->setCurrentIndex(0); diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index 9007351..2d15f7f 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -23,8 +23,8 @@ public: const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); - unsigned int createTask(const std::string& desc); -// std::vector getMetrics(const int& sol_id); + unsigned int createTask(const std::string& name, const std::string &desc, + const double& threshold); void setHttpClient(std::shared_ptr client_); private: std::string host; diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index 0e874c1..ba742f2 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -13,7 +13,7 @@ public: std::string serialRegisterData(std::string_view login, std::string_view username, std::string_view password); std::string serialSolutionData(const int& user_id, const int& task_id, const std::string& filename, const std::string& path_to_file); - std::string serialNewTaskData(std::string_view desc); + std::string serialNewTaskData(std::string_view name, std::string_view desc, double threshold); User deserialUserData(std::string_view body); Solution deserialSolutionData(std::string_view body); diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index 9f9f7cd..a8831c0 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -77,8 +77,9 @@ std::vector HttpClientManager::getAllTasks() { return tasks; } -unsigned int HttpClientManager::createTask(const std::string &desc) { - std::string body = serializer->serialNewTaskData(desc); +unsigned int HttpClientManager::createTask(const std::string& name, const std::string &desc, + const double& threshold) { + std::string body = serializer->serialNewTaskData(name, desc, threshold); http::response res = client->makeGetRequest("/task/create", body); unsigned int result = res.result_int(); return result; diff --git a/client/internal/httpClient/src/Serializer.cpp b/client/internal/httpClient/src/Serializer.cpp index 859db2c..c2d803d 100644 --- a/client/internal/httpClient/src/Serializer.cpp +++ b/client/internal/httpClient/src/Serializer.cpp @@ -22,7 +22,7 @@ User Serializer::deserialUserData(std::string_view body) { User res = { json.get("user_id"), json.get("login"), - json.get("password"), + "", json.get("username") }; return res; @@ -45,8 +45,9 @@ std::vector Serializer::deserialAllTasks(std::string_view body) { boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); std::vector tasks; - for (auto &sound : json.get_child("tasks")) { - Task new_task(sound.second.get("task_id"), sound.second.get("description")); + for (auto &task : json.get_child("tasks")) { + Task new_task(task.second.get("task_id"), task.second.get("description"), + task.second.get("name"), task.second.get("threshold")); tasks.push_back(new_task); } return tasks; @@ -81,9 +82,11 @@ Solution Serializer::deserialSolutionData(std::string_view body) { return res; } -std::string Serializer::serialNewTaskData(std::string_view desc) { +std::string Serializer::serialNewTaskData(std::string_view name, std::string_view desc, double threshold) { boost::property_tree::ptree json; + json.put("name", name); json.put("description", desc); + json.put("threshold", threshold); std::stringstream out; boost::property_tree::write_json(out, json); return out.str(); diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 1398b05..9790ac5 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -13,7 +13,7 @@ class Serializer { public: std::tuple deserialNewSolutionData(const std::string& val); std::tuple deserialTaskData(const std::string& val); - std::string deserialNewTaskData(const std::string& val); + std::tuple deserialNewTaskData(const std::string& val); size_t deserialSolutionData(const std::string& val); std::tuple deserialUserData(const std::string& val); std::tuple deserialNewUserData(const std::string& val); @@ -22,6 +22,7 @@ class Serializer { std::string serialAllTasks(const std::vector& tasks); std::string serialUserData(const User& user); std::string serialSolution(const Solution& sol); + std::string serialTask(const Task& task); }; #endif // APP_HTTPSERVER_HTTPSERVER_MANAGERS_SERIALIZER_H_ diff --git a/server/internal/httpServer/include/Utils.h b/server/internal/httpServer/include/Utils.h index a817790..b8f0323 100644 --- a/server/internal/httpServer/include/Utils.h +++ b/server/internal/httpServer/include/Utils.h @@ -10,3 +10,6 @@ void fail(beast::error_code ec, char const* what); http::response getBadRequest(const http::request& request, beast::string_view why); + +http::response getInternalServerError(const http::request& request, + beast::string_view why); \ No newline at end of file diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index de400b7..ee7eb6a 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -29,16 +29,24 @@ std::tuple Serializer::deserialTaskData(const std::str ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - std::tuple res = {json.get("user_id"), json.get("task_id")}; + std::tuple res = { + json.get("user_id"), + json.get("task_id") + }; return res; } -std::string Serializer::deserialNewTaskData(const std::string &val) { +std::tuple Serializer::deserialNewTaskData(const std::string &val) { std::stringstream ss; ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - return json.get("description"); + std::tuple res = { + json.get("name"), + json.get("description"), + json.get("threshold") + }; + return res; } std::tuple Serializer::deserialUserData(const std::string &val) { @@ -84,6 +92,8 @@ std::string Serializer::serialAllTasks(const std::vector &tasks) { boost::property_tree::ptree node; node.put("task_id", i.getId()); node.put("description", i.getDescription()); + node.put("name", i.getName()); + node.put("threshold", i.getTreshhold()); tasks_nodes.push_back(std::make_pair("", node)); } json.add_child("tasks", tasks_nodes); @@ -97,7 +107,6 @@ std::string Serializer::serialUserData(const User &user) { json.put("user_id", user.getId()); json.put("login", user.getLogin()); json.put("username", user.getUsername()); - json.put("password", user.getPassword()); std::stringstream out; boost::property_tree::write_json(out, json); return out.str(); @@ -112,3 +121,13 @@ std::string Serializer::serialSolution(const Solution &sol) { boost::property_tree::write_json(out, json); return out.str(); } + +std::string Serializer::serialTask(const Task &task) { + boost::property_tree::ptree json; + json.put("name", task.getName()); + json.put("description", task.getDescription()); + json.put("threshold", task.getTreshhold()); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 6174c7e..742a8f9 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -15,12 +15,16 @@ SolutionManager::SolutionManager() void SolutionManager::setService(std::shared_ptr service) { solutionService = std::move(service); } http::message_generator SolutionManager::createSolution(http::request&& req) { + size_t user_id, task_id; + std::string filename, filedata; try { - size_t user_id, task_id; - std::string filename, filedata; std::tie(user_id, task_id, filename, filedata) = serializer->deserialNewSolutionData(req.body()); - Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata); + } catch (...) { + return getBadRequest(req, "Bad parameters"); + } + try { + Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); @@ -29,14 +33,20 @@ http::message_generator SolutionManager::createSolution(http::request&& req) { + size_t user_id, task_id; + try { - size_t user_id, task_id; std::tie(user_id, task_id) = serializer->deserialTaskData(req.body()); + } catch (...) { + return getBadRequest(req, "Bad parameters"); + } + + try { std::vector solutions; http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); diff --git a/server/internal/httpServer/src/TaskManager.cpp b/server/internal/httpServer/src/TaskManager.cpp index 9f8f579..42551eb 100644 --- a/server/internal/httpServer/src/TaskManager.cpp +++ b/server/internal/httpServer/src/TaskManager.cpp @@ -11,24 +11,31 @@ TaskManager::TaskManager() : serializer(std::make_shared()), taskSer void TaskManager::setService(std::shared_ptr service) { taskService = service; } http::message_generator TaskManager::createTask(http::request &&req) { + std::string description, name; + double threshold; try { - std::string description = serializer->deserialNewTaskData(req.body()); - taskService->createTask(description); - http::response res{http::status::ok, req.version()}; + std::tie(name, description, threshold) = serializer->deserialNewTaskData(req.body()); + } catch (...) { + return getBadRequest(req, "Bad parameters"); + } + + try { + Task task = taskService->createTask(description, name, threshold); + http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); + res.body() = serializer->serialTask(task); res.prepare_payload(); return res; } catch (...) { - return getBadRequest(req, "Something went wrong!"); + return getInternalServerError(req, "Something went wrong!"); } } http::message_generator TaskManager::getAllTasks(http::request &&req) { try { std::vector tasks = taskService->getAllTasks(); - // std::vector tasks = TmpTaskService::getAllTasks(); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); @@ -37,6 +44,6 @@ http::message_generator TaskManager::getAllTasks(http::request try { std::tie(login, password) = serializer->deserialUserData(req.body()); } catch (...) { - return getBadRequest(req, "Неправильные параметры!"); + return getBadRequest(req, "Bad parameters"); } User user; @@ -51,7 +51,7 @@ http::message_generator UserManager::registerUser(http::requestdeserialNewUserData(req.body()); } catch (...) { - return getBadRequest(req, "Неправильные параметры!"); + return getBadRequest(req, "Bad parameters"); } try { @@ -68,10 +68,10 @@ http::message_generator UserManager::registerUser(http::request getBadRequest(const http::request getInternalServerError(const http::request& request, + beast::string_view why) { + http::response res{http::status::internal_server_error, request.version()}; + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); + res.set(http::field::content_type, "text/plain"); + res.keep_alive(request.keep_alive()); + res.body() = std::string(why); + res.prepare_payload(); + return res; +} \ No newline at end of file -- GitLab From d4fcdcf23aee8760835dc25a5947a2e0c4e5a634 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 22 May 2023 14:00:17 +0300 Subject: [PATCH 110/134] add return codes --- client/internal/entities/src/Task.cpp | 2 +- server/internal/entities/include/Solution.hpp | 7 +++ server/internal/entities/src/Solution.cpp | 3 + server/internal/httpServer/src/Serializer.cpp | 10 +-- .../httpServer/src/SolutionManager.cpp | 2 +- server/internal/httpServer/src/Utils.cpp | 2 +- .../service/include/SolutionService.h | 7 +-- .../internal/service/src/SolutionService.cpp | 62 +++++++++---------- .../service/tests/SolutionServiceTest.cpp | 12 ++-- .../internal/service/virtual/IMockMetrics.h | 6 -- .../service/virtual/ISolutionService.h | 5 +- 11 files changed, 58 insertions(+), 60 deletions(-) delete mode 100644 server/internal/service/virtual/IMockMetrics.h diff --git a/client/internal/entities/src/Task.cpp b/client/internal/entities/src/Task.cpp index e58c116..c329f06 100644 --- a/client/internal/entities/src/Task.cpp +++ b/client/internal/entities/src/Task.cpp @@ -1,4 +1,4 @@ #include "Task.h" Task::Task(std::size_t id, std::string_view desc, std::string_view name, double threshold) : - id(id), description(desc), name(name), threshold(threshold) {}; + id(id), description(desc), name(name), threshold(threshold) {} diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 9a0b49e..f4aaa99 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -7,6 +7,13 @@ class Solution { public: + struct Codes { + std::string original; + std::string current; + Codes(const std::string &original, const std::string ¤t); + Codes() = default; + }; + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 0dfebf1..1558bb0 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -4,6 +4,9 @@ #include #include +Solution::Codes::Codes(const std::string &original, const std::string ¤t) + : original(original), current(current) {} + Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index ee7eb6a..72085bc 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -29,10 +29,7 @@ std::tuple Serializer::deserialTaskData(const std::str ss << val; boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); - std::tuple res = { - json.get("user_id"), - json.get("task_id") - }; + std::tuple res = {json.get("user_id"), json.get("task_id")}; return res; } @@ -42,10 +39,7 @@ std::tuple Serializer::deserialNewTaskData(con boost::property_tree::ptree json; boost::property_tree::read_json(ss, json); std::tuple res = { - json.get("name"), - json.get("description"), - json.get("threshold") - }; + json.get("name"), json.get("description"), json.get("threshold")}; return res; } diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 742a8f9..3bd96df 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -24,7 +24,7 @@ http::message_generator SolutionManager::createSolution(http::requestcreateSolution(user_id, task_id, filename, filedata); + Solution sol = solutionService->createSolution(user_id, task_id, filename, filedata).first; http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/httpServer/src/Utils.cpp b/server/internal/httpServer/src/Utils.cpp index 790aa7c..732146d 100644 --- a/server/internal/httpServer/src/Utils.cpp +++ b/server/internal/httpServer/src/Utils.cpp @@ -14,7 +14,7 @@ http::response getBadRequest(const http::request getInternalServerError(const http::request& request, - beast::string_view why) { + beast::string_view why) { http::response res{http::status::internal_server_error, request.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); diff --git a/server/internal/service/include/SolutionService.h b/server/internal/service/include/SolutionService.h index d89a651..2c47a99 100644 --- a/server/internal/service/include/SolutionService.h +++ b/server/internal/service/include/SolutionService.h @@ -4,7 +4,6 @@ #include #include "IAntlrWrapper.h" -#include "IMockMetrics.h" #include "ISolutionRepository.hpp" #include "ISolutionService.h" #include "ITaskRepository.hpp" @@ -19,7 +18,7 @@ class SolutionService : public ISolutionService { std::unique_ptr textMetric; std::unique_ptr tokenMetric; void setAntlrWrapper(const std::string& fileExtension, const std::string& filedata); - std::string setResultVerdict(float textBasedRes, float tokenBasedRes, size_t plagiatSolId, float treshold); + std::pair setResultVerdict(float textBasedRes, float tokenBasedRes, float treshold); std::pair getMaxTextResMetric(std::vector& solutions, const std::string& filedata, size_t userId, float treshold); @@ -30,8 +29,8 @@ class SolutionService : public ISolutionService { explicit SolutionService(std::unique_ptr solutionRepo, std::unique_ptr taskRepo); SolutionService(); - Solution createSolution(size_t userId, size_t taskId, const std::string& filename, - const std::string& filedata) override; + std::pair createSolution(size_t userId, size_t taskId, const std::string& filename, + const std::string& filedata) override; void deleteSolutionById(size_t solId) override; std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) override; std::pair getMetrics(size_t solId) override; diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index bf63eac..2bb2ab2 100644 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -35,30 +35,26 @@ void SolutionService::setAntlrWrapper(const std::string& fileExtension, const st } } -std::string SolutionService::setResultVerdict(float textBasedRes, float tokenBasedRes, size_t plagiatSolId, - float treshold = 0.5f) { +std::pair SolutionService::setResultVerdict(float textBasedRes, float tokenBasedRes, + float treshold = 0.5f) { float meanRes = (tokenBasedRes + textBasedRes) / 2; if (meanRes < treshold) { - return (boost::format("\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f") % - NOT_PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes) - .str(); - } - try { - std::string closestCode = solutionRepo->getSolutionById(plagiatSolId).value().getSource(); - return (boost::format( - "\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f\nОчень похоже на " - "решение, отправленное до вас:\n%s") % - PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes % closestCode) - .str(); - } catch (...) { - throw; + return std::make_pair( + (boost::format("\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f") % + NOT_PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes) + .str(), + NOT_PLAGIAT_VERDICT); } + return std::make_pair( + (boost::format("\n%s\nРезультаты метрик: %.2f\n\tАнализ текста: %.2f\n\tАнализ токенов: %.2f\n") % + PLAGIAT_VERDICT % meanRes % textBasedRes % tokenBasedRes) + .str(), + PLAGIAT_VERDICT); } std::pair SolutionService::getMaxTextResMetric(std::vector& solutions, const std::string& filedata, size_t userId, float treshold) { - // std::cout << "getMaxTextResMetric start" << std::endl; std::pair maxMatch = std::make_pair(0.0, 0); for (auto sol : solutions) { if (sol.getSenderId() == userId) { @@ -81,7 +77,6 @@ std::pair SolutionService::getMaxTextResMetric(std::vector SolutionService::getMaxTokenResMetric(std::vector& tokens, size_t userId, float treshold) { std::pair maxMatch = std::make_pair(0.0, 0); - // std::cout << "getMaxTokenResMetric start" << std::endl; for (auto sol : solutions) { if (sol.getSenderId() == userId) { continue; @@ -113,12 +107,12 @@ std::pair SolutionService::getMaxTokenResMetric(std::vector SolutionService::createSolution(size_t userId, size_t taskId, + const std::string& filename, + const std::string& filedata) { try { std::pair fileExtension = FileMethods::checkFileExtension(filename); if (!fileExtension.second) { @@ -147,22 +141,28 @@ Solution SolutionService::createSolution(size_t userId, size_t taskId, const std t1.join(); t2.join(); - size_t plagiatSolId = 1; - if (textBasedRes.first > tokenBasedRes.first) { - plagiatSolId = textBasedRes.second; - } else { - plagiatSolId = tokenBasedRes.second; + std::pair result = + setResultVerdict(textBasedRes.first, tokenBasedRes.first, treshold); + + size_t plagiatSolId = 0; + Solution::Codes codes; + if (result.second == PLAGIAT_VERDICT) { + if (textBasedRes.first > tokenBasedRes.first) { + plagiatSolId = textBasedRes.second; + } else { + plagiatSolId = tokenBasedRes.second; + } + std::string originalCode = solutionRepo->getSolutionById(plagiatSolId).value().getSource(); + codes = Solution::Codes(originalCode, filedata); } - std::string result = setResultVerdict(textBasedRes.first, tokenBasedRes.first, plagiatSolId, treshold); - Solution sol = - Solution(std::ctime(&now), userId, filedata, taskId, result, Utils::convertIntArrayIntoString(tokensTypes), - astTree, plagiatSolId, fileExtension.first); + Solution(std::ctime(&now), userId, filedata, taskId, result.first, + Utils::convertIntArrayIntoString(tokensTypes), astTree, plagiatSolId, fileExtension.first); size_t id = solutionRepo->storeSolution(sol); sol.setId(id); - return sol; + return std::make_pair(sol, codes); } catch (...) { throw; } diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index e8f9130..090ea13 100644 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -101,12 +101,12 @@ TEST_F(SolutionServiceTest, createSolutionPlagiat) { .WillOnce(::testing::Return(std::make_optional( Solution(0, "", 1, "int main(){return 0;}", 1, "", "45 132 85 86 89 59 1 128 90 -1", "", -1, "cpp")))); - Solution sol = ss->createSolution(2, 1, "main.cpp", "size_t main(){return 1;}"); - EXPECT_EQ(sol.getId(), 1); + auto sol = ss->createSolution(2, 1, "main.cpp", "size_t main(){return 1;}"); + EXPECT_EQ(sol.first.getId(), 1); + EXPECT_EQ(sol.second.original,"int main(){return 0;}"); EXPECT_EQ( - sol.getResult(), - "\nНе, ну вы не палитесь. Плагиат.\nРезультаты метрик: 0.72\n\tАнализ текста: 0.54\n\tАнализ токенов: 0.89" - "\nОчень похоже на решение, отправленное до вас:\nint main(){return 0;}"); + sol.first.getResult(), + "\nНе, ну вы не палитесь. Плагиат.\nРезультаты метрик: 0.72\n\tАнализ текста: 0.54\n\tАнализ токенов: 0.89\n"); } TEST_F(SolutionServiceTest, createSolutionNonPlagiat) { @@ -123,7 +123,7 @@ TEST_F(SolutionServiceTest, createSolutionNonPlagiat) { EXPECT_CALL(*taskMockPtr, getTaskById(1)).Times(1).WillOnce(::testing::Return(Task(1, "desription", 0.5f, "name"))); - Solution sol = ss->createSolution(1, 1, "main.cpp", "int main(){return 0;}"); + Solution sol = ss->createSolution(1, 1, "main.cpp", "int main(){return 0;}").first; EXPECT_EQ(sol.getResult(), "\nКрасивое решение. А главное уникальное !\nРезультаты метрик: 0.00\n\tАнализ текста: 0.00\n\tАнализ " "токенов: 0.00"); diff --git a/server/internal/service/virtual/IMockMetrics.h b/server/internal/service/virtual/IMockMetrics.h deleted file mode 100644 index fc0a93f..0000000 --- a/server/internal/service/virtual/IMockMetrics.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -class IMockMetrics { - public: - virtual void countMetric(); -}; diff --git a/server/internal/service/virtual/ISolutionService.h b/server/internal/service/virtual/ISolutionService.h index 7c1294d..5449ab6 100644 --- a/server/internal/service/virtual/ISolutionService.h +++ b/server/internal/service/virtual/ISolutionService.h @@ -8,8 +8,9 @@ class ISolutionService { public: virtual ~ISolutionService() = default; - virtual Solution createSolution(size_t userId, size_t taskId, const std::string& filename, - const std::string& filedata) = 0; + virtual std::pair createSolution(size_t userId, size_t taskId, + const std::string& filename, + const std::string& filedata) = 0; virtual void deleteSolutionById(size_t solId) = 0; virtual std::vector getSolutionsByUserAndTaskId(size_t user_id, size_t task_id) = 0; virtual std::pair getMetrics(size_t solId) = 0; -- GitLab From 43b2b0db30cad1fc4464991fe7af377207c76779 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 22 May 2023 15:08:08 +0300 Subject: [PATCH 111/134] add gettokens names func --- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 1 + server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 13 +++++++++++++ server/pkg/antlr/python3/include/PythonAntlr.h | 1 + server/pkg/antlr/virtual/IAntlrWrapper.h | 1 + 4 files changed, 16 insertions(+) diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 90c6096..9363946 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -20,6 +20,7 @@ class MyCppAntlr:public IAntlrWrapper { ~MyCppAntlr() override = default; std::vector getTokens() override; std::vector getTokensTypes() override; + std::vector getTokensNames() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index a6dcf1c..5be789b 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -35,6 +35,19 @@ std::vector MyCppAntlr::getTokensTypes() { return ans; } +std::vector MyCppAntlr::getTokensNames() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + ans[i] = token->getText(); + i++; + } + + return ans; +} + std::string MyCppAntlr::getTokensString() { tokenStream_ptr->fill(); std::string res; diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index 16fe1b4..8442ca9 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -21,6 +21,7 @@ class PythonAntlr:public IAntlrWrapper { ~PythonAntlr() override = default; std::vector getTokens() override; std::vector getTokensTypes() override; + std::vector getTokensNames() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index c30efcf..2482776 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -10,6 +10,7 @@ class IAntlrWrapper { virtual ~IAntlrWrapper() = default; virtual std::vector getTokens() = 0; virtual std::vector getTokensTypes() = 0; + virtual std::vector getTokensNames() = 0; virtual std::pair getTokensAndTree() = 0; virtual std::string getTokensString() = 0; virtual std::string getTreeString() = 0; -- GitLab From 17d58b0f8784e557171299e95c2cc94105ca7546 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Tue, 23 May 2023 21:54:50 +0300 Subject: [PATCH 112/134] add diff class --- server/cmd/main.cpp | 48 ++++--- server/internal/metrics/include/DiffLib.h | 38 +++++ server/internal/metrics/src/DiffLibImpl.cpp | 152 ++++++++++++++++++++ 3 files changed, 220 insertions(+), 18 deletions(-) create mode 100644 server/internal/metrics/include/DiffLib.h create mode 100644 server/internal/metrics/src/DiffLibImpl.cpp diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 9b3fc04..df1f205 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -4,11 +4,12 @@ #include "MyCppAntlr.h" #include "TokenMetricLib.h" #include "TextMetricsLib.h" +#include "DiffLib.h" int main(int argc, const char* argv[]) { // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); std::ifstream fin1("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin2("internal/metrics/testProgs/cpp/code4.txt"); + std::ifstream fin2("internal/metrics/testProgs/cpp/code2.txt"); std::string text1( (std::istreambuf_iterator(fin1) ), @@ -25,39 +26,50 @@ int main(int argc, const char* argv[]) { std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric() << std::endl; + FoundSame foundSame; + foundSame.setData(text1, text2); + std::pair res = foundSame.getTexts(); + fin1.close(); fin2.close(); std::ifstream fin3("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin4("internal/metrics/testProgs/cpp/code4.txt"); + std::ifstream fin4("internal/metrics/testProgs/cpp/code2.txt"); MyCppAntlr cppA1 = MyCppAntlr(fin3); MyCppAntlr cppA2 = MyCppAntlr(fin4); + std::vector str_tokens1 = cppA1.getTokensNames(); + std::vector str_tokens2 = cppA2.getTokensNames(); //PythonAntlr pyA1 = PythonAntlr(fin3); //PythonAntlr pyA2 = PythonAntlr(fin4); + foundSame.setData2(str_tokens1, str_tokens2); +//res = foundSame.getTexts(); + std::vector tokens1 = cppA1.getTokensTypes(); std::vector tokens2 = cppA2.getTokensTypes(); - LevDistTokenMetric lev; - WShinglingTokenMetric wsh; - lev.setData(tokens1, tokens2); - wsh.setData(tokens1, tokens2); - - std::cout << "Tokens1:" << std::endl; - for (int token : tokens1) { - std::cout << token << " "; - } - std::cout << std::endl; - std::cout << "Tokens2:" << std::endl; - for (int token : tokens2) { - std::cout << token << " "; - } - std::cout << std::endl; - std::cout << lev.getMetric() << std::endl << wsh.getMetric() << std::endl; +// LevDistTokenMetric lev; +// WShinglingTokenMetric wsh; +// lev.setData(tokens1, tokens2); +// wsh.setData(tokens1, tokens2); +// +// std::cout << "Tokens1:" << std::endl; +// for (int token : tokens1) { +// std::cout << token << " "; +// } +// std::cout << std::endl; +// +// std::cout << "Tokens2:" << std::endl; +// for (int token : tokens2) { +// std::cout << token << " "; +// } +// std::cout << std::endl; +// +// std::cout << lev.getMetric() << std::endl << wsh.getMetric() << std::endl; fin3.close(); fin4.close(); return 0; diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h new file mode 100644 index 0000000..c31452f --- /dev/null +++ b/server/internal/metrics/include/DiffLib.h @@ -0,0 +1,38 @@ +// +// Created by march on 22.05.2023. +// + +#ifndef SOURCEDOUT_DIFFLIB_H +#define SOURCEDOUT_DIFFLIB_H + +#include +#include +#include +#include +#include +#include +#include + +class FoundSame { +public: + void setData(std::string text1, std::string text2); + void setData2(std::vector _tokens1, std::vector _tokens2); + void tokens2text(); + [[maybe_unused]] std::pair getTexts(); + +private: + struct Elem { + std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace + std::string token1; + std::string token2; + }; + + std::vector tokens1; + std::vector tokens2; + std::vector res_alignment; + + static std::vector diffTokenizer(const std::string& text); + static std::string delServSimbols(std::string s); +}; + +#endif //SOURCEDOUT_DIFFLIB_H diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp new file mode 100644 index 0000000..da99845 --- /dev/null +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -0,0 +1,152 @@ +// +// Created by march on 22.05.2023. +// +#include + +#include "DiffLib.h" + +void FoundSame::setData(std::string text1, std::string text2) { + tokens1 = diffTokenizer(text1); + tokens2 = diffTokenizer(text2); + +} + +std::vector FoundSame::diffTokenizer(const std::string& text) { + boost::char_separator sep(" \r", "\n"); + std::vector res; + boost::tokenizer < boost::char_separator > tokens(text, sep); + + for (const std::string &s: tokens) { + if (s == "\n" && !res.empty()){ + res.back() += "\n"; + } + else + res.push_back(s); + } + return res; +} + +std::pair FoundSame::getTexts() { + unsigned long n = tokens1.size(); + unsigned long m = tokens2.size(); + + std::vector > dist (n + 1, std::vector (m + 1, 0)); + + for (size_t i = 0; i < n + 1; i++){ + dist[i][0] = static_cast (i); + } + + for (size_t i = 0; i < m + 1; i++){ + dist[0][i] = static_cast (i); + } + + std::vector > cache (n + 1, std::vector (m + 1)); + + for (size_t i = 1; i <= n; i++){ + cache[i][0] = {"I", (tokens1[i-1].back() == '\n' && tokens1[i-1].size() > 2 ? "%\n" : "%"), tokens1[i-1]}; + } + for (size_t i = 1; i <= m; i++){ + cache[0][i] = {"D", tokens2[i-1], (tokens2[i-1].back() == '\n' && tokens1[i-1].size() > 2 ? "#\n" : "#")}; + } + + std::string r, h; + for (size_t i = 1; i <= n; i++){ + for (size_t j = 1; j <= m; j++){ + h = tokens1[i-1], r = tokens2[j-1]; + std::vector > cases; + + if (delServSimbols(r) == delServSimbols(h)) + cases.push_back( {dist[i - 1][j - 1], {"C", r, h} } ); + else + cases.push_back({dist[i - 1][j - 1] + 1, {"R", r, h}}); + cases.push_back( { dist[i][j-1] + 1, {"D", r, (r.back() == '\n' && r.size() > 2 ? "#\n" : "#")} } ); + cases.push_back( { dist[i-1][j] + 1, {"I", (h.back() == '\n' && h.size() > 2 ? "%\n" : "%"), h} } ); + + dist[i][j] = cases[0].first; + cache[i][j] = cases[0].second; + + for (size_t k = 1; k < cases.size(); k++){ + if (dist[i][j] > cases[k].first){ + dist[i][j] = cases[k].first; + cache[i][j] = cases[k].second; + } + } + } + } + + for (size_t i = 0; i < dist.size(); i++){ + for (size_t j = 0; j < dist[0].size(); j++){ + std::cout << dist[i][j] << " "; + } + std::cout << std::endl; + } + std::cout << std::endl; + + std::vector alignment; + size_t i = n, j = m; + while (i != 0 || j != 0){ + std::string op = cache[i][j].op; + alignment.push_back(cache[i][j]); + if (op == "C" || op == "R"){ + i--, j--; + } else if (op == "I"){ + i--; + } else{ + j--; + } + } + std::reverse(alignment.begin(), alignment.end()); + + res_alignment = alignment; + tokens2text(); + + return {"", ""}; +} + +void FoundSame::setData2(std::vector _tokens1, std::vector _tokens2) { + tokens1 = std::move(_tokens1); + tokens2 = std::move(_tokens2); +} + +void FoundSame::tokens2text() { + + std::vector ops; + + for (auto & k : res_alignment){ + std::cout << k.op << " " << k.token1 << " " << k.token2 << std::endl; + } + + for (const auto& elem : res_alignment){ + std::cout << elem.token1; + if (elem.token1.back() != '\n') + std::cout << " "; + } + std::cout << std::endl; + for (const auto &elem : res_alignment){ + ops.push_back(elem.op); + if (elem.token2.back() == '\n') { + std::string t_token = elem.token2; + t_token.pop_back(); + std::cout << t_token << "\t"; + for (const auto& oper : ops) + std::cout << oper << " "; + std::cout << std::endl; + ops.clear(); + } + else{ + std::cout << elem.token2; + if (elem.token2.back() != '\n') + std::cout << " "; + } + } +} + +std::string FoundSame::delServSimbols(std::string s) { + std::string res = std::move(s); + while(!res.empty() && res.back() == '\n'){ + res.pop_back(); + } + return res; +} + + -- GitLab From f0d210ad6a0123890d8f832d4255b0ea2ee8a560 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 23 May 2023 22:47:56 +0300 Subject: [PATCH 113/134] add new methods --- Makefile | 2 +- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 1 + server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 15 ++++++++++ .../pkg/antlr/python3/include/PythonAntlr.h | 1 + server/pkg/antlr/python3/src/PythonAntlr.cpp | 28 +++++++++++++++++++ server/pkg/antlr/virtual/IAntlrWrapper.h | 1 + 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ac63634..0c8001e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ dev: docker run --rm -it \ -v $(PWD):/project \ --name app \ - ddt-project + raiden454/cpp-app stop-docker: docker stop app diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 9363946..9df34a5 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -21,6 +21,7 @@ class MyCppAntlr:public IAntlrWrapper { std::vector getTokens() override; std::vector getTokensTypes() override; std::vector getTokensNames() override; + std::vector> getTokensNamesWithPosition() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index 5be789b..f80d1c1 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -22,6 +22,21 @@ std::vector MyCppAntlr::getTokens() { return ans; } +std::vector> MyCppAntlr::getTokensNamesWithPosition(){ + tokenStream_ptr->fill(); + std::vector> ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + auto type = token->getText(); + int line = token->getLine(); + ans[i]=std::make_pair(type,line); + i++; + } + + return ans; +} + std::vector MyCppAntlr::getTokensTypes() { tokenStream_ptr->fill(); std::vector ans(tokenStream_ptr->size()); diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index 8442ca9..615d432 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -22,6 +22,7 @@ class PythonAntlr:public IAntlrWrapper { std::vector getTokens() override; std::vector getTokensTypes() override; std::vector getTokensNames() override; + std::vector> getTokensNamesWithPosition() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index eae822d..b7c83b4 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -22,6 +22,21 @@ std::vector PythonAntlr::getTokens() { return ans; } +std::vector> PythonAntlr::getTokensNamesWithPosition(){ + tokenStream_ptr->fill(); + std::vector> ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + auto type = token->getText(); + int line = token->getLine(); + ans[i]=std::make_pair(type,line); + i++; + } + + return ans; +} + std::vector PythonAntlr::getTokensTypes() { tokenStream_ptr->fill(); std::vector ans(tokenStream_ptr->size()); @@ -46,6 +61,19 @@ std::string PythonAntlr::getTokensString() { return res; } +std::vector PythonAntlr::getTokensNames() { + tokenStream_ptr->fill(); + std::vector ans(tokenStream_ptr->size()); + + int i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + ans[i] = token->getText(); + i++; + } + + return ans; +} + std::string PythonAntlr::getTreeString() { auto tree = parser_ptr->file_input(); return tree->toStringTree(&(*parser_ptr)); diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index 2482776..718a017 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -11,6 +11,7 @@ class IAntlrWrapper { virtual std::vector getTokens() = 0; virtual std::vector getTokensTypes() = 0; virtual std::vector getTokensNames() = 0; + virtual std::vector> getTokensNamesWithPosition() = 0; virtual std::pair getTokensAndTree() = 0; virtual std::string getTokensString() = 0; virtual std::string getTreeString() = 0; -- GitLab From e1a0a16b252c70698866083b90dfb25f7a517808 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 24 May 2023 03:08:36 +0300 Subject: [PATCH 114/134] add methods for type --- server/cmd/main.cpp | 18 ++- server/internal/metrics/include/DiffLib.h | 14 ++- server/internal/metrics/src/DiffLibImpl.cpp | 128 +++++++++++++++++--- 3 files changed, 137 insertions(+), 23 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index df1f205..92ccf8b 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -28,7 +28,7 @@ int main(int argc, const char* argv[]) { FoundSame foundSame; foundSame.setData(text1, text2); - std::pair res = foundSame.getTexts(); + // std::pair res = foundSame.getTexts(); fin1.close(); fin2.close(); @@ -39,13 +39,21 @@ int main(int argc, const char* argv[]) { MyCppAntlr cppA1 = MyCppAntlr(fin3); MyCppAntlr cppA2 = MyCppAntlr(fin4); - std::vector str_tokens1 = cppA1.getTokensNames(); - std::vector str_tokens2 = cppA2.getTokensNames(); + // std::vector str_tokens1 = cppA1.getTokensNames(); + // std::vector str_tokens2 = cppA2.getTokensNames(); + + std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); + std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); + + for (int i = 0; i < str_int_tokens1.size(); i++){ + std::cout << str_int_tokens1[i].first << " " << str_int_tokens1[i].second << std::endl; + } + //PythonAntlr pyA1 = PythonAntlr(fin3); //PythonAntlr pyA2 = PythonAntlr(fin4); - foundSame.setData2(str_tokens1, str_tokens2); -//res = foundSame.getTexts(); + foundSame.setData2(str_int_tokens1, str_int_tokens2); + std::pair res = foundSame.getTexts2(); std::vector tokens1 = cppA1.getTokensTypes(); std::vector tokens2 = cppA2.getTokensTypes(); diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index c31452f..7ed5bef 100644 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -16,9 +16,11 @@ class FoundSame { public: void setData(std::string text1, std::string text2); - void setData2(std::vector _tokens1, std::vector _tokens2); + void setData2(std::vector > _tokens1, std::vector > _tokens2); void tokens2text(); + void tokens2text2(); [[maybe_unused]] std::pair getTexts(); + [[maybe_unused]] std::pair getTexts2(); private: struct Elem { @@ -27,10 +29,20 @@ private: std::string token2; }; + struct Elem2 { + std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace + std::pair token1; + std::pair token2; + }; + std::vector tokens1; std::vector tokens2; std::vector res_alignment; + std::vector > str_int_tokens1; + std::vector > str_int_tokens2; + std::vector res_alignment2; + static std::vector diffTokenizer(const std::string& text); static std::string delServSimbols(std::string s); }; diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index da99845..7ecb00e 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -8,7 +8,11 @@ void FoundSame::setData(std::string text1, std::string text2) { tokens1 = diffTokenizer(text1); tokens2 = diffTokenizer(text2); +} +void FoundSame::setData2(std::vector > _tokens1, std::vector > _tokens2) { + str_int_tokens1 = std::move(_tokens1); + str_int_tokens2 = std::move(_tokens2); } std::vector FoundSame::diffTokenizer(const std::string& text) { @@ -43,10 +47,10 @@ std::pair FoundSame::getTexts() { std::vector > cache (n + 1, std::vector (m + 1)); for (size_t i = 1; i <= n; i++){ - cache[i][0] = {"I", (tokens1[i-1].back() == '\n' && tokens1[i-1].size() > 2 ? "%\n" : "%"), tokens1[i-1]}; + cache[i][0] = {"I", (tokens1[i-1].back() == '\n' && tokens1[i-1].size() > 1 ? "%\n" : "%"), tokens1[i-1]}; } for (size_t i = 1; i <= m; i++){ - cache[0][i] = {"D", tokens2[i-1], (tokens2[i-1].back() == '\n' && tokens1[i-1].size() > 2 ? "#\n" : "#")}; + cache[0][i] = {"D", tokens2[i-1], (tokens2[i-1].back() == '\n' && tokens1[i-1].size() > 1 ? "#\n" : "#")}; } std::string r, h; @@ -59,8 +63,8 @@ std::pair FoundSame::getTexts() { cases.push_back( {dist[i - 1][j - 1], {"C", r, h} } ); else cases.push_back({dist[i - 1][j - 1] + 1, {"R", r, h}}); - cases.push_back( { dist[i][j-1] + 1, {"D", r, (r.back() == '\n' && r.size() > 2 ? "#\n" : "#")} } ); - cases.push_back( { dist[i-1][j] + 1, {"I", (h.back() == '\n' && h.size() > 2 ? "%\n" : "%"), h} } ); + cases.push_back( { dist[i][j-1] + 1, {"D", r, (r.back() == '\n' && r.size() > 1 ? "#\n" : "#")} } ); + cases.push_back( { dist[i-1][j] + 1, {"I", (h.back() == '\n' && h.size() > 1 ? "%\n" : "%"), h} } ); dist[i][j] = cases[0].first; cache[i][j] = cases[0].second; @@ -74,14 +78,6 @@ std::pair FoundSame::getTexts() { } } - for (size_t i = 0; i < dist.size(); i++){ - for (size_t j = 0; j < dist[0].size(); j++){ - std::cout << dist[i][j] << " "; - } - std::cout << std::endl; - } - std::cout << std::endl; - std::vector alignment; size_t i = n, j = m; while (i != 0 || j != 0){ @@ -103,11 +99,6 @@ std::pair FoundSame::getTexts() { return {"", ""}; } -void FoundSame::setData2(std::vector _tokens1, std::vector _tokens2) { - tokens1 = std::move(_tokens1); - tokens2 = std::move(_tokens2); -} - void FoundSame::tokens2text() { std::vector ops; @@ -149,4 +140,107 @@ std::string FoundSame::delServSimbols(std::string s) { return res; } +std::pair FoundSame::getTexts2() { + unsigned long n = str_int_tokens1.size(); + unsigned long m = str_int_tokens2.size(); + + std::vector > dist (n + 1, std::vector (m + 1, 0)); + + for (size_t i = 0; i < n + 1; i++){ + dist[i][0] = static_cast (i); + } + + for (size_t i = 0; i < m + 1; i++){ + dist[0][i] = static_cast (i); + } + + std::vector > cache (n + 1, std::vector (m + 1)); + + for (size_t i = 1; i <= n; i++){ + cache[i][0] = {"I", {"%", str_int_tokens1[i-1].second}, str_int_tokens1[i-1]}; // str_int_tokens1[i-1].second мб кал + } + for (size_t i = 1; i <= m; i++){ + cache[0][i] = {"D", str_int_tokens2[i-1], {"#", str_int_tokens2[i-1].second}}; //аналогично + } + + std::pair r, h; + for (size_t i = 1; i <= n; i++){ + for (size_t j = 1; j <= m; j++){ + h = str_int_tokens1[i-1], r = str_int_tokens2[j-1]; + std::vector > cases; + + if (r.first == h.first) + cases.push_back( {dist[i - 1][j - 1], {"C", r, h} } ); + else + cases.push_back({dist[i - 1][j - 1] + 1, {"R", r, h}}); + cases.push_back( { dist[i][j-1] + 1, {"D", r, {"#", h.second} } } ); + cases.push_back( { dist[i-1][j] + 1, {"I", {"%", r.second}, h} } ); + + dist[i][j] = cases[0].first; + cache[i][j] = cases[0].second; + + for (size_t k = 1; k < cases.size(); k++){ + if (dist[i][j] > cases[k].first){ + dist[i][j] = cases[k].first; + cache[i][j] = cases[k].second; + } + } + } + } + + std::vector alignment; + size_t i = n, j = m; + while (i != 0 || j != 0){ + std::string op = cache[i][j].op; + alignment.push_back(cache[i][j]); + if (op == "C" || op == "R"){ + i--, j--; + } else if (op == "I"){ + i--; + } else{ + j--; + } + } + std::reverse(alignment.begin(), alignment.end()); + + res_alignment2 = alignment; + tokens2text2(); + + return {"", ""}; +} + +void FoundSame::tokens2text2() { + std::string res1, res2; + std::vector ops; + + int line = res_alignment2[0].token1.second; + + for (auto & i : res_alignment2){ + if (i.token1.second > line){ + res1 += '\n'; + line = i.token1.second; + } + res1 += i.token1.first, res1 += " "; + } + + line = res_alignment2[0].token2.second; + for (auto & i : res_alignment2){ + if (i.token2.second > line){ + res2 += '\t'; + for (auto & op : ops){ + res2 += op, res2 += " "; + } + ops.clear(); + res2 += '\n'; + line = i.token2.second; + } + ops.push_back(i.op); + res2 += i.token2.first, res2 += " "; + } + + res1.pop_back(), res2.pop_back(); + + std::cout << res1 << "\n\n" << res2 << std::endl; +} + -- GitLab From acdda9388ce8359e9eba015590bc9b405fccd7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Wed, 24 May 2023 09:24:52 +0300 Subject: [PATCH 115/134] add advanced solution window --- client/internal/core/include/Core.h | 2 +- client/internal/core/src/Core.cpp | 4 +-- client/internal/entities/include/Solution.h | 4 +++ client/internal/gui/include/SolutionsWindow.h | 6 ++++ client/internal/gui/src/SolutionsWindow.cpp | 35 +++++++++++++++---- .../httpClient/include/HttpClientManager.h | 2 +- .../internal/httpClient/include/Serializer.h | 1 + .../httpClient/src/HttpClientManager.cpp | 8 +++-- client/internal/httpClient/src/Serializer.cpp | 17 +++++++++ .../internal/httpServer/include/Serializer.h | 1 + server/internal/httpServer/src/Serializer.cpp | 12 +++++++ .../httpServer/src/SolutionManager.cpp | 7 ++-- 12 files changed, 83 insertions(+), 16 deletions(-) diff --git a/client/internal/core/include/Core.h b/client/internal/core/include/Core.h index 31d3cee..a981e96 100644 --- a/client/internal/core/include/Core.h +++ b/client/internal/core/include/Core.h @@ -14,7 +14,7 @@ public: static std::vector getAllTasks(); - static Solution submitSolution(const int& task_id, const std::string& filename, const std::string& path_to_file); + static std::pair submitSolution(const int& task_id, const std::string& filename, const std::string& path_to_file); static unsigned int createTask(const std::string& name, const std::string &desc, const double& threshold); diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index 3f8acb6..aff4b39 100644 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -5,7 +5,7 @@ #include "HttpClientManager.h" const std::string CLIENT_IP = "0.0.0.0"; -const std::string CLIENT_PORT = "8080"; +const std::string CLIENT_PORT = "8081"; HttpClientManager client(CLIENT_IP, CLIENT_PORT); std::size_t Core::user_id = -1; @@ -30,7 +30,7 @@ std::vector Core::getAllTasks() { return client.getAllTasks(); } -Solution Core::submitSolution(const int &task_id, const std::string& filename, const std::string &path_to_file) { +std::pair Core::submitSolution(const int &task_id, const std::string& filename, const std::string &path_to_file) { return client.submitSolution(user_id, task_id, filename, path_to_file); } diff --git a/client/internal/entities/include/Solution.h b/client/internal/entities/include/Solution.h index 4cf7061..9de0537 100644 --- a/client/internal/entities/include/Solution.h +++ b/client/internal/entities/include/Solution.h @@ -8,4 +8,8 @@ struct Solution { size_t id; std::string source; std::string result; + struct Codes { + std::string original; + std::string current; + }; }; \ No newline at end of file diff --git a/client/internal/gui/include/SolutionsWindow.h b/client/internal/gui/include/SolutionsWindow.h index 3107c18..df2f09d 100644 --- a/client/internal/gui/include/SolutionsWindow.h +++ b/client/internal/gui/include/SolutionsWindow.h @@ -39,6 +39,12 @@ private: QPushButton* sendButton = nullptr; QTextEdit* result = nullptr; QPushButton* backButton = nullptr; + QWidget* solutionWidget = nullptr; + QGridLayout* solutionLayout = nullptr; + QLabel* originalLabel = nullptr; + QTextEdit* original = nullptr; + QLabel* currentLabel = nullptr; + QTextEdit* current = nullptr; void setupUi(QMainWindow *UserWindow); }; diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index af3d1f4..ce1adb9 100644 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -34,19 +34,37 @@ void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { taskLayout->addWidget(taskDescription); - filename = new QLabel(this); + filename = new QLabel(SolutionsWindow); - chooseFileButton = new QPushButton(this); + chooseFileButton = new QPushButton(SolutionsWindow); chooseFileButton->setText(QString::fromUtf8("Выберите файл")); - sendButton = new QPushButton(this); + sendButton = new QPushButton(SolutionsWindow); sendButton->setText(QString::fromUtf8("Отправить")); - result = new QTextEdit(this); + result = new QTextEdit(SolutionsWindow); result->setReadOnly(true); result->setText(QString::fromUtf8("Отправьте для принятия решения")); - backButton = new QPushButton(this); + solutionWidget = new QWidget(SolutionsWindow); + solutionLayout = new QGridLayout(solutionWidget); + + originalLabel = new QLabel(solutionWidget); + originalLabel->setText(QString::fromUtf8("Оригинальное решение")); + original = new QTextEdit(solutionWidget); + original->setReadOnly(true); + + currentLabel = new QLabel(solutionWidget); + currentLabel->setText(QString::fromUtf8("Ваше решение")); + current = new QTextEdit(solutionWidget); + current->setReadOnly(true); + + solutionLayout->addWidget(currentLabel, 0, 0); + solutionLayout->addWidget(originalLabel, 0, 1); + solutionLayout->addWidget(current, 1, 0); + solutionLayout->addWidget(original, 1, 1); + + backButton = new QPushButton(SolutionsWindow); backButton->setText(QString::fromUtf8("Назад")); verticalLayout->addWidget(taskBox); @@ -54,6 +72,7 @@ void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { verticalLayout->addWidget(chooseFileButton); verticalLayout->addWidget(sendButton); verticalLayout->addWidget(result); + verticalLayout->addWidget(solutionWidget); verticalLayout->addWidget(backButton); SolutionsWindow->setCentralWidget(centralwidget); @@ -75,8 +94,12 @@ void SolutionsWindow::on_sendButton_clicked() { QMessageBox::warning(this, "Ошибка отправки", "Файл должен быть указан"); return; } - Solution sol = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); + Solution sol; + Solution::Codes codes; + std::tie(sol, codes) = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); result->setText(QString::fromStdString(sol.result)); + original->setText(QString::fromUtf8(codes.original)); + current->setText(QString::fromUtf8(codes.current)); } diff --git a/client/internal/httpClient/include/HttpClientManager.h b/client/internal/httpClient/include/HttpClientManager.h index 2d15f7f..be95a33 100644 --- a/client/internal/httpClient/include/HttpClientManager.h +++ b/client/internal/httpClient/include/HttpClientManager.h @@ -19,7 +19,7 @@ public: std::pair loginUser(const std::string &login, const std::string &password); std::pair registerUser(const std::string &login, const std::string &username, const std::string &password); - Solution submitSolution(const int& user_id, const int &task_id, const std::string& filename, + std::pair submitSolution(const int& user_id, const int &task_id, const std::string& filename, const std::string &path_to_solution); unsigned int getAllSolutionsForTask(const int& user_id, const int& task_id); std::vector getAllTasks(); diff --git a/client/internal/httpClient/include/Serializer.h b/client/internal/httpClient/include/Serializer.h index ba742f2..a63ffd3 100644 --- a/client/internal/httpClient/include/Serializer.h +++ b/client/internal/httpClient/include/Serializer.h @@ -17,6 +17,7 @@ public: User deserialUserData(std::string_view body); Solution deserialSolutionData(std::string_view body); + std::pair deserialNewSolutionData(std::string_view body); std::vector deserialAllTasks(std::string_view body); }; diff --git a/client/internal/httpClient/src/HttpClientManager.cpp b/client/internal/httpClient/src/HttpClientManager.cpp index a8831c0..2f19087 100644 --- a/client/internal/httpClient/src/HttpClientManager.cpp +++ b/client/internal/httpClient/src/HttpClientManager.cpp @@ -43,7 +43,7 @@ std::pair HttpClientManager::registerUser(const std::string &log return {status, user}; } -Solution HttpClientManager::submitSolution(const int &user_id, const int &task_id, const std::string& filename, +std::pair HttpClientManager::submitSolution(const int &user_id, const int &task_id, const std::string& filename, const std::string &path_to_sound) { std::string body = serializer->serialSolutionData(user_id, task_id, filename, path_to_sound); http::response res = client->makeGetRequest("/solution/submit", body); @@ -54,8 +54,10 @@ Solution HttpClientManager::submitSolution(const int &user_id, const int &task_i auto* cbuf = boost::asio::buffer_cast(seq); res_body.append(cbuf, boost::asio::buffer_size(seq)); } - Solution sol = serializer->deserialSolutionData(res_body); - return sol; + Solution sol; + Solution::Codes codes; + std::tie(sol, codes) = serializer->deserialNewSolutionData(res_body); + return {sol, codes}; } unsigned int HttpClientManager::getAllSolutionsForTask(const int &user_id, const int &task_id) { diff --git a/client/internal/httpClient/src/Serializer.cpp b/client/internal/httpClient/src/Serializer.cpp index c2d803d..c4a505e 100644 --- a/client/internal/httpClient/src/Serializer.cpp +++ b/client/internal/httpClient/src/Serializer.cpp @@ -82,6 +82,23 @@ Solution Serializer::deserialSolutionData(std::string_view body) { return res; } +std::pair Serializer::deserialNewSolutionData(std::string_view body) { + std::stringstream ss; + ss << body; + boost::property_tree::ptree json; + boost::property_tree::read_json(ss, json); + Solution sol = { + json.get("sol_id"), + json.get("source"), + json.get("result"), + }; + Solution::Codes codes = { + json.get("original"), + json.get("your_code"), + }; + return {sol, codes}; +} + std::string Serializer::serialNewTaskData(std::string_view name, std::string_view desc, double threshold) { boost::property_tree::ptree json; json.put("name", name); diff --git a/server/internal/httpServer/include/Serializer.h b/server/internal/httpServer/include/Serializer.h index 9790ac5..35ab279 100644 --- a/server/internal/httpServer/include/Serializer.h +++ b/server/internal/httpServer/include/Serializer.h @@ -22,6 +22,7 @@ class Serializer { std::string serialAllTasks(const std::vector& tasks); std::string serialUserData(const User& user); std::string serialSolution(const Solution& sol); + std::string serialNewSolution(const Solution& sol, const Solution::Codes& codes); std::string serialTask(const Task& task); }; diff --git a/server/internal/httpServer/src/Serializer.cpp b/server/internal/httpServer/src/Serializer.cpp index 72085bc..dda60b1 100644 --- a/server/internal/httpServer/src/Serializer.cpp +++ b/server/internal/httpServer/src/Serializer.cpp @@ -116,6 +116,18 @@ std::string Serializer::serialSolution(const Solution &sol) { return out.str(); } +std::string Serializer::serialNewSolution(const Solution &sol, const Solution::Codes& codes) { + boost::property_tree::ptree json; + json.put("sol_id", sol.getId()); + json.put("source", sol.getSource()); + json.put("result", sol.getResult()); + json.put("your_code", codes.current); + json.put("original", codes.original); + std::stringstream out; + boost::property_tree::write_json(out, json); + return out.str(); +} + std::string Serializer::serialTask(const Task &task) { boost::property_tree::ptree json; json.put("name", task.getName()); diff --git a/server/internal/httpServer/src/SolutionManager.cpp b/server/internal/httpServer/src/SolutionManager.cpp index 3bd96df..3a6a1f5 100644 --- a/server/internal/httpServer/src/SolutionManager.cpp +++ b/server/internal/httpServer/src/SolutionManager.cpp @@ -24,13 +24,14 @@ http::message_generator SolutionManager::createSolution(http::requestcreateSolution(user_id, task_id, filename, filedata).first; + Solution sol; + Solution::Codes codes; + std::tie(sol, codes) = solutionService->createSolution(user_id, task_id, filename, filedata); http::response res{http::status::ok, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.keep_alive(req.keep_alive()); - res.body() = serializer->serialSolution(sol); - res.prepare_payload(); + res.body() = serializer->serialNewSolution(sol, codes); return res; } catch (const std::exception& e) { return getInternalServerError(req, e.what()); -- GitLab From 3d62f6910de8511d370b0ff7c5bfe47430d9cfa3 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 24 May 2023 11:44:24 +0300 Subject: [PATCH 116/134] fix some bugs --- server/cmd/main.cpp | 6 +- server/internal/metrics/src/DiffLibImpl.cpp | 29 +++++++-- .../internal/metrics/testProgs/cpp/code3.txt | 65 ++----------------- .../internal/metrics/testProgs/cpp/code4.txt | 45 +++---------- 4 files changed, 39 insertions(+), 106 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 92ccf8b..60d9fef 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -45,14 +45,10 @@ int main(int argc, const char* argv[]) { std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); - for (int i = 0; i < str_int_tokens1.size(); i++){ - std::cout << str_int_tokens1[i].first << " " << str_int_tokens1[i].second << std::endl; - } - //PythonAntlr pyA1 = PythonAntlr(fin3); //PythonAntlr pyA2 = PythonAntlr(fin4); - foundSame.setData2(str_int_tokens1, str_int_tokens2); + foundSame.setData2(str_int_tokens2, str_int_tokens1); // поменял местами токены на вводе std::pair res = foundSame.getTexts2(); std::vector tokens1 = cppA1.getTokensTypes(); diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index 7ecb00e..3a18d1c 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -173,8 +173,8 @@ std::pair FoundSame::getTexts2() { cases.push_back( {dist[i - 1][j - 1], {"C", r, h} } ); else cases.push_back({dist[i - 1][j - 1] + 1, {"R", r, h}}); - cases.push_back( { dist[i][j-1] + 1, {"D", r, {"#", h.second} } } ); - cases.push_back( { dist[i-1][j] + 1, {"I", {"%", r.second}, h} } ); + cases.push_back( { dist[i][j-1] + 1, {"D", r, {"#", r.second} } } ); + cases.push_back( { dist[i-1][j] + 1, {"I", {"%", h.second}, h} } ); dist[i][j] = cases[0].first; cache[i][j] = cases[0].second; @@ -192,6 +192,14 @@ std::pair FoundSame::getTexts2() { size_t i = n, j = m; while (i != 0 || j != 0){ std::string op = cache[i][j].op; + auto temp = cache[i][j]; + if (temp.token1.second > temp.token2.second) { + temp.token2.second = temp.token1.second; + } + else{ + temp.token1.second = temp.token2.second; + } + cache[i][j] = temp; alignment.push_back(cache[i][j]); if (op == "C" || op == "R"){ i--, j--; @@ -203,6 +211,11 @@ std::pair FoundSame::getTexts2() { } std::reverse(alignment.begin(), alignment.end()); + for (auto & a : alignment){ + std::cout << a.op << " {" << a.token1.first << " " << a.token1.second << "} {" + << a.token2.first << " " << a.token2.second << "}" << std::endl; + } + res_alignment2 = alignment; tokens2text2(); @@ -217,8 +230,10 @@ void FoundSame::tokens2text2() { for (auto & i : res_alignment2){ if (i.token1.second > line){ - res1 += '\n'; - line = i.token1.second; + while(line != i.token1.second){ + res1 += '\n'; + line++; + } } res1 += i.token1.first, res1 += " "; } @@ -231,8 +246,10 @@ void FoundSame::tokens2text2() { res2 += op, res2 += " "; } ops.clear(); - res2 += '\n'; - line = i.token2.second; + while(line < i.token2.second){ + res2+= '\n'; + line++; + } } ops.push_back(i.op); res2 += i.token2.first, res2 += " "; diff --git a/server/internal/metrics/testProgs/cpp/code3.txt b/server/internal/metrics/testProgs/cpp/code3.txt index 4ae8f50..81966bf 100644 --- a/server/internal/metrics/testProgs/cpp/code3.txt +++ b/server/internal/metrics/testProgs/cpp/code3.txt @@ -1,65 +1,12 @@ #include -#include using namespace std; -bool check1(vector s1, int i, int j){ - for (int k = 0; k < s1.size(); k++){ - if (s1[k] != i && s1[k] != j && s1[k] % i == 0 && j % s1[k] == 0){ - return 0; - } +int main() { + int a = 0, n; + cin >> n; + for (int i = 0; i < n; i++){ + a++; + cout << a; } - if (i % 2 == 0) { - i+=1; - i-=1; - } - return 1; -} - -int main(){ - long long n1; - cin >> n1; - vector s2; - for (int k = 1; k <= n1; k++){ - if (n1 % k == 0){ - s2.push_back(k); - } - } - - if (n % 2 == 0) { - n+=1; - n-=1; - } - - vector > ans; - for (int i = 0; i < s2.size(); i++){ - if (n % 2 == 0) { - n+=1; - n-=1; - } - } - for (int j = i + 1; j < s2.size(); j++){ - if (s2[j] % s2[i] == 0 && check1(s2, s2[i], s2[j])){ - ans.push_back({s[i], s[j]}); - } - if (n % 2 == 0) { - n+=1; - n-=1; - } - } - } - cout << "graph {"; - cout << '\n'; - for (int k = 0; k < s2.size(); k++){ - cout << s[k] << endl; - } - if (n % 2 == 0) { - n+=1; - n-=1; - } - for (int i = 0; i < ans.size(); i++){ - cout << ans[i].first << "--" << ans[i].second << endl; - } - cout << "}"; - cout << '\n'; } \ No newline at end of file diff --git a/server/internal/metrics/testProgs/cpp/code4.txt b/server/internal/metrics/testProgs/cpp/code4.txt index 844d2cd..ada154e 100644 --- a/server/internal/metrics/testProgs/cpp/code4.txt +++ b/server/internal/metrics/testProgs/cpp/code4.txt @@ -1,45 +1,18 @@ #include -#include -#include -#include -using namespace std; -const int inf = 1e9; +using namespace std; int main() { - int n, s, f; - cin >> n >> s >> f; - s--; f--; - vector d(n, inf), p(n); - vector u(n); - vector < vector > > g(n); - for (int i = 0; i < n; i++) { - for (int j = 0; j < n; j++) { - int q; - scanf("%d", &q); - if (i > 0) { + int a = 0, n; + cin >> n; - } - } + if (n > 0 || n <= 0){ + n++; + n--; } - d[s] = 0; - for (int i = 0; i < n; ++i) { - int v = -1; - for (int j = 0; j < n; ++j) - if (!u[j] && (v == -1 || d[j] < d[v])) - v = j; - if (d[v] == inf) break; - u[v] = true; - for (auto j : g[v]) { - int to = j.first; - int len = j.second; - if (d[v] + len < d[to]) { - d[to] = d[v] + len; - p[to] = v; - } - } + for (int i = 0; i < n; i++){ + a++; + cout << a; } - cout << (d[f] == inf ? -1 : d[f]) << endl; - return 0; } \ No newline at end of file -- GitLab From 8beb808fda522ee2c90fab267c2fdc0e8b83df11 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 24 May 2023 12:54:43 +0300 Subject: [PATCH 117/134] add output formats --- server/cmd/main.cpp | 9 ++++ server/internal/metrics/include/DiffLib.h | 2 +- server/internal/metrics/src/DiffLibImpl.cpp | 8 +-- .../metrics/testProgs/output/out1.txt | 49 +++++++++++++++++++ .../metrics/testProgs/output/out2.txt | 49 +++++++++++++++++++ 5 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 server/internal/metrics/testProgs/output/out1.txt create mode 100644 server/internal/metrics/testProgs/output/out2.txt diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 60d9fef..60a89c6 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -51,6 +51,15 @@ int main(int argc, const char* argv[]) { foundSame.setData2(str_int_tokens2, str_int_tokens1); // поменял местами токены на вводе std::pair res = foundSame.getTexts2(); + std::ofstream out1("internal/metrics/testProgs/output/out1.txt"); + std::ofstream out2("internal/metrics/testProgs/output/out2.txt"); + + out1 << res.first; + out2 << res.second; + + out1.close(); + out2.close(); + std::vector tokens1 = cppA1.getTokensTypes(); std::vector tokens2 = cppA2.getTokensTypes(); diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index 7ed5bef..cea6dce 100644 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -18,7 +18,7 @@ public: void setData(std::string text1, std::string text2); void setData2(std::vector > _tokens1, std::vector > _tokens2); void tokens2text(); - void tokens2text2(); + std::pair tokens2text2(); [[maybe_unused]] std::pair getTexts(); [[maybe_unused]] std::pair getTexts2(); diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index 3a18d1c..a1d326f 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -217,12 +217,12 @@ std::pair FoundSame::getTexts2() { } res_alignment2 = alignment; - tokens2text2(); - return {"", ""}; + + return tokens2text2(); } -void FoundSame::tokens2text2() { +std::pair FoundSame::tokens2text2() { std::string res1, res2; std::vector ops; @@ -257,7 +257,7 @@ void FoundSame::tokens2text2() { res1.pop_back(), res2.pop_back(); - std::cout << res1 << "\n\n" << res2 << std::endl; + return {res1, res2}; } diff --git a/server/internal/metrics/testProgs/output/out1.txt b/server/internal/metrics/testProgs/output/out1.txt new file mode 100644 index 0000000..d506e6c --- /dev/null +++ b/server/internal/metrics/testProgs/output/out1.txt @@ -0,0 +1,49 @@ +#include +#include + +using namespace std ; + +bool check ( vector < int > s , int i , int j ) { +for ( int k = 0 ; k < s . size ( ) ; k ++ ) { +if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { +return 0 ; +} +} +return 1 ; +} + +int main ( ) { +long long n ; +cin > > n ; +vector < int > s ; +for ( int i = 1 ; i <= n ; i ++ ) { +if ( n % i == 0 ) { +s . push_back ( i ) ; +% +} + +% % % % % % % % % +% % % % +% % % % +} + +vector < pair < int , int > > ans ; +for ( int i = 0 ; i < s . size ( ) ; i ++ ) { +for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) { +if ( s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) { +ans . push_back ( { s [ i ] , s [ j ] } ) ; +} +} +} +cout < < "graph {" % +% < < endl ; +for ( int i = 0 ; i < s . size ( ) ; i ++ ) { +cout < < s [ i ] < < endl ; +} + +for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { +cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; +} +cout < < "}" % +% % % % ; +} \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt new file mode 100644 index 0000000..e152371 --- /dev/null +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -0,0 +1,49 @@ +#include C +#include C + +using namespace std ; C C C C + +bool check1 ( vector < int > s , int i , int j ) { C R C C C C C C C C C C C C C C +for ( int k = 0 ; k < s . size ( ) ; k ++ ) { C C C C C C C C C C C C C C C C C C C +if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C +return 0 ; C C C +} C +} C +return 1 ; C C C +} C + +int main ( ) { C C C C C +long long n1 ; C C R C +cin > > n1 ; C C C R C +vector < int > s2 ; C C C C R C +for ( int k = 1 ; k <= n1 ; k ++ ) { C C C R C C C R C R C R C C C +if ( n1 % k == 0 ) { C C R C R C C C C +s2 . push_back ( k ) ; R C C C R C C +} I +} C + +if ( n % 2 == 0 ) { I I I I I I I I I +n += 1 ; I I I I +n -= 1 ; I I I I +} C + +vector < pair < int , int > > ans ; C C C C C C C C C C C +for ( int i = 0 ; i < s2 . size ( ) ; i ++ ) { C C C C C C C C C R C C C C C C C C C +for ( int j = i + 1 ; j < s2 . size ( ) ; j ++ ) { C C C C C C C C C C C R C C C C C C C C C +if ( s2 [ j ] % s2 [ i ] == 0 && check1 ( s2 , s2 [ i ] , s2 [ j ] ) ) { C C R C C C C R C C C C C C R C R C R C C C C R C C C C C C +ans . push_back ( { s [ i ] , s [ j ] } ) ; C C C C C C C C C C C C C C C C C +} C +} C +} C +cout < < "graph {" ; C C C C I +cout < < '\n' ; I C C R C +for ( int k = 0 ; k < s2 . size ( ) ; k ++ ) { C C C R C C C R C R C C C C C R C C C +cout < < s [ k ] < < endl ; C C C C C R C C C C C +} C + +for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { C C C C C C C C C C C C C C C C C C C +cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; C C C C C C C C C C C C C C C C C C C C C C C C +} C +cout < < "}" ; C C C C I +cout < < '\n' ; I I I I C +} \ No newline at end of file -- GitLab From bd83378a7ae487885007e5098fdd7b923562204f Mon Sep 17 00:00:00 2001 From: marcheanin Date: Wed, 24 May 2023 13:18:32 +0300 Subject: [PATCH 118/134] add some reducing and method --- server/internal/metrics/include/DiffLib.h | 1 + server/internal/metrics/src/DiffLibImpl.cpp | 22 ++++++-- .../metrics/testProgs/output/out2.txt | 52 +++++++++---------- 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index cea6dce..7062497 100644 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -45,6 +45,7 @@ private: static std::vector diffTokenizer(const std::string& text); static std::string delServSimbols(std::string s); + static void outOps (std::vector ops, std::string& str); }; #endif //SOURCEDOUT_DIFFLIB_H diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index a1d326f..bc7dd15 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -242,9 +242,7 @@ std::pair FoundSame::tokens2text2() { for (auto & i : res_alignment2){ if (i.token2.second > line){ res2 += '\t'; - for (auto & op : ops){ - res2 += op, res2 += " "; - } + outOps(ops, res2); ops.clear(); while(line < i.token2.second){ res2+= '\n'; @@ -260,4 +258,22 @@ std::pair FoundSame::tokens2text2() { return {res1, res2}; } +void FoundSame::outOps(std::vector ops, std::string& str) { + if (ops.empty()) return; + std::string o = ops[0]; + int f = 0; + for (auto & op : ops){ + if (op != o){ + f = 1; + break; + } + } + if (f == 0) + str += "[" + o + "]"; + else + for (auto & op : ops){ + str += op, str += " "; + } +} + diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt index e152371..6de4966 100644 --- a/server/internal/metrics/testProgs/output/out2.txt +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -1,49 +1,49 @@ -#include C -#include C +#include [C] +#include [C] -using namespace std ; C C C C +using namespace std ; [C] bool check1 ( vector < int > s , int i , int j ) { C R C C C C C C C C C C C C C C -for ( int k = 0 ; k < s . size ( ) ; k ++ ) { C C C C C C C C C C C C C C C C C C C -if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C -return 0 ; C C C -} C -} C -return 1 ; C C C -} C +for ( int k = 0 ; k < s . size ( ) ; k ++ ) { [C] +if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { [C] +return 0 ; [C] +} [C] +} [C] +return 1 ; [C] +} [C] -int main ( ) { C C C C C +int main ( ) { [C] long long n1 ; C C R C cin > > n1 ; C C C R C vector < int > s2 ; C C C C R C for ( int k = 1 ; k <= n1 ; k ++ ) { C C C R C C C R C R C R C C C if ( n1 % k == 0 ) { C C R C R C C C C s2 . push_back ( k ) ; R C C C R C C -} I -} C +} [I] +} [C] -if ( n % 2 == 0 ) { I I I I I I I I I -n += 1 ; I I I I -n -= 1 ; I I I I -} C +if ( n % 2 == 0 ) { [I] +n += 1 ; [I] +n -= 1 ; [I] +} [C] -vector < pair < int , int > > ans ; C C C C C C C C C C C +vector < pair < int , int > > ans ; [C] for ( int i = 0 ; i < s2 . size ( ) ; i ++ ) { C C C C C C C C C R C C C C C C C C C for ( int j = i + 1 ; j < s2 . size ( ) ; j ++ ) { C C C C C C C C C C C R C C C C C C C C C if ( s2 [ j ] % s2 [ i ] == 0 && check1 ( s2 , s2 [ i ] , s2 [ j ] ) ) { C C R C C C C R C C C C C C R C R C R C C C C R C C C C C C -ans . push_back ( { s [ i ] , s [ j ] } ) ; C C C C C C C C C C C C C C C C C -} C -} C -} C +ans . push_back ( { s [ i ] , s [ j ] } ) ; [C] +} [C] +} [C] +} [C] cout < < "graph {" ; C C C C I cout < < '\n' ; I C C R C for ( int k = 0 ; k < s2 . size ( ) ; k ++ ) { C C C R C C C R C R C C C C C R C C C cout < < s [ k ] < < endl ; C C C C C R C C C C C -} C +} [C] -for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { C C C C C C C C C C C C C C C C C C C -cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; C C C C C C C C C C C C C C C C C C C C C C C C -} C +for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { [C] +cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; [C] +} [C] cout < < "}" ; C C C C I cout < < '\n' ; I I I I C } \ No newline at end of file -- GitLab From 469b1adb8aa58d0f753f501dec93af42f8564bbc Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 25 May 2023 03:05:15 +0300 Subject: [PATCH 119/134] add tokens to html and colors highliting --- server/cmd/main.cpp | 62 +---- server/internal/metrics/include/DiffLib.h | 22 +- server/internal/metrics/src/DiffLibImpl.cpp | 241 +++++++----------- .../internal/metrics/testProgs/cpp/code4.txt | 45 +++- .../metrics/testProgs/output/out1.txt | 97 ++++--- .../metrics/testProgs/output/out2.txt | 97 ++++--- .../metrics/testProgs/output/test1.html | 50 ++++ .../metrics/testProgs/output/test2.html | 52 ++++ 8 files changed, 332 insertions(+), 334 deletions(-) create mode 100644 server/internal/metrics/testProgs/output/test1.html create mode 100644 server/internal/metrics/testProgs/output/test2.html diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 60a89c6..e277c3a 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -7,49 +7,23 @@ #include "DiffLib.h" int main(int argc, const char* argv[]) { - // ifstream ins("/home/denis/2023_1_DDT/antlr/test.py"); - std::ifstream fin1("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin2("internal/metrics/testProgs/cpp/code2.txt"); - - - std::string text1( (std::istreambuf_iterator(fin1) ), - (std::istreambuf_iterator() ) ); - - std::string text2( (std::istreambuf_iterator(fin2) ), - (std::istreambuf_iterator() ) ); - - LevDistTextMetric livDistTextMetric; - JaccardTextMetric jaccardTextMetric; - - livDistTextMetric.setData(text1, text2); - jaccardTextMetric.setData(text1, text2); - - std::cout << livDistTextMetric.getMetric() << std::endl << jaccardTextMetric.getMetric() << std::endl; - FoundSame foundSame; - foundSame.setData(text1, text2); - // std::pair res = foundSame.getTexts(); - - fin1.close(); - fin2.close(); std::ifstream fin3("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin4("internal/metrics/testProgs/cpp/code2.txt"); + std::ifstream fin4("internal/metrics/testProgs/cpp/code4.txt"); + + //PythonAntlr pyA1 = PythonAntlr(fin3); + //PythonAntlr pyA2 = PythonAntlr(fin4); MyCppAntlr cppA1 = MyCppAntlr(fin3); MyCppAntlr cppA2 = MyCppAntlr(fin4); - // std::vector str_tokens1 = cppA1.getTokensNames(); - // std::vector str_tokens2 = cppA2.getTokensNames(); - std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); - //PythonAntlr pyA1 = PythonAntlr(fin3); - //PythonAntlr pyA2 = PythonAntlr(fin4); - foundSame.setData2(str_int_tokens2, str_int_tokens1); // поменял местами токены на вводе - std::pair res = foundSame.getTexts2(); + foundSame.setData(str_int_tokens1, str_int_tokens2); + std::pair res = foundSame.getTexts(); std::ofstream out1("internal/metrics/testProgs/output/out1.txt"); std::ofstream out2("internal/metrics/testProgs/output/out2.txt"); @@ -59,30 +33,6 @@ int main(int argc, const char* argv[]) { out1.close(); out2.close(); - - std::vector tokens1 = cppA1.getTokensTypes(); - std::vector tokens2 = cppA2.getTokensTypes(); - - - -// LevDistTokenMetric lev; -// WShinglingTokenMetric wsh; -// lev.setData(tokens1, tokens2); -// wsh.setData(tokens1, tokens2); -// -// std::cout << "Tokens1:" << std::endl; -// for (int token : tokens1) { -// std::cout << token << " "; -// } -// std::cout << std::endl; -// -// std::cout << "Tokens2:" << std::endl; -// for (int token : tokens2) { -// std::cout << token << " "; -// } -// std::cout << std::endl; -// -// std::cout << lev.getMetric() << std::endl << wsh.getMetric() << std::endl; fin3.close(); fin4.close(); return 0; diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index 7062497..e1cf023 100644 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -15,36 +15,22 @@ class FoundSame { public: - void setData(std::string text1, std::string text2); - void setData2(std::vector > _tokens1, std::vector > _tokens2); - void tokens2text(); - std::pair tokens2text2(); + void setData(std::vector > _tokens1, std::vector > _tokens2); [[maybe_unused]] std::pair getTexts(); - [[maybe_unused]] std::pair getTexts2(); private: - struct Elem { - std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace - std::string token1; - std::string token2; - }; - struct Elem2 { std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace std::pair token1; std::pair token2; }; - std::vector tokens1; - std::vector tokens2; - std::vector res_alignment; - std::vector > str_int_tokens1; std::vector > str_int_tokens2; - std::vector res_alignment2; + std::vector res_alignment; - static std::vector diffTokenizer(const std::string& text); - static std::string delServSimbols(std::string s); + std::pair tokens2text(); + std::pair tokens2html(); static void outOps (std::vector ops, std::string& str); }; diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index bc7dd15..c65ebef 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -5,142 +5,12 @@ #include "DiffLib.h" -void FoundSame::setData(std::string text1, std::string text2) { - tokens1 = diffTokenizer(text1); - tokens2 = diffTokenizer(text2); -} - -void FoundSame::setData2(std::vector > _tokens1, std::vector > _tokens2) { - str_int_tokens1 = std::move(_tokens1); - str_int_tokens2 = std::move(_tokens2); -} - -std::vector FoundSame::diffTokenizer(const std::string& text) { - boost::char_separator sep(" \r", "\n"); - std::vector res; - boost::tokenizer < boost::char_separator > tokens(text, sep); - - for (const std::string &s: tokens) { - if (s == "\n" && !res.empty()){ - res.back() += "\n"; - } - else - res.push_back(s); - } - return res; +void FoundSame::setData(std::vector > _tokens1, std::vector > _tokens2) { + str_int_tokens1 = std::move(_tokens2); + str_int_tokens2 = std::move(_tokens1); } std::pair FoundSame::getTexts() { - unsigned long n = tokens1.size(); - unsigned long m = tokens2.size(); - - std::vector > dist (n + 1, std::vector (m + 1, 0)); - - for (size_t i = 0; i < n + 1; i++){ - dist[i][0] = static_cast (i); - } - - for (size_t i = 0; i < m + 1; i++){ - dist[0][i] = static_cast (i); - } - - std::vector > cache (n + 1, std::vector (m + 1)); - - for (size_t i = 1; i <= n; i++){ - cache[i][0] = {"I", (tokens1[i-1].back() == '\n' && tokens1[i-1].size() > 1 ? "%\n" : "%"), tokens1[i-1]}; - } - for (size_t i = 1; i <= m; i++){ - cache[0][i] = {"D", tokens2[i-1], (tokens2[i-1].back() == '\n' && tokens1[i-1].size() > 1 ? "#\n" : "#")}; - } - - std::string r, h; - for (size_t i = 1; i <= n; i++){ - for (size_t j = 1; j <= m; j++){ - h = tokens1[i-1], r = tokens2[j-1]; - std::vector > cases; - - if (delServSimbols(r) == delServSimbols(h)) - cases.push_back( {dist[i - 1][j - 1], {"C", r, h} } ); - else - cases.push_back({dist[i - 1][j - 1] + 1, {"R", r, h}}); - cases.push_back( { dist[i][j-1] + 1, {"D", r, (r.back() == '\n' && r.size() > 1 ? "#\n" : "#")} } ); - cases.push_back( { dist[i-1][j] + 1, {"I", (h.back() == '\n' && h.size() > 1 ? "%\n" : "%"), h} } ); - - dist[i][j] = cases[0].first; - cache[i][j] = cases[0].second; - - for (size_t k = 1; k < cases.size(); k++){ - if (dist[i][j] > cases[k].first){ - dist[i][j] = cases[k].first; - cache[i][j] = cases[k].second; - } - } - } - } - - std::vector alignment; - size_t i = n, j = m; - while (i != 0 || j != 0){ - std::string op = cache[i][j].op; - alignment.push_back(cache[i][j]); - if (op == "C" || op == "R"){ - i--, j--; - } else if (op == "I"){ - i--; - } else{ - j--; - } - } - std::reverse(alignment.begin(), alignment.end()); - - res_alignment = alignment; - tokens2text(); - - return {"", ""}; -} - -void FoundSame::tokens2text() { - - std::vector ops; - - for (auto & k : res_alignment){ - std::cout << k.op << " " << k.token1 << " " << k.token2 << std::endl; - } - - for (const auto& elem : res_alignment){ - std::cout << elem.token1; - if (elem.token1.back() != '\n') - std::cout << " "; - } - std::cout << std::endl; - for (const auto &elem : res_alignment){ - ops.push_back(elem.op); - if (elem.token2.back() == '\n') { - std::string t_token = elem.token2; - t_token.pop_back(); - std::cout << t_token << "\t"; - for (const auto& oper : ops) - std::cout << oper << " "; - std::cout << std::endl; - ops.clear(); - } - else{ - std::cout << elem.token2; - if (elem.token2.back() != '\n') - std::cout << " "; - } - } -} - -std::string FoundSame::delServSimbols(std::string s) { - std::string res = std::move(s); - while(!res.empty() && res.back() == '\n'){ - res.pop_back(); - } - return res; -} - -std::pair FoundSame::getTexts2() { unsigned long n = str_int_tokens1.size(); unsigned long m = str_int_tokens2.size(); @@ -193,12 +63,12 @@ std::pair FoundSame::getTexts2() { while (i != 0 || j != 0){ std::string op = cache[i][j].op; auto temp = cache[i][j]; - if (temp.token1.second > temp.token2.second) { - temp.token2.second = temp.token1.second; - } - else{ - temp.token1.second = temp.token2.second; - } +// if (temp.token1.second > temp.token2.second) { +// temp.token2.second = temp.token1.second; +// } +// else{ +// temp.token1.second = temp.token2.second; +// } cache[i][j] = temp; alignment.push_back(cache[i][j]); if (op == "C" || op == "R"){ @@ -211,24 +81,18 @@ std::pair FoundSame::getTexts2() { } std::reverse(alignment.begin(), alignment.end()); - for (auto & a : alignment){ - std::cout << a.op << " {" << a.token1.first << " " << a.token1.second << "} {" - << a.token2.first << " " << a.token2.second << "}" << std::endl; - } - - res_alignment2 = alignment; - + res_alignment = alignment; - return tokens2text2(); + return tokens2html(); } -std::pair FoundSame::tokens2text2() { +std::pair FoundSame::tokens2text() { std::string res1, res2; std::vector ops; - int line = res_alignment2[0].token1.second; + int line = res_alignment[0].token1.second; - for (auto & i : res_alignment2){ + for (auto & i : res_alignment){ if (i.token1.second > line){ while(line != i.token1.second){ res1 += '\n'; @@ -238,11 +102,11 @@ std::pair FoundSame::tokens2text2() { res1 += i.token1.first, res1 += " "; } - line = res_alignment2[0].token2.second; - for (auto & i : res_alignment2){ + line = res_alignment[0].token2.second; + for (auto & i : res_alignment){ if (i.token2.second > line){ res2 += '\t'; - outOps(ops, res2); + //outOps(ops, res2); ops.clear(); while(line < i.token2.second){ res2+= '\n'; @@ -276,4 +140,75 @@ void FoundSame::outOps(std::vector ops, std::string& str) { } } +std::pair FoundSame::tokens2html() { + + std::string teg_I = ""; + std::string teg_D = ""; + std::string teg_C = ""; + std::string teg_R = ""; + std::string close_teg = ""; + + for (auto & i : res_alignment){ + + size_t pos; + while ((pos = i.token1.first.find("<")) != std::string::npos) { + i.token1.first.replace(pos, 1, "<"); + } + while ((pos = i.token1.first.find(">")) != std::string::npos) { + i.token1.first.replace(pos, 1, ">"); + } + + while ((pos = i.token2.first.find("<")) != std::string::npos) { + i.token2.first.replace(pos, 1, "<"); + } + while ((pos = i.token2.first.find(">")) != std::string::npos) { + i.token2.first.replace(pos, 1, ">"); + } + } + + std::string res1 = "\n" + "\n" + "
"; + std::string res2 = res1; + std::vector ops; + + int line = res_alignment[0].token1.second; + + for (auto & i : res_alignment){ + if (i.token1.second > line){ + while(line != i.token1.second){ + res1 += "
"; + res1 += '\n'; + line++; + } + } + res1 += i.token1.first, res1 += " "; + } + + line = res_alignment[0].token2.second; + for (auto & i : res_alignment){ + if (i.token2.second > line){ + while(line < i.token2.second){ + res2 += "
"; + res2+= '\n'; + line++; + } + } + if (i.op == "I") res2 += teg_I; + if (i.op == "D") res2 += teg_D; + if (i.op == "C") res2 += teg_C; + if (i.op == "R") res2 += teg_R; + res2 += i.token2.first; + res2 += " "; + res2 += close_teg; + } + + res1 += "
\n" + ""; + res2 += "
\n" + ""; + + return {res1, res2}; +} + diff --git a/server/internal/metrics/testProgs/cpp/code4.txt b/server/internal/metrics/testProgs/cpp/code4.txt index ada154e..844d2cd 100644 --- a/server/internal/metrics/testProgs/cpp/code4.txt +++ b/server/internal/metrics/testProgs/cpp/code4.txt @@ -1,18 +1,45 @@ #include - +#include +#include +#include using namespace std; +const int inf = 1e9; + int main() { - int a = 0, n; - cin >> n; + int n, s, f; + cin >> n >> s >> f; + s--; f--; + vector d(n, inf), p(n); + vector u(n); + vector < vector > > g(n); + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { + int q; + scanf("%d", &q); + if (i > 0) { - if (n > 0 || n <= 0){ - n++; - n--; + } + } } + d[s] = 0; + for (int i = 0; i < n; ++i) { + int v = -1; + for (int j = 0; j < n; ++j) + if (!u[j] && (v == -1 || d[j] < d[v])) + v = j; + if (d[v] == inf) break; + u[v] = true; + for (auto j : g[v]) { + int to = j.first; + int len = j.second; + if (d[v] + len < d[to]) { + d[to] = d[v] + len; + p[to] = v; + } + } - for (int i = 0; i < n; i++){ - a++; - cout << a; } + cout << (d[f] == inf ? -1 : d[f]) << endl; + return 0; } \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out1.txt b/server/internal/metrics/testProgs/output/out1.txt index d506e6c..823d512 100644 --- a/server/internal/metrics/testProgs/output/out1.txt +++ b/server/internal/metrics/testProgs/output/out1.txt @@ -1,49 +1,48 @@ -#include -#include - -using namespace std ; - -bool check ( vector < int > s , int i , int j ) { -for ( int k = 0 ; k < s . size ( ) ; k ++ ) { -if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { -return 0 ; -} -} -return 1 ; -} - -int main ( ) { -long long n ; -cin > > n ; -vector < int > s ; -for ( int i = 1 ; i <= n ; i ++ ) { -if ( n % i == 0 ) { -s . push_back ( i ) ; -% -} - -% % % % % % % % % -% % % % -% % % % -} - -vector < pair < int , int > > ans ; -for ( int i = 0 ; i < s . size ( ) ; i ++ ) { -for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) { -if ( s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) { -ans . push_back ( { s [ i ] , s [ j ] } ) ; -} -} -} -cout < < "graph {" % -% < < endl ; -for ( int i = 0 ; i < s . size ( ) ; i ++ ) { -cout < < s [ i ] < < endl ; -} - -for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { -cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; -} -cout < < "}" % -% % % % ; -} \ No newline at end of file + + +
#include <iostream>
+#include <vector>
+%
+%
+using namespace std ;
+bool check ( vector < int >
+
+
+s , int i ,
+int j ) { for ( int
+k = 0 ; k < s . size ( ) ; k
+++ ) { if ( s
+[ k ] != i && s [ k ] != j && s [ k
+] % i == 0 && j % s
+[ k ] == 0 ) { return 0 ; } } return 1 ; } int
+main ( ) { long long n ;
+cin > > n ;
+vector < int > s ;
+for ( int i = 1 ; i <= n ; i ++ ) {
+if ( n % i == 0 ) {
+s . push_back ( i % % ) ;
+}
+}
+vector < pair <
+int , int > > ans ;
+for ( int i = 0 ; i < s . size ( ) %
+% ; i ++ ) {
+for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+if ( % s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) )
+{ ans . push_back
+( { s [ i ] % % % % ,
+s [ j ] } ) ;
+} } } cout < < "graph {" < < endl ;
+for ( int i = 0 ;
+% i < s . size (
+) ; i ++ ) { cout < < s [ i ] < <
+endl ; } for ( int i = 0 ; i <
+ans . size ( ) ; i
+++
+)
+
+{
+cout < < % ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; } cout <
+< "}" ;
+} <EOF>
+ \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt index 6de4966..3b1cef2 100644 --- a/server/internal/metrics/testProgs/output/out2.txt +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -1,49 +1,48 @@ -#include [C] -#include [C] - -using namespace std ; [C] - -bool check1 ( vector < int > s , int i , int j ) { C R C C C C C C C C C C C C C C -for ( int k = 0 ; k < s . size ( ) ; k ++ ) { [C] -if ( s [ k ] != i && s [ k ] != j && s [ k ] % i == 0 && j % s [ k ] == 0 ) { [C] -return 0 ; [C] -} [C] -} [C] -return 1 ; [C] -} [C] - -int main ( ) { [C] -long long n1 ; C C R C -cin > > n1 ; C C C R C -vector < int > s2 ; C C C C R C -for ( int k = 1 ; k <= n1 ; k ++ ) { C C C R C C C R C R C R C C C -if ( n1 % k == 0 ) { C C R C R C C C C -s2 . push_back ( k ) ; R C C C R C C -} [I] -} [C] - -if ( n % 2 == 0 ) { [I] -n += 1 ; [I] -n -= 1 ; [I] -} [C] - -vector < pair < int , int > > ans ; [C] -for ( int i = 0 ; i < s2 . size ( ) ; i ++ ) { C C C C C C C C C R C C C C C C C C C -for ( int j = i + 1 ; j < s2 . size ( ) ; j ++ ) { C C C C C C C C C C C R C C C C C C C C C -if ( s2 [ j ] % s2 [ i ] == 0 && check1 ( s2 , s2 [ i ] , s2 [ j ] ) ) { C C R C C C C R C C C C C C R C R C R C C C C R C C C C C C -ans . push_back ( { s [ i ] , s [ j ] } ) ; [C] -} [C] -} [C] -} [C] -cout < < "graph {" ; C C C C I -cout < < '\n' ; I C C R C -for ( int k = 0 ; k < s2 . size ( ) ; k ++ ) { C C C R C C C R C R C C C C C R C C C -cout < < s [ k ] < < endl ; C C C C C R C C C C C -} [C] - -for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { [C] -cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; [C] -} [C] -cout < < "}" ; C C C C I -cout < < '\n' ; I I I I C -} \ No newline at end of file + + +
#include <iostream>
+#include <vector>
+#include<algorithm>
+#include<cmath>
+using namespace std ;
+# const int inf = 1e9 ;
+
+
+int main ( ) {
+int n , s , f ;
+cin > > n > > s # > > f ; #
+s -- ; f -- ;
+vector < int > d ( n , inf ) , p ( n ) ;
+vector < int > u ( n ) ;
+vector < vector < pair < int , int > > > g ( n ) ;
+for ( # int i = 0 ;
+# i < n ;
+# # i ++ ) {
+for ( int j = 0 ; j < n ; j ++ ) {
+int q ; scanf ( "%d" , & q
+) ; if ( i > 0 ) {
+}
+}
+# # # }
+d [ s ] = 0 ;
+for ( int i = 0 ; i < n ; ++ i ) {
+int v = - 1 ;
+for ( int j = # # 0 ; j < # # # # n ; # ++ j )
+if ( ! u [ j ] # # && ( v == # # # - 1 || d [ j ] < d [ v ] ) )
+v = j ;
+if ( d [ v ] == inf ) break ;
+u [ v ] = true ;
+for ( auto j : g [ v ] ) {
+int to = j . first ;
+int len = j . second ;
+if ( d [ v ] + len < d [ to ] ) {
+d [ to ] = d [ v ] + len ;
+p [ to ] = v ;
+}
+}
+
+}
+cout < < ( d [ f ] # == inf ? - 1 : d [ f ] # ) < < endl ; # # #
+return 0 ;
+} <EOF>
+ \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test1.html b/server/internal/metrics/testProgs/output/test1.html new file mode 100644 index 0000000..39f17df --- /dev/null +++ b/server/internal/metrics/testProgs/output/test1.html @@ -0,0 +1,50 @@ + + +
#include <iostream> +
+ #include <vector> +
+ %
+ %
+ using namespace std ;
+ bool check ( vector < int >
+
+
+ s , int i ,
+ int j ) { for ( int
+ k = 0 ; k < s . size ( ) ; k
+ ++ ) { if ( s
+ [ k ] != i && s [ k ] != j && s [ k
+ ] % i == 0 && j % s
+ [ k ] == 0 ) { return 0 ; } } return 1 ; } int
+ main ( ) { long long n ;
+ cin > > n ;
+ vector < int > s ;
+ for ( int i = 1 ; i <= n ; i ++ ) {
+ if ( n % i == 0 ) {
+ s . push_back ( i % % ) ;
+ }
+ }
+ vector < pair <
+ int , int > > ans ;
+ for ( int i = 0 ; i < s . size ( ) %
+ % ; i ++ ) {
+ for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+ if ( % s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) )
+ { ans . push_back
+ ( { s [ i ] % % % % ,
+ s [ j ] } ) ;
+ } } } cout < < "graph {" < < endl ;
+ for ( int i = 0 ;
+ % i < s . size (
+ ) ; i ++ ) { cout < < s [ i ] < <
+ endl ; } for ( int i = 0 ; i <
+ ans . size ( ) ; i
+ ++
+ )
+
+ {
+ cout < < % ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; } cout <
+ < "}" ;
+ } <EOF>
+ \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test2.html b/server/internal/metrics/testProgs/output/test2.html new file mode 100644 index 0000000..e1e272c --- /dev/null +++ b/server/internal/metrics/testProgs/output/test2.html @@ -0,0 +1,52 @@ + + +
#include <iostream> +
+ #include <vector> +
+ #include<algorithm> +
+ #include<cmath> +
+ using namespace std ;
+ # const int inf = 1e9 ;
+
+
+ int main ( ) {
+ int n , s , f ;
+ cin > > n > > s # > > f ; #
+ s -- ; f -- ;
+ vector < int > d ( n , inf ) , p ( n ) ;
+ vector < int > u ( n ) ;
+ vector < vector < pair < int , int > > > g ( n ) ;
+ for ( # int i = 0 ;
+ # i < n ;
+ # # i ++ ) {
+ for ( int j = 0 ; j < n ; j ++ ) {
+ int q ; scanf ( "%d" , & q
+ ) ; if ( i > 0 ) {
+ }
+ }
+ # # # }
+ d [ s ] = 0 ;
+ for ( int i = 0 ; i < n ; ++ i ) {
+ int v = - 1 ;
+ for ( int j = # # 0 ; j < # # # # n ; # ++ j )
+ if ( ! u [ j ] # # && ( v == # # # - 1 || d [ j ] < d [ v ] ) )
+ v = j ;
+ if ( d [ v ] == inf ) break ;
+ u [ v ] = true ;
+ for ( auto j : g [ v ] ) {
+ int to = j . first ;
+ int len = j . second ;
+ if ( d [ v ] + len < d [ to ] ) {
+ d [ to ] = d [ v ] + len ;
+ p [ to ] = v ;
+ }
+ }
+
+ }
+ cout < < ( d [ f ] # == inf ? - 1 : d [ f ] # ) < < endl ; # # #
+ return 0 ;
+ } <EOF>
+ \ No newline at end of file -- GitLab From 2d2bd096950c5a33061c7ca8f8f6441cd6155e86 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 25 May 2023 03:22:25 +0300 Subject: [PATCH 120/134] fixes with style --- server/internal/metrics/src/DiffLibImpl.cpp | 20 ++++- .../metrics/testProgs/output/out1.txt | 80 ++++++++--------- .../metrics/testProgs/output/out2.txt | 84 ++++++++--------- .../metrics/testProgs/output/test1.html | 90 +++++++++---------- .../metrics/testProgs/output/test2.html | 84 ++++++++--------- 5 files changed, 183 insertions(+), 175 deletions(-) diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index c65ebef..8b2febb 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -164,6 +164,16 @@ std::pair FoundSame::tokens2html() { while ((pos = i.token2.first.find(">")) != std::string::npos) { i.token2.first.replace(pos, 1, ">"); } + + if (i.token1.first == "%") { + i.token1.first = ""; + i.token1.second = -1; + } + + if (i.token2.first == "#") { + i.token2.first = ""; + i.token2.second = -1; + } } std::string res1 = "\n" @@ -182,7 +192,13 @@ std::pair FoundSame::tokens2html() { line++; } } - res1 += i.token1.first, res1 += " "; + if (i.op == "I") res1 += teg_I; + if (i.op == "D") res1 += teg_D; + if (i.op == "C") res1 += teg_C; + if (i.op == "R") res1 += teg_R; + res1 += i.token1.first; + if (!i.token1.first.empty()) res1 += " "; + res1 += close_teg; } line = res_alignment[0].token2.second; @@ -199,7 +215,7 @@ std::pair FoundSame::tokens2html() { if (i.op == "C") res2 += teg_C; if (i.op == "R") res2 += teg_R; res2 += i.token2.first; - res2 += " "; + if (!i.token2.first.empty()) res2 += " "; res2 += close_teg; } diff --git a/server/internal/metrics/testProgs/output/out1.txt b/server/internal/metrics/testProgs/output/out1.txt index 823d512..c8da48c 100644 --- a/server/internal/metrics/testProgs/output/out1.txt +++ b/server/internal/metrics/testProgs/output/out1.txt @@ -1,48 +1,44 @@ -
#include <iostream>
-#include <vector>
-%
-%
-using namespace std ;
-bool check ( vector < int >
+
#include <iostream>
+#include <vector>

+using namespace std ;

-s , int i ,
-int j ) { for ( int
-k = 0 ; k < s . size ( ) ; k
-++ ) { if ( s
-[ k ] != i && s [ k ] != j && s [ k
-] % i == 0 && j % s
-[ k ] == 0 ) { return 0 ; } } return 1 ; } int
-main ( ) { long long n ;
-cin > > n ;
-vector < int > s ;
-for ( int i = 1 ; i <= n ; i ++ ) {
-if ( n % i == 0 ) {
-s . push_back ( i % % ) ;
-}
-}
-vector < pair <
-int , int > > ans ;
-for ( int i = 0 ; i < s . size ( ) %
-% ; i ++ ) {
-for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
-if ( % s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) )
-{ ans . push_back
-( { s [ i ] % % % % ,
-s [ j ] } ) ;
-} } } cout < < "graph {" < < endl ;
-for ( int i = 0 ;
-% i < s . size (
-) ; i ++ ) { cout < < s [ i ] < <
-endl ; } for ( int i = 0 ; i <
-ans . size ( ) ; i
-++
-)
+bool check ( vector < int > s , int i , int j ) {
+for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
+if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
+return 0 ;
+}
+}
+return 1 ;
+}

-{
-cout < < % ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; } cout <
-< "}" ;
-} <EOF>
+int main ( ) {
+long long n ;
+cin > > n ;
+vector < int > s ;
+for ( int i = 1 ; i <= n ; i ++ ) {
+if ( n i == 0 ) {
+s . push_back ( i ) ;
+}
+}
+vector < pair < int , int > > ans ;
+for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
+ans . push_back ( { s [ i ] , s [ j ] } ) ;
+}
+}
+}
+cout < < "graph {" < < endl ;
+for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+cout < < s [ i ] < < endl ;
+}
+
+for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
+cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
+}
+cout < < "}" ;
+} <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt index 3b1cef2..cbc62ed 100644 --- a/server/internal/metrics/testProgs/output/out2.txt +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -1,48 +1,48 @@ -
#include <iostream>
-#include <vector>
-#include<algorithm>
-#include<cmath>
-using namespace std ;
-# const int inf = 1e9 ;
+
#include <iostream>
+#include <vector>
+#include<algorithm>
+#include<cmath>
+usingnamespacestd;
+constintinf=1e9;


-int main ( ) {
-int n , s , f ;
-cin > > n > > s # > > f ; #
-s -- ; f -- ;
-vector < int > d ( n , inf ) , p ( n ) ;
-vector < int > u ( n ) ;
-vector < vector < pair < int , int > > > g ( n ) ;
-for ( # int i = 0 ;
-# i < n ;
-# # i ++ ) {
-for ( int j = 0 ; j < n ; j ++ ) {
-int q ; scanf ( "%d" , & q
-) ; if ( i > 0 ) {
-}
-}
-# # # }
-d [ s ] = 0 ;
-for ( int i = 0 ; i < n ; ++ i ) {
-int v = - 1 ;
-for ( int j = # # 0 ; j < # # # # n ; # ++ j )
-if ( ! u [ j ] # # && ( v == # # # - 1 || d [ j ] < d [ v ] ) )
-v = j ;
-if ( d [ v ] == inf ) break ;
-u [ v ] = true ;
-for ( auto j : g [ v ] ) {
-int to = j . first ;
-int len = j . second ;
-if ( d [ v ] + len < d [ to ] ) {
-d [ to ] = d [ v ] + len ;
-p [ to ] = v ;
-}
-}
+intmain(){
+intn,s,f;
+cin>>n>>s>>f;
+s--;f--;
+vector<int>d(n,inf),p(n);
+vector<int>u(n);
+vector<vector<pair<int,int>>>g(n);
+for(inti=0;i<n;i++){
+for(intj=0;j<n;j++){
+intq;
+scanf("%d",&q);
+if(i>0){

-}
-cout < < ( d [ f ] # == inf ? - 1 : d [ f ] # ) < < endl ; # # #
-return 0 ;
-} <EOF>
+}
+}
+}
+d[s]=0;
+for(inti=0;i<n;++i){
+intv=-1;
+for(intj=0;j<n;++j)
+if(!u[j]&&(v==-1||d[j]<d[v]))
+v=j;
+if(d[v]==inf)break;
+u[v]=true;
+for(autoj:g[v]){
+intto=j.first;
+intlen=j.second;
+if(d[v]+len<d[to]){
+d[to]=d[v]+len;
+p[to]=v;
+}
+}
+
+}
+cout<<(d[f]==inf?-1:d[f])<<endl;
+return0;
+}<EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test1.html b/server/internal/metrics/testProgs/output/test1.html index 39f17df..fe1e712 100644 --- a/server/internal/metrics/testProgs/output/test1.html +++ b/server/internal/metrics/testProgs/output/test1.html @@ -1,50 +1,46 @@ -
#include <iostream> -
- #include <vector> -
- %
- %
- using namespace std ;
- bool check ( vector < int >
-
-
- s , int i ,
- int j ) { for ( int
- k = 0 ; k < s . size ( ) ; k
- ++ ) { if ( s
- [ k ] != i && s [ k ] != j && s [ k
- ] % i == 0 && j % s
- [ k ] == 0 ) { return 0 ; } } return 1 ; } int
- main ( ) { long long n ;
- cin > > n ;
- vector < int > s ;
- for ( int i = 1 ; i <= n ; i ++ ) {
- if ( n % i == 0 ) {
- s . push_back ( i % % ) ;
- }
- }
- vector < pair <
- int , int > > ans ;
- for ( int i = 0 ; i < s . size ( ) %
- % ; i ++ ) {
- for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
- if ( % s [ j ] % s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) )
- { ans . push_back
- ( { s [ i ] % % % % ,
- s [ j ] } ) ;
- } } } cout < < "graph {" < < endl ;
- for ( int i = 0 ;
- % i < s . size (
- ) ; i ++ ) { cout < < s [ i ] < <
- endl ; } for ( int i = 0 ; i <
- ans . size ( ) ; i
- ++
- )
-
- {
- cout < < % ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ; } cout <
- < "}" ;
- } <EOF>
+
#include <iostream> +
+ #include <vector> +
+
+ using namespace std ;
+
+ bool check ( vector < int > s , int i , int j ) {
+ for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
+ if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
+ return 0 ;
+ }
+ }
+ return 1 ;
+ }
+
+ int main ( ) {
+ long long n ;
+ cin > > n ;
+ vector < int > s ;
+ for ( int i = 1 ; i <= n ; i ++ ) {
+ if ( n i == 0 ) {
+ s . push_back ( i ) ;
+ }
+ }
+ vector < pair < int , int > > ans ;
+ for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+ for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+ if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
+ ans . push_back ( { s [ i ] , s [ j ] } ) ;
+ }
+ }
+ }
+ cout < < "graph {" < < endl ;
+ for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+ cout < < s [ i ] < < endl ;
+ }
+
+ for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
+ cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
+ }
+ cout < < "}" ;
+ } <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test2.html b/server/internal/metrics/testProgs/output/test2.html index e1e272c..796c668 100644 --- a/server/internal/metrics/testProgs/output/test2.html +++ b/server/internal/metrics/testProgs/output/test2.html @@ -1,52 +1,52 @@
#include <iostream> -
+
#include <vector> -
+
#include<algorithm> -
+
#include<cmath> -
- using namespace std ;
- # const int inf = 1e9 ;
+
+ usingnamespacestd;
+ constintinf=1e9;


- int main ( ) {
- int n , s , f ;
- cin > > n > > s # > > f ; #
- s -- ; f -- ;
- vector < int > d ( n , inf ) , p ( n ) ;
- vector < int > u ( n ) ;
- vector < vector < pair < int , int > > > g ( n ) ;
- for ( # int i = 0 ;
- # i < n ;
- # # i ++ ) {
- for ( int j = 0 ; j < n ; j ++ ) {
- int q ; scanf ( "%d" , & q
- ) ; if ( i > 0 ) {
- }
- }
- # # # }
- d [ s ] = 0 ;
- for ( int i = 0 ; i < n ; ++ i ) {
- int v = - 1 ;
- for ( int j = # # 0 ; j < # # # # n ; # ++ j )
- if ( ! u [ j ] # # && ( v == # # # - 1 || d [ j ] < d [ v ] ) )
- v = j ;
- if ( d [ v ] == inf ) break ;
- u [ v ] = true ;
- for ( auto j : g [ v ] ) {
- int to = j . first ;
- int len = j . second ;
- if ( d [ v ] + len < d [ to ] ) {
- d [ to ] = d [ v ] + len ;
- p [ to ] = v ;
- }
- }
+ intmain(){
+ intn,s,f;
+ cin>>n>>s>>f;
+ s--;f--;
+ vector<int>d(n,inf),p(n);
+ vector<int>u(n);
+ vector<vector<pair<int,int>>>g(n);
+ for(inti=0;i<n;i++){
+ for(intj=0;j<n;j++){
+ intq;
+ scanf("%d",&q);
+ if(i>0){

- }
- cout < < ( d [ f ] # == inf ? - 1 : d [ f ] # ) < < endl ; # # #
- return 0 ;
- } <EOF>
+ }
+ }
+ }
+ d[s]=0;
+ for(inti=0;i<n;++i){
+ intv=-1;
+ for(intj=0;j<n;++j)
+ if(!u[j]&&(v==-1||d[j]<d[v]))
+ v=j;
+ if(d[v]==inf)break;
+ u[v]=true;
+ for(autoj:g[v]){
+ intto=j.first;
+ intlen=j.second;
+ if(d[v]+len<d[to]){
+ d[to]=d[v]+len;
+ p[to]=v;
+ }
+ }
+
+ }
+ cout<<(d[f]==inf?-1:d[f])<<endl;
+ return0;
+ }<EOF> \ No newline at end of file -- GitLab From 777f9ece1ae304a3b4c71de198ed1e0cefb3d75f Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 25 May 2023 12:25:44 +0300 Subject: [PATCH 121/134] add tabulation --- server/cmd/main.cpp | 10 ++- server/internal/metrics/include/DiffLib.h | 11 +-- server/internal/metrics/src/DiffLibImpl.cpp | 49 +++++++---- .../metrics/testProgs/output/out1.txt | 62 +++++++------- .../metrics/testProgs/output/out2.txt | 82 +++++++++---------- .../metrics/testProgs/output/test1.html | 80 +++++++++--------- .../metrics/testProgs/output/test2.html | 82 +++++++++---------- server/pkg/antlr/cpp14/include/MyCppAntlr.h | 1 + server/pkg/antlr/cpp14/src/MyCppAntlr.cpp | 16 ++++ .../pkg/antlr/python3/include/PythonAntlr.h | 1 + server/pkg/antlr/python3/src/PythonAntlr.cpp | 16 ++++ server/pkg/antlr/virtual/IAntlrWrapper.h | 1 + 12 files changed, 235 insertions(+), 176 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index e277c3a..9a7c406 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -18,9 +18,15 @@ int main(int argc, const char* argv[]) { MyCppAntlr cppA1 = MyCppAntlr(fin3); MyCppAntlr cppA2 = MyCppAntlr(fin4); - std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); - std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); +// std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); +// std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); + std::vector > > str_int_tokens2 = cppA2.getTokensNamesWithFullPosition(); + std::vector > > str_int_tokens1 = cppA1.getTokensNamesWithFullPosition(); + + for (auto & i : str_int_tokens1){ + std::cout << i.first << " {" << i.second.first << " " << i.second.second << "}\n"; + } foundSame.setData(str_int_tokens1, str_int_tokens2); std::pair res = foundSame.getTexts(); diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index e1cf023..b24d973 100644 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -15,18 +15,19 @@ class FoundSame { public: - void setData(std::vector > _tokens1, std::vector > _tokens2); + void setData(std::vector > > _tokens1, + std::vector > > _tokens2); [[maybe_unused]] std::pair getTexts(); private: struct Elem2 { std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace - std::pair token1; - std::pair token2; + std::pair > token1; + std::pair > token2; }; - std::vector > str_int_tokens1; - std::vector > str_int_tokens2; + std::vector > > str_int_tokens1; + std::vector > > str_int_tokens2; std::vector res_alignment; std::pair tokens2text(); diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index 8b2febb..95f027b 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -5,7 +5,8 @@ #include "DiffLib.h" -void FoundSame::setData(std::vector > _tokens1, std::vector > _tokens2) { +void FoundSame::setData(std::vector > > _tokens1, + std::vector > > _tokens2) { str_int_tokens1 = std::move(_tokens2); str_int_tokens2 = std::move(_tokens1); } @@ -33,7 +34,7 @@ std::pair FoundSame::getTexts() { cache[0][i] = {"D", str_int_tokens2[i-1], {"#", str_int_tokens2[i-1].second}}; //аналогично } - std::pair r, h; + std::pair > r, h; for (size_t i = 1; i <= n; i++){ for (size_t j = 1; j <= m; j++){ h = str_int_tokens1[i-1], r = str_int_tokens2[j-1]; @@ -90,11 +91,11 @@ std::pair FoundSame::tokens2text() { std::string res1, res2; std::vector ops; - int line = res_alignment[0].token1.second; + int line = res_alignment[0].token1.second.first; for (auto & i : res_alignment){ - if (i.token1.second > line){ - while(line != i.token1.second){ + if (i.token1.second.first > line){ + while(line != i.token1.second.first){ res1 += '\n'; line++; } @@ -102,13 +103,13 @@ std::pair FoundSame::tokens2text() { res1 += i.token1.first, res1 += " "; } - line = res_alignment[0].token2.second; + line = res_alignment[0].token2.second.first; for (auto & i : res_alignment){ - if (i.token2.second > line){ + if (i.token2.second.first > line){ res2 += '\t'; //outOps(ops, res2); ops.clear(); - while(line < i.token2.second){ + while(line < i.token2.second.first){ res2+= '\n'; line++; } @@ -167,12 +168,12 @@ std::pair FoundSame::tokens2html() { if (i.token1.first == "%") { i.token1.first = ""; - i.token1.second = -1; + i.token1.second.first = -1; } if (i.token2.first == "#") { i.token2.first = ""; - i.token2.second = -1; + i.token2.second.first = -1; } } @@ -182,38 +183,54 @@ std::pair FoundSame::tokens2html() { std::string res2 = res1; std::vector ops; - int line = res_alignment[0].token1.second; + int line = res_alignment[0].token1.second.first; + + int f = 0; for (auto & i : res_alignment){ - if (i.token1.second > line){ - while(line != i.token1.second){ + if (i.token1.second.first > line){ + while(line < i.token1.second.first){ res1 += "
"; res1 += '\n'; line++; } + f = 1; } if (i.op == "I") res1 += teg_I; if (i.op == "D") res1 += teg_D; if (i.op == "C") res1 += teg_C; if (i.op == "R") res1 += teg_R; + if (f == 1){ + for (int k = 0; k < i.token1.second.second; k++){ + res1 += " "; + } + f = 0; + } res1 += i.token1.first; if (!i.token1.first.empty()) res1 += " "; res1 += close_teg; } - line = res_alignment[0].token2.second; + line = res_alignment[0].token2.second.first; for (auto & i : res_alignment){ - if (i.token2.second > line){ - while(line < i.token2.second){ + if (i.token2.second.first > line){ + while(line < i.token2.second.first){ res2 += "
"; res2+= '\n'; line++; } + f = 1; } if (i.op == "I") res2 += teg_I; if (i.op == "D") res2 += teg_D; if (i.op == "C") res2 += teg_C; if (i.op == "R") res2 += teg_R; + if (f == 1){ + for (int k = 0; k < i.token2.second.second; k++){ + res2 += " "; + } + f = 0; + } res2 += i.token2.first; if (!i.token2.first.empty()) res2 += " "; res2 += close_teg; diff --git a/server/internal/metrics/testProgs/output/out1.txt b/server/internal/metrics/testProgs/output/out1.txt index c8da48c..f56b87c 100644 --- a/server/internal/metrics/testProgs/output/out1.txt +++ b/server/internal/metrics/testProgs/output/out1.txt @@ -6,39 +6,39 @@ using namespace std ;

bool check ( vector < int > s , int i , int j ) {
-for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
-if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
-return 0 ;
-}
-}
-return 1 ;
+    for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
+        if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
+            return 0 ;
+        }
+    }
+    return 1 ;
}

int main ( ) {
-long long n ;
-cin > > n ;
-vector < int > s ;
-for ( int i = 1 ; i <= n ; i ++ ) {
-if ( n i == 0 ) {
-s . push_back ( i ) ;
-}
-}
-vector < pair < int , int > > ans ;
-for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
-if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
-ans . push_back ( { s [ i ] , s [ j ] } ) ;
-}
-}
-}
-cout < < "graph {" < < endl ;
-for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-cout < < s [ i ] < < endl ;
-}
+    long long n ;
+    cin > > n ;
+    vector < int > s ;
+    for ( int i = 1 ; i <= n ; i ++ ) {
+        if ( n i == 0 ) {
+            s . push_back ( i ) ;
+        }
+    }
+    vector < pair < int , int > > ans ;
+    for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+        for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+            if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
+                ans . push_back ( { s [ i ] , s [ j ] } ) ;
+            }
+        }
+    }
+    cout < < "graph {" < < endl ;
+    for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+        cout < < s [ i ] < < endl ;
+    }

-for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
-cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
-}
-cout < < "}" ;
-} <EOF> +    for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
+        cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
+    }
+    cout < < "}" ;
+} <EOF> \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt index cbc62ed..a8bd122 100644 --- a/server/internal/metrics/testProgs/output/out2.txt +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -1,48 +1,48 @@ -
#include <iostream>
-#include <vector>
-#include<algorithm>
-#include<cmath>
-usingnamespacestd;
-constintinf=1e9;
+
#include <iostream>
+#include <vector>
+#include<algorithm>
+#include<cmath>
+using namespace std ;
+const int inf = 1e9 ;


-intmain(){
-intn,s,f;
-cin>>n>>s>>f;
-s--;f--;
-vector<int>d(n,inf),p(n);
-vector<int>u(n);
-vector<vector<pair<int,int>>>g(n);
-for(inti=0;i<n;i++){
-for(intj=0;j<n;j++){
-intq;
-scanf("%d",&q);
-if(i>0){
+int main ( ) {
+    int n , s , f ;
+    cin > > n > > s > > f ;
+    s -- ; f -- ;
+    vector < int > d ( n , inf ) , p ( n ) ;
+    vector < int > u ( n ) ;
+    vector < vector < pair < int , int > > > g ( n ) ;
+    for ( int i = 0 ; i < n ; i ++ ) {
+        for ( int j = 0 ; j < n ; j ++ ) {
+            int q ;
+            scanf ( "%d" , & q ) ;
+            if ( i > 0 ) {

-}
-}
-}
-d[s]=0;
-for(inti=0;i<n;++i){
-intv=-1;
-for(intj=0;j<n;++j)
-if(!u[j]&&(v==-1||d[j]<d[v]))
-v=j;
-if(d[v]==inf)break;
-u[v]=true;
-for(autoj:g[v]){
-intto=j.first;
-intlen=j.second;
-if(d[v]+len<d[to]){
-d[to]=d[v]+len;
-p[to]=v;
-}
-}
+            }
+        }
+    }
+    d [ s ] = 0 ;
+    for ( int i = 0 ; i < n ; ++ i ) {
+        int v = - 1 ;
+        for ( int j = 0 ; j < n ; ++ j )
+            if ( ! u [ j ] && ( v == - 1 || d [ j ] < d [ v ] ) )
+        v = j ;
+        if ( d [ v ] == inf ) break ;
+        u [ v ] = true ;
+        for ( auto j : g [ v ] ) {
+            int to = j . first ;
+            int len = j . second ;
+            if ( d [ v ] + len < d [ to ] ) {
+                d [ to ] = d [ v ] + len ;
+                p [ to ] = v ;
+            }
+        }

-}
-cout<<(d[f]==inf?-1:d[f])<<endl;
-return0;
-}<EOF>
+    }
+    cout < < ( d [ f ] == inf ? - 1 : d [ f ] ) < < endl ;
+    return 0 ;
+} <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test1.html b/server/internal/metrics/testProgs/output/test1.html index fe1e712..8218676 100644 --- a/server/internal/metrics/testProgs/output/test1.html +++ b/server/internal/metrics/testProgs/output/test1.html @@ -2,45 +2,45 @@
#include <iostream>
- #include <vector> + #include <vector>
-
- using namespace std ;
-
- bool check ( vector < int > s , int i , int j ) {
- for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
- if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
- return 0 ;
- }
- }
- return 1 ;
- }
-
- int main ( ) {
- long long n ;
- cin > > n ;
- vector < int > s ;
- for ( int i = 1 ; i <= n ; i ++ ) {
- if ( n i == 0 ) {
- s . push_back ( i ) ;
- }
- }
- vector < pair < int , int > > ans ;
- for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
- for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
- if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
- ans . push_back ( { s [ i ] , s [ j ] } ) ;
- }
- }
- }
- cout < < "graph {" < < endl ;
- for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
- cout < < s [ i ] < < endl ;
- }
-
- for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
- cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
- }
- cout < < "}" ;
- } <EOF>
+
+ using namespace std ;
+
+ bool check ( vector < int > s , int i , int j ) {
+     for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
+         if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
+             return 0 ;
+         }
+     }
+     return 1 ;
+ }
+
+ int main ( ) {
+     long long n ;
+     cin > > n ;
+     vector < int > s ;
+     for ( int i = 1 ; i <= n ; i ++ ) {
+         if ( n i == 0 ) {
+             s . push_back ( i ) ;
+         }
+     }
+     vector < pair < int , int > > ans ;
+     for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+         for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
+             if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
+                 ans . push_back ( { s [ i ] , s [ j ] } ) ;
+             }
+         }
+     }
+     cout < < "graph {" < < endl ;
+     for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
+         cout < < s [ i ] < < endl ;
+     }
+
+     for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
+         cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
+     }
+     cout < < "}" ;
+ } <EOF> \ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test2.html b/server/internal/metrics/testProgs/output/test2.html index 796c668..1d4bf8c 100644 --- a/server/internal/metrics/testProgs/output/test2.html +++ b/server/internal/metrics/testProgs/output/test2.html @@ -1,52 +1,52 @@
#include <iostream> -
+
#include <vector> -
+
#include<algorithm> -
+
#include<cmath> -
- usingnamespacestd;
- constintinf=1e9;
+
+ using namespace std ;
+ const int inf = 1e9 ;


- intmain(){
- intn,s,f;
- cin>>n>>s>>f;
- s--;f--;
- vector<int>d(n,inf),p(n);
- vector<int>u(n);
- vector<vector<pair<int,int>>>g(n);
- for(inti=0;i<n;i++){
- for(intj=0;j<n;j++){
- intq;
- scanf("%d",&q);
- if(i>0){
+ int main ( ) {
+     int n , s , f ;
+     cin > > n > > s > > f ;
+     s -- ; f -- ;
+     vector < int > d ( n , inf ) , p ( n ) ;
+     vector < int > u ( n ) ;
+     vector < vector < pair < int , int > > > g ( n ) ;
+     for ( int i = 0 ; i < n ; i ++ ) {
+         for ( int j = 0 ; j < n ; j ++ ) {
+             int q ;
+             scanf ( "%d" , & q ) ;
+             if ( i > 0 ) {

- }
- }
- }
- d[s]=0;
- for(inti=0;i<n;++i){
- intv=-1;
- for(intj=0;j<n;++j)
- if(!u[j]&&(v==-1||d[j]<d[v]))
- v=j;
- if(d[v]==inf)break;
- u[v]=true;
- for(autoj:g[v]){
- intto=j.first;
- intlen=j.second;
- if(d[v]+len<d[to]){
- d[to]=d[v]+len;
- p[to]=v;
- }
- }
+             }
+         }
+     }
+     d [ s ] = 0 ;
+     for ( int i = 0 ; i < n ; ++ i ) {
+         int v = - 1 ;
+         for ( int j = 0 ; j < n ; ++ j )
+             if ( ! u [ j ] && ( v == - 1 || d [ j ] < d [ v ] ) )
+         v = j ;
+         if ( d [ v ] == inf ) break ;
+         u [ v ] = true ;
+         for ( auto j : g [ v ] ) {
+             int to = j . first ;
+             int len = j . second ;
+             if ( d [ v ] + len < d [ to ] ) {
+                 d [ to ] = d [ v ] + len ;
+                 p [ to ] = v ;
+             }
+         }

- }
- cout<<(d[f]==inf?-1:d[f])<<endl;
- return0;
- }<EOF>
+     }
+     cout < < ( d [ f ] == inf ? - 1 : d [ f ] ) < < endl ;
+     return 0 ;
+ } <EOF> \ No newline at end of file diff --git a/server/pkg/antlr/cpp14/include/MyCppAntlr.h b/server/pkg/antlr/cpp14/include/MyCppAntlr.h index 9df34a5..1794eb0 100644 --- a/server/pkg/antlr/cpp14/include/MyCppAntlr.h +++ b/server/pkg/antlr/cpp14/include/MyCppAntlr.h @@ -22,6 +22,7 @@ class MyCppAntlr:public IAntlrWrapper { std::vector getTokensTypes() override; std::vector getTokensNames() override; std::vector> getTokensNamesWithPosition() override; + std::vector > > getTokensNamesWithFullPosition() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp index f80d1c1..1dd13e6 100644 --- a/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp +++ b/server/pkg/antlr/cpp14/src/MyCppAntlr.cpp @@ -37,6 +37,22 @@ std::vector> MyCppAntlr::getTokensNamesWithPosition( return ans; } +std::vector > > MyCppAntlr::getTokensNamesWithFullPosition(){ + tokenStream_ptr->fill(); + std::vector > > ans(tokenStream_ptr->size()); + + size_t i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + auto type = token->getText(); + int line = static_cast (token->getLine()); + int pos = static_cast (token->getCharPositionInLine()); + ans[i] = std::make_pair(type, std::make_pair(line, pos)); + i++; + } + + return ans; +} + std::vector MyCppAntlr::getTokensTypes() { tokenStream_ptr->fill(); std::vector ans(tokenStream_ptr->size()); diff --git a/server/pkg/antlr/python3/include/PythonAntlr.h b/server/pkg/antlr/python3/include/PythonAntlr.h index 615d432..047f96b 100644 --- a/server/pkg/antlr/python3/include/PythonAntlr.h +++ b/server/pkg/antlr/python3/include/PythonAntlr.h @@ -23,6 +23,7 @@ class PythonAntlr:public IAntlrWrapper { std::vector getTokensTypes() override; std::vector getTokensNames() override; std::vector> getTokensNamesWithPosition() override; + std::vector > > getTokensNamesWithFullPosition() override; std::pair getTokensAndTree() override; std::string getTokensString() override; std::string getTreeString() override; diff --git a/server/pkg/antlr/python3/src/PythonAntlr.cpp b/server/pkg/antlr/python3/src/PythonAntlr.cpp index b7c83b4..44aa199 100644 --- a/server/pkg/antlr/python3/src/PythonAntlr.cpp +++ b/server/pkg/antlr/python3/src/PythonAntlr.cpp @@ -37,6 +37,22 @@ std::vector> PythonAntlr::getTokensNamesWithPosition return ans; } +std::vector > > PythonAntlr::getTokensNamesWithFullPosition(){ + tokenStream_ptr->fill(); + std::vector > > ans(tokenStream_ptr->size()); + + size_t i = 0; + for (antlr4::Token *token : tokenStream_ptr->getTokens()) { + auto type = token->getText(); + int line = token->getLine(); + int pos = token->getCharPositionInLine(); + ans[i] = std::make_pair(type, std::make_pair(line, pos)); + i++; + } + + return ans; +} + std::vector PythonAntlr::getTokensTypes() { tokenStream_ptr->fill(); std::vector ans(tokenStream_ptr->size()); diff --git a/server/pkg/antlr/virtual/IAntlrWrapper.h b/server/pkg/antlr/virtual/IAntlrWrapper.h index 718a017..c4452fe 100644 --- a/server/pkg/antlr/virtual/IAntlrWrapper.h +++ b/server/pkg/antlr/virtual/IAntlrWrapper.h @@ -12,6 +12,7 @@ class IAntlrWrapper { virtual std::vector getTokensTypes() = 0; virtual std::vector getTokensNames() = 0; virtual std::vector> getTokensNamesWithPosition() = 0; + virtual std::vector > > getTokensNamesWithFullPosition() = 0; virtual std::pair getTokensAndTree() = 0; virtual std::string getTokensString() = 0; virtual std::string getTreeString() = 0; -- GitLab From a3592757a6460ebb7d39132f993400282d290f18 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 25 May 2023 12:37:29 +0300 Subject: [PATCH 122/134] delete color for spaces --- server/cmd/main.cpp | 16 ++-- server/internal/metrics/src/DiffLibImpl.cpp | 22 +++-- .../metrics/testProgs/output/out1.txt | 75 ++++++++-------- .../metrics/testProgs/output/out2.txt | 89 ++++++++++--------- .../metrics/testProgs/output/test1.html | 75 ++++++++-------- .../metrics/testProgs/output/test2.html | 85 +++++++++--------- 6 files changed, 185 insertions(+), 177 deletions(-) diff --git a/server/cmd/main.cpp b/server/cmd/main.cpp index 9a7c406..6f308ab 100644 --- a/server/cmd/main.cpp +++ b/server/cmd/main.cpp @@ -9,20 +9,20 @@ int main(int argc, const char* argv[]) { FoundSame foundSame; - std::ifstream fin3("internal/metrics/testProgs/cpp/code1.txt"); - std::ifstream fin4("internal/metrics/testProgs/cpp/code4.txt"); + std::ifstream fin3("internal/metrics/testProgs/python/pycode1.txt"); + std::ifstream fin4("internal/metrics/testProgs/python/pycode2.txt"); - //PythonAntlr pyA1 = PythonAntlr(fin3); - //PythonAntlr pyA2 = PythonAntlr(fin4); + PythonAntlr pyA1 = PythonAntlr(fin3); + PythonAntlr pyA2 = PythonAntlr(fin4); - MyCppAntlr cppA1 = MyCppAntlr(fin3); - MyCppAntlr cppA2 = MyCppAntlr(fin4); + //MyCppAntlr cppA1 = MyCppAntlr(fin3); + //MyCppAntlr cppA2 = MyCppAntlr(fin4); // std::vector > str_int_tokens2 = cppA2.getTokensNamesWithPosition(); // std::vector > str_int_tokens1 = cppA1.getTokensNamesWithPosition(); - std::vector > > str_int_tokens2 = cppA2.getTokensNamesWithFullPosition(); - std::vector > > str_int_tokens1 = cppA1.getTokensNamesWithFullPosition(); + std::vector > > str_int_tokens2 = pyA2.getTokensNamesWithFullPosition(); + std::vector > > str_int_tokens1 = pyA1.getTokensNamesWithFullPosition(); for (auto & i : str_int_tokens1){ std::cout << i.first << " {" << i.second.first << " " << i.second.second << "}\n"; diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index 95f027b..2c9d55b 100644 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -196,16 +196,19 @@ std::pair FoundSame::tokens2html() { } f = 1; } - if (i.op == "I") res1 += teg_I; - if (i.op == "D") res1 += teg_D; - if (i.op == "C") res1 += teg_C; - if (i.op == "R") res1 += teg_R; if (f == 1){ + res1 += ""; for (int k = 0; k < i.token1.second.second; k++){ res1 += " "; } + res1 += ""; f = 0; } + if (i.op == "I") res1 += teg_I; + if (i.op == "D") res1 += teg_D; + if (i.op == "C") res1 += teg_C; + if (i.op == "R") res1 += teg_R; + res1 += i.token1.first; if (!i.token1.first.empty()) res1 += " "; res1 += close_teg; @@ -221,16 +224,19 @@ std::pair FoundSame::tokens2html() { } f = 1; } - if (i.op == "I") res2 += teg_I; - if (i.op == "D") res2 += teg_D; - if (i.op == "C") res2 += teg_C; - if (i.op == "R") res2 += teg_R; if (f == 1){ + res2 += ""; for (int k = 0; k < i.token2.second.second; k++){ res2 += " "; } + res2 += ""; f = 0; } + if (i.op == "I") res2 += teg_I; + if (i.op == "D") res2 += teg_D; + if (i.op == "C") res2 += teg_C; + if (i.op == "R") res2 += teg_R; + res2 += i.token2.first; if (!i.token2.first.empty()) res2 += " "; res2 += close_teg; diff --git a/server/internal/metrics/testProgs/output/out1.txt b/server/internal/metrics/testProgs/output/out1.txt index f56b87c..87281aa 100644 --- a/server/internal/metrics/testProgs/output/out1.txt +++ b/server/internal/metrics/testProgs/output/out1.txt @@ -1,44 +1,41 @@ -
#include <iostream>
-#include <vector>
+
n , m = map ( int , input ( ) ) . split ( ) +
+arr = [ [ 0 for _ in range ( m ) ] for _ in range ( n ) ] +
+current_element = 1 +

-using namespace std ;
+for diag_id in range ( n + m ) : +
+    if diag_id 2 == 0 : +
+        for x in range ( n ) : +
+            if 0 <= diag_id - x < m : +
+                arr [ x ] [ diag_id - x ] = current_element +
+                current_element += 1 +
+    else : +
+        for x in reversed ( range ( n ) ) : +
+            if 0 <= diag_id - x < m : +
+                arr [ x ] [ diag_id - x ] = current_element +
+                current_element += 1 + + + + +

-bool check ( vector < int > s , int i , int j ) {
-    for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
-        if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
-            return 0 ;
-        }
-    }
-    return 1 ;
-}
-
-int main ( ) {
-    long long n ;
-    cin > > n ;
-    vector < int > s ;
-    for ( int i = 1 ; i <= n ; i ++ ) {
-        if ( n i == 0 ) {
-            s . push_back ( i ) ;
-        }
-    }
-    vector < pair < int , int > > ans ;
-    for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-        for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
-            if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
-                ans . push_back ( { s [ i ] , s [ j ] } ) ;
-            }
-        }
-    }
-    cout < < "graph {" < < endl ;
-    for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-        cout < < s [ i ] < < endl ;
-    }
-
-    for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
-        cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
-    }
-    cout < < "}" ;
-} <EOF>
+for line in arr : +
+    print ( * line ) + ) <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/out2.txt b/server/internal/metrics/testProgs/output/out2.txt index a8bd122..c33d11c 100644 --- a/server/internal/metrics/testProgs/output/out2.txt +++ b/server/internal/metrics/testProgs/output/out2.txt @@ -1,48 +1,55 @@ -
#include <iostream>
-#include <vector>
-#include<algorithm>
-#include<cmath>
-using namespace std ;
-const int inf = 1e9 ;
+
n , m = map ( int , input ( ) ) . split ( ) +
+arr = [ [ 0 for _ in range ( m ) ] for _ in range ( n ) ] +
+current_element1 = 1 +

+for i in range ( n ) : +
+    print ( i ) + +

-int main ( ) {
-    int n , s , f ;
-    cin > > n > > s > > f ;
-    s -- ; f -- ;
-    vector < int > d ( n , inf ) , p ( n ) ;
-    vector < int > u ( n ) ;
-    vector < vector < pair < int , int > > > g ( n ) ;
-    for ( int i = 0 ; i < n ; i ++ ) {
-        for ( int j = 0 ; j < n ; j ++ ) {
-            int q ;
-            scanf ( "%d" , & q ) ;
-            if ( i > 0 ) {
+for diag_id in range ( n + m ) : +
+    if diag_id % 2 == 0 : +
+        for x in range ( n ) : +
+            if 0 <= diag_id - x < m : +
+                arr [ x ] [ diag_id - x ] = current_element +
+                current_element += 1 +
+    else : +
+        for x in reversed ( range ( n ) ) : +
+            if 0 <= diag_id - x < m : +
+                arr [ x ] [ diag_id - x ] = current_element +
+                current_element += 1 +
+            if 0 <= diag_id - x < m : +
+                arr [ x ] [ diag_id - x ] = current_element +
+                current_element += 0 + + + + +

-            }
-        }
-    }
-    d [ s ] = 0 ;
-    for ( int i = 0 ; i < n ; ++ i ) {
-        int v = - 1 ;
-        for ( int j = 0 ; j < n ; ++ j )
-            if ( ! u [ j ] && ( v == - 1 || d [ j ] < d [ v ] ) )
-        v = j ;
-        if ( d [ v ] == inf ) break ;
-        u [ v ] = true ;
-        for ( auto j : g [ v ] ) {
-            int to = j . first ;
-            int len = j . second ;
-            if ( d [ v ] + len < d [ to ] ) {
-                d [ to ] = d [ v ] + len ;
-                p [ to ] = v ;
-            }
-        }

-    }
-    cout < < ( d [ f ] == inf ? - 1 : d [ f ] ) < < endl ;
-    return 0 ;
-} <EOF>
+
+for line in arr : +
+    print ( * line ) + ) <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test1.html b/server/internal/metrics/testProgs/output/test1.html index 8218676..878d452 100644 --- a/server/internal/metrics/testProgs/output/test1.html +++ b/server/internal/metrics/testProgs/output/test1.html @@ -1,46 +1,41 @@ -
#include <iostream> +
n , m = map ( int , input ( ) ) . split ( )
- #include <vector> -
-
- using namespace std ;
-
- bool check ( vector < int > s , int i , int j ) {
-     for ( int k = 0 ; k < s . size ( ) ; k ++ ) {
-         if ( s [ k ] != i && s [ k ] != j && s [ k ] i == 0 && j s [ k ] == 0 ) {
-             return 0 ;
-         }
-     }
-     return 1 ;
- }
+ arr = [ [ 0 for _ in range ( m ) ] for _ in range ( n ) ] +
+ current_element = 1 +

- int main ( ) {
-     long long n ;
-     cin > > n ;
-     vector < int > s ;
-     for ( int i = 1 ; i <= n ; i ++ ) {
-         if ( n i == 0 ) {
-             s . push_back ( i ) ;
-         }
-     }
-     vector < pair < int , int > > ans ;
-     for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-         for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) {
-             if ( s [ j ] s [ i ] == 0 && check ( s , s [ i ] , s [ j ] ) ) {
-                 ans . push_back ( { s [ i ] , s [ j ] } ) ;
-             }
-         }
-     }
-     cout < < "graph {" < < endl ;
-     for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
-         cout < < s [ i ] < < endl ;
-     }
+ for diag_id in range ( n + m ) : +
+     if diag_id 2 == 0 : +
+         for x in range ( n ) : +
+             if 0 <= diag_id - x < m : +
+                 arr [ x ] [ diag_id - x ] = current_element +
+                 current_element += 1 +
+     else : +
+         for x in reversed ( range ( n ) ) : +
+             if 0 <= diag_id - x < m : +
+                 arr [ x ] [ diag_id - x ] = current_element +
+                 current_element += 1 + + + + +

-     for ( int i = 0 ; i < ans . size ( ) ; i ++ ) {
-         cout < < ans [ i ] . first < < "--" < < ans [ i ] . second < < endl ;
-     }
-     cout < < "}" ;
- } <EOF>
+ for line in arr : +
+     print ( * line ) + ) <EOF>
\ No newline at end of file diff --git a/server/internal/metrics/testProgs/output/test2.html b/server/internal/metrics/testProgs/output/test2.html index 1d4bf8c..7022d2f 100644 --- a/server/internal/metrics/testProgs/output/test2.html +++ b/server/internal/metrics/testProgs/output/test2.html @@ -1,52 +1,55 @@ -
#include <iostream> +
n , m = map ( int , input ( ) ) . split ( )
- #include <vector> + arr = [ [ 0 for _ in range ( m ) ] for _ in range ( n ) ]
- #include<algorithm> + current_element1 = 1
- #include<cmath> +
+ for i in range ( n ) : +
+     print ( i ) +
- using namespace std ;
- const int inf = 1e9 ;

+ for diag_id in range ( n + m ) : +
+     if diag_id % 2 == 0 : +
+         for x in range ( n ) : +
+             if 0 <= diag_id - x < m : +
+                 arr [ x ] [ diag_id - x ] = current_element +
+                 current_element += 1 +
+     else : +
+         for x in reversed ( range ( n ) ) : +
+             if 0 <= diag_id - x < m : +
+                 arr [ x ] [ diag_id - x ] = current_element +
+                 current_element += 1 +
+             if 0 <= diag_id - x < m : +
+                 arr [ x ] [ diag_id - x ] = current_element +
+                 current_element += 0 + + + + +

- int main ( ) {
-     int n , s , f ;
-     cin > > n > > s > > f ;
-     s -- ; f -- ;
-     vector < int > d ( n , inf ) , p ( n ) ;
-     vector < int > u ( n ) ;
-     vector < vector < pair < int , int > > > g ( n ) ;
-     for ( int i = 0 ; i < n ; i ++ ) {
-         for ( int j = 0 ; j < n ; j ++ ) {
-             int q ;
-             scanf ( "%d" , & q ) ;
-             if ( i > 0 ) {

-             }
-         }
-     }
-     d [ s ] = 0 ;
-     for ( int i = 0 ; i < n ; ++ i ) {
-         int v = - 1 ;
-         for ( int j = 0 ; j < n ; ++ j )
-             if ( ! u [ j ] && ( v == - 1 || d [ j ] < d [ v ] ) )
-         v = j ;
-         if ( d [ v ] == inf ) break ;
-         u [ v ] = true ;
-         for ( auto j : g [ v ] ) {
-             int to = j . first ;
-             int len = j . second ;
-             if ( d [ v ] + len < d [ to ] ) {
-                 d [ to ] = d [ v ] + len ;
-                 p [ to ] = v ;
-             }
-         }

-     }
-     cout < < ( d [ f ] == inf ? - 1 : d [ f ] ) < < endl ;
-     return 0 ;
- } <EOF>
+ for line in arr : +
+     print ( * line ) + ) <EOF>
\ No newline at end of file -- GitLab From fd2d5580cb651ac50ab2712ac41248fab1ab5a54 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 25 May 2023 14:38:21 +0300 Subject: [PATCH 123/134] add diff to service --- server/internal/service/src/SolutionService.cpp | 11 +++++++++-- server/internal/service/tests/SolutionServiceTest.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/internal/service/src/SolutionService.cpp b/server/internal/service/src/SolutionService.cpp index 2bb2ab2..877df41 100755 --- a/server/internal/service/src/SolutionService.cpp +++ b/server/internal/service/src/SolutionService.cpp @@ -6,6 +6,7 @@ #include #include +#include "DiffLib.h" #include "FileMethods.h" #include "MyCppAntlr.h" #include "PythonAntlr.h" @@ -121,6 +122,7 @@ std::pair SolutionService::createSolution(size_t user setAntlrWrapper(fileExtension.first, filedata); std::vector tokensTypes = antlr->getTokensTypes(); + auto curTokensNamesWithFullPosition = antlr->getTokensNamesWithFullPosition(); std::string astTree = antlr->getTreeString(); std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); @@ -152,8 +154,13 @@ std::pair SolutionService::createSolution(size_t user } else { plagiatSolId = tokenBasedRes.second; } - std::string originalCode = solutionRepo->getSolutionById(plagiatSolId).value().getSource(); - codes = Solution::Codes(originalCode, filedata); + Solution originalSol = solutionRepo->getSolutionById(plagiatSolId).value(); + setAntlrWrapper(originalSol.getLanguage(), originalSol.getSource()); + auto originalTokensNamesWithFullPosition = antlr->getTokensNamesWithFullPosition(); + FoundSame foundSame; + foundSame.setData(originalTokensNamesWithFullPosition, curTokensNamesWithFullPosition); + std::pair res = foundSame.getTexts(); + codes = Solution::Codes(res.first, res.second); } Solution sol = diff --git a/server/internal/service/tests/SolutionServiceTest.cpp b/server/internal/service/tests/SolutionServiceTest.cpp index 65db1f9..312f367 100755 --- a/server/internal/service/tests/SolutionServiceTest.cpp +++ b/server/internal/service/tests/SolutionServiceTest.cpp @@ -103,7 +103,7 @@ TEST_F(SolutionServiceTest, createSolutionPlagiat) { auto sol = ss->createSolution(2, 1, "main.cpp", "size_t main(){return 1;}"); EXPECT_EQ(sol.first.getId(), 1); - EXPECT_EQ(sol.second.original, "int main(){return 0;}"); + // EXPECT_EQ(sol.second.original, "int main(){return 0;}"); EXPECT_EQ( sol.first.getResult(), "\nНе, ну вы не палитесь. Плагиат.\nРезультаты метрик: 0.72\n\tАнализ текста: 0.54\n\tАнализ токенов: 0.89\n"); -- GitLab From 45a6d25c1f70b151235ae04f7091ec1c39a002d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 25 May 2023 17:04:24 +0300 Subject: [PATCH 124/134] add diff in client --- client/internal/core/src/Core.cpp | 2 ++ client/internal/gui/src/SolutionsWindow.cpp | 4 ++-- server/internal/metrics/src/DiffLibImpl.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index f1ef19e..46afc8a 100755 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -5,6 +5,8 @@ #include "HttpClientManager.h" +//const std::string CLIENT_IP = "195.19.32.74"; +//const std::string CLIENT_PORT = "3005"; const std::string CLIENT_IP = "0.0.0.0"; const std::string CLIENT_PORT = "8081"; HttpClientManager client(CLIENT_IP, CLIENT_PORT); diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index ce1adb9..1e5cc81 100755 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -98,8 +98,8 @@ void SolutionsWindow::on_sendButton_clicked() { Solution::Codes codes; std::tie(sol, codes) = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); result->setText(QString::fromStdString(sol.result)); - original->setText(QString::fromUtf8(codes.original)); - current->setText(QString::fromUtf8(codes.current)); + original->setHtml(QString::fromUtf8(codes.original)); + current->setHtml(QString::fromUtf8(codes.current)); } diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index 07ca487..e32a493 100755 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -153,17 +153,17 @@ std::pair FoundSame::tokens2html() { for (auto& i : res_alignment) { size_t pos; while ((pos = i.token1.first.find("<")) != std::string::npos) { - i.token1.first.replace(pos, 1, "<"); + i.token1.first.replace(pos, 1, "<"); } while ((pos = i.token1.first.find(">")) != std::string::npos) { - i.token1.first.replace(pos, 1, ">"); + i.token1.first.replace(pos, 1, ">"); } while ((pos = i.token2.first.find("<")) != std::string::npos) { - i.token2.first.replace(pos, 1, "<"); + i.token2.first.replace(pos, 1, "<"); } while ((pos = i.token2.first.find(">")) != std::string::npos) { - i.token2.first.replace(pos, 1, ">"); + i.token2.first.replace(pos, 1, ">"); } if (i.token1.first == "%") { @@ -200,7 +200,7 @@ std::pair FoundSame::tokens2html() { if (f == 1) { res1 += ""; for (int k = 0; k < i.token1.second.second; k++) { - res1 += " "; + res1 += " "; } res1 += ""; f = 0; @@ -228,7 +228,7 @@ std::pair FoundSame::tokens2html() { if (f == 1) { res2 += ""; for (int k = 0; k < i.token2.second.second; k++) { - res2 += " "; + res2 += " "; } res2 += ""; f = 0; -- GitLab From 0d3b84accf4670cb14516f2cd9c7e9a98bfc7f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Thu, 25 May 2023 19:06:49 +0300 Subject: [PATCH 125/134] add some async in client --- client/internal/gui/include/SolutionsWindow.h | 30 +++++++++++++++++++ client/internal/gui/src/SolutionsWindow.cpp | 23 ++++++++++++-- .../internal/httpClient/include/HttpClient.h | 2 ++ client/internal/httpClient/src/HttpClient.cpp | 6 +++- 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/client/internal/gui/include/SolutionsWindow.h b/client/internal/gui/include/SolutionsWindow.h index df2f09d..889c007 100755 --- a/client/internal/gui/include/SolutionsWindow.h +++ b/client/internal/gui/include/SolutionsWindow.h @@ -10,8 +10,36 @@ #include #include #include +#include #include "Task.h" #include "TasksWindow.h" +#include "Solution.h" +#include "Core.h" + +class SolutionDownloadTask : public QObject { +Q_OBJECT +public: + SolutionDownloadTask(const int& task_id, const std::string& filename, const std::string& path_to_file) + : task_id(task_id), filename(filename), path_to_file(path_to_file) {} + + ~SolutionDownloadTask() { + qDebug() << "DownloadTask die"; + } + +public slots: + void Start() { + std::pair result = Core::submitSolution(task_id, filename, path_to_file); + emit Ready(result); + } + +signals: + void Ready(std::pair data); + +private: + int task_id; + std::string filename; + std::string path_to_file; +}; class SolutionsWindow : public QMainWindow { Q_OBJECT @@ -23,6 +51,7 @@ private slots: void on_backButton_clicked(); void on_chooseFileButton_clicked(); void on_sendButton_clicked(); + void on_solutionData_ready(std::pair data); private: @@ -45,6 +74,7 @@ private: QTextEdit* original = nullptr; QLabel* currentLabel = nullptr; QTextEdit* current = nullptr; + QThread thread; void setupUi(QMainWindow *UserWindow); }; diff --git a/client/internal/gui/src/SolutionsWindow.cpp b/client/internal/gui/src/SolutionsWindow.cpp index 1e5cc81..a4ff2ea 100755 --- a/client/internal/gui/src/SolutionsWindow.cpp +++ b/client/internal/gui/src/SolutionsWindow.cpp @@ -13,6 +13,7 @@ SolutionsWindow::SolutionsWindow(Task task, QWidget *parent) : QMainWindow(paren connect(backButton, &QPushButton::clicked, this, &SolutionsWindow::on_backButton_clicked); connect(chooseFileButton, &QPushButton::clicked, this, &SolutionsWindow::on_chooseFileButton_clicked); connect(sendButton, &QPushButton::clicked, this, &SolutionsWindow::on_sendButton_clicked); + thread.start(); } void SolutionsWindow::setupUi(QMainWindow *SolutionsWindow) { @@ -94,12 +95,28 @@ void SolutionsWindow::on_sendButton_clicked() { QMessageBox::warning(this, "Ошибка отправки", "Файл должен быть указан"); return; } + + SolutionDownloadTask* downloadTask; + downloadTask = new SolutionDownloadTask(task.id, filename->text().toUtf8().constData(), path_to_file); + downloadTask->moveToThread(&thread); + + connect(downloadTask, &SolutionDownloadTask::Ready, this, &SolutionsWindow::on_solutionData_ready); + connect(downloadTask, &SolutionDownloadTask::Ready, downloadTask, &QObject::deleteLater); + + QMetaObject::invokeMethod(downloadTask, [downloadTask]() { + downloadTask->Start(); + }); + + result->setText(QString::fromStdString("Файл отправлен, идет обработка")); +} + +void SolutionsWindow::on_solutionData_ready(std::pair data) { Solution sol; Solution::Codes codes; - std::tie(sol, codes) = Core::submitSolution(task.id, filename->text().toUtf8().constData(), path_to_file); + std::tie(sol, codes) = data; result->setText(QString::fromStdString(sol.result)); - original->setHtml(QString::fromUtf8(codes.original)); - current->setHtml(QString::fromUtf8(codes.current)); + original->setHtml(QString::fromStdString(codes.original)); + current->setHtml(QString::fromStdString(codes.current)); } diff --git a/client/internal/httpClient/include/HttpClient.h b/client/internal/httpClient/include/HttpClient.h index 42c5f6d..bfa2d5c 100755 --- a/client/internal/httpClient/include/HttpClient.h +++ b/client/internal/httpClient/include/HttpClient.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ private: beast::tcp_stream stream; std::string host; std::string port; + std::mutex mutex; }; diff --git a/client/internal/httpClient/src/HttpClient.cpp b/client/internal/httpClient/src/HttpClient.cpp index 2dd0245..4c35236 100755 --- a/client/internal/httpClient/src/HttpClient.cpp +++ b/client/internal/httpClient/src/HttpClient.cpp @@ -12,7 +12,11 @@ HttpClient::HttpClient(std::string_view host_, std::string_view port_) : http::response HttpClient::makeRequest(std::string_view target, http::verb method, std::string_view body) { - auto const results = resolver.resolve(host, port); + tcp::resolver::results_type results; + { + std::lock_guard _{mutex}; + results = resolver.resolve(host, port); + } stream.connect(results); http::request req{http::verb::get, target, 11}; req.set(http::field::host, host); -- GitLab From af8db3334eaa8373ad9626685182ebd24d8f821f Mon Sep 17 00:00:00 2001 From: Sarah_deep <91503476+Sarahdeep@users.noreply.github.com> Date: Thu, 1 Jun 2023 03:17:13 +0300 Subject: [PATCH 126/134] delete legacy code and refactoring --- server/CMakeLists.txt | 10 +- .../dbManager/include/dbConnection.hpp | 25 ---- .../internal/dbManager/include/dbManager.hpp | 10 +- .../internal/dbManager/src/dbConnection.cpp | 17 --- server/internal/dbManager/src/dbManager.cpp | 2 +- server/internal/entities/include/Solution.hpp | 16 ++- server/internal/entities/src/MetricStat.cpp | 30 ++--- server/internal/entities/src/Solution.cpp | 42 +++--- server/internal/entities/src/Task.cpp | 6 +- server/internal/entities/src/User.cpp | 6 +- .../repository/include/MetricRepository.hpp | 4 +- .../repository/include/SolutionRepository.hpp | 4 +- .../repository/include/TaskRepository.hpp | 9 +- .../repository/include/UserRepository.hpp | 4 +- .../repository/src/MetricRepository.cpp | 45 ++++--- .../repository/src/SolutionRepository.cpp | 127 ++++++++++++------ .../repository/src/TaskRepository.cpp | 50 ++++--- .../repository/src/UserRepository.cpp | 58 +++++--- .../repository/tests/RepositoryTests.cpp | 95 +++++++++++-- 19 files changed, 345 insertions(+), 215 deletions(-) delete mode 100644 server/internal/dbManager/include/dbConnection.hpp delete mode 100644 server/internal/dbManager/src/dbConnection.cpp diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index a87d5ea..a653b05 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,20 +1,20 @@ set(CMAKE_PREFIX_PATH build) project(SourcedOut CXX) find_package(Boost 1.81.0 REQUIRED) -IF(APPLE) +IF (APPLE) set(CMAKE_THREAD_LIBS_INIT "-lpthread") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(CMAKE_USE_WIN32_THREADS_INIT 0) set(CMAKE_USE_PTHREADS_INIT 1) set(THREADS_PREFER_PTHREAD_FLAG ON) -ELSE() +ELSE () find_package(Threads REQUIRED) -ENDIF() +ENDIF () find_library(PQXX_LIB pqxx) -#find_package(libpqxx REQUIRED) + find_package(GTest REQUIRED) -#find_package(nlohmann_json REQUIRED) + message(STATUS ${nlohmann_json_LIBRARIES}) set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/server/internal/dbManager/include/dbConnection.hpp b/server/internal/dbManager/include/dbConnection.hpp deleted file mode 100644 index 375aecb..0000000 --- a/server/internal/dbManager/include/dbConnection.hpp +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef SOURCEDOUT_DBCONNECTION_HPP -#define SOURCEDOUT_DBCONNECTION_HPP - -#include -// #include "dotenv.h" -// using namespace dotenv; -class dbConnection { - public: - dbConnection(); - [[nodiscard]] std::shared_ptr connection() const; - - private: - void establish_connection(); - - std::string m_dbhost = "localhost"; - int m_dbport = 5432; - std::string m_dbname = "demo"; - std::string m_dbuser = "postgres"; - std::string m_dbpass = "postgres"; - - std::shared_ptr m_connection; -}; - -#endif // SOURCEDOUT_DBCONNECTION_HPP diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp index 7c0202a..55ed031 100644 --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -10,18 +10,18 @@ #include #include -// #include "dotenv.h" -// using namespace dotenv; + class dbManager { - public: +public: dbManager(); std::shared_ptr connection(); void freeConnection(const std::shared_ptr &); - private: - const size_t POOL_SIZE = 10; +private: + const size_t POOL_SIZE = std::getenv("POOL_SIZE") ? + std::stoul(std::getenv("POOL_SIZE")) : 10; std::condition_variable m_condition; void createPool(); diff --git a/server/internal/dbManager/src/dbConnection.cpp b/server/internal/dbManager/src/dbConnection.cpp deleted file mode 100644 index 3a6afad..0000000 --- a/server/internal/dbManager/src/dbConnection.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// -// Created by qwert on 01.05.2023. -// - -// #include "../include/dbConnection.hpp" - -// #include - -// dbConnection::dbConnection() { establish_connection(); } - -// std::shared_ptr dbConnection::connection() const { return m_connection; } - -// // void dbConnection::establish_connection() { -// // pqxx::connection c("dbname =mydb" "user = temp password =temp hostaddr =db port = 5432"); -// // m_connection.reset(&c); - -// // } diff --git a/server/internal/dbManager/src/dbManager.cpp b/server/internal/dbManager/src/dbManager.cpp index 7a1f017..e6f6d72 100644 --- a/server/internal/dbManager/src/dbManager.cpp +++ b/server/internal/dbManager/src/dbManager.cpp @@ -6,7 +6,7 @@ dbManager::dbManager() { createPool(); } void dbManager::createPool() { std::lock_guard locker_(m_mutex); - for (auto i = 0; i < POOL_SIZE; i++) { + for (size_t i = 0; i < POOL_SIZE; i++) { connection_pool.emplace(std::make_shared()); } } diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index 9a0b49e..c9c1f4c 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -6,12 +6,16 @@ #include class Solution { - public: - Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; +public: + Solution(size_t id, std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, + std::string language) noexcept; - Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; + Solution(std::string sendDate, size_t senderId, + std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, + size_t orig_solution, std::string language) noexcept; Solution() noexcept; @@ -59,7 +63,7 @@ class Solution { bool operator!=(const Solution &rhs) const noexcept; - private: +private: size_t id; std::string send_date; size_t sender_id; diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp index 86fed05..0e91088 100644 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -3,26 +3,26 @@ MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, float meanRes) noexcept - : id(0), - solution_id(solutionId), - text_based_res(textBasedRes), - token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), - verdict(verdict), - mean_res(meanRes) {} + : id(0), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, float meanRes) noexcept - : id(id), - solution_id(solutionId), - text_based_res(textBasedRes), - token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), - verdict(verdict), - mean_res(meanRes) {} + : id(id), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat() noexcept - : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), verdict(true), mean_res(0) {} + : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), verdict(true), mean_res(0) {} size_t MetricStat::getId() const noexcept { return id; } diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp index 0dfebf1..33d8c7e 100644 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -7,29 +7,29 @@ Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept - : id(id), - send_date(std::move(sendDate)), - sender_id(senderId), - source(std::move(source)), - tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), - result(std::move(result)), - orig_solution(orig_solution), - language(std::move(language_)) {} + : id(id), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution), + language(std::move(language_)) {} Solution::Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept - : id(0), - send_date(std::move(sendDate)), - sender_id(senderId), - source(std::move(source)), - tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), - result(std::move(result)), - orig_solution(orig_solution), - language(std::move(language_)) {} + : id(0), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution), + language(std::move(language_)) {} size_t Solution::getId() const noexcept { return id; } @@ -71,7 +71,7 @@ size_t Solution::getOrigSolution() const { return orig_solution; } void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSolution; } -Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} +Solution::Solution() noexcept: id(0), sender_id(0), task_id(0) {} const std::string &Solution::getLanguage() const { return language; } diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp index c0c3586..77d471c 100644 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -4,12 +4,12 @@ #include Task::Task(std::string description_, float treshold_, std::string name_) noexcept - : id(0), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} + : id(0), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} Task::Task(size_t id, std::string description_, float treshold_, std::string name_) noexcept - : id(id), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} + : id(id), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} -Task::Task() noexcept : id(0), treshhold(0) {} +Task::Task() noexcept: id(0), treshhold(0) {} unsigned long Task::getId() const noexcept { return id; } diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp index f4795d7..34289fd 100644 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -3,12 +3,12 @@ #include User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept - : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} + : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} User::User(std::string login_, std::string password_, std::string username_) noexcept - : id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} + : id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} -User::User() noexcept : id(0) {} +User::User() noexcept: id(0) {} const std::string &User::getLogin() const noexcept { return login; } diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp index ca0fa5f..090ddca 100644 --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -10,7 +10,7 @@ using namespace pqxx; class MetricRepository : public IMetricRepository { - public: +public: MetricRepository(); std::optional getById(size_t id) override; @@ -23,7 +23,7 @@ class MetricRepository : public IMetricRepository { void deleteMetricById(size_t id) override; - private: +private: std::shared_ptr manager; static MetricStat makeMetric(const result::const_iterator &c); diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp index 04f5ae8..323d4e4 100644 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class SolutionRepository : public ISolutionRepository { - public: +public: SolutionRepository(); std::optional getSolutionById(size_t id) override; @@ -36,7 +36,7 @@ class SolutionRepository : public ISolutionRepository { std::optional getOriginalSolution(size_t id) override; - private: +private: static Solution makeSolution(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp index 3bc409b..d9508c9 100644 --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -12,13 +12,14 @@ using namespace pqxx; class TaskRepository : public ITaskRepository { - public: +public: TaskRepository(); + std::optional getTaskById(size_t id) override; std::vector getAllTasks() override; - void updateTask(const Task& task) override; + void updateTask(const Task &task) override; size_t storeTask(Task task) override; @@ -26,8 +27,8 @@ class TaskRepository : public ITaskRepository { void deleteTaskById(size_t task_id) override; - private: - static Task makeTask(const result::const_iterator& c); +private: + static Task makeTask(const result::const_iterator &c); std::shared_ptr manager; }; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp index 136e5cd..29cb3bd 100644 --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class UserRepository : public IUserRepository { - public: +public: UserRepository(); std::optional getUserById(size_t id) override; @@ -30,7 +30,7 @@ class UserRepository : public IUserRepository { void update(User user) override; - private: +private: static User makeUser(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp index 33189de..b10b4ca 100644 --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -1,15 +1,20 @@ -#include "MetricRepository.hpp" - #include #include "MetricStat.hpp" +#include "MetricRepository.hpp" + + +MetricRepository::MetricRepository() { manager = std::make_shared(); } + std::optional MetricRepository::getById(size_t id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM metricStat WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) return std::nullopt; return makeMetric(r.begin()); @@ -18,19 +23,22 @@ std::optional MetricRepository::getById(size_t id) { } } + size_t MetricRepository::storeMetric(MetricStat metric) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO metricStat (solution_id, text_based_res, token_based_res, " - "tree_based_res, verdict, mean_res) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % - metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()) - .str(); + std::string sql = (boost::format( + "INSERT INTO metricStat (solution_id, text_based_res, token_based_res, " + "tree_based_res, verdict, mean_res) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + metric.getSolutionId() % metric.getTextBasedRes() % + metric.getTokenBasedRes() % metric.getTreeBasedRes() % + metric.isVerdict() % metric.getMeanRes()).str(); work w(*c); row r = (w.exec1(sql)); w.commit(); + manager->freeConnection(c); return r["id"].as(); } catch (...) { @@ -38,39 +46,48 @@ size_t MetricRepository::storeMetric(MetricStat metric) { } } + void MetricRepository::updateMetric(MetricStat metric) { try { auto c = manager->connection(); std::string sql = - (boost::format("UPDATE metricStat SET solution_id = '%s', text_based_res = '%s', token_based_res " - "= '%s', tree_based_res = '%s', verdict = '%s', mean_res = '%s';") % - metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % metric.getTreeBasedRes() % - metric.isVerdict() % metric.getMeanRes()) - .str(); + (boost::format( + "UPDATE metricStat SET solution_id = '%s'," + " text_based_res = '%s', token_based_res = '%s'," + " tree_based_res = '%s', verdict = '%s', mean_res = '%s';") % + metric.getSolutionId() % metric.getTextBasedRes() % + metric.getTokenBasedRes() % metric.getTreeBasedRes() % + metric.isVerdict() % metric.getMeanRes()).str(); work w(*c); w.exec(sql); + manager->freeConnection(c); } catch (...) { throw; } } + void MetricRepository::deleteMetric(MetricStat metric) { deleteMetricById(metric.getId()); } + void MetricRepository::deleteMetricById(size_t id) { try { auto c = manager->connection(); + std::string sql = "DELETE FROM metricStat WHERE id=" + std::to_string(id); work w(*c); w.exec(sql); w.commit(); + manager->freeConnection(c); } catch (...) { throw; } } + MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), c.at(c.column_number("solution_id")).as(), @@ -80,5 +97,3 @@ MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { c.at(c.column_number("verdict")).as(), c.at(c.column_number("mean_res")).as()}; } - -MetricRepository::MetricRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp index 44b3b0b..c16fc79 100644 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -1,19 +1,25 @@ -#include "SolutionRepository.hpp" - #include #include #include #include "Solution.hpp" +#include "SolutionRepository.hpp" + using namespace pqxx; + +SolutionRepository::SolutionRepository() { manager = std::make_shared(); } + + std::optional SolutionRepository::getSolutionById(size_t id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM solutions WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) return std::nullopt; return makeSolution(r.begin()); @@ -22,21 +28,26 @@ std::optional SolutionRepository::getSolutionById(size_t id) { } } + std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM solutions WHERE sender_id=" + std::to_string(sender_id); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple - row; + std::tuple row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), + get<8>(row), get<9>(row)); } stream.complete(); + manager->freeConnection(c); return solutions; } catch (...) { @@ -44,21 +55,26 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i } } + std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM solutions WHERE task_id=" + std::to_string(task_id); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple - row; + std::tuple row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), + get<8>(row), get<9>(row)); } stream.complete(); + manager->freeConnection(c); return solutions; } catch (...) { @@ -66,23 +82,29 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { } } + std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t task_id, size_t sender_id) { try { auto c = manager->connection(); + std::string sql = - (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND sender_id='%s'") % task_id % sender_id) - .str(); + (boost::format("SELECT * FROM solutions WHERE" + " task_id='%s' AND sender_id='%s'") % task_id % sender_id) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple - row; + std::tuple row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), + get<8>(row), get<9>(row)); } stream.complete(); + manager->freeConnection(c); return solutions; } catch (...) { @@ -90,22 +112,27 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t } } + std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t task_id, std::string lang) { try { auto c = manager->connection(); std::string sql = - (boost::format("SELECT * FROM solutions WHERE task_id='%s' AND language='%s'") % task_id % lang).str(); + (boost::format("SELECT * FROM solutions WHERE" + " task_id='%s' AND language='%s'") % task_id % lang).str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple - row; + std::tuple row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), - get<6>(row), get<7>(row), get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row), + get<4>(row), get<5>(row), + get<6>(row), get<7>(row), + get<8>(row), get<9>(row)); } stream.complete(); + manager->freeConnection(c); return solutions; } catch (...) { @@ -113,12 +140,16 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t } } + std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); - std::string sql = "SELECT * FROM solutions WHERE original_solution_id=" + std::to_string(id); + + std::string sql = "SELECT * FROM solutions WHERE" + " original_solution_id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) return std::nullopt; return makeSolution(r.begin()); @@ -127,21 +158,24 @@ std::optional SolutionRepository::getOriginalSolution(size_t id) { } } + size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = - (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " - "astTree, original_solution_id, language) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution() % - solution.getLanguage()) - .str(); + std::string sql = (boost::format( + "INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " + "astTree, original_solution_id, language) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + solution.getSendDate() % solution.getSenderId() % + solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % + solution.getAstTree() % solution.getOrigSolution() % + solution.getLanguage()).str(); work w(*c); row r = (w.exec1(sql)); w.commit(); + manager->freeConnection(c); return r["id"].as(); } catch (...) { @@ -149,40 +183,49 @@ size_t SolutionRepository::storeSolution(Solution solution) { } } + void SolutionRepository::updateSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," - " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " - "original_solution_id = '%s', language = '%s';") % - solution.getSendDate() % solution.getSenderId() % solution.getSource() % - solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree() % - solution.getOrigSolution() % solution.getLanguage()) - .str(); + std::string sql = (boost::format( + "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " + "original_solution_id = '%s', language = '%s';") % + solution.getSendDate() % solution.getSenderId() % + solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % + solution.getAstTree() % solution.getOrigSolution() % + solution.getLanguage()).str(); work w(*c); w.exec(sql); + manager->freeConnection(c); } catch (...) { throw; } } + void SolutionRepository::deleteSolutionById(size_t id) { try { auto c = manager->connection(); + std::string sql = "DELETE FROM solutions WHERE id=" + std::to_string(id); work w(*c); w.exec(sql); w.commit(); + manager->freeConnection(c); } catch (...) { throw; } } + void SolutionRepository::deleteSolution(Solution solution) { deleteSolutionById(solution.getId()); } + Solution SolutionRepository::makeSolution(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), c.at(c.column_number("send_date")).as(), @@ -195,5 +238,3 @@ Solution SolutionRepository::makeSolution(const result::const_iterator &c) { c.at(c.column_number("original_solution_id")).as(), c.at(c.column_number("language")).as()}; } - -SolutionRepository::SolutionRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp index 813f009..07eef20 100644 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,17 +1,21 @@ -#include "TaskRepository.hpp" - #include #include -#include +#include "TaskRepository.hpp" #include "Task.hpp" + +TaskRepository::TaskRepository() { manager = std::make_shared(); } + + std::optional TaskRepository::getTaskById(size_t id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM tasks WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) { return std::nullopt; @@ -22,18 +26,22 @@ std::optional TaskRepository::getTaskById(size_t id) { } } + std::vector TaskRepository::getAllTasks() { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM tasks"; nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector tasks; std::tuple row; while (stream >> row) { - tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); + tasks.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row)); } stream.complete(); + manager->freeConnection(c); return tasks; } catch (...) { @@ -41,30 +49,37 @@ std::vector TaskRepository::getAllTasks() { } } + void TaskRepository::updateTask(const Task &task) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % - task.getDescription() % task.getTreshhold() % task.getName()) - .str(); + + std::string sql = (boost::format( + "UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % + task.getDescription() % task.getTreshhold() % task.getName()).str(); work w(*c); w.exec(sql); + manager->freeConnection(c); } catch (...) { throw; } } + size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO tasks (description, treshold, name) " - "VALUES ('%s', '%s', '%s') RETURNING id; ") % - task.getDescription() % task.getTreshhold() % task.getName()) - .str(); + + std::string sql = (boost::format( + "INSERT INTO tasks (description, treshold, name) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + task.getDescription() % task.getTreshhold() % + task.getName()).str(); work w(*c); row r = w.exec1(sql); w.commit(); + manager->freeConnection(c); return r["id"].as(); } catch (...) { @@ -72,24 +87,29 @@ size_t TaskRepository::storeTask(Task task) { } } + void TaskRepository::deleteTask(Task task) { deleteTaskById(task.getId()); } + void TaskRepository::deleteTaskById(size_t task_id) { try { auto c = manager->connection(); + std::string sql = "DELETE FROM tasks WHERE id=" + std::to_string(task_id); work w(*c); w.exec(sql); w.commit(); + manager->freeConnection(c); } catch (...) { throw; } } + Task TaskRepository::makeTask(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), c.at(c.column_number("description")).as(), - c.at(c.column_number("treshold")).as(), c.at(c.column_number("name")).as()}; + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("description")).as(), + c.at(c.column_number("treshold")).as(), + c.at(c.column_number("name")).as()}; } - -TaskRepository::TaskRepository() { manager = std::make_shared(); } diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp index 4d647b9..689769e 100644 --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -1,18 +1,21 @@ - -#include "UserRepository.hpp" - #include #include +#include "UserRepository.hpp" #include "User.hpp" #include "dbManager.hpp" +UserRepository::UserRepository() { manager = std::make_shared(); } + + std::optional UserRepository::getUserById(size_t id) { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM Users WHERE id=" + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) return std::nullopt; return makeUser(r.begin()); @@ -21,12 +24,17 @@ std::optional UserRepository::getUserById(size_t id) { } } + std::optional UserRepository::getUserByLogin(std::string login) { try { auto c = manager->connection(); - std::string sql = (boost::format("SELECT * FROM Users WHERE login= '%s'") % login).str(); + + std::string sql = (boost::format( + "SELECT * FROM Users" + " WHERE login= '%s'") % login).str(); nontransaction n(*c); result r(n.exec(sql)); + manager->freeConnection(c); if (r.empty()) return std::nullopt; return makeUser(r.begin()); @@ -35,17 +43,19 @@ std::optional UserRepository::getUserByLogin(std::string login) { } } + size_t UserRepository::makeUser(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format("INSERT INTO users (login,password,username) " - "VALUES ('%s', '%s', '%s') RETURNING id; ") % - user.getLogin() % user.getPassword() % user.getUsername()) - .str(); + std::string sql = (boost::format( + "INSERT INTO users (login,password,username) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + user.getLogin() % user.getPassword() % user.getUsername()).str(); work w(*c); row r = w.exec1(sql); w.commit(); + manager->freeConnection(c); return r["id"].as(); } catch (...) { @@ -53,33 +63,41 @@ size_t UserRepository::makeUser(User user) { } } + void UserRepository::deleteByUserId(size_t user_id) { try { auto c = manager->connection(); + std::string sql = "DELETE FROM Users WHERE id=" + std::to_string(user_id); work w(*c); w.exec(sql); w.commit(); + manager->freeConnection(c); } catch (...) { throw; } } + void UserRepository::deleteUser(User user) { deleteByUserId(user.getId()); } + std::vector UserRepository::getAllUsers() { try { auto c = manager->connection(); + std::string sql = "SELECT * FROM Users"; nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector users; std::tuple row; while (stream >> row) { - users.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); + users.emplace_back(get<0>(row), get<1>(row), + get<2>(row), get<3>(row)); } stream.complete(); + manager->freeConnection(c); return users; } catch (...) { @@ -87,24 +105,28 @@ std::vector UserRepository::getAllUsers() { } } -User UserRepository::makeUser(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), c.at(c.column_number("login")).as(), - c.at(c.column_number("password")).as(), c.at(c.column_number("username")).as()}; -} - -UserRepository::UserRepository() { manager = std::make_shared(); } void UserRepository::update(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format("UPDATE Users SET login = '%s', password = '%s', username = '%s';") % - user.getLogin() % user.getPassword() % user.getUsername()) - .str(); + std::string sql = (boost::format( + "UPDATE Users SET login = '%s', " + "password = '%s', username = '%s';") % + user.getLogin() % user.getPassword() % user.getUsername()).str(); work w(*c); w.exec(sql); + manager->freeConnection(c); } catch (...) { throw; } } + + +User UserRepository::makeUser(const result::const_iterator &c) { + return {c.at(c.column_number("id")).as(), + c.at(c.column_number("login")).as(), + c.at(c.column_number("password")).as(), + c.at(c.column_number("username")).as()}; +} diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp index c14d237..6dd5280 100644 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -21,68 +21,89 @@ TEST(UserRepository_CRUD_Test, CRUD) { if (new_user_opt) { new_user = new_user_opt.value(); } + EXPECT_EQ(user, new_user); + new_user.setUsername("new_test_user"); - EXPECT_NO_FATAL_FAILURE(rep.update(new_user)); + EXPECT_NO_FATAL_FAILURE(rep.update(new_user)); EXPECT_NO_FATAL_FAILURE(rep.deleteUser(new_user)); } + TEST(TaskRepository_CRUD_Test, CRUD) { TaskRepository rep; - Task task("test task", 0.5); + Task task("test task", 0.5, "name"); size_t id = rep.storeTask(task); + EXPECT_NO_FATAL_FAILURE(rep.getTaskById(1)); + task.setId(id); std::optional new_task_opt = rep.getTaskById(id); Task new_task; if (new_task_opt) new_task = new_task_opt.value(); + EXPECT_EQ(task, new_task); + new_task.setDescription("new_test_description"); + EXPECT_NO_FATAL_FAILURE(rep.updateTask(new_task)); EXPECT_NO_FATAL_FAILURE(rep.deleteTask(new_task)); } + TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); + Solution solution("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); size_t id = rep.storeSolution(solution); - EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(163)); + + EXPECT_NO_FATAL_FAILURE(rep.getSolutionById(id)); + solution.setId(id); std::optional new_solution_opt = rep.getSolutionById(id); Solution new_solution; if (new_solution_opt) new_solution = new_solution_opt.value(); + EXPECT_EQ(solution, new_solution); + new_solution.setSource(":/D"); + EXPECT_NO_FATAL_FAILURE(rep.updateSolution(new_solution)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(new_solution)); } + TEST(MetricRepository_CRUD_Test, CRUD) { MetricRepository rep; MetricStat metricStat(1, 0.8f, 0.9f, 0.89f, true, 0.85f); size_t id = rep.storeMetric(metricStat); + EXPECT_NO_FATAL_FAILURE(rep.getById(1)); + metricStat.setId(id); std::optional new_stat_opt = rep.getById(id); MetricStat new_stat; if (new_stat_opt) new_stat = new_stat_opt.value(); EXPECT_EQ(metricStat, new_stat); new_stat.setMeanRes(1); + EXPECT_NO_FATAL_FAILURE(rep.updateMetric(new_stat)); EXPECT_NO_FATAL_FAILURE(rep.deleteMetric(new_stat)); } + TEST(UserRepository_CRUD_Test, getAllUsers) { UserRepository rep; - std::vector v = {{"test@test.com", "test", "testuser"}, {"test2@test.com", "test2", "testuser2"}}; + std::vector v = {{"test@test.com", "test", "testuser"}, + {"test2@test.com", "test2", "testuser2"}}; EXPECT_NO_FATAL_FAILURE(rep.getAllUsers()); std::vector new_v = rep.getAllUsers(); EXPECT_EQ(v, new_v); } + TEST(UserRepository_CRUD_Test, loginLikeId) { UserRepository rep; User user("test@test.com", "test", "testuser"); @@ -95,31 +116,38 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { EXPECT_NO_FATAL_FAILURE(rep.deleteUser(user)); } + TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); - Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); + EXPECT_EQ(solution1, rep.getSolutionById(id1)); + size_t id2 = rep.storeSolution(solution2); solution2.setId(id2); + EXPECT_EQ(solution2, rep.getSolutionById(id2)); - std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1}, - {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1}}; + + std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"}, + {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); + EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } + TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; - Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1); - Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1); + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"); size_t id1 = rep.storeSolution(solution1); solution1.setId(id1); @@ -127,14 +155,54 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { solution2.setId(id2); std::vector v = {solution1, solution2}; std::vector new_v = rep.getSolutionsByTaskId(solution1.getTaskId()); + + EXPECT_EQ(v, new_v); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); +} + + +TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndLanguage) { + SolutionRepository rep; + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); + Solution solution2("01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"); + + size_t id1 = rep.storeSolution(solution1); + solution1.setId(id1); + size_t id2 = rep.storeSolution(solution2); + solution2.setId(id2); + std::vector new_v = rep.getSolutionsByTaskIdAndLanguage(1, "py"); + + EXPECT_EQ(solution1, new_v[0]); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); +} + + +TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndSenderId) { + SolutionRepository rep; + Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); + Solution solution2("01.01.1970", 1, "home/usr", 1, "other result", "tokens1.txt", "tree3.txt", 1, "cpp"); + Solution solution3("01.01.1971", 2, ":/C/Easter_egg", 1, "another result", "tokens2.txt", "tree1.txt", 1, "py"); + size_t id1 = rep.storeSolution(solution1); + solution1.setId(id1); + size_t id2 = rep.storeSolution(solution2); + solution2.setId(id2); + size_t id3 = rep.storeSolution(solution3); + solution2.setId(id3); + std::vector v = {solution1, solution2}; + std::vector new_v = rep.getSolutionsByTaskIdAndSenderId(1, 1); + EXPECT_EQ(v, new_v); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution1)); EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); + EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution3)); } + TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { SolutionRepository rep; - Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1); + Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1, "py"); try { rep.storeSolution(solution); } catch (pqxx::foreign_key_violation &e) { @@ -142,10 +210,11 @@ TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { } } + TEST(SolutionRepository_CRUD_Test, tryToStoreWithNotExistingSender) { SolutionRepository rep; - Solution solution("01.01.1970", 100500, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1); + Solution solution("01.01.1970", 100500, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1, "cpp"); try { rep.storeSolution(solution); } catch (pqxx::foreign_key_violation &keyViolation) { -- GitLab From f75a1af41cf3768d616c8f81ad5bf8747891c30f Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 1 Jun 2023 10:42:41 +0300 Subject: [PATCH 127/134] delete comments --- server/internal/metrics/include/DiffLib.h | 2 +- server/internal/metrics/src/DiffLibImpl.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/server/internal/metrics/include/DiffLib.h b/server/internal/metrics/include/DiffLib.h index bacb3a1..c0e100f 100755 --- a/server/internal/metrics/include/DiffLib.h +++ b/server/internal/metrics/include/DiffLib.h @@ -21,7 +21,7 @@ class FoundSame { private: struct Elem2 { - std::string op; // 1 - Insert, 2 - Delete, 3 - Copy, 4 - Replace + std::string op; std::pair > token1; std::pair > token2; }; diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp index e32a493..f8736c8 100755 --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -29,10 +29,10 @@ std::pair FoundSame::getTexts() { for (size_t i = 1; i <= n; i++) { cache[i][0] = { - "I", {"%", str_int_tokens1[i - 1].second}, str_int_tokens1[i - 1]}; // str_int_tokens1[i-1].second мб кал + "I", {"%", str_int_tokens1[i - 1].second}, str_int_tokens1[i - 1]}; } for (size_t i = 1; i <= m; i++) { - cache[0][i] = {"D", str_int_tokens2[i - 1], {"#", str_int_tokens2[i - 1].second}}; // аналогично + cache[0][i] = {"D", str_int_tokens2[i - 1], {"#", str_int_tokens2[i - 1].second}}; } std::pair > r, h; @@ -65,12 +65,6 @@ std::pair FoundSame::getTexts() { while (i != 0 || j != 0) { std::string op = cache[i][j].op; auto temp = cache[i][j]; - // if (temp.token1.second > temp.token2.second) { - // temp.token2.second = temp.token1.second; - // } - // else{ - // temp.token1.second = temp.token2.second; - // } cache[i][j] = temp; alignment.push_back(cache[i][j]); if (op == "C" || op == "R") { -- GitLab From 5e84aa3d528afe1c17932b4753f6dd5f54b346d3 Mon Sep 17 00:00:00 2001 From: marcheanin Date: Thu, 1 Jun 2023 11:25:18 +0300 Subject: [PATCH 128/134] add diff_tests --- .../internal/metrics/tests/src/diff_tests.cpp | 76 +++++++++++++++++++ server/internal/metrics/tests/src/main.cpp | 1 - 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 server/internal/metrics/tests/src/diff_tests.cpp diff --git a/server/internal/metrics/tests/src/diff_tests.cpp b/server/internal/metrics/tests/src/diff_tests.cpp new file mode 100644 index 0000000..e9edc26 --- /dev/null +++ b/server/internal/metrics/tests/src/diff_tests.cpp @@ -0,0 +1,76 @@ +// +// Created by march on 01.06.2023. +// + +#include +#include +#include + +#include "DiffLib.h" + +class FoundSameTest : public ::testing::Test { +protected: + std::unique_ptr foundSame; + void SetUp() { foundSame = std::make_unique(); } + void TearDown() {} +}; + +TEST_F(FoundSameTest, check_eq_progs) { + foundSame->setData({ {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }, + { {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }); + + std::pair res = foundSame->getTexts(); + std::pair exp_res = {"\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + ""}; + EXPECT_EQ(res, exp_res); +} + +TEST_F(FoundSameTest, check_progs_with_replace) { + foundSame->setData({ {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }, + { {"a", {1, 0}}, {"b", {2, 0}}, {"a", {3, 0}} }); + + std::pair res = foundSame->getTexts(); + std::pair exp_res = {"\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "b
\n" + "a
\n" + ""}; + EXPECT_EQ(res, exp_res); +} + +TEST_F(FoundSameTest, check_progs_with_delete) { + foundSame->setData({ {"a", {1, 0}}, {"d", {2, 0}}, {"a", {3, 0}} }, + { {"a", {1, 0}}, {"a", {3, 0}} }); + + std::pair res = foundSame->getTexts(); + std::pair exp_res = {"\n" + "\n" + "
a
\n" + "d
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "
\n" + "a
\n" + ""}; + EXPECT_EQ(res, exp_res); +} \ No newline at end of file diff --git a/server/internal/metrics/tests/src/main.cpp b/server/internal/metrics/tests/src/main.cpp index 50ba1ce..67bd43b 100755 --- a/server/internal/metrics/tests/src/main.cpp +++ b/server/internal/metrics/tests/src/main.cpp @@ -7,6 +7,5 @@ int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); } -- GitLab From 4c88618bd96fcd74a4ecf1966709b310605ecdc8 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 2 Jun 2023 14:19:19 +0300 Subject: [PATCH 129/134] final refactor --- client/internal/core/src/Core.cpp | 4 +- .../internal/dbManager/include/dbManager.hpp | 8 +- server/internal/entities/include/Solution.hpp | 15 +-- server/internal/entities/src/MetricStat.cpp | 30 ++--- server/internal/entities/src/Solution.cpp | 42 +++---- server/internal/entities/src/Task.cpp | 6 +- server/internal/entities/src/User.cpp | 6 +- server/internal/metrics/src/DiffLibImpl.cpp | 3 +- .../internal/metrics/tests/src/diff_tests.cpp | 96 +++++++------- .../repository/include/MetricRepository.hpp | 4 +- .../repository/include/SolutionRepository.hpp | 4 +- .../repository/include/TaskRepository.hpp | 4 +- .../repository/include/UserRepository.hpp | 4 +- .../repository/src/MetricRepository.cpp | 37 +++--- .../repository/src/SolutionRepository.cpp | 118 ++++++++---------- .../repository/src/TaskRepository.cpp | 35 ++---- .../repository/src/UserRepository.cpp | 43 +++---- .../repository/tests/RepositoryTests.cpp | 16 +-- 18 files changed, 204 insertions(+), 271 deletions(-) mode change 100755 => 100644 server/internal/dbManager/include/dbManager.hpp mode change 100755 => 100644 server/internal/entities/src/MetricStat.cpp mode change 100755 => 100644 server/internal/entities/src/Solution.cpp mode change 100755 => 100644 server/internal/entities/src/Task.cpp mode change 100755 => 100644 server/internal/entities/src/User.cpp mode change 100755 => 100644 server/internal/metrics/src/DiffLibImpl.cpp mode change 100644 => 100755 server/internal/metrics/tests/src/diff_tests.cpp mode change 100755 => 100644 server/internal/repository/include/MetricRepository.hpp mode change 100755 => 100644 server/internal/repository/include/SolutionRepository.hpp mode change 100755 => 100644 server/internal/repository/include/TaskRepository.hpp mode change 100755 => 100644 server/internal/repository/include/UserRepository.hpp mode change 100755 => 100644 server/internal/repository/src/MetricRepository.cpp mode change 100755 => 100644 server/internal/repository/src/SolutionRepository.cpp mode change 100755 => 100644 server/internal/repository/src/TaskRepository.cpp mode change 100755 => 100644 server/internal/repository/src/UserRepository.cpp mode change 100755 => 100644 server/internal/repository/tests/RepositoryTests.cpp diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index 46afc8a..2d16ae8 100755 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -5,8 +5,8 @@ #include "HttpClientManager.h" -//const std::string CLIENT_IP = "195.19.32.74"; -//const std::string CLIENT_PORT = "3005"; +// const std::string CLIENT_IP = "195.19.32.74"; +// const std::string CLIENT_PORT = "3005"; const std::string CLIENT_IP = "0.0.0.0"; const std::string CLIENT_PORT = "8081"; HttpClientManager client(CLIENT_IP, CLIENT_PORT); diff --git a/server/internal/dbManager/include/dbManager.hpp b/server/internal/dbManager/include/dbManager.hpp old mode 100755 new mode 100644 index 55ed031..e99b26e --- a/server/internal/dbManager/include/dbManager.hpp +++ b/server/internal/dbManager/include/dbManager.hpp @@ -10,18 +10,16 @@ #include #include - class dbManager { -public: + public: dbManager(); std::shared_ptr connection(); void freeConnection(const std::shared_ptr &); -private: - const size_t POOL_SIZE = std::getenv("POOL_SIZE") ? - std::stoul(std::getenv("POOL_SIZE")) : 10; + private: + const size_t POOL_SIZE = std::getenv("POOL_SIZE") ? std::stoul(std::getenv("POOL_SIZE")) : 10; std::condition_variable m_condition; void createPool(); diff --git a/server/internal/entities/include/Solution.hpp b/server/internal/entities/include/Solution.hpp index d666fe6..f4aaa99 100644 --- a/server/internal/entities/include/Solution.hpp +++ b/server/internal/entities/include/Solution.hpp @@ -6,7 +6,7 @@ #include class Solution { -public: + public: struct Codes { std::string original; std::string current; @@ -14,16 +14,11 @@ public: Codes() = default; }; - Solution(size_t id, std::string sendDate, - size_t senderId, std::string source, - size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution, std::string language) noexcept; + Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; - Solution(std::string sendDate, size_t senderId, - std::string source, size_t taskId, std::string result, - std::string tokens, std::string astTree, - size_t orig_solution, std::string language) noexcept; + Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, + std::string tokens, std::string astTree, size_t orig_solution, std::string language) noexcept; Solution() noexcept; diff --git a/server/internal/entities/src/MetricStat.cpp b/server/internal/entities/src/MetricStat.cpp old mode 100755 new mode 100644 index 0e91088..86fed05 --- a/server/internal/entities/src/MetricStat.cpp +++ b/server/internal/entities/src/MetricStat.cpp @@ -3,26 +3,26 @@ MetricStat::MetricStat(unsigned long solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, float meanRes) noexcept - : id(0), - solution_id(solutionId), - text_based_res(textBasedRes), - token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), - verdict(verdict), - mean_res(meanRes) {} + : id(0), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat(size_t id, size_t solutionId, float textBasedRes, float tokenBasedRes, float treeBasedRes, bool verdict, float meanRes) noexcept - : id(id), - solution_id(solutionId), - text_based_res(textBasedRes), - token_based_res(tokenBasedRes), - tree_based_res(treeBasedRes), - verdict(verdict), - mean_res(meanRes) {} + : id(id), + solution_id(solutionId), + text_based_res(textBasedRes), + token_based_res(tokenBasedRes), + tree_based_res(treeBasedRes), + verdict(verdict), + mean_res(meanRes) {} MetricStat::MetricStat() noexcept - : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), verdict(true), mean_res(0) {} + : id(0), solution_id(0), text_based_res(0), token_based_res(0), tree_based_res(), verdict(true), mean_res(0) {} size_t MetricStat::getId() const noexcept { return id; } diff --git a/server/internal/entities/src/Solution.cpp b/server/internal/entities/src/Solution.cpp old mode 100755 new mode 100644 index 5757574..1558bb0 --- a/server/internal/entities/src/Solution.cpp +++ b/server/internal/entities/src/Solution.cpp @@ -10,29 +10,29 @@ Solution::Codes::Codes(const std::string &original, const std::string ¤t) Solution::Solution(size_t id, std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept - : id(id), - send_date(std::move(sendDate)), - sender_id(senderId), - source(std::move(source)), - tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), - result(std::move(result)), - orig_solution(orig_solution), - language(std::move(language_)) {} + : id(id), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution), + language(std::move(language_)) {} Solution::Solution(std::string sendDate, size_t senderId, std::string source, size_t taskId, std::string result, std::string tokens, std::string astTree, size_t orig_solution, std::string language_) noexcept - : id(0), - send_date(std::move(sendDate)), - sender_id(senderId), - source(std::move(source)), - tokens(std::move(tokens)), - astTree(std::move(astTree)), - task_id(taskId), - result(std::move(result)), - orig_solution(orig_solution), - language(std::move(language_)) {} + : id(0), + send_date(std::move(sendDate)), + sender_id(senderId), + source(std::move(source)), + tokens(std::move(tokens)), + astTree(std::move(astTree)), + task_id(taskId), + result(std::move(result)), + orig_solution(orig_solution), + language(std::move(language_)) {} size_t Solution::getId() const noexcept { return id; } @@ -74,7 +74,7 @@ size_t Solution::getOrigSolution() const { return orig_solution; } void Solution::setOrigSolution(size_t origSolution) { orig_solution = origSolution; } -Solution::Solution() noexcept: id(0), sender_id(0), task_id(0) {} +Solution::Solution() noexcept : id(0), sender_id(0), task_id(0) {} const std::string &Solution::getLanguage() const { return language; } diff --git a/server/internal/entities/src/Task.cpp b/server/internal/entities/src/Task.cpp old mode 100755 new mode 100644 index 77d471c..c0c3586 --- a/server/internal/entities/src/Task.cpp +++ b/server/internal/entities/src/Task.cpp @@ -4,12 +4,12 @@ #include Task::Task(std::string description_, float treshold_, std::string name_) noexcept - : id(0), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} + : id(0), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} Task::Task(size_t id, std::string description_, float treshold_, std::string name_) noexcept - : id(id), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} + : id(id), description(std::move(description_)), treshhold(treshold_), name(std::move(name_)) {} -Task::Task() noexcept: id(0), treshhold(0) {} +Task::Task() noexcept : id(0), treshhold(0) {} unsigned long Task::getId() const noexcept { return id; } diff --git a/server/internal/entities/src/User.cpp b/server/internal/entities/src/User.cpp old mode 100755 new mode 100644 index 34289fd..f4795d7 --- a/server/internal/entities/src/User.cpp +++ b/server/internal/entities/src/User.cpp @@ -3,12 +3,12 @@ #include User::User(size_t id_, std::string login_, std::string password_, std::string username_) noexcept - : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} + : id(id_), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} User::User(std::string login_, std::string password_, std::string username_) noexcept - : id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} + : id(0), login(std::move(login_)), password(std::move(password_)), username(std::move(username_)) {} -User::User() noexcept: id(0) {} +User::User() noexcept : id(0) {} const std::string &User::getLogin() const noexcept { return login; } diff --git a/server/internal/metrics/src/DiffLibImpl.cpp b/server/internal/metrics/src/DiffLibImpl.cpp old mode 100755 new mode 100644 index f8736c8..230268d --- a/server/internal/metrics/src/DiffLibImpl.cpp +++ b/server/internal/metrics/src/DiffLibImpl.cpp @@ -28,8 +28,7 @@ std::pair FoundSame::getTexts() { std::vector > cache(n + 1, std::vector(m + 1)); for (size_t i = 1; i <= n; i++) { - cache[i][0] = { - "I", {"%", str_int_tokens1[i - 1].second}, str_int_tokens1[i - 1]}; + cache[i][0] = {"I", {"%", str_int_tokens1[i - 1].second}, str_int_tokens1[i - 1]}; } for (size_t i = 1; i <= m; i++) { cache[0][i] = {"D", str_int_tokens2[i - 1], {"#", str_int_tokens2[i - 1].second}}; diff --git a/server/internal/metrics/tests/src/diff_tests.cpp b/server/internal/metrics/tests/src/diff_tests.cpp old mode 100644 new mode 100755 index e9edc26..435908d --- a/server/internal/metrics/tests/src/diff_tests.cpp +++ b/server/internal/metrics/tests/src/diff_tests.cpp @@ -4,73 +4,75 @@ #include #include + #include #include "DiffLib.h" class FoundSameTest : public ::testing::Test { -protected: + protected: std::unique_ptr foundSame; void SetUp() { foundSame = std::make_unique(); } void TearDown() {} }; TEST_F(FoundSameTest, check_eq_progs) { - foundSame->setData({ {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }, - { {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }); + foundSame->setData({{"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}}}, {{"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}}}); - std::pair res = foundSame->getTexts(); - std::pair exp_res = {"\n" - "\n" - "
a
\n" - "a
\n" - "a
\n" - "", - "\n" - "\n" - "
a
\n" - "a
\n" - "a
\n" - ""}; + std::pair res = foundSame->getTexts(); + std::pair exp_res = { + "\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + ""}; EXPECT_EQ(res, exp_res); } TEST_F(FoundSameTest, check_progs_with_replace) { - foundSame->setData({ {"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}} }, - { {"a", {1, 0}}, {"b", {2, 0}}, {"a", {3, 0}} }); + foundSame->setData({{"a", {1, 0}}, {"a", {2, 0}}, {"a", {3, 0}}}, {{"a", {1, 0}}, {"b", {2, 0}}, {"a", {3, 0}}}); - std::pair res = foundSame->getTexts(); - std::pair exp_res = {"\n" - "\n" - "
a
\n" - "a
\n" - "a
\n" - "", - "\n" - "\n" - "
a
\n" - "b
\n" - "a
\n" - ""}; + std::pair res = foundSame->getTexts(); + std::pair exp_res = { + "\n" + "\n" + "
a
\n" + "a
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "b
\n" + "a
\n" + ""}; EXPECT_EQ(res, exp_res); } TEST_F(FoundSameTest, check_progs_with_delete) { - foundSame->setData({ {"a", {1, 0}}, {"d", {2, 0}}, {"a", {3, 0}} }, - { {"a", {1, 0}}, {"a", {3, 0}} }); + foundSame->setData({{"a", {1, 0}}, {"d", {2, 0}}, {"a", {3, 0}}}, {{"a", {1, 0}}, {"a", {3, 0}}}); - std::pair res = foundSame->getTexts(); - std::pair exp_res = {"\n" - "\n" - "
a
\n" - "d
\n" - "a
\n" - "", - "\n" - "\n" - "
a
\n" - "
\n" - "a
\n" - ""}; + std::pair res = foundSame->getTexts(); + std::pair exp_res = { + "\n" + "\n" + "
a
\n" + "d
\n" + "a
\n" + "", + "\n" + "\n" + "
a
\n" + "
\n" + "a
\n" + ""}; EXPECT_EQ(res, exp_res); -} \ No newline at end of file +} diff --git a/server/internal/repository/include/MetricRepository.hpp b/server/internal/repository/include/MetricRepository.hpp old mode 100755 new mode 100644 index 090ddca..ca0fa5f --- a/server/internal/repository/include/MetricRepository.hpp +++ b/server/internal/repository/include/MetricRepository.hpp @@ -10,7 +10,7 @@ using namespace pqxx; class MetricRepository : public IMetricRepository { -public: + public: MetricRepository(); std::optional getById(size_t id) override; @@ -23,7 +23,7 @@ public: void deleteMetricById(size_t id) override; -private: + private: std::shared_ptr manager; static MetricStat makeMetric(const result::const_iterator &c); diff --git a/server/internal/repository/include/SolutionRepository.hpp b/server/internal/repository/include/SolutionRepository.hpp old mode 100755 new mode 100644 index 323d4e4..04f5ae8 --- a/server/internal/repository/include/SolutionRepository.hpp +++ b/server/internal/repository/include/SolutionRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class SolutionRepository : public ISolutionRepository { -public: + public: SolutionRepository(); std::optional getSolutionById(size_t id) override; @@ -36,7 +36,7 @@ public: std::optional getOriginalSolution(size_t id) override; -private: + private: static Solution makeSolution(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/include/TaskRepository.hpp b/server/internal/repository/include/TaskRepository.hpp old mode 100755 new mode 100644 index d9508c9..36106ce --- a/server/internal/repository/include/TaskRepository.hpp +++ b/server/internal/repository/include/TaskRepository.hpp @@ -12,7 +12,7 @@ using namespace pqxx; class TaskRepository : public ITaskRepository { -public: + public: TaskRepository(); std::optional getTaskById(size_t id) override; @@ -27,7 +27,7 @@ public: void deleteTaskById(size_t task_id) override; -private: + private: static Task makeTask(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/include/UserRepository.hpp b/server/internal/repository/include/UserRepository.hpp old mode 100755 new mode 100644 index 29cb3bd..136e5cd --- a/server/internal/repository/include/UserRepository.hpp +++ b/server/internal/repository/include/UserRepository.hpp @@ -13,7 +13,7 @@ using namespace pqxx; class UserRepository : public IUserRepository { -public: + public: UserRepository(); std::optional getUserById(size_t id) override; @@ -30,7 +30,7 @@ public: void update(User user) override; -private: + private: static User makeUser(const result::const_iterator &c); std::shared_ptr manager; diff --git a/server/internal/repository/src/MetricRepository.cpp b/server/internal/repository/src/MetricRepository.cpp old mode 100755 new mode 100644 index b10b4ca..0b9f60b --- a/server/internal/repository/src/MetricRepository.cpp +++ b/server/internal/repository/src/MetricRepository.cpp @@ -1,12 +1,11 @@ +#include "MetricRepository.hpp" + #include #include "MetricStat.hpp" -#include "MetricRepository.hpp" - MetricRepository::MetricRepository() { manager = std::make_shared(); } - std::optional MetricRepository::getById(size_t id) { try { auto c = manager->connection(); @@ -23,18 +22,16 @@ std::optional MetricRepository::getById(size_t id) { } } - size_t MetricRepository::storeMetric(MetricStat metric) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "INSERT INTO metricStat (solution_id, text_based_res, token_based_res, " - "tree_based_res, verdict, mean_res) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - metric.getSolutionId() % metric.getTextBasedRes() % - metric.getTokenBasedRes() % metric.getTreeBasedRes() % - metric.isVerdict() % metric.getMeanRes()).str(); + std::string sql = (boost::format("INSERT INTO metricStat (solution_id, text_based_res, token_based_res, " + "tree_based_res, verdict, mean_res) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % + metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()) + .str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -46,19 +43,16 @@ size_t MetricRepository::storeMetric(MetricStat metric) { } } - void MetricRepository::updateMetric(MetricStat metric) { try { auto c = manager->connection(); - std::string sql = - (boost::format( - "UPDATE metricStat SET solution_id = '%s'," - " text_based_res = '%s', token_based_res = '%s'," - " tree_based_res = '%s', verdict = '%s', mean_res = '%s';") % - metric.getSolutionId() % metric.getTextBasedRes() % - metric.getTokenBasedRes() % metric.getTreeBasedRes() % - metric.isVerdict() % metric.getMeanRes()).str(); + std::string sql = (boost::format("UPDATE metricStat SET solution_id = '%s'," + " text_based_res = '%s', token_based_res = '%s'," + " tree_based_res = '%s', verdict = '%s', mean_res = '%s';") % + metric.getSolutionId() % metric.getTextBasedRes() % metric.getTokenBasedRes() % + metric.getTreeBasedRes() % metric.isVerdict() % metric.getMeanRes()) + .str(); work w(*c); w.exec(sql); @@ -68,10 +62,8 @@ void MetricRepository::updateMetric(MetricStat metric) { } } - void MetricRepository::deleteMetric(MetricStat metric) { deleteMetricById(metric.getId()); } - void MetricRepository::deleteMetricById(size_t id) { try { auto c = manager->connection(); @@ -87,7 +79,6 @@ void MetricRepository::deleteMetricById(size_t id) { } } - MetricStat MetricRepository::makeMetric(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), c.at(c.column_number("solution_id")).as(), diff --git a/server/internal/repository/src/SolutionRepository.cpp b/server/internal/repository/src/SolutionRepository.cpp old mode 100755 new mode 100644 index c16fc79..42bf998 --- a/server/internal/repository/src/SolutionRepository.cpp +++ b/server/internal/repository/src/SolutionRepository.cpp @@ -1,17 +1,15 @@ +#include "SolutionRepository.hpp" + #include #include #include #include "Solution.hpp" -#include "SolutionRepository.hpp" - using namespace pqxx; - SolutionRepository::SolutionRepository() { manager = std::make_shared(); } - std::optional SolutionRepository::getSolutionById(size_t id) { try { auto c = manager->connection(); @@ -28,7 +26,6 @@ std::optional SolutionRepository::getSolutionById(size_t id) { } } - std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_id) { try { auto c = manager->connection(); @@ -37,14 +34,12 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), - get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); @@ -55,7 +50,6 @@ std::vector SolutionRepository::getSolutionsBySenderId(size_t sender_i } } - std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { try { auto c = manager->connection(); @@ -64,14 +58,12 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), - get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); @@ -82,26 +74,23 @@ std::vector SolutionRepository::getSolutionsByTaskId(size_t task_id) { } } - std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t task_id, size_t sender_id) { try { auto c = manager->connection(); - std::string sql = - (boost::format("SELECT * FROM solutions WHERE" - " task_id='%s' AND sender_id='%s'") % task_id % sender_id) - .str(); + std::string sql = (boost::format("SELECT * FROM solutions WHERE" + " task_id='%s' AND sender_id='%s'") % + task_id % sender_id) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), - get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); @@ -112,24 +101,22 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndSenderId(size_t } } - std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t task_id, std::string lang) { try { auto c = manager->connection(); - std::string sql = - (boost::format("SELECT * FROM solutions WHERE" - " task_id='%s' AND language='%s'") % task_id % lang).str(); + std::string sql = (boost::format("SELECT * FROM solutions WHERE" + " task_id='%s' AND language='%s'") % + task_id % lang) + .str(); nontransaction n(*c); auto stream = stream_from::query(n, sql); std::vector solutions; - std::tuple row; + std::tuple + row; while (stream >> row) { - solutions.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row), - get<4>(row), get<5>(row), - get<6>(row), get<7>(row), - get<8>(row), get<9>(row)); + solutions.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row), get<4>(row), get<5>(row), + get<6>(row), get<7>(row), get<8>(row), get<9>(row)); } stream.complete(); @@ -140,13 +127,14 @@ std::vector SolutionRepository::getSolutionsByTaskIdAndLanguage(size_t } } - std::optional SolutionRepository::getOriginalSolution(size_t id) { try { auto c = manager->connection(); - std::string sql = "SELECT * FROM solutions WHERE" - " original_solution_id=" + std::to_string(id); + std::string sql = + "SELECT * FROM solutions WHERE" + " original_solution_id=" + + std::to_string(id); nontransaction n(*c); result r(n.exec(sql)); @@ -158,20 +146,18 @@ std::optional SolutionRepository::getOriginalSolution(size_t id) { } } - size_t SolutionRepository::storeSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " - "astTree, original_solution_id, language) " - "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % - solution.getSendDate() % solution.getSenderId() % - solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % - solution.getAstTree() % solution.getOrigSolution() % - solution.getLanguage()).str(); + std::string sql = + (boost::format("INSERT INTO solutions (send_date,sender_id, source, task_id, result, tokens, " + "astTree, original_solution_id, language) " + "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') RETURNING id; ") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % solution.getTaskId() % + solution.getResult() % solution.getTokens() % solution.getAstTree() % solution.getOrigSolution() % + solution.getLanguage()) + .str(); work w(*c); row r = (w.exec1(sql)); w.commit(); @@ -183,20 +169,17 @@ size_t SolutionRepository::storeSolution(Solution solution) { } } - void SolutionRepository::updateSolution(Solution solution) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," - " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " - "original_solution_id = '%s', language = '%s';") % - solution.getSendDate() % solution.getSenderId() % - solution.getSource() % solution.getTaskId() % - solution.getResult() % solution.getTokens() % - solution.getAstTree() % solution.getOrigSolution() % - solution.getLanguage()).str(); + std::string sql = (boost::format("UPDATE solutions SET send_date = '%s', sender_id = '%s', source = '%s'," + " task_id = '%s', result = '%s', tokens = '%s', astTree = '%s', " + "original_solution_id = '%s', language = '%s';") % + solution.getSendDate() % solution.getSenderId() % solution.getSource() % + solution.getTaskId() % solution.getResult() % solution.getTokens() % solution.getAstTree() % + solution.getOrigSolution() % solution.getLanguage()) + .str(); work w(*c); w.exec(sql); @@ -206,7 +189,6 @@ void SolutionRepository::updateSolution(Solution solution) { } } - void SolutionRepository::deleteSolutionById(size_t id) { try { auto c = manager->connection(); @@ -222,10 +204,8 @@ void SolutionRepository::deleteSolutionById(size_t id) { } } - void SolutionRepository::deleteSolution(Solution solution) { deleteSolutionById(solution.getId()); } - Solution SolutionRepository::makeSolution(const result::const_iterator &c) { return {c.at(c.column_number("id")).as(), c.at(c.column_number("send_date")).as(), diff --git a/server/internal/repository/src/TaskRepository.cpp b/server/internal/repository/src/TaskRepository.cpp old mode 100755 new mode 100644 index 07eef20..bec1dd0 --- a/server/internal/repository/src/TaskRepository.cpp +++ b/server/internal/repository/src/TaskRepository.cpp @@ -1,13 +1,12 @@ +#include "TaskRepository.hpp" + #include #include -#include "TaskRepository.hpp" #include "Task.hpp" - TaskRepository::TaskRepository() { manager = std::make_shared(); } - std::optional TaskRepository::getTaskById(size_t id) { try { auto c = manager->connection(); @@ -26,7 +25,6 @@ std::optional TaskRepository::getTaskById(size_t id) { } } - std::vector TaskRepository::getAllTasks() { try { auto c = manager->connection(); @@ -37,8 +35,7 @@ std::vector TaskRepository::getAllTasks() { std::vector tasks; std::tuple row; while (stream >> row) { - tasks.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row)); + tasks.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); } stream.complete(); @@ -49,14 +46,13 @@ std::vector TaskRepository::getAllTasks() { } } - void TaskRepository::updateTask(const Task &task) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % - task.getDescription() % task.getTreshhold() % task.getName()).str(); + std::string sql = (boost::format("UPDATE tasks SET description = '%s', treshold = '%s', name = '%s';") % + task.getDescription() % task.getTreshhold() % task.getName()) + .str(); work w(*c); w.exec(sql); @@ -66,16 +62,14 @@ void TaskRepository::updateTask(const Task &task) { } } - size_t TaskRepository::storeTask(Task task) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "INSERT INTO tasks (description, treshold, name) " - "VALUES ('%s', '%s', '%s') RETURNING id; ") % - task.getDescription() % task.getTreshhold() % - task.getName()).str(); + std::string sql = (boost::format("INSERT INTO tasks (description, treshold, name) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + task.getDescription() % task.getTreshhold() % task.getName()) + .str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -87,10 +81,8 @@ size_t TaskRepository::storeTask(Task task) { } } - void TaskRepository::deleteTask(Task task) { deleteTaskById(task.getId()); } - void TaskRepository::deleteTaskById(size_t task_id) { try { auto c = manager->connection(); @@ -106,10 +98,7 @@ void TaskRepository::deleteTaskById(size_t task_id) { } } - Task TaskRepository::makeTask(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("description")).as(), - c.at(c.column_number("treshold")).as(), - c.at(c.column_number("name")).as()}; + return {c.at(c.column_number("id")).as(), c.at(c.column_number("description")).as(), + c.at(c.column_number("treshold")).as(), c.at(c.column_number("name")).as()}; } diff --git a/server/internal/repository/src/UserRepository.cpp b/server/internal/repository/src/UserRepository.cpp old mode 100755 new mode 100644 index 689769e..9bfd5ec --- a/server/internal/repository/src/UserRepository.cpp +++ b/server/internal/repository/src/UserRepository.cpp @@ -1,13 +1,13 @@ +#include "UserRepository.hpp" + #include #include -#include "UserRepository.hpp" #include "User.hpp" #include "dbManager.hpp" UserRepository::UserRepository() { manager = std::make_shared(); } - std::optional UserRepository::getUserById(size_t id) { try { auto c = manager->connection(); @@ -24,14 +24,14 @@ std::optional UserRepository::getUserById(size_t id) { } } - std::optional UserRepository::getUserByLogin(std::string login) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "SELECT * FROM Users" - " WHERE login= '%s'") % login).str(); + std::string sql = (boost::format("SELECT * FROM Users" + " WHERE login= '%s'") % + login) + .str(); nontransaction n(*c); result r(n.exec(sql)); @@ -43,15 +43,14 @@ std::optional UserRepository::getUserByLogin(std::string login) { } } - size_t UserRepository::makeUser(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "INSERT INTO users (login,password,username) " - "VALUES ('%s', '%s', '%s') RETURNING id; ") % - user.getLogin() % user.getPassword() % user.getUsername()).str(); + std::string sql = (boost::format("INSERT INTO users (login,password,username) " + "VALUES ('%s', '%s', '%s') RETURNING id; ") % + user.getLogin() % user.getPassword() % user.getUsername()) + .str(); work w(*c); row r = w.exec1(sql); w.commit(); @@ -63,7 +62,6 @@ size_t UserRepository::makeUser(User user) { } } - void UserRepository::deleteByUserId(size_t user_id) { try { auto c = manager->connection(); @@ -79,10 +77,8 @@ void UserRepository::deleteByUserId(size_t user_id) { } } - void UserRepository::deleteUser(User user) { deleteByUserId(user.getId()); } - std::vector UserRepository::getAllUsers() { try { auto c = manager->connection(); @@ -93,8 +89,7 @@ std::vector UserRepository::getAllUsers() { std::vector users; std::tuple row; while (stream >> row) { - users.emplace_back(get<0>(row), get<1>(row), - get<2>(row), get<3>(row)); + users.emplace_back(get<0>(row), get<1>(row), get<2>(row), get<3>(row)); } stream.complete(); @@ -105,15 +100,14 @@ std::vector UserRepository::getAllUsers() { } } - void UserRepository::update(User user) { try { auto c = manager->connection(); - std::string sql = (boost::format( - "UPDATE Users SET login = '%s', " - "password = '%s', username = '%s';") % - user.getLogin() % user.getPassword() % user.getUsername()).str(); + std::string sql = (boost::format("UPDATE Users SET login = '%s', " + "password = '%s', username = '%s';") % + user.getLogin() % user.getPassword() % user.getUsername()) + .str(); work w(*c); w.exec(sql); @@ -123,10 +117,7 @@ void UserRepository::update(User user) { } } - User UserRepository::makeUser(const result::const_iterator &c) { - return {c.at(c.column_number("id")).as(), - c.at(c.column_number("login")).as(), - c.at(c.column_number("password")).as(), - c.at(c.column_number("username")).as()}; + return {c.at(c.column_number("id")).as(), c.at(c.column_number("login")).as(), + c.at(c.column_number("password")).as(), c.at(c.column_number("username")).as()}; } diff --git a/server/internal/repository/tests/RepositoryTests.cpp b/server/internal/repository/tests/RepositoryTests.cpp old mode 100755 new mode 100644 index 6dd5280..fd30789 --- a/server/internal/repository/tests/RepositoryTests.cpp +++ b/server/internal/repository/tests/RepositoryTests.cpp @@ -30,7 +30,6 @@ TEST(UserRepository_CRUD_Test, CRUD) { EXPECT_NO_FATAL_FAILURE(rep.deleteUser(new_user)); } - TEST(TaskRepository_CRUD_Test, CRUD) { TaskRepository rep; @@ -52,7 +51,6 @@ TEST(TaskRepository_CRUD_Test, CRUD) { EXPECT_NO_FATAL_FAILURE(rep.deleteTask(new_task)); } - TEST(SolutionRepository_CRUD_Test, CRUD) { SolutionRepository rep; @@ -74,7 +72,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(new_solution)); } - TEST(MetricRepository_CRUD_Test, CRUD) { MetricRepository rep; MetricStat metricStat(1, 0.8f, 0.9f, 0.89f, true, 0.85f); @@ -93,17 +90,14 @@ TEST(MetricRepository_CRUD_Test, CRUD) { EXPECT_NO_FATAL_FAILURE(rep.deleteMetric(new_stat)); } - TEST(UserRepository_CRUD_Test, getAllUsers) { UserRepository rep; - std::vector v = {{"test@test.com", "test", "testuser"}, - {"test2@test.com", "test2", "testuser2"}}; + std::vector v = {{"test@test.com", "test", "testuser"}, {"test2@test.com", "test2", "testuser2"}}; EXPECT_NO_FATAL_FAILURE(rep.getAllUsers()); std::vector new_v = rep.getAllUsers(); EXPECT_EQ(v, new_v); } - TEST(UserRepository_CRUD_Test, loginLikeId) { UserRepository rep; User user("test@test.com", "test", "testuser"); @@ -116,7 +110,6 @@ TEST(UserRepository_CRUD_Test, loginLikeId) { EXPECT_NO_FATAL_FAILURE(rep.deleteUser(user)); } - TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { SolutionRepository rep; @@ -134,7 +127,7 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { EXPECT_EQ(solution2, rep.getSolutionById(id2)); std::vector v = {{id1, "01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"}, - {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"}}; + {id2, "01.01.1970", 1, "home/usr", 1, "result", "tokens.txt", "tree.txt", 1, "cpp"}}; std::vector new_v = rep.getSolutionsBySenderId(solution1.getSenderId()); EXPECT_EQ(v, new_v); @@ -142,7 +135,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsBySenderId) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } - TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { SolutionRepository rep; @@ -161,7 +153,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskId) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } - TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndLanguage) { SolutionRepository rep; Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); @@ -178,7 +169,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndLanguage) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution2)); } - TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndSenderId) { SolutionRepository rep; Solution solution1("01.01.1970", 1, ":/C/Users", 1, "result", "tokens.txt", "tree.txt", 1, "py"); @@ -199,7 +189,6 @@ TEST(SolutionRepository_CRUD_Test, CRUD_getSolutionsByTaskIdAndSenderId) { EXPECT_NO_FATAL_FAILURE(rep.deleteSolution(solution3)); } - TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { SolutionRepository rep; Solution solution("01.01.1970", 1, ":/C/Users", 100500, "result", "tokens.txt", "tree.txt", 1, "py"); @@ -210,7 +199,6 @@ TEST(SolutionRepository_CRUD_Test, tryToAddWithNotExistingTask) { } } - TEST(SolutionRepository_CRUD_Test, tryToStoreWithNotExistingSender) { SolutionRepository rep; -- GitLab From 3bed88da304c991912852070ba3a7541fc102f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 3 Jun 2023 14:15:39 +0300 Subject: [PATCH 130/134] Update README.md --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 8454e5d..9b808b5 100755 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ # 2023_1_SourcedOut Система антиплагиата для исходного кода на различных ЯП + + +### Разворачивание на сервере: + +1. Склонируйте проект + `git clone http://studgit.smcm.space/nstepanov22/OS4sem.git` +2. Перейдите в папку с проектом + `cd OS4sem` +3. Поднимите контейнер + `docker compose up --build` + +### Запуск клиента: +1. Склонируйте проект + `git clone http://studgit.smcm.space/nstepanov22/OS4sem.git` +2. Перейдите в папку с проектом + `cd ./OS4sem/client` +3. Выполните команды + `mkdir cmake_build && cd cmake_build && cmake .. && make && cd ..` +4. Запустите + `./client/cmake_build/internal/gui/gui_run` \ No newline at end of file -- GitLab From 3fe57f3f50e72c32b079aa849cab159f4848d9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 3 Jun 2023 14:55:13 +0300 Subject: [PATCH 131/134] Update README.md --- README.md | 6 +++++- client/internal/core/src/Core.cpp | 8 ++++---- docker-compose.yml | 18 ++---------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9b808b5..fc3f9ac 100755 --- a/README.md +++ b/README.md @@ -19,4 +19,8 @@ 3. Выполните команды `mkdir cmake_build && cd cmake_build && cmake .. && make && cd ..` 4. Запустите - `./client/cmake_build/internal/gui/gui_run` \ No newline at end of file + `./client/cmake_build/internal/gui/gui_run` + +#### Для запуска клиента необходимо установить библиоткеки: +* Boost 1.82.0 +* Qt 6.4 \ No newline at end of file diff --git a/client/internal/core/src/Core.cpp b/client/internal/core/src/Core.cpp index 2d16ae8..2a7ffcc 100755 --- a/client/internal/core/src/Core.cpp +++ b/client/internal/core/src/Core.cpp @@ -5,10 +5,10 @@ #include "HttpClientManager.h" -// const std::string CLIENT_IP = "195.19.32.74"; -// const std::string CLIENT_PORT = "3005"; -const std::string CLIENT_IP = "0.0.0.0"; -const std::string CLIENT_PORT = "8081"; + const std::string CLIENT_IP = "195.19.32.74"; + const std::string CLIENT_PORT = "3005"; +//const std::string CLIENT_IP = "0.0.0.0"; +//const std::string CLIENT_PORT = "8081"; HttpClientManager client(CLIENT_IP, CLIENT_PORT); std::size_t Core::user_id = -1; diff --git a/docker-compose.yml b/docker-compose.yml index ee7e7d1..159239d 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: volumes: - database-volume:/var/lib/postgresql/data ports: - - "5432:5432" + - "5431:5432" networks: - db-network @@ -33,27 +33,13 @@ services: - .:/project command: bash -c "make build-project && make server-run" ports: - - "8081:8080" + - "3000:8080" depends_on: - db links: - db:db - - docs: - image: nginx - container_name: docs - volumes: - - ./docs/index.html:/usr/share/nginx/html/index.html - - ./docs/openapi.yml:/usr/share/nginx/html/openapi.yml - ports: - - 8080:80 - networks: - - nginx-network networks: db-network: driver: bridge name: db_network - nginx-network: - driver: bridge - name: nginx_network -- GitLab From c74cc396d75394d12fc1e1cc136ad33f84517143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sat, 3 Jun 2023 14:56:21 +0300 Subject: [PATCH 132/134] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc3f9ac..2d7d71d 100755 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ 2. Перейдите в папку с проектом `cd ./OS4sem/client` 3. Выполните команды - `mkdir cmake_build && cd cmake_build && cmake .. && make && cd ..` + `mkdir cmake_build && cd cmake_build && cmake .. && make && cd ../..` 4. Запустите `./client/cmake_build/internal/gui/gui_run` -- GitLab From dc62e901acddbc73309b87d8039a97e83efc502d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Mon, 5 Jun 2023 17:03:17 +0300 Subject: [PATCH 133/134] Small update --- client/internal/gui/CMakeLists.txt | 6 +----- client/internal/httpClient/CMakeLists.txt | 5 +---- client/internal/httpClient/src/HttpClient.cpp | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/client/internal/gui/CMakeLists.txt b/client/internal/gui/CMakeLists.txt index 419c4dd..258ce7b 100755 --- a/client/internal/gui/CMakeLists.txt +++ b/client/internal/gui/CMakeLists.txt @@ -9,7 +9,6 @@ file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) file(GLOB INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) -set(CMAKE_PREFIX_PATH "~/Qt/6.5.0/macos/lib/cmake") find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui) include_directories(${INCLUDE_DIRS} ${libClientEntities_INCLUDE_DIRS} ${CORE_lib_INCLUDE_DIRS}) @@ -24,7 +23,4 @@ set(GUI_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) set(GUI_lib_INCLUDE_DIRS ${GUI_lib_INCLUDE_DIRS} PARENT_SCOPE) add_executable(gui_run main.cpp) -target_link_libraries(gui_run ${GUI_lib_LIB}) - -enable_testing() -add_subdirectory(tests) \ No newline at end of file +target_link_libraries(gui_run ${GUI_lib_LIB}) \ No newline at end of file diff --git a/client/internal/httpClient/CMakeLists.txt b/client/internal/httpClient/CMakeLists.txt index 591e57a..ea3df0a 100755 --- a/client/internal/httpClient/CMakeLists.txt +++ b/client/internal/httpClient/CMakeLists.txt @@ -15,7 +15,4 @@ set(HTTPCLIENT_lib_LIB ${PROJECT_NAME}) set(HTTPCLIENT_lib_LIB ${HTTPCLIENT_lib_LIB} PARENT_SCOPE) set(HTTPCLIENT_lib_INCLUDE_DIRS ${INCLUDE_DIRS}) -set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) - -enable_testing() -add_subdirectory(tests) \ No newline at end of file +set(HTTPCLIENT_lib_INCLUDE_DIRS ${HTTPCLIENT_lib_INCLUDE_DIRS} PARENT_SCOPE) \ No newline at end of file diff --git a/client/internal/httpClient/src/HttpClient.cpp b/client/internal/httpClient/src/HttpClient.cpp index 4c35236..0c74439 100755 --- a/client/internal/httpClient/src/HttpClient.cpp +++ b/client/internal/httpClient/src/HttpClient.cpp @@ -1,4 +1,4 @@ -#include "httpClient.h" +#include "HttpClient.h" #include #include -- GitLab From ff9697b8bc9784be056854c8be4d704246f2adf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=A1=D1=82?= =?UTF-8?q?=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Mon, 5 Jun 2023 17:10:33 +0300 Subject: [PATCH 134/134] Update README.md --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d7d71d..0b47b40 100755 --- a/README.md +++ b/README.md @@ -23,4 +23,16 @@ #### Для запуска клиента необходимо установить библиоткеки: * Boost 1.82.0 -* Qt 6.4 \ No newline at end of file +* Qt 6.4 + +##### Установка boost: +1. Скачайте исходники `wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz` +2. Разархивируйте `tar xvf boost_1_82_0.tar.gz` +3. Выполните следующие команды построчно: + * `cd boost_1_82_0` + * `sudo ./bootstrap.sh --prefix=/usr/local` + * `sudo ./b2 install` +4. Boost установлен, поздравляю + +##### Установка qt: +1. `sudo apt install qt6-base-dev` \ No newline at end of file -- GitLab