]> cygwin.com Git - cygwin-apps/setup.git/blob - package_source.h
2002-04-29 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / package_source.h
1 /*
2 * Copyright (c) 2001, Robert Collins.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 /* this is the parent class for all package source (not source code - installation
17 * source as in http/ftp/disk file) operations.
18 */
19
20 #ifndef _PACKAGE_SOURCE_H_
21 #define _PACKAGE_SOURCE_H_
22
23 /* required to parse this file */
24 #include "list.h"
25 #include "strings.h"
26 #include "String++.h"
27
28 /* standard binary package metadata:
29 * Name (ie mutt
30 * Vendor Version (ie 2.5.1)
31 * Package Version (ie 16)
32 * Stability
33 * Files
34 */
35
36 /* For non installed files, this class can be populated via information about
37 * what is available on the net, or by parsing a specific package file.
38 * for installed packages, this class should represent what is currently installed,
39 * - updated by what net metadata has about it.
40 * i.e. the stability of this version will change simply because the net mirrors
41 * now consider it old.
42 */
43
44 class site
45 {
46 public:
47 site (String const &newkey);
48 ~site ()
49 {
50 };
51 String key;
52 };
53
54 class packagesource
55 {
56 public:
57 packagesource ():size (0), canonical (0), base (0), filename (0), cached ()
58 {
59 };
60 /* how big is the source file */
61 size_t size;
62 /* The canonical name - the complete path to the source file
63 * i.e. foo/bar/package-1.tar.bz2
64 */
65 virtual const char *Canonical ()
66 {
67 return canonical;
68 };
69 /* The basename - without extention
70 * i.e. package-1
71 */
72 virtual const char *Base ()
73 {
74 return base;
75 };
76 /* The basename - with extention
77 * i.e. package-1.tar.bz2
78 */
79 virtual const char *Filename ()
80 {
81 return filename;
82 };
83 /* what is the cached filename, to prevent directory scanning during install */
84 virtual char const *Cached ()
85 {
86 return cached.cstr_oneuse();
87 };
88 /* sets the canonical path, and parses and creates base and filename */
89 virtual void set_canonical (char const *);
90 virtual void set_cached (String const &);
91 list < site, String, String::casecompare > sites;
92
93 virtual ~ packagesource ()
94 {
95 if (canonical)
96 delete []canonical;
97 if (base)
98 delete []base;
99 if (filename)
100 delete []filename;
101 };
102
103 private:
104 char *canonical;
105 char *base;
106 char *filename;
107 String cached;
108 };
109
110 #endif /* _PACKAGE_SOURCE_H_ */
This page took 0.039508 seconds and 5 git commands to generate.