registry.h 957 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <util/generic/string.h>
  3. #include <util/generic/strbuf.h>
  4. #include "resource.h"
  5. namespace NResource {
  6. TString Compress(const TStringBuf data);
  7. TString Decompress(const TStringBuf data);
  8. class IMatch {
  9. public:
  10. virtual void OnMatch(const TResource& res) = 0;
  11. virtual ~IMatch() = default;
  12. };
  13. class IStore {
  14. public:
  15. virtual void Store(const TStringBuf key, const TStringBuf data) = 0;
  16. virtual bool Has(const TStringBuf key) const = 0;
  17. virtual bool FindExact(const TStringBuf key, TString* out) const = 0;
  18. virtual void FindMatch(const TStringBuf subkey, IMatch& cb) const = 0;
  19. virtual size_t Count() const noexcept = 0;
  20. virtual TStringBuf KeyByIndex(size_t idx) const = 0;
  21. virtual ~IStore() = default;
  22. };
  23. IStore* CommonStore();
  24. struct TRegHelper {
  25. TRegHelper(const TStringBuf key, const TStringBuf data);
  26. };
  27. }