SearchSECODatabaseAPI
Types.h
1/*
2This program has been developed by students from the bachelor Computer Science at
3Utrecht University within the Software Project course.
4© Copyright Utrecht University (Department of Information and Computing Sciences)
5*/
6
7#pragma once
8#include <ctime>
9#include <vector>
10
11#include "md5/md5.h"
12
13namespace types
14{
15
16 typedef std::string AuthorID;
17 typedef long long ProjectID;
18 typedef std::string Hash;
19 typedef std::string File;
20 typedef time_t Version;
21
25 struct Author
26 {
27 public:
28 std::string name;
29 std::string mail;
30 std::string id;
31 Author() : name(""), mail(""), id("")
32 {
33 }
34
40 Author(std::string name, std::string mail) : name(name), mail(mail)
41 {
42 id = md5(name + " " + mail);
43 }
44 };
45
49 struct MethodIn
50 {
51 public:
52 Hash hash;
53 std::string methodName;
54 File fileLocation;
55 int lineNumber;
56 std::string vulnCode;
57 std::vector<Author> authors;
58 };
59
64 struct MethodOut
65 {
66 public:
67 Hash hash;
68 ProjectID projectID;
69 File fileLocation;
70 Version startVersion;
71 std::string startVersionHash;
72 Version endVersion;
73 std::string endVersionHash;
74 std::string methodName;
75 int lineNumber;
76 std::string vulnCode;
77 std::vector<AuthorID> authorIDs;
78 long long parserVersion;
79 };
80
81 struct MethodID
82 {
83 public:
84 Hash hash;
85 ProjectID projectID;
86 File fileLocation;
87 Version startVersion;
88 };
89
93 struct ProjectIn
94 {
95 public:
96 ProjectID projectID;
97 Version version;
98 std::string versionHash;
99 std::string license;
100 std::string name;
101 std::string url;
102 Author owner = Author("", "");
103 std::vector<Hash> hashes;
104 long long parserVersion;
105 };
106
112 {
113 public:
114 ProjectID projectID;
115 Version version;
116 std::string versionHash;
117 std::string license;
118 std::string name;
119 std::string url;
120 AuthorID ownerID;
121 std::vector<Hash> hashes;
122 long long parserVersion;
123 };
124} // namespace types
Represents the data of an author.
Definition: Types.h:26
Author(std::string name, std::string mail)
Constructs an author with provided name and mail, and generates id as the MD5-hash of the concatenate...
Definition: Types.h:40
Definition: Types.h:82
Represents the relevant data of a method to be put in the database.
Definition: Types.h:50
Represents the data of a method to be returned to the user. Difference with MethodIn: authorIDs inste...
Definition: Types.h:65
Represents the relevant data of a project when it is put into the database.
Definition: Types.h:94
Represents the relevant data of a project when it is returned to user. Difference with ProjectIn: aut...
Definition: Types.h:112