diff --git a/configuration/gui/meson.build b/configuration/gui/meson.build index 0e00908dace4ee1abcfb352f464d9a621794895d..e07a4614a428ed8abb13f09abdcb8b8a272d5493 100644 --- a/configuration/gui/meson.build +++ b/configuration/gui/meson.build @@ -1,4 +1,4 @@ -project('testproject', 'cpp', +project('GUI Project', 'cpp', version : '0.1', default_options : ['warning_level=2', 'cpp_std=c++20', @@ -14,8 +14,7 @@ else endif animationwindow_dep = dependency('animationwindow', fallback: ['animationwindow', 'animationwindow_dep']) -# TODO: slett std_lib_facilities fra animationwindow. Kommenter samtidig ut de to følgende linjene -# std_lib_facilities_dep = dependency('std_lib_facilities', fallback: ['std_lib_facilities', 'std_lib_facilities_dep']) +std_lib_facilities_dep = dependency('std_lib_facilities', fallback: ['std_lib_facilities', 'std_lib_facilities_dep']) if host_machine.system() == 'linux' @@ -26,4 +25,4 @@ endif src = ['main.cpp'] -exe = executable('program', src, dependencies : [animationwindow_dep, sdl2_dep], cpp_args : compiler_flags) +exe = executable('program', src, dependencies : [animationwindow_dep, sdl2_dep, std_lib_facilities_dep], cpp_args : compiler_flags) diff --git a/configuration/nogui/meson.build b/configuration/nogui/meson.build index 5f00880c76a7aed2368ac6882af50a34cc85f2e9..805c12975d1c538a7e2a6b4e6dc4f32cd80d329b 100644 --- a/configuration/nogui/meson.build +++ b/configuration/nogui/meson.build @@ -1,4 +1,4 @@ -project('testproject', 'cpp', +project('CLI Project', 'cpp', version : '0.1', default_options : ['warning_level=2', 'cpp_std=c++20', diff --git a/dependencies/subprojects/animationwindow/include/std_lib_facilities.h b/dependencies/subprojects/animationwindow/include/std_lib_facilities.h deleted file mode 100644 index 8c17b656fe384f04085985c861417a6a1b6f69f0..0000000000000000000000000000000000000000 --- a/dependencies/subprojects/animationwindow/include/std_lib_facilities.h +++ /dev/null @@ -1,184 +0,0 @@ -/** @file */ -/* - std_lib_facilities.h -*/ - -/* - simple "Programming: Principles and Practice using C++ (second edition)" - course header to be used for the first few weeks. It provides the most common - standard headers (in the global namespace) and minimal exception/error - support. - - Students: please don't try to understand the details of headers just - yet. All will be explained. This header is primarily used so that you don't - have to understand every concept all at once. - - By Chapter 10, you don't need this file and after Chapter 21, you'll - understand it - - Revised April 25, 2010: simple_error() added - - Revised November 25 2013: remove support for pre-C++11 compilers, use - C++11: <chrono> Revised November 28 2013: add a few container algorithms - Revised June 8 2014: added #ifndef to workaround Microsoft C++11 - weakness - - Revised for TDT4102, NTNU, 21 December 2018: - - more std libs included. - - Revised on 30.08.2022: - - Removed std::list and std::forward_list includes - - Removed keep_window_open() functions - - Use TDT4102 namespace -*/ - -#pragma once - -#include <iostream> -#include <iomanip> -#include <fstream> -#include <sstream> -#include <cmath> -#include <cstdlib> -#include <string> -#include <vector> -#include <unordered_map> -#include <filesystem> -#include <algorithm> -#include <array> -#include <regex> -#include <random> -#include <stdexcept> -#include <set> - -#include <chrono> -#include <numeric> -#include <map> -#include "internal/windows_main_fix.h" - -//------------------------------------------------------------------------------ - -using Unicode = long; - -//------------------------------------------------------------------------------ - -// Create an empty namespace so we can use it -namespace TDT4102 { - -} - -using namespace std; -using namespace TDT4102; - -template <class T> string to_string(const T& t) -{ - ostringstream os; - os << t; - return os.str(); -} - -struct Range_error : out_of_range -{ // enhanced vector range error reporting - int index; - Range_error(int i) : out_of_range("Range error: " + to_string(i)), index(i) - {} -}; - -struct Exit : runtime_error -{ - Exit() : runtime_error("Exit") - {} -}; - -// error() simply disguises throws: -[[ noreturn ]] inline void error(const string& s) -{ - throw runtime_error(s); -} - -[[ noreturn ]] inline void error(const string& s, const string& s2) -{ - error(s + s2); -} - -[[ noreturn ]] inline void error(const string& s, int i) -{ - ostringstream os; - os << s << ": " << i; - error(os.str()); -} - - -template <class T> char* as_bytes(T& i) // needed for binary I/O -{ - void* addr = &i; // get the address of the first byte - // of memory used to store the object - return static_cast<char*>(addr); // treat that memory as bytes -} - -// error function to be used (only) until error() is introduced in Chapter 5: -[[ noreturn ]] inline void simple_error(string s) // write ``error: s and exit program -{ - cerr << "error: " << s << '\n'; - exit(1); -} - -// make std::min() and std::max() accessible on systems with antisocial macros: -#undef min -#undef max - -// run-time checked narrowing cast (type conversion). -template <class R, class A> R narrow_cast(const A& a) -{ - R r = R(a); - if (A(r) != a) - error(string("info loss")); - return r; -} - -// random number generators. See 24.7. -inline int randint(int min, int max) -{ - auto seed = std::chrono::system_clock::now().time_since_epoch().count(); - static default_random_engine ran{static_cast<unsigned int>(seed)}; - return uniform_int_distribution<>{min, max}(ran); -} - -inline int randint(int max) -{ - return randint(0, max); -} - -// container algorithms. See 21.9. - -template <typename C> using Value_type = typename C::value_type; - -template <typename C> using Iterator = typename C::iterator; - -template <typename C> -// requires Container<C>() -void sort(C& c) -{ - std::sort(c.begin(), c.end()); -} - -template <typename C, typename Pred> -// requires Container<C>() && Binary_Predicate<Value_type<C>>() -void sort(C& c, Pred p) -{ - std::sort(c.begin(), c.end(), p); -} - -template <typename C, typename Val> -// requires Container<C>() && Equality_comparable<C,Val>() -Iterator<C> find(C& c, Val v) -{ - return std::find(c.begin(), c.end(), v); -} - -template <typename C, typename Pred> -// requires Container<C>() && Predicate<Pred,Value_type<C>>() -Iterator<C> find_if(C& c, Pred p) -{ - return std::find_if(c.begin(), c.end(), p); -} diff --git a/templates/Configuration only/.gitkeep b/templates/GUI Configuration/.gitkeep similarity index 100% rename from templates/Configuration only/.gitkeep rename to templates/GUI Configuration/.gitkeep diff --git a/templates/_nogui_Conf CLI only/.gitkeep b/templates/_nogui_No GUI Configuration/.gitkeep similarity index 100% rename from templates/_nogui_Conf CLI only/.gitkeep rename to templates/_nogui_No GUI Configuration/.gitkeep