Run cmake-init and setup flake.nix and default.nix
This commit is contained in:
6
source/lib.cpp
Normal file
6
source/lib.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "lib.hpp"
|
||||
|
||||
library::library()
|
||||
: name {"ec-controller"}
|
||||
{
|
||||
}
|
||||
21
source/lib.hpp
Normal file
21
source/lib.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief The core implementation of the executable
|
||||
*
|
||||
* This class makes up the library part of the executable, which means that the
|
||||
* main logic is implemented here. This kind of separation makes it easy to
|
||||
* test the implementation for the executable, because the logic is nicely
|
||||
* separated from the command-line logic implemented in the main function.
|
||||
*/
|
||||
struct library
|
||||
{
|
||||
/**
|
||||
* @brief Simply initializes the name member to the name of the project
|
||||
*/
|
||||
library();
|
||||
|
||||
std::string name;
|
||||
};
|
||||
12
source/main.cpp
Normal file
12
source/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "lib.hpp"
|
||||
|
||||
auto main() -> int
|
||||
{
|
||||
auto const lib = library {};
|
||||
auto const message = "Hello from " + lib.name + "!";
|
||||
std::cout << message << '\n';
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user