1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 2004 Walter Franzini
4 //	Copyright (C) 2008 Peter Miller
5 //
6 //	This program is free software; you can redistribute it and/or modify
7 //	it under the terms of the GNU 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 program 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 General Public License for more details.
15 //
16 //	You should have received a copy of the GNU General Public License
17 //	along with this program. If not, see
18 //	<http://www.gnu.org/licenses/>.
19 //
20 
21 #ifndef AEDIST_REPLAY_LINE_H
22 #define AEDIST_REPLAY_LINE_H
23 
24 #include <common/nstring.h>
25 
26 /**
27   * The replay line is used to represent a line read from the output of
28   * /cgi-bin/aeget/projname?inventory
29   */
30 class replay_line
31 {
32 public:
33     /**
34       * The destructor.
35       */
36     virtual ~replay_line();
37 
38     /**
39       * The default constructor.
40       */
41     replay_line();
42 
43     /**
44       * The copy constructor.
45       */
46     replay_line(const replay_line &arg);
47 
48     /**
49       * The assignment operator.
50       */
51     replay_line &operator=(const replay_line &arg);
52 
53     /**
54       * The extract method is used to dismantle a line of text into its
55       * component parts.
56       *
57       * \param arg
58       *     The string representing the line to be dismantled.
59       * \returns
60       *     bool; false if the line is not in the correct format, true
61       *     if the line was in the correct format and was successfully
62       *     dismantled.
63       */
64     bool extract(const nstring &arg);
65 
66     /**
67       * The get_version method is used to get the version part of the
68       * dismantled line.
69       */
get_version()70     nstring get_version() const { return version; }
71 
72     /**
73       * The get_uuid method is used to get the UUID part of the
74       * dismantled line.
75       */
get_uuid()76     nstring get_uuid() const { return uuid; }
77 
78     /**
79       * The get_description method is used to get the brief description
80       * part of the dismantled line.
81       */
get_description()82     nstring get_description() const { return description; }
83 
84     /**
85       * The get_url2 method is used to get the URL wrapped around the
86       * UUID, which is the one for downloading from.
87       */
get_url2()88     nstring get_url2() const { return url2; }
89 
90 private:
91     /**
92       * The url1 instance variable is used to remember the change menu URL
93       * extracted (it is wrapped around the version number in each row).
94       */
95     nstring url1;
96 
97     /**
98       * The version instance variable is used to remember the version
99       * extracted.
100       */
101     nstring version;
102 
103     /**
104       * The url2 instance variable is used to remember the download URL
105       * extracted (it is wrapped around the UUID in each row).
106       */
107     nstring url2;
108 
109     /**
110       * The uuid instance variable is used to remember the UUID
111       * extracted.
112       */
113     nstring uuid;
114 
115     /**
116       * The version instance variable is used to remember the breif
117       * description extracted.
118       */
119     nstring description;
120 };
121 
122 #endif // AEDIST_REPLAY_LINE_H
123