]> git.saurik.com Git - apt.git/blame - test/scratch.cc
g++- works
[apt.git] / test / scratch.cc
CommitLineData
2fd65468
AL
1#include <string>
2/*void basic_string<char,string_char_traits<char>,alloc>::Rep::release()
3{
4 cout << "Release " << (void *)this << ' ' << ref << endl;
5 if (--ref == 0) delete this;
6}
7
8basic_string<char,string_char_traits<char>,alloc>::~basic_string()
9{
10 cout << "Destroy " << (void *)this << ',' << rep()->ref << endl;
11 rep ()->release ();
12}*/
13
14
15
2b154e53 16#include <apt-pkg/tagfile.h>
3856756b 17#include <apt-pkg/strutl.h>
024835dc 18
2fd65468
AL
19#include <apt-pkg/cachefile.h>
20#include <apt-pkg/pkgrecords.h>
21#include <apt-pkg/error.h>
22#include <apt-pkg/init.h>
23
b98f2859
AL
24#include <signal.h>
25#include <stdio.h>
2fd65468
AL
26#include <malloc.h>
27
28struct Rep
29{
30 size_t len, res, ref;
31 bool selfish;
32};
b98f2859 33
93bf083d 34int main(int argc,char *argv[])
024835dc 35{
2fd65468
AL
36 pkgCacheFile Cache;
37 OpProgress Prog;
38 pkgInitialize(*_config);
39 if (Cache.Open(Prog,false) == false)
40 {
41 _error->DumpErrors();
42 return 0;
43 }
44
45 pkgRecords rec(*Cache);
46 while (1)
47 {
48 pkgCache::VerIterator V = (*Cache)[Cache->PkgBegin()].CandidateVerIter(*Cache);
49 pkgRecords::Parser &Parse = rec.Lookup(V.FileList());
50 string Foo = Parse.ShortDesc();
51
52 cout << (reinterpret_cast<Rep *>(Foo.begin()) - 1)[0].ref << endl;
53
54// cout << Foo << endl;
55
56// cout << rec.Lookup(V.FileList()).ShortDesc() << endl;
57 malloc_stats();
58 }
59
60#if 0
3856756b
AL
61 URI U(argv[1]);
62 cout << U.Access << endl;
63 cout << U.User << endl;
64 cout << U.Password << endl;
65 cout << U.Host << endl;
66 cout << U.Path << endl;
67 cout << U.Port << endl;
68
69/*
2b154e53
AL
70 FileFd F(argv[1],FileFd::ReadOnly);
71 pkgTagFile Reader(F);
72
73 pkgTagSection Sect;
74 while (Reader.Step(Sect) == true)
75 {
76 Sect.FindS("Package");
77 Sect.FindS("Section");
78 Sect.FindS("Version");
79 Sect.FindI("Size");
3856756b 80 };*/
2fd65468 81#endif
f46e7681 82 return 0;
024835dc 83}