CARDS 2.4.121
Package manager for the NuTyX GNU/Linux distribution
webcards.h
1 // webcards.h
2 //
3 // Copyright (c) 2016 - 2020 by NuTyX team (http://nutyx.org)
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 // USA.
19 //
20 
21 #ifndef WEBCARDS_H
22 #define WEBCARD_H
23 
24 #include "pkgrepo.h"
25 #include "mysql.h"
26 
27 #define INSERTPACKAGE(basename, name) listOfPackages.insert("<td>" \
28 + i.arch + "</td>" \
29 + "<td>" + i.branch + "</td>" \
30 + "<td>" + i.collection + "</td>" \
31 + "<td> <a href=\"https://github.com/NuTyX/packages-" + i.arch \
32 + "/tree/" + i.branch + "/" \
33 + i.collection + "/" + basename + "\">" + name + "</a></td>" \
34 + "<td> <a href=\"https://github.com/NuTyX/packages-" + i.arch \
35 + "/commits/" + i.branch + "/" \
36 + i.collection + "/" + basename + "\">" + j.version + "-" + itos(j.release) + "</a></td>" \
37 + "<td>" + j.description + "</td>" \
38 + "<td>" + getDateFromEpoch(j.buildDate) + "</td>")
39 
40 struct contentInfo_t {
41  std::string date;
42  std::vector<std::string> text;
43 };
44 struct arguments_t {
45  std::string packageArch; /* The arch of the package to search */
46  std::string packageBranch; /* The branch of the package to search */
47  std::string docName; /* The page to show */
48  std::string stringSearch; /* The string to search */
49  std::string packageSearch; /* The package to search */
50  std::string type; /* Type of search collection, package, etc */
51 };
52 typedef std::map<std::string, contentInfo_t> content_t;
53 
54 /* populate a vector of string with delimed string from an html formated text */
55 std::vector<std::string> parseHTMLDelimitedList
56 (const std::vector<std::string>& text,
57 const std::string delimiter, const std::string contentTitle);
58 
59 
60 void searchpkg(contentInfo_t &contentInfo, arguments_t &arguments);
61 void visitOfPage(char * Argument);
62 
63 #endif /* WEBCARDS_H */
64 // vim:set ts=2 :
contentInfo_t
Definition: webcards.h:40
arguments_t
Definition: webcards.h:44