Revision 1 (by moose, 2006/03/06 10:00:33) Initial Import
// CacheIter.cpp - An STL Iterator for the Internet Explorer Cache

// Copyright 2000 by Samir Bajaj

//

// NOTES

//     This file contains the entry point for the application that

//     demonstrates the implementation and use of an STL Iterator 

//     for the Internet Explorer Cache.

//

//     Additional library module: WININET.LIB


#include <windows.h>

#include <algorithm>

#include <numeric>

#include "FuncObjs.h"

#include "CacheIter.h"


const unsigned int cache_iterator::CACHE_ENTRY_INFO_SIZE = 4096;



int main()
{
    using namespace std;

    // count of entries in the cache

    cout << "Total count: " << count_if(cache_iterator(), cache_iterator(0), 
                                        always_true<cache_iterator::value_type>()) << endl;
    
    // for_each to display all entries

    for_each(cache_iterator(), cache_iterator(0), display_cache_entry());

    // accumulate() to add up the size of all cache entries

    cout << accumulate(cache_iterator(), cache_iterator(0), 0, cache_file_size()) << endl;

    return 0;
}