#pragma once /** helper class to iterate all free clusters of the Filesystem */ class FreeClusterIterator { FS& fs; ClusterNr cur; public: FreeClusterIterator(FS& fs) : fs(fs), cur(2) { } /** get the next free cluster that is available */ ClusterNr next() { while(true) { const ClusterNr tmp = fs.getNextCluster(cur); if (tmp.isFree()) {return cur;} ++cur; } } };