source: appstream-generator/src/asgen/backends/dummy/dummypkg.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 2.2 KB
Line 
1/*
2 * Copyright (C) 2016 Matthias Klumpp <matthias@tenstral.net>
3 *
4 * Licensed under the GNU Lesser General Public License Version 3
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the license, or
9 * (at your option) any later version.
10 *
11 * This software is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20module asgen.backends.dummy.dummypkg;
21
22import std.stdio;
23import std.string;
24import std.array : empty;
25import asgen.backends.interfaces;
26import asgen.logging;
27
28
29final class DummyPackage : Package
30{
31private:
32    string pkgname;
33    string pkgver;
34    string pkgarch;
35    string pkgmaintainer;
36    string[string] desc;
37    string testPkgFname;
38
39public:
40    @property override string name () const { return pkgname; }
41    @property override string ver () const { return pkgver; }
42    @property override string arch () const { return pkgarch; }
43
44    @property override const(string[string]) description () const { return desc; }
45
46    override
47    @property string filename () const { return testPkgFname; }
48    @property void   filename (string fname) { testPkgFname = fname; }
49
50    override
51    @property string maintainer () const { return pkgmaintainer; }
52    @property void   maintainer (string maint) { pkgmaintainer = maint; }
53
54    this (string pname, string pver, string parch)
55    {
56        pkgname = pname;
57        pkgver = pver;
58        pkgarch = parch;
59    }
60
61    ~this ()
62    {
63    }
64
65    void setDescription (string text, string locale)
66    {
67        desc[locale] = text;
68    }
69
70    override
71    ubyte[] getFileData (string fname)
72    {
73        return ['N', 'O', 'T', 'H', 'I', 'N', 'G'];
74    }
75
76    @property override
77    string[] contents ()
78    {
79        return ["NOTHING1", "NOTHING2"];
80    }
81
82    override
83    void close ()
84    {
85    }
86}
Note: See TracBrowser for help on using the repository browser.