Gabriele Contini
2019-09-10 82f9d834ad772b2f16b6524f679d14d8a7afe881
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * LicenseSigner.h
 *
 *  Created on: Apr 6, 2014
 *      
 */
 
#ifndef LICENSE_GENERATOR_H_
#define LICENSE_GENERATOR_H_
 
#include <boost/program_options.hpp>
#include "../../library/LicenseReader.h"
 
namespace license {
 
namespace po = boost::program_options;
/**
 * This class contains all the logic used to generate a new license.
 * Since it has no method "main", can be easily used in unit tests.
 */
class LicenseGenerator {
private:
    LicenseGenerator();
    static void printHelp(const char* prog_name, const po::options_description& options);
    static po::options_description configureProgramOptions();
    static vector<FullLicenseInfo> parseLicenseInfo(const po::variables_map& vm);
    static void generateAndOutputLicenses(const po::variables_map& vm,
            ostream& outputFile);
    static string normalize_date(const std::string& s);
public:
    /**
     * Available options:
     * <ul>
     *     <li>-s : use Client Signature.</li>
     * </ul>
     * @param argc
     *             count of arguments.
     * @param argv
     *             char** of parameters.
     * @return
     */
    static int generateLicense(int argc, const char** argv);
};
 
} /* namespace license */
 
#endif /* LICENSE_GENERATOR_H_ */