Changeset 31073 in vbox
- Timestamp:
- Jul 23, 2010 7:04:04 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
idl/VirtualBox.xidl (modified) (3 diffs)
-
xml/Settings.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31072 r31073 472 472 </const> 473 473 <const name="Future" value="99999"> 474 <desc>Settings version greater than "1.1 0", written by a future VirtualBox version.</desc>474 <desc>Settings version greater than "1.11", written by a future VirtualBox version.</desc> 475 475 </const> 476 476 </enum> … … 4009 4009 <desc> 4010 4010 Type of the session. If <link to="#sessionState"/> is 4011 S essionSpawning or SessionOpen, this attribute contains the4011 Spawning or Locked, this attribute contains the 4012 4012 same value as passed to the 4013 4013 <link to="IMachine::launchVMProcess"/> method in the … … 12832 12832 <desc> 12833 12833 Type of this session. The value of this attribute is valid only 12834 if the session is currently open (i.e. its <link to="#state" /> is12835 SessionState_SessionOpen), otherwise an error will be returned.12834 if the session currently has a machine locked (i.e. its 12835 <link to="#state" /> is Locked), otherwise an error will be returned. 12836 12836 </desc> 12837 12837 </attribute> -
trunk/src/VBox/Main/xml/Settings.cpp
r31063 r31073 9 9 * The code can read all VirtualBox settings files version 1.3 and higher. That version was 10 10 * written by VirtualBox 2.0. It can write settings version 1.7 (used by VirtualBox 2.2 and 11 * 3.0) and 1.9 (used by VirtualBox 3.1). 12 * 13 * Rules for introducing new settings: If an element or attribute is introduced that was not 14 * present before VirtualBox 3.1, then settings version checks need to be introduced. The 15 * settings version for VirtualBox 3.1 is 1.9; see the SettingsVersion enumeration in 16 * src/VBox/Main/idl/VirtualBox.xidl for details about which version was used when. 17 * 18 * The settings versions checks are necessary because VirtualBox 3.1 no longer automatically 19 * converts XML settings files but only if necessary, that is, if settings are present that 20 * the old format does not support. If we write an element or attribute to a settings file 21 * of an older version, then an old VirtualBox (before 3.1) will attempt to validate it 22 * with XML schema, and that will certainly fail. 11 * 3.0) and 1.9 (used by VirtualBox 3.1) and newer ones obviously. 12 * 13 * The settings versions enum is defined in src/VBox/Main/idl/VirtualBox.xidl. To introduce 14 * a new settings version (should be necessary at most once per VirtualBox major release, 15 * if at all), add a new SettingsVersion value to that enum and grep for the previously 16 * highest value to see which code in here needs adjusting. 17 * 18 * Certainly ConfigFileBase::ConfigFileBase() will. Change VBOX_XML_VERSION below as well. 19 * 20 * Once a new settings version has been added, these are the rules for introducing a new 21 * setting: If an XML element or attribute or value is introduced that was not present in 22 * previous versions, then settings version checks need to be introduced. See the 23 * SettingsVersion enumeration in src/VBox/Main/idl/VirtualBox.xidl for details about which 24 * version was used when. 25 * 26 * The settings versions checks are necessary because since version 3.1, VirtualBox no longer 27 * automatically converts XML settings files but only if necessary, that is, if settings are 28 * present that the old format does not support. If we write an element or attribute to a 29 * settings file of an older version, then an old VirtualBox (before 3.1) will attempt to 30 * validate it with XML schema, and that will certainly fail. 23 31 * 24 32 * So, to introduce a new setting: … … 27 35 * 28 36 * 2) In the settings reader method, try to read the setting; if it's there, great, if not, 29 * the default value will have been set by the constructor. 30 * 31 * 3) In the settings writer method, write the setting _only_ if the current settings 37 * the default value will have been set by the constructor. The rule is to be tolerant 38 * here. 39 * 40 * 3) In MachineConfigFile::bumpSettingsVersionIfNeeded(), check if the new setting has 41 * a non-default value (i.e. that differs from the constructor). If so, bump the 42 * settings version to the current version so the settings writer (4) can write out 43 * the non-default value properly. 44 * 45 * So far a corresponding method for MainConfigFile has not been necessary since there 46 * have been no incompatible changes yet. 47 * 48 * 4) In the settings writer method, write the setting _only_ if the current settings 32 49 * version (stored in m->sv) is high enough. That is, for VirtualBox 3.3, write it 33 50 * only if (m->sv >= SettingsVersion_v1_11). 34 *35 * 4) In MachineConfigFile::bumpSettingsVersionIfNeeded(), check if the new setting has36 * a non-default value (i.e. that differs from the constructor). If so, bump the37 * settings version to the current version so the settings writer (3) can write out38 * the non-default value properly.39 *40 * So far a corresponding method for MainConfigFile has not been necessary since there41 * have been no incompatible changes yet.42 51 */ 43 52 … … 204 213 205 214 /** 206 * Constructor. Allocates the XML internals. 215 * Constructor. Allocates the XML internals, parses the XML file if 216 * pstrFilename is != NULL and reads the settings version from it. 207 217 * @param strFilename 208 218 */ … … 571 581 * set the "sv" member to the required settings version that is to 572 582 * be written. For newly created files, the settings version will be 573 * the latest (1. 9); for files read in from disk earlier, it will be583 * the latest (1.11); for files read in from disk earlier, it will be 574 584 * the settings version indicated in the file. However, this method 575 585 * will silently make sure that the settings version is always
Note:
See TracChangeset
for help on using the changeset viewer.

