Botan  1.11.15
src/lib/utils/datastor/datastor.h
Go to the documentation of this file.
00001 /*
00002 * Data Store
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_DATA_STORE_H__
00009 #define BOTAN_DATA_STORE_H__
00010 
00011 #include <botan/secmem.h>
00012 #include <functional>
00013 #include <utility>
00014 #include <string>
00015 #include <vector>
00016 #include <map>
00017 
00018 namespace Botan {
00019 
00020 /**
00021 * Data Store
00022 */
00023 class BOTAN_DLL Data_Store
00024    {
00025    public:
00026       /**
00027       * A search function
00028       */
00029       bool operator==(const Data_Store&) const;
00030 
00031       std::multimap<std::string, std::string> search_for(
00032          std::function<bool (std::string, std::string)> predicate) const;
00033 
00034       std::vector<std::string> get(const std::string&) const;
00035 
00036       std::string get1(const std::string& key) const;
00037 
00038       std::string get1(const std::string& key,
00039                        const std::string& default_value) const;
00040 
00041       std::vector<byte> get1_memvec(const std::string&) const;
00042       u32bit get1_u32bit(const std::string&, u32bit = 0) const;
00043 
00044       bool has_value(const std::string&) const;
00045 
00046       void add(const std::multimap<std::string, std::string>&);
00047       void add(const std::string&, const std::string&);
00048       void add(const std::string&, u32bit);
00049       void add(const std::string&, const secure_vector<byte>&);
00050       void add(const std::string&, const std::vector<byte>&);
00051    private:
00052       std::multimap<std::string, std::string> contents;
00053    };
00054 
00055 }
00056 
00057 #endif