blob: ad5016b2876d4df66684b72beaed0e59784748d9 (
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
|
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire.cc,v 1.2 1998/10/20 02:39:15 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
#ifdef __GNUG__
#pragma implementation "apt-pkg/acquire.h"
#endif
#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <strutl.h>
/*}}}*/
// Acquire::pkgAcquire - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcquire::pkgAcquire()
{
Queues = 0;
Configs = 0;
}
/*}}}*/
// Acquire::~pkgAcquire - Destructor /*{{{*/
// ---------------------------------------------------------------------
/* Free our memory */
pkgAcquire::~pkgAcquire()
{
while (Items.size() != 0)
delete Items[0];
while (Configs != 0)
{
MethodConfig *Jnk = Configs;
Configs = Configs->Next;
delete Jnk;
}
}
/*}}}*/
// Acquire::Add - Add a new item /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcquire::Add(Item *Itm)
{
Items.push_back(Itm);
}
/*}}}*/
// Acquire::Remove - Remove a item /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcquire::Remove(Item *Itm)
{
for (vector<Item *>::iterator I = Items.begin(); I < Items.end(); I++)
{
if (*I == Itm)
Items.erase(I);
}
}
/*}}}*/
// Acquire::Enqueue - Queue an URI for fetching /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcquire::Enqueue(Item *Item,string URI)
{
cout << "Fetching " << URI << endl;
cout << " to " << Item->ToFile() << endl;
cout << " Queue is: " << QueueName(URI) << endl;
}
/*}}}*/
// Acquire::QueueName - Return the name of the queue for this URI /*{{{*/
// ---------------------------------------------------------------------
/* */
string pkgAcquire::QueueName(string URI)
{
const MethodConfig *Config = GetConfig(URIAccess(URI));
return string();
}
/*}}}*/
// Acquire::GetConfig - Fetch the configuration information /*{{{*/
// ---------------------------------------------------------------------
/* This locates the configuration structure for an access method. If
a config structure cannot be found a Worker will be created to
retrieve it */
const pkgAcquire::MethodConfig *pkgAcquire::GetConfig(string Access)
{
// Search for an existing config
MethodConfig *Conf;
for (Conf = Configs; Conf != 0; Conf = Conf->Next)
if (Conf->Access == Access)
return Conf;
// Create the new config class
Conf = new MethodConfig;
Conf->Access = Access;
Conf->Next = Configs;
Configs = Conf;
// Create the worker to fetch the configuration
Worker Work(Conf);
if (Work.Start() == false)
return 0;
return Conf;
}
/*}}}*/
// Acquire::MethodConfig::MethodConfig - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
pkgAcquire::MethodConfig::MethodConfig()
{
SingleInstance = false;
PreScan = false;
}
/*}}}*/
|