File: storage.hpp

package info (click to toggle)
dtl 1.21-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 440 kB
  • sloc: cpp: 2,285; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (2)
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
#ifndef DTL_STORAGE
#define DTL_STORAGE

#include <dtl/dtl.hpp>

template <typename sesElem, typename storedData >
class CustomStorage : public dtl::Storage < sesElem, storedData >
{
public :
    CustomStorage(storedData& sd) : dtl::Storage < sesElem, storedData > (sd) {}
    ~CustomStorage() {}
    void operator() (const sesElem& se) const {
        switch (se.second.type) {
        case dtl::SES_ADD:
            this->storedData_ = this->storedData_ + "Add: " + se.first + "\n";
            break;
        case dtl::SES_DELETE:
            this->storedData_ = this->storedData_ + "Delete: " + se.first + "\n";
            break;
        case dtl::SES_COMMON:
            this->storedData_ = this->storedData_ + "Common: " + se.first + "\n";
            break;
        }
    }
};

#endif // DTL_STORAGE