Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/shared/Registry.h

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Patch Set: simplify Registry_Key Created July 26, 2014, 5 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include <string>
sergei 2014/07/28 11:46:27 Where is the guard?
2 #include <Windows.h>
3
4 namespace AdblockPlus
5 {
6 /**
7 * An open key in the system registry.
8 *
9 * This class is not completely general.
10 * In particular, it cannot encapsulate the predefined registry keys
11 * such as HKEY_CLASSES_ROOT.
12 * These classes are considered "always open",
13 * and the destructor should not close them.
14 * Rather than trying to detect these predefined keys,
15 * we simply don't allow them to be constructed.
16 * In practice, this is a limitation without much consequence.
17 * If this were a library designed for standalone use,
18 * this limitation might not be appropriate, but it's fine here.
19 */
Oleksandr 2014/07/27 22:13:30 Extensive comments make the code hard to read, IMH
sergei 2014/07/28 11:46:27 I find this particular comment and the comment for
Eric 2014/07/28 11:48:43 These comments are formatted for consumption by Do
20 class Registry_Key
sergei 2014/07/28 11:46:27 remove underscore
21 {
22 /**
23 * Handle to registry key that is open and not predefined.
sergei 2014/07/28 11:46:27 But, for example, this comment and the comment for
24 */
25 HKEY key;
26
27 public:
28 /**
29 * Constructor to open a key as a subkey key of an existing parent.
30 * Opens the key with read-only access.
31 *
32 * The constructor throws if 'key_name' is not found,
33 * to preserve the invariant that the registry key is open.
34 * The constructor also throws if 'key_name' is empty,
35 * to preserve the invariant the the registry key is not predefinded.
36 *
37 * \param parent
38 * An open registry key. This may be one of the predefined keys.
39 * \param key_name
40 * Name of the subkey to be opened under the parent.
41 */
42 Registry_Key(HKEY parent, std::wstring key_name);
sergei 2014/07/28 11:46:27 - const references - keyName
43
44 /**
45 * Destructor always closes the key.
46 */
47 ~Registry_Key();
48
49 /**
50 * Retrieve a value from a name-value pair within the present key.
51 *
52 * Throws if the name is not found within the dictionary.
53 * Throws if the name is found but is not a string.
54 */
55 std::wstring value_wstring(std::wstring name) const;
sergei 2014/07/28 11:46:27 To be consistent with the rest code, it's better t
56 };
57 }
58
OLDNEW

Powered by Google App Engine
This is Rietveld