Utils::PersistentSettingsReader Class
class Utils::PersistentSettingsReaderRazred PersistentSettingsReader bere » QVariantMap « poljubnih, vgrajenih podatkovnih struktur iz datoteke XML. Več...
| Header: | #include <PersistentSettingsReader> |
Podroben opis
Obdeluje vse preproste tipe, ki se lahko serializirajo v nize, ter » QVariantList « in » QVariantMap «. Primer:
<qtcreator> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> <value type="int">0</value> </data> <data> <variable>ProjectExplorer.Project.EditorSettings</variable> <valuemap type="QVariantMap"> <value type="bool" key="EditorConfiguration.AutoIndent">true</value> </valuemap> </data>
Pri razčlenjevanju strukture se za vsak element <data> uporabi razčlenjevalni sklad (parse stack) tipa `ParseValueStackEntry`. `ParseValueStackEntry` je varianta/združitev naslednjih elementov:
- preproste vrednosti
- zemljevid
- seznam
Funkcije za serializacijo v niz za lastne tipe lahko registrirate tako, da jih vnesete v sistem tipov Qt Meta. Primer:
QMetaType::registerConverter(&MyCustomType::toString); QMetaType::registerConverter<QString, MyCustomType>(&myCustomTypeFromString);
Ob vstopu v element vrednosti ( <value> / <valuelist>, <valuemap> ) se vnos ustrezno potisne na sklad. Ob izstopu iz elementa se vrednost QVariant vnosa odstrani s sklada in doda vnosa na spodnji del sklada (doda se na seznam ali vstavi v zemljevid). Prvi element sklada je vrednost elementa <data>.
Glej tudi Utils::PersistentSettingsWriter.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.