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>
|
|
|
|
*/
|
|
|
|
|
2021-04-14 15:35:49 +10:00
|
|
|
#pragma once
|
2015-08-10 15:47:30 +10:00
|
|
|
|
2018-08-27 14:16:27 +10:00
|
|
|
#include "windows.hpp"
|
2018-08-24 17:32:04 +10:00
|
|
|
|
2019-01-04 17:11:53 +11:00
|
|
|
#include <winreg.h>
|
|
|
|
|
2018-08-27 14:16:27 +10:00
|
|
|
#include "../view.hpp"
|
2015-08-10 15:47:30 +10:00
|
|
|
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
namespace cruft::win32 {
|
2015-08-10 15:47:30 +10:00
|
|
|
class key {
|
|
|
|
public:
|
2018-08-24 17:32:04 +10:00
|
|
|
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 ();
|
|
|
|
|
2018-08-24 17:32:04 +10:00
|
|
|
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
|
|
|
}
|