| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 #include <string> | 
|  | 2 #include <Windows.h> | 
|  | 3 | 
|  | 4 namespace AdblockPlus | 
|  | 5 { | 
|  | 6   /** | 
|  | 7    * An open key in the system registry. | 
|  | 8    */ | 
|  | 9   class Registry_Key | 
|  | 10   { | 
|  | 11     /** | 
|  | 12      * Handle to an open registry key. | 
|  | 13      */ | 
|  | 14     HKEY key; | 
|  | 15 | 
|  | 16     /** | 
|  | 17      * Flag whether the registry key is predefined or not. | 
|  | 18      * | 
|  | 19      * Predefined key values are considered "always open" and should not be clos
    ed in the destructor. | 
|  | 20      */ | 
|  | 21     bool is_predefined; | 
|  | 22 | 
|  | 23   public: | 
|  | 24     /** | 
|  | 25      * Enumeration for predefined root keys. | 
|  | 26      */ | 
|  | 27     enum class Predefined | 
|  | 28       : unsigned int | 
|  | 29     { | 
|  | 30       HKCR = 0,   // HKEY_CLASSES_ROOT | 
|  | 31       HKCC,       // HKEY_CURRENT_CONFIG | 
|  | 32       HKCU,       // HKEY_CURRENT_USER | 
|  | 33       HKLM,       // HKEY_LOCAL_MACHINE | 
|  | 34       HKU         // HKEY_USERS | 
|  | 35     }; | 
|  | 36 | 
|  | 37     /** | 
|  | 38      * Constructor to open a key under one of the predefined roots. | 
|  | 39      * Opens the key with read-only access. | 
|  | 40      * | 
|  | 41      * Because the invariant of this class is that the underlying registry key i
    s open, | 
|  | 42      *   this constructor throws if 'key_name' is not found. | 
|  | 43      */ | 
|  | 44     Registry_Key( Predefined root, std::wstring key_name ); | 
|  | 45 | 
|  | 46     /** | 
|  | 47      * Constructor for one of the predefined roots. | 
|  | 48      */ | 
|  | 49     Registry_Key( Predefined root ); | 
|  | 50 | 
|  | 51     /** | 
|  | 52      * Destructor closes the key if it's not a predefined one. | 
|  | 53      */ | 
|  | 54     ~Registry_Key(); | 
|  | 55 | 
|  | 56     /** | 
|  | 57      * Retrieve a value from a name-value pair within the present key. | 
|  | 58      * | 
|  | 59      * Throws if the name is not found within the dictionary. | 
|  | 60      * Throws if the name is found but is not a string. | 
|  | 61      */ | 
|  | 62     std::wstring value_wstring( std::wstring name ) const; | 
|  | 63   }; | 
|  | 64 } | 
|  | 65 | 
| OLD | NEW | 
|---|