summaryrefslogtreecommitdiff
path: root/xmlspec/XMLMirror.h
blob: 96dcfef70ec5f3080a3e91f31411c14a63bc3df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef _H_XMLMIRROR_
#define _H_XMLMIRROR_

// standard C++ includes
#include <string>
#include <vector>
#include <iostream>

// our includes
#include "XMLAttrs.h"
#include "XMLBase.h"

// forward declaration
class XMLSpec;

using namespace std;

// <mirror ...>
class XMLMirror : public XMLBase
{
//
// static object creation functions
//
public:
	/**
	 * static function for creation of an XMLMirror object
	 * .
	 * @param pAttrs Pointer to our attribute structure
	 * @param pSpec Pointer to our spec that is to ultimately
	 *              contain the object
	 * @param bPatch true if we are handling the mirror for a patch
	 * @return true on success, false otherwise
	 **/
	static bool parseCreate(XMLAttrs* pAttrs,
							XMLSpec* pSpec,
							bool bPatch = false);

//
// constructors/destructor
//
public:
	/**
	 * Default constructor for the XMLMirror object
	 * .
	 * @param szPath        Full path for the mirror
	 * @param szDescription Full mirror description
	 * @param szCoutry      Country code for the mirror
	 * @return none
	 **/
	XMLMirror(const char* szPath,
			  const char* szDescription,
			  const char* szCountry);

	/**
	 * Copy contructor
	 * .
	 * @param rMirror Reference to the object to copy
	 * @return none
	 **/
	XMLMirror(const XMLMirror& rMirror);

	/**
	 * Destructor for an XMLMirror object
	 * .
	 * @param none
	 * @return none
	 **/
	~XMLMirror();

//
// operators
//
public:
	/**
	 * Assignment operator
	 * .
	 * @param mirror The mirror to get the values from
	 * @return The modified object
	 **/
	XMLMirror operator=(XMLMirror mirror);

//
// public member functions
//
public:
	/**
	 * Converts an XMLMirror object to a RPM spec file
	 * .
	 * @param rOut File stream
	 * @return none
	 **/
	void toSpecFile(ostream& rOut);

	/**
	 * Converts an XMLMirror object to an XML spec file
	 * .
	 * @param rOut File stream
	 * @return none
	 **/
	void toXMLFile(ostream& rOut);

//
// member variable get/set functions
//
public:
	/**
	 * Checks if we have a path
	 * .
	 * @param none
	 * @return true if we have a path, false otherise
	 **/
	bool hasPath()
	{
		return m_sPath.length() ? true : false;
	}

	/**
	 * Returns the path
	 * .
	 * @param none
	 * @return The path strinbg
	 **/
	const char* getPath()
	{
		return m_sPath.c_str();
	}

	/**
	 * Checks if we have a description set
	 * .
	 * @param none
	 * @return true is we have a description, false otherwise
	 **/
	bool hasDescription()
	{
		return m_sDescription.length() ? true : false;
	}

	/**
	 * Returns the description
	 * .
	 * @param none
	 * @return the description string
	 **/
	const char* getDescription()
	{
		return m_sDescription.c_str();
	}

	/**
	 * Checks if we have a country set
	 * .
	 * @param none
	 * @return true if we have a country, false otherwise
	 **/
	bool hasCountry()
	{
		return m_sCountry.length() ? true : false;
	}

	/**
	 * Gets the country
	 * .
	 * @param none
	 * @return The country string
	 **/
	const char* getCountry()
	{
		return m_sCountry.c_str();
	}

//
// member variables
//
protected:
	string     m_sPath;
	string     m_sDescription;
	string     m_sCountry;
};

#endif