libcruft-util/cruft/util/win32/registry.hpp

62 lines
1.5 KiB
C++
Raw Permalink Normal View History

2015-08-10 15:47:30 +10:00
/*
2018-08-04 15:14:06 +10:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2015-08-10 15:47:30 +10:00
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
*/
#pragma once
2015-08-10 15:47:30 +10:00
#include "windows.hpp"
#include <winreg.h>
#include "../view.hpp"
2015-08-10 15:47:30 +10:00
#include <set>
#include <string>
namespace cruft::win32 {
2015-08-10 15:47:30 +10:00
class key {
public:
key (key const &root, const char *child, REGSAM rights = KEY_READ);
2015-08-10 15:47:30 +10:00
key (HKEY root, const char *child, REGSAM rights = KEY_READ);
~key ();
class child_iterator {
public:
using value_type = key;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
using iterator_category = std::input_iterator_tag;
child_iterator (key const &_parent);
child_iterator (key const &_parent, int _index);
key operator* (void) const;
child_iterator& operator++ ();
bool operator== (child_iterator const&);
bool operator!= (child_iterator const&);
private:
key const &m_parent;
int m_index;
};
cruft::view<child_iterator> subkeys (void);
std::string name (void) const;
2015-08-10 15:47:30 +10:00
template <typename T>
T data (const char *name = nullptr) const;
std::set<std::string>
values (void) const;
private:
HKEY m_handle;
};
2017-01-05 15:06:49 +11:00
}