OpenASIP 2.2
Loading...
Searching...
No Matches
LicenseGenerator.cc
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 Tampere University.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18*/
19/**
20 * @file LicenseGenerator.cc
21 *
22 * Helper class for generating licenses
23 *
24 * @author Kari Hepola 2023 (kari.hepola@tuni.fi)
25 * @note rating: red
26 */
27
28#include "LicenseGenerator.hh"
29
30/**
31 * Destructor
32*/
33
35
36/**
37 * Generates a MIT license header for a module.
38 * @param year The copyright year
39 * @param comment String used for comment
40 * @return The generated MIT license
41*/
42
43std::string
45const std::string& comment) {
46 std::string license;
47 license =
48 comment + " Copyright (c) " + year + " Tampere University.\n"
49 + comment + "\n"
50 + comment + " Module generated by OpenASIP.\n"
51 + comment + "\n"
52 + comment + " Permission is hereby granted, free of charge, to any"
53 " person obtaining a\n"
54 + comment + " copy of this software and associated documentation files"
55 " (the \"Software\"),\n"
56 + comment + " to deal in the Software without restriction, including"
57 " without limitation\n"
58 + comment + " the rights to use, copy, modify, merge, publish, "
59 "distribute, sublicense,\n"
60 + comment + " and/or sell copies of the Software, and to permit "
61 "persons to whom the\n"
62 + comment + " Software is furnished to do so, subject to the following"
63 " conditions:\n"
64 + comment + "\n"
65 + comment + " The above copyright notice and this permission notice"
66 " shall be included in\n"
67 + comment + " all copies or substantial portions of the Software.\n"
68 + comment + "\n"
69 + comment + " THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY"
70 " OF ANY KIND, EXPRESS OR\n"
71 + comment + " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES"
72 " OF MERCHANTABILITY,\n"
73 + comment + " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT."
74 " IN NO EVENT SHALL THE\n"
75 + comment + " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,"
76 " DAMAGES OR OTHER\n"
77 + comment + " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR"
78 " OTHERWISE, ARISING\n"
79 + comment + " FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR"
80 " THE USE OR OTHER\n"
81 + comment + " DEALINGS IN THE SOFTWARE.\n\n";
82
83 return license;
84}
static std::string generateMITLicense(const std::string &year, const std::string &comment)