summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/3rdparty/cplusplus/AST.cpp1542
-rw-r--r--src/libs/3rdparty/cplusplus/AST.h3228
-rw-r--r--src/libs/3rdparty/cplusplus/ASTClone.cpp156
-rw-r--r--src/libs/3rdparty/cplusplus/ASTPatternBuilder.h308
-rw-r--r--src/libs/3rdparty/cplusplus/ASTVisitor.cpp30
-rw-r--r--src/libs/3rdparty/cplusplus/ASTVisitor.h36
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp568
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.h16
-rw-r--r--src/libs/3rdparty/cplusplus/Control.cpp108
-rw-r--r--src/libs/3rdparty/cplusplus/Control.h68
-rw-r--r--src/libs/3rdparty/cplusplus/DiagnosticClient.h2
-rw-r--r--src/libs/3rdparty/cplusplus/FullySpecifiedType.h4
-rw-r--r--src/libs/3rdparty/cplusplus/Lexer.cpp20
-rw-r--r--src/libs/3rdparty/cplusplus/LiteralTable.h18
-rw-r--r--src/libs/3rdparty/cplusplus/Literals.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Literals.h10
-rw-r--r--src/libs/3rdparty/cplusplus/Matcher.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Matcher.h4
-rw-r--r--src/libs/3rdparty/cplusplus/MemoryPool.cpp10
-rw-r--r--src/libs/3rdparty/cplusplus/Name.cpp28
-rw-r--r--src/libs/3rdparty/cplusplus/Name.h18
-rw-r--r--src/libs/3rdparty/cplusplus/Names.cpp38
-rw-r--r--src/libs/3rdparty/cplusplus/Names.h14
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.cpp594
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.h48
-rw-r--r--src/libs/3rdparty/cplusplus/Scope.cpp50
-rw-r--r--src/libs/3rdparty/cplusplus/Scope.h18
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.cpp98
-rw-r--r--src/libs/3rdparty/cplusplus/Symbol.h122
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.cpp172
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.h84
-rw-r--r--src/libs/3rdparty/cplusplus/Templates.cpp50
-rw-r--r--src/libs/3rdparty/cplusplus/Templates.h6
-rw-r--r--src/libs/3rdparty/cplusplus/Token.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/Token.h17
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.cpp146
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.h94
-rw-r--r--src/libs/3rdparty/cplusplus/Type.cpp38
-rw-r--r--src/libs/3rdparty/cplusplus/Type.h82
-rw-r--r--src/libs/3rdparty/json/json.hpp20842
-rw-r--r--src/libs/3rdparty/syntax-highlighting/CMakeLists.txt2
-rw-r--r--src/libs/3rdparty/yaml-cpp/.clang-format47
-rw-r--r--src/libs/3rdparty/yaml-cpp/LICENSE19
-rw-r--r--src/libs/3rdparty/yaml-cpp/README.md51
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h17
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h67
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h42
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h57
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h254
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterdef.h16
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h137
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterstyle.h16
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h40
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h261
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/mark.h29
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h331
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h26
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h185
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h92
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h27
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h46
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h169
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h127
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h180
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h98
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/emit.h32
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h448
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h31
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h145
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/parse.h78
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h29
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/type.h16
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h25
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/null.h26
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h72
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h86
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h51
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h103
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/yaml.h24
-rw-r--r--src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch1667
-rw-r--r--src/libs/3rdparty/yaml-cpp/patches/0002-yaml-cpp-Make-dll.h-compatible-with-fvisibility-hidd.patch42
-rw-r--r--src/libs/3rdparty/yaml-cpp/patches/0003-yaml-cpp-MSVC-Fix-unknown-override-specifier-for-_NO.patch52
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/binary.cpp93
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/collectionstack.h39
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/convert.cpp75
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/directives.cpp22
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/directives.h29
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emit.cpp25
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitfromevents.cpp119
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitter.cpp911
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitterstate.cpp365
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitterstate.h203
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitterutils.cpp483
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/emitterutils.h50
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/exceptions.cpp25
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/exp.cpp136
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/exp.h222
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/indentation.h41
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/memory.cpp26
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/node.cpp12
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/node_data.cpp300
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/nodebuilder.cpp130
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/nodebuilder.h70
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/nodeevents.cpp101
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/nodeevents.h64
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/null.cpp10
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/ostream_wrapper.cpp57
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/parse.cpp72
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/parser.cpp129
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/ptr_vector.h43
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/regex_yaml.cpp45
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/regex_yaml.h87
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/regeximpl.h186
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scanner.cpp386
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scanner.h190
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scanscalar.cpp250
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scanscalar.h63
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scantag.cpp81
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scantag.h19
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/scantoken.cpp437
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/setting.h95
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/simplekey.cpp128
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/singledocparser.cpp414
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/singledocparser.h65
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/stream.cpp448
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/stream.h76
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/streamcharsource.h48
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/stringsource.h48
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/tag.cpp49
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/tag.h33
-rw-r--r--src/libs/3rdparty/yaml-cpp/src/token.h69
-rw-r--r--src/libs/3rdparty/yaml-cpp/yaml-cpp.pc.cmake11
-rw-r--r--src/libs/3rdparty/yaml-cpp/yaml-cpp.pri89
-rw-r--r--src/libs/3rdparty/yaml-cpp/yaml-cpp.pro5
-rw-r--r--src/libs/3rdparty/yaml-cpp/yaml-cpp.qbs105
-rw-r--r--src/libs/3rdparty/yaml-cpp/yaml-cpp_dependencies.pri2
-rw-r--r--src/libs/clangsupport/CMakeLists.txt1
-rw-r--r--src/libs/clangsupport/clangpathwatcher.h6
-rw-r--r--src/libs/clangsupport/clangsupport-lib.pri2
-rw-r--r--src/libs/clangsupport/clangsupport_global.h9
-rw-r--r--src/libs/clangsupport/clangsupportdebugutils.h2
-rw-r--r--src/libs/clangsupport/filecontainerv2.h20
-rw-r--r--src/libs/clangsupport/filepathcache.h144
-rw-r--r--src/libs/clangsupport/filepathcaching.cpp45
-rw-r--r--src/libs/clangsupport/filepathcaching.h27
-rw-r--r--src/libs/clangsupport/filepathcachinginterface.h4
-rw-r--r--src/libs/clangsupport/filepathstorage.h33
-rw-r--r--src/libs/clangsupport/filepathstoragesources.h85
-rw-r--r--src/libs/clangsupport/filepathstoragesqlitestatementfactory.h14
-rw-r--r--src/libs/clangsupport/filesystem.cpp5
-rw-r--r--src/libs/clangsupport/generatedfiles.cpp19
-rw-r--r--src/libs/clangsupport/generatedfiles.h1
-rw-r--r--src/libs/clangsupport/generatedfilesinterface.h1
-rw-r--r--src/libs/clangsupport/idpaths.h14
-rw-r--r--src/libs/clangsupport/modifiedtimechecker.h44
-rw-r--r--src/libs/clangsupport/processcreator.cpp6
-rw-r--r--src/libs/clangsupport/projectpartcontainer.h19
-rw-r--r--src/libs/clangsupport/projectpartid.h18
-rw-r--r--src/libs/clangsupport/projectpartsstorage.h100
-rw-r--r--src/libs/clangsupport/projectpartsstorageinterface.h5
-rw-r--r--src/libs/clangsupport/projectpartstoragestructs.h55
-rw-r--r--src/libs/clangsupport/refactoringdatabaseinitializer.h4
-rw-r--r--src/libs/clangsupport/set_algorithm.h24
-rw-r--r--src/libs/clangsupport/sourceentry.h13
-rw-r--r--src/libs/clangsupport/sourcelocationcontainer.h8
-rw-r--r--src/libs/clangsupport/sourcerangecontainer.h2
-rw-r--r--src/libs/clangsupport/stringcache.h203
-rw-r--r--src/libs/clangsupport/stringcacheentry.h50
-rw-r--r--src/libs/clangsupport/stringcachefwd.h7
-rw-r--r--src/libs/clangsupport/tokeninfocontainer.h10
-rw-r--r--src/libs/cplusplus/ASTPath.cpp4
-rw-r--r--src/libs/cplusplus/ASTPath.h4
-rw-r--r--src/libs/cplusplus/AlreadyConsideredClassContainer.h2
-rw-r--r--src/libs/cplusplus/CppDocument.cpp84
-rw-r--r--src/libs/cplusplus/CppDocument.h90
-rw-r--r--src/libs/cplusplus/CppRewriter.cpp16
-rw-r--r--src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp12
-rw-r--r--src/libs/cplusplus/FastPreprocessor.cpp16
-rw-r--r--src/libs/cplusplus/FastPreprocessor.h20
-rw-r--r--src/libs/cplusplus/FindUsages.cpp12
-rw-r--r--src/libs/cplusplus/FindUsages.h8
-rw-r--r--src/libs/cplusplus/LookupContext.cpp144
-rw-r--r--src/libs/cplusplus/LookupContext.h12
-rw-r--r--src/libs/cplusplus/LookupItem.cpp2
-rw-r--r--src/libs/cplusplus/Macro.cpp2
-rw-r--r--src/libs/cplusplus/Macro.h6
-rw-r--r--src/libs/cplusplus/MatchingText.cpp9
-rw-r--r--src/libs/cplusplus/MatchingText.h2
-rw-r--r--src/libs/cplusplus/NamePrettyPrinter.cpp4
-rw-r--r--src/libs/cplusplus/Overview.h6
-rw-r--r--src/libs/cplusplus/PreprocessorClient.cpp8
-rw-r--r--src/libs/cplusplus/PreprocessorClient.h42
-rw-r--r--src/libs/cplusplus/PreprocessorEnvironment.cpp12
-rw-r--r--src/libs/cplusplus/PreprocessorEnvironment.h2
-rw-r--r--src/libs/cplusplus/ResolveExpression.cpp58
-rw-r--r--src/libs/cplusplus/ResolveExpression.h6
-rw-r--r--src/libs/cplusplus/SimpleLexer.cpp6
-rw-r--r--src/libs/cplusplus/SimpleLexer.h6
-rw-r--r--src/libs/cplusplus/SymbolNameVisitor.cpp2
-rw-r--r--src/libs/cplusplus/TypeOfExpression.cpp12
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp8
-rw-r--r--src/libs/cplusplus/cppmodelmanagerbase.cpp10
-rw-r--r--src/libs/cplusplus/cppmodelmanagerbase.h2
-rw-r--r--src/libs/cplusplus/findcdbbreakpoint.cpp10
-rw-r--r--src/libs/cplusplus/findcdbbreakpoint.h15
-rw-r--r--src/libs/cplusplus/pp-engine.cpp30
-rw-r--r--src/libs/cplusplus/pp-engine.h6
-rw-r--r--src/libs/extensionsystem/CMakeLists.txt4
-rw-r--r--src/libs/extensionsystem/pluginmanager.cpp41
-rw-r--r--src/libs/extensionsystem/pluginmanager.h1
-rw-r--r--src/libs/extensionsystem/pluginspec.cpp4
-rw-r--r--src/libs/glsl/glslast.cpp4
-rw-r--r--src/libs/glsl/glslastdump.cpp2
-rw-r--r--src/libs/glsl/glslengine.h6
-rw-r--r--src/libs/glsl/glsllexer.cpp4
-rw-r--r--src/libs/glsl/glsllexer.h2
-rw-r--r--src/libs/glsl/glslmemorypool.cpp10
-rw-r--r--src/libs/glsl/glslparser.cpp52
-rw-r--r--src/libs/glsl/glslparser.h4
-rw-r--r--src/libs/glsl/glslsemantic.cpp70
-rw-r--r--src/libs/glsl/glslsemantic.h4
-rw-r--r--src/libs/glsl/glslsymbol.cpp2
-rw-r--r--src/libs/glsl/glslsymbol.h20
-rw-r--r--src/libs/glsl/glslsymbols.cpp8
-rw-r--r--src/libs/glsl/glslsymbols.h2
-rw-r--r--src/libs/glsl/glsltype.h34
-rw-r--r--src/libs/glsl/glsltypes.cpp106
-rw-r--r--src/libs/glsl/glsltypes.h6
-rw-r--r--src/libs/languageserverprotocol/clientcapabilities.cpp35
-rw-r--r--src/libs/languageserverprotocol/clientcapabilities.h20
-rw-r--r--src/libs/languageserverprotocol/jsonkeys.h5
-rw-r--r--src/libs/languageserverprotocol/languagefeatures.cpp56
-rw-r--r--src/libs/languageserverprotocol/languagefeatures.h56
-rw-r--r--src/libs/languageserverprotocol/lsptypes.cpp4
-rw-r--r--src/libs/languageserverprotocol/lsptypes.h4
-rw-r--r--src/libs/languageserverprotocol/servercapabilities.cpp43
-rw-r--r--src/libs/languageserverprotocol/servercapabilities.h17
-rw-r--r--src/libs/libs.pro3
-rw-r--r--src/libs/libs.qbs1
-rw-r--r--src/libs/modelinglib/qmt/config/textscanner.cpp2
-rw-r--r--src/libs/modelinglib/qmt/controller/undocommand.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/dclonevisitor.cpp4
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/dfactory.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/dflatassignmentvisitor.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/diagramcontroller.cpp28
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/dupdatevisitor.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_controller/dvoidvisitor.cpp4
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp18
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/diagramscenemodelitemvisitors.cpp12
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/annotationitem.cpp14
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/associationitem.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/boundaryitem.cpp6
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/connectionitem.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp18
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/relationitem.cpp10
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/items/swimlaneitem.cpp10
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/latchcontroller.cpp2
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/alignbuttonsitem.cpp12
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/alignlineitem.cpp6
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/arrowitem.cpp12
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/customiconitem.cpp4
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/pathselectionitem.cpp6
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/rectangularselectionitem.cpp8
-rw-r--r--src/libs/modelinglib/qmt/diagram_scene/parts/relationstarter.cpp6
-rw-r--r--src/libs/modelinglib/qmt/diagram_widgets_ui/stackeddiagramsview.cpp2
-rw-r--r--src/libs/modelinglib/qmt/infrastructure/geometryutilities.cpp4
-rw-r--r--src/libs/modelinglib/qmt/model/melement.cpp2
-rw-r--r--src/libs/modelinglib/qmt/model_controller/mchildrenvisitor.cpp2
-rw-r--r--src/libs/modelinglib/qmt/model_controller/mclonevisitor.cpp4
-rw-r--r--src/libs/modelinglib/qmt/model_controller/mvoidvisitor.cpp4
-rw-r--r--src/libs/modelinglib/qmt/model_ui/sortedtreemodel.cpp6
-rw-r--r--src/libs/modelinglib/qmt/model_ui/treemodel.cpp38
-rw-r--r--src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp4
-rw-r--r--src/libs/modelinglib/qmt/model_widgets_ui/palettebox.cpp2
-rw-r--r--src/libs/modelinglib/qmt/model_widgets_ui/propertiesview.cpp60
-rw-r--r--src/libs/modelinglib/qmt/model_widgets_ui/propertiesviewmview.cpp9
-rw-r--r--src/libs/modelinglib/qmt/style/defaultstyleengine.cpp28
-rw-r--r--src/libs/modelinglib/qmt/tasks/alignonrastervisitor.cpp4
-rw-r--r--src/libs/modelinglib/qmt/tasks/diagramscenecontroller.cpp4
-rw-r--r--src/libs/modelinglib/qtserialization/inc/qark/typeregistry.h4
-rw-r--r--src/libs/qmldebug/qmldebugcommandlinearguments.h29
-rw-r--r--src/libs/qmldebug/qmldebugconnection.cpp2
-rw-r--r--src/libs/qmldebug/qmldebugconnectionmanager.cpp2
-rw-r--r--src/libs/qmldebug/qmldebugconnectionmanager.h2
-rw-r--r--src/libs/qmldebug/qmloutputparser.h2
-rw-r--r--src/libs/qmldebug/qpacketprotocol.cpp2
-rw-r--r--src/libs/qmldebug/qpacketprotocol.h2
-rw-r--r--src/libs/qmleditorwidgets/colorbox.h2
-rw-r--r--src/libs/qmleditorwidgets/colorbutton.h2
-rw-r--r--src/libs/qmleditorwidgets/contextpanetextwidget.h2
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidget.cpp5
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidget.h4
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetimage.cpp3
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetimage.h10
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidgetrectangle.h2
-rw-r--r--src/libs/qmleditorwidgets/customcolordialog.cpp9
-rw-r--r--src/libs/qmleditorwidgets/customcolordialog.h2
-rw-r--r--src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp4
-rw-r--r--src/libs/qmleditorwidgets/easingpane/easingcontextpane.h2
-rw-r--r--src/libs/qmleditorwidgets/easingpane/easinggraph.h2
-rw-r--r--src/libs/qmleditorwidgets/filewidget.h2
-rw-r--r--src/libs/qmleditorwidgets/fontsizespinbox.cpp2
-rw-r--r--src/libs/qmleditorwidgets/fontsizespinbox.h2
-rw-r--r--src/libs/qmleditorwidgets/gradientline.h2
-rw-r--r--src/libs/qmleditorwidgets/huecontrol.h2
-rw-r--r--src/libs/qmljs/jsoncheck.cpp2
-rw-r--r--src/libs/qmljs/parser/qmljsengine_p.h18
-rw-r--r--src/libs/qmljs/persistenttrie.cpp15
-rw-r--r--src/libs/qmljs/qmljsbind.cpp22
-rw-r--r--src/libs/qmljs/qmljsbundle.cpp14
-rw-r--r--src/libs/qmljs/qmljscheck.cpp74
-rw-r--r--src/libs/qmljs/qmljscontext.cpp18
-rw-r--r--src/libs/qmljs/qmljscontext.h2
-rw-r--r--src/libs/qmljs/qmljsdocument.cpp46
-rw-r--r--src/libs/qmljs/qmljsdocument.h3
-rw-r--r--src/libs/qmljs/qmljsevaluate.cpp8
-rw-r--r--src/libs/qmljs/qmljsevaluate.h2
-rw-r--r--src/libs/qmljs/qmljsfindexportedcpptypes.cpp75
-rw-r--r--src/libs/qmljs/qmljsicons.cpp4
-rw-r--r--src/libs/qmljs/qmljsicontextpane.h2
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.cpp30
-rw-r--r--src/libs/qmljs/qmljsinterpreter.cpp176
-rw-r--r--src/libs/qmljs/qmljsinterpreter.h74
-rw-r--r--src/libs/qmljs/qmljslineinfo.cpp6
-rw-r--r--src/libs/qmljs/qmljslink.cpp35
-rw-r--r--src/libs/qmljs/qmljslink.h2
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp35
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h1
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp4
-rw-r--r--src/libs/qmljs/qmljsrewriter.cpp26
-rw-r--r--src/libs/qmljs/qmljsscopebuilder.cpp12
-rw-r--r--src/libs/qmljs/qmljsscopechain.cpp18
-rw-r--r--src/libs/qmljs/qmljsscopechain.h2
-rw-r--r--src/libs/qmljs/qmljstypedescriptionreader.cpp2
-rw-r--r--src/libs/qmljs/qmljsutils.cpp6
-rw-r--r--src/libs/qmljs/qmljsutils.h2
-rw-r--r--src/libs/qmljs/qmljsvalueowner.cpp24
-rw-r--r--src/libs/qmljs/qmljsvalueowner.h2
-rw-r--r--src/libs/sqlite/CMakeLists.txt2
-rw-r--r--src/libs/sqlite/sqlitedatabasebackend.cpp2
-rw-r--r--src/libs/ssh/sftpfilesystemmodel.cpp18
-rw-r--r--src/libs/ssh/sftpfilesystemmodel.h2
-rw-r--r--src/libs/ssh/sshconnection.h2
-rw-r--r--src/libs/ssh/sshconnectionmanager.cpp10
-rw-r--r--src/libs/ssh/sshkeycreationdialog.h2
-rw-r--r--src/libs/ssh/sshremoteprocess.cpp28
-rw-r--r--src/libs/ssh/sshremoteprocess.h4
-rw-r--r--src/libs/ssh/sshremoteprocessrunner.cpp4
-rw-r--r--src/libs/ssh/sshremoteprocessrunner.h2
-rw-r--r--src/libs/tracing/CMakeLists.txt1
-rw-r--r--src/libs/tracing/flamegraph.cpp6
-rw-r--r--src/libs/tracing/qml/ButtonsBar.qml30
-rw-r--r--src/libs/tracing/qml/CategoryLabel.qml15
-rw-r--r--src/libs/tracing/qml/FlameGraphView.qml28
-rw-r--r--src/libs/tracing/qml/ImageToolButton.qml20
-rw-r--r--src/libs/tracing/qml/MainView.qml42
-rw-r--r--src/libs/tracing/qml/RangeDetails.qml5
-rw-r--r--src/libs/tracing/qml/RowLabel.qml36
-rw-r--r--src/libs/tracing/qml/SelectionRangeDetails.qml3
-rw-r--r--src/libs/tracing/qml/TimelineContent.qml240
-rw-r--r--src/libs/tracing/qml/TimelineLabels.qml6
-rw-r--r--src/libs/tracing/timelineabstractrenderer.cpp2
-rw-r--r--src/libs/tracing/timelineformattime.cpp10
-rw-r--r--src/libs/tracing/timelineitemsrenderpass.cpp10
-rw-r--r--src/libs/tracing/timelinemodel.cpp83
-rw-r--r--src/libs/tracing/timelinemodel.h17
-rw-r--r--src/libs/tracing/timelinemodel_p.h3
-rw-r--r--src/libs/tracing/timelinenotesrenderpass.cpp10
-rw-r--r--src/libs/tracing/timelineoverviewrenderer.cpp10
-rw-r--r--src/libs/tracing/timelinerenderer.cpp17
-rw-r--r--src/libs/tracing/timelinerenderpass.cpp4
-rw-r--r--src/libs/tracing/timelinerenderstate.cpp2
-rw-r--r--src/libs/tracing/timelineselectionrenderpass.cpp6
-rw-r--r--src/libs/tracing/timelinetheme.cpp6
-rw-r--r--src/libs/utils/CMakeLists.txt25
-rw-r--r--src/libs/utils/algorithm.h32
-rw-r--r--src/libs/utils/basetreeview.cpp2
-rw-r--r--src/libs/utils/buildablehelperlibrary.cpp4
-rw-r--r--src/libs/utils/camelcasecursor.cpp341
-rw-r--r--src/libs/utils/camelcasecursor.h45
-rw-r--r--src/libs/utils/changeset.cpp10
-rw-r--r--src/libs/utils/changeset.h2
-rw-r--r--src/libs/utils/consoleprocess.cpp840
-rw-r--r--src/libs/utils/consoleprocess.h45
-rw-r--r--src/libs/utils/consoleprocess_p.h80
-rw-r--r--src/libs/utils/consoleprocess_unix.cpp449
-rw-r--r--src/libs/utils/consoleprocess_win.cpp400
-rw-r--r--src/libs/utils/cpplanguage_details.h2
-rw-r--r--src/libs/utils/delegates.cpp12
-rw-r--r--src/libs/utils/detailsbutton.cpp58
-rw-r--r--src/libs/utils/detailsbutton.h18
-rw-r--r--src/libs/utils/displayname.cpp76
-rw-r--r--src/libs/utils/displayname.h63
-rw-r--r--src/libs/utils/environment.cpp450
-rw-r--r--src/libs/utils/environment.h82
-rw-r--r--src/libs/utils/environmentdialog.cpp152
-rw-r--r--src/libs/utils/environmentdialog.h30
-rw-r--r--src/libs/utils/environmentfwd.h51
-rw-r--r--src/libs/utils/environmentmodel.cpp354
-rw-r--r--src/libs/utils/environmentmodel.h44
-rw-r--r--src/libs/utils/fadingindicator.cpp4
-rw-r--r--src/libs/utils/fancylineedit.cpp69
-rw-r--r--src/libs/utils/fancylineedit.h7
-rw-r--r--src/libs/utils/fancymainwindow.cpp9
-rw-r--r--src/libs/utils/fileutils.cpp54
-rw-r--r--src/libs/utils/fileutils.h28
-rw-r--r--src/libs/utils/flowlayout.cpp4
-rw-r--r--src/libs/utils/fuzzymatcher.cpp19
-rw-r--r--src/libs/utils/fuzzymatcher.h2
-rw-r--r--src/libs/utils/images/download_arrow.pngbin0 -> 150 bytes
-rw-r--r--src/libs/utils/images/download_arrow@2x.pngbin0 -> 181 bytes
-rw-r--r--src/libs/utils/images/download_base.pngbin0 -> 96 bytes
-rw-r--r--src/libs/utils/images/download_base@2x.pngbin0 -> 104 bytes
-rw-r--r--src/libs/utils/images/online.pngbin0 -> 214 bytes
-rw-r--r--src/libs/utils/images/online@2x.pngbin0 -> 440 bytes
-rw-r--r--src/libs/utils/images/run_file.pngbin0 -> 102 bytes
-rw-r--r--src/libs/utils/images/run_file@2x.pngbin0 -> 132 bytes
-rw-r--r--src/libs/utils/images/runselected_boxes.pngbin0 -> 99 bytes
-rw-r--r--src/libs/utils/images/runselected_boxes@2x.pngbin0 -> 104 bytes
-rw-r--r--src/libs/utils/images/runselected_tickmarks.pngbin0 -> 151 bytes
-rw-r--r--src/libs/utils/images/runselected_tickmarks@2x.pngbin0 -> 162 bytes
-rw-r--r--src/libs/utils/listmodel.h6
-rw-r--r--src/libs/utils/macroexpander.cpp5
-rw-r--r--src/libs/utils/mimetypes/mimeglobpattern.cpp7
-rw-r--r--src/libs/utils/mimetypes/mimeglobpattern_p.h9
-rw-r--r--src/libs/utils/mimetypes/mimeprovider.cpp14
-rw-r--r--src/libs/utils/namevaluedictionary.cpp202
-rw-r--r--src/libs/utils/namevaluedictionary.h105
-rw-r--r--src/libs/utils/namevalueitem.cpp213
-rw-r--r--src/libs/utils/namevalueitem.h80
-rw-r--r--src/libs/utils/namevaluemodel.cpp437
-rw-r--r--src/libs/utils/namevaluemodel.h85
-rw-r--r--src/libs/utils/namevaluesdialog.cpp147
-rw-r--r--src/libs/utils/namevaluesdialog.h86
-rw-r--r--src/libs/utils/namevaluevalidator.cpp72
-rw-r--r--src/libs/utils/namevaluevalidator.h58
-rw-r--r--src/libs/utils/osspecificaspects.h5
-rw-r--r--src/libs/utils/outputformatter.cpp2
-rw-r--r--src/libs/utils/pathchooser.cpp13
-rw-r--r--src/libs/utils/pathlisteditor.cpp2
-rw-r--r--src/libs/utils/process_ctrlc_stub.cpp16
-rw-r--r--src/libs/utils/qrcparser.cpp18
-rw-r--r--src/libs/utils/qrcparser.h8
-rw-r--r--src/libs/utils/qtcprocess.cpp38
-rw-r--r--src/libs/utils/qtcprocess.h4
-rw-r--r--src/libs/utils/savefile.cpp18
-rw-r--r--src/libs/utils/settingsaccessor.cpp15
-rw-r--r--src/libs/utils/shellcommand.cpp55
-rw-r--r--src/libs/utils/shellcommand.h21
-rw-r--r--src/libs/utils/smallstring.h10
-rw-r--r--src/libs/utils/smallstringio.h4
-rw-r--r--src/libs/utils/smallstringvector.h11
-rw-r--r--src/libs/utils/stringutils.cpp8
-rw-r--r--src/libs/utils/synchronousprocess.cpp27
-rw-r--r--src/libs/utils/synchronousprocess.h9
-rw-r--r--src/libs/utils/textutils.cpp27
-rw-r--r--src/libs/utils/textutils.h3
-rw-r--r--src/libs/utils/tooltip/tips.cpp2
-rw-r--r--src/libs/utils/treemodel.cpp16
-rw-r--r--src/libs/utils/treeviewcombobox.cpp4
-rw-r--r--src/libs/utils/utils-lib.pri24
-rw-r--r--src/libs/utils/utils.qbs35
-rw-r--r--src/libs/utils/utils.qrc12
-rw-r--r--src/libs/utils/utilsicons.cpp5
-rw-r--r--src/libs/utils/utilsicons.h2
-rw-r--r--src/libs/utils/winutils.cpp8
-rw-r--r--src/libs/utils/wizard.cpp2
468 files changed, 42841 insertions, 8460 deletions
diff --git a/src/libs/3rdparty/cplusplus/AST.cpp b/src/libs/3rdparty/cplusplus/AST.cpp
index 035c9baf73..3b91838eec 100644
--- a/src/libs/3rdparty/cplusplus/AST.cpp
+++ b/src/libs/3rdparty/cplusplus/AST.cpp
@@ -68,12 +68,12 @@ bool AST::match(AST *pattern, ASTMatcher *matcher)
return match0(pattern, matcher);
}
-unsigned GnuAttributeSpecifierAST::firstToken() const
+int GnuAttributeSpecifierAST::firstToken() const
{
return attribute_token;
}
-unsigned BaseSpecifierAST::firstToken() const
+int BaseSpecifierAST::firstToken() const
{
if (virtual_token && access_specifier_token)
return std::min(virtual_token, access_specifier_token);
@@ -87,7 +87,7 @@ unsigned BaseSpecifierAST::firstToken() const
return 0;
}
-unsigned BaseSpecifierAST::lastToken() const
+int BaseSpecifierAST::lastToken() const
{
if (ellipsis_token)
return ellipsis_token;
@@ -104,7 +104,7 @@ unsigned BaseSpecifierAST::lastToken() const
}
/** \generated */
-unsigned AccessDeclarationAST::firstToken() const
+int AccessDeclarationAST::firstToken() const
{
if (access_specifier_token)
return access_specifier_token;
@@ -116,7 +116,7 @@ unsigned AccessDeclarationAST::firstToken() const
}
/** \generated */
-unsigned AccessDeclarationAST::lastToken() const
+int AccessDeclarationAST::lastToken() const
{
if (colon_token)
return colon_token + 1;
@@ -128,15 +128,15 @@ unsigned AccessDeclarationAST::lastToken() const
}
/** \generated */
-unsigned ArrayAccessAST::firstToken() const
+int ArrayAccessAST::firstToken() const
{
if (base_expression)
- if (unsigned candidate = base_expression->firstToken())
+ if (int candidate = base_expression->firstToken())
return candidate;
if (lbracket_token)
return lbracket_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -144,28 +144,28 @@ unsigned ArrayAccessAST::firstToken() const
}
/** \generated */
-unsigned ArrayAccessAST::lastToken() const
+int ArrayAccessAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
if (base_expression)
- if (unsigned candidate = base_expression->lastToken())
+ if (int candidate = base_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ArrayDeclaratorAST::firstToken() const
+int ArrayDeclaratorAST::firstToken() const
{
if (lbracket_token)
return lbracket_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -173,12 +173,12 @@ unsigned ArrayDeclaratorAST::firstToken() const
}
/** \generated */
-unsigned ArrayDeclaratorAST::lastToken() const
+int ArrayDeclaratorAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
@@ -186,12 +186,12 @@ unsigned ArrayDeclaratorAST::lastToken() const
}
/** \generated */
-unsigned ArrayInitializerAST::firstToken() const
+int ArrayInitializerAST::firstToken() const
{
if (lbrace_token)
return lbrace_token;
if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (int candidate = expression_list->firstToken())
return candidate;
if (rbrace_token)
return rbrace_token;
@@ -199,12 +199,12 @@ unsigned ArrayInitializerAST::firstToken() const
}
/** \generated */
-unsigned ArrayInitializerAST::lastToken() const
+int ArrayInitializerAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (int candidate = expression_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
@@ -212,7 +212,7 @@ unsigned ArrayInitializerAST::lastToken() const
}
/** \generated */
-unsigned AsmDefinitionAST::firstToken() const
+int AsmDefinitionAST::firstToken() const
{
if (asm_token)
return asm_token;
@@ -228,7 +228,7 @@ unsigned AsmDefinitionAST::firstToken() const
}
/** \generated */
-unsigned AsmDefinitionAST::lastToken() const
+int AsmDefinitionAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -244,7 +244,7 @@ unsigned AsmDefinitionAST::lastToken() const
}
/** \generated */
-unsigned GnuAttributeAST::firstToken() const
+int GnuAttributeAST::firstToken() const
{
if (identifier_token)
return identifier_token;
@@ -253,7 +253,7 @@ unsigned GnuAttributeAST::firstToken() const
if (tag_token)
return tag_token;
if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (int candidate = expression_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -261,12 +261,12 @@ unsigned GnuAttributeAST::firstToken() const
}
/** \generated */
-unsigned GnuAttributeAST::lastToken() const
+int GnuAttributeAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (int candidate = expression_list->lastToken())
return candidate;
if (tag_token)
return tag_token + 1;
@@ -278,35 +278,35 @@ unsigned GnuAttributeAST::lastToken() const
}
/** \generated */
-unsigned BinaryExpressionAST::firstToken() const
+int BinaryExpressionAST::firstToken() const
{
if (left_expression)
- if (unsigned candidate = left_expression->firstToken())
+ if (int candidate = left_expression->firstToken())
return candidate;
if (binary_op_token)
return binary_op_token;
if (right_expression)
- if (unsigned candidate = right_expression->firstToken())
+ if (int candidate = right_expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned BinaryExpressionAST::lastToken() const
+int BinaryExpressionAST::lastToken() const
{
if (right_expression)
- if (unsigned candidate = right_expression->lastToken())
+ if (int candidate = right_expression->lastToken())
return candidate;
if (binary_op_token)
return binary_op_token + 1;
if (left_expression)
- if (unsigned candidate = left_expression->lastToken())
+ if (int candidate = left_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned BoolLiteralAST::firstToken() const
+int BoolLiteralAST::firstToken() const
{
if (literal_token)
return literal_token;
@@ -314,7 +314,7 @@ unsigned BoolLiteralAST::firstToken() const
}
/** \generated */
-unsigned BoolLiteralAST::lastToken() const
+int BoolLiteralAST::lastToken() const
{
if (literal_token)
return literal_token + 1;
@@ -322,12 +322,12 @@ unsigned BoolLiteralAST::lastToken() const
}
/** \generated */
-unsigned BracedInitializerAST::firstToken() const
+int BracedInitializerAST::firstToken() const
{
if (lbrace_token)
return lbrace_token;
if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (int candidate = expression_list->firstToken())
return candidate;
if (comma_token)
return comma_token;
@@ -337,14 +337,14 @@ unsigned BracedInitializerAST::firstToken() const
}
/** \generated */
-unsigned BracedInitializerAST::lastToken() const
+int BracedInitializerAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (comma_token)
return comma_token + 1;
if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (int candidate = expression_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
@@ -352,7 +352,7 @@ unsigned BracedInitializerAST::lastToken() const
}
/** \generated */
-unsigned BreakStatementAST::firstToken() const
+int BreakStatementAST::firstToken() const
{
if (break_token)
return break_token;
@@ -362,7 +362,7 @@ unsigned BreakStatementAST::firstToken() const
}
/** \generated */
-unsigned BreakStatementAST::lastToken() const
+int BreakStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -372,15 +372,15 @@ unsigned BreakStatementAST::lastToken() const
}
/** \generated */
-unsigned CallAST::firstToken() const
+int CallAST::firstToken() const
{
if (base_expression)
- if (unsigned candidate = base_expression->firstToken())
+ if (int candidate = base_expression->firstToken())
return candidate;
if (lparen_token)
return lparen_token;
if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (int candidate = expression_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -388,37 +388,37 @@ unsigned CallAST::firstToken() const
}
/** \generated */
-unsigned CallAST::lastToken() const
+int CallAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (int candidate = expression_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (base_expression)
- if (unsigned candidate = base_expression->lastToken())
+ if (int candidate = base_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned CaptureAST::firstToken() const
+int CaptureAST::firstToken() const
{
if (amper_token)
return amper_token;
if (identifier)
- if (unsigned candidate = identifier->firstToken())
+ if (int candidate = identifier->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned CaptureAST::lastToken() const
+int CaptureAST::lastToken() const
{
if (identifier)
- if (unsigned candidate = identifier->lastToken())
+ if (int candidate = identifier->lastToken())
return candidate;
if (amper_token)
return amper_token + 1;
@@ -426,31 +426,31 @@ unsigned CaptureAST::lastToken() const
}
/** \generated */
-unsigned CaseStatementAST::firstToken() const
+int CaseStatementAST::firstToken() const
{
if (case_token)
return case_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (colon_token)
return colon_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned CaseStatementAST::lastToken() const
+int CaseStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (case_token)
return case_token + 1;
@@ -458,31 +458,31 @@ unsigned CaseStatementAST::lastToken() const
}
/** \generated */
-unsigned CastExpressionAST::firstToken() const
+int CastExpressionAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned CastExpressionAST::lastToken() const
+int CastExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -490,33 +490,33 @@ unsigned CastExpressionAST::lastToken() const
}
/** \generated */
-unsigned CatchClauseAST::firstToken() const
+int CatchClauseAST::firstToken() const
{
if (catch_token)
return catch_token;
if (lparen_token)
return lparen_token;
if (exception_declaration)
- if (unsigned candidate = exception_declaration->firstToken())
+ if (int candidate = exception_declaration->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned CatchClauseAST::lastToken() const
+int CatchClauseAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (exception_declaration)
- if (unsigned candidate = exception_declaration->lastToken())
+ if (int candidate = exception_declaration->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -526,29 +526,29 @@ unsigned CatchClauseAST::lastToken() const
}
/** \generated */
-unsigned ClassSpecifierAST::firstToken() const
+int ClassSpecifierAST::firstToken() const
{
if (classkey_token)
return classkey_token;
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (final_token)
return final_token;
if (colon_token)
return colon_token;
if (base_clause_list)
- if (unsigned candidate = base_clause_list->firstToken())
+ if (int candidate = base_clause_list->firstToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (lbrace_token)
return lbrace_token;
if (member_specifier_list)
- if (unsigned candidate = member_specifier_list->firstToken())
+ if (int candidate = member_specifier_list->firstToken())
return candidate;
if (rbrace_token)
return rbrace_token;
@@ -556,29 +556,29 @@ unsigned ClassSpecifierAST::firstToken() const
}
/** \generated */
-unsigned ClassSpecifierAST::lastToken() const
+int ClassSpecifierAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (member_specifier_list)
- if (unsigned candidate = member_specifier_list->lastToken())
+ if (int candidate = member_specifier_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
if (base_clause_list)
- if (unsigned candidate = base_clause_list->lastToken())
+ if (int candidate = base_clause_list->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (final_token)
return final_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (classkey_token)
return classkey_token + 1;
@@ -586,12 +586,12 @@ unsigned ClassSpecifierAST::lastToken() const
}
/** \generated */
-unsigned CompoundExpressionAST::firstToken() const
+int CompoundExpressionAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -599,12 +599,12 @@ unsigned CompoundExpressionAST::firstToken() const
}
/** \generated */
-unsigned CompoundExpressionAST::lastToken() const
+int CompoundExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -612,31 +612,31 @@ unsigned CompoundExpressionAST::lastToken() const
}
/** \generated */
-unsigned CompoundLiteralAST::firstToken() const
+int CompoundLiteralAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned CompoundLiteralAST::lastToken() const
+int CompoundLiteralAST::lastToken() const
{
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -644,12 +644,12 @@ unsigned CompoundLiteralAST::lastToken() const
}
/** \generated */
-unsigned CompoundStatementAST::firstToken() const
+int CompoundStatementAST::firstToken() const
{
if (lbrace_token)
return lbrace_token;
if (statement_list)
- if (unsigned candidate = statement_list->firstToken())
+ if (int candidate = statement_list->firstToken())
return candidate;
if (rbrace_token)
return rbrace_token;
@@ -657,12 +657,12 @@ unsigned CompoundStatementAST::firstToken() const
}
/** \generated */
-unsigned CompoundStatementAST::lastToken() const
+int CompoundStatementAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (statement_list)
- if (unsigned candidate = statement_list->lastToken())
+ if (int candidate = statement_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
@@ -670,69 +670,69 @@ unsigned CompoundStatementAST::lastToken() const
}
/** \generated */
-unsigned ConditionAST::firstToken() const
+int ConditionAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ConditionAST::lastToken() const
+int ConditionAST::lastToken() const
{
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ConditionalExpressionAST::firstToken() const
+int ConditionalExpressionAST::firstToken() const
{
if (condition)
- if (unsigned candidate = condition->firstToken())
+ if (int candidate = condition->firstToken())
return candidate;
if (question_token)
return question_token;
if (left_expression)
- if (unsigned candidate = left_expression->firstToken())
+ if (int candidate = left_expression->firstToken())
return candidate;
if (colon_token)
return colon_token;
if (right_expression)
- if (unsigned candidate = right_expression->firstToken())
+ if (int candidate = right_expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ConditionalExpressionAST::lastToken() const
+int ConditionalExpressionAST::lastToken() const
{
if (right_expression)
- if (unsigned candidate = right_expression->lastToken())
+ if (int candidate = right_expression->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (left_expression)
- if (unsigned candidate = left_expression->lastToken())
+ if (int candidate = left_expression->lastToken())
return candidate;
if (question_token)
return question_token + 1;
if (condition)
- if (unsigned candidate = condition->lastToken())
+ if (int candidate = condition->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ContinueStatementAST::firstToken() const
+int ContinueStatementAST::firstToken() const
{
if (continue_token)
return continue_token;
@@ -742,7 +742,7 @@ unsigned ContinueStatementAST::firstToken() const
}
/** \generated */
-unsigned ContinueStatementAST::lastToken() const
+int ContinueStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -752,27 +752,27 @@ unsigned ContinueStatementAST::lastToken() const
}
/** \generated */
-unsigned ConversionFunctionIdAST::firstToken() const
+int ConversionFunctionIdAST::firstToken() const
{
if (operator_token)
return operator_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->firstToken())
+ if (int candidate = ptr_operator_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ConversionFunctionIdAST::lastToken() const
+int ConversionFunctionIdAST::lastToken() const
{
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->lastToken())
+ if (int candidate = ptr_operator_list->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (operator_token)
return operator_token + 1;
@@ -780,21 +780,21 @@ unsigned ConversionFunctionIdAST::lastToken() const
}
/** \generated */
-unsigned CppCastExpressionAST::firstToken() const
+int CppCastExpressionAST::firstToken() const
{
if (cast_token)
return cast_token;
if (less_token)
return less_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (greater_token)
return greater_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -802,19 +802,19 @@ unsigned CppCastExpressionAST::firstToken() const
}
/** \generated */
-unsigned CppCastExpressionAST::lastToken() const
+int CppCastExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (greater_token)
return greater_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (less_token)
return less_token + 1;
@@ -824,12 +824,12 @@ unsigned CppCastExpressionAST::lastToken() const
}
/** \generated */
-unsigned CtorInitializerAST::firstToken() const
+int CtorInitializerAST::firstToken() const
{
if (colon_token)
return colon_token;
if (member_initializer_list)
- if (unsigned candidate = member_initializer_list->firstToken())
+ if (int candidate = member_initializer_list->firstToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token;
@@ -837,12 +837,12 @@ unsigned CtorInitializerAST::firstToken() const
}
/** \generated */
-unsigned CtorInitializerAST::lastToken() const
+int CtorInitializerAST::lastToken() const
{
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
if (member_initializer_list)
- if (unsigned candidate = member_initializer_list->lastToken())
+ if (int candidate = member_initializer_list->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
@@ -850,91 +850,91 @@ unsigned CtorInitializerAST::lastToken() const
}
/** \generated */
-unsigned DeclarationStatementAST::firstToken() const
+int DeclarationStatementAST::firstToken() const
{
if (declaration)
- if (unsigned candidate = declaration->firstToken())
+ if (int candidate = declaration->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DeclarationStatementAST::lastToken() const
+int DeclarationStatementAST::lastToken() const
{
if (declaration)
- if (unsigned candidate = declaration->lastToken())
+ if (int candidate = declaration->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned DeclaratorAST::firstToken() const
+int DeclaratorAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->firstToken())
+ if (int candidate = ptr_operator_list->firstToken())
return candidate;
if (core_declarator)
- if (unsigned candidate = core_declarator->firstToken())
+ if (int candidate = core_declarator->firstToken())
return candidate;
if (postfix_declarator_list)
- if (unsigned candidate = postfix_declarator_list->firstToken())
+ if (int candidate = postfix_declarator_list->firstToken())
return candidate;
if (post_attribute_list)
- if (unsigned candidate = post_attribute_list->firstToken())
+ if (int candidate = post_attribute_list->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DeclaratorAST::lastToken() const
+int DeclaratorAST::lastToken() const
{
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (post_attribute_list)
- if (unsigned candidate = post_attribute_list->lastToken())
+ if (int candidate = post_attribute_list->lastToken())
return candidate;
if (postfix_declarator_list)
- if (unsigned candidate = postfix_declarator_list->lastToken())
+ if (int candidate = postfix_declarator_list->lastToken())
return candidate;
if (core_declarator)
- if (unsigned candidate = core_declarator->lastToken())
+ if (int candidate = core_declarator->lastToken())
return candidate;
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->lastToken())
+ if (int candidate = ptr_operator_list->lastToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned DeclaratorIdAST::firstToken() const
+int DeclaratorIdAST::firstToken() const
{
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DeclaratorIdAST::lastToken() const
+int DeclaratorIdAST::lastToken() const
{
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
@@ -942,7 +942,7 @@ unsigned DeclaratorIdAST::lastToken() const
}
/** \generated */
-unsigned DeleteExpressionAST::firstToken() const
+int DeleteExpressionAST::firstToken() const
{
if (scope_token)
return scope_token;
@@ -953,16 +953,16 @@ unsigned DeleteExpressionAST::firstToken() const
if (rbracket_token)
return rbracket_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DeleteExpressionAST::lastToken() const
+int DeleteExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (rbracket_token)
return rbracket_token + 1;
@@ -976,21 +976,21 @@ unsigned DeleteExpressionAST::lastToken() const
}
/** \generated */
-unsigned DestructorNameAST::firstToken() const
+int DestructorNameAST::firstToken() const
{
if (tilde_token)
return tilde_token;
if (unqualified_name)
- if (unsigned candidate = unqualified_name->firstToken())
+ if (int candidate = unqualified_name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DestructorNameAST::lastToken() const
+int DestructorNameAST::lastToken() const
{
if (unqualified_name)
- if (unsigned candidate = unqualified_name->lastToken())
+ if (int candidate = unqualified_name->lastToken())
return candidate;
if (tilde_token)
return tilde_token + 1;
@@ -998,19 +998,19 @@ unsigned DestructorNameAST::lastToken() const
}
/** \generated */
-unsigned DoStatementAST::firstToken() const
+int DoStatementAST::firstToken() const
{
if (do_token)
return do_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
if (while_token)
return while_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -1020,21 +1020,21 @@ unsigned DoStatementAST::firstToken() const
}
/** \generated */
-unsigned DoStatementAST::lastToken() const
+int DoStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (while_token)
return while_token + 1;
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (do_token)
return do_token + 1;
@@ -1042,27 +1042,27 @@ unsigned DoStatementAST::lastToken() const
}
/** \generated */
-unsigned ElaboratedTypeSpecifierAST::firstToken() const
+int ElaboratedTypeSpecifierAST::firstToken() const
{
if (classkey_token)
return classkey_token;
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ElaboratedTypeSpecifierAST::lastToken() const
+int ElaboratedTypeSpecifierAST::lastToken() const
{
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (classkey_token)
return classkey_token + 1;
@@ -1070,7 +1070,7 @@ unsigned ElaboratedTypeSpecifierAST::lastToken() const
}
/** \generated */
-unsigned EmptyDeclarationAST::firstToken() const
+int EmptyDeclarationAST::firstToken() const
{
if (semicolon_token)
return semicolon_token;
@@ -1078,7 +1078,7 @@ unsigned EmptyDeclarationAST::firstToken() const
}
/** \generated */
-unsigned EmptyDeclarationAST::lastToken() const
+int EmptyDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -1086,24 +1086,24 @@ unsigned EmptyDeclarationAST::lastToken() const
}
/** \generated */
-unsigned EnumSpecifierAST::firstToken() const
+int EnumSpecifierAST::firstToken() const
{
if (enum_token)
return enum_token;
if (key_token)
return key_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (colon_token)
return colon_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (lbrace_token)
return lbrace_token;
if (enumerator_list)
- if (unsigned candidate = enumerator_list->firstToken())
+ if (int candidate = enumerator_list->firstToken())
return candidate;
if (stray_comma_token)
return stray_comma_token;
@@ -1113,24 +1113,24 @@ unsigned EnumSpecifierAST::firstToken() const
}
/** \generated */
-unsigned EnumSpecifierAST::lastToken() const
+int EnumSpecifierAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (stray_comma_token)
return stray_comma_token + 1;
if (enumerator_list)
- if (unsigned candidate = enumerator_list->lastToken())
+ if (int candidate = enumerator_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (key_token)
return key_token + 1;
@@ -1140,23 +1140,23 @@ unsigned EnumSpecifierAST::lastToken() const
}
/** \generated */
-unsigned EnumeratorAST::firstToken() const
+int EnumeratorAST::firstToken() const
{
if (identifier_token)
return identifier_token;
if (equal_token)
return equal_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned EnumeratorAST::lastToken() const
+int EnumeratorAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
@@ -1166,13 +1166,13 @@ unsigned EnumeratorAST::lastToken() const
}
/** \generated */
-unsigned ExceptionDeclarationAST::firstToken() const
+int ExceptionDeclarationAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token;
@@ -1180,21 +1180,21 @@ unsigned ExceptionDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ExceptionDeclarationAST::lastToken() const
+int ExceptionDeclarationAST::lastToken() const
{
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned DynamicExceptionSpecificationAST::firstToken() const
+int DynamicExceptionSpecificationAST::firstToken() const
{
if (throw_token)
return throw_token;
@@ -1203,7 +1203,7 @@ unsigned DynamicExceptionSpecificationAST::firstToken() const
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (type_id_list)
- if (unsigned candidate = type_id_list->firstToken())
+ if (int candidate = type_id_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -1211,12 +1211,12 @@ unsigned DynamicExceptionSpecificationAST::firstToken() const
}
/** \generated */
-unsigned DynamicExceptionSpecificationAST::lastToken() const
+int DynamicExceptionSpecificationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (type_id_list)
- if (unsigned candidate = type_id_list->lastToken())
+ if (int candidate = type_id_list->lastToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
@@ -1228,34 +1228,34 @@ unsigned DynamicExceptionSpecificationAST::lastToken() const
}
/** \generated */
-unsigned ExpressionOrDeclarationStatementAST::firstToken() const
+int ExpressionOrDeclarationStatementAST::firstToken() const
{
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (declaration)
- if (unsigned candidate = declaration->firstToken())
+ if (int candidate = declaration->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ExpressionOrDeclarationStatementAST::lastToken() const
+int ExpressionOrDeclarationStatementAST::lastToken() const
{
if (declaration)
- if (unsigned candidate = declaration->lastToken())
+ if (int candidate = declaration->lastToken())
return candidate;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ExpressionStatementAST::firstToken() const
+int ExpressionStatementAST::firstToken() const
{
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -1263,60 +1263,60 @@ unsigned ExpressionStatementAST::firstToken() const
}
/** \generated */
-unsigned ExpressionStatementAST::lastToken() const
+int ExpressionStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ForStatementAST::firstToken() const
+int ForStatementAST::firstToken() const
{
if (for_token)
return for_token;
if (lparen_token)
return lparen_token;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
if (condition)
- if (unsigned candidate = condition->firstToken())
+ if (int candidate = condition->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ForStatementAST::lastToken() const
+int ForStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (semicolon_token)
return semicolon_token + 1;
if (condition)
- if (unsigned candidate = condition->lastToken())
+ if (int candidate = condition->lastToken())
return candidate;
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1326,55 +1326,55 @@ unsigned ForStatementAST::lastToken() const
}
/** \generated */
-unsigned ForeachStatementAST::firstToken() const
+int ForeachStatementAST::firstToken() const
{
if (foreach_token)
return foreach_token;
if (lparen_token)
return lparen_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
if (comma_token)
return comma_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ForeachStatementAST::lastToken() const
+int ForeachStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (comma_token)
return comma_token + 1;
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1384,53 +1384,53 @@ unsigned ForeachStatementAST::lastToken() const
}
/** \generated */
-unsigned FunctionDeclaratorAST::firstToken() const
+int FunctionDeclaratorAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (parameter_declaration_clause)
- if (unsigned candidate = parameter_declaration_clause->firstToken())
+ if (int candidate = parameter_declaration_clause->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->firstToken())
+ if (int candidate = cv_qualifier_list->firstToken())
return candidate;
if (ref_qualifier_token)
return ref_qualifier_token;
if (exception_specification)
- if (unsigned candidate = exception_specification->firstToken())
+ if (int candidate = exception_specification->firstToken())
return candidate;
if (trailing_return_type)
- if (unsigned candidate = trailing_return_type->firstToken())
+ if (int candidate = trailing_return_type->firstToken())
return candidate;
if (as_cpp_initializer)
- if (unsigned candidate = as_cpp_initializer->firstToken())
+ if (int candidate = as_cpp_initializer->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned FunctionDeclaratorAST::lastToken() const
+int FunctionDeclaratorAST::lastToken() const
{
if (as_cpp_initializer)
- if (unsigned candidate = as_cpp_initializer->lastToken())
+ if (int candidate = as_cpp_initializer->lastToken())
return candidate;
if (trailing_return_type)
- if (unsigned candidate = trailing_return_type->lastToken())
+ if (int candidate = trailing_return_type->lastToken())
return candidate;
if (exception_specification)
- if (unsigned candidate = exception_specification->lastToken())
+ if (int candidate = exception_specification->lastToken())
return candidate;
if (ref_qualifier_token)
return ref_qualifier_token + 1;
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->lastToken())
+ if (int candidate = cv_qualifier_list->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (parameter_declaration_clause)
- if (unsigned candidate = parameter_declaration_clause->lastToken())
+ if (int candidate = parameter_declaration_clause->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1438,39 +1438,39 @@ unsigned FunctionDeclaratorAST::lastToken() const
}
/** \generated */
-unsigned FunctionDefinitionAST::firstToken() const
+int FunctionDefinitionAST::firstToken() const
{
if (qt_invokable_token)
return qt_invokable_token;
if (decl_specifier_list)
- if (unsigned candidate = decl_specifier_list->firstToken())
+ if (int candidate = decl_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (ctor_initializer)
- if (unsigned candidate = ctor_initializer->firstToken())
+ if (int candidate = ctor_initializer->firstToken())
return candidate;
if (function_body)
- if (unsigned candidate = function_body->firstToken())
+ if (int candidate = function_body->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned FunctionDefinitionAST::lastToken() const
+int FunctionDefinitionAST::lastToken() const
{
if (function_body)
- if (unsigned candidate = function_body->lastToken())
+ if (int candidate = function_body->lastToken())
return candidate;
if (ctor_initializer)
- if (unsigned candidate = ctor_initializer->lastToken())
+ if (int candidate = ctor_initializer->lastToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (decl_specifier_list)
- if (unsigned candidate = decl_specifier_list->lastToken())
+ if (int candidate = decl_specifier_list->lastToken())
return candidate;
if (qt_invokable_token)
return qt_invokable_token + 1;
@@ -1478,7 +1478,7 @@ unsigned FunctionDefinitionAST::lastToken() const
}
/** \generated */
-unsigned GotoStatementAST::firstToken() const
+int GotoStatementAST::firstToken() const
{
if (goto_token)
return goto_token;
@@ -1490,7 +1490,7 @@ unsigned GotoStatementAST::firstToken() const
}
/** \generated */
-unsigned GotoStatementAST::lastToken() const
+int GotoStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
@@ -1502,61 +1502,61 @@ unsigned GotoStatementAST::lastToken() const
}
/** \generated */
-unsigned IdExpressionAST::firstToken() const
+int IdExpressionAST::firstToken() const
{
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned IdExpressionAST::lastToken() const
+int IdExpressionAST::lastToken() const
{
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned IfStatementAST::firstToken() const
+int IfStatementAST::firstToken() const
{
if (if_token)
return if_token;
if (lparen_token)
return lparen_token;
if (condition)
- if (unsigned candidate = condition->firstToken())
+ if (int candidate = condition->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
if (else_token)
return else_token;
if (else_statement)
- if (unsigned candidate = else_statement->firstToken())
+ if (int candidate = else_statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned IfStatementAST::lastToken() const
+int IfStatementAST::lastToken() const
{
if (else_statement)
- if (unsigned candidate = else_statement->lastToken())
+ if (int candidate = else_statement->lastToken())
return candidate;
if (else_token)
return else_token + 1;
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (condition)
- if (unsigned candidate = condition->lastToken())
+ if (int candidate = condition->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1566,23 +1566,23 @@ unsigned IfStatementAST::lastToken() const
}
/** \generated */
-unsigned LabeledStatementAST::firstToken() const
+int LabeledStatementAST::firstToken() const
{
if (label_token)
return label_token;
if (colon_token)
return colon_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned LabeledStatementAST::lastToken() const
+int LabeledStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
@@ -1592,21 +1592,21 @@ unsigned LabeledStatementAST::lastToken() const
}
/** \generated */
-unsigned LambdaCaptureAST::firstToken() const
+int LambdaCaptureAST::firstToken() const
{
if (default_capture_token)
return default_capture_token;
if (capture_list)
- if (unsigned candidate = capture_list->firstToken())
+ if (int candidate = capture_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned LambdaCaptureAST::lastToken() const
+int LambdaCaptureAST::lastToken() const
{
if (capture_list)
- if (unsigned candidate = capture_list->lastToken())
+ if (int candidate = capture_list->lastToken())
return candidate;
if (default_capture_token)
return default_capture_token + 1;
@@ -1614,47 +1614,47 @@ unsigned LambdaCaptureAST::lastToken() const
}
/** \generated */
-unsigned LambdaDeclaratorAST::firstToken() const
+int LambdaDeclaratorAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (parameter_declaration_clause)
- if (unsigned candidate = parameter_declaration_clause->firstToken())
+ if (int candidate = parameter_declaration_clause->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (attributes)
- if (unsigned candidate = attributes->firstToken())
+ if (int candidate = attributes->firstToken())
return candidate;
if (mutable_token)
return mutable_token;
if (exception_specification)
- if (unsigned candidate = exception_specification->firstToken())
+ if (int candidate = exception_specification->firstToken())
return candidate;
if (trailing_return_type)
- if (unsigned candidate = trailing_return_type->firstToken())
+ if (int candidate = trailing_return_type->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned LambdaDeclaratorAST::lastToken() const
+int LambdaDeclaratorAST::lastToken() const
{
if (trailing_return_type)
- if (unsigned candidate = trailing_return_type->lastToken())
+ if (int candidate = trailing_return_type->lastToken())
return candidate;
if (exception_specification)
- if (unsigned candidate = exception_specification->lastToken())
+ if (int candidate = exception_specification->lastToken())
return candidate;
if (mutable_token)
return mutable_token + 1;
if (attributes)
- if (unsigned candidate = attributes->lastToken())
+ if (int candidate = attributes->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (parameter_declaration_clause)
- if (unsigned candidate = parameter_declaration_clause->lastToken())
+ if (int candidate = parameter_declaration_clause->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1662,42 +1662,42 @@ unsigned LambdaDeclaratorAST::lastToken() const
}
/** \generated */
-unsigned LambdaExpressionAST::firstToken() const
+int LambdaExpressionAST::firstToken() const
{
if (lambda_introducer)
- if (unsigned candidate = lambda_introducer->firstToken())
+ if (int candidate = lambda_introducer->firstToken())
return candidate;
if (lambda_declarator)
- if (unsigned candidate = lambda_declarator->firstToken())
+ if (int candidate = lambda_declarator->firstToken())
return candidate;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned LambdaExpressionAST::lastToken() const
+int LambdaExpressionAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (lambda_declarator)
- if (unsigned candidate = lambda_declarator->lastToken())
+ if (int candidate = lambda_declarator->lastToken())
return candidate;
if (lambda_introducer)
- if (unsigned candidate = lambda_introducer->lastToken())
+ if (int candidate = lambda_introducer->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned LambdaIntroducerAST::firstToken() const
+int LambdaIntroducerAST::firstToken() const
{
if (lbracket_token)
return lbracket_token;
if (lambda_capture)
- if (unsigned candidate = lambda_capture->firstToken())
+ if (int candidate = lambda_capture->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -1705,12 +1705,12 @@ unsigned LambdaIntroducerAST::firstToken() const
}
/** \generated */
-unsigned LambdaIntroducerAST::lastToken() const
+int LambdaIntroducerAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (lambda_capture)
- if (unsigned candidate = lambda_capture->lastToken())
+ if (int candidate = lambda_capture->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
@@ -1718,12 +1718,12 @@ unsigned LambdaIntroducerAST::lastToken() const
}
/** \generated */
-unsigned LinkageBodyAST::firstToken() const
+int LinkageBodyAST::firstToken() const
{
if (lbrace_token)
return lbrace_token;
if (declaration_list)
- if (unsigned candidate = declaration_list->firstToken())
+ if (int candidate = declaration_list->firstToken())
return candidate;
if (rbrace_token)
return rbrace_token;
@@ -1731,12 +1731,12 @@ unsigned LinkageBodyAST::firstToken() const
}
/** \generated */
-unsigned LinkageBodyAST::lastToken() const
+int LinkageBodyAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (declaration_list)
- if (unsigned candidate = declaration_list->lastToken())
+ if (int candidate = declaration_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
@@ -1744,23 +1744,23 @@ unsigned LinkageBodyAST::lastToken() const
}
/** \generated */
-unsigned LinkageSpecificationAST::firstToken() const
+int LinkageSpecificationAST::firstToken() const
{
if (extern_token)
return extern_token;
if (extern_type_token)
return extern_type_token;
if (declaration)
- if (unsigned candidate = declaration->firstToken())
+ if (int candidate = declaration->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned LinkageSpecificationAST::lastToken() const
+int LinkageSpecificationAST::lastToken() const
{
if (declaration)
- if (unsigned candidate = declaration->lastToken())
+ if (int candidate = declaration->lastToken())
return candidate;
if (extern_type_token)
return extern_type_token + 1;
@@ -1770,81 +1770,81 @@ unsigned LinkageSpecificationAST::lastToken() const
}
/** \generated */
-unsigned MemInitializerAST::firstToken() const
+int MemInitializerAST::firstToken() const
{
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned MemInitializerAST::lastToken() const
+int MemInitializerAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned MemberAccessAST::firstToken() const
+int MemberAccessAST::firstToken() const
{
if (base_expression)
- if (unsigned candidate = base_expression->firstToken())
+ if (int candidate = base_expression->firstToken())
return candidate;
if (access_token)
return access_token;
if (template_token)
return template_token;
if (member_name)
- if (unsigned candidate = member_name->firstToken())
+ if (int candidate = member_name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned MemberAccessAST::lastToken() const
+int MemberAccessAST::lastToken() const
{
if (member_name)
- if (unsigned candidate = member_name->lastToken())
+ if (int candidate = member_name->lastToken())
return candidate;
if (template_token)
return template_token + 1;
if (access_token)
return access_token + 1;
if (base_expression)
- if (unsigned candidate = base_expression->lastToken())
+ if (int candidate = base_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned NamedTypeSpecifierAST::firstToken() const
+int NamedTypeSpecifierAST::firstToken() const
{
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned NamedTypeSpecifierAST::lastToken() const
+int NamedTypeSpecifierAST::lastToken() const
{
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned NamespaceAST::firstToken() const
+int NamespaceAST::firstToken() const
{
if (inline_token)
return inline_token;
@@ -1853,22 +1853,22 @@ unsigned NamespaceAST::firstToken() const
if (identifier_token)
return identifier_token;
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (linkage_body)
- if (unsigned candidate = linkage_body->firstToken())
+ if (int candidate = linkage_body->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned NamespaceAST::lastToken() const
+int NamespaceAST::lastToken() const
{
if (linkage_body)
- if (unsigned candidate = linkage_body->lastToken())
+ if (int candidate = linkage_body->lastToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (identifier_token)
return identifier_token + 1;
@@ -1880,7 +1880,7 @@ unsigned NamespaceAST::lastToken() const
}
/** \generated */
-unsigned NamespaceAliasDefinitionAST::firstToken() const
+int NamespaceAliasDefinitionAST::firstToken() const
{
if (namespace_token)
return namespace_token;
@@ -1889,7 +1889,7 @@ unsigned NamespaceAliasDefinitionAST::firstToken() const
if (equal_token)
return equal_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -1897,12 +1897,12 @@ unsigned NamespaceAliasDefinitionAST::firstToken() const
}
/** \generated */
-unsigned NamespaceAliasDefinitionAST::lastToken() const
+int NamespaceAliasDefinitionAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
@@ -1914,12 +1914,12 @@ unsigned NamespaceAliasDefinitionAST::lastToken() const
}
/** \generated */
-unsigned NestedDeclaratorAST::firstToken() const
+int NestedDeclaratorAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -1927,12 +1927,12 @@ unsigned NestedDeclaratorAST::firstToken() const
}
/** \generated */
-unsigned NestedDeclaratorAST::lastToken() const
+int NestedDeclaratorAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1940,12 +1940,12 @@ unsigned NestedDeclaratorAST::lastToken() const
}
/** \generated */
-unsigned NestedExpressionAST::firstToken() const
+int NestedExpressionAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -1953,12 +1953,12 @@ unsigned NestedExpressionAST::firstToken() const
}
/** \generated */
-unsigned NestedExpressionAST::lastToken() const
+int NestedExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -1966,10 +1966,10 @@ unsigned NestedExpressionAST::lastToken() const
}
/** \generated */
-unsigned NestedNameSpecifierAST::firstToken() const
+int NestedNameSpecifierAST::firstToken() const
{
if (class_or_namespace_name)
- if (unsigned candidate = class_or_namespace_name->firstToken())
+ if (int candidate = class_or_namespace_name->firstToken())
return candidate;
if (scope_token)
return scope_token;
@@ -1977,23 +1977,23 @@ unsigned NestedNameSpecifierAST::firstToken() const
}
/** \generated */
-unsigned NestedNameSpecifierAST::lastToken() const
+int NestedNameSpecifierAST::lastToken() const
{
if (scope_token)
return scope_token + 1;
if (class_or_namespace_name)
- if (unsigned candidate = class_or_namespace_name->lastToken())
+ if (int candidate = class_or_namespace_name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned NewArrayDeclaratorAST::firstToken() const
+int NewArrayDeclaratorAST::firstToken() const
{
if (lbracket_token)
return lbracket_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -2001,12 +2001,12 @@ unsigned NewArrayDeclaratorAST::firstToken() const
}
/** \generated */
-unsigned NewArrayDeclaratorAST::lastToken() const
+int NewArrayDeclaratorAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
@@ -2014,49 +2014,49 @@ unsigned NewArrayDeclaratorAST::lastToken() const
}
/** \generated */
-unsigned NewExpressionAST::firstToken() const
+int NewExpressionAST::firstToken() const
{
if (scope_token)
return scope_token;
if (new_token)
return new_token;
if (new_placement)
- if (unsigned candidate = new_placement->firstToken())
+ if (int candidate = new_placement->firstToken())
return candidate;
if (lparen_token)
return lparen_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (new_type_id)
- if (unsigned candidate = new_type_id->firstToken())
+ if (int candidate = new_type_id->firstToken())
return candidate;
if (new_initializer)
- if (unsigned candidate = new_initializer->firstToken())
+ if (int candidate = new_initializer->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned NewExpressionAST::lastToken() const
+int NewExpressionAST::lastToken() const
{
if (new_initializer)
- if (unsigned candidate = new_initializer->lastToken())
+ if (int candidate = new_initializer->lastToken())
return candidate;
if (new_type_id)
- if (unsigned candidate = new_type_id->lastToken())
+ if (int candidate = new_type_id->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (new_placement)
- if (unsigned candidate = new_placement->lastToken())
+ if (int candidate = new_placement->lastToken())
return candidate;
if (new_token)
return new_token + 1;
@@ -2066,12 +2066,12 @@ unsigned NewExpressionAST::lastToken() const
}
/** \generated */
-unsigned ExpressionListParenAST::firstToken() const
+int ExpressionListParenAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (expression_list)
- if (unsigned candidate = expression_list->firstToken())
+ if (int candidate = expression_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -2079,12 +2079,12 @@ unsigned ExpressionListParenAST::firstToken() const
}
/** \generated */
-unsigned ExpressionListParenAST::lastToken() const
+int ExpressionListParenAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression_list)
- if (unsigned candidate = expression_list->lastToken())
+ if (int candidate = expression_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -2092,37 +2092,37 @@ unsigned ExpressionListParenAST::lastToken() const
}
/** \generated */
-unsigned NewTypeIdAST::firstToken() const
+int NewTypeIdAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->firstToken())
+ if (int candidate = ptr_operator_list->firstToken())
return candidate;
if (new_array_declarator_list)
- if (unsigned candidate = new_array_declarator_list->firstToken())
+ if (int candidate = new_array_declarator_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned NewTypeIdAST::lastToken() const
+int NewTypeIdAST::lastToken() const
{
if (new_array_declarator_list)
- if (unsigned candidate = new_array_declarator_list->lastToken())
+ if (int candidate = new_array_declarator_list->lastToken())
return candidate;
if (ptr_operator_list)
- if (unsigned candidate = ptr_operator_list->lastToken())
+ if (int candidate = ptr_operator_list->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned NumericLiteralAST::firstToken() const
+int NumericLiteralAST::firstToken() const
{
if (literal_token)
return literal_token;
@@ -2130,7 +2130,7 @@ unsigned NumericLiteralAST::firstToken() const
}
/** \generated */
-unsigned NumericLiteralAST::lastToken() const
+int NumericLiteralAST::lastToken() const
{
if (literal_token)
return literal_token + 1;
@@ -2138,38 +2138,38 @@ unsigned NumericLiteralAST::lastToken() const
}
/** \generated */
-unsigned ObjCClassDeclarationAST::firstToken() const
+int ObjCClassDeclarationAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (interface_token)
return interface_token;
if (implementation_token)
return implementation_token;
if (class_name)
- if (unsigned candidate = class_name->firstToken())
+ if (int candidate = class_name->firstToken())
return candidate;
if (lparen_token)
return lparen_token;
if (category_name)
- if (unsigned candidate = category_name->firstToken())
+ if (int candidate = category_name->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (colon_token)
return colon_token;
if (superclass)
- if (unsigned candidate = superclass->firstToken())
+ if (int candidate = superclass->firstToken())
return candidate;
if (protocol_refs)
- if (unsigned candidate = protocol_refs->firstToken())
+ if (int candidate = protocol_refs->firstToken())
return candidate;
if (inst_vars_decl)
- if (unsigned candidate = inst_vars_decl->firstToken())
+ if (int candidate = inst_vars_decl->firstToken())
return candidate;
if (member_declaration_list)
- if (unsigned candidate = member_declaration_list->firstToken())
+ if (int candidate = member_declaration_list->firstToken())
return candidate;
if (end_token)
return end_token;
@@ -2177,54 +2177,54 @@ unsigned ObjCClassDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCClassDeclarationAST::lastToken() const
+int ObjCClassDeclarationAST::lastToken() const
{
if (end_token)
return end_token + 1;
if (member_declaration_list)
- if (unsigned candidate = member_declaration_list->lastToken())
+ if (int candidate = member_declaration_list->lastToken())
return candidate;
if (inst_vars_decl)
- if (unsigned candidate = inst_vars_decl->lastToken())
+ if (int candidate = inst_vars_decl->lastToken())
return candidate;
if (protocol_refs)
- if (unsigned candidate = protocol_refs->lastToken())
+ if (int candidate = protocol_refs->lastToken())
return candidate;
if (superclass)
- if (unsigned candidate = superclass->lastToken())
+ if (int candidate = superclass->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (rparen_token)
return rparen_token + 1;
if (category_name)
- if (unsigned candidate = category_name->lastToken())
+ if (int candidate = category_name->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (class_name)
- if (unsigned candidate = class_name->lastToken())
+ if (int candidate = class_name->lastToken())
return candidate;
if (implementation_token)
return implementation_token + 1;
if (interface_token)
return interface_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCClassForwardDeclarationAST::firstToken() const
+int ObjCClassForwardDeclarationAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (class_token)
return class_token;
if (identifier_list)
- if (unsigned candidate = identifier_list->firstToken())
+ if (int candidate = identifier_list->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -2232,28 +2232,28 @@ unsigned ObjCClassForwardDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCClassForwardDeclarationAST::lastToken() const
+int ObjCClassForwardDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (identifier_list)
- if (unsigned candidate = identifier_list->lastToken())
+ if (int candidate = identifier_list->lastToken())
return candidate;
if (class_token)
return class_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCDynamicPropertiesDeclarationAST::firstToken() const
+int ObjCDynamicPropertiesDeclarationAST::firstToken() const
{
if (dynamic_token)
return dynamic_token;
if (property_identifier_list)
- if (unsigned candidate = property_identifier_list->firstToken())
+ if (int candidate = property_identifier_list->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -2261,12 +2261,12 @@ unsigned ObjCDynamicPropertiesDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCDynamicPropertiesDeclarationAST::lastToken() const
+int ObjCDynamicPropertiesDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (property_identifier_list)
- if (unsigned candidate = property_identifier_list->lastToken())
+ if (int candidate = property_identifier_list->lastToken())
return candidate;
if (dynamic_token)
return dynamic_token + 1;
@@ -2274,21 +2274,21 @@ unsigned ObjCDynamicPropertiesDeclarationAST::lastToken() const
}
/** \generated */
-unsigned ObjCEncodeExpressionAST::firstToken() const
+int ObjCEncodeExpressionAST::firstToken() const
{
if (encode_token)
return encode_token;
if (type_name)
- if (unsigned candidate = type_name->firstToken())
+ if (int candidate = type_name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCEncodeExpressionAST::lastToken() const
+int ObjCEncodeExpressionAST::lastToken() const
{
if (type_name)
- if (unsigned candidate = type_name->lastToken())
+ if (int candidate = type_name->lastToken())
return candidate;
if (encode_token)
return encode_token + 1;
@@ -2296,55 +2296,55 @@ unsigned ObjCEncodeExpressionAST::lastToken() const
}
/** \generated */
-unsigned ObjCFastEnumerationAST::firstToken() const
+int ObjCFastEnumerationAST::firstToken() const
{
if (for_token)
return for_token;
if (lparen_token)
return lparen_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
if (in_token)
return in_token;
if (fast_enumeratable_expression)
- if (unsigned candidate = fast_enumeratable_expression->firstToken())
+ if (int candidate = fast_enumeratable_expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCFastEnumerationAST::lastToken() const
+int ObjCFastEnumerationAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (fast_enumeratable_expression)
- if (unsigned candidate = fast_enumeratable_expression->lastToken())
+ if (int candidate = fast_enumeratable_expression->lastToken())
return candidate;
if (in_token)
return in_token + 1;
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -2354,12 +2354,12 @@ unsigned ObjCFastEnumerationAST::lastToken() const
}
/** \generated */
-unsigned ObjCInstanceVariablesDeclarationAST::firstToken() const
+int ObjCInstanceVariablesDeclarationAST::firstToken() const
{
if (lbrace_token)
return lbrace_token;
if (instance_variable_list)
- if (unsigned candidate = instance_variable_list->firstToken())
+ if (int candidate = instance_variable_list->firstToken())
return candidate;
if (rbrace_token)
return rbrace_token;
@@ -2367,12 +2367,12 @@ unsigned ObjCInstanceVariablesDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCInstanceVariablesDeclarationAST::lastToken() const
+int ObjCInstanceVariablesDeclarationAST::lastToken() const
{
if (rbrace_token)
return rbrace_token + 1;
if (instance_variable_list)
- if (unsigned candidate = instance_variable_list->lastToken())
+ if (int candidate = instance_variable_list->lastToken())
return candidate;
if (lbrace_token)
return lbrace_token + 1;
@@ -2380,66 +2380,66 @@ unsigned ObjCInstanceVariablesDeclarationAST::lastToken() const
}
/** \generated */
-unsigned ObjCMessageArgumentAST::firstToken() const
+int ObjCMessageArgumentAST::firstToken() const
{
if (parameter_value_expression)
- if (unsigned candidate = parameter_value_expression->firstToken())
+ if (int candidate = parameter_value_expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCMessageArgumentAST::lastToken() const
+int ObjCMessageArgumentAST::lastToken() const
{
if (parameter_value_expression)
- if (unsigned candidate = parameter_value_expression->lastToken())
+ if (int candidate = parameter_value_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCMessageArgumentDeclarationAST::firstToken() const
+int ObjCMessageArgumentDeclarationAST::firstToken() const
{
if (type_name)
- if (unsigned candidate = type_name->firstToken())
+ if (int candidate = type_name->firstToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (param_name)
- if (unsigned candidate = param_name->firstToken())
+ if (int candidate = param_name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCMessageArgumentDeclarationAST::lastToken() const
+int ObjCMessageArgumentDeclarationAST::lastToken() const
{
if (param_name)
- if (unsigned candidate = param_name->lastToken())
+ if (int candidate = param_name->lastToken())
return candidate;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (type_name)
- if (unsigned candidate = type_name->lastToken())
+ if (int candidate = type_name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCMessageExpressionAST::firstToken() const
+int ObjCMessageExpressionAST::firstToken() const
{
if (lbracket_token)
return lbracket_token;
if (receiver_expression)
- if (unsigned candidate = receiver_expression->firstToken())
+ if (int candidate = receiver_expression->firstToken())
return candidate;
if (selector)
- if (unsigned candidate = selector->firstToken())
+ if (int candidate = selector->firstToken())
return candidate;
if (argument_list)
- if (unsigned candidate = argument_list->firstToken())
+ if (int candidate = argument_list->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -2447,18 +2447,18 @@ unsigned ObjCMessageExpressionAST::firstToken() const
}
/** \generated */
-unsigned ObjCMessageExpressionAST::lastToken() const
+int ObjCMessageExpressionAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (argument_list)
- if (unsigned candidate = argument_list->lastToken())
+ if (int candidate = argument_list->lastToken())
return candidate;
if (selector)
- if (unsigned candidate = selector->lastToken())
+ if (int candidate = selector->lastToken())
return candidate;
if (receiver_expression)
- if (unsigned candidate = receiver_expression->lastToken())
+ if (int candidate = receiver_expression->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
@@ -2466,13 +2466,13 @@ unsigned ObjCMessageExpressionAST::lastToken() const
}
/** \generated */
-unsigned ObjCMethodDeclarationAST::firstToken() const
+int ObjCMethodDeclarationAST::firstToken() const
{
if (method_prototype)
- if (unsigned candidate = method_prototype->firstToken())
+ if (int candidate = method_prototype->firstToken())
return candidate;
if (function_body)
- if (unsigned candidate = function_body->firstToken())
+ if (int candidate = function_body->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -2480,57 +2480,57 @@ unsigned ObjCMethodDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCMethodDeclarationAST::lastToken() const
+int ObjCMethodDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (function_body)
- if (unsigned candidate = function_body->lastToken())
+ if (int candidate = function_body->lastToken())
return candidate;
if (method_prototype)
- if (unsigned candidate = method_prototype->lastToken())
+ if (int candidate = method_prototype->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCMethodPrototypeAST::firstToken() const
+int ObjCMethodPrototypeAST::firstToken() const
{
if (method_type_token)
return method_type_token;
if (type_name)
- if (unsigned candidate = type_name->firstToken())
+ if (int candidate = type_name->firstToken())
return candidate;
if (selector)
- if (unsigned candidate = selector->firstToken())
+ if (int candidate = selector->firstToken())
return candidate;
if (argument_list)
- if (unsigned candidate = argument_list->firstToken())
+ if (int candidate = argument_list->firstToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCMethodPrototypeAST::lastToken() const
+int ObjCMethodPrototypeAST::lastToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
if (argument_list)
- if (unsigned candidate = argument_list->lastToken())
+ if (int candidate = argument_list->lastToken())
return candidate;
if (selector)
- if (unsigned candidate = selector->lastToken())
+ if (int candidate = selector->lastToken())
return candidate;
if (type_name)
- if (unsigned candidate = type_name->lastToken())
+ if (int candidate = type_name->lastToken())
return candidate;
if (method_type_token)
return method_type_token + 1;
@@ -2538,23 +2538,23 @@ unsigned ObjCMethodPrototypeAST::lastToken() const
}
/** \generated */
-unsigned ObjCPropertyAttributeAST::firstToken() const
+int ObjCPropertyAttributeAST::firstToken() const
{
if (attribute_identifier_token)
return attribute_identifier_token;
if (equals_token)
return equals_token;
if (method_selector)
- if (unsigned candidate = method_selector->firstToken())
+ if (int candidate = method_selector->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCPropertyAttributeAST::lastToken() const
+int ObjCPropertyAttributeAST::lastToken() const
{
if (method_selector)
- if (unsigned candidate = method_selector->lastToken())
+ if (int candidate = method_selector->lastToken())
return candidate;
if (equals_token)
return equals_token + 1;
@@ -2564,63 +2564,63 @@ unsigned ObjCPropertyAttributeAST::lastToken() const
}
/** \generated */
-unsigned ObjCPropertyDeclarationAST::firstToken() const
+int ObjCPropertyDeclarationAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (property_token)
return property_token;
if (lparen_token)
return lparen_token;
if (property_attribute_list)
- if (unsigned candidate = property_attribute_list->firstToken())
+ if (int candidate = property_attribute_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (simple_declaration)
- if (unsigned candidate = simple_declaration->firstToken())
+ if (int candidate = simple_declaration->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCPropertyDeclarationAST::lastToken() const
+int ObjCPropertyDeclarationAST::lastToken() const
{
if (simple_declaration)
- if (unsigned candidate = simple_declaration->lastToken())
+ if (int candidate = simple_declaration->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (property_attribute_list)
- if (unsigned candidate = property_attribute_list->lastToken())
+ if (int candidate = property_attribute_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
if (property_token)
return property_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCProtocolDeclarationAST::firstToken() const
+int ObjCProtocolDeclarationAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (protocol_token)
return protocol_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (protocol_refs)
- if (unsigned candidate = protocol_refs->firstToken())
+ if (int candidate = protocol_refs->firstToken())
return candidate;
if (member_declaration_list)
- if (unsigned candidate = member_declaration_list->firstToken())
+ if (int candidate = member_declaration_list->firstToken())
return candidate;
if (end_token)
return end_token;
@@ -2628,29 +2628,29 @@ unsigned ObjCProtocolDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCProtocolDeclarationAST::lastToken() const
+int ObjCProtocolDeclarationAST::lastToken() const
{
if (end_token)
return end_token + 1;
if (member_declaration_list)
- if (unsigned candidate = member_declaration_list->lastToken())
+ if (int candidate = member_declaration_list->lastToken())
return candidate;
if (protocol_refs)
- if (unsigned candidate = protocol_refs->lastToken())
+ if (int candidate = protocol_refs->lastToken())
return candidate;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (protocol_token)
return protocol_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCProtocolExpressionAST::firstToken() const
+int ObjCProtocolExpressionAST::firstToken() const
{
if (protocol_token)
return protocol_token;
@@ -2664,7 +2664,7 @@ unsigned ObjCProtocolExpressionAST::firstToken() const
}
/** \generated */
-unsigned ObjCProtocolExpressionAST::lastToken() const
+int ObjCProtocolExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
@@ -2678,15 +2678,15 @@ unsigned ObjCProtocolExpressionAST::lastToken() const
}
/** \generated */
-unsigned ObjCProtocolForwardDeclarationAST::firstToken() const
+int ObjCProtocolForwardDeclarationAST::firstToken() const
{
if (attribute_list)
- if (unsigned candidate = attribute_list->firstToken())
+ if (int candidate = attribute_list->firstToken())
return candidate;
if (protocol_token)
return protocol_token;
if (identifier_list)
- if (unsigned candidate = identifier_list->firstToken())
+ if (int candidate = identifier_list->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -2694,28 +2694,28 @@ unsigned ObjCProtocolForwardDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCProtocolForwardDeclarationAST::lastToken() const
+int ObjCProtocolForwardDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (identifier_list)
- if (unsigned candidate = identifier_list->lastToken())
+ if (int candidate = identifier_list->lastToken())
return candidate;
if (protocol_token)
return protocol_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCProtocolRefsAST::firstToken() const
+int ObjCProtocolRefsAST::firstToken() const
{
if (less_token)
return less_token;
if (identifier_list)
- if (unsigned candidate = identifier_list->firstToken())
+ if (int candidate = identifier_list->firstToken())
return candidate;
if (greater_token)
return greater_token;
@@ -2723,12 +2723,12 @@ unsigned ObjCProtocolRefsAST::firstToken() const
}
/** \generated */
-unsigned ObjCProtocolRefsAST::lastToken() const
+int ObjCProtocolRefsAST::lastToken() const
{
if (greater_token)
return greater_token + 1;
if (identifier_list)
- if (unsigned candidate = identifier_list->lastToken())
+ if (int candidate = identifier_list->lastToken())
return candidate;
if (less_token)
return less_token + 1;
@@ -2736,25 +2736,25 @@ unsigned ObjCProtocolRefsAST::lastToken() const
}
/** \generated */
-unsigned ObjCSelectorAST::firstToken() const
+int ObjCSelectorAST::firstToken() const
{
if (selector_argument_list)
- if (unsigned candidate = selector_argument_list->firstToken())
+ if (int candidate = selector_argument_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCSelectorAST::lastToken() const
+int ObjCSelectorAST::lastToken() const
{
if (selector_argument_list)
- if (unsigned candidate = selector_argument_list->lastToken())
+ if (int candidate = selector_argument_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ObjCSelectorArgumentAST::firstToken() const
+int ObjCSelectorArgumentAST::firstToken() const
{
if (name_token)
return name_token;
@@ -2764,7 +2764,7 @@ unsigned ObjCSelectorArgumentAST::firstToken() const
}
/** \generated */
-unsigned ObjCSelectorArgumentAST::lastToken() const
+int ObjCSelectorArgumentAST::lastToken() const
{
if (colon_token)
return colon_token + 1;
@@ -2774,14 +2774,14 @@ unsigned ObjCSelectorArgumentAST::lastToken() const
}
/** \generated */
-unsigned ObjCSelectorExpressionAST::firstToken() const
+int ObjCSelectorExpressionAST::firstToken() const
{
if (selector_token)
return selector_token;
if (lparen_token)
return lparen_token;
if (selector)
- if (unsigned candidate = selector->firstToken())
+ if (int candidate = selector->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -2789,12 +2789,12 @@ unsigned ObjCSelectorExpressionAST::firstToken() const
}
/** \generated */
-unsigned ObjCSelectorExpressionAST::lastToken() const
+int ObjCSelectorExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (selector)
- if (unsigned candidate = selector->lastToken())
+ if (int candidate = selector->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -2804,33 +2804,33 @@ unsigned ObjCSelectorExpressionAST::lastToken() const
}
/** \generated */
-unsigned ObjCSynchronizedStatementAST::firstToken() const
+int ObjCSynchronizedStatementAST::firstToken() const
{
if (synchronized_token)
return synchronized_token;
if (lparen_token)
return lparen_token;
if (synchronized_object)
- if (unsigned candidate = synchronized_object->firstToken())
+ if (int candidate = synchronized_object->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ObjCSynchronizedStatementAST::lastToken() const
+int ObjCSynchronizedStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (synchronized_object)
- if (unsigned candidate = synchronized_object->lastToken())
+ if (int candidate = synchronized_object->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -2840,12 +2840,12 @@ unsigned ObjCSynchronizedStatementAST::lastToken() const
}
/** \generated */
-unsigned ObjCSynthesizedPropertiesDeclarationAST::firstToken() const
+int ObjCSynthesizedPropertiesDeclarationAST::firstToken() const
{
if (synthesized_token)
return synthesized_token;
if (property_identifier_list)
- if (unsigned candidate = property_identifier_list->firstToken())
+ if (int candidate = property_identifier_list->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -2853,12 +2853,12 @@ unsigned ObjCSynthesizedPropertiesDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCSynthesizedPropertiesDeclarationAST::lastToken() const
+int ObjCSynthesizedPropertiesDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (property_identifier_list)
- if (unsigned candidate = property_identifier_list->lastToken())
+ if (int candidate = property_identifier_list->lastToken())
return candidate;
if (synthesized_token)
return synthesized_token + 1;
@@ -2866,7 +2866,7 @@ unsigned ObjCSynthesizedPropertiesDeclarationAST::lastToken() const
}
/** \generated */
-unsigned ObjCSynthesizedPropertyAST::firstToken() const
+int ObjCSynthesizedPropertyAST::firstToken() const
{
if (property_identifier_token)
return property_identifier_token;
@@ -2878,7 +2878,7 @@ unsigned ObjCSynthesizedPropertyAST::firstToken() const
}
/** \generated */
-unsigned ObjCSynthesizedPropertyAST::lastToken() const
+int ObjCSynthesizedPropertyAST::lastToken() const
{
if (alias_identifier_token)
return alias_identifier_token + 1;
@@ -2890,14 +2890,14 @@ unsigned ObjCSynthesizedPropertyAST::lastToken() const
}
/** \generated */
-unsigned ObjCTypeNameAST::firstToken() const
+int ObjCTypeNameAST::firstToken() const
{
if (lparen_token)
return lparen_token;
if (type_qualifier_token)
return type_qualifier_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -2905,12 +2905,12 @@ unsigned ObjCTypeNameAST::firstToken() const
}
/** \generated */
-unsigned ObjCTypeNameAST::lastToken() const
+int ObjCTypeNameAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (type_qualifier_token)
return type_qualifier_token + 1;
@@ -2920,7 +2920,7 @@ unsigned ObjCTypeNameAST::lastToken() const
}
/** \generated */
-unsigned ObjCVisibilityDeclarationAST::firstToken() const
+int ObjCVisibilityDeclarationAST::firstToken() const
{
if (visibility_token)
return visibility_token;
@@ -2928,7 +2928,7 @@ unsigned ObjCVisibilityDeclarationAST::firstToken() const
}
/** \generated */
-unsigned ObjCVisibilityDeclarationAST::lastToken() const
+int ObjCVisibilityDeclarationAST::lastToken() const
{
if (visibility_token)
return visibility_token + 1;
@@ -2936,7 +2936,7 @@ unsigned ObjCVisibilityDeclarationAST::lastToken() const
}
/** \generated */
-unsigned OperatorAST::firstToken() const
+int OperatorAST::firstToken() const
{
if (op_token)
return op_token;
@@ -2948,7 +2948,7 @@ unsigned OperatorAST::firstToken() const
}
/** \generated */
-unsigned OperatorAST::lastToken() const
+int OperatorAST::lastToken() const
{
if (close_token)
return close_token + 1;
@@ -2960,21 +2960,21 @@ unsigned OperatorAST::lastToken() const
}
/** \generated */
-unsigned OperatorFunctionIdAST::firstToken() const
+int OperatorFunctionIdAST::firstToken() const
{
if (operator_token)
return operator_token;
if (op)
- if (unsigned candidate = op->firstToken())
+ if (int candidate = op->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned OperatorFunctionIdAST::lastToken() const
+int OperatorFunctionIdAST::lastToken() const
{
if (op)
- if (unsigned candidate = op->lastToken())
+ if (int candidate = op->lastToken())
return candidate;
if (operator_token)
return operator_token + 1;
@@ -2982,44 +2982,44 @@ unsigned OperatorFunctionIdAST::lastToken() const
}
/** \generated */
-unsigned ParameterDeclarationAST::firstToken() const
+int ParameterDeclarationAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ParameterDeclarationAST::lastToken() const
+int ParameterDeclarationAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned ParameterDeclarationClauseAST::firstToken() const
+int ParameterDeclarationClauseAST::firstToken() const
{
if (parameter_declaration_list)
- if (unsigned candidate = parameter_declaration_list->firstToken())
+ if (int candidate = parameter_declaration_list->firstToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token;
@@ -3027,32 +3027,32 @@ unsigned ParameterDeclarationClauseAST::firstToken() const
}
/** \generated */
-unsigned ParameterDeclarationClauseAST::lastToken() const
+int ParameterDeclarationClauseAST::lastToken() const
{
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
if (parameter_declaration_list)
- if (unsigned candidate = parameter_declaration_list->lastToken())
+ if (int candidate = parameter_declaration_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned PointerAST::firstToken() const
+int PointerAST::firstToken() const
{
if (star_token)
return star_token;
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->firstToken())
+ if (int candidate = cv_qualifier_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned PointerAST::lastToken() const
+int PointerAST::lastToken() const
{
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->lastToken())
+ if (int candidate = cv_qualifier_list->lastToken())
return candidate;
if (star_token)
return star_token + 1;
@@ -3060,17 +3060,17 @@ unsigned PointerAST::lastToken() const
}
/** \generated */
-unsigned PointerToMemberAST::firstToken() const
+int PointerToMemberAST::firstToken() const
{
if (global_scope_token)
return global_scope_token;
if (nested_name_specifier_list)
- if (unsigned candidate = nested_name_specifier_list->firstToken())
+ if (int candidate = nested_name_specifier_list->firstToken())
return candidate;
if (star_token)
return star_token;
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->firstToken())
+ if (int candidate = cv_qualifier_list->firstToken())
return candidate;
if (ref_qualifier_token)
return ref_qualifier_token;
@@ -3078,17 +3078,17 @@ unsigned PointerToMemberAST::firstToken() const
}
/** \generated */
-unsigned PointerToMemberAST::lastToken() const
+int PointerToMemberAST::lastToken() const
{
if (ref_qualifier_token)
return ref_qualifier_token + 1;
if (cv_qualifier_list)
- if (unsigned candidate = cv_qualifier_list->lastToken())
+ if (int candidate = cv_qualifier_list->lastToken())
return candidate;
if (star_token)
return star_token + 1;
if (nested_name_specifier_list)
- if (unsigned candidate = nested_name_specifier_list->lastToken())
+ if (int candidate = nested_name_specifier_list->lastToken())
return candidate;
if (global_scope_token)
return global_scope_token + 1;
@@ -3096,10 +3096,10 @@ unsigned PointerToMemberAST::lastToken() const
}
/** \generated */
-unsigned PostIncrDecrAST::firstToken() const
+int PostIncrDecrAST::firstToken() const
{
if (base_expression)
- if (unsigned candidate = base_expression->firstToken())
+ if (int candidate = base_expression->firstToken())
return candidate;
if (incr_decr_token)
return incr_decr_token;
@@ -3107,25 +3107,25 @@ unsigned PostIncrDecrAST::firstToken() const
}
/** \generated */
-unsigned PostIncrDecrAST::lastToken() const
+int PostIncrDecrAST::lastToken() const
{
if (incr_decr_token)
return incr_decr_token + 1;
if (base_expression)
- if (unsigned candidate = base_expression->lastToken())
+ if (int candidate = base_expression->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned QtEnumDeclarationAST::firstToken() const
+int QtEnumDeclarationAST::firstToken() const
{
if (enum_specifier_token)
return enum_specifier_token;
if (lparen_token)
return lparen_token;
if (enumerator_list)
- if (unsigned candidate = enumerator_list->firstToken())
+ if (int candidate = enumerator_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3133,12 +3133,12 @@ unsigned QtEnumDeclarationAST::firstToken() const
}
/** \generated */
-unsigned QtEnumDeclarationAST::lastToken() const
+int QtEnumDeclarationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (enumerator_list)
- if (unsigned candidate = enumerator_list->lastToken())
+ if (int candidate = enumerator_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3148,14 +3148,14 @@ unsigned QtEnumDeclarationAST::lastToken() const
}
/** \generated */
-unsigned QtFlagsDeclarationAST::firstToken() const
+int QtFlagsDeclarationAST::firstToken() const
{
if (flags_specifier_token)
return flags_specifier_token;
if (lparen_token)
return lparen_token;
if (flag_enums_list)
- if (unsigned candidate = flag_enums_list->firstToken())
+ if (int candidate = flag_enums_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3163,12 +3163,12 @@ unsigned QtFlagsDeclarationAST::firstToken() const
}
/** \generated */
-unsigned QtFlagsDeclarationAST::lastToken() const
+int QtFlagsDeclarationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (flag_enums_list)
- if (unsigned candidate = flag_enums_list->lastToken())
+ if (int candidate = flag_enums_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3178,38 +3178,38 @@ unsigned QtFlagsDeclarationAST::lastToken() const
}
/** \generated */
-unsigned QtInterfaceNameAST::firstToken() const
+int QtInterfaceNameAST::firstToken() const
{
if (interface_name)
- if (unsigned candidate = interface_name->firstToken())
+ if (int candidate = interface_name->firstToken())
return candidate;
if (constraint_list)
- if (unsigned candidate = constraint_list->firstToken())
+ if (int candidate = constraint_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned QtInterfaceNameAST::lastToken() const
+int QtInterfaceNameAST::lastToken() const
{
if (constraint_list)
- if (unsigned candidate = constraint_list->lastToken())
+ if (int candidate = constraint_list->lastToken())
return candidate;
if (interface_name)
- if (unsigned candidate = interface_name->lastToken())
+ if (int candidate = interface_name->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned QtInterfacesDeclarationAST::firstToken() const
+int QtInterfacesDeclarationAST::firstToken() const
{
if (interfaces_token)
return interfaces_token;
if (lparen_token)
return lparen_token;
if (interface_name_list)
- if (unsigned candidate = interface_name_list->firstToken())
+ if (int candidate = interface_name_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3217,12 +3217,12 @@ unsigned QtInterfacesDeclarationAST::firstToken() const
}
/** \generated */
-unsigned QtInterfacesDeclarationAST::lastToken() const
+int QtInterfacesDeclarationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (interface_name_list)
- if (unsigned candidate = interface_name_list->lastToken())
+ if (int candidate = interface_name_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3232,14 +3232,14 @@ unsigned QtInterfacesDeclarationAST::lastToken() const
}
/** \generated */
-unsigned QtMemberDeclarationAST::firstToken() const
+int QtMemberDeclarationAST::firstToken() const
{
if (q_token)
return q_token;
if (lparen_token)
return lparen_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3247,12 +3247,12 @@ unsigned QtMemberDeclarationAST::firstToken() const
}
/** \generated */
-unsigned QtMemberDeclarationAST::lastToken() const
+int QtMemberDeclarationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3262,14 +3262,14 @@ unsigned QtMemberDeclarationAST::lastToken() const
}
/** \generated */
-unsigned QtMethodAST::firstToken() const
+int QtMethodAST::firstToken() const
{
if (method_token)
return method_token;
if (lparen_token)
return lparen_token;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3277,12 +3277,12 @@ unsigned QtMethodAST::firstToken() const
}
/** \generated */
-unsigned QtMethodAST::lastToken() const
+int QtMethodAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3292,7 +3292,7 @@ unsigned QtMethodAST::lastToken() const
}
/** \generated */
-unsigned QtObjectTagAST::firstToken() const
+int QtObjectTagAST::firstToken() const
{
if (q_object_token)
return q_object_token;
@@ -3300,7 +3300,7 @@ unsigned QtObjectTagAST::firstToken() const
}
/** \generated */
-unsigned QtObjectTagAST::lastToken() const
+int QtObjectTagAST::lastToken() const
{
if (q_object_token)
return q_object_token + 1;
@@ -3308,7 +3308,7 @@ unsigned QtObjectTagAST::lastToken() const
}
/** \generated */
-unsigned QtPrivateSlotAST::firstToken() const
+int QtPrivateSlotAST::firstToken() const
{
if (q_private_slot_token)
return q_private_slot_token;
@@ -3323,10 +3323,10 @@ unsigned QtPrivateSlotAST::firstToken() const
if (comma_token)
return comma_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3334,15 +3334,15 @@ unsigned QtPrivateSlotAST::firstToken() const
}
/** \generated */
-unsigned QtPrivateSlotAST::lastToken() const
+int QtPrivateSlotAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (comma_token)
return comma_token + 1;
@@ -3360,25 +3360,25 @@ unsigned QtPrivateSlotAST::lastToken() const
}
/** \generated */
-unsigned QtPropertyDeclarationAST::firstToken() const
+int QtPropertyDeclarationAST::firstToken() const
{
if (property_specifier_token)
return property_specifier_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (comma_token)
return comma_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
if (property_name)
- if (unsigned candidate = property_name->firstToken())
+ if (int candidate = property_name->firstToken())
return candidate;
if (property_declaration_item_list)
- if (unsigned candidate = property_declaration_item_list->firstToken())
+ if (int candidate = property_declaration_item_list->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3386,23 +3386,23 @@ unsigned QtPropertyDeclarationAST::firstToken() const
}
/** \generated */
-unsigned QtPropertyDeclarationAST::lastToken() const
+int QtPropertyDeclarationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (property_declaration_item_list)
- if (unsigned candidate = property_declaration_item_list->lastToken())
+ if (int candidate = property_declaration_item_list->lastToken())
return candidate;
if (property_name)
- if (unsigned candidate = property_name->lastToken())
+ if (int candidate = property_name->lastToken())
return candidate;
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (comma_token)
return comma_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3412,21 +3412,21 @@ unsigned QtPropertyDeclarationAST::lastToken() const
}
/** \generated */
-unsigned QtPropertyDeclarationItemAST::firstToken() const
+int QtPropertyDeclarationItemAST::firstToken() const
{
if (item_name_token)
return item_name_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned QtPropertyDeclarationItemAST::lastToken() const
+int QtPropertyDeclarationItemAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (item_name_token)
return item_name_token + 1;
@@ -3434,27 +3434,27 @@ unsigned QtPropertyDeclarationItemAST::lastToken() const
}
/** \generated */
-unsigned QualifiedNameAST::firstToken() const
+int QualifiedNameAST::firstToken() const
{
if (global_scope_token)
return global_scope_token;
if (nested_name_specifier_list)
- if (unsigned candidate = nested_name_specifier_list->firstToken())
+ if (int candidate = nested_name_specifier_list->firstToken())
return candidate;
if (unqualified_name)
- if (unsigned candidate = unqualified_name->firstToken())
+ if (int candidate = unqualified_name->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned QualifiedNameAST::lastToken() const
+int QualifiedNameAST::lastToken() const
{
if (unqualified_name)
- if (unsigned candidate = unqualified_name->lastToken())
+ if (int candidate = unqualified_name->lastToken())
return candidate;
if (nested_name_specifier_list)
- if (unsigned candidate = nested_name_specifier_list->lastToken())
+ if (int candidate = nested_name_specifier_list->lastToken())
return candidate;
if (global_scope_token)
return global_scope_token + 1;
@@ -3462,7 +3462,7 @@ unsigned QualifiedNameAST::lastToken() const
}
/** \generated */
-unsigned ReferenceAST::firstToken() const
+int ReferenceAST::firstToken() const
{
if (reference_token)
return reference_token;
@@ -3470,7 +3470,7 @@ unsigned ReferenceAST::firstToken() const
}
/** \generated */
-unsigned ReferenceAST::lastToken() const
+int ReferenceAST::lastToken() const
{
if (reference_token)
return reference_token + 1;
@@ -3478,12 +3478,12 @@ unsigned ReferenceAST::lastToken() const
}
/** \generated */
-unsigned ReturnStatementAST::firstToken() const
+int ReturnStatementAST::firstToken() const
{
if (return_token)
return return_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -3491,12 +3491,12 @@ unsigned ReturnStatementAST::firstToken() const
}
/** \generated */
-unsigned ReturnStatementAST::lastToken() const
+int ReturnStatementAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (return_token)
return return_token + 1;
@@ -3504,15 +3504,15 @@ unsigned ReturnStatementAST::lastToken() const
}
/** \generated */
-unsigned SimpleDeclarationAST::firstToken() const
+int SimpleDeclarationAST::firstToken() const
{
if (qt_invokable_token)
return qt_invokable_token;
if (decl_specifier_list)
- if (unsigned candidate = decl_specifier_list->firstToken())
+ if (int candidate = decl_specifier_list->firstToken())
return candidate;
if (declarator_list)
- if (unsigned candidate = declarator_list->firstToken())
+ if (int candidate = declarator_list->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -3520,15 +3520,15 @@ unsigned SimpleDeclarationAST::firstToken() const
}
/** \generated */
-unsigned SimpleDeclarationAST::lastToken() const
+int SimpleDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (declarator_list)
- if (unsigned candidate = declarator_list->lastToken())
+ if (int candidate = declarator_list->lastToken())
return candidate;
if (decl_specifier_list)
- if (unsigned candidate = decl_specifier_list->lastToken())
+ if (int candidate = decl_specifier_list->lastToken())
return candidate;
if (qt_invokable_token)
return qt_invokable_token + 1;
@@ -3536,7 +3536,7 @@ unsigned SimpleDeclarationAST::lastToken() const
}
/** \generated */
-unsigned SimpleNameAST::firstToken() const
+int SimpleNameAST::firstToken() const
{
if (identifier_token)
return identifier_token;
@@ -3544,7 +3544,7 @@ unsigned SimpleNameAST::firstToken() const
}
/** \generated */
-unsigned SimpleNameAST::lastToken() const
+int SimpleNameAST::lastToken() const
{
if (identifier_token)
return identifier_token + 1;
@@ -3552,7 +3552,7 @@ unsigned SimpleNameAST::lastToken() const
}
/** \generated */
-unsigned SimpleSpecifierAST::firstToken() const
+int SimpleSpecifierAST::firstToken() const
{
if (specifier_token)
return specifier_token;
@@ -3560,7 +3560,7 @@ unsigned SimpleSpecifierAST::firstToken() const
}
/** \generated */
-unsigned SimpleSpecifierAST::lastToken() const
+int SimpleSpecifierAST::lastToken() const
{
if (specifier_token)
return specifier_token + 1;
@@ -3568,7 +3568,7 @@ unsigned SimpleSpecifierAST::lastToken() const
}
/** \generated */
-unsigned SizeofExpressionAST::firstToken() const
+int SizeofExpressionAST::firstToken() const
{
if (sizeof_token)
return sizeof_token;
@@ -3577,7 +3577,7 @@ unsigned SizeofExpressionAST::firstToken() const
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3585,12 +3585,12 @@ unsigned SizeofExpressionAST::firstToken() const
}
/** \generated */
-unsigned SizeofExpressionAST::lastToken() const
+int SizeofExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3602,21 +3602,21 @@ unsigned SizeofExpressionAST::lastToken() const
}
/** \generated */
-unsigned StringLiteralAST::firstToken() const
+int StringLiteralAST::firstToken() const
{
if (literal_token)
return literal_token;
if (next)
- if (unsigned candidate = next->firstToken())
+ if (int candidate = next->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned StringLiteralAST::lastToken() const
+int StringLiteralAST::lastToken() const
{
if (next)
- if (unsigned candidate = next->lastToken())
+ if (int candidate = next->lastToken())
return candidate;
if (literal_token)
return literal_token + 1;
@@ -3624,33 +3624,33 @@ unsigned StringLiteralAST::lastToken() const
}
/** \generated */
-unsigned SwitchStatementAST::firstToken() const
+int SwitchStatementAST::firstToken() const
{
if (switch_token)
return switch_token;
if (lparen_token)
return lparen_token;
if (condition)
- if (unsigned candidate = condition->firstToken())
+ if (int candidate = condition->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned SwitchStatementAST::lastToken() const
+int SwitchStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (condition)
- if (unsigned candidate = condition->lastToken())
+ if (int candidate = condition->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3660,7 +3660,7 @@ unsigned SwitchStatementAST::lastToken() const
}
/** \generated */
-unsigned TemplateDeclarationAST::firstToken() const
+int TemplateDeclarationAST::firstToken() const
{
if (export_token)
return export_token;
@@ -3669,26 +3669,26 @@ unsigned TemplateDeclarationAST::firstToken() const
if (less_token)
return less_token;
if (template_parameter_list)
- if (unsigned candidate = template_parameter_list->firstToken())
+ if (int candidate = template_parameter_list->firstToken())
return candidate;
if (greater_token)
return greater_token;
if (declaration)
- if (unsigned candidate = declaration->firstToken())
+ if (int candidate = declaration->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TemplateDeclarationAST::lastToken() const
+int TemplateDeclarationAST::lastToken() const
{
if (declaration)
- if (unsigned candidate = declaration->lastToken())
+ if (int candidate = declaration->lastToken())
return candidate;
if (greater_token)
return greater_token + 1;
if (template_parameter_list)
- if (unsigned candidate = template_parameter_list->lastToken())
+ if (int candidate = template_parameter_list->lastToken())
return candidate;
if (less_token)
return less_token + 1;
@@ -3700,7 +3700,7 @@ unsigned TemplateDeclarationAST::lastToken() const
}
/** \generated */
-unsigned TemplateIdAST::firstToken() const
+int TemplateIdAST::firstToken() const
{
if (template_token)
return template_token;
@@ -3709,7 +3709,7 @@ unsigned TemplateIdAST::firstToken() const
if (less_token)
return less_token;
if (template_argument_list)
- if (unsigned candidate = template_argument_list->firstToken())
+ if (int candidate = template_argument_list->firstToken())
return candidate;
if (greater_token)
return greater_token;
@@ -3717,12 +3717,12 @@ unsigned TemplateIdAST::firstToken() const
}
/** \generated */
-unsigned TemplateIdAST::lastToken() const
+int TemplateIdAST::lastToken() const
{
if (greater_token)
return greater_token + 1;
if (template_argument_list)
- if (unsigned candidate = template_argument_list->lastToken())
+ if (int candidate = template_argument_list->lastToken())
return candidate;
if (less_token)
return less_token + 1;
@@ -3734,14 +3734,14 @@ unsigned TemplateIdAST::lastToken() const
}
/** \generated */
-unsigned TemplateTypeParameterAST::firstToken() const
+int TemplateTypeParameterAST::firstToken() const
{
if (template_token)
return template_token;
if (less_token)
return less_token;
if (template_parameter_list)
- if (unsigned candidate = template_parameter_list->firstToken())
+ if (int candidate = template_parameter_list->firstToken())
return candidate;
if (greater_token)
return greater_token;
@@ -3750,26 +3750,26 @@ unsigned TemplateTypeParameterAST::firstToken() const
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TemplateTypeParameterAST::lastToken() const
+int TemplateTypeParameterAST::lastToken() const
{
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
@@ -3778,7 +3778,7 @@ unsigned TemplateTypeParameterAST::lastToken() const
if (greater_token)
return greater_token + 1;
if (template_parameter_list)
- if (unsigned candidate = template_parameter_list->lastToken())
+ if (int candidate = template_parameter_list->lastToken())
return candidate;
if (less_token)
return less_token + 1;
@@ -3788,7 +3788,7 @@ unsigned TemplateTypeParameterAST::lastToken() const
}
/** \generated */
-unsigned ThisExpressionAST::firstToken() const
+int ThisExpressionAST::firstToken() const
{
if (this_token)
return this_token;
@@ -3796,7 +3796,7 @@ unsigned ThisExpressionAST::firstToken() const
}
/** \generated */
-unsigned ThisExpressionAST::lastToken() const
+int ThisExpressionAST::lastToken() const
{
if (this_token)
return this_token + 1;
@@ -3804,21 +3804,21 @@ unsigned ThisExpressionAST::lastToken() const
}
/** \generated */
-unsigned ThrowExpressionAST::firstToken() const
+int ThrowExpressionAST::firstToken() const
{
if (throw_token)
return throw_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned ThrowExpressionAST::lastToken() const
+int ThrowExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (throw_token)
return throw_token + 1;
@@ -3826,33 +3826,33 @@ unsigned ThrowExpressionAST::lastToken() const
}
/** \generated */
-unsigned TrailingReturnTypeAST::firstToken() const
+int TrailingReturnTypeAST::firstToken() const
{
if (arrow_token)
return arrow_token;
if (attributes)
- if (unsigned candidate = attributes->firstToken())
+ if (int candidate = attributes->firstToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TrailingReturnTypeAST::lastToken() const
+int TrailingReturnTypeAST::lastToken() const
{
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (attributes)
- if (unsigned candidate = attributes->lastToken())
+ if (int candidate = attributes->lastToken())
return candidate;
if (arrow_token)
return arrow_token + 1;
@@ -3860,45 +3860,45 @@ unsigned TrailingReturnTypeAST::lastToken() const
}
/** \generated */
-unsigned TranslationUnitAST::firstToken() const
+int TranslationUnitAST::firstToken() const
{
if (declaration_list)
- if (unsigned candidate = declaration_list->firstToken())
+ if (int candidate = declaration_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TranslationUnitAST::lastToken() const
+int TranslationUnitAST::lastToken() const
{
if (declaration_list)
- if (unsigned candidate = declaration_list->lastToken())
+ if (int candidate = declaration_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned TryBlockStatementAST::firstToken() const
+int TryBlockStatementAST::firstToken() const
{
if (try_token)
return try_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
if (catch_clause_list)
- if (unsigned candidate = catch_clause_list->firstToken())
+ if (int candidate = catch_clause_list->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TryBlockStatementAST::lastToken() const
+int TryBlockStatementAST::lastToken() const
{
if (catch_clause_list)
- if (unsigned candidate = catch_clause_list->lastToken())
+ if (int candidate = catch_clause_list->lastToken())
return candidate;
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (try_token)
return try_token + 1;
@@ -3906,62 +3906,62 @@ unsigned TryBlockStatementAST::lastToken() const
}
/** \generated */
-unsigned TypeConstructorCallAST::firstToken() const
+int TypeConstructorCallAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TypeConstructorCallAST::lastToken() const
+int TypeConstructorCallAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned TypeIdAST::firstToken() const
+int TypeIdAST::firstToken() const
{
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TypeIdAST::lastToken() const
+int TypeIdAST::lastToken() const
{
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned TypeidExpressionAST::firstToken() const
+int TypeidExpressionAST::firstToken() const
{
if (typeid_token)
return typeid_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -3969,12 +3969,12 @@ unsigned TypeidExpressionAST::firstToken() const
}
/** \generated */
-unsigned TypeidExpressionAST::lastToken() const
+int TypeidExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -3984,27 +3984,27 @@ unsigned TypeidExpressionAST::lastToken() const
}
/** \generated */
-unsigned TypenameCallExpressionAST::firstToken() const
+int TypenameCallExpressionAST::firstToken() const
{
if (typename_token)
return typename_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TypenameCallExpressionAST::lastToken() const
+int TypenameCallExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (typename_token)
return typename_token + 1;
@@ -4012,33 +4012,33 @@ unsigned TypenameCallExpressionAST::lastToken() const
}
/** \generated */
-unsigned TypenameTypeParameterAST::firstToken() const
+int TypenameTypeParameterAST::firstToken() const
{
if (classkey_token)
return classkey_token;
if (dot_dot_dot_token)
return dot_dot_dot_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (type_id)
- if (unsigned candidate = type_id->firstToken())
+ if (int candidate = type_id->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned TypenameTypeParameterAST::lastToken() const
+int TypenameTypeParameterAST::lastToken() const
{
if (type_id)
- if (unsigned candidate = type_id->lastToken())
+ if (int candidate = type_id->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (dot_dot_dot_token)
return dot_dot_dot_token + 1;
@@ -4048,14 +4048,14 @@ unsigned TypenameTypeParameterAST::lastToken() const
}
/** \generated */
-unsigned TypeofSpecifierAST::firstToken() const
+int TypeofSpecifierAST::firstToken() const
{
if (typeof_token)
return typeof_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -4063,12 +4063,12 @@ unsigned TypeofSpecifierAST::firstToken() const
}
/** \generated */
-unsigned TypeofSpecifierAST::lastToken() const
+int TypeofSpecifierAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4078,21 +4078,21 @@ unsigned TypeofSpecifierAST::lastToken() const
}
/** \generated */
-unsigned UnaryExpressionAST::firstToken() const
+int UnaryExpressionAST::firstToken() const
{
if (unary_op_token)
return unary_op_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned UnaryExpressionAST::lastToken() const
+int UnaryExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (unary_op_token)
return unary_op_token + 1;
@@ -4100,14 +4100,14 @@ unsigned UnaryExpressionAST::lastToken() const
}
/** \generated */
-unsigned UsingAST::firstToken() const
+int UsingAST::firstToken() const
{
if (using_token)
return using_token;
if (typename_token)
return typename_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -4115,12 +4115,12 @@ unsigned UsingAST::firstToken() const
}
/** \generated */
-unsigned UsingAST::lastToken() const
+int UsingAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (typename_token)
return typename_token + 1;
@@ -4130,14 +4130,14 @@ unsigned UsingAST::lastToken() const
}
/** \generated */
-unsigned UsingDirectiveAST::firstToken() const
+int UsingDirectiveAST::firstToken() const
{
if (using_token)
return using_token;
if (namespace_token)
return namespace_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -4145,12 +4145,12 @@ unsigned UsingDirectiveAST::firstToken() const
}
/** \generated */
-unsigned UsingDirectiveAST::lastToken() const
+int UsingDirectiveAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (namespace_token)
return namespace_token + 1;
@@ -4160,33 +4160,33 @@ unsigned UsingDirectiveAST::lastToken() const
}
/** \generated */
-unsigned WhileStatementAST::firstToken() const
+int WhileStatementAST::firstToken() const
{
if (while_token)
return while_token;
if (lparen_token)
return lparen_token;
if (condition)
- if (unsigned candidate = condition->firstToken())
+ if (int candidate = condition->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned WhileStatementAST::lastToken() const
+int WhileStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (condition)
- if (unsigned candidate = condition->lastToken())
+ if (int candidate = condition->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4196,14 +4196,14 @@ unsigned WhileStatementAST::lastToken() const
}
/** \generated */
-unsigned GnuAttributeSpecifierAST::lastToken() const
+int GnuAttributeSpecifierAST::lastToken() const
{
if (second_rparen_token)
return second_rparen_token + 1;
if (first_rparen_token)
return first_rparen_token + 1;
if (attribute_list)
- if (unsigned candidate = attribute_list->lastToken())
+ if (int candidate = attribute_list->lastToken())
return candidate;
if (second_lparen_token)
return second_lparen_token + 1;
@@ -4215,7 +4215,7 @@ unsigned GnuAttributeSpecifierAST::lastToken() const
}
/** \generated */
-unsigned PointerLiteralAST::firstToken() const
+int PointerLiteralAST::firstToken() const
{
if (literal_token)
return literal_token;
@@ -4223,7 +4223,7 @@ unsigned PointerLiteralAST::firstToken() const
}
/** \generated */
-unsigned PointerLiteralAST::lastToken() const
+int PointerLiteralAST::lastToken() const
{
if (literal_token)
return literal_token + 1;
@@ -4231,14 +4231,14 @@ unsigned PointerLiteralAST::lastToken() const
}
/** \generated */
-unsigned NoExceptSpecificationAST::firstToken() const
+int NoExceptSpecificationAST::firstToken() const
{
if (noexcept_token)
return noexcept_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -4246,12 +4246,12 @@ unsigned NoExceptSpecificationAST::firstToken() const
}
/** \generated */
-unsigned NoExceptSpecificationAST::lastToken() const
+int NoExceptSpecificationAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4261,19 +4261,19 @@ unsigned NoExceptSpecificationAST::lastToken() const
}
/** \generated */
-unsigned StaticAssertDeclarationAST::firstToken() const
+int StaticAssertDeclarationAST::firstToken() const
{
if (static_assert_token)
return static_assert_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (comma_token)
return comma_token;
if (string_literal)
- if (unsigned candidate = string_literal->firstToken())
+ if (int candidate = string_literal->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -4283,19 +4283,19 @@ unsigned StaticAssertDeclarationAST::firstToken() const
}
/** \generated */
-unsigned StaticAssertDeclarationAST::lastToken() const
+int StaticAssertDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (rparen_token)
return rparen_token + 1;
if (string_literal)
- if (unsigned candidate = string_literal->lastToken())
+ if (int candidate = string_literal->lastToken())
return candidate;
if (comma_token)
return comma_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4305,14 +4305,14 @@ unsigned StaticAssertDeclarationAST::lastToken() const
}
/** \generated */
-unsigned DecltypeSpecifierAST::firstToken() const
+int DecltypeSpecifierAST::firstToken() const
{
if (decltype_token)
return decltype_token;
if (lparen_token)
return lparen_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -4320,12 +4320,12 @@ unsigned DecltypeSpecifierAST::firstToken() const
}
/** \generated */
-unsigned DecltypeSpecifierAST::lastToken() const
+int DecltypeSpecifierAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4335,49 +4335,49 @@ unsigned DecltypeSpecifierAST::lastToken() const
}
/** \generated */
-unsigned RangeBasedForStatementAST::firstToken() const
+int RangeBasedForStatementAST::firstToken() const
{
if (for_token)
return for_token;
if (lparen_token)
return lparen_token;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->firstToken())
+ if (int candidate = type_specifier_list->firstToken())
return candidate;
if (declarator)
- if (unsigned candidate = declarator->firstToken())
+ if (int candidate = declarator->firstToken())
return candidate;
if (colon_token)
return colon_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
if (statement)
- if (unsigned candidate = statement->firstToken())
+ if (int candidate = statement->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned RangeBasedForStatementAST::lastToken() const
+int RangeBasedForStatementAST::lastToken() const
{
if (statement)
- if (unsigned candidate = statement->lastToken())
+ if (int candidate = statement->lastToken())
return candidate;
if (rparen_token)
return rparen_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (colon_token)
return colon_token + 1;
if (declarator)
- if (unsigned candidate = declarator->lastToken())
+ if (int candidate = declarator->lastToken())
return candidate;
if (type_specifier_list)
- if (unsigned candidate = type_specifier_list->lastToken())
+ if (int candidate = type_specifier_list->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4387,14 +4387,14 @@ unsigned RangeBasedForStatementAST::lastToken() const
}
/** \generated */
-unsigned AlignofExpressionAST::firstToken() const
+int AlignofExpressionAST::firstToken() const
{
if (alignof_token)
return alignof_token;
if (lparen_token)
return lparen_token;
if (typeId)
- if (unsigned candidate = typeId->firstToken())
+ if (int candidate = typeId->firstToken())
return candidate;
if (rparen_token)
return rparen_token;
@@ -4402,12 +4402,12 @@ unsigned AlignofExpressionAST::firstToken() const
}
/** \generated */
-unsigned AlignofExpressionAST::lastToken() const
+int AlignofExpressionAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (typeId)
- if (unsigned candidate = typeId->lastToken())
+ if (int candidate = typeId->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4417,17 +4417,17 @@ unsigned AlignofExpressionAST::lastToken() const
}
/** \generated */
-unsigned AliasDeclarationAST::firstToken() const
+int AliasDeclarationAST::firstToken() const
{
if (using_token)
return using_token;
if (name)
- if (unsigned candidate = name->firstToken())
+ if (int candidate = name->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (typeId)
- if (unsigned candidate = typeId->firstToken())
+ if (int candidate = typeId->firstToken())
return candidate;
if (semicolon_token)
return semicolon_token;
@@ -4435,17 +4435,17 @@ unsigned AliasDeclarationAST::firstToken() const
}
/** \generated */
-unsigned AliasDeclarationAST::lastToken() const
+int AliasDeclarationAST::lastToken() const
{
if (semicolon_token)
return semicolon_token + 1;
if (typeId)
- if (unsigned candidate = typeId->lastToken())
+ if (int candidate = typeId->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (name)
- if (unsigned candidate = name->lastToken())
+ if (int candidate = name->lastToken())
return candidate;
if (using_token)
return using_token + 1;
@@ -4453,40 +4453,40 @@ unsigned AliasDeclarationAST::lastToken() const
}
/** \generated */
-unsigned DesignatedInitializerAST::firstToken() const
+int DesignatedInitializerAST::firstToken() const
{
if (designator_list)
- if (unsigned candidate = designator_list->firstToken())
+ if (int candidate = designator_list->firstToken())
return candidate;
if (equal_token)
return equal_token;
if (initializer)
- if (unsigned candidate = initializer->firstToken())
+ if (int candidate = initializer->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned DesignatedInitializerAST::lastToken() const
+int DesignatedInitializerAST::lastToken() const
{
if (initializer)
- if (unsigned candidate = initializer->lastToken())
+ if (int candidate = initializer->lastToken())
return candidate;
if (equal_token)
return equal_token + 1;
if (designator_list)
- if (unsigned candidate = designator_list->lastToken())
+ if (int candidate = designator_list->lastToken())
return candidate;
return 1;
}
/** \generated */
-unsigned BracketDesignatorAST::firstToken() const
+int BracketDesignatorAST::firstToken() const
{
if (lbracket_token)
return lbracket_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
if (rbracket_token)
return rbracket_token;
@@ -4494,12 +4494,12 @@ unsigned BracketDesignatorAST::firstToken() const
}
/** \generated */
-unsigned BracketDesignatorAST::lastToken() const
+int BracketDesignatorAST::lastToken() const
{
if (rbracket_token)
return rbracket_token + 1;
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (lbracket_token)
return lbracket_token + 1;
@@ -4507,7 +4507,7 @@ unsigned BracketDesignatorAST::lastToken() const
}
/** \generated */
-unsigned DotDesignatorAST::firstToken() const
+int DotDesignatorAST::firstToken() const
{
if (dot_token)
return dot_token;
@@ -4517,7 +4517,7 @@ unsigned DotDesignatorAST::firstToken() const
}
/** \generated */
-unsigned DotDesignatorAST::lastToken() const
+int DotDesignatorAST::lastToken() const
{
if (identifier_token)
return identifier_token + 1;
@@ -4527,14 +4527,14 @@ unsigned DotDesignatorAST::lastToken() const
}
/** \generated */
-unsigned AlignmentSpecifierAST::firstToken() const
+int AlignmentSpecifierAST::firstToken() const
{
if (align_token)
return align_token;
if (lparen_token)
return lparen_token;
if (typeIdExprOrAlignmentExpr)
- if (unsigned candidate = typeIdExprOrAlignmentExpr->firstToken())
+ if (int candidate = typeIdExprOrAlignmentExpr->firstToken())
return candidate;
if (ellipses_token)
return ellipses_token;
@@ -4544,14 +4544,14 @@ unsigned AlignmentSpecifierAST::firstToken() const
}
/** \generated */
-unsigned AlignmentSpecifierAST::lastToken() const
+int AlignmentSpecifierAST::lastToken() const
{
if (rparen_token)
return rparen_token + 1;
if (ellipses_token)
return ellipses_token + 1;
if (typeIdExprOrAlignmentExpr)
- if (unsigned candidate = typeIdExprOrAlignmentExpr->lastToken())
+ if (int candidate = typeIdExprOrAlignmentExpr->lastToken())
return candidate;
if (lparen_token)
return lparen_token + 1;
@@ -4561,21 +4561,21 @@ unsigned AlignmentSpecifierAST::lastToken() const
}
/** \generated */
-unsigned NoExceptOperatorExpressionAST::firstToken() const
+int NoExceptOperatorExpressionAST::firstToken() const
{
if (noexcept_token)
return noexcept_token;
if (expression)
- if (unsigned candidate = expression->firstToken())
+ if (int candidate = expression->firstToken())
return candidate;
return 0;
}
/** \generated */
-unsigned NoExceptOperatorExpressionAST::lastToken() const
+int NoExceptOperatorExpressionAST::lastToken() const
{
if (expression)
- if (unsigned candidate = expression->lastToken())
+ if (int candidate = expression->lastToken())
return candidate;
if (noexcept_token)
return noexcept_token + 1;
diff --git a/src/libs/3rdparty/cplusplus/AST.h b/src/libs/3rdparty/cplusplus/AST.h
index fc6750320b..dbc79f37e0 100644
--- a/src/libs/3rdparty/cplusplus/AST.h
+++ b/src/libs/3rdparty/cplusplus/AST.h
@@ -41,7 +41,7 @@ public:
: value(value), next(0)
{ }
- unsigned firstToken() const
+ int firstToken() const
{
if (value)
return value->firstToken();
@@ -50,7 +50,7 @@ public:
return 0;
}
- unsigned lastToken() const
+ int lastToken() const
{
Tptr lv = lastValue();
@@ -118,173 +118,173 @@ public:
return false;
}
- virtual unsigned firstToken() const = 0;
- virtual unsigned lastToken() const = 0;
+ virtual int firstToken() const = 0;
+ virtual int lastToken() const = 0;
virtual AST *clone(MemoryPool *pool) const = 0;
- virtual AccessDeclarationAST *asAccessDeclaration() { return 0; }
- virtual AliasDeclarationAST *asAliasDeclaration() { return 0; }
- virtual AlignmentSpecifierAST *asAlignmentSpecifier() { return 0; }
- virtual AlignofExpressionAST *asAlignofExpression() { return 0; }
- virtual AnonymousNameAST *asAnonymousName() { return 0; }
- virtual ArrayAccessAST *asArrayAccess() { return 0; }
- virtual ArrayDeclaratorAST *asArrayDeclarator() { return 0; }
- virtual ArrayInitializerAST *asArrayInitializer() { return 0; }
- virtual AsmDefinitionAST *asAsmDefinition() { return 0; }
- virtual AttributeSpecifierAST *asAttributeSpecifier() { return 0; }
- virtual BaseSpecifierAST *asBaseSpecifier() { return 0; }
- virtual BinaryExpressionAST *asBinaryExpression() { return 0; }
- virtual BoolLiteralAST *asBoolLiteral() { return 0; }
- virtual BracedInitializerAST *asBracedInitializer() { return 0; }
- virtual BracketDesignatorAST *asBracketDesignator() { return 0; }
- virtual BreakStatementAST *asBreakStatement() { return 0; }
- virtual CallAST *asCall() { return 0; }
- virtual CaptureAST *asCapture() { return 0; }
- virtual CaseStatementAST *asCaseStatement() { return 0; }
- virtual CastExpressionAST *asCastExpression() { return 0; }
- virtual CatchClauseAST *asCatchClause() { return 0; }
- virtual ClassSpecifierAST *asClassSpecifier() { return 0; }
- virtual CompoundExpressionAST *asCompoundExpression() { return 0; }
- virtual CompoundLiteralAST *asCompoundLiteral() { return 0; }
- virtual CompoundStatementAST *asCompoundStatement() { return 0; }
- virtual ConditionAST *asCondition() { return 0; }
- virtual ConditionalExpressionAST *asConditionalExpression() { return 0; }
- virtual ContinueStatementAST *asContinueStatement() { return 0; }
- virtual ConversionFunctionIdAST *asConversionFunctionId() { return 0; }
- virtual CoreDeclaratorAST *asCoreDeclarator() { return 0; }
- virtual CppCastExpressionAST *asCppCastExpression() { return 0; }
- virtual CtorInitializerAST *asCtorInitializer() { return 0; }
- virtual DeclarationAST *asDeclaration() { return 0; }
- virtual DeclarationStatementAST *asDeclarationStatement() { return 0; }
- virtual DeclaratorAST *asDeclarator() { return 0; }
- virtual DeclaratorIdAST *asDeclaratorId() { return 0; }
- virtual DecltypeSpecifierAST *asDecltypeSpecifier() { return 0; }
- virtual DeleteExpressionAST *asDeleteExpression() { return 0; }
- virtual DesignatedInitializerAST *asDesignatedInitializer() { return 0; }
- virtual DesignatorAST *asDesignator() { return 0; }
- virtual DestructorNameAST *asDestructorName() { return 0; }
- virtual DoStatementAST *asDoStatement() { return 0; }
- virtual DotDesignatorAST *asDotDesignator() { return 0; }
- virtual DynamicExceptionSpecificationAST *asDynamicExceptionSpecification() { return 0; }
- virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() { return 0; }
- virtual EmptyDeclarationAST *asEmptyDeclaration() { return 0; }
- virtual EnumSpecifierAST *asEnumSpecifier() { return 0; }
- virtual EnumeratorAST *asEnumerator() { return 0; }
- virtual ExceptionDeclarationAST *asExceptionDeclaration() { return 0; }
- virtual ExceptionSpecificationAST *asExceptionSpecification() { return 0; }
- virtual ExpressionAST *asExpression() { return 0; }
- virtual ExpressionListParenAST *asExpressionListParen() { return 0; }
- virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return 0; }
- virtual ExpressionStatementAST *asExpressionStatement() { return 0; }
- virtual ForStatementAST *asForStatement() { return 0; }
- virtual ForeachStatementAST *asForeachStatement() { return 0; }
- virtual FunctionDeclaratorAST *asFunctionDeclarator() { return 0; }
- virtual FunctionDefinitionAST *asFunctionDefinition() { return 0; }
- virtual GnuAttributeAST *asGnuAttribute() { return 0; }
- virtual GnuAttributeSpecifierAST *asGnuAttributeSpecifier() { return 0; }
- virtual GotoStatementAST *asGotoStatement() { return 0; }
- virtual IdExpressionAST *asIdExpression() { return 0; }
- virtual IfStatementAST *asIfStatement() { return 0; }
- virtual LabeledStatementAST *asLabeledStatement() { return 0; }
- virtual LambdaCaptureAST *asLambdaCapture() { return 0; }
- virtual LambdaDeclaratorAST *asLambdaDeclarator() { return 0; }
- virtual LambdaExpressionAST *asLambdaExpression() { return 0; }
- virtual LambdaIntroducerAST *asLambdaIntroducer() { return 0; }
- virtual LinkageBodyAST *asLinkageBody() { return 0; }
- virtual LinkageSpecificationAST *asLinkageSpecification() { return 0; }
- virtual MemInitializerAST *asMemInitializer() { return 0; }
- virtual MemberAccessAST *asMemberAccess() { return 0; }
- virtual NameAST *asName() { return 0; }
- virtual NamedTypeSpecifierAST *asNamedTypeSpecifier() { return 0; }
- virtual NamespaceAST *asNamespace() { return 0; }
- virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() { return 0; }
- virtual NestedDeclaratorAST *asNestedDeclarator() { return 0; }
- virtual NestedExpressionAST *asNestedExpression() { return 0; }
- virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return 0; }
- virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
- virtual NewExpressionAST *asNewExpression() { return 0; }
- virtual NewTypeIdAST *asNewTypeId() { return 0; }
- virtual NoExceptOperatorExpressionAST *asNoExceptOperatorExpression() { return 0; }
- virtual NoExceptSpecificationAST *asNoExceptSpecification() { return 0; }
- virtual NumericLiteralAST *asNumericLiteral() { return 0; }
- virtual ObjCClassDeclarationAST *asObjCClassDeclaration() { return 0; }
- virtual ObjCClassForwardDeclarationAST *asObjCClassForwardDeclaration() { return 0; }
- virtual ObjCDynamicPropertiesDeclarationAST *asObjCDynamicPropertiesDeclaration() { return 0; }
- virtual ObjCEncodeExpressionAST *asObjCEncodeExpression() { return 0; }
- virtual ObjCFastEnumerationAST *asObjCFastEnumeration() { return 0; }
- virtual ObjCInstanceVariablesDeclarationAST *asObjCInstanceVariablesDeclaration() { return 0; }
- virtual ObjCMessageArgumentAST *asObjCMessageArgument() { return 0; }
- virtual ObjCMessageArgumentDeclarationAST *asObjCMessageArgumentDeclaration() { return 0; }
- virtual ObjCMessageExpressionAST *asObjCMessageExpression() { return 0; }
- virtual ObjCMethodDeclarationAST *asObjCMethodDeclaration() { return 0; }
- virtual ObjCMethodPrototypeAST *asObjCMethodPrototype() { return 0; }
- virtual ObjCPropertyAttributeAST *asObjCPropertyAttribute() { return 0; }
- virtual ObjCPropertyDeclarationAST *asObjCPropertyDeclaration() { return 0; }
- virtual ObjCProtocolDeclarationAST *asObjCProtocolDeclaration() { return 0; }
- virtual ObjCProtocolExpressionAST *asObjCProtocolExpression() { return 0; }
- virtual ObjCProtocolForwardDeclarationAST *asObjCProtocolForwardDeclaration() { return 0; }
- virtual ObjCProtocolRefsAST *asObjCProtocolRefs() { return 0; }
- virtual ObjCSelectorAST *asObjCSelector() { return 0; }
- virtual ObjCSelectorArgumentAST *asObjCSelectorArgument() { return 0; }
- virtual ObjCSelectorExpressionAST *asObjCSelectorExpression() { return 0; }
- virtual ObjCSynchronizedStatementAST *asObjCSynchronizedStatement() { return 0; }
- virtual ObjCSynthesizedPropertiesDeclarationAST *asObjCSynthesizedPropertiesDeclaration() { return 0; }
- virtual ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() { return 0; }
- virtual ObjCTypeNameAST *asObjCTypeName() { return 0; }
- virtual ObjCVisibilityDeclarationAST *asObjCVisibilityDeclaration() { return 0; }
- virtual OperatorAST *asOperator() { return 0; }
- virtual OperatorFunctionIdAST *asOperatorFunctionId() { return 0; }
- virtual ParameterDeclarationAST *asParameterDeclaration() { return 0; }
- virtual ParameterDeclarationClauseAST *asParameterDeclarationClause() { return 0; }
- virtual PointerAST *asPointer() { return 0; }
- virtual PointerLiteralAST *asPointerLiteral() { return 0; }
- virtual PointerToMemberAST *asPointerToMember() { return 0; }
- virtual PostIncrDecrAST *asPostIncrDecr() { return 0; }
- virtual PostfixAST *asPostfix() { return 0; }
- virtual PostfixDeclaratorAST *asPostfixDeclarator() { return 0; }
- virtual PtrOperatorAST *asPtrOperator() { return 0; }
- virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return 0; }
- virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return 0; }
- virtual QtInterfaceNameAST *asQtInterfaceName() { return 0; }
- virtual QtInterfacesDeclarationAST *asQtInterfacesDeclaration() { return 0; }
- virtual QtMemberDeclarationAST *asQtMemberDeclaration() { return 0; }
- virtual QtMethodAST *asQtMethod() { return 0; }
- virtual QtObjectTagAST *asQtObjectTag() { return 0; }
- virtual QtPrivateSlotAST *asQtPrivateSlot() { return 0; }
- virtual QtPropertyDeclarationAST *asQtPropertyDeclaration() { return 0; }
- virtual QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() { return 0; }
- virtual QualifiedNameAST *asQualifiedName() { return 0; }
- virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return 0; }
- virtual ReferenceAST *asReference() { return 0; }
- virtual ReturnStatementAST *asReturnStatement() { return 0; }
- virtual SimpleDeclarationAST *asSimpleDeclaration() { return 0; }
- virtual SimpleNameAST *asSimpleName() { return 0; }
- virtual SimpleSpecifierAST *asSimpleSpecifier() { return 0; }
- virtual SizeofExpressionAST *asSizeofExpression() { return 0; }
- virtual SpecifierAST *asSpecifier() { return 0; }
- virtual StatementAST *asStatement() { return 0; }
- virtual StaticAssertDeclarationAST *asStaticAssertDeclaration() { return 0; }
- virtual StringLiteralAST *asStringLiteral() { return 0; }
- virtual SwitchStatementAST *asSwitchStatement() { return 0; }
- virtual TemplateDeclarationAST *asTemplateDeclaration() { return 0; }
- virtual TemplateIdAST *asTemplateId() { return 0; }
- virtual TemplateTypeParameterAST *asTemplateTypeParameter() { return 0; }
- virtual ThisExpressionAST *asThisExpression() { return 0; }
- virtual ThrowExpressionAST *asThrowExpression() { return 0; }
- virtual TrailingReturnTypeAST *asTrailingReturnType() { return 0; }
- virtual TranslationUnitAST *asTranslationUnit() { return 0; }
- virtual TryBlockStatementAST *asTryBlockStatement() { return 0; }
- virtual TypeConstructorCallAST *asTypeConstructorCall() { return 0; }
- virtual TypeIdAST *asTypeId() { return 0; }
- virtual TypeidExpressionAST *asTypeidExpression() { return 0; }
- virtual TypenameCallExpressionAST *asTypenameCallExpression() { return 0; }
- virtual TypenameTypeParameterAST *asTypenameTypeParameter() { return 0; }
- virtual TypeofSpecifierAST *asTypeofSpecifier() { return 0; }
- virtual UnaryExpressionAST *asUnaryExpression() { return 0; }
- virtual UsingAST *asUsing() { return 0; }
- virtual UsingDirectiveAST *asUsingDirective() { return 0; }
- virtual WhileStatementAST *asWhileStatement() { return 0; }
+ virtual AccessDeclarationAST *asAccessDeclaration() { return nullptr; }
+ virtual AliasDeclarationAST *asAliasDeclaration() { return nullptr; }
+ virtual AlignmentSpecifierAST *asAlignmentSpecifier() { return nullptr; }
+ virtual AlignofExpressionAST *asAlignofExpression() { return nullptr; }
+ virtual AnonymousNameAST *asAnonymousName() { return nullptr; }
+ virtual ArrayAccessAST *asArrayAccess() { return nullptr; }
+ virtual ArrayDeclaratorAST *asArrayDeclarator() { return nullptr; }
+ virtual ArrayInitializerAST *asArrayInitializer() { return nullptr; }
+ virtual AsmDefinitionAST *asAsmDefinition() { return nullptr; }
+ virtual AttributeSpecifierAST *asAttributeSpecifier() { return nullptr; }
+ virtual BaseSpecifierAST *asBaseSpecifier() { return nullptr; }
+ virtual BinaryExpressionAST *asBinaryExpression() { return nullptr; }
+ virtual BoolLiteralAST *asBoolLiteral() { return nullptr; }
+ virtual BracedInitializerAST *asBracedInitializer() { return nullptr; }
+ virtual BracketDesignatorAST *asBracketDesignator() { return nullptr; }
+ virtual BreakStatementAST *asBreakStatement() { return nullptr; }
+ virtual CallAST *asCall() { return nullptr; }
+ virtual CaptureAST *asCapture() { return nullptr; }
+ virtual CaseStatementAST *asCaseStatement() { return nullptr; }
+ virtual CastExpressionAST *asCastExpression() { return nullptr; }
+ virtual CatchClauseAST *asCatchClause() { return nullptr; }
+ virtual ClassSpecifierAST *asClassSpecifier() { return nullptr; }
+ virtual CompoundExpressionAST *asCompoundExpression() { return nullptr; }
+ virtual CompoundLiteralAST *asCompoundLiteral() { return nullptr; }
+ virtual CompoundStatementAST *asCompoundStatement() { return nullptr; }
+ virtual ConditionAST *asCondition() { return nullptr; }
+ virtual ConditionalExpressionAST *asConditionalExpression() { return nullptr; }
+ virtual ContinueStatementAST *asContinueStatement() { return nullptr; }
+ virtual ConversionFunctionIdAST *asConversionFunctionId() { return nullptr; }
+ virtual CoreDeclaratorAST *asCoreDeclarator() { return nullptr; }
+ virtual CppCastExpressionAST *asCppCastExpression() { return nullptr; }
+ virtual CtorInitializerAST *asCtorInitializer() { return nullptr; }
+ virtual DeclarationAST *asDeclaration() { return nullptr; }
+ virtual DeclarationStatementAST *asDeclarationStatement() { return nullptr; }
+ virtual DeclaratorAST *asDeclarator() { return nullptr; }
+ virtual DeclaratorIdAST *asDeclaratorId() { return nullptr; }
+ virtual DecltypeSpecifierAST *asDecltypeSpecifier() { return nullptr; }
+ virtual DeleteExpressionAST *asDeleteExpression() { return nullptr; }
+ virtual DesignatedInitializerAST *asDesignatedInitializer() { return nullptr; }
+ virtual DesignatorAST *asDesignator() { return nullptr; }
+ virtual DestructorNameAST *asDestructorName() { return nullptr; }
+ virtual DoStatementAST *asDoStatement() { return nullptr; }
+ virtual DotDesignatorAST *asDotDesignator() { return nullptr; }
+ virtual DynamicExceptionSpecificationAST *asDynamicExceptionSpecification() { return nullptr; }
+ virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() { return nullptr; }
+ virtual EmptyDeclarationAST *asEmptyDeclaration() { return nullptr; }
+ virtual EnumSpecifierAST *asEnumSpecifier() { return nullptr; }
+ virtual EnumeratorAST *asEnumerator() { return nullptr; }
+ virtual ExceptionDeclarationAST *asExceptionDeclaration() { return nullptr; }
+ virtual ExceptionSpecificationAST *asExceptionSpecification() { return nullptr; }
+ virtual ExpressionAST *asExpression() { return nullptr; }
+ virtual ExpressionListParenAST *asExpressionListParen() { return nullptr; }
+ virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return nullptr; }
+ virtual ExpressionStatementAST *asExpressionStatement() { return nullptr; }
+ virtual ForStatementAST *asForStatement() { return nullptr; }
+ virtual ForeachStatementAST *asForeachStatement() { return nullptr; }
+ virtual FunctionDeclaratorAST *asFunctionDeclarator() { return nullptr; }
+ virtual FunctionDefinitionAST *asFunctionDefinition() { return nullptr; }
+ virtual GnuAttributeAST *asGnuAttribute() { return nullptr; }
+ virtual GnuAttributeSpecifierAST *asGnuAttributeSpecifier() { return nullptr; }
+ virtual GotoStatementAST *asGotoStatement() { return nullptr; }
+ virtual IdExpressionAST *asIdExpression() { return nullptr; }
+ virtual IfStatementAST *asIfStatement() { return nullptr; }
+ virtual LabeledStatementAST *asLabeledStatement() { return nullptr; }
+ virtual LambdaCaptureAST *asLambdaCapture() { return nullptr; }
+ virtual LambdaDeclaratorAST *asLambdaDeclarator() { return nullptr; }
+ virtual LambdaExpressionAST *asLambdaExpression() { return nullptr; }
+ virtual LambdaIntroducerAST *asLambdaIntroducer() { return nullptr; }
+ virtual LinkageBodyAST *asLinkageBody() { return nullptr; }
+ virtual LinkageSpecificationAST *asLinkageSpecification() { return nullptr; }
+ virtual MemInitializerAST *asMemInitializer() { return nullptr; }
+ virtual MemberAccessAST *asMemberAccess() { return nullptr; }
+ virtual NameAST *asName() { return nullptr; }
+ virtual NamedTypeSpecifierAST *asNamedTypeSpecifier() { return nullptr; }
+ virtual NamespaceAST *asNamespace() { return nullptr; }
+ virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() { return nullptr; }
+ virtual NestedDeclaratorAST *asNestedDeclarator() { return nullptr; }
+ virtual NestedExpressionAST *asNestedExpression() { return nullptr; }
+ virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return nullptr; }
+ virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return nullptr; }
+ virtual NewExpressionAST *asNewExpression() { return nullptr; }
+ virtual NewTypeIdAST *asNewTypeId() { return nullptr; }
+ virtual NoExceptOperatorExpressionAST *asNoExceptOperatorExpression() { return nullptr; }
+ virtual NoExceptSpecificationAST *asNoExceptSpecification() { return nullptr; }
+ virtual NumericLiteralAST *asNumericLiteral() { return nullptr; }
+ virtual ObjCClassDeclarationAST *asObjCClassDeclaration() { return nullptr; }
+ virtual ObjCClassForwardDeclarationAST *asObjCClassForwardDeclaration() { return nullptr; }
+ virtual ObjCDynamicPropertiesDeclarationAST *asObjCDynamicPropertiesDeclaration() { return nullptr; }
+ virtual ObjCEncodeExpressionAST *asObjCEncodeExpression() { return nullptr; }
+ virtual ObjCFastEnumerationAST *asObjCFastEnumeration() { return nullptr; }
+ virtual ObjCInstanceVariablesDeclarationAST *asObjCInstanceVariablesDeclaration() { return nullptr; }
+ virtual ObjCMessageArgumentAST *asObjCMessageArgument() { return nullptr; }
+ virtual ObjCMessageArgumentDeclarationAST *asObjCMessageArgumentDeclaration() { return nullptr; }
+ virtual ObjCMessageExpressionAST *asObjCMessageExpression() { return nullptr; }
+ virtual ObjCMethodDeclarationAST *asObjCMethodDeclaration() { return nullptr; }
+ virtual ObjCMethodPrototypeAST *asObjCMethodPrototype() { return nullptr; }
+ virtual ObjCPropertyAttributeAST *asObjCPropertyAttribute() { return nullptr; }
+ virtual ObjCPropertyDeclarationAST *asObjCPropertyDeclaration() { return nullptr; }
+ virtual ObjCProtocolDeclarationAST *asObjCProtocolDeclaration() { return nullptr; }
+ virtual ObjCProtocolExpressionAST *asObjCProtocolExpression() { return nullptr; }
+ virtual ObjCProtocolForwardDeclarationAST *asObjCProtocolForwardDeclaration() { return nullptr; }
+ virtual ObjCProtocolRefsAST *asObjCProtocolRefs() { return nullptr; }
+ virtual ObjCSelectorAST *asObjCSelector() { return nullptr; }
+ virtual ObjCSelectorArgumentAST *asObjCSelectorArgument() { return nullptr; }
+ virtual ObjCSelectorExpressionAST *asObjCSelectorExpression() { return nullptr; }
+ virtual ObjCSynchronizedStatementAST *asObjCSynchronizedStatement() { return nullptr; }
+ virtual ObjCSynthesizedPropertiesDeclarationAST *asObjCSynthesizedPropertiesDeclaration() { return nullptr; }
+ virtual ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() { return nullptr; }
+ virtual ObjCTypeNameAST *asObjCTypeName() { return nullptr; }
+ virtual ObjCVisibilityDeclarationAST *asObjCVisibilityDeclaration() { return nullptr; }
+ virtual OperatorAST *asOperator() { return nullptr; }
+ virtual OperatorFunctionIdAST *asOperatorFunctionId() { return nullptr; }
+ virtual ParameterDeclarationAST *asParameterDeclaration() { return nullptr; }
+ virtual ParameterDeclarationClauseAST *asParameterDeclarationClause() { return nullptr; }
+ virtual PointerAST *asPointer() { return nullptr; }
+ virtual PointerLiteralAST *asPointerLiteral() { return nullptr; }
+ virtual PointerToMemberAST *asPointerToMember() { return nullptr; }
+ virtual PostIncrDecrAST *asPostIncrDecr() { return nullptr; }
+ virtual PostfixAST *asPostfix() { return nullptr; }
+ virtual PostfixDeclaratorAST *asPostfixDeclarator() { return nullptr; }
+ virtual PtrOperatorAST *asPtrOperator() { return nullptr; }
+ virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return nullptr; }
+ virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return nullptr; }
+ virtual QtInterfaceNameAST *asQtInterfaceName() { return nullptr; }
+ virtual QtInterfacesDeclarationAST *asQtInterfacesDeclaration() { return nullptr; }
+ virtual QtMemberDeclarationAST *asQtMemberDeclaration() { return nullptr; }
+ virtual QtMethodAST *asQtMethod() { return nullptr; }
+ virtual QtObjectTagAST *asQtObjectTag() { return nullptr; }
+ virtual QtPrivateSlotAST *asQtPrivateSlot() { return nullptr; }
+ virtual QtPropertyDeclarationAST *asQtPropertyDeclaration() { return nullptr; }
+ virtual QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() { return nullptr; }
+ virtual QualifiedNameAST *asQualifiedName() { return nullptr; }
+ virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return nullptr; }
+ virtual ReferenceAST *asReference() { return nullptr; }
+ virtual ReturnStatementAST *asReturnStatement() { return nullptr; }
+ virtual SimpleDeclarationAST *asSimpleDeclaration() { return nullptr; }
+ virtual SimpleNameAST *asSimpleName() { return nullptr; }
+ virtual SimpleSpecifierAST *asSimpleSpecifier() { return nullptr; }
+ virtual SizeofExpressionAST *asSizeofExpression() { return nullptr; }
+ virtual SpecifierAST *asSpecifier() { return nullptr; }
+ virtual StatementAST *asStatement() { return nullptr; }
+ virtual StaticAssertDeclarationAST *asStaticAssertDeclaration() { return nullptr; }
+ virtual StringLiteralAST *asStringLiteral() { return nullptr; }
+ virtual SwitchStatementAST *asSwitchStatement() { return nullptr; }
+ virtual TemplateDeclarationAST *asTemplateDeclaration() { return nullptr; }
+ virtual TemplateIdAST *asTemplateId() { return nullptr; }
+ virtual TemplateTypeParameterAST *asTemplateTypeParameter() { return nullptr; }
+ virtual ThisExpressionAST *asThisExpression() { return nullptr; }
+ virtual ThrowExpressionAST *asThrowExpression() { return nullptr; }
+ virtual TrailingReturnTypeAST *asTrailingReturnType() { return nullptr; }
+ virtual TranslationUnitAST *asTranslationUnit() { return nullptr; }
+ virtual TryBlockStatementAST *asTryBlockStatement() { return nullptr; }
+ virtual TypeConstructorCallAST *asTypeConstructorCall() { return nullptr; }
+ virtual TypeIdAST *asTypeId() { return nullptr; }
+ virtual TypeidExpressionAST *asTypeidExpression() { return nullptr; }
+ virtual TypenameCallExpressionAST *asTypenameCallExpression() { return nullptr; }
+ virtual TypenameTypeParameterAST *asTypenameTypeParameter() { return nullptr; }
+ virtual TypeofSpecifierAST *asTypeofSpecifier() { return nullptr; }
+ virtual UnaryExpressionAST *asUnaryExpression() { return nullptr; }
+ virtual UsingAST *asUsing() { return nullptr; }
+ virtual UsingDirectiveAST *asUsingDirective() { return nullptr; }
+ virtual WhileStatementAST *asWhileStatement() { return nullptr; }
protected:
virtual void accept0(ASTVisitor *visitor) = 0;
@@ -294,9 +294,6 @@ protected:
class CPLUSPLUS_EXPORT StatementAST: public AST
{
public:
- StatementAST()
- {}
-
virtual StatementAST *asStatement() { return this; }
virtual StatementAST *clone(MemoryPool *pool) const = 0;
@@ -305,9 +302,6 @@ public:
class CPLUSPLUS_EXPORT ExpressionAST: public AST
{
public:
- ExpressionAST()
- {}
-
virtual ExpressionAST *asExpression() { return this; }
virtual ExpressionAST *clone(MemoryPool *pool) const = 0;
@@ -316,9 +310,6 @@ public:
class CPLUSPLUS_EXPORT DeclarationAST: public AST
{
public:
- DeclarationAST()
- {}
-
virtual DeclarationAST *asDeclaration() { return this; }
virtual DeclarationAST *clone(MemoryPool *pool) const = 0;
@@ -327,13 +318,9 @@ public:
class CPLUSPLUS_EXPORT NameAST: public AST
{
public: // annotations
- const Name *name;
+ const Name *name = nullptr;
public:
- NameAST()
- : name(0)
- {}
-
virtual NameAST *asName() { return this; }
virtual NameAST *clone(MemoryPool *pool) const = 0;
@@ -342,9 +329,6 @@ public:
class CPLUSPLUS_EXPORT SpecifierAST: public AST
{
public:
- SpecifierAST()
- {}
-
virtual SpecifierAST *asSpecifier() { return this; }
virtual SpecifierAST *clone(MemoryPool *pool) const = 0;
@@ -353,9 +337,6 @@ public:
class CPLUSPLUS_EXPORT PtrOperatorAST: public AST
{
public:
- PtrOperatorAST()
- {}
-
virtual PtrOperatorAST *asPtrOperator() { return this; }
virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0;
@@ -364,9 +345,6 @@ public:
class CPLUSPLUS_EXPORT PostfixAST: public ExpressionAST
{
public:
- PostfixAST()
- {}
-
virtual PostfixAST *asPostfix() { return this; }
virtual PostfixAST *clone(MemoryPool *pool) const = 0;
@@ -375,9 +353,6 @@ public:
class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
{
public:
- CoreDeclaratorAST()
- {}
-
virtual CoreDeclaratorAST *asCoreDeclarator() { return this; }
virtual CoreDeclaratorAST *clone(MemoryPool *pool) const = 0;
@@ -386,9 +361,6 @@ public:
class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST
{
public:
- PostfixDeclaratorAST()
- {}
-
virtual PostfixDeclaratorAST *asPostfixDeclarator() { return this; }
virtual PostfixDeclaratorAST *clone(MemoryPool *pool) const = 0;
@@ -397,19 +369,14 @@ public:
class CPLUSPLUS_EXPORT ObjCSelectorArgumentAST: public AST
{
public:
- unsigned name_token;
- unsigned colon_token;
+ int name_token = 0;
+ int colon_token = 0;
public:
- ObjCSelectorArgumentAST()
- : name_token(0)
- , colon_token(0)
- {}
-
virtual ObjCSelectorArgumentAST *asObjCSelectorArgument() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSelectorArgumentAST *clone(MemoryPool *pool) const;
@@ -421,17 +388,13 @@ protected:
class CPLUSPLUS_EXPORT ObjCSelectorAST: public NameAST
{
public:
- ObjCSelectorArgumentListAST *selector_argument_list;
+ ObjCSelectorArgumentListAST *selector_argument_list = nullptr;
public:
- ObjCSelectorAST()
- : selector_argument_list(0)
- {}
-
virtual ObjCSelectorAST *asObjCSelector() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSelectorAST *clone(MemoryPool *pool) const;
@@ -443,17 +406,13 @@ protected:
class CPLUSPLUS_EXPORT SimpleSpecifierAST: public SpecifierAST
{
public:
- unsigned specifier_token;
+ int specifier_token = 0;
public:
- SimpleSpecifierAST()
- : specifier_token(0)
- {}
-
virtual SimpleSpecifierAST *asSimpleSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual SimpleSpecifierAST *clone(MemoryPool *pool) const;
@@ -465,9 +424,6 @@ protected:
class CPLUSPLUS_EXPORT AttributeSpecifierAST: public SpecifierAST
{
public:
- AttributeSpecifierAST()
- {}
-
virtual AttributeSpecifierAST *asAttributeSpecifier() { return this; }
virtual AttributeSpecifierAST *clone(MemoryPool *pool) const = 0;
@@ -476,25 +432,17 @@ public:
class CPLUSPLUS_EXPORT AlignmentSpecifierAST: public AttributeSpecifierAST
{
public:
- unsigned align_token;
- unsigned lparen_token;
- ExpressionAST *typeIdExprOrAlignmentExpr;
- unsigned ellipses_token;
- unsigned rparen_token;
+ int align_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *typeIdExprOrAlignmentExpr = nullptr;
+ int ellipses_token = 0;
+ int rparen_token = 0;
public:
- AlignmentSpecifierAST()
- : align_token(0)
- , lparen_token(0)
- , typeIdExprOrAlignmentExpr(0)
- , ellipses_token(0)
- , rparen_token(0)
- {}
-
virtual AlignmentSpecifierAST *asAlignmentSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual AlignmentSpecifierAST *clone(MemoryPool *pool) const;
@@ -507,27 +455,18 @@ protected:
class CPLUSPLUS_EXPORT GnuAttributeSpecifierAST: public AttributeSpecifierAST
{
public:
- unsigned attribute_token;
- unsigned first_lparen_token;
- unsigned second_lparen_token;
- GnuAttributeListAST *attribute_list;
- unsigned first_rparen_token;
- unsigned second_rparen_token;
+ int attribute_token = 0;
+ int first_lparen_token = 0;
+ int second_lparen_token = 0;
+ GnuAttributeListAST *attribute_list = nullptr;
+ int first_rparen_token = 0;
+ int second_rparen_token = 0;
public:
- GnuAttributeSpecifierAST()
- : attribute_token(0)
- , first_lparen_token(0)
- , second_lparen_token(0)
- , attribute_list(0)
- , first_rparen_token(0)
- , second_rparen_token(0)
- {}
-
virtual GnuAttributeSpecifierAST *asGnuAttributeSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual GnuAttributeSpecifierAST *clone(MemoryPool *pool) const;
@@ -539,25 +478,17 @@ protected:
class CPLUSPLUS_EXPORT GnuAttributeAST: public AST
{
public:
- unsigned identifier_token;
- unsigned lparen_token;
- unsigned tag_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ int identifier_token = 0;
+ int lparen_token = 0;
+ int tag_token = 0;
+ ExpressionListAST *expression_list = nullptr;
+ int rparen_token = 0;
public:
- GnuAttributeAST()
- : identifier_token(0)
- , lparen_token(0)
- , tag_token(0)
- , expression_list(0)
- , rparen_token(0)
- {}
-
virtual GnuAttributeAST *asGnuAttribute() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual GnuAttributeAST *clone(MemoryPool *pool) const;
@@ -569,23 +500,16 @@ protected:
class CPLUSPLUS_EXPORT TypeofSpecifierAST: public SpecifierAST
{
public:
- unsigned typeof_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int typeof_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- TypeofSpecifierAST()
- : typeof_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual TypeofSpecifierAST *asTypeofSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypeofSpecifierAST *clone(MemoryPool *pool) const;
@@ -597,23 +521,16 @@ protected:
class CPLUSPLUS_EXPORT DecltypeSpecifierAST: public SpecifierAST
{
public:
- unsigned decltype_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int decltype_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- DecltypeSpecifierAST()
- : decltype_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual DecltypeSpecifierAST *asDecltypeSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DecltypeSpecifierAST *clone(MemoryPool *pool) const;
@@ -625,29 +542,19 @@ protected:
class CPLUSPLUS_EXPORT DeclaratorAST: public AST
{
public:
- SpecifierListAST *attribute_list;
- PtrOperatorListAST *ptr_operator_list;
- CoreDeclaratorAST *core_declarator;
- PostfixDeclaratorListAST *postfix_declarator_list;
- SpecifierListAST *post_attribute_list;
- unsigned equal_token;
- ExpressionAST *initializer;
+ SpecifierListAST *attribute_list = nullptr;
+ PtrOperatorListAST *ptr_operator_list = nullptr;
+ CoreDeclaratorAST *core_declarator = nullptr;
+ PostfixDeclaratorListAST *postfix_declarator_list = nullptr;
+ SpecifierListAST *post_attribute_list = nullptr;
+ int equal_token = 0;
+ ExpressionAST *initializer = nullptr;
public:
- DeclaratorAST()
- : attribute_list(0)
- , ptr_operator_list(0)
- , core_declarator(0)
- , postfix_declarator_list(0)
- , post_attribute_list(0)
- , equal_token(0)
- , initializer(0)
- {}
-
virtual DeclaratorAST *asDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DeclaratorAST *clone(MemoryPool *pool) const;
@@ -659,27 +566,19 @@ protected:
class CPLUSPLUS_EXPORT SimpleDeclarationAST: public DeclarationAST
{
public:
- unsigned qt_invokable_token;
- SpecifierListAST *decl_specifier_list;
- DeclaratorListAST *declarator_list;
- unsigned semicolon_token;
+ int qt_invokable_token = 0;
+ SpecifierListAST *decl_specifier_list = nullptr;
+ DeclaratorListAST *declarator_list = nullptr;
+ int semicolon_token = 0;
public:
- List<Symbol *> *symbols;
+ List<Symbol *> *symbols = nullptr;
public:
- SimpleDeclarationAST()
- : qt_invokable_token(0)
- , decl_specifier_list(0)
- , declarator_list(0)
- , semicolon_token(0)
- , symbols(0)
- {}
-
virtual SimpleDeclarationAST *asSimpleDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual SimpleDeclarationAST *clone(MemoryPool *pool) const;
@@ -691,17 +590,13 @@ protected:
class CPLUSPLUS_EXPORT EmptyDeclarationAST: public DeclarationAST
{
public:
- unsigned semicolon_token;
+ int semicolon_token = 0;
public:
- EmptyDeclarationAST()
- : semicolon_token(0)
- {}
-
virtual EmptyDeclarationAST *asEmptyDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual EmptyDeclarationAST *clone(MemoryPool *pool) const;
@@ -713,21 +608,15 @@ protected:
class CPLUSPLUS_EXPORT AccessDeclarationAST: public DeclarationAST
{
public:
- unsigned access_specifier_token;
- unsigned slots_token;
- unsigned colon_token;
+ int access_specifier_token = 0;
+ int slots_token = 0;
+ int colon_token = 0;
public:
- AccessDeclarationAST()
- : access_specifier_token(0)
- , slots_token(0)
- , colon_token(0)
- {}
-
virtual AccessDeclarationAST *asAccessDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual AccessDeclarationAST *clone(MemoryPool *pool) const;
@@ -739,17 +628,13 @@ protected:
class CPLUSPLUS_EXPORT QtObjectTagAST: public DeclarationAST
{
public:
- unsigned q_object_token;
+ int q_object_token = 0;
public:
- QtObjectTagAST()
- : q_object_token(0)
- {}
-
virtual QtObjectTagAST *asQtObjectTag() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtObjectTagAST *clone(MemoryPool *pool) const;
@@ -761,33 +646,21 @@ protected:
class CPLUSPLUS_EXPORT QtPrivateSlotAST: public DeclarationAST
{
public:
- unsigned q_private_slot_token;
- unsigned lparen_token;
- unsigned dptr_token;
- unsigned dptr_lparen_token;
- unsigned dptr_rparen_token;
- unsigned comma_token;
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
- unsigned rparen_token;
-
-public:
- QtPrivateSlotAST()
- : q_private_slot_token(0)
- , lparen_token(0)
- , dptr_token(0)
- , dptr_lparen_token(0)
- , dptr_rparen_token(0)
- , comma_token(0)
- , type_specifier_list(0)
- , declarator(0)
- , rparen_token(0)
- {}
+ int q_private_slot_token = 0;
+ int lparen_token = 0;
+ int dptr_token = 0;
+ int dptr_lparen_token = 0;
+ int dptr_rparen_token = 0;
+ int comma_token = 0;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
+ int rparen_token = 0;
+public:
virtual QtPrivateSlotAST *asQtPrivateSlot() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtPrivateSlotAST *clone(MemoryPool *pool) const;
@@ -799,19 +672,14 @@ protected:
class QtPropertyDeclarationItemAST: public AST
{
public:
- unsigned item_name_token;
- ExpressionAST *expression;
+ int item_name_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- QtPropertyDeclarationItemAST()
- : item_name_token(0)
- , expression(0)
- {}
-
virtual QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtPropertyDeclarationItemAST *clone(MemoryPool *pool) const;
@@ -823,31 +691,20 @@ protected:
class CPLUSPLUS_EXPORT QtPropertyDeclarationAST: public DeclarationAST
{
public:
- unsigned property_specifier_token;
- unsigned lparen_token;
- ExpressionAST *expression; // for Q_PRIVATE_PROPERTY(expression, ...)
- unsigned comma_token;
- ExpressionAST *type_id;
- NameAST *property_name;
- QtPropertyDeclarationItemListAST *property_declaration_item_list;
- unsigned rparen_token;
+ int property_specifier_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr; // for Q_PRIVATE_PROPERTY(expression, ...)
+ int comma_token = 0;
+ ExpressionAST *type_id = nullptr;
+ NameAST *property_name = nullptr;
+ QtPropertyDeclarationItemListAST *property_declaration_item_list = nullptr;
+ int rparen_token = 0;
public:
- QtPropertyDeclarationAST()
- : property_specifier_token(0)
- , lparen_token(0)
- , expression(0)
- , comma_token(0)
- , type_id(0)
- , property_name(0)
- , property_declaration_item_list(0)
- , rparen_token(0)
- {}
-
virtual QtPropertyDeclarationAST *asQtPropertyDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtPropertyDeclarationAST *clone(MemoryPool *pool) const;
@@ -859,23 +716,16 @@ protected:
class CPLUSPLUS_EXPORT QtEnumDeclarationAST: public DeclarationAST
{
public:
- unsigned enum_specifier_token;
- unsigned lparen_token;
- NameListAST *enumerator_list;
- unsigned rparen_token;
+ int enum_specifier_token = 0;
+ int lparen_token = 0;
+ NameListAST *enumerator_list = nullptr;
+ int rparen_token = 0;
public:
- QtEnumDeclarationAST()
- : enum_specifier_token(0)
- , lparen_token(0)
- , enumerator_list(0)
- , rparen_token(0)
- {}
-
virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtEnumDeclarationAST *clone(MemoryPool *pool) const;
@@ -887,23 +737,16 @@ protected:
class CPLUSPLUS_EXPORT QtFlagsDeclarationAST: public DeclarationAST
{
public:
- unsigned flags_specifier_token;
- unsigned lparen_token;
- NameListAST *flag_enums_list;
- unsigned rparen_token;
+ int flags_specifier_token = 0;
+ int lparen_token = 0;
+ NameListAST *flag_enums_list = nullptr;
+ int rparen_token = 0;
public:
- QtFlagsDeclarationAST()
- : flags_specifier_token(0)
- , lparen_token(0)
- , flag_enums_list(0)
- , rparen_token(0)
- {}
-
virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtFlagsDeclarationAST *clone(MemoryPool *pool) const;
@@ -915,19 +758,14 @@ protected:
class CPLUSPLUS_EXPORT QtInterfaceNameAST: public AST
{
public:
- NameAST *interface_name;
- NameListAST *constraint_list;
+ NameAST *interface_name = nullptr;
+ NameListAST *constraint_list = nullptr;
public:
- QtInterfaceNameAST()
- : interface_name(0)
- , constraint_list(0)
- {}
-
virtual QtInterfaceNameAST *asQtInterfaceName() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtInterfaceNameAST *clone(MemoryPool *pool) const;
@@ -939,23 +777,16 @@ protected:
class CPLUSPLUS_EXPORT QtInterfacesDeclarationAST: public DeclarationAST
{
public:
- unsigned interfaces_token;
- unsigned lparen_token;
- QtInterfaceNameListAST *interface_name_list;
- unsigned rparen_token;
+ int interfaces_token = 0;
+ int lparen_token = 0;
+ QtInterfaceNameListAST *interface_name_list = nullptr;
+ int rparen_token = 0;
public:
- QtInterfacesDeclarationAST()
- : interfaces_token(0)
- , lparen_token(0)
- , interface_name_list(0)
- , rparen_token(0)
- {}
-
virtual QtInterfacesDeclarationAST *asQtInterfacesDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtInterfacesDeclarationAST *clone(MemoryPool *pool) const;
@@ -967,27 +798,19 @@ protected:
class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST
{
public:
- unsigned asm_token;
- unsigned volatile_token;
- unsigned lparen_token;
+ int asm_token = 0;
+ int volatile_token = 0;
+ int lparen_token = 0;
// ### string literals
// ### asm operand list
- unsigned rparen_token;
- unsigned semicolon_token;
+ int rparen_token = 0;
+ int semicolon_token = 0;
public:
- AsmDefinitionAST()
- : asm_token(0)
- , volatile_token(0)
- , lparen_token(0)
- , rparen_token(0)
- , semicolon_token(0)
- {}
-
virtual AsmDefinitionAST *asAsmDefinition() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual AsmDefinitionAST *clone(MemoryPool *pool) const;
@@ -999,27 +822,19 @@ protected:
class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
{
public:
- unsigned virtual_token;
- unsigned access_specifier_token;
- NameAST *name;
- unsigned ellipsis_token;
+ int virtual_token = 0;
+ int access_specifier_token = 0;
+ NameAST *name = nullptr;
+ int ellipsis_token = 0;
public: // annotations
- BaseClass *symbol;
+ BaseClass *symbol = nullptr;
public:
- BaseSpecifierAST()
- : virtual_token(0)
- , access_specifier_token(0)
- , name(0)
- , ellipsis_token(0)
- , symbol(0)
- {}
-
virtual BaseSpecifierAST *asBaseSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BaseSpecifierAST *clone(MemoryPool *pool) const;
@@ -1031,17 +846,13 @@ protected:
class CPLUSPLUS_EXPORT IdExpressionAST: public ExpressionAST
{
public:
- NameAST *name;
+ NameAST *name = nullptr;
public:
- IdExpressionAST()
- : name(0)
- {}
-
virtual IdExpressionAST *asIdExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual IdExpressionAST *clone(MemoryPool *pool) const;
@@ -1053,21 +864,15 @@ protected:
class CPLUSPLUS_EXPORT CompoundExpressionAST: public ExpressionAST
{
public:
- unsigned lparen_token;
- CompoundStatementAST *statement;
- unsigned rparen_token;
+ int lparen_token = 0;
+ CompoundStatementAST *statement = nullptr;
+ int rparen_token = 0;
public:
- CompoundExpressionAST()
- : lparen_token(0)
- , statement(0)
- , rparen_token(0)
- {}
-
virtual CompoundExpressionAST *asCompoundExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CompoundExpressionAST *clone(MemoryPool *pool) const;
@@ -1079,23 +884,16 @@ protected:
class CPLUSPLUS_EXPORT CompoundLiteralAST: public ExpressionAST
{
public:
- unsigned lparen_token;
- ExpressionAST *type_id;
- unsigned rparen_token;
- ExpressionAST *initializer;
+ int lparen_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int rparen_token = 0;
+ ExpressionAST *initializer = nullptr;
public:
- CompoundLiteralAST()
- : lparen_token(0)
- , type_id(0)
- , rparen_token(0)
- , initializer(0)
- {}
-
virtual CompoundLiteralAST *asCompoundLiteral() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CompoundLiteralAST *clone(MemoryPool *pool) const;
@@ -1107,23 +905,16 @@ protected:
class CPLUSPLUS_EXPORT QtMethodAST: public ExpressionAST
{
public:
- unsigned method_token;
- unsigned lparen_token;
- DeclaratorAST *declarator;
- unsigned rparen_token;
+ int method_token = 0;
+ int lparen_token = 0;
+ DeclaratorAST *declarator = nullptr;
+ int rparen_token = 0;
public:
- QtMethodAST()
- : method_token(0)
- , lparen_token(0)
- , declarator(0)
- , rparen_token(0)
- {}
-
virtual QtMethodAST *asQtMethod() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtMethodAST *clone(MemoryPool *pool) const;
@@ -1135,23 +926,16 @@ protected:
class CPLUSPLUS_EXPORT QtMemberDeclarationAST: public StatementAST
{
public:
- unsigned q_token;
- unsigned lparen_token;
- ExpressionAST *type_id;
- unsigned rparen_token;
+ int q_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int rparen_token = 0;
public:
- QtMemberDeclarationAST()
- : q_token(0)
- , lparen_token(0)
- , type_id(0)
- , rparen_token(0)
- {}
-
virtual QtMemberDeclarationAST *asQtMemberDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QtMemberDeclarationAST *clone(MemoryPool *pool) const;
@@ -1163,21 +947,15 @@ protected:
class CPLUSPLUS_EXPORT BinaryExpressionAST: public ExpressionAST
{
public:
- ExpressionAST *left_expression;
- unsigned binary_op_token;
- ExpressionAST *right_expression;
+ ExpressionAST *left_expression = nullptr;
+ int binary_op_token = 0;
+ ExpressionAST *right_expression = nullptr;
public:
- BinaryExpressionAST()
- : left_expression(0)
- , binary_op_token(0)
- , right_expression(0)
- {}
-
virtual BinaryExpressionAST *asBinaryExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BinaryExpressionAST *clone(MemoryPool *pool) const;
@@ -1189,23 +967,16 @@ protected:
class CPLUSPLUS_EXPORT CastExpressionAST: public ExpressionAST
{
public:
- unsigned lparen_token;
- ExpressionAST *type_id;
- unsigned rparen_token;
- ExpressionAST *expression;
+ int lparen_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int rparen_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- CastExpressionAST()
- : lparen_token(0)
- , type_id(0)
- , rparen_token(0)
- , expression(0)
- {}
-
virtual CastExpressionAST *asCastExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CastExpressionAST *clone(MemoryPool *pool) const;
@@ -1217,39 +988,25 @@ protected:
class CPLUSPLUS_EXPORT ClassSpecifierAST: public SpecifierAST
{
public:
- unsigned classkey_token;
- SpecifierListAST *attribute_list;
- NameAST *name;
- unsigned final_token;
- unsigned colon_token;
- BaseSpecifierListAST *base_clause_list;
- unsigned dot_dot_dot_token;
- unsigned lbrace_token;
- DeclarationListAST *member_specifier_list;
- unsigned rbrace_token;
+ int classkey_token = 0;
+ SpecifierListAST *attribute_list = nullptr;
+ NameAST *name = nullptr;
+ int final_token = 0;
+ int colon_token = 0;
+ BaseSpecifierListAST *base_clause_list = nullptr;
+ int dot_dot_dot_token = 0;
+ int lbrace_token = 0;
+ DeclarationListAST *member_specifier_list = nullptr;
+ int rbrace_token = 0;
public: // annotations
- Class *symbol;
-
-public:
- ClassSpecifierAST()
- : classkey_token(0)
- , attribute_list(0)
- , name(0)
- , final_token(0)
- , colon_token(0)
- , base_clause_list(0)
- , dot_dot_dot_token(0)
- , lbrace_token(0)
- , member_specifier_list(0)
- , rbrace_token(0)
- , symbol(0)
- {}
+ Class *symbol = nullptr;
+public:
virtual ClassSpecifierAST *asClassSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ClassSpecifierAST *clone(MemoryPool *pool) const;
@@ -1261,23 +1018,16 @@ protected:
class CPLUSPLUS_EXPORT CaseStatementAST: public StatementAST
{
public:
- unsigned case_token;
- ExpressionAST *expression;
- unsigned colon_token;
- StatementAST *statement;
+ int case_token = 0;
+ ExpressionAST *expression = nullptr;
+ int colon_token = 0;
+ StatementAST *statement = nullptr;
public:
- CaseStatementAST()
- : case_token(0)
- , expression(0)
- , colon_token(0)
- , statement(0)
- {}
-
virtual CaseStatementAST *asCaseStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CaseStatementAST *clone(MemoryPool *pool) const;
@@ -1289,25 +1039,18 @@ protected:
class CPLUSPLUS_EXPORT CompoundStatementAST: public StatementAST
{
public:
- unsigned lbrace_token;
- StatementListAST *statement_list;
- unsigned rbrace_token;
+ int lbrace_token = 0;
+ StatementListAST *statement_list = nullptr;
+ int rbrace_token = 0;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- CompoundStatementAST()
- : lbrace_token(0)
- , statement_list(0)
- , rbrace_token(0)
- , symbol(0)
- {}
-
virtual CompoundStatementAST *asCompoundStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CompoundStatementAST *clone(MemoryPool *pool) const;
@@ -1319,19 +1062,14 @@ protected:
class CPLUSPLUS_EXPORT ConditionAST: public ExpressionAST
{
public:
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
public:
- ConditionAST()
- : type_specifier_list(0)
- , declarator(0)
- {}
-
virtual ConditionAST *asCondition() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ConditionAST *clone(MemoryPool *pool) const;
@@ -1343,25 +1081,17 @@ protected:
class CPLUSPLUS_EXPORT ConditionalExpressionAST: public ExpressionAST
{
public:
- ExpressionAST *condition;
- unsigned question_token;
- ExpressionAST *left_expression;
- unsigned colon_token;
- ExpressionAST *right_expression;
+ ExpressionAST *condition = nullptr;
+ int question_token = 0;
+ ExpressionAST *left_expression = nullptr;
+ int colon_token = 0;
+ ExpressionAST *right_expression = nullptr;
public:
- ConditionalExpressionAST()
- : condition(0)
- , question_token(0)
- , left_expression(0)
- , colon_token(0)
- , right_expression(0)
- {}
-
virtual ConditionalExpressionAST *asConditionalExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ConditionalExpressionAST *clone(MemoryPool *pool) const;
@@ -1373,29 +1103,19 @@ protected:
class CPLUSPLUS_EXPORT CppCastExpressionAST: public ExpressionAST
{
public:
- unsigned cast_token;
- unsigned less_token;
- ExpressionAST *type_id;
- unsigned greater_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int cast_token = 0;
+ int less_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int greater_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- CppCastExpressionAST()
- : cast_token(0)
- , less_token(0)
- , type_id(0)
- , greater_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual CppCastExpressionAST *asCppCastExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CppCastExpressionAST *clone(MemoryPool *pool) const;
@@ -1407,21 +1127,15 @@ protected:
class CPLUSPLUS_EXPORT CtorInitializerAST: public AST
{
public:
- unsigned colon_token;
- MemInitializerListAST *member_initializer_list;
- unsigned dot_dot_dot_token;
+ int colon_token = 0;
+ MemInitializerListAST *member_initializer_list = nullptr;
+ int dot_dot_dot_token = 0;
public:
- CtorInitializerAST()
- : colon_token(0)
- , member_initializer_list(0)
- , dot_dot_dot_token(0)
- {}
-
virtual CtorInitializerAST *asCtorInitializer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CtorInitializerAST *clone(MemoryPool *pool) const;
@@ -1433,17 +1147,13 @@ protected:
class CPLUSPLUS_EXPORT DeclarationStatementAST: public StatementAST
{
public:
- DeclarationAST *declaration;
+ DeclarationAST *declaration = nullptr;
public:
- DeclarationStatementAST()
- : declaration(0)
- {}
-
virtual DeclarationStatementAST *asDeclarationStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DeclarationStatementAST *clone(MemoryPool *pool) const;
@@ -1455,19 +1165,14 @@ protected:
class CPLUSPLUS_EXPORT DeclaratorIdAST: public CoreDeclaratorAST
{
public:
- unsigned dot_dot_dot_token;
- NameAST *name;
+ int dot_dot_dot_token = 0;
+ NameAST *name = nullptr;
public:
- DeclaratorIdAST()
- : dot_dot_dot_token(0)
- , name(0)
- {}
-
virtual DeclaratorIdAST *asDeclaratorId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DeclaratorIdAST *clone(MemoryPool *pool) const;
@@ -1479,21 +1184,15 @@ protected:
class CPLUSPLUS_EXPORT NestedDeclaratorAST: public CoreDeclaratorAST
{
public:
- unsigned lparen_token;
- DeclaratorAST *declarator;
- unsigned rparen_token;
+ int lparen_token = 0;
+ DeclaratorAST *declarator = nullptr;
+ int rparen_token = 0;
public:
- NestedDeclaratorAST()
- : lparen_token(0)
- , declarator(0)
- , rparen_token(0)
- {}
-
virtual NestedDeclaratorAST *asNestedDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NestedDeclaratorAST *clone(MemoryPool *pool) const;
@@ -1505,36 +1204,24 @@ protected:
class CPLUSPLUS_EXPORT FunctionDeclaratorAST: public PostfixDeclaratorAST
{
public:
- unsigned lparen_token;
- ParameterDeclarationClauseAST *parameter_declaration_clause;
- unsigned rparen_token;
- SpecifierListAST *cv_qualifier_list;
- unsigned ref_qualifier_token;
- ExceptionSpecificationAST *exception_specification;
- TrailingReturnTypeAST *trailing_return_type;
+ int lparen_token = 0;
+ ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr;
+ int rparen_token = 0;
+ SpecifierListAST *cv_qualifier_list = nullptr;
+ int ref_qualifier_token = 0;
+ ExceptionSpecificationAST *exception_specification = nullptr;
+ TrailingReturnTypeAST *trailing_return_type = nullptr;
// Some FunctionDeclarators can also be interpreted as an initializer, like for 'A b(c);'
- ExpressionAST *as_cpp_initializer;
+ ExpressionAST *as_cpp_initializer = nullptr;
public: // annotations
- Function *symbol;
+ Function *symbol = nullptr;
public:
- FunctionDeclaratorAST()
- : lparen_token(0)
- , parameter_declaration_clause(0)
- , rparen_token(0)
- , cv_qualifier_list(0)
- , ref_qualifier_token(0)
- , exception_specification(0)
- , trailing_return_type(0)
- , as_cpp_initializer(0)
- , symbol(0)
- {}
-
virtual FunctionDeclaratorAST *asFunctionDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual FunctionDeclaratorAST *clone(MemoryPool *pool) const;
@@ -1546,21 +1233,15 @@ protected:
class CPLUSPLUS_EXPORT ArrayDeclaratorAST: public PostfixDeclaratorAST
{
public:
- unsigned lbracket_token;
- ExpressionAST *expression;
- unsigned rbracket_token;
+ int lbracket_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rbracket_token = 0;
public:
- ArrayDeclaratorAST()
- : lbracket_token(0)
- , expression(0)
- , rbracket_token(0)
- {}
-
virtual ArrayDeclaratorAST *asArrayDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ArrayDeclaratorAST *clone(MemoryPool *pool) const;
@@ -1572,25 +1253,17 @@ protected:
class CPLUSPLUS_EXPORT DeleteExpressionAST: public ExpressionAST
{
public:
- unsigned scope_token;
- unsigned delete_token;
- unsigned lbracket_token;
- unsigned rbracket_token;
- ExpressionAST *expression;
+ int scope_token = 0;
+ int delete_token = 0;
+ int lbracket_token = 0;
+ int rbracket_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- DeleteExpressionAST()
- : scope_token(0)
- , delete_token(0)
- , lbracket_token(0)
- , rbracket_token(0)
- , expression(0)
- {}
-
virtual DeleteExpressionAST *asDeleteExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DeleteExpressionAST *clone(MemoryPool *pool) const;
@@ -1602,29 +1275,19 @@ protected:
class CPLUSPLUS_EXPORT DoStatementAST: public StatementAST
{
public:
- unsigned do_token;
- StatementAST *statement;
- unsigned while_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
- unsigned semicolon_token;
+ int do_token = 0;
+ StatementAST *statement = nullptr;
+ int while_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
+ int semicolon_token = 0;
public:
- DoStatementAST()
- : do_token(0)
- , statement(0)
- , while_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- , semicolon_token(0)
- {}
-
virtual DoStatementAST *asDoStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DoStatementAST *clone(MemoryPool *pool) const;
@@ -1636,17 +1299,13 @@ protected:
class CPLUSPLUS_EXPORT NamedTypeSpecifierAST: public SpecifierAST
{
public:
- NameAST *name;
+ NameAST *name = nullptr;
public:
- NamedTypeSpecifierAST()
- : name(0)
- {}
-
virtual NamedTypeSpecifierAST *asNamedTypeSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NamedTypeSpecifierAST *clone(MemoryPool *pool) const;
@@ -1658,21 +1317,15 @@ protected:
class CPLUSPLUS_EXPORT ElaboratedTypeSpecifierAST: public SpecifierAST
{
public:
- unsigned classkey_token;
- SpecifierListAST *attribute_list;
- NameAST *name;
+ int classkey_token = 0;
+ SpecifierListAST *attribute_list = nullptr;
+ NameAST *name = nullptr;
public:
- ElaboratedTypeSpecifierAST()
- : classkey_token(0)
- , attribute_list(0)
- , name(0)
- {}
-
virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ElaboratedTypeSpecifierAST *clone(MemoryPool *pool) const;
@@ -1684,37 +1337,24 @@ protected:
class CPLUSPLUS_EXPORT EnumSpecifierAST: public SpecifierAST
{
public:
- unsigned enum_token;
- unsigned key_token; // struct, class or 0
- NameAST *name;
- unsigned colon_token; // can be 0 if there is no enum-base
- SpecifierListAST *type_specifier_list; // ditto
- unsigned lbrace_token;
- EnumeratorListAST *enumerator_list;
- unsigned stray_comma_token;
- unsigned rbrace_token;
+ int enum_token = 0;
+ int key_token = 0; // struct, class or 0
+ NameAST *name = nullptr;
+ int colon_token = 0; // can be 0 if there is no enum-base
+ SpecifierListAST *type_specifier_list = nullptr; // ditto
+ int lbrace_token = 0;
+ EnumeratorListAST *enumerator_list = nullptr;
+ int stray_comma_token = 0;
+ int rbrace_token = 0;
public: // annotations
- Enum *symbol;
-
-public:
- EnumSpecifierAST()
- : enum_token(0)
- , key_token(0)
- , name(0)
- , colon_token(0)
- , type_specifier_list(0)
- , lbrace_token(0)
- , enumerator_list(0)
- , stray_comma_token(0)
- , rbrace_token(0)
- , symbol(0)
- {}
+ Enum *symbol = nullptr;
+public:
virtual EnumSpecifierAST *asEnumSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual EnumSpecifierAST *clone(MemoryPool *pool) const;
@@ -1726,21 +1366,15 @@ protected:
class CPLUSPLUS_EXPORT EnumeratorAST: public AST
{
public:
- unsigned identifier_token;
- unsigned equal_token;
- ExpressionAST *expression;
+ int identifier_token = 0;
+ int equal_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- EnumeratorAST()
- : identifier_token(0)
- , equal_token(0)
- , expression(0)
- {}
-
virtual EnumeratorAST *asEnumerator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual EnumeratorAST *clone(MemoryPool *pool) const;
@@ -1752,21 +1386,15 @@ protected:
class CPLUSPLUS_EXPORT ExceptionDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
- unsigned dot_dot_dot_token;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
+ int dot_dot_dot_token = 0;
public:
- ExceptionDeclarationAST()
- : type_specifier_list(0)
- , declarator(0)
- , dot_dot_dot_token(0)
- {}
-
virtual ExceptionDeclarationAST *asExceptionDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ExceptionDeclarationAST *clone(MemoryPool *pool) const;
@@ -1778,9 +1406,6 @@ protected:
class CPLUSPLUS_EXPORT ExceptionSpecificationAST: public AST
{
public:
- ExceptionSpecificationAST()
- {}
-
virtual ExceptionSpecificationAST *asExceptionSpecification() { return this; }
virtual ExceptionSpecificationAST *clone(MemoryPool *pool) const = 0;
@@ -1789,25 +1414,17 @@ public:
class CPLUSPLUS_EXPORT DynamicExceptionSpecificationAST: public ExceptionSpecificationAST
{
public:
- unsigned throw_token;
- unsigned lparen_token;
- unsigned dot_dot_dot_token;
- ExpressionListAST *type_id_list;
- unsigned rparen_token;
+ int throw_token = 0;
+ int lparen_token = 0;
+ int dot_dot_dot_token = 0;
+ ExpressionListAST *type_id_list = nullptr;
+ int rparen_token = 0;
public:
- DynamicExceptionSpecificationAST()
- : throw_token(0)
- , lparen_token(0)
- , dot_dot_dot_token(0)
- , type_id_list(0)
- , rparen_token(0)
- {}
-
virtual DynamicExceptionSpecificationAST *asDynamicExceptionSpecification() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DynamicExceptionSpecificationAST *clone(MemoryPool *pool) const;
@@ -1819,23 +1436,16 @@ protected:
class CPLUSPLUS_EXPORT NoExceptSpecificationAST: public ExceptionSpecificationAST
{
public:
- unsigned noexcept_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int noexcept_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- NoExceptSpecificationAST()
- : noexcept_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual NoExceptSpecificationAST *asNoExceptSpecification() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NoExceptSpecificationAST *clone(MemoryPool *pool) const;
@@ -1847,19 +1457,14 @@ protected:
class CPLUSPLUS_EXPORT ExpressionOrDeclarationStatementAST: public StatementAST
{
public:
- ExpressionStatementAST *expression;
- DeclarationStatementAST *declaration;
+ ExpressionStatementAST *expression = nullptr;
+ DeclarationStatementAST *declaration = nullptr;
public:
- ExpressionOrDeclarationStatementAST()
- : expression(0)
- , declaration(0)
- {}
-
virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ExpressionOrDeclarationStatementAST *clone(MemoryPool *pool) const;
@@ -1871,19 +1476,14 @@ protected:
class CPLUSPLUS_EXPORT ExpressionStatementAST: public StatementAST
{
public:
- ExpressionAST *expression;
- unsigned semicolon_token;
+ ExpressionAST *expression = nullptr;
+ int semicolon_token = 0;
public:
- ExpressionStatementAST()
- : expression(0)
- , semicolon_token(0)
- {}
-
virtual ExpressionStatementAST *asExpressionStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ExpressionStatementAST *clone(MemoryPool *pool) const;
@@ -1895,29 +1495,20 @@ protected:
class CPLUSPLUS_EXPORT FunctionDefinitionAST: public DeclarationAST
{
public:
- unsigned qt_invokable_token;
- SpecifierListAST *decl_specifier_list;
- DeclaratorAST *declarator;
- CtorInitializerAST *ctor_initializer;
- StatementAST *function_body;
+ int qt_invokable_token = 0;
+ SpecifierListAST *decl_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
+ CtorInitializerAST *ctor_initializer = nullptr;
+ StatementAST *function_body = nullptr;
public: // annotations
- Function *symbol;
+ Function *symbol = nullptr;
public:
- FunctionDefinitionAST()
- : qt_invokable_token(0)
- , decl_specifier_list(0)
- , declarator(0)
- , ctor_initializer(0)
- , function_body(0)
- , symbol(0)
- {}
-
virtual FunctionDefinitionAST *asFunctionDefinition() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual FunctionDefinitionAST *clone(MemoryPool *pool) const;
@@ -1929,39 +1520,26 @@ protected:
class CPLUSPLUS_EXPORT ForeachStatementAST: public StatementAST
{
public:
- unsigned foreach_token;
- unsigned lparen_token;
+ int foreach_token = 0;
+ int lparen_token = 0;
// declaration
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
// or an expression
- ExpressionAST *initializer;
- unsigned comma_token;
- ExpressionAST *expression;
- unsigned rparen_token;
- StatementAST *statement;
+ ExpressionAST *initializer = nullptr;
+ int comma_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
-
-public:
- ForeachStatementAST()
- : foreach_token(0)
- , lparen_token(0)
- , type_specifier_list(0)
- , declarator(0)
- , initializer(0)
- , comma_token(0)
- , expression(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
+ Block *symbol = nullptr;
+public:
virtual ForeachStatementAST *asForeachStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ForeachStatementAST *clone(MemoryPool *pool) const;
@@ -1973,37 +1551,25 @@ protected:
class CPLUSPLUS_EXPORT RangeBasedForStatementAST : public StatementAST
{
public:
- unsigned for_token;
- unsigned lparen_token;
+ int for_token = 0;
+ int lparen_token = 0;
// declaration
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
// or an expression
- unsigned colon_token;
- ExpressionAST *expression;
- unsigned rparen_token;
- StatementAST *statement;
+ int colon_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- RangeBasedForStatementAST()
- : for_token(0)
- , lparen_token(0)
- , type_specifier_list(0)
- , declarator(0)
- , colon_token(0)
- , expression(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
-
virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual RangeBasedForStatementAST *clone(MemoryPool *pool) const;
@@ -2015,35 +1581,23 @@ protected:
class CPLUSPLUS_EXPORT ForStatementAST: public StatementAST
{
public:
- unsigned for_token;
- unsigned lparen_token;
- StatementAST *initializer;
- ExpressionAST *condition;
- unsigned semicolon_token;
- ExpressionAST *expression;
- unsigned rparen_token;
- StatementAST *statement;
+ int for_token = 0;
+ int lparen_token = 0;
+ StatementAST *initializer = nullptr;
+ ExpressionAST *condition = nullptr;
+ int semicolon_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- ForStatementAST()
- : for_token(0)
- , lparen_token(0)
- , initializer(0)
- , condition(0)
- , semicolon_token(0)
- , expression(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
-
virtual ForStatementAST *asForStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ForStatementAST *clone(MemoryPool *pool) const;
@@ -2055,33 +1609,22 @@ protected:
class CPLUSPLUS_EXPORT IfStatementAST: public StatementAST
{
public:
- unsigned if_token;
- unsigned lparen_token;
- ExpressionAST *condition;
- unsigned rparen_token;
- StatementAST *statement;
- unsigned else_token;
- StatementAST *else_statement;
+ int if_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *condition = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
+ int else_token = 0;
+ StatementAST *else_statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- IfStatementAST()
- : if_token(0)
- , lparen_token(0)
- , condition(0)
- , rparen_token(0)
- , statement(0)
- , else_token(0)
- , else_statement(0)
- , symbol(0)
- {}
-
virtual IfStatementAST *asIfStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual IfStatementAST *clone(MemoryPool *pool) const;
@@ -2093,21 +1636,15 @@ protected:
class CPLUSPLUS_EXPORT ArrayInitializerAST: public ExpressionAST
{
public:
- unsigned lbrace_token;
- ExpressionListAST *expression_list;
- unsigned rbrace_token;
+ int lbrace_token = 0;
+ ExpressionListAST *expression_list = nullptr;
+ int rbrace_token = 0;
public:
- ArrayInitializerAST()
- : lbrace_token(0)
- , expression_list(0)
- , rbrace_token(0)
- {}
-
virtual ArrayInitializerAST *asArrayInitializer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ArrayInitializerAST *clone(MemoryPool *pool) const;
@@ -2119,21 +1656,15 @@ protected:
class CPLUSPLUS_EXPORT LabeledStatementAST: public StatementAST
{
public:
- unsigned label_token;
- unsigned colon_token;
- StatementAST *statement;
+ int label_token = 0;
+ int colon_token = 0;
+ StatementAST *statement = nullptr;
public:
- LabeledStatementAST()
- : label_token(0)
- , colon_token(0)
- , statement(0)
- {}
-
virtual LabeledStatementAST *asLabeledStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LabeledStatementAST *clone(MemoryPool *pool) const;
@@ -2145,20 +1676,14 @@ protected:
class CPLUSPLUS_EXPORT LinkageBodyAST: public DeclarationAST
{
public:
- unsigned lbrace_token;
- DeclarationListAST *declaration_list;
- unsigned rbrace_token;
+ int lbrace_token = 0;
+ DeclarationListAST *declaration_list = nullptr;
+ int rbrace_token = 0;
public:
- LinkageBodyAST()
- : lbrace_token(0)
- , declaration_list(0)
- , rbrace_token(0)
- {}
-
virtual LinkageBodyAST *asLinkageBody() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LinkageBodyAST *clone(MemoryPool *pool) const;
@@ -2170,21 +1695,15 @@ protected:
class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
{
public:
- unsigned extern_token;
- unsigned extern_type_token;
- DeclarationAST *declaration;
+ int extern_token = 0;
+ int extern_type_token = 0;
+ DeclarationAST *declaration = nullptr;
public:
- LinkageSpecificationAST()
- : extern_token(0)
- , extern_type_token(0)
- , declaration(0)
- {}
-
virtual LinkageSpecificationAST *asLinkageSpecification() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LinkageSpecificationAST *clone(MemoryPool *pool) const;
@@ -2196,20 +1715,15 @@ protected:
class CPLUSPLUS_EXPORT MemInitializerAST: public AST
{
public:
- NameAST *name;
+ NameAST *name = nullptr;
// either a BracedInitializerAST or a ExpressionListParenAST
- ExpressionAST *expression;
+ ExpressionAST *expression = nullptr;
public:
- MemInitializerAST()
- : name(0)
- , expression(0)
- {}
-
virtual MemInitializerAST *asMemInitializer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual MemInitializerAST *clone(MemoryPool *pool) const;
@@ -2221,19 +1735,14 @@ protected:
class CPLUSPLUS_EXPORT NestedNameSpecifierAST: public AST
{
public:
- NameAST *class_or_namespace_name;
- unsigned scope_token;
+ NameAST *class_or_namespace_name = nullptr;
+ int scope_token = 0;
public:
- NestedNameSpecifierAST()
- : class_or_namespace_name(0)
- , scope_token(0)
- {}
-
virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NestedNameSpecifierAST *clone(MemoryPool *pool) const;
@@ -2245,21 +1754,15 @@ protected:
class CPLUSPLUS_EXPORT QualifiedNameAST: public NameAST
{
public:
- unsigned global_scope_token;
- NestedNameSpecifierListAST *nested_name_specifier_list;
- NameAST *unqualified_name;
+ int global_scope_token = 0;
+ NestedNameSpecifierListAST *nested_name_specifier_list = nullptr;
+ NameAST *unqualified_name = nullptr;
public:
- QualifiedNameAST()
- : global_scope_token(0)
- , nested_name_specifier_list(0)
- , unqualified_name(0)
- {}
-
virtual QualifiedNameAST *asQualifiedName() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual QualifiedNameAST *clone(MemoryPool *pool) const;
@@ -2271,19 +1774,14 @@ protected:
class CPLUSPLUS_EXPORT OperatorFunctionIdAST: public NameAST
{
public:
- unsigned operator_token;
- OperatorAST *op;
+ int operator_token = 0;
+ OperatorAST *op = nullptr;
public:
- OperatorFunctionIdAST()
- : operator_token(0)
- , op(0)
- {}
-
virtual OperatorFunctionIdAST *asOperatorFunctionId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual OperatorFunctionIdAST *clone(MemoryPool *pool) const;
@@ -2295,21 +1793,15 @@ protected:
class CPLUSPLUS_EXPORT ConversionFunctionIdAST: public NameAST
{
public:
- unsigned operator_token;
- SpecifierListAST *type_specifier_list;
- PtrOperatorListAST *ptr_operator_list;
+ int operator_token = 0;
+ SpecifierListAST *type_specifier_list = nullptr;
+ PtrOperatorListAST *ptr_operator_list = nullptr;
public:
- ConversionFunctionIdAST()
- : operator_token(0)
- , type_specifier_list(0)
- , ptr_operator_list(0)
- {}
-
virtual ConversionFunctionIdAST *asConversionFunctionId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ConversionFunctionIdAST *clone(MemoryPool *pool) const;
@@ -2321,15 +1813,12 @@ protected:
class CPLUSPLUS_EXPORT AnonymousNameAST: public NameAST
{
public:
- unsigned class_token;
-public:
- AnonymousNameAST()
- : class_token(0)
- {}
+ int class_token = 0;
+public:
virtual AnonymousNameAST *asAnonymousName() { return this; }
- virtual unsigned firstToken() const { return 0; }
- virtual unsigned lastToken() const { return 0; }
+ virtual int firstToken() const { return 0; }
+ virtual int lastToken() const { return 0; }
virtual AnonymousNameAST *clone(MemoryPool *pool) const;
@@ -2341,17 +1830,13 @@ protected:
class CPLUSPLUS_EXPORT SimpleNameAST: public NameAST
{
public:
- unsigned identifier_token;
+ int identifier_token = 0;
public:
- SimpleNameAST()
- : identifier_token(0)
- {}
-
virtual SimpleNameAST *asSimpleName() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual SimpleNameAST *clone(MemoryPool *pool) const;
@@ -2363,19 +1848,14 @@ protected:
class CPLUSPLUS_EXPORT DestructorNameAST: public NameAST
{
public:
- unsigned tilde_token;
- NameAST *unqualified_name;
+ int tilde_token = 0;
+ NameAST *unqualified_name = nullptr;
public:
- DestructorNameAST()
- : tilde_token(0)
- , unqualified_name(0)
- {}
-
virtual DestructorNameAST *asDestructorName() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DestructorNameAST *clone(MemoryPool *pool) const;
@@ -2387,25 +1867,17 @@ protected:
class CPLUSPLUS_EXPORT TemplateIdAST: public NameAST
{
public:
- unsigned template_token;
- unsigned identifier_token;
- unsigned less_token;
- ExpressionListAST *template_argument_list;
- unsigned greater_token;
+ int template_token = 0;
+ int identifier_token = 0;
+ int less_token = 0;
+ ExpressionListAST *template_argument_list = nullptr;
+ int greater_token = 0;
public:
- TemplateIdAST()
- : template_token(0)
- , identifier_token(0)
- , less_token(0)
- , template_argument_list(0)
- , greater_token(0)
- {}
-
virtual TemplateIdAST *asTemplateId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TemplateIdAST *clone(MemoryPool *pool) const;
@@ -2417,29 +1889,20 @@ protected:
class CPLUSPLUS_EXPORT NamespaceAST: public DeclarationAST
{
public:
- unsigned inline_token;
- unsigned namespace_token;
- unsigned identifier_token;
- SpecifierListAST *attribute_list;
- DeclarationAST *linkage_body;
+ int inline_token = 0;
+ int namespace_token = 0;
+ int identifier_token = 0;
+ SpecifierListAST *attribute_list = nullptr;
+ DeclarationAST *linkage_body = nullptr;
public: // annotations
- Namespace *symbol;
+ Namespace *symbol = nullptr;
public:
- NamespaceAST()
- : inline_token(0)
- , namespace_token(0)
- , identifier_token(0)
- , attribute_list(0)
- , linkage_body(0)
- , symbol(0)
- {}
-
virtual NamespaceAST *asNamespace() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NamespaceAST *clone(MemoryPool *pool) const;
@@ -2451,25 +1914,17 @@ protected:
class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
{
public:
- unsigned namespace_token;
- unsigned namespace_name_token;
- unsigned equal_token;
- NameAST *name;
- unsigned semicolon_token;
+ int namespace_token = 0;
+ int namespace_name_token = 0;
+ int equal_token = 0;
+ NameAST *name = nullptr;
+ int semicolon_token = 0;
public:
- NamespaceAliasDefinitionAST()
- : namespace_token(0)
- , namespace_name_token(0)
- , equal_token(0)
- , name(0)
- , semicolon_token(0)
- {}
-
virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NamespaceAliasDefinitionAST *clone(MemoryPool *pool) const;
@@ -2481,29 +1936,20 @@ protected:
class CPLUSPLUS_EXPORT AliasDeclarationAST: public DeclarationAST
{
public:
- unsigned using_token;
- NameAST *name;
- unsigned equal_token;
- TypeIdAST *typeId;
- unsigned semicolon_token;
+ int using_token = 0;
+ NameAST *name = nullptr;
+ int equal_token = 0;
+ TypeIdAST *typeId = nullptr;
+ int semicolon_token = 0;
public: // annotations
- Declaration *symbol;
+ Declaration *symbol = nullptr;
public:
- AliasDeclarationAST()
- : using_token(0)
- , name(0)
- , equal_token(0)
- , typeId(0)
- , semicolon_token(0)
- , symbol(0)
- {}
-
virtual AliasDeclarationAST *asAliasDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual AliasDeclarationAST *clone(MemoryPool *pool) const;
@@ -2515,21 +1961,15 @@ protected:
class CPLUSPLUS_EXPORT ExpressionListParenAST: public ExpressionAST
{
public:
- unsigned lparen_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ int lparen_token = 0;
+ ExpressionListAST *expression_list = nullptr;
+ int rparen_token = 0;
public:
- ExpressionListParenAST()
- : lparen_token(0)
- , expression_list(0)
- , rparen_token(0)
- {}
-
virtual ExpressionListParenAST *asExpressionListParen() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ExpressionListParenAST *clone(MemoryPool *pool) const;
@@ -2541,21 +1981,15 @@ protected:
class CPLUSPLUS_EXPORT NewArrayDeclaratorAST: public AST
{
public:
- unsigned lbracket_token;
- ExpressionAST *expression;
- unsigned rbracket_token;
+ int lbracket_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rbracket_token = 0;
public:
- NewArrayDeclaratorAST()
- : lbracket_token(0)
- , expression(0)
- , rbracket_token(0)
- {}
-
virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NewArrayDeclaratorAST *clone(MemoryPool *pool) const;
@@ -2567,34 +2001,23 @@ protected:
class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
{
public:
- unsigned scope_token;
- unsigned new_token;
- ExpressionListParenAST *new_placement;
+ int scope_token = 0;
+ int new_token = 0;
+ ExpressionListParenAST *new_placement = nullptr;
- unsigned lparen_token;
- ExpressionAST *type_id;
- unsigned rparen_token;
+ int lparen_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int rparen_token = 0;
- NewTypeIdAST *new_type_id;
+ NewTypeIdAST *new_type_id = nullptr;
- ExpressionAST *new_initializer; // either ExpressionListParenAST or BracedInitializerAST
+ ExpressionAST *new_initializer = nullptr; // either ExpressionListParenAST or BracedInitializerAST
public:
- NewExpressionAST()
- : scope_token(0)
- , new_token(0)
- , new_placement(0)
- , lparen_token(0)
- , type_id(0)
- , rparen_token(0)
- , new_type_id(0)
- , new_initializer(0)
- {}
-
virtual NewExpressionAST *asNewExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NewExpressionAST *clone(MemoryPool *pool) const;
@@ -2606,21 +2029,15 @@ protected:
class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
{
public:
- SpecifierListAST *type_specifier_list;
- PtrOperatorListAST *ptr_operator_list;
- NewArrayDeclaratorListAST *new_array_declarator_list;
+ SpecifierListAST *type_specifier_list = nullptr;
+ PtrOperatorListAST *ptr_operator_list = nullptr;
+ NewArrayDeclaratorListAST *new_array_declarator_list = nullptr;
public:
- NewTypeIdAST()
- : type_specifier_list(0)
- , ptr_operator_list(0)
- , new_array_declarator_list(0)
- {}
-
virtual NewTypeIdAST *asNewTypeId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NewTypeIdAST *clone(MemoryPool *pool) const;
@@ -2632,21 +2049,15 @@ protected:
class CPLUSPLUS_EXPORT OperatorAST: public AST
{
public:
- unsigned op_token;
- unsigned open_token;
- unsigned close_token;
+ int op_token = 0;
+ int open_token = 0;
+ int close_token = 0;
public:
- OperatorAST()
- : op_token(0)
- , open_token(0)
- , close_token(0)
- {}
-
virtual OperatorAST *asOperator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual OperatorAST *clone(MemoryPool *pool) const;
@@ -2658,27 +2069,19 @@ protected:
class CPLUSPLUS_EXPORT ParameterDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
- unsigned equal_token;
- ExpressionAST *expression;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
+ int equal_token = 0;
+ ExpressionAST *expression = nullptr;
public: // annotations
- Argument *symbol;
+ Argument *symbol = nullptr;
public:
- ParameterDeclarationAST()
- : type_specifier_list(0)
- , declarator(0)
- , equal_token(0)
- , expression(0)
- , symbol(0)
- {}
-
virtual ParameterDeclarationAST *asParameterDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ParameterDeclarationAST *clone(MemoryPool *pool) const;
@@ -2690,19 +2093,14 @@ protected:
class CPLUSPLUS_EXPORT ParameterDeclarationClauseAST: public AST
{
public:
- ParameterDeclarationListAST *parameter_declaration_list;
- unsigned dot_dot_dot_token;
+ ParameterDeclarationListAST *parameter_declaration_list = nullptr;
+ int dot_dot_dot_token = 0;
public:
- ParameterDeclarationClauseAST()
- : parameter_declaration_list(0)
- , dot_dot_dot_token(0)
- {}
-
virtual ParameterDeclarationClauseAST *asParameterDeclarationClause() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ParameterDeclarationClauseAST *clone(MemoryPool *pool) const;
@@ -2714,23 +2112,16 @@ protected:
class CPLUSPLUS_EXPORT CallAST: public PostfixAST
{
public:
- ExpressionAST *base_expression;
- unsigned lparen_token;
- ExpressionListAST *expression_list;
- unsigned rparen_token;
+ ExpressionAST *base_expression = nullptr;
+ int lparen_token = 0;
+ ExpressionListAST *expression_list = nullptr;
+ int rparen_token = 0;
public:
- CallAST()
- : base_expression(0)
- , lparen_token(0)
- , expression_list(0)
- , rparen_token(0)
- {}
-
virtual CallAST *asCall() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CallAST *clone(MemoryPool *pool) const;
@@ -2742,23 +2133,16 @@ protected:
class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
{
public:
- ExpressionAST *base_expression;
- unsigned lbracket_token;
- ExpressionAST *expression;
- unsigned rbracket_token;
+ ExpressionAST *base_expression = nullptr;
+ int lbracket_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rbracket_token = 0;
public:
- ArrayAccessAST()
- : base_expression(0)
- , lbracket_token(0)
- , expression(0)
- , rbracket_token(0)
- {}
-
virtual ArrayAccessAST *asArrayAccess() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ArrayAccessAST *clone(MemoryPool *pool) const;
@@ -2770,19 +2154,14 @@ protected:
class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
{
public:
- ExpressionAST *base_expression;
- unsigned incr_decr_token;
+ ExpressionAST *base_expression = nullptr;
+ int incr_decr_token = 0;
public:
- PostIncrDecrAST()
- : base_expression(0)
- , incr_decr_token(0)
- {}
-
virtual PostIncrDecrAST *asPostIncrDecr() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual PostIncrDecrAST *clone(MemoryPool *pool) const;
@@ -2794,23 +2173,16 @@ protected:
class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
{
public:
- ExpressionAST *base_expression;
- unsigned access_token;
- unsigned template_token;
- NameAST *member_name;
+ ExpressionAST *base_expression = nullptr;
+ int access_token = 0;
+ int template_token = 0;
+ NameAST *member_name = nullptr;
public:
- MemberAccessAST()
- : base_expression(0)
- , access_token(0)
- , template_token(0)
- , member_name(0)
- {}
-
virtual MemberAccessAST *asMemberAccess() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual MemberAccessAST *clone(MemoryPool *pool) const;
@@ -2822,23 +2194,16 @@ protected:
class CPLUSPLUS_EXPORT TypeidExpressionAST: public ExpressionAST
{
public:
- unsigned typeid_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int typeid_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- TypeidExpressionAST()
- : typeid_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual TypeidExpressionAST *asTypeidExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypeidExpressionAST *clone(MemoryPool *pool) const;
@@ -2850,21 +2215,15 @@ protected:
class CPLUSPLUS_EXPORT TypenameCallExpressionAST: public ExpressionAST
{
public:
- unsigned typename_token;
- NameAST *name;
- ExpressionAST *expression; // either ExpressionListParenAST or BracedInitializerAST
+ int typename_token = 0;
+ NameAST *name = nullptr;
+ ExpressionAST *expression = nullptr; // either ExpressionListParenAST or BracedInitializerAST
public:
- TypenameCallExpressionAST()
- : typename_token(0)
- , name(0)
- , expression(0)
- {}
-
virtual TypenameCallExpressionAST *asTypenameCallExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypenameCallExpressionAST *clone(MemoryPool *pool) const;
@@ -2876,19 +2235,14 @@ protected:
class CPLUSPLUS_EXPORT TypeConstructorCallAST: public ExpressionAST
{
public:
- SpecifierListAST *type_specifier_list;
- ExpressionAST *expression; // either ExpressionListParenAST or BracedInitializerAST
+ SpecifierListAST *type_specifier_list = nullptr;
+ ExpressionAST *expression = nullptr; // either ExpressionListParenAST or BracedInitializerAST
public:
- TypeConstructorCallAST()
- : type_specifier_list(0)
- , expression(0)
- {}
-
virtual TypeConstructorCallAST *asTypeConstructorCall() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypeConstructorCallAST *clone(MemoryPool *pool) const;
@@ -2900,25 +2254,17 @@ protected:
class CPLUSPLUS_EXPORT PointerToMemberAST: public PtrOperatorAST
{
public:
- unsigned global_scope_token;
- NestedNameSpecifierListAST *nested_name_specifier_list;
- unsigned star_token;
- SpecifierListAST *cv_qualifier_list;
- unsigned ref_qualifier_token;
+ int global_scope_token = 0;
+ NestedNameSpecifierListAST *nested_name_specifier_list = nullptr;
+ int star_token = 0;
+ SpecifierListAST *cv_qualifier_list = nullptr;
+ int ref_qualifier_token = 0;
public:
- PointerToMemberAST()
- : global_scope_token(0)
- , nested_name_specifier_list(0)
- , star_token(0)
- , cv_qualifier_list(0)
- , ref_qualifier_token(0)
- {}
-
virtual PointerToMemberAST *asPointerToMember() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual PointerToMemberAST *clone(MemoryPool *pool) const;
@@ -2930,19 +2276,14 @@ protected:
class CPLUSPLUS_EXPORT PointerAST: public PtrOperatorAST
{
public:
- unsigned star_token;
- SpecifierListAST *cv_qualifier_list;
+ int star_token = 0;
+ SpecifierListAST *cv_qualifier_list = nullptr;
public:
- PointerAST()
- : star_token(0)
- , cv_qualifier_list(0)
- {}
-
virtual PointerAST *asPointer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual PointerAST *clone(MemoryPool *pool) const;
@@ -2954,17 +2295,13 @@ protected:
class CPLUSPLUS_EXPORT ReferenceAST: public PtrOperatorAST
{
public:
- unsigned reference_token;
+ int reference_token = 0;
public:
- ReferenceAST()
- : reference_token(0)
- {}
-
virtual ReferenceAST *asReference() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ReferenceAST *clone(MemoryPool *pool) const;
@@ -2976,19 +2313,14 @@ protected:
class CPLUSPLUS_EXPORT BreakStatementAST: public StatementAST
{
public:
- unsigned break_token;
- unsigned semicolon_token;
+ int break_token = 0;
+ int semicolon_token = 0;
public:
- BreakStatementAST()
- : break_token(0)
- , semicolon_token(0)
- {}
-
virtual BreakStatementAST *asBreakStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BreakStatementAST *clone(MemoryPool *pool) const;
@@ -3000,19 +2332,14 @@ protected:
class CPLUSPLUS_EXPORT ContinueStatementAST: public StatementAST
{
public:
- unsigned continue_token;
- unsigned semicolon_token;
+ int continue_token = 0;
+ int semicolon_token = 0;
public:
- ContinueStatementAST()
- : continue_token(0)
- , semicolon_token(0)
- {}
-
virtual ContinueStatementAST *asContinueStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ContinueStatementAST *clone(MemoryPool *pool) const;
@@ -3024,21 +2351,15 @@ protected:
class CPLUSPLUS_EXPORT GotoStatementAST: public StatementAST
{
public:
- unsigned goto_token;
- unsigned identifier_token;
- unsigned semicolon_token;
+ int goto_token = 0;
+ int identifier_token = 0;
+ int semicolon_token = 0;
public:
- GotoStatementAST()
- : goto_token(0)
- , identifier_token(0)
- , semicolon_token(0)
- {}
-
virtual GotoStatementAST *asGotoStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual GotoStatementAST *clone(MemoryPool *pool) const;
@@ -3050,21 +2371,15 @@ protected:
class CPLUSPLUS_EXPORT ReturnStatementAST: public StatementAST
{
public:
- unsigned return_token;
- ExpressionAST *expression;
- unsigned semicolon_token;
+ int return_token = 0;
+ ExpressionAST *expression = nullptr;
+ int semicolon_token = 0;
public:
- ReturnStatementAST()
- : return_token(0)
- , expression(0)
- , semicolon_token(0)
- {}
-
virtual ReturnStatementAST *asReturnStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ReturnStatementAST *clone(MemoryPool *pool) const;
@@ -3076,25 +2391,17 @@ protected:
class CPLUSPLUS_EXPORT SizeofExpressionAST: public ExpressionAST
{
public:
- unsigned sizeof_token;
- unsigned dot_dot_dot_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int sizeof_token = 0;
+ int dot_dot_dot_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- SizeofExpressionAST()
- : sizeof_token(0)
- , dot_dot_dot_token(0)
- , lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual SizeofExpressionAST *asSizeofExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual SizeofExpressionAST *clone(MemoryPool *pool) const;
@@ -3106,23 +2413,16 @@ protected:
class CPLUSPLUS_EXPORT AlignofExpressionAST: public ExpressionAST
{
public:
- unsigned alignof_token;
- unsigned lparen_token;
+ int alignof_token = 0;
+ int lparen_token = 0;
TypeIdAST *typeId;
- unsigned rparen_token;
+ int rparen_token = 0;
public:
- AlignofExpressionAST()
- : alignof_token(0)
- , lparen_token(0)
- , typeId(0)
- , rparen_token(0)
- {}
-
virtual AlignofExpressionAST *asAlignofExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual AlignofExpressionAST *clone(MemoryPool *pool) const;
@@ -3134,17 +2434,13 @@ protected:
class CPLUSPLUS_EXPORT PointerLiteralAST: public ExpressionAST
{
public:
- unsigned literal_token;
+ int literal_token = 0;
public:
- PointerLiteralAST()
- : literal_token(0)
- {}
-
virtual PointerLiteralAST *asPointerLiteral() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual PointerLiteralAST *clone(MemoryPool *pool) const;
@@ -3156,17 +2452,13 @@ protected:
class CPLUSPLUS_EXPORT NumericLiteralAST: public ExpressionAST
{
public:
- unsigned literal_token;
+ int literal_token = 0;
public:
- NumericLiteralAST()
- : literal_token(0)
- {}
-
virtual NumericLiteralAST *asNumericLiteral() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NumericLiteralAST *clone(MemoryPool *pool) const;
@@ -3178,17 +2470,13 @@ protected:
class CPLUSPLUS_EXPORT BoolLiteralAST: public ExpressionAST
{
public:
- unsigned literal_token;
+ int literal_token = 0;
public:
- BoolLiteralAST()
- : literal_token(0)
- {}
-
virtual BoolLiteralAST *asBoolLiteral() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BoolLiteralAST *clone(MemoryPool *pool) const;
@@ -3200,17 +2488,13 @@ protected:
class CPLUSPLUS_EXPORT ThisExpressionAST: public ExpressionAST
{
public:
- unsigned this_token;
+ int this_token = 0;
public:
- ThisExpressionAST()
- : this_token(0)
- {}
-
virtual ThisExpressionAST *asThisExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ThisExpressionAST *clone(MemoryPool *pool) const;
@@ -3222,21 +2506,15 @@ protected:
class CPLUSPLUS_EXPORT NestedExpressionAST: public ExpressionAST
{
public:
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned rparen_token;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rparen_token = 0;
public:
- NestedExpressionAST()
- : lparen_token(0)
- , expression(0)
- , rparen_token(0)
- {}
-
virtual NestedExpressionAST *asNestedExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NestedExpressionAST *clone(MemoryPool *pool) const;
@@ -3248,29 +2526,19 @@ protected:
class CPLUSPLUS_EXPORT StaticAssertDeclarationAST: public DeclarationAST
{
public:
- unsigned static_assert_token;
- unsigned lparen_token;
- ExpressionAST *expression;
- unsigned comma_token;
- ExpressionAST *string_literal;
- unsigned rparen_token;
- unsigned semicolon_token;
+ int static_assert_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *expression = nullptr;
+ int comma_token = 0;
+ ExpressionAST *string_literal = nullptr;
+ int rparen_token = 0;
+ int semicolon_token = 0;
public:
- StaticAssertDeclarationAST()
- : static_assert_token(0)
- , lparen_token(0)
- , expression(0)
- , comma_token(0)
- , string_literal(0)
- , rparen_token(0)
- , semicolon_token(0)
- {}
-
virtual StaticAssertDeclarationAST *asStaticAssertDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual StaticAssertDeclarationAST *clone(MemoryPool *pool) const;
@@ -3282,19 +2550,14 @@ protected:
class CPLUSPLUS_EXPORT StringLiteralAST: public ExpressionAST
{
public:
- unsigned literal_token;
- StringLiteralAST *next;
+ int literal_token = 0;
+ StringLiteralAST *next = nullptr;
public:
- StringLiteralAST()
- : literal_token(0)
- , next(0)
- {}
-
virtual StringLiteralAST *asStringLiteral() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual StringLiteralAST *clone(MemoryPool *pool) const;
@@ -3306,29 +2569,20 @@ protected:
class CPLUSPLUS_EXPORT SwitchStatementAST: public StatementAST
{
public:
- unsigned switch_token;
- unsigned lparen_token;
- ExpressionAST *condition;
- unsigned rparen_token;
- StatementAST *statement;
+ int switch_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *condition = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- SwitchStatementAST()
- : switch_token(0)
- , lparen_token(0)
- , condition(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
-
virtual SwitchStatementAST *asSwitchStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual SwitchStatementAST *clone(MemoryPool *pool) const;
@@ -3340,31 +2594,21 @@ protected:
class CPLUSPLUS_EXPORT TemplateDeclarationAST: public DeclarationAST
{
public:
- unsigned export_token;
- unsigned template_token;
- unsigned less_token;
- DeclarationListAST *template_parameter_list;
- unsigned greater_token;
- DeclarationAST *declaration;
+ int export_token = 0;
+ int template_token = 0;
+ int less_token = 0;
+ DeclarationListAST *template_parameter_list = nullptr;
+ int greater_token = 0;
+ DeclarationAST *declaration = nullptr;
public: // annotations
- Template *symbol;
+ Template *symbol = nullptr;
public:
- TemplateDeclarationAST()
- : export_token(0)
- , template_token(0)
- , less_token(0)
- , template_parameter_list(0)
- , greater_token(0)
- , declaration(0)
- , symbol(0)
- {}
-
virtual TemplateDeclarationAST *asTemplateDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TemplateDeclarationAST *clone(MemoryPool *pool) const;
@@ -3376,19 +2620,14 @@ protected:
class CPLUSPLUS_EXPORT ThrowExpressionAST: public ExpressionAST
{
public:
- unsigned throw_token;
- ExpressionAST *expression;
+ int throw_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- ThrowExpressionAST()
- : throw_token(0)
- , expression(0)
- {}
-
virtual ThrowExpressionAST *asThrowExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ThrowExpressionAST *clone(MemoryPool *pool) const;
@@ -3400,19 +2639,14 @@ protected:
class CPLUSPLUS_EXPORT NoExceptOperatorExpressionAST: public ExpressionAST
{
public:
- unsigned noexcept_token;
- ExpressionAST *expression;
+ int noexcept_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- NoExceptOperatorExpressionAST()
- : noexcept_token(0)
- , expression(0)
- {}
-
virtual NoExceptOperatorExpressionAST *asNoExceptOperatorExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual NoExceptOperatorExpressionAST *clone(MemoryPool *pool) const;
@@ -3424,17 +2658,13 @@ protected:
class CPLUSPLUS_EXPORT TranslationUnitAST: public AST
{
public:
- DeclarationListAST *declaration_list;
+ DeclarationListAST *declaration_list = nullptr;
public:
- TranslationUnitAST()
- : declaration_list(0)
- {}
-
virtual TranslationUnitAST *asTranslationUnit() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TranslationUnitAST *clone(MemoryPool *pool) const;
@@ -3446,21 +2676,15 @@ protected:
class CPLUSPLUS_EXPORT TryBlockStatementAST: public StatementAST
{
public:
- unsigned try_token;
- StatementAST *statement;
- CatchClauseListAST *catch_clause_list;
+ int try_token = 0;
+ StatementAST *statement = nullptr;
+ CatchClauseListAST *catch_clause_list = nullptr;
public:
- TryBlockStatementAST()
- : try_token(0)
- , statement(0)
- , catch_clause_list(0)
- {}
-
virtual TryBlockStatementAST *asTryBlockStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TryBlockStatementAST *clone(MemoryPool *pool) const;
@@ -3472,29 +2696,20 @@ protected:
class CPLUSPLUS_EXPORT CatchClauseAST: public StatementAST
{
public:
- unsigned catch_token;
- unsigned lparen_token;
- ExceptionDeclarationAST *exception_declaration;
- unsigned rparen_token;
- StatementAST *statement;
+ int catch_token = 0;
+ int lparen_token = 0;
+ ExceptionDeclarationAST *exception_declaration = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- CatchClauseAST()
- : catch_token(0)
- , lparen_token(0)
- , exception_declaration(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
-
virtual CatchClauseAST *asCatchClause() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CatchClauseAST *clone(MemoryPool *pool) const;
@@ -3506,19 +2721,14 @@ protected:
class CPLUSPLUS_EXPORT TypeIdAST: public ExpressionAST
{
public:
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
public:
- TypeIdAST()
- : type_specifier_list(0)
- , declarator(0)
- {}
-
virtual TypeIdAST *asTypeId() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypeIdAST *clone(MemoryPool *pool) const;
@@ -3530,29 +2740,20 @@ protected:
class CPLUSPLUS_EXPORT TypenameTypeParameterAST: public DeclarationAST
{
public:
- unsigned classkey_token;
- unsigned dot_dot_dot_token;
- NameAST *name;
- unsigned equal_token;
- ExpressionAST *type_id;
+ int classkey_token = 0;
+ int dot_dot_dot_token = 0;
+ NameAST *name = nullptr;
+ int equal_token = 0;
+ ExpressionAST *type_id = nullptr;
public: // annotations
- TypenameArgument *symbol;
+ TypenameArgument *symbol = nullptr;
public:
- TypenameTypeParameterAST()
- : classkey_token(0)
- , dot_dot_dot_token(0)
- , name(0)
- , equal_token(0)
- , type_id(0)
- , symbol(0)
- {}
-
virtual TypenameTypeParameterAST *asTypenameTypeParameter() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TypenameTypeParameterAST *clone(MemoryPool *pool) const;
@@ -3564,37 +2765,24 @@ protected:
class CPLUSPLUS_EXPORT TemplateTypeParameterAST: public DeclarationAST
{
public:
- unsigned template_token;
- unsigned less_token;
- DeclarationListAST *template_parameter_list;
- unsigned greater_token;
- unsigned class_token;
- unsigned dot_dot_dot_token;
- NameAST *name;
- unsigned equal_token;
- ExpressionAST *type_id;
+ int template_token = 0;
+ int less_token = 0;
+ DeclarationListAST *template_parameter_list = nullptr;
+ int greater_token = 0;
+ int class_token = 0;
+ int dot_dot_dot_token = 0;
+ NameAST *name = nullptr;
+ int equal_token = 0;
+ ExpressionAST *type_id = nullptr;
public:
- TypenameArgument *symbol;
+ TypenameArgument *symbol = nullptr;
public:
- TemplateTypeParameterAST()
- : template_token(0)
- , less_token(0)
- , template_parameter_list(0)
- , greater_token(0)
- , class_token(0)
- , dot_dot_dot_token(0)
- , name(0)
- , equal_token(0)
- , type_id(0)
- , symbol(0)
- {}
-
virtual TemplateTypeParameterAST *asTemplateTypeParameter() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TemplateTypeParameterAST *clone(MemoryPool *pool) const;
@@ -3606,19 +2794,14 @@ protected:
class CPLUSPLUS_EXPORT UnaryExpressionAST: public ExpressionAST
{
public:
- unsigned unary_op_token;
- ExpressionAST *expression;
+ int unary_op_token = 0;
+ ExpressionAST *expression = nullptr;
public:
- UnaryExpressionAST()
- : unary_op_token(0)
- , expression(0)
- {}
-
virtual UnaryExpressionAST *asUnaryExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual UnaryExpressionAST *clone(MemoryPool *pool) const;
@@ -3630,27 +2813,19 @@ protected:
class CPLUSPLUS_EXPORT UsingAST: public DeclarationAST
{
public:
- unsigned using_token;
- unsigned typename_token;
- NameAST *name;
- unsigned semicolon_token;
+ int using_token = 0;
+ int typename_token = 0;
+ NameAST *name = nullptr;
+ int semicolon_token = 0;
public: // annotations
- UsingDeclaration *symbol;
+ UsingDeclaration *symbol = nullptr;
public:
- UsingAST()
- : using_token(0)
- , typename_token(0)
- , name(0)
- , semicolon_token(0)
- , symbol(0)
- {}
-
virtual UsingAST *asUsing() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual UsingAST *clone(MemoryPool *pool) const;
@@ -3662,27 +2837,19 @@ protected:
class CPLUSPLUS_EXPORT UsingDirectiveAST: public DeclarationAST
{
public:
- unsigned using_token;
- unsigned namespace_token;
- NameAST *name;
- unsigned semicolon_token;
+ int using_token = 0;
+ int namespace_token = 0;
+ NameAST *name = nullptr;
+ int semicolon_token = 0;
public:
- UsingNamespaceDirective *symbol;
+ UsingNamespaceDirective *symbol = nullptr;
public:
- UsingDirectiveAST()
- : using_token(0)
- , namespace_token(0)
- , name(0)
- , semicolon_token(0)
- , symbol(0)
- {}
-
virtual UsingDirectiveAST *asUsingDirective() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual UsingDirectiveAST *clone(MemoryPool *pool) const;
@@ -3694,29 +2861,20 @@ protected:
class CPLUSPLUS_EXPORT WhileStatementAST: public StatementAST
{
public:
- unsigned while_token;
- unsigned lparen_token;
- ExpressionAST *condition;
- unsigned rparen_token;
- StatementAST *statement;
+ int while_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *condition = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
+ Block *symbol = nullptr;
public:
- WhileStatementAST()
- : while_token(0)
- , lparen_token(0)
- , condition(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
-
virtual WhileStatementAST *asWhileStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual WhileStatementAST *clone(MemoryPool *pool) const;
@@ -3728,27 +2886,19 @@ protected:
class CPLUSPLUS_EXPORT ObjCClassForwardDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *attribute_list;
- unsigned class_token;
- NameListAST *identifier_list;
- unsigned semicolon_token;
+ SpecifierListAST *attribute_list = nullptr;
+ int class_token = 0;
+ NameListAST *identifier_list = nullptr;
+ int semicolon_token = 0;
public: // annotations
- List<ObjCForwardClassDeclaration *> *symbols;
+ List<ObjCForwardClassDeclaration *> *symbols = nullptr;
public:
- ObjCClassForwardDeclarationAST()
- : attribute_list(0)
- , class_token(0)
- , identifier_list(0)
- , semicolon_token(0)
- , symbols(0)
- {}
-
virtual ObjCClassForwardDeclarationAST *asObjCClassForwardDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCClassForwardDeclarationAST *clone(MemoryPool *pool) const;
@@ -3760,45 +2910,28 @@ protected:
class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *attribute_list;
- unsigned interface_token;
- unsigned implementation_token;
- NameAST *class_name;
- unsigned lparen_token;
- NameAST *category_name;
- unsigned rparen_token;
- unsigned colon_token;
- NameAST *superclass;
- ObjCProtocolRefsAST *protocol_refs;
- ObjCInstanceVariablesDeclarationAST *inst_vars_decl;
- DeclarationListAST *member_declaration_list;
- unsigned end_token;
+ SpecifierListAST *attribute_list = nullptr;
+ int interface_token = 0;
+ int implementation_token = 0;
+ NameAST *class_name = nullptr;
+ int lparen_token = 0;
+ NameAST *category_name = nullptr;
+ int rparen_token = 0;
+ int colon_token = 0;
+ NameAST *superclass = nullptr;
+ ObjCProtocolRefsAST *protocol_refs = nullptr;
+ ObjCInstanceVariablesDeclarationAST *inst_vars_decl = nullptr;
+ DeclarationListAST *member_declaration_list = nullptr;
+ int end_token = 0;
public: // annotations
- ObjCClass *symbol;
-
-public:
- ObjCClassDeclarationAST()
- : attribute_list(0)
- , interface_token(0)
- , implementation_token(0)
- , class_name(0)
- , lparen_token(0)
- , category_name(0)
- , rparen_token(0)
- , colon_token(0)
- , superclass(0)
- , protocol_refs(0)
- , inst_vars_decl(0)
- , member_declaration_list(0)
- , end_token(0)
- , symbol(0)
- {}
+ ObjCClass *symbol = nullptr;
+public:
virtual ObjCClassDeclarationAST *asObjCClassDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCClassDeclarationAST *clone(MemoryPool *pool) const;
@@ -3810,27 +2943,19 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocolForwardDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *attribute_list;
- unsigned protocol_token;
- NameListAST *identifier_list;
- unsigned semicolon_token;
+ SpecifierListAST *attribute_list = nullptr;
+ int protocol_token = 0;
+ NameListAST *identifier_list = nullptr;
+ int semicolon_token = 0;
public: // annotations
- List<ObjCForwardProtocolDeclaration *> *symbols;
+ List<ObjCForwardProtocolDeclaration *> *symbols = nullptr;
public:
- ObjCProtocolForwardDeclarationAST()
- : attribute_list(0)
- , protocol_token(0)
- , identifier_list(0)
- , semicolon_token(0)
- , symbols(0)
- {}
-
virtual ObjCProtocolForwardDeclarationAST *asObjCProtocolForwardDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCProtocolForwardDeclarationAST *clone(MemoryPool *pool) const;
@@ -3842,31 +2967,21 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocolDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *attribute_list;
- unsigned protocol_token;
- NameAST *name;
- ObjCProtocolRefsAST *protocol_refs;
- DeclarationListAST *member_declaration_list;
- unsigned end_token;
+ SpecifierListAST *attribute_list = nullptr;
+ int protocol_token = 0;
+ NameAST *name = nullptr;
+ ObjCProtocolRefsAST *protocol_refs = nullptr;
+ DeclarationListAST *member_declaration_list = nullptr;
+ int end_token = 0;
public: // annotations
- ObjCProtocol *symbol;
+ ObjCProtocol *symbol = nullptr;
public:
- ObjCProtocolDeclarationAST()
- : attribute_list(0)
- , protocol_token(0)
- , name(0)
- , protocol_refs(0)
- , member_declaration_list(0)
- , end_token(0)
- , symbol(0)
- {}
-
virtual ObjCProtocolDeclarationAST *asObjCProtocolDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCProtocolDeclarationAST *clone(MemoryPool *pool) const;
@@ -3878,21 +2993,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocolRefsAST: public AST
{
public:
- unsigned less_token;
- NameListAST *identifier_list;
- unsigned greater_token;
+ int less_token = 0;
+ NameListAST *identifier_list = nullptr;
+ int greater_token = 0;
public:
- ObjCProtocolRefsAST()
- : less_token(0)
- , identifier_list(0)
- , greater_token(0)
- {}
-
virtual ObjCProtocolRefsAST *asObjCProtocolRefs() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCProtocolRefsAST *clone(MemoryPool *pool) const;
@@ -3904,17 +3013,13 @@ protected:
class CPLUSPLUS_EXPORT ObjCMessageArgumentAST: public AST
{
public:
- ExpressionAST *parameter_value_expression;
+ ExpressionAST *parameter_value_expression = nullptr;
public:
- ObjCMessageArgumentAST()
- : parameter_value_expression(0)
- {}
-
virtual ObjCMessageArgumentAST *asObjCMessageArgument() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCMessageArgumentAST *clone(MemoryPool *pool) const;
@@ -3926,25 +3031,17 @@ protected:
class CPLUSPLUS_EXPORT ObjCMessageExpressionAST: public ExpressionAST
{
public:
- unsigned lbracket_token;
- ExpressionAST *receiver_expression;
- ObjCSelectorAST *selector;
- ObjCMessageArgumentListAST *argument_list;
- unsigned rbracket_token;
+ int lbracket_token = 0;
+ ExpressionAST *receiver_expression = nullptr;
+ ObjCSelectorAST *selector = nullptr;
+ ObjCMessageArgumentListAST *argument_list = nullptr;
+ int rbracket_token = 0;
public:
- ObjCMessageExpressionAST()
- : lbracket_token(0)
- , receiver_expression(0)
- , selector(0)
- , argument_list(0)
- , rbracket_token(0)
- {}
-
virtual ObjCMessageExpressionAST *asObjCMessageExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCMessageExpressionAST *clone(MemoryPool *pool) const;
@@ -3956,23 +3053,16 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocolExpressionAST: public ExpressionAST
{
public:
- unsigned protocol_token;
- unsigned lparen_token;
- unsigned identifier_token;
- unsigned rparen_token;
+ int protocol_token = 0;
+ int lparen_token = 0;
+ int identifier_token = 0;
+ int rparen_token = 0;
public:
- ObjCProtocolExpressionAST()
- : protocol_token(0)
- , lparen_token(0)
- , identifier_token(0)
- , rparen_token(0)
- {}
-
virtual ObjCProtocolExpressionAST *asObjCProtocolExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCProtocolExpressionAST *clone(MemoryPool *pool) const;
@@ -3984,23 +3074,16 @@ protected:
class CPLUSPLUS_EXPORT ObjCTypeNameAST: public AST
{
public:
- unsigned lparen_token;
- unsigned type_qualifier_token;
- ExpressionAST *type_id;
- unsigned rparen_token;
+ int lparen_token = 0;
+ int type_qualifier_token = 0;
+ ExpressionAST *type_id = nullptr;
+ int rparen_token = 0;
public:
- ObjCTypeNameAST()
- : lparen_token(0)
- , type_qualifier_token(0)
- , type_id(0)
- , rparen_token(0)
- {}
-
virtual ObjCTypeNameAST *asObjCTypeName() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCTypeNameAST *clone(MemoryPool *pool) const;
@@ -4012,19 +3095,14 @@ protected:
class CPLUSPLUS_EXPORT ObjCEncodeExpressionAST: public ExpressionAST
{
public:
- unsigned encode_token;
- ObjCTypeNameAST *type_name;
+ int encode_token = 0;
+ ObjCTypeNameAST *type_name = nullptr;
public:
- ObjCEncodeExpressionAST()
- : encode_token(0)
- , type_name(0)
- {}
-
virtual ObjCEncodeExpressionAST *asObjCEncodeExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCEncodeExpressionAST *clone(MemoryPool *pool) const;
@@ -4036,23 +3114,16 @@ protected:
class CPLUSPLUS_EXPORT ObjCSelectorExpressionAST: public ExpressionAST
{
public:
- unsigned selector_token;
- unsigned lparen_token;
- ObjCSelectorAST *selector;
- unsigned rparen_token;
+ int selector_token = 0;
+ int lparen_token = 0;
+ ObjCSelectorAST *selector = nullptr;
+ int rparen_token = 0;
public:
- ObjCSelectorExpressionAST()
- : selector_token(0)
- , lparen_token(0)
- , selector(0)
- , rparen_token(0)
- {}
-
virtual ObjCSelectorExpressionAST *asObjCSelectorExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSelectorExpressionAST *clone(MemoryPool *pool) const;
@@ -4064,21 +3135,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCInstanceVariablesDeclarationAST: public AST
{
public:
- unsigned lbrace_token;
- DeclarationListAST *instance_variable_list;
- unsigned rbrace_token;
+ int lbrace_token = 0;
+ DeclarationListAST *instance_variable_list = nullptr;
+ int rbrace_token = 0;
public:
- ObjCInstanceVariablesDeclarationAST()
- : lbrace_token(0)
- , instance_variable_list(0)
- , rbrace_token(0)
- {}
-
virtual ObjCInstanceVariablesDeclarationAST *asObjCInstanceVariablesDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCInstanceVariablesDeclarationAST *clone(MemoryPool *pool) const;
@@ -4090,17 +3155,13 @@ protected:
class CPLUSPLUS_EXPORT ObjCVisibilityDeclarationAST: public DeclarationAST
{
public:
- unsigned visibility_token;
+ int visibility_token = 0;
public:
- ObjCVisibilityDeclarationAST()
- : visibility_token(0)
- {}
-
virtual ObjCVisibilityDeclarationAST *asObjCVisibilityDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCVisibilityDeclarationAST *clone(MemoryPool *pool) const;
@@ -4112,21 +3173,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCPropertyAttributeAST: public AST
{
public:
- unsigned attribute_identifier_token;
- unsigned equals_token;
- ObjCSelectorAST *method_selector;
+ int attribute_identifier_token = 0;
+ int equals_token = 0;
+ ObjCSelectorAST *method_selector = nullptr;
public:
- ObjCPropertyAttributeAST()
- : attribute_identifier_token(0)
- , equals_token(0)
- , method_selector(0)
- {}
-
virtual ObjCPropertyAttributeAST *asObjCPropertyAttribute() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCPropertyAttributeAST *clone(MemoryPool *pool) const;
@@ -4138,31 +3193,21 @@ protected:
class CPLUSPLUS_EXPORT ObjCPropertyDeclarationAST: public DeclarationAST
{
public:
- SpecifierListAST *attribute_list;
- unsigned property_token;
- unsigned lparen_token;
- ObjCPropertyAttributeListAST *property_attribute_list;
- unsigned rparen_token;
- DeclarationAST *simple_declaration;
+ SpecifierListAST *attribute_list = nullptr;
+ int property_token = 0;
+ int lparen_token = 0;
+ ObjCPropertyAttributeListAST *property_attribute_list = nullptr;
+ int rparen_token = 0;
+ DeclarationAST *simple_declaration = nullptr;
public: // annotations
- List<ObjCPropertyDeclaration *> *symbols;
+ List<ObjCPropertyDeclaration *> *symbols = nullptr;
public:
- ObjCPropertyDeclarationAST()
- : attribute_list(0)
- , property_token(0)
- , lparen_token(0)
- , property_attribute_list(0)
- , rparen_token(0)
- , simple_declaration(0)
- , symbols(0)
- {}
-
virtual ObjCPropertyDeclarationAST *asObjCPropertyDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCPropertyDeclarationAST *clone(MemoryPool *pool) const;
@@ -4174,25 +3219,18 @@ protected:
class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationAST: public AST
{
public:
- ObjCTypeNameAST* type_name;
- SpecifierListAST *attribute_list;
- NameAST *param_name;
+ ObjCTypeNameAST *type_name = nullptr;
+ SpecifierListAST *attribute_list = nullptr;
+ NameAST *param_name = nullptr;
public: // annotations
- Argument *argument;
+ Argument *argument = nullptr;
public:
- ObjCMessageArgumentDeclarationAST()
- : type_name(0)
- , attribute_list(0)
- , param_name(0)
- , argument(0)
- {}
-
virtual ObjCMessageArgumentDeclarationAST *asObjCMessageArgumentDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCMessageArgumentDeclarationAST *clone(MemoryPool *pool) const;
@@ -4204,31 +3242,21 @@ protected:
class CPLUSPLUS_EXPORT ObjCMethodPrototypeAST: public AST
{
public:
- unsigned method_type_token;
- ObjCTypeNameAST *type_name;
- ObjCSelectorAST *selector;
- ObjCMessageArgumentDeclarationListAST *argument_list;
- unsigned dot_dot_dot_token;
- SpecifierListAST *attribute_list;
+ int method_type_token = 0;
+ ObjCTypeNameAST *type_name = nullptr;
+ ObjCSelectorAST *selector = nullptr;
+ ObjCMessageArgumentDeclarationListAST *argument_list = nullptr;
+ int dot_dot_dot_token = 0;
+ SpecifierListAST *attribute_list = nullptr;
public: // annotations
- ObjCMethod *symbol;
+ ObjCMethod *symbol = nullptr;
public:
- ObjCMethodPrototypeAST()
- : method_type_token(0)
- , type_name(0)
- , selector(0)
- , argument_list(0)
- , dot_dot_dot_token(0)
- , attribute_list(0)
- , symbol(0)
- {}
-
virtual ObjCMethodPrototypeAST *asObjCMethodPrototype() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCMethodPrototypeAST *clone(MemoryPool *pool) const;
@@ -4240,21 +3268,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCMethodDeclarationAST: public DeclarationAST
{
public:
- ObjCMethodPrototypeAST *method_prototype;
- StatementAST *function_body;
- unsigned semicolon_token;
+ ObjCMethodPrototypeAST *method_prototype = nullptr;
+ StatementAST *function_body = nullptr;
+ int semicolon_token = 0;
public:
- ObjCMethodDeclarationAST()
- : method_prototype(0)
- , function_body(0)
- , semicolon_token(0)
- {}
-
virtual ObjCMethodDeclarationAST *asObjCMethodDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCMethodDeclarationAST *clone(MemoryPool *pool) const;
@@ -4266,21 +3288,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyAST: public AST
{
public:
- unsigned property_identifier_token;
- unsigned equals_token;
- unsigned alias_identifier_token;
+ int property_identifier_token = 0;
+ int equals_token = 0;
+ int alias_identifier_token = 0;
public:
- ObjCSynthesizedPropertyAST()
- : property_identifier_token(0)
- , equals_token(0)
- , alias_identifier_token(0)
- {}
-
virtual ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSynthesizedPropertyAST *clone(MemoryPool *pool) const;
@@ -4292,21 +3308,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCSynthesizedPropertiesDeclarationAST: public DeclarationAST
{
public:
- unsigned synthesized_token;
- ObjCSynthesizedPropertyListAST *property_identifier_list;
- unsigned semicolon_token;
+ int synthesized_token = 0;
+ ObjCSynthesizedPropertyListAST *property_identifier_list = nullptr;
+ int semicolon_token = 0;
public:
- ObjCSynthesizedPropertiesDeclarationAST()
- : synthesized_token(0)
- , property_identifier_list(0)
- , semicolon_token(0)
- {}
-
virtual ObjCSynthesizedPropertiesDeclarationAST *asObjCSynthesizedPropertiesDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSynthesizedPropertiesDeclarationAST *clone(MemoryPool *pool) const;
@@ -4318,21 +3328,15 @@ protected:
class CPLUSPLUS_EXPORT ObjCDynamicPropertiesDeclarationAST: public DeclarationAST
{
public:
- unsigned dynamic_token;
- NameListAST *property_identifier_list;
- unsigned semicolon_token;
+ int dynamic_token = 0;
+ NameListAST *property_identifier_list = nullptr;
+ int semicolon_token = 0;
public:
- ObjCDynamicPropertiesDeclarationAST()
- : dynamic_token(0)
- , property_identifier_list(0)
- , semicolon_token(0)
- {}
-
virtual ObjCDynamicPropertiesDeclarationAST *asObjCDynamicPropertiesDeclaration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCDynamicPropertiesDeclarationAST *clone(MemoryPool *pool) const;
@@ -4344,41 +3348,28 @@ protected:
class CPLUSPLUS_EXPORT ObjCFastEnumerationAST: public StatementAST
{
public:
- unsigned for_token;
- unsigned lparen_token;
+ int for_token = 0;
+ int lparen_token = 0;
// declaration
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
// or an expression
- ExpressionAST *initializer;
+ ExpressionAST *initializer = nullptr;
- unsigned in_token;
- ExpressionAST *fast_enumeratable_expression;
- unsigned rparen_token;
- StatementAST *statement;
+ int in_token = 0;
+ ExpressionAST *fast_enumeratable_expression = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public: // annotations
- Block *symbol;
-
-public:
- ObjCFastEnumerationAST()
- : for_token(0)
- , lparen_token(0)
- , type_specifier_list(0)
- , declarator(0)
- , initializer(0)
- , in_token(0)
- , fast_enumeratable_expression(0)
- , rparen_token(0)
- , statement(0)
- , symbol(0)
- {}
+ Block *symbol = nullptr;
+public:
virtual ObjCFastEnumerationAST *asObjCFastEnumeration() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCFastEnumerationAST *clone(MemoryPool *pool) const;
@@ -4390,25 +3381,17 @@ protected:
class CPLUSPLUS_EXPORT ObjCSynchronizedStatementAST: public StatementAST
{
public:
- unsigned synchronized_token;
- unsigned lparen_token;
- ExpressionAST *synchronized_object;
- unsigned rparen_token;
- StatementAST *statement;
+ int synchronized_token = 0;
+ int lparen_token = 0;
+ ExpressionAST *synchronized_object = nullptr;
+ int rparen_token = 0;
+ StatementAST *statement = nullptr;
public:
- ObjCSynchronizedStatementAST()
- : synchronized_token(0)
- , lparen_token(0)
- , synchronized_object(0)
- , rparen_token(0)
- , statement(0)
- {}
-
virtual ObjCSynchronizedStatementAST *asObjCSynchronizedStatement() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual ObjCSynchronizedStatementAST *clone(MemoryPool *pool) const;
@@ -4421,21 +3404,15 @@ protected:
class LambdaExpressionAST: public ExpressionAST
{
public:
- LambdaIntroducerAST *lambda_introducer;
- LambdaDeclaratorAST *lambda_declarator;
- StatementAST *statement;
+ LambdaIntroducerAST *lambda_introducer = nullptr;
+ LambdaDeclaratorAST *lambda_declarator = nullptr;
+ StatementAST *statement = nullptr;
public:
- LambdaExpressionAST()
- : lambda_introducer(0)
- , lambda_declarator(0)
- , statement(0)
- {}
-
virtual LambdaExpressionAST *asLambdaExpression() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LambdaExpressionAST *clone(MemoryPool *pool) const;
protected:
@@ -4446,20 +3423,14 @@ protected:
class LambdaIntroducerAST: public AST
{
public:
- unsigned lbracket_token;
- LambdaCaptureAST *lambda_capture;
- unsigned rbracket_token;
+ int lbracket_token = 0;
+ LambdaCaptureAST *lambda_capture = nullptr;
+ int rbracket_token = 0;
public:
- LambdaIntroducerAST()
- : lbracket_token(0)
- , lambda_capture(0)
- , rbracket_token(0)
- {}
-
virtual LambdaIntroducerAST *asLambdaIntroducer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LambdaIntroducerAST *clone(MemoryPool *pool) const;
@@ -4471,18 +3442,13 @@ protected:
class LambdaCaptureAST: public AST
{
public:
- unsigned default_capture_token;
- CaptureListAST *capture_list;
+ int default_capture_token = 0;
+ CaptureListAST *capture_list = nullptr;
public:
- LambdaCaptureAST()
- : default_capture_token(0)
- , capture_list(0)
- {}
-
virtual LambdaCaptureAST *asLambdaCapture() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LambdaCaptureAST *clone(MemoryPool *pool) const;
@@ -4494,18 +3460,13 @@ protected:
class CaptureAST: public AST
{
public:
- unsigned amper_token;
- NameAST *identifier;
+ int amper_token = 0;
+ NameAST *identifier = nullptr;
public:
- CaptureAST()
- : amper_token(0)
- , identifier(0)
- {}
-
virtual CaptureAST *asCapture() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual CaptureAST *clone(MemoryPool *pool) const;
@@ -4517,32 +3478,21 @@ protected:
class LambdaDeclaratorAST: public AST
{
public:
- unsigned lparen_token;
- ParameterDeclarationClauseAST *parameter_declaration_clause;
- unsigned rparen_token;
- SpecifierListAST *attributes;
- unsigned mutable_token;
- ExceptionSpecificationAST *exception_specification;
- TrailingReturnTypeAST *trailing_return_type;
+ int lparen_token = 0;
+ ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr;
+ int rparen_token = 0;
+ SpecifierListAST *attributes = nullptr;
+ int mutable_token = 0;
+ ExceptionSpecificationAST *exception_specification = nullptr;
+ TrailingReturnTypeAST *trailing_return_type = nullptr;
public: // annotations
- Function *symbol;
+ Function *symbol = nullptr;
public:
- LambdaDeclaratorAST()
- : lparen_token(0)
- , parameter_declaration_clause(0)
- , rparen_token(0)
- , attributes(0)
- , mutable_token(0)
- , exception_specification(0)
- , trailing_return_type(0)
- , symbol(0)
- {}
-
virtual LambdaDeclaratorAST *asLambdaDeclarator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual LambdaDeclaratorAST *clone(MemoryPool *pool) const;
@@ -4554,22 +3504,15 @@ protected:
class TrailingReturnTypeAST: public AST
{
public:
- unsigned arrow_token;
- SpecifierListAST *attributes;
- SpecifierListAST *type_specifier_list;
- DeclaratorAST *declarator;
+ int arrow_token = 0;
+ SpecifierListAST *attributes = nullptr;
+ SpecifierListAST *type_specifier_list = nullptr;
+ DeclaratorAST *declarator = nullptr;
public:
- TrailingReturnTypeAST()
- : arrow_token(0)
- , attributes(0)
- , type_specifier_list(0)
- , declarator(0)
- {}
-
virtual TrailingReturnTypeAST *asTrailingReturnType() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual TrailingReturnTypeAST *clone(MemoryPool *pool) const;
@@ -4581,22 +3524,15 @@ protected:
class BracedInitializerAST: public ExpressionAST
{
public:
- unsigned lbrace_token;
- ExpressionListAST *expression_list;
- unsigned comma_token;
- unsigned rbrace_token;
+ int lbrace_token = 0;
+ ExpressionListAST *expression_list = nullptr;
+ int comma_token = 0;
+ int rbrace_token = 0;
public:
- BracedInitializerAST()
- : lbrace_token(0)
- , expression_list(0)
- , comma_token(0)
- , rbrace_token(0)
- {}
-
virtual BracedInitializerAST *asBracedInitializer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BracedInitializerAST *clone(MemoryPool *pool) const;
@@ -4608,9 +3544,6 @@ protected:
class DesignatorAST: public AST
{
public:
- DesignatorAST()
- {}
-
virtual DesignatorAST *asDesignator() { return this; }
virtual DesignatorAST *clone(MemoryPool *pool) const = 0;
};
@@ -4618,17 +3551,13 @@ public:
class DotDesignatorAST: public DesignatorAST
{
public:
- unsigned dot_token;
- unsigned identifier_token;
-public:
- DotDesignatorAST()
- : dot_token(0)
- , identifier_token(0)
- {}
+ int dot_token = 0;
+ int identifier_token = 0;
+public:
virtual DotDesignatorAST *asDotDesignator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DotDesignatorAST *clone(MemoryPool *pool) const;
@@ -4640,19 +3569,14 @@ protected:
class BracketDesignatorAST: public DesignatorAST
{
public:
- unsigned lbracket_token;
- ExpressionAST *expression;
- unsigned rbracket_token;
-public:
- BracketDesignatorAST()
- : lbracket_token(0)
- , expression(0)
- , rbracket_token(0)
- {}
+ int lbracket_token = 0;
+ ExpressionAST *expression = nullptr;
+ int rbracket_token = 0;
+public:
virtual BracketDesignatorAST *asBracketDesignator() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual BracketDesignatorAST *clone(MemoryPool *pool) const;
@@ -4664,20 +3588,14 @@ protected:
class DesignatedInitializerAST: public ExpressionAST
{
public:
- DesignatorListAST *designator_list;
- unsigned equal_token;
- ExpressionAST *initializer;
+ DesignatorListAST *designator_list = nullptr;
+ int equal_token = 0;
+ ExpressionAST *initializer = nullptr;
public:
- DesignatedInitializerAST()
- : designator_list(0)
- , equal_token(0)
- , initializer(0)
- {}
-
virtual DesignatedInitializerAST *asDesignatedInitializer() { return this; }
- virtual unsigned firstToken() const;
- virtual unsigned lastToken() const;
+ virtual int firstToken() const;
+ virtual int lastToken() const;
virtual DesignatedInitializerAST *clone(MemoryPool *pool) const;
diff --git a/src/libs/3rdparty/cplusplus/ASTClone.cpp b/src/libs/3rdparty/cplusplus/ASTClone.cpp
index 17a1af18d9..65350e3eab 100644
--- a/src/libs/3rdparty/cplusplus/ASTClone.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTClone.cpp
@@ -44,7 +44,7 @@ ObjCSelectorAST *ObjCSelectorAST::clone(MemoryPool *pool) const
ObjCSelectorAST *ast = new (pool) ObjCSelectorAST;
for (ObjCSelectorArgumentListAST *iter = selector_argument_list, **ast_iter = &ast->selector_argument_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ObjCSelectorArgumentListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ObjCSelectorArgumentListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -75,7 +75,7 @@ GnuAttributeSpecifierAST *GnuAttributeSpecifierAST::clone(MemoryPool *pool) cons
ast->second_lparen_token = second_lparen_token;
for (GnuAttributeListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) GnuAttributeListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) GnuAttributeListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->first_rparen_token = first_rparen_token;
ast->second_rparen_token = second_rparen_token;
return ast;
@@ -89,7 +89,7 @@ GnuAttributeAST *GnuAttributeAST::clone(MemoryPool *pool) const
ast->tag_token = tag_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -121,18 +121,18 @@ DeclaratorAST *DeclaratorAST::clone(MemoryPool *pool) const
DeclaratorAST *ast = new (pool) DeclaratorAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (core_declarator)
ast->core_declarator = core_declarator->clone(pool);
for (PostfixDeclaratorListAST *iter = postfix_declarator_list, **ast_iter = &ast->postfix_declarator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) PostfixDeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) PostfixDeclaratorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (SpecifierListAST *iter = post_attribute_list, **ast_iter = &ast->post_attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->equal_token = equal_token;
if (initializer)
ast->initializer = initializer->clone(pool);
@@ -145,10 +145,10 @@ SimpleDeclarationAST *SimpleDeclarationAST::clone(MemoryPool *pool) const
ast->qt_invokable_token = qt_invokable_token;
for (SpecifierListAST *iter = decl_specifier_list, **ast_iter = &ast->decl_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (DeclaratorListAST *iter = declarator_list, **ast_iter = &ast->declarator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclaratorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->semicolon_token = semicolon_token;
return ast;
}
@@ -187,7 +187,7 @@ QtPrivateSlotAST *QtPrivateSlotAST::clone(MemoryPool *pool) const
ast->comma_token = comma_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
ast->rparen_token = rparen_token;
@@ -217,7 +217,7 @@ QtPropertyDeclarationAST *QtPropertyDeclarationAST::clone(MemoryPool *pool) cons
ast->property_name = property_name->clone(pool);
for (QtPropertyDeclarationItemListAST *iter = property_declaration_item_list, **ast_iter = &ast->property_declaration_item_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) QtPropertyDeclarationItemListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) QtPropertyDeclarationItemListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -229,7 +229,7 @@ QtEnumDeclarationAST *QtEnumDeclarationAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (NameListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -241,7 +241,7 @@ QtFlagsDeclarationAST *QtFlagsDeclarationAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (NameListAST *iter = flag_enums_list, **ast_iter = &ast->flag_enums_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -253,7 +253,7 @@ QtInterfaceNameAST *QtInterfaceNameAST::clone(MemoryPool *pool) const
ast->interface_name = interface_name->clone(pool);
for (NameListAST *iter = constraint_list, **ast_iter = &ast->constraint_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -264,7 +264,7 @@ QtInterfacesDeclarationAST *QtInterfacesDeclarationAST::clone(MemoryPool *pool)
ast->lparen_token = lparen_token;
for (QtInterfaceNameListAST *iter = interface_name_list, **ast_iter = &ast->interface_name_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) QtInterfaceNameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) QtInterfaceNameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -372,19 +372,19 @@ ClassSpecifierAST *ClassSpecifierAST::clone(MemoryPool *pool) const
ast->classkey_token = classkey_token;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (name)
ast->name = name->clone(pool);
ast->final_token = final_token;
ast->colon_token = colon_token;
for (BaseSpecifierListAST *iter = base_clause_list, **ast_iter = &ast->base_clause_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) BaseSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) BaseSpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->dot_dot_dot_token = dot_dot_dot_token;
ast->lbrace_token = lbrace_token;
for (DeclarationListAST *iter = member_specifier_list, **ast_iter = &ast->member_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbrace_token = rbrace_token;
return ast;
}
@@ -407,7 +407,7 @@ CompoundStatementAST *CompoundStatementAST::clone(MemoryPool *pool) const
ast->lbrace_token = lbrace_token;
for (StatementListAST *iter = statement_list, **ast_iter = &ast->statement_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) StatementListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) StatementListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbrace_token = rbrace_token;
return ast;
}
@@ -417,7 +417,7 @@ ConditionAST *ConditionAST::clone(MemoryPool *pool) const
ConditionAST *ast = new (pool) ConditionAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
return ast;
@@ -458,7 +458,7 @@ CtorInitializerAST *CtorInitializerAST::clone(MemoryPool *pool) const
ast->colon_token = colon_token;
for (MemInitializerListAST *iter = member_initializer_list, **ast_iter = &ast->member_initializer_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) MemInitializerListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) MemInitializerListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->dot_dot_dot_token = dot_dot_dot_token;
return ast;
}
@@ -499,7 +499,7 @@ FunctionDeclaratorAST *FunctionDeclaratorAST::clone(MemoryPool *pool) const
ast->rparen_token = rparen_token;
for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->ref_qualifier_token = ref_qualifier_token;
if (exception_specification)
ast->exception_specification = exception_specification->clone(pool);
@@ -561,7 +561,7 @@ ElaboratedTypeSpecifierAST *ElaboratedTypeSpecifierAST::clone(MemoryPool *pool)
ast->classkey_token = classkey_token;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (name)
ast->name = name->clone(pool);
return ast;
@@ -577,11 +577,11 @@ EnumSpecifierAST *EnumSpecifierAST::clone(MemoryPool *pool) const
ast->colon_token = colon_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->lbrace_token = lbrace_token;
for (EnumeratorListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) EnumeratorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) EnumeratorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->stray_comma_token = stray_comma_token;
ast->rbrace_token = rbrace_token;
return ast;
@@ -602,7 +602,7 @@ ExceptionDeclarationAST *ExceptionDeclarationAST::clone(MemoryPool *pool) const
ExceptionDeclarationAST *ast = new (pool) ExceptionDeclarationAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
ast->dot_dot_dot_token = dot_dot_dot_token;
@@ -617,7 +617,7 @@ DynamicExceptionSpecificationAST *DynamicExceptionSpecificationAST::clone(Memory
ast->dot_dot_dot_token = dot_dot_dot_token;
for (ExpressionListAST *iter = type_id_list, **ast_iter = &ast->type_id_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -658,7 +658,7 @@ FunctionDefinitionAST *FunctionDefinitionAST::clone(MemoryPool *pool) const
ast->qt_invokable_token = qt_invokable_token;
for (SpecifierListAST *iter = decl_specifier_list, **ast_iter = &ast->decl_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
if (ctor_initializer)
@@ -675,7 +675,7 @@ ForeachStatementAST *ForeachStatementAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
if (initializer)
@@ -696,7 +696,7 @@ RangeBasedForStatementAST *RangeBasedForStatementAST::clone(MemoryPool *pool) co
ast->lparen_token = lparen_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
ast->colon_token = colon_token;
@@ -748,7 +748,7 @@ ArrayInitializerAST *ArrayInitializerAST::clone(MemoryPool *pool) const
ast->lbrace_token = lbrace_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbrace_token = rbrace_token;
return ast;
}
@@ -769,7 +769,7 @@ LinkageBodyAST *LinkageBodyAST::clone(MemoryPool *pool) const
ast->lbrace_token = lbrace_token;
for (DeclarationListAST *iter = declaration_list, **ast_iter = &ast->declaration_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbrace_token = rbrace_token;
return ast;
}
@@ -809,7 +809,7 @@ QualifiedNameAST *QualifiedNameAST::clone(MemoryPool *pool) const
ast->global_scope_token = global_scope_token;
for (NestedNameSpecifierListAST *iter = nested_name_specifier_list, **ast_iter = &ast->nested_name_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (unqualified_name)
ast->unqualified_name = unqualified_name->clone(pool);
return ast;
@@ -830,10 +830,10 @@ ConversionFunctionIdAST *ConversionFunctionIdAST::clone(MemoryPool *pool) const
ast->operator_token = operator_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -868,7 +868,7 @@ TemplateIdAST *TemplateIdAST::clone(MemoryPool *pool) const
ast->less_token = less_token;
for (ExpressionListAST *iter = template_argument_list, **ast_iter = &ast->template_argument_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->greater_token = greater_token;
return ast;
}
@@ -881,7 +881,7 @@ NamespaceAST *NamespaceAST::clone(MemoryPool *pool) const
ast->identifier_token = identifier_token;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (linkage_body)
ast->linkage_body = linkage_body->clone(pool);
return ast;
@@ -918,7 +918,7 @@ ExpressionListParenAST *ExpressionListParenAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -956,13 +956,13 @@ NewTypeIdAST *NewTypeIdAST::clone(MemoryPool *pool) const
NewTypeIdAST *ast = new (pool) NewTypeIdAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (NewArrayDeclaratorListAST *iter = new_array_declarator_list, **ast_iter = &ast->new_array_declarator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NewArrayDeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NewArrayDeclaratorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -980,7 +980,7 @@ ParameterDeclarationAST *ParameterDeclarationAST::clone(MemoryPool *pool) const
ParameterDeclarationAST *ast = new (pool) ParameterDeclarationAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
ast->equal_token = equal_token;
@@ -994,7 +994,7 @@ ParameterDeclarationClauseAST *ParameterDeclarationClauseAST::clone(MemoryPool *
ParameterDeclarationClauseAST *ast = new (pool) ParameterDeclarationClauseAST;
for (ParameterDeclarationListAST *iter = parameter_declaration_list, **ast_iter = &ast->parameter_declaration_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ParameterDeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ParameterDeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->dot_dot_dot_token = dot_dot_dot_token;
return ast;
}
@@ -1007,7 +1007,7 @@ CallAST *CallAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
return ast;
}
@@ -1072,7 +1072,7 @@ TypeConstructorCallAST *TypeConstructorCallAST::clone(MemoryPool *pool) const
TypeConstructorCallAST *ast = new (pool) TypeConstructorCallAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (expression)
ast->expression = expression->clone(pool);
return ast;
@@ -1084,11 +1084,11 @@ PointerToMemberAST *PointerToMemberAST::clone(MemoryPool *pool) const
ast->global_scope_token = global_scope_token;
for (NestedNameSpecifierListAST *iter = nested_name_specifier_list, **ast_iter = &ast->nested_name_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->star_token = star_token;
for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->ref_qualifier_token = ref_qualifier_token;
return ast;
}
@@ -1099,7 +1099,7 @@ PointerAST *PointerAST::clone(MemoryPool *pool) const
ast->star_token = star_token;
for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -1251,7 +1251,7 @@ TemplateDeclarationAST *TemplateDeclarationAST::clone(MemoryPool *pool) const
ast->less_token = less_token;
for (DeclarationListAST *iter = template_parameter_list, **ast_iter = &ast->template_parameter_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->greater_token = greater_token;
if (declaration)
ast->declaration = declaration->clone(pool);
@@ -1281,7 +1281,7 @@ TranslationUnitAST *TranslationUnitAST::clone(MemoryPool *pool) const
TranslationUnitAST *ast = new (pool) TranslationUnitAST;
for (DeclarationListAST *iter = declaration_list, **ast_iter = &ast->declaration_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -1293,7 +1293,7 @@ TryBlockStatementAST *TryBlockStatementAST::clone(MemoryPool *pool) const
ast->statement = statement->clone(pool);
for (CatchClauseListAST *iter = catch_clause_list, **ast_iter = &ast->catch_clause_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) CatchClauseListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) CatchClauseListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -1315,7 +1315,7 @@ TypeIdAST *TypeIdAST::clone(MemoryPool *pool) const
TypeIdAST *ast = new (pool) TypeIdAST;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
return ast;
@@ -1341,7 +1341,7 @@ TemplateTypeParameterAST *TemplateTypeParameterAST::clone(MemoryPool *pool) cons
ast->less_token = less_token;
for (DeclarationListAST *iter = template_parameter_list, **ast_iter = &ast->template_parameter_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->greater_token = greater_token;
ast->class_token = class_token;
ast->dot_dot_dot_token = dot_dot_dot_token;
@@ -1402,11 +1402,11 @@ ObjCClassForwardDeclarationAST *ObjCClassForwardDeclarationAST::clone(MemoryPool
ObjCClassForwardDeclarationAST *ast = new (pool) ObjCClassForwardDeclarationAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->class_token = class_token;
for (NameListAST *iter = identifier_list, **ast_iter = &ast->identifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->semicolon_token = semicolon_token;
return ast;
}
@@ -1416,7 +1416,7 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
ObjCClassDeclarationAST *ast = new (pool) ObjCClassDeclarationAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->interface_token = interface_token;
ast->implementation_token = implementation_token;
if (class_name)
@@ -1434,7 +1434,7 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
ast->inst_vars_decl = inst_vars_decl->clone(pool);
for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->end_token = end_token;
return ast;
}
@@ -1444,11 +1444,11 @@ ObjCProtocolForwardDeclarationAST *ObjCProtocolForwardDeclarationAST::clone(Memo
ObjCProtocolForwardDeclarationAST *ast = new (pool) ObjCProtocolForwardDeclarationAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->protocol_token = protocol_token;
for (NameListAST *iter = identifier_list, **ast_iter = &ast->identifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->semicolon_token = semicolon_token;
return ast;
}
@@ -1458,7 +1458,7 @@ ObjCProtocolDeclarationAST *ObjCProtocolDeclarationAST::clone(MemoryPool *pool)
ObjCProtocolDeclarationAST *ast = new (pool) ObjCProtocolDeclarationAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->protocol_token = protocol_token;
if (name)
ast->name = name->clone(pool);
@@ -1466,7 +1466,7 @@ ObjCProtocolDeclarationAST *ObjCProtocolDeclarationAST::clone(MemoryPool *pool)
ast->protocol_refs = protocol_refs->clone(pool);
for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->end_token = end_token;
return ast;
}
@@ -1477,7 +1477,7 @@ ObjCProtocolRefsAST *ObjCProtocolRefsAST::clone(MemoryPool *pool) const
ast->less_token = less_token;
for (NameListAST *iter = identifier_list, **ast_iter = &ast->identifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->greater_token = greater_token;
return ast;
}
@@ -1500,7 +1500,7 @@ ObjCMessageExpressionAST *ObjCMessageExpressionAST::clone(MemoryPool *pool) cons
ast->selector = selector->clone(pool);
for (ObjCMessageArgumentListAST *iter = argument_list, **ast_iter = &ast->argument_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ObjCMessageArgumentListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ObjCMessageArgumentListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbracket_token = rbracket_token;
return ast;
}
@@ -1552,7 +1552,7 @@ ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclarationAST::clone(
ast->lbrace_token = lbrace_token;
for (DeclarationListAST *iter = instance_variable_list, **ast_iter = &ast->instance_variable_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rbrace_token = rbrace_token;
return ast;
}
@@ -1579,12 +1579,12 @@ ObjCPropertyDeclarationAST *ObjCPropertyDeclarationAST::clone(MemoryPool *pool)
ObjCPropertyDeclarationAST *ast = new (pool) ObjCPropertyDeclarationAST;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->property_token = property_token;
ast->lparen_token = lparen_token;
for (ObjCPropertyAttributeListAST *iter = property_attribute_list, **ast_iter = &ast->property_attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ObjCPropertyAttributeListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ObjCPropertyAttributeListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->rparen_token = rparen_token;
if (simple_declaration)
ast->simple_declaration = simple_declaration->clone(pool);
@@ -1598,7 +1598,7 @@ ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclarationAST::clone(Memo
ast->type_name = type_name->clone(pool);
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (param_name)
ast->param_name = param_name->clone(pool);
return ast;
@@ -1614,11 +1614,11 @@ ObjCMethodPrototypeAST *ObjCMethodPrototypeAST::clone(MemoryPool *pool) const
ast->selector = selector->clone(pool);
for (ObjCMessageArgumentDeclarationListAST *iter = argument_list, **ast_iter = &ast->argument_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ObjCMessageArgumentDeclarationListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ObjCMessageArgumentDeclarationListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->dot_dot_dot_token = dot_dot_dot_token;
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -1648,7 +1648,7 @@ ObjCSynthesizedPropertiesDeclarationAST *ObjCSynthesizedPropertiesDeclarationAST
ast->synthesized_token = synthesized_token;
for (ObjCSynthesizedPropertyListAST *iter = property_identifier_list, **ast_iter = &ast->property_identifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ObjCSynthesizedPropertyListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ObjCSynthesizedPropertyListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->semicolon_token = semicolon_token;
return ast;
}
@@ -1659,7 +1659,7 @@ ObjCDynamicPropertiesDeclarationAST *ObjCDynamicPropertiesDeclarationAST::clone(
ast->dynamic_token = dynamic_token;
for (NameListAST *iter = property_identifier_list, **ast_iter = &ast->property_identifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) NameListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->semicolon_token = semicolon_token;
return ast;
}
@@ -1671,7 +1671,7 @@ ObjCFastEnumerationAST *ObjCFastEnumerationAST::clone(MemoryPool *pool) const
ast->lparen_token = lparen_token;
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
if (initializer)
@@ -1726,7 +1726,7 @@ LambdaCaptureAST *LambdaCaptureAST::clone(MemoryPool *pool) const
ast->default_capture_token = default_capture_token;
for (CaptureListAST *iter = capture_list, **ast_iter = &ast->capture_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) CaptureListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) CaptureListAST((iter->value) ? iter->value->clone(pool) : nullptr);
return ast;
}
@@ -1748,7 +1748,7 @@ LambdaDeclaratorAST *LambdaDeclaratorAST::clone(MemoryPool *pool) const
ast->rparen_token = rparen_token;
for (SpecifierListAST *iter = attributes, **ast_iter = &ast->attributes;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->mutable_token = mutable_token;
if (exception_specification)
ast->exception_specification = exception_specification->clone(pool);
@@ -1763,10 +1763,10 @@ TrailingReturnTypeAST *TrailingReturnTypeAST::clone(MemoryPool *pool) const
ast->arrow_token = arrow_token;
for (SpecifierListAST *iter = attributes, **ast_iter = &ast->attributes;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : nullptr);
if (declarator)
ast->declarator = declarator->clone(pool);
return ast;
@@ -1778,7 +1778,7 @@ BracedInitializerAST *BracedInitializerAST::clone(MemoryPool *pool) const
ast->lbrace_token = lbrace_token;
for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->comma_token = comma_token;
ast->rbrace_token = rbrace_token;
return ast;
@@ -1807,7 +1807,7 @@ DesignatedInitializerAST *DesignatedInitializerAST::clone(MemoryPool *pool) cons
DesignatedInitializerAST *ast = new (pool) DesignatedInitializerAST;
for (DesignatorListAST *iter = designator_list, **ast_iter = &ast->designator_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) DesignatorListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) DesignatorListAST((iter->value) ? iter->value->clone(pool) : nullptr);
ast->equal_token = equal_token;
if (initializer)
ast->initializer = initializer->clone(pool);
diff --git a/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h b/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
index 9270a3429c..c2888b3e2e 100644
--- a/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
+++ b/src/libs/3rdparty/cplusplus/ASTPatternBuilder.h
@@ -49,7 +49,7 @@ public:
return ast;
}
- ObjCSelectorAST *ObjCSelector(ObjCSelectorArgumentListAST *selector_argument_list = 0)
+ ObjCSelectorAST *ObjCSelector(ObjCSelectorArgumentListAST *selector_argument_list = nullptr)
{
ObjCSelectorAST *ast = new (&pool) ObjCSelectorAST;
ast->selector_argument_list = selector_argument_list;
@@ -62,42 +62,42 @@ public:
return ast;
}
- AlignmentSpecifierAST *AlignmentSpecifier(ExpressionAST *typeIdExprOrAlignmentExpr = 0)
+ AlignmentSpecifierAST *AlignmentSpecifier(ExpressionAST *typeIdExprOrAlignmentExpr = nullptr)
{
AlignmentSpecifierAST *ast = new (&pool) AlignmentSpecifierAST;
ast->typeIdExprOrAlignmentExpr = typeIdExprOrAlignmentExpr;
return ast;
}
- GnuAttributeSpecifierAST *GnuAttributeSpecifier(GnuAttributeListAST *attribute_list = 0)
+ GnuAttributeSpecifierAST *GnuAttributeSpecifier(GnuAttributeListAST *attribute_list = nullptr)
{
GnuAttributeSpecifierAST *ast = new (&pool) GnuAttributeSpecifierAST;
ast->attribute_list = attribute_list;
return ast;
}
- GnuAttributeAST *GnuAttribute(ExpressionListAST *expression_list = 0)
+ GnuAttributeAST *GnuAttribute(ExpressionListAST *expression_list = nullptr)
{
GnuAttributeAST *ast = new (&pool) GnuAttributeAST;
ast->expression_list = expression_list;
return ast;
}
- TypeofSpecifierAST *TypeofSpecifier(ExpressionAST *expression = 0)
+ TypeofSpecifierAST *TypeofSpecifier(ExpressionAST *expression = nullptr)
{
TypeofSpecifierAST *ast = new (&pool) TypeofSpecifierAST;
ast->expression = expression;
return ast;
}
- DecltypeSpecifierAST *DecltypeSpecifier(ExpressionAST *expression = 0)
+ DecltypeSpecifierAST *DecltypeSpecifier(ExpressionAST *expression = nullptr)
{
DecltypeSpecifierAST *ast = new (&pool) DecltypeSpecifierAST;
ast->expression = expression;
return ast;
}
- DeclaratorAST *Declarator(SpecifierListAST *attribute_list = 0, PtrOperatorListAST *ptr_operator_list = 0, CoreDeclaratorAST *core_declarator = 0, PostfixDeclaratorListAST *postfix_declarator_list = 0, SpecifierListAST *post_attribute_list = 0, ExpressionAST *initializer = 0)
+ DeclaratorAST *Declarator(SpecifierListAST *attribute_list = nullptr, PtrOperatorListAST *ptr_operator_list = nullptr, CoreDeclaratorAST *core_declarator = nullptr, PostfixDeclaratorListAST *postfix_declarator_list = nullptr, SpecifierListAST *post_attribute_list = nullptr, ExpressionAST *initializer = nullptr)
{
DeclaratorAST *ast = new (&pool) DeclaratorAST;
ast->attribute_list = attribute_list;
@@ -109,7 +109,7 @@ public:
return ast;
}
- SimpleDeclarationAST *SimpleDeclaration(SpecifierListAST *decl_specifier_list = 0, DeclaratorListAST *declarator_list = 0)
+ SimpleDeclarationAST *SimpleDeclaration(SpecifierListAST *decl_specifier_list = nullptr, DeclaratorListAST *declarator_list = nullptr)
{
SimpleDeclarationAST *ast = new (&pool) SimpleDeclarationAST;
ast->decl_specifier_list = decl_specifier_list;
@@ -135,7 +135,7 @@ public:
return ast;
}
- QtPrivateSlotAST *QtPrivateSlot(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0)
+ QtPrivateSlotAST *QtPrivateSlot(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr)
{
QtPrivateSlotAST *ast = new (&pool) QtPrivateSlotAST;
ast->type_specifier_list = type_specifier_list;
@@ -143,14 +143,14 @@ public:
return ast;
}
- QtPropertyDeclarationItemAST *QtPropertyDeclarationItem(ExpressionAST *expression = 0)
+ QtPropertyDeclarationItemAST *QtPropertyDeclarationItem(ExpressionAST *expression = nullptr)
{
QtPropertyDeclarationItemAST *ast = new (&pool) QtPropertyDeclarationItemAST;
ast->expression = expression;
return ast;
}
- QtPropertyDeclarationAST *QtPropertyDeclaration(ExpressionAST *expression = 0, ExpressionAST *type_id = 0, NameAST *property_name = 0, QtPropertyDeclarationItemListAST *property_declaration_item_list = 0)
+ QtPropertyDeclarationAST *QtPropertyDeclaration(ExpressionAST *expression = nullptr, ExpressionAST *type_id = nullptr, NameAST *property_name = nullptr, QtPropertyDeclarationItemListAST *property_declaration_item_list = nullptr)
{
QtPropertyDeclarationAST *ast = new (&pool) QtPropertyDeclarationAST;
ast->expression = expression;
@@ -160,21 +160,21 @@ public:
return ast;
}
- QtEnumDeclarationAST *QtEnumDeclaration(NameListAST *enumerator_list = 0)
+ QtEnumDeclarationAST *QtEnumDeclaration(NameListAST *enumerator_list = nullptr)
{
QtEnumDeclarationAST *ast = new (&pool) QtEnumDeclarationAST;
ast->enumerator_list = enumerator_list;
return ast;
}
- QtFlagsDeclarationAST *QtFlagsDeclaration(NameListAST *flag_enums_list = 0)
+ QtFlagsDeclarationAST *QtFlagsDeclaration(NameListAST *flag_enums_list = nullptr)
{
QtFlagsDeclarationAST *ast = new (&pool) QtFlagsDeclarationAST;
ast->flag_enums_list = flag_enums_list;
return ast;
}
- QtInterfaceNameAST *QtInterfaceName(NameAST *interface_name = 0, NameListAST *constraint_list = 0)
+ QtInterfaceNameAST *QtInterfaceName(NameAST *interface_name = nullptr, NameListAST *constraint_list = nullptr)
{
QtInterfaceNameAST *ast = new (&pool) QtInterfaceNameAST;
ast->interface_name = interface_name;
@@ -182,7 +182,7 @@ public:
return ast;
}
- QtInterfacesDeclarationAST *QtInterfacesDeclaration(QtInterfaceNameListAST *interface_name_list = 0)
+ QtInterfacesDeclarationAST *QtInterfacesDeclaration(QtInterfaceNameListAST *interface_name_list = nullptr)
{
QtInterfacesDeclarationAST *ast = new (&pool) QtInterfacesDeclarationAST;
ast->interface_name_list = interface_name_list;
@@ -195,28 +195,28 @@ public:
return ast;
}
- BaseSpecifierAST *BaseSpecifier(NameAST *name = 0)
+ BaseSpecifierAST *BaseSpecifier(NameAST *name = nullptr)
{
BaseSpecifierAST *ast = new (&pool) BaseSpecifierAST;
ast->name = name;
return ast;
}
- IdExpressionAST *IdExpression(NameAST *name = 0)
+ IdExpressionAST *IdExpression(NameAST *name = nullptr)
{
IdExpressionAST *ast = new (&pool) IdExpressionAST;
ast->name = name;
return ast;
}
- CompoundExpressionAST *CompoundExpression(CompoundStatementAST *statement = 0)
+ CompoundExpressionAST *CompoundExpression(CompoundStatementAST *statement = nullptr)
{
CompoundExpressionAST *ast = new (&pool) CompoundExpressionAST;
ast->statement = statement;
return ast;
}
- CompoundLiteralAST *CompoundLiteral(ExpressionAST *type_id = 0, ExpressionAST *initializer = 0)
+ CompoundLiteralAST *CompoundLiteral(ExpressionAST *type_id = nullptr, ExpressionAST *initializer = nullptr)
{
CompoundLiteralAST *ast = new (&pool) CompoundLiteralAST;
ast->type_id = type_id;
@@ -224,21 +224,21 @@ public:
return ast;
}
- QtMethodAST *QtMethod(DeclaratorAST *declarator = 0)
+ QtMethodAST *QtMethod(DeclaratorAST *declarator = nullptr)
{
QtMethodAST *ast = new (&pool) QtMethodAST;
ast->declarator = declarator;
return ast;
}
- QtMemberDeclarationAST *QtMemberDeclaration(ExpressionAST *type_id = 0)
+ QtMemberDeclarationAST *QtMemberDeclaration(ExpressionAST *type_id = nullptr)
{
QtMemberDeclarationAST *ast = new (&pool) QtMemberDeclarationAST;
ast->type_id = type_id;
return ast;
}
- BinaryExpressionAST *BinaryExpression(ExpressionAST *left_expression = 0, ExpressionAST *right_expression = 0)
+ BinaryExpressionAST *BinaryExpression(ExpressionAST *left_expression = nullptr, ExpressionAST *right_expression = nullptr)
{
BinaryExpressionAST *ast = new (&pool) BinaryExpressionAST;
ast->left_expression = left_expression;
@@ -246,7 +246,7 @@ public:
return ast;
}
- CastExpressionAST *CastExpression(ExpressionAST *type_id = 0, ExpressionAST *expression = 0)
+ CastExpressionAST *CastExpression(ExpressionAST *type_id = nullptr, ExpressionAST *expression = nullptr)
{
CastExpressionAST *ast = new (&pool) CastExpressionAST;
ast->type_id = type_id;
@@ -254,7 +254,7 @@ public:
return ast;
}
- ClassSpecifierAST *ClassSpecifier(SpecifierListAST *attribute_list = 0, NameAST *name = 0, BaseSpecifierListAST *base_clause_list = 0, DeclarationListAST *member_specifier_list = 0)
+ ClassSpecifierAST *ClassSpecifier(SpecifierListAST *attribute_list = nullptr, NameAST *name = nullptr, BaseSpecifierListAST *base_clause_list = nullptr, DeclarationListAST *member_specifier_list = nullptr)
{
ClassSpecifierAST *ast = new (&pool) ClassSpecifierAST;
ast->attribute_list = attribute_list;
@@ -264,7 +264,7 @@ public:
return ast;
}
- CaseStatementAST *CaseStatement(ExpressionAST *expression = 0, StatementAST *statement = 0)
+ CaseStatementAST *CaseStatement(ExpressionAST *expression = nullptr, StatementAST *statement = nullptr)
{
CaseStatementAST *ast = new (&pool) CaseStatementAST;
ast->expression = expression;
@@ -272,14 +272,14 @@ public:
return ast;
}
- CompoundStatementAST *CompoundStatement(StatementListAST *statement_list = 0)
+ CompoundStatementAST *CompoundStatement(StatementListAST *statement_list = nullptr)
{
CompoundStatementAST *ast = new (&pool) CompoundStatementAST;
ast->statement_list = statement_list;
return ast;
}
- ConditionAST *Condition(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0)
+ ConditionAST *Condition(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr)
{
ConditionAST *ast = new (&pool) ConditionAST;
ast->type_specifier_list = type_specifier_list;
@@ -287,7 +287,7 @@ public:
return ast;
}
- ConditionalExpressionAST *ConditionalExpression(ExpressionAST *condition = 0, ExpressionAST *left_expression = 0, ExpressionAST *right_expression = 0)
+ ConditionalExpressionAST *ConditionalExpression(ExpressionAST *condition = nullptr, ExpressionAST *left_expression = nullptr, ExpressionAST *right_expression = nullptr)
{
ConditionalExpressionAST *ast = new (&pool) ConditionalExpressionAST;
ast->condition = condition;
@@ -296,7 +296,7 @@ public:
return ast;
}
- CppCastExpressionAST *CppCastExpression(ExpressionAST *type_id = 0, ExpressionAST *expression = 0)
+ CppCastExpressionAST *CppCastExpression(ExpressionAST *type_id = nullptr, ExpressionAST *expression = nullptr)
{
CppCastExpressionAST *ast = new (&pool) CppCastExpressionAST;
ast->type_id = type_id;
@@ -304,35 +304,35 @@ public:
return ast;
}
- CtorInitializerAST *CtorInitializer(MemInitializerListAST *member_initializer_list = 0)
+ CtorInitializerAST *CtorInitializer(MemInitializerListAST *member_initializer_list = nullptr)
{
CtorInitializerAST *ast = new (&pool) CtorInitializerAST;
ast->member_initializer_list = member_initializer_list;
return ast;
}
- DeclarationStatementAST *DeclarationStatement(DeclarationAST *declaration = 0)
+ DeclarationStatementAST *DeclarationStatement(DeclarationAST *declaration = nullptr)
{
DeclarationStatementAST *ast = new (&pool) DeclarationStatementAST;
ast->declaration = declaration;
return ast;
}
- DeclaratorIdAST *DeclaratorId(NameAST *name = 0)
+ DeclaratorIdAST *DeclaratorId(NameAST *name = nullptr)
{
DeclaratorIdAST *ast = new (&pool) DeclaratorIdAST;
ast->name = name;
return ast;
}
- NestedDeclaratorAST *NestedDeclarator(DeclaratorAST *declarator = 0)
+ NestedDeclaratorAST *NestedDeclarator(DeclaratorAST *declarator = nullptr)
{
NestedDeclaratorAST *ast = new (&pool) NestedDeclaratorAST;
ast->declarator = declarator;
return ast;
}
- FunctionDeclaratorAST *FunctionDeclarator(ParameterDeclarationClauseAST *parameter_declaration_clause = 0, SpecifierListAST *cv_qualifier_list = 0, ExceptionSpecificationAST *exception_specification = 0, TrailingReturnTypeAST *trailing_return_type = 0, ExpressionAST *as_cpp_initializer = 0)
+ FunctionDeclaratorAST *FunctionDeclarator(ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr, SpecifierListAST *cv_qualifier_list = nullptr, ExceptionSpecificationAST *exception_specification = nullptr, TrailingReturnTypeAST *trailing_return_type = nullptr, ExpressionAST *as_cpp_initializer = nullptr)
{
FunctionDeclaratorAST *ast = new (&pool) FunctionDeclaratorAST;
ast->parameter_declaration_clause = parameter_declaration_clause;
@@ -343,21 +343,21 @@ public:
return ast;
}
- ArrayDeclaratorAST *ArrayDeclarator(ExpressionAST *expression = 0)
+ ArrayDeclaratorAST *ArrayDeclarator(ExpressionAST *expression = nullptr)
{
ArrayDeclaratorAST *ast = new (&pool) ArrayDeclaratorAST;
ast->expression = expression;
return ast;
}
- DeleteExpressionAST *DeleteExpression(ExpressionAST *expression = 0)
+ DeleteExpressionAST *DeleteExpression(ExpressionAST *expression = nullptr)
{
DeleteExpressionAST *ast = new (&pool) DeleteExpressionAST;
ast->expression = expression;
return ast;
}
- DoStatementAST *DoStatement(StatementAST *statement = 0, ExpressionAST *expression = 0)
+ DoStatementAST *DoStatement(StatementAST *statement = nullptr, ExpressionAST *expression = nullptr)
{
DoStatementAST *ast = new (&pool) DoStatementAST;
ast->statement = statement;
@@ -365,14 +365,14 @@ public:
return ast;
}
- NamedTypeSpecifierAST *NamedTypeSpecifier(NameAST *name = 0)
+ NamedTypeSpecifierAST *NamedTypeSpecifier(NameAST *name = nullptr)
{
NamedTypeSpecifierAST *ast = new (&pool) NamedTypeSpecifierAST;
ast->name = name;
return ast;
}
- ElaboratedTypeSpecifierAST *ElaboratedTypeSpecifier(SpecifierListAST *attribute_list = 0, NameAST *name = 0)
+ ElaboratedTypeSpecifierAST *ElaboratedTypeSpecifier(SpecifierListAST *attribute_list = nullptr, NameAST *name = nullptr)
{
ElaboratedTypeSpecifierAST *ast = new (&pool) ElaboratedTypeSpecifierAST;
ast->attribute_list = attribute_list;
@@ -380,7 +380,7 @@ public:
return ast;
}
- EnumSpecifierAST *EnumSpecifier(NameAST *name = 0, SpecifierListAST *type_specifier_list = 0, EnumeratorListAST *enumerator_list = 0)
+ EnumSpecifierAST *EnumSpecifier(NameAST *name = nullptr, SpecifierListAST *type_specifier_list = nullptr, EnumeratorListAST *enumerator_list = nullptr)
{
EnumSpecifierAST *ast = new (&pool) EnumSpecifierAST;
ast->name = name;
@@ -389,14 +389,14 @@ public:
return ast;
}
- EnumeratorAST *Enumerator(ExpressionAST *expression = 0)
+ EnumeratorAST *Enumerator(ExpressionAST *expression = nullptr)
{
EnumeratorAST *ast = new (&pool) EnumeratorAST;
ast->expression = expression;
return ast;
}
- ExceptionDeclarationAST *ExceptionDeclaration(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0)
+ ExceptionDeclarationAST *ExceptionDeclaration(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr)
{
ExceptionDeclarationAST *ast = new (&pool) ExceptionDeclarationAST;
ast->type_specifier_list = type_specifier_list;
@@ -404,21 +404,21 @@ public:
return ast;
}
- DynamicExceptionSpecificationAST *DynamicExceptionSpecification(ExpressionListAST *type_id_list = 0)
+ DynamicExceptionSpecificationAST *DynamicExceptionSpecification(ExpressionListAST *type_id_list = nullptr)
{
DynamicExceptionSpecificationAST *ast = new (&pool) DynamicExceptionSpecificationAST;
ast->type_id_list = type_id_list;
return ast;
}
- NoExceptSpecificationAST *NoExceptSpecification(ExpressionAST *expression = 0)
+ NoExceptSpecificationAST *NoExceptSpecification(ExpressionAST *expression = nullptr)
{
NoExceptSpecificationAST *ast = new (&pool) NoExceptSpecificationAST;
ast->expression = expression;
return ast;
}
- ExpressionOrDeclarationStatementAST *ExpressionOrDeclarationStatement(ExpressionStatementAST *expression = 0, DeclarationStatementAST *declaration = 0)
+ ExpressionOrDeclarationStatementAST *ExpressionOrDeclarationStatement(ExpressionStatementAST *expression = nullptr, DeclarationStatementAST *declaration = nullptr)
{
ExpressionOrDeclarationStatementAST *ast = new (&pool) ExpressionOrDeclarationStatementAST;
ast->expression = expression;
@@ -426,14 +426,14 @@ public:
return ast;
}
- ExpressionStatementAST *ExpressionStatement(ExpressionAST *expression = 0)
+ ExpressionStatementAST *ExpressionStatement(ExpressionAST *expression = nullptr)
{
ExpressionStatementAST *ast = new (&pool) ExpressionStatementAST;
ast->expression = expression;
return ast;
}
- FunctionDefinitionAST *FunctionDefinition(SpecifierListAST *decl_specifier_list = 0, DeclaratorAST *declarator = 0, CtorInitializerAST *ctor_initializer = 0, StatementAST *function_body = 0)
+ FunctionDefinitionAST *FunctionDefinition(SpecifierListAST *decl_specifier_list = nullptr, DeclaratorAST *declarator = nullptr, CtorInitializerAST *ctor_initializer = nullptr, StatementAST *function_body = nullptr)
{
FunctionDefinitionAST *ast = new (&pool) FunctionDefinitionAST;
ast->decl_specifier_list = decl_specifier_list;
@@ -443,7 +443,7 @@ public:
return ast;
}
- ForeachStatementAST *ForeachStatement(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *initializer = 0, ExpressionAST *expression = 0, StatementAST *statement = 0)
+ ForeachStatementAST *ForeachStatement(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr, ExpressionAST *initializer = nullptr, ExpressionAST *expression = nullptr, StatementAST *statement = nullptr)
{
ForeachStatementAST *ast = new (&pool) ForeachStatementAST;
ast->type_specifier_list = type_specifier_list;
@@ -454,7 +454,7 @@ public:
return ast;
}
- RangeBasedForStatementAST *RangeBasedForStatement(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *expression = 0, StatementAST *statement = 0)
+ RangeBasedForStatementAST *RangeBasedForStatement(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr, ExpressionAST *expression = nullptr, StatementAST *statement = nullptr)
{
RangeBasedForStatementAST *ast = new (&pool) RangeBasedForStatementAST;
ast->type_specifier_list = type_specifier_list;
@@ -464,7 +464,7 @@ public:
return ast;
}
- ForStatementAST *ForStatement(StatementAST *initializer = 0, ExpressionAST *condition = 0, ExpressionAST *expression = 0, StatementAST *statement = 0)
+ ForStatementAST *ForStatement(StatementAST *initializer = nullptr, ExpressionAST *condition = nullptr, ExpressionAST *expression = nullptr, StatementAST *statement = nullptr)
{
ForStatementAST *ast = new (&pool) ForStatementAST;
ast->initializer = initializer;
@@ -474,7 +474,7 @@ public:
return ast;
}
- IfStatementAST *IfStatement(ExpressionAST *condition = 0, StatementAST *statement = 0, StatementAST *else_statement = 0)
+ IfStatementAST *IfStatement(ExpressionAST *condition = nullptr, StatementAST *statement = nullptr, StatementAST *else_statement = nullptr)
{
IfStatementAST *ast = new (&pool) IfStatementAST;
ast->condition = condition;
@@ -483,35 +483,35 @@ public:
return ast;
}
- ArrayInitializerAST *ArrayInitializer(ExpressionListAST *expression_list = 0)
+ ArrayInitializerAST *ArrayInitializer(ExpressionListAST *expression_list = nullptr)
{
ArrayInitializerAST *ast = new (&pool) ArrayInitializerAST;
ast->expression_list = expression_list;
return ast;
}
- LabeledStatementAST *LabeledStatement(StatementAST *statement = 0)
+ LabeledStatementAST *LabeledStatement(StatementAST *statement = nullptr)
{
LabeledStatementAST *ast = new (&pool) LabeledStatementAST;
ast->statement = statement;
return ast;
}
- LinkageBodyAST *LinkageBody(DeclarationListAST *declaration_list = 0)
+ LinkageBodyAST *LinkageBody(DeclarationListAST *declaration_list = nullptr)
{
LinkageBodyAST *ast = new (&pool) LinkageBodyAST;
ast->declaration_list = declaration_list;
return ast;
}
- LinkageSpecificationAST *LinkageSpecification(DeclarationAST *declaration = 0)
+ LinkageSpecificationAST *LinkageSpecification(DeclarationAST *declaration = nullptr)
{
LinkageSpecificationAST *ast = new (&pool) LinkageSpecificationAST;
ast->declaration = declaration;
return ast;
}
- MemInitializerAST *MemInitializer(NameAST *name = 0, ExpressionAST *expression = 0)
+ MemInitializerAST *MemInitializer(NameAST *name = nullptr, ExpressionAST *expression = nullptr)
{
MemInitializerAST *ast = new (&pool) MemInitializerAST;
ast->name = name;
@@ -519,14 +519,14 @@ public:
return ast;
}
- NestedNameSpecifierAST *NestedNameSpecifier(NameAST *class_or_namespace_name = 0)
+ NestedNameSpecifierAST *NestedNameSpecifier(NameAST *class_or_namespace_name = nullptr)
{
NestedNameSpecifierAST *ast = new (&pool) NestedNameSpecifierAST;
ast->class_or_namespace_name = class_or_namespace_name;
return ast;
}
- QualifiedNameAST *QualifiedName(NestedNameSpecifierListAST *nested_name_specifier_list = 0, NameAST *unqualified_name = 0)
+ QualifiedNameAST *QualifiedName(NestedNameSpecifierListAST *nested_name_specifier_list = nullptr, NameAST *unqualified_name = nullptr)
{
QualifiedNameAST *ast = new (&pool) QualifiedNameAST;
ast->nested_name_specifier_list = nested_name_specifier_list;
@@ -534,14 +534,14 @@ public:
return ast;
}
- OperatorFunctionIdAST *OperatorFunctionId(OperatorAST *op = 0)
+ OperatorFunctionIdAST *OperatorFunctionId(OperatorAST *op = nullptr)
{
OperatorFunctionIdAST *ast = new (&pool) OperatorFunctionIdAST;
ast->op = op;
return ast;
}
- ConversionFunctionIdAST *ConversionFunctionId(SpecifierListAST *type_specifier_list = 0, PtrOperatorListAST *ptr_operator_list = 0)
+ ConversionFunctionIdAST *ConversionFunctionId(SpecifierListAST *type_specifier_list = nullptr, PtrOperatorListAST *ptr_operator_list = nullptr)
{
ConversionFunctionIdAST *ast = new (&pool) ConversionFunctionIdAST;
ast->type_specifier_list = type_specifier_list;
@@ -561,21 +561,21 @@ public:
return ast;
}
- DestructorNameAST *DestructorName(NameAST *unqualified_name = 0)
+ DestructorNameAST *DestructorName(NameAST *unqualified_name = nullptr)
{
DestructorNameAST *ast = new (&pool) DestructorNameAST;
ast->unqualified_name = unqualified_name;
return ast;
}
- TemplateIdAST *TemplateId(ExpressionListAST *template_argument_list = 0)
+ TemplateIdAST *TemplateId(ExpressionListAST *template_argument_list = nullptr)
{
TemplateIdAST *ast = new (&pool) TemplateIdAST;
ast->template_argument_list = template_argument_list;
return ast;
}
- NamespaceAST *Namespace(SpecifierListAST *attribute_list = 0, DeclarationAST *linkage_body = 0)
+ NamespaceAST *Namespace(SpecifierListAST *attribute_list = nullptr, DeclarationAST *linkage_body = nullptr)
{
NamespaceAST *ast = new (&pool) NamespaceAST;
ast->attribute_list = attribute_list;
@@ -583,14 +583,14 @@ public:
return ast;
}
- NamespaceAliasDefinitionAST *NamespaceAliasDefinition(NameAST *name = 0)
+ NamespaceAliasDefinitionAST *NamespaceAliasDefinition(NameAST *name = nullptr)
{
NamespaceAliasDefinitionAST *ast = new (&pool) NamespaceAliasDefinitionAST;
ast->name = name;
return ast;
}
- AliasDeclarationAST *AliasDeclaration(NameAST *name = 0, TypeIdAST *typeId = 0)
+ AliasDeclarationAST *AliasDeclaration(NameAST *name = nullptr, TypeIdAST *typeId = nullptr)
{
AliasDeclarationAST *ast = new (&pool) AliasDeclarationAST;
ast->name = name;
@@ -598,21 +598,21 @@ public:
return ast;
}
- ExpressionListParenAST *ExpressionListParen(ExpressionListAST *expression_list = 0)
+ ExpressionListParenAST *ExpressionListParen(ExpressionListAST *expression_list = nullptr)
{
ExpressionListParenAST *ast = new (&pool) ExpressionListParenAST;
ast->expression_list = expression_list;
return ast;
}
- NewArrayDeclaratorAST *NewArrayDeclarator(ExpressionAST *expression = 0)
+ NewArrayDeclaratorAST *NewArrayDeclarator(ExpressionAST *expression = nullptr)
{
NewArrayDeclaratorAST *ast = new (&pool) NewArrayDeclaratorAST;
ast->expression = expression;
return ast;
}
- NewExpressionAST *NewExpression(ExpressionListParenAST *new_placement = 0, ExpressionAST *type_id = 0, NewTypeIdAST *new_type_id = 0, ExpressionAST *new_initializer = 0)
+ NewExpressionAST *NewExpression(ExpressionListParenAST *new_placement = nullptr, ExpressionAST *type_id = nullptr, NewTypeIdAST *new_type_id = nullptr, ExpressionAST *new_initializer = nullptr)
{
NewExpressionAST *ast = new (&pool) NewExpressionAST;
ast->new_placement = new_placement;
@@ -622,7 +622,7 @@ public:
return ast;
}
- NewTypeIdAST *NewTypeId(SpecifierListAST *type_specifier_list = 0, PtrOperatorListAST *ptr_operator_list = 0, NewArrayDeclaratorListAST *new_array_declarator_list = 0)
+ NewTypeIdAST *NewTypeId(SpecifierListAST *type_specifier_list = nullptr, PtrOperatorListAST *ptr_operator_list = nullptr, NewArrayDeclaratorListAST *new_array_declarator_list = nullptr)
{
NewTypeIdAST *ast = new (&pool) NewTypeIdAST;
ast->type_specifier_list = type_specifier_list;
@@ -637,7 +637,7 @@ public:
return ast;
}
- ParameterDeclarationAST *ParameterDeclaration(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *expression = 0)
+ ParameterDeclarationAST *ParameterDeclaration(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr, ExpressionAST *expression = nullptr)
{
ParameterDeclarationAST *ast = new (&pool) ParameterDeclarationAST;
ast->type_specifier_list = type_specifier_list;
@@ -646,14 +646,14 @@ public:
return ast;
}
- ParameterDeclarationClauseAST *ParameterDeclarationClause(ParameterDeclarationListAST *parameter_declaration_list = 0)
+ ParameterDeclarationClauseAST *ParameterDeclarationClause(ParameterDeclarationListAST *parameter_declaration_list = nullptr)
{
ParameterDeclarationClauseAST *ast = new (&pool) ParameterDeclarationClauseAST;
ast->parameter_declaration_list = parameter_declaration_list;
return ast;
}
- CallAST *Call(ExpressionAST *base_expression = 0, ExpressionListAST *expression_list = 0)
+ CallAST *Call(ExpressionAST *base_expression = nullptr, ExpressionListAST *expression_list = nullptr)
{
CallAST *ast = new (&pool) CallAST;
ast->base_expression = base_expression;
@@ -661,7 +661,7 @@ public:
return ast;
}
- ArrayAccessAST *ArrayAccess(ExpressionAST *base_expression = 0, ExpressionAST *expression = 0)
+ ArrayAccessAST *ArrayAccess(ExpressionAST *base_expression = nullptr, ExpressionAST *expression = nullptr)
{
ArrayAccessAST *ast = new (&pool) ArrayAccessAST;
ast->base_expression = base_expression;
@@ -669,14 +669,14 @@ public:
return ast;
}
- PostIncrDecrAST *PostIncrDecr(ExpressionAST *base_expression = 0)
+ PostIncrDecrAST *PostIncrDecr(ExpressionAST *base_expression = nullptr)
{
PostIncrDecrAST *ast = new (&pool) PostIncrDecrAST;
ast->base_expression = base_expression;
return ast;
}
- MemberAccessAST *MemberAccess(ExpressionAST *base_expression = 0, NameAST *member_name = 0)
+ MemberAccessAST *MemberAccess(ExpressionAST *base_expression = nullptr, NameAST *member_name = nullptr)
{
MemberAccessAST *ast = new (&pool) MemberAccessAST;
ast->base_expression = base_expression;
@@ -684,14 +684,14 @@ public:
return ast;
}
- TypeidExpressionAST *TypeidExpression(ExpressionAST *expression = 0)
+ TypeidExpressionAST *TypeidExpression(ExpressionAST *expression = nullptr)
{
TypeidExpressionAST *ast = new (&pool) TypeidExpressionAST;
ast->expression = expression;
return ast;
}
- TypenameCallExpressionAST *TypenameCallExpression(NameAST *name = 0, ExpressionAST *expression = 0)
+ TypenameCallExpressionAST *TypenameCallExpression(NameAST *name = nullptr, ExpressionAST *expression = nullptr)
{
TypenameCallExpressionAST *ast = new (&pool) TypenameCallExpressionAST;
ast->name = name;
@@ -699,7 +699,7 @@ public:
return ast;
}
- TypeConstructorCallAST *TypeConstructorCall(SpecifierListAST *type_specifier_list = 0, ExpressionAST *expression = 0)
+ TypeConstructorCallAST *TypeConstructorCall(SpecifierListAST *type_specifier_list = nullptr, ExpressionAST *expression = nullptr)
{
TypeConstructorCallAST *ast = new (&pool) TypeConstructorCallAST;
ast->type_specifier_list = type_specifier_list;
@@ -707,7 +707,7 @@ public:
return ast;
}
- PointerToMemberAST *PointerToMember(NestedNameSpecifierListAST *nested_name_specifier_list = 0, SpecifierListAST *cv_qualifier_list = 0)
+ PointerToMemberAST *PointerToMember(NestedNameSpecifierListAST *nested_name_specifier_list = nullptr, SpecifierListAST *cv_qualifier_list = nullptr)
{
PointerToMemberAST *ast = new (&pool) PointerToMemberAST;
ast->nested_name_specifier_list = nested_name_specifier_list;
@@ -715,7 +715,7 @@ public:
return ast;
}
- PointerAST *Pointer(SpecifierListAST *cv_qualifier_list = 0)
+ PointerAST *Pointer(SpecifierListAST *cv_qualifier_list = nullptr)
{
PointerAST *ast = new (&pool) PointerAST;
ast->cv_qualifier_list = cv_qualifier_list;
@@ -746,21 +746,21 @@ public:
return ast;
}
- ReturnStatementAST *ReturnStatement(ExpressionAST *expression = 0)
+ ReturnStatementAST *ReturnStatement(ExpressionAST *expression = nullptr)
{
ReturnStatementAST *ast = new (&pool) ReturnStatementAST;
ast->expression = expression;
return ast;
}
- SizeofExpressionAST *SizeofExpression(ExpressionAST *expression = 0)
+ SizeofExpressionAST *SizeofExpression(ExpressionAST *expression = nullptr)
{
SizeofExpressionAST *ast = new (&pool) SizeofExpressionAST;
ast->expression = expression;
return ast;
}
- AlignofExpressionAST *AlignofExpression(TypeIdAST *typeId = 0)
+ AlignofExpressionAST *AlignofExpression(TypeIdAST *typeId = nullptr)
{
AlignofExpressionAST *ast = new (&pool) AlignofExpressionAST;
ast->typeId = typeId;
@@ -791,14 +791,14 @@ public:
return ast;
}
- NestedExpressionAST *NestedExpression(ExpressionAST *expression = 0)
+ NestedExpressionAST *NestedExpression(ExpressionAST *expression = nullptr)
{
NestedExpressionAST *ast = new (&pool) NestedExpressionAST;
ast->expression = expression;
return ast;
}
- StaticAssertDeclarationAST *StaticAssertDeclaration(ExpressionAST *expression = 0, ExpressionAST *string_literal = 0)
+ StaticAssertDeclarationAST *StaticAssertDeclaration(ExpressionAST *expression = nullptr, ExpressionAST *string_literal = nullptr)
{
StaticAssertDeclarationAST *ast = new (&pool) StaticAssertDeclarationAST;
ast->expression = expression;
@@ -806,14 +806,14 @@ public:
return ast;
}
- StringLiteralAST *StringLiteral(StringLiteralAST *next = 0)
+ StringLiteralAST *StringLiteral(StringLiteralAST *next = nullptr)
{
StringLiteralAST *ast = new (&pool) StringLiteralAST;
ast->next = next;
return ast;
}
- SwitchStatementAST *SwitchStatement(ExpressionAST *condition = 0, StatementAST *statement = 0)
+ SwitchStatementAST *SwitchStatement(ExpressionAST *condition = nullptr, StatementAST *statement = nullptr)
{
SwitchStatementAST *ast = new (&pool) SwitchStatementAST;
ast->condition = condition;
@@ -821,7 +821,7 @@ public:
return ast;
}
- TemplateDeclarationAST *TemplateDeclaration(DeclarationListAST *template_parameter_list = 0, DeclarationAST *declaration = 0)
+ TemplateDeclarationAST *TemplateDeclaration(DeclarationListAST *template_parameter_list = nullptr, DeclarationAST *declaration = nullptr)
{
TemplateDeclarationAST *ast = new (&pool) TemplateDeclarationAST;
ast->template_parameter_list = template_parameter_list;
@@ -829,28 +829,28 @@ public:
return ast;
}
- ThrowExpressionAST *ThrowExpression(ExpressionAST *expression = 0)
+ ThrowExpressionAST *ThrowExpression(ExpressionAST *expression = nullptr)
{
ThrowExpressionAST *ast = new (&pool) ThrowExpressionAST;
ast->expression = expression;
return ast;
}
- NoExceptOperatorExpressionAST *NoExceptOperatorExpression(ExpressionAST *expression = 0)
+ NoExceptOperatorExpressionAST *NoExceptOperatorExpression(ExpressionAST *expression = nullptr)
{
NoExceptOperatorExpressionAST *ast = new (&pool) NoExceptOperatorExpressionAST;
ast->expression = expression;
return ast;
}
- TranslationUnitAST *TranslationUnit(DeclarationListAST *declaration_list = 0)
+ TranslationUnitAST *TranslationUnit(DeclarationListAST *declaration_list = nullptr)
{
TranslationUnitAST *ast = new (&pool) TranslationUnitAST;
ast->declaration_list = declaration_list;
return ast;
}
- TryBlockStatementAST *TryBlockStatement(StatementAST *statement = 0, CatchClauseListAST *catch_clause_list = 0)
+ TryBlockStatementAST *TryBlockStatement(StatementAST *statement = nullptr, CatchClauseListAST *catch_clause_list = nullptr)
{
TryBlockStatementAST *ast = new (&pool) TryBlockStatementAST;
ast->statement = statement;
@@ -858,7 +858,7 @@ public:
return ast;
}
- CatchClauseAST *CatchClause(ExceptionDeclarationAST *exception_declaration = 0, StatementAST *statement = 0)
+ CatchClauseAST *CatchClause(ExceptionDeclarationAST *exception_declaration = nullptr, StatementAST *statement = nullptr)
{
CatchClauseAST *ast = new (&pool) CatchClauseAST;
ast->exception_declaration = exception_declaration;
@@ -866,7 +866,7 @@ public:
return ast;
}
- TypeIdAST *TypeId(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0)
+ TypeIdAST *TypeId(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr)
{
TypeIdAST *ast = new (&pool) TypeIdAST;
ast->type_specifier_list = type_specifier_list;
@@ -874,7 +874,7 @@ public:
return ast;
}
- TypenameTypeParameterAST *TypenameTypeParameter(NameAST *name = 0, ExpressionAST *type_id = 0)
+ TypenameTypeParameterAST *TypenameTypeParameter(NameAST *name = nullptr, ExpressionAST *type_id = nullptr)
{
TypenameTypeParameterAST *ast = new (&pool) TypenameTypeParameterAST;
ast->name = name;
@@ -882,7 +882,7 @@ public:
return ast;
}
- TemplateTypeParameterAST *TemplateTypeParameter(DeclarationListAST *template_parameter_list = 0, NameAST *name = 0, ExpressionAST *type_id = 0)
+ TemplateTypeParameterAST *TemplateTypeParameter(DeclarationListAST *template_parameter_list = nullptr, NameAST *name = nullptr, ExpressionAST *type_id = nullptr)
{
TemplateTypeParameterAST *ast = new (&pool) TemplateTypeParameterAST;
ast->template_parameter_list = template_parameter_list;
@@ -891,28 +891,28 @@ public:
return ast;
}
- UnaryExpressionAST *UnaryExpression(ExpressionAST *expression = 0)
+ UnaryExpressionAST *UnaryExpression(ExpressionAST *expression = nullptr)
{
UnaryExpressionAST *ast = new (&pool) UnaryExpressionAST;
ast->expression = expression;
return ast;
}
- UsingAST *Using(NameAST *name = 0)
+ UsingAST *Using(NameAST *name = nullptr)
{
UsingAST *ast = new (&pool) UsingAST;
ast->name = name;
return ast;
}
- UsingDirectiveAST *UsingDirective(NameAST *name = 0)
+ UsingDirectiveAST *UsingDirective(NameAST *name = nullptr)
{
UsingDirectiveAST *ast = new (&pool) UsingDirectiveAST;
ast->name = name;
return ast;
}
- WhileStatementAST *WhileStatement(ExpressionAST *condition = 0, StatementAST *statement = 0)
+ WhileStatementAST *WhileStatement(ExpressionAST *condition = nullptr, StatementAST *statement = nullptr)
{
WhileStatementAST *ast = new (&pool) WhileStatementAST;
ast->condition = condition;
@@ -920,7 +920,7 @@ public:
return ast;
}
- ObjCClassForwardDeclarationAST *ObjCClassForwardDeclaration(SpecifierListAST *attribute_list = 0, NameListAST *identifier_list = 0)
+ ObjCClassForwardDeclarationAST *ObjCClassForwardDeclaration(SpecifierListAST *attribute_list = nullptr, NameListAST *identifier_list = nullptr)
{
ObjCClassForwardDeclarationAST *ast = new (&pool) ObjCClassForwardDeclarationAST;
ast->attribute_list = attribute_list;
@@ -928,7 +928,7 @@ public:
return ast;
}
- ObjCClassDeclarationAST *ObjCClassDeclaration(SpecifierListAST *attribute_list = 0, NameAST *class_name = 0, NameAST *category_name = 0, NameAST *superclass = 0, ObjCProtocolRefsAST *protocol_refs = 0, ObjCInstanceVariablesDeclarationAST *inst_vars_decl = 0, DeclarationListAST *member_declaration_list = 0)
+ ObjCClassDeclarationAST *ObjCClassDeclaration(SpecifierListAST *attribute_list = nullptr, NameAST *class_name = nullptr, NameAST *category_name = nullptr, NameAST *superclass = nullptr, ObjCProtocolRefsAST *protocol_refs = nullptr, ObjCInstanceVariablesDeclarationAST *inst_vars_decl = nullptr, DeclarationListAST *member_declaration_list = nullptr)
{
ObjCClassDeclarationAST *ast = new (&pool) ObjCClassDeclarationAST;
ast->attribute_list = attribute_list;
@@ -941,7 +941,7 @@ public:
return ast;
}
- ObjCProtocolForwardDeclarationAST *ObjCProtocolForwardDeclaration(SpecifierListAST *attribute_list = 0, NameListAST *identifier_list = 0)
+ ObjCProtocolForwardDeclarationAST *ObjCProtocolForwardDeclaration(SpecifierListAST *attribute_list = nullptr, NameListAST *identifier_list = nullptr)
{
ObjCProtocolForwardDeclarationAST *ast = new (&pool) ObjCProtocolForwardDeclarationAST;
ast->attribute_list = attribute_list;
@@ -949,7 +949,7 @@ public:
return ast;
}
- ObjCProtocolDeclarationAST *ObjCProtocolDeclaration(SpecifierListAST *attribute_list = 0, NameAST *name = 0, ObjCProtocolRefsAST *protocol_refs = 0, DeclarationListAST *member_declaration_list = 0)
+ ObjCProtocolDeclarationAST *ObjCProtocolDeclaration(SpecifierListAST *attribute_list = nullptr, NameAST *name = nullptr, ObjCProtocolRefsAST *protocol_refs = nullptr, DeclarationListAST *member_declaration_list = nullptr)
{
ObjCProtocolDeclarationAST *ast = new (&pool) ObjCProtocolDeclarationAST;
ast->attribute_list = attribute_list;
@@ -959,21 +959,21 @@ public:
return ast;
}
- ObjCProtocolRefsAST *ObjCProtocolRefs(NameListAST *identifier_list = 0)
+ ObjCProtocolRefsAST *ObjCProtocolRefs(NameListAST *identifier_list = nullptr)
{
ObjCProtocolRefsAST *ast = new (&pool) ObjCProtocolRefsAST;
ast->identifier_list = identifier_list;
return ast;
}
- ObjCMessageArgumentAST *ObjCMessageArgument(ExpressionAST *parameter_value_expression = 0)
+ ObjCMessageArgumentAST *ObjCMessageArgument(ExpressionAST *parameter_value_expression = nullptr)
{
ObjCMessageArgumentAST *ast = new (&pool) ObjCMessageArgumentAST;
ast->parameter_value_expression = parameter_value_expression;
return ast;
}
- ObjCMessageExpressionAST *ObjCMessageExpression(ExpressionAST *receiver_expression = 0, ObjCSelectorAST *selector = 0, ObjCMessageArgumentListAST *argument_list = 0)
+ ObjCMessageExpressionAST *ObjCMessageExpression(ExpressionAST *receiver_expression = nullptr, ObjCSelectorAST *selector = nullptr, ObjCMessageArgumentListAST *argument_list = nullptr)
{
ObjCMessageExpressionAST *ast = new (&pool) ObjCMessageExpressionAST;
ast->receiver_expression = receiver_expression;
@@ -988,28 +988,28 @@ public:
return ast;
}
- ObjCTypeNameAST *ObjCTypeName(ExpressionAST *type_id = 0)
+ ObjCTypeNameAST *ObjCTypeName(ExpressionAST *type_id = nullptr)
{
ObjCTypeNameAST *ast = new (&pool) ObjCTypeNameAST;
ast->type_id = type_id;
return ast;
}
- ObjCEncodeExpressionAST *ObjCEncodeExpression(ObjCTypeNameAST *type_name = 0)
+ ObjCEncodeExpressionAST *ObjCEncodeExpression(ObjCTypeNameAST *type_name = nullptr)
{
ObjCEncodeExpressionAST *ast = new (&pool) ObjCEncodeExpressionAST;
ast->type_name = type_name;
return ast;
}
- ObjCSelectorExpressionAST *ObjCSelectorExpression(ObjCSelectorAST *selector = 0)
+ ObjCSelectorExpressionAST *ObjCSelectorExpression(ObjCSelectorAST *selector = nullptr)
{
ObjCSelectorExpressionAST *ast = new (&pool) ObjCSelectorExpressionAST;
ast->selector = selector;
return ast;
}
- ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclaration(DeclarationListAST *instance_variable_list = 0)
+ ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclaration(DeclarationListAST *instance_variable_list = nullptr)
{
ObjCInstanceVariablesDeclarationAST *ast = new (&pool) ObjCInstanceVariablesDeclarationAST;
ast->instance_variable_list = instance_variable_list;
@@ -1022,14 +1022,14 @@ public:
return ast;
}
- ObjCPropertyAttributeAST *ObjCPropertyAttribute(ObjCSelectorAST *method_selector = 0)
+ ObjCPropertyAttributeAST *ObjCPropertyAttribute(ObjCSelectorAST *method_selector = nullptr)
{
ObjCPropertyAttributeAST *ast = new (&pool) ObjCPropertyAttributeAST;
ast->method_selector = method_selector;
return ast;
}
- ObjCPropertyDeclarationAST *ObjCPropertyDeclaration(SpecifierListAST *attribute_list = 0, ObjCPropertyAttributeListAST *property_attribute_list = 0, DeclarationAST *simple_declaration = 0)
+ ObjCPropertyDeclarationAST *ObjCPropertyDeclaration(SpecifierListAST *attribute_list = nullptr, ObjCPropertyAttributeListAST *property_attribute_list = nullptr, DeclarationAST *simple_declaration = nullptr)
{
ObjCPropertyDeclarationAST *ast = new (&pool) ObjCPropertyDeclarationAST;
ast->attribute_list = attribute_list;
@@ -1038,7 +1038,7 @@ public:
return ast;
}
- ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclaration(ObjCTypeNameAST *type_name = 0, SpecifierListAST *attribute_list = 0, NameAST *param_name = 0)
+ ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclaration(ObjCTypeNameAST *type_name = nullptr, SpecifierListAST *attribute_list = nullptr, NameAST *param_name = nullptr)
{
ObjCMessageArgumentDeclarationAST *ast = new (&pool) ObjCMessageArgumentDeclarationAST;
ast->type_name = type_name;
@@ -1047,7 +1047,7 @@ public:
return ast;
}
- ObjCMethodPrototypeAST *ObjCMethodPrototype(ObjCTypeNameAST *type_name = 0, ObjCSelectorAST *selector = 0, ObjCMessageArgumentDeclarationListAST *argument_list = 0, SpecifierListAST *attribute_list = 0)
+ ObjCMethodPrototypeAST *ObjCMethodPrototype(ObjCTypeNameAST *type_name = nullptr, ObjCSelectorAST *selector = nullptr, ObjCMessageArgumentDeclarationListAST *argument_list = nullptr, SpecifierListAST *attribute_list = nullptr)
{
ObjCMethodPrototypeAST *ast = new (&pool) ObjCMethodPrototypeAST;
ast->type_name = type_name;
@@ -1057,7 +1057,7 @@ public:
return ast;
}
- ObjCMethodDeclarationAST *ObjCMethodDeclaration(ObjCMethodPrototypeAST *method_prototype = 0, StatementAST *function_body = 0)
+ ObjCMethodDeclarationAST *ObjCMethodDeclaration(ObjCMethodPrototypeAST *method_prototype = nullptr, StatementAST *function_body = nullptr)
{
ObjCMethodDeclarationAST *ast = new (&pool) ObjCMethodDeclarationAST;
ast->method_prototype = method_prototype;
@@ -1071,21 +1071,21 @@ public:
return ast;
}
- ObjCSynthesizedPropertiesDeclarationAST *ObjCSynthesizedPropertiesDeclaration(ObjCSynthesizedPropertyListAST *property_identifier_list = 0)
+ ObjCSynthesizedPropertiesDeclarationAST *ObjCSynthesizedPropertiesDeclaration(ObjCSynthesizedPropertyListAST *property_identifier_list = nullptr)
{
ObjCSynthesizedPropertiesDeclarationAST *ast = new (&pool) ObjCSynthesizedPropertiesDeclarationAST;
ast->property_identifier_list = property_identifier_list;
return ast;
}
- ObjCDynamicPropertiesDeclarationAST *ObjCDynamicPropertiesDeclaration(NameListAST *property_identifier_list = 0)
+ ObjCDynamicPropertiesDeclarationAST *ObjCDynamicPropertiesDeclaration(NameListAST *property_identifier_list = nullptr)
{
ObjCDynamicPropertiesDeclarationAST *ast = new (&pool) ObjCDynamicPropertiesDeclarationAST;
ast->property_identifier_list = property_identifier_list;
return ast;
}
- ObjCFastEnumerationAST *ObjCFastEnumeration(SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0, ExpressionAST *initializer = 0, ExpressionAST *fast_enumeratable_expression = 0, StatementAST *statement = 0)
+ ObjCFastEnumerationAST *ObjCFastEnumeration(SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr, ExpressionAST *initializer = nullptr, ExpressionAST *fast_enumeratable_expression = nullptr, StatementAST *statement = nullptr)
{
ObjCFastEnumerationAST *ast = new (&pool) ObjCFastEnumerationAST;
ast->type_specifier_list = type_specifier_list;
@@ -1096,7 +1096,7 @@ public:
return ast;
}
- ObjCSynchronizedStatementAST *ObjCSynchronizedStatement(ExpressionAST *synchronized_object = 0, StatementAST *statement = 0)
+ ObjCSynchronizedStatementAST *ObjCSynchronizedStatement(ExpressionAST *synchronized_object = nullptr, StatementAST *statement = nullptr)
{
ObjCSynchronizedStatementAST *ast = new (&pool) ObjCSynchronizedStatementAST;
ast->synchronized_object = synchronized_object;
@@ -1104,7 +1104,7 @@ public:
return ast;
}
- LambdaExpressionAST *LambdaExpression(LambdaIntroducerAST *lambda_introducer = 0, LambdaDeclaratorAST *lambda_declarator = 0, StatementAST *statement = 0)
+ LambdaExpressionAST *LambdaExpression(LambdaIntroducerAST *lambda_introducer = nullptr, LambdaDeclaratorAST *lambda_declarator = nullptr, StatementAST *statement = nullptr)
{
LambdaExpressionAST *ast = new (&pool) LambdaExpressionAST;
ast->lambda_introducer = lambda_introducer;
@@ -1113,28 +1113,28 @@ public:
return ast;
}
- LambdaIntroducerAST *LambdaIntroducer(LambdaCaptureAST *lambda_capture = 0)
+ LambdaIntroducerAST *LambdaIntroducer(LambdaCaptureAST *lambda_capture = nullptr)
{
LambdaIntroducerAST *ast = new (&pool) LambdaIntroducerAST;
ast->lambda_capture = lambda_capture;
return ast;
}
- LambdaCaptureAST *LambdaCapture(CaptureListAST *capture_list = 0)
+ LambdaCaptureAST *LambdaCapture(CaptureListAST *capture_list = nullptr)
{
LambdaCaptureAST *ast = new (&pool) LambdaCaptureAST;
ast->capture_list = capture_list;
return ast;
}
- CaptureAST *Capture(NameAST *identifier = 0)
+ CaptureAST *Capture(NameAST *identifier = nullptr)
{
CaptureAST *ast = new (&pool) CaptureAST;
ast->identifier = identifier;
return ast;
}
- LambdaDeclaratorAST *LambdaDeclarator(ParameterDeclarationClauseAST *parameter_declaration_clause = 0, SpecifierListAST *attributes = 0, ExceptionSpecificationAST *exception_specification = 0, TrailingReturnTypeAST *trailing_return_type = 0)
+ LambdaDeclaratorAST *LambdaDeclarator(ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr, SpecifierListAST *attributes = nullptr, ExceptionSpecificationAST *exception_specification = nullptr, TrailingReturnTypeAST *trailing_return_type = nullptr)
{
LambdaDeclaratorAST *ast = new (&pool) LambdaDeclaratorAST;
ast->parameter_declaration_clause = parameter_declaration_clause;
@@ -1144,7 +1144,7 @@ public:
return ast;
}
- TrailingReturnTypeAST *TrailingReturnType(SpecifierListAST *attributes = 0, SpecifierListAST *type_specifier_list = 0, DeclaratorAST *declarator = 0)
+ TrailingReturnTypeAST *TrailingReturnType(SpecifierListAST *attributes = nullptr, SpecifierListAST *type_specifier_list = nullptr, DeclaratorAST *declarator = nullptr)
{
TrailingReturnTypeAST *ast = new (&pool) TrailingReturnTypeAST;
ast->attributes = attributes;
@@ -1153,7 +1153,7 @@ public:
return ast;
}
- BracedInitializerAST *BracedInitializer(ExpressionListAST *expression_list = 0)
+ BracedInitializerAST *BracedInitializer(ExpressionListAST *expression_list = nullptr)
{
BracedInitializerAST *ast = new (&pool) BracedInitializerAST;
ast->expression_list = expression_list;
@@ -1166,14 +1166,14 @@ public:
return ast;
}
- BracketDesignatorAST *BracketDesignator(ExpressionAST *expression = 0)
+ BracketDesignatorAST *BracketDesignator(ExpressionAST *expression = nullptr)
{
BracketDesignatorAST *ast = new (&pool) BracketDesignatorAST;
ast->expression = expression;
return ast;
}
- DesignatedInitializerAST *DesignatedInitializer(DesignatorListAST *designator_list = 0, ExpressionAST *initializer = 0)
+ DesignatedInitializerAST *DesignatedInitializer(DesignatorListAST *designator_list = nullptr, ExpressionAST *initializer = nullptr)
{
DesignatedInitializerAST *ast = new (&pool) DesignatedInitializerAST;
ast->designator_list = designator_list;
@@ -1181,7 +1181,7 @@ public:
return ast;
}
- BaseSpecifierListAST *BaseSpecifierList(BaseSpecifierAST *value, BaseSpecifierListAST *next = 0)
+ BaseSpecifierListAST *BaseSpecifierList(BaseSpecifierAST *value, BaseSpecifierListAST *next = nullptr)
{
BaseSpecifierListAST *list = new (&pool) BaseSpecifierListAST;
list->next = next;
@@ -1189,7 +1189,7 @@ public:
return list;
}
- CaptureListAST *CaptureList(CaptureAST *value, CaptureListAST *next = 0)
+ CaptureListAST *CaptureList(CaptureAST *value, CaptureListAST *next = nullptr)
{
CaptureListAST *list = new (&pool) CaptureListAST;
list->next = next;
@@ -1197,7 +1197,7 @@ public:
return list;
}
- CatchClauseListAST *CatchClauseList(CatchClauseAST *value, CatchClauseListAST *next = 0)
+ CatchClauseListAST *CatchClauseList(CatchClauseAST *value, CatchClauseListAST *next = nullptr)
{
CatchClauseListAST *list = new (&pool) CatchClauseListAST;
list->next = next;
@@ -1205,7 +1205,7 @@ public:
return list;
}
- DeclarationListAST *DeclarationList(DeclarationAST *value, DeclarationListAST *next = 0)
+ DeclarationListAST *DeclarationList(DeclarationAST *value, DeclarationListAST *next = nullptr)
{
DeclarationListAST *list = new (&pool) DeclarationListAST;
list->next = next;
@@ -1213,7 +1213,7 @@ public:
return list;
}
- DeclaratorListAST *DeclaratorList(DeclaratorAST *value, DeclaratorListAST *next = 0)
+ DeclaratorListAST *DeclaratorList(DeclaratorAST *value, DeclaratorListAST *next = nullptr)
{
DeclaratorListAST *list = new (&pool) DeclaratorListAST;
list->next = next;
@@ -1221,7 +1221,7 @@ public:
return list;
}
- DesignatorListAST *DesignatorList(DesignatorAST *value, DesignatorListAST *next = 0)
+ DesignatorListAST *DesignatorList(DesignatorAST *value, DesignatorListAST *next = nullptr)
{
DesignatorListAST *list = new (&pool) DesignatorListAST;
list->next = next;
@@ -1229,7 +1229,7 @@ public:
return list;
}
- EnumeratorListAST *EnumeratorList(EnumeratorAST *value, EnumeratorListAST *next = 0)
+ EnumeratorListAST *EnumeratorList(EnumeratorAST *value, EnumeratorListAST *next = nullptr)
{
EnumeratorListAST *list = new (&pool) EnumeratorListAST;
list->next = next;
@@ -1237,7 +1237,7 @@ public:
return list;
}
- ExpressionListAST *ExpressionList(ExpressionAST *value, ExpressionListAST *next = 0)
+ ExpressionListAST *ExpressionList(ExpressionAST *value, ExpressionListAST *next = nullptr)
{
ExpressionListAST *list = new (&pool) ExpressionListAST;
list->next = next;
@@ -1245,7 +1245,7 @@ public:
return list;
}
- GnuAttributeListAST *GnuAttributeList(GnuAttributeAST *value, GnuAttributeListAST *next = 0)
+ GnuAttributeListAST *GnuAttributeList(GnuAttributeAST *value, GnuAttributeListAST *next = nullptr)
{
GnuAttributeListAST *list = new (&pool) GnuAttributeListAST;
list->next = next;
@@ -1253,7 +1253,7 @@ public:
return list;
}
- MemInitializerListAST *MemInitializerList(MemInitializerAST *value, MemInitializerListAST *next = 0)
+ MemInitializerListAST *MemInitializerList(MemInitializerAST *value, MemInitializerListAST *next = nullptr)
{
MemInitializerListAST *list = new (&pool) MemInitializerListAST;
list->next = next;
@@ -1261,7 +1261,7 @@ public:
return list;
}
- NameListAST *NameList(NameAST *value, NameListAST *next = 0)
+ NameListAST *NameList(NameAST *value, NameListAST *next = nullptr)
{
NameListAST *list = new (&pool) NameListAST;
list->next = next;
@@ -1269,7 +1269,7 @@ public:
return list;
}
- NestedNameSpecifierListAST *NestedNameSpecifierList(NestedNameSpecifierAST *value, NestedNameSpecifierListAST *next = 0)
+ NestedNameSpecifierListAST *NestedNameSpecifierList(NestedNameSpecifierAST *value, NestedNameSpecifierListAST *next = nullptr)
{
NestedNameSpecifierListAST *list = new (&pool) NestedNameSpecifierListAST;
list->next = next;
@@ -1277,7 +1277,7 @@ public:
return list;
}
- NewArrayDeclaratorListAST *NewArrayDeclaratorList(NewArrayDeclaratorAST *value, NewArrayDeclaratorListAST *next = 0)
+ NewArrayDeclaratorListAST *NewArrayDeclaratorList(NewArrayDeclaratorAST *value, NewArrayDeclaratorListAST *next = nullptr)
{
NewArrayDeclaratorListAST *list = new (&pool) NewArrayDeclaratorListAST;
list->next = next;
@@ -1285,7 +1285,7 @@ public:
return list;
}
- ObjCMessageArgumentDeclarationListAST *ObjCMessageArgumentDeclarationList(ObjCMessageArgumentDeclarationAST *value, ObjCMessageArgumentDeclarationListAST *next = 0)
+ ObjCMessageArgumentDeclarationListAST *ObjCMessageArgumentDeclarationList(ObjCMessageArgumentDeclarationAST *value, ObjCMessageArgumentDeclarationListAST *next = nullptr)
{
ObjCMessageArgumentDeclarationListAST *list = new (&pool) ObjCMessageArgumentDeclarationListAST;
list->next = next;
@@ -1293,7 +1293,7 @@ public:
return list;
}
- ObjCMessageArgumentListAST *ObjCMessageArgumentList(ObjCMessageArgumentAST *value, ObjCMessageArgumentListAST *next = 0)
+ ObjCMessageArgumentListAST *ObjCMessageArgumentList(ObjCMessageArgumentAST *value, ObjCMessageArgumentListAST *next = nullptr)
{
ObjCMessageArgumentListAST *list = new (&pool) ObjCMessageArgumentListAST;
list->next = next;
@@ -1301,7 +1301,7 @@ public:
return list;
}
- ObjCPropertyAttributeListAST *ObjCPropertyAttributeList(ObjCPropertyAttributeAST *value, ObjCPropertyAttributeListAST *next = 0)
+ ObjCPropertyAttributeListAST *ObjCPropertyAttributeList(ObjCPropertyAttributeAST *value, ObjCPropertyAttributeListAST *next = nullptr)
{
ObjCPropertyAttributeListAST *list = new (&pool) ObjCPropertyAttributeListAST;
list->next = next;
@@ -1309,7 +1309,7 @@ public:
return list;
}
- ObjCSelectorArgumentListAST *ObjCSelectorArgumentList(ObjCSelectorArgumentAST *value, ObjCSelectorArgumentListAST *next = 0)
+ ObjCSelectorArgumentListAST *ObjCSelectorArgumentList(ObjCSelectorArgumentAST *value, ObjCSelectorArgumentListAST *next = nullptr)
{
ObjCSelectorArgumentListAST *list = new (&pool) ObjCSelectorArgumentListAST;
list->next = next;
@@ -1317,7 +1317,7 @@ public:
return list;
}
- ObjCSynthesizedPropertyListAST *ObjCSynthesizedPropertyList(ObjCSynthesizedPropertyAST *value, ObjCSynthesizedPropertyListAST *next = 0)
+ ObjCSynthesizedPropertyListAST *ObjCSynthesizedPropertyList(ObjCSynthesizedPropertyAST *value, ObjCSynthesizedPropertyListAST *next = nullptr)
{
ObjCSynthesizedPropertyListAST *list = new (&pool) ObjCSynthesizedPropertyListAST;
list->next = next;
@@ -1325,7 +1325,7 @@ public:
return list;
}
- ParameterDeclarationListAST *ParameterDeclarationList(ParameterDeclarationAST *value, ParameterDeclarationListAST *next = 0)
+ ParameterDeclarationListAST *ParameterDeclarationList(ParameterDeclarationAST *value, ParameterDeclarationListAST *next = nullptr)
{
ParameterDeclarationListAST *list = new (&pool) ParameterDeclarationListAST;
list->next = next;
@@ -1333,7 +1333,7 @@ public:
return list;
}
- PostfixDeclaratorListAST *PostfixDeclaratorList(PostfixDeclaratorAST *value, PostfixDeclaratorListAST *next = 0)
+ PostfixDeclaratorListAST *PostfixDeclaratorList(PostfixDeclaratorAST *value, PostfixDeclaratorListAST *next = nullptr)
{
PostfixDeclaratorListAST *list = new (&pool) PostfixDeclaratorListAST;
list->next = next;
@@ -1341,7 +1341,7 @@ public:
return list;
}
- PtrOperatorListAST *PtrOperatorList(PtrOperatorAST *value, PtrOperatorListAST *next = 0)
+ PtrOperatorListAST *PtrOperatorList(PtrOperatorAST *value, PtrOperatorListAST *next = nullptr)
{
PtrOperatorListAST *list = new (&pool) PtrOperatorListAST;
list->next = next;
@@ -1349,7 +1349,7 @@ public:
return list;
}
- QtInterfaceNameListAST *QtInterfaceNameList(QtInterfaceNameAST *value, QtInterfaceNameListAST *next = 0)
+ QtInterfaceNameListAST *QtInterfaceNameList(QtInterfaceNameAST *value, QtInterfaceNameListAST *next = nullptr)
{
QtInterfaceNameListAST *list = new (&pool) QtInterfaceNameListAST;
list->next = next;
@@ -1357,7 +1357,7 @@ public:
return list;
}
- QtPropertyDeclarationItemListAST *QtPropertyDeclarationItemList(QtPropertyDeclarationItemAST *value, QtPropertyDeclarationItemListAST *next = 0)
+ QtPropertyDeclarationItemListAST *QtPropertyDeclarationItemList(QtPropertyDeclarationItemAST *value, QtPropertyDeclarationItemListAST *next = nullptr)
{
QtPropertyDeclarationItemListAST *list = new (&pool) QtPropertyDeclarationItemListAST;
list->next = next;
@@ -1365,7 +1365,7 @@ public:
return list;
}
- SpecifierListAST *SpecifierList(SpecifierAST *value, SpecifierListAST *next = 0)
+ SpecifierListAST *SpecifierList(SpecifierAST *value, SpecifierListAST *next = nullptr)
{
SpecifierListAST *list = new (&pool) SpecifierListAST;
list->next = next;
@@ -1373,7 +1373,7 @@ public:
return list;
}
- StatementListAST *StatementList(StatementAST *value, StatementListAST *next = 0)
+ StatementListAST *StatementList(StatementAST *value, StatementListAST *next = nullptr)
{
StatementListAST *list = new (&pool) StatementListAST;
list->next = next;
diff --git a/src/libs/3rdparty/cplusplus/ASTVisitor.cpp b/src/libs/3rdparty/cplusplus/ASTVisitor.cpp
index f4119e9ce1..efd5ff1d53 100644
--- a/src/libs/3rdparty/cplusplus/ASTVisitor.cpp
+++ b/src/libs/3rdparty/cplusplus/ASTVisitor.cpp
@@ -40,7 +40,7 @@ Control *ASTVisitor::control() const
if (_translationUnit)
return _translationUnit->control();
- return 0;
+ return nullptr;
}
TranslationUnit *ASTVisitor::translationUnit() const
@@ -49,44 +49,40 @@ TranslationUnit *ASTVisitor::translationUnit() const
void ASTVisitor::setTranslationUnit(TranslationUnit *translationUnit)
{ _translationUnit = translationUnit; }
-unsigned ASTVisitor::tokenCount() const
+int ASTVisitor::tokenCount() const
{ return translationUnit()->tokenCount(); }
-const Token &ASTVisitor::tokenAt(unsigned index) const
+const Token &ASTVisitor::tokenAt(int index) const
{ return translationUnit()->tokenAt(index); }
-int ASTVisitor::tokenKind(unsigned index) const
+int ASTVisitor::tokenKind(int index) const
{ return translationUnit()->tokenKind(index); }
-const char *ASTVisitor::spell(unsigned index) const
+const char *ASTVisitor::spell(int index) const
{ return translationUnit()->spell(index); }
-const Identifier *ASTVisitor::identifier(unsigned index) const
+const Identifier *ASTVisitor::identifier(int index) const
{ return translationUnit()->identifier(index); }
-const Literal *ASTVisitor::literal(unsigned index) const
+const Literal *ASTVisitor::literal(int index) const
{ return translationUnit()->literal(index); }
-const NumericLiteral *ASTVisitor::numericLiteral(unsigned index) const
+const NumericLiteral *ASTVisitor::numericLiteral(int index) const
{ return translationUnit()->numericLiteral(index); }
-const StringLiteral *ASTVisitor::stringLiteral(unsigned index) const
+const StringLiteral *ASTVisitor::stringLiteral(int index) const
{ return translationUnit()->stringLiteral(index); }
-void ASTVisitor::getPosition(unsigned offset,
- unsigned *line,
- unsigned *column,
+void ASTVisitor::getPosition(int offset, int *line, int *column,
const StringLiteral **fileName) const
{ translationUnit()->getPosition(offset, line, column, fileName); }
-void ASTVisitor::getTokenPosition(unsigned index,
- unsigned *line,
- unsigned *column,
+void ASTVisitor::getTokenPosition(int index, int *line, int *column,
const StringLiteral **fileName) const
{ translationUnit()->getTokenPosition(index, line, column, fileName); }
-void ASTVisitor::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const
+void ASTVisitor::getTokenStartPosition(int index, int *line, int *column) const
{ getPosition(tokenAt(index).utf16charsBegin(), line, column); }
-void ASTVisitor::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
+void ASTVisitor::getTokenEndPosition(int index, int *line, int *column) const
{ getPosition(tokenAt(index).utf16charsEnd(), line, column); }
diff --git a/src/libs/3rdparty/cplusplus/ASTVisitor.h b/src/libs/3rdparty/cplusplus/ASTVisitor.h
index 46bfde340b..a1740e12cd 100644
--- a/src/libs/3rdparty/cplusplus/ASTVisitor.h
+++ b/src/libs/3rdparty/cplusplus/ASTVisitor.h
@@ -38,27 +38,27 @@ public:
void setTranslationUnit(TranslationUnit *translationUnit);
Control *control() const;
- unsigned tokenCount() const;
- const Token &tokenAt(unsigned index) const;
- int tokenKind(unsigned index) const;
- const char *spell(unsigned index) const;
- const Identifier *identifier(unsigned index) const;
- const Literal *literal(unsigned index) const;
- const NumericLiteral *numericLiteral(unsigned index) const;
- const StringLiteral *stringLiteral(unsigned index) const;
+ int tokenCount() const;
+ const Token &tokenAt(int index) const;
+ int tokenKind(int index) const;
+ const char *spell(int index) const;
+ const Identifier *identifier(int index) const;
+ const Literal *literal(int index) const;
+ const NumericLiteral *numericLiteral(int index) const;
+ const StringLiteral *stringLiteral(int index) const;
- void getPosition(unsigned offset,
- unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getPosition(int offset,
+ int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void getTokenPosition(unsigned index,
- unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getTokenPosition(int index,
+ int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const;
- void getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const;
+ void getTokenStartPosition(int index, int *line, int *column) const;
+ void getTokenEndPosition(int index, int *line, int *column) const;
void accept(AST *ast);
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 1f082a6ec8..053d4f1388 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -42,10 +42,10 @@ const int Bind::kMaxDepth(100);
Bind::Bind(TranslationUnit *unit)
: ASTVisitor(unit),
- _scope(0),
- _expression(0),
- _name(0),
- _declaratorId(0),
+ _scope(nullptr),
+ _expression(nullptr),
+ _name(nullptr),
+ _declaratorId(nullptr),
_visibility(Symbol::Public),
_objcVisibility(Symbol::Public),
_methodKey(Function::NormalMethod),
@@ -64,7 +64,7 @@ void Bind::setSkipFunctionBodies(bool skipFunctionBodies)
_skipFunctionBodies = skipFunctionBodies;
}
-unsigned Bind::location(DeclaratorAST *ast, unsigned defaultLocation) const
+int Bind::location(DeclaratorAST *ast, int defaultLocation) const
{
if (! ast)
return defaultLocation;
@@ -75,7 +75,7 @@ unsigned Bind::location(DeclaratorAST *ast, unsigned defaultLocation) const
return ast->firstToken();
}
-unsigned Bind::location(CoreDeclaratorAST *ast, unsigned defaultLocation) const
+int Bind::location(CoreDeclaratorAST *ast, int defaultLocation) const
{
if (! ast)
return defaultLocation;
@@ -89,7 +89,7 @@ unsigned Bind::location(CoreDeclaratorAST *ast, unsigned defaultLocation) const
return ast->firstToken();
}
-unsigned Bind::location(NameAST *name, unsigned defaultLocation) const
+int Bind::location(NameAST *name, int defaultLocation) const
{
if (! name)
return defaultLocation;
@@ -229,7 +229,7 @@ void Bind::declaration(DeclarationAST *ast)
const Name *Bind::name(NameAST *ast)
{
- const Name *value = 0;
+ const Name *value = nullptr;
std::swap(_name, value);
accept(ast);
std::swap(_name, value);
@@ -296,7 +296,7 @@ bool Bind::visit(ObjCSelectorArgumentAST *ast)
const Name *Bind::objCSelectorArgument(ObjCSelectorArgumentAST *ast, bool *hasArg)
{
if (! (ast && ast->name_token))
- return 0;
+ return nullptr;
if (ast->colon_token)
*hasArg = true;
@@ -316,7 +316,7 @@ void Bind::attribute(GnuAttributeAST *ast)
if (! ast)
return;
- // unsigned identifier_token = ast->identifier_token;
+ // int identifier_token = ast->identifier_token;
if (const Identifier *id = identifier(ast->identifier_token)) {
if (id == control()->deprecatedId())
_type.setDeprecated(true);
@@ -324,12 +324,12 @@ void Bind::attribute(GnuAttributeAST *ast)
_type.setUnavailable(true);
}
- // unsigned lparen_token = ast->lparen_token;
- // unsigned tag_token = ast->tag_token;
+ // int lparen_token = ast->lparen_token;
+ // int tag_token = ast->tag_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
ExpressionTy value = this->expression(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
}
bool Bind::visit(DeclaratorAST *ast)
@@ -413,12 +413,12 @@ bool Bind::visit(BaseSpecifierAST *ast)
return false;
}
-void Bind::baseSpecifier(BaseSpecifierAST *ast, unsigned colon_token, Class *klass)
+void Bind::baseSpecifier(BaseSpecifierAST *ast, int colon_token, Class *klass)
{
if (! ast)
return;
- unsigned sourceLocation = location(ast->name, ast->firstToken());
+ int sourceLocation = location(ast->name, ast->firstToken());
if (! sourceLocation)
sourceLocation = std::max(colon_token, klass->sourceLocation());
@@ -448,11 +448,11 @@ void Bind::ctorInitializer(CtorInitializerAST *ast, Function *fun)
if (! ast)
return;
- // unsigned colon_token = ast->colon_token;
+ // int colon_token = ast->colon_token;
for (MemInitializerListAST *it = ast->member_initializer_list; it; it = it->next) {
this->memInitializer(it->value, fun);
}
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
}
bool Bind::visit(EnumeratorAST *ast)
@@ -508,7 +508,7 @@ void calculateConstantValue(const Symbol *symbol, EnumeratorDeclaration *e, Cont
const std::string buffer
= std::to_string(static_cast<long long>(constantValueAsInt));
e->setConstantValue(control->stringLiteral(buffer.c_str(),
- unsigned(buffer.size())));
+ int(buffer.size())));
}
}
}
@@ -531,7 +531,7 @@ const StringLiteral *valueOfEnumerator(const Enum *e, const Identifier *value) {
}
}
}
- return 0;
+ return nullptr;
}
} // anonymous namespace
@@ -543,8 +543,8 @@ void Bind::enumerator(EnumeratorAST *ast, Enum *symbol)
if (! ast)
return;
- // unsigned identifier_token = ast->identifier_token;
- // unsigned equal_token = ast->equal_token;
+ // int identifier_token = ast->identifier_token;
+ // int equal_token = ast->equal_token;
/*ExpressionTy expression =*/ this->expression(ast->expression);
if (ast->identifier_token) {
@@ -556,7 +556,7 @@ void Bind::enumerator(EnumeratorAST *ast, Enum *symbol)
const int firstToken = expr->firstToken();
const int lastToken = expr->lastToken();
const StringLiteral *constantValue = asStringLiteral(expr);
- const StringLiteral *resolvedValue = 0;
+ const StringLiteral *resolvedValue = nullptr;
if (lastToken - firstToken == 1) {
if (const Identifier *constantId = identifier(firstToken))
resolvedValue = valueOfEnumerator(symbol, constantId);
@@ -587,16 +587,16 @@ FullySpecifiedType Bind::exceptionSpecification(ExceptionSpecificationAST *ast,
return type;
if (DynamicExceptionSpecificationAST *dyn = ast->asDynamicExceptionSpecification()) {
- // unsigned throw_token = ast->throw_token;
- // unsigned lparen_token = ast->lparen_token;
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int throw_token = ast->throw_token;
+ // int lparen_token = ast->lparen_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
for (ExpressionListAST *it = dyn->type_id_list; it; it = it->next) {
/*ExpressionTy value =*/ this->expression(it->value);
}
} else if (NoExceptSpecificationAST *no = ast->asNoExceptSpecification()) {
/*ExpressionTy value =*/ this->expression(no->expression);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return type;
}
@@ -629,7 +629,7 @@ bool Bind::visit(NestedNameSpecifierAST *ast)
const Name *Bind::nestedNameSpecifier(NestedNameSpecifierAST *ast)
{
if (! ast)
- return 0;
+ return nullptr;
const Name *class_or_namespace_name = this->name(ast->class_or_namespace_name);
return class_or_namespace_name;
@@ -637,11 +637,11 @@ const Name *Bind::nestedNameSpecifier(NestedNameSpecifierAST *ast)
bool Bind::visit(ExpressionListParenAST *ast)
{
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
/*ExpressionTy value =*/ this->expression(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
@@ -651,11 +651,11 @@ void Bind::newPlacement(ExpressionListParenAST *ast)
if (! ast)
return;
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
ExpressionTy value = this->expression(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
}
bool Bind::visit(NewArrayDeclaratorAST *ast)
@@ -672,9 +672,9 @@ FullySpecifiedType Bind::newArrayDeclarator(NewArrayDeclaratorAST *ast, const Fu
if (! ast)
return type;
- // unsigned lbracket_token = ast->lbracket_token;
+ // int lbracket_token = ast->lbracket_token;
ExpressionTy expression = this->expression(ast->expression);
- // unsigned rbracket_token = ast->rbracket_token;
+ // int rbracket_token = ast->rbracket_token;
return type;
}
@@ -719,9 +719,9 @@ OperatorNameId::Kind Bind::cppOperator(OperatorAST *ast)
if (! ast)
return kind;
- // unsigned op_token = ast->op_token;
- // unsigned open_token = ast->open_token;
- // unsigned close_token = ast->close_token;
+ // int op_token = ast->op_token;
+ // int open_token = ast->open_token;
+ // int close_token = ast->close_token;
switch (tokenKind(ast->op_token)) {
case T_NEW:
@@ -904,7 +904,7 @@ bool Bind::visit(ParameterDeclarationClauseAST *ast)
return false;
}
-void Bind::parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun)
+void Bind::parameterDeclarationClause(ParameterDeclarationClauseAST *ast, int lparen_token, Function *fun)
{
if (! ast)
return;
@@ -992,7 +992,7 @@ FullySpecifiedType Bind::objCTypeName(ObjCTypeNameAST *ast)
if (! ast)
return FullySpecifiedType();
- // unsigned type_qualifier_token = ast->type_qualifier_token;
+ // int type_qualifier_token = ast->type_qualifier_token;
ExpressionTy type_id = this->expression(ast->type_id);
return type_id;
}
@@ -1011,11 +1011,11 @@ void Bind::objCInstanceVariablesDeclaration(ObjCInstanceVariablesDeclarationAST
if (! ast)
return;
- // unsigned lbrace_token = ast->lbrace_token;
+ // int lbrace_token = ast->lbrace_token;
for (DeclarationListAST *it = ast->instance_variable_list; it; it = it->next) {
this->declaration(it->value);
}
- // unsigned rbrace_token = ast->rbrace_token;
+ // int rbrace_token = ast->rbrace_token;
}
bool Bind::visit(ObjCPropertyAttributeAST *ast)
@@ -1030,8 +1030,8 @@ void Bind::objCPropertyAttribute(ObjCPropertyAttributeAST *ast)
if (! ast)
return;
- // unsigned attribute_identifier_token = ast->attribute_identifier_token;
- // unsigned equals_token = ast->equals_token;
+ // int attribute_identifier_token = ast->attribute_identifier_token;
+ // int equals_token = ast->equals_token;
/*const Name *method_selector =*/ this->name(ast->method_selector);
}
@@ -1070,13 +1070,13 @@ bool Bind::visit(ObjCMethodPrototypeAST *ast)
ObjCMethod *Bind::objCMethodPrototype(ObjCMethodPrototypeAST *ast)
{
if (! ast)
- return 0;
+ return nullptr;
- // unsigned method_type_token = ast->method_type_token;
+ // int method_type_token = ast->method_type_token;
FullySpecifiedType returnType = this->objCTypeName(ast->type_name);
const Name *selector = this->name(ast->selector);
- const unsigned sourceLocation = location(ast->selector, ast->firstToken());
+ const int sourceLocation = location(ast->selector, ast->firstToken());
ObjCMethod *method = control()->newObjCMethod(sourceLocation, selector);
// ### set the offsets
method->setReturnType(returnType);
@@ -1115,9 +1115,9 @@ void Bind::objCSynthesizedProperty(ObjCSynthesizedPropertyAST *ast)
if (! ast)
return;
- // unsigned property_identifier_token = ast->property_identifier_token;
- // unsigned equals_token = ast->equals_token;
- // unsigned alias_identifier_token = ast->alias_identifier_token;
+ // int property_identifier_token = ast->property_identifier_token;
+ // int equals_token = ast->equals_token;
+ // int alias_identifier_token = ast->alias_identifier_token;
}
bool Bind::visit(LambdaIntroducerAST *ast)
@@ -1132,9 +1132,9 @@ void Bind::lambdaIntroducer(LambdaIntroducerAST *ast)
if (! ast)
return;
- // unsigned lbracket_token = ast->lbracket_token;
+ // int lbracket_token = ast->lbracket_token;
this->lambdaCapture(ast->lambda_capture);
- // unsigned rbracket_token = ast->rbracket_token;
+ // int rbracket_token = ast->rbracket_token;
}
bool Bind::visit(LambdaCaptureAST *ast)
@@ -1149,7 +1149,7 @@ void Bind::lambdaCapture(LambdaCaptureAST *ast)
if (! ast)
return;
- // unsigned default_capture_token = ast->default_capture_token;
+ // int default_capture_token = ast->default_capture_token;
for (CaptureListAST *it = ast->capture_list; it; it = it->next) {
this->capture(it->value);
}
@@ -1180,9 +1180,9 @@ bool Bind::visit(LambdaDeclaratorAST *ast)
Function *Bind::lambdaDeclarator(LambdaDeclaratorAST *ast)
{
if (! ast)
- return 0;
+ return nullptr;
- Function *fun = control()->newFunction(0, 0);
+ Function *fun = control()->newFunction(0, nullptr);
fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin());
fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
@@ -1191,13 +1191,13 @@ Function *Bind::lambdaDeclarator(LambdaDeclaratorAST *ast)
type = this->trailingReturnType(ast->trailing_return_type, type);
ast->symbol = fun;
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
for (SpecifierListAST *it = ast->attributes; it; it = it->next) {
type = this->specifier(it->value, type);
}
- // unsigned mutable_token = ast->mutable_token;
+ // int mutable_token = ast->mutable_token;
type = this->exceptionSpecification(ast->exception_specification, type);
if (!type.isValid())
@@ -1220,37 +1220,37 @@ FullySpecifiedType Bind::trailingReturnType(TrailingReturnTypeAST *ast, const Fu
if (! ast)
return type;
- // unsigned arrow_token = ast->arrow_token;
+ // int arrow_token = ast->arrow_token;
for (SpecifierListAST *it = ast->attributes; it; it = it->next) {
type = this->specifier(it->value, type);
}
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
return type;
}
const StringLiteral *Bind::asStringLiteral(const ExpressionAST *ast)
{
- CPP_ASSERT(ast, return 0);
- const unsigned firstToken = ast->firstToken();
- const unsigned lastToken = ast->lastToken();
+ CPP_ASSERT(ast, return nullptr);
+ const int firstToken = ast->firstToken();
+ const int lastToken = ast->lastToken();
std::string buffer;
- for (unsigned index = firstToken; index != lastToken; ++index) {
+ for (int index = firstToken; index != lastToken; ++index) {
const Token &tk = tokenAt(index);
if (index != firstToken && (tk.whitespace() || tk.newline()))
buffer += ' ';
buffer += tk.spell();
}
- return control()->stringLiteral(buffer.c_str(), unsigned(buffer.size()));
+ return control()->stringLiteral(buffer.c_str(), int(buffer.size()));
}
// StatementAST
bool Bind::visit(QtMemberDeclarationAST *ast)
{
- const Name *name = 0;
+ const Name *name = nullptr;
if (tokenKind(ast->q_token) == T_Q_D)
name = control()->identifier("d");
@@ -1266,7 +1266,7 @@ bool Bind::visit(QtMemberDeclarationAST *ast)
privateClass += nameId->identifier()->chars();
privateClass += "Private";
- const Name *privName = control()->identifier(privateClass.c_str(), unsigned(privateClass.size()));
+ const Name *privName = control()->identifier(privateClass.c_str(), int(privateClass.size()));
declTy.setType(control()->namedType(privName));
}
}
@@ -1289,7 +1289,7 @@ bool Bind::visit(CaseStatementAST *ast)
bool Bind::visit(CompoundStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- unsigned startScopeToken = ast->lbrace_token ? ast->lbrace_token : ast->firstToken();
+ int startScopeToken = ast->lbrace_token ? ast->lbrace_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
ast->symbol = block;
@@ -1325,14 +1325,14 @@ bool Bind::visit(ExpressionOrDeclarationStatementAST *ast)
bool Bind::visit(ExpressionStatementAST *ast)
{
ExpressionTy expression = this->expression(ast->expression);
- // unsigned semicolon_token = ast->semicolon_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
bool Bind::visit(ForeachStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1344,26 +1344,26 @@ bool Bind::visit(ForeachStatementAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- const StringLiteral *initializer = 0;
+ const StringLiteral *initializer = nullptr;
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
ExpressionTy exprType = this->expression(ast->expression);
- ArrayType* arrayType = 0;
+ ArrayType* arrayType = nullptr;
arrayType = exprType->asArrayType();
- if (arrayType != 0)
+ if (arrayType != nullptr)
type = arrayType->elementType();
- else if (ast->expression != 0) {
+ else if (ast->expression != nullptr) {
const StringLiteral *sl = asStringLiteral(ast->expression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
+ initializer = control()->stringLiteral(buff.c_str(), int(buff.size()));
}
}
if (declaratorId && declaratorId->name) {
- unsigned sourceLocation = location(declaratorId->name, ast->firstToken());
+ int sourceLocation = location(declaratorId->name, ast->firstToken());
Declaration *decl = control()->newDeclaration(sourceLocation, declaratorId->name->name);
decl->setType(type);
decl->setInitializer(initializer);
@@ -1380,7 +1380,7 @@ bool Bind::visit(ForeachStatementAST *ast)
bool Bind::visit(RangeBasedForStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1392,26 +1392,26 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- const StringLiteral *initializer = 0;
+ const StringLiteral *initializer = nullptr;
if (type.isAuto() && translationUnit()->languageFeatures().cxx11Enabled) {
ExpressionTy exprType = this->expression(ast->expression);
- ArrayType* arrayType = 0;
+ ArrayType* arrayType = nullptr;
arrayType = exprType->asArrayType();
- if (arrayType != 0)
+ if (arrayType != nullptr)
type = arrayType->elementType();
- else if (ast->expression != 0) {
+ else if (ast->expression != nullptr) {
const StringLiteral *sl = asStringLiteral(ast->expression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
+ initializer = control()->stringLiteral(buff.c_str(), int(buff.size()));
}
}
if (declaratorId && declaratorId->name) {
- unsigned sourceLocation = location(declaratorId->name, ast->firstToken());
+ int sourceLocation = location(declaratorId->name, ast->firstToken());
Declaration *decl = control()->newDeclaration(sourceLocation, declaratorId->name->name);
decl->setType(type);
decl->setInitializer(initializer);
@@ -1427,7 +1427,7 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
bool Bind::visit(ForStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1436,9 +1436,9 @@ bool Bind::visit(ForStatementAST *ast)
Scope *previousScope = switchScope(block);
this->statement(ast->initializer);
/*ExpressionTy condition =*/ this->expression(ast->condition);
- // unsigned semicolon_token = ast->semicolon_token;
+ // int semicolon_token = ast->semicolon_token;
/*ExpressionTy expression =*/ this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
this->statement(ast->statement);
(void) switchScope(previousScope);
return false;
@@ -1447,7 +1447,7 @@ bool Bind::visit(ForStatementAST *ast)
bool Bind::visit(IfStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1463,8 +1463,8 @@ bool Bind::visit(IfStatementAST *ast)
bool Bind::visit(LabeledStatementAST *ast)
{
- // unsigned label_token = ast->label_token;
- // unsigned colon_token = ast->colon_token;
+ // int label_token = ast->label_token;
+ // int colon_token = ast->colon_token;
this->statement(ast->statement);
return false;
}
@@ -1472,25 +1472,25 @@ bool Bind::visit(LabeledStatementAST *ast)
bool Bind::visit(BreakStatementAST *ast)
{
(void) ast;
- // unsigned break_token = ast->break_token;
- // unsigned semicolon_token = ast->semicolon_token;
+ // int break_token = ast->break_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
bool Bind::visit(ContinueStatementAST *ast)
{
(void) ast;
- // unsigned continue_token = ast->continue_token;
- // unsigned semicolon_token = ast->semicolon_token;
+ // int continue_token = ast->continue_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
bool Bind::visit(GotoStatementAST *ast)
{
(void) ast;
- // unsigned goto_token = ast->goto_token;
- // unsigned identifier_token = ast->identifier_token;
- // unsigned semicolon_token = ast->semicolon_token;
+ // int goto_token = ast->goto_token;
+ // int identifier_token = ast->identifier_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
@@ -1503,7 +1503,7 @@ bool Bind::visit(ReturnStatementAST *ast)
bool Bind::visit(SwitchStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1518,7 +1518,7 @@ bool Bind::visit(SwitchStatementAST *ast)
bool Bind::visit(TryBlockStatementAST *ast)
{
- // unsigned try_token = ast->try_token;
+ // int try_token = ast->try_token;
this->statement(ast->statement);
for (CatchClauseListAST *it = ast->catch_clause_list; it; it = it->next) {
this->statement(it->value);
@@ -1529,7 +1529,7 @@ bool Bind::visit(TryBlockStatementAST *ast)
bool Bind::visit(CatchClauseAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1537,7 +1537,7 @@ bool Bind::visit(CatchClauseAST *ast)
Scope *previousScope = switchScope(block);
this->declaration(ast->exception_declaration);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
this->statement(ast->statement);
(void) switchScope(previousScope);
return false;
@@ -1546,7 +1546,7 @@ bool Bind::visit(CatchClauseAST *ast)
bool Bind::visit(WhileStatementAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1562,7 +1562,7 @@ bool Bind::visit(WhileStatementAST *ast)
bool Bind::visit(ObjCFastEnumerationAST *ast)
{
Block *block = control()->newBlock(ast->firstToken());
- const unsigned startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
+ const int startScopeToken = ast->lparen_token ? ast->lparen_token : ast->firstToken();
block->setStartOffset(tokenAt(startScopeToken).utf16charsEnd());
block->setEndOffset(tokenAt(ast->lastToken()).utf16charsBegin());
_scope->addMember(block);
@@ -1573,11 +1573,11 @@ bool Bind::visit(ObjCFastEnumerationAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
if (declaratorId && declaratorId->name) {
- unsigned sourceLocation = location(declaratorId->name, ast->firstToken());
+ int sourceLocation = location(declaratorId->name, ast->firstToken());
Declaration *decl = control()->newDeclaration(sourceLocation, declaratorId->name->name);
decl->setType(type);
block->addMember(decl);
@@ -1592,10 +1592,10 @@ bool Bind::visit(ObjCFastEnumerationAST *ast)
bool Bind::visit(ObjCSynchronizedStatementAST *ast)
{
- // unsigned synchronized_token = ast->synchronized_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int synchronized_token = ast->synchronized_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy synchronized_object = this->expression(ast->synchronized_object);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
this->statement(ast->statement);
return false;
}
@@ -1610,45 +1610,45 @@ bool Bind::visit(IdExpressionAST *ast)
bool Bind::visit(CompoundExpressionAST *ast)
{
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
this->statement(ast->statement);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(CompoundLiteralAST *ast)
{
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy type_id = this->expression(ast->type_id);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
ExpressionTy initializer = this->expression(ast->initializer);
return false;
}
bool Bind::visit(QtMethodAST *ast)
{
- // unsigned method_token = ast->method_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int method_token = ast->method_token;
+ // int lparen_token = ast->lparen_token;
FullySpecifiedType type;
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(BinaryExpressionAST *ast)
{
ExpressionTy left_expression = this->expression(ast->left_expression);
- // unsigned binary_op_token = ast->binary_op_token;
+ // int binary_op_token = ast->binary_op_token;
ExpressionTy right_expression = this->expression(ast->right_expression);
return false;
}
bool Bind::visit(CastExpressionAST *ast)
{
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy type_id = this->expression(ast->type_id);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
ExpressionTy expression = this->expression(ast->expression);
return false;
}
@@ -1659,11 +1659,11 @@ bool Bind::visit(ConditionAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
if (declaratorId && declaratorId->name) {
- unsigned sourceLocation = location(declaratorId->name, ast->firstToken());
+ int sourceLocation = location(declaratorId->name, ast->firstToken());
Declaration *decl = control()->newDeclaration(sourceLocation, declaratorId->name->name);
decl->setType(type);
@@ -1679,53 +1679,53 @@ bool Bind::visit(ConditionAST *ast)
bool Bind::visit(ConditionalExpressionAST *ast)
{
ExpressionTy condition = this->expression(ast->condition);
- // unsigned question_token = ast->question_token;
+ // int question_token = ast->question_token;
ExpressionTy left_expression = this->expression(ast->left_expression);
- // unsigned colon_token = ast->colon_token;
+ // int colon_token = ast->colon_token;
ExpressionTy right_expression = this->expression(ast->right_expression);
return false;
}
bool Bind::visit(CppCastExpressionAST *ast)
{
- // unsigned cast_token = ast->cast_token;
- // unsigned less_token = ast->less_token;
+ // int cast_token = ast->cast_token;
+ // int less_token = ast->less_token;
ExpressionTy type_id = this->expression(ast->type_id);
- // unsigned greater_token = ast->greater_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int greater_token = ast->greater_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy expression = this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(DeleteExpressionAST *ast)
{
- // unsigned scope_token = ast->scope_token;
- // unsigned delete_token = ast->delete_token;
- // unsigned lbracket_token = ast->lbracket_token;
- // unsigned rbracket_token = ast->rbracket_token;
+ // int scope_token = ast->scope_token;
+ // int delete_token = ast->delete_token;
+ // int lbracket_token = ast->lbracket_token;
+ // int rbracket_token = ast->rbracket_token;
ExpressionTy expression = this->expression(ast->expression);
return false;
}
bool Bind::visit(ArrayInitializerAST *ast)
{
- // unsigned lbrace_token = ast->lbrace_token;
+ // int lbrace_token = ast->lbrace_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
ExpressionTy value = this->expression(it->value);
}
- // unsigned rbrace_token = ast->rbrace_token;
+ // int rbrace_token = ast->rbrace_token;
return false;
}
bool Bind::visit(NewExpressionAST *ast)
{
- // unsigned scope_token = ast->scope_token;
- // unsigned new_token = ast->new_token;
+ // int scope_token = ast->scope_token;
+ // int new_token = ast->new_token;
this->newPlacement(ast->new_placement);
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy type_id = this->expression(ast->type_id);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
this->newTypeId(ast->new_type_id);
this->expression(ast->new_initializer);
return false;
@@ -1733,16 +1733,16 @@ bool Bind::visit(NewExpressionAST *ast)
bool Bind::visit(TypeidExpressionAST *ast)
{
- // unsigned typeid_token = ast->typeid_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int typeid_token = ast->typeid_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy expression = this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(TypenameCallExpressionAST *ast)
{
- // unsigned typename_token = ast->typename_token;
+ // int typename_token = ast->typename_token;
/*const Name *name =*/ this->name(ast->name);
this->expression(ast->expression);
return false;
@@ -1760,60 +1760,60 @@ bool Bind::visit(TypeConstructorCallAST *ast)
bool Bind::visit(SizeofExpressionAST *ast)
{
- // unsigned sizeof_token = ast->sizeof_token;
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int sizeof_token = ast->sizeof_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy expression = this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(PointerLiteralAST *ast)
{
(void) ast;
- // unsigned literal_token = ast->literal_token;
+ // int literal_token = ast->literal_token;
return false;
}
bool Bind::visit(NumericLiteralAST *ast)
{
(void) ast;
- // unsigned literal_token = ast->literal_token;
+ // int literal_token = ast->literal_token;
return false;
}
bool Bind::visit(BoolLiteralAST *ast)
{
(void) ast;
- // unsigned literal_token = ast->literal_token;
+ // int literal_token = ast->literal_token;
return false;
}
bool Bind::visit(ThisExpressionAST *ast)
{
(void) ast;
- // unsigned this_token = ast->this_token;
+ // int this_token = ast->this_token;
return false;
}
bool Bind::visit(NestedExpressionAST *ast)
{
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy expression = this->expression(ast->expression);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(StringLiteralAST *ast)
{
- // unsigned literal_token = ast->literal_token;
+ // int literal_token = ast->literal_token;
ExpressionTy next = this->expression(ast->next);
return false;
}
bool Bind::visit(ThrowExpressionAST *ast)
{
- // unsigned throw_token = ast->throw_token;
+ // int throw_token = ast->throw_token;
ExpressionTy expression = this->expression(ast->expression);
return false;
}
@@ -1824,7 +1824,7 @@ bool Bind::visit(TypeIdAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
_expression = type;
return false;
@@ -1832,46 +1832,46 @@ bool Bind::visit(TypeIdAST *ast)
bool Bind::visit(UnaryExpressionAST *ast)
{
- // unsigned unary_op_token = ast->unary_op_token;
+ // int unary_op_token = ast->unary_op_token;
ExpressionTy expression = this->expression(ast->expression);
return false;
}
bool Bind::visit(ObjCMessageExpressionAST *ast)
{
- // unsigned lbracket_token = ast->lbracket_token;
+ // int lbracket_token = ast->lbracket_token;
/*ExpressionTy receiver_expression =*/ this->expression(ast->receiver_expression);
/*const Name *selector =*/ this->name(ast->selector);
for (ObjCMessageArgumentListAST *it = ast->argument_list; it; it = it->next) {
this->objCMessageArgument(it->value);
}
- // unsigned rbracket_token = ast->rbracket_token;
+ // int rbracket_token = ast->rbracket_token;
return false;
}
bool Bind::visit(ObjCProtocolExpressionAST *ast)
{
(void) ast;
- // unsigned protocol_token = ast->protocol_token;
- // unsigned lparen_token = ast->lparen_token;
- // unsigned identifier_token = ast->identifier_token;
- // unsigned rparen_token = ast->rparen_token;
+ // int protocol_token = ast->protocol_token;
+ // int lparen_token = ast->lparen_token;
+ // int identifier_token = ast->identifier_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(ObjCEncodeExpressionAST *ast)
{
- // unsigned encode_token = ast->encode_token;
+ // int encode_token = ast->encode_token;
FullySpecifiedType type = this->objCTypeName(ast->type_name);
return false;
}
bool Bind::visit(ObjCSelectorExpressionAST *ast)
{
- // unsigned selector_token = ast->selector_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int selector_token = ast->selector_token;
+ // int lparen_token = ast->lparen_token;
/*const Name *selector =*/ this->name(ast->selector);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
@@ -1892,12 +1892,12 @@ bool Bind::visit(LambdaExpressionAST *ast)
bool Bind::visit(BracedInitializerAST *ast)
{
- // unsigned lbrace_token = ast->lbrace_token;
+ // int lbrace_token = ast->lbrace_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
/*ExpressionTy value =*/ this->expression(it->value);
}
- // unsigned comma_token = ast->comma_token;
- // unsigned rbrace_token = ast->rbrace_token;
+ // int comma_token = ast->comma_token;
+ // int rbrace_token = ast->rbrace_token;
return false;
}
@@ -1920,7 +1920,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
if (ast->qt_invokable_token)
methodKey = methodKeyForInvokableToken(tokenKind(ast->qt_invokable_token));
- // unsigned qt_invokable_token = ast->qt_invokable_token;
+ // int qt_invokable_token = ast->qt_invokable_token;
FullySpecifiedType type;
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
@@ -1929,13 +1929,13 @@ bool Bind::visit(SimpleDeclarationAST *ast)
List<Symbol *> **symbolTail = &ast->symbols;
if (! ast->declarator_list) {
- ElaboratedTypeSpecifierAST *elabTypeSpec = 0;
+ ElaboratedTypeSpecifierAST *elabTypeSpec = nullptr;
for (SpecifierListAST *it = ast->decl_specifier_list; ! elabTypeSpec && it; it = it->next)
elabTypeSpec = it->value->asElaboratedTypeSpecifier();
if (elabTypeSpec && tokenKind(elabTypeSpec->classkey_token) != T_TYPENAME) {
- unsigned sourceLocation = elabTypeSpec->firstToken();
- const Name *name = 0;
+ int sourceLocation = elabTypeSpec->firstToken();
+ const Name *name = nullptr;
if (elabTypeSpec->name) {
sourceLocation = location(elabTypeSpec->name, sourceLocation);
name = elabTypeSpec->name->name;
@@ -1953,11 +1953,11 @@ bool Bind::visit(SimpleDeclarationAST *ast)
}
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
FullySpecifiedType declTy = this->declarator(it->value, type, &declaratorId);
- const Name *declName = 0;
- unsigned sourceLocation = location(it->value, ast->firstToken());
+ const Name *declName = nullptr;
+ int sourceLocation = location(it->value, ast->firstToken());
if (declaratorId && declaratorId->name)
declName = declaratorId->name->name;
@@ -2006,7 +2006,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
bool Bind::visit(EmptyDeclarationAST *ast)
{
(void) ast;
- unsigned semicolon_token = ast->semicolon_token;
+ int semicolon_token = ast->semicolon_token;
if (_scope && (_scope->isClass() || _scope->isNamespace())) {
const Token &tk = tokenAt(semicolon_token);
@@ -2034,25 +2034,25 @@ bool Bind::visit(AccessDeclarationAST *ast)
bool Bind::visit(QtObjectTagAST *ast)
{
(void) ast;
- // unsigned q_object_token = ast->q_object_token;
+ // int q_object_token = ast->q_object_token;
return false;
}
bool Bind::visit(QtPrivateSlotAST *ast)
{
- // unsigned q_private_slot_token = ast->q_private_slot_token;
- // unsigned lparen_token = ast->lparen_token;
- // unsigned dptr_token = ast->dptr_token;
- // unsigned dptr_lparen_token = ast->dptr_lparen_token;
- // unsigned dptr_rparen_token = ast->dptr_rparen_token;
- // unsigned comma_token = ast->comma_token;
+ // int q_private_slot_token = ast->q_private_slot_token;
+ // int lparen_token = ast->lparen_token;
+ // int dptr_token = ast->dptr_token;
+ // int dptr_lparen_token = ast->dptr_lparen_token;
+ // int dptr_rparen_token = ast->dptr_rparen_token;
+ // int comma_token = ast->comma_token;
FullySpecifiedType type;
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
@@ -2075,12 +2075,12 @@ static void qtPropertyAttribute(TranslationUnit *unit, ExpressionAST *expression
bool Bind::visit(QtPropertyDeclarationAST *ast)
{
- // unsigned property_specifier_token = ast->property_specifier_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int property_specifier_token = ast->property_specifier_token;
+ // int lparen_token = ast->lparen_token;
ExpressionTy type_id = this->expression(ast->type_id);
const Name *property_name = this->name(ast->property_name);
- unsigned sourceLocation = ast->firstToken();
+ int sourceLocation = ast->firstToken();
if (ast->property_name)
sourceLocation = ast->property_name->firstToken();
QtPropertyDeclaration *propertyDeclaration = control()->newQtPropertyDeclaration(sourceLocation, property_name);
@@ -2128,14 +2128,14 @@ bool Bind::visit(QtPropertyDeclarationAST *ast)
}
propertyDeclaration->setFlags(flags);
_scope->addMember(propertyDeclaration);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(QtEnumDeclarationAST *ast)
{
- // unsigned enum_specifier_token = ast->enum_specifier_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int enum_specifier_token = ast->enum_specifier_token;
+ // int lparen_token = ast->lparen_token;
for (NameListAST *it = ast->enumerator_list; it; it = it->next) {
const Name *value = this->name(it->value);
if (!value)
@@ -2144,29 +2144,29 @@ bool Bind::visit(QtEnumDeclarationAST *ast)
_scope->addMember(qtEnum);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(QtFlagsDeclarationAST *ast)
{
- // unsigned flags_specifier_token = ast->flags_specifier_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int flags_specifier_token = ast->flags_specifier_token;
+ // int lparen_token = ast->lparen_token;
for (NameListAST *it = ast->flag_enums_list; it; it = it->next) {
/*const Name *value =*/ this->name(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(QtInterfacesDeclarationAST *ast)
{
- // unsigned interfaces_token = ast->interfaces_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int interfaces_token = ast->interfaces_token;
+ // int lparen_token = ast->lparen_token;
for (QtInterfaceNameListAST *it = ast->interface_name_list; it; it = it->next) {
this->qtInterfaceName(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
@@ -2194,11 +2194,11 @@ bool Bind::visit(AliasDeclarationAST *ast)
bool Bind::visit(AsmDefinitionAST *ast)
{
(void) ast;
- // unsigned asm_token = ast->asm_token;
- // unsigned volatile_token = ast->volatile_token;
- // unsigned lparen_token = ast->lparen_token;
- // unsigned rparen_token = ast->rparen_token;
- // unsigned semicolon_token = ast->semicolon_token;
+ // int asm_token = ast->asm_token;
+ // int volatile_token = ast->volatile_token;
+ // int lparen_token = ast->lparen_token;
+ // int rparen_token = ast->rparen_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
@@ -2208,17 +2208,17 @@ bool Bind::visit(ExceptionDeclarationAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- const Name *argName = 0;
+ const Name *argName = nullptr;
if (declaratorId && declaratorId->name)
argName = declaratorId->name->name;
Argument *arg = control()->newArgument(location(declaratorId, ast->firstToken()), argName);
arg->setType(type);
_scope->addMember(arg);
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
return false;
}
@@ -2233,7 +2233,7 @@ bool Bind::visit(FunctionDefinitionAST *ast)
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
declSpecifiers = this->specifier(it->value, declSpecifiers);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
FullySpecifiedType type = this->declarator(ast->declarator, declSpecifiers.qualifiedType(), &declaratorId);
Function *fun = type->asFunctionType();
@@ -2270,33 +2270,33 @@ bool Bind::visit(FunctionDefinitionAST *ast)
bool Bind::visit(LinkageBodyAST *ast)
{
- // unsigned lbrace_token = ast->lbrace_token;
+ // int lbrace_token = ast->lbrace_token;
for (DeclarationListAST *it = ast->declaration_list; it; it = it->next) {
this->declaration(it->value);
}
- // unsigned rbrace_token = ast->rbrace_token;
+ // int rbrace_token = ast->rbrace_token;
return false;
}
bool Bind::visit(LinkageSpecificationAST *ast)
{
- // unsigned extern_token = ast->extern_token;
- // unsigned extern_type_token = ast->extern_type_token;
+ // int extern_token = ast->extern_token;
+ // int extern_type_token = ast->extern_type_token;
this->declaration(ast->declaration);
return false;
}
bool Bind::visit(NamespaceAST *ast)
{
- // unsigned namespace_token = ast->namespace_token;
- // unsigned identifier_token = ast->identifier_token;
+ // int namespace_token = ast->namespace_token;
+ // int identifier_token = ast->identifier_token;
FullySpecifiedType type;
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- unsigned sourceLocation = ast->firstToken();
- const Name *namespaceName = 0;
+ int sourceLocation = ast->firstToken();
+ const Name *namespaceName = nullptr;
if (ast->identifier_token) {
sourceLocation = ast->identifier_token;
namespaceName = identifier(ast->identifier_token);
@@ -2317,8 +2317,8 @@ bool Bind::visit(NamespaceAST *ast)
bool Bind::visit(NamespaceAliasDefinitionAST *ast)
{
- unsigned sourceLocation = ast->firstToken();
- const Name *name = 0;
+ int sourceLocation = ast->firstToken();
+ const Name *name = nullptr;
if (ast->namespace_name_token) {
sourceLocation = ast->namespace_name_token;
name = identifier(ast->namespace_name_token);
@@ -2336,12 +2336,12 @@ bool Bind::visit(ParameterDeclarationAST *ast)
for (SpecifierListAST *it = ast->type_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- DeclaratorIdAST *declaratorId = 0;
+ DeclaratorIdAST *declaratorId = nullptr;
type = this->declarator(ast->declarator, type, &declaratorId);
- // unsigned equal_token = ast->equal_token;
+ // int equal_token = ast->equal_token;
ExpressionTy expression = this->expression(ast->expression);
- const Name *argName = 0;
+ const Name *argName = nullptr;
if (declaratorId && declaratorId->name)
argName = declaratorId->name->name;
@@ -2359,7 +2359,7 @@ bool Bind::visit(ParameterDeclarationAST *ast)
bool Bind::visit(TemplateDeclarationAST *ast)
{
- Template *templ = control()->newTemplate(ast->firstToken(), 0);
+ Template *templ = control()->newTemplate(ast->firstToken(), nullptr);
templ->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin());
templ->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
ast->symbol = templ;
@@ -2368,7 +2368,7 @@ bool Bind::visit(TemplateDeclarationAST *ast)
for (DeclarationListAST *it = ast->template_parameter_list; it; it = it->next) {
this->declaration(it->value);
}
- // unsigned greater_token = ast->greater_token;
+ // int greater_token = ast->greater_token;
this->declaration(ast->declaration);
(void) switchScope(previousScope);
@@ -2383,9 +2383,9 @@ bool Bind::visit(TemplateDeclarationAST *ast)
bool Bind::visit(TypenameTypeParameterAST *ast)
{
- unsigned sourceLocation = location(ast->name, ast->firstToken());
- // unsigned classkey_token = ast->classkey_token;
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ int sourceLocation = location(ast->name, ast->firstToken());
+ // int classkey_token = ast->classkey_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
const Name *name = this->name(ast->name);
ExpressionTy type_id = this->expression(ast->type_id);
CPlusPlus::Kind classKey = translationUnit()->tokenKind(ast->classkey_token);
@@ -2400,19 +2400,19 @@ bool Bind::visit(TypenameTypeParameterAST *ast)
bool Bind::visit(TemplateTypeParameterAST *ast)
{
- unsigned sourceLocation = location(ast->name, ast->firstToken());
+ int sourceLocation = location(ast->name, ast->firstToken());
- // unsigned template_token = ast->template_token;
- // unsigned less_token = ast->less_token;
+ // int template_token = ast->template_token;
+ // int less_token = ast->less_token;
// ### process the template prototype
#if 0
for (DeclarationListAST *it = ast->template_parameter_list; it; it = it->next) {
this->declaration(it->value);
}
#endif
- // unsigned greater_token = ast->greater_token;
- // unsigned class_token = ast->class_token;
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int greater_token = ast->greater_token;
+ // int class_token = ast->class_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
const Name *name = this->name(ast->name);
ExpressionTy type_id = this->expression(ast->type_id);
@@ -2428,7 +2428,7 @@ bool Bind::visit(TemplateTypeParameterAST *ast)
bool Bind::visit(UsingAST *ast)
{
- unsigned sourceLocation = location(ast->name, ast->firstToken());
+ int sourceLocation = location(ast->name, ast->firstToken());
const Name *name = this->name(ast->name);
UsingDeclaration *symbol = control()->newUsingDeclaration(sourceLocation, name);
@@ -2439,7 +2439,7 @@ bool Bind::visit(UsingAST *ast)
bool Bind::visit(UsingDirectiveAST *ast)
{
- unsigned sourceLocation = location(ast->name, ast->firstToken());
+ int sourceLocation = location(ast->name, ast->firstToken());
const Name *name = this->name(ast->name);
UsingNamespaceDirective *symbol = control()->newUsingNamespaceDirective(sourceLocation, name);
ast->symbol = symbol;
@@ -2456,11 +2456,11 @@ bool Bind::visit(ObjCClassForwardDeclarationAST *ast)
List<ObjCForwardClassDeclaration *> **symbolTail = &ast->symbols;
- // unsigned class_token = ast->class_token;
+ // int class_token = ast->class_token;
for (NameListAST *it = ast->identifier_list; it; it = it->next) {
const Name *name = this->name(it->value);
- const unsigned sourceLocation = location(it->value, ast->firstToken());
+ const int sourceLocation = location(it->value, ast->firstToken());
ObjCForwardClassDeclaration *fwd = control()->newObjCForwardClassDeclaration(sourceLocation, name);
setDeclSpecifiers(fwd, declSpecifiers);
_scope->addMember(fwd);
@@ -2472,18 +2472,18 @@ bool Bind::visit(ObjCClassForwardDeclarationAST *ast)
return false;
}
-unsigned Bind::calculateScopeStart(ObjCClassDeclarationAST *ast) const
+int Bind::calculateScopeStart(ObjCClassDeclarationAST *ast) const
{
if (ast->inst_vars_decl)
- if (unsigned pos = ast->inst_vars_decl->lbrace_token)
+ if (int pos = ast->inst_vars_decl->lbrace_token)
return tokenAt(pos).utf16charsEnd();
if (ast->protocol_refs)
- if (unsigned pos = ast->protocol_refs->lastToken())
+ if (int pos = ast->protocol_refs->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
if (ast->superclass)
- if (unsigned pos = ast->superclass->lastToken())
+ if (int pos = ast->superclass->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
if (ast->colon_token)
@@ -2493,14 +2493,14 @@ unsigned Bind::calculateScopeStart(ObjCClassDeclarationAST *ast) const
return tokenAt(ast->rparen_token).utf16charsEnd();
if (ast->category_name)
- if (unsigned pos = ast->category_name->lastToken())
+ if (int pos = ast->category_name->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
if (ast->lparen_token)
return tokenAt(ast->lparen_token).utf16charsEnd();
if (ast->class_name)
- if (unsigned pos = ast->class_name->lastToken())
+ if (int pos = ast->class_name->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
return tokenAt(ast->firstToken()).utf16charsBegin();
@@ -2515,7 +2515,7 @@ bool Bind::visit(ObjCClassDeclarationAST *ast)
const Name *class_name = this->name(ast->class_name);
const Name *category_name = this->name(ast->category_name);
- const unsigned sourceLocation = location(ast->class_name, ast->firstToken());
+ const int sourceLocation = location(ast->class_name, ast->firstToken());
ObjCClass *klass = control()->newObjCClass(sourceLocation, class_name);
ast->symbol = klass;
_scope->addMember(klass);
@@ -2560,11 +2560,11 @@ bool Bind::visit(ObjCProtocolForwardDeclarationAST *ast)
List<ObjCForwardProtocolDeclaration *> **symbolTail = &ast->symbols;
- // unsigned class_token = ast->class_token;
+ // int class_token = ast->class_token;
for (NameListAST *it = ast->identifier_list; it; it = it->next) {
const Name *name = this->name(it->value);
- const unsigned sourceLocation = location(it->value, ast->firstToken());
+ const int sourceLocation = location(it->value, ast->firstToken());
ObjCForwardProtocolDeclaration *fwd = control()->newObjCForwardProtocolDeclaration(sourceLocation, name);
setDeclSpecifiers(fwd, declSpecifiers);
_scope->addMember(fwd);
@@ -2576,13 +2576,13 @@ bool Bind::visit(ObjCProtocolForwardDeclarationAST *ast)
return false;
}
-unsigned Bind::calculateScopeStart(ObjCProtocolDeclarationAST *ast) const
+int Bind::calculateScopeStart(ObjCProtocolDeclarationAST *ast) const
{
if (ast->protocol_refs)
- if (unsigned pos = ast->protocol_refs->lastToken())
+ if (int pos = ast->protocol_refs->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
if (ast->name)
- if (unsigned pos = ast->name->lastToken())
+ if (int pos = ast->name->lastToken())
return tokenAt(pos - 1).utf16charsEnd();
return tokenAt(ast->firstToken()).utf16charsBegin();
@@ -2594,10 +2594,10 @@ bool Bind::visit(ObjCProtocolDeclarationAST *ast)
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- // unsigned protocol_token = ast->protocol_token;
+ // int protocol_token = ast->protocol_token;
const Name *name = this->name(ast->name);
- const unsigned sourceLocation = location(ast->name, ast->firstToken());
+ const int sourceLocation = location(ast->name, ast->firstToken());
ObjCProtocol *protocol = control()->newObjCProtocol(sourceLocation, name);
protocol->setStartOffset(calculateScopeStart(ast));
protocol->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
@@ -2630,12 +2630,12 @@ bool Bind::visit(ObjCPropertyDeclarationAST *ast)
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
type = this->specifier(it->value, type);
}
- // unsigned property_token = ast->property_token;
- // unsigned lparen_token = ast->lparen_token;
+ // int property_token = ast->property_token;
+ // int lparen_token = ast->lparen_token;
for (ObjCPropertyAttributeListAST *it = ast->property_attribute_list; it; it = it->next) {
this->objCPropertyAttribute(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
this->declaration(ast->simple_declaration);
// List<ObjCPropertyDeclaration *> *symbols = ast->symbols;
return false;
@@ -2647,7 +2647,7 @@ bool Bind::visit(ObjCMethodDeclarationAST *ast)
if (! ast->function_body) {
const Name *name = method->name();
- unsigned sourceLocation = ast->firstToken();
+ int sourceLocation = ast->firstToken();
Declaration *decl = control()->newDeclaration(sourceLocation, name);
decl->setType(method);
_scope->addMember(decl);
@@ -2665,21 +2665,21 @@ bool Bind::visit(ObjCMethodDeclarationAST *ast)
bool Bind::visit(ObjCSynthesizedPropertiesDeclarationAST *ast)
{
- // unsigned synthesized_token = ast->synthesized_token;
+ // int synthesized_token = ast->synthesized_token;
for (ObjCSynthesizedPropertyListAST *it = ast->property_identifier_list; it; it = it->next) {
this->objCSynthesizedProperty(it->value);
}
- // unsigned semicolon_token = ast->semicolon_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
bool Bind::visit(ObjCDynamicPropertiesDeclarationAST *ast)
{
- // unsigned dynamic_token = ast->dynamic_token;
+ // int dynamic_token = ast->dynamic_token;
for (NameListAST *it = ast->property_identifier_list; it; it = it->next) {
/*const Name *value =*/ this->name(it->value);
}
- // unsigned semicolon_token = ast->semicolon_token;
+ // int semicolon_token = ast->semicolon_token;
return false;
}
@@ -2696,7 +2696,7 @@ bool Bind::visit(ObjCSelectorAST *ast) // ### review
}
if (! arguments.empty()) {
- _name = control()->selectorNameId(&arguments[0], unsigned(arguments.size()), hasArgs);
+ _name = control()->selectorNameId(&arguments[0], int(arguments.size()), hasArgs);
ast->name = _name;
}
@@ -2781,7 +2781,7 @@ bool Bind::visit(TemplateIdAST *ast)
_name = control()->templateNameId(id, isSpecialization);
else
_name = control()->templateNameId(id, isSpecialization, &templateArguments[0],
- unsigned(templateArguments.size()));
+ int(templateArguments.size()));
ast->name = _name;
return false;
@@ -3003,14 +3003,14 @@ bool Bind::visit(AlignmentSpecifierAST *ast)
bool Bind::visit(GnuAttributeSpecifierAST *ast)
{
- // unsigned attribute_token = ast->attribute_token;
- // unsigned first_lparen_token = ast->first_lparen_token;
- // unsigned second_lparen_token = ast->second_lparen_token;
+ // int attribute_token = ast->attribute_token;
+ // int first_lparen_token = ast->first_lparen_token;
+ // int second_lparen_token = ast->second_lparen_token;
for (GnuAttributeListAST *it = ast->attribute_list; it; it = it->next) {
this->attribute(it->value);
}
- // unsigned first_rparen_token = ast->first_rparen_token;
- // unsigned second_rparen_token = ast->second_rparen_token;
+ // int first_rparen_token = ast->first_rparen_token;
+ // int second_rparen_token = ast->second_rparen_token;
return false;
}
@@ -3029,9 +3029,9 @@ bool Bind::visit(DecltypeSpecifierAST *ast)
bool Bind::visit(ClassSpecifierAST *ast)
{
- // unsigned classkey_token = ast->classkey_token;
- unsigned sourceLocation = ast->firstToken();
- unsigned startScopeOffset = tokenAt(sourceLocation).utf16charsEnd(); // at the end of the class key
+ // int classkey_token = ast->classkey_token;
+ int sourceLocation = ast->firstToken();
+ int startScopeOffset = tokenAt(sourceLocation).utf16charsEnd(); // at the end of the class key
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
_type = this->specifier(it->value, _type);
@@ -3062,7 +3062,7 @@ bool Bind::visit(ClassSpecifierAST *ast)
klass->setVisibility(_visibility);
// set the class key
- unsigned classKey = tokenKind(ast->classkey_token);
+ int classKey = tokenKind(ast->classkey_token);
if (classKey == T_CLASS)
klass->setClassKey(Class::ClassKey);
else if (classKey == T_STRUCT)
@@ -3079,7 +3079,7 @@ bool Bind::visit(ClassSpecifierAST *ast)
for (BaseSpecifierListAST *it = ast->base_clause_list; it; it = it->next) {
this->baseSpecifier(it->value, ast->colon_token, klass);
}
- // unsigned dot_dot_dot_token = ast->dot_dot_dot_token;
+ // int dot_dot_dot_token = ast->dot_dot_dot_token;
for (DeclarationListAST *it = ast->member_specifier_list; it; it = it->next) {
this->declaration(it->value);
}
@@ -3100,7 +3100,7 @@ bool Bind::visit(NamedTypeSpecifierAST *ast)
bool Bind::visit(ElaboratedTypeSpecifierAST *ast)
{
- // unsigned classkey_token = ast->classkey_token;
+ // int classkey_token = ast->classkey_token;
for (SpecifierListAST *it = ast->attribute_list; it; it = it->next) {
_type = this->specifier(it->value, _type);
}
@@ -3110,7 +3110,7 @@ bool Bind::visit(ElaboratedTypeSpecifierAST *ast)
bool Bind::visit(EnumSpecifierAST *ast)
{
- unsigned sourceLocation = location(ast->name, ast->firstToken());
+ int sourceLocation = location(ast->name, ast->firstToken());
const Name *enumName = this->name(ast->name);
Enum *e = control()->newEnum(sourceLocation, enumName);
@@ -3136,7 +3136,7 @@ bool Bind::visit(EnumSpecifierAST *ast)
// PtrOperatorAST
bool Bind::visit(PointerToMemberAST *ast)
{
- const Name *memberName = 0;
+ const Name *memberName = nullptr;
for (NestedNameSpecifierListAST *it = ast->nested_name_specifier_list; it; it = it->next) {
const Name *class_or_namespace_name = this->nestedNameSpecifier(it->value);
@@ -3184,35 +3184,35 @@ bool Bind::visit(ReferenceAST *ast)
bool Bind::visit(CallAST *ast)
{
/*ExpressionTy base_expression =*/ this->expression(ast->base_expression);
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
/*ExpressionTy value =*/ this->expression(it->value);
}
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
return false;
}
bool Bind::visit(ArrayAccessAST *ast)
{
/*ExpressionTy base_expression =*/ this->expression(ast->base_expression);
- // unsigned lbracket_token = ast->lbracket_token;
+ // int lbracket_token = ast->lbracket_token;
/*ExpressionTy expression =*/ this->expression(ast->expression);
- // unsigned rbracket_token = ast->rbracket_token;
+ // int rbracket_token = ast->rbracket_token;
return false;
}
bool Bind::visit(PostIncrDecrAST *ast)
{
ExpressionTy base_expression = this->expression(ast->base_expression);
- // unsigned incr_decr_token = ast->incr_decr_token;
+ // int incr_decr_token = ast->incr_decr_token;
return false;
}
bool Bind::visit(MemberAccessAST *ast)
{
ExpressionTy base_expression = this->expression(ast->base_expression);
- // unsigned access_token = ast->access_token;
- // unsigned template_token = ast->template_token;
+ // int access_token = ast->access_token;
+ // int template_token = ast->template_token;
/*const Name *member_name =*/ this->name(ast->member_name);
return false;
}
@@ -3236,16 +3236,16 @@ bool Bind::visit(NestedDeclaratorAST *ast)
// PostfixDeclaratorAST
bool Bind::visit(FunctionDeclaratorAST *ast)
{
- Function *fun = control()->newFunction(0, 0);
+ Function *fun = control()->newFunction(0, nullptr);
fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin());
fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
if (ast->trailing_return_type)
_type = this->trailingReturnType(ast->trailing_return_type, _type);
fun->setReturnType(_type);
- // unsigned lparen_token = ast->lparen_token;
+ // int lparen_token = ast->lparen_token;
this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun);
- // unsigned rparen_token = ast->rparen_token;
+ // int rparen_token = ast->rparen_token;
FullySpecifiedType type(fun);
for (SpecifierListAST *it = ast->cv_qualifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
@@ -3266,7 +3266,7 @@ bool Bind::visit(FunctionDeclaratorAST *ast)
}
this->exceptionSpecification(ast->exception_specification, type);
- if (ast->as_cpp_initializer != 0) {
+ if (ast->as_cpp_initializer != nullptr) {
fun->setAmbiguous(true);
/*ExpressionTy as_cpp_initializer =*/ this->expression(ast->as_cpp_initializer);
}
@@ -3283,7 +3283,7 @@ bool Bind::visit(ArrayDeclaratorAST *ast)
return false;
}
-void Bind::ensureValidClassName(const Name **name, unsigned sourceLocation)
+void Bind::ensureValidClassName(const Name **name, int sourceLocation)
{
if (!*name)
return;
diff --git a/src/libs/3rdparty/cplusplus/Bind.h b/src/libs/3rdparty/cplusplus/Bind.h
index 741043fdea..0898722964 100644
--- a/src/libs/3rdparty/cplusplus/Bind.h
+++ b/src/libs/3rdparty/cplusplus/Bind.h
@@ -43,9 +43,9 @@ public:
protected:
using ASTVisitor::translationUnit;
- unsigned location(DeclaratorAST *ast, unsigned defaultLocation) const;
- unsigned location(CoreDeclaratorAST *ast, unsigned defaultLocation) const;
- unsigned location(NameAST *name, unsigned defaultLocation) const;
+ int location(DeclaratorAST *ast, int defaultLocation) const;
+ int location(CoreDeclaratorAST *ast, int defaultLocation) const;
+ int location(NameAST *name, int defaultLocation) const;
static int visibilityForAccessSpecifier(int tokenKind);
static int visibilityForClassKey(int tokenKind);
@@ -72,14 +72,14 @@ protected:
int switchMethodKey(int methodKey);
int switchObjCVisibility(int visibility);
- unsigned calculateScopeStart(ObjCClassDeclarationAST *ast) const;
- unsigned calculateScopeStart(ObjCProtocolDeclarationAST *ast) const;
+ int calculateScopeStart(ObjCClassDeclarationAST *ast) const;
+ int calculateScopeStart(ObjCProtocolDeclarationAST *ast) const;
const Name *objCSelectorArgument(ObjCSelectorArgumentAST *ast, bool *hasArg);
void attribute(GnuAttributeAST *ast);
FullySpecifiedType declarator(DeclaratorAST *ast, const FullySpecifiedType &init, DeclaratorIdAST **declaratorId);
void qtInterfaceName(QtInterfaceNameAST *ast);
- void baseSpecifier(BaseSpecifierAST *ast, unsigned colon_token, Class *klass);
+ void baseSpecifier(BaseSpecifierAST *ast, int colon_token, Class *klass);
void ctorInitializer(CtorInitializerAST *ast, Function *fun);
void enumerator(EnumeratorAST *ast, Enum *symbol);
FullySpecifiedType exceptionSpecification(ExceptionSpecificationAST *ast, const FullySpecifiedType &init);
@@ -89,7 +89,7 @@ protected:
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
OperatorNameId::Kind cppOperator(OperatorAST *ast);
- void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun);
+ void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, int lparen_token, Function *fun);
void translationUnit(TranslationUnitAST *ast);
void objCProtocolRefs(ObjCProtocolRefsAST *ast, Symbol *objcClassOrProtocol);
void objCMessageArgument(ObjCMessageArgumentAST *ast);
@@ -282,7 +282,7 @@ protected:
private:
static const int kMaxDepth;
- void ensureValidClassName(const Name **name, unsigned sourceLocation);
+ void ensureValidClassName(const Name **name, int sourceLocation);
Scope *_scope;
ExpressionTy _expression;
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp
index a5601bf620..2bbe00c293 100644
--- a/src/libs/3rdparty/cplusplus/Control.cpp
+++ b/src/libs/3rdparty/cplusplus/Control.cpp
@@ -209,21 +209,21 @@ class Control::Data
public:
Data(Control *control)
: control(control)
- , translationUnit(0)
- , diagnosticClient(0)
- , deprecatedId(0)
- , unavailableId(0)
- , objcGetterId(0)
- , objcSetterId(0)
- , objcReadwriteId(0)
- , objcReadonlyId(0)
- , objcAssignId(0)
- , objcRetainId(0)
- , objcCopyId(0)
- , objcNonatomicId(0)
- , cpp11Override(0)
- , cpp11Final(0)
- , processor(0)
+ , translationUnit(nullptr)
+ , diagnosticClient(nullptr)
+ , deprecatedId(nullptr)
+ , unavailableId(nullptr)
+ , objcGetterId(nullptr)
+ , objcSetterId(nullptr)
+ , objcReadwriteId(nullptr)
+ , objcReadonlyId(nullptr)
+ , objcAssignId(nullptr)
+ , objcRetainId(nullptr)
+ , objcCopyId(nullptr)
+ , objcNonatomicId(nullptr)
+ , cpp11Override(nullptr)
+ , cpp11Final(nullptr)
+ , processor(nullptr)
{}
~Data()
@@ -574,20 +574,20 @@ const OperatorNameId *Control::findOperatorNameId(OperatorNameId::Kind operatorI
{
Table<OperatorNameId>::const_iterator i = d->operatorNameIds.find(operatorId);
if (i == d->operatorNameIds.end())
- return 0;
+ return nullptr;
else
return &*i;
}
-const Identifier *Control::findIdentifier(const char *chars, unsigned size) const
+const Identifier *Control::findIdentifier(const char *chars, int size) const
{ return d->identifiers.findLiteral(chars, size); }
-const Identifier *Control::identifier(const char *chars, unsigned size)
+const Identifier *Control::identifier(const char *chars, int size)
{ return d->identifiers.findOrInsertLiteral(chars, size); }
const Identifier *Control::identifier(const char *chars)
{
- const unsigned length = unsigned(std::strlen(chars));
+ const int length = int(std::strlen(chars));
return identifier(chars, length);
}
@@ -609,28 +609,28 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const
Control::NumericLiteralIterator Control::lastNumericLiteral() const
{ return d->numericLiterals.end(); }
-const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
+const StringLiteral *Control::stringLiteral(const char *chars, int size)
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
const StringLiteral *Control::stringLiteral(const char *chars)
{
- const unsigned length = unsigned(std::strlen(chars));
+ const int length = int(std::strlen(chars));
return stringLiteral(chars, length);
}
-const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
+const NumericLiteral *Control::numericLiteral(const char *chars, int size)
{ return d->numericLiterals.findOrInsertLiteral(chars, size); }
const NumericLiteral *Control::numericLiteral(const char *chars)
{
- const unsigned length = unsigned(std::strlen(chars));
+ const int length = int(std::strlen(chars));
return numericLiteral(chars, length);
}
const TemplateNameId *Control::templateNameId(const Identifier *id,
bool isSpecialization,
const FullySpecifiedType *const args,
- unsigned argv)
+ int argv)
{
return d->findOrInsertTemplateNameId(id, isSpecialization, args, args + argv);
}
@@ -650,7 +650,7 @@ const QualifiedNameId *Control::qualifiedNameId(const Name *base, const Name *na
}
const SelectorNameId *Control::selectorNameId(const Name *const *names,
- unsigned nameCount,
+ int nameCount,
bool hasArguments)
{
return d->findOrInsertSelectorNameId(names, names + nameCount, hasArguments);
@@ -675,88 +675,88 @@ PointerType *Control::pointerType(const FullySpecifiedType &elementType)
ReferenceType *Control::referenceType(const FullySpecifiedType &elementType, bool rvalueRef)
{ return d->findOrInsertReferenceType(elementType, rvalueRef); }
-ArrayType *Control::arrayType(const FullySpecifiedType &elementType, unsigned size)
+ArrayType *Control::arrayType(const FullySpecifiedType &elementType, int size)
{ return d->findOrInsertArrayType(elementType, size); }
NamedType *Control::namedType(const Name *name)
{ return d->findOrInsertNamedType(name); }
-Argument *Control::newArgument(unsigned sourceLocation, const Name *name)
+Argument *Control::newArgument(int sourceLocation, const Name *name)
{ return d->newArgument(sourceLocation, name); }
-TypenameArgument *Control::newTypenameArgument(unsigned sourceLocation, const Name *name)
+TypenameArgument *Control::newTypenameArgument(int sourceLocation, const Name *name)
{ return d->newTypenameArgument(sourceLocation, name); }
-Function *Control::newFunction(unsigned sourceLocation, const Name *name)
+Function *Control::newFunction(int sourceLocation, const Name *name)
{ return d->newFunction(sourceLocation, name); }
-Namespace *Control::newNamespace(unsigned sourceLocation, const Name *name)
+Namespace *Control::newNamespace(int sourceLocation, const Name *name)
{ return d->newNamespace(sourceLocation, name); }
-Template *Control::newTemplate(unsigned sourceLocation, const Name *name)
+Template *Control::newTemplate(int sourceLocation, const Name *name)
{ return d->newTemplate(sourceLocation, name); }
-NamespaceAlias *Control::newNamespaceAlias(unsigned sourceLocation, const Name *name)
+NamespaceAlias *Control::newNamespaceAlias(int sourceLocation, const Name *name)
{ return d->newNamespaceAlias(sourceLocation, name); }
-BaseClass *Control::newBaseClass(unsigned sourceLocation, const Name *name)
+BaseClass *Control::newBaseClass(int sourceLocation, const Name *name)
{ return d->newBaseClass(sourceLocation, name); }
-Class *Control::newClass(unsigned sourceLocation, const Name *name)
+Class *Control::newClass(int sourceLocation, const Name *name)
{ return d->newClass(sourceLocation, name); }
-Enum *Control::newEnum(unsigned sourceLocation, const Name *name)
+Enum *Control::newEnum(int sourceLocation, const Name *name)
{ return d->newEnum(sourceLocation, name); }
-Block *Control::newBlock(unsigned sourceLocation)
+Block *Control::newBlock(int sourceLocation)
{ return d->newBlock(sourceLocation); }
-Declaration *Control::newDeclaration(unsigned sourceLocation, const Name *name)
+Declaration *Control::newDeclaration(int sourceLocation, const Name *name)
{ return d->newDeclaration(sourceLocation, name); }
-EnumeratorDeclaration *Control::newEnumeratorDeclaration(unsigned sourceLocation, const Name *name)
+EnumeratorDeclaration *Control::newEnumeratorDeclaration(int sourceLocation, const Name *name)
{ return d->newEnumeratorDeclaration(sourceLocation, name); }
-UsingNamespaceDirective *Control::newUsingNamespaceDirective(unsigned sourceLocation,
+UsingNamespaceDirective *Control::newUsingNamespaceDirective(int sourceLocation,
const Name *name)
{ return d->newUsingNamespaceDirective(sourceLocation, name); }
-UsingDeclaration *Control::newUsingDeclaration(unsigned sourceLocation, const Name *name)
+UsingDeclaration *Control::newUsingDeclaration(int sourceLocation, const Name *name)
{ return d->newUsingDeclaration(sourceLocation, name); }
-ForwardClassDeclaration *Control::newForwardClassDeclaration(unsigned sourceLocation,
+ForwardClassDeclaration *Control::newForwardClassDeclaration(int sourceLocation,
const Name *name)
{ return d->newForwardClassDeclaration(sourceLocation, name); }
-QtPropertyDeclaration *Control::newQtPropertyDeclaration(unsigned sourceLocation,
+QtPropertyDeclaration *Control::newQtPropertyDeclaration(int sourceLocation,
const Name *name)
{ return d->newQtPropertyDeclaration(sourceLocation, name); }
-QtEnum *Control::newQtEnum(unsigned sourceLocation, const Name *name)
+QtEnum *Control::newQtEnum(int sourceLocation, const Name *name)
{ return d->newQtEnum(sourceLocation, name); }
-ObjCBaseClass *Control::newObjCBaseClass(unsigned sourceLocation, const Name *name)
+ObjCBaseClass *Control::newObjCBaseClass(int sourceLocation, const Name *name)
{ return d->newObjCBaseClass(sourceLocation, name); }
-ObjCBaseProtocol *Control::newObjCBaseProtocol(unsigned sourceLocation, const Name *name)
+ObjCBaseProtocol *Control::newObjCBaseProtocol(int sourceLocation, const Name *name)
{ return d->newObjCBaseProtocol(sourceLocation, name); }
-ObjCClass *Control::newObjCClass(unsigned sourceLocation, const Name *name)
+ObjCClass *Control::newObjCClass(int sourceLocation, const Name *name)
{ return d->newObjCClass(sourceLocation, name); }
-ObjCForwardClassDeclaration *Control::newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name)
+ObjCForwardClassDeclaration *Control::newObjCForwardClassDeclaration(int sourceLocation, const Name *name)
{ return d->newObjCForwardClassDeclaration(sourceLocation, name); }
-ObjCProtocol *Control::newObjCProtocol(unsigned sourceLocation, const Name *name)
+ObjCProtocol *Control::newObjCProtocol(int sourceLocation, const Name *name)
{ return d->newObjCProtocol(sourceLocation, name); }
-ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name)
+ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(int sourceLocation, const Name *name)
{ return d->newObjCForwardProtocolDeclaration(sourceLocation, name); }
-ObjCMethod *Control::newObjCMethod(unsigned sourceLocation, const Name *name)
+ObjCMethod *Control::newObjCMethod(int sourceLocation, const Name *name)
{ return d->newObjCMethod(sourceLocation, name); }
-ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name)
+ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(int sourceLocation, const Name *name)
{ return d->newObjCPropertyDeclaration(sourceLocation, name); }
const Identifier *Control::deprecatedId() const
@@ -798,7 +798,7 @@ const Identifier *Control::cpp11Final() const
Symbol **Control::firstSymbol() const
{
if (d->symbols.empty())
- return 0;
+ return nullptr;
return &*d->symbols.begin();
}
@@ -806,12 +806,12 @@ Symbol **Control::firstSymbol() const
Symbol **Control::lastSymbol() const
{
if (d->symbols.empty())
- return 0;
+ return nullptr;
return &*d->symbols.begin() + d->symbols.size();
}
-unsigned Control::symbolCount() const
+int Control::symbolCount() const
{
return unsigned(d->symbols.size());
}
diff --git a/src/libs/3rdparty/cplusplus/Control.h b/src/libs/3rdparty/cplusplus/Control.h
index 97c1503833..348864a402 100644
--- a/src/libs/3rdparty/cplusplus/Control.h
+++ b/src/libs/3rdparty/cplusplus/Control.h
@@ -54,8 +54,8 @@ public:
/// Returns the canonical template name id.
const TemplateNameId *templateNameId(const Identifier *id,
bool isSpecialization,
- const FullySpecifiedType *const args = 0,
- unsigned argc = 0);
+ const FullySpecifiedType *const args = nullptr,
+ int argc = 0);
/// Returns the canonical destructor name id.
const DestructorNameId *destructorNameId(const Name *name);
@@ -70,7 +70,7 @@ public:
const QualifiedNameId *qualifiedNameId(const Name *base, const Name *name);
const SelectorNameId *selectorNameId(const Name *const *names,
- unsigned nameCount,
+ int nameCount,
bool hasArguments);
/// Returns a Type object of type VoidType.
@@ -93,82 +93,82 @@ public:
ReferenceType *referenceType(const FullySpecifiedType &elementType, bool rvalueRef);
/// Retruns a Type object of type ArrayType.
- ArrayType *arrayType(const FullySpecifiedType &elementType, unsigned size = 0);
+ ArrayType *arrayType(const FullySpecifiedType &elementType, int size = 0);
/// Returns a Type object of type NamedType.
NamedType *namedType(const Name *name);
/// Creates a new Declaration symbol.
- Declaration *newDeclaration(unsigned sourceLocation, const Name *name);
+ Declaration *newDeclaration(int sourceLocation, const Name *name);
/// Creates a new EnumeratorDeclaration symbol.
- EnumeratorDeclaration *newEnumeratorDeclaration(unsigned sourceLocation, const Name *name);
+ EnumeratorDeclaration *newEnumeratorDeclaration(int sourceLocation, const Name *name);
/// Creates a new Argument symbol.
- Argument *newArgument(unsigned sourceLocation, const Name *name = 0);
+ Argument *newArgument(int sourceLocation, const Name *name = nullptr);
/// Creates a new Argument symbol.
- TypenameArgument *newTypenameArgument(unsigned sourceLocation, const Name *name = 0);
+ TypenameArgument *newTypenameArgument(int sourceLocation, const Name *name = nullptr);
/// Creates a new Function symbol.
- Function *newFunction(unsigned sourceLocation, const Name *name = 0);
+ Function *newFunction(int sourceLocation, const Name *name = nullptr);
/// Creates a new Namespace symbol.
- Namespace *newNamespace(unsigned sourceLocation, const Name *name = 0);
+ Namespace *newNamespace(int sourceLocation, const Name *name = nullptr);
/// Creates a new Template symbol.
- Template *newTemplate(unsigned sourceLocation, const Name *name = 0);
+ Template *newTemplate(int sourceLocation, const Name *name = nullptr);
/// Creates a new Namespace symbol.
- NamespaceAlias *newNamespaceAlias(unsigned sourceLocation, const Name *name = 0);
+ NamespaceAlias *newNamespaceAlias(int sourceLocation, const Name *name = nullptr);
/// Creates a new BaseClass symbol.
- BaseClass *newBaseClass(unsigned sourceLocation, const Name *name = 0);
+ BaseClass *newBaseClass(int sourceLocation, const Name *name = nullptr);
/// Creates a new Class symbol.
- Class *newClass(unsigned sourceLocation, const Name *name = 0);
+ Class *newClass(int sourceLocation, const Name *name = nullptr);
/// Creates a new Enum symbol.
- Enum *newEnum(unsigned sourceLocation, const Name *name = 0);
+ Enum *newEnum(int sourceLocation, const Name *name = nullptr);
/// Creates a new Block symbol.
- Block *newBlock(unsigned sourceLocation);
+ Block *newBlock(int sourceLocation);
/// Creates a new UsingNamespaceDirective symbol.
- UsingNamespaceDirective *newUsingNamespaceDirective(unsigned sourceLocation, const Name *name = 0);
+ UsingNamespaceDirective *newUsingNamespaceDirective(int sourceLocation, const Name *name = nullptr);
/// Creates a new UsingDeclaration symbol.
- UsingDeclaration *newUsingDeclaration(unsigned sourceLocation, const Name *name = 0);
+ UsingDeclaration *newUsingDeclaration(int sourceLocation, const Name *name = nullptr);
/// Creates a new ForwardClassDeclaration symbol.
- ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
+ ForwardClassDeclaration *newForwardClassDeclaration(int sourceLocation, const Name *name = nullptr);
/// Creates a new QtPropertyDeclaration symbol.
- QtPropertyDeclaration *newQtPropertyDeclaration(unsigned sourceLocation, const Name *name = 0);
+ QtPropertyDeclaration *newQtPropertyDeclaration(int sourceLocation, const Name *name = nullptr);
/// Creates a new QtEnum symbol.
- QtEnum *newQtEnum(unsigned sourceLocation, const Name *name = 0);
+ QtEnum *newQtEnum(int sourceLocation, const Name *name = nullptr);
- ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, const Name *name);
- ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, const Name *name);
+ ObjCBaseClass *newObjCBaseClass(int sourceLocation, const Name *name);
+ ObjCBaseProtocol *newObjCBaseProtocol(int sourceLocation, const Name *name);
/// Creates a new Objective-C class symbol.
- ObjCClass *newObjCClass(unsigned sourceLocation, const Name *name = 0);
+ ObjCClass *newObjCClass(int sourceLocation, const Name *name = nullptr);
/// Creates a new Objective-C class forward declaration symbol.
- ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
+ ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(int sourceLocation, const Name *name = nullptr);
/// Creates a new Objective-C protocol symbol.
- ObjCProtocol *newObjCProtocol(unsigned sourceLocation, const Name *name = 0);
+ ObjCProtocol *newObjCProtocol(int sourceLocation, const Name *name = nullptr);
/// Creates a new Objective-C protocol forward declaration symbol.
- ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name = 0);
+ ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(int sourceLocation, const Name *name = nullptr);
/// Creates a new Objective-C method symbol.
- ObjCMethod *newObjCMethod(unsigned sourceLocation, const Name *name = 0);
+ ObjCMethod *newObjCMethod(int sourceLocation, const Name *name = nullptr);
/// Creates a new Objective-C @property declaration symbol.
- ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
+ ObjCPropertyDeclaration *newObjCPropertyDeclaration(int sourceLocation, const Name *name);
const Identifier *deprecatedId() const;
const Identifier *unavailableId() const;
@@ -187,8 +187,8 @@ public:
const OperatorNameId *findOperatorNameId(OperatorNameId::Kind operatorId) const;
- const Identifier *findIdentifier(const char *chars, unsigned size) const;
- const Identifier *identifier(const char *chars, unsigned size);
+ const Identifier *findIdentifier(const char *chars, int size) const;
+ const Identifier *identifier(const char *chars, int size);
const Identifier *identifier(const char *chars);
typedef const Identifier *const *IdentifierIterator;
@@ -204,15 +204,15 @@ public:
NumericLiteralIterator firstNumericLiteral() const;
NumericLiteralIterator lastNumericLiteral() const;
- const StringLiteral *stringLiteral(const char *chars, unsigned size);
+ const StringLiteral *stringLiteral(const char *chars, int size);
const StringLiteral *stringLiteral(const char *chars);
- const NumericLiteral *numericLiteral(const char *chars, unsigned size);
+ const NumericLiteral *numericLiteral(const char *chars, int size);
const NumericLiteral *numericLiteral(const char *chars);
Symbol **firstSymbol() const;
Symbol **lastSymbol() const;
- unsigned symbolCount() const;
+ int symbolCount() const;
bool hasSymbol(Symbol *symbol) const;
void addSymbol(Symbol *symbol);
diff --git a/src/libs/3rdparty/cplusplus/DiagnosticClient.h b/src/libs/3rdparty/cplusplus/DiagnosticClient.h
index 108133b97e..b009074ebd 100644
--- a/src/libs/3rdparty/cplusplus/DiagnosticClient.h
+++ b/src/libs/3rdparty/cplusplus/DiagnosticClient.h
@@ -42,7 +42,7 @@ public:
virtual void report(int level,
const StringLiteral *fileName,
- unsigned line, unsigned column,
+ int line, int column,
const char *format, va_list ap) = 0;
};
diff --git a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h
index 5a7e33a2db..aa983ada10 100644
--- a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h
+++ b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h
@@ -28,7 +28,7 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT FullySpecifiedType
{
public:
- FullySpecifiedType(Type *type = 0);
+ FullySpecifiedType(Type *type = nullptr);
~FullySpecifiedType();
bool isValid() const;
@@ -103,7 +103,7 @@ public:
bool operator != (const FullySpecifiedType &other) const;
bool operator < (const FullySpecifiedType &other) const;
- bool match(const FullySpecifiedType &otherTy, Matcher *matcher = 0) const;
+ bool match(const FullySpecifiedType &otherTy, Matcher *matcher = nullptr) const;
FullySpecifiedType simplified() const;
diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp
index 079ae0ca6e..dc24f5e96c 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.cpp
+++ b/src/libs/3rdparty/cplusplus/Lexer.cpp
@@ -64,8 +64,8 @@ Lexer::Lexer(TranslationUnit *unit)
}
Lexer::Lexer(const char *firstChar, const char *lastChar)
- : _translationUnit(0),
- _control(0),
+ : _translationUnit(nullptr),
+ _control(nullptr),
_state(0),
_flags(0),
_currentLine(1)
@@ -747,7 +747,7 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
const char *yytext = _currentChar;
int delimLength = -1;
- const char *closingDelimCandidate = 0;
+ const char *closingDelimCandidate = nullptr;
bool closed = false;
while (_yychar) {
if (_yychar == '(' && delimLength == -1) {
@@ -781,7 +781,7 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
// Make sure this continues to be a valid candidate.
if (_yychar != *(yytext + (_currentChar - closingDelimCandidate)))
- closingDelimCandidate = 0;
+ closingDelimCandidate = nullptr;
yyinp();
}
@@ -954,7 +954,8 @@ void Lexer::scanNumericLiteral(Token *tok)
yyinp();
while (std::isdigit(_yychar) ||
(_yychar >= 'a' && _yychar <= 'f') ||
- (_yychar >= 'A' && _yychar <= 'F')) {
+ (_yychar >= 'A' && _yychar <= 'F') ||
+ ((_yychar == '\'') && _languageFeatures.cxx14Enabled)) {
yyinp();
}
if (!scanOptionalIntegerSuffix())
@@ -962,7 +963,8 @@ void Lexer::scanNumericLiteral(Token *tok)
goto theEnd;
} else if (_yychar == 'b' || _yychar == 'B') { // see n3472
yyinp();
- while (_yychar == '0' || _yychar == '1')
+ while (_yychar == '0' || _yychar == '1' ||
+ ((_yychar == '\'') && _languageFeatures.cxx14Enabled))
yyinp();
if (!scanOptionalIntegerSuffix())
scanOptionalUserDefinedLiteral(tok);
@@ -970,7 +972,8 @@ void Lexer::scanNumericLiteral(Token *tok)
} else if (_yychar >= '0' && _yychar <= '7') {
do {
yyinp();
- } while (_yychar >= '0' && _yychar <= '7');
+ } while ((_yychar >= '0' && _yychar <= '7') ||
+ ((_yychar == '\'') && _languageFeatures.cxx14Enabled));
if (!scanOptionalIntegerSuffix())
scanOptionalUserDefinedLiteral(tok);
goto theEnd;
@@ -989,7 +992,8 @@ void Lexer::scanNumericLiteral(Token *tok)
if (scanExponentPart() && !scanOptionalFloatingSuffix())
scanOptionalUserDefinedLiteral(tok);
break;
- } else if (std::isdigit(_yychar)) {
+ } else if (std::isdigit(_yychar) ||
+ ((_yychar == '\'') && _languageFeatures.cxx14Enabled)) {
yyinp();
} else {
if (!scanOptionalIntegerSuffix())
diff --git a/src/libs/3rdparty/cplusplus/LiteralTable.h b/src/libs/3rdparty/cplusplus/LiteralTable.h
index 5a3f1e9042..494bc928bd 100644
--- a/src/libs/3rdparty/cplusplus/LiteralTable.h
+++ b/src/libs/3rdparty/cplusplus/LiteralTable.h
@@ -36,8 +36,8 @@ public:
public:
LiteralTable()
- : _literals(0),
- _buckets(0),
+ : _literals(nullptr),
+ _buckets(nullptr),
_allocatedLiterals(0),
_literalCount(-1),
_allocatedBuckets(0)
@@ -59,8 +59,8 @@ public:
if (_buckets)
std::free(_buckets);
- _literals = 0;
- _buckets = 0;
+ _literals = nullptr;
+ _buckets = nullptr;
_allocatedLiterals = 0;
_literalCount = -1;
_allocatedBuckets = 0;
@@ -69,10 +69,10 @@ public:
bool empty() const
{ return _literalCount == -1; }
- unsigned size() const
+ int size() const
{ return _literalCount + 1; }
- const Literal *at(unsigned index) const
+ const Literal *at(int index) const
{ return _literals[index]; }
iterator begin() const
@@ -81,7 +81,7 @@ public:
iterator end() const
{ return _literals + _literalCount + 1; }
- const Literal *findLiteral(const char *chars, unsigned size) const
+ const Literal *findLiteral(const char *chars, int size) const
{
if (_buckets) {
unsigned h = Literal::hashCode(chars, size);
@@ -92,10 +92,10 @@ public:
}
}
- return 0;
+ return nullptr;
}
- const Literal *findOrInsertLiteral(const char *chars, unsigned size)
+ const Literal *findOrInsertLiteral(const char *chars, int size)
{
if (_buckets) {
unsigned h = Literal::hashCode(chars, size);
diff --git a/src/libs/3rdparty/cplusplus/Literals.cpp b/src/libs/3rdparty/cplusplus/Literals.cpp
index 19c92e49bb..d778c2f0cc 100644
--- a/src/libs/3rdparty/cplusplus/Literals.cpp
+++ b/src/libs/3rdparty/cplusplus/Literals.cpp
@@ -28,8 +28,8 @@
using namespace CPlusPlus;
////////////////////////////////////////////////////////////////////////////////
-Literal::Literal(const char *chars, unsigned size)
- : _next(0), _index(0)
+Literal::Literal(const char *chars, int size)
+ : _next(nullptr), _index(0)
{
_chars = new char[size + 1];
@@ -79,7 +79,7 @@ unsigned Literal::hashCode(const char *chars, unsigned size)
}
////////////////////////////////////////////////////////////////////////////////
-NumericLiteral::NumericLiteral(const char *chars, unsigned size)
+NumericLiteral::NumericLiteral(const char *chars, int size)
: Literal(chars, size), _flags(0)
{
f._type = NumericLiteralIsInt;
diff --git a/src/libs/3rdparty/cplusplus/Literals.h b/src/libs/3rdparty/cplusplus/Literals.h
index 19255b619b..8a4f4332ac 100644
--- a/src/libs/3rdparty/cplusplus/Literals.h
+++ b/src/libs/3rdparty/cplusplus/Literals.h
@@ -36,15 +36,15 @@ public:
typedef iterator const_iterator;
public:
- Literal(const char *chars, unsigned size);
+ Literal(const char *chars, int size);
virtual ~Literal();
iterator begin() const { return _chars; }
iterator end() const { return _chars + _size; }
- char at(unsigned index) const { return _chars[index]; }
+ char at(int index) const { return _chars[index]; }
const char *chars() const { return _chars; }
- unsigned size() const { return _size; }
+ int size() const { return _size; }
unsigned hashCode() const { return _hashCode; }
static unsigned hashCode(const char *chars, unsigned size);
@@ -73,7 +73,7 @@ public:
class CPLUSPLUS_EXPORT NumericLiteral: public Literal
{
public:
- NumericLiteral(const char *chars, unsigned size);
+ NumericLiteral(const char *chars, int size);
enum {
NumericLiteralIsInt,
@@ -108,7 +108,7 @@ private:
class CPLUSPLUS_EXPORT Identifier: public Literal, public Name
{
public:
- Identifier(const char *chars, unsigned size)
+ Identifier(const char *chars, int size)
: Literal(chars, size)
{ }
diff --git a/src/libs/3rdparty/cplusplus/Matcher.cpp b/src/libs/3rdparty/cplusplus/Matcher.cpp
index ffb852a67c..8ef26017c6 100644
--- a/src/libs/3rdparty/cplusplus/Matcher.cpp
+++ b/src/libs/3rdparty/cplusplus/Matcher.cpp
@@ -293,7 +293,7 @@ bool Matcher::match(const ObjCMethod *type, const ObjCMethod *otherType)
else if (! type->returnType().match(otherType->returnType(), this))
return false;
- for (unsigned i = 0; i < type->argumentCount(); ++i) {
+ for (int i = 0; i < type->argumentCount(); ++i) {
Symbol *l = type->argumentAt(i);
Symbol *r = otherType->argumentAt(i);
if (! l->type().match(r->type(), this))
@@ -356,10 +356,10 @@ bool Matcher::match(const QualifiedNameId *name, const QualifiedNameId *otherNam
bool Matcher::match(const SelectorNameId *name, const SelectorNameId *otherName)
{
- const unsigned nc = name->nameCount();
+ const int nc = name->nameCount();
if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount())
return false;
- for (unsigned i = 0; i < nc; ++i)
+ for (int i = 0; i < nc; ++i)
if (! Matcher::match(name->nameAt(i), otherName->nameAt(i), this))
return false;
return true;
diff --git a/src/libs/3rdparty/cplusplus/Matcher.h b/src/libs/3rdparty/cplusplus/Matcher.h
index 6a8da9a7b7..4fc3fb1054 100644
--- a/src/libs/3rdparty/cplusplus/Matcher.h
+++ b/src/libs/3rdparty/cplusplus/Matcher.h
@@ -38,8 +38,8 @@ public:
Matcher();
virtual ~Matcher();
- static bool match(const Type *type, const Type *otherType, Matcher *matcher = 0);
- static bool match(const Name *name, const Name *otherName, Matcher *matcher = 0);
+ static bool match(const Type *type, const Type *otherType, Matcher *matcher = nullptr);
+ static bool match(const Name *name, const Name *otherName, Matcher *matcher = nullptr);
virtual bool match(const UndefinedType *type, const UndefinedType *otherType);
virtual bool match(const VoidType *type, const VoidType *otherType);
diff --git a/src/libs/3rdparty/cplusplus/MemoryPool.cpp b/src/libs/3rdparty/cplusplus/MemoryPool.cpp
index bcd5154b72..af6f7ebddb 100644
--- a/src/libs/3rdparty/cplusplus/MemoryPool.cpp
+++ b/src/libs/3rdparty/cplusplus/MemoryPool.cpp
@@ -27,11 +27,11 @@
using namespace CPlusPlus;
MemoryPool::MemoryPool()
- : _blocks(0),
+ : _blocks(nullptr),
_allocatedBlocks(0),
_blockCount(-1),
- _ptr(0),
- _end(0)
+ _ptr(nullptr),
+ _end(nullptr)
{ }
MemoryPool::~MemoryPool()
@@ -49,7 +49,7 @@ MemoryPool::~MemoryPool()
void MemoryPool::reset()
{
_blockCount = -1;
- _ptr = _end = 0;
+ _ptr = _end = nullptr;
}
void *MemoryPool::allocate_helper(size_t size)
@@ -65,7 +65,7 @@ void *MemoryPool::allocate_helper(size_t size)
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
- _blocks[index] = 0;
+ _blocks[index] = nullptr;
}
char *&block = _blocks[_blockCount];
diff --git a/src/libs/3rdparty/cplusplus/Name.cpp b/src/libs/3rdparty/cplusplus/Name.cpp
index 1016586c89..815b74bbed 100644
--- a/src/libs/3rdparty/cplusplus/Name.cpp
+++ b/src/libs/3rdparty/cplusplus/Name.cpp
@@ -35,28 +35,28 @@ Name::~Name()
{ }
bool Name::isNameId() const
-{ return asNameId() != 0; }
+{ return asNameId() != nullptr; }
bool Name::isAnonymousNameId() const
-{ return asAnonymousNameId() != 0; }
+{ return asAnonymousNameId() != nullptr; }
bool Name::isTemplateNameId() const
-{ return asTemplateNameId() != 0; }
+{ return asTemplateNameId() != nullptr; }
bool Name::isDestructorNameId() const
-{ return asDestructorNameId() != 0; }
+{ return asDestructorNameId() != nullptr; }
bool Name::isOperatorNameId() const
-{ return asOperatorNameId() != 0; }
+{ return asOperatorNameId() != nullptr; }
bool Name::isConversionNameId() const
-{ return asConversionNameId() != 0; }
+{ return asConversionNameId() != nullptr; }
bool Name::isQualifiedNameId() const
-{ return asQualifiedNameId() != 0; }
+{ return asQualifiedNameId() != nullptr; }
bool Name::isSelectorNameId() const
-{ return asSelectorNameId() != 0; }
+{ return asSelectorNameId() != nullptr; }
void Name::accept(NameVisitor *visitor) const
{
@@ -79,9 +79,9 @@ bool Name::match(const Name *other, Matcher *matcher) const
bool Name::Compare::operator()(const Name *name, const Name *other) const
{
- if (name == 0)
- return other != 0;
- if (other == 0)
+ if (name == nullptr)
+ return other != nullptr;
+ if (other == nullptr)
return false;
if (name == other)
return false;
@@ -89,9 +89,9 @@ bool Name::Compare::operator()(const Name *name, const Name *other) const
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
- if (id == 0)
- return otherId != 0;
- if (otherId == 0)
+ if (id == nullptr)
+ return otherId != nullptr;
+ if (otherId == nullptr)
return false;
return std::strcmp(id->chars(), otherId->chars()) < 0;
diff --git a/src/libs/3rdparty/cplusplus/Name.h b/src/libs/3rdparty/cplusplus/Name.h
index 460f0bca11..7a4a159ffe 100644
--- a/src/libs/3rdparty/cplusplus/Name.h
+++ b/src/libs/3rdparty/cplusplus/Name.h
@@ -44,19 +44,19 @@ public:
bool isQualifiedNameId() const;
bool isSelectorNameId() const;
- virtual const Identifier *asNameId() const { return 0; }
- virtual const AnonymousNameId *asAnonymousNameId() const { return 0; }
- virtual const TemplateNameId *asTemplateNameId() const { return 0; }
- virtual const DestructorNameId *asDestructorNameId() const { return 0; }
- virtual const OperatorNameId *asOperatorNameId() const { return 0; }
- virtual const ConversionNameId *asConversionNameId() const { return 0; }
- virtual const QualifiedNameId *asQualifiedNameId() const { return 0; }
- virtual const SelectorNameId *asSelectorNameId() const { return 0; }
+ virtual const Identifier *asNameId() const { return nullptr; }
+ virtual const AnonymousNameId *asAnonymousNameId() const { return nullptr; }
+ virtual const TemplateNameId *asTemplateNameId() const { return nullptr; }
+ virtual const DestructorNameId *asDestructorNameId() const { return nullptr; }
+ virtual const OperatorNameId *asOperatorNameId() const { return nullptr; }
+ virtual const ConversionNameId *asConversionNameId() const { return nullptr; }
+ virtual const QualifiedNameId *asQualifiedNameId() const { return nullptr; }
+ virtual const SelectorNameId *asSelectorNameId() const { return nullptr; }
void accept(NameVisitor *visitor) const;
static void accept(const Name *name, NameVisitor *visitor);
- bool match(const Name *other, Matcher *matcher = 0) const;
+ bool match(const Name *other, Matcher *matcher = nullptr) const;
public:
struct Compare {
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp
index 10bbf389d2..6bcc988f37 100644
--- a/src/libs/3rdparty/cplusplus/Names.cpp
+++ b/src/libs/3rdparty/cplusplus/Names.cpp
@@ -45,7 +45,7 @@ const Identifier *QualifiedNameId::identifier() const
if (const Name *u = name())
return u->identifier();
- return 0;
+ return nullptr;
}
const Name *QualifiedNameId::base() const
@@ -93,18 +93,18 @@ bool TemplateNameId::match0(const Name *otherName, Matcher *matcher) const
const Identifier *TemplateNameId::identifier() const
{ return _identifier; }
-unsigned TemplateNameId::templateArgumentCount() const
-{ return unsigned(_templateArguments.size()); }
+int TemplateNameId::templateArgumentCount() const
+{ return int(_templateArguments.size()); }
-const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
+const FullySpecifiedType &TemplateNameId::templateArgumentAt(int index) const
{ return _templateArguments[index]; }
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
const TemplateNameId *other) const
{
- if (name == 0)
- return other != 0;
- if (other == 0)
+ if (name == nullptr)
+ return other != nullptr;
+ if (other == nullptr)
return false;
if (name == other)
return false;
@@ -112,9 +112,9 @@ bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
const Identifier *id = name->identifier();
const Identifier *otherId = other->identifier();
- if (id == 0)
- return otherId != 0;
- if (otherId == 0)
+ if (id == nullptr)
+ return otherId != nullptr;
+ if (otherId == nullptr)
return false;
const int c = std::strcmp(id->chars(), otherId->chars());
@@ -154,7 +154,7 @@ OperatorNameId::Kind OperatorNameId::kind() const
{ return _kind; }
const Identifier *OperatorNameId::identifier() const
-{ return 0; }
+{ return nullptr; }
ConversionNameId::ConversionNameId(const FullySpecifiedType &type)
: _type(type)
@@ -177,7 +177,7 @@ FullySpecifiedType ConversionNameId::type() const
{ return _type; }
const Identifier *ConversionNameId::identifier() const
-{ return 0; }
+{ return nullptr; }
SelectorNameId::~SelectorNameId()
{ }
@@ -195,28 +195,28 @@ bool SelectorNameId::match0(const Name *otherName, Matcher *matcher) const
const Identifier *SelectorNameId::identifier() const
{
if (_names.empty())
- return 0;
+ return nullptr;
return nameAt(0)->identifier();
}
-unsigned SelectorNameId::nameCount() const
-{ return unsigned(_names.size()); }
+int SelectorNameId::nameCount() const
+{ return int(_names.size()); }
-const Name *SelectorNameId::nameAt(unsigned index) const
+const Name *SelectorNameId::nameAt(int index) const
{ return _names[index]; }
bool SelectorNameId::hasArguments() const
{ return _hasArguments; }
-AnonymousNameId::AnonymousNameId(unsigned classTokenIndex)
+AnonymousNameId::AnonymousNameId(int classTokenIndex)
: _classTokenIndex(classTokenIndex)
{ }
AnonymousNameId::~AnonymousNameId()
{ }
-unsigned AnonymousNameId::classTokenIndex() const
+int AnonymousNameId::classTokenIndex() const
{
return _classTokenIndex;
}
@@ -232,4 +232,4 @@ bool AnonymousNameId::match0(const Name *otherName, Matcher *matcher) const
}
const Identifier *AnonymousNameId::identifier() const
-{ return 0; }
+{ return nullptr; }
diff --git a/src/libs/3rdparty/cplusplus/Names.h b/src/libs/3rdparty/cplusplus/Names.h
index b8d090da2f..cea93911c6 100644
--- a/src/libs/3rdparty/cplusplus/Names.h
+++ b/src/libs/3rdparty/cplusplus/Names.h
@@ -88,8 +88,8 @@ public:
virtual const Identifier *identifier() const;
// ### find a better name
- unsigned templateArgumentCount() const;
- const FullySpecifiedType &templateArgumentAt(unsigned index) const;
+ int templateArgumentCount() const;
+ const FullySpecifiedType &templateArgumentAt(int index) const;
virtual const TemplateNameId *asTemplateNameId() const
{ return this; }
@@ -224,8 +224,8 @@ public:
virtual const Identifier *identifier() const;
- unsigned nameCount() const;
- const Name *nameAt(unsigned index) const;
+ int nameCount() const;
+ const Name *nameAt(int index) const;
bool hasArguments() const;
virtual const SelectorNameId *asSelectorNameId() const
@@ -248,10 +248,10 @@ private:
class CPLUSPLUS_EXPORT AnonymousNameId: public Name
{
public:
- AnonymousNameId(unsigned classTokenIndex);
+ AnonymousNameId(int classTokenIndex);
virtual ~AnonymousNameId();
- unsigned classTokenIndex() const;
+ int classTokenIndex() const;
virtual const Identifier *identifier() const;
@@ -263,7 +263,7 @@ protected:
virtual bool match0(const Name *otherName, Matcher *matcher) const;
private:
- unsigned _classTokenIndex;
+ int _classTokenIndex;
};
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp
index 6bee0fa972..fd7b963a87 100644
--- a/src/libs/3rdparty/cplusplus/Parser.cpp
+++ b/src/libs/3rdparty/cplusplus/Parser.cpp
@@ -49,7 +49,7 @@ class DebugRule {
public:
static int depth;
- DebugRule(const char *name, const char *spell, unsigned idx, bool blocked)
+ DebugRule(const char *name, const char *spell, int idx, bool blocked)
{
for (int i = 0; i <= depth; ++i)
fputc('-', stderr);
@@ -170,20 +170,20 @@ public:
};
struct CacheKey {
- CacheKey(unsigned initialCursor, ASTKind astKind)
+ CacheKey(int initialCursor, ASTKind astKind)
: initialCursor(initialCursor)
, astKind(astKind)
{}
- const unsigned initialCursor;
+ const int initialCursor;
const ASTKind astKind;
};
public:
ASTCache() {}
- void insert(ASTKind astKind, unsigned tokenIndexBeforeParsing,
- AST *resultingAST, unsigned resultingTokenIndex, bool resultingReturnValue)
+ void insert(ASTKind astKind, int tokenIndexBeforeParsing,
+ AST *resultingAST, int resultingTokenIndex, bool resultingReturnValue)
{
const auto key = std::make_pair(astKind, tokenIndexBeforeParsing);
@@ -195,14 +195,14 @@ public:
_cache.insert(keyValue);
}
- AST *find(ASTKind astKind, unsigned tokenIndex,
- unsigned *resultingTokenIndex, bool *foundInCache, bool *returnValue) const
+ AST *find(ASTKind astKind, int tokenIndex,
+ int *resultingTokenIndex, bool *foundInCache, bool *returnValue) const
{
const auto key = std::make_pair(astKind, tokenIndex);
const auto it = _cache.find(key);
if (it == _cache.end()) {
*foundInCache = false;
- return 0;
+ return nullptr;
} else {
*foundInCache = true;
*resultingTokenIndex = it->second.resultingTokenIndex;
@@ -224,11 +224,11 @@ private:
struct ParseFunctionResult {
AST *resultingAST;
- unsigned resultingTokenIndex;
+ int resultingTokenIndex;
bool returnValue;
};
- typedef std::pair<int, unsigned> ASTKindAndTokenIndex;
+ typedef std::pair<int, int> ASTKindAndTokenIndex;
std::unordered_map<ASTKindAndTokenIndex, ParseFunctionResult, KeyHasher> _cache;
};
@@ -251,7 +251,7 @@ inline void debugPrintCheckCache(bool) {}
#define CHECK_CACHE(ASTKind, ASTType) \
do { \
bool foundInCache; \
- unsigned newTokenIndex; \
+ int newTokenIndex; \
bool returnValue; \
if (AST *ast = _astCache->find(ASTKind, cursor(), \
&newTokenIndex, &foundInCache, &returnValue)) { \
@@ -486,7 +486,7 @@ int Parser::find(int token, int stopAt)
return 0;
}
-void Parser::match(int kind, unsigned *token)
+void Parser::match(int kind, int *token)
{
if (LA() == kind)
*token = consumeToken();
@@ -501,7 +501,7 @@ bool Parser::parseClassOrNamespaceName(NameAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_IDENTIFIER && (LA(2) == T_COLON_COLON || LA(2) == T_LESS)) {
- unsigned identifier_token = cursor();
+ int identifier_token = cursor();
if (LA(2) == T_LESS) {
bool blocked = blockErrors(true);
@@ -521,7 +521,7 @@ bool Parser::parseClassOrNamespaceName(NameAST *&node)
return true;
}
} else if (LA() == T_TEMPLATE) {
- unsigned template_token = consumeToken();
+ int template_token = consumeToken();
if (parseTemplateId(node, template_token) && LA() == T_COLON_COLON)
return true;
rewind(template_token);
@@ -529,12 +529,12 @@ bool Parser::parseClassOrNamespaceName(NameAST *&node)
return false;
}
-bool Parser::parseTemplateId(NameAST *&node, unsigned template_token)
+bool Parser::parseTemplateId(NameAST *&node, int template_token)
{
DEBUG_THIS_RULE();
CHECK_CACHE(ASTCache::TemplateId, NameAST);
- const unsigned start = cursor();
+ const int start = cursor();
if (LA() == T_IDENTIFIER && LA(2) == T_LESS) {
TemplateIdAST *ast = new (_pool) TemplateIdAST;
@@ -554,7 +554,7 @@ bool Parser::parseTemplateId(NameAST *&node, unsigned template_token)
}
const bool result = false;
- _astCache->insert(ASTCache::TemplateId, start, 0, cursor(), result);
+ _astCache->insert(ASTCache::TemplateId, start, nullptr, cursor(), result);
rewind(start);
return result;
}
@@ -564,9 +564,9 @@ bool Parser::parseNestedNameSpecifier(NestedNameSpecifierListAST *&node,
{
DEBUG_THIS_RULE();
NestedNameSpecifierListAST **nested_name_specifier = &node;
- NameAST *class_or_namespace_name = 0;
+ NameAST *class_or_namespace_name = nullptr;
if (parseClassOrNamespaceName(class_or_namespace_name) && LA() == T_COLON_COLON) {
- unsigned scope_token = consumeToken();
+ int scope_token = consumeToken();
NestedNameSpecifierAST *name = new (_pool) NestedNameSpecifierAST;
name->class_or_namespace_name = class_or_namespace_name;
@@ -598,7 +598,7 @@ bool Parser::parseNestedNameSpecifier(NestedNameSpecifierListAST *&node,
bool Parser::parseNestedNameSpecifierOpt(NestedNameSpecifierListAST *&name, bool acceptTemplateId)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
if (! parseNestedNameSpecifier(name, acceptTemplateId))
rewind(start);
return true;
@@ -607,7 +607,7 @@ bool Parser::parseNestedNameSpecifierOpt(NestedNameSpecifierListAST *&name, bool
bool Parser::parseName(NameAST *&node, bool acceptTemplateId)
{
DEBUG_THIS_RULE();
- unsigned global_scope_token = 0;
+ int global_scope_token = 0;
switch (LA()) {
case T_COLON_COLON:
@@ -623,13 +623,13 @@ bool Parser::parseName(NameAST *&node, bool acceptTemplateId)
if (LA() == T_COLON_COLON)
global_scope_token = consumeToken();
- NestedNameSpecifierListAST *nested_name_specifier = 0;
+ NestedNameSpecifierListAST *nested_name_specifier = nullptr;
parseNestedNameSpecifierOpt(nested_name_specifier,
/*acceptTemplateId=*/ true);
- NameAST *unqualified_name = 0;
+ NameAST *unqualified_name = nullptr;
if (parseUnqualifiedName(unqualified_name,
- /*acceptTemplateId=*/ acceptTemplateId || nested_name_specifier != 0)) {
+ /*acceptTemplateId=*/ acceptTemplateId || nested_name_specifier != nullptr)) {
if (! global_scope_token && ! nested_name_specifier) {
node = unqualified_name;
return true;
@@ -653,9 +653,9 @@ bool Parser::parseTranslationUnit(TranslationUnitAST *&node)
DeclarationListAST **decl = &ast->declaration_list;
while (LA()) {
- unsigned start_declaration = cursor();
+ int start_declaration = cursor();
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
if (parseDeclaration(declaration)) {
*decl = new (_pool) DeclarationListAST;
@@ -729,15 +729,15 @@ bool Parser::parseDeclaration(DeclarationAST *&node)
case T_Q_DECLARE_INTERFACE:
{
consumeToken();
- unsigned lparen_token = 0;
+ int lparen_token = 0;
match(T_LPAREN, &lparen_token);
- NameAST *name = 0;
+ NameAST *name = nullptr;
parseName(name);
- unsigned comma_token = 0;
+ int comma_token = 0;
match(T_COMMA, &comma_token);
- unsigned string_literal = 0;
+ int string_literal = 0;
match(T_STRING_LITERAL, &string_literal);
- unsigned rparen_token = 0;
+ int rparen_token = 0;
match(T_RPAREN, &rparen_token);
} return true;
@@ -759,8 +759,8 @@ bool Parser::parseDeclaration(DeclarationAST *&node)
default: {
if (_languageFeatures.objCEnabled && LA() == T___ATTRIBUTE__) {
- const unsigned start = cursor();
- SpecifierListAST *attributes = 0, **attr = &attributes;
+ const int start = cursor();
+ SpecifierListAST *attributes = nullptr, **attr = &attributes;
while (parseGnuAttributeSpecifier(*attr))
attr = &(*attr)->next;
if (LA() == T_AT_INTERFACE)
@@ -817,8 +817,8 @@ bool Parser::parseLinkageBody(DeclarationAST *&node)
if (tk == T_RBRACE)
break;
- unsigned start_declaration = cursor();
- DeclarationAST *declaration = 0;
+ int start_declaration = cursor();
+ DeclarationAST *declaration = nullptr;
if (parseDeclaration(declaration)) {
*declaration_ptr = new (_pool) DeclarationListAST;
(*declaration_ptr)->value = declaration;
@@ -865,11 +865,11 @@ bool Parser::parseNamespace(DeclarationAST *&node)
&& !isNestedNamespace())
return false;
- unsigned inline_token = 0;
+ int inline_token = 0;
if (_languageFeatures.cxx11Enabled && LA() == T_INLINE)
inline_token = consumeToken();
- unsigned namespace_token = consumeToken();
+ int namespace_token = consumeToken();
if (LA() == T_IDENTIFIER && LA(2) == T_EQUAL) {
if (inline_token)
@@ -896,7 +896,7 @@ bool Parser::parseNamespace(DeclarationAST *&node)
} else if (LA() == T_LBRACE) {
parseLinkageBody(ast->linkage_body);
} else { // attempt to do error recovery
- unsigned pos = cursor();
+ int pos = cursor();
for (;LA() != T_EOF_SYMBOL; consumeToken()) {
switch (LA()) {
case T_IDENTIFIER:
@@ -932,7 +932,7 @@ bool Parser::isNestedNamespace() const
bool Parser::parseNestedNamespace(DeclarationAST *&node)
{
DEBUG_THIS_RULE();
- DeclarationAST *ast = 0;
+ DeclarationAST *ast = nullptr;
if (isNestedNamespace() && parseNamespace(ast)) {
node = ast;
return true;
@@ -1003,7 +1003,7 @@ bool Parser::parseAliasDeclaration(DeclarationAST *&node)
alias->equal_token = consumeToken();
- ExpressionAST *expr = 0;
+ ExpressionAST *expr = nullptr;
parseTypeId(expr);
if (expr)
alias->typeId = expr->asTypeId();
@@ -1019,11 +1019,11 @@ bool Parser::parseConversionFunctionId(NameAST *&node)
DEBUG_THIS_RULE();
if (LA() != T_OPERATOR)
return false;
- unsigned operator_token = consumeToken();
- SpecifierListAST *type_specifier = 0;
+ int operator_token = consumeToken();
+ SpecifierListAST *type_specifier = nullptr;
if (! parseTypeSpecifier(type_specifier))
return false;
- PtrOperatorListAST *ptr_operators = 0, **ptr_operators_tail = &ptr_operators;
+ PtrOperatorListAST *ptr_operators = nullptr, **ptr_operators_tail = &ptr_operators;
while (parsePtrOperator(*ptr_operators_tail))
ptr_operators_tail = &(*ptr_operators_tail)->next;
@@ -1040,9 +1040,9 @@ bool Parser::parseOperatorFunctionId(NameAST *&node)
DEBUG_THIS_RULE();
if (LA() != T_OPERATOR)
return false;
- unsigned operator_token = consumeToken();
+ int operator_token = consumeToken();
- OperatorAST *op = 0;
+ OperatorAST *op = nullptr;
if (! parseOperator(op))
return false;
@@ -1053,13 +1053,13 @@ bool Parser::parseOperatorFunctionId(NameAST *&node)
return true;
}
-Parser::TemplateArgumentListEntry *Parser::templateArgumentListEntry(unsigned tokenIndex)
+Parser::TemplateArgumentListEntry *Parser::templateArgumentListEntry(int tokenIndex)
{
- std::map<unsigned, TemplateArgumentListEntry>::iterator it =_templateArgumentList.find(tokenIndex);
+ std::map<int, TemplateArgumentListEntry>::iterator it =_templateArgumentList.find(tokenIndex);
if (it != _templateArgumentList.end())
return &it->second;
- return 0;
+ return nullptr;
}
bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
@@ -1069,13 +1069,13 @@ bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
if (TemplateArgumentListEntry *entry = templateArgumentListEntry(cursor())) {
rewind(entry->cursor);
node = entry->ast;
- return entry->ast != 0;
+ return entry->ast != nullptr;
}
- unsigned start = cursor();
+ int start = cursor();
ExpressionListAST **template_argument_ptr = &node;
- ExpressionAST *template_argument = 0;
+ ExpressionAST *template_argument = nullptr;
const bool cxx11Enabled = _languageFeatures.cxx11Enabled;
if (parseTemplateArgument(template_argument)) {
*template_argument_ptr = new (_pool) ExpressionListAST;
@@ -1103,14 +1103,14 @@ bool Parser::parseTemplateArgumentList(ExpressionListAST *&node)
ExpressionListAST *template_argument_list = node;
for (ExpressionListAST *iter = template_argument_list, **ast_iter = &node;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
- *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0);
+ *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : nullptr);
}
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node)));
return true;
}
- _templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), 0)));
+ _templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), nullptr)));
return false;
}
@@ -1127,7 +1127,7 @@ bool Parser::parseAsmDefinition(DeclarationAST *&node)
ast->volatile_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- unsigned string_literal_token = 0;
+ int string_literal_token = 0;
match(T_STRING_LITERAL, &string_literal_token);
while (LA() == T_STRING_LITERAL) {
consumeToken();
@@ -1181,19 +1181,19 @@ bool Parser::parseAsmOperandList()
bool Parser::parseAsmOperand()
{
DEBUG_THIS_RULE();
- unsigned string_literal_token = 0;
+ int string_literal_token = 0;
match(T_STRING_LITERAL, &string_literal_token);
if (LA() == T_LBRACKET) {
- /*unsigned lbracket_token = */ consumeToken();
+ /*int lbracket_token = */ consumeToken();
match(T_STRING_LITERAL, &string_literal_token);
- unsigned rbracket_token = 0;
+ int rbracket_token = 0;
match(T_RBRACKET, &rbracket_token);
}
- unsigned lparen_token = 0, rparen_token = 0;
+ int lparen_token = 0, rparen_token = 0;
match(T_LPAREN, &lparen_token);
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
parseExpression(expression);
match(T_RPAREN, &rparen_token);
return true;
@@ -1205,7 +1205,7 @@ bool Parser::parseAsmClobberList()
if (LA() != T_STRING_LITERAL)
return false;
- unsigned string_literal_token = consumeToken();
+ int string_literal_token = consumeToken();
while (LA() == T_COMMA) {
consumeToken();
@@ -1236,9 +1236,9 @@ bool Parser::parseTemplateDeclaration(DeclarationAST *&node)
}
while (LA()) {
- unsigned start_declaration = cursor();
+ int start_declaration = cursor();
- ast->declaration = 0;
+ ast->declaration = nullptr;
if (parseDeclaration(ast->declaration))
break;
@@ -1335,7 +1335,7 @@ bool Parser::parseCvQualifiers(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
SpecifierListAST **ast = &node;
while (*ast)
@@ -1357,7 +1357,7 @@ bool Parser::parseCvQualifiers(SpecifierListAST *&node)
return start != cursor();
}
-bool Parser::parseRefQualifier(unsigned &ref_qualifier)
+bool Parser::parseRefQualifier(int &ref_qualifier)
{
DEBUG_THIS_RULE();
@@ -1382,7 +1382,7 @@ bool Parser::parseOverrideFinalQualifiers(SpecifierListAST *&node)
if (!_languageFeatures.cxx11Enabled)
return false;
- unsigned start = cursor();
+ int start = cursor();
SpecifierListAST **ast = &node;
while (*ast)
@@ -1421,13 +1421,13 @@ bool Parser::parsePtrOperator(PtrOperatorListAST *&node)
node = new (_pool) PtrOperatorListAST(ast);
return true;
} else if (LA() == T_COLON_COLON || LA() == T_IDENTIFIER) {
- unsigned scope_or_identifier_token = cursor();
+ int scope_or_identifier_token = cursor();
- unsigned global_scope_token = 0;
+ int global_scope_token = 0;
if (LA() == T_COLON_COLON)
global_scope_token = consumeToken();
- NestedNameSpecifierListAST *nested_name_specifiers = 0;
+ NestedNameSpecifierListAST *nested_name_specifiers = nullptr;
bool has_nested_name_specifier = parseNestedNameSpecifier(nested_name_specifiers, true);
if (has_nested_name_specifier && LA() == T_STAR) {
PointerToMemberAST *ast = new (_pool) PointerToMemberAST;
@@ -1446,7 +1446,7 @@ bool Parser::parsePtrOperator(PtrOperatorListAST *&node)
bool Parser::parseTemplateArgument(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
if (parseTypeId(node)) {
int index = 1;
@@ -1482,7 +1482,7 @@ bool Parser::parseDeclSpecifierSeq(SpecifierListAST *&decl_specifier_seq,
{
DEBUG_THIS_RULE();
bool has_type_specifier = false;
- NameAST *named_type_specifier = 0;
+ NameAST *named_type_specifier = nullptr;
SpecifierListAST **decl_specifier_seq_ptr = &decl_specifier_seq;
for (;;) {
if (! noStorageSpecifiers && ! onlySimpleTypeSpecifiers && lookAtStorageClassSpecifier()) {
@@ -1515,7 +1515,7 @@ bool Parser::parseDeclSpecifierSeq(SpecifierListAST *&decl_specifier_seq,
} else if (! onlySimpleTypeSpecifiers && ! has_type_specifier &&
(LA() == T_TYPENAME || LA() == T_ENUM || lookAtClassKey())) {
// typename-specifier, elaborated-type-specifier
- unsigned startOfElaboratedTypeSpecifier = cursor();
+ int startOfElaboratedTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
error(startOfElaboratedTypeSpecifier, "expected an elaborated type specifier");
break;
@@ -1526,13 +1526,13 @@ bool Parser::parseDeclSpecifierSeq(SpecifierListAST *&decl_specifier_seq,
break;
}
- return decl_specifier_seq != 0;
+ return decl_specifier_seq != nullptr;
}
bool Parser::parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
bool blocked = blockErrors(true);
if (parseDeclarator(node, decl_specifier_list)) {
blockErrors(blocked);
@@ -1546,23 +1546,23 @@ bool Parser::parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, Specifier
bool Parser::parseCoreDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
- SpecifierListAST *attributes = 0;
+ int start = cursor();
+ SpecifierListAST *attributes = nullptr;
parseOptionalAttributeSpecifierSequence(attributes);
- PtrOperatorListAST *ptr_operators = 0, **ptr_operators_tail = &ptr_operators;
+ PtrOperatorListAST *ptr_operators = nullptr, **ptr_operators_tail = &ptr_operators;
while (parsePtrOperator(*ptr_operators_tail))
ptr_operators_tail = &(*ptr_operators_tail)->next;
if (LA() == T_COLON_COLON || LA() == T_IDENTIFIER || LA() == T_TILDE || LA() == T_OPERATOR
|| (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COLON_COLON || LA(2) == T_IDENTIFIER))) {
- unsigned dot_dot_dot_token = 0;
+ int dot_dot_dot_token = 0;
if (LA() == T_DOT_DOT_DOT)
dot_dot_dot_token = consumeToken();
- NameAST *name = 0;
+ NameAST *name = nullptr;
if (parseName(name)) {
DeclaratorIdAST *declarator_id = new (_pool) DeclaratorIdAST;
declarator_id->dot_dot_dot_token = dot_dot_dot_token;
@@ -1578,8 +1578,8 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
if (attributes)
warning(attributes->firstToken(), "unexpected attribtues");
- unsigned lparen_token = consumeToken();
- DeclaratorAST *declarator = 0;
+ int lparen_token = consumeToken();
+ DeclaratorAST *declarator = nullptr;
if (parseDeclarator(declarator, decl_specifier_list) && LA() == T_RPAREN) {
NestedDeclaratorAST *nested_declarator = new (_pool) NestedDeclaratorAST;
nested_declarator->lparen_token = lparen_token;
@@ -1623,17 +1623,17 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
PostfixDeclaratorListAST **postfix_ptr = &node->postfix_declarator_list;
for (;;) {
- unsigned startOfPostDeclarator = cursor();
+ int startOfPostDeclarator = cursor();
if (LA() == T_LPAREN) {
if (! declaringClass && LA(2) != T_RPAREN && maybeCppInitializer(node)) {
- unsigned lparen_token = cursor();
- ExpressionAST *initializer = 0;
+ int lparen_token = cursor();
+ ExpressionAST *initializer = nullptr;
bool blocked = blockErrors(true);
if (parseInitializer(initializer, &node->equal_token)) {
// maybe the initializer also parses as a FunctionDeclarator?
- ExpressionListParenAST *expr = 0;
+ ExpressionListParenAST *expr = nullptr;
if (initializer)
expr = initializer->asExpressionListParen();
if (expr) {
@@ -1643,9 +1643,9 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif
// check for ambiguous declarators.
consumeToken();
- ParameterDeclarationClauseAST *parameter_declaration_clause = 0;
+ ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr;
if (parseParameterDeclarationClause(parameter_declaration_clause) && LA() == T_RPAREN) {
- unsigned rparen_token = consumeToken();
+ int rparen_token = consumeToken();
FunctionDeclaratorAST *ast = new (_pool) FunctionDeclaratorAST;
ast->lparen_token = lparen_token;
@@ -1730,15 +1730,15 @@ bool Parser::parseAbstractCoreDeclarator(DeclaratorAST *&node, SpecifierListAST
{
DEBUG_THIS_RULE();
- PtrOperatorListAST *ptr_operators = 0, **ptr_operators_tail = &ptr_operators;
+ PtrOperatorListAST *ptr_operators = nullptr, **ptr_operators_tail = &ptr_operators;
while (parsePtrOperator(*ptr_operators_tail))
ptr_operators_tail = &(*ptr_operators_tail)->next;
- unsigned after_ptr_operators = cursor();
+ int after_ptr_operators = cursor();
if (LA() == T_LPAREN && LA(2) != T_RPAREN) {
- unsigned lparen_token = consumeToken();
- DeclaratorAST *declarator = 0;
+ int lparen_token = consumeToken();
+ DeclaratorAST *declarator = nullptr;
if (parseAbstractDeclarator(declarator, decl_specifier_list) && LA() == T_RPAREN) {
NestedDeclaratorAST *nested_declarator = new (_pool) NestedDeclaratorAST;
nested_declarator->lparen_token = lparen_token;
@@ -1768,7 +1768,7 @@ bool Parser::parseAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *dec
if (! parseAbstractCoreDeclarator(node, decl_specifier_list))
return false;
- PostfixDeclaratorListAST *postfix_declarators = 0,
+ PostfixDeclaratorListAST *postfix_declarators = nullptr,
**postfix_ptr = &postfix_declarators;
for (;;) {
@@ -1844,7 +1844,7 @@ bool Parser::parseEnumSpecifier(SpecifierListAST *&node)
}
if (LA() == T_LBRACE) {
ast->lbrace_token = consumeToken();
- unsigned comma_token = 0;
+ int comma_token = 0;
EnumeratorListAST **enumerator_ptr = &ast->enumerator_list;
while (int tk = LA()) {
if (tk == T_RBRACE)
@@ -1879,7 +1879,7 @@ bool Parser::parseTemplateParameterList(DeclarationListAST *&node)
{
DEBUG_THIS_RULE();
DeclarationListAST **template_parameter_ptr = &node;
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
if (parseTemplateParameter(declaration)) {
*template_parameter_ptr = new (_pool) DeclarationListAST;
(*template_parameter_ptr)->value = declaration;
@@ -1888,7 +1888,7 @@ bool Parser::parseTemplateParameterList(DeclarationListAST *&node)
while (LA() == T_COMMA) {
consumeToken(); // XXX Store this token somewhere
- declaration = 0;
+ declaration = nullptr;
if (parseTemplateParameter(declaration)) {
*template_parameter_ptr = new (_pool) DeclarationListAST;
(*template_parameter_ptr)->value = declaration;
@@ -1906,7 +1906,7 @@ bool Parser::parseTemplateParameter(DeclarationAST *&node)
if (parseTypeParameter(node))
return true;
bool previousTemplateArguments = switchTemplateArguments(true);
- ParameterDeclarationAST *ast = 0;
+ ParameterDeclarationAST *ast = nullptr;
bool parsed = parseParameterDeclaration(ast);
node = ast;
(void) switchTemplateArguments(previousTemplateArguments);
@@ -2005,7 +2005,7 @@ bool Parser::parseTypeId(ExpressionAST *&node)
DEBUG_THIS_RULE();
CHECK_CACHE(ASTCache::TypeId, ExpressionAST);
- SpecifierListAST *type_specifier = 0;
+ SpecifierListAST *type_specifier = nullptr;
if (parseTypeSpecifier(type_specifier)) {
TypeIdAST *ast = new (_pool) TypeIdAST;
ast->type_specifier_list = type_specifier;
@@ -2022,11 +2022,11 @@ bool Parser::parseParameterDeclarationClause(ParameterDeclarationClauseAST *&nod
if (LA() == T_RPAREN)
return true; // nothing to do
CHECK_CACHE(ASTCache::ParameterDeclarationClause, ParameterDeclarationClauseAST);
- const unsigned initialCursor = cursor();
+ const int initialCursor = cursor();
- ParameterDeclarationListAST *parameter_declarations = 0;
+ ParameterDeclarationListAST *parameter_declarations = nullptr;
- unsigned dot_dot_dot_token = 0;
+ int dot_dot_dot_token = 0;
if (LA() == T_DOT_DOT_DOT)
dot_dot_dot_token = consumeToken();
else {
@@ -2059,7 +2059,7 @@ bool Parser::parseParameterDeclarationList(ParameterDeclarationListAST *&node)
return false; // nothing to do.
ParameterDeclarationListAST **parameter_declaration_ptr = &node;
- ParameterDeclarationAST *declaration = 0;
+ ParameterDeclarationAST *declaration = nullptr;
if (parseParameterDeclaration(declaration)) {
*parameter_declaration_ptr = new (_pool) ParameterDeclarationListAST;
(*parameter_declaration_ptr)->value = declaration;
@@ -2070,7 +2070,7 @@ bool Parser::parseParameterDeclarationList(ParameterDeclarationListAST *&node)
if (LA() == T_DOT_DOT_DOT)
break;
- declaration = 0;
+ declaration = nullptr;
if (parseParameterDeclaration(declaration)) {
*parameter_declaration_ptr = new (_pool) ParameterDeclarationListAST;
(*parameter_declaration_ptr)->value = declaration;
@@ -2085,7 +2085,7 @@ bool Parser::parseParameterDeclarationList(ParameterDeclarationListAST *&node)
bool Parser::parseParameterDeclaration(ParameterDeclarationAST *&node)
{
DEBUG_THIS_RULE();
- SpecifierListAST *decl_specifier_seq = 0;
+ SpecifierListAST *decl_specifier_seq = nullptr;
if (parseDeclSpecifierSeq(decl_specifier_seq)) {
ParameterDeclarationAST *ast = new (_pool) ParameterDeclarationAST;
ast->type_specifier_list = decl_specifier_seq;
@@ -2107,7 +2107,7 @@ bool Parser::parseParameterDeclaration(ParameterDeclarationAST *&node)
const Identifier *Parser::className(ClassSpecifierAST *ast) const
{
if (! ast)
- return 0;
+ return nullptr;
return identifier(ast->name);
}
@@ -2115,7 +2115,7 @@ const Identifier *Parser::className(ClassSpecifierAST *ast) const
const Identifier *Parser::identifier(NameAST *name) const
{
if (! name)
- return 0;
+ return nullptr;
if (QualifiedNameAST *q = name->asQualifiedName())
name = q->unqualified_name;
@@ -2127,7 +2127,7 @@ const Identifier *Parser::identifier(NameAST *name) const
return _translationUnit->identifier(template_id->identifier_token);
}
- return 0;
+ return nullptr;
}
bool Parser::parseClassSpecifier(SpecifierListAST *&node)
@@ -2136,9 +2136,9 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
if (! lookAtClassKey())
return false;
- unsigned classkey_token = consumeToken();
+ int classkey_token = consumeToken();
- SpecifierListAST *attributes = 0;
+ SpecifierListAST *attributes = nullptr;
parseOptionalAttributeSpecifierSequence(attributes);
if (LA(1) == T_IDENTIFIER && LA(2) == T_IDENTIFIER) {
@@ -2150,7 +2150,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
}
}
- NameAST *name = 0;
+ NameAST *name = nullptr;
parseName(name);
bool parsed = false;
@@ -2158,9 +2158,9 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
const bool previousInFunctionBody = _inFunctionBody;
_inFunctionBody = false;
- unsigned colon_token = 0;
- unsigned dot_dot_dot_token = 0;
- unsigned final_token = 0;
+ int colon_token = 0;
+ int dot_dot_dot_token = 0;
+ int final_token = 0;
if (LA() == T_IDENTIFIER) {
const Identifier *id = tok().identifier;
@@ -2175,7 +2175,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
name = ast;
}
- BaseSpecifierListAST *base_clause_list = 0;
+ BaseSpecifierListAST *base_clause_list = nullptr;
if (LA() == T_COLON) {
colon_token = cursor();
@@ -2188,7 +2188,7 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
if (LA() != T_LBRACE) {
error(cursor(), "expected `{' before `%s'", tok().spell());
- const unsigned saved = cursor();
+ const int saved = cursor();
for (int n = 0; n < 3 && LA() != T_EOF_SYMBOL; ++n, consumeToken()) {
if (LA() == T_LBRACE)
@@ -2219,8 +2219,8 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node)
break;
}
- unsigned start_declaration = cursor();
- DeclarationAST *declaration = 0;
+ int start_declaration = cursor();
+ DeclarationAST *declaration = nullptr;
if (parseMemberSpecification(declaration, ast)) {
if (declaration) { // paranoia check
*declaration_ptr = new (_pool) DeclarationListAST;
@@ -2325,7 +2325,7 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
node = ast;
break;
} else if (LA() == T_IDENTIFIER) {
- QtPropertyDeclarationItemAST *item = 0;
+ QtPropertyDeclarationItemAST *item = nullptr;
switch (peekAtQtContextKeyword()) {
case Token_READ:
case Token_WRITE:
@@ -2337,8 +2337,8 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
case Token_SCRIPTABLE:
case Token_STORED:
case Token_USER: {
- unsigned item_name_token = consumeToken();
- ExpressionAST *expr = 0;
+ int item_name_token = consumeToken();
+ ExpressionAST *expr = nullptr;
if (parsePostfixExpression(expr)) {
QtPropertyDeclarationItemAST *bItem =
new (_pool) QtPropertyDeclarationItemAST;
@@ -2403,7 +2403,7 @@ bool Parser::parseQtEnumDeclaration(DeclarationAST *&node)
ast->enum_specifier_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
for (NameListAST **iter = &ast->enumerator_list; LA() && LA() != T_RPAREN; iter = &(*iter)->next) {
- NameAST *name_ast = 0;
+ NameAST *name_ast = nullptr;
if (!parseName(name_ast))
break;
*iter = new (_pool) NameListAST;
@@ -2436,7 +2436,7 @@ bool Parser::parseQtFlags(DeclarationAST *&node)
ast->flags_specifier_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
for (NameListAST **iter = &ast->flag_enums_list; LA() && LA() != T_RPAREN; iter = &(*iter)->next) {
- NameAST *name_ast = 0;
+ NameAST *name_ast = nullptr;
if (!parseName(name_ast))
break;
*iter = new (_pool) NameListAST;
@@ -2486,15 +2486,15 @@ bool Parser::parseQtInterfaces(DeclarationAST *&node)
ast->interfaces_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
for (QtInterfaceNameListAST **iter = &ast->interface_name_list; LA() && LA() != T_RPAREN; iter = &(*iter)->next) {
- NameAST *name_ast = 0;
+ NameAST *name_ast = nullptr;
if (!parseName(name_ast))
break;
*iter = new (_pool) QtInterfaceNameListAST;
(*iter)->value = new (_pool) QtInterfaceNameAST;
(*iter)->value->interface_name = name_ast;
for (NameListAST **iter2 = &(*iter)->value->constraint_list; LA() && LA() == T_COLON; iter2 = &(*iter2)->next) {
- /*unsigned colon_token =*/ consumeToken();
- NameAST *name_ast2 = 0;
+ /*int colon_token =*/ consumeToken();
+ NameAST *name_ast2 = nullptr;
if (!parseName(name_ast2))
break;
*iter2 = new (_pool) NameListAST;
@@ -2595,7 +2595,7 @@ bool Parser::parseCtorInitializer(CtorInitializerAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_COLON) {
- unsigned colon_token = consumeToken();
+ int colon_token = consumeToken();
CtorInitializerAST *ast = new (_pool) CtorInitializerAST;
ast->colon_token = colon_token;
@@ -2615,11 +2615,11 @@ bool Parser::parseElaboratedTypeSpecifier(SpecifierListAST *&node)
{
DEBUG_THIS_RULE();
if (lookAtClassKey() || LA() == T_ENUM || LA() == T_TYPENAME) {
- unsigned classkey_token = consumeToken();
+ int classkey_token = consumeToken();
- SpecifierListAST *attributes = 0;
+ SpecifierListAST *attributes = nullptr;
parseOptionalAttributeSpecifierSequence(attributes);
- NameAST *name = 0;
+ NameAST *name = nullptr;
if (parseName(name)) {
ElaboratedTypeSpecifierAST *ast = new (_pool) ElaboratedTypeSpecifierAST;
ast->classkey_token = classkey_token;
@@ -2706,8 +2706,8 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_sp
&& node->postfix_declarator_list->lastValue()->asFunctionDeclarator();
if (declaringClass && LA() == T_COLON
&& (! node || ! node->postfix_declarator_list)) {
- unsigned colon_token = consumeToken();
- ExpressionAST *expression = 0;
+ int colon_token = consumeToken();
+ ExpressionAST *expression = nullptr;
if (parseConstantExpression(expression) && (LA() == T_COMMA ||
LA() == T_SEMICOLON)) {
// recognized a bitfielddeclarator.
@@ -2760,14 +2760,14 @@ bool Parser::parseBaseClause(BaseSpecifierListAST *&node)
return false;
}
-bool Parser::parseInitializer(ExpressionAST *&node, unsigned *equals_token)
+bool Parser::parseInitializer(ExpressionAST *&node, int *equals_token)
{
DEBUG_THIS_RULE();
return parseInitializer0x(node, equals_token);
}
-bool Parser::parseInitializer0x(ExpressionAST *&node, unsigned *equals_token)
+bool Parser::parseInitializer0x(ExpressionAST *&node, int *equals_token)
{
DEBUG_THIS_RULE();
@@ -2835,7 +2835,7 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
ExpressionListAST **expression_list_ptr = &node;
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
_initializerClauseDepth.push(1);
@@ -2941,7 +2941,7 @@ bool Parser::parseMemInitializerList(MemInitializerListAST *&node)
bool Parser::parseMemInitializer(MemInitializerListAST *&node)
{
DEBUG_THIS_RULE();
- NameAST *name = 0;
+ NameAST *name = nullptr;
if (! parseName(name))
return false;
@@ -2969,7 +2969,7 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
ExpressionListAST **expression_list_ptr = &node;
- ExpressionAST *typeId = 0;
+ ExpressionAST *typeId = nullptr;
if (parseTypeId(typeId)) {
*expression_list_ptr = new (_pool) ExpressionListAST;
(*expression_list_ptr)->value = typeId;
@@ -3000,7 +3000,7 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
CHECK_CACHE(ASTCache::ExpressionList, ExpressionListAST);
- unsigned initialCursor = cursor();
+ int initialCursor = cursor();
if (_languageFeatures.cxx11Enabled) {
const bool result = parseInitializerList0x(node);
@@ -3009,7 +3009,7 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
}
ExpressionListAST **expression_list_ptr = &node;
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
if (parseAssignmentExpression(expression)) {
*expression_list_ptr = new (_pool) ExpressionListAST;
(*expression_list_ptr)->value = expression;
@@ -3029,7 +3029,7 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
}
const bool result = false;
- _astCache->insert(ASTCache::ExpressionList, initialCursor, 0, cursor(), result);
+ _astCache->insert(ASTCache::ExpressionList, initialCursor, nullptr, cursor(), result);
return result;
}
@@ -3071,14 +3071,14 @@ bool Parser::parseInitializerList(ExpressionListAST *&node)
{
DEBUG_THIS_RULE();
ExpressionListAST **initializer_ptr = &node;
- ExpressionAST *initializer = 0;
+ ExpressionAST *initializer = nullptr;
if (parseInitializerClause(initializer)) {
*initializer_ptr = new (_pool) ExpressionListAST;
(*initializer_ptr)->value = initializer;
initializer_ptr = &(*initializer_ptr)->next;
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
- initializer = 0;
+ initializer = nullptr;
parseInitializerClause(initializer);
*initializer_ptr = new (_pool) ExpressionListAST;
(*initializer_ptr)->value = initializer;
@@ -3116,13 +3116,13 @@ bool Parser::parseUnqualifiedName(NameAST *&node, bool acceptTemplateId)
node = ast;
return true;
} else if (LA() == T_OPERATOR) {
- unsigned operator_token = cursor();
+ int operator_token = cursor();
if (parseOperatorFunctionId(node))
return true;
rewind(operator_token);
return parseConversionFunctionId(node);
} else if (LA() == T_IDENTIFIER) {
- unsigned identifier_token = cursor();
+ int identifier_token = cursor();
if (acceptTemplateId && LA(2) == T_LESS) {
bool blocked = blockErrors(true);
if (parseTemplateId(node)
@@ -3141,7 +3141,7 @@ bool Parser::parseUnqualifiedName(NameAST *&node, bool acceptTemplateId)
node = ast;
return true;
} else if (LA() == T_TEMPLATE) {
- unsigned template_token = consumeToken();
+ int template_token = consumeToken();
if (parseTemplateId(node, template_token))
return true;
rewind(template_token);
@@ -3205,7 +3205,7 @@ bool Parser::parseExpressionStatement(StatementAST *&node)
bool parsed = false;
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
if (parseExpression(expression)) {
ExpressionStatementAST *ast = new (previousPool) ExpressionStatementAST;
if (expression)
@@ -3253,7 +3253,7 @@ bool Parser::parseStatement(StatementAST *&node, bool blockLabeledStatement)
return parseSwitchStatement(node);
case T_TRY:
- return parseTryBlockStatement(node, 0);
+ return parseTryBlockStatement(node, nullptr);
case T_CASE:
case T_DEFAULT:
@@ -3314,7 +3314,7 @@ bool Parser::parseStatement(StatementAST *&node, bool blockLabeledStatement)
// Simply skip the emit token and parse as an expression statement - no strong
// reason to have an specific ast type.
consumeToken();
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
if (parsePostfixExpression(expression)) {
ExpressionStatementAST *ast = new (_pool) ExpressionStatementAST;
ast->expression = expression;
@@ -3397,13 +3397,13 @@ bool Parser::parseReturnStatement(StatementAST *&node)
bool Parser::maybeAmbiguousStatement(DeclarationStatementAST *ast, StatementAST *&node)
{
- const unsigned start = ast->firstToken();
- const unsigned end = ast->lastToken();
+ const int start = ast->firstToken();
+ const int end = ast->lastToken();
const bool blocked = blockErrors(true);
bool maybeAmbiguous = false;
- StatementAST *stmt = 0;
+ StatementAST *stmt = nullptr;
if (parseExpressionStatement(stmt)) {
if (stmt->firstToken() == start && stmt->lastToken() == end) {
maybeAmbiguous = true;
@@ -3423,7 +3423,7 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
if (LA() == T_SEMICOLON)
return parseExpressionStatement(node);
- const unsigned start = cursor();
+ const int start = cursor();
if (lookAtCVQualifier()
|| lookAtStorageClassSpecifier()
@@ -3438,13 +3438,13 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
if (LA() == T_IDENTIFIER || (LA() == T_COLON_COLON && LA(2) == T_IDENTIFIER)) {
const bool blocked = blockErrors(true);
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
const bool hasExpression = parseExpression(expression);
- const unsigned afterExpression = cursor();
+ const int afterExpression = cursor();
if (hasExpression/* && LA() == T_SEMICOLON*/) {
- //const unsigned semicolon_token = consumeToken();
- unsigned semicolon_token = 0;
+ //const int semicolon_token = consumeToken();
+ int semicolon_token = 0;
if (LA() == T_SEMICOLON)
semicolon_token = cursor();
@@ -3467,7 +3467,7 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
}
}
} else if (CallAST *call = expression->asCall()) {
- if (call->base_expression->asIdExpression() != 0) {
+ if (call->base_expression->asIdExpression() != nullptr) {
(void) blockErrors(blocked);
node = as_expression;
match(T_SEMICOLON, &as_expression->semicolon_token);
@@ -3477,14 +3477,14 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
rewind(start);
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
if (parseSimpleDeclaration(declaration)) {
DeclarationStatementAST *as_declaration = new (_pool) DeclarationStatementAST;
as_declaration->declaration = declaration;
SimpleDeclarationAST *simple = declaration->asSimpleDeclaration();
if (! semicolon_token || invalidAssignment || semicolon_token != simple->semicolon_token ||
- (simple->decl_specifier_list != 0 && simple->declarator_list != 0)) {
+ (simple->decl_specifier_list != nullptr && simple->declarator_list != nullptr)) {
node = as_declaration;
(void) blockErrors(blocked);
return true;
@@ -3518,13 +3518,13 @@ bool Parser::parseExpressionOrDeclarationStatement(StatementAST *&node)
bool Parser::parseCondition(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
bool blocked = blockErrors(true);
- SpecifierListAST *type_specifier = 0;
+ SpecifierListAST *type_specifier = nullptr;
if (parseTypeSpecifier(type_specifier)) {
- DeclaratorAST *declarator = 0;
- if (parseInitDeclarator(declarator, type_specifier, /*declaringClass=*/ 0)) {
+ DeclaratorAST *declarator = nullptr;
+ if (parseInitDeclarator(declarator, type_specifier, /*declaringClass=*/ nullptr)) {
if (declarator->initializer && declarator->equal_token) {
ConditionAST *ast = new (_pool) ConditionAST;
ast->type_specifier_list = type_specifier;
@@ -3583,15 +3583,15 @@ bool Parser::parseForeachStatement(StatementAST *&node)
ast->foreach_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- unsigned startOfTypeSpecifier = cursor();
+ int startOfTypeSpecifier = cursor();
bool blocked = blockErrors(true);
if (parseTypeSpecifier(ast->type_specifier_list))
parseDeclarator(ast->declarator, ast->type_specifier_list);
if (! ast->type_specifier_list || ! ast->declarator) {
- ast->type_specifier_list = 0;
- ast->declarator = 0;
+ ast->type_specifier_list = nullptr;
+ ast->declarator = nullptr;
blockErrors(blocked);
rewind(startOfTypeSpecifier);
@@ -3617,11 +3617,11 @@ bool Parser::parseForStatement(StatementAST *&node)
if (LA() != T_FOR)
return false;
- unsigned for_token = consumeToken();
- unsigned lparen_token = 0;
+ int for_token = consumeToken();
+ int lparen_token = 0;
match(T_LPAREN, &lparen_token);
- unsigned startOfTypeSpecifier = cursor();
+ int startOfTypeSpecifier = cursor();
bool blocked = blockErrors(true);
if (_languageFeatures.objCEnabled) {
@@ -3634,16 +3634,16 @@ bool Parser::parseForStatement(StatementAST *&node)
if ((ast->type_specifier_list || ast->declarator) && !peekAtObjCContextKeyword(Token_in)) {
// woops, probably parsed too much: "in" got parsed as a declarator. Let's redo it:
- ast->type_specifier_list = 0;
- ast->declarator = 0;
+ ast->type_specifier_list = nullptr;
+ ast->declarator = nullptr;
rewind(startOfTypeSpecifier);
parseDeclarator(ast->declarator, ast->type_specifier_list);
}
if (! ast->type_specifier_list || ! ast->declarator) {
- ast->type_specifier_list = 0;
- ast->declarator = 0;
+ ast->type_specifier_list = nullptr;
+ ast->declarator = nullptr;
rewind(startOfTypeSpecifier);
parseAssignmentExpression(ast->initializer);
@@ -3736,8 +3736,8 @@ bool Parser::parseCompoundStatement(StatementAST *&node)
if (tk == T_RBRACE)
break;
- unsigned start_statement = cursor();
- StatementAST *statement = 0;
+ int start_statement = cursor();
+ StatementAST *statement = nullptr;
if (! parseStatement(statement)) {
rewind(start_statement + 1);
skipUntilStatement();
@@ -3876,8 +3876,8 @@ bool Parser::parseNamespaceAliasDefinition(DeclarationAST *&node)
bool Parser::parseDeclarationStatement(StatementAST *&node)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
- DeclarationAST *declaration = 0;
+ int start = cursor();
+ DeclarationAST *declaration = nullptr;
if (! parseBlockDeclaration(declaration))
return false;
@@ -3998,7 +3998,7 @@ bool Parser::parseAttributeSpecifier(SpecifierListAST *&attribute_list)
ast->align_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- const unsigned saved = cursor();
+ const int saved = cursor();
if (!parseTypeId(ast->typeIdExprOrAlignmentExpr) ||
(LA() != T_RPAREN &&
(LA(1) != T_DOT_DOT_DOT || LA(2) != T_RPAREN))) {
@@ -4087,7 +4087,7 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierListAST *&node)
TypeofSpecifierAST *ast = new (_pool) TypeofSpecifierAST;
ast->typeof_token = consumeToken();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
+ int lparen_token = consumeToken();
if (parseTypeId(ast->expression) && LA() == T_RPAREN) {
ast->lparen_token = lparen_token;
ast->rparen_token = consumeToken();
@@ -4122,7 +4122,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
const ASTCache::CacheKey cacheKey(cursor(), ASTCache::Declaration);
CHECK_CACHE(cacheKey.astKind, DeclarationAST);
- unsigned qt_invokable_token = 0;
+ int qt_invokable_token = 0;
if (declaringClass && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT || LA() == T_Q_INVOKABLE))
qt_invokable_token = consumeToken();
@@ -4130,9 +4130,9 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
// or a contructor declaration.
bool has_type_specifier = false;
bool has_complex_type_specifier = false;
- unsigned startOfNamedTypeSpecifier = 0;
- NameAST *named_type_specifier = 0;
- SpecifierListAST *decl_specifier_seq = 0,
+ int startOfNamedTypeSpecifier = 0;
+ NameAST *named_type_specifier = nullptr;
+ SpecifierListAST *decl_specifier_seq = nullptr,
**decl_specifier_seq_ptr = &decl_specifier_seq;
for (;;) {
if (lookAtCVQualifier() || lookAtFunctionSpecifier()
@@ -4174,7 +4174,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
break;
}
} else if (! has_type_specifier && LA() == T_ENUM) {
- unsigned startOfTypeSpecifier = cursor();
+ int startOfTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)
|| LA() == T_LBRACE
|| (_languageFeatures.cxx11Enabled && LA() == T_COLON)) {
@@ -4188,7 +4188,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
has_type_specifier = true;
} else if (! has_type_specifier && LA() == T_TYPENAME) {
- unsigned startOfElaboratedTypeSpecifier = cursor();
+ int startOfElaboratedTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr)) {
error(startOfElaboratedTypeSpecifier, "expected an elaborated type specifier");
break;
@@ -4196,7 +4196,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
decl_specifier_seq_ptr = &(*decl_specifier_seq_ptr)->next;
has_type_specifier = true;
} else if (! has_type_specifier && lookAtClassKey()) {
- unsigned startOfTypeSpecifier = cursor();
+ int startOfTypeSpecifier = cursor();
if (! parseElaboratedTypeSpecifier(*decl_specifier_seq_ptr) ||
(LA() == T_COLON || LA() == T_LBRACE
|| (LA(0) == T_IDENTIFIER && LA(1) == T_IDENTIFIER // MACRO Name followed by : or {
@@ -4216,22 +4216,22 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
break;
}
- DeclaratorListAST *declarator_list = 0,
+ DeclaratorListAST *declarator_list = nullptr,
**declarator_ptr = &declarator_list;
- DeclaratorAST *declarator = 0;
+ DeclaratorAST *declarator = nullptr;
if (LA() != T_SEMICOLON) {
const bool maybeCtor = (LA() == T_LPAREN && named_type_specifier);
bool didParseInitDeclarator = parseInitDeclarator(declarator, decl_specifier_seq, declaringClass);
if ((! didParseInitDeclarator && maybeCtor) || (didParseInitDeclarator && maybeCtor && LA() == T_COLON)){
rewind(startOfNamedTypeSpecifier);
- named_type_specifier = 0;
+ named_type_specifier = nullptr;
// pop the named type specifier from the decl-specifier-seq
SpecifierListAST **spec_ptr = &decl_specifier_seq;
for (; *spec_ptr; spec_ptr = &(*spec_ptr)->next) {
if (! (*spec_ptr)->next) {
- *spec_ptr = 0;
+ *spec_ptr = nullptr;
break;
}
}
@@ -4258,7 +4258,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
while (LA() == T_COMMA) {
consumeToken(); // consume T_COMMA
- declarator = 0;
+ declarator = nullptr;
if (parseInitDeclarator(declarator, decl_specifier_seq, declaringClass)) {
*declarator_ptr = new (_pool) DeclaratorListAST;
(*declarator_ptr)->value = declarator;
@@ -4282,7 +4282,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
node = ast;
CACHE_AND_RETURN(cacheKey, true); // recognized a function definition.
} else {
- CtorInitializerAST *ctor_initializer = 0;
+ CtorInitializerAST *ctor_initializer = nullptr;
bool hasCtorInitializer = false;
if (LA() == T_COLON) {
@@ -4290,7 +4290,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *de
parseCtorInitializer(ctor_initializer);
if (LA() != T_LBRACE) {
- const unsigned pos = cursor();
+ const int pos = cursor();
for (int n = 0; n < 3 && LA(); consumeToken(), ++n)
if (LA() == T_LBRACE)
@@ -4339,7 +4339,7 @@ bool Parser::maybeForwardOrClassDeclaration(SpecifierListAST *decl_specifier_seq
spec->asEnumSpecifier() ||
spec->asClassSpecifier()) {
for (it = it->next; it; it = it->next)
- if (it->value->asAttributeSpecifier() == 0)
+ if (it->value->asAttributeSpecifier() == nullptr)
return false;
return true;
}
@@ -4353,7 +4353,7 @@ bool Parser::parseFunctionBody(StatementAST *&node)
{
DEBUG_THIS_RULE();
if (_translationUnit->skipFunctionBody()) {
- unsigned token_lbrace = 0;
+ int token_lbrace = 0;
match(T_LBRACE, &token_lbrace);
if (! token_lbrace)
return false;
@@ -4361,7 +4361,7 @@ bool Parser::parseFunctionBody(StatementAST *&node)
const Token &tk = _translationUnit->tokenAt(token_lbrace);
if (tk.close_brace)
rewind(tk.close_brace);
- unsigned token_rbrace = 0;
+ int token_rbrace = 0;
match(T_RBRACE, &token_rbrace);
return true;
}
@@ -4391,12 +4391,12 @@ bool Parser::parseTryBlockStatement(StatementAST *&node, CtorInitializerAST **pl
ast->try_token = consumeToken();
// [ctor-initializer]
if (LA() == T_COLON) {
- const unsigned colonPos = cursor();
- CtorInitializerAST *ctor_initializer = 0;
+ const int colonPos = cursor();
+ CtorInitializerAST *ctor_initializer = nullptr;
parseCtorInitializer(ctor_initializer);
if (LA() != T_LBRACE) {
- const unsigned pos = cursor();
+ const int pos = cursor();
for (int n = 0; n < 3 && LA(); consumeToken(), ++n)
if (LA() == T_LBRACE)
@@ -4451,7 +4451,7 @@ bool Parser::parseExceptionDeclaration(ExceptionDeclarationAST *&node)
return true;
}
- SpecifierListAST *type_specifier = 0;
+ SpecifierListAST *type_specifier = nullptr;
if (parseTypeSpecifier(type_specifier)) {
ExceptionDeclarationAST *ast = new (_pool) ExceptionDeclarationAST;
ast->type_specifier_list = type_specifier;
@@ -4554,7 +4554,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
// GNU extension: '(' '{' statement-list '}' ')'
CompoundExpressionAST *ast = new (_pool) CompoundExpressionAST;
ast->lparen_token = consumeToken();
- StatementAST *statement = 0;
+ StatementAST *statement = nullptr;
parseCompoundStatement(statement);
ast->statement = statement->asCompoundStatement();
match(T_RPAREN, &ast->rparen_token);
@@ -4569,7 +4569,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
return parseQtMethod(node);
case T_LBRACKET: {
- const unsigned lbracket_token = cursor();
+ const int lbracket_token = cursor();
if (_languageFeatures.cxx11Enabled) {
if (parseLambdaExpression(node))
@@ -4589,7 +4589,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
return parseObjCExpression(node);
default: {
- NameAST *name = 0;
+ NameAST *name = nullptr;
if (parseNameId(name)) {
IdExpressionAST *ast = new (_pool) IdExpressionAST;
ast->name = name;
@@ -4667,15 +4667,15 @@ bool Parser::parseObjCTryStatement(StatementAST *& /*node*/)
parseCompoundStatement(body_statment);
while (LA() == T_AT_CATCH) {
/*catch_token =*/ consumeToken();
- unsigned lparen_token;
+ int lparen_token;
match(T_LPAREN, &lparen_token);
if (LA() == T_DOT_DOT_DOT) {
- /*unsigned ellipsis_token =*/ consumeToken();
+ /*int ellipsis_token =*/ consumeToken();
} else {
ParameterDeclarationAST *exception_decl;
parseParameterDeclaration(exception_decl);
}
- unsigned rparen_token;
+ int rparen_token;
match(T_RPAREN, &rparen_token);
StatementAST *catch_statement;
parseCompoundStatement(catch_statement);
@@ -4720,7 +4720,7 @@ bool Parser::parseObjCThrowStatement(StatementAST *&/*node*/)
/*throw_token =*/ consumeToken();
ExpressionAST *thrown_expression;
parseExpression(thrown_expression);
- unsigned semicolon_token;
+ int semicolon_token;
match(T_SEMICOLON, &semicolon_token);
return true;
@@ -4764,7 +4764,7 @@ bool Parser::parseObjCSelectorExpression(ExpressionAST *&node)
ast->selector_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- unsigned identifier_token = 0;
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
if (LA() == T_COLON) {
ObjCSelectorAST *args = new (_pool) ObjCSelectorAST;
@@ -4807,12 +4807,12 @@ bool Parser::parseObjCMessageExpression(ExpressionAST *&node)
if (LA() != T_LBRACKET)
return false;
- unsigned start = cursor();
+ int start = cursor();
- unsigned lbracket_token = consumeToken();
- ExpressionAST *receiver_expression = 0;
- ObjCSelectorAST *selector = 0;
- ObjCMessageArgumentListAST *argument_list = 0;
+ int lbracket_token = consumeToken();
+ ExpressionAST *receiver_expression = nullptr;
+ ObjCSelectorAST *selector = nullptr;
+ ObjCMessageArgumentListAST *argument_list = nullptr;
if (parseObjCMessageReceiver(receiver_expression) &&
parseObjCMessageArguments(selector, argument_list)) {
@@ -4845,10 +4845,10 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg
if (LA() == T_RBRACKET)
return false; // nothing to do.
- unsigned start = cursor();
+ int start = cursor();
- ObjCSelectorArgumentAST *selectorArgument = 0;
- ObjCMessageArgumentAST *messageArgument = 0;
+ ObjCSelectorArgumentAST *selectorArgument = nullptr;
+ ObjCMessageArgumentAST *messageArgument = nullptr;
if (parseObjCSelectorArg(selectorArgument, messageArgument)) {
ObjCSelectorArgumentListAST *selAst = new (_pool) ObjCSelectorArgumentListAST;
@@ -4890,7 +4890,7 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg
return true;
} else {
rewind(start);
- unsigned name_token = 0;
+ int name_token = 0;
if (!parseObjCSelector(name_token))
return false;
ObjCSelectorAST *sel = new (_pool) ObjCSelectorAST;
@@ -4898,7 +4898,7 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg
sel->selector_argument_list->value = new (_pool) ObjCSelectorArgumentAST;
sel->selector_argument_list->value->name_token = name_token;
selNode = sel;
- argNode = 0;
+ argNode = nullptr;
return true;
}
@@ -4908,7 +4908,7 @@ bool Parser::parseObjCMessageArguments(ObjCSelectorAST *&selNode, ObjCMessageArg
bool Parser::parseObjCSelectorArg(ObjCSelectorArgumentAST *&selNode, ObjCMessageArgumentAST *&argNode)
{
DEBUG_THIS_RULE();
- unsigned selector_token = 0;
+ int selector_token = 0;
if (!parseObjCSelector(selector_token))
return false;
@@ -4921,7 +4921,7 @@ bool Parser::parseObjCSelectorArg(ObjCSelectorArgumentAST *&selNode, ObjCMessage
argNode = new (_pool) ObjCMessageArgumentAST;
ExpressionAST **expr = &argNode->parameter_value_expression;
- unsigned expressionStart = cursor();
+ int expressionStart = cursor();
if (parseAssignmentExpression(*expr) && LA() == T_COLON && (*expr)->asCastExpression()) {
rewind(expressionStart);
parseUnaryExpression(*expr);
@@ -4933,7 +4933,7 @@ bool Parser::parseObjCSelectorArg(ObjCSelectorArgumentAST *&selNode, ObjCMessage
bool Parser::parseNameId(NameAST *&name)
{
DEBUG_THIS_RULE();
- unsigned start = cursor();
+ int start = cursor();
if (! parseName(name))
return false;
@@ -4942,7 +4942,7 @@ bool Parser::parseNameId(NameAST *&name)
QualifiedNameAST *qualified_name_id = name->asQualifiedName();
- TemplateIdAST *template_id = 0;
+ TemplateIdAST *template_id = nullptr;
if (qualified_name_id) {
if (NameAST *unqualified_name = qualified_name_id->unqualified_name)
template_id = unqualified_name->asTemplateId();
@@ -4959,8 +4959,8 @@ bool Parser::parseNameId(NameAST *&name)
if (! template_arguments->next && template_arguments->value &&
template_arguments->value->asBinaryExpression()) {
- unsigned saved = cursor();
- ExpressionAST *expr = 0;
+ int saved = cursor();
+ ExpressionAST *expr = nullptr;
bool blocked = blockErrors(true);
bool lookAtCastExpression = parseCastExpression(expr);
@@ -4972,7 +4972,7 @@ bool Parser::parseNameId(NameAST *&name)
&& cast_expression->type_id && cast_expression->expression) {
rewind(start);
- name = 0;
+ name = nullptr;
return parseName(name, false);
}
}
@@ -5013,10 +5013,10 @@ bool Parser::parseNestedExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
+ int lparen_token = consumeToken();
bool previousTemplateArguments = switchTemplateArguments(false);
- ExpressionAST *expression = 0;
+ ExpressionAST *expression = nullptr;
if (parseExpression(expression) && LA() == T_RPAREN) {
NestedExpressionAST *ast = new (_pool) NestedExpressionAST;
ast->lparen_token = lparen_token;
@@ -5056,8 +5056,8 @@ bool Parser::parseTypenameCallExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_TYPENAME) {
- unsigned typename_token = consumeToken();
- NameAST *name = 0;
+ int typename_token = consumeToken();
+ NameAST *name = nullptr;
if (parseName(name)
&& (LA() == T_LPAREN || (_languageFeatures.cxx11Enabled && LA() == T_LBRACE))) {
TypenameCallExpressionAST *ast = new (_pool) TypenameCallExpressionAST;
@@ -5085,7 +5085,7 @@ bool Parser::parseTypeidExpression(ExpressionAST *&node)
ast->typeid_token = consumeToken();
if (LA() == T_LPAREN)
ast->lparen_token = consumeToken();
- unsigned saved = cursor();
+ int saved = cursor();
if (! (parseTypeId(ast->expression) && LA() == T_RPAREN)) {
rewind(saved);
parseExpression(ast->expression);
@@ -5115,13 +5115,13 @@ bool Parser::parseCorePostfixExpression(ExpressionAST *&node)
return parseTypeidExpression(node);
default: {
- unsigned start = cursor();
- SpecifierListAST *type_specifier = 0;
+ int start = cursor();
+ SpecifierListAST *type_specifier = nullptr;
bool blocked = blockErrors(true);
if (lookAtBuiltinTypeSpecifier() &&
parseSimpleTypeSpecifier(type_specifier) &&
(LA() == T_LPAREN || (_languageFeatures.cxx11Enabled && LA() == T_LBRACE))) {
- ExpressionAST *expr = 0;
+ ExpressionAST *expr = nullptr;
if (LA() == T_LPAREN) {
parseExpressionListParen(expr);
} else { // T_LBRACE
@@ -5138,10 +5138,10 @@ bool Parser::parseCorePostfixExpression(ExpressionAST *&node)
// look for compound literals
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionAST *type_id = 0;
+ int lparen_token = consumeToken();
+ ExpressionAST *type_id = nullptr;
if (parseTypeId(type_id) && LA() == T_RPAREN) {
- unsigned rparen_token = consumeToken();
+ int rparen_token = consumeToken();
if (LA() == T_LBRACE) {
blockErrors(blocked);
@@ -5223,7 +5223,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
case T_PLUS:
case T_MINUS:
case T_EXCLAIM: {
- unsigned op = cursor();
+ int op = cursor();
UnaryExpressionAST *ast = new (_pool) UnaryExpressionAST;
ast->unary_op_token = consumeToken();
if (! parseCastExpression(ast->expression))
@@ -5253,7 +5253,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
ast->dot_dot_dot_token = consumeToken();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
+ int lparen_token = consumeToken();
const bool blocked = blockErrors(true);
const bool hasTypeId = parseTypeId(ast->expression);
(void) blockErrors(blocked);
@@ -5281,7 +5281,7 @@ bool Parser::parseUnaryExpression(ExpressionAST *&node)
ast->alignof_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- ExpressionAST *temp = 0;
+ ExpressionAST *temp = nullptr;
parseTypeId(temp);
if (temp)
ast->typeId = temp->asTypeId();
@@ -5318,10 +5318,10 @@ bool Parser::parseExpressionListParen(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionListAST *expression_list = 0;
+ int lparen_token = consumeToken();
+ ExpressionListAST *expression_list = nullptr;
if (parseExpressionList(expression_list) && LA() == T_RPAREN) {
- unsigned rparen_token = consumeToken();
+ int rparen_token = consumeToken();
ExpressionListParenAST *ast = new (_pool) ExpressionListParenAST;
ast->lparen_token = lparen_token;
ast->expression_list = expression_list;
@@ -5351,12 +5351,12 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
ast->new_token = consumeToken();
- ExpressionAST *parenExpressionList = 0;
+ ExpressionAST *parenExpressionList = nullptr;
if (parseExpressionListParen(parenExpressionList)) {
- unsigned after_new_placement = cursor();
+ int after_new_placement = cursor();
- NewTypeIdAST *new_type_id = 0;
+ NewTypeIdAST *new_type_id = nullptr;
if (parseNewTypeId(new_type_id)) {
ast->new_placement = parenExpressionList->asExpressionListParen();
ast->new_type_id = new_type_id;
@@ -5368,8 +5368,8 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
rewind(after_new_placement);
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionAST *type_id = 0;
+ int lparen_token = consumeToken();
+ ExpressionAST *type_id = nullptr;
if (parseTypeId(type_id) && LA() == T_RPAREN) {
ast->new_placement = parenExpressionList->asExpressionListParen();
ast->lparen_token = lparen_token;
@@ -5385,8 +5385,8 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
rewind(ast->new_token + 1);
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- ExpressionAST *type_id = 0;
+ int lparen_token = consumeToken();
+ ExpressionAST *type_id = nullptr;
if (parseTypeId(type_id) && LA() == T_RPAREN) {
ast->lparen_token = lparen_token;
ast->type_id = type_id;
@@ -5406,7 +5406,7 @@ bool Parser::parseNewExpression(ExpressionAST *&node)
bool Parser::parseNewTypeId(NewTypeIdAST *&node)
{
DEBUG_THIS_RULE();
- SpecifierListAST *typeSpec = 0;
+ SpecifierListAST *typeSpec = nullptr;
if (! parseTypeSpecifier(typeSpec))
return false;
@@ -5479,9 +5479,9 @@ bool Parser::parseCastExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
if (LA() == T_LPAREN) {
- unsigned lparen_token = consumeToken();
- unsigned initialCursor = cursor();
- ExpressionAST *type_id = 0;
+ int lparen_token = consumeToken();
+ int initialCursor = cursor();
+ ExpressionAST *type_id = nullptr;
if (parseTypeId(type_id) && LA() == T_RPAREN) {
if (TypeIdAST *tid = type_id->asTypeId()) {
@@ -5493,10 +5493,10 @@ bool Parser::parseCastExpression(ExpressionAST *&node)
case T_PLUS_PLUS:
case T_MINUS_MINUS: {
- const unsigned rparen_token = consumeToken();
+ const int rparen_token = consumeToken();
const bool blocked = blockErrors(true);
- ExpressionAST *unary = 0;
+ ExpressionAST *unary = nullptr;
bool followedByUnaryExpression = parseUnaryExpression(unary);
blockErrors(blocked);
rewind(rparen_token);
@@ -5505,7 +5505,7 @@ bool Parser::parseCastExpression(ExpressionAST *&node)
if (! unary)
followedByUnaryExpression = false;
else if (UnaryExpressionAST *u = unary->asUnaryExpression())
- followedByUnaryExpression = u->expression != 0;
+ followedByUnaryExpression = u->expression != nullptr;
}
if (! followedByUnaryExpression)
@@ -5521,8 +5521,8 @@ bool Parser::parseCastExpression(ExpressionAST *&node)
}
}
- unsigned rparen_token = consumeToken();
- ExpressionAST *expression = 0;
+ int rparen_token = consumeToken();
+ ExpressionAST *expression = nullptr;
if (parseCastExpression(expression)) {
CastExpressionAST *ast = new (_pool) CastExpressionAST;
ast->lparen_token = lparen_token;
@@ -5535,7 +5535,7 @@ bool Parser::parseCastExpression(ExpressionAST *&node)
}
parse_as_unary_expression:
- _astCache->insert(ASTCache::TypeId, initialCursor, 0, cursor(), false);
+ _astCache->insert(ASTCache::TypeId, initialCursor, nullptr, cursor(), false);
rewind(lparen_token);
}
@@ -5618,7 +5618,7 @@ bool Parser::parseQtMethod(ExpressionAST *&node)
QtMethodAST *ast = new (_pool) QtMethodAST;
ast->method_token = consumeToken();
match(T_LPAREN, &ast->lparen_token);
- if (! parseDeclarator(ast->declarator, /*decl_specifier_seq =*/ 0))
+ if (! parseDeclarator(ast->declarator, /*decl_specifier_seq =*/ nullptr))
error(cursor(), "expected a function declarator before token `%s'", tok().spell());
match(T_RPAREN, &ast->rparen_token);
node = ast;
@@ -5637,7 +5637,7 @@ bool Parser::parseExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
CHECK_CACHE(ASTCache::Expression, ExpressionAST);
- unsigned initialCursor = cursor();
+ int initialCursor = cursor();
if (_expressionDepth > MAX_EXPRESSION_DEPTH)
return false;
@@ -5654,7 +5654,7 @@ void Parser::parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minP
{
DEBUG_THIS_RULE();
- unsigned iterations = 0;
+ int iterations = 0;
while (precedence(tok().kind(), _templateArguments) >= minPrecedence) {
if (++iterations > MAX_EXPRESSION_DEPTH) {
warning(cursor(), "Reached parse limit for expression");
@@ -5664,21 +5664,21 @@ void Parser::parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minP
const int operPrecedence = precedence(tok().kind(), _templateArguments);
const int oper = consumeToken();
- ConditionalExpressionAST *condExpr = 0;
+ ConditionalExpressionAST *condExpr = nullptr;
if (operPrecedence == Prec::Conditional) {
condExpr = new (_pool) ConditionalExpressionAST;
condExpr->question_token = oper;
if (tok().kind() == T_COLON) {
// GNU extension:
// logical-or-expression '?' ':' conditional-expression
- condExpr->left_expression = 0;
+ condExpr->left_expression = nullptr;
} else {
parseExpression(condExpr->left_expression);
}
match(T_COLON, &condExpr->colon_token);
}
- ExpressionAST *rhs = 0;
+ ExpressionAST *rhs = nullptr;
const bool isCPlusPlus = true;
if (operPrecedence <= Prec::Conditional && isCPlusPlus) {
// in C++ you can put a throw in the right-most expression of a conditional expression,
@@ -5783,8 +5783,8 @@ bool Parser::parseDesignatedInitializer(ExpressionAST *&node)
DesignatedInitializerAST *ast = new (_pool) DesignatedInitializerAST;
DesignatorListAST **designator_list_ptr = &ast->designator_list;
- DesignatorAST *designator = 0;
- const unsigned start = cursor();
+ DesignatorAST *designator = nullptr;
+ const int start = cursor();
while (parseDesignator(designator)) {
*designator_list_ptr = new (_pool) DesignatorListAST;
(*designator_list_ptr)->value = designator;
@@ -5817,7 +5817,7 @@ bool Parser::parseDesignatedInitializer(ExpressionAST *&node)
bool Parser::parseDesignator(DesignatorAST *&node)
{
DEBUG_THIS_RULE();
- const unsigned start = cursor();
+ const int start = cursor();
if (LA() == T_DOT) {
DotDesignatorAST *ast = new (_pool) DotDesignatorAST;
ast->dot_token = consumeToken();
@@ -5849,7 +5849,7 @@ bool Parser::parseObjCClassForwardDeclaration(DeclarationAST *&node)
ObjCClassForwardDeclarationAST *ast = new (_pool) ObjCClassForwardDeclarationAST;
ast->class_token = consumeToken();
- unsigned identifier_token = 0;
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
ast->identifier_list = new (_pool) NameListAST;
@@ -5902,8 +5902,8 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
if (LA() != T_AT_INTERFACE)
return false;
- unsigned objc_interface_token = consumeToken();
- unsigned identifier_token = 0;
+ int objc_interface_token = consumeToken();
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
if (LA() == T_LPAREN) {
@@ -5931,7 +5931,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
parseObjCProtocolRefs(ast->protocol_refs);
DeclarationListAST **nextMembers = &ast->member_declaration_list;
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
while (parseObjCInterfaceMemberDeclaration(declaration)) {
*nextMembers = new (_pool) DeclarationListAST;
(*nextMembers)->value = declaration;
@@ -5962,7 +5962,7 @@ bool Parser::parseObjCInterface(DeclarationAST *&node,
parseObjClassInstanceVariables(ast->inst_vars_decl);
DeclarationListAST **nextMembers = &ast->member_declaration_list;
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
while (parseObjCInterfaceMemberDeclaration(declaration)) {
*nextMembers = new (_pool) DeclarationListAST;
(*nextMembers)->value = declaration;
@@ -5991,8 +5991,8 @@ bool Parser::parseObjCProtocol(DeclarationAST *&node,
if (LA() != T_AT_PROTOCOL)
return false;
- unsigned protocol_token = consumeToken();
- unsigned identifier_token = 0;
+ int protocol_token = consumeToken();
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
if (LA() == T_COMMA || LA() == T_SEMICOLON) {
@@ -6033,7 +6033,7 @@ bool Parser::parseObjCProtocol(DeclarationAST *&node,
parseObjCProtocolRefs(ast->protocol_refs);
DeclarationListAST **nextMembers = &ast->member_declaration_list;
- DeclarationAST *declaration = 0;
+ DeclarationAST *declaration = nullptr;
while (parseObjCInterfaceMemberDeclaration(declaration)) {
*nextMembers = new (_pool) DeclarationListAST;
(*nextMembers)->value = declaration;
@@ -6057,8 +6057,8 @@ bool Parser::parseObjCImplementation(DeclarationAST *&node)
if (LA() != T_AT_IMPLEMENTATION)
return false;
- unsigned implementation_token = consumeToken();
- unsigned identifier_token = 0;
+ int implementation_token = consumeToken();
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
if (LA() == T_LPAREN) {
@@ -6110,8 +6110,8 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
DeclarationListAST **next = &node;
while (LA() && LA() != T_AT_END) {
- unsigned start = cursor();
- DeclarationAST *declaration = 0;
+ int start = cursor();
+ DeclarationAST *declaration = nullptr;
switch (LA()) {
case T_PLUS:
@@ -6213,7 +6213,7 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node)
bool Parser::parseObjCMethodDefinition(DeclarationAST *&node)
{
DEBUG_THIS_RULE();
- ObjCMethodPrototypeAST *method_prototype = 0;
+ ObjCMethodPrototypeAST *method_prototype = nullptr;
if (! parseObjCMethodPrototype(method_prototype))
return false;
@@ -6245,7 +6245,7 @@ bool Parser::parseObjCProtocolRefs(ObjCProtocolRefsAST *&node)
match(T_LESS, &ast->less_token);
- unsigned identifier_token = 0;
+ int identifier_token = 0;
match(T_IDENTIFIER, &identifier_token);
ast->identifier_list = new (_pool) NameListAST;
SimpleNameAST *name = new (_pool) SimpleNameAST;
@@ -6286,7 +6286,7 @@ bool Parser::parseObjClassInstanceVariables(ObjCInstanceVariablesDeclarationAST
if (LA() == T_RBRACE)
break;
- const unsigned start = cursor();
+ const int start = cursor();
*next = new (_pool) DeclarationListAST;
parseObjCInstanceVariableDeclaration((*next)->value);
@@ -6393,7 +6393,7 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierListAS
if (LA() == T_LPAREN) {
match(T_LPAREN, &ast->lparen_token);
- ObjCPropertyAttributeAST *property_attribute = 0;
+ ObjCPropertyAttributeAST *property_attribute = nullptr;
if (parseObjCPropertyAttribute(property_attribute)) {
ast->property_attribute_list = new (_pool) ObjCPropertyAttributeListAST;
ast->property_attribute_list->value = property_attribute;
@@ -6439,8 +6439,8 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
parseObjCTypeName(ast->type_name);
if ((lookAtObjCSelector() && LA(2) == T_COLON) || LA() == T_COLON) {
- ObjCSelectorArgumentAST *argument = 0;
- ObjCMessageArgumentDeclarationAST *declaration = 0;
+ ObjCSelectorArgumentAST *argument = nullptr;
+ ObjCMessageArgumentDeclarationAST *declaration = nullptr;
parseObjCKeywordDeclaration(argument, declaration);
ObjCSelectorAST *sel = new (_pool) ObjCSelectorAST;
@@ -6472,7 +6472,7 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node)
}
// TODO: Is this still valid, and if so, should it be stored in the AST? (EV)
- ParameterDeclarationAST *parameter_declaration = 0;
+ ParameterDeclarationAST *parameter_declaration = nullptr;
parseParameterDeclaration(parameter_declaration);
}
} else if (lookAtObjCSelector()) {
@@ -6568,7 +6568,7 @@ bool Parser::parseObjCTypeName(ObjCTypeNameAST *&node)
// objc-selector ::= T_IDENTIFIER | keyword
//
-bool Parser::parseObjCSelector(unsigned &selector_token)
+bool Parser::parseObjCSelector(int &selector_token)
{
DEBUG_THIS_RULE();
if (! lookAtObjCSelector())
@@ -6605,7 +6605,7 @@ bool Parser::parseObjCKeywordDeclaration(ObjCSelectorArgumentAST *&argument, Obj
return true;
}
-bool Parser::parseObjCTypeQualifiers(unsigned &type_qualifier)
+bool Parser::parseObjCTypeQualifiers(int &type_qualifier)
{
DEBUG_THIS_RULE();
if (LA() != T_IDENTIFIER)
@@ -6636,7 +6636,7 @@ bool Parser::peekAtObjCContextKeyword(int kind)
return k == kind;
}
-bool Parser::parseObjCContextKeyword(int kind, unsigned &in_token)
+bool Parser::parseObjCContextKeyword(int kind, int &in_token)
{
DEBUG_THIS_RULE();
@@ -6661,7 +6661,7 @@ bool Parser::parseLambdaExpression(ExpressionAST *&node)
{
DEBUG_THIS_RULE();
- LambdaIntroducerAST *lambda_introducer = 0;
+ LambdaIntroducerAST *lambda_introducer = nullptr;
if (parseLambdaIntroducer(lambda_introducer)) {
LambdaExpressionAST *ast = new (_pool) LambdaExpressionAST;
ast->lambda_introducer = lambda_introducer;
@@ -6703,8 +6703,8 @@ bool Parser::parseLambdaCapture(LambdaCaptureAST *&node)
DEBUG_THIS_RULE();
bool startsWithDefaultCapture = false;
- unsigned default_capture = 0;
- CaptureListAST *capture_list = 0;
+ int default_capture = 0;
+ CaptureListAST *capture_list = nullptr;
if (LA() == T_AMPER || LA() == T_EQUAL) {
if (LA(2) == T_COMMA || LA(2) == T_RBRACKET) {
@@ -6758,7 +6758,7 @@ bool Parser::parseCaptureList(CaptureListAST *&node)
{
DEBUG_THIS_RULE();
- CaptureAST *capture = 0;
+ CaptureAST *capture = nullptr;
if (parseCapture(capture)) {
node = new (_pool) CaptureListAST;
@@ -6767,7 +6767,7 @@ bool Parser::parseCaptureList(CaptureListAST *&node)
CaptureListAST **l = &node->next;
while (LA() == T_COMMA) {
consumeToken(); // consume `,'
- CaptureAST *capture = 0;
+ CaptureAST *capture = nullptr;
parseCapture(capture);
if (capture) {
*l = new (_pool) CaptureListAST;
@@ -6828,21 +6828,21 @@ bool Parser::parseTrailingReturnType(TrailingReturnTypeAST *&node)
return true;
}
-void Parser::rewind(unsigned cursor)
+void Parser::rewind(int cursor)
{
#ifndef CPLUSPLUS_NO_DEBUG_RULE
if (cursor != _tokenIndex)
fprintf(stderr, "! rewinding from token %d to token %d\n", _tokenIndex, cursor);
#endif
- const unsigned n = _translationUnit->tokenCount();
+ const int n = _translationUnit->tokenCount();
if (cursor < n)
_tokenIndex = cursor;
else
_tokenIndex = n - 1;
}
-void Parser::warning(unsigned index, const char *format, ...)
+void Parser::warning(int index, const char *format, ...)
{
va_list args, ap;
va_start(args, format);
@@ -6852,7 +6852,7 @@ void Parser::warning(unsigned index, const char *format, ...)
va_end(args);
}
-void Parser::error(unsigned index, const char *format, ...)
+void Parser::error(int index, const char *format, ...)
{
va_list args, ap;
va_start(args, format);
@@ -6862,7 +6862,7 @@ void Parser::error(unsigned index, const char *format, ...)
va_end(args);
}
-void Parser::fatal(unsigned index, const char *format, ...)
+void Parser::fatal(int index, const char *format, ...)
{
va_list args, ap;
va_start(args, format);
diff --git a/src/libs/3rdparty/cplusplus/Parser.h b/src/libs/3rdparty/cplusplus/Parser.h
index 110bb29d2b..750c590b40 100644
--- a/src/libs/3rdparty/cplusplus/Parser.h
+++ b/src/libs/3rdparty/cplusplus/Parser.h
@@ -72,14 +72,14 @@ public:
bool parseConstantExpression(ExpressionAST *&node);
bool parseCtorInitializer(CtorInitializerAST *&node);
bool parseCvQualifiers(SpecifierListAST *&node);
- bool parseRefQualifier(unsigned &ref_qualifier);
+ bool parseRefQualifier(int &ref_qualifier);
bool parseOverrideFinalQualifiers(SpecifierListAST *&node);
bool parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list);
bool parseDeclaration(DeclarationAST *&node);
- bool parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *declaringClass = 0);
+ bool parseSimpleDeclaration(DeclarationAST *&node, ClassSpecifierAST *declaringClass = nullptr);
bool parseDeclarationStatement(StatementAST *&node);
bool parseCoreDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass);
- bool parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass = 0);
+ bool parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass = nullptr);
bool parseDeleteExpression(ExpressionAST *&node);
bool parseDoStatement(StatementAST *&node);
bool parseElaboratedTypeSpecifier(SpecifierListAST *&node);
@@ -100,7 +100,7 @@ public:
bool parseInclusiveOrExpression(ExpressionAST *&node);
bool parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass);
bool parseInitializerList(ExpressionListAST *&node);
- bool parseInitializer(ExpressionAST *&node, unsigned *equals_token);
+ bool parseInitializer(ExpressionAST *&node, int *equals_token);
bool parseInitializerClause(ExpressionAST *&node);
bool parseLabeledStatement(StatementAST *&node);
bool parseLinkageBody(DeclarationAST *&node);
@@ -111,7 +111,7 @@ public:
bool parseMemInitializerList(MemInitializerListAST *&node);
bool parseMemberSpecification(DeclarationAST *&node, ClassSpecifierAST *declaringClass);
bool parseMultiplicativeExpression(ExpressionAST *&node);
- bool parseTemplateId(NameAST *&node, unsigned template_token = 0);
+ bool parseTemplateId(NameAST *&node, int template_token = 0);
bool parseClassOrNamespaceName(NameAST *&node);
bool parseNameId(NameAST *&node);
bool parseName(NameAST *&node, bool acceptTemplateId = true);
@@ -195,7 +195,7 @@ public:
bool parseQtMethod(ExpressionAST *&node);
// C++0x
- bool parseInitializer0x(ExpressionAST *&node, unsigned *equals_token);
+ bool parseInitializer0x(ExpressionAST *&node, int *equals_token);
bool parseBraceOrEqualInitializer0x(ExpressionAST *&node);
bool parseInitializerClause0x(ExpressionAST *&node);
bool parseInitializerList0x(ExpressionListAST *&node);
@@ -213,9 +213,9 @@ public:
bool parseObjCExpression(ExpressionAST *&node);
bool parseObjCClassForwardDeclaration(DeclarationAST *&node);
bool parseObjCInterface(DeclarationAST *&node,
- SpecifierListAST *attributes = 0);
+ SpecifierListAST *attributes = nullptr);
bool parseObjCProtocol(DeclarationAST *&node,
- SpecifierListAST *attributes = 0);
+ SpecifierListAST *attributes = nullptr);
bool parseObjCTryStatement(StatementAST *&node);
bool parseObjCSynchronizedStatement(StatementAST *&node);
@@ -236,16 +236,16 @@ public:
bool parseObjCInterfaceMemberDeclaration(DeclarationAST *&node);
bool parseObjCInstanceVariableDeclaration(DeclarationAST *&node);
bool parseObjCPropertyDeclaration(DeclarationAST *&node,
- SpecifierListAST *attributes = 0);
+ SpecifierListAST *attributes = nullptr);
bool parseObjCImplementation(DeclarationAST *&node);
bool parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node);
bool parseObjCPropertyAttribute(ObjCPropertyAttributeAST *&node);
bool parseObjCTypeName(ObjCTypeNameAST *&node);
- bool parseObjCSelector(unsigned &selector_token);
+ bool parseObjCSelector(int &selector_token);
bool parseObjCKeywordDeclaration(ObjCSelectorArgumentAST *&argument, ObjCMessageArgumentDeclarationAST *&node);
- bool parseObjCTypeQualifiers(unsigned &type_qualifier);
+ bool parseObjCTypeQualifiers(int &type_qualifier);
bool peekAtObjCContextKeyword(int kind);
- bool parseObjCContextKeyword(int kind, unsigned &in_token);
+ bool parseObjCContextKeyword(int kind, int &in_token);
bool lookAtObjCSelector() const;
@@ -269,7 +269,7 @@ public:
const Identifier *className(ClassSpecifierAST *ast) const;
const Identifier *identifier(NameAST *name) const;
- void match(int kind, unsigned *token);
+ void match(int kind, int *token);
bool maybeAmbiguousStatement(DeclarationStatementAST *ast, StatementAST *&node);
bool maybeForwardOrClassDeclaration(SpecifierListAST *decl_specifier_seq) const;
@@ -280,9 +280,9 @@ public:
bool maybeSplitGreaterGreaterToken(int n = 1);
bool blockErrors(bool block) { return _translationUnit->blockErrors(block); }
- void warning(unsigned index, const char *format, ...);
- void error(unsigned index, const char *format, ...);
- void fatal(unsigned index, const char *format, ...);
+ void warning(int index, const char *format, ...);
+ void error(int index, const char *format, ...);
+ void fatal(int index, const char *format, ...);
inline const Token &tok(int i = 1) const
{ return _translationUnit->tokenAt(_tokenIndex + i - 1); }
@@ -293,21 +293,21 @@ public:
inline int consumeToken()
{ return _tokenIndex++; }
- inline unsigned cursor() const
+ inline int cursor() const
{ return _tokenIndex; }
- void rewind(unsigned cursor);
+ void rewind(int cursor);
struct TemplateArgumentListEntry {
- unsigned index;
- unsigned cursor;
+ int index;
+ int cursor;
ExpressionListAST *ast;
- TemplateArgumentListEntry(unsigned index = 0, unsigned cursor = 0, ExpressionListAST *ast = 0)
+ TemplateArgumentListEntry(int index = 0, int cursor = 0, ExpressionListAST *ast = nullptr)
: index(index), cursor(cursor), ast(ast) {}
};
- TemplateArgumentListEntry *templateArgumentListEntry(unsigned tokenIndex);
+ TemplateArgumentListEntry *templateArgumentListEntry(int tokenIndex);
void clearTemplateArgumentList() { _templateArgumentList.clear(); }
private:
@@ -315,7 +315,7 @@ private:
Control *_control;
MemoryPool *_pool;
LanguageFeatures _languageFeatures;
- unsigned _tokenIndex;
+ int _tokenIndex;
bool _templateArguments: 1;
bool _inFunctionBody: 1;
bool _inExpressionStatement: 1;
@@ -324,7 +324,7 @@ private:
std::stack<int> _initializerClauseDepth;
MemoryPool _expressionStatementTempPool;
- std::map<unsigned, TemplateArgumentListEntry> _templateArgumentList;
+ std::map<int, TemplateArgumentListEntry> _templateArgumentList;
class ASTCache;
ASTCache *_astCache;
diff --git a/src/libs/3rdparty/cplusplus/Scope.cpp b/src/libs/3rdparty/cplusplus/Scope.cpp
index 406a794c7e..43d8c98965 100644
--- a/src/libs/3rdparty/cplusplus/Scope.cpp
+++ b/src/libs/3rdparty/cplusplus/Scope.cpp
@@ -40,7 +40,7 @@ public:
public:
/// Constructs an empty Scope.
- SymbolTable(Scope *owner = 0);
+ SymbolTable(Scope *owner = nullptr);
/// Destroy this scope.
~SymbolTable();
@@ -58,10 +58,10 @@ public:
bool isEmpty() const;
/// Returns the number of symbols is in the scope.
- unsigned symbolCount() const;
+ int symbolCount() const;
/// Returns the Symbol at the given position.
- Symbol *symbolAt(unsigned index) const;
+ Symbol *symbolAt(int index) const;
/// Returns the first Symbol in the scope.
iterator firstSymbol() const;
@@ -92,8 +92,8 @@ private:
SymbolTable::SymbolTable(Scope *owner)
: _owner(owner),
- _symbols(0),
- _hash(0),
+ _symbols(nullptr),
+ _hash(nullptr),
_allocatedSymbols(0),
_symbolCount(-1),
_hashSize(0)
@@ -136,7 +136,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
Symbol *SymbolTable::lookat(const Identifier *id) const
{
if (! _hash || ! id)
- return 0;
+ return nullptr;
const unsigned h = id->hashCode() % _hashSize;
Symbol *symbol = _hash[h];
@@ -154,7 +154,7 @@ Symbol *SymbolTable::lookat(const Identifier *id) const
if (d->identifier()->match(id))
break;
} else if (identity->isQualifiedNameId()) {
- return 0;
+ return nullptr;
} else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) {
if (selectorNameId->identifier()->match(id))
break;
@@ -166,7 +166,7 @@ Symbol *SymbolTable::lookat(const Identifier *id) const
Symbol *SymbolTable::lookat(OperatorNameId::Kind operatorId) const
{
if (! _hash)
- return 0;
+ return nullptr;
const unsigned h = operatorId % _hashSize;
Symbol *symbol = _hash[h];
@@ -210,13 +210,13 @@ unsigned SymbolTable::hashValue(Symbol *symbol) const
bool SymbolTable::isEmpty() const
{ return _symbolCount == -1; }
-unsigned SymbolTable::symbolCount() const
+int SymbolTable::symbolCount() const
{ return _symbolCount + 1; }
-Symbol *SymbolTable::symbolAt(unsigned index) const
+Symbol *SymbolTable::symbolAt(int index) const
{
if (! _symbols)
- return 0;
+ return nullptr;
return _symbols[index];
}
@@ -226,16 +226,16 @@ SymbolTable::iterator SymbolTable::firstSymbol() const
SymbolTable::iterator SymbolTable::lastSymbol() const
{ return _symbols + _symbolCount + 1; }
-Scope::Scope(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Scope::Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name),
- _members(0),
+ _members(nullptr),
_startOffset(0),
_endOffset(0)
{ }
Scope::Scope(Clone *clone, Subst *subst, Scope *original)
: Symbol(clone, subst, original)
- , _members(0)
+ , _members(nullptr)
, _startOffset(original->_startOffset)
, _endOffset(original->_endOffset)
{
@@ -260,39 +260,39 @@ bool Scope::isEmpty() const
{ return _members ? _members->isEmpty() : true; }
/// Returns the number of symbols is in the scope.
-unsigned Scope::memberCount() const
+int Scope::memberCount() const
{ return _members ? _members->symbolCount() : 0; }
/// Returns the Symbol at the given position.
-Symbol *Scope::memberAt(unsigned index) const
-{ return _members ? _members->symbolAt(index) : 0; }
+Symbol *Scope::memberAt(int index) const
+{ return _members ? _members->symbolAt(index) : nullptr; }
/// Returns the first Symbol in the scope.
Scope::iterator Scope::memberBegin() const
-{ return _members ? _members->firstSymbol() : 0; }
+{ return _members ? _members->firstSymbol() : nullptr; }
/// Returns the last Symbol in the scope.
Scope::iterator Scope::memberEnd() const
-{ return _members ? _members->lastSymbol() : 0; }
+{ return _members ? _members->lastSymbol() : nullptr; }
Symbol *Scope::find(const Identifier *id) const
-{ return _members ? _members->lookat(id) : 0; }
+{ return _members ? _members->lookat(id) : nullptr; }
Symbol *Scope::find(OperatorNameId::Kind operatorId) const
-{ return _members ? _members->lookat(operatorId) : 0; }
+{ return _members ? _members->lookat(operatorId) : nullptr; }
/// Set the start offset of the scope
-unsigned Scope::startOffset() const
+int Scope::startOffset() const
{ return _startOffset; }
-void Scope::setStartOffset(unsigned offset)
+void Scope::setStartOffset(int offset)
{ _startOffset = offset; }
/// Set the end offset of the scope
-unsigned Scope::endOffset() const
+int Scope::endOffset() const
{ return _endOffset; }
-void Scope::setEndOffset(unsigned offset)
+void Scope::setEndOffset(int offset)
{ _endOffset = offset; }
} // namespace CPlusPlus
diff --git a/src/libs/3rdparty/cplusplus/Scope.h b/src/libs/3rdparty/cplusplus/Scope.h
index 01a5b7450d..c3b2a6ca37 100644
--- a/src/libs/3rdparty/cplusplus/Scope.h
+++ b/src/libs/3rdparty/cplusplus/Scope.h
@@ -29,7 +29,7 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT Scope: public Symbol
{
public:
- Scope(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Scope(Clone *clone, Subst *subst, Scope *original);
virtual ~Scope();
@@ -40,10 +40,10 @@ public:
bool isEmpty() const;
/// Returns the number of symbols is in the scope.
- unsigned memberCount() const;
+ int memberCount() const;
/// Returns the Symbol at the given position.
- Symbol *memberAt(unsigned index) const;
+ Symbol *memberAt(int index) const;
typedef Symbol **iterator;
@@ -57,12 +57,12 @@ public:
Symbol *find(OperatorNameId::Kind operatorId) const;
/// Set the start offset of the scope
- unsigned startOffset() const;
- void setStartOffset(unsigned offset);
+ int startOffset() const;
+ void setStartOffset(int offset);
/// Set the end offset of the scope
- unsigned endOffset() const;
- void setEndOffset(unsigned offset);
+ int endOffset() const;
+ void setEndOffset(int offset);
virtual const Scope *asScope() const
{ return this; }
@@ -72,8 +72,8 @@ public:
private:
SymbolTable *_members;
- unsigned _startOffset;
- unsigned _endOffset;
+ int _startOffset;
+ int _endOffset;
};
} // namespace CPlusPlus
diff --git a/src/libs/3rdparty/cplusplus/Symbol.cpp b/src/libs/3rdparty/cplusplus/Symbol.cpp
index e9c7edb0dc..62100474b4 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbol.cpp
@@ -86,11 +86,11 @@ private:
unsigned _value;
};
-Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
- : _name(0),
- _enclosingScope(0),
- _next(0),
- _fileId(0),
+Symbol::Symbol(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
+ : _name(nullptr),
+ _enclosingScope(nullptr),
+ _next(nullptr),
+ _fileId(nullptr),
_sourceLocation(0),
_hashCode(0),
_storage(Symbol::NoStorage),
@@ -108,8 +108,8 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const
Symbol::Symbol(Clone *clone, Subst *subst, Symbol *original)
: _name(clone->name(original->_name, subst)),
- _enclosingScope(0),
- _next(0),
+ _enclosingScope(nullptr),
+ _next(nullptr),
_fileId(clone->control()->stringLiteral(original->fileName(), original->fileNameLength())),
_sourceLocation(original->_sourceLocation),
_hashCode(original->_hashCode),
@@ -142,7 +142,7 @@ void Symbol::visitSymbol(Symbol *symbol, SymbolVisitor *visitor)
symbol->visitSymbol(visitor);
}
-unsigned Symbol::sourceLocation() const
+int Symbol::sourceLocation() const
{ return _sourceLocation; }
bool Symbol::isGenerated() const
@@ -160,7 +160,7 @@ bool Symbol::isUnavailable() const
void Symbol::setUnavailable(bool isUnavailable)
{ _isUnavailable = isUnavailable; }
-void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit)
+void Symbol::setSourceLocation(int sourceLocation, TranslationUnit *translationUnit)
{
_sourceLocation = sourceLocation;
@@ -172,16 +172,16 @@ void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *transla
_isGenerated = false;
_line = 0;
_column = 0;
- _fileId = 0;
+ _fileId = nullptr;
}
}
-unsigned Symbol::line() const
+int Symbol::line() const
{
return _line;
}
-unsigned Symbol::column() const
+int Symbol::column() const
{
return _column;
}
@@ -194,13 +194,13 @@ const StringLiteral *Symbol::fileId() const
const char *Symbol::fileName() const
{ return _fileId ? _fileId->chars() : ""; }
-unsigned Symbol::fileNameLength() const
+int Symbol::fileNameLength() const
{ return _fileId ? _fileId->size() : 0; }
const Name *Symbol::unqualifiedName() const
{
if (! _name)
- return 0;
+ return nullptr;
else if (const QualifiedNameId *q = _name->asQualifiedNameId())
return q->name();
@@ -228,7 +228,7 @@ const Identifier *Symbol::identifier() const
if (_name)
return _name->identifier();
- return 0;
+ return nullptr;
}
Scope *Symbol::enclosingScope() const
@@ -242,7 +242,7 @@ void Symbol::setEnclosingScope(Scope *scope)
void Symbol::resetEnclosingScope()
{
- _enclosingScope = 0;
+ _enclosingScope = nullptr;
}
Namespace *Symbol::enclosingNamespace() const
@@ -251,7 +251,7 @@ Namespace *Symbol::enclosingNamespace() const
if (Namespace *ns = s->asNamespace())
return ns;
}
- return 0;
+ return nullptr;
}
Template *Symbol::enclosingTemplate() const
@@ -260,7 +260,7 @@ Template *Symbol::enclosingTemplate() const
if (Template *templ = s->asTemplate())
return templ;
}
- return 0;
+ return nullptr;
}
Class *Symbol::enclosingClass() const
@@ -269,7 +269,7 @@ Class *Symbol::enclosingClass() const
if (Class *klass = s->asClass())
return klass;
}
- return 0;
+ return nullptr;
}
Enum *Symbol::enclosingEnum() const
@@ -278,7 +278,7 @@ Enum *Symbol::enclosingEnum() const
if (Enum *e = s->asEnum())
return e;
}
- return 0;
+ return nullptr;
}
Function *Symbol::enclosingFunction() const
@@ -287,7 +287,7 @@ Function *Symbol::enclosingFunction() const
if (Function *fun = s->asFunction())
return fun;
}
- return 0;
+ return nullptr;
}
Block *Symbol::enclosingBlock() const
@@ -296,7 +296,7 @@ Block *Symbol::enclosingBlock() const
if (Block *block = s->asBlock())
return block;
}
- return 0;
+ return nullptr;
}
unsigned Symbol::index() const
@@ -348,76 +348,76 @@ bool Symbol::isPrivate() const
{ return _visibility == Private; }
bool Symbol::isScope() const
-{ return asScope() != 0; }
+{ return asScope() != nullptr; }
bool Symbol::isEnum() const
-{ return asEnum() != 0; }
+{ return asEnum() != nullptr; }
bool Symbol::isFunction() const
-{ return asFunction() != 0; }
+{ return asFunction() != nullptr; }
bool Symbol::isNamespace() const
-{ return asNamespace() != 0; }
+{ return asNamespace() != nullptr; }
bool Symbol::isTemplate() const
-{ return asTemplate() != 0; }
+{ return asTemplate() != nullptr; }
bool Symbol::isClass() const
-{ return asClass() != 0; }
+{ return asClass() != nullptr; }
bool Symbol::isForwardClassDeclaration() const
-{ return asForwardClassDeclaration() != 0; }
+{ return asForwardClassDeclaration() != nullptr; }
bool Symbol::isQtPropertyDeclaration() const
-{ return asQtPropertyDeclaration() != 0; }
+{ return asQtPropertyDeclaration() != nullptr; }
bool Symbol::isQtEnum() const
-{ return asQtEnum() != 0; }
+{ return asQtEnum() != nullptr; }
bool Symbol::isBlock() const
-{ return asBlock() != 0; }
+{ return asBlock() != nullptr; }
bool Symbol::isUsingNamespaceDirective() const
-{ return asUsingNamespaceDirective() != 0; }
+{ return asUsingNamespaceDirective() != nullptr; }
bool Symbol::isUsingDeclaration() const
-{ return asUsingDeclaration() != 0; }
+{ return asUsingDeclaration() != nullptr; }
bool Symbol::isDeclaration() const
-{ return asDeclaration() != 0; }
+{ return asDeclaration() != nullptr; }
bool Symbol::isArgument() const
-{ return asArgument() != 0; }
+{ return asArgument() != nullptr; }
bool Symbol::isTypenameArgument() const
-{ return asTypenameArgument() != 0; }
+{ return asTypenameArgument() != nullptr; }
bool Symbol::isBaseClass() const
-{ return asBaseClass() != 0; }
+{ return asBaseClass() != nullptr; }
bool Symbol::isObjCBaseClass() const
-{ return asObjCBaseClass() != 0; }
+{ return asObjCBaseClass() != nullptr; }
bool Symbol::isObjCBaseProtocol() const
-{ return asObjCBaseProtocol() != 0; }
+{ return asObjCBaseProtocol() != nullptr; }
bool Symbol::isObjCClass() const
-{ return asObjCClass() != 0; }
+{ return asObjCClass() != nullptr; }
bool Symbol::isObjCForwardClassDeclaration() const
-{ return asObjCForwardClassDeclaration() != 0; }
+{ return asObjCForwardClassDeclaration() != nullptr; }
bool Symbol::isObjCProtocol() const
-{ return asObjCProtocol() != 0; }
+{ return asObjCProtocol() != nullptr; }
bool Symbol::isObjCForwardProtocolDeclaration() const
-{ return asObjCForwardProtocolDeclaration() != 0; }
+{ return asObjCForwardProtocolDeclaration() != nullptr; }
bool Symbol::isObjCMethod() const
-{ return asObjCMethod() != 0; }
+{ return asObjCMethod() != nullptr; }
bool Symbol::isObjCPropertyDeclaration() const
-{ return asObjCPropertyDeclaration() != 0; }
+{ return asObjCPropertyDeclaration() != nullptr; }
void Symbol::copy(Symbol *other)
{
@@ -439,10 +439,10 @@ void Symbol::copy(Symbol *other)
Utils::Link Symbol::toLink() const
{
- const QString filename = QString::fromUtf8(fileName(), static_cast<int>(fileNameLength()));
+ const QString filename = QString::fromUtf8(fileName(), fileNameLength());
- int line = static_cast<int>(this->line());
- int column = static_cast<int>(this->column());
+ int line = this->line();
+ int column = this->column();
if (column)
--column;
diff --git a/src/libs/3rdparty/cplusplus/Symbol.h b/src/libs/3rdparty/cplusplus/Symbol.h
index e4c8eea152..ae441b339b 100644
--- a/src/libs/3rdparty/cplusplus/Symbol.h
+++ b/src/libs/3rdparty/cplusplus/Symbol.h
@@ -54,20 +54,20 @@ public:
public:
/// Constructs a Symbol with the given source location, name and translation unit.
- Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Symbol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Symbol(Clone *clone, Subst *subst, Symbol *original);
/// Destroy this Symbol.
virtual ~Symbol();
/// Returns this Symbol's source location.
- unsigned sourceLocation() const;
+ int sourceLocation() const;
/// \returns this Symbol's line number. The line number is 1-based.
- unsigned line() const;
+ int line() const;
/// \returns this Symbol's column number. The column number is 1-based.
- unsigned column() const;
+ int column() const;
/// Returns this Symbol's file name.
const StringLiteral *fileId() const;
@@ -76,7 +76,7 @@ public:
const char *fileName() const;
/// Returns this Symbol's file name length.
- unsigned fileNameLength() const;
+ int fileNameLength() const;
/// Returns this Symbol's name.
const Name *name() const;
@@ -200,57 +200,57 @@ public:
Utils::Link toLink() const;
- virtual const Scope *asScope() const { return 0; }
- virtual const Enum *asEnum() const { return 0; }
- virtual const Function *asFunction() const { return 0; }
- virtual const Namespace *asNamespace() const { return 0; }
- virtual const Template *asTemplate() const { return 0; }
- virtual const NamespaceAlias *asNamespaceAlias() const { return 0; }
- virtual const Class *asClass() const { return 0; }
- virtual const Block *asBlock() const { return 0; }
- virtual const UsingNamespaceDirective *asUsingNamespaceDirective() const { return 0; }
- virtual const UsingDeclaration *asUsingDeclaration() const { return 0; }
- virtual const Declaration *asDeclaration() const { return 0; }
- virtual const Argument *asArgument() const { return 0; }
- virtual const TypenameArgument *asTypenameArgument() const { return 0; }
- virtual const BaseClass *asBaseClass() const { return 0; }
- virtual const ForwardClassDeclaration *asForwardClassDeclaration() const { return 0; }
- virtual const QtPropertyDeclaration *asQtPropertyDeclaration() const { return 0; }
- virtual const QtEnum *asQtEnum() const { return 0; }
- virtual const ObjCBaseClass *asObjCBaseClass() const { return 0; }
- virtual const ObjCBaseProtocol *asObjCBaseProtocol() const { return 0; }
- virtual const ObjCClass *asObjCClass() const { return 0; }
- virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const { return 0; }
- virtual const ObjCProtocol *asObjCProtocol() const { return 0; }
- virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const { return 0; }
- virtual const ObjCMethod *asObjCMethod() const { return 0; }
- virtual const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const { return 0; }
-
- virtual Scope *asScope() { return 0; }
- virtual Enum *asEnum() { return 0; }
- virtual Function *asFunction() { return 0; }
- virtual Namespace *asNamespace() { return 0; }
- virtual Template *asTemplate() { return 0; }
- virtual NamespaceAlias *asNamespaceAlias() { return 0; }
- virtual Class *asClass() { return 0; }
- virtual Block *asBlock() { return 0; }
- virtual UsingNamespaceDirective *asUsingNamespaceDirective() { return 0; }
- virtual UsingDeclaration *asUsingDeclaration() { return 0; }
- virtual Declaration *asDeclaration() { return 0; }
- virtual Argument *asArgument() { return 0; }
- virtual TypenameArgument *asTypenameArgument() { return 0; }
- virtual BaseClass *asBaseClass() { return 0; }
- virtual ForwardClassDeclaration *asForwardClassDeclaration() { return 0; }
- virtual QtPropertyDeclaration *asQtPropertyDeclaration() { return 0; }
- virtual QtEnum *asQtEnum() { return 0; }
- virtual ObjCBaseClass *asObjCBaseClass() { return 0; }
- virtual ObjCBaseProtocol *asObjCBaseProtocol() { return 0; }
- virtual ObjCClass *asObjCClass() { return 0; }
- virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() { return 0; }
- virtual ObjCProtocol *asObjCProtocol() { return 0; }
- virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() { return 0; }
- virtual ObjCMethod *asObjCMethod() { return 0; }
- virtual ObjCPropertyDeclaration *asObjCPropertyDeclaration() { return 0; }
+ virtual const Scope *asScope() const { return nullptr; }
+ virtual const Enum *asEnum() const { return nullptr; }
+ virtual const Function *asFunction() const { return nullptr; }
+ virtual const Namespace *asNamespace() const { return nullptr; }
+ virtual const Template *asTemplate() const { return nullptr; }
+ virtual const NamespaceAlias *asNamespaceAlias() const { return nullptr; }
+ virtual const Class *asClass() const { return nullptr; }
+ virtual const Block *asBlock() const { return nullptr; }
+ virtual const UsingNamespaceDirective *asUsingNamespaceDirective() const { return nullptr; }
+ virtual const UsingDeclaration *asUsingDeclaration() const { return nullptr; }
+ virtual const Declaration *asDeclaration() const { return nullptr; }
+ virtual const Argument *asArgument() const { return nullptr; }
+ virtual const TypenameArgument *asTypenameArgument() const { return nullptr; }
+ virtual const BaseClass *asBaseClass() const { return nullptr; }
+ virtual const ForwardClassDeclaration *asForwardClassDeclaration() const { return nullptr; }
+ virtual const QtPropertyDeclaration *asQtPropertyDeclaration() const { return nullptr; }
+ virtual const QtEnum *asQtEnum() const { return nullptr; }
+ virtual const ObjCBaseClass *asObjCBaseClass() const { return nullptr; }
+ virtual const ObjCBaseProtocol *asObjCBaseProtocol() const { return nullptr; }
+ virtual const ObjCClass *asObjCClass() const { return nullptr; }
+ virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const { return nullptr; }
+ virtual const ObjCProtocol *asObjCProtocol() const { return nullptr; }
+ virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const { return nullptr; }
+ virtual const ObjCMethod *asObjCMethod() const { return nullptr; }
+ virtual const ObjCPropertyDeclaration *asObjCPropertyDeclaration() const { return nullptr; }
+
+ virtual Scope *asScope() { return nullptr; }
+ virtual Enum *asEnum() { return nullptr; }
+ virtual Function *asFunction() { return nullptr; }
+ virtual Namespace *asNamespace() { return nullptr; }
+ virtual Template *asTemplate() { return nullptr; }
+ virtual NamespaceAlias *asNamespaceAlias() { return nullptr; }
+ virtual Class *asClass() { return nullptr; }
+ virtual Block *asBlock() { return nullptr; }
+ virtual UsingNamespaceDirective *asUsingNamespaceDirective() { return nullptr; }
+ virtual UsingDeclaration *asUsingDeclaration() { return nullptr; }
+ virtual Declaration *asDeclaration() { return nullptr; }
+ virtual Argument *asArgument() { return nullptr; }
+ virtual TypenameArgument *asTypenameArgument() { return nullptr; }
+ virtual BaseClass *asBaseClass() { return nullptr; }
+ virtual ForwardClassDeclaration *asForwardClassDeclaration() { return nullptr; }
+ virtual QtPropertyDeclaration *asQtPropertyDeclaration() { return nullptr; }
+ virtual QtEnum *asQtEnum() { return nullptr; }
+ virtual ObjCBaseClass *asObjCBaseClass() { return nullptr; }
+ virtual ObjCBaseProtocol *asObjCBaseProtocol() { return nullptr; }
+ virtual ObjCClass *asObjCClass() { return nullptr; }
+ virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() { return nullptr; }
+ virtual ObjCProtocol *asObjCProtocol() { return nullptr; }
+ virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() { return nullptr; }
+ virtual ObjCMethod *asObjCMethod() { return nullptr; }
+ virtual ObjCPropertyDeclaration *asObjCPropertyDeclaration() { return nullptr; }
/// Returns this Symbol's type.
virtual FullySpecifiedType type() const = 0;
@@ -294,7 +294,7 @@ public:
void setEnclosingScope(Scope *enclosingScope); // ### make me private
void resetEnclosingScope(); // ### make me private
- void setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit); // ### make me private
+ void setSourceLocation(int sourceLocation, TranslationUnit *translationUnit); // ### make me private
void visitSymbol(SymbolVisitor *visitor);
static void visitSymbol(Symbol *symbol, SymbolVisitor *visitor);
@@ -309,13 +309,13 @@ private:
Scope *_enclosingScope;
Symbol *_next;
const StringLiteral *_fileId;
- unsigned _sourceLocation;
+ int _sourceLocation;
unsigned _hashCode;
int _storage;
int _visibility;
- unsigned _index;
- unsigned _line;
- unsigned _column;
+ int _index;
+ int _line;
+ int _column;
bool _isGenerated: 1;
bool _isDeprecated: 1;
diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp
index 8ce7cb8a73..a895f7ed6c 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbols.cpp
@@ -34,7 +34,7 @@
using namespace CPlusPlus;
UsingNamespaceDirective::UsingNamespaceDirective(TranslationUnit *translationUnit,
- unsigned sourceLocation, const Name *name)
+ int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -52,8 +52,8 @@ void UsingNamespaceDirective::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
NamespaceAlias::NamespaceAlias(TranslationUnit *translationUnit,
- unsigned sourceLocation, const Name *name)
- : Symbol(translationUnit, sourceLocation, name), _namespaceName(0)
+ int sourceLocation, const Name *name)
+ : Symbol(translationUnit, sourceLocation, name), _namespaceName(nullptr)
{ }
NamespaceAlias::NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original)
@@ -78,7 +78,7 @@ void NamespaceAlias::visitSymbol0(SymbolVisitor *visitor)
UsingDeclaration::UsingDeclaration(TranslationUnit *translationUnit,
- unsigned sourceLocation, const Name *name)
+ int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -95,9 +95,9 @@ FullySpecifiedType UsingDeclaration::type() const
void UsingDeclaration::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-Declaration::Declaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Declaration::Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
- , _initializer(0)
+ , _initializer(nullptr)
{ }
Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
@@ -158,7 +158,7 @@ Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
std::strcmp(enNamespaceNameId, "__cxx11") == 0) {
if (std::strcmp(enClassNameId, "unique_ptr") == 0) {
if (std::strcmp(nameId, "pointer") == 0) {
- newType = clone->type(subst->apply(firstTemplParamName), 0);
+ newType = clone->type(subst->apply(firstTemplParamName), nullptr);
newType = FullySpecifiedType(clone->control()->pointerType(newType));
}
} else if (std::strcmp(enClassNameId, "list") == 0 ||
@@ -172,12 +172,12 @@ Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
std::strcmp(enClassNameId, "array") == 0) {
if (std::strcmp(nameId, "reference") == 0 ||
std::strcmp(nameId, "const_reference") == 0) {
- newType = clone->type(subst->apply(firstTemplParamName), 0);
+ newType = clone->type(subst->apply(firstTemplParamName), nullptr);
} else if (std::strcmp(nameId, "iterator") == 0 ||
std::strcmp(nameId, "reverse_iterator") == 0 ||
std::strcmp(nameId, "const_reverse_iterator") == 0 ||
std::strcmp(nameId, "const_iterator") == 0) {
- newType = clone->type(subst->apply(firstTemplParamName), 0);
+ newType = clone->type(subst->apply(firstTemplParamName), nullptr);
newType = FullySpecifiedType(clone->control()->pointerType(newType));
}
} else if (std::strcmp(enClassNameId, "_Hash") == 0 ||
@@ -186,12 +186,12 @@ Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
std::strcmp(nameId, "reverse_iterator") == 0 ||
std::strcmp(nameId, "const_reverse_iterator") == 0 ||
std::strcmp(nameId, "const_iterator") == 0) {
- FullySpecifiedType clonedType = clone->type(subst->apply(firstTemplParamName), 0);
+ FullySpecifiedType clonedType = clone->type(subst->apply(firstTemplParamName), nullptr);
if (NamedType *namedType = clonedType.type()->asNamedType()) {
if (const TemplateNameId * templateNameId =
namedType->name()->asTemplateNameId()) {
if (templateNameId->templateArgumentCount()) {
- newType = clone->type(templateNameId->templateArgumentAt(0), 0);
+ newType = clone->type(templateNameId->templateArgumentAt(0), nullptr);
newType = FullySpecifiedType(clone->control()->pointerType(newType));
}
}
@@ -226,9 +226,9 @@ const StringLiteral *Declaration::getInitializer() const
void Declaration::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Declaration(translationUnit, sourceLocation, name)
- , _constantValue(0)
+ , _constantValue(nullptr)
{}
EnumeratorDeclaration::~EnumeratorDeclaration()
@@ -240,9 +240,9 @@ const StringLiteral *EnumeratorDeclaration::constantValue() const
void EnumeratorDeclaration::setConstantValue(const StringLiteral *constantValue)
{ _constantValue = constantValue; }
-Argument::Argument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Argument::Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name),
- _initializer(0)
+ _initializer(nullptr)
{ }
Argument::Argument(Clone *clone, Subst *subst, Argument *original)
@@ -255,7 +255,7 @@ Argument::~Argument()
{ }
bool Argument::hasInitializer() const
-{ return _initializer != 0; }
+{ return _initializer != nullptr; }
const StringLiteral *Argument::initializer() const
{ return _initializer; }
@@ -272,7 +272,7 @@ FullySpecifiedType Argument::type() const
void Argument::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
, _isClassDeclarator(false)
{ }
@@ -295,7 +295,7 @@ FullySpecifiedType TypenameArgument::type() const
void TypenameArgument::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-Function::Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Function::Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name),
_flags(0)
{ }
@@ -338,10 +338,10 @@ bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
else if (! Matcher::match(unqualifiedName(), other->unqualifiedName(), matcher))
return false;
- const unsigned argc = argumentCount();
+ const int argc = argumentCount();
if (argc != other->argumentCount())
return false;
- for (unsigned i = 0; i < argc; ++i) {
+ for (int i = 0; i < argc; ++i) {
Symbol *l = argumentAt(i);
Symbol *r = other->argumentAt(i);
if (! l->type().match(r->type(), matcher)) {
@@ -395,24 +395,24 @@ bool Function::hasReturnType() const
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
}
-unsigned Function::argumentCount() const
+int Function::argumentCount() const
{
- const unsigned memCnt = memberCount();
+ const int memCnt = memberCount();
if (memCnt > 0 && memberAt(0)->type()->isVoidType())
return 0;
// Definitions with function-try-blocks will have more than a block, and
// arguments with a lambda as default argument will also have more blocks.
- unsigned argc = 0;
- for (unsigned it = 0; it < memCnt; ++it)
+ int argc = 0;
+ for (int it = 0; it < memCnt; ++it)
if (memberAt(it)->isArgument())
++argc;
return argc;
}
-Symbol *Function::argumentAt(unsigned index) const
+Symbol *Function::argumentAt(int index) const
{
- for (unsigned it = 0, eit = memberCount(); it < eit; ++it) {
+ for (int it = 0, eit = memberCount(); it < eit; ++it) {
if (Argument *arg = memberAt(it)->asArgument()) {
if (index == 0)
return arg;
@@ -421,20 +421,20 @@ Symbol *Function::argumentAt(unsigned index) const
}
}
- return 0;
+ return nullptr;
}
bool Function::hasArguments() const
{
- unsigned argc = argumentCount();
+ int argc = argumentCount();
return ! (argc == 0 || (argc == 1 && argumentAt(0)->type()->isVoidType()));
}
-unsigned Function::minimumArgumentCount() const
+int Function::minimumArgumentCount() const
{
- unsigned index = 0;
+ int index = 0;
- for (unsigned ei = argumentCount(); index < ei; ++index) {
+ for (int ei = argumentCount(); index < ei; ++index) {
if (Argument *arg = argumentAt(index)->asArgument()) {
if (arg->hasInitializer())
break;
@@ -501,16 +501,16 @@ void Function::setAmbiguous(bool isAmbiguous)
void Function::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
}
-bool Function::maybeValidPrototype(unsigned actualArgumentCount) const
+bool Function::maybeValidPrototype(int actualArgumentCount) const
{
- const unsigned argc = argumentCount();
- unsigned minNumberArguments = 0;
+ const int argc = argumentCount();
+ int minNumberArguments = 0;
for (; minNumberArguments < argc; ++minNumberArguments) {
Argument *arg = argumentAt(minNumberArguments)->asArgument();
@@ -535,8 +535,8 @@ bool Function::maybeValidPrototype(unsigned actualArgumentCount) const
}
-Block::Block(TranslationUnit *translationUnit, unsigned sourceLocation)
- : Scope(translationUnit, sourceLocation, /*name = */ 0)
+Block::Block(TranslationUnit *translationUnit, int sourceLocation)
+ : Scope(translationUnit, sourceLocation, /*name = */ nullptr)
{ }
Block::Block(Clone *clone, Subst *subst, Block *original)
@@ -552,13 +552,13 @@ FullySpecifiedType Block::type() const
void Block::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
}
-Enum::Enum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Enum::Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name)
, _isScoped(false)
{ }
@@ -598,13 +598,13 @@ bool Enum::match0(const Type *otherType, Matcher *matcher) const
void Enum::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
}
-Template::Template(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Template::Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name)
{ }
@@ -615,21 +615,21 @@ Template::Template(Clone *clone, Subst *subst, Template *original)
Template::~Template()
{ }
-unsigned Template::templateParameterCount() const
+int Template::templateParameterCount() const
{
- if (declaration() != 0)
+ if (declaration() != nullptr)
return memberCount() - 1;
return 0;
}
-Symbol *Template::templateParameterAt(unsigned index) const
+Symbol *Template::templateParameterAt(int index) const
{ return memberAt(index); }
Symbol *Template::declaration() const
{
if (isEmpty())
- return 0;
+ return nullptr;
if (Symbol *s = memberAt(memberCount() - 1)) {
if (s->isClass() || s->isForwardClassDeclaration() ||
@@ -637,7 +637,7 @@ Symbol *Template::declaration() const
return s;
}
- return 0;
+ return nullptr;
}
FullySpecifiedType Template::type() const
@@ -646,7 +646,7 @@ FullySpecifiedType Template::type() const
void Template::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
@@ -662,7 +662,7 @@ bool Template::match0(const Type *otherType, Matcher *matcher) const
return false;
}
-Namespace::Namespace(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Namespace::Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name)
, _isInline(false)
{ }
@@ -689,7 +689,7 @@ bool Namespace::match0(const Type *otherType, Matcher *matcher) const
void Namespace::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
@@ -698,7 +698,7 @@ void Namespace::visitSymbol0(SymbolVisitor *visitor)
FullySpecifiedType Namespace::type() const
{ return FullySpecifiedType(const_cast<Namespace *>(this)); }
-BaseClass::BaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+BaseClass::BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name),
_isVirtual(false)
{ }
@@ -734,7 +734,7 @@ void BaseClass::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
ForwardClassDeclaration::ForwardClassDeclaration(TranslationUnit *translationUnit,
- unsigned sourceLocation, const Name *name)
+ int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -762,7 +762,7 @@ bool ForwardClassDeclaration::match0(const Type *otherType, Matcher *matcher) co
return false;
}
-Class::Class(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+Class::Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name),
_key(ClassKey)
{ }
@@ -804,10 +804,10 @@ bool Class::match0(const Type *otherType, Matcher *matcher) const
return false;
}
-unsigned Class::baseClassCount() const
-{ return unsigned(_baseClasses.size()); }
+int Class::baseClassCount() const
+{ return int(_baseClasses.size()); }
-BaseClass *Class::baseClassAt(unsigned index) const
+BaseClass *Class::baseClassAt(int index) const
{ return _baseClasses.at(index); }
void Class::addBaseClass(BaseClass *baseClass)
@@ -819,17 +819,17 @@ FullySpecifiedType Class::type() const
void Class::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < _baseClasses.size(); ++i) {
+ for (int i = 0; i < int(_baseClasses.size()); ++i) {
visitSymbol(_baseClasses.at(i), visitor);
}
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
}
-QtPropertyDeclaration::QtPropertyDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+QtPropertyDeclaration::QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
, _flags(NoFlags)
{ }
@@ -859,7 +859,7 @@ void QtPropertyDeclaration::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-QtEnum::QtEnum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+QtEnum::QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -877,7 +877,7 @@ void QtEnum::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-ObjCBaseClass::ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+ObjCBaseClass::ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -894,7 +894,7 @@ FullySpecifiedType ObjCBaseClass::type() const
void ObjCBaseClass::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-ObjCBaseProtocol::ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+ObjCBaseProtocol::ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Symbol(translationUnit, sourceLocation, name)
{ }
@@ -911,17 +911,17 @@ FullySpecifiedType ObjCBaseProtocol::type() const
void ObjCBaseProtocol::visitSymbol0(SymbolVisitor *visitor)
{ visitor->visit(this); }
-ObjCClass::ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name):
+ObjCClass::ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name):
Scope(translationUnit, sourceLocation, name),
- _categoryName(0),
- _baseClass(0),
+ _categoryName(nullptr),
+ _baseClass(nullptr),
_isInterface(false)
{ }
ObjCClass::ObjCClass(Clone *clone, Subst *subst, ObjCClass *original)
: Scope(clone, subst, original)
, _categoryName(clone->name(original->_categoryName, subst))
- , _baseClass(0)
+ , _baseClass(nullptr)
, _isInterface(original->_isInterface)
{
if (original->_baseClass)
@@ -940,7 +940,7 @@ void ObjCClass::setInterface(bool isInterface)
{ _isInterface = isInterface; }
bool ObjCClass::isCategory() const
-{ return _categoryName != 0; }
+{ return _categoryName != nullptr; }
const Name *ObjCClass::categoryName() const
{ return _categoryName; }
@@ -954,10 +954,10 @@ ObjCBaseClass *ObjCClass::baseClass() const
void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
{ _baseClass = baseClass; }
-unsigned ObjCClass::protocolCount() const
-{ return unsigned(_protocols.size()); }
+int ObjCClass::protocolCount() const
+{ return int(_protocols.size()); }
-ObjCBaseProtocol *ObjCClass::protocolAt(unsigned index) const
+ObjCBaseProtocol *ObjCClass::protocolAt(int index) const
{ return _protocols.at(index); }
void ObjCClass::addProtocol(ObjCBaseProtocol *protocol)
@@ -972,10 +972,10 @@ void ObjCClass::visitSymbol0(SymbolVisitor *visitor)
if (_baseClass)
visitSymbol(_baseClass, visitor);
- for (unsigned i = 0; i < _protocols.size(); ++i)
+ for (int i = 0; i < int(_protocols.size()); ++i)
visitSymbol(_protocols.at(i), visitor);
- for (unsigned i = 0; i < memberCount(); ++i)
+ for (int i = 0; i < memberCount(); ++i)
visitSymbol(memberAt(i), visitor);
}
}
@@ -991,7 +991,7 @@ bool ObjCClass::match0(const Type *otherType, Matcher *matcher) const
return false;
}
-ObjCProtocol::ObjCProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name):
+ObjCProtocol::ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name):
Scope(translationUnit, sourceLocation, name)
{
}
@@ -1006,10 +1006,10 @@ ObjCProtocol::ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original)
ObjCProtocol::~ObjCProtocol()
{}
-unsigned ObjCProtocol::protocolCount() const
-{ return unsigned(_protocols.size()); }
+int ObjCProtocol::protocolCount() const
+{ return int(_protocols.size()); }
-ObjCBaseProtocol *ObjCProtocol::protocolAt(unsigned index) const
+ObjCBaseProtocol *ObjCProtocol::protocolAt(int index) const
{ return _protocols.at(index); }
void ObjCProtocol::addProtocol(ObjCBaseProtocol *protocol)
@@ -1021,7 +1021,7 @@ FullySpecifiedType ObjCProtocol::type() const
void ObjCProtocol::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < _protocols.size(); ++i)
+ for (int i = 0; i < int(_protocols.size()); ++i)
visitSymbol(_protocols.at(i), visitor);
}
}
@@ -1037,7 +1037,7 @@ bool ObjCProtocol::match0(const Type *otherType, Matcher *matcher) const
return false;
}
-ObjCForwardClassDeclaration::ObjCForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation,
+ObjCForwardClassDeclaration::ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation,
const Name *name):
Symbol(translationUnit, sourceLocation, name)
{
@@ -1067,7 +1067,7 @@ bool ObjCForwardClassDeclaration::match0(const Type *otherType, Matcher *matcher
return false;
}
-ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation,
+ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation,
const Name *name):
Symbol(translationUnit, sourceLocation, name)
{
@@ -1097,7 +1097,7 @@ bool ObjCForwardProtocolDeclaration::match0(const Type *otherType, Matcher *matc
return false;
}
-ObjCMethod::ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
+ObjCMethod::ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name),
_flags(0)
{ }
@@ -1137,15 +1137,15 @@ bool ObjCMethod::hasReturnType() const
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
}
-unsigned ObjCMethod::argumentCount() const
+int ObjCMethod::argumentCount() const
{
- const unsigned c = memberCount();
+ const int c = memberCount();
if (c > 0 && memberAt(c - 1)->isBlock())
return c - 1;
return c;
}
-Symbol *ObjCMethod::argumentAt(unsigned index) const
+Symbol *ObjCMethod::argumentAt(int index) const
{
return memberAt(index);
}
@@ -1165,18 +1165,18 @@ void ObjCMethod::setVariadic(bool isVariadic)
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
{
if (visitor->visit(this)) {
- for (unsigned i = 0; i < memberCount(); ++i) {
+ for (int i = 0; i < memberCount(); ++i) {
visitSymbol(memberAt(i), visitor);
}
}
}
ObjCPropertyDeclaration::ObjCPropertyDeclaration(TranslationUnit *translationUnit,
- unsigned sourceLocation,
+ int sourceLocation,
const Name *name):
Symbol(translationUnit, sourceLocation, name),
- _getterName(0),
- _setterName(0),
+ _getterName(nullptr),
+ _setterName(nullptr),
_propertyAttributes(None)
{}
diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h
index e29f78bf01..fd9417984e 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.h
+++ b/src/libs/3rdparty/cplusplus/Symbols.h
@@ -32,7 +32,7 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT UsingNamespaceDirective: public Symbol
{
public:
- UsingNamespaceDirective(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ UsingNamespaceDirective(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
UsingNamespaceDirective(Clone *clone, Subst *subst, UsingNamespaceDirective *original);
virtual ~UsingNamespaceDirective();
@@ -52,7 +52,7 @@ protected:
class CPLUSPLUS_EXPORT UsingDeclaration: public Symbol
{
public:
- UsingDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ UsingDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration *original);
virtual ~UsingDeclaration();
@@ -72,7 +72,7 @@ protected:
class CPLUSPLUS_EXPORT NamespaceAlias: public Symbol
{
public:
- NamespaceAlias(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ NamespaceAlias(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original);
virtual ~NamespaceAlias();
@@ -98,7 +98,7 @@ private:
class CPLUSPLUS_EXPORT Declaration: public Symbol
{
public:
- Declaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Declaration(Clone *clone, Subst *subst, Declaration *original);
virtual ~Declaration();
@@ -116,10 +116,10 @@ public:
{ return this; }
virtual EnumeratorDeclaration *asEnumeratorDeclarator()
- { return 0; }
+ { return nullptr; }
virtual const EnumeratorDeclaration *asEnumeratorDeclarator() const
- { return 0; }
+ { return nullptr; }
protected:
virtual void visitSymbol0(SymbolVisitor *visitor);
@@ -132,7 +132,7 @@ private:
class CPLUSPLUS_EXPORT EnumeratorDeclaration: public Declaration
{
public:
- EnumeratorDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
virtual ~EnumeratorDeclaration();
const StringLiteral *constantValue() const;
@@ -151,7 +151,7 @@ private:
class CPLUSPLUS_EXPORT Argument: public Symbol
{
public:
- Argument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Argument(Clone *clone, Subst *subst, Argument *original);
virtual ~Argument();
@@ -182,7 +182,7 @@ private:
class CPLUSPLUS_EXPORT TypenameArgument: public Symbol
{
public:
- TypenameArgument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original);
virtual ~TypenameArgument();
@@ -210,7 +210,7 @@ private:
class CPLUSPLUS_EXPORT Block: public Scope
{
public:
- Block(TranslationUnit *translationUnit, unsigned sourceLocation);
+ Block(TranslationUnit *translationUnit, int sourceLocation);
Block(Clone *clone, Subst *subst, Block *original);
virtual ~Block();
@@ -230,7 +230,7 @@ protected:
class CPLUSPLUS_EXPORT ForwardClassDeclaration: public Symbol, public Type
{
public:
- ForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
virtual ~ForwardClassDeclaration();
@@ -259,7 +259,7 @@ protected:
class CPLUSPLUS_EXPORT Enum: public Scope, public Type
{
public:
- Enum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Enum(Clone *clone, Subst *subst, Enum *original);
virtual ~Enum();
@@ -308,7 +308,7 @@ public:
};
public:
- Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Function(Clone *clone, Subst *subst, Function *original);
virtual ~Function();
@@ -325,12 +325,12 @@ public:
/** Convenience function that returns whether the function returns something (including void). */
bool hasReturnType() const;
- unsigned argumentCount() const;
- Symbol *argumentAt(unsigned index) const;
+ int argumentCount() const;
+ Symbol *argumentAt(int index) const;
/** Convenience function that returns whether the function receives any arguments. */
bool hasArguments() const;
- unsigned minimumArgumentCount() const;
+ int minimumArgumentCount() const;
bool isVirtual() const;
void setVirtual(bool isVirtual);
@@ -356,12 +356,12 @@ public:
RefQualifier refQualifier() const;
void setRefQualifier(RefQualifier refQualifier);
- bool isSignatureEqualTo(const Function *other, Matcher *matcher = 0) const;
+ bool isSignatureEqualTo(const Function *other, Matcher *matcher = nullptr) const;
bool isAmbiguous() const; // internal
void setAmbiguous(bool isAmbiguous); // internal
- bool maybeValidPrototype(unsigned actualArgumentCount) const;
+ bool maybeValidPrototype(int actualArgumentCount) const;
// Symbol's interface
virtual FullySpecifiedType type() const;
@@ -407,12 +407,12 @@ private:
class CPLUSPLUS_EXPORT Template: public Scope, public Type
{
public:
- Template(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Template(Clone *clone, Subst *subst, Template *original);
virtual ~Template();
- unsigned templateParameterCount() const;
- Symbol *templateParameterAt(unsigned index) const;
+ int templateParameterCount() const;
+ Symbol *templateParameterAt(int index) const;
Symbol *declaration() const;
// Symbol's interface
@@ -441,7 +441,7 @@ protected:
class CPLUSPLUS_EXPORT Namespace: public Scope, public Type
{
public:
- Namespace(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Namespace(Clone *clone, Subst *subst, Namespace *original);
virtual ~Namespace();
@@ -479,7 +479,7 @@ private:
class CPLUSPLUS_EXPORT BaseClass: public Symbol
{
public:
- BaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
BaseClass(Clone *clone, Subst *subst, BaseClass *original);
virtual ~BaseClass();
@@ -511,7 +511,7 @@ private:
class CPLUSPLUS_EXPORT Class: public Scope, public Type
{
public:
- Class(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
Class(Clone *clone, Subst *subst, Class *original);
virtual ~Class();
@@ -527,8 +527,8 @@ public:
Key classKey() const;
void setClassKey(Key key);
- unsigned baseClassCount() const;
- BaseClass *baseClassAt(unsigned index) const;
+ int baseClassCount() const;
+ BaseClass *baseClassAt(int index) const;
void addBaseClass(BaseClass *baseClass);
// Symbol's interface
@@ -580,7 +580,7 @@ public:
};
public:
- QtPropertyDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
QtPropertyDeclaration(Clone *clone, Subst *subst, QtPropertyDeclaration *original);
virtual ~QtPropertyDeclaration();
@@ -609,7 +609,7 @@ private:
class CPLUSPLUS_EXPORT QtEnum: public Symbol
{
public:
- QtEnum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
QtEnum(Clone *clone, Subst *subst, QtEnum *original);
virtual ~QtEnum();
@@ -629,7 +629,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCBaseClass: public Symbol
{
public:
- ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original);
virtual ~ObjCBaseClass();
@@ -649,7 +649,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCBaseProtocol: public Symbol
{
public:
- ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol *original);
virtual ~ObjCBaseProtocol();
@@ -669,7 +669,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration: public Symbol, public Type
{
public:
- ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
virtual ~ObjCForwardProtocolDeclaration();
@@ -698,12 +698,12 @@ protected:
class CPLUSPLUS_EXPORT ObjCProtocol: public Scope, public Type
{
public:
- ObjCProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original);
virtual ~ObjCProtocol();
- unsigned protocolCount() const;
- ObjCBaseProtocol *protocolAt(unsigned index) const;
+ int protocolCount() const;
+ ObjCBaseProtocol *protocolAt(int index) const;
void addProtocol(ObjCBaseProtocol *protocol);
// Symbol's interface
@@ -734,7 +734,7 @@ private:
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration: public Symbol, public Type
{
public:
- ObjCForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
virtual ~ObjCForwardClassDeclaration();
@@ -763,7 +763,7 @@ protected:
class CPLUSPLUS_EXPORT ObjCClass: public Scope, public Type
{
public:
- ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCClass(Clone *clone, Subst *subst, ObjCClass *original);
virtual ~ObjCClass();
@@ -777,8 +777,8 @@ public:
ObjCBaseClass *baseClass() const;
void setBaseClass(ObjCBaseClass *baseClass);
- unsigned protocolCount() const;
- ObjCBaseProtocol *protocolAt(unsigned index) const;
+ int protocolCount() const;
+ ObjCBaseProtocol *protocolAt(int index) const;
void addProtocol(ObjCBaseProtocol *protocol);
// Symbol's interface
@@ -812,7 +812,7 @@ private:
class CPLUSPLUS_EXPORT ObjCMethod: public Scope, public Type
{
public:
- ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
+ ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original);
virtual ~ObjCMethod();
@@ -822,8 +822,8 @@ public:
/** Convenience function that returns whether the function returns something (including void). */
bool hasReturnType() const;
- unsigned argumentCount() const;
- Symbol *argumentAt(unsigned index) const;
+ int argumentCount() const;
+ Symbol *argumentAt(int index) const;
/** Convenience function that returns whether the function receives any arguments. */
bool hasArguments() const;
@@ -883,7 +883,7 @@ public:
public:
ObjCPropertyDeclaration(TranslationUnit *translationUnit,
- unsigned sourceLocation,
+ int sourceLocation,
const Name *name);
ObjCPropertyDeclaration(Clone *clone, Subst *subst, ObjCPropertyDeclaration *original);
virtual ~ObjCPropertyDeclaration();
diff --git a/src/libs/3rdparty/cplusplus/Templates.cpp b/src/libs/3rdparty/cplusplus/Templates.cpp
index 61c6e612ae..75ee4e95fa 100644
--- a/src/libs/3rdparty/cplusplus/Templates.cpp
+++ b/src/libs/3rdparty/cplusplus/Templates.cpp
@@ -34,7 +34,7 @@ using namespace CPlusPlus;
CloneType::CloneType(Clone *clone)
: _clone(clone)
, _control(clone->control())
- , _subst(0)
+ , _subst(nullptr)
{
}
@@ -102,7 +102,7 @@ void CloneType::visit(NamedType *type)
const Name *name = _clone->name(type->name(), _subst);
FullySpecifiedType ty;
if (_subst)
- ty = _clone->type(_subst->apply(name), 0);
+ ty = _clone->type(_subst->apply(name), nullptr);
if (! ty.isValid())
ty = _control->namedType(name);
_type.setType(ty.type());
@@ -177,15 +177,15 @@ void CloneType::visit(ObjCForwardProtocolDeclaration *type)
CloneSymbol::CloneSymbol(Clone *clone)
: _clone(clone)
, _control(clone->control())
- , _subst(0)
- , _symbol(0)
+ , _subst(nullptr)
+ , _symbol(nullptr)
{
}
Symbol *CloneSymbol::cloneSymbol(Symbol *symbol, Subst *subst)
{
if (! symbol)
- return 0;
+ return nullptr;
SymbolSubstPair symbolSubstPair = std::make_pair(symbol, subst);
auto it = _cache.find(symbolSubstPair);
@@ -194,14 +194,14 @@ Symbol *CloneSymbol::cloneSymbol(Symbol *symbol, Subst *subst)
return it->second;
}
- Symbol *r = 0;
+ Symbol *r = nullptr;
std::swap(_subst, subst);
std::swap(_symbol, r);
accept(symbol);
std::swap(_symbol, r);
std::swap(_subst, subst);
- CPP_CHECK(r != 0);
+ CPP_CHECK(r != nullptr);
_cache[symbolSubstPair] = r;
return r;
}
@@ -401,28 +401,28 @@ bool CloneSymbol::visit(ObjCPropertyDeclaration *symbol)
CloneName::CloneName(Clone *clone)
: _clone(clone)
, _control(clone->control())
- , _subst(0)
- , _name(0)
+ , _subst(nullptr)
+ , _name(nullptr)
{
}
const Name *CloneName::cloneName(const Name *name, Subst *subst)
{
if (! name)
- return 0;
+ return nullptr;
NameSubstPair nameSubstPair = std::make_pair(name, subst);
auto it = _cache.find(nameSubstPair);
if (it != _cache.end())
return it->second;
- const Name *r = 0;
+ const Name *r = nullptr;
std::swap(_subst, subst);
std::swap(_name, r);
accept(name);
std::swap(_name, r);
std::swap(_subst, subst);
- CPP_CHECK(r != 0);
+ CPP_CHECK(r != nullptr);
_cache[nameSubstPair] = r;
return r;
}
@@ -440,13 +440,13 @@ void CloneName::visit(const AnonymousNameId *name)
void CloneName::visit(const TemplateNameId *name)
{
std::vector<FullySpecifiedType> args(name->templateArgumentCount());
- for (unsigned i = 0; i < args.size(); ++i)
+ for (int i = 0; i < int(args.size()); ++i)
args[i] = _clone->type(name->templateArgumentAt(i), _subst);
if (args.empty())
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization());
else
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization(),
- &args[0], unsigned(args.size()));
+ &args[0], int(args.size()));
}
void CloneName::visit(const DestructorNameId *name)
@@ -474,9 +474,9 @@ void CloneName::visit(const SelectorNameId *name)
{
CPP_CHECK(name->nameCount() > 0);
std::vector<const Name *> names(name->nameCount());
- for (unsigned i = 0; i < names.size(); ++i)
+ for (int i = 0; i < int(names.size()); ++i)
names[i] = _clone->name(name->nameAt(i), _subst);
- _name = _control->selectorNameId(&names[0], unsigned(names.size()), name->hasArguments());
+ _name = _control->selectorNameId(&names[0], int(names.size()), name->hasArguments());
}
@@ -490,17 +490,17 @@ Clone::Clone(Control *control)
const StringLiteral *Clone::stringLiteral(const StringLiteral *literal)
{
- return literal ? _control->stringLiteral(literal->chars(), literal->size()) : 0;
+ return literal ? _control->stringLiteral(literal->chars(), literal->size()) : nullptr;
}
const NumericLiteral *Clone::numericLiteral(const NumericLiteral *literal)
{
- return literal ? _control->numericLiteral(literal->chars(), literal->size()) : 0;
+ return literal ? _control->numericLiteral(literal->chars(), literal->size()) : nullptr;
}
const Identifier *Clone::identifier(const Identifier *id)
{
- return id ? _control->identifier(id->chars(), id->size()) : 0;
+ return id ? _control->identifier(id->chars(), id->size()) : nullptr;
}
FullySpecifiedType Clone::type(const FullySpecifiedType &type, Subst *subst)
@@ -518,16 +518,16 @@ Symbol *Clone::symbol(Symbol *symbol, Subst *subst)
return _symbol(symbol, subst);
}
-Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args, unsigned argc, Subst *s)
+Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args, int argc, Subst *s)
{
Subst subst(_control, s);
- for (unsigned i = 0, e = std::min(templ->templateParameterCount(), argc); i < e; ++i) {
+ for (int i = 0, e = std::min(templ->templateParameterCount(), argc); i < e; ++i) {
Symbol *formal = templ->templateParameterAt(i);
FullySpecifiedType actual = args[i];
- subst.bind(name(formal->name(), 0), actual);
+ subst.bind(name(formal->name(), nullptr), actual);
}
if (argc < templ->templateParameterCount()) {
- for (unsigned i = argc; i < templ->templateParameterCount(); ++i) {
+ for (int i = argc; i < templ->templateParameterCount(); ++i) {
Symbol *formal = templ->templateParameterAt(i);
if (TypenameArgument *tn = formal->asTypenameArgument())
subst.bind(name(formal->name(), &subst), type(tn->type(), &subst));
@@ -537,7 +537,7 @@ Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args
inst->setEnclosingScope(templ->enclosingScope());
return inst;
}
- return 0;
+ return nullptr;
}
//
@@ -564,7 +564,7 @@ FullySpecifiedType Subst::apply(const Name *name) const
return control()->namedType(control()->qualifiedNameId(qualifiedBase,
qualifiedName));
}
- else if(baseNamedType->name()->identifier() != 0) {
+ else if(baseNamedType->name()->identifier() != nullptr) {
const QualifiedNameId *clonedQualifiedNameId
= control()->qualifiedNameId(baseNamedType->name()->identifier(),
unqualified->name());
diff --git a/src/libs/3rdparty/cplusplus/Templates.h b/src/libs/3rdparty/cplusplus/Templates.h
index 67b57a6296..b1da4ef4d0 100644
--- a/src/libs/3rdparty/cplusplus/Templates.h
+++ b/src/libs/3rdparty/cplusplus/Templates.h
@@ -40,7 +40,7 @@ class CPLUSPLUS_EXPORT Subst
Subst &operator = (const Subst &other);
public:
- Subst(Control *control, Subst *previous = 0)
+ Subst(Control *control, Subst *previous = nullptr)
: _control(control)
, _previous(previous)
{ }
@@ -196,8 +196,8 @@ public:
Symbol *symbol(Symbol *symbol, Subst *subst);
Symbol *instantiate(Template *templ,
- const FullySpecifiedType *const args, unsigned argc,
- Subst *subst = 0);
+ const FullySpecifiedType *const args, int argc,
+ Subst *subst = nullptr);
private:
CloneType _type;
diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp
index ecc7a8487b..0159b1ed7d 100644
--- a/src/libs/3rdparty/cplusplus/Token.cpp
+++ b/src/libs/3rdparty/cplusplus/Token.cpp
@@ -247,7 +247,7 @@ void Token::reset()
flags = 0;
byteOffset = 0;
utf16charOffset = 0;
- ptr = 0;
+ ptr = nullptr;
}
const char *Token::name(int kind)
diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h
index 67378b28a3..0f0f76d3cf 100644
--- a/src/libs/3rdparty/cplusplus/Token.h
+++ b/src/libs/3rdparty/cplusplus/Token.h
@@ -298,7 +298,7 @@ enum Kind {
class CPLUSPLUS_EXPORT Token
{
public:
- Token() : flags(0), byteOffset(0), utf16charOffset(0), ptr(0) {}
+ Token() : flags(0), byteOffset(0), utf16charOffset(0), ptr(nullptr) {}
inline bool is(unsigned k) const { return f.kind == k; }
inline bool isNot(unsigned k) const { return f.kind != k; }
@@ -313,13 +313,13 @@ public:
inline bool generated() const { return f.generated; }
inline bool userDefinedLiteral() const { return f.userDefinedLiteral; }
- inline unsigned bytes() const { return f.bytes; }
- inline unsigned bytesBegin() const { return byteOffset; }
- inline unsigned bytesEnd() const { return byteOffset + f.bytes; }
+ inline int bytes() const { return f.bytes; }
+ inline int bytesBegin() const { return byteOffset; }
+ inline int bytesEnd() const { return byteOffset + f.bytes; }
- inline unsigned utf16chars() const { return f.utf16chars; }
- inline unsigned utf16charsBegin() const { return utf16charOffset; }
- inline unsigned utf16charsEnd() const { return utf16charOffset + f.utf16chars; }
+ inline int utf16chars() const { return f.utf16chars; }
+ inline int utf16charsBegin() const { return utf16charOffset; }
+ inline int utf16charsEnd() const { return utf16charOffset + f.utf16chars; }
inline bool isLiteral() const
{ return f.kind >= T_FIRST_LITERAL && f.kind <= T_LAST_LITERAL; }
@@ -405,7 +405,7 @@ public:
const StringLiteral *string;
const Identifier *identifier;
unsigned close_brace;
- unsigned lineno;
+ int lineno;
};
};
@@ -437,6 +437,7 @@ struct LanguageFeatures
unsigned int qtKeywordsEnabled : 1; // If Qt is used but QT_NO_KEYWORDS defined
unsigned int cxxEnabled : 1;
unsigned int cxx11Enabled : 1;
+ unsigned int cxx14Enabled : 1;
unsigned int objCEnabled : 1;
unsigned int c99Enabled : 1;
};
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
index 2da8ad563e..d5f299750e 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
@@ -43,10 +43,10 @@ const Token TranslationUnit::nullToken;
TranslationUnit::TranslationUnit(Control *control, const StringLiteral *fileId)
: _control(control),
_fileId(fileId),
- _firstSourceChar(0),
- _lastSourceChar(0),
- _pool(0),
- _ast(0),
+ _firstSourceChar(nullptr),
+ _lastSourceChar(nullptr),
+ _pool(nullptr),
+ _ast(nullptr),
_flags(0)
{
_tokens = new std::vector<Token>();
@@ -70,7 +70,7 @@ const StringLiteral *TranslationUnit::fileId() const
const char *TranslationUnit::fileName() const
{ return _fileId->chars(); }
-unsigned TranslationUnit::fileNameLength() const
+int TranslationUnit::fileNameLength() const
{ return _fileId->size(); }
const char *TranslationUnit::firstSourceChar() const
@@ -79,42 +79,42 @@ const char *TranslationUnit::firstSourceChar() const
const char *TranslationUnit::lastSourceChar() const
{ return _lastSourceChar; }
-unsigned TranslationUnit::sourceLength() const
+int TranslationUnit::sourceLength() const
{ return _lastSourceChar - _firstSourceChar; }
-void TranslationUnit::setSource(const char *source, unsigned size)
+void TranslationUnit::setSource(const char *source, int size)
{
_firstSourceChar = source;
_lastSourceChar = source + size;
}
-const char *TranslationUnit::spell(unsigned index) const
+const char *TranslationUnit::spell(int index) const
{
if (! index)
- return 0;
+ return nullptr;
return tokenAt(index).spell();
}
-unsigned TranslationUnit::commentCount() const
-{ return unsigned(_comments->size()); }
+int TranslationUnit::commentCount() const
+{ return int(_comments->size()); }
-const Token &TranslationUnit::commentAt(unsigned index) const
+const Token &TranslationUnit::commentAt(int index) const
{ return _comments->at(index); }
-const Identifier *TranslationUnit::identifier(unsigned index) const
+const Identifier *TranslationUnit::identifier(int index) const
{ return tokenAt(index).identifier; }
-const Literal *TranslationUnit::literal(unsigned index) const
+const Literal *TranslationUnit::literal(int index) const
{ return tokenAt(index).literal; }
-const StringLiteral *TranslationUnit::stringLiteral(unsigned index) const
+const StringLiteral *TranslationUnit::stringLiteral(int index) const
{ return tokenAt(index).string; }
-const NumericLiteral *TranslationUnit::numericLiteral(unsigned index) const
+const NumericLiteral *TranslationUnit::numericLiteral(int index) const
{ return tokenAt(index).number; }
-unsigned TranslationUnit::matchingBrace(unsigned index) const
+int TranslationUnit::matchingBrace(int index) const
{ return tokenAt(index).close_brace; }
MemoryPool *TranslationUnit::memoryPool() const
@@ -140,7 +140,7 @@ void TranslationUnit::tokenize()
lex.setLanguageFeatures(_languageFeatures);
lex.setScanCommentTokens(true);
- std::stack<unsigned> braces;
+ std::stack<int> braces;
_tokens->push_back(nullToken); // the first token needs to be invalid!
pushLineOffset(0);
@@ -153,8 +153,8 @@ void TranslationUnit::tokenize()
// We need to track information about the expanded tokens. A vector with an addition
// explicit index control is used instead of queue mainly for performance reasons.
- std::vector<std::pair<unsigned, unsigned> > lineColumn;
- unsigned lineColumnIdx = 0;
+ std::vector<std::pair<int, int> > lineColumn;
+ int lineColumnIdx = 0;
Token tk;
do {
@@ -162,7 +162,7 @@ void TranslationUnit::tokenize()
recognize:
if (tk.is(T_POUND) && tk.newline()) {
- const unsigned utf16CharOffset = tk.utf16charOffset;
+ const int utf16CharOffset = tk.utf16charOffset;
lex(&tk);
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == expansionId) {
@@ -175,10 +175,10 @@ recognize:
lex(&tk);
// Gather where the expansion happens and its length.
- //unsigned macroOffset = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
+ //int macroOffset = static_cast<int>(strtoul(tk.spell(), 0, 0));
lex(&tk);
lex(&tk); // Skip the separating comma
- //unsigned macroLength = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
+ //int macroLength = static_cast<int>(strtoul(tk.spell(), 0, 0));
lex(&tk);
// NOTE: We are currently not using the macro offset and length. They
@@ -198,7 +198,7 @@ recognize:
// Get the total number of generated tokens and specify "null"
// information for them.
unsigned totalGenerated =
- static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
+ static_cast<int>(strtoul(tk.spell(), nullptr, 0));
const std::size_t previousSize = lineColumn.size();
lineColumn.resize(previousSize + totalGenerated);
std::fill(lineColumn.begin() + previousSize,
@@ -207,10 +207,10 @@ recognize:
lex(&tk);
} else if (tk.is(T_NUMERIC_LITERAL)) {
- unsigned line = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
+ int line = static_cast<int>(strtoul(tk.spell(), nullptr, 0));
lex(&tk);
lex(&tk); // Skip the separating colon
- unsigned column = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
+ int column = static_cast<int>(strtoul(tk.spell(), nullptr, 0));
// Store line and column for this non-generated token.
lineColumn.push_back(std::make_pair(line, column));
@@ -230,7 +230,7 @@ recognize:
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == lineId)
lex(&tk);
if (! tk.newline() && tk.is(T_NUMERIC_LITERAL)) {
- unsigned line = (unsigned) strtoul(tk.spell(), 0, 0);
+ int line = static_cast<int>(strtol(tk.spell(), nullptr, 0));
lex(&tk);
if (! tk.newline() && tk.is(T_STRING_LITERAL)) {
const StringLiteral *fileName =
@@ -244,12 +244,12 @@ recognize:
}
goto recognize;
} else if (tk.kind() == T_LBRACE) {
- braces.push(unsigned(_tokens->size()));
+ braces.push(int(_tokens->size()));
} else if (tk.kind() == T_RBRACE && ! braces.empty()) {
- const unsigned open_brace_index = braces.top();
+ const int open_brace_index = braces.top();
braces.pop();
if (open_brace_index < tokenCount())
- (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
+ (*_tokens)[open_brace_index].close_brace = int(_tokens->size());
} else if (tk.isComment()) {
_comments->push_back(tk);
continue; // comments are not in the regular token stream
@@ -258,9 +258,9 @@ recognize:
bool currentExpanded = false;
bool currentGenerated = false;
- if (!lineColumn.empty() && lineColumnIdx < lineColumn.size()) {
+ if (!lineColumn.empty() && lineColumnIdx < static_cast<int>(lineColumn.size())) {
currentExpanded = true;
- const std::pair<unsigned, unsigned> &p = lineColumn[lineColumnIdx];
+ const std::pair<int, int> &p = lineColumn[lineColumnIdx];
if (p.first)
_expandedLineColumn.insert(std::make_pair(tk.utf16charsBegin(), p));
else
@@ -276,8 +276,8 @@ recognize:
} while (tk.kind());
for (; ! braces.empty(); braces.pop()) {
- unsigned open_brace_index = braces.top();
- (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
+ int open_brace_index = braces.top();
+ (*_tokens)[open_brace_index].close_brace = int(_tokens->size());
}
}
@@ -302,31 +302,31 @@ bool TranslationUnit::parse(ParseMode mode)
switch (mode) {
case ParseTranlationUnit: {
- TranslationUnitAST *node = 0;
+ TranslationUnitAST *node = nullptr;
parsed = parser.parseTranslationUnit(node);
_ast = node;
} break;
case ParseDeclaration: {
- DeclarationAST *node = 0;
+ DeclarationAST *node = nullptr;
parsed = parser.parseDeclaration(node);
_ast = node;
} break;
case ParseExpression: {
- ExpressionAST *node = 0;
+ ExpressionAST *node = nullptr;
parsed = parser.parseExpression(node);
_ast = node;
} break;
case ParseDeclarator: {
- DeclaratorAST *node = 0;
- parsed = parser.parseDeclarator(node, /*decl_specifier_list =*/ 0);
+ DeclaratorAST *node = nullptr;
+ parsed = parser.parseDeclarator(node, /*decl_specifier_list =*/ nullptr);
_ast = node;
} break;
case ParseStatement: {
- StatementAST *node = 0;
+ StatementAST *node = nullptr;
parsed = parser.parseStatement(node);
_ast = node;
} break;
@@ -338,17 +338,17 @@ bool TranslationUnit::parse(ParseMode mode)
return parsed;
}
-void TranslationUnit::pushLineOffset(unsigned offset)
+void TranslationUnit::pushLineOffset(int offset)
{ _lineOffsets.push_back(offset); }
-void TranslationUnit::pushPreprocessorLine(unsigned utf16charOffset,
- unsigned line,
+void TranslationUnit::pushPreprocessorLine(int utf16charOffset,
+ int line,
const StringLiteral *fileName)
{ _ppLines.push_back(PPLine(utf16charOffset, line, fileName)); }
-unsigned TranslationUnit::findLineNumber(unsigned utf16charOffset) const
+int TranslationUnit::findLineNumber(int utf16charOffset) const
{
- std::vector<unsigned>::const_iterator it =
+ std::vector<int>::const_iterator it =
std::lower_bound(_lineOffsets.begin(), _lineOffsets.end(), utf16charOffset);
if (it != _lineOffsets.begin())
@@ -357,7 +357,7 @@ unsigned TranslationUnit::findLineNumber(unsigned utf16charOffset) const
return it - _lineOffsets.begin();
}
-TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(unsigned utf16charOffset) const
+TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(int utf16charOffset) const
{
std::vector<PPLine>::const_iterator it =
std::lower_bound(_ppLines.begin(), _ppLines.end(), PPLine(utf16charOffset));
@@ -368,7 +368,7 @@ TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(unsigned utf16char
return *it;
}
-unsigned TranslationUnit::findColumnNumber(unsigned utf16CharOffset, unsigned lineNumber) const
+int TranslationUnit::findColumnNumber(int utf16CharOffset, int lineNumber) const
{
if (! utf16CharOffset)
return 0;
@@ -376,30 +376,30 @@ unsigned TranslationUnit::findColumnNumber(unsigned utf16CharOffset, unsigned li
return utf16CharOffset - _lineOffsets[lineNumber];
}
-void TranslationUnit::getTokenPosition(unsigned index,
- unsigned *line,
- unsigned *column,
+void TranslationUnit::getTokenPosition(int index,
+ int *line,
+ int *column,
const StringLiteral **fileName) const
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
-void TranslationUnit::getTokenStartPosition(unsigned index, unsigned *line,
- unsigned *column,
+void TranslationUnit::getTokenStartPosition(int index, int *line,
+ int *column,
const StringLiteral **fileName) const
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
-void TranslationUnit::getTokenEndPosition(unsigned index, unsigned *line,
- unsigned *column,
+void TranslationUnit::getTokenEndPosition(int index, int *line,
+ int *column,
const StringLiteral **fileName) const
{ return getPosition(tokenAt(index).utf16charsEnd(), line, column, fileName); }
-void TranslationUnit::getPosition(unsigned utf16charOffset,
- unsigned *line,
- unsigned *column,
+void TranslationUnit::getPosition(int utf16charOffset,
+ int *line,
+ int *column,
const StringLiteral **fileName) const
{
- unsigned lineNumber = 0;
- unsigned columnNumber = 0;
- const StringLiteral *file = 0;
+ int lineNumber = 0;
+ int columnNumber = 0;
+ const StringLiteral *file = nullptr;
// If this token is expanded we already have the information directly from the expansion
// section header. Otherwise, we need to calculate it.
@@ -433,22 +433,22 @@ void TranslationUnit::getPosition(unsigned utf16charOffset,
*fileName = file;
}
-void TranslationUnit::message(DiagnosticClient::Level level, unsigned index, const char *format, va_list args)
+void TranslationUnit::message(DiagnosticClient::Level level, int index, const char *format, va_list args)
{
if (f._blockErrors)
return;
index = std::min(index, tokenCount() - 1);
- unsigned line = 0, column = 0;
- const StringLiteral *fileName = 0;
+ int line = 0, column = 0;
+ const StringLiteral *fileName = nullptr;
getTokenPosition(index, &line, &column, &fileName);
if (DiagnosticClient *client = control()->diagnosticClient())
client->report(level, fileName, line, column, format, args);
}
-void TranslationUnit::warning(unsigned index, const char *format, ...)
+void TranslationUnit::warning(int index, const char *format, ...)
{
if (f._blockErrors)
return;
@@ -461,7 +461,7 @@ void TranslationUnit::warning(unsigned index, const char *format, ...)
va_end(args);
}
-void TranslationUnit::error(unsigned index, const char *format, ...)
+void TranslationUnit::error(int index, const char *format, ...)
{
if (f._blockErrors)
return;
@@ -474,7 +474,7 @@ void TranslationUnit::error(unsigned index, const char *format, ...)
va_end(args);
}
-void TranslationUnit::fatal(unsigned index, const char *format, ...)
+void TranslationUnit::fatal(int index, const char *format, ...)
{
if (f._blockErrors)
return;
@@ -487,13 +487,13 @@ void TranslationUnit::fatal(unsigned index, const char *format, ...)
va_end(args);
}
-unsigned TranslationUnit::findPreviousLineOffset(unsigned tokenIndex) const
+int TranslationUnit::findPreviousLineOffset(int tokenIndex) const
{
- unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).utf16charsBegin())];
+ int lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).utf16charsBegin())];
return lineOffset;
}
-bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
+bool TranslationUnit::maybeSplitGreaterGreaterToken(int tokenIndex)
{
if (tokenIndex >= tokenCount())
return false;
@@ -529,16 +529,16 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
void TranslationUnit::releaseTokensAndComments()
{
delete _tokens;
- _tokens = 0;
+ _tokens = nullptr;
delete _comments;
- _comments = 0;
+ _comments = nullptr;
}
void TranslationUnit::resetAST()
{
delete _pool;
- _pool = 0;
- _ast = 0;
+ _pool = nullptr;
+ _ast = nullptr;
}
void TranslationUnit::release()
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h
index 7def1a65a3..7422885a7e 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.h
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h
@@ -43,29 +43,29 @@ public:
const StringLiteral *fileId() const;
const char *fileName() const;
- unsigned fileNameLength() const;
+ int fileNameLength() const;
const char *firstSourceChar() const;
const char *lastSourceChar() const;
- unsigned sourceLength() const;
+ int sourceLength() const;
- void setSource(const char *source, unsigned size);
+ void setSource(const char *source, int size);
- unsigned tokenCount() const { return _tokens ? unsigned(_tokens->size()) : unsigned(0); }
- const Token &tokenAt(unsigned index) const
+ int tokenCount() const { return _tokens ? int(_tokens->size()) : 0; }
+ const Token &tokenAt(int index) const
{ return _tokens && index < tokenCount() ? (*_tokens)[index] : nullToken; }
- Kind tokenKind(unsigned index) const { return tokenAt(index).kind(); }
- const char *spell(unsigned index) const;
+ Kind tokenKind(int index) const { return tokenAt(index).kind(); }
+ const char *spell(int index) const;
- unsigned commentCount() const;
- const Token &commentAt(unsigned index) const;
+ int commentCount() const;
+ const Token &commentAt(int index) const;
- unsigned matchingBrace(unsigned index) const;
- const Identifier *identifier(unsigned index) const;
- const Literal *literal(unsigned index) const;
- const StringLiteral *stringLiteral(unsigned index) const;
- const NumericLiteral *numericLiteral(unsigned index) const;
+ int matchingBrace(int index) const;
+ const Identifier *identifier(int index) const;
+ const Literal *literal(int index) const;
+ const StringLiteral *stringLiteral(int index) const;
+ const NumericLiteral *numericLiteral(int index) const;
MemoryPool *memoryPool() const;
AST *ast() const;
@@ -78,11 +78,11 @@ public:
return previous;
}
- void warning(unsigned index, const char *fmt, ...);
- void error(unsigned index, const char *fmt, ...);
- void fatal(unsigned index, const char *fmt, ...);
+ void warning(int index, const char *fmt, ...);
+ void error(int index, const char *fmt, ...);
+ void fatal(int index, const char *fmt, ...);
- void message(DiagnosticClient::Level level, unsigned index,
+ void message(DiagnosticClient::Level level, int index,
const char *format, va_list ap);
bool isTokenized() const;
@@ -106,45 +106,45 @@ public:
void resetAST();
void release();
- void getTokenStartPosition(unsigned index, unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getTokenStartPosition(int index, int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void getTokenEndPosition(unsigned index, unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getTokenEndPosition(int index, int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void getPosition(unsigned utf16charOffset,
- unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getPosition(int utf16charOffset,
+ int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void getTokenPosition(unsigned index,
- unsigned *line,
- unsigned *column = 0,
- const StringLiteral **fileName = 0) const;
+ void getTokenPosition(int index,
+ int *line,
+ int *column = nullptr,
+ const StringLiteral **fileName = nullptr) const;
- void pushLineOffset(unsigned offset);
- void pushPreprocessorLine(unsigned utf16charOffset,
- unsigned line,
+ void pushLineOffset(int offset);
+ void pushPreprocessorLine(int utf16charOffset,
+ int line,
const StringLiteral *fileName);
- unsigned findPreviousLineOffset(unsigned tokenIndex) const;
+ int findPreviousLineOffset(int tokenIndex) const;
- bool maybeSplitGreaterGreaterToken(unsigned tokenIndex);
+ bool maybeSplitGreaterGreaterToken(int tokenIndex);
LanguageFeatures languageFeatures() const { return _languageFeatures; }
void setLanguageFeatures(LanguageFeatures features) { _languageFeatures = features; }
private:
struct PPLine {
- unsigned utf16charOffset;
- unsigned line;
+ int utf16charOffset;
+ int line;
const StringLiteral *fileName;
- PPLine(unsigned utf16charOffset = 0,
- unsigned line = 0,
- const StringLiteral *fileName = 0)
+ PPLine(int utf16charOffset = 0,
+ int line = 0,
+ const StringLiteral *fileName = nullptr)
: utf16charOffset(utf16charOffset), line(line), fileName(fileName)
{ }
@@ -159,9 +159,9 @@ private:
};
void releaseTokensAndComments();
- unsigned findLineNumber(unsigned utf16charOffset) const;
- unsigned findColumnNumber(unsigned utf16CharOffset, unsigned lineNumber) const;
- PPLine findPreprocessorLine(unsigned utf16charOffset) const;
+ int findLineNumber(int utf16charOffset) const;
+ int findColumnNumber(int utf16CharOffset, int lineNumber) const;
+ PPLine findPreprocessorLine(int utf16charOffset) const;
static const Token nullToken;
@@ -171,9 +171,9 @@ private:
const char *_lastSourceChar;
std::vector<Token> *_tokens;
std::vector<Token> *_comments;
- std::vector<unsigned> _lineOffsets;
+ std::vector<int> _lineOffsets;
std::vector<PPLine> _ppLines;
- typedef std::unordered_map<unsigned, std::pair<unsigned, unsigned> > TokenLineColumn;
+ typedef std::unordered_map<unsigned, std::pair<int, int> > TokenLineColumn;
TokenLineColumn _expandedLineColumn;
MemoryPool *_pool;
AST *_ast;
diff --git a/src/libs/3rdparty/cplusplus/Type.cpp b/src/libs/3rdparty/cplusplus/Type.cpp
index bad4d42eeb..e9b0f2d3c1 100644
--- a/src/libs/3rdparty/cplusplus/Type.cpp
+++ b/src/libs/3rdparty/cplusplus/Type.cpp
@@ -36,61 +36,61 @@ bool Type::isUndefinedType() const
{ return this == UndefinedType::instance(); }
bool Type::isVoidType() const
-{ return asVoidType() != 0; }
+{ return asVoidType() != nullptr; }
bool Type::isIntegerType() const
-{ return asIntegerType() != 0; }
+{ return asIntegerType() != nullptr; }
bool Type::isFloatType() const
-{ return asFloatType() != 0; }
+{ return asFloatType() != nullptr; }
bool Type::isPointerType() const
-{ return asPointerType() != 0; }
+{ return asPointerType() != nullptr; }
bool Type::isPointerToMemberType() const
-{ return asPointerToMemberType() != 0; }
+{ return asPointerToMemberType() != nullptr; }
bool Type::isReferenceType() const
-{ return asReferenceType() != 0; }
+{ return asReferenceType() != nullptr; }
bool Type::isArrayType() const
-{ return asArrayType() != 0; }
+{ return asArrayType() != nullptr; }
bool Type::isNamedType() const
-{ return asNamedType() != 0; }
+{ return asNamedType() != nullptr; }
bool Type::isFunctionType() const
-{ return asFunctionType() != 0; }
+{ return asFunctionType() != nullptr; }
bool Type::isNamespaceType() const
-{ return asNamespaceType() != 0; }
+{ return asNamespaceType() != nullptr; }
bool Type::isTemplateType() const
-{ return asTemplateType() != 0; }
+{ return asTemplateType() != nullptr; }
bool Type::isClassType() const
-{ return asClassType() != 0; }
+{ return asClassType() != nullptr; }
bool Type::isEnumType() const
-{ return asEnumType() != 0; }
+{ return asEnumType() != nullptr; }
bool Type::isForwardClassDeclarationType() const
-{ return asForwardClassDeclarationType() != 0; }
+{ return asForwardClassDeclarationType() != nullptr; }
bool Type::isObjCClassType() const
-{ return asObjCClassType() != 0; }
+{ return asObjCClassType() != nullptr; }
bool Type::isObjCProtocolType() const
-{ return asObjCProtocolType() != 0; }
+{ return asObjCProtocolType() != nullptr; }
bool Type::isObjCMethodType() const
-{ return asObjCMethodType() != 0; }
+{ return asObjCMethodType() != nullptr; }
bool Type::isObjCForwardClassDeclarationType() const
-{ return asObjCForwardClassDeclarationType() != 0; }
+{ return asObjCForwardClassDeclarationType() != nullptr; }
bool Type::isObjCForwardProtocolDeclarationType() const
-{ return asObjCForwardProtocolDeclarationType() != 0; }
+{ return asObjCForwardProtocolDeclarationType() != nullptr; }
void Type::accept(TypeVisitor *visitor)
{
diff --git a/src/libs/3rdparty/cplusplus/Type.h b/src/libs/3rdparty/cplusplus/Type.h
index 25f260c2cd..72116daf37 100644
--- a/src/libs/3rdparty/cplusplus/Type.h
+++ b/src/libs/3rdparty/cplusplus/Type.h
@@ -51,52 +51,52 @@ public:
bool isObjCForwardClassDeclarationType() const;
bool isObjCForwardProtocolDeclarationType() const;
- virtual const UndefinedType *asUndefinedType() const { return 0; }
- virtual const VoidType *asVoidType() const { return 0; }
- virtual const IntegerType *asIntegerType() const { return 0; }
- virtual const FloatType *asFloatType() const { return 0; }
- virtual const PointerType *asPointerType() const { return 0; }
- virtual const PointerToMemberType *asPointerToMemberType() const { return 0; }
- virtual const ReferenceType *asReferenceType() const { return 0; }
- virtual const ArrayType *asArrayType() const { return 0; }
- virtual const NamedType *asNamedType() const { return 0; }
- virtual const Function *asFunctionType() const { return 0; }
- virtual const Namespace *asNamespaceType() const { return 0; }
- virtual const Template *asTemplateType() const { return 0; }
- virtual const Class *asClassType() const { return 0; }
- virtual const Enum *asEnumType() const { return 0; }
- virtual const ForwardClassDeclaration *asForwardClassDeclarationType() const { return 0; }
- virtual const ObjCClass *asObjCClassType() const { return 0; }
- virtual const ObjCProtocol *asObjCProtocolType() const { return 0; }
- virtual const ObjCMethod *asObjCMethodType() const { return 0; }
- virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const { return 0; }
- virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const { return 0; }
+ virtual const UndefinedType *asUndefinedType() const { return nullptr; }
+ virtual const VoidType *asVoidType() const { return nullptr; }
+ virtual const IntegerType *asIntegerType() const { return nullptr; }
+ virtual const FloatType *asFloatType() const { return nullptr; }
+ virtual const PointerType *asPointerType() const { return nullptr; }
+ virtual const PointerToMemberType *asPointerToMemberType() const { return nullptr; }
+ virtual const ReferenceType *asReferenceType() const { return nullptr; }
+ virtual const ArrayType *asArrayType() const { return nullptr; }
+ virtual const NamedType *asNamedType() const { return nullptr; }
+ virtual const Function *asFunctionType() const { return nullptr; }
+ virtual const Namespace *asNamespaceType() const { return nullptr; }
+ virtual const Template *asTemplateType() const { return nullptr; }
+ virtual const Class *asClassType() const { return nullptr; }
+ virtual const Enum *asEnumType() const { return nullptr; }
+ virtual const ForwardClassDeclaration *asForwardClassDeclarationType() const { return nullptr; }
+ virtual const ObjCClass *asObjCClassType() const { return nullptr; }
+ virtual const ObjCProtocol *asObjCProtocolType() const { return nullptr; }
+ virtual const ObjCMethod *asObjCMethodType() const { return nullptr; }
+ virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const { return nullptr; }
+ virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const { return nullptr; }
- virtual UndefinedType *asUndefinedType() { return 0; }
- virtual VoidType *asVoidType() { return 0; }
- virtual IntegerType *asIntegerType() { return 0; }
- virtual FloatType *asFloatType() { return 0; }
- virtual PointerType *asPointerType() { return 0; }
- virtual PointerToMemberType *asPointerToMemberType() { return 0; }
- virtual ReferenceType *asReferenceType() { return 0; }
- virtual ArrayType *asArrayType() { return 0; }
- virtual NamedType *asNamedType() { return 0; }
- virtual Function *asFunctionType() { return 0; }
- virtual Namespace *asNamespaceType() { return 0; }
- virtual Template *asTemplateType() { return 0; }
- virtual Class *asClassType() { return 0; }
- virtual Enum *asEnumType() { return 0; }
- virtual ForwardClassDeclaration *asForwardClassDeclarationType() { return 0; }
- virtual ObjCClass *asObjCClassType() { return 0; }
- virtual ObjCProtocol *asObjCProtocolType() { return 0; }
- virtual ObjCMethod *asObjCMethodType() { return 0; }
- virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() { return 0; }
- virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() { return 0; }
+ virtual UndefinedType *asUndefinedType() { return nullptr; }
+ virtual VoidType *asVoidType() { return nullptr; }
+ virtual IntegerType *asIntegerType() { return nullptr; }
+ virtual FloatType *asFloatType() { return nullptr; }
+ virtual PointerType *asPointerType() { return nullptr; }
+ virtual PointerToMemberType *asPointerToMemberType() { return nullptr; }
+ virtual ReferenceType *asReferenceType() { return nullptr; }
+ virtual ArrayType *asArrayType() { return nullptr; }
+ virtual NamedType *asNamedType() { return nullptr; }
+ virtual Function *asFunctionType() { return nullptr; }
+ virtual Namespace *asNamespaceType() { return nullptr; }
+ virtual Template *asTemplateType() { return nullptr; }
+ virtual Class *asClassType() { return nullptr; }
+ virtual Enum *asEnumType() { return nullptr; }
+ virtual ForwardClassDeclaration *asForwardClassDeclarationType() { return nullptr; }
+ virtual ObjCClass *asObjCClassType() { return nullptr; }
+ virtual ObjCProtocol *asObjCProtocolType() { return nullptr; }
+ virtual ObjCMethod *asObjCMethodType() { return nullptr; }
+ virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() { return nullptr; }
+ virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() { return nullptr; }
void accept(TypeVisitor *visitor);
static void accept(Type *type, TypeVisitor *visitor);
- bool match(const Type *other, Matcher *matcher = 0) const;
+ bool match(const Type *other, Matcher *matcher = nullptr) const;
protected:
virtual void accept0(TypeVisitor *visitor) = 0;
diff --git a/src/libs/3rdparty/json/json.hpp b/src/libs/3rdparty/json/json.hpp
new file mode 100644
index 0000000000..c66d8243ad
--- /dev/null
+++ b/src/libs/3rdparty/json/json.hpp
@@ -0,0 +1,20842 @@
+/*
+ __ _____ _____ _____
+ __| | __| | | | JSON for Modern C++
+| | |__ | | | | | | version 3.6.1
+|_____|_____|_____|_|___| https://github.com/nlohmann/json
+
+Licensed under the MIT License <http://opensource.org/licenses/MIT>.
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3
+#define NLOHMANN_JSON_VERSION_MINOR 6
+#define NLOHMANN_JSON_VERSION_PATCH 1
+
+#include <algorithm> // all_of, find, for_each
+#include <cassert> // assert
+#include <ciso646> // and, not, or
+#include <cstddef> // nullptr_t, ptrdiff_t, size_t
+#include <functional> // hash, less
+#include <initializer_list> // initializer_list
+#include <iosfwd> // istream, ostream
+#include <iterator> // random_access_iterator_tag
+#include <memory> // unique_ptr
+#include <numeric> // accumulate
+#include <string> // string, stoi, to_string
+#include <utility> // declval, forward, move, pair, swap
+#include <vector> // vector
+
+// #include <nlohmann/adl_serializer.hpp>
+
+
+#include <utility>
+
+// #include <nlohmann/detail/conversions/from_json.hpp>
+
+
+#include <algorithm> // transform
+#include <array> // array
+#include <ciso646> // and, not
+#include <forward_list> // forward_list
+#include <iterator> // inserter, front_inserter, end
+#include <map> // map
+#include <string> // string
+#include <tuple> // tuple, make_tuple
+#include <type_traits> // is_arithmetic, is_same, is_enum, underlying_type, is_convertible
+#include <unordered_map> // unordered_map
+#include <utility> // pair, declval
+#include <valarray> // valarray
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+
+#include <exception> // exception
+#include <stdexcept> // runtime_error
+#include <string> // to_string
+
+// #include <nlohmann/detail/input/position_t.hpp>
+
+
+#include <cstddef> // size_t
+
+namespace nlohmann
+{
+namespace detail
+{
+/// struct to capture the start position of the current token
+struct position_t
+{
+ /// the total number of characters read
+ std::size_t chars_read_total = 0;
+ /// the number of characters read in the current line
+ std::size_t chars_read_current_line = 0;
+ /// the number of lines read
+ std::size_t lines_read = 0;
+
+ /// conversion to size_t to preserve SAX interface
+ constexpr operator size_t() const
+ {
+ return chars_read_total;
+ }
+};
+
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+////////////////
+// exceptions //
+////////////////
+
+/*!
+@brief general exception of the @ref basic_json class
+
+This class is an extension of `std::exception` objects with a member @a id for
+exception ids. It is used as the base class for all exceptions thrown by the
+@ref basic_json class. This class can hence be used as "wildcard" to catch
+exceptions.
+
+Subclasses:
+- @ref parse_error for exceptions indicating a parse error
+- @ref invalid_iterator for exceptions indicating errors with iterators
+- @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+- @ref out_of_range for exceptions indicating access out of the defined range
+- @ref other_error for exceptions indicating other library errors
+
+@internal
+@note To have nothrow-copy-constructible exceptions, we internally use
+ `std::runtime_error` which can cope with arbitrary-length error messages.
+ Intermediate strings are built with static functions and then passed to
+ the actual constructor.
+@endinternal
+
+@liveexample{The following code shows how arbitrary library exceptions can be
+caught.,exception}
+
+@since version 3.0.0
+*/
+class exception : public std::exception
+{
+ public:
+ /// returns the explanatory string
+ const char* what() const noexcept override
+ {
+ return m.what();
+ }
+
+ /// the id of the exception
+ const int id;
+
+ protected:
+ exception(int id_, const char* what_arg) : id(id_), m(what_arg) {}
+
+ static std::string name(const std::string& ename, int id_)
+ {
+ return "[json.exception." + ename + "." + std::to_string(id_) + "] ";
+ }
+
+ private:
+ /// an exception object as storage for error messages
+ std::runtime_error m;
+};
+
+/*!
+@brief exception indicating a parse error
+
+This exception is thrown by the library when a parse error occurs. Parse errors
+can occur during the deserialization of JSON text, CBOR, MessagePack, as well
+as when using JSON Patch.
+
+Member @a byte holds the byte index of the last read character in the input
+file.
+
+Exceptions have ids 1xx.
+
+name / id | example message | description
+------------------------------ | --------------- | -------------------------
+json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position.
+json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point.
+json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid.
+json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects.
+json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.
+json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`.
+json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
+json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
+json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number.
+json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
+json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
+json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
+json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet).
+
+@note For an input with n bytes, 1 is the index of the first character and n+1
+ is the index of the terminating null byte or the end of file. This also
+ holds true when reading a byte vector (CBOR or MessagePack).
+
+@liveexample{The following code shows how a `parse_error` exception can be
+caught.,parse_error}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class parse_error : public exception
+{
+ public:
+ /*!
+ @brief create a parse error exception
+ @param[in] id_ the id of the exception
+ @param[in] pos the position where the error occurred (or with
+ chars_read_total=0 if the position cannot be
+ determined)
+ @param[in] what_arg the explanatory string
+ @return parse_error object
+ */
+ static parse_error create(int id_, const position_t& pos, const std::string& what_arg)
+ {
+ std::string w = exception::name("parse_error", id_) + "parse error" +
+ position_string(pos) + ": " + what_arg;
+ return parse_error(id_, pos.chars_read_total, w.c_str());
+ }
+
+ static parse_error create(int id_, std::size_t byte_, const std::string& what_arg)
+ {
+ std::string w = exception::name("parse_error", id_) + "parse error" +
+ (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
+ ": " + what_arg;
+ return parse_error(id_, byte_, w.c_str());
+ }
+
+ /*!
+ @brief byte index of the parse error
+
+ The byte index of the last read character in the input file.
+
+ @note For an input with n bytes, 1 is the index of the first character and
+ n+1 is the index of the terminating null byte or the end of file.
+ This also holds true when reading a byte vector (CBOR or MessagePack).
+ */
+ const std::size_t byte;
+
+ private:
+ parse_error(int id_, std::size_t byte_, const char* what_arg)
+ : exception(id_, what_arg), byte(byte_) {}
+
+ static std::string position_string(const position_t& pos)
+ {
+ return " at line " + std::to_string(pos.lines_read + 1) +
+ ", column " + std::to_string(pos.chars_read_current_line);
+ }
+};
+
+/*!
+@brief exception indicating errors with iterators
+
+This exception is thrown if iterators passed to a library function do not match
+the expected semantics.
+
+Exceptions have ids 2xx.
+
+name / id | example message | description
+----------------------------------- | --------------- | -------------------------
+json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
+json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
+json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from.
+json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid.
+json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid.
+json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range.
+json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key.
+json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
+json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
+json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
+json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to.
+json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container.
+json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered.
+json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin().
+
+@liveexample{The following code shows how an `invalid_iterator` exception can be
+caught.,invalid_iterator}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class invalid_iterator : public exception
+{
+ public:
+ static invalid_iterator create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("invalid_iterator", id_) + what_arg;
+ return invalid_iterator(id_, w.c_str());
+ }
+
+ private:
+ invalid_iterator(int id_, const char* what_arg)
+ : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating executing a member function with a wrong type
+
+This exception is thrown in case of a type error; that is, a library function is
+executed on a JSON value whose type does not match the expected semantics.
+
+Exceptions have ids 3xx.
+
+name / id | example message | description
+----------------------------- | --------------- | -------------------------
+json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead.
+json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types.
+json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &.
+json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types.
+json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types.
+json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types.
+json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types.
+json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types.
+json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types.
+json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types.
+json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types.
+json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types.
+json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined.
+json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers.
+json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive.
+json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. |
+json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) |
+
+@liveexample{The following code shows how a `type_error` exception can be
+caught.,type_error}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class type_error : public exception
+{
+ public:
+ static type_error create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("type_error", id_) + what_arg;
+ return type_error(id_, w.c_str());
+ }
+
+ private:
+ type_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating access out of the defined range
+
+This exception is thrown in case a library function is called on an input
+parameter that exceeds the expected range, for instance in case of array
+indices or nonexisting object keys.
+
+Exceptions have ids 4xx.
+
+name / id | example message | description
+------------------------------- | --------------- | -------------------------
+json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1.
+json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it.
+json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object.
+json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved.
+json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value.
+json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF.
+json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. |
+json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. |
+json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string |
+
+@liveexample{The following code shows how an `out_of_range` exception can be
+caught.,out_of_range}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class out_of_range : public exception
+{
+ public:
+ static out_of_range create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("out_of_range", id_) + what_arg;
+ return out_of_range(id_, w.c_str());
+ }
+
+ private:
+ out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating other library errors
+
+This exception is thrown in case of errors that cannot be classified with the
+other exception types.
+
+Exceptions have ids 5xx.
+
+name / id | example message | description
+------------------------------ | --------------- | -------------------------
+json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed.
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+
+@liveexample{The following code shows how an `other_error` exception can be
+caught.,other_error}
+
+@since version 3.0.0
+*/
+class other_error : public exception
+{
+ public:
+ static other_error create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("other_error", id_) + what_arg;
+ return other_error(id_, w.c_str());
+ }
+
+ private:
+ other_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+#include <utility> // pair
+
+// This file contains all internal macro definitions
+// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them
+
+// exclude unsupported compilers
+#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
+ #if defined(__clang__)
+ #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
+ #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
+ #endif
+ #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
+ #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
+ #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
+ #endif
+ #endif
+#endif
+
+// disable float-equal warnings on GCC/clang
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+// disable documentation warnings on clang
+#if defined(__clang__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdocumentation"
+#endif
+
+// allow for portable deprecation warnings
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #define JSON_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER)
+ #define JSON_DEPRECATED __declspec(deprecated)
+#else
+ #define JSON_DEPRECATED
+#endif
+
+// allow for portable nodiscard warnings
+#if defined(__has_cpp_attribute)
+ #if __has_cpp_attribute(nodiscard)
+ #define JSON_NODISCARD [[nodiscard]]
+ #elif __has_cpp_attribute(gnu::warn_unused_result)
+ #define JSON_NODISCARD [[gnu::warn_unused_result]]
+ #else
+ #define JSON_NODISCARD
+ #endif
+#else
+ #define JSON_NODISCARD
+#endif
+
+// allow to disable exceptions
+#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
+ #define JSON_THROW(exception) throw exception
+ #define JSON_TRY try
+ #define JSON_CATCH(exception) catch(exception)
+ #define JSON_INTERNAL_CATCH(exception) catch(exception)
+#else
+ #include <cstdlib>
+ #define JSON_THROW(exception) std::abort()
+ #define JSON_TRY if (true)
+ #define JSON_CATCH(exception) if (false)
+ #define JSON_INTERNAL_CATCH(exception) if (false)
+#endif
+
+// override exception macros
+#if defined(JSON_THROW_USER)
+ #undef JSON_THROW
+ #define JSON_THROW JSON_THROW_USER
+#endif
+#if defined(JSON_TRY_USER)
+ #undef JSON_TRY
+ #define JSON_TRY JSON_TRY_USER
+#endif
+#if defined(JSON_CATCH_USER)
+ #undef JSON_CATCH
+ #define JSON_CATCH JSON_CATCH_USER
+ #undef JSON_INTERNAL_CATCH
+ #define JSON_INTERNAL_CATCH JSON_CATCH_USER
+#endif
+#if defined(JSON_INTERNAL_CATCH_USER)
+ #undef JSON_INTERNAL_CATCH
+ #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER
+#endif
+
+// manual branch prediction
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #define JSON_LIKELY(x) __builtin_expect(x, 1)
+ #define JSON_UNLIKELY(x) __builtin_expect(x, 0)
+#else
+ #define JSON_LIKELY(x) x
+ #define JSON_UNLIKELY(x) x
+#endif
+
+// C++ language standard detection
+#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
+ #define JSON_HAS_CPP_17
+ #define JSON_HAS_CPP_14
+#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
+ #define JSON_HAS_CPP_14
+#endif
+
+/*!
+@brief macro to briefly define a mapping between an enum and JSON
+@def NLOHMANN_JSON_SERIALIZE_ENUM
+@since version 3.4.0
+*/
+#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \
+ template<typename BasicJsonType> \
+ inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
+ { \
+ static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
+ static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
+ auto it = std::find_if(std::begin(m), std::end(m), \
+ [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
+ { \
+ return ej_pair.first == e; \
+ }); \
+ j = ((it != std::end(m)) ? it : std::begin(m))->second; \
+ } \
+ template<typename BasicJsonType> \
+ inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
+ { \
+ static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
+ static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
+ auto it = std::find_if(std::begin(m), std::end(m), \
+ [j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
+ { \
+ return ej_pair.second == j; \
+ }); \
+ e = ((it != std::end(m)) ? it : std::begin(m))->first; \
+ }
+
+// Ugly macros to avoid uglier copy-paste when specializing basic_json. They
+// may be removed in the future once the class is split.
+
+#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
+ template<template<typename, typename, typename...> class ObjectType, \
+ template<typename, typename...> class ArrayType, \
+ class StringType, class BooleanType, class NumberIntegerType, \
+ class NumberUnsignedType, class NumberFloatType, \
+ template<typename> class AllocatorType, \
+ template<typename, typename = void> class JSONSerializer>
+
+#define NLOHMANN_BASIC_JSON_TPL \
+ basic_json<ObjectType, ArrayType, StringType, BooleanType, \
+ NumberIntegerType, NumberUnsignedType, NumberFloatType, \
+ AllocatorType, JSONSerializer>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+
+#include <ciso646> // not
+#include <cstddef> // size_t
+#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
+
+namespace nlohmann
+{
+namespace detail
+{
+// alias templates to reduce boilerplate
+template<bool B, typename T = void>
+using enable_if_t = typename std::enable_if<B, T>::type;
+
+template<typename T>
+using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+
+// implementation of C++14 index_sequence and affiliates
+// source: https://stackoverflow.com/a/32223343
+template<std::size_t... Ints>
+struct index_sequence
+{
+ using type = index_sequence;
+ using value_type = std::size_t;
+ static constexpr std::size_t size() noexcept
+ {
+ return sizeof...(Ints);
+ }
+};
+
+template<class Sequence1, class Sequence2>
+struct merge_and_renumber;
+
+template<std::size_t... I1, std::size_t... I2>
+struct merge_and_renumber<index_sequence<I1...>, index_sequence<I2...>>
+ : index_sequence < I1..., (sizeof...(I1) + I2)... > {};
+
+template<std::size_t N>
+struct make_index_sequence
+ : merge_and_renumber < typename make_index_sequence < N / 2 >::type,
+ typename make_index_sequence < N - N / 2 >::type > {};
+
+template<> struct make_index_sequence<0> : index_sequence<> {};
+template<> struct make_index_sequence<1> : index_sequence<0> {};
+
+template<typename... Ts>
+using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
+
+// dispatch utility (taken from ranges-v3)
+template<unsigned N> struct priority_tag : priority_tag < N - 1 > {};
+template<> struct priority_tag<0> {};
+
+// taken from ranges-v3
+template<typename T>
+struct static_const
+{
+ static constexpr T value{};
+};
+
+template<typename T>
+constexpr T static_const<T>::value;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+#include <ciso646> // not
+#include <limits> // numeric_limits
+#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
+#include <utility> // declval
+
+// #include <nlohmann/detail/iterators/iterator_traits.hpp>
+
+
+#include <iterator> // random_access_iterator_tag
+
+// #include <nlohmann/detail/meta/void_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename ...Ts> struct make_void
+{
+ using type = void;
+};
+template <typename ...Ts> using void_t = typename make_void<Ts...>::type;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename It, typename = void>
+struct iterator_types {};
+
+template <typename It>
+struct iterator_types <
+ It,
+ void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
+ typename It::reference, typename It::iterator_category >>
+{
+ using difference_type = typename It::difference_type;
+ using value_type = typename It::value_type;
+ using pointer = typename It::pointer;
+ using reference = typename It::reference;
+ using iterator_category = typename It::iterator_category;
+};
+
+// This is required as some compilers implement std::iterator_traits in a way that
+// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.
+template <typename T, typename = void>
+struct iterator_traits
+{
+};
+
+template <typename T>
+struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
+ : iterator_types<T>
+{
+};
+
+template <typename T>
+struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
+{
+ using iterator_category = std::random_access_iterator_tag;
+ using value_type = T;
+ using difference_type = ptrdiff_t;
+ using pointer = T*;
+ using reference = T&;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/detected.hpp>
+
+
+#include <type_traits>
+
+// #include <nlohmann/detail/meta/void_t.hpp>
+
+
+// http://en.cppreference.com/w/cpp/experimental/is_detected
+namespace nlohmann
+{
+namespace detail
+{
+struct nonesuch
+{
+ nonesuch() = delete;
+ ~nonesuch() = delete;
+ nonesuch(nonesuch const&) = delete;
+ nonesuch(nonesuch const&&) = delete;
+ void operator=(nonesuch const&) = delete;
+ void operator=(nonesuch&&) = delete;
+};
+
+template <class Default,
+ class AlwaysVoid,
+ template <class...> class Op,
+ class... Args>
+struct detector
+{
+ using value_t = std::false_type;
+ using type = Default;
+};
+
+template <class Default, template <class...> class Op, class... Args>
+struct detector<Default, void_t<Op<Args...>>, Op, Args...>
+{
+ using value_t = std::true_type;
+ using type = Op<Args...>;
+};
+
+template <template <class...> class Op, class... Args>
+using is_detected = typename detector<nonesuch, void, Op, Args...>::value_t;
+
+template <template <class...> class Op, class... Args>
+using detected_t = typename detector<nonesuch, void, Op, Args...>::type;
+
+template <class Default, template <class...> class Op, class... Args>
+using detected_or = detector<Default, void, Op, Args...>;
+
+template <class Default, template <class...> class Op, class... Args>
+using detected_or_t = typename detected_or<Default, Op, Args...>::type;
+
+template <class Expected, template <class...> class Op, class... Args>
+using is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>;
+
+template <class To, template <class...> class Op, class... Args>
+using is_detected_convertible =
+ std::is_convertible<detected_t<Op, Args...>, To>;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/json_fwd.hpp>
+#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
+#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
+
+#include <cstdint> // int64_t, uint64_t
+#include <map> // map
+#include <memory> // allocator
+#include <string> // string
+#include <vector> // vector
+
+/*!
+@brief namespace for Niels Lohmann
+@see https://github.com/nlohmann
+@since version 1.0.0
+*/
+namespace nlohmann
+{
+/*!
+@brief default JSONSerializer template argument
+
+This serializer ignores the template arguments and uses ADL
+([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
+for serialization.
+*/
+template<typename T = void, typename SFINAE = void>
+struct adl_serializer;
+
+template<template<typename U, typename V, typename... Args> class ObjectType =
+ std::map,
+ template<typename U, typename... Args> class ArrayType = std::vector,
+ class StringType = std::string, class BooleanType = bool,
+ class NumberIntegerType = std::int64_t,
+ class NumberUnsignedType = std::uint64_t,
+ class NumberFloatType = double,
+ template<typename U> class AllocatorType = std::allocator,
+ template<typename T, typename SFINAE = void> class JSONSerializer =
+ adl_serializer>
+class basic_json;
+
+/*!
+@brief JSON Pointer
+
+A JSON pointer defines a string syntax for identifying a specific value
+within a JSON document. It can be used with functions `at` and
+`operator[]`. Furthermore, JSON pointers are the base for JSON patches.
+
+@sa [RFC 6901](https://tools.ietf.org/html/rfc6901)
+
+@since version 2.0.0
+*/
+template<typename BasicJsonType>
+class json_pointer;
+
+/*!
+@brief default JSON class
+
+This type is the default specialization of the @ref basic_json class which
+uses the standard template types.
+
+@since version 1.0.0
+*/
+using json = basic_json<>;
+} // namespace nlohmann
+
+#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
+
+
+namespace nlohmann
+{
+/*!
+@brief detail namespace with internal helper functions
+
+This namespace collects functions that should not be exposed,
+implementations of some @ref basic_json methods, and meta-programming helpers.
+
+@since version 2.1.0
+*/
+namespace detail
+{
+/////////////
+// helpers //
+/////////////
+
+// Note to maintainers:
+//
+// Every trait in this file expects a non CV-qualified type.
+// The only exceptions are in the 'aliases for detected' section
+// (i.e. those of the form: decltype(T::member_function(std::declval<T>())))
+//
+// In this case, T has to be properly CV-qualified to constraint the function arguments
+// (e.g. to_json(BasicJsonType&, const T&))
+
+template<typename> struct is_basic_json : std::false_type {};
+
+NLOHMANN_BASIC_JSON_TPL_DECLARATION
+struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {};
+
+//////////////////////////
+// aliases for detected //
+//////////////////////////
+
+template <typename T>
+using mapped_type_t = typename T::mapped_type;
+
+template <typename T>
+using key_type_t = typename T::key_type;
+
+template <typename T>
+using value_type_t = typename T::value_type;
+
+template <typename T>
+using difference_type_t = typename T::difference_type;
+
+template <typename T>
+using pointer_t = typename T::pointer;
+
+template <typename T>
+using reference_t = typename T::reference;
+
+template <typename T>
+using iterator_category_t = typename T::iterator_category;
+
+template <typename T>
+using iterator_t = typename T::iterator;
+
+template <typename T, typename... Args>
+using to_json_function = decltype(T::to_json(std::declval<Args>()...));
+
+template <typename T, typename... Args>
+using from_json_function = decltype(T::from_json(std::declval<Args>()...));
+
+template <typename T, typename U>
+using get_template_function = decltype(std::declval<T>().template get<U>());
+
+// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
+template <typename BasicJsonType, typename T, typename = void>
+struct has_from_json : std::false_type {};
+
+template <typename BasicJsonType, typename T>
+struct has_from_json<BasicJsonType, T,
+ enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<void, from_json_function, serializer,
+ const BasicJsonType&, T&>::value;
+};
+
+// This trait checks if JSONSerializer<T>::from_json(json const&) exists
+// this overload is used for non-default-constructible user-defined-types
+template <typename BasicJsonType, typename T, typename = void>
+struct has_non_default_from_json : std::false_type {};
+
+template<typename BasicJsonType, typename T>
+struct has_non_default_from_json<BasicJsonType, T, enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<T, from_json_function, serializer,
+ const BasicJsonType&>::value;
+};
+
+// This trait checks if BasicJsonType::json_serializer<T>::to_json exists
+// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion.
+template <typename BasicJsonType, typename T, typename = void>
+struct has_to_json : std::false_type {};
+
+template <typename BasicJsonType, typename T>
+struct has_to_json<BasicJsonType, T, enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<void, to_json_function, serializer, BasicJsonType&,
+ T>::value;
+};
+
+
+///////////////////
+// is_ functions //
+///////////////////
+
+template <typename T, typename = void>
+struct is_iterator_traits : std::false_type {};
+
+template <typename T>
+struct is_iterator_traits<iterator_traits<T>>
+{
+ private:
+ using traits = iterator_traits<T>;
+
+ public:
+ static constexpr auto value =
+ is_detected<value_type_t, traits>::value &&
+ is_detected<difference_type_t, traits>::value &&
+ is_detected<pointer_t, traits>::value &&
+ is_detected<iterator_category_t, traits>::value &&
+ is_detected<reference_t, traits>::value;
+};
+
+// source: https://stackoverflow.com/a/37193089/4116453
+
+template <typename T, typename = void>
+struct is_complete_type : std::false_type {};
+
+template <typename T>
+struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {};
+
+template <typename BasicJsonType, typename CompatibleObjectType,
+ typename = void>
+struct is_compatible_object_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleObjectType>
+struct is_compatible_object_type_impl <
+ BasicJsonType, CompatibleObjectType,
+ enable_if_t<is_detected<mapped_type_t, CompatibleObjectType>::value and
+ is_detected<key_type_t, CompatibleObjectType>::value >>
+{
+
+ using object_t = typename BasicJsonType::object_t;
+
+ // macOS's is_constructible does not play well with nonesuch...
+ static constexpr bool value =
+ std::is_constructible<typename object_t::key_type,
+ typename CompatibleObjectType::key_type>::value and
+ std::is_constructible<typename object_t::mapped_type,
+ typename CompatibleObjectType::mapped_type>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleObjectType>
+struct is_compatible_object_type
+ : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};
+
+template <typename BasicJsonType, typename ConstructibleObjectType,
+ typename = void>
+struct is_constructible_object_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleObjectType>
+struct is_constructible_object_type_impl <
+ BasicJsonType, ConstructibleObjectType,
+ enable_if_t<is_detected<mapped_type_t, ConstructibleObjectType>::value and
+ is_detected<key_type_t, ConstructibleObjectType>::value >>
+{
+ using object_t = typename BasicJsonType::object_t;
+
+ static constexpr bool value =
+ (std::is_constructible<typename ConstructibleObjectType::key_type, typename object_t::key_type>::value and
+ std::is_same<typename object_t::mapped_type, typename ConstructibleObjectType::mapped_type>::value) or
+ (has_from_json<BasicJsonType, typename ConstructibleObjectType::mapped_type>::value or
+ has_non_default_from_json<BasicJsonType, typename ConstructibleObjectType::mapped_type >::value);
+};
+
+template <typename BasicJsonType, typename ConstructibleObjectType>
+struct is_constructible_object_type
+ : is_constructible_object_type_impl<BasicJsonType,
+ ConstructibleObjectType> {};
+
+template <typename BasicJsonType, typename CompatibleStringType,
+ typename = void>
+struct is_compatible_string_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleStringType>
+struct is_compatible_string_type_impl <
+ BasicJsonType, CompatibleStringType,
+ enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
+ value_type_t, CompatibleStringType>::value >>
+{
+ static constexpr auto value =
+ std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;
+};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_compatible_string_type
+ : is_compatible_string_type_impl<BasicJsonType, ConstructibleStringType> {};
+
+template <typename BasicJsonType, typename ConstructibleStringType,
+ typename = void>
+struct is_constructible_string_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_constructible_string_type_impl <
+ BasicJsonType, ConstructibleStringType,
+ enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
+ value_type_t, ConstructibleStringType>::value >>
+{
+ static constexpr auto value =
+ std::is_constructible<ConstructibleStringType,
+ typename BasicJsonType::string_t>::value;
+};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_constructible_string_type
+ : is_constructible_string_type_impl<BasicJsonType, ConstructibleStringType> {};
+
+template <typename BasicJsonType, typename CompatibleArrayType, typename = void>
+struct is_compatible_array_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleArrayType>
+struct is_compatible_array_type_impl <
+ BasicJsonType, CompatibleArrayType,
+ enable_if_t<is_detected<value_type_t, CompatibleArrayType>::value and
+ is_detected<iterator_t, CompatibleArrayType>::value and
+// This is needed because json_reverse_iterator has a ::iterator type...
+// Therefore it is detected as a CompatibleArrayType.
+// The real fix would be to have an Iterable concept.
+ not is_iterator_traits<
+ iterator_traits<CompatibleArrayType>>::value >>
+{
+ static constexpr bool value =
+ std::is_constructible<BasicJsonType,
+ typename CompatibleArrayType::value_type>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleArrayType>
+struct is_compatible_array_type
+ : is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType, typename = void>
+struct is_constructible_array_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type_impl <
+ BasicJsonType, ConstructibleArrayType,
+ enable_if_t<std::is_same<ConstructibleArrayType,
+ typename BasicJsonType::value_type>::value >>
+ : std::true_type {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type_impl <
+ BasicJsonType, ConstructibleArrayType,
+ enable_if_t<not std::is_same<ConstructibleArrayType,
+ typename BasicJsonType::value_type>::value and
+ is_detected<value_type_t, ConstructibleArrayType>::value and
+ is_detected<iterator_t, ConstructibleArrayType>::value and
+ is_complete_type<
+ detected_t<value_type_t, ConstructibleArrayType>>::value >>
+{
+ static constexpr bool value =
+ // This is needed because json_reverse_iterator has a ::iterator type,
+ // furthermore, std::back_insert_iterator (and other iterators) have a base class `iterator`...
+ // Therefore it is detected as a ConstructibleArrayType.
+ // The real fix would be to have an Iterable concept.
+ not is_iterator_traits <
+ iterator_traits<ConstructibleArrayType >>::value and
+
+ (std::is_same<typename ConstructibleArrayType::value_type, typename BasicJsonType::array_t::value_type>::value or
+ has_from_json<BasicJsonType,
+ typename ConstructibleArrayType::value_type>::value or
+ has_non_default_from_json <
+ BasicJsonType, typename ConstructibleArrayType::value_type >::value);
+};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type
+ : is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType,
+ typename = void>
+struct is_compatible_integer_type_impl : std::false_type {};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType>
+struct is_compatible_integer_type_impl <
+ RealIntegerType, CompatibleNumberIntegerType,
+ enable_if_t<std::is_integral<RealIntegerType>::value and
+ std::is_integral<CompatibleNumberIntegerType>::value and
+ not std::is_same<bool, CompatibleNumberIntegerType>::value >>
+{
+ // is there an assert somewhere on overflows?
+ using RealLimits = std::numeric_limits<RealIntegerType>;
+ using CompatibleLimits = std::numeric_limits<CompatibleNumberIntegerType>;
+
+ static constexpr auto value =
+ std::is_constructible<RealIntegerType,
+ CompatibleNumberIntegerType>::value and
+ CompatibleLimits::is_integer and
+ RealLimits::is_signed == CompatibleLimits::is_signed;
+};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType>
+struct is_compatible_integer_type
+ : is_compatible_integer_type_impl<RealIntegerType,
+ CompatibleNumberIntegerType> {};
+
+template <typename BasicJsonType, typename CompatibleType, typename = void>
+struct is_compatible_type_impl: std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleType>
+struct is_compatible_type_impl <
+ BasicJsonType, CompatibleType,
+ enable_if_t<is_complete_type<CompatibleType>::value >>
+{
+ static constexpr bool value =
+ has_to_json<BasicJsonType, CompatibleType>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleType>
+struct is_compatible_type
+ : is_compatible_type_impl<BasicJsonType, CompatibleType> {};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+#include <array> // array
+#include <ciso646> // and
+#include <cstddef> // size_t
+#include <cstdint> // uint8_t
+#include <string> // string
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////////////
+// JSON type enumeration //
+///////////////////////////
+
+/*!
+@brief the JSON type enumeration
+
+This enumeration collects the different JSON types. It is internally used to
+distinguish the stored values, and the functions @ref basic_json::is_null(),
+@ref basic_json::is_object(), @ref basic_json::is_array(),
+@ref basic_json::is_string(), @ref basic_json::is_boolean(),
+@ref basic_json::is_number() (with @ref basic_json::is_number_integer(),
+@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()),
+@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and
+@ref basic_json::is_structured() rely on it.
+
+@note There are three enumeration entries (number_integer, number_unsigned, and
+number_float), because the library distinguishes these three types for numbers:
+@ref basic_json::number_unsigned_t is used for unsigned integers,
+@ref basic_json::number_integer_t is used for signed integers, and
+@ref basic_json::number_float_t is used for floating-point numbers or to
+approximate integers which do not fit in the limits of their respective type.
+
+@sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON
+value with the default value for a given type
+
+@since version 1.0.0
+*/
+enum class value_t : std::uint8_t
+{
+ null, ///< null value
+ object, ///< object (unordered set of name/value pairs)
+ array, ///< array (ordered collection of values)
+ string, ///< string value
+ boolean, ///< boolean value
+ number_integer, ///< number value (signed integer)
+ number_unsigned, ///< number value (unsigned integer)
+ number_float, ///< number value (floating-point)
+ discarded ///< discarded by the the parser callback function
+};
+
+/*!
+@brief comparison operator for JSON types
+
+Returns an ordering that is similar to Python:
+- order: null < boolean < number < object < array < string
+- furthermore, each type is not smaller than itself
+- discarded values are not comparable
+
+@since version 1.0.0
+*/
+inline bool operator<(const value_t lhs, const value_t rhs) noexcept
+{
+ static constexpr std::array<std::uint8_t, 8> order = {{
+ 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
+ 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */
+ }
+ };
+
+ const auto l_index = static_cast<std::size_t>(lhs);
+ const auto r_index = static_cast<std::size_t>(rhs);
+ return l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index];
+}
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
+{
+ if (JSON_UNLIKELY(not j.is_null()))
+ {
+ JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name())));
+ }
+ n = nullptr;
+}
+
+// overloads for basic_json template parameters
+template<typename BasicJsonType, typename ArithmeticType,
+ enable_if_t<std::is_arithmetic<ArithmeticType>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
+ int> = 0>
+void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
+{
+ switch (static_cast<value_t>(j))
+ {
+ case value_t::number_unsigned:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
+ break;
+ }
+ case value_t::number_integer:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
+ break;
+ }
+ case value_t::number_float:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name())));
+ }
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
+{
+ if (JSON_UNLIKELY(not j.is_boolean()))
+ {
+ JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name())));
+ }
+ b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
+{
+ if (JSON_UNLIKELY(not j.is_string()))
+ {
+ JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
+ }
+ s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
+}
+
+template <
+ typename BasicJsonType, typename ConstructibleStringType,
+ enable_if_t <
+ is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value and
+ not std::is_same<typename BasicJsonType::string_t,
+ ConstructibleStringType>::value,
+ int > = 0 >
+void from_json(const BasicJsonType& j, ConstructibleStringType& s)
+{
+ if (JSON_UNLIKELY(not j.is_string()))
+ {
+ JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
+ }
+
+ s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType, typename EnumType,
+ enable_if_t<std::is_enum<EnumType>::value, int> = 0>
+void from_json(const BasicJsonType& j, EnumType& e)
+{
+ typename std::underlying_type<EnumType>::type val;
+ get_arithmetic_value(j, val);
+ e = static_cast<EnumType>(val);
+}
+
+// forward_list doesn't have an insert method
+template<typename BasicJsonType, typename T, typename Allocator,
+ enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
+void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
+{
+ if (JSON_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ std::transform(j.rbegin(), j.rend(),
+ std::front_inserter(l), [](const BasicJsonType & i)
+ {
+ return i.template get<T>();
+ });
+}
+
+// valarray doesn't have an insert method
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
+void from_json(const BasicJsonType& j, std::valarray<T>& l)
+{
+ if (JSON_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ l.resize(j.size());
+ std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l));
+}
+
+template<typename BasicJsonType>
+void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/)
+{
+ arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
+}
+
+template <typename BasicJsonType, typename T, std::size_t N>
+auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& arr,
+ priority_tag<2> /*unused*/)
+-> decltype(j.template get<T>(), void())
+{
+ for (std::size_t i = 0; i < N; ++i)
+ {
+ arr[i] = j.at(i).template get<T>();
+ }
+}
+
+template<typename BasicJsonType, typename ConstructibleArrayType>
+auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/)
+-> decltype(
+ arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
+ j.template get<typename ConstructibleArrayType::value_type>(),
+ void())
+{
+ using std::end;
+
+ arr.reserve(j.size());
+ std::transform(j.begin(), j.end(),
+ std::inserter(arr, end(arr)), [](const BasicJsonType & i)
+ {
+ // get<BasicJsonType>() returns *this, this won't call a from_json
+ // method when value_type is BasicJsonType
+ return i.template get<typename ConstructibleArrayType::value_type>();
+ });
+}
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr,
+ priority_tag<0> /*unused*/)
+{
+ using std::end;
+
+ std::transform(
+ j.begin(), j.end(), std::inserter(arr, end(arr)),
+ [](const BasicJsonType & i)
+ {
+ // get<BasicJsonType>() returns *this, this won't call a from_json
+ // method when value_type is BasicJsonType
+ return i.template get<typename ConstructibleArrayType::value_type>();
+ });
+}
+
+template <typename BasicJsonType, typename ConstructibleArrayType,
+ enable_if_t <
+ is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value and
+ not is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value and
+ not is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value and
+ not is_basic_json<ConstructibleArrayType>::value,
+ int > = 0 >
+
+auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
+-> decltype(from_json_array_impl(j, arr, priority_tag<3> {}),
+j.template get<typename ConstructibleArrayType::value_type>(),
+void())
+{
+ if (JSON_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " +
+ std::string(j.type_name())));
+ }
+
+ from_json_array_impl(j, arr, priority_tag<3> {});
+}
+
+template<typename BasicJsonType, typename ConstructibleObjectType,
+ enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0>
+void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
+{
+ if (JSON_UNLIKELY(not j.is_object()))
+ {
+ JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name())));
+ }
+
+ auto inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
+ using value_type = typename ConstructibleObjectType::value_type;
+ std::transform(
+ inner_object->begin(), inner_object->end(),
+ std::inserter(obj, obj.begin()),
+ [](typename BasicJsonType::object_t::value_type const & p)
+ {
+ return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
+ });
+}
+
+// overload for arithmetic types, not chosen for basic_json template arguments
+// (BooleanType, etc..); note: Is it really necessary to provide explicit
+// overloads for boolean_t etc. in case of a custom BooleanType which is not
+// an arithmetic type?
+template<typename BasicJsonType, typename ArithmeticType,
+ enable_if_t <
+ std::is_arithmetic<ArithmeticType>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
+ int> = 0>
+void from_json(const BasicJsonType& j, ArithmeticType& val)
+{
+ switch (static_cast<value_t>(j))
+ {
+ case value_t::number_unsigned:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
+ break;
+ }
+ case value_t::number_integer:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
+ break;
+ }
+ case value_t::number_float:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
+ break;
+ }
+ case value_t::boolean:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name())));
+ }
+}
+
+template<typename BasicJsonType, typename A1, typename A2>
+void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
+{
+ p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};
+}
+
+template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
+void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence<Idx...> /*unused*/)
+{
+ t = std::make_tuple(j.at(Idx).template get<typename std::tuple_element<Idx, Tuple>::type>()...);
+}
+
+template<typename BasicJsonType, typename... Args>
+void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
+{
+ from_json_tuple_impl(j, t, index_sequence_for<Args...> {});
+}
+
+template <typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator,
+ typename = enable_if_t<not std::is_constructible<
+ typename BasicJsonType::string_t, Key>::value>>
+void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
+{
+ if (JSON_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ for (const auto& p : j)
+ {
+ if (JSON_UNLIKELY(not p.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
+ }
+ m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
+ }
+}
+
+template <typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator,
+ typename = enable_if_t<not std::is_constructible<
+ typename BasicJsonType::string_t, Key>::value>>
+void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
+{
+ if (JSON_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ for (const auto& p : j)
+ {
+ if (JSON_UNLIKELY(not p.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
+ }
+ m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
+ }
+}
+
+struct from_json_fn
+{
+ template<typename BasicJsonType, typename T>
+ auto operator()(const BasicJsonType& j, T& val) const
+ noexcept(noexcept(from_json(j, val)))
+ -> decltype(from_json(j, val), void())
+ {
+ return from_json(j, val);
+ }
+};
+} // namespace detail
+
+/// namespace to hold default `from_json` function
+/// to see why this is required:
+/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
+namespace
+{
+constexpr const auto& from_json = detail::static_const<detail::from_json_fn>::value;
+} // namespace
+} // namespace nlohmann
+
+// #include <nlohmann/detail/conversions/to_json.hpp>
+
+
+#include <algorithm> // copy
+#include <ciso646> // or, and, not
+#include <iterator> // begin, end
+#include <string> // string
+#include <tuple> // tuple, get
+#include <type_traits> // is_same, is_constructible, is_floating_point, is_enum, underlying_type
+#include <utility> // move, forward, declval, pair
+#include <valarray> // valarray
+#include <vector> // vector
+
+// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
+
+
+#include <cstddef> // size_t
+#include <iterator> // input_iterator_tag
+#include <string> // string, to_string
+#include <tuple> // tuple_size, get, tuple_element
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename IteratorType> class iteration_proxy_value
+{
+ public:
+ using difference_type = std::ptrdiff_t;
+ using value_type = iteration_proxy_value;
+ using pointer = value_type * ;
+ using reference = value_type & ;
+ using iterator_category = std::input_iterator_tag;
+
+ private:
+ /// the iterator
+ IteratorType anchor;
+ /// an index for arrays (used to create key names)
+ std::size_t array_index = 0;
+ /// last stringified array index
+ mutable std::size_t array_index_last = 0;
+ /// a string representation of the array index
+ mutable std::string array_index_str = "0";
+ /// an empty string (to return a reference for primitive values)
+ const std::string empty_str = "";
+
+ public:
+ explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}
+
+ /// dereference operator (needed for range-based for)
+ iteration_proxy_value& operator*()
+ {
+ return *this;
+ }
+
+ /// increment operator (needed for range-based for)
+ iteration_proxy_value& operator++()
+ {
+ ++anchor;
+ ++array_index;
+
+ return *this;
+ }
+
+ /// equality operator (needed for InputIterator)
+ bool operator==(const iteration_proxy_value& o) const
+ {
+ return anchor == o.anchor;
+ }
+
+ /// inequality operator (needed for range-based for)
+ bool operator!=(const iteration_proxy_value& o) const
+ {
+ return anchor != o.anchor;
+ }
+
+ /// return key of the iterator
+ const std::string& key() const
+ {
+ assert(anchor.m_object != nullptr);
+
+ switch (anchor.m_object->type())
+ {
+ // use integer array index as key
+ case value_t::array:
+ {
+ if (array_index != array_index_last)
+ {
+ array_index_str = std::to_string(array_index);
+ array_index_last = array_index;
+ }
+ return array_index_str;
+ }
+
+ // use key from the object
+ case value_t::object:
+ return anchor.key();
+
+ // use an empty key for all primitive types
+ default:
+ return empty_str;
+ }
+ }
+
+ /// return value of the iterator
+ typename IteratorType::reference value() const
+ {
+ return anchor.value();
+ }
+};
+
+/// proxy class for the items() function
+template<typename IteratorType> class iteration_proxy
+{
+ private:
+ /// the container to iterate
+ typename IteratorType::reference container;
+
+ public:
+ /// construct iteration proxy from a container
+ explicit iteration_proxy(typename IteratorType::reference cont) noexcept
+ : container(cont) {}
+
+ /// return iterator begin (needed for range-based for)
+ iteration_proxy_value<IteratorType> begin() noexcept
+ {
+ return iteration_proxy_value<IteratorType>(container.begin());
+ }
+
+ /// return iterator end (needed for range-based for)
+ iteration_proxy_value<IteratorType> end() noexcept
+ {
+ return iteration_proxy_value<IteratorType>(container.end());
+ }
+};
+// Structured Bindings Support
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+template <std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0>
+auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key())
+{
+ return i.key();
+}
+// Structured Bindings Support
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+template <std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0>
+auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value())
+{
+ return i.value();
+}
+} // namespace detail
+} // namespace nlohmann
+
+// The Addition to the STD Namespace is required to add
+// Structured Bindings Support to the iteration_proxy_value class
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+namespace std
+{
+#if defined(__clang__)
+ // Fix: https://github.com/nlohmann/json/issues/1401
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wmismatched-tags"
+#endif
+template <typename IteratorType>
+class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>>
+ : public std::integral_constant<std::size_t, 2> {};
+
+template <std::size_t N, typename IteratorType>
+class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
+{
+ public:
+ using type = decltype(
+ get<N>(std::declval <
+ ::nlohmann::detail::iteration_proxy_value<IteratorType >> ()));
+};
+#if defined(__clang__)
+ #pragma clang diagnostic pop
+#endif
+} // namespace std
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+//////////////////
+// constructors //
+//////////////////
+
+template<value_t> struct external_constructor;
+
+template<>
+struct external_constructor<value_t::boolean>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept
+ {
+ j.m_type = value_t::boolean;
+ j.m_value = b;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::string>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s)
+ {
+ j.m_type = value_t::string;
+ j.m_value = s;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s)
+ {
+ j.m_type = value_t::string;
+ j.m_value = std::move(s);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleStringType,
+ enable_if_t<not std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
+ int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleStringType& str)
+ {
+ j.m_type = value_t::string;
+ j.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_float>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept
+ {
+ j.m_type = value_t::number_float;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_unsigned>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept
+ {
+ j.m_type = value_t::number_unsigned;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_integer>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept
+ {
+ j.m_type = value_t::number_integer;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::array>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = arr;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = std::move(arr);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleArrayType,
+ enable_if_t<not std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
+ int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleArrayType& arr)
+ {
+ using std::begin;
+ using std::end;
+ j.m_type = value_t::array;
+ j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const std::vector<bool>& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = value_t::array;
+ j.m_value.array->reserve(arr.size());
+ for (const bool x : arr)
+ {
+ j.m_value.array->push_back(x);
+ }
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
+ static void construct(BasicJsonType& j, const std::valarray<T>& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = value_t::array;
+ j.m_value.array->resize(arr.size());
+ std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::object>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj)
+ {
+ j.m_type = value_t::object;
+ j.m_value = obj;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
+ {
+ j.m_type = value_t::object;
+ j.m_value = std::move(obj);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleObjectType,
+ enable_if_t<not std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleObjectType& obj)
+ {
+ using std::begin;
+ using std::end;
+
+ j.m_type = value_t::object;
+ j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
+ j.assert_invariant();
+ }
+};
+
+/////////////
+// to_json //
+/////////////
+
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value, int> = 0>
+void to_json(BasicJsonType& j, T b) noexcept
+{
+ external_constructor<value_t::boolean>::construct(j, b);
+}
+
+template<typename BasicJsonType, typename CompatibleString,
+ enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>
+void to_json(BasicJsonType& j, const CompatibleString& s)
+{
+ external_constructor<value_t::string>::construct(j, s);
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
+{
+ external_constructor<value_t::string>::construct(j, std::move(s));
+}
+
+template<typename BasicJsonType, typename FloatType,
+ enable_if_t<std::is_floating_point<FloatType>::value, int> = 0>
+void to_json(BasicJsonType& j, FloatType val) noexcept
+{
+ external_constructor<value_t::number_float>::construct(j, static_cast<typename BasicJsonType::number_float_t>(val));
+}
+
+template<typename BasicJsonType, typename CompatibleNumberUnsignedType,
+ enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value, int> = 0>
+void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
+{
+ external_constructor<value_t::number_unsigned>::construct(j, static_cast<typename BasicJsonType::number_unsigned_t>(val));
+}
+
+template<typename BasicJsonType, typename CompatibleNumberIntegerType,
+ enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value, int> = 0>
+void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
+{
+ external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val));
+}
+
+template<typename BasicJsonType, typename EnumType,
+ enable_if_t<std::is_enum<EnumType>::value, int> = 0>
+void to_json(BasicJsonType& j, EnumType e) noexcept
+{
+ using underlying_type = typename std::underlying_type<EnumType>::type;
+ external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, const std::vector<bool>& e)
+{
+ external_constructor<value_t::array>::construct(j, e);
+}
+
+template <typename BasicJsonType, typename CompatibleArrayType,
+ enable_if_t<is_compatible_array_type<BasicJsonType,
+ CompatibleArrayType>::value and
+ not is_compatible_object_type<
+ BasicJsonType, CompatibleArrayType>::value and
+ not is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value and
+ not is_basic_json<CompatibleArrayType>::value,
+ int> = 0>
+void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
+{
+ external_constructor<value_t::array>::construct(j, arr);
+}
+
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
+void to_json(BasicJsonType& j, const std::valarray<T>& arr)
+{
+ external_constructor<value_t::array>::construct(j, std::move(arr));
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
+{
+ external_constructor<value_t::array>::construct(j, std::move(arr));
+}
+
+template<typename BasicJsonType, typename CompatibleObjectType,
+ enable_if_t<is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value and not is_basic_json<CompatibleObjectType>::value, int> = 0>
+void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
+{
+ external_constructor<value_t::object>::construct(j, obj);
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
+{
+ external_constructor<value_t::object>::construct(j, std::move(obj));
+}
+
+template <
+ typename BasicJsonType, typename T, std::size_t N,
+ enable_if_t<not std::is_constructible<typename BasicJsonType::string_t,
+ const T(&)[N]>::value,
+ int> = 0 >
+void to_json(BasicJsonType& j, const T(&arr)[N])
+{
+ external_constructor<value_t::array>::construct(j, arr);
+}
+
+template<typename BasicJsonType, typename... Args>
+void to_json(BasicJsonType& j, const std::pair<Args...>& p)
+{
+ j = { p.first, p.second };
+}
+
+// for https://github.com/nlohmann/json/pull/1134
+template < typename BasicJsonType, typename T,
+ enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>
+void to_json(BasicJsonType& j, const T& b)
+{
+ j = { {b.key(), b.value()} };
+}
+
+template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
+void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...> /*unused*/)
+{
+ j = { std::get<Idx>(t)... };
+}
+
+template<typename BasicJsonType, typename... Args>
+void to_json(BasicJsonType& j, const std::tuple<Args...>& t)
+{
+ to_json_tuple_impl(j, t, index_sequence_for<Args...> {});
+}
+
+struct to_json_fn
+{
+ template<typename BasicJsonType, typename T>
+ auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward<T>(val))))
+ -> decltype(to_json(j, std::forward<T>(val)), void())
+ {
+ return to_json(j, std::forward<T>(val));
+ }
+};
+} // namespace detail
+
+/// namespace to hold default `to_json` function
+namespace
+{
+constexpr const auto& to_json = detail::static_const<detail::to_json_fn>::value;
+} // namespace
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+
+template<typename, typename>
+struct adl_serializer
+{
+ /*!
+ @brief convert a JSON value to any value type
+
+ This function is usually called by the `get()` function of the
+ @ref basic_json class (either explicit or via conversion operators).
+
+ @param[in] j JSON value to read from
+ @param[in,out] val value to write to
+ */
+ template<typename BasicJsonType, typename ValueType>
+ static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
+ noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
+ -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
+ {
+ ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
+ }
+
+ /*!
+ @brief convert any value type to a JSON value
+
+ This function is usually called by the constructors of the @ref basic_json
+ class.
+
+ @param[in,out] j JSON value to write to
+ @param[in] val value to read from
+ */
+ template <typename BasicJsonType, typename ValueType>
+ static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
+ noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))
+ -> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void())
+ {
+ ::nlohmann::to_json(j, std::forward<ValueType>(val));
+ }
+};
+
+} // namespace nlohmann
+
+// #include <nlohmann/detail/conversions/from_json.hpp>
+
+// #include <nlohmann/detail/conversions/to_json.hpp>
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/binary_reader.hpp>
+
+
+#include <algorithm> // generate_n
+#include <array> // array
+#include <cassert> // assert
+#include <cmath> // ldexp
+#include <cstddef> // size_t
+#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
+#include <cstdio> // snprintf
+#include <cstring> // memcpy
+#include <iterator> // back_inserter
+#include <limits> // numeric_limits
+#include <string> // char_traits, string
+#include <utility> // make_pair, move
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+
+#include <array> // array
+#include <cassert> // assert
+#include <cstddef> // size_t
+#include <cstdio> //FILE *
+#include <cstring> // strlen
+#include <istream> // istream
+#include <iterator> // begin, end, iterator_traits, random_access_iterator_tag, distance, next
+#include <memory> // shared_ptr, make_shared, addressof
+#include <numeric> // accumulate
+#include <string> // string, char_traits
+#include <type_traits> // enable_if, is_base_of, is_pointer, is_integral, remove_pointer
+#include <utility> // pair, declval
+
+// #include <nlohmann/detail/iterators/iterator_traits.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+/// the supported input formats
+enum class input_format_t { json, cbor, msgpack, ubjson, bson };
+
+////////////////////
+// input adapters //
+////////////////////
+
+/*!
+@brief abstract input adapter interface
+
+Produces a stream of std::char_traits<char>::int_type characters from a
+std::istream, a buffer, or some other input type. Accepts the return of
+exactly one non-EOF character for future input. The int_type characters
+returned consist of all valid char values as positive values (typically
+unsigned char), plus an EOF value outside that range, specified by the value
+of the function std::char_traits<char>::eof(). This value is typically -1, but
+could be any arbitrary value which is not a valid char value.
+*/
+struct input_adapter_protocol
+{
+ /// get a character [0,255] or std::char_traits<char>::eof().
+ virtual std::char_traits<char>::int_type get_character() = 0;
+ virtual ~input_adapter_protocol() = default;
+};
+
+/// a type to simplify interfaces
+using input_adapter_t = std::shared_ptr<input_adapter_protocol>;
+
+/*!
+Input adapter for stdio file access. This adapter read only 1 byte and do not use any
+ buffer. This adapter is a very low level adapter.
+*/
+class file_input_adapter : public input_adapter_protocol
+{
+ public:
+ explicit file_input_adapter(std::FILE* f) noexcept
+ : m_file(f)
+ {}
+
+ // make class move-only
+ file_input_adapter(const file_input_adapter&) = delete;
+ file_input_adapter(file_input_adapter&&) = default;
+ file_input_adapter& operator=(const file_input_adapter&) = delete;
+ file_input_adapter& operator=(file_input_adapter&&) = default;
+ ~file_input_adapter() override = default;
+
+ std::char_traits<char>::int_type get_character() noexcept override
+ {
+ return std::fgetc(m_file);
+ }
+
+ private:
+ /// the file pointer to read from
+ std::FILE* m_file;
+};
+
+
+/*!
+Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at
+beginning of input. Does not support changing the underlying std::streambuf
+in mid-input. Maintains underlying std::istream and std::streambuf to support
+subsequent use of standard std::istream operations to process any input
+characters following those used in parsing the JSON input. Clears the
+std::istream flags; any input errors (e.g., EOF) will be detected by the first
+subsequent call for input from the std::istream.
+*/
+class input_stream_adapter : public input_adapter_protocol
+{
+ public:
+ ~input_stream_adapter() override
+ {
+ // clear stream flags; we use underlying streambuf I/O, do not
+ // maintain ifstream flags, except eof
+ is.clear(is.rdstate() & std::ios::eofbit);
+ }
+
+ explicit input_stream_adapter(std::istream& i)
+ : is(i), sb(*i.rdbuf())
+ {}
+
+ // delete because of pointer members
+ input_stream_adapter(const input_stream_adapter&) = delete;
+ input_stream_adapter& operator=(input_stream_adapter&) = delete;
+ input_stream_adapter(input_stream_adapter&&) = delete;
+ input_stream_adapter& operator=(input_stream_adapter&&) = delete;
+
+ // std::istream/std::streambuf use std::char_traits<char>::to_int_type, to
+ // ensure that std::char_traits<char>::eof() and the character 0xFF do not
+ // end up as the same value, eg. 0xFFFFFFFF.
+ std::char_traits<char>::int_type get_character() override
+ {
+ auto res = sb.sbumpc();
+ // set eof manually, as we don't use the istream interface.
+ if (res == EOF)
+ {
+ is.clear(is.rdstate() | std::ios::eofbit);
+ }
+ return res;
+ }
+
+ private:
+ /// the associated input stream
+ std::istream& is;
+ std::streambuf& sb;
+};
+
+/// input adapter for buffer input
+class input_buffer_adapter : public input_adapter_protocol
+{
+ public:
+ input_buffer_adapter(const char* b, const std::size_t l) noexcept
+ : cursor(b), limit(b + l)
+ {}
+
+ // delete because of pointer members
+ input_buffer_adapter(const input_buffer_adapter&) = delete;
+ input_buffer_adapter& operator=(input_buffer_adapter&) = delete;
+ input_buffer_adapter(input_buffer_adapter&&) = delete;
+ input_buffer_adapter& operator=(input_buffer_adapter&&) = delete;
+ ~input_buffer_adapter() override = default;
+
+ std::char_traits<char>::int_type get_character() noexcept override
+ {
+ if (JSON_LIKELY(cursor < limit))
+ {
+ return std::char_traits<char>::to_int_type(*(cursor++));
+ }
+
+ return std::char_traits<char>::eof();
+ }
+
+ private:
+ /// pointer to the current character
+ const char* cursor;
+ /// pointer past the last character
+ const char* const limit;
+};
+
+template<typename WideStringType, size_t T>
+struct wide_string_input_helper
+{
+ // UTF-32
+ static void fill_buffer(const WideStringType& str,
+ size_t& current_wchar,
+ std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
+ size_t& utf8_bytes_index,
+ size_t& utf8_bytes_filled)
+ {
+ utf8_bytes_index = 0;
+
+ if (current_wchar == str.size())
+ {
+ utf8_bytes[0] = std::char_traits<char>::eof();
+ utf8_bytes_filled = 1;
+ }
+ else
+ {
+ // get the current character
+ const auto wc = static_cast<unsigned int>(str[current_wchar++]);
+
+ // UTF-32 to UTF-8 encoding
+ if (wc < 0x80)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ else if (wc <= 0x7FF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((wc >> 6u) & 0x1Fu));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (wc & 0x3Fu));
+ utf8_bytes_filled = 2;
+ }
+ else if (wc <= 0xFFFF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((wc >> 12u) & 0x0Fu));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((wc >> 6u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (wc & 0x3Fu));
+ utf8_bytes_filled = 3;
+ }
+ else if (wc <= 0x10FFFF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | ((wc >> 18u) & 0x07u));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((wc >> 12u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((wc >> 6u) & 0x3Fu));
+ utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (wc & 0x3Fu));
+ utf8_bytes_filled = 4;
+ }
+ else
+ {
+ // unknown character
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ }
+ }
+};
+
+template<typename WideStringType>
+struct wide_string_input_helper<WideStringType, 2>
+{
+ // UTF-16
+ static void fill_buffer(const WideStringType& str,
+ size_t& current_wchar,
+ std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
+ size_t& utf8_bytes_index,
+ size_t& utf8_bytes_filled)
+ {
+ utf8_bytes_index = 0;
+
+ if (current_wchar == str.size())
+ {
+ utf8_bytes[0] = std::char_traits<char>::eof();
+ utf8_bytes_filled = 1;
+ }
+ else
+ {
+ // get the current character
+ const auto wc = static_cast<unsigned int>(str[current_wchar++]);
+
+ // UTF-16 to UTF-8 encoding
+ if (wc < 0x80)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ else if (wc <= 0x7FF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((wc >> 6u)));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (wc & 0x3Fu));
+ utf8_bytes_filled = 2;
+ }
+ else if (0xD800 > wc or wc >= 0xE000)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((wc >> 12u)));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((wc >> 6u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (wc & 0x3Fu));
+ utf8_bytes_filled = 3;
+ }
+ else
+ {
+ if (current_wchar < str.size())
+ {
+ const auto wc2 = static_cast<unsigned int>(str[current_wchar++]);
+ const auto charcode = 0x10000u + (((wc & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | (charcode >> 18u));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 12u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 6u) & 0x3Fu));
+ utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (charcode & 0x3Fu));
+ utf8_bytes_filled = 4;
+ }
+ else
+ {
+ // unknown character
+ ++current_wchar;
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ }
+ }
+ }
+};
+
+template<typename WideStringType>
+class wide_string_input_adapter : public input_adapter_protocol
+{
+ public:
+ explicit wide_string_input_adapter(const WideStringType& w) noexcept
+ : str(w)
+ {}
+
+ std::char_traits<char>::int_type get_character() noexcept override
+ {
+ // check if buffer needs to be filled
+ if (utf8_bytes_index == utf8_bytes_filled)
+ {
+ fill_buffer<sizeof(typename WideStringType::value_type)>();
+
+ assert(utf8_bytes_filled > 0);
+ assert(utf8_bytes_index == 0);
+ }
+
+ // use buffer
+ assert(utf8_bytes_filled > 0);
+ assert(utf8_bytes_index < utf8_bytes_filled);
+ return utf8_bytes[utf8_bytes_index++];
+ }
+
+ private:
+ template<size_t T>
+ void fill_buffer()
+ {
+ wide_string_input_helper<WideStringType, T>::fill_buffer(str, current_wchar, utf8_bytes, utf8_bytes_index, utf8_bytes_filled);
+ }
+
+ /// the wstring to process
+ const WideStringType& str;
+
+ /// index of the current wchar in str
+ std::size_t current_wchar = 0;
+
+ /// a buffer for UTF-8 bytes
+ std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};
+
+ /// index to the utf8_codes array for the next valid byte
+ std::size_t utf8_bytes_index = 0;
+ /// number of valid bytes in the utf8_codes array
+ std::size_t utf8_bytes_filled = 0;
+};
+
+class input_adapter
+{
+ public:
+ // native support
+ input_adapter(std::FILE* file)
+ : ia(std::make_shared<file_input_adapter>(file)) {}
+ /// input adapter for input stream
+ input_adapter(std::istream& i)
+ : ia(std::make_shared<input_stream_adapter>(i)) {}
+
+ /// input adapter for input stream
+ input_adapter(std::istream&& i)
+ : ia(std::make_shared<input_stream_adapter>(i)) {}
+
+ input_adapter(const std::wstring& ws)
+ : ia(std::make_shared<wide_string_input_adapter<std::wstring>>(ws)) {}
+
+ input_adapter(const std::u16string& ws)
+ : ia(std::make_shared<wide_string_input_adapter<std::u16string>>(ws)) {}
+
+ input_adapter(const std::u32string& ws)
+ : ia(std::make_shared<wide_string_input_adapter<std::u32string>>(ws)) {}
+
+ /// input adapter for buffer
+ template<typename CharT,
+ typename std::enable_if<
+ std::is_pointer<CharT>::value and
+ std::is_integral<typename std::remove_pointer<CharT>::type>::value and
+ sizeof(typename std::remove_pointer<CharT>::type) == 1,
+ int>::type = 0>
+ input_adapter(CharT b, std::size_t l)
+ : ia(std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(b), l)) {}
+
+ // derived support
+
+ /// input adapter for string literal
+ template<typename CharT,
+ typename std::enable_if<
+ std::is_pointer<CharT>::value and
+ std::is_integral<typename std::remove_pointer<CharT>::type>::value and
+ sizeof(typename std::remove_pointer<CharT>::type) == 1,
+ int>::type = 0>
+ input_adapter(CharT b)
+ : input_adapter(reinterpret_cast<const char*>(b),
+ std::strlen(reinterpret_cast<const char*>(b))) {}
+
+ /// input adapter for iterator range with contiguous storage
+ template<class IteratorType,
+ typename std::enable_if<
+ std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
+ int>::type = 0>
+ input_adapter(IteratorType first, IteratorType last)
+ {
+#ifndef NDEBUG
+ // assertion to check that the iterator range is indeed contiguous,
+ // see http://stackoverflow.com/a/35008842/266378 for more discussion
+ const auto is_contiguous = std::accumulate(
+ first, last, std::pair<bool, int>(true, 0),
+ [&first](std::pair<bool, int> res, decltype(*first) val)
+ {
+ res.first &= (val == *(std::next(std::addressof(*first), res.second++)));
+ return res;
+ }).first;
+ assert(is_contiguous);
+#endif
+
+ // assertion to check that each element is 1 byte long
+ static_assert(
+ sizeof(typename iterator_traits<IteratorType>::value_type) == 1,
+ "each element in the iterator range must have the size of 1 byte");
+
+ const auto len = static_cast<size_t>(std::distance(first, last));
+ if (JSON_LIKELY(len > 0))
+ {
+ // there is at least one element: use the address of first
+ ia = std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(&(*first)), len);
+ }
+ else
+ {
+ // the address of first cannot be used: use nullptr
+ ia = std::make_shared<input_buffer_adapter>(nullptr, len);
+ }
+ }
+
+ /// input adapter for array
+ template<class T, std::size_t N>
+ input_adapter(T (&array)[N])
+ : input_adapter(std::begin(array), std::end(array)) {}
+
+ /// input adapter for contiguous container
+ template<class ContiguousContainer, typename
+ std::enable_if<not std::is_pointer<ContiguousContainer>::value and
+ std::is_base_of<std::random_access_iterator_tag, typename iterator_traits<decltype(std::begin(std::declval<ContiguousContainer const>()))>::iterator_category>::value,
+ int>::type = 0>
+ input_adapter(const ContiguousContainer& c)
+ : input_adapter(std::begin(c), std::end(c)) {}
+
+ operator input_adapter_t()
+ {
+ return ia;
+ }
+
+ private:
+ /// the actual adapter
+ input_adapter_t ia = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/json_sax.hpp>
+
+
+#include <cassert> // assert
+#include <cstddef>
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+
+/*!
+@brief SAX interface
+
+This class describes the SAX interface used by @ref nlohmann::json::sax_parse.
+Each function is called in different situations while the input is parsed. The
+boolean return value informs the parser whether to continue processing the
+input.
+*/
+template<typename BasicJsonType>
+struct json_sax
+{
+ /// type for (signed) integers
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ /// type for unsigned integers
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ /// type for floating-point numbers
+ using number_float_t = typename BasicJsonType::number_float_t;
+ /// type for strings
+ using string_t = typename BasicJsonType::string_t;
+
+ /*!
+ @brief a null value was read
+ @return whether parsing should proceed
+ */
+ virtual bool null() = 0;
+
+ /*!
+ @brief a boolean value was read
+ @param[in] val boolean value
+ @return whether parsing should proceed
+ */
+ virtual bool boolean(bool val) = 0;
+
+ /*!
+ @brief an integer number was read
+ @param[in] val integer value
+ @return whether parsing should proceed
+ */
+ virtual bool number_integer(number_integer_t val) = 0;
+
+ /*!
+ @brief an unsigned integer number was read
+ @param[in] val unsigned integer value
+ @return whether parsing should proceed
+ */
+ virtual bool number_unsigned(number_unsigned_t val) = 0;
+
+ /*!
+ @brief an floating-point number was read
+ @param[in] val floating-point value
+ @param[in] s raw token value
+ @return whether parsing should proceed
+ */
+ virtual bool number_float(number_float_t val, const string_t& s) = 0;
+
+ /*!
+ @brief a string was read
+ @param[in] val string value
+ @return whether parsing should proceed
+ @note It is safe to move the passed string.
+ */
+ virtual bool string(string_t& val) = 0;
+
+ /*!
+ @brief the beginning of an object was read
+ @param[in] elements number of object elements or -1 if unknown
+ @return whether parsing should proceed
+ @note binary formats may report the number of elements
+ */
+ virtual bool start_object(std::size_t elements) = 0;
+
+ /*!
+ @brief an object key was read
+ @param[in] val object key
+ @return whether parsing should proceed
+ @note It is safe to move the passed string.
+ */
+ virtual bool key(string_t& val) = 0;
+
+ /*!
+ @brief the end of an object was read
+ @return whether parsing should proceed
+ */
+ virtual bool end_object() = 0;
+
+ /*!
+ @brief the beginning of an array was read
+ @param[in] elements number of array elements or -1 if unknown
+ @return whether parsing should proceed
+ @note binary formats may report the number of elements
+ */
+ virtual bool start_array(std::size_t elements) = 0;
+
+ /*!
+ @brief the end of an array was read
+ @return whether parsing should proceed
+ */
+ virtual bool end_array() = 0;
+
+ /*!
+ @brief a parse error occurred
+ @param[in] position the position in the input where the error occurs
+ @param[in] last_token the last read token
+ @param[in] ex an exception object describing the error
+ @return whether parsing should proceed (must return false)
+ */
+ virtual bool parse_error(std::size_t position,
+ const std::string& last_token,
+ const detail::exception& ex) = 0;
+
+ virtual ~json_sax() = default;
+};
+
+
+namespace detail
+{
+/*!
+@brief SAX implementation to create a JSON value from SAX events
+
+This class implements the @ref json_sax interface and processes the SAX events
+to create a JSON value which makes it basically a DOM parser. The structure or
+hierarchy of the JSON value is managed by the stack `ref_stack` which contains
+a pointer to the respective array or object for each recursion depth.
+
+After successful parsing, the value that is passed by reference to the
+constructor contains the parsed value.
+
+@tparam BasicJsonType the JSON type
+*/
+template<typename BasicJsonType>
+class json_sax_dom_parser
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+
+ /*!
+ @param[in, out] r reference to a JSON value that is manipulated while
+ parsing
+ @param[in] allow_exceptions_ whether parse errors yield exceptions
+ */
+ explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true)
+ : root(r), allow_exceptions(allow_exceptions_)
+ {}
+
+ // make class move-only
+ json_sax_dom_parser(const json_sax_dom_parser&) = delete;
+ json_sax_dom_parser(json_sax_dom_parser&&) = default;
+ json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
+ json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
+ ~json_sax_dom_parser() = default;
+
+ bool null()
+ {
+ handle_value(nullptr);
+ return true;
+ }
+
+ bool boolean(bool val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_integer(number_integer_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_float(number_float_t val, const string_t& /*unused*/)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool string(string_t& val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool start_object(std::size_t len)
+ {
+ ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
+
+ if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408,
+ "excessive object size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool key(string_t& val)
+ {
+ // add null at given key and store the reference for later
+ object_element = &(ref_stack.back()->m_value.object->operator[](val));
+ return true;
+ }
+
+ bool end_object()
+ {
+ ref_stack.pop_back();
+ return true;
+ }
+
+ bool start_array(std::size_t len)
+ {
+ ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
+
+ if (JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408,
+ "excessive array size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool end_array()
+ {
+ ref_stack.pop_back();
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
+ const detail::exception& ex)
+ {
+ errored = true;
+ if (allow_exceptions)
+ {
+ // determine the proper exception type from the id
+ switch ((ex.id / 100) % 100)
+ {
+ case 1:
+ JSON_THROW(*static_cast<const detail::parse_error*>(&ex));
+ case 4:
+ JSON_THROW(*static_cast<const detail::out_of_range*>(&ex));
+ // LCOV_EXCL_START
+ case 2:
+ JSON_THROW(*static_cast<const detail::invalid_iterator*>(&ex));
+ case 3:
+ JSON_THROW(*static_cast<const detail::type_error*>(&ex));
+ case 5:
+ JSON_THROW(*static_cast<const detail::other_error*>(&ex));
+ default:
+ assert(false);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return false;
+ }
+
+ constexpr bool is_errored() const
+ {
+ return errored;
+ }
+
+ private:
+ /*!
+ @invariant If the ref stack is empty, then the passed value will be the new
+ root.
+ @invariant If the ref stack contains a value, then it is an array or an
+ object to which we can add elements
+ */
+ template<typename Value>
+ BasicJsonType* handle_value(Value&& v)
+ {
+ if (ref_stack.empty())
+ {
+ root = BasicJsonType(std::forward<Value>(v));
+ return &root;
+ }
+
+ assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
+
+ if (ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
+ return &(ref_stack.back()->m_value.array->back());
+ }
+
+ assert(ref_stack.back()->is_object());
+ assert(object_element);
+ *object_element = BasicJsonType(std::forward<Value>(v));
+ return object_element;
+ }
+
+ /// the parsed JSON value
+ BasicJsonType& root;
+ /// stack to model hierarchy of values
+ std::vector<BasicJsonType*> ref_stack {};
+ /// helper to hold the reference for the next object element
+ BasicJsonType* object_element = nullptr;
+ /// whether a syntax error occurred
+ bool errored = false;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+};
+
+template<typename BasicJsonType>
+class json_sax_dom_callback_parser
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using parser_callback_t = typename BasicJsonType::parser_callback_t;
+ using parse_event_t = typename BasicJsonType::parse_event_t;
+
+ json_sax_dom_callback_parser(BasicJsonType& r,
+ const parser_callback_t cb,
+ const bool allow_exceptions_ = true)
+ : root(r), callback(cb), allow_exceptions(allow_exceptions_)
+ {
+ keep_stack.push_back(true);
+ }
+
+ // make class move-only
+ json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete;
+ json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;
+ json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete;
+ json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default;
+ ~json_sax_dom_callback_parser() = default;
+
+ bool null()
+ {
+ handle_value(nullptr);
+ return true;
+ }
+
+ bool boolean(bool val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_integer(number_integer_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_float(number_float_t val, const string_t& /*unused*/)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool string(string_t& val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool start_object(std::size_t len)
+ {
+ // check callback for object start
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::object_start, discarded);
+ keep_stack.push_back(keep);
+
+ auto val = handle_value(BasicJsonType::value_t::object, true);
+ ref_stack.push_back(val.second);
+
+ // check object limit
+ if (ref_stack.back() and JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408, "excessive object size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool key(string_t& val)
+ {
+ BasicJsonType k = BasicJsonType(val);
+
+ // check callback for key
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::key, k);
+ key_keep_stack.push_back(keep);
+
+ // add discarded value at given key and store the reference for later
+ if (keep and ref_stack.back())
+ {
+ object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);
+ }
+
+ return true;
+ }
+
+ bool end_object()
+ {
+ if (ref_stack.back() and not callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()))
+ {
+ // discard object
+ *ref_stack.back() = discarded;
+ }
+
+ assert(not ref_stack.empty());
+ assert(not keep_stack.empty());
+ ref_stack.pop_back();
+ keep_stack.pop_back();
+
+ if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_object())
+ {
+ // remove discarded value
+ for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
+ {
+ if (it->is_discarded())
+ {
+ ref_stack.back()->erase(it);
+ break;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool start_array(std::size_t len)
+ {
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::array_start, discarded);
+ keep_stack.push_back(keep);
+
+ auto val = handle_value(BasicJsonType::value_t::array, true);
+ ref_stack.push_back(val.second);
+
+ // check array limit
+ if (ref_stack.back() and JSON_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408, "excessive array size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool end_array()
+ {
+ bool keep = true;
+
+ if (ref_stack.back())
+ {
+ keep = callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
+ if (not keep)
+ {
+ // discard array
+ *ref_stack.back() = discarded;
+ }
+ }
+
+ assert(not ref_stack.empty());
+ assert(not keep_stack.empty());
+ ref_stack.pop_back();
+ keep_stack.pop_back();
+
+ // remove discarded value
+ if (not keep and not ref_stack.empty() and ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->pop_back();
+ }
+
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
+ const detail::exception& ex)
+ {
+ errored = true;
+ if (allow_exceptions)
+ {
+ // determine the proper exception type from the id
+ switch ((ex.id / 100) % 100)
+ {
+ case 1:
+ JSON_THROW(*static_cast<const detail::parse_error*>(&ex));
+ case 4:
+ JSON_THROW(*static_cast<const detail::out_of_range*>(&ex));
+ // LCOV_EXCL_START
+ case 2:
+ JSON_THROW(*static_cast<const detail::invalid_iterator*>(&ex));
+ case 3:
+ JSON_THROW(*static_cast<const detail::type_error*>(&ex));
+ case 5:
+ JSON_THROW(*static_cast<const detail::other_error*>(&ex));
+ default:
+ assert(false);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return false;
+ }
+
+ constexpr bool is_errored() const
+ {
+ return errored;
+ }
+
+ private:
+ /*!
+ @param[in] v value to add to the JSON value we build during parsing
+ @param[in] skip_callback whether we should skip calling the callback
+ function; this is required after start_array() and
+ start_object() SAX events, because otherwise we would call the
+ callback function with an empty array or object, respectively.
+
+ @invariant If the ref stack is empty, then the passed value will be the new
+ root.
+ @invariant If the ref stack contains a value, then it is an array or an
+ object to which we can add elements
+
+ @return pair of boolean (whether value should be kept) and pointer (to the
+ passed value in the ref_stack hierarchy; nullptr if not kept)
+ */
+ template<typename Value>
+ std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool skip_callback = false)
+ {
+ assert(not keep_stack.empty());
+
+ // do not handle this value if we know it would be added to a discarded
+ // container
+ if (not keep_stack.back())
+ {
+ return {false, nullptr};
+ }
+
+ // create value
+ auto value = BasicJsonType(std::forward<Value>(v));
+
+ // check callback
+ const bool keep = skip_callback or callback(static_cast<int>(ref_stack.size()), parse_event_t::value, value);
+
+ // do not handle this value if we just learned it shall be discarded
+ if (not keep)
+ {
+ return {false, nullptr};
+ }
+
+ if (ref_stack.empty())
+ {
+ root = std::move(value);
+ return {true, &root};
+ }
+
+ // skip this value if we already decided to skip the parent
+ // (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)
+ if (not ref_stack.back())
+ {
+ return {false, nullptr};
+ }
+
+ // we now only expect arrays and objects
+ assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
+
+ // array
+ if (ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->push_back(std::move(value));
+ return {true, &(ref_stack.back()->m_value.array->back())};
+ }
+
+ // object
+ assert(ref_stack.back()->is_object());
+ // check if we should store an element for the current key
+ assert(not key_keep_stack.empty());
+ const bool store_element = key_keep_stack.back();
+ key_keep_stack.pop_back();
+
+ if (not store_element)
+ {
+ return {false, nullptr};
+ }
+
+ assert(object_element);
+ *object_element = std::move(value);
+ return {true, object_element};
+ }
+
+ /// the parsed JSON value
+ BasicJsonType& root;
+ /// stack to model hierarchy of values
+ std::vector<BasicJsonType*> ref_stack {};
+ /// stack to manage which values to keep
+ std::vector<bool> keep_stack {};
+ /// stack to manage which object keys to keep
+ std::vector<bool> key_keep_stack {};
+ /// helper to hold the reference for the next object element
+ BasicJsonType* object_element = nullptr;
+ /// whether a syntax error occurred
+ bool errored = false;
+ /// callback function
+ const parser_callback_t callback = nullptr;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+ /// a discarded value for the callback
+ BasicJsonType discarded = BasicJsonType::value_t::discarded;
+};
+
+template<typename BasicJsonType>
+class json_sax_acceptor
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+
+ bool null()
+ {
+ return true;
+ }
+
+ bool boolean(bool /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_integer(number_integer_t /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_float(number_float_t /*unused*/, const string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool string(string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool start_object(std::size_t /*unused*/ = std::size_t(-1))
+ {
+ return true;
+ }
+
+ bool key(string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool end_object()
+ {
+ return true;
+ }
+
+ bool start_array(std::size_t /*unused*/ = std::size_t(-1))
+ {
+ return true;
+ }
+
+ bool end_array()
+ {
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/)
+ {
+ return false;
+ }
+};
+} // namespace detail
+
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/is_sax.hpp>
+
+
+#include <cstdint> // size_t
+#include <utility> // declval
+#include <string> // string
+
+// #include <nlohmann/detail/meta/detected.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename T>
+using null_function_t = decltype(std::declval<T&>().null());
+
+template <typename T>
+using boolean_function_t =
+ decltype(std::declval<T&>().boolean(std::declval<bool>()));
+
+template <typename T, typename Integer>
+using number_integer_function_t =
+ decltype(std::declval<T&>().number_integer(std::declval<Integer>()));
+
+template <typename T, typename Unsigned>
+using number_unsigned_function_t =
+ decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>()));
+
+template <typename T, typename Float, typename String>
+using number_float_function_t = decltype(std::declval<T&>().number_float(
+ std::declval<Float>(), std::declval<const String&>()));
+
+template <typename T, typename String>
+using string_function_t =
+ decltype(std::declval<T&>().string(std::declval<String&>()));
+
+template <typename T>
+using start_object_function_t =
+ decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
+
+template <typename T, typename String>
+using key_function_t =
+ decltype(std::declval<T&>().key(std::declval<String&>()));
+
+template <typename T>
+using end_object_function_t = decltype(std::declval<T&>().end_object());
+
+template <typename T>
+using start_array_function_t =
+ decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
+
+template <typename T>
+using end_array_function_t = decltype(std::declval<T&>().end_array());
+
+template <typename T, typename Exception>
+using parse_error_function_t = decltype(std::declval<T&>().parse_error(
+ std::declval<std::size_t>(), std::declval<const std::string&>(),
+ std::declval<const Exception&>()));
+
+template <typename SAX, typename BasicJsonType>
+struct is_sax
+{
+ private:
+ static_assert(is_basic_json<BasicJsonType>::value,
+ "BasicJsonType must be of type basic_json<...>");
+
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using exception_t = typename BasicJsonType::exception;
+
+ public:
+ static constexpr bool value =
+ is_detected_exact<bool, null_function_t, SAX>::value &&
+ is_detected_exact<bool, boolean_function_t, SAX>::value &&
+ is_detected_exact<bool, number_integer_function_t, SAX,
+ number_integer_t>::value &&
+ is_detected_exact<bool, number_unsigned_function_t, SAX,
+ number_unsigned_t>::value &&
+ is_detected_exact<bool, number_float_function_t, SAX, number_float_t,
+ string_t>::value &&
+ is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
+ is_detected_exact<bool, start_object_function_t, SAX>::value &&
+ is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
+ is_detected_exact<bool, end_object_function_t, SAX>::value &&
+ is_detected_exact<bool, start_array_function_t, SAX>::value &&
+ is_detected_exact<bool, end_array_function_t, SAX>::value &&
+ is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value;
+};
+
+template <typename SAX, typename BasicJsonType>
+struct is_sax_static_asserts
+{
+ private:
+ static_assert(is_basic_json<BasicJsonType>::value,
+ "BasicJsonType must be of type basic_json<...>");
+
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using exception_t = typename BasicJsonType::exception;
+
+ public:
+ static_assert(is_detected_exact<bool, null_function_t, SAX>::value,
+ "Missing/invalid function: bool null()");
+ static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,
+ "Missing/invalid function: bool boolean(bool)");
+ static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,
+ "Missing/invalid function: bool boolean(bool)");
+ static_assert(
+ is_detected_exact<bool, number_integer_function_t, SAX,
+ number_integer_t>::value,
+ "Missing/invalid function: bool number_integer(number_integer_t)");
+ static_assert(
+ is_detected_exact<bool, number_unsigned_function_t, SAX,
+ number_unsigned_t>::value,
+ "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
+ static_assert(is_detected_exact<bool, number_float_function_t, SAX,
+ number_float_t, string_t>::value,
+ "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
+ static_assert(
+ is_detected_exact<bool, string_function_t, SAX, string_t>::value,
+ "Missing/invalid function: bool string(string_t&)");
+ static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
+ "Missing/invalid function: bool start_object(std::size_t)");
+ static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
+ "Missing/invalid function: bool key(string_t&)");
+ static_assert(is_detected_exact<bool, end_object_function_t, SAX>::value,
+ "Missing/invalid function: bool end_object()");
+ static_assert(is_detected_exact<bool, start_array_function_t, SAX>::value,
+ "Missing/invalid function: bool start_array(std::size_t)");
+ static_assert(is_detected_exact<bool, end_array_function_t, SAX>::value,
+ "Missing/invalid function: bool end_array()");
+ static_assert(
+ is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value,
+ "Missing/invalid function: bool parse_error(std::size_t, const "
+ "std::string&, const exception&)");
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////
+// binary reader //
+///////////////////
+
+/*!
+@brief deserialization of CBOR, MessagePack, and UBJSON values
+*/
+template<typename BasicJsonType, typename SAX = json_sax_dom_parser<BasicJsonType>>
+class binary_reader
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using json_sax_t = SAX;
+
+ public:
+ /*!
+ @brief create a binary reader
+
+ @param[in] adapter input adapter to read from
+ */
+ explicit binary_reader(input_adapter_t adapter) : ia(std::move(adapter))
+ {
+ (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
+ assert(ia);
+ }
+
+ // make class move-only
+ binary_reader(const binary_reader&) = delete;
+ binary_reader(binary_reader&&) = default;
+ binary_reader& operator=(const binary_reader&) = delete;
+ binary_reader& operator=(binary_reader&&) = default;
+ ~binary_reader() = default;
+
+ /*!
+ @param[in] format the binary format to parse
+ @param[in] sax_ a SAX event processor
+ @param[in] strict whether to expect the input to be consumed completed
+
+ @return
+ */
+ bool sax_parse(const input_format_t format,
+ json_sax_t* sax_,
+ const bool strict = true)
+ {
+ sax = sax_;
+ bool result = false;
+
+ switch (format)
+ {
+ case input_format_t::bson:
+ result = parse_bson_internal();
+ break;
+
+ case input_format_t::cbor:
+ result = parse_cbor_internal();
+ break;
+
+ case input_format_t::msgpack:
+ result = parse_msgpack_internal();
+ break;
+
+ case input_format_t::ubjson:
+ result = parse_ubjson_internal();
+ break;
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+ // strict mode: next byte must be EOF
+ if (result and strict)
+ {
+ if (format == input_format_t::ubjson)
+ {
+ get_ignore_noop();
+ }
+ else
+ {
+ get();
+ }
+
+ if (JSON_UNLIKELY(current != std::char_traits<char>::eof()))
+ {
+ return sax->parse_error(chars_read, get_token_string(),
+ parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value")));
+ }
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief determine system byte order
+
+ @return true if and only if system's byte order is little endian
+
+ @note from http://stackoverflow.com/a/1001328/266378
+ */
+ static constexpr bool little_endianess(int num = 1) noexcept
+ {
+ return *reinterpret_cast<char*>(&num) == 1;
+ }
+
+ private:
+ //////////
+ // BSON //
+ //////////
+
+ /*!
+ @brief Reads in a BSON-object and passes it to the SAX-parser.
+ @return whether a valid BSON-value was passed to the SAX parser
+ */
+ bool parse_bson_internal()
+ {
+ std::int32_t document_size;
+ get_number<std::int32_t, true>(input_format_t::bson, document_size);
+
+ if (JSON_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_bson_element_list(/*is_array*/false)))
+ {
+ return false;
+ }
+
+ return sax->end_object();
+ }
+
+ /*!
+ @brief Parses a C-style string from the BSON input.
+ @param[in, out] result A reference to the string variable where the read
+ string is to be stored.
+ @return `true` if the \x00-byte indicating the end of the string was
+ encountered before the EOF; false` indicates an unexpected EOF.
+ */
+ bool get_bson_cstr(string_t& result)
+ {
+ auto out = std::back_inserter(result);
+ while (true)
+ {
+ get();
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::bson, "cstring")))
+ {
+ return false;
+ }
+ if (current == 0x00)
+ {
+ return true;
+ }
+ *out++ = static_cast<char>(current);
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief Parses a zero-terminated string of length @a len from the BSON
+ input.
+ @param[in] len The length (including the zero-byte at the end) of the
+ string to be read.
+ @param[in, out] result A reference to the string variable where the read
+ string is to be stored.
+ @tparam NumberType The type of the length @a len
+ @pre len >= 1
+ @return `true` if the string was successfully parsed
+ */
+ template<typename NumberType>
+ bool get_bson_string(const NumberType len, string_t& result)
+ {
+ if (JSON_UNLIKELY(len < 1))
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string")));
+ }
+
+ return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) and get() != std::char_traits<char>::eof();
+ }
+
+ /*!
+ @brief Read a BSON document element of the given @a element_type.
+ @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html
+ @param[in] element_type_parse_position The position in the input stream,
+ where the `element_type` was read.
+ @warning Not all BSON element types are supported yet. An unsupported
+ @a element_type will give rise to a parse_error.114:
+ Unsupported BSON record type 0x...
+ @return whether a valid BSON-object/array was passed to the SAX parser
+ */
+ bool parse_bson_element_internal(const int element_type,
+ const std::size_t element_type_parse_position)
+ {
+ switch (element_type)
+ {
+ case 0x01: // double
+ {
+ double number;
+ return get_number<double, true>(input_format_t::bson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0x02: // string
+ {
+ std::int32_t len;
+ string_t value;
+ return get_number<std::int32_t, true>(input_format_t::bson, len) and get_bson_string(len, value) and sax->string(value);
+ }
+
+ case 0x03: // object
+ {
+ return parse_bson_internal();
+ }
+
+ case 0x04: // array
+ {
+ return parse_bson_array();
+ }
+
+ case 0x08: // boolean
+ {
+ return sax->boolean(get() != 0);
+ }
+
+ case 0x0A: // null
+ {
+ return sax->null();
+ }
+
+ case 0x10: // int32
+ {
+ std::int32_t value;
+ return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(value);
+ }
+
+ case 0x12: // int64
+ {
+ std::int64_t value;
+ return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(value);
+ }
+
+ default: // anything else not supported (yet)
+ {
+ std::array<char, 3> cr{{}};
+ (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type));
+ return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data())));
+ }
+ }
+ }
+
+ /*!
+ @brief Read a BSON element list (as specified in the BSON-spec)
+
+ The same binary layout is used for objects and arrays, hence it must be
+ indicated with the argument @a is_array which one is expected
+ (true --> array, false --> object).
+
+ @param[in] is_array Determines if the element list being read is to be
+ treated as an object (@a is_array == false), or as an
+ array (@a is_array == true).
+ @return whether a valid BSON-object/array was passed to the SAX parser
+ */
+ bool parse_bson_element_list(const bool is_array)
+ {
+ string_t key;
+ while (int element_type = get())
+ {
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::bson, "element list")))
+ {
+ return false;
+ }
+
+ const std::size_t element_type_parse_position = chars_read;
+ if (JSON_UNLIKELY(not get_bson_cstr(key)))
+ {
+ return false;
+ }
+
+ if (not is_array and not sax->key(key))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
+ {
+ return false;
+ }
+
+ // get_bson_cstr only appends
+ key.clear();
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief Reads an array from the BSON input and passes it to the SAX-parser.
+ @return whether a valid BSON-array was passed to the SAX parser
+ */
+ bool parse_bson_array()
+ {
+ std::int32_t document_size;
+ get_number<std::int32_t, true>(input_format_t::bson, document_size);
+
+ if (JSON_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_bson_element_list(/*is_array*/true)))
+ {
+ return false;
+ }
+
+ return sax->end_array();
+ }
+
+ //////////
+ // CBOR //
+ //////////
+
+ /*!
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether a valid CBOR value was passed to the SAX parser
+ */
+ bool parse_cbor_internal(const bool get_char = true)
+ {
+ switch (get_char ? get() : current)
+ {
+ // EOF
+ case std::char_traits<char>::eof():
+ return unexpect_eof(input_format_t::cbor, "value");
+
+ // Integer 0x00..0x17 (0..23)
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case 0x09:
+ case 0x0A:
+ case 0x0B:
+ case 0x0C:
+ case 0x0D:
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ return sax->number_unsigned(static_cast<number_unsigned_t>(current));
+
+ case 0x18: // Unsigned integer (one-byte uint8_t follows)
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x19: // Unsigned integer (two-byte uint16_t follows)
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x1A: // Unsigned integer (four-byte uint32_t follows)
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ // Negative integer -1-0x00..-1-0x17 (-1..-24)
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ return sax->number_integer(static_cast<std::int8_t>(0x20 - 1 - current));
+
+ case 0x38: // Negative integer (one-byte uint8_t follows)
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x39: // Negative integer -1-n (two-byte uint16_t follows)
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x3A: // Negative integer -1-n (four-byte uint32_t follows)
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows)
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1)
+ - static_cast<number_integer_t>(number));
+ }
+
+ // UTF-8 string (0x00..0x17 bytes follow)
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
+ case 0x79: // UTF-8 string (two-byte uint16_t for n follow)
+ case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)
+ case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)
+ case 0x7F: // UTF-8 string (indefinite length)
+ {
+ string_t s;
+ return get_cbor_string(s) and sax->string(s);
+ }
+
+ // array (0x00..0x17 data items follow)
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
+
+ case 0x98: // array (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x99: // array (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9A: // array (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9B: // array (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9F: // array (indefinite length)
+ return get_cbor_array(std::size_t(-1));
+
+ // map (0x00..0x17 pairs of data items follow)
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
+
+ case 0xB8: // map (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xB9: // map (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBA: // map (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBB: // map (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBF: // map (indefinite length)
+ return get_cbor_object(std::size_t(-1));
+
+ case 0xF4: // false
+ return sax->boolean(false);
+
+ case 0xF5: // true
+ return sax->boolean(true);
+
+ case 0xF6: // null
+ return sax->null();
+
+ case 0xF9: // Half-Precision Float (two-byte IEEE 754)
+ {
+ const int byte1_raw = get();
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
+ {
+ return false;
+ }
+ const int byte2_raw = get();
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
+ {
+ return false;
+ }
+
+ const auto byte1 = static_cast<unsigned char>(byte1_raw);
+ const auto byte2 = static_cast<unsigned char>(byte2_raw);
+
+ // code from RFC 7049, Appendix D, Figure 3:
+ // As half-precision floating-point numbers were only added
+ // to IEEE 754 in 2008, today's programming platforms often
+ // still only have limited support for them. It is very
+ // easy to include at least decoding support for them even
+ // without such support. An example of a small decoder for
+ // half-precision floating-point numbers in the C language
+ // is shown in Fig. 3.
+ const auto half = static_cast<unsigned int>((byte1 << 8u) + byte2);
+ const double val = [&half]
+ {
+ const int exp = (half >> 10u) & 0x1Fu;
+ const unsigned int mant = half & 0x3FFu;
+ assert(0 <= exp and exp <= 32);
+ assert(0 <= mant and mant <= 1024);
+ switch (exp)
+ {
+ case 0:
+ return std::ldexp(mant, -24);
+ case 31:
+ return (mant == 0)
+ ? std::numeric_limits<double>::infinity()
+ : std::numeric_limits<double>::quiet_NaN();
+ default:
+ return std::ldexp(mant + 1024, exp - 25);
+ }
+ }();
+ return sax->number_float((half & 0x8000u) != 0
+ ? static_cast<number_float_t>(-val)
+ : static_cast<number_float_t>(val), "");
+ }
+
+ case 0xFA: // Single-Precision Float (four-byte IEEE 754)
+ {
+ float number;
+ return get_number(input_format_t::cbor, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xFB: // Double-Precision Float (eight-byte IEEE 754)
+ {
+ double number;
+ return get_number(input_format_t::cbor, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ default: // anything else (0xFF is handled inside the other types)
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a CBOR string
+
+ This function first reads starting bytes to determine the expected
+ string length and then copies this number of bytes into a string.
+ Additionally, CBOR's strings with indefinite lengths are supported.
+
+ @param[out] result created string
+
+ @return whether string creation completed
+ */
+ bool get_cbor_string(string_t& result)
+ {
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::cbor, "string")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ // UTF-8 string (0x00..0x17 bytes follow)
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ {
+ return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
+ }
+
+ case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x79: // UTF-8 string (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7F: // UTF-8 string (indefinite length)
+ {
+ while (get() != 0xFF)
+ {
+ string_t chunk;
+ if (not get_cbor_string(chunk))
+ {
+ return false;
+ }
+ result.append(chunk);
+ }
+ return true;
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, "expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x" + last_token, "string")));
+ }
+ }
+ }
+
+ /*!
+ @param[in] len the length of the array or std::size_t(-1) for an
+ array of indefinite size
+ @return whether array creation completed
+ */
+ bool get_cbor_array(const std::size_t len)
+ {
+ if (JSON_UNLIKELY(not sax->start_array(len)))
+ {
+ return false;
+ }
+
+ if (len != std::size_t(-1))
+ {
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ if (JSON_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ while (get() != 0xFF)
+ {
+ if (JSON_UNLIKELY(not parse_cbor_internal(false)))
+ {
+ return false;
+ }
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @param[in] len the length of the object or std::size_t(-1) for an
+ object of indefinite size
+ @return whether object creation completed
+ */
+ bool get_cbor_object(const std::size_t len)
+ {
+ if (JSON_UNLIKELY(not sax->start_object(len)))
+ {
+ return false;
+ }
+
+ string_t key;
+ if (len != std::size_t(-1))
+ {
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ get();
+ if (JSON_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ else
+ {
+ while (get() != 0xFF)
+ {
+ if (JSON_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+
+ return sax->end_object();
+ }
+
+ /////////////
+ // MsgPack //
+ /////////////
+
+ /*!
+ @return whether a valid MessagePack value was passed to the SAX parser
+ */
+ bool parse_msgpack_internal()
+ {
+ switch (get())
+ {
+ // EOF
+ case std::char_traits<char>::eof():
+ return unexpect_eof(input_format_t::msgpack, "value");
+
+ // positive fixint
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case 0x09:
+ case 0x0A:
+ case 0x0B:
+ case 0x0C:
+ case 0x0D:
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1A:
+ case 0x1B:
+ case 0x1C:
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58:
+ case 0x59:
+ case 0x5A:
+ case 0x5B:
+ case 0x5C:
+ case 0x5D:
+ case 0x5E:
+ case 0x5F:
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78:
+ case 0x79:
+ case 0x7A:
+ case 0x7B:
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ case 0x7F:
+ return sax->number_unsigned(static_cast<number_unsigned_t>(current));
+
+ // fixmap
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
+
+ // fixarray
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9A:
+ case 0x9B:
+ case 0x9C:
+ case 0x9D:
+ case 0x9E:
+ case 0x9F:
+ return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
+
+ // fixstr
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ case 0xB8:
+ case 0xB9:
+ case 0xBA:
+ case 0xBB:
+ case 0xBC:
+ case 0xBD:
+ case 0xBE:
+ case 0xBF:
+ {
+ string_t s;
+ return get_msgpack_string(s) and sax->string(s);
+ }
+
+ case 0xC0: // nil
+ return sax->null();
+
+ case 0xC2: // false
+ return sax->boolean(false);
+
+ case 0xC3: // true
+ return sax->boolean(true);
+
+ case 0xCA: // float 32
+ {
+ float number;
+ return get_number(input_format_t::msgpack, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xCB: // float 64
+ {
+ double number;
+ return get_number(input_format_t::msgpack, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xCC: // uint 8
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCD: // uint 16
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCE: // uint 32
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCF: // uint 64
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xD0: // int 8
+ {
+ std::int8_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD1: // int 16
+ {
+ std::int16_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD2: // int 32
+ {
+ std::int32_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD3: // int 64
+ {
+ std::int64_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD9: // str 8
+ case 0xDA: // str 16
+ case 0xDB: // str 32
+ {
+ string_t s;
+ return get_msgpack_string(s) and sax->string(s);
+ }
+
+ case 0xDC: // array 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_array(static_cast<std::size_t>(len));
+ }
+
+ case 0xDD: // array 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_array(static_cast<std::size_t>(len));
+ }
+
+ case 0xDE: // map 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xDF: // map 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_object(static_cast<std::size_t>(len));
+ }
+
+ // negative fixint
+ case 0xE0:
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xED:
+ case 0xEE:
+ case 0xEF:
+ case 0xF0:
+ case 0xF1:
+ case 0xF2:
+ case 0xF3:
+ case 0xF4:
+ case 0xF5:
+ case 0xF6:
+ case 0xF7:
+ case 0xF8:
+ case 0xF9:
+ case 0xFA:
+ case 0xFB:
+ case 0xFC:
+ case 0xFD:
+ case 0xFE:
+ case 0xFF:
+ return sax->number_integer(static_cast<std::int8_t>(current));
+
+ default: // anything else
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::msgpack, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a MessagePack string
+
+ This function first reads starting bytes to determine the expected
+ string length and then copies this number of bytes into a string.
+
+ @param[out] result created string
+
+ @return whether string creation completed
+ */
+ bool get_msgpack_string(string_t& result)
+ {
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::msgpack, "string")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ // fixstr
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ case 0xB8:
+ case 0xB9:
+ case 0xBA:
+ case 0xBB:
+ case 0xBC:
+ case 0xBD:
+ case 0xBE:
+ case 0xBF:
+ {
+ return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
+ }
+
+ case 0xD9: // str 8
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ case 0xDA: // str 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ case 0xDB: // str 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::msgpack, "expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x" + last_token, "string")));
+ }
+ }
+ }
+
+ /*!
+ @param[in] len the length of the array
+ @return whether array creation completed
+ */
+ bool get_msgpack_array(const std::size_t len)
+ {
+ if (JSON_UNLIKELY(not sax->start_array(len)))
+ {
+ return false;
+ }
+
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ if (JSON_UNLIKELY(not parse_msgpack_internal()))
+ {
+ return false;
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @param[in] len the length of the object
+ @return whether object creation completed
+ */
+ bool get_msgpack_object(const std::size_t len)
+ {
+ if (JSON_UNLIKELY(not sax->start_object(len)))
+ {
+ return false;
+ }
+
+ string_t key;
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ get();
+ if (JSON_UNLIKELY(not get_msgpack_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_UNLIKELY(not parse_msgpack_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+
+ return sax->end_object();
+ }
+
+ ////////////
+ // UBJSON //
+ ////////////
+
+ /*!
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether a valid UBJSON value was passed to the SAX parser
+ */
+ bool parse_ubjson_internal(const bool get_char = true)
+ {
+ return get_ubjson_value(get_char ? get_ignore_noop() : current);
+ }
+
+ /*!
+ @brief reads a UBJSON string
+
+ This function is either called after reading the 'S' byte explicitly
+ indicating a string, or in case of an object key where the 'S' byte can be
+ left out.
+
+ @param[out] result created string
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether string creation completed
+ */
+ bool get_ubjson_string(string_t& result, const bool get_char = true)
+ {
+ if (get_char)
+ {
+ get(); // TODO(niels): may we ignore N here?
+ }
+
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ case 'U':
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'i':
+ {
+ std::int8_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'I':
+ {
+ std::int16_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'l':
+ {
+ std::int32_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'L':
+ {
+ std::int64_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ default:
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L); last byte: 0x" + last_token, "string")));
+ }
+ }
+
+ /*!
+ @param[out] result determined size
+ @return whether size determination completed
+ */
+ bool get_ubjson_size_value(std::size_t& result)
+ {
+ switch (get_ignore_noop())
+ {
+ case 'U':
+ {
+ std::uint8_t number;
+ if (JSON_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'i':
+ {
+ std::int8_t number;
+ if (JSON_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'I':
+ {
+ std::int16_t number;
+ if (JSON_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'l':
+ {
+ std::int32_t number;
+ if (JSON_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'L':
+ {
+ std::int64_t number;
+ if (JSON_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token, "size")));
+ }
+ }
+ }
+
+ /*!
+ @brief determine the type and size for a container
+
+ In the optimized UBJSON format, a type and a size can be provided to allow
+ for a more compact representation.
+
+ @param[out] result pair of the size and the type
+
+ @return whether pair creation completed
+ */
+ bool get_ubjson_size_type(std::pair<std::size_t, int>& result)
+ {
+ result.first = string_t::npos; // size
+ result.second = 0; // type
+
+ get_ignore_noop();
+
+ if (current == '$')
+ {
+ result.second = get(); // must not ignore 'N', because 'N' maybe the type
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "type")))
+ {
+ return false;
+ }
+
+ get_ignore_noop();
+ if (JSON_UNLIKELY(current != '#'))
+ {
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
+ {
+ return false;
+ }
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "expected '#' after type information; last byte: 0x" + last_token, "size")));
+ }
+
+ return get_ubjson_size_value(result.first);
+ }
+
+ if (current == '#')
+ {
+ return get_ubjson_size_value(result.first);
+ }
+
+ return true;
+ }
+
+ /*!
+ @param prefix the previously read or set type prefix
+ @return whether value creation completed
+ */
+ bool get_ubjson_value(const int prefix)
+ {
+ switch (prefix)
+ {
+ case std::char_traits<char>::eof(): // EOF
+ return unexpect_eof(input_format_t::ubjson, "value");
+
+ case 'T': // true
+ return sax->boolean(true);
+ case 'F': // false
+ return sax->boolean(false);
+
+ case 'Z': // null
+ return sax->null();
+
+ case 'U':
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_unsigned(number);
+ }
+
+ case 'i':
+ {
+ std::int8_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'I':
+ {
+ std::int16_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'l':
+ {
+ std::int32_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'L':
+ {
+ std::int64_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'd':
+ {
+ float number;
+ return get_number(input_format_t::ubjson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 'D':
+ {
+ double number;
+ return get_number(input_format_t::ubjson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 'C': // char
+ {
+ get();
+ if (JSON_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "char")))
+ {
+ return false;
+ }
+ if (JSON_UNLIKELY(current > 127))
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char")));
+ }
+ string_t s(1, static_cast<char>(current));
+ return sax->string(s);
+ }
+
+ case 'S': // string
+ {
+ string_t s;
+ return get_ubjson_string(s) and sax->string(s);
+ }
+
+ case '[': // array
+ return get_ubjson_array();
+
+ case '{': // object
+ return get_ubjson_object();
+
+ default: // anything else
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @return whether array creation completed
+ */
+ bool get_ubjson_array()
+ {
+ std::pair<std::size_t, int> size_and_type;
+ if (JSON_UNLIKELY(not get_ubjson_size_type(size_and_type)))
+ {
+ return false;
+ }
+
+ if (size_and_type.first != string_t::npos)
+ {
+ if (JSON_UNLIKELY(not sax->start_array(size_and_type.first)))
+ {
+ return false;
+ }
+
+ if (size_and_type.second != 0)
+ {
+ if (size_and_type.second != 'N')
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_UNLIKELY(not get_ubjson_value(size_and_type.second)))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (JSON_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ while (current != ']')
+ {
+ if (JSON_UNLIKELY(not parse_ubjson_internal(false)))
+ {
+ return false;
+ }
+ get_ignore_noop();
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @return whether object creation completed
+ */
+ bool get_ubjson_object()
+ {
+ std::pair<std::size_t, int> size_and_type;
+ if (JSON_UNLIKELY(not get_ubjson_size_type(size_and_type)))
+ {
+ return false;
+ }
+
+ string_t key;
+ if (size_and_type.first != string_t::npos)
+ {
+ if (JSON_UNLIKELY(not sax->start_object(size_and_type.first)))
+ {
+ return false;
+ }
+
+ if (size_and_type.second != 0)
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_UNLIKELY(not get_ubjson_value(size_and_type.second)))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ else
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ }
+ else
+ {
+ if (JSON_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ while (current != '}')
+ {
+ if (JSON_UNLIKELY(not get_ubjson_string(key, false) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ get_ignore_noop();
+ key.clear();
+ }
+ }
+
+ return sax->end_object();
+ }
+
+ ///////////////////////
+ // Utility functions //
+ ///////////////////////
+
+ /*!
+ @brief get next character from the input
+
+ This function provides the interface to the used input adapter. It does
+ not throw in case the input reached EOF, but returns a -'ve valued
+ `std::char_traits<char>::eof()` in that case.
+
+ @return character read from the input
+ */
+ int get()
+ {
+ ++chars_read;
+ return current = ia->get_character();
+ }
+
+ /*!
+ @return character read from the input after ignoring all 'N' entries
+ */
+ int get_ignore_noop()
+ {
+ do
+ {
+ get();
+ }
+ while (current == 'N');
+
+ return current;
+ }
+
+ /*
+ @brief read a number from the input
+
+ @tparam NumberType the type of the number
+ @param[in] format the current format (for diagnostics)
+ @param[out] result number of type @a NumberType
+
+ @return whether conversion completed
+
+ @note This function needs to respect the system's endianness, because
+ bytes in CBOR, MessagePack, and UBJSON are stored in network order
+ (big endian) and therefore need reordering on little endian systems.
+ */
+ template<typename NumberType, bool InputIsLittleEndian = false>
+ bool get_number(const input_format_t format, NumberType& result)
+ {
+ // step 1: read input into array with system's byte order
+ std::array<std::uint8_t, sizeof(NumberType)> vec;
+ for (std::size_t i = 0; i < sizeof(NumberType); ++i)
+ {
+ get();
+ if (JSON_UNLIKELY(not unexpect_eof(format, "number")))
+ {
+ return false;
+ }
+
+ // reverse byte order prior to conversion if necessary
+ if (is_little_endian != InputIsLittleEndian)
+ {
+ vec[sizeof(NumberType) - i - 1] = static_cast<std::uint8_t>(current);
+ }
+ else
+ {
+ vec[i] = static_cast<std::uint8_t>(current); // LCOV_EXCL_LINE
+ }
+ }
+
+ // step 2: convert array into number of type T and return
+ std::memcpy(&result, vec.data(), sizeof(NumberType));
+ return true;
+ }
+
+ /*!
+ @brief create a string by reading characters from the input
+
+ @tparam NumberType the type of the number
+ @param[in] format the current format (for diagnostics)
+ @param[in] len number of characters to read
+ @param[out] result string created by reading @a len bytes
+
+ @return whether string creation completed
+
+ @note We can not reserve @a len bytes for the result, because @a len
+ may be too large. Usually, @ref unexpect_eof() detects the end of
+ the input before we run out of string memory.
+ */
+ template<typename NumberType>
+ bool get_string(const input_format_t format,
+ const NumberType len,
+ string_t& result)
+ {
+ bool success = true;
+ std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
+ {
+ get();
+ if (JSON_UNLIKELY(not unexpect_eof(format, "string")))
+ {
+ success = false;
+ }
+ return static_cast<char>(current);
+ });
+ return success;
+ }
+
+ /*!
+ @param[in] format the current format (for diagnostics)
+ @param[in] context further context information (for diagnostics)
+ @return whether the last read character is not EOF
+ */
+ bool unexpect_eof(const input_format_t format, const char* context) const
+ {
+ if (JSON_UNLIKELY(current == std::char_traits<char>::eof()))
+ {
+ return sax->parse_error(chars_read, "<end of file>",
+ parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context)));
+ }
+ return true;
+ }
+
+ /*!
+ @return a string representation of the last read byte
+ */
+ std::string get_token_string() const
+ {
+ std::array<char, 3> cr{{}};
+ (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current));
+ return std::string{cr.data()};
+ }
+
+ /*!
+ @param[in] format the current format
+ @param[in] detail a detailed error message
+ @param[in] context further contect information
+ @return a message string to use in the parse_error exceptions
+ */
+ std::string exception_message(const input_format_t format,
+ const std::string& detail,
+ const std::string& context) const
+ {
+ std::string error_msg = "syntax error while parsing ";
+
+ switch (format)
+ {
+ case input_format_t::cbor:
+ error_msg += "CBOR";
+ break;
+
+ case input_format_t::msgpack:
+ error_msg += "MessagePack";
+ break;
+
+ case input_format_t::ubjson:
+ error_msg += "UBJSON";
+ break;
+
+ case input_format_t::bson:
+ error_msg += "BSON";
+ break;
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+ return error_msg + " " + context + ": " + detail;
+ }
+
+ private:
+ /// input adapter
+ input_adapter_t ia = nullptr;
+
+ /// the current character
+ int current = std::char_traits<char>::eof();
+
+ /// the number of characters read
+ std::size_t chars_read = 0;
+
+ /// whether we can assume little endianness
+ const bool is_little_endian = little_endianess();
+
+ /// the SAX parser
+ json_sax_t* sax = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/lexer.hpp>
+
+
+#include <array> // array
+#include <clocale> // localeconv
+#include <cstddef> // size_t
+#include <cstdio> // snprintf
+#include <cstdlib> // strtof, strtod, strtold, strtoll, strtoull
+#include <initializer_list> // initializer_list
+#include <string> // char_traits, string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/position_t.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////
+// lexer //
+///////////
+
+/*!
+@brief lexical analysis
+
+This class organizes the lexical analysis during JSON deserialization.
+*/
+template<typename BasicJsonType>
+class lexer
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+
+ public:
+ /// token types for the parser
+ enum class token_type
+ {
+ uninitialized, ///< indicating the scanner is uninitialized
+ literal_true, ///< the `true` literal
+ literal_false, ///< the `false` literal
+ literal_null, ///< the `null` literal
+ value_string, ///< a string -- use get_string() for actual value
+ value_unsigned, ///< an unsigned integer -- use get_number_unsigned() for actual value
+ value_integer, ///< a signed integer -- use get_number_integer() for actual value
+ value_float, ///< an floating point number -- use get_number_float() for actual value
+ begin_array, ///< the character for array begin `[`
+ begin_object, ///< the character for object begin `{`
+ end_array, ///< the character for array end `]`
+ end_object, ///< the character for object end `}`
+ name_separator, ///< the name separator `:`
+ value_separator, ///< the value separator `,`
+ parse_error, ///< indicating a parse error
+ end_of_input, ///< indicating the end of the input buffer
+ literal_or_value ///< a literal or the begin of a value (only for diagnostics)
+ };
+
+ /// return name of values of type token_type (only used for errors)
+ static const char* token_type_name(const token_type t) noexcept
+ {
+ switch (t)
+ {
+ case token_type::uninitialized:
+ return "<uninitialized>";
+ case token_type::literal_true:
+ return "true literal";
+ case token_type::literal_false:
+ return "false literal";
+ case token_type::literal_null:
+ return "null literal";
+ case token_type::value_string:
+ return "string literal";
+ case lexer::token_type::value_unsigned:
+ case lexer::token_type::value_integer:
+ case lexer::token_type::value_float:
+ return "number literal";
+ case token_type::begin_array:
+ return "'['";
+ case token_type::begin_object:
+ return "'{'";
+ case token_type::end_array:
+ return "']'";
+ case token_type::end_object:
+ return "'}'";
+ case token_type::name_separator:
+ return "':'";
+ case token_type::value_separator:
+ return "','";
+ case token_type::parse_error:
+ return "<parse error>";
+ case token_type::end_of_input:
+ return "end of input";
+ case token_type::literal_or_value:
+ return "'[', '{', or a literal";
+ // LCOV_EXCL_START
+ default: // catch non-enum values
+ return "unknown token";
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ explicit lexer(detail::input_adapter_t&& adapter)
+ : ia(std::move(adapter)), decimal_point_char(get_decimal_point()) {}
+
+ // delete because of pointer members
+ lexer(const lexer&) = delete;
+ lexer(lexer&&) = delete;
+ lexer& operator=(lexer&) = delete;
+ lexer& operator=(lexer&&) = delete;
+ ~lexer() = default;
+
+ private:
+ /////////////////////
+ // locales
+ /////////////////////
+
+ /// return the locale-dependent decimal point
+ static char get_decimal_point() noexcept
+ {
+ const auto loc = localeconv();
+ assert(loc != nullptr);
+ return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point);
+ }
+
+ /////////////////////
+ // scan functions
+ /////////////////////
+
+ /*!
+ @brief get codepoint from 4 hex characters following `\u`
+
+ For input "\u c1 c2 c3 c4" the codepoint is:
+ (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4
+ = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0)
+
+ Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f'
+ must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The
+ conversion is done by subtracting the offset (0x30, 0x37, and 0x57)
+ between the ASCII value of the character and the desired integer value.
+
+ @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or
+ non-hex character)
+ */
+ int get_codepoint()
+ {
+ // this function only makes sense after reading `\u`
+ assert(current == 'u');
+ int codepoint = 0;
+
+ const auto factors = { 12u, 8u, 4u, 0u };
+ for (const auto factor : factors)
+ {
+ get();
+
+ if (current >= '0' and current <= '9')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x30u) << factor);
+ }
+ else if (current >= 'A' and current <= 'F')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x37u) << factor);
+ }
+ else if (current >= 'a' and current <= 'f')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x57u) << factor);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ assert(0x0000 <= codepoint and codepoint <= 0xFFFF);
+ return codepoint;
+ }
+
+ /*!
+ @brief check if the next byte(s) are inside a given range
+
+ Adds the current byte and, for each passed range, reads a new byte and
+ checks if it is inside the range. If a violation was detected, set up an
+ error message and return false. Otherwise, return true.
+
+ @param[in] ranges list of integers; interpreted as list of pairs of
+ inclusive lower and upper bound, respectively
+
+ @pre The passed list @a ranges must have 2, 4, or 6 elements; that is,
+ 1, 2, or 3 pairs. This precondition is enforced by an assertion.
+
+ @return true if and only if no range violation was detected
+ */
+ bool next_byte_in_range(std::initializer_list<int> ranges)
+ {
+ assert(ranges.size() == 2 or ranges.size() == 4 or ranges.size() == 6);
+ add(current);
+
+ for (auto range = ranges.begin(); range != ranges.end(); ++range)
+ {
+ get();
+ if (JSON_LIKELY(*range <= current and current <= *(++range)))
+ {
+ add(current);
+ }
+ else
+ {
+ error_message = "invalid string: ill-formed UTF-8 byte";
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief scan a string literal
+
+ This function scans a string according to Sect. 7 of RFC 7159. While
+ scanning, bytes are escaped and copied into buffer token_buffer. Then the
+ function returns successfully, token_buffer is *not* null-terminated (as it
+ may contain \0 bytes), and token_buffer.size() is the number of bytes in the
+ string.
+
+ @return token_type::value_string if string could be successfully scanned,
+ token_type::parse_error otherwise
+
+ @note In case of errors, variable error_message contains a textual
+ description.
+ */
+ token_type scan_string()
+ {
+ // reset token_buffer (ignore opening quote)
+ reset();
+
+ // we entered the function by reading an open quote
+ assert(current == '\"');
+
+ while (true)
+ {
+ // get next character
+ switch (get())
+ {
+ // end of file while parsing string
+ case std::char_traits<char>::eof():
+ {
+ error_message = "invalid string: missing closing quote";
+ return token_type::parse_error;
+ }
+
+ // closing quote
+ case '\"':
+ {
+ return token_type::value_string;
+ }
+
+ // escapes
+ case '\\':
+ {
+ switch (get())
+ {
+ // quotation mark
+ case '\"':
+ add('\"');
+ break;
+ // reverse solidus
+ case '\\':
+ add('\\');
+ break;
+ // solidus
+ case '/':
+ add('/');
+ break;
+ // backspace
+ case 'b':
+ add('\b');
+ break;
+ // form feed
+ case 'f':
+ add('\f');
+ break;
+ // line feed
+ case 'n':
+ add('\n');
+ break;
+ // carriage return
+ case 'r':
+ add('\r');
+ break;
+ // tab
+ case 't':
+ add('\t');
+ break;
+
+ // unicode escapes
+ case 'u':
+ {
+ const int codepoint1 = get_codepoint();
+ int codepoint = codepoint1; // start with codepoint1
+
+ if (JSON_UNLIKELY(codepoint1 == -1))
+ {
+ error_message = "invalid string: '\\u' must be followed by 4 hex digits";
+ return token_type::parse_error;
+ }
+
+ // check if code point is a high surrogate
+ if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF)
+ {
+ // expect next \uxxxx entry
+ if (JSON_LIKELY(get() == '\\' and get() == 'u'))
+ {
+ const int codepoint2 = get_codepoint();
+
+ if (JSON_UNLIKELY(codepoint2 == -1))
+ {
+ error_message = "invalid string: '\\u' must be followed by 4 hex digits";
+ return token_type::parse_error;
+ }
+
+ // check if codepoint2 is a low surrogate
+ if (JSON_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF))
+ {
+ // overwrite codepoint
+ codepoint = static_cast<int>(
+ // high surrogate occupies the most significant 22 bits
+ (static_cast<unsigned int>(codepoint1) << 10u)
+ // low surrogate occupies the least significant 15 bits
+ + static_cast<unsigned int>(codepoint2)
+ // there is still the 0xD800, 0xDC00 and 0x10000 noise
+ // in the result so we have to subtract with:
+ // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
+ - 0x35FDC00u);
+ }
+ else
+ {
+ error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF";
+ return token_type::parse_error;
+ }
+ }
+ else
+ {
+ error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF";
+ return token_type::parse_error;
+ }
+ }
+ else
+ {
+ if (JSON_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF))
+ {
+ error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
+ return token_type::parse_error;
+ }
+ }
+
+ // result of the above calculation yields a proper codepoint
+ assert(0x00 <= codepoint and codepoint <= 0x10FFFF);
+
+ // translate codepoint into bytes
+ if (codepoint < 0x80)
+ {
+ // 1-byte characters: 0xxxxxxx (ASCII)
+ add(codepoint);
+ }
+ else if (codepoint <= 0x7FF)
+ {
+ // 2-byte characters: 110xxxxx 10xxxxxx
+ add(static_cast<int>(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u)));
+ add(static_cast<int>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+ else if (codepoint <= 0xFFFF)
+ {
+ // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
+ add(static_cast<int>(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u)));
+ add(static_cast<int>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
+ add(static_cast<int>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+ else
+ {
+ // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ add(static_cast<int>(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u)));
+ add(static_cast<int>(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
+ add(static_cast<int>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
+ add(static_cast<int>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+
+ break;
+ }
+
+ // other characters after escape
+ default:
+ error_message = "invalid string: forbidden character after backslash";
+ return token_type::parse_error;
+ }
+
+ break;
+ }
+
+ // invalid control characters
+ case 0x00:
+ {
+ error_message = "invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
+ return token_type::parse_error;
+ }
+
+ case 0x01:
+ {
+ error_message = "invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
+ return token_type::parse_error;
+ }
+
+ case 0x02:
+ {
+ error_message = "invalid string: control character U+0002 (STX) must be escaped to \\u0002";
+ return token_type::parse_error;
+ }
+
+ case 0x03:
+ {
+ error_message = "invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
+ return token_type::parse_error;
+ }
+
+ case 0x04:
+ {
+ error_message = "invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
+ return token_type::parse_error;
+ }
+
+ case 0x05:
+ {
+ error_message = "invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
+ return token_type::parse_error;
+ }
+
+ case 0x06:
+ {
+ error_message = "invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
+ return token_type::parse_error;
+ }
+
+ case 0x07:
+ {
+ error_message = "invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
+ return token_type::parse_error;
+ }
+
+ case 0x08:
+ {
+ error_message = "invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
+ return token_type::parse_error;
+ }
+
+ case 0x09:
+ {
+ error_message = "invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
+ return token_type::parse_error;
+ }
+
+ case 0x0A:
+ {
+ error_message = "invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
+ return token_type::parse_error;
+ }
+
+ case 0x0B:
+ {
+ error_message = "invalid string: control character U+000B (VT) must be escaped to \\u000B";
+ return token_type::parse_error;
+ }
+
+ case 0x0C:
+ {
+ error_message = "invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
+ return token_type::parse_error;
+ }
+
+ case 0x0D:
+ {
+ error_message = "invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
+ return token_type::parse_error;
+ }
+
+ case 0x0E:
+ {
+ error_message = "invalid string: control character U+000E (SO) must be escaped to \\u000E";
+ return token_type::parse_error;
+ }
+
+ case 0x0F:
+ {
+ error_message = "invalid string: control character U+000F (SI) must be escaped to \\u000F";
+ return token_type::parse_error;
+ }
+
+ case 0x10:
+ {
+ error_message = "invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
+ return token_type::parse_error;
+ }
+
+ case 0x11:
+ {
+ error_message = "invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
+ return token_type::parse_error;
+ }
+
+ case 0x12:
+ {
+ error_message = "invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
+ return token_type::parse_error;
+ }
+
+ case 0x13:
+ {
+ error_message = "invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
+ return token_type::parse_error;
+ }
+
+ case 0x14:
+ {
+ error_message = "invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
+ return token_type::parse_error;
+ }
+
+ case 0x15:
+ {
+ error_message = "invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
+ return token_type::parse_error;
+ }
+
+ case 0x16:
+ {
+ error_message = "invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
+ return token_type::parse_error;
+ }
+
+ case 0x17:
+ {
+ error_message = "invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
+ return token_type::parse_error;
+ }
+
+ case 0x18:
+ {
+ error_message = "invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
+ return token_type::parse_error;
+ }
+
+ case 0x19:
+ {
+ error_message = "invalid string: control character U+0019 (EM) must be escaped to \\u0019";
+ return token_type::parse_error;
+ }
+
+ case 0x1A:
+ {
+ error_message = "invalid string: control character U+001A (SUB) must be escaped to \\u001A";
+ return token_type::parse_error;
+ }
+
+ case 0x1B:
+ {
+ error_message = "invalid string: control character U+001B (ESC) must be escaped to \\u001B";
+ return token_type::parse_error;
+ }
+
+ case 0x1C:
+ {
+ error_message = "invalid string: control character U+001C (FS) must be escaped to \\u001C";
+ return token_type::parse_error;
+ }
+
+ case 0x1D:
+ {
+ error_message = "invalid string: control character U+001D (GS) must be escaped to \\u001D";
+ return token_type::parse_error;
+ }
+
+ case 0x1E:
+ {
+ error_message = "invalid string: control character U+001E (RS) must be escaped to \\u001E";
+ return token_type::parse_error;
+ }
+
+ case 0x1F:
+ {
+ error_message = "invalid string: control character U+001F (US) must be escaped to \\u001F";
+ return token_type::parse_error;
+ }
+
+ // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace))
+ case 0x20:
+ case 0x21:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58:
+ case 0x59:
+ case 0x5A:
+ case 0x5B:
+ case 0x5D:
+ case 0x5E:
+ case 0x5F:
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78:
+ case 0x79:
+ case 0x7A:
+ case 0x7B:
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ case 0x7F:
+ {
+ add(current);
+ break;
+ }
+
+ // U+0080..U+07FF: bytes C2..DF 80..BF
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xDB:
+ case 0xDC:
+ case 0xDD:
+ case 0xDE:
+ case 0xDF:
+ {
+ if (JSON_UNLIKELY(not next_byte_in_range({0x80, 0xBF})))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+0800..U+0FFF: bytes E0 A0..BF 80..BF
+ case 0xE0:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF
+ // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xEE:
+ case 0xEF:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+D000..U+D7FF: bytes ED 80..9F 80..BF
+ case 0xED:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
+ case 0xF0:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
+ case 0xF1:
+ case 0xF2:
+ case 0xF3:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
+ case 0xF4:
+ {
+ if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // remaining bytes (80..C1 and F5..FF) are ill-formed
+ default:
+ {
+ error_message = "invalid string: ill-formed UTF-8 byte";
+ return token_type::parse_error;
+ }
+ }
+ }
+ }
+
+ static void strtof(float& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtof(str, endptr);
+ }
+
+ static void strtof(double& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtod(str, endptr);
+ }
+
+ static void strtof(long double& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtold(str, endptr);
+ }
+
+ /*!
+ @brief scan a number literal
+
+ This function scans a string according to Sect. 6 of RFC 7159.
+
+ The function is realized with a deterministic finite state machine derived
+ from the grammar described in RFC 7159. Starting in state "init", the
+ input is read and used to determined the next state. Only state "done"
+ accepts the number. State "error" is a trap state to model errors. In the
+ table below, "anything" means any character but the ones listed before.
+
+ state | 0 | 1-9 | e E | + | - | . | anything
+ ---------|----------|----------|----------|---------|---------|----------|-----------
+ init | zero | any1 | [error] | [error] | minus | [error] | [error]
+ minus | zero | any1 | [error] | [error] | [error] | [error] | [error]
+ zero | done | done | exponent | done | done | decimal1 | done
+ any1 | any1 | any1 | exponent | done | done | decimal1 | done
+ decimal1 | decimal2 | [error] | [error] | [error] | [error] | [error] | [error]
+ decimal2 | decimal2 | decimal2 | exponent | done | done | done | done
+ exponent | any2 | any2 | [error] | sign | sign | [error] | [error]
+ sign | any2 | any2 | [error] | [error] | [error] | [error] | [error]
+ any2 | any2 | any2 | done | done | done | done | done
+
+ The state machine is realized with one label per state (prefixed with
+ "scan_number_") and `goto` statements between them. The state machine
+ contains cycles, but any cycle can be left when EOF is read. Therefore,
+ the function is guaranteed to terminate.
+
+ During scanning, the read bytes are stored in token_buffer. This string is
+ then converted to a signed integer, an unsigned integer, or a
+ floating-point number.
+
+ @return token_type::value_unsigned, token_type::value_integer, or
+ token_type::value_float if number could be successfully scanned,
+ token_type::parse_error otherwise
+
+ @note The scanner is independent of the current locale. Internally, the
+ locale's decimal point is used instead of `.` to work with the
+ locale-dependent converters.
+ */
+ token_type scan_number() // lgtm [cpp/use-of-goto]
+ {
+ // reset token_buffer to store the number's bytes
+ reset();
+
+ // the type of the parsed number; initially set to unsigned; will be
+ // changed if minus sign, decimal point or exponent is read
+ token_type number_type = token_type::value_unsigned;
+
+ // state (init): we just found out we need to scan a number
+ switch (current)
+ {
+ case '-':
+ {
+ add(current);
+ goto scan_number_minus;
+ }
+
+ case '0':
+ {
+ add(current);
+ goto scan_number_zero;
+ }
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ // all other characters are rejected outside scan_number()
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+scan_number_minus:
+ // state: we just parsed a leading minus sign
+ number_type = token_type::value_integer;
+ switch (get())
+ {
+ case '0':
+ {
+ add(current);
+ goto scan_number_zero;
+ }
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after '-'";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_zero:
+ // state: we just parse a zero (maybe with a leading minus sign)
+ switch (get())
+ {
+ case '.':
+ {
+ add(decimal_point_char);
+ goto scan_number_decimal1;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_any1:
+ // state: we just parsed a number 0-9 (maybe with a leading minus sign)
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ case '.':
+ {
+ add(decimal_point_char);
+ goto scan_number_decimal1;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_decimal1:
+ // state: we just parsed a decimal point
+ number_type = token_type::value_float;
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_decimal2;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after '.'";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_decimal2:
+ // we just parsed at least one number after a decimal point
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_decimal2;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_exponent:
+ // we just parsed an exponent
+ number_type = token_type::value_float;
+ switch (get())
+ {
+ case '+':
+ case '-':
+ {
+ add(current);
+ goto scan_number_sign;
+ }
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ {
+ error_message =
+ "invalid number; expected '+', '-', or digit after exponent";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_sign:
+ // we just parsed an exponent sign
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after exponent sign";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_any2:
+ // we just parsed a number after the exponent or exponent sign
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_done:
+ // unget the character after the number (we only read it to know that
+ // we are done scanning a number)
+ unget();
+
+ char* endptr = nullptr;
+ errno = 0;
+
+ // try to parse integers first and fall back to floats
+ if (number_type == token_type::value_unsigned)
+ {
+ const auto x = std::strtoull(token_buffer.data(), &endptr, 10);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ if (errno == 0)
+ {
+ value_unsigned = static_cast<number_unsigned_t>(x);
+ if (value_unsigned == x)
+ {
+ return token_type::value_unsigned;
+ }
+ }
+ }
+ else if (number_type == token_type::value_integer)
+ {
+ const auto x = std::strtoll(token_buffer.data(), &endptr, 10);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ if (errno == 0)
+ {
+ value_integer = static_cast<number_integer_t>(x);
+ if (value_integer == x)
+ {
+ return token_type::value_integer;
+ }
+ }
+ }
+
+ // this code is reached if we parse a floating-point number or if an
+ // integer conversion above failed
+ strtof(value_float, token_buffer.data(), &endptr);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ return token_type::value_float;
+ }
+
+ /*!
+ @param[in] literal_text the literal text to expect
+ @param[in] length the length of the passed literal text
+ @param[in] return_type the token type to return on success
+ */
+ token_type scan_literal(const char* literal_text, const std::size_t length,
+ token_type return_type)
+ {
+ assert(current == literal_text[0]);
+ for (std::size_t i = 1; i < length; ++i)
+ {
+ if (JSON_UNLIKELY(get() != literal_text[i]))
+ {
+ error_message = "invalid literal";
+ return token_type::parse_error;
+ }
+ }
+ return return_type;
+ }
+
+ /////////////////////
+ // input management
+ /////////////////////
+
+ /// reset token_buffer; current character is beginning of token
+ void reset() noexcept
+ {
+ token_buffer.clear();
+ token_string.clear();
+ token_string.push_back(std::char_traits<char>::to_char_type(current));
+ }
+
+ /*
+ @brief get next character from the input
+
+ This function provides the interface to the used input adapter. It does
+ not throw in case the input reached EOF, but returns a
+ `std::char_traits<char>::eof()` in that case. Stores the scanned characters
+ for use in error messages.
+
+ @return character read from the input
+ */
+ std::char_traits<char>::int_type get()
+ {
+ ++position.chars_read_total;
+ ++position.chars_read_current_line;
+
+ if (next_unget)
+ {
+ // just reset the next_unget variable and work with current
+ next_unget = false;
+ }
+ else
+ {
+ current = ia->get_character();
+ }
+
+ if (JSON_LIKELY(current != std::char_traits<char>::eof()))
+ {
+ token_string.push_back(std::char_traits<char>::to_char_type(current));
+ }
+
+ if (current == '\n')
+ {
+ ++position.lines_read;
+ position.chars_read_current_line = 0;
+ }
+
+ return current;
+ }
+
+ /*!
+ @brief unget current character (read it again on next get)
+
+ We implement unget by setting variable next_unget to true. The input is not
+ changed - we just simulate ungetting by modifying chars_read_total,
+ chars_read_current_line, and token_string. The next call to get() will
+ behave as if the unget character is read again.
+ */
+ void unget()
+ {
+ next_unget = true;
+
+ --position.chars_read_total;
+
+ // in case we "unget" a newline, we have to also decrement the lines_read
+ if (position.chars_read_current_line == 0)
+ {
+ if (position.lines_read > 0)
+ {
+ --position.lines_read;
+ }
+ }
+ else
+ {
+ --position.chars_read_current_line;
+ }
+
+ if (JSON_LIKELY(current != std::char_traits<char>::eof()))
+ {
+ assert(not token_string.empty());
+ token_string.pop_back();
+ }
+ }
+
+ /// add a character to token_buffer
+ void add(int c)
+ {
+ token_buffer.push_back(std::char_traits<char>::to_char_type(c));
+ }
+
+ public:
+ /////////////////////
+ // value getters
+ /////////////////////
+
+ /// return integer value
+ constexpr number_integer_t get_number_integer() const noexcept
+ {
+ return value_integer;
+ }
+
+ /// return unsigned integer value
+ constexpr number_unsigned_t get_number_unsigned() const noexcept
+ {
+ return value_unsigned;
+ }
+
+ /// return floating-point value
+ constexpr number_float_t get_number_float() const noexcept
+ {
+ return value_float;
+ }
+
+ /// return current string value (implicitly resets the token; useful only once)
+ string_t& get_string()
+ {
+ return token_buffer;
+ }
+
+ /////////////////////
+ // diagnostics
+ /////////////////////
+
+ /// return position of last read token
+ constexpr position_t get_position() const noexcept
+ {
+ return position;
+ }
+
+ /// return the last read token (for errors only). Will never contain EOF
+ /// (an arbitrary value that is not a valid char value, often -1), because
+ /// 255 may legitimately occur. May contain NUL, which should be escaped.
+ std::string get_token_string() const
+ {
+ // escape control characters
+ std::string result;
+ for (const auto c : token_string)
+ {
+ if ('\x00' <= c and c <= '\x1F')
+ {
+ // escape control characters
+ std::array<char, 9> cs{{}};
+ (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c));
+ result += cs.data();
+ }
+ else
+ {
+ // add character as is
+ result.push_back(c);
+ }
+ }
+
+ return result;
+ }
+
+ /// return syntax error message
+ constexpr const char* get_error_message() const noexcept
+ {
+ return error_message;
+ }
+
+ /////////////////////
+ // actual scanner
+ /////////////////////
+
+ /*!
+ @brief skip the UTF-8 byte order mark
+ @return true iff there is no BOM or the correct BOM has been skipped
+ */
+ bool skip_bom()
+ {
+ if (get() == 0xEF)
+ {
+ // check if we completely parse the BOM
+ return get() == 0xBB and get() == 0xBF;
+ }
+
+ // the first character is not the beginning of the BOM; unget it to
+ // process is later
+ unget();
+ return true;
+ }
+
+ token_type scan()
+ {
+ // initially, skip the BOM
+ if (position.chars_read_total == 0 and not skip_bom())
+ {
+ error_message = "invalid BOM; must be 0xEF 0xBB 0xBF if given";
+ return token_type::parse_error;
+ }
+
+ // read next character and ignore whitespace
+ do
+ {
+ get();
+ }
+ while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
+
+ switch (current)
+ {
+ // structural characters
+ case '[':
+ return token_type::begin_array;
+ case ']':
+ return token_type::end_array;
+ case '{':
+ return token_type::begin_object;
+ case '}':
+ return token_type::end_object;
+ case ':':
+ return token_type::name_separator;
+ case ',':
+ return token_type::value_separator;
+
+ // literals
+ case 't':
+ return scan_literal("true", 4, token_type::literal_true);
+ case 'f':
+ return scan_literal("false", 5, token_type::literal_false);
+ case 'n':
+ return scan_literal("null", 4, token_type::literal_null);
+
+ // string
+ case '\"':
+ return scan_string();
+
+ // number
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return scan_number();
+
+ // end of input (the null byte is needed when parsing from
+ // string literals)
+ case '\0':
+ case std::char_traits<char>::eof():
+ return token_type::end_of_input;
+
+ // error
+ default:
+ error_message = "invalid literal";
+ return token_type::parse_error;
+ }
+ }
+
+ private:
+ /// input adapter
+ detail::input_adapter_t ia = nullptr;
+
+ /// the current character
+ std::char_traits<char>::int_type current = std::char_traits<char>::eof();
+
+ /// whether the next get() call should just return current
+ bool next_unget = false;
+
+ /// the start position of the current token
+ position_t position {};
+
+ /// raw input token string (for error messages)
+ std::vector<char> token_string {};
+
+ /// buffer for variable-length tokens (numbers, strings)
+ string_t token_buffer {};
+
+ /// a description of occurred lexer errors
+ const char* error_message = "";
+
+ // number values
+ number_integer_t value_integer = 0;
+ number_unsigned_t value_unsigned = 0;
+ number_float_t value_float = 0;
+
+ /// the decimal point
+ const char decimal_point_char = '.';
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/parser.hpp>
+
+
+#include <cassert> // assert
+#include <cmath> // isfinite
+#include <cstdint> // uint8_t
+#include <functional> // function
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/json_sax.hpp>
+
+// #include <nlohmann/detail/input/lexer.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/is_sax.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+////////////
+// parser //
+////////////
+
+/*!
+@brief syntax analysis
+
+This class implements a recursive decent parser.
+*/
+template<typename BasicJsonType>
+class parser
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using lexer_t = lexer<BasicJsonType>;
+ using token_type = typename lexer_t::token_type;
+
+ public:
+ enum class parse_event_t : uint8_t
+ {
+ /// the parser read `{` and started to process a JSON object
+ object_start,
+ /// the parser read `}` and finished processing a JSON object
+ object_end,
+ /// the parser read `[` and started to process a JSON array
+ array_start,
+ /// the parser read `]` and finished processing a JSON array
+ array_end,
+ /// the parser read a key of a value in an object
+ key,
+ /// the parser finished reading a JSON value
+ value
+ };
+
+ using parser_callback_t =
+ std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
+
+ /// a parser reading from an input adapter
+ explicit parser(detail::input_adapter_t&& adapter,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions_ = true)
+ : callback(cb), m_lexer(std::move(adapter)), allow_exceptions(allow_exceptions_)
+ {
+ // read first token
+ get_token();
+ }
+
+ /*!
+ @brief public parser interface
+
+ @param[in] strict whether to expect the last token to be EOF
+ @param[in,out] result parsed JSON value
+
+ @throw parse_error.101 in case of an unexpected token
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+ */
+ void parse(const bool strict, BasicJsonType& result)
+ {
+ if (callback)
+ {
+ json_sax_dom_callback_parser<BasicJsonType> sdp(result, callback, allow_exceptions);
+ sax_parse_internal(&sdp);
+ result.assert_invariant();
+
+ // in strict mode, input must be completely read
+ if (strict and (get_token() != token_type::end_of_input))
+ {
+ sdp.parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ // in case of an error, return discarded value
+ if (sdp.is_errored())
+ {
+ result = value_t::discarded;
+ return;
+ }
+
+ // set top-level value to null if it was discarded by the callback
+ // function
+ if (result.is_discarded())
+ {
+ result = nullptr;
+ }
+ }
+ else
+ {
+ json_sax_dom_parser<BasicJsonType> sdp(result, allow_exceptions);
+ sax_parse_internal(&sdp);
+ result.assert_invariant();
+
+ // in strict mode, input must be completely read
+ if (strict and (get_token() != token_type::end_of_input))
+ {
+ sdp.parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ // in case of an error, return discarded value
+ if (sdp.is_errored())
+ {
+ result = value_t::discarded;
+ return;
+ }
+ }
+ }
+
+ /*!
+ @brief public accept interface
+
+ @param[in] strict whether to expect the last token to be EOF
+ @return whether the input is a proper JSON text
+ */
+ bool accept(const bool strict = true)
+ {
+ json_sax_acceptor<BasicJsonType> sax_acceptor;
+ return sax_parse(&sax_acceptor, strict);
+ }
+
+ template <typename SAX>
+ bool sax_parse(SAX* sax, const bool strict = true)
+ {
+ (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
+ const bool result = sax_parse_internal(sax);
+
+ // strict mode: next byte must be EOF
+ if (result and strict and (get_token() != token_type::end_of_input))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ return result;
+ }
+
+ private:
+ template <typename SAX>
+ bool sax_parse_internal(SAX* sax)
+ {
+ // stack to remember the hierarchy of structured values we are parsing
+ // true = array; false = object
+ std::vector<bool> states;
+ // value to avoid a goto (see comment where set to true)
+ bool skip_to_state_evaluation = false;
+
+ while (true)
+ {
+ if (not skip_to_state_evaluation)
+ {
+ // invariant: get_token() was called before each iteration
+ switch (last_token)
+ {
+ case token_type::begin_object:
+ {
+ if (JSON_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ // closing } -> we are done
+ if (get_token() == token_type::end_object)
+ {
+ if (JSON_UNLIKELY(not sax->end_object()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ // parse key
+ if (JSON_UNLIKELY(last_token != token_type::value_string))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::value_string, "object key")));
+ }
+ if (JSON_UNLIKELY(not sax->key(m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ // parse separator (:)
+ if (JSON_UNLIKELY(get_token() != token_type::name_separator))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::name_separator, "object separator")));
+ }
+
+ // remember we are now inside an object
+ states.push_back(false);
+
+ // parse values
+ get_token();
+ continue;
+ }
+
+ case token_type::begin_array:
+ {
+ if (JSON_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ // closing ] -> we are done
+ if (get_token() == token_type::end_array)
+ {
+ if (JSON_UNLIKELY(not sax->end_array()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ // remember we are now inside an array
+ states.push_back(true);
+
+ // parse values (no need to call get_token)
+ continue;
+ }
+
+ case token_type::value_float:
+ {
+ const auto res = m_lexer.get_number_float();
+
+ if (JSON_UNLIKELY(not std::isfinite(res)))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'"));
+ }
+
+ if (JSON_UNLIKELY(not sax->number_float(res, m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ break;
+ }
+
+ case token_type::literal_false:
+ {
+ if (JSON_UNLIKELY(not sax->boolean(false)))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::literal_null:
+ {
+ if (JSON_UNLIKELY(not sax->null()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::literal_true:
+ {
+ if (JSON_UNLIKELY(not sax->boolean(true)))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_integer:
+ {
+ if (JSON_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_string:
+ {
+ if (JSON_UNLIKELY(not sax->string(m_lexer.get_string())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_unsigned:
+ {
+ if (JSON_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::parse_error:
+ {
+ // using "uninitialized" to avoid "expected" message
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::uninitialized, "value")));
+ }
+
+ default: // the last token was unexpected
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::literal_or_value, "value")));
+ }
+ }
+ }
+ else
+ {
+ skip_to_state_evaluation = false;
+ }
+
+ // we reached this line after we successfully parsed a value
+ if (states.empty())
+ {
+ // empty stack: we reached the end of the hierarchy: done
+ return true;
+ }
+
+ if (states.back()) // array
+ {
+ // comma -> next value
+ if (get_token() == token_type::value_separator)
+ {
+ // parse a new value
+ get_token();
+ continue;
+ }
+
+ // closing ]
+ if (JSON_LIKELY(last_token == token_type::end_array))
+ {
+ if (JSON_UNLIKELY(not sax->end_array()))
+ {
+ return false;
+ }
+
+ // We are done with this array. Before we can parse a
+ // new value, we need to evaluate the new state first.
+ // By setting skip_to_state_evaluation to false, we
+ // are effectively jumping to the beginning of this if.
+ assert(not states.empty());
+ states.pop_back();
+ skip_to_state_evaluation = true;
+ continue;
+ }
+
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_array, "array")));
+ }
+ else // object
+ {
+ // comma -> next value
+ if (get_token() == token_type::value_separator)
+ {
+ // parse key
+ if (JSON_UNLIKELY(get_token() != token_type::value_string))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::value_string, "object key")));
+ }
+
+ if (JSON_UNLIKELY(not sax->key(m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ // parse separator (:)
+ if (JSON_UNLIKELY(get_token() != token_type::name_separator))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::name_separator, "object separator")));
+ }
+
+ // parse values
+ get_token();
+ continue;
+ }
+
+ // closing }
+ if (JSON_LIKELY(last_token == token_type::end_object))
+ {
+ if (JSON_UNLIKELY(not sax->end_object()))
+ {
+ return false;
+ }
+
+ // We are done with this object. Before we can parse a
+ // new value, we need to evaluate the new state first.
+ // By setting skip_to_state_evaluation to false, we
+ // are effectively jumping to the beginning of this if.
+ assert(not states.empty());
+ states.pop_back();
+ skip_to_state_evaluation = true;
+ continue;
+ }
+
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_object, "object")));
+ }
+ }
+ }
+
+ /// get next token from lexer
+ token_type get_token()
+ {
+ return last_token = m_lexer.scan();
+ }
+
+ std::string exception_message(const token_type expected, const std::string& context)
+ {
+ std::string error_msg = "syntax error ";
+
+ if (not context.empty())
+ {
+ error_msg += "while parsing " + context + " ";
+ }
+
+ error_msg += "- ";
+
+ if (last_token == token_type::parse_error)
+ {
+ error_msg += std::string(m_lexer.get_error_message()) + "; last read: '" +
+ m_lexer.get_token_string() + "'";
+ }
+ else
+ {
+ error_msg += "unexpected " + std::string(lexer_t::token_type_name(last_token));
+ }
+
+ if (expected != token_type::uninitialized)
+ {
+ error_msg += "; expected " + std::string(lexer_t::token_type_name(expected));
+ }
+
+ return error_msg;
+ }
+
+ private:
+ /// callback function
+ const parser_callback_t callback = nullptr;
+ /// the type of the last read token
+ token_type last_token = token_type::uninitialized;
+ /// the lexer
+ lexer_t m_lexer;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/internal_iterator.hpp>
+
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+
+#include <cstddef> // ptrdiff_t
+#include <limits> // numeric_limits
+
+namespace nlohmann
+{
+namespace detail
+{
+/*
+@brief an iterator for primitive JSON types
+
+This class models an iterator for primitive JSON types (boolean, number,
+string). It's only purpose is to allow the iterator/const_iterator classes
+to "iterate" over primitive values. Internally, the iterator is modeled by
+a `difference_type` variable. Value begin_value (`0`) models the begin,
+end_value (`1`) models past the end.
+*/
+class primitive_iterator_t
+{
+ private:
+ using difference_type = std::ptrdiff_t;
+ static constexpr difference_type begin_value = 0;
+ static constexpr difference_type end_value = begin_value + 1;
+
+ /// iterator as signed integer type
+ difference_type m_it = (std::numeric_limits<std::ptrdiff_t>::min)();
+
+ public:
+ constexpr difference_type get_value() const noexcept
+ {
+ return m_it;
+ }
+
+ /// set iterator to a defined beginning
+ void set_begin() noexcept
+ {
+ m_it = begin_value;
+ }
+
+ /// set iterator to a defined past the end
+ void set_end() noexcept
+ {
+ m_it = end_value;
+ }
+
+ /// return whether the iterator can be dereferenced
+ constexpr bool is_begin() const noexcept
+ {
+ return m_it == begin_value;
+ }
+
+ /// return whether the iterator is at end
+ constexpr bool is_end() const noexcept
+ {
+ return m_it == end_value;
+ }
+
+ friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it == rhs.m_it;
+ }
+
+ friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it < rhs.m_it;
+ }
+
+ primitive_iterator_t operator+(difference_type n) noexcept
+ {
+ auto result = *this;
+ result += n;
+ return result;
+ }
+
+ friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it - rhs.m_it;
+ }
+
+ primitive_iterator_t& operator++() noexcept
+ {
+ ++m_it;
+ return *this;
+ }
+
+ primitive_iterator_t const operator++(int) noexcept
+ {
+ auto result = *this;
+ ++m_it;
+ return result;
+ }
+
+ primitive_iterator_t& operator--() noexcept
+ {
+ --m_it;
+ return *this;
+ }
+
+ primitive_iterator_t const operator--(int) noexcept
+ {
+ auto result = *this;
+ --m_it;
+ return result;
+ }
+
+ primitive_iterator_t& operator+=(difference_type n) noexcept
+ {
+ m_it += n;
+ return *this;
+ }
+
+ primitive_iterator_t& operator-=(difference_type n) noexcept
+ {
+ m_it -= n;
+ return *this;
+ }
+};
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+/*!
+@brief an iterator value
+
+@note This structure could easily be a union, but MSVC currently does not allow
+unions members with complex constructors, see https://github.com/nlohmann/json/pull/105.
+*/
+template<typename BasicJsonType> struct internal_iterator
+{
+ /// iterator for JSON objects
+ typename BasicJsonType::object_t::iterator object_iterator {};
+ /// iterator for JSON arrays
+ typename BasicJsonType::array_t::iterator array_iterator {};
+ /// generic iterator for all other types
+ primitive_iterator_t primitive_iterator {};
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/iter_impl.hpp>
+
+
+#include <ciso646> // not
+#include <iterator> // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next
+#include <type_traits> // conditional, is_const, remove_const
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/iterators/internal_iterator.hpp>
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+// forward declare, to be able to friend it later on
+template<typename IteratorType> class iteration_proxy;
+template<typename IteratorType> class iteration_proxy_value;
+
+/*!
+@brief a template for a bidirectional iterator for the @ref basic_json class
+This class implements a both iterators (iterator and const_iterator) for the
+@ref basic_json class.
+@note An iterator is called *initialized* when a pointer to a JSON value has
+ been set (e.g., by a constructor or a copy assignment). If the iterator is
+ default-constructed, it is *uninitialized* and most methods are undefined.
+ **The library uses assertions to detect calls on uninitialized iterators.**
+@requirement The class satisfies the following concept requirements:
+-
+[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
+ The iterator that can be moved can be moved in both directions (i.e.
+ incremented and decremented).
+@since version 1.0.0, simplified in version 2.0.9, change to bidirectional
+ iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593)
+*/
+template<typename BasicJsonType>
+class iter_impl
+{
+ /// allow basic_json to access private members
+ friend iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;
+ friend BasicJsonType;
+ friend iteration_proxy<iter_impl>;
+ friend iteration_proxy_value<iter_impl>;
+
+ using object_t = typename BasicJsonType::object_t;
+ using array_t = typename BasicJsonType::array_t;
+ // make sure BasicJsonType is basic_json or const basic_json
+ static_assert(is_basic_json<typename std::remove_const<BasicJsonType>::type>::value,
+ "iter_impl only accepts (const) basic_json");
+
+ public:
+
+ /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17.
+ /// The C++ Standard has never required user-defined iterators to derive from std::iterator.
+ /// A user-defined iterator should provide publicly accessible typedefs named
+ /// iterator_category, value_type, difference_type, pointer, and reference.
+ /// Note that value_type is required to be non-const, even for constant iterators.
+ using iterator_category = std::bidirectional_iterator_tag;
+
+ /// the type of the values when the iterator is dereferenced
+ using value_type = typename BasicJsonType::value_type;
+ /// a type to represent differences between iterators
+ using difference_type = typename BasicJsonType::difference_type;
+ /// defines a pointer to the type iterated over (value_type)
+ using pointer = typename std::conditional<std::is_const<BasicJsonType>::value,
+ typename BasicJsonType::const_pointer,
+ typename BasicJsonType::pointer>::type;
+ /// defines a reference to the type iterated over (value_type)
+ using reference =
+ typename std::conditional<std::is_const<BasicJsonType>::value,
+ typename BasicJsonType::const_reference,
+ typename BasicJsonType::reference>::type;
+
+ /// default constructor
+ iter_impl() = default;
+
+ /*!
+ @brief constructor for a given JSON instance
+ @param[in] object pointer to a JSON object for this iterator
+ @pre object != nullptr
+ @post The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ explicit iter_impl(pointer object) noexcept : m_object(object)
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = typename object_t::iterator();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = typename array_t::iterator();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator = primitive_iterator_t();
+ break;
+ }
+ }
+ }
+
+ /*!
+ @note The conventional copy constructor and copy assignment are implicitly
+ defined. Combined with the following converting constructor and
+ assignment, they support: (1) copy from iterator to iterator, (2)
+ copy from const iterator to const iterator, and (3) conversion from
+ iterator to const iterator. However conversion from const iterator
+ to iterator is not defined.
+ */
+
+ /*!
+ @brief converting constructor
+ @param[in] other non-const iterator to copy from
+ @note It is not checked whether @a other is initialized.
+ */
+ iter_impl(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept
+ : m_object(other.m_object), m_it(other.m_it) {}
+
+ /*!
+ @brief converting assignment
+ @param[in,out] other non-const iterator to copy from
+ @return const/non-const iterator
+ @note It is not checked whether @a other is initialized.
+ */
+ iter_impl& operator=(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept
+ {
+ m_object = other.m_object;
+ m_it = other.m_it;
+ return *this;
+ }
+
+ private:
+ /*!
+ @brief set the iterator to the first value
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ void set_begin() noexcept
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = m_object->m_value.object->begin();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = m_object->m_value.array->begin();
+ break;
+ }
+
+ case value_t::null:
+ {
+ // set to end so begin()==end() is true: null is empty
+ m_it.primitive_iterator.set_end();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator.set_begin();
+ break;
+ }
+ }
+ }
+
+ /*!
+ @brief set the iterator past the last value
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ void set_end() noexcept
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = m_object->m_value.object->end();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = m_object->m_value.array->end();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator.set_end();
+ break;
+ }
+ }
+ }
+
+ public:
+ /*!
+ @brief return a reference to the value pointed to by the iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference operator*() const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ assert(m_it.object_iterator != m_object->m_value.object->end());
+ return m_it.object_iterator->second;
+ }
+
+ case value_t::array:
+ {
+ assert(m_it.array_iterator != m_object->m_value.array->end());
+ return *m_it.array_iterator;
+ }
+
+ case value_t::null:
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+
+ default:
+ {
+ if (JSON_LIKELY(m_it.primitive_iterator.is_begin()))
+ {
+ return *m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief dereference the iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ pointer operator->() const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ assert(m_it.object_iterator != m_object->m_value.object->end());
+ return &(m_it.object_iterator->second);
+ }
+
+ case value_t::array:
+ {
+ assert(m_it.array_iterator != m_object->m_value.array->end());
+ return &*m_it.array_iterator;
+ }
+
+ default:
+ {
+ if (JSON_LIKELY(m_it.primitive_iterator.is_begin()))
+ {
+ return m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief post-increment (it++)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl const operator++(int)
+ {
+ auto result = *this;
+ ++(*this);
+ return result;
+ }
+
+ /*!
+ @brief pre-increment (++it)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator++()
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ std::advance(m_it.object_iterator, 1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, 1);
+ break;
+ }
+
+ default:
+ {
+ ++m_it.primitive_iterator;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief post-decrement (it--)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl const operator--(int)
+ {
+ auto result = *this;
+ --(*this);
+ return result;
+ }
+
+ /*!
+ @brief pre-decrement (--it)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator--()
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ std::advance(m_it.object_iterator, -1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, -1);
+ break;
+ }
+
+ default:
+ {
+ --m_it.primitive_iterator;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief comparison: equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator==(const iter_impl& other) const
+ {
+ // if objects are not the same, the comparison is undefined
+ if (JSON_UNLIKELY(m_object != other.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
+ }
+
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ return (m_it.object_iterator == other.m_it.object_iterator);
+
+ case value_t::array:
+ return (m_it.array_iterator == other.m_it.array_iterator);
+
+ default:
+ return (m_it.primitive_iterator == other.m_it.primitive_iterator);
+ }
+ }
+
+ /*!
+ @brief comparison: not equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator!=(const iter_impl& other) const
+ {
+ return not operator==(other);
+ }
+
+ /*!
+ @brief comparison: smaller
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator<(const iter_impl& other) const
+ {
+ // if objects are not the same, the comparison is undefined
+ if (JSON_UNLIKELY(m_object != other.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
+ }
+
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators"));
+
+ case value_t::array:
+ return (m_it.array_iterator < other.m_it.array_iterator);
+
+ default:
+ return (m_it.primitive_iterator < other.m_it.primitive_iterator);
+ }
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator<=(const iter_impl& other) const
+ {
+ return not other.operator < (*this);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator>(const iter_impl& other) const
+ {
+ return not operator<=(other);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator>=(const iter_impl& other) const
+ {
+ return not operator<(other);
+ }
+
+ /*!
+ @brief add to iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator+=(difference_type i)
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, i);
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator += i;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief subtract from iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator-=(difference_type i)
+ {
+ return operator+=(-i);
+ }
+
+ /*!
+ @brief add to iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl operator+(difference_type i) const
+ {
+ auto result = *this;
+ result += i;
+ return result;
+ }
+
+ /*!
+ @brief addition of distance and iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ friend iter_impl operator+(difference_type i, const iter_impl& it)
+ {
+ auto result = it;
+ result += i;
+ return result;
+ }
+
+ /*!
+ @brief subtract from iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl operator-(difference_type i) const
+ {
+ auto result = *this;
+ result -= i;
+ return result;
+ }
+
+ /*!
+ @brief return difference
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ difference_type operator-(const iter_impl& other) const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
+
+ case value_t::array:
+ return m_it.array_iterator - other.m_it.array_iterator;
+
+ default:
+ return m_it.primitive_iterator - other.m_it.primitive_iterator;
+ }
+ }
+
+ /*!
+ @brief access to successor
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference operator[](difference_type n) const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators"));
+
+ case value_t::array:
+ return *std::next(m_it.array_iterator, n);
+
+ case value_t::null:
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+
+ default:
+ {
+ if (JSON_LIKELY(m_it.primitive_iterator.get_value() == -n))
+ {
+ return *m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief return the key of an object iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ const typename object_t::key_type& key() const
+ {
+ assert(m_object != nullptr);
+
+ if (JSON_LIKELY(m_object->is_object()))
+ {
+ return m_it.object_iterator->first;
+ }
+
+ JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators"));
+ }
+
+ /*!
+ @brief return the value of an iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference value() const
+ {
+ return operator*();
+ }
+
+ private:
+ /// associated JSON instance
+ pointer m_object = nullptr;
+ /// the actual iterator of the associated instance
+ internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
+
+// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
+
+
+#include <cstddef> // ptrdiff_t
+#include <iterator> // reverse_iterator
+#include <utility> // declval
+
+namespace nlohmann
+{
+namespace detail
+{
+//////////////////////
+// reverse_iterator //
+//////////////////////
+
+/*!
+@brief a template for a reverse iterator class
+
+@tparam Base the base iterator type to reverse. Valid types are @ref
+iterator (to create @ref reverse_iterator) and @ref const_iterator (to
+create @ref const_reverse_iterator).
+
+@requirement The class satisfies the following concept requirements:
+-
+[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
+ The iterator that can be moved can be moved in both directions (i.e.
+ incremented and decremented).
+- [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator):
+ It is possible to write to the pointed-to element (only if @a Base is
+ @ref iterator).
+
+@since version 1.0.0
+*/
+template<typename Base>
+class json_reverse_iterator : public std::reverse_iterator<Base>
+{
+ public:
+ using difference_type = std::ptrdiff_t;
+ /// shortcut to the reverse iterator adapter
+ using base_iterator = std::reverse_iterator<Base>;
+ /// the reference type for the pointed-to element
+ using reference = typename Base::reference;
+
+ /// create reverse iterator from iterator
+ explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept
+ : base_iterator(it) {}
+
+ /// create reverse iterator from base class
+ explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {}
+
+ /// post-increment (it++)
+ json_reverse_iterator const operator++(int)
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator++(1));
+ }
+
+ /// pre-increment (++it)
+ json_reverse_iterator& operator++()
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator++());
+ }
+
+ /// post-decrement (it--)
+ json_reverse_iterator const operator--(int)
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator--(1));
+ }
+
+ /// pre-decrement (--it)
+ json_reverse_iterator& operator--()
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator--());
+ }
+
+ /// add to iterator
+ json_reverse_iterator& operator+=(difference_type i)
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator+=(i));
+ }
+
+ /// add to iterator
+ json_reverse_iterator operator+(difference_type i) const
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator+(i));
+ }
+
+ /// subtract from iterator
+ json_reverse_iterator operator-(difference_type i) const
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator-(i));
+ }
+
+ /// return difference
+ difference_type operator-(const json_reverse_iterator& other) const
+ {
+ return base_iterator(*this) - base_iterator(other);
+ }
+
+ /// access to successor
+ reference operator[](difference_type n) const
+ {
+ return *(this->operator+(n));
+ }
+
+ /// return the key of an object iterator
+ auto key() const -> decltype(std::declval<Base>().key())
+ {
+ auto it = --this->base();
+ return it.key();
+ }
+
+ /// return the value of an iterator
+ reference value() const
+ {
+ auto it = --this->base();
+ return it.operator * ();
+ }
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+// #include <nlohmann/detail/json_pointer.hpp>
+
+
+#include <algorithm> // all_of
+#include <cassert> // assert
+#include <numeric> // accumulate
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+template<typename BasicJsonType>
+class json_pointer
+{
+ // allow basic_json to access private members
+ NLOHMANN_BASIC_JSON_TPL_DECLARATION
+ friend class basic_json;
+
+ public:
+ /*!
+ @brief create JSON pointer
+
+ Create a JSON pointer according to the syntax described in
+ [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3).
+
+ @param[in] s string representing the JSON pointer; if omitted, the empty
+ string is assumed which references the whole JSON value
+
+ @throw parse_error.107 if the given JSON pointer @a s is nonempty and does
+ not begin with a slash (`/`); see example below
+
+ @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is
+ not followed by `0` (representing `~`) or `1` (representing `/`); see
+ example below
+
+ @liveexample{The example shows the construction several valid JSON pointers
+ as well as the exceptional behavior.,json_pointer}
+
+ @since version 2.0.0
+ */
+ explicit json_pointer(const std::string& s = "")
+ : reference_tokens(split(s))
+ {}
+
+ /*!
+ @brief return a string representation of the JSON pointer
+
+ @invariant For each JSON pointer `ptr`, it holds:
+ @code {.cpp}
+ ptr == json_pointer(ptr.to_string());
+ @endcode
+
+ @return a string representation of the JSON pointer
+
+ @liveexample{The example shows the result of `to_string`.,json_pointer__to_string}
+
+ @since version 2.0.0
+ */
+ std::string to_string() const
+ {
+ return std::accumulate(reference_tokens.begin(), reference_tokens.end(),
+ std::string{},
+ [](const std::string & a, const std::string & b)
+ {
+ return a + "/" + escape(b);
+ });
+ }
+
+ /// @copydoc to_string()
+ operator std::string() const
+ {
+ return to_string();
+ }
+
+ /*!
+ @brief append another JSON pointer at the end of this JSON pointer
+
+ @param[in] ptr JSON pointer to append
+ @return JSON pointer with @a ptr appended
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::string) to append a reference token
+ @sa @ref operator/=(std::size_t) to append an array index
+ @sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(const json_pointer& ptr)
+ {
+ reference_tokens.insert(reference_tokens.end(),
+ ptr.reference_tokens.begin(),
+ ptr.reference_tokens.end());
+ return *this;
+ }
+
+ /*!
+ @brief append an unescaped reference token at the end of this JSON pointer
+
+ @param[in] token reference token to append
+ @return JSON pointer with @a token appended without escaping @a token
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Amortized constant.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+ @sa @ref operator/=(std::size_t) to append an array index
+ @sa @ref operator/(const json_pointer&, std::size_t) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(std::string token)
+ {
+ push_back(std::move(token));
+ return *this;
+ }
+
+ /*!
+ @brief append an array index at the end of this JSON pointer
+
+ @param[in] array_index array index ot append
+ @return JSON pointer with @a array_index appended
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Amortized constant.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+ @sa @ref operator/=(std::string) to append a reference token
+ @sa @ref operator/(const json_pointer&, std::string) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(std::size_t array_index)
+ {
+ return *this /= std::to_string(array_index);
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
+
+ @param[in] lhs JSON pointer
+ @param[in] rhs JSON pointer
+ @return a new JSON pointer with @a rhs appended to @a lhs
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a lhs and @a rhs.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& lhs,
+ const json_pointer& rhs)
+ {
+ return json_pointer(lhs) /= rhs;
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
+
+ @param[in] ptr JSON pointer
+ @param[in] token reference token
+ @return a new JSON pointer with unescaped @a token appended to @a ptr
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::string) to append a reference token
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& ptr, std::string token)
+ {
+ return json_pointer(ptr) /= std::move(token);
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
+
+ @param[in] ptr JSON pointer
+ @param[in] array_index array index
+ @return a new JSON pointer with @a array_index appended to @a ptr
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::size_t) to append an array index
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& ptr, std::size_t array_index)
+ {
+ return json_pointer(ptr) /= array_index;
+ }
+
+ /*!
+ @brief returns the parent of this JSON pointer
+
+ @return parent of this JSON pointer; in case this JSON pointer is the root,
+ the root itself is returned
+
+ @complexity Linear in the length of the JSON pointer.
+
+ @liveexample{The example shows the result of `parent_pointer` for different
+ JSON Pointers.,json_pointer__parent_pointer}
+
+ @since version 3.6.0
+ */
+ json_pointer parent_pointer() const
+ {
+ if (empty())
+ {
+ return *this;
+ }
+
+ json_pointer res = *this;
+ res.pop_back();
+ return res;
+ }
+
+ /*!
+ @brief remove last reference token
+
+ @pre not `empty()`
+
+ @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back}
+
+ @complexity Constant.
+
+ @throw out_of_range.405 if JSON pointer has no parent
+
+ @since version 3.6.0
+ */
+ void pop_back()
+ {
+ if (JSON_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ reference_tokens.pop_back();
+ }
+
+ /*!
+ @brief return last reference token
+
+ @pre not `empty()`
+ @return last reference token
+
+ @liveexample{The example shows the usage of `back`.,json_pointer__back}
+
+ @complexity Constant.
+
+ @throw out_of_range.405 if JSON pointer has no parent
+
+ @since version 3.6.0
+ */
+ const std::string& back()
+ {
+ if (JSON_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ return reference_tokens.back();
+ }
+
+ /*!
+ @brief append an unescaped token at the end of the reference pointer
+
+ @param[in] token token to add
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows the result of `push_back` for different
+ JSON Pointers.,json_pointer__push_back}
+
+ @since version 3.6.0
+ */
+ void push_back(const std::string& token)
+ {
+ reference_tokens.push_back(token);
+ }
+
+ /// @copydoc push_back(const std::string&)
+ void push_back(std::string&& token)
+ {
+ reference_tokens.push_back(std::move(token));
+ }
+
+ /*!
+ @brief return whether pointer points to the root document
+
+ @return true iff the JSON pointer points to the root document
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example shows the result of `empty` for different JSON
+ Pointers.,json_pointer__empty}
+
+ @since version 3.6.0
+ */
+ bool empty() const noexcept
+ {
+ return reference_tokens.empty();
+ }
+
+ private:
+ /*!
+ @param[in] s reference token to be converted into an array index
+
+ @return integer representation of @a s
+
+ @throw out_of_range.404 if string @a s could not be converted to an integer
+ */
+ static int array_index(const std::string& s)
+ {
+ std::size_t processed_chars = 0;
+ const int res = std::stoi(s, &processed_chars);
+
+ // check if the string was completely read
+ if (JSON_UNLIKELY(processed_chars != s.size()))
+ {
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'"));
+ }
+
+ return res;
+ }
+
+ json_pointer top() const
+ {
+ if (JSON_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ json_pointer result = *this;
+ result.reference_tokens = {reference_tokens[0]};
+ return result;
+ }
+
+ /*!
+ @brief create and return a reference to the pointed to value
+
+ @complexity Linear in the number of reference tokens.
+
+ @throw parse_error.109 if array index is not a number
+ @throw type_error.313 if value cannot be unflattened
+ */
+ BasicJsonType& get_and_create(BasicJsonType& j) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ auto result = &j;
+
+ // in case no reference tokens exist, return a reference to the JSON value
+ // j which will be overwritten by a primitive value
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (result->m_type)
+ {
+ case detail::value_t::null:
+ {
+ if (reference_token == "0")
+ {
+ // start a new array if reference token is 0
+ result = &result->operator[](0);
+ }
+ else
+ {
+ // start a new object otherwise
+ result = &result->operator[](reference_token);
+ }
+ break;
+ }
+
+ case detail::value_t::object:
+ {
+ // create an entry in the object
+ result = &result->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ // create an entry in the array
+ JSON_TRY
+ {
+ result = &result->operator[](static_cast<size_type>(array_index(reference_token)));
+ }
+ JSON_CATCH(std::invalid_argument&)
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number"));
+ }
+ break;
+ }
+
+ /*
+ The following code is only reached if there exists a reference
+ token _and_ the current value is primitive. In this case, we have
+ an error situation, because primitive values may only occur as
+ single value; that is, with an empty list of reference tokens.
+ */
+ default:
+ JSON_THROW(detail::type_error::create(313, "invalid value to unflatten"));
+ }
+ }
+
+ return *result;
+ }
+
+ /*!
+ @brief return a reference to the pointed to value
+
+ @note This version does not throw if a value is not present, but tries to
+ create nested values instead. For instance, calling this function
+ with pointer `"/this/that"` on a null value is equivalent to calling
+ `operator[]("this").operator[]("that")` on that value, effectively
+ changing the null value to an object.
+
+ @param[in] ptr a JSON value
+
+ @return reference to the JSON value pointed to by the JSON pointer
+
+ @complexity Linear in the length of the JSON pointer.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ BasicJsonType& get_unchecked(BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ // convert null values to arrays or objects before continuing
+ if (ptr->m_type == detail::value_t::null)
+ {
+ // check if reference token is a number
+ const bool nums =
+ std::all_of(reference_token.begin(), reference_token.end(),
+ [](const char x)
+ {
+ return x >= '0' and x <= '9';
+ });
+
+ // change value to array for numbers or "-" or to object otherwise
+ *ptr = (nums or reference_token == "-")
+ ? detail::value_t::array
+ : detail::value_t::object;
+ }
+
+ switch (ptr->m_type)
+ {
+ case detail::value_t::object:
+ {
+ // use unchecked object access
+ ptr = &ptr->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
+ {
+ JSON_THROW(detail::parse_error::create(106, 0,
+ "array index '" + reference_token +
+ "' must not begin with '0'"));
+ }
+
+ if (reference_token == "-")
+ {
+ // explicitly treat "-" as index beyond the end
+ ptr = &ptr->operator[](ptr->m_value.array->size());
+ }
+ else
+ {
+ // convert array index to number; unchecked access
+ JSON_TRY
+ {
+ ptr = &ptr->operator[](
+ static_cast<size_type>(array_index(reference_token)));
+ }
+ JSON_CATCH(std::invalid_argument&)
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number"));
+ }
+ }
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ BasicJsonType& get_checked(BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->m_type)
+ {
+ case detail::value_t::object:
+ {
+ // note: at performs range check
+ ptr = &ptr->at(reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_UNLIKELY(reference_token == "-"))
+ {
+ // "-" always fails the range check
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
+ {
+ JSON_THROW(detail::parse_error::create(106, 0,
+ "array index '" + reference_token +
+ "' must not begin with '0'"));
+ }
+
+ // note: at performs range check
+ JSON_TRY
+ {
+ ptr = &ptr->at(static_cast<size_type>(array_index(reference_token)));
+ }
+ JSON_CATCH(std::invalid_argument&)
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number"));
+ }
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @brief return a const reference to the pointed to value
+
+ @param[in] ptr a JSON value
+
+ @return const reference to the JSON value pointed to by the JSON
+ pointer
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->m_type)
+ {
+ case detail::value_t::object:
+ {
+ // use unchecked object access
+ ptr = &ptr->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_UNLIKELY(reference_token == "-"))
+ {
+ // "-" cannot be used for const access
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
+ {
+ JSON_THROW(detail::parse_error::create(106, 0,
+ "array index '" + reference_token +
+ "' must not begin with '0'"));
+ }
+
+ // use unchecked array access
+ JSON_TRY
+ {
+ ptr = &ptr->operator[](
+ static_cast<size_type>(array_index(reference_token)));
+ }
+ JSON_CATCH(std::invalid_argument&)
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number"));
+ }
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ const BasicJsonType& get_checked(const BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->m_type)
+ {
+ case detail::value_t::object:
+ {
+ // note: at performs range check
+ ptr = &ptr->at(reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_UNLIKELY(reference_token == "-"))
+ {
+ // "-" always fails the range check
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
+ {
+ JSON_THROW(detail::parse_error::create(106, 0,
+ "array index '" + reference_token +
+ "' must not begin with '0'"));
+ }
+
+ // note: at performs range check
+ JSON_TRY
+ {
+ ptr = &ptr->at(static_cast<size_type>(array_index(reference_token)));
+ }
+ JSON_CATCH(std::invalid_argument&)
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number"));
+ }
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @brief split the string input to reference tokens
+
+ @note This function is only called by the json_pointer constructor.
+ All exceptions below are documented there.
+
+ @throw parse_error.107 if the pointer is not empty or begins with '/'
+ @throw parse_error.108 if character '~' is not followed by '0' or '1'
+ */
+ static std::vector<std::string> split(const std::string& reference_string)
+ {
+ std::vector<std::string> result;
+
+ // special case: empty reference string -> no reference tokens
+ if (reference_string.empty())
+ {
+ return result;
+ }
+
+ // check if nonempty reference string begins with slash
+ if (JSON_UNLIKELY(reference_string[0] != '/'))
+ {
+ JSON_THROW(detail::parse_error::create(107, 1,
+ "JSON pointer must be empty or begin with '/' - was: '" +
+ reference_string + "'"));
+ }
+
+ // extract the reference tokens:
+ // - slash: position of the last read slash (or end of string)
+ // - start: position after the previous slash
+ for (
+ // search for the first slash after the first character
+ std::size_t slash = reference_string.find_first_of('/', 1),
+ // set the beginning of the first reference token
+ start = 1;
+ // we can stop if start == 0 (if slash == std::string::npos)
+ start != 0;
+ // set the beginning of the next reference token
+ // (will eventually be 0 if slash == std::string::npos)
+ start = (slash == std::string::npos) ? 0 : slash + 1,
+ // find next slash
+ slash = reference_string.find_first_of('/', start))
+ {
+ // use the text between the beginning of the reference token
+ // (start) and the last slash (slash).
+ auto reference_token = reference_string.substr(start, slash - start);
+
+ // check reference tokens are properly escaped
+ for (std::size_t pos = reference_token.find_first_of('~');
+ pos != std::string::npos;
+ pos = reference_token.find_first_of('~', pos + 1))
+ {
+ assert(reference_token[pos] == '~');
+
+ // ~ must be followed by 0 or 1
+ if (JSON_UNLIKELY(pos == reference_token.size() - 1 or
+ (reference_token[pos + 1] != '0' and
+ reference_token[pos + 1] != '1')))
+ {
+ JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'"));
+ }
+ }
+
+ // finally, store the reference token
+ unescape(reference_token);
+ result.push_back(reference_token);
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief replace all occurrences of a substring by another string
+
+ @param[in,out] s the string to manipulate; changed so that all
+ occurrences of @a f are replaced with @a t
+ @param[in] f the substring to replace with @a t
+ @param[in] t the string to replace @a f
+
+ @pre The search string @a f must not be empty. **This precondition is
+ enforced with an assertion.**
+
+ @since version 2.0.0
+ */
+ static void replace_substring(std::string& s, const std::string& f,
+ const std::string& t)
+ {
+ assert(not f.empty());
+ for (auto pos = s.find(f); // find first occurrence of f
+ pos != std::string::npos; // make sure f was found
+ s.replace(pos, f.size(), t), // replace with t, and
+ pos = s.find(f, pos + t.size())) // find next occurrence of f
+ {}
+ }
+
+ /// escape "~" to "~0" and "/" to "~1"
+ static std::string escape(std::string s)
+ {
+ replace_substring(s, "~", "~0");
+ replace_substring(s, "/", "~1");
+ return s;
+ }
+
+ /// unescape "~1" to tilde and "~0" to slash (order is important!)
+ static void unescape(std::string& s)
+ {
+ replace_substring(s, "~1", "/");
+ replace_substring(s, "~0", "~");
+ }
+
+ /*!
+ @param[in] reference_string the reference string to the current value
+ @param[in] value the value to consider
+ @param[in,out] result the result object to insert values to
+
+ @note Empty objects or arrays are flattened to `null`.
+ */
+ static void flatten(const std::string& reference_string,
+ const BasicJsonType& value,
+ BasicJsonType& result)
+ {
+ switch (value.m_type)
+ {
+ case detail::value_t::array:
+ {
+ if (value.m_value.array->empty())
+ {
+ // flatten empty array as null
+ result[reference_string] = nullptr;
+ }
+ else
+ {
+ // iterate array and use index as reference string
+ for (std::size_t i = 0; i < value.m_value.array->size(); ++i)
+ {
+ flatten(reference_string + "/" + std::to_string(i),
+ value.m_value.array->operator[](i), result);
+ }
+ }
+ break;
+ }
+
+ case detail::value_t::object:
+ {
+ if (value.m_value.object->empty())
+ {
+ // flatten empty object as null
+ result[reference_string] = nullptr;
+ }
+ else
+ {
+ // iterate object and use keys as reference string
+ for (const auto& element : *value.m_value.object)
+ {
+ flatten(reference_string + "/" + escape(element.first), element.second, result);
+ }
+ }
+ break;
+ }
+
+ default:
+ {
+ // add primitive value with its reference string
+ result[reference_string] = value;
+ break;
+ }
+ }
+ }
+
+ /*!
+ @param[in] value flattened JSON
+
+ @return unflattened JSON
+
+ @throw parse_error.109 if array index is not a number
+ @throw type_error.314 if value is not an object
+ @throw type_error.315 if object values are not primitive
+ @throw type_error.313 if value cannot be unflattened
+ */
+ static BasicJsonType
+ unflatten(const BasicJsonType& value)
+ {
+ if (JSON_UNLIKELY(not value.is_object()))
+ {
+ JSON_THROW(detail::type_error::create(314, "only objects can be unflattened"));
+ }
+
+ BasicJsonType result;
+
+ // iterate the JSON object values
+ for (const auto& element : *value.m_value.object)
+ {
+ if (JSON_UNLIKELY(not element.second.is_primitive()))
+ {
+ JSON_THROW(detail::type_error::create(315, "values in object must be primitive"));
+ }
+
+ // assign value to reference pointed to by JSON pointer; Note that if
+ // the JSON pointer is "" (i.e., points to the whole value), function
+ // get_and_create returns a reference to result itself. An assignment
+ // will then create a primitive value.
+ json_pointer(element.first).get_and_create(result) = element.second;
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief compares two JSON pointers for equality
+
+ @param[in] lhs JSON pointer to compare
+ @param[in] rhs JSON pointer to compare
+ @return whether @a lhs is equal to @a rhs
+
+ @complexity Linear in the length of the JSON pointer
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+ */
+ friend bool operator==(json_pointer const& lhs,
+ json_pointer const& rhs) noexcept
+ {
+ return lhs.reference_tokens == rhs.reference_tokens;
+ }
+
+ /*!
+ @brief compares two JSON pointers for inequality
+
+ @param[in] lhs JSON pointer to compare
+ @param[in] rhs JSON pointer to compare
+ @return whether @a lhs is not equal @a rhs
+
+ @complexity Linear in the length of the JSON pointer
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+ */
+ friend bool operator!=(json_pointer const& lhs,
+ json_pointer const& rhs) noexcept
+ {
+ return not (lhs == rhs);
+ }
+
+ /// the reference tokens
+ std::vector<std::string> reference_tokens;
+};
+} // namespace nlohmann
+
+// #include <nlohmann/detail/json_ref.hpp>
+
+
+#include <initializer_list>
+#include <utility>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template<typename BasicJsonType>
+class json_ref
+{
+ public:
+ using value_type = BasicJsonType;
+
+ json_ref(value_type&& value)
+ : owned_value(std::move(value)), value_ref(&owned_value), is_rvalue(true)
+ {}
+
+ json_ref(const value_type& value)
+ : value_ref(const_cast<value_type*>(&value)), is_rvalue(false)
+ {}
+
+ json_ref(std::initializer_list<json_ref> init)
+ : owned_value(init), value_ref(&owned_value), is_rvalue(true)
+ {}
+
+ template <
+ class... Args,
+ enable_if_t<std::is_constructible<value_type, Args...>::value, int> = 0 >
+ json_ref(Args && ... args)
+ : owned_value(std::forward<Args>(args)...), value_ref(&owned_value),
+ is_rvalue(true) {}
+
+ // class should be movable only
+ json_ref(json_ref&&) = default;
+ json_ref(const json_ref&) = delete;
+ json_ref& operator=(const json_ref&) = delete;
+ json_ref& operator=(json_ref&&) = delete;
+ ~json_ref() = default;
+
+ value_type moved_or_copied() const
+ {
+ if (is_rvalue)
+ {
+ return std::move(*value_ref);
+ }
+ return *value_ref;
+ }
+
+ value_type const& operator*() const
+ {
+ return *static_cast<value_type const*>(value_ref);
+ }
+
+ value_type const* operator->() const
+ {
+ return static_cast<value_type const*>(value_ref);
+ }
+
+ private:
+ mutable value_type owned_value = nullptr;
+ value_type* value_ref = nullptr;
+ const bool is_rvalue;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/output/binary_writer.hpp>
+
+
+#include <algorithm> // reverse
+#include <array> // array
+#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
+#include <cstring> // memcpy
+#include <limits> // numeric_limits
+#include <string> // string
+
+// #include <nlohmann/detail/input/binary_reader.hpp>
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+
+#include <algorithm> // copy
+#include <cstddef> // size_t
+#include <ios> // streamsize
+#include <iterator> // back_inserter
+#include <memory> // shared_ptr, make_shared
+#include <ostream> // basic_ostream
+#include <string> // basic_string
+#include <vector> // vector
+
+namespace nlohmann
+{
+namespace detail
+{
+/// abstract output adapter interface
+template<typename CharType> struct output_adapter_protocol
+{
+ virtual void write_character(CharType c) = 0;
+ virtual void write_characters(const CharType* s, std::size_t length) = 0;
+ virtual ~output_adapter_protocol() = default;
+};
+
+/// a type to simplify interfaces
+template<typename CharType>
+using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
+
+/// output adapter for byte vectors
+template<typename CharType>
+class output_vector_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
+ : v(vec)
+ {}
+
+ void write_character(CharType c) override
+ {
+ v.push_back(c);
+ }
+
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ std::copy(s, s + length, std::back_inserter(v));
+ }
+
+ private:
+ std::vector<CharType>& v;
+};
+
+/// output adapter for output streams
+template<typename CharType>
+class output_stream_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept
+ : stream(s)
+ {}
+
+ void write_character(CharType c) override
+ {
+ stream.put(c);
+ }
+
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ stream.write(s, static_cast<std::streamsize>(length));
+ }
+
+ private:
+ std::basic_ostream<CharType>& stream;
+};
+
+/// output adapter for basic_string
+template<typename CharType, typename StringType = std::basic_string<CharType>>
+class output_string_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_string_adapter(StringType& s) noexcept
+ : str(s)
+ {}
+
+ void write_character(CharType c) override
+ {
+ str.push_back(c);
+ }
+
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ str.append(s, length);
+ }
+
+ private:
+ StringType& str;
+};
+
+template<typename CharType, typename StringType = std::basic_string<CharType>>
+class output_adapter
+{
+ public:
+ output_adapter(std::vector<CharType>& vec)
+ : oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}
+
+ output_adapter(std::basic_ostream<CharType>& s)
+ : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {}
+
+ output_adapter(StringType& s)
+ : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {}
+
+ operator output_adapter_t<CharType>()
+ {
+ return oa;
+ }
+
+ private:
+ output_adapter_t<CharType> oa = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////
+// binary writer //
+///////////////////
+
+/*!
+@brief serialization to CBOR and MessagePack values
+*/
+template<typename BasicJsonType, typename CharType>
+class binary_writer
+{
+ using string_t = typename BasicJsonType::string_t;
+
+ public:
+ /*!
+ @brief create a binary writer
+
+ @param[in] adapter output adapter to write to
+ */
+ explicit binary_writer(output_adapter_t<CharType> adapter) : oa(adapter)
+ {
+ assert(oa);
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ void write_bson(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::object:
+ {
+ write_bson_object(*j.m_value.object);
+ break;
+ }
+
+ default:
+ {
+ JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name())));
+ }
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ */
+ void write_cbor(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ {
+ oa->write_character(to_char_type(0xF6));
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type(0xF5)
+ : to_char_type(0xF4));
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ if (j.m_value.number_integer >= 0)
+ {
+ // CBOR does not differentiate between positive signed
+ // integers and unsigned integers. Therefore, we used the
+ // code from the value_t::number_unsigned case here.
+ if (j.m_value.number_integer <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x18));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x19));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x1A));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x1B));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ }
+ else
+ {
+ // The conversions below encode the sign in the first
+ // byte, and the value is converted to a positive number.
+ const auto positive_number = -1 - j.m_value.number_integer;
+ if (j.m_value.number_integer >= -24)
+ {
+ write_number(static_cast<std::uint8_t>(0x20 + positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x38));
+ write_number(static_cast<std::uint8_t>(positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x39));
+ write_number(static_cast<std::uint16_t>(positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x3A));
+ write_number(static_cast<std::uint32_t>(positive_number));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x3B));
+ write_number(static_cast<std::uint64_t>(positive_number));
+ }
+ }
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x18));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x19));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x1A));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_unsigned));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x1B));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_unsigned));
+ }
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ oa->write_character(get_cbor_float_prefix(j.m_value.number_float));
+ write_number(j.m_value.number_float);
+ break;
+ }
+
+ case value_t::string:
+ {
+ // step 1: write control byte and the string length
+ const auto N = j.m_value.string->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0x60 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x78));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x79));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x7A));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0x7B));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write the string
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ // step 1: write control byte and the array size
+ const auto N = j.m_value.array->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0x80 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x98));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x99));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x9A));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0x9B));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.array)
+ {
+ write_cbor(el);
+ }
+ break;
+ }
+
+ case value_t::object:
+ {
+ // step 1: write control byte and the object size
+ const auto N = j.m_value.object->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0xA0 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0xB8));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0xB9));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0xBA));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0xBB));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.object)
+ {
+ write_cbor(el.first);
+ write_cbor(el.second);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ */
+ void write_msgpack(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::null: // nil
+ {
+ oa->write_character(to_char_type(0xC0));
+ break;
+ }
+
+ case value_t::boolean: // true and false
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type(0xC3)
+ : to_char_type(0xC2));
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ if (j.m_value.number_integer >= 0)
+ {
+ // MessagePack does not differentiate between positive
+ // signed integers and unsigned integers. Therefore, we used
+ // the code from the value_t::number_unsigned case here.
+ if (j.m_value.number_unsigned < 128)
+ {
+ // positive fixnum
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // uint 8
+ oa->write_character(to_char_type(0xCC));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // uint 16
+ oa->write_character(to_char_type(0xCD));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // uint 32
+ oa->write_character(to_char_type(0xCE));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ // uint 64
+ oa->write_character(to_char_type(0xCF));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ }
+ else
+ {
+ if (j.m_value.number_integer >= -32)
+ {
+ // negative fixnum
+ write_number(static_cast<std::int8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ // int 8
+ oa->write_character(to_char_type(0xD0));
+ write_number(static_cast<std::int8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ // int 16
+ oa->write_character(to_char_type(0xD1));
+ write_number(static_cast<std::int16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ // int 32
+ oa->write_character(to_char_type(0xD2));
+ write_number(static_cast<std::int32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
+ {
+ // int 64
+ oa->write_character(to_char_type(0xD3));
+ write_number(static_cast<std::int64_t>(j.m_value.number_integer));
+ }
+ }
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned < 128)
+ {
+ // positive fixnum
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // uint 8
+ oa->write_character(to_char_type(0xCC));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // uint 16
+ oa->write_character(to_char_type(0xCD));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // uint 32
+ oa->write_character(to_char_type(0xCE));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ // uint 64
+ oa->write_character(to_char_type(0xCF));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ oa->write_character(get_msgpack_float_prefix(j.m_value.number_float));
+ write_number(j.m_value.number_float);
+ break;
+ }
+
+ case value_t::string:
+ {
+ // step 1: write control byte and the string length
+ const auto N = j.m_value.string->size();
+ if (N <= 31)
+ {
+ // fixstr
+ write_number(static_cast<std::uint8_t>(0xA0 | N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // str 8
+ oa->write_character(to_char_type(0xD9));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // str 16
+ oa->write_character(to_char_type(0xDA));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // str 32
+ oa->write_character(to_char_type(0xDB));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write the string
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ // step 1: write control byte and the array size
+ const auto N = j.m_value.array->size();
+ if (N <= 15)
+ {
+ // fixarray
+ write_number(static_cast<std::uint8_t>(0x90 | N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // array 16
+ oa->write_character(to_char_type(0xDC));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // array 32
+ oa->write_character(to_char_type(0xDD));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.array)
+ {
+ write_msgpack(el);
+ }
+ break;
+ }
+
+ case value_t::object:
+ {
+ // step 1: write control byte and the object size
+ const auto N = j.m_value.object->size();
+ if (N <= 15)
+ {
+ // fixmap
+ write_number(static_cast<std::uint8_t>(0x80 | (N & 0xF)));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // map 16
+ oa->write_character(to_char_type(0xDE));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // map 32
+ oa->write_character(to_char_type(0xDF));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.object)
+ {
+ write_msgpack(el.first);
+ write_msgpack(el.second);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @param[in] use_count whether to use '#' prefixes (optimized format)
+ @param[in] use_type whether to use '$' prefixes (optimized format)
+ @param[in] add_prefix whether prefixes need to be used for this value
+ */
+ void write_ubjson(const BasicJsonType& j, const bool use_count,
+ const bool use_type, const bool add_prefix = true)
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('Z'));
+ }
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type('T')
+ : to_char_type('F'));
+ }
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix);
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix);
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix);
+ break;
+ }
+
+ case value_t::string:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('S'));
+ }
+ write_number_with_ubjson_prefix(j.m_value.string->size(), true);
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('['));
+ }
+
+ bool prefix_required = true;
+ if (use_type and not j.m_value.array->empty())
+ {
+ assert(use_count);
+ const CharType first_prefix = ubjson_prefix(j.front());
+ const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
+ [this, first_prefix](const BasicJsonType & v)
+ {
+ return ubjson_prefix(v) == first_prefix;
+ });
+
+ if (same_prefix)
+ {
+ prefix_required = false;
+ oa->write_character(to_char_type('$'));
+ oa->write_character(first_prefix);
+ }
+ }
+
+ if (use_count)
+ {
+ oa->write_character(to_char_type('#'));
+ write_number_with_ubjson_prefix(j.m_value.array->size(), true);
+ }
+
+ for (const auto& el : *j.m_value.array)
+ {
+ write_ubjson(el, use_count, use_type, prefix_required);
+ }
+
+ if (not use_count)
+ {
+ oa->write_character(to_char_type(']'));
+ }
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('{'));
+ }
+
+ bool prefix_required = true;
+ if (use_type and not j.m_value.object->empty())
+ {
+ assert(use_count);
+ const CharType first_prefix = ubjson_prefix(j.front());
+ const bool same_prefix = std::all_of(j.begin(), j.end(),
+ [this, first_prefix](const BasicJsonType & v)
+ {
+ return ubjson_prefix(v) == first_prefix;
+ });
+
+ if (same_prefix)
+ {
+ prefix_required = false;
+ oa->write_character(to_char_type('$'));
+ oa->write_character(first_prefix);
+ }
+ }
+
+ if (use_count)
+ {
+ oa->write_character(to_char_type('#'));
+ write_number_with_ubjson_prefix(j.m_value.object->size(), true);
+ }
+
+ for (const auto& el : *j.m_value.object)
+ {
+ write_number_with_ubjson_prefix(el.first.size(), true);
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(el.first.c_str()),
+ el.first.size());
+ write_ubjson(el.second, use_count, use_type, prefix_required);
+ }
+
+ if (not use_count)
+ {
+ oa->write_character(to_char_type('}'));
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ private:
+ //////////
+ // BSON //
+ //////////
+
+ /*!
+ @return The size of a BSON document entry header, including the id marker
+ and the entry name size (and its null-terminator).
+ */
+ static std::size_t calc_bson_entry_header_size(const string_t& name)
+ {
+ const auto it = name.find(static_cast<typename string_t::value_type>(0));
+ if (JSON_UNLIKELY(it != BasicJsonType::string_t::npos))
+ {
+ JSON_THROW(out_of_range::create(409,
+ "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")"));
+ }
+
+ return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
+ }
+
+ /*!
+ @brief Writes the given @a element_type and @a name to the output adapter
+ */
+ void write_bson_entry_header(const string_t& name,
+ const std::uint8_t element_type)
+ {
+ oa->write_character(to_char_type(element_type)); // boolean
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(name.c_str()),
+ name.size() + 1u);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and boolean value @a value
+ */
+ void write_bson_boolean(const string_t& name,
+ const bool value)
+ {
+ write_bson_entry_header(name, 0x08);
+ oa->write_character(value ? to_char_type(0x01) : to_char_type(0x00));
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and double value @a value
+ */
+ void write_bson_double(const string_t& name,
+ const double value)
+ {
+ write_bson_entry_header(name, 0x01);
+ write_number<double, true>(value);
+ }
+
+ /*!
+ @return The size of the BSON-encoded string in @a value
+ */
+ static std::size_t calc_bson_string_size(const string_t& value)
+ {
+ return sizeof(std::int32_t) + value.size() + 1ul;
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and string value @a value
+ */
+ void write_bson_string(const string_t& name,
+ const string_t& value)
+ {
+ write_bson_entry_header(name, 0x02);
+
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value.size() + 1ul));
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(value.c_str()),
+ value.size() + 1);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and null value
+ */
+ void write_bson_null(const string_t& name)
+ {
+ write_bson_entry_header(name, 0x0A);
+ }
+
+ /*!
+ @return The size of the BSON-encoded integer @a value
+ */
+ static std::size_t calc_bson_integer_size(const std::int64_t value)
+ {
+ return (std::numeric_limits<std::int32_t>::min)() <= value and value <= (std::numeric_limits<std::int32_t>::max)()
+ ? sizeof(std::int32_t)
+ : sizeof(std::int64_t);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and integer @a value
+ */
+ void write_bson_integer(const string_t& name,
+ const std::int64_t value)
+ {
+ if ((std::numeric_limits<std::int32_t>::min)() <= value and value <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ write_bson_entry_header(name, 0x10); // int32
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value));
+ }
+ else
+ {
+ write_bson_entry_header(name, 0x12); // int64
+ write_number<std::int64_t, true>(static_cast<std::int64_t>(value));
+ }
+ }
+
+ /*!
+ @return The size of the BSON-encoded unsigned integer in @a j
+ */
+ static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
+ {
+ return (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ ? sizeof(std::int32_t)
+ : sizeof(std::int64_t);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and unsigned @a value
+ */
+ void write_bson_unsigned(const string_t& name,
+ const std::uint64_t value)
+ {
+ if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ {
+ write_bson_entry_header(name, 0x10 /* int32 */);
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value));
+ }
+ else if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
+ {
+ write_bson_entry_header(name, 0x12 /* int64 */);
+ write_number<std::int64_t, true>(static_cast<std::int64_t>(value));
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(value) + " cannot be represented by BSON as it does not fit int64"));
+ }
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and object @a value
+ */
+ void write_bson_object_entry(const string_t& name,
+ const typename BasicJsonType::object_t& value)
+ {
+ write_bson_entry_header(name, 0x03); // object
+ write_bson_object(value);
+ }
+
+ /*!
+ @return The size of the BSON-encoded array @a value
+ */
+ static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value)
+ {
+ std::size_t embedded_document_size = 0ul;
+ std::size_t array_index = 0ul;
+
+ for (const auto& el : value)
+ {
+ embedded_document_size += calc_bson_element_size(std::to_string(array_index++), el);
+ }
+
+ return sizeof(std::int32_t) + embedded_document_size + 1ul;
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and array @a value
+ */
+ void write_bson_array(const string_t& name,
+ const typename BasicJsonType::array_t& value)
+ {
+ write_bson_entry_header(name, 0x04); // array
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_array_size(value)));
+
+ std::size_t array_index = 0ul;
+
+ for (const auto& el : value)
+ {
+ write_bson_element(std::to_string(array_index++), el);
+ }
+
+ oa->write_character(to_char_type(0x00));
+ }
+
+ /*!
+ @brief Calculates the size necessary to serialize the JSON value @a j with its @a name
+ @return The calculated size for the BSON document entry for @a j with the given @a name.
+ */
+ static std::size_t calc_bson_element_size(const string_t& name,
+ const BasicJsonType& j)
+ {
+ const auto header_size = calc_bson_entry_header_size(name);
+ switch (j.type())
+ {
+ case value_t::object:
+ return header_size + calc_bson_object_size(*j.m_value.object);
+
+ case value_t::array:
+ return header_size + calc_bson_array_size(*j.m_value.array);
+
+ case value_t::boolean:
+ return header_size + 1ul;
+
+ case value_t::number_float:
+ return header_size + 8ul;
+
+ case value_t::number_integer:
+ return header_size + calc_bson_integer_size(j.m_value.number_integer);
+
+ case value_t::number_unsigned:
+ return header_size + calc_bson_unsigned_size(j.m_value.number_unsigned);
+
+ case value_t::string:
+ return header_size + calc_bson_string_size(*j.m_value.string);
+
+ case value_t::null:
+ return header_size + 0ul;
+
+ // LCOV_EXCL_START
+ default:
+ assert(false);
+ return 0ul;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /*!
+ @brief Serializes the JSON value @a j to BSON and associates it with the
+ key @a name.
+ @param name The name to associate with the JSON entity @a j within the
+ current BSON document
+ @return The size of the BSON entry
+ */
+ void write_bson_element(const string_t& name,
+ const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::object:
+ return write_bson_object_entry(name, *j.m_value.object);
+
+ case value_t::array:
+ return write_bson_array(name, *j.m_value.array);
+
+ case value_t::boolean:
+ return write_bson_boolean(name, j.m_value.boolean);
+
+ case value_t::number_float:
+ return write_bson_double(name, j.m_value.number_float);
+
+ case value_t::number_integer:
+ return write_bson_integer(name, j.m_value.number_integer);
+
+ case value_t::number_unsigned:
+ return write_bson_unsigned(name, j.m_value.number_unsigned);
+
+ case value_t::string:
+ return write_bson_string(name, *j.m_value.string);
+
+ case value_t::null:
+ return write_bson_null(name);
+
+ // LCOV_EXCL_START
+ default:
+ assert(false);
+ return;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /*!
+ @brief Calculates the size of the BSON serialization of the given
+ JSON-object @a j.
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
+ {
+ std::size_t document_size = std::accumulate(value.begin(), value.end(), 0ul,
+ [](size_t result, const typename BasicJsonType::object_t::value_type & el)
+ {
+ return result += calc_bson_element_size(el.first, el.second);
+ });
+
+ return sizeof(std::int32_t) + document_size + 1ul;
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ void write_bson_object(const typename BasicJsonType::object_t& value)
+ {
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_object_size(value)));
+
+ for (const auto& el : value)
+ {
+ write_bson_element(el.first, el.second);
+ }
+
+ oa->write_character(to_char_type(0x00));
+ }
+
+ //////////
+ // CBOR //
+ //////////
+
+ static constexpr CharType get_cbor_float_prefix(float /*unused*/)
+ {
+ return to_char_type(0xFA); // Single-Precision Float
+ }
+
+ static constexpr CharType get_cbor_float_prefix(double /*unused*/)
+ {
+ return to_char_type(0xFB); // Double-Precision Float
+ }
+
+ /////////////
+ // MsgPack //
+ /////////////
+
+ static constexpr CharType get_msgpack_float_prefix(float /*unused*/)
+ {
+ return to_char_type(0xCA); // float 32
+ }
+
+ static constexpr CharType get_msgpack_float_prefix(double /*unused*/)
+ {
+ return to_char_type(0xCB); // float 64
+ }
+
+ ////////////
+ // UBJSON //
+ ////////////
+
+ // UBJSON: write number (floating point)
+ template<typename NumberType, typename std::enable_if<
+ std::is_floating_point<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if (add_prefix)
+ {
+ oa->write_character(get_ubjson_float_prefix(n));
+ }
+ write_number(n);
+ }
+
+ // UBJSON: write number (unsigned integer)
+ template<typename NumberType, typename std::enable_if<
+ std::is_unsigned<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('i')); // int8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if (n <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('U')); // uint8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('I')); // int16
+ }
+ write_number(static_cast<std::int16_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('l')); // int32
+ }
+ write_number(static_cast<std::int32_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('L')); // int64
+ }
+ write_number(static_cast<std::int64_t>(n));
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(n) + " cannot be represented by UBJSON as it does not fit int64"));
+ }
+ }
+
+ // UBJSON: write number (signed integer)
+ template<typename NumberType, typename std::enable_if<
+ std::is_signed<NumberType>::value and
+ not std::is_floating_point<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if ((std::numeric_limits<std::int8_t>::min)() <= n and n <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('i')); // int8
+ }
+ write_number(static_cast<std::int8_t>(n));
+ }
+ else if (static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::min)()) <= n and n <= static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('U')); // uint8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if ((std::numeric_limits<std::int16_t>::min)() <= n and n <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('I')); // int16
+ }
+ write_number(static_cast<std::int16_t>(n));
+ }
+ else if ((std::numeric_limits<std::int32_t>::min)() <= n and n <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('l')); // int32
+ }
+ write_number(static_cast<std::int32_t>(n));
+ }
+ else if ((std::numeric_limits<std::int64_t>::min)() <= n and n <= (std::numeric_limits<std::int64_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('L')); // int64
+ }
+ write_number(static_cast<std::int64_t>(n));
+ }
+ // LCOV_EXCL_START
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(n) + " cannot be represented by UBJSON as it does not fit int64"));
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ /*!
+ @brief determine the type prefix of container values
+
+ @note This function does not need to be 100% accurate when it comes to
+ integer limits. In case a number exceeds the limits of int64_t,
+ this will be detected by a later call to function
+ write_number_with_ubjson_prefix. Therefore, we return 'L' for any
+ value that does not fit the previous limits.
+ */
+ CharType ubjson_prefix(const BasicJsonType& j) const noexcept
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ return 'Z';
+
+ case value_t::boolean:
+ return j.m_value.boolean ? 'T' : 'F';
+
+ case value_t::number_integer:
+ {
+ if ((std::numeric_limits<std::int8_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ return 'i';
+ }
+ if ((std::numeric_limits<std::uint8_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ return 'U';
+ }
+ if ((std::numeric_limits<std::int16_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ return 'I';
+ }
+ if ((std::numeric_limits<std::int32_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ return 'l';
+ }
+ // no check and assume int64_t (see note above)
+ return 'L';
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ return 'i';
+ }
+ if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ return 'U';
+ }
+ if (j.m_value.number_unsigned <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ return 'I';
+ }
+ if (j.m_value.number_unsigned <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ return 'l';
+ }
+ // no check and assume int64_t (see note above)
+ return 'L';
+ }
+
+ case value_t::number_float:
+ return get_ubjson_float_prefix(j.m_value.number_float);
+
+ case value_t::string:
+ return 'S';
+
+ case value_t::array:
+ return '[';
+
+ case value_t::object:
+ return '{';
+
+ default: // discarded values
+ return 'N';
+ }
+ }
+
+ static constexpr CharType get_ubjson_float_prefix(float /*unused*/)
+ {
+ return 'd'; // float 32
+ }
+
+ static constexpr CharType get_ubjson_float_prefix(double /*unused*/)
+ {
+ return 'D'; // float 64
+ }
+
+ ///////////////////////
+ // Utility functions //
+ ///////////////////////
+
+ /*
+ @brief write a number to output input
+ @param[in] n number of type @a NumberType
+ @tparam NumberType the type of the number
+ @tparam OutputIsLittleEndian Set to true if output data is
+ required to be little endian
+
+ @note This function needs to respect the system's endianness, because bytes
+ in CBOR, MessagePack, and UBJSON are stored in network order (big
+ endian) and therefore need reordering on little endian systems.
+ */
+ template<typename NumberType, bool OutputIsLittleEndian = false>
+ void write_number(const NumberType n)
+ {
+ // step 1: write number to array of length NumberType
+ std::array<CharType, sizeof(NumberType)> vec;
+ std::memcpy(vec.data(), &n, sizeof(NumberType));
+
+ // step 2: write array to output (with possible reordering)
+ if (is_little_endian != OutputIsLittleEndian)
+ {
+ // reverse byte order prior to conversion if necessary
+ std::reverse(vec.begin(), vec.end());
+ }
+
+ oa->write_characters(vec.data(), sizeof(NumberType));
+ }
+
+ public:
+ // The following to_char_type functions are implement the conversion
+ // between uint8_t and CharType. In case CharType is not unsigned,
+ // such a conversion is required to allow values greater than 128.
+ // See <https://github.com/nlohmann/json/issues/1286> for a discussion.
+ template < typename C = CharType,
+ enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr >
+ static constexpr CharType to_char_type(std::uint8_t x) noexcept
+ {
+ return *reinterpret_cast<char*>(&x);
+ }
+
+ template < typename C = CharType,
+ enable_if_t < std::is_signed<C>::value and std::is_unsigned<char>::value > * = nullptr >
+ static CharType to_char_type(std::uint8_t x) noexcept
+ {
+ static_assert(sizeof(std::uint8_t) == sizeof(CharType), "size of CharType must be equal to std::uint8_t");
+ static_assert(std::is_pod<CharType>::value, "CharType must be POD");
+ CharType result;
+ std::memcpy(&result, &x, sizeof(x));
+ return result;
+ }
+
+ template<typename C = CharType,
+ enable_if_t<std::is_unsigned<C>::value>* = nullptr>
+ static constexpr CharType to_char_type(std::uint8_t x) noexcept
+ {
+ return x;
+ }
+
+ template < typename InputCharType, typename C = CharType,
+ enable_if_t <
+ std::is_signed<C>::value and
+ std::is_signed<char>::value and
+ std::is_same<char, typename std::remove_cv<InputCharType>::type>::value
+ > * = nullptr >
+ static constexpr CharType to_char_type(InputCharType x) noexcept
+ {
+ return x;
+ }
+
+ private:
+ /// whether we can assume little endianness
+ const bool is_little_endian = binary_reader<BasicJsonType>::little_endianess();
+
+ /// the output
+ output_adapter_t<CharType> oa = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+// #include <nlohmann/detail/output/serializer.hpp>
+
+
+#include <algorithm> // reverse, remove, fill, find, none_of
+#include <array> // array
+#include <cassert> // assert
+#include <ciso646> // and, or
+#include <clocale> // localeconv, lconv
+#include <cmath> // labs, isfinite, isnan, signbit
+#include <cstddef> // size_t, ptrdiff_t
+#include <cstdint> // uint8_t
+#include <cstdio> // snprintf
+#include <limits> // numeric_limits
+#include <string> // string
+#include <type_traits> // is_same
+#include <utility> // move
+
+// #include <nlohmann/detail/conversions/to_chars.hpp>
+
+
+#include <array> // array
+#include <cassert> // assert
+#include <ciso646> // or, and, not
+#include <cmath> // signbit, isfinite
+#include <cstdint> // intN_t, uintN_t
+#include <cstring> // memcpy, memmove
+#include <limits> // numeric_limits
+#include <type_traits> // conditional
+
+namespace nlohmann
+{
+namespace detail
+{
+
+/*!
+@brief implements the Grisu2 algorithm for binary to decimal floating-point
+conversion.
+
+This implementation is a slightly modified version of the reference
+implementation which may be obtained from
+http://florian.loitsch.com/publications (bench.tar.gz).
+
+The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch.
+
+For a detailed description of the algorithm see:
+
+[1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with
+ Integers", Proceedings of the ACM SIGPLAN 2010 Conference on Programming
+ Language Design and Implementation, PLDI 2010
+[2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately",
+ Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language
+ Design and Implementation, PLDI 1996
+*/
+namespace dtoa_impl
+{
+
+template <typename Target, typename Source>
+Target reinterpret_bits(const Source source)
+{
+ static_assert(sizeof(Target) == sizeof(Source), "size mismatch");
+
+ Target target;
+ std::memcpy(&target, &source, sizeof(Source));
+ return target;
+}
+
+struct diyfp // f * 2^e
+{
+ static constexpr int kPrecision = 64; // = q
+
+ std::uint64_t f = 0;
+ int e = 0;
+
+ constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_) {}
+
+ /*!
+ @brief returns x - y
+ @pre x.e == y.e and x.f >= y.f
+ */
+ static diyfp sub(const diyfp& x, const diyfp& y) noexcept
+ {
+ assert(x.e == y.e);
+ assert(x.f >= y.f);
+
+ return {x.f - y.f, x.e};
+ }
+
+ /*!
+ @brief returns x * y
+ @note The result is rounded. (Only the upper q bits are returned.)
+ */
+ static diyfp mul(const diyfp& x, const diyfp& y) noexcept
+ {
+ static_assert(kPrecision == 64, "internal error");
+
+ // Computes:
+ // f = round((x.f * y.f) / 2^q)
+ // e = x.e + y.e + q
+
+ // Emulate the 64-bit * 64-bit multiplication:
+ //
+ // p = u * v
+ // = (u_lo + 2^32 u_hi) (v_lo + 2^32 v_hi)
+ // = (u_lo v_lo ) + 2^32 ((u_lo v_hi ) + (u_hi v_lo )) + 2^64 (u_hi v_hi )
+ // = (p0 ) + 2^32 ((p1 ) + (p2 )) + 2^64 (p3 )
+ // = (p0_lo + 2^32 p0_hi) + 2^32 ((p1_lo + 2^32 p1_hi) + (p2_lo + 2^32 p2_hi)) + 2^64 (p3 )
+ // = (p0_lo ) + 2^32 (p0_hi + p1_lo + p2_lo ) + 2^64 (p1_hi + p2_hi + p3)
+ // = (p0_lo ) + 2^32 (Q ) + 2^64 (H )
+ // = (p0_lo ) + 2^32 (Q_lo + 2^32 Q_hi ) + 2^64 (H )
+ //
+ // (Since Q might be larger than 2^32 - 1)
+ //
+ // = (p0_lo + 2^32 Q_lo) + 2^64 (Q_hi + H)
+ //
+ // (Q_hi + H does not overflow a 64-bit int)
+ //
+ // = p_lo + 2^64 p_hi
+
+ const std::uint64_t u_lo = x.f & 0xFFFFFFFFu;
+ const std::uint64_t u_hi = x.f >> 32u;
+ const std::uint64_t v_lo = y.f & 0xFFFFFFFFu;
+ const std::uint64_t v_hi = y.f >> 32u;
+
+ const std::uint64_t p0 = u_lo * v_lo;
+ const std::uint64_t p1 = u_lo * v_hi;
+ const std::uint64_t p2 = u_hi * v_lo;
+ const std::uint64_t p3 = u_hi * v_hi;
+
+ const std::uint64_t p0_hi = p0 >> 32u;
+ const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;
+ const std::uint64_t p1_hi = p1 >> 32u;
+ const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;
+ const std::uint64_t p2_hi = p2 >> 32u;
+
+ std::uint64_t Q = p0_hi + p1_lo + p2_lo;
+
+ // The full product might now be computed as
+ //
+ // p_hi = p3 + p2_hi + p1_hi + (Q >> 32)
+ // p_lo = p0_lo + (Q << 32)
+ //
+ // But in this particular case here, the full p_lo is not required.
+ // Effectively we only need to add the highest bit in p_lo to p_hi (and
+ // Q_hi + 1 does not overflow).
+
+ Q += std::uint64_t{1} << (64u - 32u - 1u); // round, ties up
+
+ const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);
+
+ return {h, x.e + y.e + 64};
+ }
+
+ /*!
+ @brief normalize x such that the significand is >= 2^(q-1)
+ @pre x.f != 0
+ */
+ static diyfp normalize(diyfp x) noexcept
+ {
+ assert(x.f != 0);
+
+ while ((x.f >> 63u) == 0)
+ {
+ x.f <<= 1u;
+ x.e--;
+ }
+
+ return x;
+ }
+
+ /*!
+ @brief normalize x such that the result has the exponent E
+ @pre e >= x.e and the upper e - x.e bits of x.f must be zero.
+ */
+ static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept
+ {
+ const int delta = x.e - target_exponent;
+
+ assert(delta >= 0);
+ assert(((x.f << delta) >> delta) == x.f);
+
+ return {x.f << delta, target_exponent};
+ }
+};
+
+struct boundaries
+{
+ diyfp w;
+ diyfp minus;
+ diyfp plus;
+};
+
+/*!
+Compute the (normalized) diyfp representing the input number 'value' and its
+boundaries.
+
+@pre value must be finite and positive
+*/
+template <typename FloatType>
+boundaries compute_boundaries(FloatType value)
+{
+ assert(std::isfinite(value));
+ assert(value > 0);
+
+ // Convert the IEEE representation into a diyfp.
+ //
+ // If v is denormal:
+ // value = 0.F * 2^(1 - bias) = ( F) * 2^(1 - bias - (p-1))
+ // If v is normalized:
+ // value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1))
+
+ static_assert(std::numeric_limits<FloatType>::is_iec559,
+ "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
+
+ constexpr int kPrecision = std::numeric_limits<FloatType>::digits; // = p (includes the hidden bit)
+ constexpr int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
+ constexpr int kMinExp = 1 - kBias;
+ constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1); // = 2^(p-1)
+
+ using bits_type = typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;
+
+ const std::uint64_t bits = reinterpret_bits<bits_type>(value);
+ const std::uint64_t E = bits >> (kPrecision - 1);
+ const std::uint64_t F = bits & (kHiddenBit - 1);
+
+ const bool is_denormal = E == 0;
+ const diyfp v = is_denormal
+ ? diyfp(F, kMinExp)
+ : diyfp(F + kHiddenBit, static_cast<int>(E) - kBias);
+
+ // Compute the boundaries m- and m+ of the floating-point value
+ // v = f * 2^e.
+ //
+ // Determine v- and v+, the floating-point predecessor and successor if v,
+ // respectively.
+ //
+ // v- = v - 2^e if f != 2^(p-1) or e == e_min (A)
+ // = v - 2^(e-1) if f == 2^(p-1) and e > e_min (B)
+ //
+ // v+ = v + 2^e
+ //
+ // Let m- = (v- + v) / 2 and m+ = (v + v+) / 2. All real numbers _strictly_
+ // between m- and m+ round to v, regardless of how the input rounding
+ // algorithm breaks ties.
+ //
+ // ---+-------------+-------------+-------------+-------------+--- (A)
+ // v- m- v m+ v+
+ //
+ // -----------------+------+------+-------------+-------------+--- (B)
+ // v- m- v m+ v+
+
+ const bool lower_boundary_is_closer = F == 0 and E > 1;
+ const diyfp m_plus = diyfp(2 * v.f + 1, v.e - 1);
+ const diyfp m_minus = lower_boundary_is_closer
+ ? diyfp(4 * v.f - 1, v.e - 2) // (B)
+ : diyfp(2 * v.f - 1, v.e - 1); // (A)
+
+ // Determine the normalized w+ = m+.
+ const diyfp w_plus = diyfp::normalize(m_plus);
+
+ // Determine w- = m- such that e_(w-) = e_(w+).
+ const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.e);
+
+ return {diyfp::normalize(v), w_minus, w_plus};
+}
+
+// Given normalized diyfp w, Grisu needs to find a (normalized) cached
+// power-of-ten c, such that the exponent of the product c * w = f * 2^e lies
+// within a certain range [alpha, gamma] (Definition 3.2 from [1])
+//
+// alpha <= e = e_c + e_w + q <= gamma
+//
+// or
+//
+// f_c * f_w * 2^alpha <= f_c 2^(e_c) * f_w 2^(e_w) * 2^q
+// <= f_c * f_w * 2^gamma
+//
+// Since c and w are normalized, i.e. 2^(q-1) <= f < 2^q, this implies
+//
+// 2^(q-1) * 2^(q-1) * 2^alpha <= c * w * 2^q < 2^q * 2^q * 2^gamma
+//
+// or
+//
+// 2^(q - 2 + alpha) <= c * w < 2^(q + gamma)
+//
+// The choice of (alpha,gamma) determines the size of the table and the form of
+// the digit generation procedure. Using (alpha,gamma)=(-60,-32) works out well
+// in practice:
+//
+// The idea is to cut the number c * w = f * 2^e into two parts, which can be
+// processed independently: An integral part p1, and a fractional part p2:
+//
+// f * 2^e = ( (f div 2^-e) * 2^-e + (f mod 2^-e) ) * 2^e
+// = (f div 2^-e) + (f mod 2^-e) * 2^e
+// = p1 + p2 * 2^e
+//
+// The conversion of p1 into decimal form requires a series of divisions and
+// modulos by (a power of) 10. These operations are faster for 32-bit than for
+// 64-bit integers, so p1 should ideally fit into a 32-bit integer. This can be
+// achieved by choosing
+//
+// -e >= 32 or e <= -32 := gamma
+//
+// In order to convert the fractional part
+//
+// p2 * 2^e = p2 / 2^-e = d[-1] / 10^1 + d[-2] / 10^2 + ...
+//
+// into decimal form, the fraction is repeatedly multiplied by 10 and the digits
+// d[-i] are extracted in order:
+//
+// (10 * p2) div 2^-e = d[-1]
+// (10 * p2) mod 2^-e = d[-2] / 10^1 + ...
+//
+// The multiplication by 10 must not overflow. It is sufficient to choose
+//
+// 10 * p2 < 16 * p2 = 2^4 * p2 <= 2^64.
+//
+// Since p2 = f mod 2^-e < 2^-e,
+//
+// -e <= 60 or e >= -60 := alpha
+
+constexpr int kAlpha = -60;
+constexpr int kGamma = -32;
+
+struct cached_power // c = f * 2^e ~= 10^k
+{
+ std::uint64_t f;
+ int e;
+ int k;
+};
+
+/*!
+For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached
+power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c
+satisfies (Definition 3.2 from [1])
+
+ alpha <= e_c + e + q <= gamma.
+*/
+inline cached_power get_cached_power_for_binary_exponent(int e)
+{
+ // Now
+ //
+ // alpha <= e_c + e + q <= gamma (1)
+ // ==> f_c * 2^alpha <= c * 2^e * 2^q
+ //
+ // and since the c's are normalized, 2^(q-1) <= f_c,
+ //
+ // ==> 2^(q - 1 + alpha) <= c * 2^(e + q)
+ // ==> 2^(alpha - e - 1) <= c
+ //
+ // If c were an exakt power of ten, i.e. c = 10^k, one may determine k as
+ //
+ // k = ceil( log_10( 2^(alpha - e - 1) ) )
+ // = ceil( (alpha - e - 1) * log_10(2) )
+ //
+ // From the paper:
+ // "In theory the result of the procedure could be wrong since c is rounded,
+ // and the computation itself is approximated [...]. In practice, however,
+ // this simple function is sufficient."
+ //
+ // For IEEE double precision floating-point numbers converted into
+ // normalized diyfp's w = f * 2^e, with q = 64,
+ //
+ // e >= -1022 (min IEEE exponent)
+ // -52 (p - 1)
+ // -52 (p - 1, possibly normalize denormal IEEE numbers)
+ // -11 (normalize the diyfp)
+ // = -1137
+ //
+ // and
+ //
+ // e <= +1023 (max IEEE exponent)
+ // -52 (p - 1)
+ // -11 (normalize the diyfp)
+ // = 960
+ //
+ // This binary exponent range [-1137,960] results in a decimal exponent
+ // range [-307,324]. One does not need to store a cached power for each
+ // k in this range. For each such k it suffices to find a cached power
+ // such that the exponent of the product lies in [alpha,gamma].
+ // This implies that the difference of the decimal exponents of adjacent
+ // table entries must be less than or equal to
+ //
+ // floor( (gamma - alpha) * log_10(2) ) = 8.
+ //
+ // (A smaller distance gamma-alpha would require a larger table.)
+
+ // NB:
+ // Actually this function returns c, such that -60 <= e_c + e + 64 <= -34.
+
+ constexpr int kCachedPowersMinDecExp = -300;
+ constexpr int kCachedPowersDecStep = 8;
+
+ static constexpr std::array<cached_power, 79> kCachedPowers =
+ {
+ {
+ { 0xAB70FE17C79AC6CA, -1060, -300 },
+ { 0xFF77B1FCBEBCDC4F, -1034, -292 },
+ { 0xBE5691EF416BD60C, -1007, -284 },
+ { 0x8DD01FAD907FFC3C, -980, -276 },
+ { 0xD3515C2831559A83, -954, -268 },
+ { 0x9D71AC8FADA6C9B5, -927, -260 },
+ { 0xEA9C227723EE8BCB, -901, -252 },
+ { 0xAECC49914078536D, -874, -244 },
+ { 0x823C12795DB6CE57, -847, -236 },
+ { 0xC21094364DFB5637, -821, -228 },
+ { 0x9096EA6F3848984F, -794, -220 },
+ { 0xD77485CB25823AC7, -768, -212 },
+ { 0xA086CFCD97BF97F4, -741, -204 },
+ { 0xEF340A98172AACE5, -715, -196 },
+ { 0xB23867FB2A35B28E, -688, -188 },
+ { 0x84C8D4DFD2C63F3B, -661, -180 },
+ { 0xC5DD44271AD3CDBA, -635, -172 },
+ { 0x936B9FCEBB25C996, -608, -164 },
+ { 0xDBAC6C247D62A584, -582, -156 },
+ { 0xA3AB66580D5FDAF6, -555, -148 },
+ { 0xF3E2F893DEC3F126, -529, -140 },
+ { 0xB5B5ADA8AAFF80B8, -502, -132 },
+ { 0x87625F056C7C4A8B, -475, -124 },
+ { 0xC9BCFF6034C13053, -449, -116 },
+ { 0x964E858C91BA2655, -422, -108 },
+ { 0xDFF9772470297EBD, -396, -100 },
+ { 0xA6DFBD9FB8E5B88F, -369, -92 },
+ { 0xF8A95FCF88747D94, -343, -84 },
+ { 0xB94470938FA89BCF, -316, -76 },
+ { 0x8A08F0F8BF0F156B, -289, -68 },
+ { 0xCDB02555653131B6, -263, -60 },
+ { 0x993FE2C6D07B7FAC, -236, -52 },
+ { 0xE45C10C42A2B3B06, -210, -44 },
+ { 0xAA242499697392D3, -183, -36 },
+ { 0xFD87B5F28300CA0E, -157, -28 },
+ { 0xBCE5086492111AEB, -130, -20 },
+ { 0x8CBCCC096F5088CC, -103, -12 },
+ { 0xD1B71758E219652C, -77, -4 },
+ { 0x9C40000000000000, -50, 4 },
+ { 0xE8D4A51000000000, -24, 12 },
+ { 0xAD78EBC5AC620000, 3, 20 },
+ { 0x813F3978F8940984, 30, 28 },
+ { 0xC097CE7BC90715B3, 56, 36 },
+ { 0x8F7E32CE7BEA5C70, 83, 44 },
+ { 0xD5D238A4ABE98068, 109, 52 },
+ { 0x9F4F2726179A2245, 136, 60 },
+ { 0xED63A231D4C4FB27, 162, 68 },
+ { 0xB0DE65388CC8ADA8, 189, 76 },
+ { 0x83C7088E1AAB65DB, 216, 84 },
+ { 0xC45D1DF942711D9A, 242, 92 },
+ { 0x924D692CA61BE758, 269, 100 },
+ { 0xDA01EE641A708DEA, 295, 108 },
+ { 0xA26DA3999AEF774A, 322, 116 },
+ { 0xF209787BB47D6B85, 348, 124 },
+ { 0xB454E4A179DD1877, 375, 132 },
+ { 0x865B86925B9BC5C2, 402, 140 },
+ { 0xC83553C5C8965D3D, 428, 148 },
+ { 0x952AB45CFA97A0B3, 455, 156 },
+ { 0xDE469FBD99A05FE3, 481, 164 },
+ { 0xA59BC234DB398C25, 508, 172 },
+ { 0xF6C69A72A3989F5C, 534, 180 },
+ { 0xB7DCBF5354E9BECE, 561, 188 },
+ { 0x88FCF317F22241E2, 588, 196 },
+ { 0xCC20CE9BD35C78A5, 614, 204 },
+ { 0x98165AF37B2153DF, 641, 212 },
+ { 0xE2A0B5DC971F303A, 667, 220 },
+ { 0xA8D9D1535CE3B396, 694, 228 },
+ { 0xFB9B7CD9A4A7443C, 720, 236 },
+ { 0xBB764C4CA7A44410, 747, 244 },
+ { 0x8BAB8EEFB6409C1A, 774, 252 },
+ { 0xD01FEF10A657842C, 800, 260 },
+ { 0x9B10A4E5E9913129, 827, 268 },
+ { 0xE7109BFBA19C0C9D, 853, 276 },
+ { 0xAC2820D9623BF429, 880, 284 },
+ { 0x80444B5E7AA7CF85, 907, 292 },
+ { 0xBF21E44003ACDD2D, 933, 300 },
+ { 0x8E679C2F5E44FF8F, 960, 308 },
+ { 0xD433179D9C8CB841, 986, 316 },
+ { 0x9E19DB92B4E31BA9, 1013, 324 },
+ }
+ };
+
+ // This computation gives exactly the same results for k as
+ // k = ceil((kAlpha - e - 1) * 0.30102999566398114)
+ // for |e| <= 1500, but doesn't require floating-point operations.
+ // NB: log_10(2) ~= 78913 / 2^18
+ assert(e >= -1500);
+ assert(e <= 1500);
+ const int f = kAlpha - e - 1;
+ const int k = (f * 78913) / (1 << 18) + static_cast<int>(f > 0);
+
+ const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
+ assert(index >= 0);
+ assert(static_cast<std::size_t>(index) < kCachedPowers.size());
+
+ const cached_power cached = kCachedPowers[static_cast<std::size_t>(index)];
+ assert(kAlpha <= cached.e + e + 64);
+ assert(kGamma >= cached.e + e + 64);
+
+ return cached;
+}
+
+/*!
+For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k.
+For n == 0, returns 1 and sets pow10 := 1.
+*/
+inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)
+{
+ // LCOV_EXCL_START
+ if (n >= 1000000000)
+ {
+ pow10 = 1000000000;
+ return 10;
+ }
+ // LCOV_EXCL_STOP
+ else if (n >= 100000000)
+ {
+ pow10 = 100000000;
+ return 9;
+ }
+ else if (n >= 10000000)
+ {
+ pow10 = 10000000;
+ return 8;
+ }
+ else if (n >= 1000000)
+ {
+ pow10 = 1000000;
+ return 7;
+ }
+ else if (n >= 100000)
+ {
+ pow10 = 100000;
+ return 6;
+ }
+ else if (n >= 10000)
+ {
+ pow10 = 10000;
+ return 5;
+ }
+ else if (n >= 1000)
+ {
+ pow10 = 1000;
+ return 4;
+ }
+ else if (n >= 100)
+ {
+ pow10 = 100;
+ return 3;
+ }
+ else if (n >= 10)
+ {
+ pow10 = 10;
+ return 2;
+ }
+ else
+ {
+ pow10 = 1;
+ return 1;
+ }
+}
+
+inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
+ std::uint64_t rest, std::uint64_t ten_k)
+{
+ assert(len >= 1);
+ assert(dist <= delta);
+ assert(rest <= delta);
+ assert(ten_k > 0);
+
+ // <--------------------------- delta ---->
+ // <---- dist --------->
+ // --------------[------------------+-------------------]--------------
+ // M- w M+
+ //
+ // ten_k
+ // <------>
+ // <---- rest ---->
+ // --------------[------------------+----+--------------]--------------
+ // w V
+ // = buf * 10^k
+ //
+ // ten_k represents a unit-in-the-last-place in the decimal representation
+ // stored in buf.
+ // Decrement buf by ten_k while this takes buf closer to w.
+
+ // The tests are written in this order to avoid overflow in unsigned
+ // integer arithmetic.
+
+ while (rest < dist
+ and delta - rest >= ten_k
+ and (rest + ten_k < dist or dist - rest > rest + ten_k - dist))
+ {
+ assert(buf[len - 1] != '0');
+ buf[len - 1]--;
+ rest += ten_k;
+ }
+}
+
+/*!
+Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+.
+M- and M+ must be normalized and share the same exponent -60 <= e <= -32.
+*/
+inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
+ diyfp M_minus, diyfp w, diyfp M_plus)
+{
+ static_assert(kAlpha >= -60, "internal error");
+ static_assert(kGamma <= -32, "internal error");
+
+ // Generates the digits (and the exponent) of a decimal floating-point
+ // number V = buffer * 10^decimal_exponent in the range [M-, M+]. The diyfp's
+ // w, M- and M+ share the same exponent e, which satisfies alpha <= e <= gamma.
+ //
+ // <--------------------------- delta ---->
+ // <---- dist --------->
+ // --------------[------------------+-------------------]--------------
+ // M- w M+
+ //
+ // Grisu2 generates the digits of M+ from left to right and stops as soon as
+ // V is in [M-,M+].
+
+ assert(M_plus.e >= kAlpha);
+ assert(M_plus.e <= kGamma);
+
+ std::uint64_t delta = diyfp::sub(M_plus, M_minus).f; // (significand of (M+ - M-), implicit exponent is e)
+ std::uint64_t dist = diyfp::sub(M_plus, w ).f; // (significand of (M+ - w ), implicit exponent is e)
+
+ // Split M+ = f * 2^e into two parts p1 and p2 (note: e < 0):
+ //
+ // M+ = f * 2^e
+ // = ((f div 2^-e) * 2^-e + (f mod 2^-e)) * 2^e
+ // = ((p1 ) * 2^-e + (p2 )) * 2^e
+ // = p1 + p2 * 2^e
+
+ const diyfp one(std::uint64_t{1} << -M_plus.e, M_plus.e);
+
+ auto p1 = static_cast<std::uint32_t>(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
+ std::uint64_t p2 = M_plus.f & (one.f - 1); // p2 = f mod 2^-e
+
+ // 1)
+ //
+ // Generate the digits of the integral part p1 = d[n-1]...d[1]d[0]
+
+ assert(p1 > 0);
+
+ std::uint32_t pow10;
+ const int k = find_largest_pow10(p1, pow10);
+
+ // 10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1)
+ //
+ // p1 = (p1 div 10^(k-1)) * 10^(k-1) + (p1 mod 10^(k-1))
+ // = (d[k-1] ) * 10^(k-1) + (p1 mod 10^(k-1))
+ //
+ // M+ = p1 + p2 * 2^e
+ // = d[k-1] * 10^(k-1) + (p1 mod 10^(k-1)) + p2 * 2^e
+ // = d[k-1] * 10^(k-1) + ((p1 mod 10^(k-1)) * 2^-e + p2) * 2^e
+ // = d[k-1] * 10^(k-1) + ( rest) * 2^e
+ //
+ // Now generate the digits d[n] of p1 from left to right (n = k-1,...,0)
+ //
+ // p1 = d[k-1]...d[n] * 10^n + d[n-1]...d[0]
+ //
+ // but stop as soon as
+ //
+ // rest * 2^e = (d[n-1]...d[0] * 2^-e + p2) * 2^e <= delta * 2^e
+
+ int n = k;
+ while (n > 0)
+ {
+ // Invariants:
+ // M+ = buffer * 10^n + (p1 + p2 * 2^e) (buffer = 0 for n = k)
+ // pow10 = 10^(n-1) <= p1 < 10^n
+ //
+ const std::uint32_t d = p1 / pow10; // d = p1 div 10^(n-1)
+ const std::uint32_t r = p1 % pow10; // r = p1 mod 10^(n-1)
+ //
+ // M+ = buffer * 10^n + (d * 10^(n-1) + r) + p2 * 2^e
+ // = (buffer * 10 + d) * 10^(n-1) + (r + p2 * 2^e)
+ //
+ assert(d <= 9);
+ buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d
+ //
+ // M+ = buffer * 10^(n-1) + (r + p2 * 2^e)
+ //
+ p1 = r;
+ n--;
+ //
+ // M+ = buffer * 10^n + (p1 + p2 * 2^e)
+ // pow10 = 10^n
+ //
+
+ // Now check if enough digits have been generated.
+ // Compute
+ //
+ // p1 + p2 * 2^e = (p1 * 2^-e + p2) * 2^e = rest * 2^e
+ //
+ // Note:
+ // Since rest and delta share the same exponent e, it suffices to
+ // compare the significands.
+ const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2;
+ if (rest <= delta)
+ {
+ // V = buffer * 10^n, with M- <= V <= M+.
+
+ decimal_exponent += n;
+
+ // We may now just stop. But instead look if the buffer could be
+ // decremented to bring V closer to w.
+ //
+ // pow10 = 10^n is now 1 ulp in the decimal representation V.
+ // The rounding procedure works with diyfp's with an implicit
+ // exponent of e.
+ //
+ // 10^n = (10^n * 2^-e) * 2^e = ulp * 2^e
+ //
+ const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;
+ grisu2_round(buffer, length, dist, delta, rest, ten_n);
+
+ return;
+ }
+
+ pow10 /= 10;
+ //
+ // pow10 = 10^(n-1) <= p1 < 10^n
+ // Invariants restored.
+ }
+
+ // 2)
+ //
+ // The digits of the integral part have been generated:
+ //
+ // M+ = d[k-1]...d[1]d[0] + p2 * 2^e
+ // = buffer + p2 * 2^e
+ //
+ // Now generate the digits of the fractional part p2 * 2^e.
+ //
+ // Note:
+ // No decimal point is generated: the exponent is adjusted instead.
+ //
+ // p2 actually represents the fraction
+ //
+ // p2 * 2^e
+ // = p2 / 2^-e
+ // = d[-1] / 10^1 + d[-2] / 10^2 + ...
+ //
+ // Now generate the digits d[-m] of p1 from left to right (m = 1,2,...)
+ //
+ // p2 * 2^e = d[-1]d[-2]...d[-m] * 10^-m
+ // + 10^-m * (d[-m-1] / 10^1 + d[-m-2] / 10^2 + ...)
+ //
+ // using
+ //
+ // 10^m * p2 = ((10^m * p2) div 2^-e) * 2^-e + ((10^m * p2) mod 2^-e)
+ // = ( d) * 2^-e + ( r)
+ //
+ // or
+ // 10^m * p2 * 2^e = d + r * 2^e
+ //
+ // i.e.
+ //
+ // M+ = buffer + p2 * 2^e
+ // = buffer + 10^-m * (d + r * 2^e)
+ // = (buffer * 10^m + d) * 10^-m + 10^-m * r * 2^e
+ //
+ // and stop as soon as 10^-m * r * 2^e <= delta * 2^e
+
+ assert(p2 > delta);
+
+ int m = 0;
+ for (;;)
+ {
+ // Invariant:
+ // M+ = buffer * 10^-m + 10^-m * (d[-m-1] / 10 + d[-m-2] / 10^2 + ...) * 2^e
+ // = buffer * 10^-m + 10^-m * (p2 ) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
+ //
+ assert(p2 <= (std::numeric_limits<std::uint64_t>::max)() / 10);
+ p2 *= 10;
+ const std::uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e
+ const std::uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e
+ //
+ // M+ = buffer * 10^-m + 10^-m * (1/10 * (d * 2^-e + r) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * (d + r * 2^e))
+ // = (buffer * 10 + d) * 10^(-m-1) + 10^(-m-1) * r * 2^e
+ //
+ assert(d <= 9);
+ buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d
+ //
+ // M+ = buffer * 10^(-m-1) + 10^(-m-1) * r * 2^e
+ //
+ p2 = r;
+ m++;
+ //
+ // M+ = buffer * 10^-m + 10^-m * p2 * 2^e
+ // Invariant restored.
+
+ // Check if enough digits have been generated.
+ //
+ // 10^-m * p2 * 2^e <= delta * 2^e
+ // p2 * 2^e <= 10^m * delta * 2^e
+ // p2 <= 10^m * delta
+ delta *= 10;
+ dist *= 10;
+ if (p2 <= delta)
+ {
+ break;
+ }
+ }
+
+ // V = buffer * 10^-m, with M- <= V <= M+.
+
+ decimal_exponent -= m;
+
+ // 1 ulp in the decimal representation is now 10^-m.
+ // Since delta and dist are now scaled by 10^m, we need to do the
+ // same with ulp in order to keep the units in sync.
+ //
+ // 10^m * 10^-m = 1 = 2^-e * 2^e = ten_m * 2^e
+ //
+ const std::uint64_t ten_m = one.f;
+ grisu2_round(buffer, length, dist, delta, p2, ten_m);
+
+ // By construction this algorithm generates the shortest possible decimal
+ // number (Loitsch, Theorem 6.2) which rounds back to w.
+ // For an input number of precision p, at least
+ //
+ // N = 1 + ceil(p * log_10(2))
+ //
+ // decimal digits are sufficient to identify all binary floating-point
+ // numbers (Matula, "In-and-Out conversions").
+ // This implies that the algorithm does not produce more than N decimal
+ // digits.
+ //
+ // N = 17 for p = 53 (IEEE double precision)
+ // N = 9 for p = 24 (IEEE single precision)
+}
+
+/*!
+v = buf * 10^decimal_exponent
+len is the length of the buffer (number of decimal digits)
+The buffer must be large enough, i.e. >= max_digits10.
+*/
+inline void grisu2(char* buf, int& len, int& decimal_exponent,
+ diyfp m_minus, diyfp v, diyfp m_plus)
+{
+ assert(m_plus.e == m_minus.e);
+ assert(m_plus.e == v.e);
+
+ // --------(-----------------------+-----------------------)-------- (A)
+ // m- v m+
+ //
+ // --------------------(-----------+-----------------------)-------- (B)
+ // m- v m+
+ //
+ // First scale v (and m- and m+) such that the exponent is in the range
+ // [alpha, gamma].
+
+ const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e);
+
+ const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k
+
+ // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma]
+ const diyfp w = diyfp::mul(v, c_minus_k);
+ const diyfp w_minus = diyfp::mul(m_minus, c_minus_k);
+ const diyfp w_plus = diyfp::mul(m_plus, c_minus_k);
+
+ // ----(---+---)---------------(---+---)---------------(---+---)----
+ // w- w w+
+ // = c*m- = c*v = c*m+
+ //
+ // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and
+ // w+ are now off by a small amount.
+ // In fact:
+ //
+ // w - v * 10^k < 1 ulp
+ //
+ // To account for this inaccuracy, add resp. subtract 1 ulp.
+ //
+ // --------+---[---------------(---+---)---------------]---+--------
+ // w- M- w M+ w+
+ //
+ // Now any number in [M-, M+] (bounds included) will round to w when input,
+ // regardless of how the input rounding algorithm breaks ties.
+ //
+ // And digit_gen generates the shortest possible such number in [M-, M+].
+ // Note that this does not mean that Grisu2 always generates the shortest
+ // possible number in the interval (m-, m+).
+ const diyfp M_minus(w_minus.f + 1, w_minus.e);
+ const diyfp M_plus (w_plus.f - 1, w_plus.e );
+
+ decimal_exponent = -cached.k; // = -(-k) = k
+
+ grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus);
+}
+
+/*!
+v = buf * 10^decimal_exponent
+len is the length of the buffer (number of decimal digits)
+The buffer must be large enough, i.e. >= max_digits10.
+*/
+template <typename FloatType>
+void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
+{
+ static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3,
+ "internal error: not enough precision");
+
+ assert(std::isfinite(value));
+ assert(value > 0);
+
+ // If the neighbors (and boundaries) of 'value' are always computed for double-precision
+ // numbers, all float's can be recovered using strtod (and strtof). However, the resulting
+ // decimal representations are not exactly "short".
+ //
+ // The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars)
+ // says "value is converted to a string as if by std::sprintf in the default ("C") locale"
+ // and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars'
+ // does.
+ // On the other hand, the documentation for 'std::to_chars' requires that "parsing the
+ // representation using the corresponding std::from_chars function recovers value exactly". That
+ // indicates that single precision floating-point numbers should be recovered using
+ // 'std::strtof'.
+ //
+ // NB: If the neighbors are computed for single-precision numbers, there is a single float
+ // (7.0385307e-26f) which can't be recovered using strtod. The resulting double precision
+ // value is off by 1 ulp.
+#if 0
+ const boundaries w = compute_boundaries(static_cast<double>(value));
+#else
+ const boundaries w = compute_boundaries(value);
+#endif
+
+ grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus);
+}
+
+/*!
+@brief appends a decimal representation of e to buf
+@return a pointer to the element following the exponent.
+@pre -1000 < e < 1000
+*/
+inline char* append_exponent(char* buf, int e)
+{
+ assert(e > -1000);
+ assert(e < 1000);
+
+ if (e < 0)
+ {
+ e = -e;
+ *buf++ = '-';
+ }
+ else
+ {
+ *buf++ = '+';
+ }
+
+ auto k = static_cast<std::uint32_t>(e);
+ if (k < 10)
+ {
+ // Always print at least two digits in the exponent.
+ // This is for compatibility with printf("%g").
+ *buf++ = '0';
+ *buf++ = static_cast<char>('0' + k);
+ }
+ else if (k < 100)
+ {
+ *buf++ = static_cast<char>('0' + k / 10);
+ k %= 10;
+ *buf++ = static_cast<char>('0' + k);
+ }
+ else
+ {
+ *buf++ = static_cast<char>('0' + k / 100);
+ k %= 100;
+ *buf++ = static_cast<char>('0' + k / 10);
+ k %= 10;
+ *buf++ = static_cast<char>('0' + k);
+ }
+
+ return buf;
+}
+
+/*!
+@brief prettify v = buf * 10^decimal_exponent
+
+If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point
+notation. Otherwise it will be printed in exponential notation.
+
+@pre min_exp < 0
+@pre max_exp > 0
+*/
+inline char* format_buffer(char* buf, int len, int decimal_exponent,
+ int min_exp, int max_exp)
+{
+ assert(min_exp < 0);
+ assert(max_exp > 0);
+
+ const int k = len;
+ const int n = len + decimal_exponent;
+
+ // v = buf * 10^(n-k)
+ // k is the length of the buffer (number of decimal digits)
+ // n is the position of the decimal point relative to the start of the buffer.
+
+ if (k <= n and n <= max_exp)
+ {
+ // digits[000]
+ // len <= max_exp + 2
+
+ std::memset(buf + k, '0', static_cast<size_t>(n - k));
+ // Make it look like a floating-point number (#362, #378)
+ buf[n + 0] = '.';
+ buf[n + 1] = '0';
+ return buf + (n + 2);
+ }
+
+ if (0 < n and n <= max_exp)
+ {
+ // dig.its
+ // len <= max_digits10 + 1
+
+ assert(k > n);
+
+ std::memmove(buf + (n + 1), buf + n, static_cast<size_t>(k - n));
+ buf[n] = '.';
+ return buf + (k + 1);
+ }
+
+ if (min_exp < n and n <= 0)
+ {
+ // 0.[000]digits
+ // len <= 2 + (-min_exp - 1) + max_digits10
+
+ std::memmove(buf + (2 + -n), buf, static_cast<size_t>(k));
+ buf[0] = '0';
+ buf[1] = '.';
+ std::memset(buf + 2, '0', static_cast<size_t>(-n));
+ return buf + (2 + (-n) + k);
+ }
+
+ if (k == 1)
+ {
+ // dE+123
+ // len <= 1 + 5
+
+ buf += 1;
+ }
+ else
+ {
+ // d.igitsE+123
+ // len <= max_digits10 + 1 + 5
+
+ std::memmove(buf + 2, buf + 1, static_cast<size_t>(k - 1));
+ buf[1] = '.';
+ buf += 1 + k;
+ }
+
+ *buf++ = 'e';
+ return append_exponent(buf, n - 1);
+}
+
+} // namespace dtoa_impl
+
+/*!
+@brief generates a decimal representation of the floating-point number value in [first, last).
+
+The format of the resulting decimal representation is similar to printf's %g
+format. Returns an iterator pointing past-the-end of the decimal representation.
+
+@note The input number must be finite, i.e. NaN's and Inf's are not supported.
+@note The buffer must be large enough.
+@note The result is NOT null-terminated.
+*/
+template <typename FloatType>
+char* to_chars(char* first, const char* last, FloatType value)
+{
+ static_cast<void>(last); // maybe unused - fix warning
+ assert(std::isfinite(value));
+
+ // Use signbit(value) instead of (value < 0) since signbit works for -0.
+ if (std::signbit(value))
+ {
+ value = -value;
+ *first++ = '-';
+ }
+
+ if (value == 0) // +-0
+ {
+ *first++ = '0';
+ // Make it look like a floating-point number (#362, #378)
+ *first++ = '.';
+ *first++ = '0';
+ return first;
+ }
+
+ assert(last - first >= std::numeric_limits<FloatType>::max_digits10);
+
+ // Compute v = buffer * 10^decimal_exponent.
+ // The decimal digits are stored in the buffer, which needs to be interpreted
+ // as an unsigned decimal integer.
+ // len is the length of the buffer, i.e. the number of decimal digits.
+ int len = 0;
+ int decimal_exponent = 0;
+ dtoa_impl::grisu2(first, len, decimal_exponent, value);
+
+ assert(len <= std::numeric_limits<FloatType>::max_digits10);
+
+ // Format the buffer like printf("%.*g", prec, value)
+ constexpr int kMinExp = -4;
+ // Use digits10 here to increase compatibility with version 2.
+ constexpr int kMaxExp = std::numeric_limits<FloatType>::digits10;
+
+ assert(last - first >= kMaxExp + 2);
+ assert(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
+ assert(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
+
+ return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp);
+}
+
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/output/binary_writer.hpp>
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////
+// serialization //
+///////////////////
+
+/// how to treat decoding errors
+enum class error_handler_t
+{
+ strict, ///< throw a type_error exception in case of invalid UTF-8
+ replace, ///< replace invalid UTF-8 sequences with U+FFFD
+ ignore ///< ignore invalid UTF-8 sequences
+};
+
+template<typename BasicJsonType>
+class serializer
+{
+ using string_t = typename BasicJsonType::string_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ static constexpr std::uint8_t UTF8_ACCEPT = 0;
+ static constexpr std::uint8_t UTF8_REJECT = 1;
+
+ public:
+ /*!
+ @param[in] s output stream to serialize to
+ @param[in] ichar indentation character to use
+ @param[in] error_handler_ how to react on decoding errors
+ */
+ serializer(output_adapter_t<char> s, const char ichar,
+ error_handler_t error_handler_ = error_handler_t::strict)
+ : o(std::move(s))
+ , loc(std::localeconv())
+ , thousands_sep(loc->thousands_sep == nullptr ? '\0' : * (loc->thousands_sep))
+ , decimal_point(loc->decimal_point == nullptr ? '\0' : * (loc->decimal_point))
+ , indent_char(ichar)
+ , indent_string(512, indent_char)
+ , error_handler(error_handler_)
+ {}
+
+ // delete because of pointer members
+ serializer(const serializer&) = delete;
+ serializer& operator=(const serializer&) = delete;
+ serializer(serializer&&) = delete;
+ serializer& operator=(serializer&&) = delete;
+ ~serializer() = default;
+
+ /*!
+ @brief internal implementation of the serialization function
+
+ This function is called by the public member function dump and organizes
+ the serialization internally. The indentation level is propagated as
+ additional parameter. In case of arrays and objects, the function is
+ called recursively.
+
+ - strings and object keys are escaped using `escape_string()`
+ - integer numbers are converted implicitly via `operator<<`
+ - floating-point numbers are converted to a string using `"%g"` format
+
+ @param[in] val value to serialize
+ @param[in] pretty_print whether the output shall be pretty-printed
+ @param[in] indent_step the indent level
+ @param[in] current_indent the current indent level (only used internally)
+ */
+ void dump(const BasicJsonType& val, const bool pretty_print,
+ const bool ensure_ascii,
+ const unsigned int indent_step,
+ const unsigned int current_indent = 0)
+ {
+ switch (val.m_type)
+ {
+ case value_t::object:
+ {
+ if (val.m_value.object->empty())
+ {
+ o->write_characters("{}", 2);
+ return;
+ }
+
+ if (pretty_print)
+ {
+ o->write_characters("{\n", 2);
+
+ // variable to hold indentation for recursive calls
+ const auto new_indent = current_indent + indent_step;
+ if (JSON_UNLIKELY(indent_string.size() < new_indent))
+ {
+ indent_string.resize(indent_string.size() * 2, ' ');
+ }
+
+ // first n-1 elements
+ auto i = val.m_value.object->cbegin();
+ for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
+ {
+ o->write_characters(indent_string.c_str(), new_indent);
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\": ", 3);
+ dump(i->second, true, ensure_ascii, indent_step, new_indent);
+ o->write_characters(",\n", 2);
+ }
+
+ // last element
+ assert(i != val.m_value.object->cend());
+ assert(std::next(i) == val.m_value.object->cend());
+ o->write_characters(indent_string.c_str(), new_indent);
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\": ", 3);
+ dump(i->second, true, ensure_ascii, indent_step, new_indent);
+
+ o->write_character('\n');
+ o->write_characters(indent_string.c_str(), current_indent);
+ o->write_character('}');
+ }
+ else
+ {
+ o->write_character('{');
+
+ // first n-1 elements
+ auto i = val.m_value.object->cbegin();
+ for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
+ {
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\":", 2);
+ dump(i->second, false, ensure_ascii, indent_step, current_indent);
+ o->write_character(',');
+ }
+
+ // last element
+ assert(i != val.m_value.object->cend());
+ assert(std::next(i) == val.m_value.object->cend());
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\":", 2);
+ dump(i->second, false, ensure_ascii, indent_step, current_indent);
+
+ o->write_character('}');
+ }
+
+ return;
+ }
+
+ case value_t::array:
+ {
+ if (val.m_value.array->empty())
+ {
+ o->write_characters("[]", 2);
+ return;
+ }
+
+ if (pretty_print)
+ {
+ o->write_characters("[\n", 2);
+
+ // variable to hold indentation for recursive calls
+ const auto new_indent = current_indent + indent_step;
+ if (JSON_UNLIKELY(indent_string.size() < new_indent))
+ {
+ indent_string.resize(indent_string.size() * 2, ' ');
+ }
+
+ // first n-1 elements
+ for (auto i = val.m_value.array->cbegin();
+ i != val.m_value.array->cend() - 1; ++i)
+ {
+ o->write_characters(indent_string.c_str(), new_indent);
+ dump(*i, true, ensure_ascii, indent_step, new_indent);
+ o->write_characters(",\n", 2);
+ }
+
+ // last element
+ assert(not val.m_value.array->empty());
+ o->write_characters(indent_string.c_str(), new_indent);
+ dump(val.m_value.array->back(), true, ensure_ascii, indent_step, new_indent);
+
+ o->write_character('\n');
+ o->write_characters(indent_string.c_str(), current_indent);
+ o->write_character(']');
+ }
+ else
+ {
+ o->write_character('[');
+
+ // first n-1 elements
+ for (auto i = val.m_value.array->cbegin();
+ i != val.m_value.array->cend() - 1; ++i)
+ {
+ dump(*i, false, ensure_ascii, indent_step, current_indent);
+ o->write_character(',');
+ }
+
+ // last element
+ assert(not val.m_value.array->empty());
+ dump(val.m_value.array->back(), false, ensure_ascii, indent_step, current_indent);
+
+ o->write_character(']');
+ }
+
+ return;
+ }
+
+ case value_t::string:
+ {
+ o->write_character('\"');
+ dump_escaped(*val.m_value.string, ensure_ascii);
+ o->write_character('\"');
+ return;
+ }
+
+ case value_t::boolean:
+ {
+ if (val.m_value.boolean)
+ {
+ o->write_characters("true", 4);
+ }
+ else
+ {
+ o->write_characters("false", 5);
+ }
+ return;
+ }
+
+ case value_t::number_integer:
+ {
+ dump_integer(val.m_value.number_integer);
+ return;
+ }
+
+ case value_t::number_unsigned:
+ {
+ dump_integer(val.m_value.number_unsigned);
+ return;
+ }
+
+ case value_t::number_float:
+ {
+ dump_float(val.m_value.number_float);
+ return;
+ }
+
+ case value_t::discarded:
+ {
+ o->write_characters("<discarded>", 11);
+ return;
+ }
+
+ case value_t::null:
+ {
+ o->write_characters("null", 4);
+ return;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ }
+
+ private:
+ /*!
+ @brief dump escaped string
+
+ Escape a string by replacing certain special characters by a sequence of an
+ escape character (backslash) and another character and other control
+ characters by a sequence of "\u" followed by a four-digit hex
+ representation. The escaped string is written to output stream @a o.
+
+ @param[in] s the string to escape
+ @param[in] ensure_ascii whether to escape non-ASCII characters with
+ \uXXXX sequences
+
+ @complexity Linear in the length of string @a s.
+ */
+ void dump_escaped(const string_t& s, const bool ensure_ascii)
+ {
+ std::uint32_t codepoint;
+ std::uint8_t state = UTF8_ACCEPT;
+ std::size_t bytes = 0; // number of bytes written to string_buffer
+
+ // number of bytes written at the point of the last valid byte
+ std::size_t bytes_after_last_accept = 0;
+ std::size_t undumped_chars = 0;
+
+ for (std::size_t i = 0; i < s.size(); ++i)
+ {
+ const auto byte = static_cast<uint8_t>(s[i]);
+
+ switch (decode(state, codepoint, byte))
+ {
+ case UTF8_ACCEPT: // decode found a new code point
+ {
+ switch (codepoint)
+ {
+ case 0x08: // backspace
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'b';
+ break;
+ }
+
+ case 0x09: // horizontal tab
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 't';
+ break;
+ }
+
+ case 0x0A: // newline
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'n';
+ break;
+ }
+
+ case 0x0C: // formfeed
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'f';
+ break;
+ }
+
+ case 0x0D: // carriage return
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'r';
+ break;
+ }
+
+ case 0x22: // quotation mark
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = '\"';
+ break;
+ }
+
+ case 0x5C: // reverse solidus
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = '\\';
+ break;
+ }
+
+ default:
+ {
+ // escape control characters (0x00..0x1F) or, if
+ // ensure_ascii parameter is used, non-ASCII characters
+ if ((codepoint <= 0x1F) or (ensure_ascii and (codepoint >= 0x7F)))
+ {
+ if (codepoint <= 0xFFFF)
+ {
+ (std::snprintf)(string_buffer.data() + bytes, 7, "\\u%04x",
+ static_cast<std::uint16_t>(codepoint));
+ bytes += 6;
+ }
+ else
+ {
+ (std::snprintf)(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x",
+ static_cast<std::uint16_t>(0xD7C0u + (codepoint >> 10u)),
+ static_cast<std::uint16_t>(0xDC00u + (codepoint & 0x3FFu)));
+ bytes += 12;
+ }
+ }
+ else
+ {
+ // copy byte to buffer (all previous bytes
+ // been copied have in default case above)
+ string_buffer[bytes++] = s[i];
+ }
+ break;
+ }
+ }
+
+ // write buffer and reset index; there must be 13 bytes
+ // left, as this is the maximal number of bytes to be
+ // written ("\uxxxx\uxxxx\0") for one code point
+ if (string_buffer.size() - bytes < 13)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ bytes = 0;
+ }
+
+ // remember the byte position of this accept
+ bytes_after_last_accept = bytes;
+ undumped_chars = 0;
+ break;
+ }
+
+ case UTF8_REJECT: // decode found invalid UTF-8 byte
+ {
+ switch (error_handler)
+ {
+ case error_handler_t::strict:
+ {
+ std::string sn(3, '\0');
+ (std::snprintf)(&sn[0], sn.size(), "%.2X", byte);
+ JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn));
+ }
+
+ case error_handler_t::ignore:
+ case error_handler_t::replace:
+ {
+ // in case we saw this character the first time, we
+ // would like to read it again, because the byte
+ // may be OK for itself, but just not OK for the
+ // previous sequence
+ if (undumped_chars > 0)
+ {
+ --i;
+ }
+
+ // reset length buffer to the last accepted index;
+ // thus removing/ignoring the invalid characters
+ bytes = bytes_after_last_accept;
+
+ if (error_handler == error_handler_t::replace)
+ {
+ // add a replacement character
+ if (ensure_ascii)
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'u';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'd';
+ }
+ else
+ {
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xEF');
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xBF');
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xBD');
+ }
+
+ // write buffer and reset index; there must be 13 bytes
+ // left, as this is the maximal number of bytes to be
+ // written ("\uxxxx\uxxxx\0") for one code point
+ if (string_buffer.size() - bytes < 13)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ bytes = 0;
+ }
+
+ bytes_after_last_accept = bytes;
+ }
+
+ undumped_chars = 0;
+
+ // continue processing the string
+ state = UTF8_ACCEPT;
+ break;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ break;
+ }
+
+ default: // decode found yet incomplete multi-byte code point
+ {
+ if (not ensure_ascii)
+ {
+ // code point will not be escaped - copy byte to buffer
+ string_buffer[bytes++] = s[i];
+ }
+ ++undumped_chars;
+ break;
+ }
+ }
+ }
+
+ // we finished processing the string
+ if (JSON_LIKELY(state == UTF8_ACCEPT))
+ {
+ // write buffer
+ if (bytes > 0)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ }
+ }
+ else
+ {
+ // we finish reading, but do not accept: string was incomplete
+ switch (error_handler)
+ {
+ case error_handler_t::strict:
+ {
+ std::string sn(3, '\0');
+ (std::snprintf)(&sn[0], sn.size(), "%.2X", static_cast<std::uint8_t>(s.back()));
+ JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn));
+ }
+
+ case error_handler_t::ignore:
+ {
+ // write all accepted bytes
+ o->write_characters(string_buffer.data(), bytes_after_last_accept);
+ break;
+ }
+
+ case error_handler_t::replace:
+ {
+ // write all accepted bytes
+ o->write_characters(string_buffer.data(), bytes_after_last_accept);
+ // add a replacement character
+ if (ensure_ascii)
+ {
+ o->write_characters("\\ufffd", 6);
+ }
+ else
+ {
+ o->write_characters("\xEF\xBF\xBD", 3);
+ }
+ break;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ }
+ }
+
+ /*!
+ @brief count digits
+
+ Count the number of decimal (base 10) digits for an input unsigned integer.
+
+ @param[in] x unsigned integer number to count its digits
+ @return number of decimal digits
+ */
+ inline unsigned int count_digits(number_unsigned_t x) noexcept
+ {
+ unsigned int n_digits = 1;
+ for (;;)
+ {
+ if (x < 10)
+ {
+ return n_digits;
+ }
+ if (x < 100)
+ {
+ return n_digits + 1;
+ }
+ if (x < 1000)
+ {
+ return n_digits + 2;
+ }
+ if (x < 10000)
+ {
+ return n_digits + 3;
+ }
+ x = x / 10000u;
+ n_digits += 4;
+ }
+ }
+
+ /*!
+ @brief dump an integer
+
+ Dump a given integer to output stream @a o. Works internally with
+ @a number_buffer.
+
+ @param[in] x integer number (signed or unsigned) to dump
+ @tparam NumberType either @a number_integer_t or @a number_unsigned_t
+ */
+ template<typename NumberType, detail::enable_if_t<
+ std::is_same<NumberType, number_unsigned_t>::value or
+ std::is_same<NumberType, number_integer_t>::value,
+ int> = 0>
+ void dump_integer(NumberType x)
+ {
+ static constexpr std::array<std::array<char, 2>, 100> digits_to_99
+ {
+ {
+ {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}},
+ {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}},
+ {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}},
+ {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}},
+ {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}},
+ {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}},
+ {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}},
+ {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}},
+ {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}},
+ {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}},
+ }
+ };
+
+ // special case for "0"
+ if (x == 0)
+ {
+ o->write_character('0');
+ return;
+ }
+
+ // use a pointer to fill the buffer
+ auto buffer_ptr = number_buffer.begin();
+
+ const bool is_negative = std::is_same<NumberType, number_integer_t>::value and not(x >= 0); // see issue #755
+ number_unsigned_t abs_value;
+
+ unsigned int n_chars;
+
+ if (is_negative)
+ {
+ *buffer_ptr = '-';
+ abs_value = static_cast<number_unsigned_t>(std::abs(static_cast<std::intmax_t>(x)));
+
+ // account one more byte for the minus sign
+ n_chars = 1 + count_digits(abs_value);
+ }
+ else
+ {
+ abs_value = static_cast<number_unsigned_t>(x);
+ n_chars = count_digits(abs_value);
+ }
+
+ // spare 1 byte for '\0'
+ assert(n_chars < number_buffer.size() - 1);
+
+ // jump to the end to generate the string from backward
+ // so we later avoid reversing the result
+ buffer_ptr += n_chars;
+
+ // Fast int2ascii implementation inspired by "Fastware" talk by Andrei Alexandrescu
+ // See: https://www.youtube.com/watch?v=o4-CwDo2zpg
+ while (abs_value >= 100)
+ {
+ const auto digits_index = static_cast<unsigned>((abs_value % 100));
+ abs_value /= 100;
+ *(--buffer_ptr) = digits_to_99[digits_index][1];
+ *(--buffer_ptr) = digits_to_99[digits_index][0];
+ }
+
+ if (abs_value >= 10)
+ {
+ const auto digits_index = static_cast<unsigned>(abs_value);
+ *(--buffer_ptr) = digits_to_99[digits_index][1];
+ *(--buffer_ptr) = digits_to_99[digits_index][0];
+ }
+ else
+ {
+ *(--buffer_ptr) = static_cast<char>('0' + abs_value);
+ }
+
+ o->write_characters(number_buffer.data(), n_chars);
+ }
+
+ /*!
+ @brief dump a floating-point number
+
+ Dump a given floating-point number to output stream @a o. Works internally
+ with @a number_buffer.
+
+ @param[in] x floating-point number to dump
+ */
+ void dump_float(number_float_t x)
+ {
+ // NaN / inf
+ if (not std::isfinite(x))
+ {
+ o->write_characters("null", 4);
+ return;
+ }
+
+ // If number_float_t is an IEEE-754 single or double precision number,
+ // use the Grisu2 algorithm to produce short numbers which are
+ // guaranteed to round-trip, using strtof and strtod, resp.
+ //
+ // NB: The test below works if <long double> == <double>.
+ static constexpr bool is_ieee_single_or_double
+ = (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 24 and std::numeric_limits<number_float_t>::max_exponent == 128) or
+ (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 53 and std::numeric_limits<number_float_t>::max_exponent == 1024);
+
+ dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
+ }
+
+ void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/)
+ {
+ char* begin = number_buffer.data();
+ char* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x);
+
+ o->write_characters(begin, static_cast<size_t>(end - begin));
+ }
+
+ void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/)
+ {
+ // get number of digits for a float -> text -> float round-trip
+ static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
+
+ // the actual conversion
+ std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
+
+ // negative value indicates an error
+ assert(len > 0);
+ // check if buffer was large enough
+ assert(static_cast<std::size_t>(len) < number_buffer.size());
+
+ // erase thousands separator
+ if (thousands_sep != '\0')
+ {
+ const auto end = std::remove(number_buffer.begin(),
+ number_buffer.begin() + len, thousands_sep);
+ std::fill(end, number_buffer.end(), '\0');
+ assert((end - number_buffer.begin()) <= len);
+ len = (end - number_buffer.begin());
+ }
+
+ // convert decimal point to '.'
+ if (decimal_point != '\0' and decimal_point != '.')
+ {
+ const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point);
+ if (dec_pos != number_buffer.end())
+ {
+ *dec_pos = '.';
+ }
+ }
+
+ o->write_characters(number_buffer.data(), static_cast<std::size_t>(len));
+
+ // determine if need to append ".0"
+ const bool value_is_int_like =
+ std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1,
+ [](char c)
+ {
+ return c == '.' or c == 'e';
+ });
+
+ if (value_is_int_like)
+ {
+ o->write_characters(".0", 2);
+ }
+ }
+
+ /*!
+ @brief check whether a string is UTF-8 encoded
+
+ The function checks each byte of a string whether it is UTF-8 encoded. The
+ result of the check is stored in the @a state parameter. The function must
+ be called initially with state 0 (accept). State 1 means the string must
+ be rejected, because the current byte is not allowed. If the string is
+ completely processed, but the state is non-zero, the string ended
+ prematurely; that is, the last byte indicated more bytes should have
+ followed.
+
+ @param[in,out] state the state of the decoding
+ @param[in,out] codep codepoint (valid only if resulting state is UTF8_ACCEPT)
+ @param[in] byte next byte to decode
+ @return new state
+
+ @note The function has been edited: a std::array is used.
+
+ @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
+ @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
+ */
+ static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep, const std::uint8_t byte) noexcept
+ {
+ static const std::array<std::uint8_t, 400> utf8d =
+ {
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7F
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9F
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // A0..BF
+ 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0..DF
+ 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // E0..EF
+ 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // F0..FF
+ 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2
+ 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4
+ 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6
+ 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // s7..s8
+ }
+ };
+
+ const std::uint8_t type = utf8d[byte];
+
+ codep = (state != UTF8_ACCEPT)
+ ? (byte & 0x3fu) | (codep << 6u)
+ : (0xFFu >> type) & (byte);
+
+ state = utf8d[256u + state * 16u + type];
+ return state;
+ }
+
+ private:
+ /// the output of the serializer
+ output_adapter_t<char> o = nullptr;
+
+ /// a (hopefully) large enough character buffer
+ std::array<char, 64> number_buffer{{}};
+
+ /// the locale
+ const std::lconv* loc = nullptr;
+ /// the locale's thousand separator character
+ const char thousands_sep = '\0';
+ /// the locale's decimal point character
+ const char decimal_point = '\0';
+
+ /// string buffer
+ std::array<char, 512> string_buffer{{}};
+
+ /// the indentation character
+ const char indent_char;
+ /// the indentation string
+ string_t indent_string;
+
+ /// error_handler how to react on decoding errors
+ const error_handler_t error_handler;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+// #include <nlohmann/json_fwd.hpp>
+
+
+/*!
+@brief namespace for Niels Lohmann
+@see https://github.com/nlohmann
+@since version 1.0.0
+*/
+namespace nlohmann
+{
+
+/*!
+@brief a class to store JSON values
+
+@tparam ObjectType type for JSON objects (`std::map` by default; will be used
+in @ref object_t)
+@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used
+in @ref array_t)
+@tparam StringType type for JSON strings and object keys (`std::string` by
+default; will be used in @ref string_t)
+@tparam BooleanType type for JSON booleans (`bool` by default; will be used
+in @ref boolean_t)
+@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by
+default; will be used in @ref number_integer_t)
+@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c
+`uint64_t` by default; will be used in @ref number_unsigned_t)
+@tparam NumberFloatType type for JSON floating-point numbers (`double` by
+default; will be used in @ref number_float_t)
+@tparam AllocatorType type of the allocator to use (`std::allocator` by
+default)
+@tparam JSONSerializer the serializer to resolve internal calls to `to_json()`
+and `from_json()` (@ref adl_serializer by default)
+
+@requirement The class satisfies the following concept requirements:
+- Basic
+ - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible):
+ JSON values can be default constructed. The result will be a JSON null
+ value.
+ - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible):
+ A JSON value can be constructed from an rvalue argument.
+ - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible):
+ A JSON value can be copy-constructed from an lvalue expression.
+ - [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable):
+ A JSON value van be assigned from an rvalue argument.
+ - [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable):
+ A JSON value can be copy-assigned from an lvalue expression.
+ - [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible):
+ JSON values can be destructed.
+- Layout
+ - [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType):
+ JSON values have
+ [standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
+ All non-static data members are private and standard layout types, the
+ class has no virtual functions or (virtual) base classes.
+- Library-wide
+ - [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable):
+ JSON values can be compared with `==`, see @ref
+ operator==(const_reference,const_reference).
+ - [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable):
+ JSON values can be compared with `<`, see @ref
+ operator<(const_reference,const_reference).
+ - [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable):
+ Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
+ other compatible types, using unqualified function call @ref swap().
+ - [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer):
+ JSON values can be compared against `std::nullptr_t` objects which are used
+ to model the `null` value.
+- Container
+ - [Container](https://en.cppreference.com/w/cpp/named_req/Container):
+ JSON values can be used like STL containers and provide iterator access.
+ - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer);
+ JSON values can be used like STL containers and provide reverse iterator
+ access.
+
+@invariant The member variables @a m_value and @a m_type have the following
+relationship:
+- If `m_type == value_t::object`, then `m_value.object != nullptr`.
+- If `m_type == value_t::array`, then `m_value.array != nullptr`.
+- If `m_type == value_t::string`, then `m_value.string != nullptr`.
+The invariants are checked by member function assert_invariant().
+
+@internal
+@note ObjectType trick from http://stackoverflow.com/a/9860911
+@endinternal
+
+@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange
+Format](http://rfc7159.net/rfc7159)
+
+@since version 1.0.0
+
+@nosubgrouping
+*/
+NLOHMANN_BASIC_JSON_TPL_DECLARATION
+class basic_json
+{
+ private:
+ template<detail::value_t> friend struct detail::external_constructor;
+ friend ::nlohmann::json_pointer<basic_json>;
+ friend ::nlohmann::detail::parser<basic_json>;
+ friend ::nlohmann::detail::serializer<basic_json>;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::iter_impl;
+ template<typename BasicJsonType, typename CharType>
+ friend class ::nlohmann::detail::binary_writer;
+ template<typename BasicJsonType, typename SAX>
+ friend class ::nlohmann::detail::binary_reader;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::json_sax_dom_parser;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::json_sax_dom_callback_parser;
+
+ /// workaround type for MSVC
+ using basic_json_t = NLOHMANN_BASIC_JSON_TPL;
+
+ // convenience aliases for types residing in namespace detail;
+ using lexer = ::nlohmann::detail::lexer<basic_json>;
+ using parser = ::nlohmann::detail::parser<basic_json>;
+
+ using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t;
+ template<typename BasicJsonType>
+ using internal_iterator = ::nlohmann::detail::internal_iterator<BasicJsonType>;
+ template<typename BasicJsonType>
+ using iter_impl = ::nlohmann::detail::iter_impl<BasicJsonType>;
+ template<typename Iterator>
+ using iteration_proxy = ::nlohmann::detail::iteration_proxy<Iterator>;
+ template<typename Base> using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator<Base>;
+
+ template<typename CharType>
+ using output_adapter_t = ::nlohmann::detail::output_adapter_t<CharType>;
+
+ using binary_reader = ::nlohmann::detail::binary_reader<basic_json>;
+ template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;
+
+ using serializer = ::nlohmann::detail::serializer<basic_json>;
+
+ public:
+ using value_t = detail::value_t;
+ /// JSON Pointer, see @ref nlohmann::json_pointer
+ using json_pointer = ::nlohmann::json_pointer<basic_json>;
+ template<typename T, typename SFINAE>
+ using json_serializer = JSONSerializer<T, SFINAE>;
+ /// how to treat decoding errors
+ using error_handler_t = detail::error_handler_t;
+ /// helper type for initializer lists of basic_json values
+ using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
+
+ using input_format_t = detail::input_format_t;
+ /// SAX interface type, see @ref nlohmann::json_sax
+ using json_sax_t = json_sax<basic_json>;
+
+ ////////////////
+ // exceptions //
+ ////////////////
+
+ /// @name exceptions
+ /// Classes to implement user-defined exceptions.
+ /// @{
+
+ /// @copydoc detail::exception
+ using exception = detail::exception;
+ /// @copydoc detail::parse_error
+ using parse_error = detail::parse_error;
+ /// @copydoc detail::invalid_iterator
+ using invalid_iterator = detail::invalid_iterator;
+ /// @copydoc detail::type_error
+ using type_error = detail::type_error;
+ /// @copydoc detail::out_of_range
+ using out_of_range = detail::out_of_range;
+ /// @copydoc detail::other_error
+ using other_error = detail::other_error;
+
+ /// @}
+
+
+ /////////////////////
+ // container types //
+ /////////////////////
+
+ /// @name container types
+ /// The canonic container types to use @ref basic_json like any other STL
+ /// container.
+ /// @{
+
+ /// the type of elements in a basic_json container
+ using value_type = basic_json;
+
+ /// the type of an element reference
+ using reference = value_type&;
+ /// the type of an element const reference
+ using const_reference = const value_type&;
+
+ /// a type to represent differences between iterators
+ using difference_type = std::ptrdiff_t;
+ /// a type to represent container sizes
+ using size_type = std::size_t;
+
+ /// the allocator type
+ using allocator_type = AllocatorType<basic_json>;
+
+ /// the type of an element pointer
+ using pointer = typename std::allocator_traits<allocator_type>::pointer;
+ /// the type of an element const pointer
+ using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;
+
+ /// an iterator for a basic_json container
+ using iterator = iter_impl<basic_json>;
+ /// a const iterator for a basic_json container
+ using const_iterator = iter_impl<const basic_json>;
+ /// a reverse iterator for a basic_json container
+ using reverse_iterator = json_reverse_iterator<typename basic_json::iterator>;
+ /// a const reverse iterator for a basic_json container
+ using const_reverse_iterator = json_reverse_iterator<typename basic_json::const_iterator>;
+
+ /// @}
+
+
+ /*!
+ @brief returns the allocator associated with the container
+ */
+ static allocator_type get_allocator()
+ {
+ return allocator_type();
+ }
+
+ /*!
+ @brief returns version information on the library
+
+ This function returns a JSON object with information about the library,
+ including the version number and information on the platform and compiler.
+
+ @return JSON object holding version information
+ key | description
+ ----------- | ---------------
+ `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version).
+ `copyright` | The copyright line for the library as string.
+ `name` | The name of the library as string.
+ `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`.
+ `url` | The URL of the project as string.
+ `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string).
+
+ @liveexample{The following code shows an example output of the `meta()`
+ function.,meta}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @complexity Constant.
+
+ @since 2.1.0
+ */
+ JSON_NODISCARD
+ static basic_json meta()
+ {
+ basic_json result;
+
+ result["copyright"] = "(C) 2013-2017 Niels Lohmann";
+ result["name"] = "JSON for Modern C++";
+ result["url"] = "https://github.com/nlohmann/json";
+ result["version"]["string"] =
+ std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." +
+ std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." +
+ std::to_string(NLOHMANN_JSON_VERSION_PATCH);
+ result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR;
+ result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR;
+ result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH;
+
+#ifdef _WIN32
+ result["platform"] = "win32";
+#elif defined __linux__
+ result["platform"] = "linux";
+#elif defined __APPLE__
+ result["platform"] = "apple";
+#elif defined __unix__
+ result["platform"] = "unix";
+#else
+ result["platform"] = "unknown";
+#endif
+
+#if defined(__ICC) || defined(__INTEL_COMPILER)
+ result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}};
+#elif defined(__clang__)
+ result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}};
+#elif defined(__GNUC__) || defined(__GNUG__)
+ result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}};
+#elif defined(__HP_cc) || defined(__HP_aCC)
+ result["compiler"] = "hp"
+#elif defined(__IBMCPP__)
+ result["compiler"] = {{"family", "ilecpp"}, {"version", __IBMCPP__}};
+#elif defined(_MSC_VER)
+ result["compiler"] = {{"family", "msvc"}, {"version", _MSC_VER}};
+#elif defined(__PGI)
+ result["compiler"] = {{"family", "pgcpp"}, {"version", __PGI}};
+#elif defined(__SUNPRO_CC)
+ result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}};
+#else
+ result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}};
+#endif
+
+#ifdef __cplusplus
+ result["compiler"]["c++"] = std::to_string(__cplusplus);
+#else
+ result["compiler"]["c++"] = "unknown";
+#endif
+ return result;
+ }
+
+
+ ///////////////////////////
+ // JSON value data types //
+ ///////////////////////////
+
+ /// @name JSON value data types
+ /// The data types to store a JSON value. These types are derived from
+ /// the template arguments passed to class @ref basic_json.
+ /// @{
+
+#if defined(JSON_HAS_CPP_14)
+ // Use transparent comparator if possible, combined with perfect forwarding
+ // on find() and count() calls prevents unnecessary string construction.
+ using object_comparator_t = std::less<>;
+#else
+ using object_comparator_t = std::less<StringType>;
+#endif
+
+ /*!
+ @brief a type for an object
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows:
+ > An object is an unordered collection of zero or more name/value pairs,
+ > where a name is a string and a value is a string, number, boolean, null,
+ > object, or array.
+
+ To store objects in C++, a type is defined by the template parameters
+ described below.
+
+ @tparam ObjectType the container to store objects (e.g., `std::map` or
+ `std::unordered_map`)
+ @tparam StringType the type of the keys or names (e.g., `std::string`).
+ The comparison function `std::less<StringType>` is used to order elements
+ inside the container.
+ @tparam AllocatorType the allocator to use for objects (e.g.,
+ `std::allocator`)
+
+ #### Default type
+
+ With the default values for @a ObjectType (`std::map`), @a StringType
+ (`std::string`), and @a AllocatorType (`std::allocator`), the default
+ value for @a object_t is:
+
+ @code {.cpp}
+ std::map<
+ std::string, // key_type
+ basic_json, // value_type
+ std::less<std::string>, // key_compare
+ std::allocator<std::pair<const std::string, basic_json>> // allocator_type
+ >
+ @endcode
+
+ #### Behavior
+
+ The choice of @a object_t influences the behavior of the JSON class. With
+ the default type, objects have the following behavior:
+
+ - When all names are unique, objects will be interoperable in the sense
+ that all software implementations receiving that object will agree on
+ the name-value mappings.
+ - When the names within an object are not unique, it is unspecified which
+ one of the values for a given key will be chosen. For instance,
+ `{"key": 2, "key": 1}` could be equal to either `{"key": 1}` or
+ `{"key": 2}`.
+ - Internally, name/value pairs are stored in lexicographical order of the
+ names. Objects will also be serialized (see @ref dump) in this order.
+ For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored
+ and serialized as `{"a": 2, "b": 1}`.
+ - When comparing objects, the order of the name/value pairs is irrelevant.
+ This makes objects interoperable in the sense that they will not be
+ affected by these differences. For instance, `{"b": 1, "a": 2}` and
+ `{"a": 2, "b": 1}` will be treated as equal.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the maximum depth of nesting.
+
+ In this class, the object's limit of nesting is not explicitly constrained.
+ However, a maximum depth of nesting may be introduced by the compiler or
+ runtime environment. A theoretical limit can be queried by calling the
+ @ref max_size function of a JSON object.
+
+ #### Storage
+
+ Objects are stored as pointers in a @ref basic_json type. That is, for any
+ access to object values, a pointer of type `object_t*` must be
+ dereferenced.
+
+ @sa @ref array_t -- type for an array value
+
+ @since version 1.0.0
+
+ @note The order name/value pairs are added to the object is *not*
+ preserved by the library. Therefore, iterating an object may return
+ name/value pairs in a different order than they were originally stored. In
+ fact, keys will be traversed in alphabetical order as `std::map` with
+ `std::less` is used by default. Please note this behavior conforms to [RFC
+ 7159](http://rfc7159.net/rfc7159), because any order implements the
+ specified "unordered" nature of JSON objects.
+ */
+ using object_t = ObjectType<StringType,
+ basic_json,
+ object_comparator_t,
+ AllocatorType<std::pair<const StringType,
+ basic_json>>>;
+
+ /*!
+ @brief a type for an array
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows:
+ > An array is an ordered sequence of zero or more values.
+
+ To store objects in C++, a type is defined by the template parameters
+ explained below.
+
+ @tparam ArrayType container type to store arrays (e.g., `std::vector` or
+ `std::list`)
+ @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`)
+
+ #### Default type
+
+ With the default values for @a ArrayType (`std::vector`) and @a
+ AllocatorType (`std::allocator`), the default value for @a array_t is:
+
+ @code {.cpp}
+ std::vector<
+ basic_json, // value_type
+ std::allocator<basic_json> // allocator_type
+ >
+ @endcode
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the maximum depth of nesting.
+
+ In this class, the array's limit of nesting is not explicitly constrained.
+ However, a maximum depth of nesting may be introduced by the compiler or
+ runtime environment. A theoretical limit can be queried by calling the
+ @ref max_size function of a JSON array.
+
+ #### Storage
+
+ Arrays are stored as pointers in a @ref basic_json type. That is, for any
+ access to array values, a pointer of type `array_t*` must be dereferenced.
+
+ @sa @ref object_t -- type for an object value
+
+ @since version 1.0.0
+ */
+ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
+
+ /*!
+ @brief a type for a string
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows:
+ > A string is a sequence of zero or more Unicode characters.
+
+ To store objects in C++, a type is defined by the template parameter
+ described below. Unicode values are split by the JSON class into
+ byte-sized characters during deserialization.
+
+ @tparam StringType the container to store strings (e.g., `std::string`).
+ Note this container is used for keys/names in objects, see @ref object_t.
+
+ #### Default type
+
+ With the default values for @a StringType (`std::string`), the default
+ value for @a string_t is:
+
+ @code {.cpp}
+ std::string
+ @endcode
+
+ #### Encoding
+
+ Strings are stored in UTF-8 encoding. Therefore, functions like
+ `std::string::size()` or `std::string::length()` return the number of
+ bytes in the string rather than the number of characters or glyphs.
+
+ #### String comparison
+
+ [RFC 7159](http://rfc7159.net/rfc7159) states:
+ > Software implementations are typically required to test names of object
+ > members for equality. Implementations that transform the textual
+ > representation into sequences of Unicode code units and then perform the
+ > comparison numerically, code unit by code unit, are interoperable in the
+ > sense that implementations will agree in all cases on equality or
+ > inequality of two strings. For example, implementations that compare
+ > strings with escaped characters unconverted may incorrectly find that
+ > `"a\\b"` and `"a\u005Cb"` are not equal.
+
+ This implementation is interoperable as it does compare strings code unit
+ by code unit.
+
+ #### Storage
+
+ String values are stored as pointers in a @ref basic_json type. That is,
+ for any access to string values, a pointer of type `string_t*` must be
+ dereferenced.
+
+ @since version 1.0.0
+ */
+ using string_t = StringType;
+
+ /*!
+ @brief a type for a boolean
+
+ [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a
+ type which differentiates the two literals `true` and `false`.
+
+ To store objects in C++, a type is defined by the template parameter @a
+ BooleanType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a BooleanType (`bool`), the default value for
+ @a boolean_t is:
+
+ @code {.cpp}
+ bool
+ @endcode
+
+ #### Storage
+
+ Boolean values are stored directly inside a @ref basic_json type.
+
+ @since version 1.0.0
+ */
+ using boolean_t = BooleanType;
+
+ /*!
+ @brief a type for a number (integer)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store integer numbers in C++, a type is defined by the template
+ parameter @a NumberIntegerType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberIntegerType (`int64_t`), the default
+ value for @a number_integer_t is:
+
+ @code {.cpp}
+ int64_t
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in integer literals lead to an interpretation as octal
+ number. Internally, the value will be stored as decimal number. For
+ instance, the C++ integer literal `010` will be serialized to `8`.
+ During deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the range and precision of numbers.
+
+ When the default type is used, the maximal integer number that can be
+ stored is `9223372036854775807` (INT64_MAX) and the minimal integer number
+ that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers
+ that are out of range will yield over/underflow when used in a
+ constructor. During deserialization, too large or small integer numbers
+ will be automatically be stored as @ref number_unsigned_t or @ref
+ number_float_t.
+
+ [RFC 7159](http://rfc7159.net/rfc7159) further states:
+ > Note that when such software is used, numbers that are integers and are
+ > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense
+ > that implementations will agree exactly on their numeric values.
+
+ As this range is a subrange of the exactly supported range [INT64_MIN,
+ INT64_MAX], this class's integer type is interoperable.
+
+ #### Storage
+
+ Integer number values are stored directly inside a @ref basic_json type.
+
+ @sa @ref number_float_t -- type for number values (floating-point)
+
+ @sa @ref number_unsigned_t -- type for number values (unsigned integer)
+
+ @since version 1.0.0
+ */
+ using number_integer_t = NumberIntegerType;
+
+ /*!
+ @brief a type for a number (unsigned)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store unsigned integer numbers in C++, a type is defined by the
+ template parameter @a NumberUnsignedType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberUnsignedType (`uint64_t`), the
+ default value for @a number_unsigned_t is:
+
+ @code {.cpp}
+ uint64_t
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in integer literals lead to an interpretation as octal
+ number. Internally, the value will be stored as decimal number. For
+ instance, the C++ integer literal `010` will be serialized to `8`.
+ During deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the range and precision of numbers.
+
+ When the default type is used, the maximal integer number that can be
+ stored is `18446744073709551615` (UINT64_MAX) and the minimal integer
+ number that can be stored is `0`. Integer numbers that are out of range
+ will yield over/underflow when used in a constructor. During
+ deserialization, too large or small integer numbers will be automatically
+ be stored as @ref number_integer_t or @ref number_float_t.
+
+ [RFC 7159](http://rfc7159.net/rfc7159) further states:
+ > Note that when such software is used, numbers that are integers and are
+ > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense
+ > that implementations will agree exactly on their numeric values.
+
+ As this range is a subrange (when considered in conjunction with the
+ number_integer_t type) of the exactly supported range [0, UINT64_MAX],
+ this class's integer type is interoperable.
+
+ #### Storage
+
+ Integer number values are stored directly inside a @ref basic_json type.
+
+ @sa @ref number_float_t -- type for number values (floating-point)
+ @sa @ref number_integer_t -- type for number values (integer)
+
+ @since version 2.0.0
+ */
+ using number_unsigned_t = NumberUnsignedType;
+
+ /*!
+ @brief a type for a number (floating-point)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store floating-point numbers in C++, a type is defined by the template
+ parameter @a NumberFloatType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberFloatType (`double`), the default
+ value for @a number_float_t is:
+
+ @code {.cpp}
+ double
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in floating-point literals will be ignored. Internally,
+ the value will be stored as decimal number. For instance, the C++
+ floating-point literal `01.2` will be serialized to `1.2`. During
+ deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) states:
+ > This specification allows implementations to set limits on the range and
+ > precision of numbers accepted. Since software that implements IEEE
+ > 754-2008 binary64 (double precision) numbers is generally available and
+ > widely used, good interoperability can be achieved by implementations
+ > that expect no more precision or range than these provide, in the sense
+ > that implementations will approximate JSON numbers within the expected
+ > precision.
+
+ This implementation does exactly follow this approach, as it uses double
+ precision floating-point numbers. Note values smaller than
+ `-1.79769313486232e+308` and values greater than `1.79769313486232e+308`
+ will be stored as NaN internally and be serialized to `null`.
+
+ #### Storage
+
+ Floating-point number values are stored directly inside a @ref basic_json
+ type.
+
+ @sa @ref number_integer_t -- type for number values (integer)
+
+ @sa @ref number_unsigned_t -- type for number values (unsigned integer)
+
+ @since version 1.0.0
+ */
+ using number_float_t = NumberFloatType;
+
+ /// @}
+
+ private:
+
+ /// helper for exception-safe object creation
+ template<typename T, typename... Args>
+ static T* create(Args&& ... args)
+ {
+ AllocatorType<T> alloc;
+ using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
+
+ auto deleter = [&](T * object)
+ {
+ AllocatorTraits::deallocate(alloc, object, 1);
+ };
+ std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
+ AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
+ assert(object != nullptr);
+ return object.release();
+ }
+
+ ////////////////////////
+ // JSON value storage //
+ ////////////////////////
+
+ /*!
+ @brief a JSON value
+
+ The actual storage for a JSON value of the @ref basic_json class. This
+ union combines the different storage types for the JSON value types
+ defined in @ref value_t.
+
+ JSON type | value_t type | used type
+ --------- | --------------- | ------------------------
+ object | object | pointer to @ref object_t
+ array | array | pointer to @ref array_t
+ string | string | pointer to @ref string_t
+ boolean | boolean | @ref boolean_t
+ number | number_integer | @ref number_integer_t
+ number | number_unsigned | @ref number_unsigned_t
+ number | number_float | @ref number_float_t
+ null | null | *no value is stored*
+
+ @note Variable-length types (objects, arrays, and strings) are stored as
+ pointers. The size of the union should not exceed 64 bits if the default
+ value types are used.
+
+ @since version 1.0.0
+ */
+ union json_value
+ {
+ /// object (stored with pointer to save storage)
+ object_t* object;
+ /// array (stored with pointer to save storage)
+ array_t* array;
+ /// string (stored with pointer to save storage)
+ string_t* string;
+ /// boolean
+ boolean_t boolean;
+ /// number (integer)
+ number_integer_t number_integer;
+ /// number (unsigned integer)
+ number_unsigned_t number_unsigned;
+ /// number (floating-point)
+ number_float_t number_float;
+
+ /// default constructor (for null values)
+ json_value() = default;
+ /// constructor for booleans
+ json_value(boolean_t v) noexcept : boolean(v) {}
+ /// constructor for numbers (integer)
+ json_value(number_integer_t v) noexcept : number_integer(v) {}
+ /// constructor for numbers (unsigned)
+ json_value(number_unsigned_t v) noexcept : number_unsigned(v) {}
+ /// constructor for numbers (floating-point)
+ json_value(number_float_t v) noexcept : number_float(v) {}
+ /// constructor for empty values of a given type
+ json_value(value_t t)
+ {
+ switch (t)
+ {
+ case value_t::object:
+ {
+ object = create<object_t>();
+ break;
+ }
+
+ case value_t::array:
+ {
+ array = create<array_t>();
+ break;
+ }
+
+ case value_t::string:
+ {
+ string = create<string_t>("");
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ boolean = boolean_t(false);
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ number_integer = number_integer_t(0);
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ number_unsigned = number_unsigned_t(0);
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ number_float = number_float_t(0.0);
+ break;
+ }
+
+ case value_t::null:
+ {
+ object = nullptr; // silence warning, see #821
+ break;
+ }
+
+ default:
+ {
+ object = nullptr; // silence warning, see #821
+ if (JSON_UNLIKELY(t == value_t::null))
+ {
+ JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.6.1")); // LCOV_EXCL_LINE
+ }
+ break;
+ }
+ }
+ }
+
+ /// constructor for strings
+ json_value(const string_t& value)
+ {
+ string = create<string_t>(value);
+ }
+
+ /// constructor for rvalue strings
+ json_value(string_t&& value)
+ {
+ string = create<string_t>(std::move(value));
+ }
+
+ /// constructor for objects
+ json_value(const object_t& value)
+ {
+ object = create<object_t>(value);
+ }
+
+ /// constructor for rvalue objects
+ json_value(object_t&& value)
+ {
+ object = create<object_t>(std::move(value));
+ }
+
+ /// constructor for arrays
+ json_value(const array_t& value)
+ {
+ array = create<array_t>(value);
+ }
+
+ /// constructor for rvalue arrays
+ json_value(array_t&& value)
+ {
+ array = create<array_t>(std::move(value));
+ }
+
+ void destroy(value_t t) noexcept
+ {
+ switch (t)
+ {
+ case value_t::object:
+ {
+ AllocatorType<object_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ AllocatorType<array_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);
+ break;
+ }
+
+ case value_t::string:
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ };
+
+ /*!
+ @brief checks the class invariants
+
+ This function asserts the class invariants. It needs to be called at the
+ end of every constructor to make sure that created objects respect the
+ invariant. Furthermore, it has to be called each time the type of a JSON
+ value is changed, because the invariant expresses a relationship between
+ @a m_type and @a m_value.
+ */
+ void assert_invariant() const noexcept
+ {
+ assert(m_type != value_t::object or m_value.object != nullptr);
+ assert(m_type != value_t::array or m_value.array != nullptr);
+ assert(m_type != value_t::string or m_value.string != nullptr);
+ }
+
+ public:
+ //////////////////////////
+ // JSON parser callback //
+ //////////////////////////
+
+ /*!
+ @brief parser event types
+
+ The parser callback distinguishes the following events:
+ - `object_start`: the parser read `{` and started to process a JSON object
+ - `key`: the parser read a key of a value in an object
+ - `object_end`: the parser read `}` and finished processing a JSON object
+ - `array_start`: the parser read `[` and started to process a JSON array
+ - `array_end`: the parser read `]` and finished processing a JSON array
+ - `value`: the parser finished reading a JSON value
+
+ @image html callback_events.png "Example when certain parse events are triggered"
+
+ @sa @ref parser_callback_t for more information and examples
+ */
+ using parse_event_t = typename parser::parse_event_t;
+
+ /*!
+ @brief per-element parser callback type
+
+ With a parser callback function, the result of parsing a JSON text can be
+ influenced. When passed to @ref parse, it is called on certain events
+ (passed as @ref parse_event_t via parameter @a event) with a set recursion
+ depth @a depth and context JSON value @a parsed. The return value of the
+ callback function is a boolean indicating whether the element that emitted
+ the callback shall be kept or not.
+
+ We distinguish six scenarios (determined by the event type) in which the
+ callback function can be called. The following table describes the values
+ of the parameters @a depth, @a event, and @a parsed.
+
+ parameter @a event | description | parameter @a depth | parameter @a parsed
+ ------------------ | ----------- | ------------------ | -------------------
+ parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded
+ parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key
+ parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object
+ parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded
+ parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array
+ parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value
+
+ @image html callback_events.png "Example when certain parse events are triggered"
+
+ Discarding a value (i.e., returning `false`) has different effects
+ depending on the context in which function was called:
+
+ - Discarded values in structured types are skipped. That is, the parser
+ will behave as if the discarded value was never read.
+ - In case a value outside a structured type is skipped, it is replaced
+ with `null`. This case happens if the top-level element is skipped.
+
+ @param[in] depth the depth of the recursion during parsing
+
+ @param[in] event an event of type parse_event_t indicating the context in
+ the callback function has been called
+
+ @param[in,out] parsed the current intermediate parse result; note that
+ writing to this value has no effect for parse_event_t::key events
+
+ @return Whether the JSON value which called the function during parsing
+ should be kept (`true`) or not (`false`). In the latter case, it is either
+ skipped completely or replaced by an empty discarded object.
+
+ @sa @ref parse for examples
+
+ @since version 1.0.0
+ */
+ using parser_callback_t = typename parser::parser_callback_t;
+
+ //////////////////
+ // constructors //
+ //////////////////
+
+ /// @name constructors and destructors
+ /// Constructors of class @ref basic_json, copy/move constructor, copy
+ /// assignment, static functions creating objects, and the destructor.
+ /// @{
+
+ /*!
+ @brief create an empty value with a given type
+
+ Create an empty JSON value with a given type. The value will be default
+ initialized with an empty value which depends on the type:
+
+ Value type | initial value
+ ----------- | -------------
+ null | `null`
+ boolean | `false`
+ string | `""`
+ number | `0`
+ object | `{}`
+ array | `[]`
+
+ @param[in] v the type of the value to create
+
+ @complexity Constant.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows the constructor for different @ref
+ value_t values,basic_json__value_t}
+
+ @sa @ref clear() -- restores the postcondition of this constructor
+
+ @since version 1.0.0
+ */
+ basic_json(const value_t v)
+ : m_type(v), m_value(v)
+ {
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a null object
+
+ Create a `null` JSON value. It either takes a null pointer as parameter
+ (explicitly creating `null`) or no parameter (implicitly creating `null`).
+ The passed null pointer itself is not read -- it is only used to choose
+ the right constructor.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this constructor never throws
+ exceptions.
+
+ @liveexample{The following code shows the constructor with and without a
+ null pointer parameter.,basic_json__nullptr_t}
+
+ @since version 1.0.0
+ */
+ basic_json(std::nullptr_t = nullptr) noexcept
+ : basic_json(value_t::null)
+ {
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a JSON value
+
+ This is a "catch all" constructor for all compatible JSON types; that is,
+ types for which a `to_json()` method exists. The constructor forwards the
+ parameter @a val to that method (to `json_serializer<U>::to_json` method
+ with `U = uncvref_t<CompatibleType>`, to be exact).
+
+ Template type @a CompatibleType includes, but is not limited to, the
+ following types:
+ - **arrays**: @ref array_t and all kinds of compatible containers such as
+ `std::vector`, `std::deque`, `std::list`, `std::forward_list`,
+ `std::array`, `std::valarray`, `std::set`, `std::unordered_set`,
+ `std::multiset`, and `std::unordered_multiset` with a `value_type` from
+ which a @ref basic_json value can be constructed.
+ - **objects**: @ref object_t and all kinds of compatible associative
+ containers such as `std::map`, `std::unordered_map`, `std::multimap`,
+ and `std::unordered_multimap` with a `key_type` compatible to
+ @ref string_t and a `value_type` from which a @ref basic_json value can
+ be constructed.
+ - **strings**: @ref string_t, string literals, and all compatible string
+ containers can be used.
+ - **numbers**: @ref number_integer_t, @ref number_unsigned_t,
+ @ref number_float_t, and all convertible number types such as `int`,
+ `size_t`, `int64_t`, `float` or `double` can be used.
+ - **boolean**: @ref boolean_t / `bool` can be used.
+
+ See the examples below.
+
+ @tparam CompatibleType a type such that:
+ - @a CompatibleType is not derived from `std::istream`,
+ - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move
+ constructors),
+ - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments)
+ - @a CompatibleType is not a @ref basic_json nested type (e.g.,
+ @ref json_pointer, @ref iterator, etc ...)
+ - @ref @ref json_serializer<U> has a
+ `to_json(basic_json_t&, CompatibleType&&)` method
+
+ @tparam U = `uncvref_t<CompatibleType>`
+
+ @param[in] val the value to be forwarded to the respective constructor
+
+ @complexity Usually linear in the size of the passed @a val, also
+ depending on the implementation of the called `to_json()`
+ method.
+
+ @exceptionsafety Depends on the called constructor. For types directly
+ supported by the library (i.e., all types for which no `to_json()` function
+ was provided), strong guarantee holds: if an exception is thrown, there are
+ no changes to any JSON value.
+
+ @liveexample{The following code shows the constructor with several
+ compatible types.,basic_json__CompatibleType}
+
+ @since version 2.1.0
+ */
+ template <typename CompatibleType,
+ typename U = detail::uncvref_t<CompatibleType>,
+ detail::enable_if_t<
+ not detail::is_basic_json<U>::value and detail::is_compatible_type<basic_json_t, U>::value, int> = 0>
+ basic_json(CompatibleType && val) noexcept(noexcept(
+ JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
+ std::forward<CompatibleType>(val))))
+ {
+ JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val));
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a JSON value from an existing one
+
+ This is a constructor for existing @ref basic_json types.
+ It does not hijack copy/move constructors, since the parameter has different
+ template arguments than the current ones.
+
+ The constructor tries to convert the internal @ref m_value of the parameter.
+
+ @tparam BasicJsonType a type such that:
+ - @a BasicJsonType is a @ref basic_json type.
+ - @a BasicJsonType has different template arguments than @ref basic_json_t.
+
+ @param[in] val the @ref basic_json value to be converted.
+
+ @complexity Usually linear in the size of the passed @a val, also
+ depending on the implementation of the called `to_json()`
+ method.
+
+ @exceptionsafety Depends on the called constructor. For types directly
+ supported by the library (i.e., all types for which no `to_json()` function
+ was provided), strong guarantee holds: if an exception is thrown, there are
+ no changes to any JSON value.
+
+ @since version 3.2.0
+ */
+ template <typename BasicJsonType,
+ detail::enable_if_t<
+ detail::is_basic_json<BasicJsonType>::value and not std::is_same<basic_json, BasicJsonType>::value, int> = 0>
+ basic_json(const BasicJsonType& val)
+ {
+ using other_boolean_t = typename BasicJsonType::boolean_t;
+ using other_number_float_t = typename BasicJsonType::number_float_t;
+ using other_number_integer_t = typename BasicJsonType::number_integer_t;
+ using other_number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using other_string_t = typename BasicJsonType::string_t;
+ using other_object_t = typename BasicJsonType::object_t;
+ using other_array_t = typename BasicJsonType::array_t;
+
+ switch (val.type())
+ {
+ case value_t::boolean:
+ JSONSerializer<other_boolean_t>::to_json(*this, val.template get<other_boolean_t>());
+ break;
+ case value_t::number_float:
+ JSONSerializer<other_number_float_t>::to_json(*this, val.template get<other_number_float_t>());
+ break;
+ case value_t::number_integer:
+ JSONSerializer<other_number_integer_t>::to_json(*this, val.template get<other_number_integer_t>());
+ break;
+ case value_t::number_unsigned:
+ JSONSerializer<other_number_unsigned_t>::to_json(*this, val.template get<other_number_unsigned_t>());
+ break;
+ case value_t::string:
+ JSONSerializer<other_string_t>::to_json(*this, val.template get_ref<const other_string_t&>());
+ break;
+ case value_t::object:
+ JSONSerializer<other_object_t>::to_json(*this, val.template get_ref<const other_object_t&>());
+ break;
+ case value_t::array:
+ JSONSerializer<other_array_t>::to_json(*this, val.template get_ref<const other_array_t&>());
+ break;
+ case value_t::null:
+ *this = nullptr;
+ break;
+ case value_t::discarded:
+ m_type = value_t::discarded;
+ break;
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a container (array or object) from an initializer list
+
+ Creates a JSON value of type array or object from the passed initializer
+ list @a init. In case @a type_deduction is `true` (default), the type of
+ the JSON value to be created is deducted from the initializer list @a init
+ according to the following rules:
+
+ 1. If the list is empty, an empty JSON object value `{}` is created.
+ 2. If the list consists of pairs whose first element is a string, a JSON
+ object value is created where the first elements of the pairs are
+ treated as keys and the second elements are as values.
+ 3. In all other cases, an array is created.
+
+ The rules aim to create the best fit between a C++ initializer list and
+ JSON values. The rationale is as follows:
+
+ 1. The empty initializer list is written as `{}` which is exactly an empty
+ JSON object.
+ 2. C++ has no way of describing mapped types other than to list a list of
+ pairs. As JSON requires that keys must be of type string, rule 2 is the
+ weakest constraint one can pose on initializer lists to interpret them
+ as an object.
+ 3. In all other cases, the initializer list could not be interpreted as
+ JSON object type, so interpreting it as JSON array type is safe.
+
+ With the rules described above, the following JSON values cannot be
+ expressed by an initializer list:
+
+ - the empty array (`[]`): use @ref array(initializer_list_t)
+ with an empty initializer list in this case
+ - arrays whose elements satisfy rule 2: use @ref
+ array(initializer_list_t) with the same initializer list
+ in this case
+
+ @note When used without parentheses around an empty initializer list, @ref
+ basic_json() is called instead of this function, yielding the JSON null
+ value.
+
+ @param[in] init initializer list with JSON values
+
+ @param[in] type_deduction internal parameter; when set to `true`, the type
+ of the JSON value is deducted from the initializer list @a init; when set
+ to `false`, the type provided via @a manual_type is forced. This mode is
+ used by the functions @ref array(initializer_list_t) and
+ @ref object(initializer_list_t).
+
+ @param[in] manual_type internal parameter; when @a type_deduction is set
+ to `false`, the created JSON value will use the provided type (only @ref
+ value_t::array and @ref value_t::object are valid); when @a type_deduction
+ is set to `true`, this parameter has no effect
+
+ @throw type_error.301 if @a type_deduction is `false`, @a manual_type is
+ `value_t::object`, but @a init contains an element which is not a pair
+ whose first element is a string. In this case, the constructor could not
+ create an object. If @a type_deduction would have be `true`, an array
+ would have been created. See @ref object(initializer_list_t)
+ for an example.
+
+ @complexity Linear in the size of the initializer list @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The example below shows how JSON values are created from
+ initializer lists.,basic_json__list_init_t}
+
+ @sa @ref array(initializer_list_t) -- create a JSON array
+ value from an initializer list
+ @sa @ref object(initializer_list_t) -- create a JSON object
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ basic_json(initializer_list_t init,
+ bool type_deduction = true,
+ value_t manual_type = value_t::array)
+ {
+ // check if each element is an array with two elements whose first
+ // element is a string
+ bool is_an_object = std::all_of(init.begin(), init.end(),
+ [](const detail::json_ref<basic_json>& element_ref)
+ {
+ return element_ref->is_array() and element_ref->size() == 2 and (*element_ref)[0].is_string();
+ });
+
+ // adjust type if type deduction is not wanted
+ if (not type_deduction)
+ {
+ // if array is wanted, do not create an object though possible
+ if (manual_type == value_t::array)
+ {
+ is_an_object = false;
+ }
+
+ // if object is wanted but impossible, throw an exception
+ if (JSON_UNLIKELY(manual_type == value_t::object and not is_an_object))
+ {
+ JSON_THROW(type_error::create(301, "cannot create object from initializer list"));
+ }
+ }
+
+ if (is_an_object)
+ {
+ // the initializer list is a list of pairs -> create object
+ m_type = value_t::object;
+ m_value = value_t::object;
+
+ std::for_each(init.begin(), init.end(), [this](const detail::json_ref<basic_json>& element_ref)
+ {
+ auto element = element_ref.moved_or_copied();
+ m_value.object->emplace(
+ std::move(*((*element.m_value.array)[0].m_value.string)),
+ std::move((*element.m_value.array)[1]));
+ });
+ }
+ else
+ {
+ // the initializer list describes an array -> create array
+ m_type = value_t::array;
+ m_value.array = create<array_t>(init.begin(), init.end());
+ }
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief explicitly create an array from an initializer list
+
+ Creates a JSON array value from a given initializer list. That is, given a
+ list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the
+ initializer list is empty, the empty array `[]` is created.
+
+ @note This function is only needed to express two edge cases that cannot
+ be realized with the initializer list constructor (@ref
+ basic_json(initializer_list_t, bool, value_t)). These cases
+ are:
+ 1. creating an array whose elements are all pairs whose first element is a
+ string -- in this case, the initializer list constructor would create an
+ object, taking the first elements as keys
+ 2. creating an empty array -- passing the empty initializer list to the
+ initializer list constructor yields an empty object
+
+ @param[in] init initializer list with JSON values to create an array from
+ (optional)
+
+ @return JSON array value
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows an example for the `array`
+ function.,array}
+
+ @sa @ref basic_json(initializer_list_t, bool, value_t) --
+ create a JSON value from an initializer list
+ @sa @ref object(initializer_list_t) -- create a JSON object
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ JSON_NODISCARD
+ static basic_json array(initializer_list_t init = {})
+ {
+ return basic_json(init, false, value_t::array);
+ }
+
+ /*!
+ @brief explicitly create an object from an initializer list
+
+ Creates a JSON object value from a given initializer list. The initializer
+ lists elements must be pairs, and their first elements must be strings. If
+ the initializer list is empty, the empty object `{}` is created.
+
+ @note This function is only added for symmetry reasons. In contrast to the
+ related function @ref array(initializer_list_t), there are
+ no cases which can only be expressed by this function. That is, any
+ initializer list @a init can also be passed to the initializer list
+ constructor @ref basic_json(initializer_list_t, bool, value_t).
+
+ @param[in] init initializer list to create an object from (optional)
+
+ @return JSON object value
+
+ @throw type_error.301 if @a init is not a list of pairs whose first
+ elements are strings. In this case, no object can be created. When such a
+ value is passed to @ref basic_json(initializer_list_t, bool, value_t),
+ an array would have been created from the passed initializer list @a init.
+ See example below.
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows an example for the `object`
+ function.,object}
+
+ @sa @ref basic_json(initializer_list_t, bool, value_t) --
+ create a JSON value from an initializer list
+ @sa @ref array(initializer_list_t) -- create a JSON array
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ JSON_NODISCARD
+ static basic_json object(initializer_list_t init = {})
+ {
+ return basic_json(init, false, value_t::object);
+ }
+
+ /*!
+ @brief construct an array with count copies of given value
+
+ Constructs a JSON array value by creating @a cnt copies of a passed value.
+ In case @a cnt is `0`, an empty array is created.
+
+ @param[in] cnt the number of JSON copies of @a val to create
+ @param[in] val the JSON value to copy
+
+ @post `std::distance(begin(),end()) == cnt` holds.
+
+ @complexity Linear in @a cnt.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows examples for the @ref
+ basic_json(size_type\, const basic_json&)
+ constructor.,basic_json__size_type_basic_json}
+
+ @since version 1.0.0
+ */
+ basic_json(size_type cnt, const basic_json& val)
+ : m_type(value_t::array)
+ {
+ m_value.array = create<array_t>(cnt, val);
+ assert_invariant();
+ }
+
+ /*!
+ @brief construct a JSON container given an iterator range
+
+ Constructs the JSON value with the contents of the range `[first, last)`.
+ The semantics depends on the different types a JSON value can have:
+ - In case of a null type, invalid_iterator.206 is thrown.
+ - In case of other primitive types (number, boolean, or string), @a first
+ must be `begin()` and @a last must be `end()`. In this case, the value is
+ copied. Otherwise, invalid_iterator.204 is thrown.
+ - In case of structured types (array, object), the constructor behaves as
+ similar versions for `std::vector` or `std::map`; that is, a JSON array
+ or object is constructed from the values in the range.
+
+ @tparam InputIT an input iterator type (@ref iterator or @ref
+ const_iterator)
+
+ @param[in] first begin of the range to copy from (included)
+ @param[in] last end of the range to copy from (excluded)
+
+ @pre Iterators @a first and @a last must be initialized. **This
+ precondition is enforced with an assertion (see warning).** If
+ assertions are switched off, a violation of this precondition yields
+ undefined behavior.
+
+ @pre Range `[first, last)` is valid. Usually, this precondition cannot be
+ checked efficiently. Only certain edge cases are detected; see the
+ description of the exceptions below. A violation of this precondition
+ yields undefined behavior.
+
+ @warning A precondition is enforced with a runtime assertion that will
+ result in calling `std::abort` if this precondition is not met.
+ Assertions can be disabled by defining `NDEBUG` at compile time.
+ See https://en.cppreference.com/w/cpp/error/assert for more
+ information.
+
+ @throw invalid_iterator.201 if iterators @a first and @a last are not
+ compatible (i.e., do not belong to the same JSON value). In this case,
+ the range `[first, last)` is undefined.
+ @throw invalid_iterator.204 if iterators @a first and @a last belong to a
+ primitive type (number, boolean, or string), but @a first does not point
+ to the first element any more. In this case, the range `[first, last)` is
+ undefined. See example code below.
+ @throw invalid_iterator.206 if iterators @a first and @a last belong to a
+ null value. In this case, the range `[first, last)` is undefined.
+
+ @complexity Linear in distance between @a first and @a last.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The example below shows several ways to create JSON values by
+ specifying a subrange with iterators.,basic_json__InputIt_InputIt}
+
+ @since version 1.0.0
+ */
+ template<class InputIT, typename std::enable_if<
+ std::is_same<InputIT, typename basic_json_t::iterator>::value or
+ std::is_same<InputIT, typename basic_json_t::const_iterator>::value, int>::type = 0>
+ basic_json(InputIT first, InputIT last)
+ {
+ assert(first.m_object != nullptr);
+ assert(last.m_object != nullptr);
+
+ // make sure iterator fits the current value
+ if (JSON_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(201, "iterators are not compatible"));
+ }
+
+ // copy type from first iterator
+ m_type = first.m_object->m_type;
+
+ // check if iterator range is complete for primitive values
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ {
+ if (JSON_UNLIKELY(not first.m_it.primitive_iterator.is_begin()
+ or not last.m_it.primitive_iterator.is_end()))
+ {
+ JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ switch (m_type)
+ {
+ case value_t::number_integer:
+ {
+ m_value.number_integer = first.m_object->m_value.number_integer;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value.number_unsigned = first.m_object->m_value.number_unsigned;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value.number_float = first.m_object->m_value.number_float;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value.boolean = first.m_object->m_value.boolean;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value = *first.m_object->m_value.string;
+ break;
+ }
+
+ case value_t::object:
+ {
+ m_value.object = create<object_t>(first.m_it.object_iterator,
+ last.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value.array = create<array_t>(first.m_it.array_iterator,
+ last.m_it.array_iterator);
+ break;
+ }
+
+ default:
+ JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " +
+ std::string(first.m_object->type_name())));
+ }
+
+ assert_invariant();
+ }
+
+
+ ///////////////////////////////////////
+ // other constructors and destructor //
+ ///////////////////////////////////////
+
+ /// @private
+ basic_json(const detail::json_ref<basic_json>& ref)
+ : basic_json(ref.moved_or_copied())
+ {}
+
+ /*!
+ @brief copy constructor
+
+ Creates a copy of a given JSON value.
+
+ @param[in] other the JSON value to copy
+
+ @post `*this == other`
+
+ @complexity Linear in the size of @a other.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+ - As postcondition, it holds: `other == basic_json(other)`.
+
+ @liveexample{The following code shows an example for the copy
+ constructor.,basic_json__basic_json}
+
+ @since version 1.0.0
+ */
+ basic_json(const basic_json& other)
+ : m_type(other.m_type)
+ {
+ // check of passed value is valid
+ other.assert_invariant();
+
+ switch (m_type)
+ {
+ case value_t::object:
+ {
+ m_value = *other.m_value.object;
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value = *other.m_value.array;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value = *other.m_value.string;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value = other.m_value.boolean;
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ m_value = other.m_value.number_integer;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value = other.m_value.number_unsigned;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value = other.m_value.number_float;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief move constructor
+
+ Move constructor. Constructs a JSON value with the contents of the given
+ value @a other using move semantics. It "steals" the resources from @a
+ other and leaves it as JSON null value.
+
+ @param[in,out] other value to move to this object
+
+ @post `*this` has the same value as @a other before the call.
+ @post @a other is a JSON null value.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this constructor never throws
+ exceptions.
+
+ @requirement This function helps `basic_json` satisfying the
+ [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible)
+ requirements.
+
+ @liveexample{The code below shows the move constructor explicitly called
+ via std::move.,basic_json__moveconstructor}
+
+ @since version 1.0.0
+ */
+ basic_json(basic_json&& other) noexcept
+ : m_type(std::move(other.m_type)),
+ m_value(std::move(other.m_value))
+ {
+ // check that passed value is valid
+ other.assert_invariant();
+
+ // invalidate payload
+ other.m_type = value_t::null;
+ other.m_value = {};
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief copy assignment
+
+ Copy assignment operator. Copies a JSON value via the "copy and swap"
+ strategy: It is expressed in terms of the copy constructor, destructor,
+ and the `swap()` member function.
+
+ @param[in] other value to copy from
+
+ @complexity Linear.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+
+ @liveexample{The code below shows and example for the copy assignment. It
+ creates a copy of value `a` which is then swapped with `b`. Finally\, the
+ copy of `a` (which is the null value after the swap) is
+ destroyed.,basic_json__copyassignment}
+
+ @since version 1.0.0
+ */
+ basic_json& operator=(basic_json other) noexcept (
+ std::is_nothrow_move_constructible<value_t>::value and
+ std::is_nothrow_move_assignable<value_t>::value and
+ std::is_nothrow_move_constructible<json_value>::value and
+ std::is_nothrow_move_assignable<json_value>::value
+ )
+ {
+ // check that passed value is valid
+ other.assert_invariant();
+
+ using std::swap;
+ swap(m_type, other.m_type);
+ swap(m_value, other.m_value);
+
+ assert_invariant();
+ return *this;
+ }
+
+ /*!
+ @brief destructor
+
+ Destroys the JSON value and frees all allocated memory.
+
+ @complexity Linear.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+ - All stored elements are destroyed and all memory is freed.
+
+ @since version 1.0.0
+ */
+ ~basic_json() noexcept
+ {
+ assert_invariant();
+ m_value.destroy(m_type);
+ }
+
+ /// @}
+
+ public:
+ ///////////////////////
+ // object inspection //
+ ///////////////////////
+
+ /// @name object inspection
+ /// Functions to inspect the type of a JSON value.
+ /// @{
+
+ /*!
+ @brief serialization
+
+ Serialization function for JSON values. The function tries to mimic
+ Python's `json.dumps()` function, and currently supports its @a indent
+ and @a ensure_ascii parameters.
+
+ @param[in] indent If indent is nonnegative, then array elements and object
+ members will be pretty-printed with that indent level. An indent level of
+ `0` will only insert newlines. `-1` (the default) selects the most compact
+ representation.
+ @param[in] indent_char The character to use for indentation if @a indent is
+ greater than `0`. The default is ` ` (space).
+ @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters
+ in the output are escaped with `\uXXXX` sequences, and the result consists
+ of ASCII characters only.
+ @param[in] error_handler how to react on decoding errors; there are three
+ possible values: `strict` (throws and exception in case a decoding error
+ occurs; default), `replace` (replace invalid UTF-8 sequences with U+FFFD),
+ and `ignore` (ignore invalid UTF-8 sequences during serialization).
+
+ @return string containing the serialization of the JSON value
+
+ @throw type_error.316 if a string stored inside the JSON value is not
+ UTF-8 encoded
+
+ @complexity Linear.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @liveexample{The following example shows the effect of different @a indent\,
+ @a indent_char\, and @a ensure_ascii parameters to the result of the
+ serialization.,dump}
+
+ @see https://docs.python.org/2/library/json.html#json.dump
+
+ @since version 1.0.0; indentation character @a indent_char, option
+ @a ensure_ascii and exceptions added in version 3.0.0; error
+ handlers added in version 3.4.0.
+ */
+ string_t dump(const int indent = -1,
+ const char indent_char = ' ',
+ const bool ensure_ascii = false,
+ const error_handler_t error_handler = error_handler_t::strict) const
+ {
+ string_t result;
+ serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);
+
+ if (indent >= 0)
+ {
+ s.dump(*this, true, ensure_ascii, static_cast<unsigned int>(indent));
+ }
+ else
+ {
+ s.dump(*this, false, ensure_ascii, 0);
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief return the type of the JSON value (explicit)
+
+ Return the type of the JSON value as a value from the @ref value_t
+ enumeration.
+
+ @return the type of the JSON value
+ Value type | return value
+ ------------------------- | -------------------------
+ null | value_t::null
+ boolean | value_t::boolean
+ string | value_t::string
+ number (integer) | value_t::number_integer
+ number (unsigned integer) | value_t::number_unsigned
+ number (floating-point) | value_t::number_float
+ object | value_t::object
+ array | value_t::array
+ discarded | value_t::discarded
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `type()` for all JSON
+ types.,type}
+
+ @sa @ref operator value_t() -- return the type of the JSON value (implicit)
+ @sa @ref type_name() -- return the type as string
+
+ @since version 1.0.0
+ */
+ constexpr value_t type() const noexcept
+ {
+ return m_type;
+ }
+
+ /*!
+ @brief return whether type is primitive
+
+ This function returns true if and only if the JSON type is primitive
+ (string, number, boolean, or null).
+
+ @return `true` if type is primitive (string, number, boolean, or null),
+ `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_primitive()` for all JSON
+ types.,is_primitive}
+
+ @sa @ref is_structured() -- returns whether JSON value is structured
+ @sa @ref is_null() -- returns whether JSON value is `null`
+ @sa @ref is_string() -- returns whether JSON value is a string
+ @sa @ref is_boolean() -- returns whether JSON value is a boolean
+ @sa @ref is_number() -- returns whether JSON value is a number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_primitive() const noexcept
+ {
+ return is_null() or is_string() or is_boolean() or is_number();
+ }
+
+ /*!
+ @brief return whether type is structured
+
+ This function returns true if and only if the JSON type is structured
+ (array or object).
+
+ @return `true` if type is structured (array or object), `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_structured()` for all JSON
+ types.,is_structured}
+
+ @sa @ref is_primitive() -- returns whether value is primitive
+ @sa @ref is_array() -- returns whether value is an array
+ @sa @ref is_object() -- returns whether value is an object
+
+ @since version 1.0.0
+ */
+ constexpr bool is_structured() const noexcept
+ {
+ return is_array() or is_object();
+ }
+
+ /*!
+ @brief return whether value is null
+
+ This function returns true if and only if the JSON value is null.
+
+ @return `true` if type is null, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_null()` for all JSON
+ types.,is_null}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_null() const noexcept
+ {
+ return m_type == value_t::null;
+ }
+
+ /*!
+ @brief return whether value is a boolean
+
+ This function returns true if and only if the JSON value is a boolean.
+
+ @return `true` if type is boolean, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_boolean()` for all JSON
+ types.,is_boolean}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_boolean() const noexcept
+ {
+ return m_type == value_t::boolean;
+ }
+
+ /*!
+ @brief return whether value is a number
+
+ This function returns true if and only if the JSON value is a number. This
+ includes both integer (signed and unsigned) and floating-point values.
+
+ @return `true` if type is number (regardless whether integer, unsigned
+ integer or floating-type), `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number()` for all JSON
+ types.,is_number}
+
+ @sa @ref is_number_integer() -- check if value is an integer or unsigned
+ integer number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number() const noexcept
+ {
+ return is_number_integer() or is_number_float();
+ }
+
+ /*!
+ @brief return whether value is an integer number
+
+ This function returns true if and only if the JSON value is a signed or
+ unsigned integer number. This excludes floating-point values.
+
+ @return `true` if type is an integer or unsigned integer number, `false`
+ otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_integer()` for all
+ JSON types.,is_number_integer}
+
+ @sa @ref is_number() -- check if value is a number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number_integer() const noexcept
+ {
+ return m_type == value_t::number_integer or m_type == value_t::number_unsigned;
+ }
+
+ /*!
+ @brief return whether value is an unsigned integer number
+
+ This function returns true if and only if the JSON value is an unsigned
+ integer number. This excludes floating-point and signed integer values.
+
+ @return `true` if type is an unsigned integer number, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_unsigned()` for all
+ JSON types.,is_number_unsigned}
+
+ @sa @ref is_number() -- check if value is a number
+ @sa @ref is_number_integer() -- check if value is an integer or unsigned
+ integer number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 2.0.0
+ */
+ constexpr bool is_number_unsigned() const noexcept
+ {
+ return m_type == value_t::number_unsigned;
+ }
+
+ /*!
+ @brief return whether value is a floating-point number
+
+ This function returns true if and only if the JSON value is a
+ floating-point number. This excludes signed and unsigned integer values.
+
+ @return `true` if type is a floating-point number, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_float()` for all
+ JSON types.,is_number_float}
+
+ @sa @ref is_number() -- check if value is number
+ @sa @ref is_number_integer() -- check if value is an integer number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number_float() const noexcept
+ {
+ return m_type == value_t::number_float;
+ }
+
+ /*!
+ @brief return whether value is an object
+
+ This function returns true if and only if the JSON value is an object.
+
+ @return `true` if type is object, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_object()` for all JSON
+ types.,is_object}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_object() const noexcept
+ {
+ return m_type == value_t::object;
+ }
+
+ /*!
+ @brief return whether value is an array
+
+ This function returns true if and only if the JSON value is an array.
+
+ @return `true` if type is array, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_array()` for all JSON
+ types.,is_array}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_array() const noexcept
+ {
+ return m_type == value_t::array;
+ }
+
+ /*!
+ @brief return whether value is a string
+
+ This function returns true if and only if the JSON value is a string.
+
+ @return `true` if type is string, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_string()` for all JSON
+ types.,is_string}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_string() const noexcept
+ {
+ return m_type == value_t::string;
+ }
+
+ /*!
+ @brief return whether value is discarded
+
+ This function returns true if and only if the JSON value was discarded
+ during parsing with a callback function (see @ref parser_callback_t).
+
+ @note This function will always be `false` for JSON values after parsing.
+ That is, discarded values can only occur during parsing, but will be
+ removed when inside a structured value or replaced by null in other cases.
+
+ @return `true` if type is discarded, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_discarded()` for all JSON
+ types.,is_discarded}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_discarded() const noexcept
+ {
+ return m_type == value_t::discarded;
+ }
+
+ /*!
+ @brief return the type of the JSON value (implicit)
+
+ Implicitly return the type of the JSON value as a value from the @ref
+ value_t enumeration.
+
+ @return the type of the JSON value
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies the @ref value_t operator for
+ all JSON types.,operator__value_t}
+
+ @sa @ref type() -- return the type of the JSON value (explicit)
+ @sa @ref type_name() -- return the type as string
+
+ @since version 1.0.0
+ */
+ constexpr operator value_t() const noexcept
+ {
+ return m_type;
+ }
+
+ /// @}
+
+ private:
+ //////////////////
+ // value access //
+ //////////////////
+
+ /// get a boolean (explicit)
+ boolean_t get_impl(boolean_t* /*unused*/) const
+ {
+ if (JSON_LIKELY(is_boolean()))
+ {
+ return m_value.boolean;
+ }
+
+ JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(type_name())));
+ }
+
+ /// get a pointer to the value (object)
+ object_t* get_impl_ptr(object_t* /*unused*/) noexcept
+ {
+ return is_object() ? m_value.object : nullptr;
+ }
+
+ /// get a pointer to the value (object)
+ constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept
+ {
+ return is_object() ? m_value.object : nullptr;
+ }
+
+ /// get a pointer to the value (array)
+ array_t* get_impl_ptr(array_t* /*unused*/) noexcept
+ {
+ return is_array() ? m_value.array : nullptr;
+ }
+
+ /// get a pointer to the value (array)
+ constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept
+ {
+ return is_array() ? m_value.array : nullptr;
+ }
+
+ /// get a pointer to the value (string)
+ string_t* get_impl_ptr(string_t* /*unused*/) noexcept
+ {
+ return is_string() ? m_value.string : nullptr;
+ }
+
+ /// get a pointer to the value (string)
+ constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept
+ {
+ return is_string() ? m_value.string : nullptr;
+ }
+
+ /// get a pointer to the value (boolean)
+ boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept
+ {
+ return is_boolean() ? &m_value.boolean : nullptr;
+ }
+
+ /// get a pointer to the value (boolean)
+ constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept
+ {
+ return is_boolean() ? &m_value.boolean : nullptr;
+ }
+
+ /// get a pointer to the value (integer number)
+ number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept
+ {
+ return is_number_integer() ? &m_value.number_integer : nullptr;
+ }
+
+ /// get a pointer to the value (integer number)
+ constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept
+ {
+ return is_number_integer() ? &m_value.number_integer : nullptr;
+ }
+
+ /// get a pointer to the value (unsigned number)
+ number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept
+ {
+ return is_number_unsigned() ? &m_value.number_unsigned : nullptr;
+ }
+
+ /// get a pointer to the value (unsigned number)
+ constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept
+ {
+ return is_number_unsigned() ? &m_value.number_unsigned : nullptr;
+ }
+
+ /// get a pointer to the value (floating-point number)
+ number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept
+ {
+ return is_number_float() ? &m_value.number_float : nullptr;
+ }
+
+ /// get a pointer to the value (floating-point number)
+ constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept
+ {
+ return is_number_float() ? &m_value.number_float : nullptr;
+ }
+
+ /*!
+ @brief helper function to implement get_ref()
+
+ This function helps to implement get_ref() without code duplication for
+ const and non-const overloads
+
+ @tparam ThisType will be deduced as `basic_json` or `const basic_json`
+
+ @throw type_error.303 if ReferenceType does not match underlying value
+ type of the current JSON
+ */
+ template<typename ReferenceType, typename ThisType>
+ static ReferenceType get_ref_impl(ThisType& obj)
+ {
+ // delegate the call to get_ptr<>()
+ auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
+
+ if (JSON_LIKELY(ptr != nullptr))
+ {
+ return *ptr;
+ }
+
+ JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name())));
+ }
+
+ public:
+ /// @name value access
+ /// Direct access to the stored value of a JSON value.
+ /// @{
+
+ /*!
+ @brief get special-case overload
+
+ This overloads avoids a lot of template boilerplate, it can be seen as the
+ identity method
+
+ @tparam BasicJsonType == @ref basic_json
+
+ @return a copy of *this
+
+ @complexity Constant.
+
+ @since version 2.1.0
+ */
+ template<typename BasicJsonType, detail::enable_if_t<
+ std::is_same<typename std::remove_const<BasicJsonType>::type, basic_json_t>::value,
+ int> = 0>
+ basic_json get() const
+ {
+ return *this;
+ }
+
+ /*!
+ @brief get special-case overload
+
+ This overloads converts the current @ref basic_json in a different
+ @ref basic_json type
+
+ @tparam BasicJsonType == @ref basic_json
+
+ @return a copy of *this, converted into @tparam BasicJsonType
+
+ @complexity Depending on the implementation of the called `from_json()`
+ method.
+
+ @since version 3.2.0
+ */
+ template<typename BasicJsonType, detail::enable_if_t<
+ not std::is_same<BasicJsonType, basic_json>::value and
+ detail::is_basic_json<BasicJsonType>::value, int> = 0>
+ BasicJsonType get() const
+ {
+ return *this;
+ }
+
+ /*!
+ @brief get a value (explicit)
+
+ Explicit type conversion between the JSON value and a compatible value
+ which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
+ and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
+ The value is converted by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ ValueType ret;
+ JSONSerializer<ValueType>::from_json(*this, ret);
+ return ret;
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json,
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `void from_json(const basic_json&, ValueType&)`, and
+ - @ref json_serializer<ValueType> does not have a `from_json()` method of
+ the form `ValueType from_json(const basic_json&)`
+
+ @tparam ValueTypeCV the provided value type
+ @tparam ValueType the returned value type
+
+ @return copy of the JSON value, converted to @a ValueType
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,get__ValueType_const}
+
+ @since version 2.1.0
+ */
+ template<typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,
+ detail::enable_if_t <
+ not detail::is_basic_json<ValueType>::value and
+ detail::has_from_json<basic_json_t, ValueType>::value and
+ not detail::has_non_default_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType get() const noexcept(noexcept(
+ JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
+ {
+ // we cannot static_assert on ValueTypeCV being non-const, because
+ // there is support for get<const basic_json_t>(), which is why we
+ // still need the uncvref
+ static_assert(not std::is_reference<ValueTypeCV>::value,
+ "get() cannot be used with reference types, you might want to use get_ref()");
+ static_assert(std::is_default_constructible<ValueType>::value,
+ "types must be DefaultConstructible when used with get()");
+
+ ValueType ret;
+ JSONSerializer<ValueType>::from_json(*this, ret);
+ return ret;
+ }
+
+ /*!
+ @brief get a value (explicit); special case
+
+ Explicit type conversion between the JSON value and a compatible value
+ which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
+ and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
+ The value is converted by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ return JSONSerializer<ValueTypeCV>::from_json(*this);
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json and
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `ValueType from_json(const basic_json&)`
+
+ @note If @ref json_serializer<ValueType> has both overloads of
+ `from_json()`, this one is chosen.
+
+ @tparam ValueTypeCV the provided value type
+ @tparam ValueType the returned value type
+
+ @return copy of the JSON value, converted to @a ValueType
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @since version 2.1.0
+ */
+ template<typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,
+ detail::enable_if_t<not std::is_same<basic_json_t, ValueType>::value and
+ detail::has_non_default_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType get() const noexcept(noexcept(
+ JSONSerializer<ValueTypeCV>::from_json(std::declval<const basic_json_t&>())))
+ {
+ static_assert(not std::is_reference<ValueTypeCV>::value,
+ "get() cannot be used with reference types, you might want to use get_ref()");
+ return JSONSerializer<ValueTypeCV>::from_json(*this);
+ }
+
+ /*!
+ @brief get a value (explicit)
+
+ Explicit type conversion between the JSON value and a compatible value.
+ The value is filled into the input parameter by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ ValueType v;
+ JSONSerializer<ValueType>::from_json(*this, v);
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json,
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `void from_json(const basic_json&, ValueType&)`, and
+
+ @tparam ValueType the input parameter type.
+
+ @return the input parameter, allowing chaining calls.
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,get_to}
+
+ @since version 3.3.0
+ */
+ template<typename ValueType,
+ detail::enable_if_t <
+ not detail::is_basic_json<ValueType>::value and
+ detail::has_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType & get_to(ValueType& v) const noexcept(noexcept(
+ JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
+ {
+ JSONSerializer<ValueType>::from_json(*this, v);
+ return v;
+ }
+
+
+ /*!
+ @brief get a pointer value (implicit)
+
+ Implicit pointer access to the internally stored JSON value. No copies are
+ made.
+
+ @warning Writing data to the pointee of the result yields an undefined
+ state.
+
+ @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref
+ object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,
+ @ref number_unsigned_t, or @ref number_float_t. Enforced by a static
+ assertion.
+
+ @return pointer to the internally stored JSON value if the requested
+ pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how pointers to internal values of a
+ JSON value can be requested. Note that no type conversions are made and a
+ `nullptr` is returned if the value and the requested pointer type does not
+ match.,get_ptr}
+
+ @since version 1.0.0
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ auto get_ptr() noexcept -> decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
+ {
+ // delegate the call to get_impl_ptr<>()
+ return get_impl_ptr(static_cast<PointerType>(nullptr));
+ }
+
+ /*!
+ @brief get a pointer value (implicit)
+ @copydoc get_ptr()
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value and
+ std::is_const<typename std::remove_pointer<PointerType>::type>::value, int>::type = 0>
+ constexpr auto get_ptr() const noexcept -> decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
+ {
+ // delegate the call to get_impl_ptr<>() const
+ return get_impl_ptr(static_cast<PointerType>(nullptr));
+ }
+
+ /*!
+ @brief get a pointer value (explicit)
+
+ Explicit pointer access to the internally stored JSON value. No copies are
+ made.
+
+ @warning The pointer becomes invalid if the underlying JSON object
+ changes.
+
+ @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref
+ object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,
+ @ref number_unsigned_t, or @ref number_float_t.
+
+ @return pointer to the internally stored JSON value if the requested
+ pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how pointers to internal values of a
+ JSON value can be requested. Note that no type conversions are made and a
+ `nullptr` is returned if the value and the requested pointer type does not
+ match.,get__PointerType}
+
+ @sa @ref get_ptr() for explicit pointer-member access
+
+ @since version 1.0.0
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ auto get() noexcept -> decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
+ {
+ // delegate the call to get_ptr
+ return get_ptr<PointerType>();
+ }
+
+ /*!
+ @brief get a pointer value (explicit)
+ @copydoc get()
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ constexpr auto get() const noexcept -> decltype(std::declval<const basic_json_t&>().template get_ptr<PointerType>())
+ {
+ // delegate the call to get_ptr
+ return get_ptr<PointerType>();
+ }
+
+ /*!
+ @brief get a reference value (implicit)
+
+ Implicit reference access to the internally stored JSON value. No copies
+ are made.
+
+ @warning Writing data to the referee of the result yields an undefined
+ state.
+
+ @tparam ReferenceType reference type; must be a reference to @ref array_t,
+ @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or
+ @ref number_float_t. Enforced by static assertion.
+
+ @return reference to the internally stored JSON value if the requested
+ reference type @a ReferenceType fits to the JSON value; throws
+ type_error.303 otherwise
+
+ @throw type_error.303 in case passed type @a ReferenceType is incompatible
+ with the stored JSON value; see example below
+
+ @complexity Constant.
+
+ @liveexample{The example shows several calls to `get_ref()`.,get_ref}
+
+ @since version 1.1.0
+ */
+ template<typename ReferenceType, typename std::enable_if<
+ std::is_reference<ReferenceType>::value, int>::type = 0>
+ ReferenceType get_ref()
+ {
+ // delegate call to get_ref_impl
+ return get_ref_impl<ReferenceType>(*this);
+ }
+
+ /*!
+ @brief get a reference value (implicit)
+ @copydoc get_ref()
+ */
+ template<typename ReferenceType, typename std::enable_if<
+ std::is_reference<ReferenceType>::value and
+ std::is_const<typename std::remove_reference<ReferenceType>::type>::value, int>::type = 0>
+ ReferenceType get_ref() const
+ {
+ // delegate call to get_ref_impl
+ return get_ref_impl<ReferenceType>(*this);
+ }
+
+ /*!
+ @brief get a value (implicit)
+
+ Implicit type conversion between the JSON value and a compatible value.
+ The call is realized by calling @ref get() const.
+
+ @tparam ValueType non-pointer type compatible to the JSON value, for
+ instance `int` for JSON integer numbers, `bool` for JSON booleans, or
+ `std::vector` types for JSON arrays. The character type of @ref string_t
+ as well as an initializer list of this type is excluded to avoid
+ ambiguities as these types implicitly convert to `std::string`.
+
+ @return copy of the JSON value, converted to type @a ValueType
+
+ @throw type_error.302 in case passed type @a ValueType is incompatible
+ to the JSON value type (e.g., the JSON value is of type boolean, but a
+ string is requested); see example below
+
+ @complexity Linear in the size of the JSON value.
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,operator__ValueType}
+
+ @since version 1.0.0
+ */
+ template < typename ValueType, typename std::enable_if <
+ not std::is_pointer<ValueType>::value and
+ not std::is_same<ValueType, detail::json_ref<basic_json>>::value and
+ not std::is_same<ValueType, typename string_t::value_type>::value and
+ not detail::is_basic_json<ValueType>::value
+
+#ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015
+ and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
+#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER <= 1914))
+ and not std::is_same<ValueType, typename std::string_view>::value
+#endif
+#endif
+ and detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value
+ , int >::type = 0 >
+ operator ValueType() const
+ {
+ // delegate the call to get<>() const
+ return get<ValueType>();
+ }
+
+ /// @}
+
+
+ ////////////////////
+ // element access //
+ ////////////////////
+
+ /// @name element access
+ /// Access to the JSON value.
+ /// @{
+
+ /*!
+ @brief access specified array element with bounds checking
+
+ Returns a reference to the element at specified location @a idx, with
+ bounds checking.
+
+ @param[in] idx index of the element to access
+
+ @return reference to the element at index @a idx
+
+ @throw type_error.304 if the JSON value is not an array; in this case,
+ calling `at` with an index makes no sense. See example below.
+ @throw out_of_range.401 if the index @a idx is out of range of the array;
+ that is, `idx >= size()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how array elements can be read and
+ written using `at()`. It also demonstrates the different exceptions that
+ can be thrown.,at__size_type}
+ */
+ reference at(size_type idx)
+ {
+ // at only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ JSON_TRY
+ {
+ return m_value.array->at(idx);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified array element with bounds checking
+
+ Returns a const reference to the element at specified location @a idx,
+ with bounds checking.
+
+ @param[in] idx index of the element to access
+
+ @return const reference to the element at index @a idx
+
+ @throw type_error.304 if the JSON value is not an array; in this case,
+ calling `at` with an index makes no sense. See example below.
+ @throw out_of_range.401 if the index @a idx is out of range of the array;
+ that is, `idx >= size()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how array elements can be read using
+ `at()`. It also demonstrates the different exceptions that can be thrown.,
+ at__size_type_const}
+ */
+ const_reference at(size_type idx) const
+ {
+ // at only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ JSON_TRY
+ {
+ return m_value.array->at(idx);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified object element with bounds checking
+
+ Returns a reference to the element at with specified key @a key, with
+ bounds checking.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.304 if the JSON value is not an object; in this case,
+ calling `at` with a key makes no sense. See example below.
+ @throw out_of_range.403 if the key @a key is is not stored in the object;
+ that is, `find(key) == end()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Logarithmic in the size of the container.
+
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how object elements can be read and
+ written using `at()`. It also demonstrates the different exceptions that
+ can be thrown.,at__object_t_key_type}
+ */
+ reference at(const typename object_t::key_type& key)
+ {
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ JSON_TRY
+ {
+ return m_value.object->at(key);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(403, "key '" + key + "' not found"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified object element with bounds checking
+
+ Returns a const reference to the element at with specified key @a key,
+ with bounds checking.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @throw type_error.304 if the JSON value is not an object; in this case,
+ calling `at` with a key makes no sense. See example below.
+ @throw out_of_range.403 if the key @a key is is not stored in the object;
+ that is, `find(key) == end()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Logarithmic in the size of the container.
+
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how object elements can be read using
+ `at()`. It also demonstrates the different exceptions that can be thrown.,
+ at__object_t_key_type_const}
+ */
+ const_reference at(const typename object_t::key_type& key) const
+ {
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ JSON_TRY
+ {
+ return m_value.object->at(key);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(403, "key '" + key + "' not found"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified array element
+
+ Returns a reference to the element at specified location @a idx.
+
+ @note If @a idx is beyond the range of the array (i.e., `idx >= size()`),
+ then the array is silently filled up with `null` values to make `idx` a
+ valid reference to the last stored element.
+
+ @param[in] idx index of the element to access
+
+ @return reference to the element at index @a idx
+
+ @throw type_error.305 if the JSON value is not an array or null; in that
+ cases, using the [] operator with an index makes no sense.
+
+ @complexity Constant if @a idx is in the range of the array. Otherwise
+ linear in `idx - size()`.
+
+ @liveexample{The example below shows how array elements can be read and
+ written using `[]` operator. Note the addition of `null`
+ values.,operatorarray__size_type}
+
+ @since version 1.0.0
+ */
+ reference operator[](size_type idx)
+ {
+ // implicitly convert null value to an empty array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value.array = create<array_t>();
+ assert_invariant();
+ }
+
+ // operator[] only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ // fill up array with null values if given idx is outside range
+ if (idx >= m_value.array->size())
+ {
+ m_value.array->insert(m_value.array->end(),
+ idx - m_value.array->size() + 1,
+ basic_json());
+ }
+
+ return m_value.array->operator[](idx);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified array element
+
+ Returns a const reference to the element at specified location @a idx.
+
+ @param[in] idx index of the element to access
+
+ @return const reference to the element at index @a idx
+
+ @throw type_error.305 if the JSON value is not an array; in that case,
+ using the [] operator with an index makes no sense.
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how array elements can be read using
+ the `[]` operator.,operatorarray__size_type_const}
+
+ @since version 1.0.0
+ */
+ const_reference operator[](size_type idx) const
+ {
+ // const operator[] only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ return m_value.array->operator[](idx);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element
+
+ Returns a reference to the element at with specified key @a key.
+
+ @note If @a key is not found in the object, then it is silently added to
+ the object and filled with a `null` value to make `key` a valid reference.
+ In case the value was `null` before, it is converted to an object.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.305 if the JSON value is not an object or null; in that
+ cases, using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read and
+ written using the `[]` operator.,operatorarray__key_type}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+ */
+ reference operator[](const typename object_t::key_type& key)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ // operator[] only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ return m_value.object->operator[](key);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief read-only access specified object element
+
+ Returns a const reference to the element at with specified key @a key. No
+ bounds checking is performed.
+
+ @warning If the element with key @a key does not exist, the behavior is
+ undefined.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @pre The element with key @a key must exist. **This precondition is
+ enforced with an assertion.**
+
+ @throw type_error.305 if the JSON value is not an object; in that case,
+ using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read using
+ the `[]` operator.,operatorarray__key_type_const}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+ */
+ const_reference operator[](const typename object_t::key_type& key) const
+ {
+ // const operator[] only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ assert(m_value.object->find(key) != m_value.object->end());
+ return m_value.object->find(key)->second;
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element
+
+ Returns a reference to the element at with specified key @a key.
+
+ @note If @a key is not found in the object, then it is silently added to
+ the object and filled with a `null` value to make `key` a valid reference.
+ In case the value was `null` before, it is converted to an object.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.305 if the JSON value is not an object or null; in that
+ cases, using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read and
+ written using the `[]` operator.,operatorarray__key_type}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.1.0
+ */
+ template<typename T>
+ reference operator[](T* key)
+ {
+ // implicitly convert null to object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ return m_value.object->operator[](key);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief read-only access specified object element
+
+ Returns a const reference to the element at with specified key @a key. No
+ bounds checking is performed.
+
+ @warning If the element with key @a key does not exist, the behavior is
+ undefined.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @pre The element with key @a key must exist. **This precondition is
+ enforced with an assertion.**
+
+ @throw type_error.305 if the JSON value is not an object; in that case,
+ using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read using
+ the `[]` operator.,operatorarray__key_type_const}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.1.0
+ */
+ template<typename T>
+ const_reference operator[](T* key) const
+ {
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ assert(m_value.object->find(key) != m_value.object->end());
+ return m_value.object->find(key)->second;
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element with default value
+
+ Returns either a copy of an object's element at the specified key @a key
+ or a given default value if no element with key @a key exists.
+
+ The function is basically equivalent to executing
+ @code {.cpp}
+ try {
+ return at(key);
+ } catch(out_of_range) {
+ return default_value;
+ }
+ @endcode
+
+ @note Unlike @ref at(const typename object_t::key_type&), this function
+ does not throw if the given key @a key was not found.
+
+ @note Unlike @ref operator[](const typename object_t::key_type& key), this
+ function does not implicitly add an element to the position defined by @a
+ key. This function is furthermore also applicable to const objects.
+
+ @param[in] key key of the element to access
+ @param[in] default_value the value to return if @a key is not found
+
+ @tparam ValueType type compatible to JSON values, for instance `int` for
+ JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for
+ JSON arrays. Note the type of the expected value at @a key and the default
+ value @a default_value must be compatible.
+
+ @return copy of the element at key @a key or @a default_value if @a key
+ is not found
+
+ @throw type_error.306 if the JSON value is not an object; in that case,
+ using `value()` with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be queried
+ with a default value.,basic_json__value}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+
+ @since version 1.0.0
+ */
+ template<class ValueType, typename std::enable_if<
+ std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
+ ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
+ {
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ // if key is found, return value and given default value otherwise
+ const auto it = find(key);
+ if (it != end())
+ {
+ return *it;
+ }
+
+ return default_value;
+ }
+
+ JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief overload for a default value of type const char*
+ @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const
+ */
+ string_t value(const typename object_t::key_type& key, const char* default_value) const
+ {
+ return value(key, string_t(default_value));
+ }
+
+ /*!
+ @brief access specified object element via JSON Pointer with default value
+
+ Returns either a copy of an object's element at the specified key @a key
+ or a given default value if no element with key @a key exists.
+
+ The function is basically equivalent to executing
+ @code {.cpp}
+ try {
+ return at(ptr);
+ } catch(out_of_range) {
+ return default_value;
+ }
+ @endcode
+
+ @note Unlike @ref at(const json_pointer&), this function does not throw
+ if the given key @a key was not found.
+
+ @param[in] ptr a JSON pointer to the element to access
+ @param[in] default_value the value to return if @a ptr found no value
+
+ @tparam ValueType type compatible to JSON values, for instance `int` for
+ JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for
+ JSON arrays. Note the type of the expected value at @a key and the default
+ value @a default_value must be compatible.
+
+ @return copy of the element at key @a key or @a default_value if @a key
+ is not found
+
+ @throw type_error.306 if the JSON value is not an object; in that case,
+ using `value()` with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be queried
+ with a default value.,basic_json__value_ptr}
+
+ @sa @ref operator[](const json_pointer&) for unchecked access by reference
+
+ @since version 2.0.2
+ */
+ template<class ValueType, typename std::enable_if<
+ std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
+ ValueType value(const json_pointer& ptr, const ValueType& default_value) const
+ {
+ // at only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ // if pointer resolves a value, return it or use default value
+ JSON_TRY
+ {
+ return ptr.get_checked(this);
+ }
+ JSON_INTERNAL_CATCH (out_of_range&)
+ {
+ return default_value;
+ }
+ }
+
+ JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief overload for a default value of type const char*
+ @copydoc basic_json::value(const json_pointer&, ValueType) const
+ */
+ string_t value(const json_pointer& ptr, const char* default_value) const
+ {
+ return value(ptr, string_t(default_value));
+ }
+
+ /*!
+ @brief access the first element
+
+ Returns a reference to the first element in the container. For a JSON
+ container `c`, the expression `c.front()` is equivalent to `*c.begin()`.
+
+ @return In case of a structured type (array or object), a reference to the
+ first element is returned. In case of number, string, or boolean values, a
+ reference to the value is returned.
+
+ @complexity Constant.
+
+ @pre The JSON value must not be `null` (would throw `std::out_of_range`)
+ or an empty array or object (undefined behavior, **guarded by
+ assertions**).
+ @post The JSON value remains unchanged.
+
+ @throw invalid_iterator.214 when called on `null` value
+
+ @liveexample{The following code shows an example for `front()`.,front}
+
+ @sa @ref back() -- access the last element
+
+ @since version 1.0.0
+ */
+ reference front()
+ {
+ return *begin();
+ }
+
+ /*!
+ @copydoc basic_json::front()
+ */
+ const_reference front() const
+ {
+ return *cbegin();
+ }
+
+ /*!
+ @brief access the last element
+
+ Returns a reference to the last element in the container. For a JSON
+ container `c`, the expression `c.back()` is equivalent to
+ @code {.cpp}
+ auto tmp = c.end();
+ --tmp;
+ return *tmp;
+ @endcode
+
+ @return In case of a structured type (array or object), a reference to the
+ last element is returned. In case of number, string, or boolean values, a
+ reference to the value is returned.
+
+ @complexity Constant.
+
+ @pre The JSON value must not be `null` (would throw `std::out_of_range`)
+ or an empty array or object (undefined behavior, **guarded by
+ assertions**).
+ @post The JSON value remains unchanged.
+
+ @throw invalid_iterator.214 when called on a `null` value. See example
+ below.
+
+ @liveexample{The following code shows an example for `back()`.,back}
+
+ @sa @ref front() -- access the first element
+
+ @since version 1.0.0
+ */
+ reference back()
+ {
+ auto tmp = end();
+ --tmp;
+ return *tmp;
+ }
+
+ /*!
+ @copydoc basic_json::back()
+ */
+ const_reference back() const
+ {
+ auto tmp = cend();
+ --tmp;
+ return *tmp;
+ }
+
+ /*!
+ @brief remove element given an iterator
+
+ Removes the element specified by iterator @a pos. The iterator @a pos must
+ be valid and dereferenceable. Thus the `end()` iterator (which is valid,
+ but is not dereferenceable) cannot be used as a value for @a pos.
+
+ If called on a primitive type other than `null`, the resulting JSON value
+ will be `null`.
+
+ @param[in] pos iterator to the element to remove
+ @return Iterator following the last removed element. If the iterator @a
+ pos refers to the last element, the `end()` iterator is returned.
+
+ @tparam IteratorType an @ref iterator or @ref const_iterator
+
+ @post Invalidates iterators and references at or after the point of the
+ erase, including the `end()` iterator.
+
+ @throw type_error.307 if called on a `null` value; example: `"cannot use
+ erase() with null"`
+ @throw invalid_iterator.202 if called on an iterator which does not belong
+ to the current JSON value; example: `"iterator does not fit current
+ value"`
+ @throw invalid_iterator.205 if called on a primitive type with invalid
+ iterator (i.e., any iterator which is not `begin()`); example: `"iterator
+ out of range"`
+
+ @complexity The complexity depends on the type:
+ - objects: amortized constant
+ - arrays: linear in distance between @a pos and the end of the container
+ - strings: linear in the length of the string
+ - other types: constant
+
+ @liveexample{The example shows the result of `erase()` for different JSON
+ types.,erase__IteratorType}
+
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ template<class IteratorType, typename std::enable_if<
+ std::is_same<IteratorType, typename basic_json_t::iterator>::value or
+ std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int>::type
+ = 0>
+ IteratorType erase(IteratorType pos)
+ {
+ // make sure iterator fits the current value
+ if (JSON_UNLIKELY(this != pos.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ IteratorType result = end();
+
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ {
+ if (JSON_UNLIKELY(not pos.m_it.primitive_iterator.is_begin()))
+ {
+ JSON_THROW(invalid_iterator::create(205, "iterator out of range"));
+ }
+
+ if (is_string())
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
+ m_value.string = nullptr;
+ }
+
+ m_type = value_t::null;
+ assert_invariant();
+ break;
+ }
+
+ case value_t::object:
+ {
+ result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief remove elements given an iterator range
+
+ Removes the element specified by the range `[first; last)`. The iterator
+ @a first does not need to be dereferenceable if `first == last`: erasing
+ an empty range is a no-op.
+
+ If called on a primitive type other than `null`, the resulting JSON value
+ will be `null`.
+
+ @param[in] first iterator to the beginning of the range to remove
+ @param[in] last iterator past the end of the range to remove
+ @return Iterator following the last removed element. If the iterator @a
+ second refers to the last element, the `end()` iterator is returned.
+
+ @tparam IteratorType an @ref iterator or @ref const_iterator
+
+ @post Invalidates iterators and references at or after the point of the
+ erase, including the `end()` iterator.
+
+ @throw type_error.307 if called on a `null` value; example: `"cannot use
+ erase() with null"`
+ @throw invalid_iterator.203 if called on iterators which does not belong
+ to the current JSON value; example: `"iterators do not fit current value"`
+ @throw invalid_iterator.204 if called on a primitive type with invalid
+ iterators (i.e., if `first != begin()` and `last != end()`); example:
+ `"iterators out of range"`
+
+ @complexity The complexity depends on the type:
+ - objects: `log(size()) + std::distance(first, last)`
+ - arrays: linear in the distance between @a first and @a last, plus linear
+ in the distance between @a last and end of the container
+ - strings: linear in the length of the string
+ - other types: constant
+
+ @liveexample{The example shows the result of `erase()` for different JSON
+ types.,erase__IteratorType_IteratorType}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ template<class IteratorType, typename std::enable_if<
+ std::is_same<IteratorType, typename basic_json_t::iterator>::value or
+ std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int>::type
+ = 0>
+ IteratorType erase(IteratorType first, IteratorType last)
+ {
+ // make sure iterator fits the current value
+ if (JSON_UNLIKELY(this != first.m_object or this != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value"));
+ }
+
+ IteratorType result = end();
+
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ {
+ if (JSON_LIKELY(not first.m_it.primitive_iterator.is_begin()
+ or not last.m_it.primitive_iterator.is_end()))
+ {
+ JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
+ }
+
+ if (is_string())
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
+ m_value.string = nullptr;
+ }
+
+ m_type = value_t::null;
+ assert_invariant();
+ break;
+ }
+
+ case value_t::object:
+ {
+ result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
+ last.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
+ last.m_it.array_iterator);
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief remove element from a JSON object given a key
+
+ Removes elements from a JSON object with the key value @a key.
+
+ @param[in] key value of the elements to remove
+
+ @return Number of elements removed. If @a ObjectType is the default
+ `std::map` type, the return value will always be `0` (@a key was not
+ found) or `1` (@a key was found).
+
+ @post References and iterators to the erased elements are invalidated.
+ Other references and iterators are not affected.
+
+ @throw type_error.307 when called on a type other than JSON object;
+ example: `"cannot use erase() with null"`
+
+ @complexity `log(size()) + count(key)`
+
+ @liveexample{The example shows the effect of `erase()`.,erase__key_type}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ size_type erase(const typename object_t::key_type& key)
+ {
+ // this erase only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ return m_value.object->erase(key);
+ }
+
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief remove element from a JSON array given an index
+
+ Removes element from a JSON array at the index @a idx.
+
+ @param[in] idx index of the element to remove
+
+ @throw type_error.307 when called on a type other than JSON object;
+ example: `"cannot use erase() with null"`
+ @throw out_of_range.401 when `idx >= size()`; example: `"array index 17
+ is out of range"`
+
+ @complexity Linear in distance between @a idx and the end of the container.
+
+ @liveexample{The example shows the effect of `erase()`.,erase__size_type}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+
+ @since version 1.0.0
+ */
+ void erase(const size_type idx)
+ {
+ // this erase only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ if (JSON_UNLIKELY(idx >= size()))
+ {
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+
+ m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
+ }
+ else
+ {
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+ }
+
+ /// @}
+
+
+ ////////////
+ // lookup //
+ ////////////
+
+ /// @name lookup
+ /// @{
+
+ /*!
+ @brief find an element in a JSON object
+
+ Finds an element in a JSON object with key equivalent to @a key. If the
+ element is not found or the JSON value is not an object, end() is
+ returned.
+
+ @note This method always returns @ref end() when executed on a JSON type
+ that is not an object.
+
+ @param[in] key key value of the element to search for.
+
+ @return Iterator to an element with key equivalent to @a key. If no such
+ element is found or the JSON value is not an object, past-the-end (see
+ @ref end()) iterator is returned.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The example shows how `find()` is used.,find__key_type}
+
+ @sa @ref contains(KeyT&&) const -- checks whether a key exists
+
+ @since version 1.0.0
+ */
+ template<typename KeyT>
+ iterator find(KeyT&& key)
+ {
+ auto result = end();
+
+ if (is_object())
+ {
+ result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief find an element in a JSON object
+ @copydoc find(KeyT&&)
+ */
+ template<typename KeyT>
+ const_iterator find(KeyT&& key) const
+ {
+ auto result = cend();
+
+ if (is_object())
+ {
+ result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief returns the number of occurrences of a key in a JSON object
+
+ Returns the number of elements with key @a key. If ObjectType is the
+ default `std::map` type, the return value will always be `0` (@a key was
+ not found) or `1` (@a key was found).
+
+ @note This method always returns `0` when executed on a JSON type that is
+ not an object.
+
+ @param[in] key key value of the element to count
+
+ @return Number of elements with key @a key. If the JSON value is not an
+ object, the return value will be `0`.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The example shows how `count()` is used.,count}
+
+ @since version 1.0.0
+ */
+ template<typename KeyT>
+ size_type count(KeyT&& key) const
+ {
+ // return 0 for all nonobject types
+ return is_object() ? m_value.object->count(std::forward<KeyT>(key)) : 0;
+ }
+
+ /*!
+ @brief check the existence of an element in a JSON object
+
+ Check whether an element exists in a JSON object with key equivalent to
+ @a key. If the element is not found or the JSON value is not an object,
+ false is returned.
+
+ @note This method always returns false when executed on a JSON type
+ that is not an object.
+
+ @param[in] key key value to check its existence.
+
+ @return true if an element with specified @a key exists. If no such
+ element with such key is found or the JSON value is not an object,
+ false is returned.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The following code shows an example for `contains()`.,contains}
+
+ @sa @ref find(KeyT&&) -- returns an iterator to an object element
+
+ @since version 3.6.0
+ */
+ template<typename KeyT>
+ bool contains(KeyT&& key) const
+ {
+ return is_object() and m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end();
+ }
+
+ /// @}
+
+
+ ///////////////
+ // iterators //
+ ///////////////
+
+ /// @name iterators
+ /// @{
+
+ /*!
+ @brief returns an iterator to the first element
+
+ Returns an iterator to the first element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return iterator to the first element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+
+ @liveexample{The following code shows an example for `begin()`.,begin}
+
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref cend() -- returns a const iterator to the end
+
+ @since version 1.0.0
+ */
+ iterator begin() noexcept
+ {
+ iterator result(this);
+ result.set_begin();
+ return result;
+ }
+
+ /*!
+ @copydoc basic_json::cbegin()
+ */
+ const_iterator begin() const noexcept
+ {
+ return cbegin();
+ }
+
+ /*!
+ @brief returns a const iterator to the first element
+
+ Returns a const iterator to the first element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return const iterator to the first element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
+
+ @liveexample{The following code shows an example for `cbegin()`.,cbegin}
+
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref cend() -- returns a const iterator to the end
+
+ @since version 1.0.0
+ */
+ const_iterator cbegin() const noexcept
+ {
+ const_iterator result(this);
+ result.set_begin();
+ return result;
+ }
+
+ /*!
+ @brief returns an iterator to one past the last element
+
+ Returns an iterator to one past the last element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return iterator one past the last element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+
+ @liveexample{The following code shows an example for `end()`.,end}
+
+ @sa @ref cend() -- returns a const iterator to the end
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+
+ @since version 1.0.0
+ */
+ iterator end() noexcept
+ {
+ iterator result(this);
+ result.set_end();
+ return result;
+ }
+
+ /*!
+ @copydoc basic_json::cend()
+ */
+ const_iterator end() const noexcept
+ {
+ return cend();
+ }
+
+ /*!
+ @brief returns a const iterator to one past the last element
+
+ Returns a const iterator to one past the last element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return const iterator one past the last element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).end()`.
+
+ @liveexample{The following code shows an example for `cend()`.,cend}
+
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+
+ @since version 1.0.0
+ */
+ const_iterator cend() const noexcept
+ {
+ const_iterator result(this);
+ result.set_end();
+ return result;
+ }
+
+ /*!
+ @brief returns an iterator to the reverse-beginning
+
+ Returns an iterator to the reverse-beginning; that is, the last element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `reverse_iterator(end())`.
+
+ @liveexample{The following code shows an example for `rbegin()`.,rbegin}
+
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref crend() -- returns a const reverse iterator to the end
+
+ @since version 1.0.0
+ */
+ reverse_iterator rbegin() noexcept
+ {
+ return reverse_iterator(end());
+ }
+
+ /*!
+ @copydoc basic_json::crbegin()
+ */
+ const_reverse_iterator rbegin() const noexcept
+ {
+ return crbegin();
+ }
+
+ /*!
+ @brief returns an iterator to the reverse-end
+
+ Returns an iterator to the reverse-end; that is, one before the first
+ element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `reverse_iterator(begin())`.
+
+ @liveexample{The following code shows an example for `rend()`.,rend}
+
+ @sa @ref crend() -- returns a const reverse iterator to the end
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+
+ @since version 1.0.0
+ */
+ reverse_iterator rend() noexcept
+ {
+ return reverse_iterator(begin());
+ }
+
+ /*!
+ @copydoc basic_json::crend()
+ */
+ const_reverse_iterator rend() const noexcept
+ {
+ return crend();
+ }
+
+ /*!
+ @brief returns a const reverse iterator to the last element
+
+ Returns a const iterator to the reverse-beginning; that is, the last
+ element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
+
+ @liveexample{The following code shows an example for `crbegin()`.,crbegin}
+
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref crend() -- returns a const reverse iterator to the end
+
+ @since version 1.0.0
+ */
+ const_reverse_iterator crbegin() const noexcept
+ {
+ return const_reverse_iterator(cend());
+ }
+
+ /*!
+ @brief returns a const reverse iterator to one before the first
+
+ Returns a const reverse iterator to the reverse-end; that is, one before
+ the first element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
+
+ @liveexample{The following code shows an example for `crend()`.,crend}
+
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+
+ @since version 1.0.0
+ */
+ const_reverse_iterator crend() const noexcept
+ {
+ return const_reverse_iterator(cbegin());
+ }
+
+ public:
+ /*!
+ @brief wrapper to access iterator member functions in range-based for
+
+ This function allows to access @ref iterator::key() and @ref
+ iterator::value() during range-based for loops. In these loops, a
+ reference to the JSON values is returned, so there is no access to the
+ underlying iterator.
+
+ For loop without iterator_wrapper:
+
+ @code{cpp}
+ for (auto it = j_object.begin(); it != j_object.end(); ++it)
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ Range-based for loop without iterator proxy:
+
+ @code{cpp}
+ for (auto it : j_object)
+ {
+ // "it" is of type json::reference and has no key() member
+ std::cout << "value: " << it << '\n';
+ }
+ @endcode
+
+ Range-based for loop with iterator proxy:
+
+ @code{cpp}
+ for (auto it : json::iterator_wrapper(j_object))
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ @note When iterating over an array, `key()` will return the index of the
+ element as string (see example).
+
+ @param[in] ref reference to a JSON value
+ @return iteration proxy object wrapping @a ref with an interface to use in
+ range-based for loops
+
+ @liveexample{The following code shows how the wrapper is used,iterator_wrapper}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @note The name of this function is not yet final and may change in the
+ future.
+
+ @deprecated This stream operator is deprecated and will be removed in
+ future 4.0.0 of the library. Please use @ref items() instead;
+ that is, replace `json::iterator_wrapper(j)` with `j.items()`.
+ */
+ JSON_DEPRECATED
+ static iteration_proxy<iterator> iterator_wrapper(reference ref) noexcept
+ {
+ return ref.items();
+ }
+
+ /*!
+ @copydoc iterator_wrapper(reference)
+ */
+ JSON_DEPRECATED
+ static iteration_proxy<const_iterator> iterator_wrapper(const_reference ref) noexcept
+ {
+ return ref.items();
+ }
+
+ /*!
+ @brief helper to access iterator member functions in range-based for
+
+ This function allows to access @ref iterator::key() and @ref
+ iterator::value() during range-based for loops. In these loops, a
+ reference to the JSON values is returned, so there is no access to the
+ underlying iterator.
+
+ For loop without `items()` function:
+
+ @code{cpp}
+ for (auto it = j_object.begin(); it != j_object.end(); ++it)
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ Range-based for loop without `items()` function:
+
+ @code{cpp}
+ for (auto it : j_object)
+ {
+ // "it" is of type json::reference and has no key() member
+ std::cout << "value: " << it << '\n';
+ }
+ @endcode
+
+ Range-based for loop with `items()` function:
+
+ @code{cpp}
+ for (auto& el : j_object.items())
+ {
+ std::cout << "key: " << el.key() << ", value:" << el.value() << '\n';
+ }
+ @endcode
+
+ The `items()` function also allows to use
+ [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding)
+ (C++17):
+
+ @code{cpp}
+ for (auto& [key, val] : j_object.items())
+ {
+ std::cout << "key: " << key << ", value:" << val << '\n';
+ }
+ @endcode
+
+ @note When iterating over an array, `key()` will return the index of the
+ element as string (see example). For primitive types (e.g., numbers),
+ `key()` returns an empty string.
+
+ @return iteration proxy object wrapping @a ref with an interface to use in
+ range-based for loops
+
+ @liveexample{The following code shows how the function is used.,items}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 3.1.0, structured bindings support since 3.5.0.
+ */
+ iteration_proxy<iterator> items() noexcept
+ {
+ return iteration_proxy<iterator>(*this);
+ }
+
+ /*!
+ @copydoc items()
+ */
+ iteration_proxy<const_iterator> items() const noexcept
+ {
+ return iteration_proxy<const_iterator>(*this);
+ }
+
+ /// @}
+
+
+ //////////////
+ // capacity //
+ //////////////
+
+ /// @name capacity
+ /// @{
+
+ /*!
+ @brief checks whether the container is empty.
+
+ Checks if a JSON value has no elements (i.e. whether its @ref size is `0`).
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `true`
+ boolean | `false`
+ string | `false`
+ number | `false`
+ object | result of function `object_t::empty()`
+ array | result of function `array_t::empty()`
+
+ @liveexample{The following code uses `empty()` to check if a JSON
+ object contains any elements.,empty}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their `empty()` functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @note This function does not return whether a string stored as JSON value
+ is empty - it returns whether the JSON container itself is empty which is
+ false in the case of a string.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `begin() == end()`.
+
+ @sa @ref size() -- returns the number of elements
+
+ @since version 1.0.0
+ */
+ bool empty() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ {
+ // null values are empty
+ return true;
+ }
+
+ case value_t::array:
+ {
+ // delegate call to array_t::empty()
+ return m_value.array->empty();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::empty()
+ return m_value.object->empty();
+ }
+
+ default:
+ {
+ // all other types are nonempty
+ return false;
+ }
+ }
+ }
+
+ /*!
+ @brief returns the number of elements
+
+ Returns the number of elements in a JSON value.
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `0`
+ boolean | `1`
+ string | `1`
+ number | `1`
+ object | result of function object_t::size()
+ array | result of function array_t::size()
+
+ @liveexample{The following code calls `size()` on the different value
+ types.,size}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their size() functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @note This function does not return the length of a string stored as JSON
+ value - it returns the number of elements in the JSON value which is 1 in
+ the case of a string.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `std::distance(begin(), end())`.
+
+ @sa @ref empty() -- checks whether the container is empty
+ @sa @ref max_size() -- returns the maximal number of elements
+
+ @since version 1.0.0
+ */
+ size_type size() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ {
+ // null values are empty
+ return 0;
+ }
+
+ case value_t::array:
+ {
+ // delegate call to array_t::size()
+ return m_value.array->size();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::size()
+ return m_value.object->size();
+ }
+
+ default:
+ {
+ // all other types have size 1
+ return 1;
+ }
+ }
+ }
+
+ /*!
+ @brief returns the maximum possible number of elements
+
+ Returns the maximum number of elements a JSON value is able to hold due to
+ system or library implementation limitations, i.e. `std::distance(begin(),
+ end())` for the JSON value.
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `0` (same as `size()`)
+ boolean | `1` (same as `size()`)
+ string | `1` (same as `size()`)
+ number | `1` (same as `size()`)
+ object | result of function `object_t::max_size()`
+ array | result of function `array_t::max_size()`
+
+ @liveexample{The following code calls `max_size()` on the different value
+ types. Note the output is implementation specific.,max_size}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their `max_size()` functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of returning `b.size()` where `b` is the largest
+ possible JSON value.
+
+ @sa @ref size() -- returns the number of elements
+
+ @since version 1.0.0
+ */
+ size_type max_size() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::array:
+ {
+ // delegate call to array_t::max_size()
+ return m_value.array->max_size();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::max_size()
+ return m_value.object->max_size();
+ }
+
+ default:
+ {
+ // all other types have max_size() == size()
+ return size();
+ }
+ }
+ }
+
+ /// @}
+
+
+ ///////////////
+ // modifiers //
+ ///////////////
+
+ /// @name modifiers
+ /// @{
+
+ /*!
+ @brief clears the contents
+
+ Clears the content of a JSON value and resets it to the default value as
+ if @ref basic_json(value_t) would have been called with the current value
+ type from @ref type():
+
+ Value type | initial value
+ ----------- | -------------
+ null | `null`
+ boolean | `false`
+ string | `""`
+ number | `0`
+ object | `{}`
+ array | `[]`
+
+ @post Has the same effect as calling
+ @code {.cpp}
+ *this = basic_json(type());
+ @endcode
+
+ @liveexample{The example below shows the effect of `clear()` to different
+ JSON types.,clear}
+
+ @complexity Linear in the size of the JSON value.
+
+ @iterators All iterators, pointers and references related to this container
+ are invalidated.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @sa @ref basic_json(value_t) -- constructor that creates an object with the
+ same value than calling `clear()`
+
+ @since version 1.0.0
+ */
+ void clear() noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::number_integer:
+ {
+ m_value.number_integer = 0;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value.number_unsigned = 0;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value.number_float = 0.0;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value.boolean = false;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value.string->clear();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value.array->clear();
+ break;
+ }
+
+ case value_t::object:
+ {
+ m_value.object->clear();
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @brief add an object to an array
+
+ Appends the given element @a val to the end of the JSON value. If the
+ function is called on a JSON null value, an empty array is created before
+ appending @a val.
+
+ @param[in] val the value to add to the JSON array
+
+ @throw type_error.308 when called on a type other than JSON array or
+ null; example: `"cannot use push_back() with number"`
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows how `push_back()` and `+=` can be used to
+ add elements to a JSON array. Note how the `null` value was silently
+ converted to a JSON array.,push_back}
+
+ @since version 1.0.0
+ */
+ void push_back(basic_json&& val)
+ {
+ // push_back only works for null objects or arrays
+ if (JSON_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array (move semantics)
+ m_value.array->push_back(std::move(val));
+ // invalidate object: mark it null so we do not call the destructor
+ // cppcheck-suppress accessMoved
+ val.m_type = value_t::null;
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ reference operator+=(basic_json&& val)
+ {
+ push_back(std::move(val));
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ void push_back(const basic_json& val)
+ {
+ // push_back only works for null objects or arrays
+ if (JSON_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array
+ m_value.array->push_back(val);
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ reference operator+=(const basic_json& val)
+ {
+ push_back(val);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an object
+
+ Inserts the given element @a val to the JSON object. If the function is
+ called on a JSON null value, an empty object is created before inserting
+ @a val.
+
+ @param[in] val the value to add to the JSON object
+
+ @throw type_error.308 when called on a type other than JSON object or
+ null; example: `"cannot use push_back() with number"`
+
+ @complexity Logarithmic in the size of the container, O(log(`size()`)).
+
+ @liveexample{The example shows how `push_back()` and `+=` can be used to
+ add elements to a JSON object. Note how the `null` value was silently
+ converted to a JSON object.,push_back__object_t__value}
+
+ @since version 1.0.0
+ */
+ void push_back(const typename object_t::value_type& val)
+ {
+ // push_back only works for null objects or objects
+ if (JSON_UNLIKELY(not(is_null() or is_object())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // add element to array
+ m_value.object->insert(val);
+ }
+
+ /*!
+ @brief add an object to an object
+ @copydoc push_back(const typename object_t::value_type&)
+ */
+ reference operator+=(const typename object_t::value_type& val)
+ {
+ push_back(val);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an object
+
+ This function allows to use `push_back` with an initializer list. In case
+
+ 1. the current value is an object,
+ 2. the initializer list @a init contains only two elements, and
+ 3. the first element of @a init is a string,
+
+ @a init is converted into an object element and added using
+ @ref push_back(const typename object_t::value_type&). Otherwise, @a init
+ is converted to a JSON value and added using @ref push_back(basic_json&&).
+
+ @param[in] init an initializer list
+
+ @complexity Linear in the size of the initializer list @a init.
+
+ @note This function is required to resolve an ambiguous overload error,
+ because pairs like `{"key", "value"}` can be both interpreted as
+ `object_t::value_type` or `std::initializer_list<basic_json>`, see
+ https://github.com/nlohmann/json/issues/235 for more information.
+
+ @liveexample{The example shows how initializer lists are treated as
+ objects when possible.,push_back__initializer_list}
+ */
+ void push_back(initializer_list_t init)
+ {
+ if (is_object() and init.size() == 2 and (*init.begin())->is_string())
+ {
+ basic_json&& key = init.begin()->moved_or_copied();
+ push_back(typename object_t::value_type(
+ std::move(key.get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));
+ }
+ else
+ {
+ push_back(basic_json(init));
+ }
+ }
+
+ /*!
+ @brief add an object to an object
+ @copydoc push_back(initializer_list_t)
+ */
+ reference operator+=(initializer_list_t init)
+ {
+ push_back(init);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an array
+
+ Creates a JSON value from the passed parameters @a args to the end of the
+ JSON value. If the function is called on a JSON null value, an empty array
+ is created before appending the value created from @a args.
+
+ @param[in] args arguments to forward to a constructor of @ref basic_json
+ @tparam Args compatible types to create a @ref basic_json object
+
+ @throw type_error.311 when called on a type other than JSON array or
+ null; example: `"cannot use emplace_back() with number"`
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows how `push_back()` can be used to add
+ elements to a JSON array. Note how the `null` value was silently converted
+ to a JSON array.,emplace_back}
+
+ @since version 2.0.8
+ */
+ template<class... Args>
+ void emplace_back(Args&& ... args)
+ {
+ // emplace_back only works for null objects or arrays
+ if (JSON_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array (perfect forwarding)
+ m_value.array->emplace_back(std::forward<Args>(args)...);
+ }
+
+ /*!
+ @brief add an object to an object if key does not exist
+
+ Inserts a new element into a JSON object constructed in-place with the
+ given @a args if there is no element with the key in the container. If the
+ function is called on a JSON null value, an empty object is created before
+ appending the value created from @a args.
+
+ @param[in] args arguments to forward to a constructor of @ref basic_json
+ @tparam Args compatible types to create a @ref basic_json object
+
+ @return a pair consisting of an iterator to the inserted element, or the
+ already-existing element if no insertion happened, and a bool
+ denoting whether the insertion took place.
+
+ @throw type_error.311 when called on a type other than JSON object or
+ null; example: `"cannot use emplace() with number"`
+
+ @complexity Logarithmic in the size of the container, O(log(`size()`)).
+
+ @liveexample{The example shows how `emplace()` can be used to add elements
+ to a JSON object. Note how the `null` value was silently converted to a
+ JSON object. Further note how no value is added if there was already one
+ value stored with the same key.,emplace}
+
+ @since version 2.0.8
+ */
+ template<class... Args>
+ std::pair<iterator, bool> emplace(Args&& ... args)
+ {
+ // emplace only works for null objects or arrays
+ if (JSON_UNLIKELY(not(is_null() or is_object())))
+ {
+ JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name())));
+ }
+
+ // transform null object into an object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // add element to array (perfect forwarding)
+ auto res = m_value.object->emplace(std::forward<Args>(args)...);
+ // create result iterator and set iterator to the result of emplace
+ auto it = begin();
+ it.m_it.object_iterator = res.first;
+
+ // return pair of iterator and boolean
+ return {it, res.second};
+ }
+
+ /// Helper for insertion of an iterator
+ /// @note: This uses std::distance to support GCC 4.8,
+ /// see https://github.com/nlohmann/json/pull/1257
+ template<typename... Args>
+ iterator insert_iterator(const_iterator pos, Args&& ... args)
+ {
+ iterator result(this);
+ assert(m_value.array != nullptr);
+
+ auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
+ m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
+ result.m_it.array_iterator = m_value.array->begin() + insert_pos;
+
+ // This could have been written as:
+ // result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
+ // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
+
+ return result;
+ }
+
+ /*!
+ @brief inserts element
+
+ Inserts element @a val before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] val element to insert
+ @return iterator pointing to the inserted @a val.
+
+ @throw type_error.309 if called on JSON values other than arrays;
+ example: `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @complexity Constant plus linear in the distance between @a pos and end of
+ the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, const basic_json& val)
+ {
+ // insert only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ // check if iterator pos fits to this JSON value
+ if (JSON_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, val);
+ }
+
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief inserts element
+ @copydoc insert(const_iterator, const basic_json&)
+ */
+ iterator insert(const_iterator pos, basic_json&& val)
+ {
+ return insert(pos, val);
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts @a cnt copies of @a val before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] cnt number of copies of @a val to insert
+ @param[in] val element to insert
+ @return iterator pointing to the first element inserted, or @a pos if
+ `cnt==0`
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @complexity Linear in @a cnt plus linear in the distance between @a pos
+ and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__count}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, size_type cnt, const basic_json& val)
+ {
+ // insert only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ // check if iterator pos fits to this JSON value
+ if (JSON_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, cnt, val);
+ }
+
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from range `[first, last)` before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+ @throw invalid_iterator.211 if @a first or @a last are iterators into
+ container for which insert is called; example: `"passed iterators may not
+ belong to container"`
+
+ @return iterator pointing to the first element inserted, or @a pos if
+ `first==last`
+
+ @complexity Linear in `std::distance(first, last)` plus linear in the
+ distance between @a pos and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__range}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, const_iterator first, const_iterator last)
+ {
+ // insert only works for arrays
+ if (JSON_UNLIKELY(not is_array()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if iterator pos fits to this JSON value
+ if (JSON_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ if (JSON_UNLIKELY(first.m_object == this))
+ {
+ JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, first.m_it.array_iterator, last.m_it.array_iterator);
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from initializer list @a ilist before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] ilist initializer list to insert the values from
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @return iterator pointing to the first element inserted, or @a pos if
+ `ilist` is empty
+
+ @complexity Linear in `ilist.size()` plus linear in the distance between
+ @a pos and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__ilist}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, initializer_list_t ilist)
+ {
+ // insert only works for arrays
+ if (JSON_UNLIKELY(not is_array()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if iterator pos fits to this JSON value
+ if (JSON_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, ilist.begin(), ilist.end());
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from range `[first, last)`.
+
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.309 if called on JSON values other than objects; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if iterator @a first or @a last does does not
+ point to an object; example: `"iterators first and last must point to
+ objects"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+
+ @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number
+ of elements to insert.
+
+ @liveexample{The example shows how `insert()` is used.,insert__range_object}
+
+ @since version 3.0.0
+ */
+ void insert(const_iterator first, const_iterator last)
+ {
+ // insert only works for objects
+ if (JSON_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ // passed iterators must belong to objects
+ if (JSON_UNLIKELY(not first.m_object->is_object()))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
+ }
+
+ m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);
+ }
+
+ /*!
+ @brief updates a JSON object from another object, overwriting existing keys
+
+ Inserts all values from JSON object @a j and overwrites existing keys.
+
+ @param[in] j JSON object to read values from
+
+ @throw type_error.312 if called on JSON values other than objects; example:
+ `"cannot use update() with string"`
+
+ @complexity O(N*log(size() + N)), where N is the number of elements to
+ insert.
+
+ @liveexample{The example shows how `update()` is used.,update}
+
+ @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update
+
+ @since version 3.0.0
+ */
+ void update(const_reference j)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ if (JSON_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
+ }
+ if (JSON_UNLIKELY(not j.is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name())));
+ }
+
+ for (auto it = j.cbegin(); it != j.cend(); ++it)
+ {
+ m_value.object->operator[](it.key()) = it.value();
+ }
+ }
+
+ /*!
+ @brief updates a JSON object from another object, overwriting existing keys
+
+ Inserts all values from from range `[first, last)` and overwrites existing
+ keys.
+
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.312 if called on JSON values other than objects; example:
+ `"cannot use update() with string"`
+ @throw invalid_iterator.202 if iterator @a first or @a last does does not
+ point to an object; example: `"iterators first and last must point to
+ objects"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+
+ @complexity O(N*log(size() + N)), where N is the number of elements to
+ insert.
+
+ @liveexample{The example shows how `update()` is used__range.,update}
+
+ @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update
+
+ @since version 3.0.0
+ */
+ void update(const_iterator first, const_iterator last)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ if (JSON_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ // passed iterators must belong to objects
+ if (JSON_UNLIKELY(not first.m_object->is_object()
+ or not last.m_object->is_object()))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
+ }
+
+ for (auto it = first; it != last; ++it)
+ {
+ m_value.object->operator[](it.key()) = it.value();
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of the JSON value with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other JSON value to exchange the contents with
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how JSON values can be swapped with
+ `swap()`.,swap__reference}
+
+ @since version 1.0.0
+ */
+ void swap(reference other) noexcept (
+ std::is_nothrow_move_constructible<value_t>::value and
+ std::is_nothrow_move_assignable<value_t>::value and
+ std::is_nothrow_move_constructible<json_value>::value and
+ std::is_nothrow_move_assignable<json_value>::value
+ )
+ {
+ std::swap(m_type, other.m_type);
+ std::swap(m_value, other.m_value);
+ assert_invariant();
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON array with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other array to exchange the contents with
+
+ @throw type_error.310 when JSON value is not an array; example: `"cannot
+ use swap() with string"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how arrays can be swapped with
+ `swap()`.,swap__array_t}
+
+ @since version 1.0.0
+ */
+ void swap(array_t& other)
+ {
+ // swap only works for arrays
+ if (JSON_LIKELY(is_array()))
+ {
+ std::swap(*(m_value.array), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON object with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other object to exchange the contents with
+
+ @throw type_error.310 when JSON value is not an object; example:
+ `"cannot use swap() with string"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how objects can be swapped with
+ `swap()`.,swap__object_t}
+
+ @since version 1.0.0
+ */
+ void swap(object_t& other)
+ {
+ // swap only works for objects
+ if (JSON_LIKELY(is_object()))
+ {
+ std::swap(*(m_value.object), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON string with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other string to exchange the contents with
+
+ @throw type_error.310 when JSON value is not a string; example: `"cannot
+ use swap() with boolean"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how strings can be swapped with
+ `swap()`.,swap__string_t}
+
+ @since version 1.0.0
+ */
+ void swap(string_t& other)
+ {
+ // swap only works for strings
+ if (JSON_LIKELY(is_string()))
+ {
+ std::swap(*(m_value.string), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /// @}
+
+ public:
+ //////////////////////////////////////////
+ // lexicographical comparison operators //
+ //////////////////////////////////////////
+
+ /// @name lexicographical comparison operators
+ /// @{
+
+ /*!
+ @brief comparison: equal
+
+ Compares two JSON values for equality according to the following rules:
+ - Two JSON values are equal if (1) they are from the same type and (2)
+ their stored values are the same according to their respective
+ `operator==`.
+ - Integer and floating-point numbers are automatically converted before
+ comparison. Note than two NaN values are always treated as unequal.
+ - Two JSON null values are equal.
+
+ @note Floating-point inside JSON values numbers are compared with
+ `json::number_float_t::operator==` which is `double::operator==` by
+ default. To compare floating-point while respecting an epsilon, an alternative
+ [comparison function](https://github.com/mariokonrad/marnav/blob/master/src/marnav/math/floatingpoint.hpp#L34-#L39)
+ could be used, for instance
+ @code {.cpp}
+ template<typename T, typename = typename std::enable_if<std::is_floating_point<T>::value, T>::type>
+ inline bool is_same(T a, T b, T epsilon = std::numeric_limits<T>::epsilon()) noexcept
+ {
+ return std::abs(a - b) <= epsilon;
+ }
+ @endcode
+
+ @note NaN values never compare equal to themselves or to other NaN values.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether the values @a lhs and @a rhs are equal
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @complexity Linear.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__equal}
+
+ @since version 1.0.0
+ */
+ friend bool operator==(const_reference lhs, const_reference rhs) noexcept
+ {
+ const auto lhs_type = lhs.type();
+ const auto rhs_type = rhs.type();
+
+ if (lhs_type == rhs_type)
+ {
+ switch (lhs_type)
+ {
+ case value_t::array:
+ return *lhs.m_value.array == *rhs.m_value.array;
+
+ case value_t::object:
+ return *lhs.m_value.object == *rhs.m_value.object;
+
+ case value_t::null:
+ return true;
+
+ case value_t::string:
+ return *lhs.m_value.string == *rhs.m_value.string;
+
+ case value_t::boolean:
+ return lhs.m_value.boolean == rhs.m_value.boolean;
+
+ case value_t::number_integer:
+ return lhs.m_value.number_integer == rhs.m_value.number_integer;
+
+ case value_t::number_unsigned:
+ return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;
+
+ case value_t::number_float:
+ return lhs.m_value.number_float == rhs.m_value.number_float;
+
+ default:
+ return false;
+ }
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+ {
+ return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_integer);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)
+ {
+ return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_integer == static_cast<number_integer_t>(rhs.m_value.number_unsigned);
+ }
+
+ return false;
+ }
+
+ /*!
+ @brief comparison: equal
+ @copydoc operator==(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs == basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: equal
+ @copydoc operator==(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) == rhs;
+ }
+
+ /*!
+ @brief comparison: not equal
+
+ Compares two JSON values for inequality by calculating `not (lhs == rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether the values @a lhs and @a rhs are not equal
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__notequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs == rhs);
+ }
+
+ /*!
+ @brief comparison: not equal
+ @copydoc operator!=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs != basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: not equal
+ @copydoc operator!=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) != rhs;
+ }
+
+ /*!
+ @brief comparison: less than
+
+ Compares whether one JSON value @a lhs is less than another JSON value @a
+ rhs according to the following rules:
+ - If @a lhs and @a rhs have the same type, the values are compared using
+ the default `<` operator.
+ - Integer and floating-point numbers are automatically converted before
+ comparison
+ - In case @a lhs and @a rhs have different types, the values are ignored
+ and the order of the types is considered, see
+ @ref operator<(const value_t, const value_t).
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is less than @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__less}
+
+ @since version 1.0.0
+ */
+ friend bool operator<(const_reference lhs, const_reference rhs) noexcept
+ {
+ const auto lhs_type = lhs.type();
+ const auto rhs_type = rhs.type();
+
+ if (lhs_type == rhs_type)
+ {
+ switch (lhs_type)
+ {
+ case value_t::array:
+ // note parentheses are necessary, see
+ // https://github.com/nlohmann/json/issues/1530
+ return (*lhs.m_value.array) < (*rhs.m_value.array);
+
+ case value_t::object:
+ return *lhs.m_value.object < *rhs.m_value.object;
+
+ case value_t::null:
+ return false;
+
+ case value_t::string:
+ return *lhs.m_value.string < *rhs.m_value.string;
+
+ case value_t::boolean:
+ return lhs.m_value.boolean < rhs.m_value.boolean;
+
+ case value_t::number_integer:
+ return lhs.m_value.number_integer < rhs.m_value.number_integer;
+
+ case value_t::number_unsigned:
+ return lhs.m_value.number_unsigned < rhs.m_value.number_unsigned;
+
+ case value_t::number_float:
+ return lhs.m_value.number_float < rhs.m_value.number_float;
+
+ default:
+ return false;
+ }
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+ {
+ return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_integer);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_integer < static_cast<number_integer_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)
+ {
+ return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;
+ }
+
+ // We only reach this line if we cannot compare values. In that case,
+ // we compare types. Note we have to call the operator explicitly,
+ // because MSVC has problems otherwise.
+ return operator<(lhs_type, rhs_type);
+ }
+
+ /*!
+ @brief comparison: less than
+ @copydoc operator<(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs < basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: less than
+ @copydoc operator<(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) < rhs;
+ }
+
+ /*!
+ @brief comparison: less than or equal
+
+ Compares whether one JSON value @a lhs is less than or equal to another
+ JSON value by calculating `not (rhs < lhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is less than or equal to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__greater}
+
+ @since version 1.0.0
+ */
+ friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (rhs < lhs);
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @copydoc operator<=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs <= basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @copydoc operator<=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) <= rhs;
+ }
+
+ /*!
+ @brief comparison: greater than
+
+ Compares whether one JSON value @a lhs is greater than another
+ JSON value by calculating `not (lhs <= rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is greater than to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__lessequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator>(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs <= rhs);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @copydoc operator>(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs > basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @copydoc operator>(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) > rhs;
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+
+ Compares whether one JSON value @a lhs is greater than or equal to another
+ JSON value by calculating `not (lhs < rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is greater than or equal to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__greaterequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs < rhs);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @copydoc operator>=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs >= basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @copydoc operator>=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) >= rhs;
+ }
+
+ /// @}
+
+ ///////////////////
+ // serialization //
+ ///////////////////
+
+ /// @name serialization
+ /// @{
+
+ /*!
+ @brief serialize to stream
+
+ Serialize the given JSON value @a j to the output stream @a o. The JSON
+ value will be serialized using the @ref dump member function.
+
+ - The indentation of the output can be controlled with the member variable
+ `width` of the output stream @a o. For instance, using the manipulator
+ `std::setw(4)` on @a o sets the indentation level to `4` and the
+ serialization result is the same as calling `dump(4)`.
+
+ - The indentation character can be controlled with the member variable
+ `fill` of the output stream @a o. For instance, the manipulator
+ `std::setfill('\\t')` sets indentation to use a tab character rather than
+ the default space character.
+
+ @param[in,out] o stream to serialize to
+ @param[in] j JSON value to serialize
+
+ @return the stream @a o
+
+ @throw type_error.316 if a string stored inside the JSON value is not
+ UTF-8 encoded
+
+ @complexity Linear.
+
+ @liveexample{The example below shows the serialization with different
+ parameters to `width` to adjust the indentation level.,operator_serialize}
+
+ @since version 1.0.0; indentation character added in version 3.0.0
+ */
+ friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
+ {
+ // read width member and use it as indentation parameter if nonzero
+ const bool pretty_print = o.width() > 0;
+ const auto indentation = pretty_print ? o.width() : 0;
+
+ // reset width to 0 for subsequent calls to this stream
+ o.width(0);
+
+ // do the actual serialization
+ serializer s(detail::output_adapter<char>(o), o.fill());
+ s.dump(j, pretty_print, false, static_cast<unsigned int>(indentation));
+ return o;
+ }
+
+ /*!
+ @brief serialize to stream
+ @deprecated This stream operator is deprecated and will be removed in
+ future 4.0.0 of the library. Please use
+ @ref operator<<(std::ostream&, const basic_json&)
+ instead; that is, replace calls like `j >> o;` with `o << j;`.
+ @since version 1.0.0; deprecated since version 3.0.0
+ */
+ JSON_DEPRECATED
+ friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
+ {
+ return o << j;
+ }
+
+ /// @}
+
+
+ /////////////////////
+ // deserialization //
+ /////////////////////
+
+ /// @name deserialization
+ /// @{
+
+ /*!
+ @brief deserialize from a compatible input
+
+ This function reads from a compatible input. Examples are:
+ - an array of 1-byte values
+ - strings with character/literal type with size of 1 byte
+ - input streams
+ - container with contiguous storage of 1-byte values. Compatible container
+ types include `std::vector`, `std::string`, `std::array`,
+ `std::valarray`, and `std::initializer_list`. Furthermore, C-style
+ arrays can be used with `std::begin()`/`std::end()`. User-defined
+ containers can be used as long as they implement random-access iterators
+ and a contiguous storage.
+
+ @pre Each element of the container has a size of 1 byte. Violating this
+ precondition yields undefined behavior. **This precondition is enforced
+ with a static assertion.**
+
+ @pre The container storage is contiguous. Violating this precondition
+ yields undefined behavior. **This precondition is enforced with an
+ assertion.**
+
+ @warning There is no way to enforce all preconditions at compile-time. If
+ the function is called with a noncompliant container and with
+ assertions switched off, the behavior is undefined and will most
+ likely yield segmentation violation.
+
+ @param[in] i input to read from
+ @param[in] cb a parser callback function of type @ref parser_callback_t
+ which is used to control the deserialization by filtering unwanted values
+ (optional)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.101 if a parse error occurs; example: `""unexpected end
+ of input; expected string literal""`
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser. The complexity can be higher if the parser callback function
+ @a cb has a super-linear complexity.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `parse()` function reading
+ from an array.,parse__array__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function with
+ and without callback function.,parse__string__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function with
+ and without callback function.,parse__istream__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function reading
+ from a contiguous container.,parse__contiguouscontainer__parser_callback_t}
+
+ @since version 2.0.3 (contiguous containers)
+ */
+ JSON_NODISCARD
+ static basic_json parse(detail::input_adapter&& i,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ parser(i, cb, allow_exceptions).parse(true, result);
+ return result;
+ }
+
+ static bool accept(detail::input_adapter&& i)
+ {
+ return parser(i).accept(true);
+ }
+
+ /*!
+ @brief generate SAX events
+
+ The SAX event lister must follow the interface of @ref json_sax.
+
+ This function reads from a compatible input. Examples are:
+ - an array of 1-byte values
+ - strings with character/literal type with size of 1 byte
+ - input streams
+ - container with contiguous storage of 1-byte values. Compatible container
+ types include `std::vector`, `std::string`, `std::array`,
+ `std::valarray`, and `std::initializer_list`. Furthermore, C-style
+ arrays can be used with `std::begin()`/`std::end()`. User-defined
+ containers can be used as long as they implement random-access iterators
+ and a contiguous storage.
+
+ @pre Each element of the container has a size of 1 byte. Violating this
+ precondition yields undefined behavior. **This precondition is enforced
+ with a static assertion.**
+
+ @pre The container storage is contiguous. Violating this precondition
+ yields undefined behavior. **This precondition is enforced with an
+ assertion.**
+
+ @warning There is no way to enforce all preconditions at compile-time. If
+ the function is called with a noncompliant container and with
+ assertions switched off, the behavior is undefined and will most
+ likely yield segmentation violation.
+
+ @param[in] i input to read from
+ @param[in,out] sax SAX event listener
+ @param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON)
+ @param[in] strict whether the input has to be consumed completely
+
+ @return return value of the last processed SAX event
+
+ @throw parse_error.101 if a parse error occurs; example: `""unexpected end
+ of input; expected string literal""`
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser. The complexity can be higher if the SAX consumer @a sax has
+ a super-linear complexity.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `sax_parse()` function
+ reading from string and processing the events with a user-defined SAX
+ event consumer.,sax_parse}
+
+ @since version 3.2.0
+ */
+ template <typename SAX>
+ static bool sax_parse(detail::input_adapter&& i, SAX* sax,
+ input_format_t format = input_format_t::json,
+ const bool strict = true)
+ {
+ assert(sax);
+ return format == input_format_t::json
+ ? parser(std::move(i)).sax_parse(sax, strict)
+ : detail::binary_reader<basic_json, SAX>(std::move(i)).sax_parse(format, sax, strict);
+ }
+
+ /*!
+ @brief deserialize from an iterator range with contiguous storage
+
+ This function reads from an iterator range of a container with contiguous
+ storage of 1-byte values. Compatible container types include
+ `std::vector`, `std::string`, `std::array`, `std::valarray`, and
+ `std::initializer_list`. Furthermore, C-style arrays can be used with
+ `std::begin()`/`std::end()`. User-defined containers can be used as long
+ as they implement random-access iterators and a contiguous storage.
+
+ @pre The iterator range is contiguous. Violating this precondition yields
+ undefined behavior. **This precondition is enforced with an assertion.**
+ @pre Each element in the range has a size of 1 byte. Violating this
+ precondition yields undefined behavior. **This precondition is enforced
+ with a static assertion.**
+
+ @warning There is no way to enforce all preconditions at compile-time. If
+ the function is called with noncompliant iterators and with
+ assertions switched off, the behavior is undefined and will most
+ likely yield segmentation violation.
+
+ @tparam IteratorType iterator of container with contiguous storage
+ @param[in] first begin of the range to parse (included)
+ @param[in] last end of the range to parse (excluded)
+ @param[in] cb a parser callback function of type @ref parser_callback_t
+ which is used to control the deserialization by filtering unwanted values
+ (optional)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.101 in case of an unexpected token
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser. The complexity can be higher if the parser callback function
+ @a cb has a super-linear complexity.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `parse()` function reading
+ from an iterator range.,parse__iteratortype__parser_callback_t}
+
+ @since version 2.0.3
+ */
+ template<class IteratorType, typename std::enable_if<
+ std::is_base_of<
+ std::random_access_iterator_tag,
+ typename std::iterator_traits<IteratorType>::iterator_category>::value, int>::type = 0>
+ static basic_json parse(IteratorType first, IteratorType last,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ parser(detail::input_adapter(first, last), cb, allow_exceptions).parse(true, result);
+ return result;
+ }
+
+ template<class IteratorType, typename std::enable_if<
+ std::is_base_of<
+ std::random_access_iterator_tag,
+ typename std::iterator_traits<IteratorType>::iterator_category>::value, int>::type = 0>
+ static bool accept(IteratorType first, IteratorType last)
+ {
+ return parser(detail::input_adapter(first, last)).accept(true);
+ }
+
+ template<class IteratorType, class SAX, typename std::enable_if<
+ std::is_base_of<
+ std::random_access_iterator_tag,
+ typename std::iterator_traits<IteratorType>::iterator_category>::value, int>::type = 0>
+ static bool sax_parse(IteratorType first, IteratorType last, SAX* sax)
+ {
+ return parser(detail::input_adapter(first, last)).sax_parse(sax);
+ }
+
+ /*!
+ @brief deserialize from stream
+ @deprecated This stream operator is deprecated and will be removed in
+ version 4.0.0 of the library. Please use
+ @ref operator>>(std::istream&, basic_json&)
+ instead; that is, replace calls like `j << i;` with `i >> j;`.
+ @since version 1.0.0; deprecated since version 3.0.0
+ */
+ JSON_DEPRECATED
+ friend std::istream& operator<<(basic_json& j, std::istream& i)
+ {
+ return operator>>(i, j);
+ }
+
+ /*!
+ @brief deserialize from stream
+
+ Deserializes an input stream to a JSON value.
+
+ @param[in,out] i input stream to read a serialized JSON value from
+ @param[in,out] j JSON value to write the deserialized input to
+
+ @throw parse_error.101 in case of an unexpected token
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below shows how a JSON value is constructed by
+ reading a serialization from a stream.,operator_deserialize}
+
+ @sa parse(std::istream&, const parser_callback_t) for a variant with a
+ parser callback function to filter values while parsing
+
+ @since version 1.0.0
+ */
+ friend std::istream& operator>>(std::istream& i, basic_json& j)
+ {
+ parser(detail::input_adapter(i)).parse(false, j);
+ return i;
+ }
+
+ /// @}
+
+ ///////////////////////////
+ // convenience functions //
+ ///////////////////////////
+
+ /*!
+ @brief return the type as string
+
+ Returns the type name as string to be used in error messages - usually to
+ indicate that a function was called on a wrong JSON type.
+
+ @return a string representation of a the @a m_type member:
+ Value type | return value
+ ----------- | -------------
+ null | `"null"`
+ boolean | `"boolean"`
+ string | `"string"`
+ number | `"number"` (for all number types)
+ object | `"object"`
+ array | `"array"`
+ discarded | `"discarded"`
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @complexity Constant.
+
+ @liveexample{The following code exemplifies `type_name()` for all JSON
+ types.,type_name}
+
+ @sa @ref type() -- return the type of the JSON value
+ @sa @ref operator value_t() -- return the type of the JSON value (implicit)
+
+ @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept`
+ since 3.0.0
+ */
+ const char* type_name() const noexcept
+ {
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ return "null";
+ case value_t::object:
+ return "object";
+ case value_t::array:
+ return "array";
+ case value_t::string:
+ return "string";
+ case value_t::boolean:
+ return "boolean";
+ case value_t::discarded:
+ return "discarded";
+ default:
+ return "number";
+ }
+ }
+ }
+
+
+ private:
+ //////////////////////
+ // member variables //
+ //////////////////////
+
+ /// the type of the current element
+ value_t m_type = value_t::null;
+
+ /// the value of the current element
+ json_value m_value = {};
+
+ //////////////////////////////////////////
+ // binary serialization/deserialization //
+ //////////////////////////////////////////
+
+ /// @name binary serialization/deserialization support
+ /// @{
+
+ public:
+ /*!
+ @brief create a CBOR serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the CBOR (Concise
+ Binary Object Representation) serialization format. CBOR is a binary
+ serialization format which aims to be more compact than JSON itself, yet
+ more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ CBOR types according to the CBOR specification (RFC 7049):
+
+ JSON value type | value/range | CBOR type | first byte
+ --------------- | ------------------------------------------ | ---------------------------------- | ---------------
+ null | `null` | Null | 0xF6
+ boolean | `true` | True | 0xF5
+ boolean | `false` | False | 0xF4
+ number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B
+ number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A
+ number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39
+ number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38
+ number_integer | -24..-1 | Negative integer | 0x20..0x37
+ number_integer | 0..23 | Integer | 0x00..0x17
+ number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18
+ number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19
+ number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A
+ number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B
+ number_unsigned | 0..23 | Integer | 0x00..0x17
+ number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18
+ number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19
+ number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A
+ number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B
+ number_float | *any value* | Double-Precision Float | 0xFB
+ string | *length*: 0..23 | UTF-8 string | 0x60..0x77
+ string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78
+ string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79
+ string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A
+ string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B
+ array | *size*: 0..23 | array | 0x80..0x97
+ array | *size*: 23..255 | array (1 byte follow) | 0x98
+ array | *size*: 256..65535 | array (2 bytes follow) | 0x99
+ array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A
+ array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B
+ object | *size*: 0..23 | map | 0xA0..0xB7
+ object | *size*: 23..255 | map (1 byte follow) | 0xB8
+ object | *size*: 256..65535 | map (2 bytes follow) | 0xB9
+ object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA
+ object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a CBOR value.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @note The following CBOR types are not used in the conversion:
+ - byte strings (0x40..0x5F)
+ - UTF-8 strings terminated by "break" (0x7F)
+ - arrays terminated by "break" (0x9F)
+ - maps terminated by "break" (0xBF)
+ - date/time (0xC0..0xC1)
+ - bignum (0xC2..0xC3)
+ - decimal fraction (0xC4)
+ - bigfloat (0xC5)
+ - tagged items (0xC6..0xD4, 0xD8..0xDB)
+ - expected conversions (0xD5..0xD7)
+ - simple values (0xE0..0xF3, 0xF8)
+ - undefined (0xF7)
+ - half and single-precision floats (0xF9-0xFA)
+ - break (0xFF)
+
+ @param[in] j JSON value to serialize
+ @return MessagePack serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in CBOR format.,to_cbor}
+
+ @sa http://cbor.io
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ analogous deserialization
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9
+ */
+ static std::vector<uint8_t> to_cbor(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_cbor(j, result);
+ return result;
+ }
+
+ static void to_cbor(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_cbor(j);
+ }
+
+ static void to_cbor(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_cbor(j);
+ }
+
+ /*!
+ @brief create a MessagePack serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the MessagePack
+ serialization format. MessagePack is a binary serialization format which
+ aims to be more compact than JSON itself, yet more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ MessagePack types according to the MessagePack specification:
+
+ JSON value type | value/range | MessagePack type | first byte
+ --------------- | --------------------------------- | ---------------- | ----------
+ null | `null` | nil | 0xC0
+ boolean | `true` | true | 0xC3
+ boolean | `false` | false | 0xC2
+ number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3
+ number_integer | -2147483648..-32769 | int32 | 0xD2
+ number_integer | -32768..-129 | int16 | 0xD1
+ number_integer | -128..-33 | int8 | 0xD0
+ number_integer | -32..-1 | negative fixint | 0xE0..0xFF
+ number_integer | 0..127 | positive fixint | 0x00..0x7F
+ number_integer | 128..255 | uint 8 | 0xCC
+ number_integer | 256..65535 | uint 16 | 0xCD
+ number_integer | 65536..4294967295 | uint 32 | 0xCE
+ number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF
+ number_unsigned | 0..127 | positive fixint | 0x00..0x7F
+ number_unsigned | 128..255 | uint 8 | 0xCC
+ number_unsigned | 256..65535 | uint 16 | 0xCD
+ number_unsigned | 65536..4294967295 | uint 32 | 0xCE
+ number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF
+ number_float | *any value* | float 64 | 0xCB
+ string | *length*: 0..31 | fixstr | 0xA0..0xBF
+ string | *length*: 32..255 | str 8 | 0xD9
+ string | *length*: 256..65535 | str 16 | 0xDA
+ string | *length*: 65536..4294967295 | str 32 | 0xDB
+ array | *size*: 0..15 | fixarray | 0x90..0x9F
+ array | *size*: 16..65535 | array 16 | 0xDC
+ array | *size*: 65536..4294967295 | array 32 | 0xDD
+ object | *size*: 0..15 | fix map | 0x80..0x8F
+ object | *size*: 16..65535 | map 16 | 0xDE
+ object | *size*: 65536..4294967295 | map 32 | 0xDF
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a MessagePack value.
+
+ @note The following values can **not** be converted to a MessagePack value:
+ - strings with more than 4294967295 bytes
+ - arrays with more than 4294967295 elements
+ - objects with more than 4294967295 elements
+
+ @note The following MessagePack types are not used in the conversion:
+ - bin 8 - bin 32 (0xC4..0xC6)
+ - ext 8 - ext 32 (0xC7..0xC9)
+ - float 32 (0xCA)
+ - fixext 1 - fixext 16 (0xD4..0xD8)
+
+ @note Any MessagePack output created @ref to_msgpack can be successfully
+ parsed by @ref from_msgpack.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @param[in] j JSON value to serialize
+ @return MessagePack serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in MessagePack format.,to_msgpack}
+
+ @sa http://msgpack.org
+ @sa @ref from_msgpack for the analogous deserialization
+ @sa @ref to_cbor(const basic_json& for the related CBOR format
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9
+ */
+ static std::vector<uint8_t> to_msgpack(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_msgpack(j, result);
+ return result;
+ }
+
+ static void to_msgpack(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_msgpack(j);
+ }
+
+ static void to_msgpack(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_msgpack(j);
+ }
+
+ /*!
+ @brief create a UBJSON serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the UBJSON
+ (Universal Binary JSON) serialization format. UBJSON aims to be more compact
+ than JSON itself, yet more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ UBJSON types according to the UBJSON specification:
+
+ JSON value type | value/range | UBJSON type | marker
+ --------------- | --------------------------------- | ----------- | ------
+ null | `null` | null | `Z`
+ boolean | `true` | true | `T`
+ boolean | `false` | false | `F`
+ number_integer | -9223372036854775808..-2147483649 | int64 | `L`
+ number_integer | -2147483648..-32769 | int32 | `l`
+ number_integer | -32768..-129 | int16 | `I`
+ number_integer | -128..127 | int8 | `i`
+ number_integer | 128..255 | uint8 | `U`
+ number_integer | 256..32767 | int16 | `I`
+ number_integer | 32768..2147483647 | int32 | `l`
+ number_integer | 2147483648..9223372036854775807 | int64 | `L`
+ number_unsigned | 0..127 | int8 | `i`
+ number_unsigned | 128..255 | uint8 | `U`
+ number_unsigned | 256..32767 | int16 | `I`
+ number_unsigned | 32768..2147483647 | int32 | `l`
+ number_unsigned | 2147483648..9223372036854775807 | int64 | `L`
+ number_float | *any value* | float64 | `D`
+ string | *with shortest length indicator* | string | `S`
+ array | *see notes on optimized format* | array | `[`
+ object | *see notes on optimized format* | map | `{`
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a UBJSON value.
+
+ @note The following values can **not** be converted to a UBJSON value:
+ - strings with more than 9223372036854775807 bytes (theoretical)
+ - unsigned integer numbers above 9223372036854775807
+
+ @note The following markers are not used in the conversion:
+ - `Z`: no-op values are not created.
+ - `C`: single-byte strings are serialized with `S` markers.
+
+ @note Any UBJSON output created @ref to_ubjson can be successfully parsed
+ by @ref from_ubjson.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @note The optimized formats for containers are supported: Parameter
+ @a use_size adds size information to the beginning of a container and
+ removes the closing marker. Parameter @a use_type further checks
+ whether all elements of a container have the same type and adds the
+ type marker to the beginning of the container. The @a use_type
+ parameter must only be used together with @a use_size = true. Note
+ that @a use_size = true alone may result in larger representations -
+ the benefit of this parameter is that the receiving side is
+ immediately informed on the number of elements of the container.
+
+ @param[in] j JSON value to serialize
+ @param[in] use_size whether to add size annotations to container types
+ @param[in] use_type whether to add type annotations to container types
+ (must be combined with @a use_size = true)
+ @return UBJSON serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in UBJSON format.,to_ubjson}
+
+ @sa http://ubjson.org
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ analogous deserialization
+ @sa @ref to_cbor(const basic_json& for the related CBOR format
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+
+ @since version 3.1.0
+ */
+ static std::vector<uint8_t> to_ubjson(const basic_json& j,
+ const bool use_size = false,
+ const bool use_type = false)
+ {
+ std::vector<uint8_t> result;
+ to_ubjson(j, result, use_size, use_type);
+ return result;
+ }
+
+ static void to_ubjson(const basic_json& j, detail::output_adapter<uint8_t> o,
+ const bool use_size = false, const bool use_type = false)
+ {
+ binary_writer<uint8_t>(o).write_ubjson(j, use_size, use_type);
+ }
+
+ static void to_ubjson(const basic_json& j, detail::output_adapter<char> o,
+ const bool use_size = false, const bool use_type = false)
+ {
+ binary_writer<char>(o).write_ubjson(j, use_size, use_type);
+ }
+
+
+ /*!
+ @brief Serializes the given JSON object `j` to BSON and returns a vector
+ containing the corresponding BSON-representation.
+
+ BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are
+ stored as a single entity (a so-called document).
+
+ The library uses the following mapping from JSON values types to BSON types:
+
+ JSON value type | value/range | BSON type | marker
+ --------------- | --------------------------------- | ----------- | ------
+ null | `null` | null | 0x0A
+ boolean | `true`, `false` | boolean | 0x08
+ number_integer | -9223372036854775808..-2147483649 | int64 | 0x12
+ number_integer | -2147483648..2147483647 | int32 | 0x10
+ number_integer | 2147483648..9223372036854775807 | int64 | 0x12
+ number_unsigned | 0..2147483647 | int32 | 0x10
+ number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12
+ number_unsigned | 9223372036854775808..18446744073709551615| -- | --
+ number_float | *any value* | double | 0x01
+ string | *any value* | string | 0x02
+ array | *any value* | document | 0x04
+ object | *any value* | document | 0x03
+
+ @warning The mapping is **incomplete**, since only JSON-objects (and things
+ contained therein) can be serialized to BSON.
+ Also, integers larger than 9223372036854775807 cannot be serialized to BSON,
+ and the keys may not contain U+0000, since they are serialized a
+ zero-terminated c-strings.
+
+ @throw out_of_range.407 if `j.is_number_unsigned() && j.get<std::uint64_t>() > 9223372036854775807`
+ @throw out_of_range.409 if a key in `j` contains a NULL (U+0000)
+ @throw type_error.317 if `!j.is_object()`
+
+ @pre The input `j` is required to be an object: `j.is_object() == true`.
+
+ @note Any BSON output created via @ref to_bson can be successfully parsed
+ by @ref from_bson.
+
+ @param[in] j JSON value to serialize
+ @return BSON serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in BSON format.,to_bson}
+
+ @sa http://bsonspec.org/spec.html
+ @sa @ref from_bson(detail::input_adapter&&, const bool strict) for the
+ analogous deserialization
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+ @sa @ref to_cbor(const basic_json&) for the related CBOR format
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+ */
+ static std::vector<uint8_t> to_bson(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_bson(j, result);
+ return result;
+ }
+
+ /*!
+ @brief Serializes the given JSON object `j` to BSON and forwards the
+ corresponding BSON-representation to the given output_adapter `o`.
+ @param j The JSON object to convert to BSON.
+ @param o The output adapter that receives the binary BSON representation.
+ @pre The input `j` shall be an object: `j.is_object() == true`
+ @sa @ref to_bson(const basic_json&)
+ */
+ static void to_bson(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_bson(j);
+ }
+
+ /*!
+ @copydoc to_bson(const basic_json&, detail::output_adapter<uint8_t>)
+ */
+ static void to_bson(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_bson(j);
+ }
+
+
+ /*!
+ @brief create a JSON value from an input in CBOR format
+
+ Deserializes a given input @a i to a JSON value using the CBOR (Concise
+ Binary Object Representation) serialization format.
+
+ The library maps CBOR types to JSON value types as follows:
+
+ CBOR type | JSON value type | first byte
+ ---------------------- | --------------- | ----------
+ Integer | number_unsigned | 0x00..0x17
+ Unsigned integer | number_unsigned | 0x18
+ Unsigned integer | number_unsigned | 0x19
+ Unsigned integer | number_unsigned | 0x1A
+ Unsigned integer | number_unsigned | 0x1B
+ Negative integer | number_integer | 0x20..0x37
+ Negative integer | number_integer | 0x38
+ Negative integer | number_integer | 0x39
+ Negative integer | number_integer | 0x3A
+ Negative integer | number_integer | 0x3B
+ Negative integer | number_integer | 0x40..0x57
+ UTF-8 string | string | 0x60..0x77
+ UTF-8 string | string | 0x78
+ UTF-8 string | string | 0x79
+ UTF-8 string | string | 0x7A
+ UTF-8 string | string | 0x7B
+ UTF-8 string | string | 0x7F
+ array | array | 0x80..0x97
+ array | array | 0x98
+ array | array | 0x99
+ array | array | 0x9A
+ array | array | 0x9B
+ array | array | 0x9F
+ map | object | 0xA0..0xB7
+ map | object | 0xB8
+ map | object | 0xB9
+ map | object | 0xBA
+ map | object | 0xBB
+ map | object | 0xBF
+ False | `false` | 0xF4
+ True | `true` | 0xF5
+ Null | `null` | 0xF6
+ Half-Precision Float | number_float | 0xF9
+ Single-Precision Float | number_float | 0xFA
+ Double-Precision Float | number_float | 0xFB
+
+ @warning The mapping is **incomplete** in the sense that not all CBOR
+ types can be converted to a JSON value. The following CBOR types
+ are not supported and will yield parse errors (parse_error.112):
+ - byte strings (0x40..0x5F)
+ - date/time (0xC0..0xC1)
+ - bignum (0xC2..0xC3)
+ - decimal fraction (0xC4)
+ - bigfloat (0xC5)
+ - tagged items (0xC6..0xD4, 0xD8..0xDB)
+ - expected conversions (0xD5..0xD7)
+ - simple values (0xE0..0xF3, 0xF8)
+ - undefined (0xF7)
+
+ @warning CBOR allows map keys of any type, whereas JSON only allows
+ strings as keys in object values. Therefore, CBOR maps with keys
+ other than UTF-8 strings are rejected (parse_error.113).
+
+ @note Any CBOR output created @ref to_cbor can be successfully parsed by
+ @ref from_cbor.
+
+ @param[in] i an input in CBOR format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if unsupported features from CBOR were
+ used in the given input @a v or if the input is not valid CBOR
+ @throw parse_error.113 if a string was expected as map key, but not found
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in CBOR
+ format to a JSON value.,from_cbor}
+
+ @sa http://cbor.io
+ @sa @ref to_cbor(const basic_json&) for the analogous serialization
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the
+ related MessagePack format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9; parameter @a start_index since 2.1.1; changed to
+ consume input adapters, removed start_index parameter, and added
+ @a strict parameter since 3.0.0; added @a allow_exceptions parameter
+ since 3.2.0
+ */
+ JSON_NODISCARD
+ static basic_json from_cbor(detail::input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(i)).sax_parse(input_format_t::cbor, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_cbor(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename A1, typename A2,
+ detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
+ JSON_NODISCARD
+ static basic_json from_cbor(A1 && a1, A2 && a2,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::cbor, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @brief create a JSON value from an input in MessagePack format
+
+ Deserializes a given input @a i to a JSON value using the MessagePack
+ serialization format.
+
+ The library maps MessagePack types to JSON value types as follows:
+
+ MessagePack type | JSON value type | first byte
+ ---------------- | --------------- | ----------
+ positive fixint | number_unsigned | 0x00..0x7F
+ fixmap | object | 0x80..0x8F
+ fixarray | array | 0x90..0x9F
+ fixstr | string | 0xA0..0xBF
+ nil | `null` | 0xC0
+ false | `false` | 0xC2
+ true | `true` | 0xC3
+ float 32 | number_float | 0xCA
+ float 64 | number_float | 0xCB
+ uint 8 | number_unsigned | 0xCC
+ uint 16 | number_unsigned | 0xCD
+ uint 32 | number_unsigned | 0xCE
+ uint 64 | number_unsigned | 0xCF
+ int 8 | number_integer | 0xD0
+ int 16 | number_integer | 0xD1
+ int 32 | number_integer | 0xD2
+ int 64 | number_integer | 0xD3
+ str 8 | string | 0xD9
+ str 16 | string | 0xDA
+ str 32 | string | 0xDB
+ array 16 | array | 0xDC
+ array 32 | array | 0xDD
+ map 16 | object | 0xDE
+ map 32 | object | 0xDF
+ negative fixint | number_integer | 0xE0-0xFF
+
+ @warning The mapping is **incomplete** in the sense that not all
+ MessagePack types can be converted to a JSON value. The following
+ MessagePack types are not supported and will yield parse errors:
+ - bin 8 - bin 32 (0xC4..0xC6)
+ - ext 8 - ext 32 (0xC7..0xC9)
+ - fixext 1 - fixext 16 (0xD4..0xD8)
+
+ @note Any MessagePack output created @ref to_msgpack can be successfully
+ parsed by @ref from_msgpack.
+
+ @param[in] i an input in MessagePack format convertible to an input
+ adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if unsupported features from MessagePack were
+ used in the given input @a i or if the input is not valid MessagePack
+ @throw parse_error.113 if a string was expected as map key, but not found
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ MessagePack format to a JSON value.,from_msgpack}
+
+ @sa http://msgpack.org
+ @sa @ref to_msgpack(const basic_json&) for the analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for
+ the related UBJSON format
+ @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for
+ the related BSON format
+
+ @since version 2.0.9; parameter @a start_index since 2.1.1; changed to
+ consume input adapters, removed start_index parameter, and added
+ @a strict parameter since 3.0.0; added @a allow_exceptions parameter
+ since 3.2.0
+ */
+ JSON_NODISCARD
+ static basic_json from_msgpack(detail::input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(i)).sax_parse(input_format_t::msgpack, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename A1, typename A2,
+ detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
+ JSON_NODISCARD
+ static basic_json from_msgpack(A1 && a1, A2 && a2,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::msgpack, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @brief create a JSON value from an input in UBJSON format
+
+ Deserializes a given input @a i to a JSON value using the UBJSON (Universal
+ Binary JSON) serialization format.
+
+ The library maps UBJSON types to JSON value types as follows:
+
+ UBJSON type | JSON value type | marker
+ ----------- | --------------------------------------- | ------
+ no-op | *no value, next value is read* | `N`
+ null | `null` | `Z`
+ false | `false` | `F`
+ true | `true` | `T`
+ float32 | number_float | `d`
+ float64 | number_float | `D`
+ uint8 | number_unsigned | `U`
+ int8 | number_integer | `i`
+ int16 | number_integer | `I`
+ int32 | number_integer | `l`
+ int64 | number_integer | `L`
+ string | string | `S`
+ char | string | `C`
+ array | array (optimized values are supported) | `[`
+ object | object (optimized values are supported) | `{`
+
+ @note The mapping is **complete** in the sense that any UBJSON value can
+ be converted to a JSON value.
+
+ @param[in] i an input in UBJSON format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if a parse error occurs
+ @throw parse_error.113 if a string could not be parsed successfully
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ UBJSON format to a JSON value.,from_ubjson}
+
+ @sa http://ubjson.org
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for
+ the related MessagePack format
+ @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for
+ the related BSON format
+
+ @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0
+ */
+ JSON_NODISCARD
+ static basic_json from_ubjson(detail::input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(i)).sax_parse(input_format_t::ubjson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename A1, typename A2,
+ detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
+ JSON_NODISCARD
+ static basic_json from_ubjson(A1 && a1, A2 && a2,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::ubjson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @brief Create a JSON value from an input in BSON format
+
+ Deserializes a given input @a i to a JSON value using the BSON (Binary JSON)
+ serialization format.
+
+ The library maps BSON record types to JSON value types as follows:
+
+ BSON type | BSON marker byte | JSON value type
+ --------------- | ---------------- | ---------------------------
+ double | 0x01 | number_float
+ string | 0x02 | string
+ document | 0x03 | object
+ array | 0x04 | array
+ binary | 0x05 | still unsupported
+ undefined | 0x06 | still unsupported
+ ObjectId | 0x07 | still unsupported
+ boolean | 0x08 | boolean
+ UTC Date-Time | 0x09 | still unsupported
+ null | 0x0A | null
+ Regular Expr. | 0x0B | still unsupported
+ DB Pointer | 0x0C | still unsupported
+ JavaScript Code | 0x0D | still unsupported
+ Symbol | 0x0E | still unsupported
+ JavaScript Code | 0x0F | still unsupported
+ int32 | 0x10 | number_integer
+ Timestamp | 0x11 | still unsupported
+ 128-bit decimal float | 0x13 | still unsupported
+ Max Key | 0x7F | still unsupported
+ Min Key | 0xFF | still unsupported
+
+ @warning The mapping is **incomplete**. The unsupported mappings
+ are indicated in the table above.
+
+ @param[in] i an input in BSON format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.114 if an unsupported BSON record type is encountered
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ BSON format to a JSON value.,from_bson}
+
+ @sa http://bsonspec.org/spec.html
+ @sa @ref to_bson(const basic_json&) for the analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for
+ the related MessagePack format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ related UBJSON format
+ */
+ JSON_NODISCARD
+ static basic_json from_bson(detail::input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(i)).sax_parse(input_format_t::bson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_bson(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename A1, typename A2,
+ detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
+ JSON_NODISCARD
+ static basic_json from_bson(A1 && a1, A2 && a2,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::bson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+
+
+ /// @}
+
+ //////////////////////////
+ // JSON Pointer support //
+ //////////////////////////
+
+ /// @name JSON Pointer functions
+ /// @{
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Uses a JSON pointer to retrieve a reference to the respective JSON value.
+ No bound checking is performed. Similar to @ref operator[](const typename
+ object_t::key_type&), `null` values are created in arrays and objects if
+ necessary.
+
+ In particular:
+ - If the JSON pointer points to an object key that does not exist, it
+ is created an filled with a `null` value before a reference to it
+ is returned.
+ - If the JSON pointer points to an array index that does not exist, it
+ is created an filled with a `null` value before a reference to it
+ is returned. All indices between the current maximum and the given
+ index are also filled with `null`.
+ - The special value `-` is treated as a synonym for the index past the
+ end.
+
+ @param[in] ptr a JSON pointer
+
+ @return reference to the element pointed to by @a ptr
+
+ @complexity Constant.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+
+ @liveexample{The behavior is shown in the example.,operatorjson_pointer}
+
+ @since version 2.0.0
+ */
+ reference operator[](const json_pointer& ptr)
+ {
+ return ptr.get_unchecked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Uses a JSON pointer to retrieve a reference to the respective JSON value.
+ No bound checking is performed. The function does not change the JSON
+ value; no `null` values are created. In particular, the the special value
+ `-` yields an exception.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return const reference to the element pointed to by @a ptr
+
+ @complexity Constant.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+
+ @liveexample{The behavior is shown in the example.,operatorjson_pointer_const}
+
+ @since version 2.0.0
+ */
+ const_reference operator[](const json_pointer& ptr) const
+ {
+ return ptr.get_unchecked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Returns a reference to the element at with specified JSON pointer @a ptr,
+ with bounds checking.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return reference to the element pointed to by @a ptr
+
+ @throw parse_error.106 if an array index in the passed JSON pointer @a ptr
+ begins with '0'. See example below.
+
+ @throw parse_error.109 if an array index in the passed JSON pointer @a ptr
+ is not a number. See example below.
+
+ @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr
+ is out of range. See example below.
+
+ @throw out_of_range.402 if the array index '-' is used in the passed JSON
+ pointer @a ptr. As `at` provides checked access (and no elements are
+ implicitly inserted), the index '-' is always invalid. See example below.
+
+ @throw out_of_range.403 if the JSON pointer describes a key of an object
+ which cannot be found. See example below.
+
+ @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.
+ See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 2.0.0
+
+ @liveexample{The behavior is shown in the example.,at_json_pointer}
+ */
+ reference at(const json_pointer& ptr)
+ {
+ return ptr.get_checked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Returns a const reference to the element at with specified JSON pointer @a
+ ptr, with bounds checking.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return reference to the element pointed to by @a ptr
+
+ @throw parse_error.106 if an array index in the passed JSON pointer @a ptr
+ begins with '0'. See example below.
+
+ @throw parse_error.109 if an array index in the passed JSON pointer @a ptr
+ is not a number. See example below.
+
+ @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr
+ is out of range. See example below.
+
+ @throw out_of_range.402 if the array index '-' is used in the passed JSON
+ pointer @a ptr. As `at` provides checked access (and no elements are
+ implicitly inserted), the index '-' is always invalid. See example below.
+
+ @throw out_of_range.403 if the JSON pointer describes a key of an object
+ which cannot be found. See example below.
+
+ @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.
+ See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 2.0.0
+
+ @liveexample{The behavior is shown in the example.,at_json_pointer_const}
+ */
+ const_reference at(const json_pointer& ptr) const
+ {
+ return ptr.get_checked(this);
+ }
+
+ /*!
+ @brief return flattened JSON value
+
+ The function creates a JSON object whose keys are JSON pointers (see [RFC
+ 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all
+ primitive. The original JSON value can be restored using the @ref
+ unflatten() function.
+
+ @return an object that maps JSON pointers to primitive values
+
+ @note Empty objects and arrays are flattened to `null` and will not be
+ reconstructed correctly by the @ref unflatten() function.
+
+ @complexity Linear in the size the JSON value.
+
+ @liveexample{The following code shows how a JSON object is flattened to an
+ object whose keys consist of JSON pointers.,flatten}
+
+ @sa @ref unflatten() for the reverse function
+
+ @since version 2.0.0
+ */
+ basic_json flatten() const
+ {
+ basic_json result(value_t::object);
+ json_pointer::flatten("", *this, result);
+ return result;
+ }
+
+ /*!
+ @brief unflatten a previously flattened JSON value
+
+ The function restores the arbitrary nesting of a JSON value that has been
+ flattened before using the @ref flatten() function. The JSON value must
+ meet certain constraints:
+ 1. The value must be an object.
+ 2. The keys must be JSON pointers (see
+ [RFC 6901](https://tools.ietf.org/html/rfc6901))
+ 3. The mapped values must be primitive JSON types.
+
+ @return the original JSON from a flattened version
+
+ @note Empty objects and arrays are flattened by @ref flatten() to `null`
+ values and can not unflattened to their original type. Apart from
+ this example, for a JSON value `j`, the following is always true:
+ `j == j.flatten().unflatten()`.
+
+ @complexity Linear in the size the JSON value.
+
+ @throw type_error.314 if value is not an object
+ @throw type_error.315 if object values are not primitive
+
+ @liveexample{The following code shows how a flattened JSON object is
+ unflattened into the original nested JSON object.,unflatten}
+
+ @sa @ref flatten() for the reverse function
+
+ @since version 2.0.0
+ */
+ basic_json unflatten() const
+ {
+ return json_pointer::unflatten(*this);
+ }
+
+ /// @}
+
+ //////////////////////////
+ // JSON Patch functions //
+ //////////////////////////
+
+ /// @name JSON Patch functions
+ /// @{
+
+ /*!
+ @brief applies a JSON patch
+
+ [JSON Patch](http://jsonpatch.com) defines a JSON document structure for
+ expressing a sequence of operations to apply to a JSON) document. With
+ this function, a JSON Patch is applied to the current JSON value by
+ executing all operations from the patch.
+
+ @param[in] json_patch JSON patch document
+ @return patched document
+
+ @note The application of a patch is atomic: Either all operations succeed
+ and the patched document is returned or an exception is thrown. In
+ any case, the original value is not changed: the patch is applied
+ to a copy of the value.
+
+ @throw parse_error.104 if the JSON patch does not consist of an array of
+ objects
+
+ @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory
+ attributes are missing); example: `"operation add must have member path"`
+
+ @throw out_of_range.401 if an array index is out of range.
+
+ @throw out_of_range.403 if a JSON pointer inside the patch could not be
+ resolved successfully in the current JSON value; example: `"key baz not
+ found"`
+
+ @throw out_of_range.405 if JSON pointer has no parent ("add", "remove",
+ "move")
+
+ @throw other_error.501 if "test" operation was unsuccessful
+
+ @complexity Linear in the size of the JSON value and the length of the
+ JSON patch. As usually only a fraction of the JSON value is affected by
+ the patch, the complexity can usually be neglected.
+
+ @liveexample{The following code shows how a JSON patch is applied to a
+ value.,patch}
+
+ @sa @ref diff -- create a JSON patch by comparing two JSON values
+
+ @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)
+ @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901)
+
+ @since version 2.0.0
+ */
+ basic_json patch(const basic_json& json_patch) const
+ {
+ // make a working copy to apply the patch to
+ basic_json result = *this;
+
+ // the valid JSON Patch operations
+ enum class patch_operations {add, remove, replace, move, copy, test, invalid};
+
+ const auto get_op = [](const std::string & op)
+ {
+ if (op == "add")
+ {
+ return patch_operations::add;
+ }
+ if (op == "remove")
+ {
+ return patch_operations::remove;
+ }
+ if (op == "replace")
+ {
+ return patch_operations::replace;
+ }
+ if (op == "move")
+ {
+ return patch_operations::move;
+ }
+ if (op == "copy")
+ {
+ return patch_operations::copy;
+ }
+ if (op == "test")
+ {
+ return patch_operations::test;
+ }
+
+ return patch_operations::invalid;
+ };
+
+ // wrapper for "add" operation; add value at ptr
+ const auto operation_add = [&result](json_pointer & ptr, basic_json val)
+ {
+ // adding to the root of the target document means replacing it
+ if (ptr.empty())
+ {
+ result = val;
+ return;
+ }
+
+ // make sure the top element of the pointer exists
+ json_pointer top_pointer = ptr.top();
+ if (top_pointer != ptr)
+ {
+ result.at(top_pointer);
+ }
+
+ // get reference to parent of JSON pointer ptr
+ const auto last_path = ptr.back();
+ ptr.pop_back();
+ basic_json& parent = result[ptr];
+
+ switch (parent.m_type)
+ {
+ case value_t::null:
+ case value_t::object:
+ {
+ // use operator[] to add value
+ parent[last_path] = val;
+ break;
+ }
+
+ case value_t::array:
+ {
+ if (last_path == "-")
+ {
+ // special case: append to back
+ parent.push_back(val);
+ }
+ else
+ {
+ const auto idx = json_pointer::array_index(last_path);
+ if (JSON_UNLIKELY(static_cast<size_type>(idx) > parent.size()))
+ {
+ // avoid undefined behavior
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+
+ // default case: insert add offset
+ parent.insert(parent.begin() + static_cast<difference_type>(idx), val);
+ }
+ break;
+ }
+
+ // if there exists a parent it cannot be primitive
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ };
+
+ // wrapper for "remove" operation; remove value at ptr
+ const auto operation_remove = [&result](json_pointer & ptr)
+ {
+ // get reference to parent of JSON pointer ptr
+ const auto last_path = ptr.back();
+ ptr.pop_back();
+ basic_json& parent = result.at(ptr);
+
+ // remove child
+ if (parent.is_object())
+ {
+ // perform range check
+ auto it = parent.find(last_path);
+ if (JSON_LIKELY(it != parent.end()))
+ {
+ parent.erase(it);
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found"));
+ }
+ }
+ else if (parent.is_array())
+ {
+ // note erase performs range check
+ parent.erase(static_cast<size_type>(json_pointer::array_index(last_path)));
+ }
+ };
+
+ // type check: top level value must be an array
+ if (JSON_UNLIKELY(not json_patch.is_array()))
+ {
+ JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
+ }
+
+ // iterate and apply the operations
+ for (const auto& val : json_patch)
+ {
+ // wrapper to get a value for an operation
+ const auto get_value = [&val](const std::string & op,
+ const std::string & member,
+ bool string_type) -> basic_json &
+ {
+ // find value
+ auto it = val.m_value.object->find(member);
+
+ // context-sensitive error message
+ const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'";
+
+ // check if desired value is present
+ if (JSON_UNLIKELY(it == val.m_value.object->end()))
+ {
+ JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'"));
+ }
+
+ // check if result is of type string
+ if (JSON_UNLIKELY(string_type and not it->second.is_string()))
+ {
+ JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'"));
+ }
+
+ // no error: return value
+ return it->second;
+ };
+
+ // type check: every element of the array must be an object
+ if (JSON_UNLIKELY(not val.is_object()))
+ {
+ JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
+ }
+
+ // collect mandatory members
+ const std::string op = get_value("op", "op", true);
+ const std::string path = get_value(op, "path", true);
+ json_pointer ptr(path);
+
+ switch (get_op(op))
+ {
+ case patch_operations::add:
+ {
+ operation_add(ptr, get_value("add", "value", false));
+ break;
+ }
+
+ case patch_operations::remove:
+ {
+ operation_remove(ptr);
+ break;
+ }
+
+ case patch_operations::replace:
+ {
+ // the "path" location must exist - use at()
+ result.at(ptr) = get_value("replace", "value", false);
+ break;
+ }
+
+ case patch_operations::move:
+ {
+ const std::string from_path = get_value("move", "from", true);
+ json_pointer from_ptr(from_path);
+
+ // the "from" location must exist - use at()
+ basic_json v = result.at(from_ptr);
+
+ // The move operation is functionally identical to a
+ // "remove" operation on the "from" location, followed
+ // immediately by an "add" operation at the target
+ // location with the value that was just removed.
+ operation_remove(from_ptr);
+ operation_add(ptr, v);
+ break;
+ }
+
+ case patch_operations::copy:
+ {
+ const std::string from_path = get_value("copy", "from", true);
+ const json_pointer from_ptr(from_path);
+
+ // the "from" location must exist - use at()
+ basic_json v = result.at(from_ptr);
+
+ // The copy is functionally identical to an "add"
+ // operation at the target location using the value
+ // specified in the "from" member.
+ operation_add(ptr, v);
+ break;
+ }
+
+ case patch_operations::test:
+ {
+ bool success = false;
+ JSON_TRY
+ {
+ // check if "value" matches the one at "path"
+ // the "path" location must exist - use at()
+ success = (result.at(ptr) == get_value("test", "value", false));
+ }
+ JSON_INTERNAL_CATCH (out_of_range&)
+ {
+ // ignore out of range errors: success remains false
+ }
+
+ // throw an exception if test fails
+ if (JSON_UNLIKELY(not success))
+ {
+ JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump()));
+ }
+
+ break;
+ }
+
+ default:
+ {
+ // op must be "add", "remove", "replace", "move", "copy", or
+ // "test"
+ JSON_THROW(parse_error::create(105, 0, "operation value '" + op + "' is invalid"));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief creates a diff as a JSON patch
+
+ Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can
+ be changed into the value @a target by calling @ref patch function.
+
+ @invariant For two JSON values @a source and @a target, the following code
+ yields always `true`:
+ @code {.cpp}
+ source.patch(diff(source, target)) == target;
+ @endcode
+
+ @note Currently, only `remove`, `add`, and `replace` operations are
+ generated.
+
+ @param[in] source JSON value to compare from
+ @param[in] target JSON value to compare against
+ @param[in] path helper value to create JSON pointers
+
+ @return a JSON patch to convert the @a source to @a target
+
+ @complexity Linear in the lengths of @a source and @a target.
+
+ @liveexample{The following code shows how a JSON patch is created as a
+ diff for two JSON values.,diff}
+
+ @sa @ref patch -- apply a JSON patch
+ @sa @ref merge_patch -- apply a JSON Merge Patch
+
+ @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)
+
+ @since version 2.0.0
+ */
+ JSON_NODISCARD
+ static basic_json diff(const basic_json& source, const basic_json& target,
+ const std::string& path = "")
+ {
+ // the patch
+ basic_json result(value_t::array);
+
+ // if the values are the same, return empty patch
+ if (source == target)
+ {
+ return result;
+ }
+
+ if (source.type() != target.type())
+ {
+ // different types: replace value
+ result.push_back(
+ {
+ {"op", "replace"}, {"path", path}, {"value", target}
+ });
+ return result;
+ }
+
+ switch (source.type())
+ {
+ case value_t::array:
+ {
+ // first pass: traverse common elements
+ std::size_t i = 0;
+ while (i < source.size() and i < target.size())
+ {
+ // recursive call to compare array values at index i
+ auto temp_diff = diff(source[i], target[i], path + "/" + std::to_string(i));
+ result.insert(result.end(), temp_diff.begin(), temp_diff.end());
+ ++i;
+ }
+
+ // i now reached the end of at least one array
+ // in a second pass, traverse the remaining elements
+
+ // remove my remaining elements
+ const auto end_index = static_cast<difference_type>(result.size());
+ while (i < source.size())
+ {
+ // add operations in reverse order to avoid invalid
+ // indices
+ result.insert(result.begin() + end_index, object(
+ {
+ {"op", "remove"},
+ {"path", path + "/" + std::to_string(i)}
+ }));
+ ++i;
+ }
+
+ // add other remaining elements
+ while (i < target.size())
+ {
+ result.push_back(
+ {
+ {"op", "add"},
+ {"path", path + "/" + std::to_string(i)},
+ {"value", target[i]}
+ });
+ ++i;
+ }
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ // first pass: traverse this object's elements
+ for (auto it = source.cbegin(); it != source.cend(); ++it)
+ {
+ // escape the key name to be used in a JSON patch
+ const auto key = json_pointer::escape(it.key());
+
+ if (target.find(it.key()) != target.end())
+ {
+ // recursive call to compare object values at key it
+ auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key);
+ result.insert(result.end(), temp_diff.begin(), temp_diff.end());
+ }
+ else
+ {
+ // found a key that is not in o -> remove it
+ result.push_back(object(
+ {
+ {"op", "remove"}, {"path", path + "/" + key}
+ }));
+ }
+ }
+
+ // second pass: traverse other object's elements
+ for (auto it = target.cbegin(); it != target.cend(); ++it)
+ {
+ if (source.find(it.key()) == source.end())
+ {
+ // found a key that is not in this -> add it
+ const auto key = json_pointer::escape(it.key());
+ result.push_back(
+ {
+ {"op", "add"}, {"path", path + "/" + key},
+ {"value", it.value()}
+ });
+ }
+ }
+
+ break;
+ }
+
+ default:
+ {
+ // both primitive type: replace value
+ result.push_back(
+ {
+ {"op", "replace"}, {"path", path}, {"value", target}
+ });
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /// @}
+
+ ////////////////////////////////
+ // JSON Merge Patch functions //
+ ////////////////////////////////
+
+ /// @name JSON Merge Patch functions
+ /// @{
+
+ /*!
+ @brief applies a JSON Merge Patch
+
+ The merge patch format is primarily intended for use with the HTTP PATCH
+ method as a means of describing a set of modifications to a target
+ resource's content. This function applies a merge patch to the current
+ JSON value.
+
+ The function implements the following algorithm from Section 2 of
+ [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396):
+
+ ```
+ define MergePatch(Target, Patch):
+ if Patch is an Object:
+ if Target is not an Object:
+ Target = {} // Ignore the contents and set it to an empty Object
+ for each Name/Value pair in Patch:
+ if Value is null:
+ if Name exists in Target:
+ remove the Name/Value pair from Target
+ else:
+ Target[Name] = MergePatch(Target[Name], Value)
+ return Target
+ else:
+ return Patch
+ ```
+
+ Thereby, `Target` is the current object; that is, the patch is applied to
+ the current value.
+
+ @param[in] apply_patch the patch to apply
+
+ @complexity Linear in the lengths of @a patch.
+
+ @liveexample{The following code shows how a JSON Merge Patch is applied to
+ a JSON document.,merge_patch}
+
+ @sa @ref patch -- apply a JSON patch
+ @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
+
+ @since version 3.0.0
+ */
+ void merge_patch(const basic_json& apply_patch)
+ {
+ if (apply_patch.is_object())
+ {
+ if (not is_object())
+ {
+ *this = object();
+ }
+ for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
+ {
+ if (it.value().is_null())
+ {
+ erase(it.key());
+ }
+ else
+ {
+ operator[](it.key()).merge_patch(it.value());
+ }
+ }
+ }
+ else
+ {
+ *this = apply_patch;
+ }
+ }
+
+ /// @}
+};
+} // namespace nlohmann
+
+///////////////////////
+// nonmember support //
+///////////////////////
+
+// specialization of std::swap, and std::hash
+namespace std
+{
+
+/// hash value for JSON objects
+template<>
+struct hash<nlohmann::json>
+{
+ /*!
+ @brief return a hash value for a JSON object
+
+ @since version 1.0.0
+ */
+ std::size_t operator()(const nlohmann::json& j) const
+ {
+ // a naive hashing via the string representation
+ const auto& h = hash<nlohmann::json::string_t>();
+ return h(j.dump());
+ }
+};
+
+/// specialization for std::less<value_t>
+/// @note: do not remove the space after '<',
+/// see https://github.com/nlohmann/json/pull/679
+template<>
+struct less< ::nlohmann::detail::value_t>
+{
+ /*!
+ @brief compare two value_t enum values
+ @since version 3.0.0
+ */
+ bool operator()(nlohmann::detail::value_t lhs,
+ nlohmann::detail::value_t rhs) const noexcept
+ {
+ return nlohmann::detail::operator<(lhs, rhs);
+ }
+};
+
+/*!
+@brief exchanges the values of two JSON objects
+
+@since version 1.0.0
+*/
+template<>
+inline void swap<nlohmann::json>(nlohmann::json& j1, nlohmann::json& j2) noexcept(
+ is_nothrow_move_constructible<nlohmann::json>::value and
+ is_nothrow_move_assignable<nlohmann::json>::value
+)
+{
+ j1.swap(j2);
+}
+
+} // namespace std
+
+/*!
+@brief user-defined string literal for JSON values
+
+This operator implements a user-defined string literal for JSON objects. It
+can be used by adding `"_json"` to a string literal and returns a JSON object
+if no parse error occurred.
+
+@param[in] s a string representation of a JSON object
+@param[in] n the length of string @a s
+@return a JSON object
+
+@since version 1.0.0
+*/
+inline nlohmann::json operator "" _json(const char* s, std::size_t n)
+{
+ return nlohmann::json::parse(s, s + n);
+}
+
+/*!
+@brief user-defined string literal for JSON pointer
+
+This operator implements a user-defined string literal for JSON Pointers. It
+can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer
+object if no parse error occurred.
+
+@param[in] s a string representation of a JSON Pointer
+@param[in] n the length of string @a s
+@return a JSON pointer object
+
+@since version 2.0.0
+*/
+inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
+{
+ return nlohmann::json::json_pointer(std::string(s, n));
+}
+
+// #include <nlohmann/detail/macro_unscope.hpp>
+
+
+// restore GCC/clang diagnostic settings
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #pragma GCC diagnostic pop
+#endif
+#if defined(__clang__)
+ #pragma GCC diagnostic pop
+#endif
+
+// clean up
+#undef JSON_INTERNAL_CATCH
+#undef JSON_CATCH
+#undef JSON_THROW
+#undef JSON_TRY
+#undef JSON_LIKELY
+#undef JSON_UNLIKELY
+#undef JSON_DEPRECATED
+#undef JSON_NODISCARD
+#undef JSON_HAS_CPP_14
+#undef JSON_HAS_CPP_17
+#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
+#undef NLOHMANN_BASIC_JSON_TPL
+
+
+#endif // INCLUDE_NLOHMANN_JSON_HPP_
diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt
index 27cc408223..d8d64bcdd7 100644
--- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt
+++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt
@@ -1,7 +1,7 @@
add_qtc_library(KSyntaxHighlighting STATIC
PUBLIC_INCLUDES autogenerated/ autogenerated/src/lib src/lib
PUBLIC_DEFINES KSYNTAXHIGHLIGHTING_LIBRARY
- DEPENDS Qt5::Network Qt5::Gui
+ DEPENDS Qt5::Network Qt5::Widgets
SOURCES
autogenerated/src/lib/ksyntaxhighlighting_logging.cpp autogenerated/src/lib/ksyntaxhighlighting_logging.h
autogenerated/ksyntaxhighlighting_version.h
diff --git a/src/libs/3rdparty/yaml-cpp/.clang-format b/src/libs/3rdparty/yaml-cpp/.clang-format
new file mode 100644
index 0000000000..d6d46fb416
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/.clang-format
@@ -0,0 +1,47 @@
+---
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+ConstructorInitializerIndentWidth: 4
+AlignEscapedNewlinesLeft: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: true
+AlwaysBreakBeforeMultilineStrings: true
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BinPackParameters: true
+ColumnLimit: 80
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+DerivePointerBinding: true
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 60
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerBindsToType: true
+SpacesBeforeTrailingComments: 2
+Cpp11BracedListStyle: true
+Standard: Cpp11
+IndentWidth: 2
+TabWidth: 8
+UseTab: Never
+BreakBeforeBraces: Attach
+IndentFunctionDeclarationAfterType: true
+SpacesInParentheses: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpaceAfterControlStatementKeyword: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 4
+...
+
diff --git a/src/libs/3rdparty/yaml-cpp/LICENSE b/src/libs/3rdparty/yaml-cpp/LICENSE
new file mode 100644
index 0000000000..991fdbbe7d
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2008-2015 Jesse Beder.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/src/libs/3rdparty/yaml-cpp/README.md b/src/libs/3rdparty/yaml-cpp/README.md
new file mode 100644
index 0000000000..f33d3503a1
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/README.md
@@ -0,0 +1,51 @@
+# yaml-cpp [![Build Status](https://travis-ci.org/jbeder/yaml-cpp.svg?branch=master)](https://travis-ci.org/jbeder/yaml-cpp) [![Documentation](https://codedocs.xyz/jbeder/yaml-cpp.svg)](https://codedocs.xyz/jbeder/yaml-cpp/)
+
+yaml-cpp is a [YAML](http://www.yaml.org/) parser and emitter in C++ matching the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).
+
+To get a feel for how it can be used, see the [Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) or [How to Emit YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML). For the old API (version < 0.5.0), see [How To Parse A Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).
+
+# Problems? #
+
+If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)! If you have questions about how to use yaml-cpp, please post it on http://stackoverflow.com and tag it [`yaml-cpp`](http://stackoverflow.com/questions/tagged/yaml-cpp).
+
+# How to Build #
+
+yaml-cpp uses [CMake](http://www.cmake.org) to support cross-platform building. The basic steps to build are:
+
+1. Download and install [CMake](http://www.cmake.org) (Resources -> Download).
+
+**Note:** If you don't use the provided installer for your platform, make sure that you add CMake's bin folder to your path.
+
+2. Navigate into the source directory, and type:
+
+```
+mkdir build
+cd build
+```
+
+3. Run CMake. The basic syntax is:
+
+```
+cmake [-G generator] [-DBUILD_SHARED_LIBS=ON|OFF] ..
+```
+
+ * The `generator` is whatever type of build system you'd like to use. To see a full list of generators on your platform, just run `cmake` (with no arguments). For example:
+ * On Windows, you might use "Visual Studio 12 2013" to generate a Visual Studio 2013 solution or "Visual Studio 14 2015 Win64" to generate a 64-bit Visual Studio 2015 solution.
+ * On OS X, you might use "Xcode" to generate an Xcode project
+ * On a UNIX-y system, simply omit the option to generate a makefile
+
+ * yaml-cpp defaults to building a static library, but you may build a shared library by specifying `-DBUILD_SHARED_LIBS=ON`.
+
+ * For more options on customizing the build, see the [CMakeLists.txt](https://github.com/jbeder/yaml-cpp/blob/master/CMakeLists.txt) file.
+
+4. Build it!
+
+5. To clean up, just remove the `build` directory.
+
+# Recent Release #
+
+[yaml-cpp 0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) has been released! This release requires C++11, and no longer depends on Boost.
+
+[yaml-cpp 0.3.0](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.3.0) is still available if you want the old API.
+
+**The old API will continue to be supported, and will still receive bugfixes!** The 0.3.x and 0.4.x versions will be old API releases, and 0.5.x and above will all be new API releases.
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h
new file mode 100644
index 0000000000..06759c724d
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h
@@ -0,0 +1,17 @@
+#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+
+namespace YAML {
+typedef std::size_t anchor_t;
+const anchor_t NullAnchor = 0;
+}
+
+#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h
new file mode 100644
index 0000000000..29d5dbd027
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h
@@ -0,0 +1,67 @@
+#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+YAML_CPP_API std::string EncodeBase64(const unsigned char *data,
+ std::size_t size);
+YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
+
+class YAML_CPP_API Binary {
+ public:
+ Binary() : m_unownedData(0), m_unownedSize(0) {}
+ Binary(const unsigned char *data_, std::size_t size_)
+ : m_unownedData(data_), m_unownedSize(size_) {}
+
+ bool owned() const { return !m_unownedData; }
+ std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
+ const unsigned char *data() const {
+ return owned() ? &m_data[0] : m_unownedData;
+ }
+
+ void swap(std::vector<unsigned char> &rhs) {
+ if (m_unownedData) {
+ m_data.swap(rhs);
+ rhs.clear();
+ rhs.resize(m_unownedSize);
+ std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
+ m_unownedData = 0;
+ m_unownedSize = 0;
+ } else {
+ m_data.swap(rhs);
+ }
+ }
+
+ bool operator==(const Binary &rhs) const {
+ const std::size_t s = size();
+ if (s != rhs.size())
+ return false;
+ const unsigned char *d1 = data();
+ const unsigned char *d2 = rhs.data();
+ for (std::size_t i = 0; i < s; i++) {
+ if (*d1++ != *d2++)
+ return false;
+ }
+ return true;
+ }
+
+ bool operator!=(const Binary &rhs) const { return !(*this == rhs); }
+
+ private:
+ std::vector<unsigned char> m_data;
+ const unsigned char *m_unownedData;
+ std::size_t m_unownedSize;
+};
+}
+
+#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
new file mode 100644
index 0000000000..897f1533df
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
@@ -0,0 +1,42 @@
+#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+// The following ifdef block is the standard way of creating macros which make
+// exporting from a DLL simpler. All files within this DLL are compiled with the
+// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
+// be defined on any project that uses this DLL. This way any other project
+// whose source files include this file see YAML_CPP_API functions as being
+// imported from a DLL, whereas this DLL sees symbols defined with this macro as
+// being exported.
+#undef YAML_CPP_API
+
+#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
+ // manually)
+
+#if defined(_WIN32) || defined(WIN32)
+# define YAML_CPP_API_IMPORT __declspec(dllimport)
+# define YAML_CPP_API_EXPORT __declspec(dllexport)
+#else
+# define YAML_CPP_API_IMPORT __attribute__((visibility("default")))
+# define YAML_CPP_API_EXPORT __attribute__((visibility("default")))
+#endif
+
+#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
+ // or defined manually)
+// #pragma message( "Defining YAML_CPP_API for DLL export" )
+#define YAML_CPP_API YAML_CPP_API_EXPORT
+#else // yaml_cpp_EXPORTS
+// #pragma message( "Defining YAML_CPP_API for DLL import" )
+#define YAML_CPP_API YAML_CPP_API_IMPORT
+#endif // yaml_cpp_EXPORTS
+#else // YAML_CPP_DLL
+#define YAML_CPP_API
+#endif // YAML_CPP_DLL
+
+#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h
new file mode 100644
index 0000000000..f14b051ab0
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h
@@ -0,0 +1,57 @@
+#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stack>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+class Emitter;
+
+class EmitFromEvents : public EventHandler {
+ public:
+ EmitFromEvents(Emitter& emitter);
+
+ virtual void OnDocumentStart(const Mark& mark);
+ virtual void OnDocumentEnd();
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnMapEnd();
+
+ private:
+ void BeginNode();
+ void EmitProps(const std::string& tag, anchor_t anchor);
+
+ private:
+ Emitter& m_emitter;
+
+ struct State {
+ enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue };
+ };
+ std::stack<State::value> m_stateStack;
+};
+}
+
+#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h
new file mode 100644
index 0000000000..ef92cc4035
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h
@@ -0,0 +1,254 @@
+#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <memory>
+#include <sstream>
+#include <string>
+
+#include "yaml-cpp/binary.h"
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/noncopyable.h"
+#include "yaml-cpp/null.h"
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+class Binary;
+struct _Null;
+} // namespace YAML
+
+namespace YAML {
+class EmitterState;
+
+class YAML_CPP_API Emitter : private noncopyable {
+ public:
+ Emitter();
+ explicit Emitter(std::ostream& stream);
+ ~Emitter();
+
+ // output
+ const char* c_str() const;
+ std::size_t size() const;
+
+ // state checking
+ bool good() const;
+ const std::string GetLastError() const;
+
+ // global setters
+ bool SetOutputCharset(EMITTER_MANIP value);
+ bool SetStringFormat(EMITTER_MANIP value);
+ bool SetBoolFormat(EMITTER_MANIP value);
+ bool SetIntBase(EMITTER_MANIP value);
+ bool SetSeqFormat(EMITTER_MANIP value);
+ bool SetMapFormat(EMITTER_MANIP value);
+ bool SetIndent(std::size_t n);
+ bool SetPreCommentIndent(std::size_t n);
+ bool SetPostCommentIndent(std::size_t n);
+ bool SetFloatPrecision(std::size_t n);
+ bool SetDoublePrecision(std::size_t n);
+
+ // local setters
+ Emitter& SetLocalValue(EMITTER_MANIP value);
+ Emitter& SetLocalIndent(const _Indent& indent);
+ Emitter& SetLocalPrecision(const _Precision& precision);
+
+ // overloads of write
+ Emitter& Write(const std::string& str);
+ Emitter& Write(bool b);
+ Emitter& Write(char ch);
+ Emitter& Write(const _Alias& alias);
+ Emitter& Write(const _Anchor& anchor);
+ Emitter& Write(const _Tag& tag);
+ Emitter& Write(const _Comment& comment);
+ Emitter& Write(const _Null& n);
+ Emitter& Write(const Binary& binary);
+
+ template <typename T>
+ Emitter& WriteIntegralType(T value);
+
+ template <typename T>
+ Emitter& WriteStreamable(T value);
+
+ private:
+ template <typename T>
+ void SetStreamablePrecision(std::stringstream&) {}
+ std::size_t GetFloatPrecision() const;
+ std::size_t GetDoublePrecision() const;
+
+ void PrepareIntegralStream(std::stringstream& stream) const;
+ void StartedScalar();
+
+ private:
+ void EmitBeginDoc();
+ void EmitEndDoc();
+ void EmitBeginSeq();
+ void EmitEndSeq();
+ void EmitBeginMap();
+ void EmitEndMap();
+ void EmitNewline();
+ void EmitKindTag();
+ void EmitTag(bool verbatim, const _Tag& tag);
+
+ void PrepareNode(EmitterNodeType::value child);
+ void PrepareTopNode(EmitterNodeType::value child);
+ void FlowSeqPrepareNode(EmitterNodeType::value child);
+ void BlockSeqPrepareNode(EmitterNodeType::value child);
+
+ void FlowMapPrepareNode(EmitterNodeType::value child);
+
+ void FlowMapPrepareLongKey(EmitterNodeType::value child);
+ void FlowMapPrepareLongKeyValue(EmitterNodeType::value child);
+ void FlowMapPrepareSimpleKey(EmitterNodeType::value child);
+ void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child);
+
+ void BlockMapPrepareNode(EmitterNodeType::value child);
+
+ void BlockMapPrepareLongKey(EmitterNodeType::value child);
+ void BlockMapPrepareLongKeyValue(EmitterNodeType::value child);
+ void BlockMapPrepareSimpleKey(EmitterNodeType::value child);
+ void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child);
+
+ void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
+
+ const char* ComputeFullBoolName(bool b) const;
+ bool CanEmitNewline() const;
+
+ private:
+ std::unique_ptr<EmitterState> m_pState;
+ ostream_wrapper m_stream;
+};
+
+template <typename T>
+inline Emitter& Emitter::WriteIntegralType(T value) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ std::stringstream stream;
+ PrepareIntegralStream(stream);
+ stream << value;
+ m_stream << stream.str();
+
+ StartedScalar();
+
+ return *this;
+}
+
+template <typename T>
+inline Emitter& Emitter::WriteStreamable(T value) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ std::stringstream stream;
+ SetStreamablePrecision<T>(stream);
+ stream << value;
+ m_stream << stream.str();
+
+ StartedScalar();
+
+ return *this;
+}
+
+template <>
+inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream) {
+ stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
+}
+
+template <>
+inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream) {
+ stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
+}
+
+// overloads of insertion
+inline Emitter& operator<<(Emitter& emitter, const std::string& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, bool v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, char v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned char v) {
+ return emitter.Write(static_cast<char>(v));
+}
+inline Emitter& operator<<(Emitter& emitter, const _Alias& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Tag& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Comment& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const _Null& v) {
+ return emitter.Write(v);
+}
+inline Emitter& operator<<(Emitter& emitter, const Binary& b) {
+ return emitter.Write(b);
+}
+
+inline Emitter& operator<<(Emitter& emitter, const char* v) {
+ return emitter.Write(std::string(v));
+}
+
+inline Emitter& operator<<(Emitter& emitter, int v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned int v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, short v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned short v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, long long v) {
+ return emitter.WriteIntegralType(v);
+}
+inline Emitter& operator<<(Emitter& emitter, unsigned long long v) {
+ return emitter.WriteIntegralType(v);
+}
+
+inline Emitter& operator<<(Emitter& emitter, float v) {
+ return emitter.WriteStreamable(v);
+}
+inline Emitter& operator<<(Emitter& emitter, double v) {
+ return emitter.WriteStreamable(v);
+}
+
+inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) {
+ return emitter.SetLocalValue(value);
+}
+
+inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
+ return emitter.SetLocalIndent(indent);
+}
+
+inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
+ return emitter.SetLocalPrecision(precision);
+}
+}
+
+#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterdef.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterdef.h
new file mode 100644
index 0000000000..0b426957fa
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterdef.h
@@ -0,0 +1,16 @@
+#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct EmitterNodeType {
+ enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
+};
+}
+
+#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h
new file mode 100644
index 0000000000..89f7256714
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h
@@ -0,0 +1,137 @@
+#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+namespace YAML {
+enum EMITTER_MANIP {
+ // general manipulators
+ Auto,
+ TagByKind,
+ Newline,
+
+ // output character set
+ EmitNonAscii,
+ EscapeNonAscii,
+
+ // string manipulators
+ // Auto, // duplicate
+ SingleQuoted,
+ DoubleQuoted,
+ Literal,
+
+ // bool manipulators
+ YesNoBool, // yes, no
+ TrueFalseBool, // true, false
+ OnOffBool, // on, off
+ UpperCase, // TRUE, N
+ LowerCase, // f, yes
+ CamelCase, // No, Off
+ LongBool, // yes, On
+ ShortBool, // y, t
+
+ // int manipulators
+ Dec,
+ Hex,
+ Oct,
+
+ // document manipulators
+ BeginDoc,
+ EndDoc,
+
+ // sequence manipulators
+ BeginSeq,
+ EndSeq,
+ Flow,
+ Block,
+
+ // map manipulators
+ BeginMap,
+ EndMap,
+ Key,
+ Value,
+ // Flow, // duplicate
+ // Block, // duplicate
+ // Auto, // duplicate
+ LongKey
+};
+
+struct _Indent {
+ _Indent(int value_) : value(value_) {}
+ int value;
+};
+
+inline _Indent Indent(int value) { return _Indent(value); }
+
+struct _Alias {
+ _Alias(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Alias Alias(const std::string content) { return _Alias(content); }
+
+struct _Anchor {
+ _Anchor(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Anchor Anchor(const std::string content) { return _Anchor(content); }
+
+struct _Tag {
+ struct Type {
+ enum value { Verbatim, PrimaryHandle, NamedHandle };
+ };
+
+ explicit _Tag(const std::string& prefix_, const std::string& content_,
+ Type::value type_)
+ : prefix(prefix_), content(content_), type(type_) {}
+ std::string prefix;
+ std::string content;
+ Type::value type;
+};
+
+inline _Tag VerbatimTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::Verbatim);
+}
+
+inline _Tag LocalTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::PrimaryHandle);
+}
+
+inline _Tag LocalTag(const std::string& prefix, const std::string content) {
+ return _Tag(prefix, content, _Tag::Type::NamedHandle);
+}
+
+inline _Tag SecondaryTag(const std::string content) {
+ return _Tag("", content, _Tag::Type::NamedHandle);
+}
+
+struct _Comment {
+ _Comment(const std::string& content_) : content(content_) {}
+ std::string content;
+};
+
+inline _Comment Comment(const std::string content) { return _Comment(content); }
+
+struct _Precision {
+ _Precision(int floatPrecision_, int doublePrecision_)
+ : floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
+
+ int floatPrecision;
+ int doublePrecision;
+};
+
+inline _Precision FloatPrecision(int n) { return _Precision(n, -1); }
+
+inline _Precision DoublePrecision(int n) { return _Precision(-1, n); }
+
+inline _Precision Precision(int n) { return _Precision(n, n); }
+}
+
+#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterstyle.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterstyle.h
new file mode 100644
index 0000000000..67bb3981b1
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitterstyle.h
@@ -0,0 +1,16 @@
+#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct EmitterStyle {
+ enum value { Default, Block, Flow };
+};
+}
+
+#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h
new file mode 100644
index 0000000000..efe381c621
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h
@@ -0,0 +1,40 @@
+#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+
+namespace YAML {
+struct Mark;
+
+class EventHandler {
+ public:
+ virtual ~EventHandler() {}
+
+ virtual void OnDocumentStart(const Mark& mark) = 0;
+ virtual void OnDocumentEnd() = 0;
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0;
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value) = 0;
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) = 0;
+ virtual void OnSequenceEnd() = 0;
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) = 0;
+ virtual void OnMapEnd() = 0;
+};
+}
+
+#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
new file mode 100644
index 0000000000..eae31968b7
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
@@ -0,0 +1,261 @@
+#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/traits.h"
+#include <sstream>
+#include <stdexcept>
+#include <string>
+
+#define YAML_CPP_NOEXCEPT noexcept
+
+namespace YAML {
+// error messages
+namespace ErrorMsg {
+const char* const YAML_DIRECTIVE_ARGS =
+ "YAML directives must have exactly one argument";
+const char* const YAML_VERSION = "bad YAML version: ";
+const char* const YAML_MAJOR_VERSION = "YAML major version too large";
+const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive";
+const char* const TAG_DIRECTIVE_ARGS =
+ "TAG directives must have exactly two arguments";
+const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive";
+const char* const CHAR_IN_TAG_HANDLE =
+ "illegal character found while scanning tag handle";
+const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix";
+const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found";
+const char* const END_OF_MAP = "end of map not found";
+const char* const END_OF_MAP_FLOW = "end of map flow not found";
+const char* const END_OF_SEQ = "end of sequence not found";
+const char* const END_OF_SEQ_FLOW = "end of sequence flow not found";
+const char* const MULTIPLE_TAGS =
+ "cannot assign multiple tags to the same node";
+const char* const MULTIPLE_ANCHORS =
+ "cannot assign multiple anchors to the same node";
+const char* const MULTIPLE_ALIASES =
+ "cannot assign multiple aliases to the same node";
+const char* const ALIAS_CONTENT =
+ "aliases can't have any content, *including* tags";
+const char* const INVALID_HEX = "bad character found while scanning hex number";
+const char* const INVALID_UNICODE = "invalid unicode: ";
+const char* const INVALID_ESCAPE = "unknown escape character: ";
+const char* const UNKNOWN_TOKEN = "unknown token";
+const char* const DOC_IN_SCALAR = "illegal document indicator in scalar";
+const char* const EOF_IN_SCALAR = "illegal EOF in scalar";
+const char* const CHAR_IN_SCALAR = "illegal character in scalar";
+const char* const TAB_IN_INDENTATION =
+ "illegal tab when looking for indentation";
+const char* const FLOW_END = "illegal flow end";
+const char* const BLOCK_ENTRY = "illegal block entry";
+const char* const MAP_KEY = "illegal map key";
+const char* const MAP_VALUE = "illegal map value";
+const char* const ALIAS_NOT_FOUND = "alias not found after *";
+const char* const ANCHOR_NOT_FOUND = "anchor not found after &";
+const char* const CHAR_IN_ALIAS =
+ "illegal character found while scanning alias";
+const char* const CHAR_IN_ANCHOR =
+ "illegal character found while scanning anchor";
+const char* const ZERO_INDENT_IN_BLOCK =
+ "cannot set zero indentation for a block scalar";
+const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
+const char* const AMBIGUOUS_ANCHOR =
+ "cannot assign the same alias to multiple nodes";
+const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
+
+const char* const INVALID_NODE =
+ "invalid node; this may result from using a map iterator as a sequence "
+ "iterator, or vice-versa";
+const char* const INVALID_SCALAR = "invalid scalar";
+const char* const KEY_NOT_FOUND = "key not found";
+const char* const BAD_CONVERSION = "bad conversion";
+const char* const BAD_DEREFERENCE = "bad dereference";
+const char* const BAD_SUBSCRIPT = "operator[] call on a scalar";
+const char* const BAD_PUSHBACK = "appending to a non-sequence";
+const char* const BAD_INSERT = "inserting in a non-convertible-to-map";
+
+const char* const UNMATCHED_GROUP_TAG = "unmatched group tag";
+const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token";
+const char* const UNEXPECTED_END_MAP = "unexpected end map token";
+const char* const SINGLE_QUOTED_CHAR =
+ "invalid character in single-quoted string";
+const char* const INVALID_ANCHOR = "invalid anchor";
+const char* const INVALID_ALIAS = "invalid alias";
+const char* const INVALID_TAG = "invalid tag";
+const char* const BAD_FILE = "bad file";
+
+template <typename T>
+inline const std::string KEY_NOT_FOUND_WITH_KEY(
+ const T&, typename disable_if<is_numeric<T>>::type* = 0) {
+ return KEY_NOT_FOUND;
+}
+
+inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+}
+
+template <typename T>
+inline const std::string KEY_NOT_FOUND_WITH_KEY(
+ const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+}
+}
+
+class YAML_CPP_API Exception : public std::runtime_error {
+ public:
+ Exception(const Mark& mark_, const std::string& msg_)
+ : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
+ virtual ~Exception() YAML_CPP_NOEXCEPT;
+
+ Exception(const Exception&) = default;
+
+ Mark mark;
+ std::string msg;
+
+ private:
+ static const std::string build_what(const Mark& mark,
+ const std::string& msg) {
+ if (mark.is_null()) {
+ return msg.c_str();
+ }
+
+ std::stringstream output;
+ output << "yaml-cpp: error at line " << mark.line + 1 << ", column "
+ << mark.column + 1 << ": " << msg;
+ return output.str();
+ }
+};
+
+class YAML_CPP_API ParserException : public Exception {
+ public:
+ ParserException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ ParserException(const ParserException&) = default;
+ virtual ~ParserException() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API RepresentationException : public Exception {
+ public:
+ RepresentationException(const Mark& mark_, const std::string& msg_)
+ : Exception(mark_, msg_) {}
+ RepresentationException(const RepresentationException&) = default;
+ virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
+};
+
+// representation exceptions
+class YAML_CPP_API InvalidScalar : public RepresentationException {
+ public:
+ InvalidScalar(const Mark& mark_)
+ : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
+ InvalidScalar(const InvalidScalar&) = default;
+ virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API KeyNotFound : public RepresentationException {
+ public:
+ template <typename T>
+ KeyNotFound(const Mark& mark_, const T& key_)
+ : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
+ }
+ KeyNotFound(const KeyNotFound&) = default;
+ virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
+};
+
+template <typename T>
+class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
+ public:
+ TypedKeyNotFound(const Mark& mark_, const T& key_)
+ : KeyNotFound(mark_, key_), key(key_) {}
+ virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
+
+ T key;
+};
+
+template <typename T>
+inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
+ const T& key) {
+ return TypedKeyNotFound<T>(mark, key);
+}
+
+class YAML_CPP_API InvalidNode : public RepresentationException {
+ public:
+ InvalidNode()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
+ InvalidNode(const InvalidNode&) = default;
+ virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadConversion : public RepresentationException {
+ public:
+ explicit BadConversion(const Mark& mark_)
+ : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
+ BadConversion(const BadConversion&) = default;
+ virtual ~BadConversion() YAML_CPP_NOEXCEPT;
+};
+
+template <typename T>
+class TypedBadConversion : public BadConversion {
+ public:
+ explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
+};
+
+class YAML_CPP_API BadDereference : public RepresentationException {
+ public:
+ BadDereference()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
+ BadDereference(const BadDereference&) = default;
+ virtual ~BadDereference() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadSubscript : public RepresentationException {
+ public:
+ BadSubscript()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
+ BadSubscript(const BadSubscript&) = default;
+ virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadPushback : public RepresentationException {
+ public:
+ BadPushback()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
+ BadPushback(const BadPushback&) = default;
+ virtual ~BadPushback() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadInsert : public RepresentationException {
+ public:
+ BadInsert()
+ : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
+ BadInsert(const BadInsert&) = default;
+ virtual ~BadInsert() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API EmitterException : public Exception {
+ public:
+ EmitterException(const std::string& msg_)
+ : Exception(Mark::null_mark(), msg_) {}
+ EmitterException(const EmitterException&) = default;
+ virtual ~EmitterException() YAML_CPP_NOEXCEPT;
+};
+
+class YAML_CPP_API BadFile : public Exception {
+ public:
+ BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
+ BadFile(const BadFile&) = default;
+ virtual ~BadFile() YAML_CPP_NOEXCEPT;
+};
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/mark.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/mark.h
new file mode 100644
index 0000000000..bf94b4f41f
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/mark.h
@@ -0,0 +1,29 @@
+#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+struct YAML_CPP_API Mark {
+ Mark() : pos(0), line(0), column(0) {}
+
+ static const Mark null_mark() { return Mark(-1, -1, -1); }
+
+ bool is_null() const { return pos == -1 && line == -1 && column == -1; }
+
+ int pos;
+ int line, column;
+
+ private:
+ Mark(int pos_, int line_, int column_)
+ : pos(pos_), line(line_), column(column_) {}
+};
+}
+
+#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h
new file mode 100644
index 0000000000..45a878ab0c
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h
@@ -0,0 +1,331 @@
+#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <array>
+#include <limits>
+#include <list>
+#include <map>
+#include <sstream>
+#include <vector>
+
+#include "yaml-cpp/binary.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+class Binary;
+struct _Null;
+template <typename T>
+struct convert;
+} // namespace YAML
+
+namespace YAML {
+namespace conversion {
+inline bool IsInfinity(const std::string& input) {
+ return input == ".inf" || input == ".Inf" || input == ".INF" ||
+ input == "+.inf" || input == "+.Inf" || input == "+.INF";
+}
+
+inline bool IsNegativeInfinity(const std::string& input) {
+ return input == "-.inf" || input == "-.Inf" || input == "-.INF";
+}
+
+inline bool IsNaN(const std::string& input) {
+ return input == ".nan" || input == ".NaN" || input == ".NAN";
+}
+}
+
+// Node
+template <>
+struct convert<Node> {
+ static Node encode(const Node& rhs) { return rhs; }
+
+ static bool decode(const Node& node, Node& rhs) {
+ rhs.reset(node);
+ return true;
+ }
+};
+
+// std::string
+template <>
+struct convert<std::string> {
+ static Node encode(const std::string& rhs) { return Node(rhs); }
+
+ static bool decode(const Node& node, std::string& rhs) {
+ if (!node.IsScalar())
+ return false;
+ rhs = node.Scalar();
+ return true;
+ }
+};
+
+// C-strings can only be encoded
+template <>
+struct convert<const char*> {
+ static Node encode(const char*& rhs) { return Node(rhs); }
+};
+
+template <std::size_t N>
+struct convert<const char[N]> {
+ static Node encode(const char(&rhs)[N]) { return Node(rhs); }
+};
+
+template <>
+struct convert<_Null> {
+ static Node encode(const _Null& /* rhs */) { return Node(); }
+
+ static bool decode(const Node& node, _Null& /* rhs */) {
+ return node.IsNull();
+ }
+};
+
+#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
+ template <> \
+ struct convert<type> { \
+ static Node encode(const type& rhs) { \
+ std::stringstream stream; \
+ stream.precision(std::numeric_limits<type>::digits10 + 1); \
+ stream << rhs; \
+ return Node(stream.str()); \
+ } \
+ \
+ static bool decode(const Node& node, type& rhs) { \
+ if (node.Type() != NodeType::Scalar) \
+ return false; \
+ const std::string& input = node.Scalar(); \
+ std::stringstream stream(input); \
+ stream.unsetf(std::ios::dec); \
+ if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \
+ return true; \
+ if (std::numeric_limits<type>::has_infinity) { \
+ if (conversion::IsInfinity(input)) { \
+ rhs = std::numeric_limits<type>::infinity(); \
+ return true; \
+ } else if (conversion::IsNegativeInfinity(input)) { \
+ rhs = negative_op std::numeric_limits<type>::infinity(); \
+ return true; \
+ } \
+ } \
+ \
+ if (std::numeric_limits<type>::has_quiet_NaN && \
+ conversion::IsNaN(input)) { \
+ rhs = std::numeric_limits<type>::quiet_NaN(); \
+ return true; \
+ } \
+ \
+ return false; \
+ } \
+ }
+
+#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
+ YAML_DEFINE_CONVERT_STREAMABLE(type, -)
+
+#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \
+ YAML_DEFINE_CONVERT_STREAMABLE(type, +)
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long);
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char);
+YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char);
+
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double);
+YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double);
+
+#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED
+#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED
+#undef YAML_DEFINE_CONVERT_STREAMABLE
+
+// bool
+template <>
+struct convert<bool> {
+ static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); }
+
+ YAML_CPP_API static bool decode(const Node& node, bool& rhs);
+};
+
+// std::map
+template <typename K, typename V>
+struct convert<std::map<K, V>> {
+ static Node encode(const std::map<K, V>& rhs) {
+ Node node(NodeType::Map);
+ for (typename std::map<K, V>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.force_insert(it->first, it->second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::map<K, V>& rhs) {
+ if (!node.IsMap())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[it->first.template as<K>()] = it->second.template as<V>();
+#else
+ rhs[it->first.as<K>()] = it->second.as<V>();
+#endif
+ return true;
+ }
+};
+
+// std::vector
+template <typename T>
+struct convert<std::vector<T>> {
+ static Node encode(const std::vector<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (typename std::vector<T>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.push_back(*it);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::vector<T>& rhs) {
+ if (!node.IsSequence())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.push_back(it->template as<T>());
+#else
+ rhs.push_back(it->as<T>());
+#endif
+ return true;
+ }
+};
+
+// std::list
+template <typename T>
+struct convert<std::list<T>> {
+ static Node encode(const std::list<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (typename std::list<T>::const_iterator it = rhs.begin();
+ it != rhs.end(); ++it)
+ node.push_back(*it);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::list<T>& rhs) {
+ if (!node.IsSequence())
+ return false;
+
+ rhs.clear();
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.push_back(it->template as<T>());
+#else
+ rhs.push_back(it->as<T>());
+#endif
+ return true;
+ }
+};
+
+// std::array
+template <typename T, std::size_t N>
+struct convert<std::array<T, N>> {
+ static Node encode(const std::array<T, N>& rhs) {
+ Node node(NodeType::Sequence);
+ for (const auto& element : rhs) {
+ node.push_back(element);
+ }
+ return node;
+ }
+
+ static bool decode(const Node& node, std::array<T, N>& rhs) {
+ if (!isNodeValid(node)) {
+ return false;
+ }
+
+ for (auto i = 0u; i < node.size(); ++i) {
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[i] = node[i].template as<T>();
+#else
+ rhs[i] = node[i].as<T>();
+#endif
+ }
+ return true;
+ }
+
+ private:
+ static bool isNodeValid(const Node& node) {
+ return node.IsSequence() && node.size() == N;
+ }
+};
+
+// std::pair
+template <typename T, typename U>
+struct convert<std::pair<T, U>> {
+ static Node encode(const std::pair<T, U>& rhs) {
+ Node node(NodeType::Sequence);
+ node.push_back(rhs.first);
+ node.push_back(rhs.second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::pair<T, U>& rhs) {
+ if (!node.IsSequence())
+ return false;
+ if (node.size() != 2)
+ return false;
+
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.first = node[0].template as<T>();
+#else
+ rhs.first = node[0].as<T>();
+#endif
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs.second = node[1].template as<U>();
+#else
+ rhs.second = node[1].as<U>();
+#endif
+ return true;
+ }
+};
+
+// binary
+template <>
+struct convert<Binary> {
+ static Node encode(const Binary& rhs) {
+ return Node(EncodeBase64(rhs.data(), rhs.size()));
+ }
+
+ static bool decode(const Node& node, Binary& rhs) {
+ if (!node.IsScalar())
+ return false;
+
+ std::vector<unsigned char> data = DecodeBase64(node.Scalar());
+ if (data.empty() && !node.Scalar().empty())
+ return false;
+
+ rhs.swap(data);
+ return true;
+ }
+};
+}
+
+#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h
new file mode 100644
index 0000000000..2c80705c9a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h
@@ -0,0 +1,26 @@
+#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+namespace detail {
+struct unspecified_bool {
+ struct NOT_ALLOWED;
+ static void true_value(NOT_ALLOWED*) {}
+};
+typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
+}
+}
+
+#define YAML_CPP_OPERATOR_BOOL() \
+ operator YAML::detail::unspecified_bool_type() const { \
+ return this->operator!() ? 0 \
+ : &YAML::detail::unspecified_bool::true_value; \
+ }
+
+#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h
new file mode 100644
index 0000000000..09e55f838c
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h
@@ -0,0 +1,185 @@
+#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/detail/node_data.h"
+#include <type_traits>
+
+namespace YAML {
+namespace detail {
+template <typename Key, typename Enable = void>
+struct get_idx {
+ static node* get(const std::vector<node*>& /* sequence */,
+ const Key& /* key */, shared_memory_holder /* pMemory */) {
+ return 0;
+ }
+};
+
+template <typename Key>
+struct get_idx<Key,
+ typename std::enable_if<std::is_unsigned<Key>::value &&
+ !std::is_same<Key, bool>::value>::type> {
+ static node* get(const std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder /* pMemory */) {
+ return key < sequence.size() ? sequence[key] : 0;
+ }
+
+ static node* get(std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
+ return 0;
+ if (key == sequence.size())
+ sequence.push_back(&pMemory->create_node());
+ return sequence[key];
+ }
+};
+
+template <typename Key>
+struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
+ static node* get(const std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ return key >= 0 ? get_idx<std::size_t>::get(
+ sequence, static_cast<std::size_t>(key), pMemory)
+ : 0;
+ }
+ static node* get(std::vector<node*>& sequence, const Key& key,
+ shared_memory_holder pMemory) {
+ return key >= 0 ? get_idx<std::size_t>::get(
+ sequence, static_cast<std::size_t>(key), pMemory)
+ : 0;
+ }
+};
+
+template <typename T>
+inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
+ T lhs;
+ if (convert<T>::decode(Node(*this, pMemory), lhs)) {
+ return lhs == rhs;
+ }
+ return false;
+}
+
+inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
+ return equals<std::string>(rhs, pMemory);
+}
+
+// indexing
+template <typename Key>
+inline node* node_data::get(const Key& key,
+ shared_memory_holder pMemory) const {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ return NULL;
+ case NodeType::Sequence:
+ if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory))
+ return pNode;
+ return NULL;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ return it->second;
+ }
+ }
+
+ return NULL;
+}
+
+template <typename Key>
+inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory)) {
+ m_type = NodeType::Sequence;
+ return *pNode;
+ }
+
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ return *it->second;
+ }
+ }
+
+ node& k = convert_to_node(key, pMemory);
+ node& v = pMemory->create_node();
+ insert_map_pair(k, v);
+ return v;
+}
+
+template <typename Key>
+inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
+ if (m_type != NodeType::Map)
+ return false;
+
+ for (kv_pairs::iterator it = m_undefinedPairs.begin();
+ it != m_undefinedPairs.end();) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->equals(key, pMemory))
+ m_undefinedPairs.erase(it);
+ it = jt;
+ }
+
+ for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->equals(key, pMemory)) {
+ m_map.erase(it);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// map
+template <typename Key, typename Value>
+inline void node_data::force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadInsert();
+ }
+
+ node& k = convert_to_node(key, pMemory);
+ node& v = convert_to_node(value, pMemory);
+ insert_map_pair(k, v);
+}
+
+template <typename T>
+inline node& node_data::convert_to_node(const T& rhs,
+ shared_memory_holder pMemory) {
+ Node value = convert<T>::encode(rhs);
+ value.EnsureNodeExists();
+ pMemory->merge(*value.m_pMemory);
+ return *value.m_pNode;
+}
+}
+}
+
+#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
new file mode 100644
index 0000000000..deec8fb62c
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
@@ -0,0 +1,92 @@
+#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include <cstddef>
+#include <iterator>
+
+namespace YAML {
+namespace detail {
+struct iterator_value;
+
+template <typename V>
+class iterator_base : public std::iterator<std::forward_iterator_tag, V,
+ std::ptrdiff_t, V*, V> {
+
+ private:
+ template <typename>
+ friend class iterator_base;
+ struct enabler {};
+ typedef node_iterator base_type;
+
+ struct proxy {
+ explicit proxy(const V& x) : m_ref(x) {}
+ V* operator->() { return std::addressof(m_ref); }
+ operator V*() { return std::addressof(m_ref); }
+
+ V m_ref;
+ };
+
+ public:
+ typedef typename iterator_base::value_type value_type;
+
+ public:
+ iterator_base() : m_iterator(), m_pMemory() {}
+ explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
+ : m_iterator(rhs), m_pMemory(pMemory) {}
+
+ template <class W>
+ iterator_base(const iterator_base<W>& rhs,
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
+ : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
+
+ iterator_base<V>& operator++() {
+ ++m_iterator;
+ return *this;
+ }
+
+ iterator_base<V> operator++(int) {
+ iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ template <typename W>
+ bool operator==(const iterator_base<W>& rhs) const {
+ return m_iterator == rhs.m_iterator;
+ }
+
+ template <typename W>
+ bool operator!=(const iterator_base<W>& rhs) const {
+ return m_iterator != rhs.m_iterator;
+ }
+
+ value_type operator*() const {
+ const typename base_type::value_type& v = *m_iterator;
+ if (v.pNode)
+ return value_type(Node(*v, m_pMemory));
+ if (v.first && v.second)
+ return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory));
+ return value_type();
+ }
+
+ proxy operator->() const { return proxy(**this); }
+
+ private:
+ base_type m_iterator;
+ shared_memory_holder m_pMemory;
+};
+}
+}
+
+#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h
new file mode 100644
index 0000000000..5f1ffe7436
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h
@@ -0,0 +1,27 @@
+#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <list>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+
+namespace detail {
+struct iterator_value;
+template <typename V>
+class iterator_base;
+}
+
+typedef detail::iterator_base<detail::iterator_value> iterator;
+typedef detail::iterator_base<const detail::iterator_value> const_iterator;
+}
+
+#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h
new file mode 100644
index 0000000000..8f2bc2657a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h
@@ -0,0 +1,46 @@
+#ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <set>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+namespace detail {
+class YAML_CPP_API memory {
+ public:
+ node& create_node();
+ void merge(const memory& rhs);
+
+ private:
+ typedef std::set<shared_node> Nodes;
+ Nodes m_nodes;
+};
+
+class YAML_CPP_API memory_holder {
+ public:
+ memory_holder() : m_pMemory(new memory) {}
+
+ node& create_node() { return m_pMemory->create_node(); }
+ void merge(memory_holder& rhs);
+
+ private:
+ shared_memory m_pMemory;
+};
+}
+}
+
+#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h
new file mode 100644
index 0000000000..8a776f62a9
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h
@@ -0,0 +1,169 @@
+#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_ref.h"
+#include <set>
+
+namespace YAML {
+namespace detail {
+class node {
+ public:
+ node() : m_pRef(new node_ref) {}
+ node(const node&) = delete;
+ node& operator=(const node&) = delete;
+
+ bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
+ const node_ref* ref() const { return m_pRef.get(); }
+
+ bool is_defined() const { return m_pRef->is_defined(); }
+ const Mark& mark() const { return m_pRef->mark(); }
+ NodeType::value type() const { return m_pRef->type(); }
+
+ const std::string& scalar() const { return m_pRef->scalar(); }
+ const std::string& tag() const { return m_pRef->tag(); }
+ EmitterStyle::value style() const { return m_pRef->style(); }
+
+ template <typename T>
+ bool equals(const T& rhs, shared_memory_holder pMemory);
+ bool equals(const char* rhs, shared_memory_holder pMemory);
+
+ void mark_defined() {
+ if (is_defined())
+ return;
+
+ m_pRef->mark_defined();
+ for (nodes::iterator it = m_dependencies.begin();
+ it != m_dependencies.end(); ++it)
+ (*it)->mark_defined();
+ m_dependencies.clear();
+ }
+
+ void add_dependency(node& rhs) {
+ if (is_defined())
+ rhs.mark_defined();
+ else
+ m_dependencies.insert(&rhs);
+ }
+
+ void set_ref(const node& rhs) {
+ if (rhs.is_defined())
+ mark_defined();
+ m_pRef = rhs.m_pRef;
+ }
+ void set_data(const node& rhs) {
+ if (rhs.is_defined())
+ mark_defined();
+ m_pRef->set_data(*rhs.m_pRef);
+ }
+
+ void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
+
+ void set_type(NodeType::value type) {
+ if (type != NodeType::Undefined)
+ mark_defined();
+ m_pRef->set_type(type);
+ }
+ void set_null() {
+ mark_defined();
+ m_pRef->set_null();
+ }
+ void set_scalar(const std::string& scalar) {
+ mark_defined();
+ m_pRef->set_scalar(scalar);
+ }
+ void set_tag(const std::string& tag) {
+ mark_defined();
+ m_pRef->set_tag(tag);
+ }
+
+ // style
+ void set_style(EmitterStyle::value style) {
+ mark_defined();
+ m_pRef->set_style(style);
+ }
+
+ // size/iterator
+ std::size_t size() const { return m_pRef->size(); }
+
+ const_node_iterator begin() const {
+ return static_cast<const node_ref&>(*m_pRef).begin();
+ }
+ node_iterator begin() { return m_pRef->begin(); }
+
+ const_node_iterator end() const {
+ return static_cast<const node_ref&>(*m_pRef).end();
+ }
+ node_iterator end() { return m_pRef->end(); }
+
+ // sequence
+ void push_back(node& input, shared_memory_holder pMemory) {
+ m_pRef->push_back(input, pMemory);
+ input.add_dependency(*this);
+ }
+ void insert(node& key, node& value, shared_memory_holder pMemory) {
+ m_pRef->insert(key, value, pMemory);
+ key.add_dependency(*this);
+ value.add_dependency(*this);
+ }
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const {
+ // NOTE: this returns a non-const node so that the top-level Node can wrap
+ // it, and returns a pointer so that it can be NULL (if there is no such
+ // key).
+ return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
+ }
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory) {
+ node& value = m_pRef->get(key, pMemory);
+ value.add_dependency(*this);
+ return value;
+ }
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory) {
+ return m_pRef->remove(key, pMemory);
+ }
+
+ node* get(node& key, shared_memory_holder pMemory) const {
+ // NOTE: this returns a non-const node so that the top-level Node can wrap
+ // it, and returns a pointer so that it can be NULL (if there is no such
+ // key).
+ return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
+ }
+ node& get(node& key, shared_memory_holder pMemory) {
+ node& value = m_pRef->get(key, pMemory);
+ key.add_dependency(*this);
+ value.add_dependency(*this);
+ return value;
+ }
+ bool remove(node& key, shared_memory_holder pMemory) {
+ return m_pRef->remove(key, pMemory);
+ }
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ m_pRef->force_insert(key, value, pMemory);
+ }
+
+ private:
+ shared_node_ref m_pRef;
+ typedef std::set<node*> nodes;
+ nodes m_dependencies;
+};
+}
+}
+
+#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
new file mode 100644
index 0000000000..50bcd74352
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
@@ -0,0 +1,127 @@
+#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <list>
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+namespace detail {
+class YAML_CPP_API node_data {
+ public:
+ node_data();
+ node_data(const node_data&) = delete;
+ node_data& operator=(const node_data&) = delete;
+
+ void mark_defined();
+ void set_mark(const Mark& mark);
+ void set_type(NodeType::value type);
+ void set_tag(const std::string& tag);
+ void set_null();
+ void set_scalar(const std::string& scalar);
+ void set_style(EmitterStyle::value style);
+
+ bool is_defined() const { return m_isDefined; }
+ const Mark& mark() const { return m_mark; }
+ NodeType::value type() const {
+ return m_isDefined ? m_type : NodeType::Undefined;
+ }
+ const std::string& scalar() const { return m_scalar; }
+ const std::string& tag() const { return m_tag; }
+ EmitterStyle::value style() const { return m_style; }
+
+ // size/iterator
+ std::size_t size() const;
+
+ const_node_iterator begin() const;
+ node_iterator begin();
+
+ const_node_iterator end() const;
+ node_iterator end();
+
+ // sequence
+ void push_back(node& node, shared_memory_holder pMemory);
+ void insert(node& key, node& value, shared_memory_holder pMemory);
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const;
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory);
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory);
+
+ node* get(node& key, shared_memory_holder pMemory) const;
+ node& get(node& key, shared_memory_holder pMemory);
+ bool remove(node& key, shared_memory_holder pMemory);
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory);
+
+ public:
+ static std::string empty_scalar;
+
+ private:
+ void compute_seq_size() const;
+ void compute_map_size() const;
+
+ void reset_sequence();
+ void reset_map();
+
+ void insert_map_pair(node& key, node& value);
+ void convert_to_map(shared_memory_holder pMemory);
+ void convert_sequence_to_map(shared_memory_holder pMemory);
+
+ template <typename T>
+ static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
+
+ private:
+ bool m_isDefined;
+ Mark m_mark;
+ NodeType::value m_type;
+ std::string m_tag;
+ EmitterStyle::value m_style;
+
+ // scalar
+ std::string m_scalar;
+
+ // sequence
+ typedef std::vector<node*> node_seq;
+ node_seq m_sequence;
+
+ mutable std::size_t m_seqSize;
+
+ // map
+ typedef std::vector<std::pair<node*, node*>> node_map;
+ node_map m_map;
+
+ typedef std::pair<node*, node*> kv_pair;
+ typedef std::list<kv_pair> kv_pairs;
+ mutable kv_pairs m_undefinedPairs;
+};
+}
+}
+
+#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
new file mode 100644
index 0000000000..088090fe74
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
@@ -0,0 +1,180 @@
+#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/ptr.h"
+#include <cstddef>
+#include <iterator>
+#include <memory>
+#include <map>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+namespace detail {
+struct iterator_type {
+ enum value { NoneType, Sequence, Map };
+};
+
+template <typename V>
+struct node_iterator_value : public std::pair<V*, V*> {
+ typedef std::pair<V*, V*> kv;
+
+ node_iterator_value() : kv(), pNode(0) {}
+ explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
+ explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {}
+
+ V& operator*() const { return *pNode; }
+ V& operator->() const { return *pNode; }
+
+ V* pNode;
+};
+
+typedef std::vector<node*> node_seq;
+typedef std::vector<std::pair<node*, node*>> node_map;
+
+template <typename V>
+struct node_iterator_type {
+ typedef node_seq::iterator seq;
+ typedef node_map::iterator map;
+};
+
+template <typename V>
+struct node_iterator_type<const V> {
+ typedef node_seq::const_iterator seq;
+ typedef node_map::const_iterator map;
+};
+
+template <typename V>
+class node_iterator_base
+ : public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
+ std::ptrdiff_t, node_iterator_value<V>*,
+ node_iterator_value<V>> {
+ private:
+ struct enabler {};
+
+ struct proxy {
+ explicit proxy(const node_iterator_value<V>& x) : m_ref(x) {}
+ node_iterator_value<V>* operator->() { return std::addressof(m_ref); }
+ operator node_iterator_value<V>*() { return std::addressof(m_ref); }
+
+ node_iterator_value<V> m_ref;
+ };
+
+ public:
+ typedef typename node_iterator_type<V>::seq SeqIter;
+ typedef typename node_iterator_type<V>::map MapIter;
+ typedef node_iterator_value<V> value_type;
+
+ node_iterator_base()
+ : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
+ explicit node_iterator_base(SeqIter seqIt)
+ : m_type(iterator_type::Sequence),
+ m_seqIt(seqIt),
+ m_mapIt(),
+ m_mapEnd() {}
+ explicit node_iterator_base(MapIter mapIt, MapIter mapEnd)
+ : m_type(iterator_type::Map),
+ m_seqIt(),
+ m_mapIt(mapIt),
+ m_mapEnd(mapEnd) {
+ m_mapIt = increment_until_defined(m_mapIt);
+ }
+
+ template <typename W>
+ node_iterator_base(const node_iterator_base<W>& rhs,
+ typename std::enable_if<std::is_convertible<W*, V*>::value,
+ enabler>::type = enabler())
+ : m_type(rhs.m_type),
+ m_seqIt(rhs.m_seqIt),
+ m_mapIt(rhs.m_mapIt),
+ m_mapEnd(rhs.m_mapEnd) {}
+
+ template <typename>
+ friend class node_iterator_base;
+
+ template <typename W>
+ bool operator==(const node_iterator_base<W>& rhs) const {
+ if (m_type != rhs.m_type)
+ return false;
+
+ switch (m_type) {
+ case iterator_type::NoneType:
+ return true;
+ case iterator_type::Sequence:
+ return m_seqIt == rhs.m_seqIt;
+ case iterator_type::Map:
+ return m_mapIt == rhs.m_mapIt;
+ }
+ return true;
+ }
+
+ template <typename W>
+ bool operator!=(const node_iterator_base<W>& rhs) const {
+ return !(*this == rhs);
+ }
+
+ node_iterator_base<V>& operator++() {
+ switch (m_type) {
+ case iterator_type::NoneType:
+ break;
+ case iterator_type::Sequence:
+ ++m_seqIt;
+ break;
+ case iterator_type::Map:
+ ++m_mapIt;
+ m_mapIt = increment_until_defined(m_mapIt);
+ break;
+ }
+ return *this;
+ }
+
+ node_iterator_base<V> operator++(int) {
+ node_iterator_base<V> iterator_pre(*this);
+ ++(*this);
+ return iterator_pre;
+ }
+
+ value_type operator*() const {
+ switch (m_type) {
+ case iterator_type::NoneType:
+ return value_type();
+ case iterator_type::Sequence:
+ return value_type(**m_seqIt);
+ case iterator_type::Map:
+ return value_type(*m_mapIt->first, *m_mapIt->second);
+ }
+ return value_type();
+ }
+
+ proxy operator->() const { return proxy(**this); }
+
+ MapIter increment_until_defined(MapIter it) {
+ while (it != m_mapEnd && !is_defined(it))
+ ++it;
+ return it;
+ }
+
+ bool is_defined(MapIter it) const {
+ return it->first->is_defined() && it->second->is_defined();
+ }
+
+ private:
+ typename iterator_type::value m_type;
+
+ SeqIter m_seqIt;
+ MapIter m_mapIt, m_mapEnd;
+};
+
+typedef node_iterator_base<node> node_iterator;
+typedef node_iterator_base<const node> const_node_iterator;
+}
+}
+
+#endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
new file mode 100644
index 0000000000..d8a94f8b80
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_ref.h
@@ -0,0 +1,98 @@
+#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/type.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/detail/node_data.h"
+
+namespace YAML {
+namespace detail {
+class node_ref {
+ public:
+ node_ref() : m_pData(new node_data) {}
+ node_ref(const node_ref&) = delete;
+ node_ref& operator=(const node_ref&) = delete;
+
+ bool is_defined() const { return m_pData->is_defined(); }
+ const Mark& mark() const { return m_pData->mark(); }
+ NodeType::value type() const { return m_pData->type(); }
+ const std::string& scalar() const { return m_pData->scalar(); }
+ const std::string& tag() const { return m_pData->tag(); }
+ EmitterStyle::value style() const { return m_pData->style(); }
+
+ void mark_defined() { m_pData->mark_defined(); }
+ void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }
+
+ void set_mark(const Mark& mark) { m_pData->set_mark(mark); }
+ void set_type(NodeType::value type) { m_pData->set_type(type); }
+ void set_tag(const std::string& tag) { m_pData->set_tag(tag); }
+ void set_null() { m_pData->set_null(); }
+ void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); }
+ void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
+
+ // size/iterator
+ std::size_t size() const { return m_pData->size(); }
+
+ const_node_iterator begin() const {
+ return static_cast<const node_data&>(*m_pData).begin();
+ }
+ node_iterator begin() { return m_pData->begin(); }
+
+ const_node_iterator end() const {
+ return static_cast<const node_data&>(*m_pData).end();
+ }
+ node_iterator end() { return m_pData->end(); }
+
+ // sequence
+ void push_back(node& node, shared_memory_holder pMemory) {
+ m_pData->push_back(node, pMemory);
+ }
+ void insert(node& key, node& value, shared_memory_holder pMemory) {
+ m_pData->insert(key, value, pMemory);
+ }
+
+ // indexing
+ template <typename Key>
+ node* get(const Key& key, shared_memory_holder pMemory) const {
+ return static_cast<const node_data&>(*m_pData).get(key, pMemory);
+ }
+ template <typename Key>
+ node& get(const Key& key, shared_memory_holder pMemory) {
+ return m_pData->get(key, pMemory);
+ }
+ template <typename Key>
+ bool remove(const Key& key, shared_memory_holder pMemory) {
+ return m_pData->remove(key, pMemory);
+ }
+
+ node* get(node& key, shared_memory_holder pMemory) const {
+ return static_cast<const node_data&>(*m_pData).get(key, pMemory);
+ }
+ node& get(node& key, shared_memory_holder pMemory) {
+ return m_pData->get(key, pMemory);
+ }
+ bool remove(node& key, shared_memory_holder pMemory) {
+ return m_pData->remove(key, pMemory);
+ }
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value,
+ shared_memory_holder pMemory) {
+ m_pData->force_insert(key, value, pMemory);
+ }
+
+ private:
+ shared_node_data m_pData;
+};
+}
+}
+
+#endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/emit.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/emit.h
new file mode 100644
index 0000000000..032268c5d0
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/emit.h
@@ -0,0 +1,32 @@
+#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <iosfwd>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Emitter;
+class Node;
+
+/**
+ * Emits the node to the given {@link Emitter}. If there is an error in writing,
+ * {@link Emitter#good} will return false.
+ */
+YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node);
+
+/** Emits the node to the given output stream. */
+YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
+
+/** Converts the node to a YAML string. */
+YAML_CPP_API std::string Dump(const Node& node);
+} // namespace YAML
+
+#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h
new file mode 100644
index 0000000000..20c487a687
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h
@@ -0,0 +1,448 @@
+#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/exceptions.h"
+#include <string>
+
+namespace YAML {
+inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
+
+inline Node::Node(NodeType::value type)
+ : m_isValid(true),
+ m_pMemory(new detail::memory_holder),
+ m_pNode(&m_pMemory->create_node()) {
+ m_pNode->set_type(type);
+}
+
+template <typename T>
+inline Node::Node(const T& rhs)
+ : m_isValid(true),
+ m_pMemory(new detail::memory_holder),
+ m_pNode(&m_pMemory->create_node()) {
+ Assign(rhs);
+}
+
+inline Node::Node(const detail::iterator_value& rhs)
+ : m_isValid(rhs.m_isValid),
+ m_pMemory(rhs.m_pMemory),
+ m_pNode(rhs.m_pNode) {}
+
+inline Node::Node(const Node& rhs)
+ : m_isValid(rhs.m_isValid),
+ m_pMemory(rhs.m_pMemory),
+ m_pNode(rhs.m_pNode) {}
+
+inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {}
+
+inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
+ : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}
+
+inline Node::~Node() {}
+
+inline void Node::EnsureNodeExists() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ if (!m_pNode) {
+ m_pMemory.reset(new detail::memory_holder);
+ m_pNode = &m_pMemory->create_node();
+ m_pNode->set_null();
+ }
+}
+
+inline bool Node::IsDefined() const {
+ if (!m_isValid) {
+ return false;
+ }
+ return m_pNode ? m_pNode->is_defined() : true;
+}
+
+inline Mark Node::Mark() const {
+ if (!m_isValid) {
+ throw InvalidNode();
+ }
+ return m_pNode ? m_pNode->mark() : Mark::null_mark();
+}
+
+inline NodeType::value Node::Type() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->type() : NodeType::Null;
+}
+
+// access
+
+// template helpers
+template <typename T, typename S>
+struct as_if {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ T operator()(const S& fallback) const {
+ if (!node.m_pNode)
+ return fallback;
+
+ T t;
+ if (convert<T>::decode(node, t))
+ return t;
+ return fallback;
+ }
+};
+
+template <typename S>
+struct as_if<std::string, S> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ std::string operator()(const S& fallback) const {
+ if (node.Type() != NodeType::Scalar)
+ return fallback;
+ return node.Scalar();
+ }
+};
+
+template <typename T>
+struct as_if<T, void> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ T operator()() const {
+ if (!node.m_pNode)
+ throw TypedBadConversion<T>(node.Mark());
+
+ T t;
+ if (convert<T>::decode(node, t))
+ return t;
+ throw TypedBadConversion<T>(node.Mark());
+ }
+};
+
+template <>
+struct as_if<std::string, void> {
+ explicit as_if(const Node& node_) : node(node_) {}
+ const Node& node;
+
+ std::string operator()() const {
+ if (node.Type() != NodeType::Scalar)
+ throw TypedBadConversion<std::string>(node.Mark());
+ return node.Scalar();
+ }
+};
+
+// access functions
+template <typename T>
+inline T Node::as() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return as_if<T, void>(*this)();
+}
+
+template <typename T, typename S>
+inline T Node::as(const S& fallback) const {
+ if (!m_isValid)
+ return fallback;
+ return as_if<T, S>(*this)(fallback);
+}
+
+inline const std::string& Node::Scalar() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
+}
+
+inline const std::string& Node::Tag() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
+}
+
+inline void Node::SetTag(const std::string& tag) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_tag(tag);
+}
+
+inline EmitterStyle::value Node::Style() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->style() : EmitterStyle::Default;
+}
+
+inline void Node::SetStyle(EmitterStyle::value style) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_style(style);
+}
+
+// assignment
+inline bool Node::is(const Node& rhs) const {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ if (!m_pNode || !rhs.m_pNode)
+ return false;
+ return m_pNode->is(*rhs.m_pNode);
+}
+
+template <typename T>
+inline Node& Node::operator=(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ Assign(rhs);
+ return *this;
+}
+
+inline void Node::reset(const YAML::Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ m_pMemory = rhs.m_pMemory;
+ m_pNode = rhs.m_pNode;
+}
+
+template <typename T>
+inline void Node::Assign(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ AssignData(convert<T>::encode(rhs));
+}
+
+template <>
+inline void Node::Assign(const std::string& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline void Node::Assign(const char* rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline void Node::Assign(char* rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->set_scalar(rhs);
+}
+
+inline Node& Node::operator=(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ if (is(rhs))
+ return *this;
+ AssignNode(rhs);
+ return *this;
+}
+
+inline void Node::AssignData(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ rhs.EnsureNodeExists();
+
+ m_pNode->set_data(*rhs.m_pNode);
+ m_pMemory->merge(*rhs.m_pMemory);
+}
+
+inline void Node::AssignNode(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ rhs.EnsureNodeExists();
+
+ if (!m_pNode) {
+ m_pNode = rhs.m_pNode;
+ m_pMemory = rhs.m_pMemory;
+ return;
+ }
+
+ m_pNode->set_ref(*rhs.m_pNode);
+ m_pMemory->merge(*rhs.m_pMemory);
+ m_pNode = rhs.m_pNode;
+}
+
+// size/iterator
+inline std::size_t Node::size() const {
+ if (!m_isValid)
+ throw InvalidNode();
+ return m_pNode ? m_pNode->size() : 0;
+}
+
+inline const_iterator Node::begin() const {
+ if (!m_isValid)
+ return const_iterator();
+ return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory)
+ : const_iterator();
+}
+
+inline iterator Node::begin() {
+ if (!m_isValid)
+ return iterator();
+ return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
+}
+
+inline const_iterator Node::end() const {
+ if (!m_isValid)
+ return const_iterator();
+ return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
+}
+
+inline iterator Node::end() {
+ if (!m_isValid)
+ return iterator();
+ return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
+}
+
+// sequence
+template <typename T>
+inline void Node::push_back(const T& rhs) {
+ if (!m_isValid)
+ throw InvalidNode();
+ push_back(Node(rhs));
+}
+
+inline void Node::push_back(const Node& rhs) {
+ if (!m_isValid || !rhs.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ rhs.EnsureNodeExists();
+
+ m_pNode->push_back(*rhs.m_pNode, m_pMemory);
+ m_pMemory->merge(*rhs.m_pMemory);
+}
+
+// helpers for indexing
+namespace detail {
+template <typename T>
+struct to_value_t {
+ explicit to_value_t(const T& t_) : t(t_) {}
+ const T& t;
+ typedef const T& return_type;
+
+ const T& operator()() const { return t; }
+};
+
+template <>
+struct to_value_t<const char*> {
+ explicit to_value_t(const char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+template <>
+struct to_value_t<char*> {
+ explicit to_value_t(char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+template <std::size_t N>
+struct to_value_t<char[N]> {
+ explicit to_value_t(const char* t_) : t(t_) {}
+ const char* t;
+ typedef std::string return_type;
+
+ const std::string operator()() const { return t; }
+};
+
+// converts C-strings to std::strings so they can be copied
+template <typename T>
+inline typename to_value_t<T>::return_type to_value(const T& t) {
+ return to_value_t<T>(t)();
+}
+}
+
+// indexing
+template <typename Key>
+inline const Node Node::operator[](const Key& key) const {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ detail::node* value = static_cast<const detail::node&>(*m_pNode)
+ .get(detail::to_value(key), m_pMemory);
+ if (!value) {
+ return Node(ZombieNode);
+ }
+ return Node(*value, m_pMemory);
+}
+
+template <typename Key>
+inline Node Node::operator[](const Key& key) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
+ return Node(value, m_pMemory);
+}
+
+template <typename Key>
+inline bool Node::remove(const Key& key) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ return m_pNode->remove(detail::to_value(key), m_pMemory);
+}
+
+inline const Node Node::operator[](const Node& key) const {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ m_pMemory->merge(*key.m_pMemory);
+ detail::node* value =
+ static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
+ if (!value) {
+ return Node(ZombieNode);
+ }
+ return Node(*value, m_pMemory);
+}
+
+inline Node Node::operator[](const Node& key) {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ m_pMemory->merge(*key.m_pMemory);
+ detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
+ return Node(value, m_pMemory);
+}
+
+inline bool Node::remove(const Node& key) {
+ if (!m_isValid || !key.m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ key.EnsureNodeExists();
+ return m_pNode->remove(*key.m_pNode, m_pMemory);
+}
+
+// map
+template <typename Key, typename Value>
+inline void Node::force_insert(const Key& key, const Value& value) {
+ if (!m_isValid)
+ throw InvalidNode();
+ EnsureNodeExists();
+ m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
+ m_pMemory);
+}
+
+// free functions
+inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
+}
+
+#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h
new file mode 100644
index 0000000000..366a9c807f
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h
@@ -0,0 +1,31 @@
+#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/detail/iterator_fwd.h"
+#include "yaml-cpp/node/detail/iterator.h"
+#include <list>
+#include <utility>
+#include <vector>
+
+namespace YAML {
+namespace detail {
+struct iterator_value : public Node, std::pair<Node, Node> {
+ iterator_value() {}
+ explicit iterator_value(const Node& rhs)
+ : Node(rhs),
+ std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
+ explicit iterator_value(const Node& key, const Node& value)
+ : Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
+};
+}
+}
+
+#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h
new file mode 100644
index 0000000000..1ded7d27b7
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h
@@ -0,0 +1,145 @@
+#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stdexcept>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/node/detail/bool_type.h"
+#include "yaml-cpp/node/detail/iterator_fwd.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+class node;
+class node_data;
+struct iterator_value;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+class YAML_CPP_API Node {
+ public:
+ friend class NodeBuilder;
+ friend class NodeEvents;
+ friend struct detail::iterator_value;
+ friend class detail::node;
+ friend class detail::node_data;
+ template <typename>
+ friend class detail::iterator_base;
+ template <typename T, typename S>
+ friend struct as_if;
+
+ typedef YAML::iterator iterator;
+ typedef YAML::const_iterator const_iterator;
+
+ Node();
+ explicit Node(NodeType::value type);
+ template <typename T>
+ explicit Node(const T& rhs);
+ explicit Node(const detail::iterator_value& rhs);
+ Node(const Node& rhs);
+ ~Node();
+
+ YAML::Mark Mark() const;
+ NodeType::value Type() const;
+ bool IsDefined() const;
+ bool IsNull() const { return Type() == NodeType::Null; }
+ bool IsScalar() const { return Type() == NodeType::Scalar; }
+ bool IsSequence() const { return Type() == NodeType::Sequence; }
+ bool IsMap() const { return Type() == NodeType::Map; }
+
+ // bool conversions
+ YAML_CPP_OPERATOR_BOOL()
+ bool operator!() const { return !IsDefined(); }
+
+ // access
+ template <typename T>
+ T as() const;
+ template <typename T, typename S>
+ T as(const S& fallback) const;
+ const std::string& Scalar() const;
+
+ const std::string& Tag() const;
+ void SetTag(const std::string& tag);
+
+ // style
+ // WARNING: This API might change in future releases.
+ EmitterStyle::value Style() const;
+ void SetStyle(EmitterStyle::value style);
+
+ // assignment
+ bool is(const Node& rhs) const;
+ template <typename T>
+ Node& operator=(const T& rhs);
+ Node& operator=(const Node& rhs);
+ void reset(const Node& rhs = Node());
+
+ // size/iterator
+ std::size_t size() const;
+
+ const_iterator begin() const;
+ iterator begin();
+
+ const_iterator end() const;
+ iterator end();
+
+ // sequence
+ template <typename T>
+ void push_back(const T& rhs);
+ void push_back(const Node& rhs);
+
+ // indexing
+ template <typename Key>
+ const Node operator[](const Key& key) const;
+ template <typename Key>
+ Node operator[](const Key& key);
+ template <typename Key>
+ bool remove(const Key& key);
+
+ const Node operator[](const Node& key) const;
+ Node operator[](const Node& key);
+ bool remove(const Node& key);
+
+ // map
+ template <typename Key, typename Value>
+ void force_insert(const Key& key, const Value& value);
+
+ private:
+ enum Zombie { ZombieNode };
+ explicit Node(Zombie);
+ explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
+
+ void EnsureNodeExists() const;
+
+ template <typename T>
+ void Assign(const T& rhs);
+ void Assign(const char* rhs);
+ void Assign(char* rhs);
+
+ void AssignData(const Node& rhs);
+ void AssignNode(const Node& rhs);
+
+ private:
+ bool m_isValid;
+ mutable detail::shared_memory_holder m_pMemory;
+ mutable detail::node* m_pNode;
+};
+
+YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs);
+
+YAML_CPP_API Node Clone(const Node& node);
+
+template <typename T>
+struct convert;
+}
+
+#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/parse.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/parse.h
new file mode 100644
index 0000000000..7745fd7245
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/parse.h
@@ -0,0 +1,78 @@
+#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Node;
+
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(const std::string& input);
+
+/**
+ * Loads the input string as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(const char* input);
+
+/**
+ * Loads the input stream as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API Node Load(std::istream& input);
+
+/**
+ * Loads the input file as a single YAML document.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
+YAML_CPP_API Node LoadFile(const std::string& filename);
+
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(const std::string& input);
+
+/**
+ * Loads the input string as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(const char* input);
+
+/**
+ * Loads the input stream as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ */
+YAML_CPP_API std::vector<Node> LoadAll(std::istream& input);
+
+/**
+ * Loads the input file as a list of YAML documents.
+ *
+ * @throws {@link ParserException} if it is malformed.
+ * @throws {@link BadFile} if the file cannot be loaded.
+ */
+YAML_CPP_API std::vector<Node> LoadAllFromFile(const std::string& filename);
+} // namespace YAML
+
+#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h
new file mode 100644
index 0000000000..ce085dd5cd
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h
@@ -0,0 +1,29 @@
+#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <memory>
+
+namespace YAML {
+namespace detail {
+class node;
+class node_ref;
+class node_data;
+class memory;
+class memory_holder;
+
+typedef std::shared_ptr<node> shared_node;
+typedef std::shared_ptr<node_ref> shared_node_ref;
+typedef std::shared_ptr<node_data> shared_node_data;
+typedef std::shared_ptr<memory_holder> shared_memory_holder;
+typedef std::shared_ptr<memory> shared_memory;
+}
+}
+
+#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/type.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/type.h
new file mode 100644
index 0000000000..9d55ca9662
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/type.h
@@ -0,0 +1,16 @@
+#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+struct NodeType {
+ enum value { Undefined, Null, Scalar, Sequence, Map };
+};
+}
+
+#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h
new file mode 100644
index 0000000000..a261040739
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h
@@ -0,0 +1,25 @@
+#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+// this is basically boost::noncopyable
+class YAML_CPP_API noncopyable {
+ protected:
+ noncopyable() {}
+ ~noncopyable() {}
+
+ private:
+ noncopyable(const noncopyable&);
+ const noncopyable& operator=(const noncopyable&);
+};
+}
+
+#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/null.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/null.h
new file mode 100644
index 0000000000..b9521d488a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/null.h
@@ -0,0 +1,26 @@
+#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/dll.h"
+#include <string>
+
+namespace YAML {
+class Node;
+
+struct YAML_CPP_API _Null {};
+inline bool operator==(const _Null&, const _Null&) { return true; }
+inline bool operator!=(const _Null&, const _Null&) { return false; }
+
+YAML_CPP_API bool IsNull(const Node& node); // old API only
+YAML_CPP_API bool IsNullString(const std::string& str);
+
+extern YAML_CPP_API _Null Null;
+}
+
+#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h
new file mode 100644
index 0000000000..09d45f39b7
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h
@@ -0,0 +1,72 @@
+#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class YAML_CPP_API ostream_wrapper {
+ public:
+ ostream_wrapper();
+ explicit ostream_wrapper(std::ostream& stream);
+ ~ostream_wrapper();
+
+ void write(const std::string& str);
+ void write(const char* str, std::size_t size);
+
+ void set_comment() { m_comment = true; }
+
+ const char* str() const {
+ if (m_pStream) {
+ return 0;
+ } else {
+ m_buffer[m_pos] = '\0';
+ return &m_buffer[0];
+ }
+ }
+
+ std::size_t row() const { return m_row; }
+ std::size_t col() const { return m_col; }
+ std::size_t pos() const { return m_pos; }
+ bool comment() const { return m_comment; }
+
+ private:
+ void update_pos(char ch);
+
+ private:
+ mutable std::vector<char> m_buffer;
+ std::ostream* const m_pStream;
+
+ std::size_t m_pos;
+ std::size_t m_row, m_col;
+ bool m_comment;
+};
+
+template <std::size_t N>
+inline ostream_wrapper& operator<<(ostream_wrapper& stream,
+ const char(&str)[N]) {
+ stream.write(str, N - 1);
+ return stream;
+}
+
+inline ostream_wrapper& operator<<(ostream_wrapper& stream,
+ const std::string& str) {
+ stream.write(str);
+ return stream;
+}
+
+inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
+ stream.write(&ch, 1);
+ return stream;
+}
+}
+
+#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h
new file mode 100644
index 0000000000..ceac22d026
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h
@@ -0,0 +1,86 @@
+#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <ios>
+#include <memory>
+
+#include "yaml-cpp/dll.h"
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+class EventHandler;
+class Node;
+class Scanner;
+struct Directives;
+struct Token;
+
+/**
+ * A parser turns a stream of bytes into one stream of "events" per YAML
+ * document in the input stream.
+ */
+class YAML_CPP_API Parser : private noncopyable {
+ public:
+ /** Constructs an empty parser (with no input. */
+ Parser();
+
+ /**
+ * Constructs a parser from the given input stream. The input stream must
+ * live as long as the parser.
+ */
+ explicit Parser(std::istream& in);
+
+ ~Parser();
+
+ /** Evaluates to true if the parser has some valid input to be read. */
+ explicit operator bool() const;
+
+ /**
+ * Resets the parser with the given input stream. Any existing state is
+ * erased.
+ */
+ void Load(std::istream& in);
+
+ /**
+ * Handles the next document by calling events on the {@code eventHandler}.
+ *
+ * @throw a ParserException on error.
+ * @return false if there are no more documents
+ */
+ bool HandleNextDocument(EventHandler& eventHandler);
+
+ void PrintTokens(std::ostream& out);
+
+ private:
+ /**
+ * Reads any directives that are next in the queue, setting the internal
+ * {@code m_pDirectives} state.
+ */
+ void ParseDirectives();
+
+ void HandleDirective(const Token& token);
+
+ /**
+ * Handles a "YAML" directive, which should be of the form 'major.minor' (like
+ * a version number).
+ */
+ void HandleYamlDirective(const Token& token);
+
+ /**
+ * Handles a "TAG" directive, which should be of the form 'handle prefix',
+ * where 'handle' is converted to 'prefix' in the file.
+ */
+ void HandleTagDirective(const Token& token);
+
+ private:
+ std::unique_ptr<Scanner> m_pScanner;
+ std::unique_ptr<Directives> m_pDirectives;
+};
+}
+
+#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
new file mode 100644
index 0000000000..06780c861f
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
@@ -0,0 +1,51 @@
+#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+#include <list>
+#include <set>
+#include <map>
+
+namespace YAML {
+template <typename Seq>
+inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
+ emitter << BeginSeq;
+ for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
+ emitter << *it;
+ emitter << EndSeq;
+ return emitter;
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename K, typename V>
+inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
+ typedef typename std::map<K, V> map;
+ emitter << BeginMap;
+ for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
+ emitter << Key << it->first << Value << it->second;
+ emitter << EndMap;
+ return emitter;
+}
+}
+
+#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h
new file mode 100644
index 0000000000..f33d0e1f63
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h
@@ -0,0 +1,103 @@
+#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+namespace YAML {
+template <typename>
+struct is_numeric {
+ enum { value = false };
+};
+
+template <>
+struct is_numeric<char> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned char> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<long int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned long int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<short int> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned short int> {
+ enum { value = true };
+};
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+template <>
+struct is_numeric<__int64> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned __int64> {
+ enum { value = true };
+};
+#else
+template <>
+struct is_numeric<long long> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<unsigned long long> {
+ enum { value = true };
+};
+#endif
+template <>
+struct is_numeric<float> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<double> {
+ enum { value = true };
+};
+template <>
+struct is_numeric<long double> {
+ enum { value = true };
+};
+
+template <bool, class T = void>
+struct enable_if_c {
+ typedef T type;
+};
+
+template <class T>
+struct enable_if_c<false, T> {};
+
+template <class Cond, class T = void>
+struct enable_if : public enable_if_c<Cond::value, T> {};
+
+template <bool, class T = void>
+struct disable_if_c {
+ typedef T type;
+};
+
+template <class T>
+struct disable_if_c<true, T> {};
+
+template <class Cond, class T = void>
+struct disable_if : public disable_if_c<Cond::value, T> {};
+}
+
+#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/yaml.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/yaml.h
new file mode 100644
index 0000000000..7f515efb96
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/yaml.h
@@ -0,0 +1,24 @@
+#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/parser.h"
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/stlemitter.h"
+#include "yaml-cpp/exceptions.h"
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/convert.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/detail/impl.h"
+#include "yaml-cpp/node/parse.h"
+#include "yaml-cpp/node/emit.h"
+
+#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch b/src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch
new file mode 100644
index 0000000000..93bdc64f64
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch
@@ -0,0 +1,1667 @@
+From dd3d5fa32be556e54d2ee2247a06e1fc7e5c8026 Mon Sep 17 00:00:00 2001
+From: Nikolai Kosjar <nikolai.kosjar@qt.io>
+Date: Thu, 22 Aug 2019 15:00:03 +0200
+Subject: [PATCH] yaml-cpp: Strip unneeded sources
+
+Change-Id: I2f863b06c1cd42abadc64897cd6282c4a2c8a8e3
+---
+ src/libs/3rdparty/yaml-cpp/.codedocs | 50 -
+ src/libs/3rdparty/yaml-cpp/.gitignore | 1 -
+ src/libs/3rdparty/yaml-cpp/.travis.yml | 28 -
+ src/libs/3rdparty/yaml-cpp/CMakeLists.txt | 365 -
+ src/libs/3rdparty/yaml-cpp/CONTRIBUTING.md | 26 -
+ .../include/yaml-cpp/contrib/anchordict.h | 39 -
+ .../include/yaml-cpp/contrib/graphbuilder.h | 149 -
+ src/libs/3rdparty/yaml-cpp/install.txt | 24 -
+ .../yaml-cpp/src/contrib/graphbuilder.cpp | 17 -
+ .../src/contrib/graphbuilderadapter.cpp | 94 -
+ .../src/contrib/graphbuilderadapter.h | 79 -
+ .../3rdparty/yaml-cpp/test/CMakeLists.txt | 44 -
+ .../yaml-cpp/test/create-emitter-tests.py | 211 -
+ .../yaml-cpp/test/gtest-1.8.0/.gitignore | 2 -
+ .../yaml-cpp/test/gtest-1.8.0/.travis.yml | 46 -
+ .../yaml-cpp/test/gtest-1.8.0/CMakeLists.txt | 16 -
+ .../yaml-cpp/test/gtest-1.8.0/README.md | 142 -
+ .../yaml-cpp/test/gtest-1.8.0/appveyor.yml | 71 -
+ .../test/gtest-1.8.0/googlemock/CHANGES | 126 -
+ .../gtest-1.8.0/googlemock/CMakeLists.txt | 202 -
+ .../test/gtest-1.8.0/googlemock/CONTRIBUTORS | 40 -
+ .../test/gtest-1.8.0/googlemock/LICENSE | 28 -
+ .../test/gtest-1.8.0/googlemock/README.md | 333 -
+ .../gtest-1.8.0/googlemock/build-aux/.keep | 0
+ .../test/gtest-1.8.0/googlemock/configure.ac | 146 -
+ .../gtest-1.8.0/googlemock/docs/CheatSheet.md | 562 -
+ .../gtest-1.8.0/googlemock/docs/CookBook.md | 3675 -------
+ .../gtest-1.8.0/googlemock/docs/DesignDoc.md | 280 -
+ .../gtest-1.8.0/googlemock/docs/DevGuide.md | 132 -
+ .../googlemock/docs/Documentation.md | 12 -
+ .../gtest-1.8.0/googlemock/docs/ForDummies.md | 439 -
+ .../docs/FrequentlyAskedQuestions.md | 628 --
+ .../googlemock/docs/KnownIssues.md | 19 -
+ .../googlemock/docs/v1_5/CheatSheet.md | 525 -
+ .../googlemock/docs/v1_5/CookBook.md | 3250 ------
+ .../googlemock/docs/v1_5/Documentation.md | 11 -
+ .../googlemock/docs/v1_5/ForDummies.md | 439 -
+ .../docs/v1_5/FrequentlyAskedQuestions.md | 624 --
+ .../googlemock/docs/v1_6/CheatSheet.md | 534 -
+ .../googlemock/docs/v1_6/CookBook.md | 3342 ------
+ .../googlemock/docs/v1_6/Documentation.md | 12 -
+ .../googlemock/docs/v1_6/ForDummies.md | 439 -
+ .../docs/v1_6/FrequentlyAskedQuestions.md | 628 --
+ .../googlemock/docs/v1_7/CheatSheet.md | 556 -
+ .../googlemock/docs/v1_7/CookBook.md | 3432 ------
+ .../googlemock/docs/v1_7/Documentation.md | 12 -
+ .../googlemock/docs/v1_7/ForDummies.md | 439 -
+ .../docs/v1_7/FrequentlyAskedQuestions.md | 628 --
+ .../googlemock/include/gmock/gmock-actions.h | 1205 --
+ .../include/gmock/gmock-cardinalities.h | 147 -
+ .../include/gmock/gmock-generated-actions.h | 2377 ----
+ .../gmock/gmock-generated-actions.h.pump | 794 --
+ .../gmock/gmock-generated-function-mockers.h | 1095 --
+ .../gmock-generated-function-mockers.h.pump | 291 -
+ .../include/gmock/gmock-generated-matchers.h | 2179 ----
+ .../gmock/gmock-generated-matchers.h.pump | 672 --
+ .../gmock/gmock-generated-nice-strict.h | 397 -
+ .../gmock/gmock-generated-nice-strict.h.pump | 161 -
+ .../googlemock/include/gmock/gmock-matchers.h | 4399 --------
+ .../include/gmock/gmock-more-actions.h | 246 -
+ .../include/gmock/gmock-more-matchers.h | 58 -
+ .../include/gmock/gmock-spec-builders.h | 1847 ----
+ .../googlemock/include/gmock/gmock.h | 94 -
+ .../internal/custom/gmock-generated-actions.h | 8 -
+ .../custom/gmock-generated-actions.h.pump | 10 -
+ .../gmock/internal/custom/gmock-matchers.h | 39 -
+ .../gmock/internal/custom/gmock-port.h | 46 -
+ .../internal/gmock-generated-internal-utils.h | 279 -
+ .../gmock-generated-internal-utils.h.pump | 136 -
+ .../gmock/internal/gmock-internal-utils.h | 511 -
+ .../include/gmock/internal/gmock-port.h | 91 -
+ .../googlemock/msvc/2005/gmock_config.vsprops | 15 -
+ .../googlemock/msvc/2010/gmock_config.props | 19 -
+ .../googlemock/msvc/2015/gmock_config.props | 19 -
+ .../googlemock/scripts/fuse_gmock_files.py | 240 -
+ .../googlemock/scripts/generator/LICENSE | 203 -
+ .../googlemock/scripts/generator/README | 35 -
+ .../scripts/generator/README.cppclean | 115 -
+ .../scripts/generator/cpp/__init__.py | 0
+ .../googlemock/scripts/generator/cpp/ast.py | 1733 ---
+ .../scripts/generator/cpp/gmock_class.py | 227 -
+ .../scripts/generator/cpp/gmock_class_test.py | 448 -
+ .../scripts/generator/cpp/keywords.py | 59 -
+ .../scripts/generator/cpp/tokenize.py | 287 -
+ .../googlemock/scripts/generator/cpp/utils.py | 41 -
+ .../googlemock/scripts/generator/gmock_gen.py | 31 -
+ .../googlemock/scripts/gmock-config.in | 303 -
+ .../googlemock/scripts/gmock_doctor.py | 640 --
+ .../gtest-1.8.0/googlemock/scripts/upload.py | 1387 ---
+ .../googlemock/scripts/upload_gmock.py | 78 -
+ .../gtest-1.8.0/googlemock/src/gmock-all.cc | 47 -
+ .../googlemock/src/gmock-cardinalities.cc | 156 -
+ .../googlemock/src/gmock-internal-utils.cc | 174 -
+ .../googlemock/src/gmock-matchers.cc | 498 -
+ .../googlemock/src/gmock-spec-builders.cc | 823 --
+ .../test/gtest-1.8.0/googlemock/src/gmock.cc | 183 -
+ .../gtest-1.8.0/googlemock/src/gmock_main.cc | 54 -
+ .../googlemock/test/gmock-actions_test.cc | 1411 ---
+ .../test/gmock-cardinalities_test.cc | 428 -
+ .../test/gmock-generated-actions_test.cc | 1228 ---
+ .../gmock-generated-function-mockers_test.cc | 622 --
+ .../gmock-generated-internal-utils_test.cc | 127 -
+ .../test/gmock-generated-matchers_test.cc | 1286 ---
+ .../test/gmock-internal-utils_test.cc | 699 --
+ .../googlemock/test/gmock-matchers_test.cc | 5652 ----------
+ .../test/gmock-more-actions_test.cc | 708 --
+ .../googlemock/test/gmock-nice-strict_test.cc | 424 -
+ .../googlemock/test/gmock-port_test.cc | 43 -
+ .../test/gmock-spec-builders_test.cc | 2644 -----
+ .../googlemock/test/gmock_all_test.cc | 51 -
+ .../googlemock/test/gmock_ex_test.cc | 81 -
+ .../googlemock/test/gmock_leak_test.py | 108 -
+ .../googlemock/test/gmock_leak_test_.cc | 100 -
+ .../googlemock/test/gmock_link2_test.cc | 40 -
+ .../googlemock/test/gmock_link_test.cc | 40 -
+ .../googlemock/test/gmock_link_test.h | 669 --
+ .../googlemock/test/gmock_output_test.py | 180 -
+ .../googlemock/test/gmock_output_test_.cc | 291 -
+ .../test/gmock_output_test_golden.txt | 310 -
+ .../googlemock/test/gmock_stress_test.cc | 322 -
+ .../gtest-1.8.0/googlemock/test/gmock_test.cc | 220 -
+ .../googlemock/test/gmock_test_utils.py | 112 -
+ .../test/gtest-1.8.0/googletest/.gitignore | 2 -
+ .../test/gtest-1.8.0/googletest/CHANGES | 157 -
+ .../gtest-1.8.0/googletest/CMakeLists.txt | 286 -
+ .../test/gtest-1.8.0/googletest/CONTRIBUTORS | 37 -
+ .../test/gtest-1.8.0/googletest/LICENSE | 28 -
+ .../test/gtest-1.8.0/googletest/README.md | 280 -
+ .../gtest-1.8.0/googletest/build-aux/.keep | 0
+ .../googletest/cmake/internal_utils.cmake | 254 -
+ .../googletest/codegear/gtest.cbproj | 138 -
+ .../googletest/codegear/gtest.groupproj | 54 -
+ .../googletest/codegear/gtest_all.cc | 38 -
+ .../googletest/codegear/gtest_link.cc | 40 -
+ .../googletest/codegear/gtest_main.cbproj | 82 -
+ .../googletest/codegear/gtest_unittest.cbproj | 88 -
+ .../test/gtest-1.8.0/googletest/configure.ac | 68 -
+ .../googletest/docs/AdvancedGuide.md | 2182 ----
+ .../gtest-1.8.0/googletest/docs/DevGuide.md | 126 -
+ .../googletest/docs/Documentation.md | 14 -
+ .../test/gtest-1.8.0/googletest/docs/FAQ.md | 1087 --
+ .../gtest-1.8.0/googletest/docs/Primer.md | 502 -
+ .../gtest-1.8.0/googletest/docs/PumpManual.md | 177 -
+ .../gtest-1.8.0/googletest/docs/Samples.md | 14 -
+ .../googletest/docs/V1_5_AdvancedGuide.md | 2096 ----
+ .../googletest/docs/V1_5_Documentation.md | 12 -
+ .../gtest-1.8.0/googletest/docs/V1_5_FAQ.md | 886 --
+ .../googletest/docs/V1_5_Primer.md | 497 -
+ .../googletest/docs/V1_5_PumpManual.md | 177 -
+ .../googletest/docs/V1_5_XcodeGuide.md | 93 -
+ .../googletest/docs/V1_6_AdvancedGuide.md | 2178 ----
+ .../googletest/docs/V1_6_Documentation.md | 14 -
+ .../gtest-1.8.0/googletest/docs/V1_6_FAQ.md | 1038 --
+ .../googletest/docs/V1_6_Primer.md | 501 -
+ .../googletest/docs/V1_6_PumpManual.md | 177 -
+ .../googletest/docs/V1_6_Samples.md | 14 -
+ .../googletest/docs/V1_6_XcodeGuide.md | 93 -
+ .../googletest/docs/V1_7_AdvancedGuide.md | 2181 ----
+ .../googletest/docs/V1_7_Documentation.md | 14 -
+ .../gtest-1.8.0/googletest/docs/V1_7_FAQ.md | 1082 --
+ .../googletest/docs/V1_7_Primer.md | 501 -
+ .../googletest/docs/V1_7_PumpManual.md | 177 -
+ .../googletest/docs/V1_7_Samples.md | 14 -
+ .../googletest/docs/V1_7_XcodeGuide.md | 93 -
+ .../gtest-1.8.0/googletest/docs/XcodeGuide.md | 93 -
+ .../include/gtest/gtest-death-test.h | 294 -
+ .../googletest/include/gtest/gtest-message.h | 250 -
+ .../include/gtest/gtest-param-test.h | 1444 ---
+ .../include/gtest/gtest-param-test.h.pump | 510 -
+ .../googletest/include/gtest/gtest-printers.h | 993 --
+ .../googletest/include/gtest/gtest-spi.h | 232 -
+ .../include/gtest/gtest-test-part.h | 179 -
+ .../include/gtest/gtest-typed-test.h | 263 -
+ .../googletest/include/gtest/gtest.h | 2236 ----
+ .../include/gtest/gtest_pred_impl.h | 358 -
+ .../googletest/include/gtest/gtest_prod.h | 58 -
+ .../gtest/internal/custom/gtest-port.h | 69 -
+ .../gtest/internal/custom/gtest-printers.h | 42 -
+ .../include/gtest/internal/custom/gtest.h | 41 -
+ .../internal/gtest-death-test-internal.h | 319 -
+ .../include/gtest/internal/gtest-filepath.h | 206 -
+ .../include/gtest/internal/gtest-internal.h | 1238 ---
+ .../include/gtest/internal/gtest-linked_ptr.h | 243 -
+ .../internal/gtest-param-util-generated.h | 5146 ---------
+ .../gtest-param-util-generated.h.pump | 286 -
+ .../include/gtest/internal/gtest-param-util.h | 731 --
+ .../include/gtest/internal/gtest-port-arch.h | 93 -
+ .../include/gtest/internal/gtest-port.h | 2554 -----
+ .../include/gtest/internal/gtest-string.h | 167 -
+ .../include/gtest/internal/gtest-tuple.h | 1020 --
+ .../include/gtest/internal/gtest-tuple.h.pump | 347 -
+ .../include/gtest/internal/gtest-type-util.h | 3331 ------
+ .../gtest/internal/gtest-type-util.h.pump | 297 -
+ .../gtest-1.8.0/googletest/m4/acx_pthread.m4 | 363 -
+ .../test/gtest-1.8.0/googletest/m4/gtest.m4 | 74 -
+ .../googletest/samples/prime_tables.h | 123 -
+ .../gtest-1.8.0/googletest/samples/sample1.cc | 68 -
+ .../gtest-1.8.0/googletest/samples/sample1.h | 43 -
+ .../googletest/samples/sample10_unittest.cc | 144 -
+ .../googletest/samples/sample1_unittest.cc | 153 -
+ .../gtest-1.8.0/googletest/samples/sample2.cc | 56 -
+ .../gtest-1.8.0/googletest/samples/sample2.h | 85 -
+ .../googletest/samples/sample2_unittest.cc | 109 -
+ .../googletest/samples/sample3-inl.h | 172 -
+ .../googletest/samples/sample3_unittest.cc | 151 -
+ .../gtest-1.8.0/googletest/samples/sample4.cc | 46 -
+ .../gtest-1.8.0/googletest/samples/sample4.h | 53 -
+ .../googletest/samples/sample4_unittest.cc | 45 -
+ .../googletest/samples/sample5_unittest.cc | 199 -
+ .../googletest/samples/sample6_unittest.cc | 224 -
+ .../googletest/samples/sample7_unittest.cc | 130 -
+ .../googletest/samples/sample8_unittest.cc | 173 -
+ .../googletest/samples/sample9_unittest.cc | 160 -
+ .../gtest-1.8.0/googletest/scripts/common.py | 83 -
+ .../googletest/scripts/fuse_gtest_files.py | 253 -
+ .../googletest/scripts/gen_gtest_pred_impl.py | 730 --
+ .../googletest/scripts/gtest-config.in | 274 -
+ .../gtest-1.8.0/googletest/scripts/pump.py | 855 --
+ .../googletest/scripts/release_docs.py | 158 -
+ .../gtest-1.8.0/googletest/scripts/upload.py | 1387 ---
+ .../googletest/scripts/upload_gtest.py | 78 -
+ .../gtest-1.8.0/googletest/src/gtest-all.cc | 48 -
+ .../googletest/src/gtest-death-test.cc | 1342 ---
+ .../googletest/src/gtest-filepath.cc | 387 -
+ .../googletest/src/gtest-internal-inl.h | 1183 --
+ .../gtest-1.8.0/googletest/src/gtest-port.cc | 1259 ---
+ .../googletest/src/gtest-printers.cc | 373 -
+ .../googletest/src/gtest-test-part.cc | 110 -
+ .../googletest/src/gtest-typed-test.cc | 118 -
+ .../test/gtest-1.8.0/googletest/src/gtest.cc | 5388 ---------
+ .../gtest-1.8.0/googletest/src/gtest_main.cc | 38 -
+ .../test/gtest-death-test_ex_test.cc | 93 -
+ .../googletest/test/gtest-death-test_test.cc | 1427 ---
+ .../googletest/test/gtest-filepath_test.cc | 662 --
+ .../googletest/test/gtest-linked_ptr_test.cc | 154 -
+ .../googletest/test/gtest-listener_test.cc | 311 -
+ .../googletest/test/gtest-message_test.cc | 159 -
+ .../googletest/test/gtest-options_test.cc | 215 -
+ .../googletest/test/gtest-param-test2_test.cc | 65 -
+ .../googletest/test/gtest-param-test_test.cc | 1055 --
+ .../googletest/test/gtest-param-test_test.h | 57 -
+ .../googletest/test/gtest-port_test.cc | 1304 ---
+ .../googletest/test/gtest-printers_test.cc | 1635 ---
+ .../googletest/test/gtest-test-part_test.cc | 208 -
+ .../googletest/test/gtest-tuple_test.cc | 320 -
+ .../googletest/test/gtest-typed-test2_test.cc | 45 -
+ .../googletest/test/gtest-typed-test_test.cc | 380 -
+ .../googletest/test/gtest-typed-test_test.h | 66 -
+ .../test/gtest-unittest-api_test.cc | 341 -
+ .../googletest/test/gtest_all_test.cc | 47 -
+ .../test/gtest_break_on_failure_unittest.py | 212 -
+ .../test/gtest_break_on_failure_unittest_.cc | 88 -
+ .../test/gtest_catch_exceptions_test.py | 237 -
+ .../test/gtest_catch_exceptions_test_.cc | 311 -
+ .../googletest/test/gtest_color_test.py | 130 -
+ .../googletest/test/gtest_color_test_.cc | 71 -
+ .../googletest/test/gtest_env_var_test.py | 117 -
+ .../googletest/test/gtest_env_var_test_.cc | 126 -
+ .../googletest/test/gtest_environment_test.cc | 192 -
+ .../googletest/test/gtest_filter_unittest.py | 636 --
+ .../googletest/test/gtest_filter_unittest_.cc | 140 -
+ .../googletest/test/gtest_help_test.py | 172 -
+ .../googletest/test/gtest_help_test_.cc | 46 -
+ .../test/gtest_list_tests_unittest.py | 207 -
+ .../test/gtest_list_tests_unittest_.cc | 157 -
+ .../googletest/test/gtest_main_unittest.cc | 45 -
+ .../googletest/test/gtest_no_test_unittest.cc | 56 -
+ .../googletest/test/gtest_output_test.py | 340 -
+ .../googletest/test/gtest_output_test_.cc | 1062 --
+ .../test/gtest_output_test_golden_lin.txt | 743 --
+ .../test/gtest_pred_impl_unittest.cc | 2427 ----
+ .../test/gtest_premature_exit_test.cc | 127 -
+ .../googletest/test/gtest_prod_test.cc | 57 -
+ .../googletest/test/gtest_repeat_test.cc | 253 -
+ .../googletest/test/gtest_shuffle_test.py | 325 -
+ .../googletest/test/gtest_shuffle_test_.cc | 103 -
+ .../googletest/test/gtest_sole_header_test.cc | 57 -
+ .../googletest/test/gtest_stress_test.cc | 256 -
+ .../googletest/test/gtest_test_utils.py | 320 -
+ .../test/gtest_throw_on_failure_ex_test.cc | 92 -
+ .../test/gtest_throw_on_failure_test.py | 171 -
+ .../test/gtest_throw_on_failure_test_.cc | 72 -
+ .../test/gtest_uninitialized_test.py | 70 -
+ .../test/gtest_uninitialized_test_.cc | 43 -
+ .../googletest/test/gtest_unittest.cc | 7706 -------------
+ .../test/gtest_xml_outfile1_test_.cc | 49 -
+ .../test/gtest_xml_outfile2_test_.cc | 49 -
+ .../test/gtest_xml_outfiles_test.py | 132 -
+ .../test/gtest_xml_output_unittest.py | 308 -
+ .../test/gtest_xml_output_unittest_.cc | 181 -
+ .../googletest/test/gtest_xml_test_utils.py | 194 -
+ .../gtest-1.8.0/googletest/test/production.cc | 36 -
+ .../gtest-1.8.0/googletest/test/production.h | 55 -
+ .../xcode/Config/DebugProject.xcconfig | 30 -
+ .../xcode/Config/FrameworkTarget.xcconfig | 17 -
+ .../googletest/xcode/Config/General.xcconfig | 41 -
+ .../xcode/Config/ReleaseProject.xcconfig | 32 -
+ .../xcode/Config/StaticLibraryTarget.xcconfig | 18 -
+ .../xcode/Config/TestTarget.xcconfig | 8 -
+ .../googletest/xcode/Resources/Info.plist | 30 -
+ .../xcode/Samples/FrameworkSample/Info.plist | 28 -
+ .../WidgetFramework.xcodeproj/project.pbxproj | 457 -
+ .../xcode/Samples/FrameworkSample/runtests.sh | 62 -
+ .../xcode/Samples/FrameworkSample/widget.cc | 63 -
+ .../xcode/Samples/FrameworkSample/widget.h | 59 -
+ .../Samples/FrameworkSample/widget_test.cc | 68 -
+ .../googletest/xcode/Scripts/runtests.sh | 65 -
+ .../xcode/Scripts/versiongenerate.py | 100 -
+ .../xcode/gtest.xcodeproj/project.pbxproj | 1135 --
+ .../yaml-cpp/test/gtest-1.8.0/travis.sh | 15 -
+ .../3rdparty/yaml-cpp/test/handler_test.h | 32 -
+ .../test/integration/emitter_test.cpp | 1038 --
+ .../test/integration/encoding_test.cpp | 182 -
+ .../test/integration/gen_emitter_test.cpp | 9759 -----------------
+ .../test/integration/handler_spec_test.cpp | 1611 ---
+ .../test/integration/handler_test.cpp | 76 -
+ .../test/integration/load_node_test.cpp | 241 -
+ .../test/integration/node_spec_test.cpp | 1131 --
+ src/libs/3rdparty/yaml-cpp/test/main.cpp | 6 -
+ .../yaml-cpp/test/mock_event_handler.h | 26 -
+ .../3rdparty/yaml-cpp/test/node/node_test.cpp | 517 -
+ .../yaml-cpp/test/ostream_wrapper_test.cpp | 66 -
+ .../3rdparty/yaml-cpp/test/regex_test.cpp | 177 -
+ .../3rdparty/yaml-cpp/test/specexamples.h | 846 --
+ .../3rdparty/yaml-cpp/util/CMakeLists.txt | 14 -
+ src/libs/3rdparty/yaml-cpp/util/api.cpp | 137 -
+ src/libs/3rdparty/yaml-cpp/util/parse.cpp | 61 -
+ src/libs/3rdparty/yaml-cpp/util/read.cpp | 103 -
+ src/libs/3rdparty/yaml-cpp/util/sandbox.cpp | 36 -
+ .../yaml-cpp/yaml-cpp-config-version.cmake.in | 11 -
+ .../yaml-cpp/yaml-cpp-config.cmake.in | 14 -
+ 331 files changed, 167784 deletions(-)
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/.codedocs
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/.gitignore
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/.travis.yml
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/CONTRIBUTING.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/anchordict.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/install.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilder.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/create-emitter-tests.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.gitignore
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.travis.yml
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/README.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/appveyor.yml
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CHANGES
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CONTRIBUTORS
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/LICENSE
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/README.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/build-aux/.keep
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/configure.ac
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CheatSheet.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CookBook.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DesignDoc.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DevGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/ForDummies.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/FrequentlyAskedQuestions.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/KnownIssues.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CheatSheet.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CookBook.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/ForDummies.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/FrequentlyAskedQuestions.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CheatSheet.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CookBook.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/ForDummies.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/FrequentlyAskedQuestions.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CheatSheet.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CookBook.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/ForDummies.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/FrequentlyAskedQuestions.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-actions.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-cardinalities.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-matchers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-actions.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-matchers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-spec-builders.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-matchers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-port.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-internal-utils.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-port.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2005/gmock_config.vsprops
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2010/gmock_config.props
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2015/gmock_config.props
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/fuse_gmock_files.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/LICENSE
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README.cppclean
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/__init__.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/ast.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class_test.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/keywords.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/tokenize.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/utils.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/gmock_gen.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock-config.in
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock_doctor.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload_gmock.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-all.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-cardinalities.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-internal-utils.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-matchers.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-spec-builders.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock_main.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-actions_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-cardinalities_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-actions_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-function-mockers_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-internal-utils_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-matchers_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-internal-utils_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-matchers_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-more-actions_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-nice-strict_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-port_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-spec-builders_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_all_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_ex_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link2_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.h
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_golden.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_stress_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test_utils.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/.gitignore
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CHANGES
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CONTRIBUTORS
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/LICENSE
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/README.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/build-aux/.keep
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/cmake/internal_utils.cmake
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.cbproj
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.groupproj
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_all.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_link.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_main.cbproj
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_unittest.cbproj
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/configure.ac
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/AdvancedGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/DevGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/FAQ.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Primer.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/PumpManual.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Samples.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_AdvancedGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_FAQ.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Primer.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_PumpManual.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_XcodeGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_AdvancedGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_FAQ.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Primer.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_PumpManual.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Samples.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_XcodeGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_AdvancedGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Documentation.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_FAQ.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Primer.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_PumpManual.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Samples.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_XcodeGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/XcodeGuide.md
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-death-test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-message.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-printers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-spi.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-test-part.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-typed-test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_pred_impl.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_prod.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-port.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-printers.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-death-test-internal.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-filepath.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-internal.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-linked_ptr.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port-arch.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-string.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h.pump
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/acx_pthread.m4
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/gtest.m4
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/prime_tables.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample10_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3-inl.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample5_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample6_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample7_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample8_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample9_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/common.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/fuse_gtest_files.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gen_gtest_pred_impl.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gtest-config.in
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/pump.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/release_docs.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload_gtest.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-all.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-death-test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-filepath.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-internal-inl.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-port.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-printers.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-test-part.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-typed-test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest_main.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_ex_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-filepath_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-linked_ptr_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-listener_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-message_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-options_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test2_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-port_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-printers_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-test-part_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-tuple_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test2_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-unittest-api_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_all_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_environment_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_main_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_no_test_unittest.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_golden_lin.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_pred_impl_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_premature_exit_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_prod_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_repeat_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_sole_header_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_stress_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_test_utils.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_ex_test.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_unittest.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile1_test_.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile2_test_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfiles_test.py
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest_.cc
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_test_utils.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/DebugProject.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/FrameworkTarget.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/General.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/ReleaseProject.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/StaticLibraryTarget.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/TestTarget.xcconfig
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Resources/Info.plist
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/Info.plist
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/runtests.sh
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget_test.cc
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/runtests.sh
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/versiongenerate.py
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/gtest.xcodeproj/project.pbxproj
+ delete mode 100755 src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/travis.sh
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/handler_test.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/emitter_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/encoding_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/gen_emitter_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/handler_spec_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/handler_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/load_node_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/integration/node_spec_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/main.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/mock_event_handler.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/node/node_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/ostream_wrapper_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/regex_test.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/test/specexamples.h
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/util/CMakeLists.txt
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/util/api.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/util/parse.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/util/read.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/util/sandbox.cpp
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/yaml-cpp-config-version.cmake.in
+ delete mode 100644 src/libs/3rdparty/yaml-cpp/yaml-cpp-config.cmake.in
+
+diff --git a/src/libs/3rdparty/yaml-cpp/.codedocs b/src/libs/3rdparty/yaml-cpp/.codedocs
+deleted file mode 100644
+index 02e438213a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/.gitignore b/src/libs/3rdparty/yaml-cpp/.gitignore
+deleted file mode 100644
+index 567609b123..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/.travis.yml b/src/libs/3rdparty/yaml-cpp/.travis.yml
+deleted file mode 100644
+index d0b6a04efe..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/CMakeLists.txt
+deleted file mode 100644
+index d2d8810288..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/CONTRIBUTING.md b/src/libs/3rdparty/yaml-cpp/CONTRIBUTING.md
+deleted file mode 100644
+index cd09a1aca8..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/anchordict.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/anchordict.h
+deleted file mode 100644
+index 78db9ec928..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/contrib/graphbuilder.h
+deleted file mode 100644
+index f0a38f2887..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/install.txt b/src/libs/3rdparty/yaml-cpp/install.txt
+deleted file mode 100644
+index 939236249b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilder.cpp b/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilder.cpp
+deleted file mode 100644
+index 416c1359db..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.cpp b/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.cpp
+deleted file mode 100644
+index 02a3d972a5..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.h b/src/libs/3rdparty/yaml-cpp/src/contrib/graphbuilderadapter.h
+deleted file mode 100644
+index 0d1e579208..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/test/CMakeLists.txt
+deleted file mode 100644
+index 3633da578b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/create-emitter-tests.py b/src/libs/3rdparty/yaml-cpp/test/create-emitter-tests.py
+deleted file mode 100644
+index 7a03c41e1b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.gitignore b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.gitignore
+deleted file mode 100644
+index ce310bc357..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.travis.yml b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/.travis.yml
+deleted file mode 100644
+index 3204dfac17..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/CMakeLists.txt
+deleted file mode 100644
+index 8d2b552ef7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/README.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/README.md
+deleted file mode 100644
+index 076484e4fa..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/appveyor.yml b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/appveyor.yml
+deleted file mode 100644
+index d613fd6027..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CHANGES b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CHANGES
+deleted file mode 100644
+index d6f2f760e3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CMakeLists.txt
+deleted file mode 100644
+index beb259a2e9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CONTRIBUTORS b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/CONTRIBUTORS
+deleted file mode 100644
+index 6e9ae362b6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/LICENSE b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/LICENSE
+deleted file mode 100644
+index 1941a11f8c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/README.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/README.md
+deleted file mode 100644
+index 332beab388..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/build-aux/.keep b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/build-aux/.keep
+deleted file mode 100644
+index e69de29bb2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/configure.ac b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/configure.ac
+deleted file mode 100644
+index 3b740f205e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CheatSheet.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CheatSheet.md
+deleted file mode 100644
+index ef4451b878..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CookBook.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/CookBook.md
+deleted file mode 100644
+index c52f1009d1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DesignDoc.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DesignDoc.md
+deleted file mode 100644
+index 3f515c3b6d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DevGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/DevGuide.md
+deleted file mode 100644
+index f4bab75ca7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/Documentation.md
+deleted file mode 100644
+index 444151ee9e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/ForDummies.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/ForDummies.md
+deleted file mode 100644
+index 0da4cbe27b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/FrequentlyAskedQuestions.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/FrequentlyAskedQuestions.md
+deleted file mode 100644
+index 5eac83f4b9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/KnownIssues.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/KnownIssues.md
+deleted file mode 100644
+index adadf5144b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CheatSheet.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CheatSheet.md
+deleted file mode 100644
+index 3c7bed4c6f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CookBook.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/CookBook.md
+deleted file mode 100644
+index 26e153c6ba..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/Documentation.md
+deleted file mode 100644
+index 315b0a2989..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/ForDummies.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/ForDummies.md
+deleted file mode 100644
+index fcc3b56174..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/FrequentlyAskedQuestions.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_5/FrequentlyAskedQuestions.md
+deleted file mode 100644
+index 7593243c3a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CheatSheet.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CheatSheet.md
+deleted file mode 100644
+index 91de1d210e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CookBook.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/CookBook.md
+deleted file mode 100644
+index f5975a0035..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/Documentation.md
+deleted file mode 100644
+index dcc9156c2a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/ForDummies.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/ForDummies.md
+deleted file mode 100644
+index 19ee63ab0c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/FrequentlyAskedQuestions.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_6/FrequentlyAskedQuestions.md
+deleted file mode 100644
+index f74715d2e3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CheatSheet.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CheatSheet.md
+deleted file mode 100644
+index db421e51be..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CookBook.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/CookBook.md
+deleted file mode 100644
+index 419a001071..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/Documentation.md
+deleted file mode 100644
+index d9181f28e1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/ForDummies.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/ForDummies.md
+deleted file mode 100644
+index ee03c5b989..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/FrequentlyAskedQuestions.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/docs/v1_7/FrequentlyAskedQuestions.md
+deleted file mode 100644
+index fa21233aa2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-actions.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-actions.h
+deleted file mode 100644
+index b3f654af34..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-cardinalities.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-cardinalities.h
+deleted file mode 100644
+index fc315f92ab..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h
+deleted file mode 100644
+index b5a889c0c3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-actions.h.pump
+deleted file mode 100644
+index 66d9f9d551..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h
+deleted file mode 100644
+index 4fa5ca9484..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-function-mockers.h.pump
+deleted file mode 100644
+index 811502d0ce..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h
+deleted file mode 100644
+index 57056fd91d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-matchers.h.pump
+deleted file mode 100644
+index de30c2c92b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h
+deleted file mode 100644
+index 4095f4d5bc..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
+deleted file mode 100644
+index 3ee1ce7f30..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-matchers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-matchers.h
+deleted file mode 100644
+index 33b37a7a5d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-actions.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-actions.h
+deleted file mode 100644
+index 3d387b6b7d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-matchers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-more-matchers.h
+deleted file mode 100644
+index 3db899f429..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-spec-builders.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock-spec-builders.h
+deleted file mode 100644
+index fed7de66bc..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/gmock.h
+deleted file mode 100644
+index 6735c71bf8..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h
+deleted file mode 100644
+index 7dc3b1ad54..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump
+deleted file mode 100644
+index d26c8a08a4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-matchers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-matchers.h
+deleted file mode 100644
+index f2efef91db..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-port.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/custom/gmock-port.h
+deleted file mode 100644
+index 9ce8bfe06b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h
+deleted file mode 100644
+index 7811e43f87..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
+deleted file mode 100644
+index 800af17c1d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-internal-utils.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-internal-utils.h
+deleted file mode 100644
+index e2ddb05c91..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-port.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/include/gmock/internal/gmock-port.h
+deleted file mode 100644
+index 63f4a6802e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2005/gmock_config.vsprops b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2005/gmock_config.vsprops
+deleted file mode 100644
+index 9b5ff7f38a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2010/gmock_config.props b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2010/gmock_config.props
+deleted file mode 100644
+index 77bc95b192..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2015/gmock_config.props b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/msvc/2015/gmock_config.props
+deleted file mode 100644
+index 77bc95b192..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/fuse_gmock_files.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/fuse_gmock_files.py
+deleted file mode 100755
+index cb7fdf2f78..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/LICENSE b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/LICENSE
+deleted file mode 100644
+index 87ea063651..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README
+deleted file mode 100644
+index d6f95974b6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README.cppclean b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/README.cppclean
+deleted file mode 100644
+index 65431b6175..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/__init__.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/__init__.py
+deleted file mode 100755
+index e69de29bb2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/ast.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/ast.py
+deleted file mode 100755
+index 11cbe9126a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class.py
+deleted file mode 100755
+index f9966cbb4b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/gmock_class_test.py
+deleted file mode 100755
+index 018f90a650..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/keywords.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/keywords.py
+deleted file mode 100755
+index f694450e37..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/tokenize.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/tokenize.py
+deleted file mode 100755
+index 359d5562d7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/utils.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/cpp/utils.py
+deleted file mode 100755
+index eab36eec33..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/gmock_gen.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/generator/gmock_gen.py
+deleted file mode 100755
+index 8cc0d135d6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock-config.in b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock-config.in
+deleted file mode 100755
+index 2baefe94d6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock_doctor.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/gmock_doctor.py
+deleted file mode 100755
+index 74992bc744..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload.py
+deleted file mode 100755
+index 6e6f9a1471..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload_gmock.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/scripts/upload_gmock.py
+deleted file mode 100755
+index 5dc484b391..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-all.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-all.cc
+deleted file mode 100644
+index 7aebce7afe..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-cardinalities.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-cardinalities.cc
+deleted file mode 100644
+index 50ec7286ee..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-internal-utils.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-internal-utils.cc
+deleted file mode 100644
+index fb5308018a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-matchers.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-matchers.cc
+deleted file mode 100644
+index e7424510fc..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-spec-builders.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock-spec-builders.cc
+deleted file mode 100644
+index 9551342070..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock.cc
+deleted file mode 100644
+index eac3d842ba..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock_main.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/src/gmock_main.cc
+deleted file mode 100644
+index bd5be03be2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-actions_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-actions_test.cc
+deleted file mode 100644
+index f470de4c55..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-cardinalities_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-cardinalities_test.cc
+deleted file mode 100644
+index 64815e57a3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-actions_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-actions_test.cc
+deleted file mode 100644
+index 5ca5bc7892..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-function-mockers_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-function-mockers_test.cc
+deleted file mode 100644
+index a86a613578..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-internal-utils_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-internal-utils_test.cc
+deleted file mode 100644
+index e0a535a346..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-matchers_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-generated-matchers_test.cc
+deleted file mode 100644
+index 0e9f77f5eb..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-internal-utils_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-internal-utils_test.cc
+deleted file mode 100644
+index 9d5ec60927..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-matchers_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-matchers_test.cc
+deleted file mode 100644
+index 9f62c3d826..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-more-actions_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-more-actions_test.cc
+deleted file mode 100644
+index 77e15bd586..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-nice-strict_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-nice-strict_test.cc
+deleted file mode 100644
+index d0adcbbed8..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-port_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-port_test.cc
+deleted file mode 100644
+index d6a8d44466..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-spec-builders_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock-spec-builders_test.cc
+deleted file mode 100644
+index 59ea87c894..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_all_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_all_test.cc
+deleted file mode 100644
+index 56d6c49ccc..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_ex_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_ex_test.cc
+deleted file mode 100644
+index 3afed86ab9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test.py
+deleted file mode 100755
+index 997680ce1a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_leak_test_.cc
+deleted file mode 100644
+index 1d27d22f62..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link2_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link2_test.cc
+deleted file mode 100644
+index 4c310c3d83..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.cc
+deleted file mode 100644
+index 61e97d10ca..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_link_test.h
+deleted file mode 100644
+index 1f55f5bd7f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test.py
+deleted file mode 100755
+index eced8a81f2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_.cc
+deleted file mode 100644
+index 44cba342ad..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_golden.txt b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_output_test_golden.txt
+deleted file mode 100644
+index 689d5eeb03..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_stress_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_stress_test.cc
+deleted file mode 100644
+index 0e97aeed0b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test.cc
+deleted file mode 100644
+index d8d0c57b16..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test_utils.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googlemock/test/gmock_test_utils.py
+deleted file mode 100755
+index 20e3d3d446..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/.gitignore b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/.gitignore
+deleted file mode 100644
+index 4b7be4b91b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CHANGES b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CHANGES
+deleted file mode 100644
+index 0552132421..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CMakeLists.txt
+deleted file mode 100644
+index 621d0f0421..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CONTRIBUTORS b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/CONTRIBUTORS
+deleted file mode 100644
+index feae2fc044..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/LICENSE b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/LICENSE
+deleted file mode 100644
+index 1941a11f8c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/README.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/README.md
+deleted file mode 100644
+index edd4408054..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/build-aux/.keep b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/build-aux/.keep
+deleted file mode 100644
+index e69de29bb2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/cmake/internal_utils.cmake b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/cmake/internal_utils.cmake
+deleted file mode 100644
+index 777b91ed4b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.cbproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.cbproj
+deleted file mode 100644
+index 285bb2a87b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.groupproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest.groupproj
+deleted file mode 100644
+index 849f4c4b81..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_all.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_all.cc
+deleted file mode 100644
+index ba7ad68ad1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_link.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_link.cc
+deleted file mode 100644
+index b955ebf2f9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_main.cbproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_main.cbproj
+deleted file mode 100644
+index fae32cb29b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_unittest.cbproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/codegear/gtest_unittest.cbproj
+deleted file mode 100644
+index 33f7056346..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/configure.ac b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/configure.ac
+deleted file mode 100644
+index cc592e1583..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/AdvancedGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/AdvancedGuide.md
+deleted file mode 100644
+index 93a65200da..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/DevGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/DevGuide.md
+deleted file mode 100644
+index 06467a3277..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Documentation.md
+deleted file mode 100644
+index 8ca1aac759..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/FAQ.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/FAQ.md
+deleted file mode 100644
+index 5fd6cb7238..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Primer.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Primer.md
+deleted file mode 100644
+index 474c1d2ab6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/PumpManual.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/PumpManual.md
+deleted file mode 100644
+index 8184f153ca..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Samples.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/Samples.md
+deleted file mode 100644
+index f21d200567..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_AdvancedGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_AdvancedGuide.md
+deleted file mode 100644
+index 34e19c26fd..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Documentation.md
+deleted file mode 100644
+index 46bba2ec86..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_FAQ.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_FAQ.md
+deleted file mode 100644
+index e870aff000..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Primer.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_Primer.md
+deleted file mode 100644
+index 6960d2ce4c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_PumpManual.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_PumpManual.md
+deleted file mode 100644
+index 15710789dd..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_XcodeGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_5_XcodeGuide.md
+deleted file mode 100644
+index bf24bf51bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_AdvancedGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_AdvancedGuide.md
+deleted file mode 100644
+index 78864b1667..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Documentation.md
+deleted file mode 100644
+index ca924660a3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_FAQ.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_FAQ.md
+deleted file mode 100644
+index 2b7f784077..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Primer.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Primer.md
+deleted file mode 100644
+index 8d840ef45b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_PumpManual.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_PumpManual.md
+deleted file mode 100644
+index 8184f153ca..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Samples.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_Samples.md
+deleted file mode 100644
+index f21d200567..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_XcodeGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_6_XcodeGuide.md
+deleted file mode 100644
+index bf24bf51bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_AdvancedGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_AdvancedGuide.md
+deleted file mode 100644
+index dd4af8f366..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Documentation.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Documentation.md
+deleted file mode 100644
+index 282697a50b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_FAQ.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_FAQ.md
+deleted file mode 100644
+index 3dd914dcf1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Primer.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Primer.md
+deleted file mode 100644
+index b1827c7355..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_PumpManual.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_PumpManual.md
+deleted file mode 100644
+index 8184f153ca..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Samples.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_Samples.md
+deleted file mode 100644
+index f21d200567..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_XcodeGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/V1_7_XcodeGuide.md
+deleted file mode 100644
+index bf24bf51bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/XcodeGuide.md b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/docs/XcodeGuide.md
+deleted file mode 100644
+index bf24bf51bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-death-test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-death-test.h
+deleted file mode 100644
+index 957a69c6a9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-message.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-message.h
+deleted file mode 100644
+index fe879bca79..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h
+deleted file mode 100644
+index 038f9ba79e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-param-test.h.pump
+deleted file mode 100644
+index 3078d6d2a1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-printers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-printers.h
+deleted file mode 100644
+index 8a33164cb3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-spi.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-spi.h
+deleted file mode 100644
+index f63fa9a1b2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-test-part.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-test-part.h
+deleted file mode 100644
+index 77eb844839..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-typed-test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest-typed-test.h
+deleted file mode 100644
+index 5f69d5678e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest.h
+deleted file mode 100644
+index f846c5bd66..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_pred_impl.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_pred_impl.h
+deleted file mode 100644
+index 30ae712f50..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_prod.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/gtest_prod.h
+deleted file mode 100644
+index da80ddc6c7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-port.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-port.h
+deleted file mode 100644
+index 7e744bd3bb..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-printers.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest-printers.h
+deleted file mode 100644
+index 60c1ea050b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/custom/gtest.h
+deleted file mode 100644
+index c27412a898..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-death-test-internal.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-death-test-internal.h
+deleted file mode 100644
+index 2b3a78f5bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-filepath.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-filepath.h
+deleted file mode 100644
+index 7a13b4b0de..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-internal.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-internal.h
+deleted file mode 100644
+index ebd1cf615d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-linked_ptr.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-linked_ptr.h
+deleted file mode 100644
+index 3602942217..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h
+deleted file mode 100644
+index 4d1d81d20f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util-generated.h.pump
+deleted file mode 100644
+index 5c7c47af0b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-param-util.h
+deleted file mode 100644
+index 82cab9b020..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port-arch.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port-arch.h
+deleted file mode 100644
+index 74ab949057..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-port.h
+deleted file mode 100644
+index 0094ed5077..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-string.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-string.h
+deleted file mode 100644
+index 97f1a7fdd2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h
+deleted file mode 100644
+index e9b405340a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-tuple.h.pump
+deleted file mode 100644
+index 429ddfeeca..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h
+deleted file mode 100644
+index e46f7cfcb4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h.pump b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/include/gtest/internal/gtest-type-util.h.pump
+deleted file mode 100644
+index 251fdf025b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/acx_pthread.m4 b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/acx_pthread.m4
+deleted file mode 100644
+index 2cf20de144..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/gtest.m4 b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/m4/gtest.m4
+deleted file mode 100644
+index 6598ba75a4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/prime_tables.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/prime_tables.h
+deleted file mode 100644
+index 92ce16a014..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.cc
+deleted file mode 100644
+index f171e2609d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1.h
+deleted file mode 100644
+index 3dfeb98c45..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample10_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample10_unittest.cc
+deleted file mode 100644
+index 0051cd5dcd..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample1_unittest.cc
+deleted file mode 100644
+index aefc4f1d86..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.cc
+deleted file mode 100644
+index 5f763b9bdf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2.h
+deleted file mode 100644
+index cb485c70fb..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample2_unittest.cc
+deleted file mode 100644
+index 4fa19b71c7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3-inl.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3-inl.h
+deleted file mode 100644
+index 7e3084d638..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample3_unittest.cc
+deleted file mode 100644
+index bf3877d013..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.cc
+deleted file mode 100644
+index ae44bda6f1..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4.h
+deleted file mode 100644
+index cd60f0dd2d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample4_unittest.cc
+deleted file mode 100644
+index fa5afc7d5a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample5_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample5_unittest.cc
+deleted file mode 100644
+index 43d8e57775..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample6_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample6_unittest.cc
+deleted file mode 100644
+index 8f2036a516..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample7_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample7_unittest.cc
+deleted file mode 100644
+index 1b651a21d6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample8_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample8_unittest.cc
+deleted file mode 100644
+index 7274334067..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample9_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/samples/sample9_unittest.cc
+deleted file mode 100644
+index b2e2079bf3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/common.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/common.py
+deleted file mode 100644
+index 3c0347a75b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/fuse_gtest_files.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/fuse_gtest_files.py
+deleted file mode 100755
+index 3f3e9f36d6..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gen_gtest_pred_impl.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gen_gtest_pred_impl.py
+deleted file mode 100755
+index 3e7ab042ea..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gtest-config.in b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/gtest-config.in
+deleted file mode 100755
+index 780f8432ef..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/pump.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/pump.py
+deleted file mode 100755
+index 5efb653c20..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/release_docs.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/release_docs.py
+deleted file mode 100755
+index 1291347f67..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload.py
+deleted file mode 100755
+index 6e6f9a1471..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload_gtest.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/scripts/upload_gtest.py
+deleted file mode 100755
+index be19ae8091..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-all.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-all.cc
+deleted file mode 100644
+index 0a9cee5223..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-death-test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-death-test.cc
+deleted file mode 100644
+index a01a369830..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-filepath.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-filepath.cc
+deleted file mode 100644
+index 0292dc1195..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-internal-inl.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-internal-inl.h
+deleted file mode 100644
+index ed8a682a96..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-port.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-port.cc
+deleted file mode 100644
+index e5bf3dd2be..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-printers.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-printers.cc
+deleted file mode 100644
+index a2df412f8a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-test-part.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-test-part.cc
+deleted file mode 100644
+index fb0e35425e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-typed-test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest-typed-test.cc
+deleted file mode 100644
+index df1eef4754..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest.cc
+deleted file mode 100644
+index d882ab2e36..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest_main.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/src/gtest_main.cc
+deleted file mode 100644
+index f302822552..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_ex_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_ex_test.cc
+deleted file mode 100644
+index b50a13d5e2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-death-test_test.cc
+deleted file mode 100644
+index bb4a3d1b38..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-filepath_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-filepath_test.cc
+deleted file mode 100644
+index da72986926..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-linked_ptr_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-linked_ptr_test.cc
+deleted file mode 100644
+index 6fcf5124a8..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-listener_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-listener_test.cc
+deleted file mode 100644
+index 90747685f0..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-message_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-message_test.cc
+deleted file mode 100644
+index 175238ef4e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-options_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-options_test.cc
+deleted file mode 100644
+index 5586dc3b1b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test2_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test2_test.cc
+deleted file mode 100644
+index 4a782fe708..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.cc
+deleted file mode 100644
+index 8b278bb94b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-param-test_test.h
+deleted file mode 100644
+index 26ea122b10..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-port_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-port_test.cc
+deleted file mode 100644
+index 6ea607bc70..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-printers_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-printers_test.cc
+deleted file mode 100644
+index 3e97cc24ab..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-test-part_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-test-part_test.cc
+deleted file mode 100644
+index ca8ba933ae..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-tuple_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-tuple_test.cc
+deleted file mode 100644
+index bfaa3e0ac4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test2_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test2_test.cc
+deleted file mode 100644
+index c284700b02..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.cc
+deleted file mode 100644
+index 93628ba080..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-typed-test_test.h
+deleted file mode 100644
+index 41d75704cf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-unittest-api_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest-unittest-api_test.cc
+deleted file mode 100644
+index b1f51688af..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_all_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_all_test.cc
+deleted file mode 100644
+index 955aa62828..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest.py
+deleted file mode 100755
+index 78f3e0f53b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_break_on_failure_unittest_.cc
+deleted file mode 100644
+index dd07478c07..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test.py
+deleted file mode 100755
+index e6fc22fd1f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_catch_exceptions_test_.cc
+deleted file mode 100644
+index d0fc82c998..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test.py
+deleted file mode 100755
+index d02a53ed85..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_color_test_.cc
+deleted file mode 100644
+index f61ebb89b8..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test.py
+deleted file mode 100755
+index 424075cfa3..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_env_var_test_.cc
+deleted file mode 100644
+index 539afc9683..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_environment_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_environment_test.cc
+deleted file mode 100644
+index 3cff19e70e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest.py
+deleted file mode 100755
+index ec0b151b11..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_filter_unittest_.cc
+deleted file mode 100644
+index 77deffc38f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test.py
+deleted file mode 100755
+index 093c838d9e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_help_test_.cc
+deleted file mode 100644
+index 31f78c2441..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest.py
+deleted file mode 100755
+index f2d2fd1b1c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_list_tests_unittest_.cc
+deleted file mode 100644
+index 907c176ba9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_main_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_main_unittest.cc
+deleted file mode 100644
+index ecd9bb876f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_no_test_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_no_test_unittest.cc
+deleted file mode 100644
+index 292599af8d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test.py
+deleted file mode 100755
+index 06dbee0980..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_.cc
+deleted file mode 100644
+index 1070a9f26f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_golden_lin.txt b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_output_test_golden_lin.txt
+deleted file mode 100644
+index 2223d560e2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_pred_impl_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_pred_impl_unittest.cc
+deleted file mode 100644
+index a84eff860a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_premature_exit_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_premature_exit_test.cc
+deleted file mode 100644
+index 3b4dc7d43f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_prod_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_prod_test.cc
+deleted file mode 100644
+index 060abce187..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_repeat_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_repeat_test.cc
+deleted file mode 100644
+index 481012adc2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test.py
+deleted file mode 100755
+index 30d0303d19..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_shuffle_test_.cc
+deleted file mode 100644
+index 6fb441bd4d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_sole_header_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_sole_header_test.cc
+deleted file mode 100644
+index ccd091a281..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_stress_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_stress_test.cc
+deleted file mode 100644
+index e7daa430df..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_test_utils.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_test_utils.py
+deleted file mode 100755
+index 4acd36c975..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_ex_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_ex_test.cc
+deleted file mode 100644
+index 8d46c76f16..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test.py
+deleted file mode 100755
+index 3e7740cabb..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_throw_on_failure_test_.cc
+deleted file mode 100644
+index 2b88fe3d9b..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test.py
+deleted file mode 100755
+index 4358370097..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_uninitialized_test_.cc
+deleted file mode 100644
+index 44316987fb..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_unittest.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_unittest.cc
+deleted file mode 100644
+index 88e94134b9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile1_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile1_test_.cc
+deleted file mode 100644
+index 531ced49d4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile2_test_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfile2_test_.cc
+deleted file mode 100644
+index 7b400b2760..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfiles_test.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_outfiles_test.py
+deleted file mode 100755
+index 524e437e6c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest.py
+deleted file mode 100755
+index bcd5975991..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest_.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_output_unittest_.cc
+deleted file mode 100644
+index 48b8771b52..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_test_utils.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/gtest_xml_test_utils.py
+deleted file mode 100755
+index 341956b54d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.cc
+deleted file mode 100644
+index 8b8a40b44e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/test/production.h
+deleted file mode 100644
+index 98fd5e476c..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/DebugProject.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/DebugProject.xcconfig
+deleted file mode 100644
+index 3d68157d5d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/FrameworkTarget.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/FrameworkTarget.xcconfig
+deleted file mode 100644
+index 357b1c8fbf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/General.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/General.xcconfig
+deleted file mode 100644
+index f23e322272..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/ReleaseProject.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/ReleaseProject.xcconfig
+deleted file mode 100644
+index 5349f0a04a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/StaticLibraryTarget.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/StaticLibraryTarget.xcconfig
+deleted file mode 100644
+index 3922fa51d5..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/TestTarget.xcconfig b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Config/TestTarget.xcconfig
+deleted file mode 100644
+index e6652ba859..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Resources/Info.plist b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Resources/Info.plist
+deleted file mode 100644
+index 9dd28ea148..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/Info.plist b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/Info.plist
+deleted file mode 100644
+index f3852edea2..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj
+deleted file mode 100644
+index 497617eb68..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/runtests.sh b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/runtests.sh
+deleted file mode 100644
+index 4a0d413e52..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.cc
+deleted file mode 100644
+index bfc4e7fcfd..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.h b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget.h
+deleted file mode 100644
+index 0c55cdc8cf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget_test.cc b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Samples/FrameworkSample/widget_test.cc
+deleted file mode 100644
+index 8725994218..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/runtests.sh b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/runtests.sh
+deleted file mode 100644
+index 3fc229f1d4..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/versiongenerate.py b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/Scripts/versiongenerate.py
+deleted file mode 100755
+index 81de8c96ac..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/gtest.xcodeproj/project.pbxproj b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/googletest/xcode/gtest.xcodeproj/project.pbxproj
+deleted file mode 100644
+index aefaa88b05..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/travis.sh b/src/libs/3rdparty/yaml-cpp/test/gtest-1.8.0/travis.sh
+deleted file mode 100755
+index bdecbd964d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/handler_test.h b/src/libs/3rdparty/yaml-cpp/test/handler_test.h
+deleted file mode 100644
+index 668a58d01e..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/emitter_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/emitter_test.cpp
+deleted file mode 100644
+index 27808380d5..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/encoding_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/encoding_test.cpp
+deleted file mode 100644
+index 9bd6586378..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/gen_emitter_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/gen_emitter_test.cpp
+deleted file mode 100644
+index e44eee6da7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/handler_spec_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/handler_spec_test.cpp
+deleted file mode 100644
+index d142a0d302..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/handler_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/handler_test.cpp
+deleted file mode 100644
+index 6011460713..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/load_node_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/load_node_test.cpp
+deleted file mode 100644
+index 02bb8fe58d..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/integration/node_spec_test.cpp b/src/libs/3rdparty/yaml-cpp/test/integration/node_spec_test.cpp
+deleted file mode 100644
+index aedf38b2bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/main.cpp b/src/libs/3rdparty/yaml-cpp/test/main.cpp
+deleted file mode 100644
+index 443e2dbb3f..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/mock_event_handler.h b/src/libs/3rdparty/yaml-cpp/test/mock_event_handler.h
+deleted file mode 100644
+index 49d1f0c334..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/node/node_test.cpp b/src/libs/3rdparty/yaml-cpp/test/node/node_test.cpp
+deleted file mode 100644
+index 485ad09e1a..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/ostream_wrapper_test.cpp b/src/libs/3rdparty/yaml-cpp/test/ostream_wrapper_test.cpp
+deleted file mode 100644
+index cdc1f05083..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/regex_test.cpp b/src/libs/3rdparty/yaml-cpp/test/regex_test.cpp
+deleted file mode 100644
+index 7589d2e4bf..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/test/specexamples.h b/src/libs/3rdparty/yaml-cpp/test/specexamples.h
+deleted file mode 100644
+index 3c81c77791..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/util/CMakeLists.txt b/src/libs/3rdparty/yaml-cpp/util/CMakeLists.txt
+deleted file mode 100644
+index 22866273c7..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/util/api.cpp b/src/libs/3rdparty/yaml-cpp/util/api.cpp
+deleted file mode 100644
+index 8ae5ff2978..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/util/parse.cpp b/src/libs/3rdparty/yaml-cpp/util/parse.cpp
+deleted file mode 100644
+index f3f0279ce5..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/util/read.cpp b/src/libs/3rdparty/yaml-cpp/util/read.cpp
+deleted file mode 100644
+index fc88f1f9b9..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/util/sandbox.cpp b/src/libs/3rdparty/yaml-cpp/util/sandbox.cpp
+deleted file mode 100644
+index 1df25bb242..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp-config-version.cmake.in b/src/libs/3rdparty/yaml-cpp/yaml-cpp-config-version.cmake.in
+deleted file mode 100644
+index 80b9c79add..0000000000
+diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp-config.cmake.in b/src/libs/3rdparty/yaml-cpp/yaml-cpp-config.cmake.in
+deleted file mode 100644
+index 7b41e3f30c..0000000000
+--
+2.17.1
+
diff --git a/src/libs/3rdparty/yaml-cpp/patches/0002-yaml-cpp-Make-dll.h-compatible-with-fvisibility-hidd.patch b/src/libs/3rdparty/yaml-cpp/patches/0002-yaml-cpp-Make-dll.h-compatible-with-fvisibility-hidd.patch
new file mode 100644
index 0000000000..90d684b9c1
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/patches/0002-yaml-cpp-Make-dll.h-compatible-with-fvisibility-hidd.patch
@@ -0,0 +1,42 @@
+From 72546402c08fc548efb248761870a83e78eb5ea3 Mon Sep 17 00:00:00 2001
+From: Nikolai Kosjar <nikolai.kosjar@qt.io>
+Date: Wed, 31 Jul 2019 09:08:55 +0200
+Subject: [PATCH] yaml-cpp: Make dll.h compatible with -fvisibility=hidden
+
+Change-Id: Ic09ace43e37102294d290768b3a7994c7a6b42c6
+---
+ src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
+index a32c06b2e3..897f1533df 100644
+--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
++++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
+@@ -18,13 +18,22 @@
+
+ #ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
+ // manually)
++
++#if defined(_WIN32) || defined(WIN32)
++# define YAML_CPP_API_IMPORT __declspec(dllimport)
++# define YAML_CPP_API_EXPORT __declspec(dllexport)
++#else
++# define YAML_CPP_API_IMPORT __attribute__((visibility("default")))
++# define YAML_CPP_API_EXPORT __attribute__((visibility("default")))
++#endif
++
+ #ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
+ // or defined manually)
+ // #pragma message( "Defining YAML_CPP_API for DLL export" )
+-#define YAML_CPP_API __declspec(dllexport)
++#define YAML_CPP_API YAML_CPP_API_EXPORT
+ #else // yaml_cpp_EXPORTS
+ // #pragma message( "Defining YAML_CPP_API for DLL import" )
+-#define YAML_CPP_API __declspec(dllimport)
++#define YAML_CPP_API YAML_CPP_API_IMPORT
+ #endif // yaml_cpp_EXPORTS
+ #else // YAML_CPP_DLL
+ #define YAML_CPP_API
+--
+2.17.1
+
diff --git a/src/libs/3rdparty/yaml-cpp/patches/0003-yaml-cpp-MSVC-Fix-unknown-override-specifier-for-_NO.patch b/src/libs/3rdparty/yaml-cpp/patches/0003-yaml-cpp-MSVC-Fix-unknown-override-specifier-for-_NO.patch
new file mode 100644
index 0000000000..ab7929f964
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/patches/0003-yaml-cpp-MSVC-Fix-unknown-override-specifier-for-_NO.patch
@@ -0,0 +1,52 @@
+From b6f98df7d1ebdd788e7b5029c3884dcf38a6f17d Mon Sep 17 00:00:00 2001
+From: Nikolai Kosjar <nikolai.kosjar@qt.io>
+Date: Tue, 27 Aug 2019 12:01:03 +0200
+Subject: [PATCH] yaml-cpp: MSVC: Fix "unknown override specifier" for
+ _NOEXCEPT
+
+Change-Id: If07000f7b3e8c4c1b87b683ff9cd29e57d43ab60
+---
+ src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h | 8 +-------
+ src/libs/3rdparty/yaml-cpp/src/exceptions.cpp | 8 +-------
+ 2 files changed, 2 insertions(+), 14 deletions(-)
+
+diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
+index 9c96859b2c..eae31968b7 100644
+--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
++++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
+@@ -13,13 +13,7 @@
+ #include <stdexcept>
+ #include <string>
+
+-// This is here for compatibility with older versions of Visual Studio
+-// which don't support noexcept
+-#ifdef _MSC_VER
+- #define YAML_CPP_NOEXCEPT _NOEXCEPT
+-#else
+- #define YAML_CPP_NOEXCEPT noexcept
+-#endif
++#define YAML_CPP_NOEXCEPT noexcept
+
+ namespace YAML {
+ // error messages
+diff --git a/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp b/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp
+index 9b6d8912c1..d5e10b23c1 100644
+--- a/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp
++++ b/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp
+@@ -1,12 +1,6 @@
+ #include "yaml-cpp/exceptions.h"
+
+-// This is here for compatibility with older versions of Visual Studio
+-// which don't support noexcept
+-#ifdef _MSC_VER
+- #define YAML_CPP_NOEXCEPT _NOEXCEPT
+-#else
+- #define YAML_CPP_NOEXCEPT noexcept
+-#endif
++#define YAML_CPP_NOEXCEPT noexcept
+
+ namespace YAML {
+
+--
+2.17.1
+
diff --git a/src/libs/3rdparty/yaml-cpp/src/binary.cpp b/src/libs/3rdparty/yaml-cpp/src/binary.cpp
new file mode 100644
index 0000000000..a7e51301b8
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/binary.cpp
@@ -0,0 +1,93 @@
+#include "yaml-cpp/binary.h"
+
+namespace YAML {
+static const char encoding[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+std::string EncodeBase64(const unsigned char *data, std::size_t size) {
+ const char PAD = '=';
+
+ std::string ret;
+ ret.resize(4 * size / 3 + 3);
+ char *out = &ret[0];
+
+ std::size_t chunks = size / 3;
+ std::size_t remainder = size % 3;
+
+ for (std::size_t i = 0; i < chunks; i++, data += 3) {
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)];
+ *out++ = encoding[((data[1] & 0xf) << 2) | (data[2] >> 6)];
+ *out++ = encoding[data[2] & 0x3f];
+ }
+
+ switch (remainder) {
+ case 0:
+ break;
+ case 1:
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4)];
+ *out++ = PAD;
+ *out++ = PAD;
+ break;
+ case 2:
+ *out++ = encoding[data[0] >> 2];
+ *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)];
+ *out++ = encoding[((data[1] & 0xf) << 2)];
+ *out++ = PAD;
+ break;
+ }
+
+ ret.resize(out - &ret[0]);
+ return ret;
+}
+
+static const unsigned char decoding[] = {
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
+ 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
+ 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255,
+};
+
+std::vector<unsigned char> DecodeBase64(const std::string &input) {
+ typedef std::vector<unsigned char> ret_type;
+ if (input.empty())
+ return ret_type();
+
+ ret_type ret(3 * input.size() / 4 + 1);
+ unsigned char *out = &ret[0];
+
+ unsigned value = 0;
+ for (std::size_t i = 0; i < input.size(); i++) {
+ unsigned char d = decoding[static_cast<unsigned>(input[i])];
+ if (d == 255)
+ return ret_type();
+
+ value = (value << 6) | d;
+ if (i % 4 == 3) {
+ *out++ = value >> 16;
+ if (i > 0 && input[i - 1] != '=')
+ *out++ = value >> 8;
+ if (input[i] != '=')
+ *out++ = value;
+ }
+ }
+
+ ret.resize(out - &ret[0]);
+ return ret;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/collectionstack.h b/src/libs/3rdparty/yaml-cpp/src/collectionstack.h
new file mode 100644
index 0000000000..2302786e03
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/collectionstack.h
@@ -0,0 +1,39 @@
+#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <stack>
+#include <cassert>
+
+namespace YAML {
+struct CollectionType {
+ enum value { NoCollection, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap };
+};
+
+class CollectionStack {
+ public:
+ CollectionType::value GetCurCollectionType() const {
+ if (collectionStack.empty())
+ return CollectionType::NoCollection;
+ return collectionStack.top();
+ }
+
+ void PushCollectionType(CollectionType::value type) {
+ collectionStack.push(type);
+ }
+ void PopCollectionType(CollectionType::value type) {
+ assert(type == GetCurCollectionType());
+ collectionStack.pop();
+ }
+
+ private:
+ std::stack<CollectionType::value> collectionStack;
+};
+}
+
+#endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/convert.cpp b/src/libs/3rdparty/yaml-cpp/src/convert.cpp
new file mode 100644
index 0000000000..ec05b77826
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/convert.cpp
@@ -0,0 +1,75 @@
+#include <algorithm>
+
+#include "yaml-cpp/node/convert.h"
+
+namespace {
+// we're not gonna mess with the mess that is all the isupper/etc. functions
+bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; }
+bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; }
+char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; }
+
+std::string tolower(const std::string& str) {
+ std::string s(str);
+ std::transform(s.begin(), s.end(), s.begin(), ToLower);
+ return s;
+}
+
+template <typename T>
+bool IsEntirely(const std::string& str, T func) {
+ for (std::size_t i = 0; i < str.size(); i++)
+ if (!func(str[i]))
+ return false;
+
+ return true;
+}
+
+// IsFlexibleCase
+// . Returns true if 'str' is:
+// . UPPERCASE
+// . lowercase
+// . Capitalized
+bool IsFlexibleCase(const std::string& str) {
+ if (str.empty())
+ return true;
+
+ if (IsEntirely(str, IsLower))
+ return true;
+
+ bool firstcaps = IsUpper(str[0]);
+ std::string rest = str.substr(1);
+ return firstcaps && (IsEntirely(rest, IsLower) || IsEntirely(rest, IsUpper));
+}
+}
+
+namespace YAML {
+bool convert<bool>::decode(const Node& node, bool& rhs) {
+ if (!node.IsScalar())
+ return false;
+
+ // we can't use iostream bool extraction operators as they don't
+ // recognize all possible values in the table below (taken from
+ // http://yaml.org/type/bool.html)
+ static const struct {
+ std::string truename, falsename;
+ } names[] = {
+ {"y", "n"}, {"yes", "no"}, {"true", "false"}, {"on", "off"},
+ };
+
+ if (!IsFlexibleCase(node.Scalar()))
+ return false;
+
+ for (unsigned i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
+ if (names[i].truename == tolower(node.Scalar())) {
+ rhs = true;
+ return true;
+ }
+
+ if (names[i].falsename == tolower(node.Scalar())) {
+ rhs = false;
+ return true;
+ }
+ }
+
+ return false;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/directives.cpp b/src/libs/3rdparty/yaml-cpp/src/directives.cpp
new file mode 100644
index 0000000000..963bd2cd37
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/directives.cpp
@@ -0,0 +1,22 @@
+#include "directives.h"
+
+namespace YAML {
+Directives::Directives() {
+ // version
+ version.isDefault = true;
+ version.major = 1;
+ version.minor = 2;
+}
+
+const std::string Directives::TranslateTagHandle(
+ const std::string& handle) const {
+ std::map<std::string, std::string>::const_iterator it = tags.find(handle);
+ if (it == tags.end()) {
+ if (handle == "!!")
+ return "tag:yaml.org,2002:";
+ return handle;
+ }
+
+ return it->second;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/directives.h b/src/libs/3rdparty/yaml-cpp/src/directives.h
new file mode 100644
index 0000000000..333af26e37
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/directives.h
@@ -0,0 +1,29 @@
+#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <map>
+
+namespace YAML {
+struct Version {
+ bool isDefault;
+ int major, minor;
+};
+
+struct Directives {
+ Directives();
+
+ const std::string TranslateTagHandle(const std::string& handle) const;
+
+ Version version;
+ std::map<std::string, std::string> tags;
+};
+}
+
+#endif // DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/emit.cpp b/src/libs/3rdparty/yaml-cpp/src/emit.cpp
new file mode 100644
index 0000000000..51bc791533
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emit.cpp
@@ -0,0 +1,25 @@
+#include "yaml-cpp/node/emit.h"
+#include "yaml-cpp/emitfromevents.h"
+#include "yaml-cpp/emitter.h"
+#include "nodeevents.h"
+
+namespace YAML {
+Emitter& operator<<(Emitter& out, const Node& node) {
+ EmitFromEvents emitFromEvents(out);
+ NodeEvents events(node);
+ events.Emit(emitFromEvents);
+ return out;
+}
+
+std::ostream& operator<<(std::ostream& out, const Node& node) {
+ Emitter emitter(out);
+ emitter << node;
+ return out;
+}
+
+std::string Dump(const Node& node) {
+ Emitter emitter;
+ emitter << node;
+ return emitter.c_str();
+}
+} // namespace YAML
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitfromevents.cpp b/src/libs/3rdparty/yaml-cpp/src/emitfromevents.cpp
new file mode 100644
index 0000000000..4832649f3c
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitfromevents.cpp
@@ -0,0 +1,119 @@
+#include <cassert>
+#include <sstream>
+
+#include "yaml-cpp/emitfromevents.h"
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace {
+std::string ToString(YAML::anchor_t anchor) {
+ std::stringstream stream;
+ stream << anchor;
+ return stream.str();
+}
+}
+
+namespace YAML {
+EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter) {}
+
+void EmitFromEvents::OnDocumentStart(const Mark&) {}
+
+void EmitFromEvents::OnDocumentEnd() {}
+
+void EmitFromEvents::OnNull(const Mark&, anchor_t anchor) {
+ BeginNode();
+ EmitProps("", anchor);
+ m_emitter << Null;
+}
+
+void EmitFromEvents::OnAlias(const Mark&, anchor_t anchor) {
+ BeginNode();
+ m_emitter << Alias(ToString(anchor));
+}
+
+void EmitFromEvents::OnScalar(const Mark&, const std::string& tag,
+ anchor_t anchor, const std::string& value) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ m_emitter << value;
+}
+
+void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag,
+ anchor_t anchor,
+ EmitterStyle::value style) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ switch (style) {
+ case EmitterStyle::Block:
+ m_emitter << Block;
+ break;
+ case EmitterStyle::Flow:
+ m_emitter << Flow;
+ break;
+ default:
+ break;
+ }
+ m_emitter << BeginSeq;
+ m_stateStack.push(State::WaitingForSequenceEntry);
+}
+
+void EmitFromEvents::OnSequenceEnd() {
+ m_emitter << EndSeq;
+ assert(m_stateStack.top() == State::WaitingForSequenceEntry);
+ m_stateStack.pop();
+}
+
+void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ BeginNode();
+ EmitProps(tag, anchor);
+ switch (style) {
+ case EmitterStyle::Block:
+ m_emitter << Block;
+ break;
+ case EmitterStyle::Flow:
+ m_emitter << Flow;
+ break;
+ default:
+ break;
+ }
+ m_emitter << BeginMap;
+ m_stateStack.push(State::WaitingForKey);
+}
+
+void EmitFromEvents::OnMapEnd() {
+ m_emitter << EndMap;
+ assert(m_stateStack.top() == State::WaitingForKey);
+ m_stateStack.pop();
+}
+
+void EmitFromEvents::BeginNode() {
+ if (m_stateStack.empty())
+ return;
+
+ switch (m_stateStack.top()) {
+ case State::WaitingForKey:
+ m_emitter << Key;
+ m_stateStack.top() = State::WaitingForValue;
+ break;
+ case State::WaitingForValue:
+ m_emitter << Value;
+ m_stateStack.top() = State::WaitingForKey;
+ break;
+ default:
+ break;
+ }
+}
+
+void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
+ if (!tag.empty() && tag != "?" && tag != "!")
+ m_emitter << VerbatimTag(tag);
+ if (anchor)
+ m_emitter << Anchor(ToString(anchor));
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitter.cpp b/src/libs/3rdparty/yaml-cpp/src/emitter.cpp
new file mode 100644
index 0000000000..ebeb059554
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitter.cpp
@@ -0,0 +1,911 @@
+#include <sstream>
+
+#include "emitterutils.h"
+#include "indentation.h" // IWYU pragma: keep
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+class Binary;
+struct _Null;
+
+Emitter::Emitter() : m_pState(new EmitterState) {}
+
+Emitter::Emitter(std::ostream& stream)
+ : m_pState(new EmitterState), m_stream(stream) {}
+
+Emitter::~Emitter() {}
+
+const char* Emitter::c_str() const { return m_stream.str(); }
+
+std::size_t Emitter::size() const { return m_stream.pos(); }
+
+// state checking
+bool Emitter::good() const { return m_pState->good(); }
+
+const std::string Emitter::GetLastError() const {
+ return m_pState->GetLastError();
+}
+
+// global setters
+bool Emitter::SetOutputCharset(EMITTER_MANIP value) {
+ return m_pState->SetOutputCharset(value, FmtScope::Global);
+}
+
+bool Emitter::SetStringFormat(EMITTER_MANIP value) {
+ return m_pState->SetStringFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetBoolFormat(EMITTER_MANIP value) {
+ bool ok = false;
+ if (m_pState->SetBoolFormat(value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetBoolCaseFormat(value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetBoolLengthFormat(value, FmtScope::Global))
+ ok = true;
+ return ok;
+}
+
+bool Emitter::SetIntBase(EMITTER_MANIP value) {
+ return m_pState->SetIntFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetSeqFormat(EMITTER_MANIP value) {
+ return m_pState->SetFlowType(GroupType::Seq, value, FmtScope::Global);
+}
+
+bool Emitter::SetMapFormat(EMITTER_MANIP value) {
+ bool ok = false;
+ if (m_pState->SetFlowType(GroupType::Map, value, FmtScope::Global))
+ ok = true;
+ if (m_pState->SetMapKeyFormat(value, FmtScope::Global))
+ ok = true;
+ return ok;
+}
+
+bool Emitter::SetIndent(std::size_t n) {
+ return m_pState->SetIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPreCommentIndent(std::size_t n) {
+ return m_pState->SetPreCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPostCommentIndent(std::size_t n) {
+ return m_pState->SetPostCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetFloatPrecision(std::size_t n) {
+ return m_pState->SetFloatPrecision(n, FmtScope::Global);
+}
+
+bool Emitter::SetDoublePrecision(std::size_t n) {
+ return m_pState->SetDoublePrecision(n, FmtScope::Global);
+}
+
+// SetLocalValue
+// . Either start/end a group, or set a modifier locally
+Emitter& Emitter::SetLocalValue(EMITTER_MANIP value) {
+ if (!good())
+ return *this;
+
+ switch (value) {
+ case BeginDoc:
+ EmitBeginDoc();
+ break;
+ case EndDoc:
+ EmitEndDoc();
+ break;
+ case BeginSeq:
+ EmitBeginSeq();
+ break;
+ case EndSeq:
+ EmitEndSeq();
+ break;
+ case BeginMap:
+ EmitBeginMap();
+ break;
+ case EndMap:
+ EmitEndMap();
+ break;
+ case Key:
+ case Value:
+ // deprecated (these can be deduced by the parity of nodes in a map)
+ break;
+ case TagByKind:
+ EmitKindTag();
+ break;
+ case Newline:
+ EmitNewline();
+ break;
+ default:
+ m_pState->SetLocalValue(value);
+ break;
+ }
+ return *this;
+}
+
+Emitter& Emitter::SetLocalIndent(const _Indent& indent) {
+ m_pState->SetIndent(indent.value, FmtScope::Local);
+ return *this;
+}
+
+Emitter& Emitter::SetLocalPrecision(const _Precision& precision) {
+ if (precision.floatPrecision >= 0)
+ m_pState->SetFloatPrecision(precision.floatPrecision, FmtScope::Local);
+ if (precision.doublePrecision >= 0)
+ m_pState->SetDoublePrecision(precision.doublePrecision, FmtScope::Local);
+ return *this;
+}
+
+// EmitBeginDoc
+void Emitter::EmitBeginDoc() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupType() != GroupType::NoType) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_stream.col() > 0)
+ m_stream << "\n";
+ m_stream << "---\n";
+
+ m_pState->StartedDoc();
+}
+
+// EmitEndDoc
+void Emitter::EmitEndDoc() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupType() != GroupType::NoType) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError("Unexpected begin document");
+ return;
+ }
+
+ if (m_stream.col() > 0)
+ m_stream << "\n";
+ m_stream << "...\n";
+}
+
+// EmitBeginSeq
+void Emitter::EmitBeginSeq() {
+ if (!good())
+ return;
+
+ PrepareNode(m_pState->NextGroupType(GroupType::Seq));
+
+ m_pState->StartedGroup(GroupType::Seq);
+}
+
+// EmitEndSeq
+void Emitter::EmitEndSeq() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupChildCount() == 0)
+ m_pState->ForceFlow();
+
+ if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(m_pState->CurIndent());
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "[";
+ m_stream << "]";
+ }
+
+ m_pState->EndedGroup(GroupType::Seq);
+}
+
+// EmitBeginMap
+void Emitter::EmitBeginMap() {
+ if (!good())
+ return;
+
+ PrepareNode(m_pState->NextGroupType(GroupType::Map));
+
+ m_pState->StartedGroup(GroupType::Map);
+}
+
+// EmitEndMap
+void Emitter::EmitEndMap() {
+ if (!good())
+ return;
+
+ if (m_pState->CurGroupChildCount() == 0)
+ m_pState->ForceFlow();
+
+ if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(m_pState->CurIndent());
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{";
+ m_stream << "}";
+ }
+
+ m_pState->EndedGroup(GroupType::Map);
+}
+
+// EmitNewline
+void Emitter::EmitNewline() {
+ if (!good())
+ return;
+
+ PrepareNode(EmitterNodeType::NoType);
+ m_stream << "\n";
+ m_pState->SetNonContent();
+}
+
+bool Emitter::CanEmitNewline() const { return true; }
+
+// Put the stream in a state so we can simply write the next node
+// E.g., if we're in a sequence, write the "- "
+void Emitter::PrepareNode(EmitterNodeType::value child) {
+ switch (m_pState->CurGroupNodeType()) {
+ case EmitterNodeType::NoType:
+ PrepareTopNode(child);
+ break;
+ case EmitterNodeType::FlowSeq:
+ FlowSeqPrepareNode(child);
+ break;
+ case EmitterNodeType::BlockSeq:
+ BlockSeqPrepareNode(child);
+ break;
+ case EmitterNodeType::FlowMap:
+ FlowMapPrepareNode(child);
+ break;
+ case EmitterNodeType::BlockMap:
+ BlockMapPrepareNode(child);
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::PrepareTopNode(EmitterNodeType::value child) {
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0) {
+ if (child != EmitterNodeType::NoType)
+ EmitBeginDoc();
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ // TODO: if we were writing null, and
+ // we wanted it blank, we wouldn't want a space
+ SpaceOrIndentTo(m_pState->HasBegunContent(), 0);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ if (m_pState->HasBegunNode())
+ m_stream << "\n";
+ break;
+ }
+}
+
+void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "[";
+ else
+ m_stream << ",";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ if (m_pState->CurGroupChildCount() > 0 || m_stream.comment()) {
+ m_stream << "\n";
+ }
+ m_stream << IndentTo(curIndent);
+ m_stream << "-";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(m_pState->HasBegunContent(), nextIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ m_stream << "\n";
+ break;
+ case EmitterNodeType::BlockMap:
+ if (m_pState->HasBegunContent() || m_stream.comment())
+ m_stream << "\n";
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) {
+ if (m_pState->CurGroupChildCount() % 2 == 0) {
+ if (m_pState->GetMapKeyFormat() == LongKey)
+ m_pState->SetLongKey();
+
+ if (m_pState->CurGroupLongKey())
+ FlowMapPrepareLongKey(child);
+ else
+ FlowMapPrepareSimpleKey(child);
+ } else {
+ if (m_pState->CurGroupLongKey())
+ FlowMapPrepareLongKeyValue(child);
+ else
+ FlowMapPrepareSimpleKeyValue(child);
+ }
+}
+
+void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{ ?";
+ else
+ m_stream << ", ?";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ if (m_pState->CurGroupChildCount() == 0)
+ m_stream << "{";
+ else
+ m_stream << ",";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+ const std::size_t lastIndent = m_pState->LastIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ m_stream << IndentTo(lastIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(
+ m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+ lastIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ assert(false);
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
+ if (m_pState->CurGroupChildCount() % 2 == 0) {
+ if (m_pState->GetMapKeyFormat() == LongKey)
+ m_pState->SetLongKey();
+ if (child == EmitterNodeType::BlockSeq ||
+ child == EmitterNodeType::BlockMap)
+ m_pState->SetLongKey();
+
+ if (m_pState->CurGroupLongKey())
+ BlockMapPrepareLongKey(child);
+ else
+ BlockMapPrepareSimpleKey(child);
+ } else {
+ if (m_pState->CurGroupLongKey())
+ BlockMapPrepareLongKeyValue(child);
+ else
+ BlockMapPrepareSimpleKeyValue(child);
+ }
+}
+
+void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t childCount = m_pState->CurGroupChildCount();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ if (childCount > 0) {
+ m_stream << "\n";
+ }
+ if (m_stream.comment()) {
+ m_stream << "\n";
+ }
+ m_stream << IndentTo(curIndent);
+ m_stream << "?";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(true, curIndent + 1);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunContent()) {
+ m_stream << "\n";
+ m_stream << IndentTo(curIndent);
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ SpaceOrIndentTo(true, curIndent + 1);
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t childCount = m_pState->CurGroupChildCount();
+
+ if (child == EmitterNodeType::NoType)
+ return;
+
+ if (!m_pState->HasBegunNode()) {
+ if (childCount > 0) {
+ m_stream << "\n";
+ }
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(m_pState->HasBegunContent(), curIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ break;
+ }
+}
+
+void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+ const std::size_t curIndent = m_pState->CurIndent();
+ const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+ if (!m_pState->HasBegunNode()) {
+ m_stream << ":";
+ }
+
+ switch (child) {
+ case EmitterNodeType::NoType:
+ break;
+ case EmitterNodeType::Property:
+ case EmitterNodeType::Scalar:
+ case EmitterNodeType::FlowSeq:
+ case EmitterNodeType::FlowMap:
+ SpaceOrIndentTo(true, nextIndent);
+ break;
+ case EmitterNodeType::BlockSeq:
+ case EmitterNodeType::BlockMap:
+ m_stream << "\n";
+ break;
+ }
+}
+
+// SpaceOrIndentTo
+// . Prepares for some more content by proper spacing
+void Emitter::SpaceOrIndentTo(bool requireSpace, std::size_t indent) {
+ if (m_stream.comment())
+ m_stream << "\n";
+ if (m_stream.col() > 0 && requireSpace)
+ m_stream << " ";
+ m_stream << IndentTo(indent);
+}
+
+void Emitter::PrepareIntegralStream(std::stringstream& stream) const {
+
+ switch (m_pState->GetIntFormat()) {
+ case Dec:
+ stream << std::dec;
+ break;
+ case Hex:
+ stream << "0x";
+ stream << std::hex;
+ break;
+ case Oct:
+ stream << "0";
+ stream << std::oct;
+ break;
+ default:
+ assert(false);
+ }
+}
+
+void Emitter::StartedScalar() { m_pState->StartedScalar(); }
+
+// *******************************************************************************************
+// overloads of Write
+
+Emitter& Emitter::Write(const std::string& str) {
+ if (!good())
+ return *this;
+
+ const bool escapeNonAscii = m_pState->GetOutputCharset() == EscapeNonAscii;
+ const StringFormat::value strFormat =
+ Utils::ComputeStringFormat(str, m_pState->GetStringFormat(),
+ m_pState->CurGroupFlowType(), escapeNonAscii);
+
+ if (strFormat == StringFormat::Literal)
+ m_pState->SetMapKeyFormat(YAML::LongKey, FmtScope::Local);
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ switch (strFormat) {
+ case StringFormat::Plain:
+ m_stream << str;
+ break;
+ case StringFormat::SingleQuoted:
+ Utils::WriteSingleQuotedString(m_stream, str);
+ break;
+ case StringFormat::DoubleQuoted:
+ Utils::WriteDoubleQuotedString(m_stream, str, escapeNonAscii);
+ break;
+ case StringFormat::Literal:
+ Utils::WriteLiteralString(m_stream, str,
+ m_pState->CurIndent() + m_pState->GetIndent());
+ break;
+ }
+
+ StartedScalar();
+
+ return *this;
+}
+
+std::size_t Emitter::GetFloatPrecision() const {
+ return m_pState->GetFloatPrecision();
+}
+
+std::size_t Emitter::GetDoublePrecision() const {
+ return m_pState->GetDoublePrecision();
+}
+
+const char* Emitter::ComputeFullBoolName(bool b) const {
+ const EMITTER_MANIP mainFmt = (m_pState->GetBoolLengthFormat() == ShortBool
+ ? YesNoBool
+ : m_pState->GetBoolFormat());
+ const EMITTER_MANIP caseFmt = m_pState->GetBoolCaseFormat();
+ switch (mainFmt) {
+ case YesNoBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "YES" : "NO";
+ case CamelCase:
+ return b ? "Yes" : "No";
+ case LowerCase:
+ return b ? "yes" : "no";
+ default:
+ break;
+ }
+ break;
+ case OnOffBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "ON" : "OFF";
+ case CamelCase:
+ return b ? "On" : "Off";
+ case LowerCase:
+ return b ? "on" : "off";
+ default:
+ break;
+ }
+ break;
+ case TrueFalseBool:
+ switch (caseFmt) {
+ case UpperCase:
+ return b ? "TRUE" : "FALSE";
+ case CamelCase:
+ return b ? "True" : "False";
+ case LowerCase:
+ return b ? "true" : "false";
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return b ? "y" : "n"; // should never get here, but it can't hurt to give
+ // these answers
+}
+
+Emitter& Emitter::Write(bool b) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ const char* name = ComputeFullBoolName(b);
+ if (m_pState->GetBoolLengthFormat() == ShortBool)
+ m_stream << name[0];
+ else
+ m_stream << name;
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(char ch) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+ Utils::WriteChar(m_stream, ch);
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Alias& alias) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasAnchor() || m_pState->HasTag()) {
+ m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ if (!Utils::WriteAlias(m_stream, alias.content)) {
+ m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+ return *this;
+ }
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Anchor& anchor) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasAnchor()) {
+ m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Property);
+
+ if (!Utils::WriteAnchor(m_stream, anchor.content)) {
+ m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+ return *this;
+ }
+
+ m_pState->SetAnchor();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Tag& tag) {
+ if (!good())
+ return *this;
+
+ if (m_pState->HasTag()) {
+ m_pState->SetError(ErrorMsg::INVALID_TAG);
+ return *this;
+ }
+
+ PrepareNode(EmitterNodeType::Property);
+
+ bool success = false;
+ if (tag.type == _Tag::Type::Verbatim)
+ success = Utils::WriteTag(m_stream, tag.content, true);
+ else if (tag.type == _Tag::Type::PrimaryHandle)
+ success = Utils::WriteTag(m_stream, tag.content, false);
+ else
+ success = Utils::WriteTagWithPrefix(m_stream, tag.prefix, tag.content);
+
+ if (!success) {
+ m_pState->SetError(ErrorMsg::INVALID_TAG);
+ return *this;
+ }
+
+ m_pState->SetTag();
+
+ return *this;
+}
+
+void Emitter::EmitKindTag() { Write(LocalTag("")); }
+
+Emitter& Emitter::Write(const _Comment& comment) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::NoType);
+
+ if (m_stream.col() > 0)
+ m_stream << Indentation(m_pState->GetPreCommentIndent());
+ Utils::WriteComment(m_stream, comment.content,
+ m_pState->GetPostCommentIndent());
+
+ m_pState->SetNonContent();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const _Null& /*null*/) {
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+
+ m_stream << "~";
+
+ StartedScalar();
+
+ return *this;
+}
+
+Emitter& Emitter::Write(const Binary& binary) {
+ Write(SecondaryTag("binary"));
+
+ if (!good())
+ return *this;
+
+ PrepareNode(EmitterNodeType::Scalar);
+ Utils::WriteBinary(m_stream, binary);
+ StartedScalar();
+
+ return *this;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitterstate.cpp b/src/libs/3rdparty/yaml-cpp/src/emitterstate.cpp
new file mode 100644
index 0000000000..3542aaf507
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitterstate.cpp
@@ -0,0 +1,365 @@
+#include <limits>
+
+#include "emitterstate.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+EmitterState::EmitterState()
+ : m_isGood(true),
+ m_curIndent(0),
+ m_hasAnchor(false),
+ m_hasTag(false),
+ m_hasNonContent(false),
+ m_docCount(0) {
+ // set default global manipulators
+ m_charset.set(EmitNonAscii);
+ m_strFmt.set(Auto);
+ m_boolFmt.set(TrueFalseBool);
+ m_boolLengthFmt.set(LongBool);
+ m_boolCaseFmt.set(LowerCase);
+ m_intFmt.set(Dec);
+ m_indent.set(2);
+ m_preCommentIndent.set(2);
+ m_postCommentIndent.set(1);
+ m_seqFmt.set(Block);
+ m_mapFmt.set(Block);
+ m_mapKeyFmt.set(Auto);
+ m_floatPrecision.set(std::numeric_limits<float>::digits10 + 1);
+ m_doublePrecision.set(std::numeric_limits<double>::digits10 + 1);
+}
+
+EmitterState::~EmitterState() {}
+
+// SetLocalValue
+// . We blindly tries to set all possible formatters to this value
+// . Only the ones that make sense will be accepted
+void EmitterState::SetLocalValue(EMITTER_MANIP value) {
+ SetOutputCharset(value, FmtScope::Local);
+ SetStringFormat(value, FmtScope::Local);
+ SetBoolFormat(value, FmtScope::Local);
+ SetBoolCaseFormat(value, FmtScope::Local);
+ SetBoolLengthFormat(value, FmtScope::Local);
+ SetIntFormat(value, FmtScope::Local);
+ SetFlowType(GroupType::Seq, value, FmtScope::Local);
+ SetFlowType(GroupType::Map, value, FmtScope::Local);
+ SetMapKeyFormat(value, FmtScope::Local);
+}
+
+void EmitterState::SetAnchor() { m_hasAnchor = true; }
+
+void EmitterState::SetTag() { m_hasTag = true; }
+
+void EmitterState::SetNonContent() { m_hasNonContent = true; }
+
+void EmitterState::SetLongKey() {
+ assert(!m_groups.empty());
+ if (m_groups.empty()) {
+ return;
+ }
+
+ assert(m_groups.back()->type == GroupType::Map);
+ m_groups.back()->longKey = true;
+}
+
+void EmitterState::ForceFlow() {
+ assert(!m_groups.empty());
+ if (m_groups.empty()) {
+ return;
+ }
+
+ m_groups.back()->flowType = FlowType::Flow;
+}
+
+void EmitterState::StartedNode() {
+ if (m_groups.empty()) {
+ m_docCount++;
+ } else {
+ m_groups.back()->childCount++;
+ if (m_groups.back()->childCount % 2 == 0) {
+ m_groups.back()->longKey = false;
+ }
+ }
+
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+EmitterNodeType::value EmitterState::NextGroupType(
+ GroupType::value type) const {
+ if (type == GroupType::Seq) {
+ if (GetFlowType(type) == Block)
+ return EmitterNodeType::BlockSeq;
+ else
+ return EmitterNodeType::FlowSeq;
+ } else {
+ if (GetFlowType(type) == Block)
+ return EmitterNodeType::BlockMap;
+ else
+ return EmitterNodeType::FlowMap;
+ }
+
+ // can't happen
+ assert(false);
+ return EmitterNodeType::NoType;
+}
+
+void EmitterState::StartedDoc() {
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+void EmitterState::EndedDoc() {
+ m_hasAnchor = false;
+ m_hasTag = false;
+ m_hasNonContent = false;
+}
+
+void EmitterState::StartedScalar() {
+ StartedNode();
+ ClearModifiedSettings();
+}
+
+void EmitterState::StartedGroup(GroupType::value type) {
+ StartedNode();
+
+ const std::size_t lastGroupIndent =
+ (m_groups.empty() ? 0 : m_groups.back()->indent);
+ m_curIndent += lastGroupIndent;
+
+ // TODO: Create move constructors for settings types to simplify transfer
+ std::unique_ptr<Group> pGroup(new Group(type));
+
+ // transfer settings (which last until this group is done)
+ //
+ // NB: if pGroup->modifiedSettings == m_modifiedSettings,
+ // m_modifiedSettings is not changed!
+ pGroup->modifiedSettings = std::move(m_modifiedSettings);
+
+ // set up group
+ if (GetFlowType(type) == Block) {
+ pGroup->flowType = FlowType::Block;
+ } else {
+ pGroup->flowType = FlowType::Flow;
+ }
+ pGroup->indent = GetIndent();
+
+ m_groups.push_back(std::move(pGroup));
+}
+
+void EmitterState::EndedGroup(GroupType::value type) {
+ if (m_groups.empty()) {
+ if (type == GroupType::Seq) {
+ return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
+ } else {
+ return SetError(ErrorMsg::UNEXPECTED_END_MAP);
+ }
+ }
+
+ // get rid of the current group
+ {
+ std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back());
+ m_groups.pop_back();
+ if (pFinishedGroup->type != type) {
+ return SetError(ErrorMsg::UNMATCHED_GROUP_TAG);
+ }
+ }
+
+ // reset old settings
+ std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
+ assert(m_curIndent >= lastIndent);
+ m_curIndent -= lastIndent;
+
+ // some global settings that we changed may have been overridden
+ // by a local setting we just popped, so we need to restore them
+ m_globalModifiedSettings.restore();
+
+ ClearModifiedSettings();
+}
+
+EmitterNodeType::value EmitterState::CurGroupNodeType() const {
+ if (m_groups.empty()) {
+ return EmitterNodeType::NoType;
+ }
+
+ return m_groups.back()->NodeType();
+}
+
+GroupType::value EmitterState::CurGroupType() const {
+ return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
+}
+
+FlowType::value EmitterState::CurGroupFlowType() const {
+ return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
+}
+
+std::size_t EmitterState::CurGroupIndent() const {
+ return m_groups.empty() ? 0 : m_groups.back()->indent;
+}
+
+std::size_t EmitterState::CurGroupChildCount() const {
+ return m_groups.empty() ? m_docCount : m_groups.back()->childCount;
+}
+
+bool EmitterState::CurGroupLongKey() const {
+ return m_groups.empty() ? false : m_groups.back()->longKey;
+}
+
+std::size_t EmitterState::LastIndent() const {
+ if (m_groups.size() <= 1) {
+ return 0;
+ }
+
+ return m_curIndent - m_groups[m_groups.size() - 2]->indent;
+}
+
+void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
+
+bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case EmitNonAscii:
+ case EscapeNonAscii:
+ _Set(m_charset, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Auto:
+ case SingleQuoted:
+ case DoubleQuoted:
+ case Literal:
+ _Set(m_strFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case OnOffBool:
+ case TrueFalseBool:
+ case YesNoBool:
+ _Set(m_boolFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case LongBool:
+ case ShortBool:
+ _Set(m_boolLengthFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case UpperCase:
+ case LowerCase:
+ case CamelCase:
+ _Set(m_boolCaseFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Dec:
+ case Hex:
+ case Oct:
+ _Set(m_intFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) {
+ if (value <= 1)
+ return false;
+
+ _Set(m_indent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetPreCommentIndent(std::size_t value,
+ FmtScope::value scope) {
+ if (value == 0)
+ return false;
+
+ _Set(m_preCommentIndent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetPostCommentIndent(std::size_t value,
+ FmtScope::value scope) {
+ if (value == 0)
+ return false;
+
+ _Set(m_postCommentIndent, value, scope);
+ return true;
+}
+
+bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+ FmtScope::value scope) {
+ switch (value) {
+ case Block:
+ case Flow:
+ _Set(groupType == GroupType::Seq ? m_seqFmt : m_mapFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const {
+ // force flow style if we're currently in a flow
+ if (CurGroupFlowType() == FlowType::Flow)
+ return Flow;
+
+ // otherwise, go with what's asked of us
+ return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get());
+}
+
+bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
+ switch (value) {
+ case Auto:
+ case LongKey:
+ _Set(m_mapKeyFmt, value, scope);
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
+ if (value > std::numeric_limits<float>::digits10 + 1)
+ return false;
+ _Set(m_floatPrecision, value, scope);
+ return true;
+}
+
+bool EmitterState::SetDoublePrecision(std::size_t value,
+ FmtScope::value scope) {
+ if (value > std::numeric_limits<double>::digits10 + 1)
+ return false;
+ _Set(m_doublePrecision, value, scope);
+ return true;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitterstate.h b/src/libs/3rdparty/yaml-cpp/src/emitterstate.h
new file mode 100644
index 0000000000..0937f000d9
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitterstate.h
@@ -0,0 +1,203 @@
+#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "setting.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+
+#include <cassert>
+#include <memory>
+#include <stack>
+#include <stdexcept>
+#include <vector>
+
+namespace YAML {
+struct FmtScope {
+ enum value { Local, Global };
+};
+struct GroupType {
+ enum value { NoType, Seq, Map };
+};
+struct FlowType {
+ enum value { NoType, Flow, Block };
+};
+
+class EmitterState {
+ public:
+ EmitterState();
+ ~EmitterState();
+
+ // basic state checking
+ bool good() const { return m_isGood; }
+ const std::string GetLastError() const { return m_lastError; }
+ void SetError(const std::string& error) {
+ m_isGood = false;
+ m_lastError = error;
+ }
+
+ // node handling
+ void SetAnchor();
+ void SetTag();
+ void SetNonContent();
+ void SetLongKey();
+ void ForceFlow();
+ void StartedDoc();
+ void EndedDoc();
+ void StartedScalar();
+ void StartedGroup(GroupType::value type);
+ void EndedGroup(GroupType::value type);
+
+ EmitterNodeType::value NextGroupType(GroupType::value type) const;
+ EmitterNodeType::value CurGroupNodeType() const;
+
+ GroupType::value CurGroupType() const;
+ FlowType::value CurGroupFlowType() const;
+ std::size_t CurGroupIndent() const;
+ std::size_t CurGroupChildCount() const;
+ bool CurGroupLongKey() const;
+
+ std::size_t LastIndent() const;
+ std::size_t CurIndent() const { return m_curIndent; }
+ bool HasAnchor() const { return m_hasAnchor; }
+ bool HasTag() const { return m_hasTag; }
+ bool HasBegunNode() const {
+ return m_hasAnchor || m_hasTag || m_hasNonContent;
+ }
+ bool HasBegunContent() const { return m_hasAnchor || m_hasTag; }
+
+ void ClearModifiedSettings();
+
+ // formatters
+ void SetLocalValue(EMITTER_MANIP value);
+
+ bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }
+
+ bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }
+
+ bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }
+
+ bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }
+
+ bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }
+
+ bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
+
+ bool SetIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetIndent() const { return m_indent.get(); }
+
+ bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
+ bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
+ std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
+
+ bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+ FmtScope::value scope);
+ EMITTER_MANIP GetFlowType(GroupType::value groupType) const;
+
+ bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
+ EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
+
+ bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
+ std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
+ bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
+ std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
+
+ private:
+ template <typename T>
+ void _Set(Setting<T>& fmt, T value, FmtScope::value scope);
+
+ void StartedNode();
+
+ private:
+ // basic state ok?
+ bool m_isGood;
+ std::string m_lastError;
+
+ // other state
+ Setting<EMITTER_MANIP> m_charset;
+ Setting<EMITTER_MANIP> m_strFmt;
+ Setting<EMITTER_MANIP> m_boolFmt;
+ Setting<EMITTER_MANIP> m_boolLengthFmt;
+ Setting<EMITTER_MANIP> m_boolCaseFmt;
+ Setting<EMITTER_MANIP> m_intFmt;
+ Setting<std::size_t> m_indent;
+ Setting<std::size_t> m_preCommentIndent, m_postCommentIndent;
+ Setting<EMITTER_MANIP> m_seqFmt;
+ Setting<EMITTER_MANIP> m_mapFmt;
+ Setting<EMITTER_MANIP> m_mapKeyFmt;
+ Setting<std::size_t> m_floatPrecision;
+ Setting<std::size_t> m_doublePrecision;
+
+ SettingChanges m_modifiedSettings;
+ SettingChanges m_globalModifiedSettings;
+
+ struct Group {
+ explicit Group(GroupType::value type_)
+ : type(type_), indent(0), childCount(0), longKey(false) {}
+
+ GroupType::value type;
+ FlowType::value flowType;
+ std::size_t indent;
+ std::size_t childCount;
+ bool longKey;
+
+ SettingChanges modifiedSettings;
+
+ EmitterNodeType::value NodeType() const {
+ if (type == GroupType::Seq) {
+ if (flowType == FlowType::Flow)
+ return EmitterNodeType::FlowSeq;
+ else
+ return EmitterNodeType::BlockSeq;
+ } else {
+ if (flowType == FlowType::Flow)
+ return EmitterNodeType::FlowMap;
+ else
+ return EmitterNodeType::BlockMap;
+ }
+
+ // can't get here
+ assert(false);
+ return EmitterNodeType::NoType;
+ }
+ };
+
+ std::vector<std::unique_ptr<Group>> m_groups;
+ std::size_t m_curIndent;
+ bool m_hasAnchor;
+ bool m_hasTag;
+ bool m_hasNonContent;
+ std::size_t m_docCount;
+};
+
+template <typename T>
+void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
+ switch (scope) {
+ case FmtScope::Local:
+ m_modifiedSettings.push(fmt.set(value));
+ break;
+ case FmtScope::Global:
+ fmt.set(value);
+ m_globalModifiedSettings.push(
+ fmt.set(value)); // this pushes an identity set, so when we restore,
+ // it restores to the value here, and not the previous one
+ break;
+ default:
+ assert(false);
+ }
+}
+}
+
+#endif // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitterutils.cpp b/src/libs/3rdparty/yaml-cpp/src/emitterutils.cpp
new file mode 100644
index 0000000000..147738ad8a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitterutils.cpp
@@ -0,0 +1,483 @@
+#include <iomanip>
+#include <sstream>
+
+#include "emitterutils.h"
+#include "exp.h"
+#include "indentation.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "stringsource.h"
+#include "yaml-cpp/binary.h" // IWYU pragma: keep
+#include "yaml-cpp/ostream_wrapper.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+namespace Utils {
+namespace {
+enum { REPLACEMENT_CHARACTER = 0xFFFD };
+
+bool IsAnchorChar(int ch) { // test for ns-anchor-char
+ switch (ch) {
+ case ',':
+ case '[':
+ case ']':
+ case '{':
+ case '}': // c-flow-indicator
+ case ' ':
+ case '\t': // s-white
+ case 0xFEFF: // c-byte-order-mark
+ case 0xA:
+ case 0xD: // b-char
+ return false;
+ case 0x85:
+ return true;
+ }
+
+ if (ch < 0x20) {
+ return false;
+ }
+
+ if (ch < 0x7E) {
+ return true;
+ }
+
+ if (ch < 0xA0) {
+ return false;
+ }
+ if (ch >= 0xD800 && ch <= 0xDFFF) {
+ return false;
+ }
+ if ((ch & 0xFFFE) == 0xFFFE) {
+ return false;
+ }
+ if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) {
+ return false;
+ }
+ if (ch > 0x10FFFF) {
+ return false;
+ }
+
+ return true;
+}
+
+int Utf8BytesIndicated(char ch) {
+ int byteVal = static_cast<unsigned char>(ch);
+ switch (byteVal >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return 1;
+ case 12:
+ case 13:
+ return 2;
+ case 14:
+ return 3;
+ case 15:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+bool IsTrailingByte(char ch) { return (ch & 0xC0) == 0x80; }
+
+bool GetNextCodePointAndAdvance(int& codePoint,
+ std::string::const_iterator& first,
+ std::string::const_iterator last) {
+ if (first == last)
+ return false;
+
+ int nBytes = Utf8BytesIndicated(*first);
+ if (nBytes < 1) {
+ // Bad lead byte
+ ++first;
+ codePoint = REPLACEMENT_CHARACTER;
+ return true;
+ }
+
+ if (nBytes == 1) {
+ codePoint = *first++;
+ return true;
+ }
+
+ // Gather bits from trailing bytes
+ codePoint = static_cast<unsigned char>(*first) & ~(0xFF << (7 - nBytes));
+ ++first;
+ --nBytes;
+ for (; nBytes > 0; ++first, --nBytes) {
+ if ((first == last) || !IsTrailingByte(*first)) {
+ codePoint = REPLACEMENT_CHARACTER;
+ break;
+ }
+ codePoint <<= 6;
+ codePoint |= *first & 0x3F;
+ }
+
+ // Check for illegal code points
+ if (codePoint > 0x10FFFF)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if (codePoint >= 0xD800 && codePoint <= 0xDFFF)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if ((codePoint & 0xFFFE) == 0xFFFE)
+ codePoint = REPLACEMENT_CHARACTER;
+ else if (codePoint >= 0xFDD0 && codePoint <= 0xFDEF)
+ codePoint = REPLACEMENT_CHARACTER;
+ return true;
+}
+
+void WriteCodePoint(ostream_wrapper& out, int codePoint) {
+ if (codePoint < 0 || codePoint > 0x10FFFF) {
+ codePoint = REPLACEMENT_CHARACTER;
+ }
+ if (codePoint < 0x7F) {
+ out << static_cast<char>(codePoint);
+ } else if (codePoint < 0x7FF) {
+ out << static_cast<char>(0xC0 | (codePoint >> 6))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ } else if (codePoint < 0xFFFF) {
+ out << static_cast<char>(0xE0 | (codePoint >> 12))
+ << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ } else {
+ out << static_cast<char>(0xF0 | (codePoint >> 18))
+ << static_cast<char>(0x80 | ((codePoint >> 12) & 0x3F))
+ << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+ << static_cast<char>(0x80 | (codePoint & 0x3F));
+ }
+}
+
+bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
+ bool allowOnlyAscii) {
+ // check against null
+ if (IsNullString(str)) {
+ return false;
+ }
+
+ // check the start
+ const RegEx& start = (flowType == FlowType::Flow ? Exp::PlainScalarInFlow()
+ : Exp::PlainScalar());
+ if (!start.Matches(str)) {
+ return false;
+ }
+
+ // and check the end for plain whitespace (which can't be faithfully kept in a
+ // plain scalar)
+ if (!str.empty() && *str.rbegin() == ' ') {
+ return false;
+ }
+
+ // then check until something is disallowed
+ static const RegEx& disallowed_flow =
+ Exp::EndScalarInFlow() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+ Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+ Exp::Tab();
+ static const RegEx& disallowed_block =
+ Exp::EndScalar() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+ Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+ Exp::Tab();
+ const RegEx& disallowed =
+ flowType == FlowType::Flow ? disallowed_flow : disallowed_block;
+
+ StringCharSource buffer(str.c_str(), str.size());
+ while (buffer) {
+ if (disallowed.Matches(buffer)) {
+ return false;
+ }
+ if (allowOnlyAscii && (0x80 <= static_cast<unsigned char>(buffer[0]))) {
+ return false;
+ }
+ ++buffer;
+ }
+
+ return true;
+}
+
+bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) {
+ // TODO: check for non-printable characters?
+ for (std::size_t i = 0; i < str.size(); i++) {
+ if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+ return false;
+ }
+ if (str[i] == '\n') {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType,
+ bool escapeNonAscii) {
+ if (flowType == FlowType::Flow) {
+ return false;
+ }
+
+ // TODO: check for non-printable characters?
+ for (std::size_t i = 0; i < str.size(); i++) {
+ if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint) {
+ static const char hexDigits[] = "0123456789abcdef";
+
+ out << "\\";
+ int digits = 8;
+ if (codePoint < 0xFF) {
+ out << "x";
+ digits = 2;
+ } else if (codePoint < 0xFFFF) {
+ out << "u";
+ digits = 4;
+ } else {
+ out << "U";
+ digits = 8;
+ }
+
+ // Write digits into the escape sequence
+ for (; digits > 0; --digits)
+ out << hexDigits[(codePoint >> (4 * (digits - 1))) & 0xF];
+}
+
+bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (!IsAnchorChar(codePoint)) {
+ return false;
+ }
+
+ WriteCodePoint(out, codePoint);
+ }
+ return true;
+}
+}
+
+StringFormat::value ComputeStringFormat(const std::string& str,
+ EMITTER_MANIP strFormat,
+ FlowType::value flowType,
+ bool escapeNonAscii) {
+ switch (strFormat) {
+ case Auto:
+ if (IsValidPlainScalar(str, flowType, escapeNonAscii)) {
+ return StringFormat::Plain;
+ }
+ return StringFormat::DoubleQuoted;
+ case SingleQuoted:
+ if (IsValidSingleQuotedScalar(str, escapeNonAscii)) {
+ return StringFormat::SingleQuoted;
+ }
+ return StringFormat::DoubleQuoted;
+ case DoubleQuoted:
+ return StringFormat::DoubleQuoted;
+ case Literal:
+ if (IsValidLiteralScalar(str, flowType, escapeNonAscii)) {
+ return StringFormat::Literal;
+ }
+ return StringFormat::DoubleQuoted;
+ default:
+ break;
+ }
+
+ return StringFormat::DoubleQuoted;
+}
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str) {
+ out << "'";
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ return false; // We can't handle a new line and the attendant indentation
+ // yet
+ }
+
+ if (codePoint == '\'') {
+ out << "''";
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ out << "'";
+ return true;
+}
+
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+ bool escapeNonAscii) {
+ out << "\"";
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ switch (codePoint) {
+ case '\"':
+ out << "\\\"";
+ break;
+ case '\\':
+ out << "\\\\";
+ break;
+ case '\n':
+ out << "\\n";
+ break;
+ case '\t':
+ out << "\\t";
+ break;
+ case '\r':
+ out << "\\r";
+ break;
+ case '\b':
+ out << "\\b";
+ break;
+ default:
+ if (codePoint < 0x20 ||
+ (codePoint >= 0x80 &&
+ codePoint <= 0xA0)) { // Control characters and non-breaking space
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else if (codePoint == 0xFEFF) { // Byte order marks (ZWNS) should be
+ // escaped (YAML 1.2, sec. 5.2)
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else if (escapeNonAscii && codePoint > 0x7E) {
+ WriteDoubleQuoteEscapeSequence(out, codePoint);
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ }
+ out << "\"";
+ return true;
+}
+
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+ std::size_t indent) {
+ out << "|\n";
+ out << IndentTo(indent);
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ out << "\n" << IndentTo(indent);
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ return true;
+}
+
+bool WriteChar(ostream_wrapper& out, char ch) {
+ if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) {
+ out << ch;
+ } else if (ch == '\"') {
+ out << "\"\\\"\"";
+ } else if (ch == '\t') {
+ out << "\"\\t\"";
+ } else if (ch == '\n') {
+ out << "\"\\n\"";
+ } else if (ch == '\b') {
+ out << "\"\\b\"";
+ } else if (ch == '\\') {
+ out << "\"\\\\\"";
+ } else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') {
+ out << "\"" << ch << "\"";
+ } else {
+ out << "\"";
+ WriteDoubleQuoteEscapeSequence(out, ch);
+ out << "\"";
+ }
+ return true;
+}
+
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+ std::size_t postCommentIndent) {
+ const std::size_t curIndent = out.col();
+ out << "#" << Indentation(postCommentIndent);
+ out.set_comment();
+ int codePoint;
+ for (std::string::const_iterator i = str.begin();
+ GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+ if (codePoint == '\n') {
+ out << "\n" << IndentTo(curIndent) << "#"
+ << Indentation(postCommentIndent);
+ out.set_comment();
+ } else {
+ WriteCodePoint(out, codePoint);
+ }
+ }
+ return true;
+}
+
+bool WriteAlias(ostream_wrapper& out, const std::string& str) {
+ out << "*";
+ return WriteAliasName(out, str);
+}
+
+bool WriteAnchor(ostream_wrapper& out, const std::string& str) {
+ out << "&";
+ return WriteAliasName(out, str);
+}
+
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim) {
+ out << (verbatim ? "!<" : "!");
+ StringCharSource buffer(str.c_str(), str.size());
+ const RegEx& reValid = verbatim ? Exp::URI() : Exp::Tag();
+ while (buffer) {
+ int n = reValid.Match(buffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << buffer[0];
+ ++buffer;
+ }
+ }
+ if (verbatim) {
+ out << ">";
+ }
+ return true;
+}
+
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+ const std::string& tag) {
+ out << "!";
+ StringCharSource prefixBuffer(prefix.c_str(), prefix.size());
+ while (prefixBuffer) {
+ int n = Exp::URI().Match(prefixBuffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << prefixBuffer[0];
+ ++prefixBuffer;
+ }
+ }
+
+ out << "!";
+ StringCharSource tagBuffer(tag.c_str(), tag.size());
+ while (tagBuffer) {
+ int n = Exp::Tag().Match(tagBuffer);
+ if (n <= 0) {
+ return false;
+ }
+
+ while (--n >= 0) {
+ out << tagBuffer[0];
+ ++tagBuffer;
+ }
+ }
+ return true;
+}
+
+bool WriteBinary(ostream_wrapper& out, const Binary& binary) {
+ WriteDoubleQuotedString(out, EncodeBase64(binary.data(), binary.size()),
+ false);
+ return true;
+}
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/emitterutils.h b/src/libs/3rdparty/yaml-cpp/src/emitterutils.h
new file mode 100644
index 0000000000..6cc7319147
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/emitterutils.h
@@ -0,0 +1,50 @@
+#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "emitterstate.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+class ostream_wrapper;
+} // namespace YAML
+
+namespace YAML {
+class Binary;
+
+struct StringFormat {
+ enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
+};
+
+namespace Utils {
+StringFormat::value ComputeStringFormat(const std::string& str,
+ EMITTER_MANIP strFormat,
+ FlowType::value flowType,
+ bool escapeNonAscii);
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+ bool escapeNonAscii);
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+ std::size_t indent);
+bool WriteChar(ostream_wrapper& out, char ch);
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+ std::size_t postCommentIndent);
+bool WriteAlias(ostream_wrapper& out, const std::string& str);
+bool WriteAnchor(ostream_wrapper& out, const std::string& str);
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+ const std::string& tag);
+bool WriteBinary(ostream_wrapper& out, const Binary& binary);
+}
+}
+
+#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp b/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp
new file mode 100644
index 0000000000..d5e10b23c1
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/exceptions.cpp
@@ -0,0 +1,25 @@
+#include "yaml-cpp/exceptions.h"
+
+#define YAML_CPP_NOEXCEPT noexcept
+
+namespace YAML {
+
+// These destructors are defined out-of-line so the vtable is only emitted once.
+Exception::~Exception() YAML_CPP_NOEXCEPT {}
+ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
+RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
+InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
+KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
+InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
+BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
+BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
+BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
+BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
+BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
+EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
+BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+
diff --git a/src/libs/3rdparty/yaml-cpp/src/exp.cpp b/src/libs/3rdparty/yaml-cpp/src/exp.cpp
new file mode 100644
index 0000000000..695440aec0
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/exp.cpp
@@ -0,0 +1,136 @@
+#include <sstream>
+
+#include "exp.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+namespace Exp {
+unsigned ParseHex(const std::string& str, const Mark& mark) {
+ unsigned value = 0;
+ for (std::size_t i = 0; i < str.size(); i++) {
+ char ch = str[i];
+ int digit = 0;
+ if ('a' <= ch && ch <= 'f')
+ digit = ch - 'a' + 10;
+ else if ('A' <= ch && ch <= 'F')
+ digit = ch - 'A' + 10;
+ else if ('0' <= ch && ch <= '9')
+ digit = ch - '0';
+ else
+ throw ParserException(mark, ErrorMsg::INVALID_HEX);
+
+ value = (value << 4) + digit;
+ }
+
+ return value;
+}
+
+std::string Str(unsigned ch) { return std::string(1, static_cast<char>(ch)); }
+
+// Escape
+// . Translates the next 'codeLength' characters into a hex number and returns
+// the result.
+// . Throws if it's not actually hex.
+std::string Escape(Stream& in, int codeLength) {
+ // grab string
+ std::string str;
+ for (int i = 0; i < codeLength; i++)
+ str += in.get();
+
+ // get the value
+ unsigned value = ParseHex(str, in.mark());
+
+ // legal unicode?
+ if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
+ std::stringstream msg;
+ msg << ErrorMsg::INVALID_UNICODE << value;
+ throw ParserException(in.mark(), msg.str());
+ }
+
+ // now break it up into chars
+ if (value <= 0x7F)
+ return Str(value);
+ else if (value <= 0x7FF)
+ return Str(0xC0 + (value >> 6)) + Str(0x80 + (value & 0x3F));
+ else if (value <= 0xFFFF)
+ return Str(0xE0 + (value >> 12)) + Str(0x80 + ((value >> 6) & 0x3F)) +
+ Str(0x80 + (value & 0x3F));
+ else
+ return Str(0xF0 + (value >> 18)) + Str(0x80 + ((value >> 12) & 0x3F)) +
+ Str(0x80 + ((value >> 6) & 0x3F)) + Str(0x80 + (value & 0x3F));
+}
+
+// Escape
+// . Escapes the sequence starting 'in' (it must begin with a '\' or single
+// quote)
+// and returns the result.
+// . Throws if it's an unknown escape character.
+std::string Escape(Stream& in) {
+ // eat slash
+ char escape = in.get();
+
+ // switch on escape character
+ char ch = in.get();
+
+ // first do single quote, since it's easier
+ if (escape == '\'' && ch == '\'')
+ return "\'";
+
+ // now do the slash (we're not gonna check if it's a slash - you better pass
+ // one!)
+ switch (ch) {
+ case '0':
+ return std::string(1, '\x00');
+ case 'a':
+ return "\x07";
+ case 'b':
+ return "\x08";
+ case 't':
+ case '\t':
+ return "\x09";
+ case 'n':
+ return "\x0A";
+ case 'v':
+ return "\x0B";
+ case 'f':
+ return "\x0C";
+ case 'r':
+ return "\x0D";
+ case 'e':
+ return "\x1B";
+ case ' ':
+ return "\x20";
+ case '\"':
+ return "\"";
+ case '\'':
+ return "\'";
+ case '\\':
+ return "\\";
+ case '/':
+ return "/";
+ case 'N':
+ return "\x85";
+ case '_':
+ return "\xA0";
+ case 'L':
+ return "\xE2\x80\xA8"; // LS (#x2028)
+ case 'P':
+ return "\xE2\x80\xA9"; // PS (#x2029)
+ case 'x':
+ return Escape(in, 2);
+ case 'u':
+ return Escape(in, 4);
+ case 'U':
+ return Escape(in, 8);
+ }
+
+ std::stringstream msg;
+ throw ParserException(in.mark(), std::string(ErrorMsg::INVALID_ESCAPE) + ch);
+}
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/exp.h b/src/libs/3rdparty/yaml-cpp/src/exp.h
new file mode 100644
index 0000000000..7c02cf6e45
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/exp.h
@@ -0,0 +1,222 @@
+#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <ios>
+#include <string>
+
+#include "regex_yaml.h"
+#include "stream.h"
+
+namespace YAML {
+////////////////////////////////////////////////////////////////////////////////
+// Here we store a bunch of expressions for matching different parts of the
+// file.
+
+namespace Exp {
+// misc
+inline const RegEx& Empty() {
+ static const RegEx e;
+ return e;
+}
+inline const RegEx& Space() {
+ static const RegEx e = RegEx(' ');
+ return e;
+}
+inline const RegEx& Tab() {
+ static const RegEx e = RegEx('\t');
+ return e;
+}
+inline const RegEx& Blank() {
+ static const RegEx e = Space() || Tab();
+ return e;
+}
+inline const RegEx& Break() {
+ static const RegEx e = RegEx('\n') || RegEx("\r\n");
+ return e;
+}
+inline const RegEx& BlankOrBreak() {
+ static const RegEx e = Blank() || Break();
+ return e;
+}
+inline const RegEx& Digit() {
+ static const RegEx e = RegEx('0', '9');
+ return e;
+}
+inline const RegEx& Alpha() {
+ static const RegEx e = RegEx('a', 'z') || RegEx('A', 'Z');
+ return e;
+}
+inline const RegEx& AlphaNumeric() {
+ static const RegEx e = Alpha() || Digit();
+ return e;
+}
+inline const RegEx& Word() {
+ static const RegEx e = AlphaNumeric() || RegEx('-');
+ return e;
+}
+inline const RegEx& Hex() {
+ static const RegEx e = Digit() || RegEx('A', 'F') || RegEx('a', 'f');
+ return e;
+}
+// Valid Unicode code points that are not part of c-printable (YAML 1.2, sec.
+// 5.1)
+inline const RegEx& NotPrintable() {
+ static const RegEx e =
+ RegEx(0) ||
+ RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x7F", REGEX_OR) ||
+ RegEx(0x0E, 0x1F) ||
+ (RegEx('\xC2') + (RegEx('\x80', '\x84') || RegEx('\x86', '\x9F')));
+ return e;
+}
+inline const RegEx& Utf8_ByteOrderMark() {
+ static const RegEx e = RegEx("\xEF\xBB\xBF");
+ return e;
+}
+
+// actual tags
+
+inline const RegEx& DocStart() {
+ static const RegEx e = RegEx("---") + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& DocEnd() {
+ static const RegEx e = RegEx("...") + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& DocIndicator() {
+ static const RegEx e = DocStart() || DocEnd();
+ return e;
+}
+inline const RegEx& BlockEntry() {
+ static const RegEx e = RegEx('-') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& Key() {
+ static const RegEx e = RegEx('?') + BlankOrBreak();
+ return e;
+}
+inline const RegEx& KeyInFlow() {
+ static const RegEx e = RegEx('?') + BlankOrBreak();
+ return e;
+}
+inline const RegEx& Value() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& ValueInFlow() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx(",}", REGEX_OR));
+ return e;
+}
+inline const RegEx& ValueInJSONFlow() {
+ static const RegEx e = RegEx(':');
+ return e;
+}
+inline const RegEx Comment() {
+ static const RegEx e = RegEx('#');
+ return e;
+}
+inline const RegEx& Anchor() {
+ static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak());
+ return e;
+}
+inline const RegEx& AnchorEnd() {
+ static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak();
+ return e;
+}
+inline const RegEx& URI() {
+ static const RegEx e = Word() || RegEx("#;/?:@&=+$,_.!~*'()[]", REGEX_OR) ||
+ (RegEx('%') + Hex() + Hex());
+ return e;
+}
+inline const RegEx& Tag() {
+ static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'()", REGEX_OR) ||
+ (RegEx('%') + Hex() + Hex());
+ return e;
+}
+
+// Plain scalar rules:
+// . Cannot start with a blank.
+// . Can never start with any of , [ ] { } # & * ! | > \' \" % @ `
+// . In the block context - ? : must be not be followed with a space.
+// . In the flow context ? is illegal and : and - must not be followed with a
+// space.
+inline const RegEx& PlainScalar() {
+ static const RegEx e =
+ !(BlankOrBreak() || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+ (RegEx("-?:", REGEX_OR) + (BlankOrBreak() || RegEx())));
+ return e;
+}
+inline const RegEx& PlainScalarInFlow() {
+ static const RegEx e =
+ !(BlankOrBreak() || RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+ (RegEx("-:", REGEX_OR) + Blank()));
+ return e;
+}
+inline const RegEx& EndScalar() {
+ static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+ return e;
+}
+inline const RegEx& EndScalarInFlow() {
+ static const RegEx e =
+ (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) ||
+ RegEx(",?[]{}", REGEX_OR);
+ return e;
+}
+
+inline const RegEx& ScanScalarEndInFlow() {
+ static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
+ return e;
+}
+
+inline const RegEx& ScanScalarEnd() {
+ static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
+ return e;
+}
+inline const RegEx& EscSingleQuote() {
+ static const RegEx e = RegEx("\'\'");
+ return e;
+}
+inline const RegEx& EscBreak() {
+ static const RegEx e = RegEx('\\') + Break();
+ return e;
+}
+
+inline const RegEx& ChompIndicator() {
+ static const RegEx e = RegEx("+-", REGEX_OR);
+ return e;
+}
+inline const RegEx& Chomp() {
+ static const RegEx e = (ChompIndicator() + Digit()) ||
+ (Digit() + ChompIndicator()) || ChompIndicator() ||
+ Digit();
+ return e;
+}
+
+// and some functions
+std::string Escape(Stream& in);
+} // namespace Exp
+
+namespace Keys {
+const char Directive = '%';
+const char FlowSeqStart = '[';
+const char FlowSeqEnd = ']';
+const char FlowMapStart = '{';
+const char FlowMapEnd = '}';
+const char FlowEntry = ',';
+const char Alias = '*';
+const char Anchor = '&';
+const char Tag = '!';
+const char LiteralScalar = '|';
+const char FoldedScalar = '>';
+const char VerbatimTagStart = '<';
+const char VerbatimTagEnd = '>';
+} // namespace Keys
+} // namespace YAML
+
+#endif // EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/indentation.h b/src/libs/3rdparty/yaml-cpp/src/indentation.h
new file mode 100644
index 0000000000..1a2ccaea2e
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/indentation.h
@@ -0,0 +1,41 @@
+#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <iostream>
+#include <cstddef>
+
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+struct Indentation {
+ Indentation(std::size_t n_) : n(n_) {}
+ std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+ const Indentation& indent) {
+ for (std::size_t i = 0; i < indent.n; i++)
+ out << ' ';
+ return out;
+}
+
+struct IndentTo {
+ IndentTo(std::size_t n_) : n(n_) {}
+ std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+ const IndentTo& indent) {
+ while (out.col() < indent.n)
+ out << ' ';
+ return out;
+}
+}
+
+#endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/memory.cpp b/src/libs/3rdparty/yaml-cpp/src/memory.cpp
new file mode 100644
index 0000000000..e5f8a9d3f8
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/memory.cpp
@@ -0,0 +1,26 @@
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+
+void memory_holder::merge(memory_holder& rhs) {
+ if (m_pMemory == rhs.m_pMemory)
+ return;
+
+ m_pMemory->merge(*rhs.m_pMemory);
+ rhs.m_pMemory = m_pMemory;
+}
+
+node& memory::create_node() {
+ shared_node pNode(new node);
+ m_nodes.insert(pNode);
+ return *pNode;
+}
+
+void memory::merge(const memory& rhs) {
+ m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
+}
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/node.cpp b/src/libs/3rdparty/yaml-cpp/src/node.cpp
new file mode 100644
index 0000000000..2088e13c9a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/node.cpp
@@ -0,0 +1,12 @@
+#include "yaml-cpp/node/node.h"
+#include "nodebuilder.h"
+#include "nodeevents.h"
+
+namespace YAML {
+Node Clone(const Node& node) {
+ NodeEvents events(node);
+ NodeBuilder builder;
+ events.Emit(builder);
+ return builder.Root();
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/node_data.cpp b/src/libs/3rdparty/yaml-cpp/src/node_data.cpp
new file mode 100644
index 0000000000..77cd465780
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/node_data.cpp
@@ -0,0 +1,300 @@
+#include <assert.h>
+#include <iterator>
+#include <sstream>
+
+#include "yaml-cpp/exceptions.h"
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep
+#include "yaml-cpp/node/detail/node_data.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+
+std::string node_data::empty_scalar;
+
+node_data::node_data()
+ : m_isDefined(false),
+ m_mark(Mark::null_mark()),
+ m_type(NodeType::Null),
+ m_style(EmitterStyle::Default),
+ m_seqSize(0) {}
+
+void node_data::mark_defined() {
+ if (m_type == NodeType::Undefined)
+ m_type = NodeType::Null;
+ m_isDefined = true;
+}
+
+void node_data::set_mark(const Mark& mark) { m_mark = mark; }
+
+void node_data::set_type(NodeType::value type) {
+ if (type == NodeType::Undefined) {
+ m_type = type;
+ m_isDefined = false;
+ return;
+ }
+
+ m_isDefined = true;
+ if (type == m_type)
+ return;
+
+ m_type = type;
+
+ switch (m_type) {
+ case NodeType::Null:
+ break;
+ case NodeType::Scalar:
+ m_scalar.clear();
+ break;
+ case NodeType::Sequence:
+ reset_sequence();
+ break;
+ case NodeType::Map:
+ reset_map();
+ break;
+ case NodeType::Undefined:
+ assert(false);
+ break;
+ }
+}
+
+void node_data::set_tag(const std::string& tag) { m_tag = tag; }
+
+void node_data::set_style(EmitterStyle::value style) { m_style = style; }
+
+void node_data::set_null() {
+ m_isDefined = true;
+ m_type = NodeType::Null;
+}
+
+void node_data::set_scalar(const std::string& scalar) {
+ m_isDefined = true;
+ m_type = NodeType::Scalar;
+ m_scalar = scalar;
+}
+
+// size/iterator
+std::size_t node_data::size() const {
+ if (!m_isDefined)
+ return 0;
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ compute_seq_size();
+ return m_seqSize;
+ case NodeType::Map:
+ compute_map_size();
+ return m_map.size() - m_undefinedPairs.size();
+ default:
+ return 0;
+ }
+ return 0;
+}
+
+void node_data::compute_seq_size() const {
+ while (m_seqSize < m_sequence.size() && m_sequence[m_seqSize]->is_defined())
+ m_seqSize++;
+}
+
+void node_data::compute_map_size() const {
+ kv_pairs::iterator it = m_undefinedPairs.begin();
+ while (it != m_undefinedPairs.end()) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->is_defined() && it->second->is_defined())
+ m_undefinedPairs.erase(it);
+ it = jt;
+ }
+}
+
+const_node_iterator node_data::begin() const {
+ if (!m_isDefined)
+ return const_node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return const_node_iterator(m_sequence.begin());
+ case NodeType::Map:
+ return const_node_iterator(m_map.begin(), m_map.end());
+ default:
+ return const_node_iterator();
+ }
+}
+
+node_iterator node_data::begin() {
+ if (!m_isDefined)
+ return node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return node_iterator(m_sequence.begin());
+ case NodeType::Map:
+ return node_iterator(m_map.begin(), m_map.end());
+ default:
+ return node_iterator();
+ }
+}
+
+const_node_iterator node_data::end() const {
+ if (!m_isDefined)
+ return const_node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return const_node_iterator(m_sequence.end());
+ case NodeType::Map:
+ return const_node_iterator(m_map.end(), m_map.end());
+ default:
+ return const_node_iterator();
+ }
+}
+
+node_iterator node_data::end() {
+ if (!m_isDefined)
+ return node_iterator();
+
+ switch (m_type) {
+ case NodeType::Sequence:
+ return node_iterator(m_sequence.end());
+ case NodeType::Map:
+ return node_iterator(m_map.end(), m_map.end());
+ default:
+ return node_iterator();
+ }
+}
+
+// sequence
+void node_data::push_back(node& node, shared_memory_holder /* pMemory */) {
+ if (m_type == NodeType::Undefined || m_type == NodeType::Null) {
+ m_type = NodeType::Sequence;
+ reset_sequence();
+ }
+
+ if (m_type != NodeType::Sequence)
+ throw BadPushback();
+
+ m_sequence.push_back(&node);
+}
+
+void node_data::insert(node& key, node& value, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ insert_map_pair(key, value);
+}
+
+// indexing
+node* node_data::get(node& key, shared_memory_holder /* pMemory */) const {
+ if (m_type != NodeType::Map) {
+ return NULL;
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key))
+ return it->second;
+ }
+
+ return NULL;
+}
+
+node& node_data::get(node& key, shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Map:
+ break;
+ case NodeType::Undefined:
+ case NodeType::Null:
+ case NodeType::Sequence:
+ convert_to_map(pMemory);
+ break;
+ case NodeType::Scalar:
+ throw BadSubscript();
+ }
+
+ for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key))
+ return *it->second;
+ }
+
+ node& value = pMemory->create_node();
+ insert_map_pair(key, value);
+ return value;
+}
+
+bool node_data::remove(node& key, shared_memory_holder /* pMemory */) {
+ if (m_type != NodeType::Map)
+ return false;
+
+ for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
+ if (it->first->is(key)) {
+ m_map.erase(it);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void node_data::reset_sequence() {
+ m_sequence.clear();
+ m_seqSize = 0;
+}
+
+void node_data::reset_map() {
+ m_map.clear();
+ m_undefinedPairs.clear();
+}
+
+void node_data::insert_map_pair(node& key, node& value) {
+ m_map.emplace_back(&key, &value);
+
+ if (!key.is_defined() || !value.is_defined())
+ m_undefinedPairs.emplace_back(&key, &value);
+}
+
+void node_data::convert_to_map(shared_memory_holder pMemory) {
+ switch (m_type) {
+ case NodeType::Undefined:
+ case NodeType::Null:
+ reset_map();
+ m_type = NodeType::Map;
+ break;
+ case NodeType::Sequence:
+ convert_sequence_to_map(pMemory);
+ break;
+ case NodeType::Map:
+ break;
+ case NodeType::Scalar:
+ assert(false);
+ break;
+ }
+}
+
+void node_data::convert_sequence_to_map(shared_memory_holder pMemory) {
+ assert(m_type == NodeType::Sequence);
+
+ reset_map();
+ for (std::size_t i = 0; i < m_sequence.size(); i++) {
+ std::stringstream stream;
+ stream << i;
+
+ node& key = pMemory->create_node();
+ key.set_scalar(stream.str());
+ insert_map_pair(key, *m_sequence[i]);
+ }
+
+ reset_sequence();
+ m_type = NodeType::Map;
+}
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/nodebuilder.cpp b/src/libs/3rdparty/yaml-cpp/src/nodebuilder.cpp
new file mode 100644
index 0000000000..093d2efeb7
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/nodebuilder.cpp
@@ -0,0 +1,130 @@
+#include <assert.h>
+#include <cassert>
+
+#include "nodebuilder.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+struct Mark;
+
+NodeBuilder::NodeBuilder()
+ : m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) {
+ m_anchors.push_back(0); // since the anchors start at 1
+}
+
+NodeBuilder::~NodeBuilder() {}
+
+Node NodeBuilder::Root() {
+ if (!m_pRoot)
+ return Node();
+
+ return Node(*m_pRoot, m_pMemory);
+}
+
+void NodeBuilder::OnDocumentStart(const Mark&) {}
+
+void NodeBuilder::OnDocumentEnd() {}
+
+void NodeBuilder::OnNull(const Mark& mark, anchor_t anchor) {
+ detail::node& node = Push(mark, anchor);
+ node.set_null();
+ Pop();
+}
+
+void NodeBuilder::OnAlias(const Mark& /* mark */, anchor_t anchor) {
+ detail::node& node = *m_anchors[anchor];
+ Push(node);
+ Pop();
+}
+
+void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value) {
+ detail::node& node = Push(mark, anchor);
+ node.set_scalar(value);
+ node.set_tag(tag);
+ Pop();
+}
+
+void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ detail::node& node = Push(mark, anchor);
+ node.set_tag(tag);
+ node.set_type(NodeType::Sequence);
+ node.set_style(style);
+}
+
+void NodeBuilder::OnSequenceEnd() { Pop(); }
+
+void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) {
+ detail::node& node = Push(mark, anchor);
+ node.set_type(NodeType::Map);
+ node.set_tag(tag);
+ node.set_style(style);
+ m_mapDepth++;
+}
+
+void NodeBuilder::OnMapEnd() {
+ assert(m_mapDepth > 0);
+ m_mapDepth--;
+ Pop();
+}
+
+detail::node& NodeBuilder::Push(const Mark& mark, anchor_t anchor) {
+ detail::node& node = m_pMemory->create_node();
+ node.set_mark(mark);
+ RegisterAnchor(anchor, node);
+ Push(node);
+ return node;
+}
+
+void NodeBuilder::Push(detail::node& node) {
+ const bool needsKey =
+ (!m_stack.empty() && m_stack.back()->type() == NodeType::Map &&
+ m_keys.size() < m_mapDepth);
+
+ m_stack.push_back(&node);
+ if (needsKey)
+ m_keys.push_back(PushedKey(&node, false));
+}
+
+void NodeBuilder::Pop() {
+ assert(!m_stack.empty());
+ if (m_stack.size() == 1) {
+ m_pRoot = m_stack[0];
+ m_stack.pop_back();
+ return;
+ }
+
+ detail::node& node = *m_stack.back();
+ m_stack.pop_back();
+
+ detail::node& collection = *m_stack.back();
+
+ if (collection.type() == NodeType::Sequence) {
+ collection.push_back(node, m_pMemory);
+ } else if (collection.type() == NodeType::Map) {
+ assert(!m_keys.empty());
+ PushedKey& key = m_keys.back();
+ if (key.second) {
+ collection.insert(*key.first, node, m_pMemory);
+ m_keys.pop_back();
+ } else {
+ key.second = true;
+ }
+ } else {
+ assert(false);
+ m_stack.clear();
+ }
+}
+
+void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) {
+ if (anchor) {
+ assert(anchor == m_anchors.size());
+ m_anchors.push_back(&node);
+ }
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/nodebuilder.h b/src/libs/3rdparty/yaml-cpp/src/nodebuilder.h
new file mode 100644
index 0000000000..a6a47f007b
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/nodebuilder.h
@@ -0,0 +1,70 @@
+#ifndef NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+struct Mark;
+} // namespace YAML
+
+namespace YAML {
+class Node;
+
+class NodeBuilder : public EventHandler {
+ public:
+ NodeBuilder();
+ virtual ~NodeBuilder();
+
+ Node Root();
+
+ virtual void OnDocumentStart(const Mark& mark);
+ virtual void OnDocumentEnd();
+
+ virtual void OnNull(const Mark& mark, anchor_t anchor);
+ virtual void OnAlias(const Mark& mark, anchor_t anchor);
+ virtual void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value);
+
+ virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnSequenceEnd();
+
+ virtual void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style);
+ virtual void OnMapEnd();
+
+ private:
+ detail::node& Push(const Mark& mark, anchor_t anchor);
+ void Push(detail::node& node);
+ void Pop();
+ void RegisterAnchor(anchor_t anchor, detail::node& node);
+
+ private:
+ detail::shared_memory_holder m_pMemory;
+ detail::node* m_pRoot;
+
+ typedef std::vector<detail::node*> Nodes;
+ Nodes m_stack;
+ Nodes m_anchors;
+
+ typedef std::pair<detail::node*, bool> PushedKey;
+ std::vector<PushedKey> m_keys;
+ std::size_t m_mapDepth;
+};
+}
+
+#endif // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/nodeevents.cpp b/src/libs/3rdparty/yaml-cpp/src/nodeevents.cpp
new file mode 100644
index 0000000000..82261feb05
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/nodeevents.cpp
@@ -0,0 +1,101 @@
+#include "nodeevents.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+void NodeEvents::AliasManager::RegisterReference(const detail::node& node) {
+ m_anchorByIdentity.insert(std::make_pair(node.ref(), _CreateNewAnchor()));
+}
+
+anchor_t NodeEvents::AliasManager::LookupAnchor(
+ const detail::node& node) const {
+ AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref());
+ if (it == m_anchorByIdentity.end())
+ return 0;
+ return it->second;
+}
+
+NodeEvents::NodeEvents(const Node& node)
+ : m_pMemory(node.m_pMemory), m_root(node.m_pNode) {
+ if (m_root)
+ Setup(*m_root);
+}
+
+void NodeEvents::Setup(const detail::node& node) {
+ int& refCount = m_refCount[node.ref()];
+ refCount++;
+ if (refCount > 1)
+ return;
+
+ if (node.type() == NodeType::Sequence) {
+ for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it)
+ Setup(**it);
+ } else if (node.type() == NodeType::Map) {
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it) {
+ Setup(*it->first);
+ Setup(*it->second);
+ }
+ }
+}
+
+void NodeEvents::Emit(EventHandler& handler) {
+ AliasManager am;
+
+ handler.OnDocumentStart(Mark());
+ if (m_root)
+ Emit(*m_root, handler, am);
+ handler.OnDocumentEnd();
+}
+
+void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
+ AliasManager& am) const {
+ anchor_t anchor = NullAnchor;
+ if (IsAliased(node)) {
+ anchor = am.LookupAnchor(node);
+ if (anchor) {
+ handler.OnAlias(Mark(), anchor);
+ return;
+ }
+
+ am.RegisterReference(node);
+ anchor = am.LookupAnchor(node);
+ }
+
+ switch (node.type()) {
+ case NodeType::Undefined:
+ break;
+ case NodeType::Null:
+ handler.OnNull(Mark(), anchor);
+ break;
+ case NodeType::Scalar:
+ handler.OnScalar(Mark(), node.tag(), anchor, node.scalar());
+ break;
+ case NodeType::Sequence:
+ handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it)
+ Emit(**it, handler, am);
+ handler.OnSequenceEnd();
+ break;
+ case NodeType::Map:
+ handler.OnMapStart(Mark(), node.tag(), anchor, node.style());
+ for (detail::const_node_iterator it = node.begin(); it != node.end();
+ ++it) {
+ Emit(*it->first, handler, am);
+ Emit(*it->second, handler, am);
+ }
+ handler.OnMapEnd();
+ break;
+ }
+}
+
+bool NodeEvents::IsAliased(const detail::node& node) const {
+ RefCount::const_iterator it = m_refCount.find(node.ref());
+ return it != m_refCount.end() && it->second > 1;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/nodeevents.h b/src/libs/3rdparty/yaml-cpp/src/nodeevents.h
new file mode 100644
index 0000000000..49c18eb854
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/nodeevents.h
@@ -0,0 +1,64 @@
+#ifndef NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <map>
+#include <vector>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+} // namespace detail
+} // namespace YAML
+
+namespace YAML {
+class EventHandler;
+class Node;
+
+class NodeEvents {
+ public:
+ explicit NodeEvents(const Node& node);
+
+ void Emit(EventHandler& handler);
+
+ private:
+ class AliasManager {
+ public:
+ AliasManager() : m_curAnchor(0) {}
+
+ void RegisterReference(const detail::node& node);
+ anchor_t LookupAnchor(const detail::node& node) const;
+
+ private:
+ anchor_t _CreateNewAnchor() { return ++m_curAnchor; }
+
+ private:
+ typedef std::map<const detail::node_ref*, anchor_t> AnchorByIdentity;
+ AnchorByIdentity m_anchorByIdentity;
+
+ anchor_t m_curAnchor;
+ };
+
+ void Setup(const detail::node& node);
+ void Emit(const detail::node& node, EventHandler& handler,
+ AliasManager& am) const;
+ bool IsAliased(const detail::node& node) const;
+
+ private:
+ detail::shared_memory_holder m_pMemory;
+ detail::node* m_root;
+
+ typedef std::map<const detail::node_ref*, int> RefCount;
+ RefCount m_refCount;
+};
+}
+
+#endif // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/null.cpp b/src/libs/3rdparty/yaml-cpp/src/null.cpp
new file mode 100644
index 0000000000..d12dd08ce4
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/null.cpp
@@ -0,0 +1,10 @@
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+_Null Null;
+
+bool IsNullString(const std::string& str) {
+ return str.empty() || str == "~" || str == "null" || str == "Null" ||
+ str == "NULL";
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/ostream_wrapper.cpp b/src/libs/3rdparty/yaml-cpp/src/ostream_wrapper.cpp
new file mode 100644
index 0000000000..357fc0094c
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/ostream_wrapper.cpp
@@ -0,0 +1,57 @@
+#include "yaml-cpp/ostream_wrapper.h"
+
+#include <algorithm>
+#include <cstring>
+#include <iostream>
+
+namespace YAML {
+ostream_wrapper::ostream_wrapper()
+ : m_buffer(1, '\0'),
+ m_pStream(0),
+ m_pos(0),
+ m_row(0),
+ m_col(0),
+ m_comment(false) {}
+
+ostream_wrapper::ostream_wrapper(std::ostream& stream)
+ : m_pStream(&stream), m_pos(0), m_row(0), m_col(0), m_comment(false) {}
+
+ostream_wrapper::~ostream_wrapper() {}
+
+void ostream_wrapper::write(const std::string& str) {
+ if (m_pStream) {
+ m_pStream->write(str.c_str(), str.size());
+ } else {
+ m_buffer.resize(std::max(m_buffer.size(), m_pos + str.size() + 1));
+ std::copy(str.begin(), str.end(), m_buffer.begin() + m_pos);
+ }
+
+ for (std::size_t i = 0; i < str.size(); i++) {
+ update_pos(str[i]);
+ }
+}
+
+void ostream_wrapper::write(const char* str, std::size_t size) {
+ if (m_pStream) {
+ m_pStream->write(str, size);
+ } else {
+ m_buffer.resize(std::max(m_buffer.size(), m_pos + size + 1));
+ std::copy(str, str + size, m_buffer.begin() + m_pos);
+ }
+
+ for (std::size_t i = 0; i < size; i++) {
+ update_pos(str[i]);
+ }
+}
+
+void ostream_wrapper::update_pos(char ch) {
+ m_pos++;
+ m_col++;
+
+ if (ch == '\n') {
+ m_row++;
+ m_col = 0;
+ m_comment = false;
+ }
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/parse.cpp b/src/libs/3rdparty/yaml-cpp/src/parse.cpp
new file mode 100644
index 0000000000..0b2ae4a4f6
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/parse.cpp
@@ -0,0 +1,72 @@
+#include "yaml-cpp/node/parse.h"
+
+#include <fstream>
+#include <sstream>
+
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/parser.h"
+#include "nodebuilder.h"
+
+namespace YAML {
+Node Load(const std::string& input) {
+ std::stringstream stream(input);
+ return Load(stream);
+}
+
+Node Load(const char* input) {
+ std::stringstream stream(input);
+ return Load(stream);
+}
+
+Node Load(std::istream& input) {
+ Parser parser(input);
+ NodeBuilder builder;
+ if (!parser.HandleNextDocument(builder)) {
+ return Node();
+ }
+
+ return builder.Root();
+}
+
+Node LoadFile(const std::string& filename) {
+ std::ifstream fin(filename.c_str());
+ if (!fin) {
+ throw BadFile();
+ }
+ return Load(fin);
+}
+
+std::vector<Node> LoadAll(const std::string& input) {
+ std::stringstream stream(input);
+ return LoadAll(stream);
+}
+
+std::vector<Node> LoadAll(const char* input) {
+ std::stringstream stream(input);
+ return LoadAll(stream);
+}
+
+std::vector<Node> LoadAll(std::istream& input) {
+ std::vector<Node> docs;
+
+ Parser parser(input);
+ while (1) {
+ NodeBuilder builder;
+ if (!parser.HandleNextDocument(builder)) {
+ break;
+ }
+ docs.push_back(builder.Root());
+ }
+
+ return docs;
+}
+
+std::vector<Node> LoadAllFromFile(const std::string& filename) {
+ std::ifstream fin(filename.c_str());
+ if (!fin) {
+ throw BadFile();
+ }
+ return LoadAll(fin);
+}
+} // namespace YAML
diff --git a/src/libs/3rdparty/yaml-cpp/src/parser.cpp b/src/libs/3rdparty/yaml-cpp/src/parser.cpp
new file mode 100644
index 0000000000..cd69f39fce
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/parser.cpp
@@ -0,0 +1,129 @@
+#include <cstdio>
+#include <sstream>
+
+#include "directives.h" // IWYU pragma: keep
+#include "scanner.h" // IWYU pragma: keep
+#include "singledocparser.h"
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/parser.h"
+
+namespace YAML {
+class EventHandler;
+
+Parser::Parser() {}
+
+Parser::Parser(std::istream& in) { Load(in); }
+
+Parser::~Parser() {}
+
+Parser::operator bool() const {
+ return m_pScanner.get() && !m_pScanner->empty();
+}
+
+void Parser::Load(std::istream& in) {
+ m_pScanner.reset(new Scanner(in));
+ m_pDirectives.reset(new Directives);
+}
+
+bool Parser::HandleNextDocument(EventHandler& eventHandler) {
+ if (!m_pScanner.get())
+ return false;
+
+ ParseDirectives();
+ if (m_pScanner->empty()) {
+ return false;
+ }
+
+ SingleDocParser sdp(*m_pScanner, *m_pDirectives);
+ sdp.HandleDocument(eventHandler);
+ return true;
+}
+
+void Parser::ParseDirectives() {
+ bool readDirective = false;
+
+ while (1) {
+ if (m_pScanner->empty()) {
+ break;
+ }
+
+ Token& token = m_pScanner->peek();
+ if (token.type != Token::DIRECTIVE) {
+ break;
+ }
+
+ // we keep the directives from the last document if none are specified;
+ // but if any directives are specific, then we reset them
+ if (!readDirective) {
+ m_pDirectives.reset(new Directives);
+ }
+
+ readDirective = true;
+ HandleDirective(token);
+ m_pScanner->pop();
+ }
+}
+
+void Parser::HandleDirective(const Token& token) {
+ if (token.value == "YAML") {
+ HandleYamlDirective(token);
+ } else if (token.value == "TAG") {
+ HandleTagDirective(token);
+ }
+}
+
+void Parser::HandleYamlDirective(const Token& token) {
+ if (token.params.size() != 1) {
+ throw ParserException(token.mark, ErrorMsg::YAML_DIRECTIVE_ARGS);
+ }
+
+ if (!m_pDirectives->version.isDefault) {
+ throw ParserException(token.mark, ErrorMsg::REPEATED_YAML_DIRECTIVE);
+ }
+
+ std::stringstream str(token.params[0]);
+ str >> m_pDirectives->version.major;
+ str.get();
+ str >> m_pDirectives->version.minor;
+ if (!str || str.peek() != EOF) {
+ throw ParserException(
+ token.mark, std::string(ErrorMsg::YAML_VERSION) + token.params[0]);
+ }
+
+ if (m_pDirectives->version.major > 1) {
+ throw ParserException(token.mark, ErrorMsg::YAML_MAJOR_VERSION);
+ }
+
+ m_pDirectives->version.isDefault = false;
+ // TODO: warning on major == 1, minor > 2?
+}
+
+void Parser::HandleTagDirective(const Token& token) {
+ if (token.params.size() != 2)
+ throw ParserException(token.mark, ErrorMsg::TAG_DIRECTIVE_ARGS);
+
+ const std::string& handle = token.params[0];
+ const std::string& prefix = token.params[1];
+ if (m_pDirectives->tags.find(handle) != m_pDirectives->tags.end()) {
+ throw ParserException(token.mark, ErrorMsg::REPEATED_TAG_DIRECTIVE);
+ }
+
+ m_pDirectives->tags[handle] = prefix;
+}
+
+void Parser::PrintTokens(std::ostream& out) {
+ if (!m_pScanner.get()) {
+ return;
+ }
+
+ while (1) {
+ if (m_pScanner->empty()) {
+ break;
+ }
+
+ out << m_pScanner->peek() << "\n";
+ m_pScanner->pop();
+ }
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/ptr_vector.h b/src/libs/3rdparty/yaml-cpp/src/ptr_vector.h
new file mode 100644
index 0000000000..955aebd8d5
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/ptr_vector.h
@@ -0,0 +1,43 @@
+#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <cstdlib>
+#include <memory>
+#include <vector>
+
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+
+// TODO: This class is no longer needed
+template <typename T>
+class ptr_vector : private YAML::noncopyable {
+ public:
+ ptr_vector() {}
+
+ void clear() { m_data.clear(); }
+
+ std::size_t size() const { return m_data.size(); }
+ bool empty() const { return m_data.empty(); }
+
+ void push_back(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); }
+ T& operator[](std::size_t i) { return *m_data[i]; }
+ const T& operator[](std::size_t i) const { return *m_data[i]; }
+
+ T& back() { return *(m_data.back().get()); }
+
+ const T& back() const { return *(m_data.back().get()); }
+
+ private:
+ std::vector<std::unique_ptr<T>> m_data;
+};
+}
+
+#endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/regex_yaml.cpp b/src/libs/3rdparty/yaml-cpp/src/regex_yaml.cpp
new file mode 100644
index 0000000000..20b772051d
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/regex_yaml.cpp
@@ -0,0 +1,45 @@
+#include "regex_yaml.h"
+
+namespace YAML {
+// constructors
+RegEx::RegEx() : m_op(REGEX_EMPTY) {}
+
+RegEx::RegEx(REGEX_OP op) : m_op(op) {}
+
+RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {}
+
+RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {}
+
+RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) {
+ for (std::size_t i = 0; i < str.size(); i++)
+ m_params.push_back(RegEx(str[i]));
+}
+
+// combination constructors
+RegEx operator!(const RegEx& ex) {
+ RegEx ret(REGEX_NOT);
+ ret.m_params.push_back(ex);
+ return ret;
+}
+
+RegEx operator||(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_OR);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+
+RegEx operator&&(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_AND);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+
+RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
+ RegEx ret(REGEX_SEQ);
+ ret.m_params.push_back(ex1);
+ ret.m_params.push_back(ex2);
+ return ret;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/regex_yaml.h b/src/libs/3rdparty/yaml-cpp/src/regex_yaml.h
new file mode 100644
index 0000000000..8f28b852a2
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/regex_yaml.h
@@ -0,0 +1,87 @@
+#ifndef REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include <vector>
+
+#include "yaml-cpp/dll.h"
+
+namespace YAML {
+class Stream;
+
+enum REGEX_OP {
+ REGEX_EMPTY,
+ REGEX_MATCH,
+ REGEX_RANGE,
+ REGEX_OR,
+ REGEX_AND,
+ REGEX_NOT,
+ REGEX_SEQ
+};
+
+// simplified regular expressions
+// . Only straightforward matches (no repeated characters)
+// . Only matches from start of string
+class YAML_CPP_API RegEx {
+ public:
+ RegEx();
+ RegEx(char ch);
+ RegEx(char a, char z);
+ RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
+ ~RegEx() {}
+
+ friend YAML_CPP_API RegEx operator!(const RegEx& ex);
+ friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2);
+ friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2);
+
+ bool Matches(char ch) const;
+ bool Matches(const std::string& str) const;
+ bool Matches(const Stream& in) const;
+ template <typename Source>
+ bool Matches(const Source& source) const;
+
+ int Match(const std::string& str) const;
+ int Match(const Stream& in) const;
+ template <typename Source>
+ int Match(const Source& source) const;
+
+ private:
+ RegEx(REGEX_OP op);
+
+ template <typename Source>
+ bool IsValidSource(const Source& source) const;
+ template <typename Source>
+ int MatchUnchecked(const Source& source) const;
+
+ template <typename Source>
+ int MatchOpEmpty(const Source& source) const;
+ template <typename Source>
+ int MatchOpMatch(const Source& source) const;
+ template <typename Source>
+ int MatchOpRange(const Source& source) const;
+ template <typename Source>
+ int MatchOpOr(const Source& source) const;
+ template <typename Source>
+ int MatchOpAnd(const Source& source) const;
+ template <typename Source>
+ int MatchOpNot(const Source& source) const;
+ template <typename Source>
+ int MatchOpSeq(const Source& source) const;
+
+ private:
+ REGEX_OP m_op;
+ char m_a, m_z;
+ std::vector<RegEx> m_params;
+};
+}
+
+#include "regeximpl.h"
+
+#endif // REGEX_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/regeximpl.h b/src/libs/3rdparty/yaml-cpp/src/regeximpl.h
new file mode 100644
index 0000000000..709124f008
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/regeximpl.h
@@ -0,0 +1,186 @@
+#ifndef REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "stream.h"
+#include "stringsource.h"
+#include "streamcharsource.h"
+
+namespace YAML {
+// query matches
+inline bool RegEx::Matches(char ch) const {
+ std::string str;
+ str += ch;
+ return Matches(str);
+}
+
+inline bool RegEx::Matches(const std::string& str) const {
+ return Match(str) >= 0;
+}
+
+inline bool RegEx::Matches(const Stream& in) const { return Match(in) >= 0; }
+
+template <typename Source>
+inline bool RegEx::Matches(const Source& source) const {
+ return Match(source) >= 0;
+}
+
+// Match
+// . Matches the given string against this regular expression.
+// . Returns the number of characters matched.
+// . Returns -1 if no characters were matched (the reason for
+// not returning zero is that we may have an empty regex
+// which is ALWAYS successful at matching zero characters).
+// . REMEMBER that we only match from the start of the buffer!
+inline int RegEx::Match(const std::string& str) const {
+ StringCharSource source(str.c_str(), str.size());
+ return Match(source);
+}
+
+inline int RegEx::Match(const Stream& in) const {
+ StreamCharSource source(in);
+ return Match(source);
+}
+
+template <typename Source>
+inline bool RegEx::IsValidSource(const Source& source) const {
+ return source;
+}
+
+template <>
+inline bool RegEx::IsValidSource<StringCharSource>(
+ const StringCharSource& source) const {
+ switch (m_op) {
+ case REGEX_MATCH:
+ case REGEX_RANGE:
+ return source;
+ default:
+ return true;
+ }
+}
+
+template <typename Source>
+inline int RegEx::Match(const Source& source) const {
+ return IsValidSource(source) ? MatchUnchecked(source) : -1;
+}
+
+template <typename Source>
+inline int RegEx::MatchUnchecked(const Source& source) const {
+ switch (m_op) {
+ case REGEX_EMPTY:
+ return MatchOpEmpty(source);
+ case REGEX_MATCH:
+ return MatchOpMatch(source);
+ case REGEX_RANGE:
+ return MatchOpRange(source);
+ case REGEX_OR:
+ return MatchOpOr(source);
+ case REGEX_AND:
+ return MatchOpAnd(source);
+ case REGEX_NOT:
+ return MatchOpNot(source);
+ case REGEX_SEQ:
+ return MatchOpSeq(source);
+ }
+
+ return -1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Operators
+// Note: the convention MatchOp*<Source> is that we can assume
+// IsSourceValid(source).
+// So we do all our checks *before* we call these functions
+
+// EmptyOperator
+template <typename Source>
+inline int RegEx::MatchOpEmpty(const Source& source) const {
+ return source[0] == Stream::eof() ? 0 : -1;
+}
+
+template <>
+inline int RegEx::MatchOpEmpty<StringCharSource>(
+ const StringCharSource& source) const {
+ return !source
+ ? 0
+ : -1; // the empty regex only is successful on the empty string
+}
+
+// MatchOperator
+template <typename Source>
+inline int RegEx::MatchOpMatch(const Source& source) const {
+ if (source[0] != m_a)
+ return -1;
+ return 1;
+}
+
+// RangeOperator
+template <typename Source>
+inline int RegEx::MatchOpRange(const Source& source) const {
+ if (m_a > source[0] || m_z < source[0])
+ return -1;
+ return 1;
+}
+
+// OrOperator
+template <typename Source>
+inline int RegEx::MatchOpOr(const Source& source) const {
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].MatchUnchecked(source);
+ if (n >= 0)
+ return n;
+ }
+ return -1;
+}
+
+// AndOperator
+// Note: 'AND' is a little funny, since we may be required to match things
+// of different lengths. If we find a match, we return the length of
+// the FIRST entry on the list.
+template <typename Source>
+inline int RegEx::MatchOpAnd(const Source& source) const {
+ int first = -1;
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].MatchUnchecked(source);
+ if (n == -1)
+ return -1;
+ if (i == 0)
+ first = n;
+ }
+ return first;
+}
+
+// NotOperator
+template <typename Source>
+inline int RegEx::MatchOpNot(const Source& source) const {
+ if (m_params.empty())
+ return -1;
+ if (m_params[0].MatchUnchecked(source) >= 0)
+ return -1;
+ return 1;
+}
+
+// SeqOperator
+template <typename Source>
+inline int RegEx::MatchOpSeq(const Source& source) const {
+ int offset = 0;
+ for (std::size_t i = 0; i < m_params.size(); i++) {
+ int n = m_params[i].Match(source + offset); // note Match, not
+ // MatchUnchecked because we
+ // need to check validity after
+ // the offset
+ if (n == -1)
+ return -1;
+ offset += n;
+ }
+
+ return offset;
+}
+}
+
+#endif // REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/scanner.cpp b/src/libs/3rdparty/yaml-cpp/src/scanner.cpp
new file mode 100644
index 0000000000..b5cfcc12b2
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scanner.cpp
@@ -0,0 +1,386 @@
+#include <cassert>
+#include <memory>
+
+#include "exp.h"
+#include "scanner.h"
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+Scanner::Scanner(std::istream& in)
+ : INPUT(in),
+ m_startedStream(false),
+ m_endedStream(false),
+ m_simpleKeyAllowed(false),
+ m_canBeJSONFlow(false) {}
+
+Scanner::~Scanner() {}
+
+bool Scanner::empty() {
+ EnsureTokensInQueue();
+ return m_tokens.empty();
+}
+
+void Scanner::pop() {
+ EnsureTokensInQueue();
+ if (!m_tokens.empty())
+ m_tokens.pop();
+}
+
+Token& Scanner::peek() {
+ EnsureTokensInQueue();
+ assert(!m_tokens.empty()); // should we be asserting here? I mean, we really
+ // just be checking
+ // if it's empty before peeking.
+
+#if 0
+ static Token *pLast = 0;
+ if(pLast != &m_tokens.front())
+ std::cerr << "peek: " << m_tokens.front() << "\n";
+ pLast = &m_tokens.front();
+#endif
+
+ return m_tokens.front();
+}
+
+Mark Scanner::mark() const { return INPUT.mark(); }
+
+void Scanner::EnsureTokensInQueue() {
+ while (1) {
+ if (!m_tokens.empty()) {
+ Token& token = m_tokens.front();
+
+ // if this guy's valid, then we're done
+ if (token.status == Token::VALID) {
+ return;
+ }
+
+ // here's where we clean up the impossible tokens
+ if (token.status == Token::INVALID) {
+ m_tokens.pop();
+ continue;
+ }
+
+ // note: what's left are the unverified tokens
+ }
+
+ // no token? maybe we've actually finished
+ if (m_endedStream) {
+ return;
+ }
+
+ // no? then scan...
+ ScanNextToken();
+ }
+}
+
+void Scanner::ScanNextToken() {
+ if (m_endedStream) {
+ return;
+ }
+
+ if (!m_startedStream) {
+ return StartStream();
+ }
+
+ // get rid of whitespace, etc. (in between tokens it should be irrelevent)
+ ScanToNextToken();
+
+ // maybe need to end some blocks
+ PopIndentToHere();
+
+ // *****
+ // And now branch based on the next few characters!
+ // *****
+
+ // end of stream
+ if (!INPUT) {
+ return EndStream();
+ }
+
+ if (INPUT.column() == 0 && INPUT.peek() == Keys::Directive) {
+ return ScanDirective();
+ }
+
+ // document token
+ if (INPUT.column() == 0 && Exp::DocStart().Matches(INPUT)) {
+ return ScanDocStart();
+ }
+
+ if (INPUT.column() == 0 && Exp::DocEnd().Matches(INPUT)) {
+ return ScanDocEnd();
+ }
+
+ // flow start/end/entry
+ if (INPUT.peek() == Keys::FlowSeqStart ||
+ INPUT.peek() == Keys::FlowMapStart) {
+ return ScanFlowStart();
+ }
+
+ if (INPUT.peek() == Keys::FlowSeqEnd || INPUT.peek() == Keys::FlowMapEnd) {
+ return ScanFlowEnd();
+ }
+
+ if (INPUT.peek() == Keys::FlowEntry) {
+ return ScanFlowEntry();
+ }
+
+ // block/map stuff
+ if (Exp::BlockEntry().Matches(INPUT)) {
+ return ScanBlockEntry();
+ }
+
+ if ((InBlockContext() ? Exp::Key() : Exp::KeyInFlow()).Matches(INPUT)) {
+ return ScanKey();
+ }
+
+ if (GetValueRegex().Matches(INPUT)) {
+ return ScanValue();
+ }
+
+ // alias/anchor
+ if (INPUT.peek() == Keys::Alias || INPUT.peek() == Keys::Anchor) {
+ return ScanAnchorOrAlias();
+ }
+
+ // tag
+ if (INPUT.peek() == Keys::Tag) {
+ return ScanTag();
+ }
+
+ // special scalars
+ if (InBlockContext() && (INPUT.peek() == Keys::LiteralScalar ||
+ INPUT.peek() == Keys::FoldedScalar)) {
+ return ScanBlockScalar();
+ }
+
+ if (INPUT.peek() == '\'' || INPUT.peek() == '\"') {
+ return ScanQuotedScalar();
+ }
+
+ // plain scalars
+ if ((InBlockContext() ? Exp::PlainScalar() : Exp::PlainScalarInFlow())
+ .Matches(INPUT)) {
+ return ScanPlainScalar();
+ }
+
+ // don't know what it is!
+ throw ParserException(INPUT.mark(), ErrorMsg::UNKNOWN_TOKEN);
+}
+
+void Scanner::ScanToNextToken() {
+ while (1) {
+ // first eat whitespace
+ while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) {
+ if (InBlockContext() && Exp::Tab().Matches(INPUT)) {
+ m_simpleKeyAllowed = false;
+ }
+ INPUT.eat(1);
+ }
+
+ // then eat a comment
+ if (Exp::Comment().Matches(INPUT)) {
+ // eat until line break
+ while (INPUT && !Exp::Break().Matches(INPUT)) {
+ INPUT.eat(1);
+ }
+ }
+
+ // if it's NOT a line break, then we're done!
+ if (!Exp::Break().Matches(INPUT)) {
+ break;
+ }
+
+ // otherwise, let's eat the line break and keep going
+ int n = Exp::Break().Match(INPUT);
+ INPUT.eat(n);
+
+ // oh yeah, and let's get rid of that simple key
+ InvalidateSimpleKey();
+
+ // new line - we may be able to accept a simple key now
+ if (InBlockContext()) {
+ m_simpleKeyAllowed = true;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+// Misc. helpers
+
+// IsWhitespaceToBeEaten
+// . We can eat whitespace if it's a space or tab
+// . Note: originally tabs in block context couldn't be eaten
+// "where a simple key could be allowed
+// (i.e., not at the beginning of a line, or following '-', '?', or
+// ':')"
+// I think this is wrong, since tabs can be non-content whitespace; it's just
+// that they can't contribute to indentation, so once you've seen a tab in a
+// line, you can't start a simple key
+bool Scanner::IsWhitespaceToBeEaten(char ch) {
+ if (ch == ' ') {
+ return true;
+ }
+
+ if (ch == '\t') {
+ return true;
+ }
+
+ return false;
+}
+
+const RegEx& Scanner::GetValueRegex() const {
+ if (InBlockContext()) {
+ return Exp::Value();
+ }
+
+ return m_canBeJSONFlow ? Exp::ValueInJSONFlow() : Exp::ValueInFlow();
+}
+
+void Scanner::StartStream() {
+ m_startedStream = true;
+ m_simpleKeyAllowed = true;
+ std::unique_ptr<IndentMarker> pIndent(
+ new IndentMarker(-1, IndentMarker::NONE));
+ m_indentRefs.push_back(std::move(pIndent));
+ m_indents.push(&m_indentRefs.back());
+}
+
+void Scanner::EndStream() {
+ // force newline
+ if (INPUT.column() > 0) {
+ INPUT.ResetColumn();
+ }
+
+ PopAllIndents();
+ PopAllSimpleKeys();
+
+ m_simpleKeyAllowed = false;
+ m_endedStream = true;
+}
+
+Token* Scanner::PushToken(Token::TYPE type) {
+ m_tokens.push(Token(type, INPUT.mark()));
+ return &m_tokens.back();
+}
+
+Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const {
+ switch (type) {
+ case IndentMarker::SEQ:
+ return Token::BLOCK_SEQ_START;
+ case IndentMarker::MAP:
+ return Token::BLOCK_MAP_START;
+ case IndentMarker::NONE:
+ assert(false);
+ break;
+ }
+ assert(false);
+ throw std::runtime_error("yaml-cpp: internal error, invalid indent type");
+}
+
+Scanner::IndentMarker* Scanner::PushIndentTo(int column,
+ IndentMarker::INDENT_TYPE type) {
+ // are we in flow?
+ if (InFlowContext()) {
+ return 0;
+ }
+
+ std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
+ IndentMarker& indent = *pIndent;
+ const IndentMarker& lastIndent = *m_indents.top();
+
+ // is this actually an indentation?
+ if (indent.column < lastIndent.column) {
+ return 0;
+ }
+ if (indent.column == lastIndent.column &&
+ !(indent.type == IndentMarker::SEQ &&
+ lastIndent.type == IndentMarker::MAP)) {
+ return 0;
+ }
+
+ // push a start token
+ indent.pStartToken = PushToken(GetStartTokenFor(type));
+
+ // and then the indent
+ m_indents.push(&indent);
+ m_indentRefs.push_back(std::move(pIndent));
+ return &m_indentRefs.back();
+}
+
+void Scanner::PopIndentToHere() {
+ // are we in flow?
+ if (InFlowContext()) {
+ return;
+ }
+
+ // now pop away
+ while (!m_indents.empty()) {
+ const IndentMarker& indent = *m_indents.top();
+ if (indent.column < INPUT.column()) {
+ break;
+ }
+ if (indent.column == INPUT.column() &&
+ !(indent.type == IndentMarker::SEQ &&
+ !Exp::BlockEntry().Matches(INPUT))) {
+ break;
+ }
+
+ PopIndent();
+ }
+
+ while (!m_indents.empty() &&
+ m_indents.top()->status == IndentMarker::INVALID) {
+ PopIndent();
+ }
+}
+
+void Scanner::PopAllIndents() {
+ // are we in flow?
+ if (InFlowContext()) {
+ return;
+ }
+
+ // now pop away
+ while (!m_indents.empty()) {
+ const IndentMarker& indent = *m_indents.top();
+ if (indent.type == IndentMarker::NONE) {
+ break;
+ }
+
+ PopIndent();
+ }
+}
+
+void Scanner::PopIndent() {
+ const IndentMarker& indent = *m_indents.top();
+ m_indents.pop();
+
+ if (indent.status != IndentMarker::VALID) {
+ InvalidateSimpleKey();
+ return;
+ }
+
+ if (indent.type == IndentMarker::SEQ) {
+ m_tokens.push(Token(Token::BLOCK_SEQ_END, INPUT.mark()));
+ } else if (indent.type == IndentMarker::MAP) {
+ m_tokens.push(Token(Token::BLOCK_MAP_END, INPUT.mark()));
+ }
+}
+
+int Scanner::GetTopIndent() const {
+ if (m_indents.empty()) {
+ return 0;
+ }
+ return m_indents.top()->column;
+}
+
+void Scanner::ThrowParserException(const std::string& msg) const {
+ Mark mark = Mark::null_mark();
+ if (!m_tokens.empty()) {
+ const Token& token = m_tokens.front();
+ mark = token.mark;
+ }
+ throw ParserException(mark, msg);
+}
+} // namespace YAML
diff --git a/src/libs/3rdparty/yaml-cpp/src/scanner.h b/src/libs/3rdparty/yaml-cpp/src/scanner.h
new file mode 100644
index 0000000000..7bb2ccc71a
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scanner.h
@@ -0,0 +1,190 @@
+#ifndef SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+#include <ios>
+#include <map>
+#include <queue>
+#include <set>
+#include <stack>
+#include <string>
+
+#include "ptr_vector.h"
+#include "stream.h"
+#include "token.h"
+#include "yaml-cpp/mark.h"
+
+namespace YAML {
+class Node;
+class RegEx;
+
+/**
+ * A scanner transforms a stream of characters into a stream of tokens.
+ */
+class Scanner {
+ public:
+ explicit Scanner(std::istream &in);
+ ~Scanner();
+
+ /** Returns true if there are no more tokens to be read. */
+ bool empty();
+
+ /** Removes the next token in the queue. */
+ void pop();
+
+ /** Returns, but does not remove, the next token in the queue. */
+ Token &peek();
+
+ /** Returns the current mark in the input stream. */
+ Mark mark() const;
+
+ private:
+ struct IndentMarker {
+ enum INDENT_TYPE { MAP, SEQ, NONE };
+ enum STATUS { VALID, INVALID, UNKNOWN };
+ IndentMarker(int column_, INDENT_TYPE type_)
+ : column(column_), type(type_), status(VALID), pStartToken(0) {}
+
+ int column;
+ INDENT_TYPE type;
+ STATUS status;
+ Token *pStartToken;
+ };
+
+ enum FLOW_MARKER { FLOW_MAP, FLOW_SEQ };
+
+ private:
+ // scanning
+
+ /**
+ * Scans until there's a valid token at the front of the queue, or the queue
+ * is empty. The state can be checked by {@link #empty}, and the next token
+ * retrieved by {@link #peek}.
+ */
+ void EnsureTokensInQueue();
+
+ /**
+ * The main scanning function; this method branches out to scan whatever the
+ * next token should be.
+ */
+ void ScanNextToken();
+
+ /** Eats the input stream until it reaches the next token-like thing. */
+ void ScanToNextToken();
+
+ /** Sets the initial conditions for starting a stream. */
+ void StartStream();
+
+ /** Closes out the stream, finish up, etc. */
+ void EndStream();
+
+ Token *PushToken(Token::TYPE type);
+
+ bool InFlowContext() const { return !m_flows.empty(); }
+ bool InBlockContext() const { return m_flows.empty(); }
+ std::size_t GetFlowLevel() const { return m_flows.size(); }
+
+ Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
+
+ /**
+ * Pushes an indentation onto the stack, and enqueues the proper token
+ * (sequence start or mapping start).
+ *
+ * @return the indent marker it generates (if any).
+ */
+ IndentMarker *PushIndentTo(int column, IndentMarker::INDENT_TYPE type);
+
+ /**
+ * Pops indentations off the stack until it reaches the current indentation
+ * level, and enqueues the proper token each time. Then pops all invalid
+ * indentations off.
+ */
+ void PopIndentToHere();
+
+ /**
+ * Pops all indentations (except for the base empty one) off the stack, and
+ * enqueues the proper token each time.
+ */
+ void PopAllIndents();
+
+ /** Pops a single indent, pushing the proper token. */
+ void PopIndent();
+ int GetTopIndent() const;
+
+ // checking input
+ bool CanInsertPotentialSimpleKey() const;
+ bool ExistsActiveSimpleKey() const;
+ void InsertPotentialSimpleKey();
+ void InvalidateSimpleKey();
+ bool VerifySimpleKey();
+ void PopAllSimpleKeys();
+
+ /**
+ * Throws a ParserException with the current token location (if available),
+ * and does not parse any more tokens.
+ */
+ void ThrowParserException(const std::string &msg) const;
+
+ bool IsWhitespaceToBeEaten(char ch);
+
+ /**
+ * Returns the appropriate regex to check if the next token is a value token.
+ */
+ const RegEx &GetValueRegex() const;
+
+ struct SimpleKey {
+ SimpleKey(const Mark &mark_, std::size_t flowLevel_);
+
+ void Validate();
+ void Invalidate();
+
+ Mark mark;
+ std::size_t flowLevel;
+ IndentMarker *pIndent;
+ Token *pMapStart, *pKey;
+ };
+
+ // and the tokens
+ void ScanDirective();
+ void ScanDocStart();
+ void ScanDocEnd();
+ void ScanBlockSeqStart();
+ void ScanBlockMapSTart();
+ void ScanBlockEnd();
+ void ScanBlockEntry();
+ void ScanFlowStart();
+ void ScanFlowEnd();
+ void ScanFlowEntry();
+ void ScanKey();
+ void ScanValue();
+ void ScanAnchorOrAlias();
+ void ScanTag();
+ void ScanPlainScalar();
+ void ScanQuotedScalar();
+ void ScanBlockScalar();
+
+ private:
+ // the stream
+ Stream INPUT;
+
+ // the output (tokens)
+ std::queue<Token> m_tokens;
+
+ // state info
+ bool m_startedStream, m_endedStream;
+ bool m_simpleKeyAllowed;
+ bool m_canBeJSONFlow;
+ std::stack<SimpleKey> m_simpleKeys;
+ std::stack<IndentMarker *> m_indents;
+ ptr_vector<IndentMarker> m_indentRefs; // for "garbage collection"
+ std::stack<FLOW_MARKER> m_flows;
+};
+}
+
+#endif // SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/scanscalar.cpp b/src/libs/3rdparty/yaml-cpp/src/scanscalar.cpp
new file mode 100644
index 0000000000..10e359d446
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scanscalar.cpp
@@ -0,0 +1,250 @@
+#include "scanscalar.h"
+
+#include <algorithm>
+
+#include "exp.h"
+#include "regeximpl.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+
+namespace YAML {
+// ScanScalar
+// . This is where the scalar magic happens.
+//
+// . We do the scanning in three phases:
+// 1. Scan until newline
+// 2. Eat newline
+// 3. Scan leading blanks.
+//
+// . Depending on the parameters given, we store or stop
+// and different places in the above flow.
+std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
+ bool foundNonEmptyLine = false;
+ bool pastOpeningBreak = (params.fold == FOLD_FLOW);
+ bool emptyLine = false, moreIndented = false;
+ int foldedNewlineCount = 0;
+ bool foldedNewlineStartedMoreIndented = false;
+ std::size_t lastEscapedChar = std::string::npos;
+ std::string scalar;
+ params.leadingSpaces = false;
+
+ if (!params.end) {
+ params.end = &Exp::Empty();
+ }
+
+ while (INPUT) {
+ // ********************************
+ // Phase #1: scan until line ending
+
+ std::size_t lastNonWhitespaceChar = scalar.size();
+ bool escapedNewline = false;
+ while (!params.end->Matches(INPUT) && !Exp::Break().Matches(INPUT)) {
+ if (!INPUT) {
+ break;
+ }
+
+ // document indicator?
+ if (INPUT.column() == 0 && Exp::DocIndicator().Matches(INPUT)) {
+ if (params.onDocIndicator == BREAK) {
+ break;
+ } else if (params.onDocIndicator == THROW) {
+ throw ParserException(INPUT.mark(), ErrorMsg::DOC_IN_SCALAR);
+ }
+ }
+
+ foundNonEmptyLine = true;
+ pastOpeningBreak = true;
+
+ // escaped newline? (only if we're escaping on slash)
+ if (params.escape == '\\' && Exp::EscBreak().Matches(INPUT)) {
+ // eat escape character and get out (but preserve trailing whitespace!)
+ INPUT.get();
+ lastNonWhitespaceChar = scalar.size();
+ lastEscapedChar = scalar.size();
+ escapedNewline = true;
+ break;
+ }
+
+ // escape this?
+ if (INPUT.peek() == params.escape) {
+ scalar += Exp::Escape(INPUT);
+ lastNonWhitespaceChar = scalar.size();
+ lastEscapedChar = scalar.size();
+ continue;
+ }
+
+ // otherwise, just add the damn character
+ char ch = INPUT.get();
+ scalar += ch;
+ if (ch != ' ' && ch != '\t') {
+ lastNonWhitespaceChar = scalar.size();
+ }
+ }
+
+ // eof? if we're looking to eat something, then we throw
+ if (!INPUT) {
+ if (params.eatEnd) {
+ throw ParserException(INPUT.mark(), ErrorMsg::EOF_IN_SCALAR);
+ }
+ break;
+ }
+
+ // doc indicator?
+ if (params.onDocIndicator == BREAK && INPUT.column() == 0 &&
+ Exp::DocIndicator().Matches(INPUT)) {
+ break;
+ }
+
+ // are we done via character match?
+ int n = params.end->Match(INPUT);
+ if (n >= 0) {
+ if (params.eatEnd) {
+ INPUT.eat(n);
+ }
+ break;
+ }
+
+ // do we remove trailing whitespace?
+ if (params.fold == FOLD_FLOW)
+ scalar.erase(lastNonWhitespaceChar);
+
+ // ********************************
+ // Phase #2: eat line ending
+ n = Exp::Break().Match(INPUT);
+ INPUT.eat(n);
+
+ // ********************************
+ // Phase #3: scan initial spaces
+
+ // first the required indentation
+ while (INPUT.peek() == ' ' &&
+ (INPUT.column() < params.indent ||
+ (params.detectIndent && !foundNonEmptyLine)) &&
+ !params.end->Matches(INPUT)) {
+ INPUT.eat(1);
+ }
+
+ // update indent if we're auto-detecting
+ if (params.detectIndent && !foundNonEmptyLine) {
+ params.indent = std::max(params.indent, INPUT.column());
+ }
+
+ // and then the rest of the whitespace
+ while (Exp::Blank().Matches(INPUT)) {
+ // we check for tabs that masquerade as indentation
+ if (INPUT.peek() == '\t' && INPUT.column() < params.indent &&
+ params.onTabInIndentation == THROW) {
+ throw ParserException(INPUT.mark(), ErrorMsg::TAB_IN_INDENTATION);
+ }
+
+ if (!params.eatLeadingWhitespace) {
+ break;
+ }
+
+ if (params.end->Matches(INPUT)) {
+ break;
+ }
+
+ INPUT.eat(1);
+ }
+
+ // was this an empty line?
+ bool nextEmptyLine = Exp::Break().Matches(INPUT);
+ bool nextMoreIndented = Exp::Blank().Matches(INPUT);
+ if (params.fold == FOLD_BLOCK && foldedNewlineCount == 0 && nextEmptyLine)
+ foldedNewlineStartedMoreIndented = moreIndented;
+
+ // for block scalars, we always start with a newline, so we should ignore it
+ // (not fold or keep)
+ if (pastOpeningBreak) {
+ switch (params.fold) {
+ case DONT_FOLD:
+ scalar += "\n";
+ break;
+ case FOLD_BLOCK:
+ if (!emptyLine && !nextEmptyLine && !moreIndented &&
+ !nextMoreIndented && INPUT.column() >= params.indent) {
+ scalar += " ";
+ } else if (nextEmptyLine) {
+ foldedNewlineCount++;
+ } else {
+ scalar += "\n";
+ }
+
+ if (!nextEmptyLine && foldedNewlineCount > 0) {
+ scalar += std::string(foldedNewlineCount - 1, '\n');
+ if (foldedNewlineStartedMoreIndented ||
+ nextMoreIndented | !foundNonEmptyLine) {
+ scalar += "\n";
+ }
+ foldedNewlineCount = 0;
+ }
+ break;
+ case FOLD_FLOW:
+ if (nextEmptyLine) {
+ scalar += "\n";
+ } else if (!emptyLine && !nextEmptyLine && !escapedNewline) {
+ scalar += " ";
+ }
+ break;
+ }
+ }
+
+ emptyLine = nextEmptyLine;
+ moreIndented = nextMoreIndented;
+ pastOpeningBreak = true;
+
+ // are we done via indentation?
+ if (!emptyLine && INPUT.column() < params.indent) {
+ params.leadingSpaces = true;
+ break;
+ }
+ }
+
+ // post-processing
+ if (params.trimTrailingSpaces) {
+ std::size_t pos = scalar.find_last_not_of(' ');
+ if (lastEscapedChar != std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
+ pos = lastEscapedChar;
+ }
+ }
+ if (pos < scalar.size()) {
+ scalar.erase(pos + 1);
+ }
+ }
+
+ switch (params.chomp) {
+ case CLIP: {
+ std::size_t pos = scalar.find_last_not_of('\n');
+ if (lastEscapedChar != std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
+ pos = lastEscapedChar;
+ }
+ }
+ if (pos == std::string::npos) {
+ scalar.erase();
+ } else if (pos + 1 < scalar.size()) {
+ scalar.erase(pos + 2);
+ }
+ } break;
+ case STRIP: {
+ std::size_t pos = scalar.find_last_not_of('\n');
+ if (lastEscapedChar != std::string::npos) {
+ if (pos < lastEscapedChar || pos == std::string::npos) {
+ pos = lastEscapedChar;
+ }
+ }
+ if (pos == std::string::npos) {
+ scalar.erase();
+ } else if (pos < scalar.size()) {
+ scalar.erase(pos + 1);
+ }
+ } break;
+ default:
+ break;
+ }
+
+ return scalar;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/scanscalar.h b/src/libs/3rdparty/yaml-cpp/src/scanscalar.h
new file mode 100644
index 0000000000..c3a574ad9b
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scanscalar.h
@@ -0,0 +1,63 @@
+#ifndef SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "regex_yaml.h"
+#include "stream.h"
+
+namespace YAML {
+enum CHOMP { STRIP = -1, CLIP, KEEP };
+enum ACTION { NONE, BREAK, THROW };
+enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW };
+
+struct ScanScalarParams {
+ ScanScalarParams()
+ : end(nullptr),
+ eatEnd(false),
+ indent(0),
+ detectIndent(false),
+ eatLeadingWhitespace(0),
+ escape(0),
+ fold(DONT_FOLD),
+ trimTrailingSpaces(0),
+ chomp(CLIP),
+ onDocIndicator(NONE),
+ onTabInIndentation(NONE),
+ leadingSpaces(false) {}
+
+ // input:
+ const RegEx* end; // what condition ends this scalar?
+ // unowned.
+ bool eatEnd; // should we eat that condition when we see it?
+ int indent; // what level of indentation should be eaten and ignored?
+ bool detectIndent; // should we try to autodetect the indent?
+ bool eatLeadingWhitespace; // should we continue eating this delicious
+ // indentation after 'indent' spaces?
+ char escape; // what character do we escape on (i.e., slash or single quote)
+ // (0 for none)
+ FOLD fold; // how do we fold line ends?
+ bool trimTrailingSpaces; // do we remove all trailing spaces (at the very
+ // end)
+ CHOMP chomp; // do we strip, clip, or keep trailing newlines (at the very
+ // end)
+ // Note: strip means kill all, clip means keep at most one, keep means keep
+ // all
+ ACTION onDocIndicator; // what do we do if we see a document indicator?
+ ACTION onTabInIndentation; // what do we do if we see a tab where we should
+ // be seeing indentation spaces
+
+ // output:
+ bool leadingSpaces;
+};
+
+std::string ScanScalar(Stream& INPUT, ScanScalarParams& info);
+}
+
+#endif // SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/scantag.cpp b/src/libs/3rdparty/yaml-cpp/src/scantag.cpp
new file mode 100644
index 0000000000..c5b39652ad
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scantag.cpp
@@ -0,0 +1,81 @@
+#include "exp.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/mark.h"
+
+namespace YAML {
+const std::string ScanVerbatimTag(Stream& INPUT) {
+ std::string tag;
+
+ // eat the start character
+ INPUT.get();
+
+ while (INPUT) {
+ if (INPUT.peek() == Keys::VerbatimTagEnd) {
+ // eat the end character
+ INPUT.get();
+ return tag;
+ }
+
+ int n = Exp::URI().Match(INPUT);
+ if (n <= 0)
+ break;
+
+ tag += INPUT.get(n);
+ }
+
+ throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG);
+}
+
+const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) {
+ std::string tag;
+ canBeHandle = true;
+ Mark firstNonWordChar;
+
+ while (INPUT) {
+ if (INPUT.peek() == Keys::Tag) {
+ if (!canBeHandle)
+ throw ParserException(firstNonWordChar, ErrorMsg::CHAR_IN_TAG_HANDLE);
+ break;
+ }
+
+ int n = 0;
+ if (canBeHandle) {
+ n = Exp::Word().Match(INPUT);
+ if (n <= 0) {
+ canBeHandle = false;
+ firstNonWordChar = INPUT.mark();
+ }
+ }
+
+ if (!canBeHandle)
+ n = Exp::Tag().Match(INPUT);
+
+ if (n <= 0)
+ break;
+
+ tag += INPUT.get(n);
+ }
+
+ return tag;
+}
+
+const std::string ScanTagSuffix(Stream& INPUT) {
+ std::string tag;
+
+ while (INPUT) {
+ int n = Exp::Tag().Match(INPUT);
+ if (n <= 0)
+ break;
+
+ tag += INPUT.get(n);
+ }
+
+ if (tag.empty())
+ throw ParserException(INPUT.mark(), ErrorMsg::TAG_WITH_NO_SUFFIX);
+
+ return tag;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/scantag.h b/src/libs/3rdparty/yaml-cpp/src/scantag.h
new file mode 100644
index 0000000000..522ba5495e
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scantag.h
@@ -0,0 +1,19 @@
+#ifndef SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+#include "stream.h"
+
+namespace YAML {
+const std::string ScanVerbatimTag(Stream& INPUT);
+const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle);
+const std::string ScanTagSuffix(Stream& INPUT);
+}
+
+#endif // SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/scantoken.cpp b/src/libs/3rdparty/yaml-cpp/src/scantoken.cpp
new file mode 100644
index 0000000000..fd8758d781
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/scantoken.cpp
@@ -0,0 +1,437 @@
+#include <sstream>
+
+#include "exp.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "scanner.h"
+#include "scanscalar.h"
+#include "scantag.h" // IWYU pragma: keep
+#include "tag.h" // IWYU pragma: keep
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/mark.h"
+
+namespace YAML {
+///////////////////////////////////////////////////////////////////////
+// Specialization for scanning specific tokens
+
+// Directive
+// . Note: no semantic checking is done here (that's for the parser to do)
+void Scanner::ScanDirective() {
+ std::string name;
+ std::vector<std::string> params;
+
+ // pop indents and simple keys
+ PopAllIndents();
+ PopAllSimpleKeys();
+
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // store pos and eat indicator
+ Token token(Token::DIRECTIVE, INPUT.mark());
+ INPUT.eat(1);
+
+ // read name
+ while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
+ token.value += INPUT.get();
+
+ // read parameters
+ while (1) {
+ // first get rid of whitespace
+ while (Exp::Blank().Matches(INPUT))
+ INPUT.eat(1);
+
+ // break on newline or comment
+ if (!INPUT || Exp::Break().Matches(INPUT) || Exp::Comment().Matches(INPUT))
+ break;
+
+ // now read parameter
+ std::string param;
+ while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
+ param += INPUT.get();
+
+ token.params.push_back(param);
+ }
+
+ m_tokens.push(token);
+}
+
+// DocStart
+void Scanner::ScanDocStart() {
+ PopAllIndents();
+ PopAllSimpleKeys();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(3);
+ m_tokens.push(Token(Token::DOC_START, mark));
+}
+
+// DocEnd
+void Scanner::ScanDocEnd() {
+ PopAllIndents();
+ PopAllSimpleKeys();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(3);
+ m_tokens.push(Token(Token::DOC_END, mark));
+}
+
+// FlowStart
+void Scanner::ScanFlowStart() {
+ // flows can be simple keys
+ InsertPotentialSimpleKey();
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ char ch = INPUT.get();
+ FLOW_MARKER flowType = (ch == Keys::FlowSeqStart ? FLOW_SEQ : FLOW_MAP);
+ m_flows.push(flowType);
+ Token::TYPE type =
+ (flowType == FLOW_SEQ ? Token::FLOW_SEQ_START : Token::FLOW_MAP_START);
+ m_tokens.push(Token(type, mark));
+}
+
+// FlowEnd
+void Scanner::ScanFlowEnd() {
+ if (InBlockContext())
+ throw ParserException(INPUT.mark(), ErrorMsg::FLOW_END);
+
+ // we might have a solo entry in the flow context
+ if (InFlowContext()) {
+ if (m_flows.top() == FLOW_MAP && VerifySimpleKey())
+ m_tokens.push(Token(Token::VALUE, INPUT.mark()));
+ else if (m_flows.top() == FLOW_SEQ)
+ InvalidateSimpleKey();
+ }
+
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = true;
+
+ // eat
+ Mark mark = INPUT.mark();
+ char ch = INPUT.get();
+
+ // check that it matches the start
+ FLOW_MARKER flowType = (ch == Keys::FlowSeqEnd ? FLOW_SEQ : FLOW_MAP);
+ if (m_flows.top() != flowType)
+ throw ParserException(mark, ErrorMsg::FLOW_END);
+ m_flows.pop();
+
+ Token::TYPE type = (flowType ? Token::FLOW_SEQ_END : Token::FLOW_MAP_END);
+ m_tokens.push(Token(type, mark));
+}
+
+// FlowEntry
+void Scanner::ScanFlowEntry() {
+ // we might have a solo entry in the flow context
+ if (InFlowContext()) {
+ if (m_flows.top() == FLOW_MAP && VerifySimpleKey())
+ m_tokens.push(Token(Token::VALUE, INPUT.mark()));
+ else if (m_flows.top() == FLOW_SEQ)
+ InvalidateSimpleKey();
+ }
+
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::FLOW_ENTRY, mark));
+}
+
+// BlockEntry
+void Scanner::ScanBlockEntry() {
+ // we better be in the block context!
+ if (InFlowContext())
+ throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY);
+
+ // can we put it here?
+ if (!m_simpleKeyAllowed)
+ throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY);
+
+ PushIndentTo(INPUT.column(), IndentMarker::SEQ);
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::BLOCK_ENTRY, mark));
+}
+
+// Key
+void Scanner::ScanKey() {
+ // handle keys diffently in the block context (and manage indents)
+ if (InBlockContext()) {
+ if (!m_simpleKeyAllowed)
+ throw ParserException(INPUT.mark(), ErrorMsg::MAP_KEY);
+
+ PushIndentTo(INPUT.column(), IndentMarker::MAP);
+ }
+
+ // can only put a simple key here if we're in block context
+ m_simpleKeyAllowed = InBlockContext();
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::KEY, mark));
+}
+
+// Value
+void Scanner::ScanValue() {
+ // and check that simple key
+ bool isSimpleKey = VerifySimpleKey();
+ m_canBeJSONFlow = false;
+
+ if (isSimpleKey) {
+ // can't follow a simple key with another simple key (dunno why, though - it
+ // seems fine)
+ m_simpleKeyAllowed = false;
+ } else {
+ // handle values diffently in the block context (and manage indents)
+ if (InBlockContext()) {
+ if (!m_simpleKeyAllowed)
+ throw ParserException(INPUT.mark(), ErrorMsg::MAP_VALUE);
+
+ PushIndentTo(INPUT.column(), IndentMarker::MAP);
+ }
+
+ // can only put a simple key here if we're in block context
+ m_simpleKeyAllowed = InBlockContext();
+ }
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::VALUE, mark));
+}
+
+// AnchorOrAlias
+void Scanner::ScanAnchorOrAlias() {
+ bool alias;
+ std::string name;
+
+ // insert a potential simple key
+ InsertPotentialSimpleKey();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // eat the indicator
+ Mark mark = INPUT.mark();
+ char indicator = INPUT.get();
+ alias = (indicator == Keys::Alias);
+
+ // now eat the content
+ while (INPUT && Exp::Anchor().Matches(INPUT))
+ name += INPUT.get();
+
+ // we need to have read SOMETHING!
+ if (name.empty())
+ throw ParserException(INPUT.mark(), alias ? ErrorMsg::ALIAS_NOT_FOUND
+ : ErrorMsg::ANCHOR_NOT_FOUND);
+
+ // and needs to end correctly
+ if (INPUT && !Exp::AnchorEnd().Matches(INPUT))
+ throw ParserException(INPUT.mark(), alias ? ErrorMsg::CHAR_IN_ALIAS
+ : ErrorMsg::CHAR_IN_ANCHOR);
+
+ // and we're done
+ Token token(alias ? Token::ALIAS : Token::ANCHOR, mark);
+ token.value = name;
+ m_tokens.push(token);
+}
+
+// Tag
+void Scanner::ScanTag() {
+ // insert a potential simple key
+ InsertPotentialSimpleKey();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ Token token(Token::TAG, INPUT.mark());
+
+ // eat the indicator
+ INPUT.get();
+
+ if (INPUT && INPUT.peek() == Keys::VerbatimTagStart) {
+ std::string tag = ScanVerbatimTag(INPUT);
+
+ token.value = tag;
+ token.data = Tag::VERBATIM;
+ } else {
+ bool canBeHandle;
+ token.value = ScanTagHandle(INPUT, canBeHandle);
+ if (!canBeHandle && token.value.empty())
+ token.data = Tag::NON_SPECIFIC;
+ else if (token.value.empty())
+ token.data = Tag::SECONDARY_HANDLE;
+ else
+ token.data = Tag::PRIMARY_HANDLE;
+
+ // is there a suffix?
+ if (canBeHandle && INPUT.peek() == Keys::Tag) {
+ // eat the indicator
+ INPUT.get();
+ token.params.push_back(ScanTagSuffix(INPUT));
+ token.data = Tag::NAMED_HANDLE;
+ }
+ }
+
+ m_tokens.push(token);
+}
+
+// PlainScalar
+void Scanner::ScanPlainScalar() {
+ std::string scalar;
+
+ // set up the scanning parameters
+ ScanScalarParams params;
+ params.end =
+ (InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd());
+ params.eatEnd = false;
+ params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1);
+ params.fold = FOLD_FLOW;
+ params.eatLeadingWhitespace = true;
+ params.trimTrailingSpaces = true;
+ params.chomp = STRIP;
+ params.onDocIndicator = BREAK;
+ params.onTabInIndentation = THROW;
+
+ // insert a potential simple key
+ InsertPotentialSimpleKey();
+
+ Mark mark = INPUT.mark();
+ scalar = ScanScalar(INPUT, params);
+
+ // can have a simple key only if we ended the scalar by starting a new line
+ m_simpleKeyAllowed = params.leadingSpaces;
+ m_canBeJSONFlow = false;
+
+ // finally, check and see if we ended on an illegal character
+ // if(Exp::IllegalCharInScalar.Matches(INPUT))
+ // throw ParserException(INPUT.mark(), ErrorMsg::CHAR_IN_SCALAR);
+
+ Token token(Token::PLAIN_SCALAR, mark);
+ token.value = scalar;
+ m_tokens.push(token);
+}
+
+// QuotedScalar
+void Scanner::ScanQuotedScalar() {
+ std::string scalar;
+
+ // peek at single or double quote (don't eat because we need to preserve (for
+ // the time being) the input position)
+ char quote = INPUT.peek();
+ bool single = (quote == '\'');
+
+ // setup the scanning parameters
+ ScanScalarParams params;
+ RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
+ params.end = &end;
+ params.eatEnd = true;
+ params.escape = (single ? '\'' : '\\');
+ params.indent = 0;
+ params.fold = FOLD_FLOW;
+ params.eatLeadingWhitespace = true;
+ params.trimTrailingSpaces = false;
+ params.chomp = CLIP;
+ params.onDocIndicator = THROW;
+
+ // insert a potential simple key
+ InsertPotentialSimpleKey();
+
+ Mark mark = INPUT.mark();
+
+ // now eat that opening quote
+ INPUT.get();
+
+ // and scan
+ scalar = ScanScalar(INPUT, params);
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = true;
+
+ Token token(Token::NON_PLAIN_SCALAR, mark);
+ token.value = scalar;
+ m_tokens.push(token);
+}
+
+// BlockScalarToken
+// . These need a little extra processing beforehand.
+// . We need to scan the line where the indicator is (this doesn't count as part
+// of the scalar),
+// and then we need to figure out what level of indentation we'll be using.
+void Scanner::ScanBlockScalar() {
+ std::string scalar;
+
+ ScanScalarParams params;
+ params.indent = 1;
+ params.detectIndent = true;
+
+ // eat block indicator ('|' or '>')
+ Mark mark = INPUT.mark();
+ char indicator = INPUT.get();
+ params.fold = (indicator == Keys::FoldedScalar ? FOLD_BLOCK : DONT_FOLD);
+
+ // eat chomping/indentation indicators
+ params.chomp = CLIP;
+ int n = Exp::Chomp().Match(INPUT);
+ for (int i = 0; i < n; i++) {
+ char ch = INPUT.get();
+ if (ch == '+')
+ params.chomp = KEEP;
+ else if (ch == '-')
+ params.chomp = STRIP;
+ else if (Exp::Digit().Matches(ch)) {
+ if (ch == '0')
+ throw ParserException(INPUT.mark(), ErrorMsg::ZERO_INDENT_IN_BLOCK);
+
+ params.indent = ch - '0';
+ params.detectIndent = false;
+ }
+ }
+
+ // now eat whitespace
+ while (Exp::Blank().Matches(INPUT))
+ INPUT.eat(1);
+
+ // and comments to the end of the line
+ if (Exp::Comment().Matches(INPUT))
+ while (INPUT && !Exp::Break().Matches(INPUT))
+ INPUT.eat(1);
+
+ // if it's not a line break, then we ran into a bad character inline
+ if (INPUT && !Exp::Break().Matches(INPUT))
+ throw ParserException(INPUT.mark(), ErrorMsg::CHAR_IN_BLOCK);
+
+ // set the initial indentation
+ if (GetTopIndent() >= 0)
+ params.indent += GetTopIndent();
+
+ params.eatLeadingWhitespace = false;
+ params.trimTrailingSpaces = false;
+ params.onTabInIndentation = THROW;
+
+ scalar = ScanScalar(INPUT, params);
+
+ // simple keys always ok after block scalars (since we're gonna start a new
+ // line anyways)
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ Token token(Token::NON_PLAIN_SCALAR, mark);
+ token.value = scalar;
+ m_tokens.push(token);
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/setting.h b/src/libs/3rdparty/yaml-cpp/src/setting.h
new file mode 100644
index 0000000000..b78d40e2e8
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/setting.h
@@ -0,0 +1,95 @@
+#ifndef SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <memory>
+#include <vector>
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+class SettingChangeBase;
+
+template <typename T>
+class Setting {
+ public:
+ Setting() : m_value() {}
+
+ const T get() const { return m_value; }
+ std::unique_ptr<SettingChangeBase> set(const T& value);
+ void restore(const Setting<T>& oldSetting) { m_value = oldSetting.get(); }
+
+ private:
+ T m_value;
+};
+
+class SettingChangeBase {
+ public:
+ virtual ~SettingChangeBase() {}
+ virtual void pop() = 0;
+};
+
+template <typename T>
+class SettingChange : public SettingChangeBase {
+ public:
+ SettingChange(Setting<T>* pSetting) : m_pCurSetting(pSetting) {
+ // copy old setting to save its state
+ m_oldSetting = *pSetting;
+ }
+
+ virtual void pop() { m_pCurSetting->restore(m_oldSetting); }
+
+ private:
+ Setting<T>* m_pCurSetting;
+ Setting<T> m_oldSetting;
+};
+
+template <typename T>
+inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) {
+ std::unique_ptr<SettingChangeBase> pChange(new SettingChange<T>(this));
+ m_value = value;
+ return pChange;
+}
+
+class SettingChanges : private noncopyable {
+ public:
+ SettingChanges() {}
+ ~SettingChanges() { clear(); }
+
+ void clear() {
+ restore();
+ m_settingChanges.clear();
+ }
+
+ void restore() {
+ for (setting_changes::const_iterator it = m_settingChanges.begin();
+ it != m_settingChanges.end(); ++it)
+ (*it)->pop();
+ }
+
+ void push(std::unique_ptr<SettingChangeBase> pSettingChange) {
+ m_settingChanges.push_back(std::move(pSettingChange));
+ }
+
+ // like std::unique_ptr - assignment is transfer of ownership
+ SettingChanges& operator=(SettingChanges&& rhs) {
+ if (this == &rhs)
+ return *this;
+
+ clear();
+ std::swap(m_settingChanges, rhs.m_settingChanges);
+
+ return *this;
+ }
+
+ private:
+ typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
+ setting_changes m_settingChanges;
+};
+}
+
+#endif // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/simplekey.cpp b/src/libs/3rdparty/yaml-cpp/src/simplekey.cpp
new file mode 100644
index 0000000000..70f56b6ae4
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/simplekey.cpp
@@ -0,0 +1,128 @@
+#include "scanner.h"
+#include "token.h"
+
+namespace YAML {
+struct Mark;
+
+Scanner::SimpleKey::SimpleKey(const Mark& mark_, std::size_t flowLevel_)
+ : mark(mark_), flowLevel(flowLevel_), pIndent(0), pMapStart(0), pKey(0) {}
+
+void Scanner::SimpleKey::Validate() {
+ // Note: pIndent will *not* be garbage here;
+ // we "garbage collect" them so we can
+ // always refer to them
+ if (pIndent)
+ pIndent->status = IndentMarker::VALID;
+ if (pMapStart)
+ pMapStart->status = Token::VALID;
+ if (pKey)
+ pKey->status = Token::VALID;
+}
+
+void Scanner::SimpleKey::Invalidate() {
+ if (pIndent)
+ pIndent->status = IndentMarker::INVALID;
+ if (pMapStart)
+ pMapStart->status = Token::INVALID;
+ if (pKey)
+ pKey->status = Token::INVALID;
+}
+
+// CanInsertPotentialSimpleKey
+bool Scanner::CanInsertPotentialSimpleKey() const {
+ if (!m_simpleKeyAllowed)
+ return false;
+
+ return !ExistsActiveSimpleKey();
+}
+
+// ExistsActiveSimpleKey
+// . Returns true if there's a potential simple key at our flow level
+// (there's allowed at most one per flow level, i.e., at the start of the flow
+// start token)
+bool Scanner::ExistsActiveSimpleKey() const {
+ if (m_simpleKeys.empty())
+ return false;
+
+ const SimpleKey& key = m_simpleKeys.top();
+ return key.flowLevel == GetFlowLevel();
+}
+
+// InsertPotentialSimpleKey
+// . If we can, add a potential simple key to the queue,
+// and save it on a stack.
+void Scanner::InsertPotentialSimpleKey() {
+ if (!CanInsertPotentialSimpleKey())
+ return;
+
+ SimpleKey key(INPUT.mark(), GetFlowLevel());
+
+ // first add a map start, if necessary
+ if (InBlockContext()) {
+ key.pIndent = PushIndentTo(INPUT.column(), IndentMarker::MAP);
+ if (key.pIndent) {
+ key.pIndent->status = IndentMarker::UNKNOWN;
+ key.pMapStart = key.pIndent->pStartToken;
+ key.pMapStart->status = Token::UNVERIFIED;
+ }
+ }
+
+ // then add the (now unverified) key
+ m_tokens.push(Token(Token::KEY, INPUT.mark()));
+ key.pKey = &m_tokens.back();
+ key.pKey->status = Token::UNVERIFIED;
+
+ m_simpleKeys.push(key);
+}
+
+// InvalidateSimpleKey
+// . Automatically invalidate the simple key in our flow level
+void Scanner::InvalidateSimpleKey() {
+ if (m_simpleKeys.empty())
+ return;
+
+ // grab top key
+ SimpleKey& key = m_simpleKeys.top();
+ if (key.flowLevel != GetFlowLevel())
+ return;
+
+ key.Invalidate();
+ m_simpleKeys.pop();
+}
+
+// VerifySimpleKey
+// . Determines whether the latest simple key to be added is valid,
+// and if so, makes it valid.
+bool Scanner::VerifySimpleKey() {
+ if (m_simpleKeys.empty())
+ return false;
+
+ // grab top key
+ SimpleKey key = m_simpleKeys.top();
+
+ // only validate if we're in the correct flow level
+ if (key.flowLevel != GetFlowLevel())
+ return false;
+
+ m_simpleKeys.pop();
+
+ bool isValid = true;
+
+ // needs to be less than 1024 characters and inline
+ if (INPUT.line() != key.mark.line || INPUT.pos() - key.mark.pos > 1024)
+ isValid = false;
+
+ // invalidate key
+ if (isValid)
+ key.Validate();
+ else
+ key.Invalidate();
+
+ return isValid;
+}
+
+void Scanner::PopAllSimpleKeys() {
+ while (!m_simpleKeys.empty())
+ m_simpleKeys.pop();
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/singledocparser.cpp b/src/libs/3rdparty/yaml-cpp/src/singledocparser.cpp
new file mode 100644
index 0000000000..a27c1c3b04
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/singledocparser.cpp
@@ -0,0 +1,414 @@
+#include <algorithm>
+#include <cstdio>
+#include <sstream>
+
+#include "collectionstack.h" // IWYU pragma: keep
+#include "scanner.h"
+#include "singledocparser.h"
+#include "tag.h"
+#include "token.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives)
+ : m_scanner(scanner),
+ m_directives(directives),
+ m_pCollectionStack(new CollectionStack),
+ m_curAnchor(0) {}
+
+SingleDocParser::~SingleDocParser() {}
+
+// HandleDocument
+// . Handles the next document
+// . Throws a ParserException on error.
+void SingleDocParser::HandleDocument(EventHandler& eventHandler) {
+ assert(!m_scanner.empty()); // guaranteed that there are tokens
+ assert(!m_curAnchor);
+
+ eventHandler.OnDocumentStart(m_scanner.peek().mark);
+
+ // eat doc start
+ if (m_scanner.peek().type == Token::DOC_START)
+ m_scanner.pop();
+
+ // recurse!
+ HandleNode(eventHandler);
+
+ eventHandler.OnDocumentEnd();
+
+ // and finally eat any doc ends we see
+ while (!m_scanner.empty() && m_scanner.peek().type == Token::DOC_END)
+ m_scanner.pop();
+}
+
+void SingleDocParser::HandleNode(EventHandler& eventHandler) {
+ // an empty node *is* a possibility
+ if (m_scanner.empty()) {
+ eventHandler.OnNull(m_scanner.mark(), NullAnchor);
+ return;
+ }
+
+ // save location
+ Mark mark = m_scanner.peek().mark;
+
+ // special case: a value node by itself must be a map, with no header
+ if (m_scanner.peek().type == Token::VALUE) {
+ eventHandler.OnMapStart(mark, "?", NullAnchor, EmitterStyle::Default);
+ HandleMap(eventHandler);
+ eventHandler.OnMapEnd();
+ return;
+ }
+
+ // special case: an alias node
+ if (m_scanner.peek().type == Token::ALIAS) {
+ eventHandler.OnAlias(mark, LookupAnchor(mark, m_scanner.peek().value));
+ m_scanner.pop();
+ return;
+ }
+
+ std::string tag;
+ anchor_t anchor;
+ ParseProperties(tag, anchor);
+
+ const Token& token = m_scanner.peek();
+
+ if (token.type == Token::PLAIN_SCALAR && IsNullString(token.value)) {
+ eventHandler.OnNull(mark, anchor);
+ m_scanner.pop();
+ return;
+ }
+
+ // add non-specific tags
+ if (tag.empty())
+ tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?");
+
+ // now split based on what kind of node we should be
+ switch (token.type) {
+ case Token::PLAIN_SCALAR:
+ case Token::NON_PLAIN_SCALAR:
+ eventHandler.OnScalar(mark, tag, anchor, token.value);
+ m_scanner.pop();
+ return;
+ case Token::FLOW_SEQ_START:
+ eventHandler.OnSequenceStart(mark, tag, anchor, EmitterStyle::Flow);
+ HandleSequence(eventHandler);
+ eventHandler.OnSequenceEnd();
+ return;
+ case Token::BLOCK_SEQ_START:
+ eventHandler.OnSequenceStart(mark, tag, anchor, EmitterStyle::Block);
+ HandleSequence(eventHandler);
+ eventHandler.OnSequenceEnd();
+ return;
+ case Token::FLOW_MAP_START:
+ eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Flow);
+ HandleMap(eventHandler);
+ eventHandler.OnMapEnd();
+ return;
+ case Token::BLOCK_MAP_START:
+ eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Block);
+ HandleMap(eventHandler);
+ eventHandler.OnMapEnd();
+ return;
+ case Token::KEY:
+ // compact maps can only go in a flow sequence
+ if (m_pCollectionStack->GetCurCollectionType() ==
+ CollectionType::FlowSeq) {
+ eventHandler.OnMapStart(mark, tag, anchor, EmitterStyle::Flow);
+ HandleMap(eventHandler);
+ eventHandler.OnMapEnd();
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (tag == "?")
+ eventHandler.OnNull(mark, anchor);
+ else
+ eventHandler.OnScalar(mark, tag, anchor, "");
+}
+
+void SingleDocParser::HandleSequence(EventHandler& eventHandler) {
+ // split based on start token
+ switch (m_scanner.peek().type) {
+ case Token::BLOCK_SEQ_START:
+ HandleBlockSequence(eventHandler);
+ break;
+ case Token::FLOW_SEQ_START:
+ HandleFlowSequence(eventHandler);
+ break;
+ default:
+ break;
+ }
+}
+
+void SingleDocParser::HandleBlockSequence(EventHandler& eventHandler) {
+ // eat start token
+ m_scanner.pop();
+ m_pCollectionStack->PushCollectionType(CollectionType::BlockSeq);
+
+ while (1) {
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ);
+
+ Token token = m_scanner.peek();
+ if (token.type != Token::BLOCK_ENTRY && token.type != Token::BLOCK_SEQ_END)
+ throw ParserException(token.mark, ErrorMsg::END_OF_SEQ);
+
+ m_scanner.pop();
+ if (token.type == Token::BLOCK_SEQ_END)
+ break;
+
+ // check for null
+ if (!m_scanner.empty()) {
+ const Token& token = m_scanner.peek();
+ if (token.type == Token::BLOCK_ENTRY ||
+ token.type == Token::BLOCK_SEQ_END) {
+ eventHandler.OnNull(token.mark, NullAnchor);
+ continue;
+ }
+ }
+
+ HandleNode(eventHandler);
+ }
+
+ m_pCollectionStack->PopCollectionType(CollectionType::BlockSeq);
+}
+
+void SingleDocParser::HandleFlowSequence(EventHandler& eventHandler) {
+ // eat start token
+ m_scanner.pop();
+ m_pCollectionStack->PushCollectionType(CollectionType::FlowSeq);
+
+ while (1) {
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ_FLOW);
+
+ // first check for end
+ if (m_scanner.peek().type == Token::FLOW_SEQ_END) {
+ m_scanner.pop();
+ break;
+ }
+
+ // then read the node
+ HandleNode(eventHandler);
+
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_SEQ_FLOW);
+
+ // now eat the separator (or could be a sequence end, which we ignore - but
+ // if it's neither, then it's a bad node)
+ Token& token = m_scanner.peek();
+ if (token.type == Token::FLOW_ENTRY)
+ m_scanner.pop();
+ else if (token.type != Token::FLOW_SEQ_END)
+ throw ParserException(token.mark, ErrorMsg::END_OF_SEQ_FLOW);
+ }
+
+ m_pCollectionStack->PopCollectionType(CollectionType::FlowSeq);
+}
+
+void SingleDocParser::HandleMap(EventHandler& eventHandler) {
+ // split based on start token
+ switch (m_scanner.peek().type) {
+ case Token::BLOCK_MAP_START:
+ HandleBlockMap(eventHandler);
+ break;
+ case Token::FLOW_MAP_START:
+ HandleFlowMap(eventHandler);
+ break;
+ case Token::KEY:
+ HandleCompactMap(eventHandler);
+ break;
+ case Token::VALUE:
+ HandleCompactMapWithNoKey(eventHandler);
+ break;
+ default:
+ break;
+ }
+}
+
+void SingleDocParser::HandleBlockMap(EventHandler& eventHandler) {
+ // eat start token
+ m_scanner.pop();
+ m_pCollectionStack->PushCollectionType(CollectionType::BlockMap);
+
+ while (1) {
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP);
+
+ Token token = m_scanner.peek();
+ if (token.type != Token::KEY && token.type != Token::VALUE &&
+ token.type != Token::BLOCK_MAP_END)
+ throw ParserException(token.mark, ErrorMsg::END_OF_MAP);
+
+ if (token.type == Token::BLOCK_MAP_END) {
+ m_scanner.pop();
+ break;
+ }
+
+ // grab key (if non-null)
+ if (token.type == Token::KEY) {
+ m_scanner.pop();
+ HandleNode(eventHandler);
+ } else {
+ eventHandler.OnNull(token.mark, NullAnchor);
+ }
+
+ // now grab value (optional)
+ if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) {
+ m_scanner.pop();
+ HandleNode(eventHandler);
+ } else {
+ eventHandler.OnNull(token.mark, NullAnchor);
+ }
+ }
+
+ m_pCollectionStack->PopCollectionType(CollectionType::BlockMap);
+}
+
+void SingleDocParser::HandleFlowMap(EventHandler& eventHandler) {
+ // eat start token
+ m_scanner.pop();
+ m_pCollectionStack->PushCollectionType(CollectionType::FlowMap);
+
+ while (1) {
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW);
+
+ Token& token = m_scanner.peek();
+ const Mark mark = token.mark;
+ // first check for end
+ if (token.type == Token::FLOW_MAP_END) {
+ m_scanner.pop();
+ break;
+ }
+
+ // grab key (if non-null)
+ if (token.type == Token::KEY) {
+ m_scanner.pop();
+ HandleNode(eventHandler);
+ } else {
+ eventHandler.OnNull(mark, NullAnchor);
+ }
+
+ // now grab value (optional)
+ if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) {
+ m_scanner.pop();
+ HandleNode(eventHandler);
+ } else {
+ eventHandler.OnNull(mark, NullAnchor);
+ }
+
+ if (m_scanner.empty())
+ throw ParserException(m_scanner.mark(), ErrorMsg::END_OF_MAP_FLOW);
+
+ // now eat the separator (or could be a map end, which we ignore - but if
+ // it's neither, then it's a bad node)
+ Token& nextToken = m_scanner.peek();
+ if (nextToken.type == Token::FLOW_ENTRY)
+ m_scanner.pop();
+ else if (nextToken.type != Token::FLOW_MAP_END)
+ throw ParserException(nextToken.mark, ErrorMsg::END_OF_MAP_FLOW);
+ }
+
+ m_pCollectionStack->PopCollectionType(CollectionType::FlowMap);
+}
+
+// . Single "key: value" pair in a flow sequence
+void SingleDocParser::HandleCompactMap(EventHandler& eventHandler) {
+ m_pCollectionStack->PushCollectionType(CollectionType::CompactMap);
+
+ // grab key
+ Mark mark = m_scanner.peek().mark;
+ m_scanner.pop();
+ HandleNode(eventHandler);
+
+ // now grab value (optional)
+ if (!m_scanner.empty() && m_scanner.peek().type == Token::VALUE) {
+ m_scanner.pop();
+ HandleNode(eventHandler);
+ } else {
+ eventHandler.OnNull(mark, NullAnchor);
+ }
+
+ m_pCollectionStack->PopCollectionType(CollectionType::CompactMap);
+}
+
+// . Single ": value" pair in a flow sequence
+void SingleDocParser::HandleCompactMapWithNoKey(EventHandler& eventHandler) {
+ m_pCollectionStack->PushCollectionType(CollectionType::CompactMap);
+
+ // null key
+ eventHandler.OnNull(m_scanner.peek().mark, NullAnchor);
+
+ // grab value
+ m_scanner.pop();
+ HandleNode(eventHandler);
+
+ m_pCollectionStack->PopCollectionType(CollectionType::CompactMap);
+}
+
+// ParseProperties
+// . Grabs any tag or anchor tokens and deals with them.
+void SingleDocParser::ParseProperties(std::string& tag, anchor_t& anchor) {
+ tag.clear();
+ anchor = NullAnchor;
+
+ while (1) {
+ if (m_scanner.empty())
+ return;
+
+ switch (m_scanner.peek().type) {
+ case Token::TAG:
+ ParseTag(tag);
+ break;
+ case Token::ANCHOR:
+ ParseAnchor(anchor);
+ break;
+ default:
+ return;
+ }
+ }
+}
+
+void SingleDocParser::ParseTag(std::string& tag) {
+ Token& token = m_scanner.peek();
+ if (!tag.empty())
+ throw ParserException(token.mark, ErrorMsg::MULTIPLE_TAGS);
+
+ Tag tagInfo(token);
+ tag = tagInfo.Translate(m_directives);
+ m_scanner.pop();
+}
+
+void SingleDocParser::ParseAnchor(anchor_t& anchor) {
+ Token& token = m_scanner.peek();
+ if (anchor)
+ throw ParserException(token.mark, ErrorMsg::MULTIPLE_ANCHORS);
+
+ anchor = RegisterAnchor(token.value);
+ m_scanner.pop();
+}
+
+anchor_t SingleDocParser::RegisterAnchor(const std::string& name) {
+ if (name.empty())
+ return NullAnchor;
+
+ return m_anchors[name] = ++m_curAnchor;
+}
+
+anchor_t SingleDocParser::LookupAnchor(const Mark& mark,
+ const std::string& name) const {
+ Anchors::const_iterator it = m_anchors.find(name);
+ if (it == m_anchors.end())
+ throw ParserException(mark, ErrorMsg::UNKNOWN_ANCHOR);
+
+ return it->second;
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/singledocparser.h b/src/libs/3rdparty/yaml-cpp/src/singledocparser.h
new file mode 100644
index 0000000000..2b92067cdd
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/singledocparser.h
@@ -0,0 +1,65 @@
+#ifndef SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <map>
+#include <memory>
+#include <string>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/noncopyable.h"
+
+namespace YAML {
+class CollectionStack;
+class EventHandler;
+class Node;
+class Scanner;
+struct Directives;
+struct Mark;
+struct Token;
+
+class SingleDocParser : private noncopyable {
+ public:
+ SingleDocParser(Scanner& scanner, const Directives& directives);
+ ~SingleDocParser();
+
+ void HandleDocument(EventHandler& eventHandler);
+
+ private:
+ void HandleNode(EventHandler& eventHandler);
+
+ void HandleSequence(EventHandler& eventHandler);
+ void HandleBlockSequence(EventHandler& eventHandler);
+ void HandleFlowSequence(EventHandler& eventHandler);
+
+ void HandleMap(EventHandler& eventHandler);
+ void HandleBlockMap(EventHandler& eventHandler);
+ void HandleFlowMap(EventHandler& eventHandler);
+ void HandleCompactMap(EventHandler& eventHandler);
+ void HandleCompactMapWithNoKey(EventHandler& eventHandler);
+
+ void ParseProperties(std::string& tag, anchor_t& anchor);
+ void ParseTag(std::string& tag);
+ void ParseAnchor(anchor_t& anchor);
+
+ anchor_t RegisterAnchor(const std::string& name);
+ anchor_t LookupAnchor(const Mark& mark, const std::string& name) const;
+
+ private:
+ Scanner& m_scanner;
+ const Directives& m_directives;
+ std::unique_ptr<CollectionStack> m_pCollectionStack;
+
+ typedef std::map<std::string, anchor_t> Anchors;
+ Anchors m_anchors;
+
+ anchor_t m_curAnchor;
+};
+}
+
+#endif // SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/stream.cpp b/src/libs/3rdparty/yaml-cpp/src/stream.cpp
new file mode 100644
index 0000000000..3b013cfa7d
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/stream.cpp
@@ -0,0 +1,448 @@
+#include <iostream>
+
+#include "stream.h"
+
+#ifndef YAML_PREFETCH_SIZE
+#define YAML_PREFETCH_SIZE 2048
+#endif
+
+#define S_ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
+#define S_ARRAY_END(A) ((A) + S_ARRAY_SIZE(A))
+
+#define CP_REPLACEMENT_CHARACTER (0xFFFD)
+
+namespace YAML {
+enum UtfIntroState {
+ uis_start,
+ uis_utfbe_b1,
+ uis_utf32be_b2,
+ uis_utf32be_bom3,
+ uis_utf32be,
+ uis_utf16be,
+ uis_utf16be_bom1,
+ uis_utfle_bom1,
+ uis_utf16le_bom2,
+ uis_utf32le_bom3,
+ uis_utf16le,
+ uis_utf32le,
+ uis_utf8_imp,
+ uis_utf16le_imp,
+ uis_utf32le_imp3,
+ uis_utf8_bom1,
+ uis_utf8_bom2,
+ uis_utf8,
+ uis_error
+};
+
+enum UtfIntroCharType {
+ uict00,
+ uictBB,
+ uictBF,
+ uictEF,
+ uictFE,
+ uictFF,
+ uictAscii,
+ uictOther,
+ uictMax
+};
+
+static bool s_introFinalState[] = {
+ false, // uis_start
+ false, // uis_utfbe_b1
+ false, // uis_utf32be_b2
+ false, // uis_utf32be_bom3
+ true, // uis_utf32be
+ true, // uis_utf16be
+ false, // uis_utf16be_bom1
+ false, // uis_utfle_bom1
+ false, // uis_utf16le_bom2
+ false, // uis_utf32le_bom3
+ true, // uis_utf16le
+ true, // uis_utf32le
+ false, // uis_utf8_imp
+ false, // uis_utf16le_imp
+ false, // uis_utf32le_imp3
+ false, // uis_utf8_bom1
+ false, // uis_utf8_bom2
+ true, // uis_utf8
+ true, // uis_error
+};
+
+static UtfIntroState s_introTransitions[][uictMax] = {
+ // uict00, uictBB, uictBF, uictEF,
+ // uictFE, uictFF, uictAscii, uictOther
+ {uis_utfbe_b1, uis_utf8, uis_utf8, uis_utf8_bom1, uis_utf16be_bom1,
+ uis_utfle_bom1, uis_utf8_imp, uis_utf8},
+ {uis_utf32be_b2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
+ uis_utf16be, uis_utf8},
+ {uis_utf32be, uis_utf8, uis_utf8, uis_utf8, uis_utf32be_bom3, uis_utf8,
+ uis_utf8, uis_utf8},
+ {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf32be, uis_utf8,
+ uis_utf8},
+ {uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be,
+ uis_utf32be, uis_utf32be, uis_utf32be},
+ {uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be,
+ uis_utf16be, uis_utf16be, uis_utf16be},
+ {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16be, uis_utf8,
+ uis_utf8},
+ {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16le_bom2, uis_utf8,
+ uis_utf8, uis_utf8},
+ {uis_utf32le_bom3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
+ uis_utf16le, uis_utf16le, uis_utf16le},
+ {uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
+ uis_utf16le, uis_utf16le, uis_utf16le},
+ {uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
+ uis_utf16le, uis_utf16le, uis_utf16le},
+ {uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le,
+ uis_utf32le, uis_utf32le, uis_utf32le},
+ {uis_utf16le_imp, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
+ uis_utf8, uis_utf8},
+ {uis_utf32le_imp3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
+ uis_utf16le, uis_utf16le, uis_utf16le},
+ {uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
+ uis_utf16le, uis_utf16le, uis_utf16le},
+ {uis_utf8, uis_utf8_bom2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
+ uis_utf8},
+ {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
+ uis_utf8},
+ {uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
+ uis_utf8},
+};
+
+static char s_introUngetCount[][uictMax] = {
+ // uict00, uictBB, uictBF, uictEF, uictFE, uictFF, uictAscii, uictOther
+ {0, 1, 1, 0, 0, 0, 0, 1},
+ {0, 2, 2, 2, 2, 2, 2, 2},
+ {3, 3, 3, 3, 0, 3, 3, 3},
+ {4, 4, 4, 4, 4, 0, 4, 4},
+ {1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1},
+ {2, 2, 2, 2, 2, 0, 2, 2},
+ {2, 2, 2, 2, 0, 2, 2, 2},
+ {0, 1, 1, 1, 1, 1, 1, 1},
+ {0, 2, 2, 2, 2, 2, 2, 2},
+ {1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1},
+ {0, 2, 2, 2, 2, 2, 2, 2},
+ {0, 3, 3, 3, 3, 3, 3, 3},
+ {4, 4, 4, 4, 4, 4, 4, 4},
+ {2, 0, 2, 2, 2, 2, 2, 2},
+ {3, 3, 0, 3, 3, 3, 3, 3},
+ {1, 1, 1, 1, 1, 1, 1, 1},
+};
+
+inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) {
+ if (std::istream::traits_type::eof() == ch) {
+ return uictOther;
+ }
+
+ switch (ch) {
+ case 0:
+ return uict00;
+ case 0xBB:
+ return uictBB;
+ case 0xBF:
+ return uictBF;
+ case 0xEF:
+ return uictEF;
+ case 0xFE:
+ return uictFE;
+ case 0xFF:
+ return uictFF;
+ }
+
+ if ((ch > 0) && (ch < 0xFF)) {
+ return uictAscii;
+ }
+
+ return uictOther;
+}
+
+inline char Utf8Adjust(unsigned long ch, unsigned char lead_bits,
+ unsigned char rshift) {
+ const unsigned char header = ((1 << lead_bits) - 1) << (8 - lead_bits);
+ const unsigned char mask = (0xFF >> (lead_bits + 1));
+ return static_cast<char>(
+ static_cast<unsigned char>(header | ((ch >> rshift) & mask)));
+}
+
+inline void QueueUnicodeCodepoint(std::deque<char>& q, unsigned long ch) {
+ // We are not allowed to queue the Stream::eof() codepoint, so
+ // replace it with CP_REPLACEMENT_CHARACTER
+ if (static_cast<unsigned long>(Stream::eof()) == ch) {
+ ch = CP_REPLACEMENT_CHARACTER;
+ }
+
+ if (ch < 0x80) {
+ q.push_back(Utf8Adjust(ch, 0, 0));
+ } else if (ch < 0x800) {
+ q.push_back(Utf8Adjust(ch, 2, 6));
+ q.push_back(Utf8Adjust(ch, 1, 0));
+ } else if (ch < 0x10000) {
+ q.push_back(Utf8Adjust(ch, 3, 12));
+ q.push_back(Utf8Adjust(ch, 1, 6));
+ q.push_back(Utf8Adjust(ch, 1, 0));
+ } else {
+ q.push_back(Utf8Adjust(ch, 4, 18));
+ q.push_back(Utf8Adjust(ch, 1, 12));
+ q.push_back(Utf8Adjust(ch, 1, 6));
+ q.push_back(Utf8Adjust(ch, 1, 0));
+ }
+}
+
+Stream::Stream(std::istream& input)
+ : m_input(input),
+ m_pPrefetched(new unsigned char[YAML_PREFETCH_SIZE]),
+ m_nPrefetchedAvailable(0),
+ m_nPrefetchedUsed(0) {
+ typedef std::istream::traits_type char_traits;
+
+ if (!input)
+ return;
+
+ // Determine (or guess) the character-set by reading the BOM, if any. See
+ // the YAML specification for the determination algorithm.
+ char_traits::int_type intro[4];
+ int nIntroUsed = 0;
+ UtfIntroState state = uis_start;
+ for (; !s_introFinalState[state];) {
+ std::istream::int_type ch = input.get();
+ intro[nIntroUsed++] = ch;
+ UtfIntroCharType charType = IntroCharTypeOf(ch);
+ UtfIntroState newState = s_introTransitions[state][charType];
+ int nUngets = s_introUngetCount[state][charType];
+ if (nUngets > 0) {
+ input.clear();
+ for (; nUngets > 0; --nUngets) {
+ if (char_traits::eof() != intro[--nIntroUsed])
+ input.putback(char_traits::to_char_type(intro[nIntroUsed]));
+ }
+ }
+ state = newState;
+ }
+
+ switch (state) {
+ case uis_utf8:
+ m_charSet = utf8;
+ break;
+ case uis_utf16le:
+ m_charSet = utf16le;
+ break;
+ case uis_utf16be:
+ m_charSet = utf16be;
+ break;
+ case uis_utf32le:
+ m_charSet = utf32le;
+ break;
+ case uis_utf32be:
+ m_charSet = utf32be;
+ break;
+ default:
+ m_charSet = utf8;
+ break;
+ }
+
+ ReadAheadTo(0);
+}
+
+Stream::~Stream() { delete[] m_pPrefetched; }
+
+char Stream::peek() const {
+ if (m_readahead.empty()) {
+ return Stream::eof();
+ }
+
+ return m_readahead[0];
+}
+
+Stream::operator bool() const {
+ return m_input.good() ||
+ (!m_readahead.empty() && m_readahead[0] != Stream::eof());
+}
+
+// get
+// . Extracts a character from the stream and updates our position
+char Stream::get() {
+ char ch = peek();
+ AdvanceCurrent();
+ m_mark.column++;
+
+ if (ch == '\n') {
+ m_mark.column = 0;
+ m_mark.line++;
+ }
+
+ return ch;
+}
+
+// get
+// . Extracts 'n' characters from the stream and updates our position
+std::string Stream::get(int n) {
+ std::string ret;
+ ret.reserve(n);
+ for (int i = 0; i < n; i++)
+ ret += get();
+ return ret;
+}
+
+// eat
+// . Eats 'n' characters and updates our position.
+void Stream::eat(int n) {
+ for (int i = 0; i < n; i++)
+ get();
+}
+
+void Stream::AdvanceCurrent() {
+ if (!m_readahead.empty()) {
+ m_readahead.pop_front();
+ m_mark.pos++;
+ }
+
+ ReadAheadTo(0);
+}
+
+bool Stream::_ReadAheadTo(size_t i) const {
+ while (m_input.good() && (m_readahead.size() <= i)) {
+ switch (m_charSet) {
+ case utf8:
+ StreamInUtf8();
+ break;
+ case utf16le:
+ StreamInUtf16();
+ break;
+ case utf16be:
+ StreamInUtf16();
+ break;
+ case utf32le:
+ StreamInUtf32();
+ break;
+ case utf32be:
+ StreamInUtf32();
+ break;
+ }
+ }
+
+ // signal end of stream
+ if (!m_input.good())
+ m_readahead.push_back(Stream::eof());
+
+ return m_readahead.size() > i;
+}
+
+void Stream::StreamInUtf8() const {
+ unsigned char b = GetNextByte();
+ if (m_input.good()) {
+ m_readahead.push_back(b);
+ }
+}
+
+void Stream::StreamInUtf16() const {
+ unsigned long ch = 0;
+ unsigned char bytes[2];
+ int nBigEnd = (m_charSet == utf16be) ? 0 : 1;
+
+ bytes[0] = GetNextByte();
+ bytes[1] = GetNextByte();
+ if (!m_input.good()) {
+ return;
+ }
+ ch = (static_cast<unsigned long>(bytes[nBigEnd]) << 8) |
+ static_cast<unsigned long>(bytes[1 ^ nBigEnd]);
+
+ if (ch >= 0xDC00 && ch < 0xE000) {
+ // Trailing (low) surrogate...ugh, wrong order
+ QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER);
+ return;
+ } else if (ch >= 0xD800 && ch < 0xDC00) {
+ // ch is a leading (high) surrogate
+
+ // Four byte UTF-8 code point
+
+ // Read the trailing (low) surrogate
+ for (;;) {
+ bytes[0] = GetNextByte();
+ bytes[1] = GetNextByte();
+ if (!m_input.good()) {
+ QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER);
+ return;
+ }
+ unsigned long chLow = (static_cast<unsigned long>(bytes[nBigEnd]) << 8) |
+ static_cast<unsigned long>(bytes[1 ^ nBigEnd]);
+ if (chLow < 0xDC00 || chLow >= 0xE000) {
+ // Trouble...not a low surrogate. Dump a REPLACEMENT CHARACTER into the
+ // stream.
+ QueueUnicodeCodepoint(m_readahead, CP_REPLACEMENT_CHARACTER);
+
+ // Deal with the next UTF-16 unit
+ if (chLow < 0xD800 || chLow >= 0xE000) {
+ // Easiest case: queue the codepoint and return
+ QueueUnicodeCodepoint(m_readahead, ch);
+ return;
+ } else {
+ // Start the loop over with the new high surrogate
+ ch = chLow;
+ continue;
+ }
+ }
+
+ // Select the payload bits from the high surrogate
+ ch &= 0x3FF;
+ ch <<= 10;
+
+ // Include bits from low surrogate
+ ch |= (chLow & 0x3FF);
+
+ // Add the surrogacy offset
+ ch += 0x10000;
+ break;
+ }
+ }
+
+ QueueUnicodeCodepoint(m_readahead, ch);
+}
+
+inline char* ReadBuffer(unsigned char* pBuffer) {
+ return reinterpret_cast<char*>(pBuffer);
+}
+
+unsigned char Stream::GetNextByte() const {
+ if (m_nPrefetchedUsed >= m_nPrefetchedAvailable) {
+ std::streambuf* pBuf = m_input.rdbuf();
+ m_nPrefetchedAvailable = static_cast<std::size_t>(
+ pBuf->sgetn(ReadBuffer(m_pPrefetched), YAML_PREFETCH_SIZE));
+ m_nPrefetchedUsed = 0;
+ if (!m_nPrefetchedAvailable) {
+ m_input.setstate(std::ios_base::eofbit);
+ }
+
+ if (0 == m_nPrefetchedAvailable) {
+ return 0;
+ }
+ }
+
+ return m_pPrefetched[m_nPrefetchedUsed++];
+}
+
+void Stream::StreamInUtf32() const {
+ static int indexes[2][4] = {{3, 2, 1, 0}, {0, 1, 2, 3}};
+
+ unsigned long ch = 0;
+ unsigned char bytes[4];
+ int* pIndexes = (m_charSet == utf32be) ? indexes[1] : indexes[0];
+
+ bytes[0] = GetNextByte();
+ bytes[1] = GetNextByte();
+ bytes[2] = GetNextByte();
+ bytes[3] = GetNextByte();
+ if (!m_input.good()) {
+ return;
+ }
+
+ for (int i = 0; i < 4; ++i) {
+ ch <<= 8;
+ ch |= bytes[pIndexes[i]];
+ }
+
+ QueueUnicodeCodepoint(m_readahead, ch);
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/stream.h b/src/libs/3rdparty/yaml-cpp/src/stream.h
new file mode 100644
index 0000000000..42d542d5b1
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/stream.h
@@ -0,0 +1,76 @@
+#ifndef STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/noncopyable.h"
+#include "yaml-cpp/mark.h"
+#include <cstddef>
+#include <deque>
+#include <ios>
+#include <iostream>
+#include <set>
+#include <string>
+
+namespace YAML {
+class Stream : private noncopyable {
+ public:
+ friend class StreamCharSource;
+
+ Stream(std::istream& input);
+ ~Stream();
+
+ operator bool() const;
+ bool operator!() const { return !static_cast<bool>(*this); }
+
+ char peek() const;
+ char get();
+ std::string get(int n);
+ void eat(int n = 1);
+
+ static char eof() { return 0x04; }
+
+ const Mark mark() const { return m_mark; }
+ int pos() const { return m_mark.pos; }
+ int line() const { return m_mark.line; }
+ int column() const { return m_mark.column; }
+ void ResetColumn() { m_mark.column = 0; }
+
+ private:
+ enum CharacterSet { utf8, utf16le, utf16be, utf32le, utf32be };
+
+ std::istream& m_input;
+ Mark m_mark;
+
+ CharacterSet m_charSet;
+ mutable std::deque<char> m_readahead;
+ unsigned char* const m_pPrefetched;
+ mutable size_t m_nPrefetchedAvailable;
+ mutable size_t m_nPrefetchedUsed;
+
+ void AdvanceCurrent();
+ char CharAt(size_t i) const;
+ bool ReadAheadTo(size_t i) const;
+ bool _ReadAheadTo(size_t i) const;
+ void StreamInUtf8() const;
+ void StreamInUtf16() const;
+ void StreamInUtf32() const;
+ unsigned char GetNextByte() const;
+};
+
+// CharAt
+// . Unchecked access
+inline char Stream::CharAt(size_t i) const { return m_readahead[i]; }
+
+inline bool Stream::ReadAheadTo(size_t i) const {
+ if (m_readahead.size() > i)
+ return true;
+ return _ReadAheadTo(i);
+}
+}
+
+#endif // STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/streamcharsource.h b/src/libs/3rdparty/yaml-cpp/src/streamcharsource.h
new file mode 100644
index 0000000000..624599e65d
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/streamcharsource.h
@@ -0,0 +1,48 @@
+#ifndef STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/noncopyable.h"
+#include <cstddef>
+
+namespace YAML {
+class StreamCharSource {
+ public:
+ StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {}
+ StreamCharSource(const StreamCharSource& source)
+ : m_offset(source.m_offset), m_stream(source.m_stream) {}
+ ~StreamCharSource() {}
+
+ operator bool() const;
+ char operator[](std::size_t i) const { return m_stream.CharAt(m_offset + i); }
+ bool operator!() const { return !static_cast<bool>(*this); }
+
+ const StreamCharSource operator+(int i) const;
+
+ private:
+ std::size_t m_offset;
+ const Stream& m_stream;
+
+ StreamCharSource& operator=(const StreamCharSource&); // non-assignable
+};
+
+inline StreamCharSource::operator bool() const {
+ return m_stream.ReadAheadTo(m_offset);
+}
+
+inline const StreamCharSource StreamCharSource::operator+(int i) const {
+ StreamCharSource source(*this);
+ if (static_cast<int>(source.m_offset) + i >= 0)
+ source.m_offset += i;
+ else
+ source.m_offset = 0;
+ return source;
+}
+}
+
+#endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/stringsource.h b/src/libs/3rdparty/yaml-cpp/src/stringsource.h
new file mode 100644
index 0000000000..6fee44bb28
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/stringsource.h
@@ -0,0 +1,48 @@
+#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <cstddef>
+
+namespace YAML {
+class StringCharSource {
+ public:
+ StringCharSource(const char* str, std::size_t size)
+ : m_str(str), m_size(size), m_offset(0) {}
+
+ operator bool() const { return m_offset < m_size; }
+ char operator[](std::size_t i) const { return m_str[m_offset + i]; }
+ bool operator!() const { return !static_cast<bool>(*this); }
+
+ const StringCharSource operator+(int i) const {
+ StringCharSource source(*this);
+ if (static_cast<int>(source.m_offset) + i >= 0)
+ source.m_offset += i;
+ else
+ source.m_offset = 0;
+ return source;
+ }
+
+ StringCharSource& operator++() {
+ ++m_offset;
+ return *this;
+ }
+
+ StringCharSource& operator+=(std::size_t offset) {
+ m_offset += offset;
+ return *this;
+ }
+
+ private:
+ const char* m_str;
+ std::size_t m_size;
+ std::size_t m_offset;
+};
+}
+
+#endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/tag.cpp b/src/libs/3rdparty/yaml-cpp/src/tag.cpp
new file mode 100644
index 0000000000..51435520e4
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/tag.cpp
@@ -0,0 +1,49 @@
+#include <cassert>
+#include <stdexcept>
+
+#include "directives.h" // IWYU pragma: keep
+#include "tag.h"
+#include "token.h"
+
+namespace YAML {
+Tag::Tag(const Token& token) : type(static_cast<TYPE>(token.data)) {
+ switch (type) {
+ case VERBATIM:
+ value = token.value;
+ break;
+ case PRIMARY_HANDLE:
+ value = token.value;
+ break;
+ case SECONDARY_HANDLE:
+ value = token.value;
+ break;
+ case NAMED_HANDLE:
+ handle = token.value;
+ value = token.params[0];
+ break;
+ case NON_SPECIFIC:
+ break;
+ default:
+ assert(false);
+ }
+}
+
+const std::string Tag::Translate(const Directives& directives) {
+ switch (type) {
+ case VERBATIM:
+ return value;
+ case PRIMARY_HANDLE:
+ return directives.TranslateTagHandle("!") + value;
+ case SECONDARY_HANDLE:
+ return directives.TranslateTagHandle("!!") + value;
+ case NAMED_HANDLE:
+ return directives.TranslateTagHandle("!" + handle + "!") + value;
+ case NON_SPECIFIC:
+ // TODO:
+ return "!";
+ default:
+ assert(false);
+ }
+ throw std::runtime_error("yaml-cpp: internal error, bad tag type");
+}
+}
diff --git a/src/libs/3rdparty/yaml-cpp/src/tag.h b/src/libs/3rdparty/yaml-cpp/src/tag.h
new file mode 100644
index 0000000000..ac30673b9e
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/tag.h
@@ -0,0 +1,33 @@
+#ifndef TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+namespace YAML {
+struct Directives;
+struct Token;
+
+struct Tag {
+ enum TYPE {
+ VERBATIM,
+ PRIMARY_HANDLE,
+ SECONDARY_HANDLE,
+ NAMED_HANDLE,
+ NON_SPECIFIC
+ };
+
+ Tag(const Token& token);
+ const std::string Translate(const Directives& directives);
+
+ TYPE type;
+ std::string handle, value;
+};
+}
+
+#endif // TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/src/token.h b/src/libs/3rdparty/yaml-cpp/src/token.h
new file mode 100644
index 0000000000..ad0b7d0a00
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/src/token.h
@@ -0,0 +1,69 @@
+#ifndef TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "yaml-cpp/mark.h"
+#include <iostream>
+#include <string>
+#include <vector>
+
+namespace YAML {
+const std::string TokenNames[] = {
+ "DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START", "BLOCK_MAP_START",
+ "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", "FLOW_SEQ_START",
+ "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", "FLOW_MAP_COMPACT",
+ "FLOW_ENTRY", "KEY", "VALUE", "ANCHOR", "ALIAS", "TAG", "SCALAR"};
+
+struct Token {
+ // enums
+ enum STATUS { VALID, INVALID, UNVERIFIED };
+ enum TYPE {
+ DIRECTIVE,
+ DOC_START,
+ DOC_END,
+ BLOCK_SEQ_START,
+ BLOCK_MAP_START,
+ BLOCK_SEQ_END,
+ BLOCK_MAP_END,
+ BLOCK_ENTRY,
+ FLOW_SEQ_START,
+ FLOW_MAP_START,
+ FLOW_SEQ_END,
+ FLOW_MAP_END,
+ FLOW_MAP_COMPACT,
+ FLOW_ENTRY,
+ KEY,
+ VALUE,
+ ANCHOR,
+ ALIAS,
+ TAG,
+ PLAIN_SCALAR,
+ NON_PLAIN_SCALAR
+ };
+
+ // data
+ Token(TYPE type_, const Mark& mark_)
+ : status(VALID), type(type_), mark(mark_), data(0) {}
+
+ friend std::ostream& operator<<(std::ostream& out, const Token& token) {
+ out << TokenNames[token.type] << std::string(": ") << token.value;
+ for (std::size_t i = 0; i < token.params.size(); i++)
+ out << std::string(" ") << token.params[i];
+ return out;
+ }
+
+ STATUS status;
+ TYPE type;
+ Mark mark;
+ std::string value;
+ std::vector<std::string> params;
+ int data;
+};
+}
+
+#endif // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp.pc.cmake b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pc.cmake
new file mode 100644
index 0000000000..3db7962eaf
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pc.cmake
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+includedir=${prefix}/@INCLUDE_INSTALL_ROOT_DIR@
+libdir=${exec_prefix}/@LIB_INSTALL_DIR@
+
+Name: Yaml-cpp
+Description: A YAML parser and emitter for C++
+Version: @YAML_CPP_VERSION@
+Requires:
+Libs: -L${libdir} -lyaml-cpp
+Cflags: -I${includedir}
diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp.pri b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pri
new file mode 100644
index 0000000000..e7416275b9
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pri
@@ -0,0 +1,89 @@
+INCLUDEPATH += $$PWD/include/
+
+HEADERS += \
+ $$PWD/include/yaml-cpp/anchor.h \
+ $$PWD/include/yaml-cpp/binary.h \
+ $$PWD/include/yaml-cpp/dll.h \
+ $$PWD/include/yaml-cpp/emitfromevents.h \
+ $$PWD/include/yaml-cpp/emitter.h \
+ $$PWD/include/yaml-cpp/emitterdef.h \
+ $$PWD/include/yaml-cpp/emittermanip.h \
+ $$PWD/include/yaml-cpp/emitterstyle.h \
+ $$PWD/include/yaml-cpp/eventhandler.h \
+ $$PWD/include/yaml-cpp/exceptions.h \
+ $$PWD/include/yaml-cpp/mark.h \
+ $$PWD/include/yaml-cpp/node/convert.h \
+ $$PWD/include/yaml-cpp/node/detail/bool_type.h \
+ $$PWD/include/yaml-cpp/node/detail/impl.h \
+ $$PWD/include/yaml-cpp/node/detail/iterator.h \
+ $$PWD/include/yaml-cpp/node/detail/iterator_fwd.h \
+ $$PWD/include/yaml-cpp/node/detail/memory.h \
+ $$PWD/include/yaml-cpp/node/detail/node.h \
+ $$PWD/include/yaml-cpp/node/detail/node_data.h \
+ $$PWD/include/yaml-cpp/node/detail/node_iterator.h \
+ $$PWD/include/yaml-cpp/node/detail/node_ref.h \
+ $$PWD/include/yaml-cpp/node/emit.h \
+ $$PWD/include/yaml-cpp/node/impl.h \
+ $$PWD/include/yaml-cpp/node/iterator.h \
+ $$PWD/include/yaml-cpp/node/node.h \
+ $$PWD/include/yaml-cpp/node/parse.h \
+ $$PWD/include/yaml-cpp/node/ptr.h \
+ $$PWD/include/yaml-cpp/node/type.h \
+ $$PWD/include/yaml-cpp/noncopyable.h \
+ $$PWD/include/yaml-cpp/null.h \
+ $$PWD/include/yaml-cpp/ostream_wrapper.h \
+ $$PWD/include/yaml-cpp/parser.h \
+ $$PWD/include/yaml-cpp/stlemitter.h \
+ $$PWD/include/yaml-cpp/traits.h \
+ $$PWD/include/yaml-cpp/yaml.h \
+ $$PWD/src/collectionstack.h \
+ $$PWD/src/directives.h \
+ $$PWD/src/emitterstate.h \
+ $$PWD/src/emitterutils.h \
+ $$PWD/src/exp.h \
+ $$PWD/src/indentation.h \
+ $$PWD/src/nodebuilder.h \
+ $$PWD/src/nodeevents.h \
+ $$PWD/src/ptr_vector.h \
+ $$PWD/src/regex_yaml.h \
+ $$PWD/src/regeximpl.h \
+ $$PWD/src/scanner.h \
+ $$PWD/src/scanscalar.h \
+ $$PWD/src/scantag.h \
+ $$PWD/src/setting.h \
+ $$PWD/src/singledocparser.h \
+ $$PWD/src/stream.h \
+ $$PWD/src/streamcharsource.h \
+ $$PWD/src/stringsource.h \
+ $$PWD/src/tag.h \
+ $$PWD/src/token.h \
+
+SOURCES += \
+ $$PWD/src/binary.cpp \
+ $$PWD/src/convert.cpp \
+ $$PWD/src/directives.cpp \
+ $$PWD/src/emit.cpp \
+ $$PWD/src/emitfromevents.cpp \
+ $$PWD/src/emitter.cpp \
+ $$PWD/src/emitterstate.cpp \
+ $$PWD/src/emitterutils.cpp \
+ $$PWD/src/exceptions.cpp \
+ $$PWD/src/exp.cpp \
+ $$PWD/src/memory.cpp \
+ $$PWD/src/node.cpp \
+ $$PWD/src/node_data.cpp \
+ $$PWD/src/nodebuilder.cpp \
+ $$PWD/src/nodeevents.cpp \
+ $$PWD/src/null.cpp \
+ $$PWD/src/ostream_wrapper.cpp \
+ $$PWD/src/parse.cpp \
+ $$PWD/src/parser.cpp \
+ $$PWD/src/regex_yaml.cpp \
+ $$PWD/src/scanner.cpp \
+ $$PWD/src/scanscalar.cpp \
+ $$PWD/src/scantag.cpp \
+ $$PWD/src/scantoken.cpp \
+ $$PWD/src/simplekey.cpp \
+ $$PWD/src/singledocparser.cpp \
+ $$PWD/src/stream.cpp \
+ $$PWD/src/tag.cpp \
diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp.pro b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pro
new file mode 100644
index 0000000000..dc21db2dd7
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/yaml-cpp.pro
@@ -0,0 +1,5 @@
+include(../../../qtcreatorlibrary.pri)
+include(yaml-cpp.pri)
+
+DEFINES += YAML_CPP_DLL yaml_cpp_EXPORTS
+
diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp.qbs b/src/libs/3rdparty/yaml-cpp/yaml-cpp.qbs
new file mode 100644
index 0000000000..9a2d3f96a0
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/yaml-cpp.qbs
@@ -0,0 +1,105 @@
+import qbs 1.0
+
+Project {
+ QtcLibrary {
+ name: "yaml-cpp"
+
+ cpp.defines: base.concat(["YAML_CPP_DLL", "yaml_cpp_EXPORTS"])
+ cpp.includePaths: [product.sourceDirectory + "/include/"]
+
+ files: [
+ "include/yaml-cpp/anchor.h",
+ "include/yaml-cpp/binary.h",
+ "include/yaml-cpp/dll.h",
+ "include/yaml-cpp/emitfromevents.h",
+ "include/yaml-cpp/emitter.h",
+ "include/yaml-cpp/emitterdef.h",
+ "include/yaml-cpp/emittermanip.h",
+ "include/yaml-cpp/emitterstyle.h",
+ "include/yaml-cpp/eventhandler.h",
+ "include/yaml-cpp/exceptions.h",
+ "include/yaml-cpp/mark.h",
+ "include/yaml-cpp/node",
+ "include/yaml-cpp/node/convert.h",
+ "include/yaml-cpp/node/detail",
+ "include/yaml-cpp/node/detail/bool_type.h",
+ "include/yaml-cpp/node/detail/impl.h",
+ "include/yaml-cpp/node/detail/iterator.h",
+ "include/yaml-cpp/node/detail/iterator_fwd.h",
+ "include/yaml-cpp/node/detail/memory.h",
+ "include/yaml-cpp/node/detail/node.h",
+ "include/yaml-cpp/node/detail/node_data.h",
+ "include/yaml-cpp/node/detail/node_iterator.h",
+ "include/yaml-cpp/node/detail/node_ref.h",
+ "include/yaml-cpp/node/emit.h",
+ "include/yaml-cpp/node/impl.h",
+ "include/yaml-cpp/node/iterator.h",
+ "include/yaml-cpp/node/node.h",
+ "include/yaml-cpp/node/parse.h",
+ "include/yaml-cpp/node/ptr.h",
+ "include/yaml-cpp/node/type.h",
+ "include/yaml-cpp/noncopyable.h",
+ "include/yaml-cpp/null.h",
+ "include/yaml-cpp/ostream_wrapper.h",
+ "include/yaml-cpp/parser.h",
+ "include/yaml-cpp/stlemitter.h",
+ "include/yaml-cpp/traits.h",
+ "include/yaml-cpp/yaml.h",
+ "src/binary.cpp",
+ "src/collectionstack.h",
+ "src/convert.cpp",
+ "src/directives.cpp",
+ "src/directives.h",
+ "src/emit.cpp",
+ "src/emitfromevents.cpp",
+ "src/emitter.cpp",
+ "src/emitterstate.cpp",
+ "src/emitterstate.h",
+ "src/emitterutils.cpp",
+ "src/emitterutils.h",
+ "src/exceptions.cpp",
+ "src/exp.cpp",
+ "src/exp.h",
+ "src/indentation.h",
+ "src/memory.cpp",
+ "src/node.cpp",
+ "src/node_data.cpp",
+ "src/nodebuilder.cpp",
+ "src/nodebuilder.h",
+ "src/nodeevents.cpp",
+ "src/nodeevents.h",
+ "src/null.cpp",
+ "src/ostream_wrapper.cpp",
+ "src/parse.cpp",
+ "src/parser.cpp",
+ "src/ptr_vector.h",
+ "src/regex_yaml.cpp",
+ "src/regex_yaml.h",
+ "src/regeximpl.h",
+ "src/scanner.cpp",
+ "src/scanner.h",
+ "src/scanscalar.cpp",
+ "src/scanscalar.h",
+ "src/scantag.cpp",
+ "src/scantag.h",
+ "src/scantoken.cpp",
+ "src/setting.h",
+ "src/simplekey.cpp",
+ "src/singledocparser.cpp",
+ "src/singledocparser.h",
+ "src/stream.cpp",
+ "src/stream.h",
+ "src/streamcharsource.h",
+ "src/stringsource.h",
+ "src/tag.cpp",
+ "src/tag.h",
+ "src/token.h",
+ ]
+
+ Export {
+ Depends { name: "cpp" }
+ cpp.includePaths: [product.sourceDirectory + "/include/"]
+ cpp.defines: base.concat(["YAML_CPP_DLL"])
+ }
+ }
+}
diff --git a/src/libs/3rdparty/yaml-cpp/yaml-cpp_dependencies.pri b/src/libs/3rdparty/yaml-cpp/yaml-cpp_dependencies.pri
new file mode 100644
index 0000000000..e93a856869
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/yaml-cpp_dependencies.pri
@@ -0,0 +1,2 @@
+QTC_LIB_NAME = yaml-cpp
+INCLUDEPATH *= $$PWD/include
diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt
index 213dbeaadb..af8bfc2342 100644
--- a/src/libs/clangsupport/CMakeLists.txt
+++ b/src/libs/clangsupport/CMakeLists.txt
@@ -1,6 +1,7 @@
set(CLANG_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
add_qtc_library(ClangSupport
+ DEPENDS Threads::Threads
PUBLIC_DEPENDS Utils Sqlite Qt5::Core Qt5::Network
PUBLIC_DEFINES
CLANG_VERSION="${CLANG_VERSION}"
diff --git a/src/libs/clangsupport/clangpathwatcher.h b/src/libs/clangsupport/clangpathwatcher.h
index 5ce02458c4..27f7646271 100644
--- a/src/libs/clangsupport/clangpathwatcher.h
+++ b/src/libs/clangsupport/clangpathwatcher.h
@@ -390,9 +390,7 @@ public:
FilePathIds watchedPaths(const WatcherEntries &entries) const
{
- auto filePathIds = Utils::transform<FilePathIds>(entries, [](WatcherEntry entry) {
- return entry.filePathId;
- });
+ auto filePathIds = Utils::transform<FilePathIds>(entries, &WatcherEntry::filePathId);
std::sort(filePathIds.begin(), filePathIds.end());
@@ -412,7 +410,7 @@ public:
for (WatcherEntry entry : foundEntries) {
if (idPaths.empty() || idPaths.back().id != entry.id)
- idPaths.push_back({entry.id, {}});
+ idPaths.emplace_back(entry.id, FilePathIds{});
idPaths.back().filePathIds.push_back(entry.filePathId);
}
diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri
index 18896c0ea0..fa4a06fe77 100644
--- a/src/libs/clangsupport/clangsupport-lib.pri
+++ b/src/libs/clangsupport/clangsupport-lib.pri
@@ -118,6 +118,7 @@ HEADERS += \
$$PWD/projectpartid.h \
$$PWD/projectpartsstorage.h \
$$PWD/projectpartsstorageinterface.h \
+ $$PWD/projectpartstoragestructs.h \
$$PWD/requestcompletionsmessage.h \
$$PWD/echomessage.h \
$$PWD/endmessage.h \
@@ -156,6 +157,7 @@ HEADERS += \
$$PWD/refactoringserverproxy.h \
$$PWD/referencesmessage.h \
$$PWD/set_algorithm.h \
+ $$PWD/stringcacheentry.h \
$$PWD/unsavedfilesupdatedmessage.h \
$$PWD/removeprojectpartsmessage.h \
$$PWD/requestannotationsmessage.h \
diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h
index 57ce18e195..7b63feb381 100644
--- a/src/libs/clangsupport/clangsupport_global.h
+++ b/src/libs/clangsupport/clangsupport_global.h
@@ -201,15 +201,14 @@ struct HighlightingTypes {
MixinHighlightingTypes mixinHighlightingTypes;
};
-enum class SourceLocationKind : uchar
-{
- None = 0,
+enum class SourceLocationKind : uchar {
+ Definition = 1,
Declaration,
DeclarationReference,
- Definition,
MacroDefinition = 128,
+ MacroUndefinition,
MacroUsage,
- MacroUndefinition
+ None = 255,
};
enum class SymbolKind : uchar
diff --git a/src/libs/clangsupport/clangsupportdebugutils.h b/src/libs/clangsupport/clangsupportdebugutils.h
index 5f1751aeac..0e4a6da9a8 100644
--- a/src/libs/clangsupport/clangsupportdebugutils.h
+++ b/src/libs/clangsupport/clangsupportdebugutils.h
@@ -40,7 +40,7 @@ Utf8String debugId(const FileContainer &fileContainer);
class CLANGSUPPORT_EXPORT VerboseScopeDurationTimer
{
public:
- VerboseScopeDurationTimer(const char *id = 0);
+ VerboseScopeDurationTimer(const char *id = nullptr);
~VerboseScopeDurationTimer();
private:
diff --git a/src/libs/clangsupport/filecontainerv2.h b/src/libs/clangsupport/filecontainerv2.h
index aa7248fb5e..e6e8c6622f 100644
--- a/src/libs/clangsupport/filecontainerv2.h
+++ b/src/libs/clangsupport/filecontainerv2.h
@@ -27,6 +27,7 @@
#include "clangsupport_global.h"
#include "filepath.h"
+#include "filepathid.h"
#include <vector>
@@ -39,13 +40,15 @@ public:
FileContainer() = default;
FileContainer(FilePath &&filePath,
+ FilePathId filePathId,
Utils::SmallString &&unsavedFileContent,
Utils::SmallStringVector &&commandLineArguments = {},
quint32 documentRevision = 0)
- : filePath(std::move(filePath)),
- unsavedFileContent(std::move(unsavedFileContent)),
- commandLineArguments(std::move(commandLineArguments)),
- documentRevision(documentRevision)
+ : filePath(std::move(filePath))
+ , filePathId(filePathId)
+ , unsavedFileContent(std::move(unsavedFileContent))
+ , commandLineArguments(std::move(commandLineArguments))
+ , documentRevision(documentRevision)
{
}
@@ -81,16 +84,11 @@ public:
< std::tie(second.filePath, second.documentRevision, second.unsavedFileContent, second.commandLineArguments);
}
- FileContainer clone() const
- {
- return FileContainer(filePath.clone(),
- unsavedFileContent.clone(),
- commandLineArguments.clone(),
- documentRevision);
- }
+ FileContainer clone() const { return *this; }
public:
FilePath filePath;
+ FilePathId filePathId;
Utils::SmallString unsavedFileContent;
Utils::SmallStringVector commandLineArguments;
quint32 documentRevision = 0;
diff --git a/src/libs/clangsupport/filepathcache.h b/src/libs/clangsupport/filepathcache.h
index 4845416d22..541769b0b5 100644
--- a/src/libs/clangsupport/filepathcache.h
+++ b/src/libs/clangsupport/filepathcache.h
@@ -29,94 +29,69 @@
#include "filepath.h"
#include "filepathexceptions.h"
#include "filepathid.h"
+#include "filepathstoragesources.h"
#include "filepathview.h"
#include "stringcache.h"
+#include <sqlitetransaction.h>
+
#include <algorithm>
namespace ClangBackEnd {
-template <typename FilePathStorage>
+template<typename FilePathStorage, typename Mutex = SharedMutex>
class CLANGSUPPORT_GCCEXPORT FilePathCache
{
- class FileNameView
- {
- public:
- friend bool operator==(const FileNameView &first, const FileNameView &second)
- {
- return first.directoryId == second.directoryId
- && first.fileName == second.fileName;
- }
-
- static
- int compare(FileNameView first, FileNameView second) noexcept
- {
- int directoryDifference = first.directoryId - second.directoryId;
-
- if (directoryDifference)
- return directoryDifference;
-
- return Utils::compare(first.fileName, second.fileName);
- }
-
- public:
- Utils::SmallStringView fileName;
- int directoryId;
- };
-
- class FileNameEntry
- {
- public:
- FileNameEntry(Utils::SmallStringView fileName, int directoryId)
- : fileName(fileName),
- directoryId(directoryId)
- {}
-
- FileNameEntry(FileNameView view)
- : fileName(view.fileName),
- directoryId(view.directoryId)
- {}
-
- friend bool operator==(const FileNameEntry &first, const FileNameEntry &second)
- {
- return first.directoryId == second.directoryId
- && first.fileName == second.fileName;
- }
-
- operator FileNameView() const
- {
- return {fileName, directoryId};
- }
-
- operator Utils::SmallString() &&
- {
- return std::move(fileName);
- }
+ FilePathCache(const FilePathCache &) = default;
+ FilePathCache &operator=(const FilePathCache &) = default;
- public:
- Utils::SmallString fileName;
- int directoryId;
- };
+ template<typename Storage, typename M>
+ friend class FilePathCache;
+public:
using DirectoryPathCache = StringCache<Utils::PathString,
Utils::SmallStringView,
int,
- SharedMutex,
+ Mutex,
decltype(&Utils::reverseCompare),
- Utils::reverseCompare>;
+ Utils::reverseCompare,
+ Sources::Directory>;
using FileNameCache = StringCache<FileNameEntry,
FileNameView,
int,
- SharedMutex,
+ Mutex,
decltype(&FileNameView::compare),
- FileNameView::compare>;
-public:
+ FileNameView::compare,
+ Sources::Source>;
+
FilePathCache(FilePathStorage &filePathStorage)
: m_filePathStorage(filePathStorage)
- {}
+ {
+ populateIfEmpty();
+ }
- FilePathCache(const FilePathCache &) = delete;
- FilePathCache &operator=(const FilePathCache &) = delete;
+ FilePathCache(FilePathCache &&) = default;
+ FilePathCache &operator=(FilePathCache &&) = default;
+
+ void populateIfEmpty()
+ {
+ if (m_fileNameCache.isEmpty()) {
+ m_directoryPathCache.populate(m_filePathStorage.fetchAllDirectories());
+ m_fileNameCache.populate(m_filePathStorage.fetchAllSources());
+ }
+ }
+
+ template<typename Cache>
+ Cache clone()
+ {
+ using DirectoryPathCache = typename Cache::DirectoryPathCache;
+ using FileNameCache = typename Cache::FileNameCache;
+ Cache cache{m_filePathStorage};
+ cache.m_directoryPathCache = m_directoryPathCache.template clone<DirectoryPathCache>();
+ cache.m_fileNameCache = m_fileNameCache.template clone<FileNameCache>();
+
+ return cache;
+ }
FilePathId filePathId(FilePathView filePath) const
{
@@ -158,8 +133,7 @@ public:
return FileNameEntry{entry.sourceName, entry.directoryId};
};
- FileNameEntry entry = m_fileNameCache.string(filePathId.filePathId,
- fetchSoureNameAndDirectoryId);
+ auto entry = m_fileNameCache.string(filePathId.filePathId, fetchSoureNameAndDirectoryId);
auto fetchDirectoryPath = [&] (int id) { return m_filePathStorage.fetchDirectoryPath(id); };
@@ -189,12 +163,40 @@ public:
return FileNameEntry{entry.sourceName, entry.directoryId};
};
- FileNameEntry entry = m_fileNameCache.string(filePathId.filePathId,
- fetchSoureNameAndDirectoryId);
-
return m_fileNameCache.string(filePathId.filePathId, fetchSoureNameAndDirectoryId).directoryId;
}
+ template<typename Container>
+ void addFilePaths(Container &&filePaths)
+ {
+ auto directoryPaths = Utils::transform<std::vector<Utils::SmallStringView>>(
+ filePaths, [](FilePathView filePath) { return filePath.directory(); });
+
+ std::unique_ptr<Sqlite::DeferredTransaction> transaction;
+
+ m_directoryPathCache.addStrings(std::move(directoryPaths), [&](Utils::SmallStringView directoryPath) {
+ if (!transaction)
+ transaction = std::make_unique<Sqlite::DeferredTransaction>(
+ m_filePathStorage.database());
+ return m_filePathStorage.fetchDirectoryIdUnguarded(directoryPath);
+ });
+
+ auto sourcePaths = Utils::transform<std::vector<FileNameView>>(filePaths, [&](FilePathView filePath) {
+ return FileNameView{filePath.name(), m_directoryPathCache.stringId(filePath.directory())};
+ });
+
+ m_fileNameCache.addStrings(std::move(sourcePaths), [&](FileNameView fileNameView) {
+ if (!transaction)
+ transaction = std::make_unique<Sqlite::DeferredTransaction>(
+ m_filePathStorage.database());
+ return m_filePathStorage.fetchSourceIdUnguarded(fileNameView.directoryId,
+ fileNameView.fileName);
+ });
+
+ if (transaction)
+ transaction->commit();
+ }
+
private:
mutable DirectoryPathCache m_directoryPathCache;
mutable FileNameCache m_fileNameCache;
diff --git a/src/libs/clangsupport/filepathcaching.cpp b/src/libs/clangsupport/filepathcaching.cpp
index 372ed86bd3..f6d9ba9691 100644
--- a/src/libs/clangsupport/filepathcaching.cpp
+++ b/src/libs/clangsupport/filepathcaching.cpp
@@ -52,4 +52,49 @@ DirectoryPathId FilePathCaching::directoryPathId(FilePathId filePathId) const
return m_cache.directoryPathId(filePathId);
}
+void FilePathCaching::addFilePaths(const FilePaths &filePaths)
+{
+ m_cache.addFilePaths(filePaths);
+}
+
+void FilePathCaching::populateIfEmpty()
+{
+ m_cache.populateIfEmpty();
+}
+
+FilePathId CopyableFilePathCaching::filePathId(FilePathView filePath) const
+{
+ return m_cache.filePathId(filePath);
+}
+
+FilePath CopyableFilePathCaching::filePath(FilePathId filePathId) const
+{
+ return m_cache.filePath(filePathId);
+}
+
+DirectoryPathId CopyableFilePathCaching::directoryPathId(Utils::SmallStringView directoryPath) const
+{
+ return m_cache.directoryPathId(directoryPath);
+}
+
+Utils::PathString CopyableFilePathCaching::directoryPath(DirectoryPathId directoryPathId) const
+{
+ return m_cache.directoryPath(directoryPathId);
+}
+
+DirectoryPathId CopyableFilePathCaching::directoryPathId(FilePathId filePathId) const
+{
+ return m_cache.directoryPathId(filePathId);
+}
+
+void CopyableFilePathCaching::addFilePaths(const FilePaths &filePaths)
+{
+ m_cache.addFilePaths(filePaths);
+}
+
+void CopyableFilePathCaching::populateIfEmpty()
+{
+ m_cache.populateIfEmpty();
+}
+
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/filepathcaching.h b/src/libs/clangsupport/filepathcaching.h
index f69b940b15..7c1f343401 100644
--- a/src/libs/clangsupport/filepathcaching.h
+++ b/src/libs/clangsupport/filepathcaching.h
@@ -40,9 +40,11 @@ namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT FilePathCaching final : public FilePathCachingInterface
{
+ friend class CopyableFilePathCaching;
using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>;
using Storage = FilePathStorage<Factory>;
using Cache = FilePathCache<Storage>;
+
public:
FilePathCaching(Sqlite::Database &database)
: m_factory(database)
@@ -53,6 +55,8 @@ public:
DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override;
Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override;
DirectoryPathId directoryPathId(FilePathId filePathId) const override;
+ void addFilePaths(const ClangBackEnd::FilePaths &filePaths) override;
+ void populateIfEmpty() override;
private:
Factory m_factory;
@@ -60,4 +64,27 @@ private:
Cache m_cache{m_storage};
};
+class CLANGSUPPORT_EXPORT CopyableFilePathCaching final : public FilePathCachingInterface
+{
+ using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>;
+ using Storage = FilePathStorage<Factory>;
+ using Cache = FilePathCache<Storage, NonLockingMutex>;
+
+public:
+ CopyableFilePathCaching(FilePathCaching &cache)
+ : m_cache(cache.m_cache.clone<Cache>())
+ {}
+
+ FilePathId filePathId(FilePathView filePath) const override;
+ FilePath filePath(FilePathId filePathId) const override;
+ DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override;
+ Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override;
+ DirectoryPathId directoryPathId(FilePathId filePathId) const override;
+ void addFilePaths(const ClangBackEnd::FilePaths &filePaths) override;
+ void populateIfEmpty() override;
+
+private:
+ Cache m_cache;
+};
+
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/filepathcachinginterface.h b/src/libs/clangsupport/filepathcachinginterface.h
index 098fd39ca9..69be405d37 100644
--- a/src/libs/clangsupport/filepathcachinginterface.h
+++ b/src/libs/clangsupport/filepathcachinginterface.h
@@ -44,6 +44,8 @@ public:
virtual DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const = 0;
virtual DirectoryPathId directoryPathId(FilePathId filePathId) const = 0;
virtual Utils::PathString directoryPath(DirectoryPathId directoryPathId) const = 0;
+ virtual void addFilePaths(const ClangBackEnd::FilePaths &filePaths) = 0;
+ virtual void populateIfEmpty() = 0;
template<typename Container>
FilePathIds filePathIds(Container &&filePaths) const
@@ -56,6 +58,8 @@ public:
std::back_inserter(filePathIds),
[&] (const auto &filePath) { return this->filePathId(filePath); });
+ std::sort(filePathIds.begin(), filePathIds.end());
+
return filePathIds;
}
diff --git a/src/libs/clangsupport/filepathstorage.h b/src/libs/clangsupport/filepathstorage.h
index 8aba2ef6d2..083782fec2 100644
--- a/src/libs/clangsupport/filepathstorage.h
+++ b/src/libs/clangsupport/filepathstorage.h
@@ -48,6 +48,16 @@ public:
: m_statementFactory(statementFactory)
{}
+ int fetchDirectoryIdUnguarded(Utils::SmallStringView directoryPath)
+ {
+ Utils::optional<int> optionalDirectoryId = readDirectoryId(directoryPath);
+
+ if (optionalDirectoryId)
+ return optionalDirectoryId.value();
+
+ return writeDirectoryId(directoryPath);
+ }
+
int fetchDirectoryId(Utils::SmallStringView directoryPath)
{
try {
@@ -125,19 +135,22 @@ public:
}
}
+ int fetchSourceIdUnguarded(int directoryId, Utils::SmallStringView sourceName)
+ {
+ Utils::optional<int> optionalSourceId = readSourceId(directoryId, sourceName);
+
+ if (optionalSourceId)
+ return optionalSourceId.value();
+
+ return writeSourceId(directoryId, sourceName);
+ }
+
int fetchSourceId(int directoryId, Utils::SmallStringView sourceName)
{
try {
Sqlite::DeferredTransaction transaction{m_statementFactory.database};
- Utils::optional<int> optionalSourceId = readSourceId(directoryId, sourceName);
-
- int sourceId = -1;
-
- if (optionalSourceId)
- sourceId = optionalSourceId.value();
- else
- sourceId = writeSourceId(directoryId, sourceName);
+ int sourceId = fetchSourceIdUnguarded(directoryId, sourceName);
transaction.commit();
@@ -212,7 +225,7 @@ public:
ReadStatement &statement = m_statementFactory.selectAllSources;
- auto sources = statement.template values<Sources::Source, 2>(8192);
+ auto sources = statement.template values<Sources::Source, 3>(8192);
transaction.commit();
@@ -222,6 +235,8 @@ public:
}
}
+ Database &database() { return m_statementFactory.database; }
+
private:
StatementFactory &m_statementFactory;
};
diff --git a/src/libs/clangsupport/filepathstoragesources.h b/src/libs/clangsupport/filepathstoragesources.h
index e76cb3b2cf..23293be1f7 100644
--- a/src/libs/clangsupport/filepathstoragesources.h
+++ b/src/libs/clangsupport/filepathstoragesources.h
@@ -25,6 +25,8 @@
#pragma once
+#include "stringcacheentry.h"
+
#include <utils/smallstring.h>
#include <cstdint>
@@ -33,41 +35,90 @@
#include <unordered_map>
namespace ClangBackEnd {
-namespace Sources {
-class Directory
+
+class FileNameView
{
public:
- Directory(int directoryId, Utils::PathString &&directoryPath)
- : directoryId(directoryId), directoryPath(std::move(directoryPath))
- {}
+ friend bool operator==(const FileNameView &first, const FileNameView &second)
+ {
+ return first.directoryId == second.directoryId && first.fileName == second.fileName;
+ }
- friend
- bool operator==(const Directory &first, const Directory &second)
+ static int compare(FileNameView first, FileNameView second) noexcept
{
- return first.directoryId == second.directoryId && first.directoryPath == second.directoryPath;
+ int directoryDifference = first.directoryId - second.directoryId;
+
+ if (directoryDifference)
+ return directoryDifference;
+
+ return Utils::compare(first.fileName, second.fileName);
}
public:
+ Utils::SmallStringView fileName;
int directoryId;
- Utils::PathString directoryPath;
};
-class Source
+class FileNameEntry
{
public:
- Source(int sourceId, Utils::PathString &&sourceName)
- : sourceId(sourceId), sourceName(std::move(sourceName))
+ FileNameEntry(Utils::SmallStringView fileName, int directoryId)
+ : fileName(fileName)
+ , directoryId(directoryId)
{}
- friend
- bool operator==(const Source &first, const Source &second)
+ FileNameEntry(FileNameView view)
+ : fileName(view.fileName)
+ , directoryId(view.directoryId)
+ {}
+
+ friend bool operator==(const FileNameEntry &first, const FileNameEntry &second)
+ {
+ return first.directoryId == second.directoryId && first.fileName == second.fileName;
+ }
+
+ friend bool operator!=(const FileNameEntry &first, const FileNameEntry &second)
+ {
+ return !(first == second);
+ }
+
+ operator FileNameView() const { return {fileName, directoryId}; }
+
+ operator Utils::SmallString() && { return std::move(fileName); }
+
+public:
+ Utils::SmallString fileName;
+ int directoryId;
+};
+
+namespace Sources {
+class Directory : public StringCacheEntry<Utils::PathString, Utils::SmallStringView, int>
+{
+ using Base = StringCacheEntry<Utils::PathString, Utils::SmallStringView, int>;
+
+public:
+ using Base::Base;
+
+ friend bool operator==(const Directory &first, const Directory &second)
{
- return first.sourceId == second.sourceId && first.sourceName == second.sourceName;
+ return first.id == second.id && first.string == second.string;
}
+};
+
+class Source : public StringCacheEntry<FileNameEntry, FileNameView, int>
+{
+ using Base = StringCacheEntry<FileNameEntry, FileNameView, int>;
public:
- int sourceId;
- Utils::PathString sourceName;
+ using Base::Base;
+ Source(Utils::SmallStringView sourceName, int directoryId, int sourceId)
+ : Base{{sourceName, directoryId}, sourceId}
+ {}
+
+ friend bool operator==(const Source &first, const Source &second)
+ {
+ return first.id == second.id && first.string == second.string;
+ }
};
class SourceNameAndDirectoryId
diff --git a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h b/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h
index 27296a1df6..f0d261dd49 100644
--- a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h
+++ b/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h
@@ -50,13 +50,8 @@ public:
database
};
ReadStatement selectDirectoryPathFromDirectoriesByDirectoryId{
- "SELECT directoryPath FROM directories WHERE directoryId = ?",
- database
- };
- ReadStatement selectAllDirectories{
- "SELECT directoryId, directoryPath FROM directories",
- database
- };
+ "SELECT directoryPath FROM directories WHERE directoryId = ?", database};
+ ReadStatement selectAllDirectories{"SELECT directoryPath, directoryId FROM directories", database};
WriteStatement insertIntoDirectories{
"INSERT INTO directories(directoryPath) VALUES (?)",
database
@@ -75,10 +70,7 @@ public:
"INSERT INTO sources(directoryId, sourceName) VALUES (?,?)",
database
};
- ReadStatement selectAllSources{
- "SELECT sourceId, sourceName FROM sources",
- database
- };
+ ReadStatement selectAllSources{"SELECT sourceName, directoryId, sourceId FROM sources", database};
};
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/filesystem.cpp b/src/libs/clangsupport/filesystem.cpp
index 5b8c037f80..db79ddda31 100644
--- a/src/libs/clangsupport/filesystem.cpp
+++ b/src/libs/clangsupport/filesystem.cpp
@@ -55,7 +55,10 @@ long long FileSystem::lastModified(FilePathId filePathId) const
fileInfo.refresh();
- return fileInfo.lastModified().toMSecsSinceEpoch() / 1000;
+ if (fileInfo.exists())
+ return fileInfo.lastModified().toMSecsSinceEpoch() / 1000;
+
+ return 0;
}
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/generatedfiles.cpp b/src/libs/clangsupport/generatedfiles.cpp
index 644137886b..22b1e8044a 100644
--- a/src/libs/clangsupport/generatedfiles.cpp
+++ b/src/libs/clangsupport/generatedfiles.cpp
@@ -53,7 +53,7 @@ void GeneratedFiles::update(const V2::FileContainers &fileContainers)
V2::FileContainers unionFileContainers;
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
- auto compare = [] (const V2::FileContainer &first, const V2::FileContainer &second) {
+ auto compare = [](const V2::FileContainer &first, const V2::FileContainer &second) {
return first.filePath < second.filePath;
};
@@ -69,10 +69,7 @@ void GeneratedFiles::update(const V2::FileContainers &fileContainers)
class Compare {
public:
- bool operator()(const FilePath &first, const FilePath &second)
- {
- return first < second;
- }
+ bool operator()(const FilePath &first, const FilePath &second) { return first < second; }
bool operator()(const V2::FileContainer &first, const V2::FileContainer &second)
{
return first.filePath < second.filePath;
@@ -116,4 +113,16 @@ const V2::FileContainers &GeneratedFiles::fileContainers() const
return m_fileContainers;
}
+FilePathIds GeneratedFiles::filePathIds() const
+{
+ auto ids = Utils::transform<FilePathIds>(m_fileContainers,
+ [](const V2::FileContainer &fileContainer) {
+ return fileContainer.filePathId;
+ });
+
+ std::sort(ids.begin(), ids.end());
+
+ return ids;
+}
+
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/generatedfiles.h b/src/libs/clangsupport/generatedfiles.h
index 933b0d111b..3e87048be9 100644
--- a/src/libs/clangsupport/generatedfiles.h
+++ b/src/libs/clangsupport/generatedfiles.h
@@ -38,6 +38,7 @@ public:
bool isValid() const;
const V2::FileContainers &fileContainers() const;
+ FilePathIds filePathIds() const;
private:
V2::FileContainers m_fileContainers;
diff --git a/src/libs/clangsupport/generatedfilesinterface.h b/src/libs/clangsupport/generatedfilesinterface.h
index 85a50ffa38..72a1dfccfb 100644
--- a/src/libs/clangsupport/generatedfilesinterface.h
+++ b/src/libs/clangsupport/generatedfilesinterface.h
@@ -38,6 +38,7 @@ public:
virtual bool isValid() const = 0;
virtual const V2::FileContainers &fileContainers() const = 0;
+ virtual FilePathIds filePathIds() const = 0;
protected:
~GeneratedFilesInterface() = default;
diff --git a/src/libs/clangsupport/idpaths.h b/src/libs/clangsupport/idpaths.h
index d0945f7ff5..8410bbbbd5 100644
--- a/src/libs/clangsupport/idpaths.h
+++ b/src/libs/clangsupport/idpaths.h
@@ -70,13 +70,23 @@ public:
class IdPaths
{
public:
- ProjectChunkId id;
- FilePathIds filePathIds;
+ IdPaths(ProjectPartId projectPartId, SourceType sourceType, FilePathIds &&filePathIds)
+ : id{projectPartId, sourceType}
+ , filePathIds(std::move(filePathIds))
+ {}
+ IdPaths(ProjectChunkId projectChunkId, FilePathIds &&filePathIds)
+ : id(projectChunkId)
+ , filePathIds(std::move(filePathIds))
+ {}
friend bool operator==(IdPaths first, IdPaths second)
{
return first.id == second.id && first.filePathIds == second.filePathIds;
}
+
+public:
+ ProjectChunkId id;
+ FilePathIds filePathIds;
};
using ProjectChunkIds = std::vector<ProjectChunkId>;
diff --git a/src/libs/clangsupport/modifiedtimechecker.h b/src/libs/clangsupport/modifiedtimechecker.h
index 00e8e3ebac..58d1307daa 100644
--- a/src/libs/clangsupport/modifiedtimechecker.h
+++ b/src/libs/clangsupport/modifiedtimechecker.h
@@ -44,14 +44,14 @@ public:
: m_fileSystem(fileSystem)
{}
- bool isUpToDate(const SourceEntries &sourceEntries) const
+ bool isUpToDate(const SourceEntries &sourceEntries) const override
{
if (sourceEntries.empty())
return false;
updateCurrentSourceTimeStamps(sourceEntries);
- return compareEntries(sourceEntries) && notReseted(sourceEntries);
+ return compareEntries(sourceEntries);
}
void pathsChanged(const FilePathIds &filePathIds) override
@@ -66,29 +66,15 @@ public:
}));
}
- void reset(const FilePathIds &filePathIds)
- {
- FilePathIds newResetFilePathIds;
- newResetFilePathIds.reserve(newResetFilePathIds.size() + m_resetFilePathIds.size());
-
- std::set_union(m_resetFilePathIds.begin(),
- m_resetFilePathIds.end(),
- filePathIds.begin(),
- filePathIds.end(),
- std::back_inserter(newResetFilePathIds));
-
- m_resetFilePathIds = std::move(newResetFilePathIds);
- }
-
private:
bool compareEntries(const SourceEntries &sourceEntries) const
{
- return set_intersection_compare(
+ return !set_intersection_compare(
m_currentSourceTimeStamps.begin(),
m_currentSourceTimeStamps.end(),
sourceEntries.begin(),
sourceEntries.end(),
- [](auto first, auto second) { return second.timeStamp > first.timeStamp; },
+ [](auto first, auto second) { return first.timeStamp > second.timeStamp; },
[](auto first, auto second) { return first.sourceId < second.sourceId; });
}
@@ -118,33 +104,13 @@ private:
m_fileSystem.lastModified(
sourceEntry.sourceId));
}),
- [](auto first, auto second) {
- return first.sourceId < second.sourceId && first.timeStamp > 0;
- });
+ [](auto first, auto second) { return first.sourceId < second.sourceId; });
return newTimeStamps;
}
- bool notReseted(const SourceEntries &sourceEntries) const
- {
- auto oldSize = m_resetFilePathIds.size();
- FilePathIds newResetFilePathIds;
- newResetFilePathIds.reserve(newResetFilePathIds.size());
-
- std::set_difference(m_resetFilePathIds.begin(),
- m_resetFilePathIds.end(),
- sourceEntries.begin(),
- sourceEntries.end(),
- std::back_inserter(newResetFilePathIds));
-
- m_resetFilePathIds = std::move(newResetFilePathIds);
-
- return oldSize == m_resetFilePathIds.size();
- }
-
private:
mutable SourceTimeStamps m_currentSourceTimeStamps;
- mutable FilePathIds m_resetFilePathIds;
FileSystemInterface &m_fileSystem;
};
diff --git a/src/libs/clangsupport/processcreator.cpp b/src/libs/clangsupport/processcreator.cpp
index 22b52793e3..ad0d4b7884 100644
--- a/src/libs/clangsupport/processcreator.cpp
+++ b/src/libs/clangsupport/processcreator.cpp
@@ -173,8 +173,10 @@ QProcessEnvironment ProcessCreator::processEnvironment() const
}
const Utils::Environment &env = m_environment;
- for (auto it = env.constBegin(); it != env.constEnd(); ++it)
- processEnvironment.insert(it.key(), it.value());
+ for (auto it = env.constBegin(); it != env.constEnd(); ++it) {
+ if (env.isEnabled(it))
+ processEnvironment.insert(env.key(it), env.expandedValueForKey(env.key(it)));
+ }
return processEnvironment;
}
diff --git a/src/libs/clangsupport/projectpartcontainer.h b/src/libs/clangsupport/projectpartcontainer.h
index b2133dcaa2..caededee5c 100644
--- a/src/libs/clangsupport/projectpartcontainer.h
+++ b/src/libs/clangsupport/projectpartcontainer.h
@@ -32,6 +32,7 @@
#include "includesearchpath.h"
#include "projectpartartefact.h"
#include "projectpartid.h"
+#include "sourceentry.h"
#include <utils/cpplanguage_details.h>
#include <utils/smallstringio.h>
@@ -126,12 +127,12 @@ public:
friend bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second)
{
return first.projectPartId == second.projectPartId
- && first.toolChainArguments == second.toolChainArguments
- && first.compilerMacros == second.compilerMacros
- && first.systemIncludeSearchPaths == second.systemIncludeSearchPaths
- && first.projectIncludeSearchPaths == second.projectIncludeSearchPaths
- && first.headerPathIds == second.headerPathIds
- && first.sourcePathIds == second.sourcePathIds&& first.language == second.language
+ && first.toolChainArguments == second.toolChainArguments
+ && first.compilerMacros == second.compilerMacros
+ && first.systemIncludeSearchPaths == second.systemIncludeSearchPaths
+ && first.projectIncludeSearchPaths == second.projectIncludeSearchPaths
+ && first.headerPathIds == second.headerPathIds
+ && first.sourcePathIds == second.sourcePathIds && first.language == second.language
&& first.languageVersion == second.languageVersion
&& first.languageExtension == second.languageExtension;
}
@@ -148,7 +149,7 @@ public:
first.language,
first.languageVersion,
first.languageExtension,
- first.hasPrecompiledHeader)
+ first.preCompiledHeaderWasGenerated)
< std::tie(second.projectPartId,
second.toolChainArguments,
second.compilerMacros,
@@ -159,7 +160,7 @@ public:
second.language,
second.languageVersion,
second.languageExtension,
- second.hasPrecompiledHeader);
+ second.preCompiledHeaderWasGenerated);
}
ProjectPartContainer clone() const
@@ -171,7 +172,7 @@ public:
FilePathIds headerPathIds;
FilePathIds sourcePathIds;
bool updateIsDeferred = false;
- bool hasPrecompiledHeader = true;
+ bool preCompiledHeaderWasGenerated = true;
};
using ProjectPartContainerReference = std::reference_wrapper<ProjectPartContainer>;
diff --git a/src/libs/clangsupport/projectpartid.h b/src/libs/clangsupport/projectpartid.h
index fc5f659605..335a0f0cc5 100644
--- a/src/libs/clangsupport/projectpartid.h
+++ b/src/libs/clangsupport/projectpartid.h
@@ -31,6 +31,15 @@ namespace ClangBackEnd {
class ProjectPartId
{
+ template<typename StringType,
+ typename StringViewType,
+ typename IndexType,
+ typename Mutex,
+ typename Compare,
+ Compare compare,
+ typename CacheEntry>
+ friend class StringCache;
+
public:
constexpr ProjectPartId() = default;
@@ -47,6 +56,11 @@ public:
return first.isValid() && first.projectPathId == second.projectPathId;
}
+ friend bool operator==(ProjectPartId first, int second)
+ {
+ return first == ProjectPartId{second};
+ }
+
friend bool operator!=(ProjectPartId first, ProjectPartId second) { return !(first == second); }
friend bool operator<(ProjectPartId first, ProjectPartId second)
@@ -68,6 +82,10 @@ public:
return in;
}
+private:
+ operator int() const { return projectPathId; }
+ ProjectPartId operator++() { return ++projectPathId; }
+
public:
int projectPathId = -1;
};
diff --git a/src/libs/clangsupport/projectpartsstorage.h b/src/libs/clangsupport/projectpartsstorage.h
index e71bb0d51e..6363ae708f 100644
--- a/src/libs/clangsupport/projectpartsstorage.h
+++ b/src/libs/clangsupport/projectpartsstorage.h
@@ -74,12 +74,12 @@ public:
.template values<FilePathId>(1024, projectPartId.projectPathId);
}
- bool hasPrecompiledHeader(ProjectPartId projectPartId) const
+ bool preCompiledHeaderWasGenerated(ProjectPartId projectPartId) const
{
- auto value = fetchProjectPrecompiledHeaderPathStatement.template value<Utils::SmallString>(
+ auto value = fetchProjectPrecompiledHeaderBuildTimeStatement.template value<long long>(
projectPartId.projectPathId);
- return value && value->hasContent();
+ return value && *value > 0;
}
ProjectPartContainers fetchProjectParts(const ProjectPartIds &projectPartIds) const override
@@ -96,7 +96,7 @@ public:
if (value) {
value->headerPathIds = fetchHeaders(projectPartId);
value->sourcePathIds = fetchSources(projectPartId);
- value->hasPrecompiledHeader = hasPrecompiledHeader(projectPartId);
+ value->preCompiledHeaderWasGenerated = preCompiledHeaderWasGenerated(projectPartId);
projectParts.push_back(*std::move(value));
}
}
@@ -109,26 +109,33 @@ public:
}
}
+ ProjectPartId fetchProjectPartIdUnguarded(Utils::SmallStringView projectPartName) const override
+ {
+ auto optionalProjectPartId = fetchProjectPartIdStatement.template value<ProjectPartId>(
+ projectPartName);
+
+ if (optionalProjectPartId) {
+ return *optionalProjectPartId;
+ } else {
+ insertProjectPartNameStatement.write(projectPartName);
+
+ return static_cast<int>(database.lastInsertedRowId());
+ }
+
+ return {};
+ }
+
ProjectPartId fetchProjectPartId(Utils::SmallStringView projectPartName) const override
{
try {
Sqlite::DeferredTransaction transaction{database};
- ProjectPartId projectPartId;
- auto optionalProjectPartId = fetchProjectPartIdStatement.template value<ProjectPartId>(
- projectPartName);
-
- if (optionalProjectPartId) {
- projectPartId = *optionalProjectPartId;
- } else {
- insertProjectPartNameStatement.write(projectPartName);
-
- projectPartId = static_cast<int>(database.lastInsertedRowId());
- }
+ ProjectPartId projectPartId = fetchProjectPartIdUnguarded(projectPartName);
transaction.commit();
return projectPartId;
+
} catch (const Sqlite::StatementIsBusy &) {
return fetchProjectPartId(projectPartName);
}
@@ -233,16 +240,36 @@ public:
Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(FilePathId sourceId) const override
{
- ReadStatement &statement = getProjectPartArtefactsBySourceId;
+ try {
+ Sqlite::DeferredTransaction transaction{database};
+
+ ReadStatement &statement = getProjectPartArtefactsBySourceId;
+
+ auto value = statement.template value<ProjectPartArtefact, 8>(sourceId.filePathId);
+
+ transaction.commit();
- return statement.template value<ProjectPartArtefact, 8>(sourceId.filePathId);
+ return value;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchProjectPartArtefact(sourceId);
+ }
}
Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(ProjectPartId projectPartId) const override
{
- ReadStatement &statement = getProjectPartArtefactsByProjectPartId;
+ try {
+ Sqlite::DeferredTransaction transaction{database};
+
+ ReadStatement &statement = getProjectPartArtefactsByProjectPartId;
- return statement.template value<ProjectPartArtefact, 8>(projectPartId.projectPathId);
+ auto value = statement.template value<ProjectPartArtefact, 8>(projectPartId.projectPathId);
+
+ transaction.commit();
+
+ return value;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchProjectPartArtefact(projectPartId);
+ }
}
void resetIndexingTimeStamps(const ProjectPartContainers &projectsParts) override
@@ -310,6 +337,23 @@ public:
Utils::SmallString::number(projectPartId.projectPathId));
}
+ Internal::ProjectPartNameIds fetchAllProjectPartNamesAndIds() const override
+ {
+ try {
+ Sqlite::DeferredTransaction transaction{database};
+
+ ReadStatement &statement = fetchAllProjectPartNamesAndIdsStatement;
+
+ auto values = statement.template values<Internal::ProjectPartNameId, 2>(256);
+
+ transaction.commit();
+
+ return values;
+ } catch (const Sqlite::StatementIsBusy &) {
+ return fetchAllProjectPartNamesAndIds();
+ }
+ }
+
public:
Sqlite::ImmediateNonThrowingDestructorTransaction transaction;
Database &database;
@@ -354,16 +398,16 @@ public:
WriteStatement insertProjectPartsSourcesStatement{
"INSERT INTO projectPartsSources(projectPartId, sourceId) VALUES (?,?)", database};
mutable ReadStatement fetchProjectPartsHeadersByIdStatement{
- "SELECT sourceId FROM projectPartsHeaders WHERE projectPartId = ?", database};
+ "SELECT sourceId FROM projectPartsHeaders WHERE projectPartId = ? ORDER BY sourceId",
+ database};
mutable ReadStatement fetchProjectPartsSourcesByIdStatement{
- "SELECT sourceId FROM projectPartsSources WHERE projectPartId = ?", database};
- mutable ReadStatement fetchProjectPrecompiledHeaderPathStatement{
- "SELECT projectPchPath FROM precompiledHeaders WHERE projectPartId = ?", database};
- WriteStatement resetDependentIndexingTimeStampsStatement{
- "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT "
- "dependencySourceId FROM sourceDependencies, collectedDependencies WHERE "
- "sourceDependencies.sourceId == collectedDependencies.sourceId) UPDATE fileStatuses SET "
- "indexingTimeStamp = NULL WHERE sourceId IN (SELECT sourceId FROM collectedDependencies)",
+ "SELECT sourceId FROM projectPartsSources WHERE projectPartId = ? ORDER BY sourceId",
database};
+ mutable ReadStatement fetchProjectPrecompiledHeaderBuildTimeStatement{
+ "SELECT projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?", database};
+ WriteStatement resetDependentIndexingTimeStampsStatement{
+ "UPDATE fileStatuses SET indexingTimeStamp = NULL WHERE sourceId = ?", database};
+ mutable ReadStatement fetchAllProjectPartNamesAndIdsStatement{
+ "SELECT projectPartName, projectPartId FROM projectParts", database};
};
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/projectpartsstorageinterface.h b/src/libs/clangsupport/projectpartsstorageinterface.h
index 2d0675e657..ec1ce65dd0 100644
--- a/src/libs/clangsupport/projectpartsstorageinterface.h
+++ b/src/libs/clangsupport/projectpartsstorageinterface.h
@@ -25,7 +25,8 @@
#pragma once
-#include <projectpartcontainer.h>
+#include "projectpartcontainer.h"
+#include "projectpartstoragestructs.h"
#include <sqlitetransaction.h>
#include <utils/optional.h>
@@ -46,8 +47,10 @@ public:
virtual ProjectPartContainers fetchProjectParts() const = 0;
virtual ProjectPartContainers fetchProjectParts(const ProjectPartIds &projectPartIds) const = 0;
+ virtual ProjectPartId fetchProjectPartIdUnguarded(Utils::SmallStringView projectPartName) const = 0;
virtual ProjectPartId fetchProjectPartId(Utils::SmallStringView projectPartName) const = 0;
virtual Utils::PathString fetchProjectPartName(ProjectPartId projectPartId) const = 0;
+ virtual Internal::ProjectPartNameIds fetchAllProjectPartNamesAndIds() const = 0;
virtual void updateProjectPart(ProjectPartId projectPartId,
const Utils::SmallStringVector &commandLineArguments,
const CompilerMacros &compilerMacros,
diff --git a/src/libs/clangsupport/projectpartstoragestructs.h b/src/libs/clangsupport/projectpartstoragestructs.h
new file mode 100644
index 0000000000..b575d31240
--- /dev/null
+++ b/src/libs/clangsupport/projectpartstoragestructs.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "projectpartid.h"
+#include "stringcacheentry.h"
+
+#include <utils/smallstring.h>
+
+#include <vector>
+
+namespace ClangBackEnd {
+
+namespace Internal {
+
+class ProjectPartNameId
+ : public StringCacheEntry<Utils::PathString, Utils::SmallStringView, ProjectPartId>
+{
+ using Base = StringCacheEntry<Utils::PathString, Utils::SmallStringView, ProjectPartId>;
+
+public:
+ using Base::Base;
+
+ ProjectPartNameId(Utils::SmallStringView projectPartName, int projectPartId)
+ : Base(projectPartName, projectPartId)
+ {}
+};
+
+using ProjectPartNameIds = std::vector<ProjectPartNameId>;
+} // namespace Internal
+
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/refactoringdatabaseinitializer.h b/src/libs/clangsupport/refactoringdatabaseinitializer.h
index 6042264a5d..426485a1fd 100644
--- a/src/libs/clangsupport/refactoringdatabaseinitializer.h
+++ b/src/libs/clangsupport/refactoringdatabaseinitializer.h
@@ -82,13 +82,15 @@ public:
Sqlite::Table table;
table.setUseIfNotExists(true);
table.setName("locations");
- table.addColumn("symbolId", Sqlite::ColumnType::Integer);
+ const Sqlite::Column &symbolIdColumn = table.addColumn("symbolId",
+ Sqlite::ColumnType::Integer);
const Sqlite::Column &lineColumn = table.addColumn("line", Sqlite::ColumnType::Integer);
const Sqlite::Column &columnColumn = table.addColumn("column", Sqlite::ColumnType::Integer);
const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer);
const Sqlite::Column &locationKindColumn = table.addColumn("locationKind", Sqlite::ColumnType::Integer);
table.addUniqueIndex({sourceIdColumn, lineColumn, columnColumn});
table.addIndex({sourceIdColumn, locationKindColumn});
+ table.addIndex({symbolIdColumn});
table.initialize(database);
}
diff --git a/src/libs/clangsupport/set_algorithm.h b/src/libs/clangsupport/set_algorithm.h
index 39bd3a2055..6a17fe6f45 100644
--- a/src/libs/clangsupport/set_algorithm.h
+++ b/src/libs/clangsupport/set_algorithm.h
@@ -89,13 +89,31 @@ bool set_intersection_compare(
++first1;
} else {
if (!comp(*first2, *first1)) {
- if (call(*first2, *first1++))
- return false;
+ if (call(*first1++, *first2))
+ return true;
}
++first2;
}
}
- return true;
+ return false;
+}
+
+template<typename InputIt1, typename InputIt2, typename BinaryPredicate, typename Callable, typename Value>
+Value mismatch_collect(InputIt1 first1,
+ InputIt1 last1,
+ InputIt2 first2,
+ InputIt2 last2,
+ Value value,
+ BinaryPredicate predicate,
+ Callable callable)
+{
+ while (first1 != last1 && first2 != last2) {
+ if (predicate(*first1, *first2))
+ value = callable(*first1, *first2, value);
+ ++first1, ++first2;
+ }
+
+ return value;
}
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/sourceentry.h b/src/libs/clangsupport/sourceentry.h
index 5e8769d14f..4912b367c3 100644
--- a/src/libs/clangsupport/sourceentry.h
+++ b/src/libs/clangsupport/sourceentry.h
@@ -59,6 +59,19 @@ public:
int64 value = -1;
};
+class PrecompiledHeaderTimeStamps
+{
+public:
+ PrecompiledHeaderTimeStamps() = default;
+ PrecompiledHeaderTimeStamps(long long projectTimeStamp, long long systemTimeStamp)
+ : project(projectTimeStamp)
+ , system(systemTimeStamp)
+ {}
+
+ TimeStamp project;
+ TimeStamp system;
+};
+
class SourceTimeStamp
{
using int64 = long long;
diff --git a/src/libs/clangsupport/sourcelocationcontainer.h b/src/libs/clangsupport/sourcelocationcontainer.h
index a975b1b2f4..1c205755b1 100644
--- a/src/libs/clangsupport/sourcelocationcontainer.h
+++ b/src/libs/clangsupport/sourcelocationcontainer.h
@@ -36,8 +36,8 @@ class CLANGSUPPORT_EXPORT SourceLocationContainer
public:
SourceLocationContainer() = default;
SourceLocationContainer(const Utf8String &filePath,
- uint line,
- uint column)
+ int line,
+ int column)
: filePath(filePath),
line(line),
column(column)
@@ -46,8 +46,8 @@ public:
public:
Utf8String filePath;
- uint line = 0;
- uint column = 0;
+ int line = 0;
+ int column = 0;
};
CLANGSUPPORT_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);
diff --git a/src/libs/clangsupport/sourcerangecontainer.h b/src/libs/clangsupport/sourcerangecontainer.h
index d8ea0ce02c..603143e210 100644
--- a/src/libs/clangsupport/sourcerangecontainer.h
+++ b/src/libs/clangsupport/sourcerangecontainer.h
@@ -42,7 +42,7 @@ public:
{
}
- bool contains(unsigned line, unsigned column) const
+ bool contains(int line, int column) const
{
if (line < start.line || line > end.line)
return false;
diff --git a/src/libs/clangsupport/stringcache.h b/src/libs/clangsupport/stringcache.h
index 9192b46aa5..3185494cf3 100644
--- a/src/libs/clangsupport/stringcache.h
+++ b/src/libs/clangsupport/stringcache.h
@@ -25,9 +25,12 @@
#pragma once
+#include "set_algorithm.h"
#include "stringcachealgorithms.h"
+#include "stringcacheentry.h"
#include "stringcachefwd.h"
+#include <utils/algorithm.h>
#include <utils/optional.h>
#include <utils/smallstringfwd.h>
@@ -90,42 +93,24 @@ private:
QReadWriteLock m_mutex;
};
-template <typename StringType,
- typename StringViewType,
- typename IndexType>
-class StringCacheEntry
+template<typename StringType,
+ typename StringViewType,
+ typename IndexType,
+ typename Mutex,
+ typename Compare,
+ Compare compare = Utils::compare,
+ typename CacheEntry = StringCacheEntry<StringType, StringViewType, IndexType>>
+class StringCache
{
-public:
- StringCacheEntry(StringType &&string, IndexType id)
- : string(std::move(string)),
- id(id)
- {}
-
- operator StringViewType() const
- {
- return string;
- }
+ template<typename T, typename V, typename I, typename M, typename C, C c, typename CE>
+ friend class StringCache;
- StringType string;
- IndexType id;
-};
+ using StringResultType = std::
+ conditional_t<std::is_base_of<NonLockingMutex, Mutex>::value, StringViewType, StringType>;
-template <typename StringType,
- typename StringViewType,
- typename IndexType>
-using StringCacheEntries = std::vector<StringCacheEntry<StringType, StringViewType, IndexType>>;
-
-template <typename StringType,
- typename StringViewType,
- typename IndexType,
- typename Mutex,
- typename Compare,
- Compare compare = Utils::compare>
-class StringCache
-{
public:
- using CacheEntry = StringCacheEntry<StringType, StringViewType, IndexType>;
- using CacheEntries = StringCacheEntries<StringType, StringViewType, IndexType>;
+ using MutexType = Mutex;
+ using CacheEntries = std::vector<CacheEntry>;
using const_iterator = typename CacheEntries::const_iterator;
using Found = ClangBackEnd::Found<const_iterator>;
@@ -135,8 +120,33 @@ public:
m_indices.reserve(reserveSize);
}
- StringCache(const StringCache &) = delete;
- StringCache &operator=(const StringCache &) = delete;
+ StringCache(const StringCache &other)
+ : m_strings(other.m_strings)
+ , m_indices(other.m_indices)
+ {}
+
+ template<typename Cache>
+ Cache clone()
+ {
+ Cache cache;
+ cache.m_strings = m_strings;
+ cache.m_indices = m_indices;
+
+ return cache;
+ }
+
+ StringCache(StringCache &&other)
+ : m_strings(std::move(other.m_strings))
+ , m_indices(std::move(other.m_indices))
+ {}
+
+ StringCache &operator=(StringCache &&other)
+ {
+ m_strings = std::move(other.m_strings);
+ m_indices = std::move(other.m_indices);
+
+ return *this;
+ }
void populate(CacheEntries &&entries)
{
@@ -147,20 +157,79 @@ public:
void uncheckedPopulate(CacheEntries &&entries)
{
- std::sort(entries.begin(),
- entries.end(),
- [] (StringViewType first, StringViewType second) {
+ std::sort(entries.begin(), entries.end(), [](StringViewType first, StringViewType second) {
return compare(first, second) < 0;
});
m_strings = std::move(entries);
- m_indices.resize(m_strings.size());
- auto begin = m_strings.cbegin();
- for (auto current = begin; current != m_strings.end(); ++current)
- m_indices.at(current->id) = std::distance(begin, current);
+ int max_id = 0;
+
+ auto found = std::max_element(m_strings.begin(),
+ m_strings.end(),
+ [](const auto &first, const auto &second) {
+ return first.id < second.id;
+ });
+
+ if (found != m_strings.end())
+ max_id = found->id + 1;
+
+ m_indices.resize(max_id, -1);
+
+ updateIndices();
}
+ template<typename Function>
+ void addStrings(std::vector<StringViewType> &&strings, Function storageFunction)
+ {
+ auto less = [](StringViewType first, StringViewType second) {
+ return compare(first, second) < 0;
+ };
+
+ std::sort(strings.begin(), strings.end(), less);
+
+ strings.erase(std::unique(strings.begin(), strings.end()), strings.end());
+
+ CacheEntries newCacheEntries;
+ newCacheEntries.reserve(strings.size());
+
+ std::set_difference(strings.begin(),
+ strings.end(),
+ m_strings.begin(),
+ m_strings.end(),
+ make_iterator([&](StringViewType newString) {
+ IndexType index = storageFunction(newString);
+ newCacheEntries.emplace_back(newString, index);
+ }),
+ less);
+
+ if (newCacheEntries.size()) {
+ auto found = std::max_element(newCacheEntries.begin(),
+ newCacheEntries.end(),
+ [](const auto &first, const auto &second) {
+ return first.id < second.id;
+ });
+
+ int max_id = found->id + 1;
+
+ if (max_id > int(m_indices.size()))
+ m_indices.resize(max_id, -1);
+
+ CacheEntries mergedCacheEntries;
+ mergedCacheEntries.reserve(newCacheEntries.size() + m_strings.size());
+
+ std::merge(std::make_move_iterator(m_strings.begin()),
+ std::make_move_iterator(m_strings.end()),
+ std::make_move_iterator(newCacheEntries.begin()),
+ std::make_move_iterator(newCacheEntries.end()),
+ std::back_inserter(mergedCacheEntries),
+ less);
+
+ m_strings = std::move(mergedCacheEntries);
+
+ updateIndices();
+ }
+ }
IndexType stringId(StringViewType stringView)
{
@@ -173,10 +242,11 @@ public:
sharedLock.unlock();
std::lock_guard<Mutex> exclusiveLock(m_mutex);
- found = find(stringView);
+ if (!std::is_base_of<NonLockingMutex, Mutex>::value)
+ found = find(stringView);
if (!found.wasFound) {
IndexType index = insertString(found.iterator, stringView, IndexType(m_indices.size()));
- found.iterator = m_strings.begin() + index;;
+ found.iterator = m_strings.begin() + index;
}
return found.iterator->id;
@@ -196,12 +266,33 @@ public:
return ids;
}
+ template<typename Container, typename Function>
+ std::vector<IndexType> stringIds(const Container &strings, Function storageFunction)
+ {
+ std::vector<IndexType> ids;
+ ids.reserve(strings.size());
+
+ std::transform(strings.begin(),
+ strings.end(),
+ std::back_inserter(ids),
+ [&](const auto &string) { return this->stringId(string, storageFunction); });
+
+ return ids;
+ }
+
std::vector<IndexType> stringIds(std::initializer_list<StringType> strings)
{
return stringIds<std::initializer_list<StringType>>(strings);
}
- StringType string(IndexType id) const
+ template<typename Function>
+ std::vector<IndexType> stringIds(std::initializer_list<StringType> strings,
+ Function storageFunction)
+ {
+ return stringIds<std::initializer_list<StringType>>(strings, storageFunction);
+ }
+
+ StringResultType string(IndexType id) const
{
std::shared_lock<Mutex> sharedLock(m_mutex);
@@ -209,7 +300,7 @@ public:
}
template<typename Function>
- StringType string(IndexType id, Function storageFunction)
+ StringResultType string(IndexType id, Function storageFunction)
{
std::shared_lock<Mutex> sharedLock(m_mutex);
@@ -227,17 +318,15 @@ public:
return m_strings[index].string;
}
- std::vector<StringType> strings(const std::vector<IndexType> &ids) const
+ std::vector<StringResultType> strings(const std::vector<IndexType> &ids) const
{
std::shared_lock<Mutex> sharedLock(m_mutex);
- std::vector<StringType> strings;
+ std::vector<StringResultType> strings;
strings.reserve(ids.size());
- std::transform(ids.begin(),
- ids.end(),
- std::back_inserter(strings),
- [&] (IndexType id) { return m_strings.at(m_indices.at(id)).string; });
+ for (IndexType id : ids)
+ strings.emplace_back(m_strings.at(m_indices.at(id)).string);
return strings;
}
@@ -260,7 +349,8 @@ public:
sharedLock.unlock();
std::lock_guard<Mutex> exclusiveLock(m_mutex);
- found = find(stringView);
+ if (!std::is_base_of<NonLockingMutex, Mutex>::value)
+ found = find(stringView);
if (!found.wasFound) {
IndexType index = insertString(found.iterator, stringView, storageFunction(stringView));
found.iterator = m_strings.begin() + index;
@@ -275,6 +365,13 @@ public:
}
private:
+ void updateIndices()
+ {
+ auto begin = m_strings.cbegin();
+ for (auto current = begin; current != m_strings.cend(); ++current)
+ m_indices[current->id] = std::distance(begin, current);
+ }
+
Found find(StringViewType stringView)
{
return findInSorted(m_strings.cbegin(), m_strings.cend(), stringView, compare);
@@ -300,7 +397,7 @@ private:
StringViewType stringView,
IndexType id)
{
- auto inserted = m_strings.emplace(beforeIterator, StringType(stringView), id);
+ auto inserted = m_strings.emplace(beforeIterator, stringView, id);
auto newIndex = IndexType(std::distance(m_strings.begin(), inserted));
diff --git a/src/libs/clangsupport/stringcacheentry.h b/src/libs/clangsupport/stringcacheentry.h
new file mode 100644
index 0000000000..bbffcdc873
--- /dev/null
+++ b/src/libs/clangsupport/stringcacheentry.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+namespace ClangBackEnd {
+
+template<typename StringType, typename StringViewType, typename IndexType>
+class StringCacheEntry
+{
+public:
+ StringCacheEntry(StringViewType string, IndexType id)
+ : string(string)
+ , id(id)
+ {}
+
+ operator StringViewType() const { return string; }
+ friend bool operator==(const StringCacheEntry &first, const StringCacheEntry &second)
+ {
+ return first.id == second.id && first.string == second.string;
+ }
+
+public:
+ StringType string;
+ IndexType id;
+};
+
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/stringcachefwd.h b/src/libs/clangsupport/stringcachefwd.h
index adc00ff1f5..2059b503b6 100644
--- a/src/libs/clangsupport/stringcachefwd.h
+++ b/src/libs/clangsupport/stringcachefwd.h
@@ -31,12 +31,7 @@ namespace ClangBackEnd {
class NonLockingMutex;
-template <typename StringType,
- typename StringViewType,
- typename IndexType,
- typename Mutex,
- typename Compare,
- Compare compare>
+template<typename StringType, typename StringViewType, typename IndexType, typename Mutex, typename Compare, Compare compare, typename CacheEntry>
class StringCache;
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/tokeninfocontainer.h b/src/libs/clangsupport/tokeninfocontainer.h
index 2b8e01e769..c819268fb9 100644
--- a/src/libs/clangsupport/tokeninfocontainer.h
+++ b/src/libs/clangsupport/tokeninfocontainer.h
@@ -103,7 +103,7 @@ class TokenInfoContainer
{
public:
TokenInfoContainer() = default;
- TokenInfoContainer(uint line, uint column, uint length, HighlightingTypes types)
+ TokenInfoContainer(int line, int column, int length, HighlightingTypes types)
: line(line)
, column(column)
, length(length)
@@ -111,7 +111,7 @@ public:
{
}
- TokenInfoContainer(uint line, uint column, uint length, HighlightingTypes types,
+ TokenInfoContainer(int line, int column, int length, HighlightingTypes types,
const ExtraInfo &extraInfo)
: line(line)
, column(column)
@@ -184,9 +184,9 @@ public:
&& first.extraInfo == second.extraInfo;
}
- uint line = 0;
- uint column = 0;
- uint length = 0;
+ int line = 0;
+ int column = 0;
+ int length = 0;
HighlightingTypes types;
ExtraInfo extraInfo;
bool noExtraInfo = true;
diff --git a/src/libs/cplusplus/ASTPath.cpp b/src/libs/cplusplus/ASTPath.cpp
index 3acec43c42..277a7d0838 100644
--- a/src/libs/cplusplus/ASTPath.cpp
+++ b/src/libs/cplusplus/ASTPath.cpp
@@ -67,12 +67,12 @@ bool ASTPath::preVisit(AST *ast)
if (lastToken <= firstToken)
return false;
- unsigned startLine, startColumn;
+ int startLine, startColumn;
getTokenStartPosition(firstToken, &startLine, &startColumn);
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
- unsigned endLine, endColumn;
+ int endLine, endColumn;
getTokenEndPosition(lastToken - 1, &endLine, &endColumn);
if (_line < endLine || (_line == endLine && _column <= endColumn)) {
diff --git a/src/libs/cplusplus/ASTPath.h b/src/libs/cplusplus/ASTPath.h
index e7dfab7fad..6e199ca853 100644
--- a/src/libs/cplusplus/ASTPath.h
+++ b/src/libs/cplusplus/ASTPath.h
@@ -64,8 +64,8 @@ private:
private:
Document::Ptr _doc;
- unsigned _line;
- unsigned _column;
+ int _line;
+ int _column;
QList<AST *> _nodes;
};
diff --git a/src/libs/cplusplus/AlreadyConsideredClassContainer.h b/src/libs/cplusplus/AlreadyConsideredClassContainer.h
index fd35291c2a..01260c0348 100644
--- a/src/libs/cplusplus/AlreadyConsideredClassContainer.h
+++ b/src/libs/cplusplus/AlreadyConsideredClassContainer.h
@@ -35,7 +35,7 @@ template<typename T>
class AlreadyConsideredClassContainer
{
public:
- AlreadyConsideredClassContainer() : _class(0) {}
+ AlreadyConsideredClassContainer() : _class(nullptr) {}
void insert(const T *item)
{
if (_container.isEmpty())
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp
index 73cc06f26a..578a6a117f 100644
--- a/src/libs/cplusplus/CppDocument.cpp
+++ b/src/libs/cplusplus/CppDocument.cpp
@@ -61,19 +61,19 @@ namespace {
class LastVisibleSymbolAt: protected SymbolVisitor
{
Symbol *root;
- unsigned line;
- unsigned column;
+ int line;
+ int column;
Symbol *symbol;
public:
LastVisibleSymbolAt(Symbol *root)
- : root(root), line(0), column(0), symbol(0) {}
+ : root(root), line(0), column(0), symbol(nullptr) {}
- Symbol *operator()(unsigned line, unsigned column)
+ Symbol *operator()(int line, int column)
{
this->line = line;
this->column = column;
- this->symbol = 0;
+ this->symbol = nullptr;
accept(root);
if (! symbol)
symbol = root;
@@ -97,14 +97,14 @@ protected:
class FindScopeAt: protected SymbolVisitor
{
TranslationUnit *_unit;
- unsigned _line;
- unsigned _column;
+ int _line;
+ int _column;
Scope *_scope;
public:
/** line and column should be 1-based */
- FindScopeAt(TranslationUnit *unit, unsigned line, unsigned column)
- : _unit(unit), _line(line), _column(column), _scope(0) {}
+ FindScopeAt(TranslationUnit *unit, int line, int column)
+ : _unit(unit), _line(line), _column(column), _scope(nullptr) {}
Scope *operator()(Symbol *symbol)
{
@@ -118,18 +118,18 @@ protected:
if (! _scope) {
Scope *scope = symbol;
- for (unsigned i = 0; i < scope->memberCount(); ++i) {
+ for (int i = 0; i < scope->memberCount(); ++i) {
accept(scope->memberAt(i));
if (_scope)
return false;
}
- unsigned startLine, startColumn;
+ int startLine, startColumn;
_unit->getPosition(scope->startOffset(), &startLine, &startColumn);
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
- unsigned endLine, endColumn;
+ int endLine, endColumn;
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
if (_line < endLine || (_line == endLine && _column < endColumn))
@@ -211,7 +211,7 @@ public:
void report(int level,
const StringLiteral *fileId,
- unsigned line, unsigned column,
+ int line, int column,
const char *format, va_list ap) override
{
if (level == Error) {
@@ -265,7 +265,7 @@ private:
Document::Document(const QString &fileName)
: _fileName(QDir::cleanPath(fileName)),
- _globalNamespace(0),
+ _globalNamespace(nullptr),
_revision(0),
_editorRevision(0),
_checkMode(0)
@@ -284,12 +284,12 @@ Document::Document(const QString &fileName)
Document::~Document()
{
delete _translationUnit;
- _translationUnit = 0;
+ _translationUnit = nullptr;
if (_control) {
delete _control->diagnosticClient();
delete _control;
}
- _control = 0;
+ _control = nullptr;
}
Control *Document::control() const
@@ -308,7 +308,7 @@ Control *Document::swapControl(Control *newControl)
_translationUnit = newTranslationUnit;
} else {
delete _translationUnit;
- _translationUnit = 0;
+ _translationUnit = nullptr;
}
Control *oldControl = _control;
@@ -375,9 +375,9 @@ void Document::appendMacro(const Macro &macro)
}
void Document::addMacroUse(const Macro &macro,
- unsigned bytesOffset, unsigned bytesLength,
- unsigned utf16charsOffset, unsigned utf16charLength,
- unsigned beginLine,
+ int bytesOffset, int bytesLength,
+ int utf16charsOffset, int utf16charLength,
+ int beginLine,
const QVector<MacroArgumentReference> &actuals)
{
MacroUse use(macro,
@@ -397,7 +397,7 @@ void Document::addMacroUse(const Macro &macro,
}
void Document::addUndefinedMacroUse(const QByteArray &name,
- unsigned bytesOffset, unsigned utf16charsOffset)
+ int bytesOffset, int utf16charsOffset)
{
QByteArray copy(name.data(), name.size());
UndefinedMacroUse use(copy, bytesOffset, utf16charsOffset);
@@ -468,7 +468,7 @@ void Document::setSkipFunctionBody(bool skipFunctionBody)
_translationUnit->setSkipFunctionBody(skipFunctionBody);
}
-unsigned Document::globalSymbolCount() const
+int Document::globalSymbolCount() const
{
if (! _globalNamespace)
return 0;
@@ -476,7 +476,7 @@ unsigned Document::globalSymbolCount() const
return _globalNamespace->memberCount();
}
-Symbol *Document::globalSymbolAt(unsigned index) const
+Symbol *Document::globalSymbolAt(int index) const
{
return _globalNamespace->memberAt(index);
}
@@ -527,23 +527,17 @@ QString Document::functionAt(int line, int column, int *lineOpeningDeclaratorPar
return QString();
// We found the function scope
- if (lineOpeningDeclaratorParenthesis) {
- unsigned line;
- translationUnit()->getPosition(scope->startOffset(), &line);
- *lineOpeningDeclaratorParenthesis = static_cast<int>(line);
- }
+ if (lineOpeningDeclaratorParenthesis)
+ translationUnit()->getPosition(scope->startOffset(), lineOpeningDeclaratorParenthesis);
- if (lineClosingBrace) {
- unsigned line;
- translationUnit()->getPosition(scope->endOffset(), &line);
- *lineClosingBrace = static_cast<int>(line);
- }
+ if (lineClosingBrace)
+ translationUnit()->getPosition(scope->endOffset(), lineClosingBrace);
const QList<const Name *> fullyQualifiedName = LookupContext::fullyQualifiedName(scope);
return Overview().prettyName(fullyQualifiedName);
}
-Scope *Document::scopeAt(unsigned line, unsigned column)
+Scope *Document::scopeAt(int line, int column)
{
FindScopeAt findScopeAt(_translationUnit, line, column);
if (Scope *scope = findScopeAt(_globalNamespace))
@@ -551,22 +545,22 @@ Scope *Document::scopeAt(unsigned line, unsigned column)
return globalNamespace();
}
-Symbol *Document::lastVisibleSymbolAt(unsigned line, unsigned column) const
+Symbol *Document::lastVisibleSymbolAt(int line, int column) const
{
LastVisibleSymbolAt lastVisibleSymbolAt(globalNamespace());
return lastVisibleSymbolAt(line, column);
}
-const Macro *Document::findMacroDefinitionAt(unsigned line) const
+const Macro *Document::findMacroDefinitionAt(int line) const
{
foreach (const Macro &macro, _definedMacros) {
if (macro.line() == line)
return &macro;
}
- return 0;
+ return nullptr;
}
-const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) const
+const Document::MacroUse *Document::findMacroUseAt(int utf16charsOffset) const
{
foreach (const Document::MacroUse &use, _macroUses) {
if (use.containsUtf16charOffset(utf16charsOffset)
@@ -574,10 +568,10 @@ const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) co
return &use;
}
}
- return 0;
+ return nullptr;
}
-const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(unsigned utf16charsOffset) const
+const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(int utf16charsOffset) const
{
foreach (const Document::UndefinedMacroUse &use, _undefinedMacroUses) {
if (use.containsUtf16charOffset(utf16charsOffset)
@@ -585,7 +579,7 @@ const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(unsigned ut
+ QString::fromUtf8(use.name(), use.name().size()).length()))
return &use;
}
- return 0;
+ return nullptr;
}
Document::Ptr Document::create(const QString &fileName)
@@ -616,17 +610,17 @@ void Document::setLanguageFeatures(LanguageFeatures features)
tu->setLanguageFeatures(features);
}
-void Document::startSkippingBlocks(unsigned utf16charsOffset)
+void Document::startSkippingBlocks(int utf16charsOffset)
{
_skippedBlocks.append(Block(0, 0, utf16charsOffset, 0));
}
-void Document::stopSkippingBlocks(unsigned utf16charsOffset)
+void Document::stopSkippingBlocks(int utf16charsOffset)
{
if (_skippedBlocks.isEmpty())
return;
- unsigned start = _skippedBlocks.back().utf16charsBegin();
+ int start = _skippedBlocks.back().utf16charsBegin();
if (start > utf16charsOffset)
_skippedBlocks.removeLast(); // Ignore this block, it's invalid.
else
@@ -783,7 +777,7 @@ static QList<Macro> macrosDefinedUntilLine(const QList<Macro> &macros, int line)
QList<Macro> filtered;
foreach (const Macro &macro, macros) {
- if (macro.line() <= unsigned(line))
+ if (macro.line() <= line)
filtered.append(macro);
else
break;
diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h
index 74205f1625..94c16be742 100644
--- a/src/libs/cplusplus/CppDocument.h
+++ b/src/libs/cplusplus/CppDocument.h
@@ -71,11 +71,11 @@ public:
void appendMacro(const Macro &macro);
void addMacroUse(const Macro &macro,
- unsigned bytesOffset, unsigned bytesLength,
- unsigned utf16charsOffset, unsigned utf16charLength,
- unsigned beginLine, const QVector<MacroArgumentReference> &range);
+ int bytesOffset, int bytesLength,
+ int utf16charsOffset, int utf16charLength,
+ int beginLine, const QVector<MacroArgumentReference> &range);
void addUndefinedMacroUse(const QByteArray &name,
- unsigned bytesOffset, unsigned utf16charsOffset);
+ int bytesOffset, int utf16charsOffset);
Control *control() const;
Control *swapControl(Control *newControl);
@@ -84,8 +84,8 @@ public:
bool skipFunctionBody() const;
void setSkipFunctionBody(bool skipFunctionBody);
- unsigned globalSymbolCount() const;
- Symbol *globalSymbolAt(unsigned index) const;
+ int globalSymbolCount() const;
+ Symbol *globalSymbolAt(int index) const;
Namespace *globalNamespace() const;
void setGlobalNamespace(Namespace *globalNamespace); // ### internal
@@ -93,10 +93,10 @@ public:
QList<Macro> definedMacros() const
{ return _definedMacros; }
- QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = 0,
- int *lineClosingBrace = 0) const;
- Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const;
- Scope *scopeAt(unsigned line, unsigned column = 0);
+ QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = nullptr,
+ int *lineClosingBrace = nullptr) const;
+ Symbol *lastVisibleSymbolAt(int line, int column = 0) const;
+ Scope *scopeAt(int line, int column = 0);
QByteArray utf8Source() const;
void setUtf8Source(const QByteArray &utf8Source);
@@ -108,8 +108,8 @@ public:
LanguageFeatures languageFeatures() const;
void setLanguageFeatures(LanguageFeatures features);
- void startSkippingBlocks(unsigned utf16charsOffset);
- void stopSkippingBlocks(unsigned utf16charsOffset);
+ void startSkippingBlocks(int utf16charsOffset);
+ void stopSkippingBlocks(int utf16charsOffset);
enum ParseMode { // ### keep in sync with CPlusPlus::TranslationUnit
ParseTranlationUnit,
@@ -146,9 +146,9 @@ public:
public:
DiagnosticMessage(int level, const QString &fileName,
- unsigned line, unsigned column,
+ int line, int column,
const QString &text,
- unsigned length = 0)
+ int length = 0)
: _level(level),
_line(line),
_fileName(fileName),
@@ -172,13 +172,13 @@ public:
QString fileName() const
{ return _fileName; }
- unsigned line() const
+ int line() const
{ return _line; }
- unsigned column() const
+ int column() const
{ return _column; }
- unsigned length() const
+ int length() const
{ return _length; }
QString text() const
@@ -189,10 +189,10 @@ public:
private:
int _level;
- unsigned _line;
+ int _line;
QString _fileName;
- unsigned _column;
- unsigned _length;
+ int _column;
+ int _length;
QString _text;
};
@@ -207,44 +207,44 @@ public:
class Block
{
- unsigned _bytesBegin;
- unsigned _bytesEnd;
- unsigned _utf16charsBegin;
- unsigned _utf16charsEnd;
+ int _bytesBegin;
+ int _bytesEnd;
+ int _utf16charsBegin;
+ int _utf16charsEnd;
public:
- inline Block(unsigned bytesBegin = 0, unsigned bytesEnd = 0,
- unsigned utf16charsBegin = 0, unsigned utf16charsEnd = 0)
+ inline Block(int bytesBegin = 0, int bytesEnd = 0,
+ int utf16charsBegin = 0, int utf16charsEnd = 0)
: _bytesBegin(bytesBegin),
_bytesEnd(bytesEnd),
_utf16charsBegin(utf16charsBegin),
_utf16charsEnd(utf16charsEnd)
{}
- inline unsigned bytesBegin() const
+ inline int bytesBegin() const
{ return _bytesBegin; }
- inline unsigned bytesEnd() const
+ inline int bytesEnd() const
{ return _bytesEnd; }
- inline unsigned utf16charsBegin() const
+ inline int utf16charsBegin() const
{ return _utf16charsBegin; }
- inline unsigned utf16charsEnd() const
+ inline int utf16charsEnd() const
{ return _utf16charsEnd; }
- bool containsUtf16charOffset(unsigned utf16charOffset) const
+ bool containsUtf16charOffset(int utf16charOffset) const
{ return utf16charOffset >= _utf16charsBegin && utf16charOffset < _utf16charsEnd; }
};
class Include {
QString _resolvedFileName;
QString _unresolvedFileName;
- unsigned _line;
+ int _line;
Client::IncludeType _type;
public:
- Include(const QString &unresolvedFileName, const QString &resolvedFileName, unsigned line,
+ Include(const QString &unresolvedFileName, const QString &resolvedFileName, int line,
Client::IncludeType type)
: _resolvedFileName(resolvedFileName)
, _unresolvedFileName(unresolvedFileName)
@@ -258,7 +258,7 @@ public:
QString unresolvedFileName() const
{ return _unresolvedFileName; }
- unsigned line() const
+ int line() const
{ return _line; }
Client::IncludeType type() const
@@ -268,13 +268,13 @@ public:
class MacroUse: public Block {
Macro _macro;
QVector<Block> _arguments;
- unsigned _beginLine;
+ int _beginLine;
public:
inline MacroUse(const Macro &macro,
- unsigned bytesBegin, unsigned bytesEnd,
- unsigned utf16charsBegin, unsigned utf16charsEnd,
- unsigned beginLine)
+ int bytesBegin, int bytesEnd,
+ int utf16charsBegin, int utf16charsEnd,
+ int beginLine)
: Block(bytesBegin, bytesEnd, utf16charsBegin, utf16charsEnd),
_macro(macro),
_beginLine(beginLine)
@@ -289,7 +289,7 @@ public:
QVector<Block> arguments() const
{ return _arguments; }
- unsigned beginLine() const
+ int beginLine() const
{ return _beginLine; }
private:
@@ -308,8 +308,8 @@ public:
public:
inline UndefinedMacroUse(
const QByteArray &name,
- unsigned bytesBegin,
- unsigned utf16charsBegin)
+ int bytesBegin,
+ int utf16charsBegin)
: Block(bytesBegin,
bytesBegin + name.length(),
utf16charsBegin,
@@ -346,9 +346,9 @@ public:
QByteArray includeGuardMacroName() const
{ return _includeGuardMacroName; }
- const Macro *findMacroDefinitionAt(unsigned line) const;
- const MacroUse *findMacroUseAt(unsigned utf16charsOffset) const;
- const UndefinedMacroUse *findUndefinedMacroUseAt(unsigned utf16charsOffset) const;
+ const Macro *findMacroDefinitionAt(int line) const;
+ const MacroUse *findMacroUseAt(int utf16charsOffset) const;
+ const UndefinedMacroUse *findUndefinedMacroUseAt(int utf16charsOffset) const;
void keepSourceAndAST();
void releaseSourceAndAST();
@@ -397,7 +397,7 @@ public:
typedef Base::const_iterator iterator;
typedef Base::const_iterator const_iterator;
- typedef QPair<Document::Ptr, unsigned> IncludeLocation;
+ typedef QPair<Document::Ptr, int> IncludeLocation;
int size() const; // ### remove
bool isEmpty() const;
diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp
index aec22d8248..fdb5de3851 100644
--- a/src/libs/cplusplus/CppRewriter.cpp
+++ b/src/libs/cplusplus/CppRewriter.cpp
@@ -131,7 +131,7 @@ public:
void visit(Function *type) override
{
- Function *funTy = control()->newFunction(0, 0);
+ Function *funTy = control()->newFunction(0, nullptr);
funTy->copy(type);
funTy->setConst(type->isConst());
funTy->setVolatile(type->isVolatile());
@@ -144,7 +144,7 @@ public:
for (unsigned i = 0, argc = type->argumentCount(); i < argc; ++i) {
Symbol *arg = type->argumentAt(i);
- Argument *newArg = control()->newArgument(0, 0);
+ Argument *newArg = control()->newArgument(0, nullptr);
newArg->copy(arg);
newArg->setName(rewrite->rewriteName(arg->name()));
newArg->setType(rewrite->rewriteType(arg->type()));
@@ -225,7 +225,7 @@ public:
const Identifier *identifier(const Identifier *other) const
{
if (! other)
- return 0;
+ return nullptr;
return control()->identifier(other->chars(), other->size());
}
@@ -236,7 +236,7 @@ public:
const Name *operator()(const Name *name)
{
if (! name)
- return 0;
+ return nullptr;
accept(name);
return (!temps.isEmpty()) ? temps.takeLast() : name;
@@ -257,7 +257,7 @@ public:
void visit(const TemplateNameId *name) override
{
QVarLengthArray<FullySpecifiedType, 8> args(name->templateArgumentCount());
- for (unsigned i = 0; i < name->templateArgumentCount(); ++i)
+ for (int i = 0; i < name->templateArgumentCount(); ++i)
args[i] = rewrite->rewriteType(name->templateArgumentAt(i));
temps.append(control()->templateNameId(identifier(name->identifier()), name->isSpecialization(),
args.data(), args.size()));
@@ -282,7 +282,7 @@ public:
void visit(const SelectorNameId *name) override
{
QVarLengthArray<const Name *, 8> names(name->nameCount());
- for (unsigned i = 0; i < name->nameCount(); ++i)
+ for (int i = 0; i < name->nameCount(); ++i)
names[i] = rewrite->rewriteName(name->nameAt(i));
temps.append(control()->selectorNameId(names.constData(), names.size(), name->hasArguments()));
}
@@ -296,7 +296,7 @@ public: // attributes
};
SubstitutionEnvironment::SubstitutionEnvironment()
- : _scope(0)
+ : _scope(nullptr)
{
}
@@ -415,7 +415,7 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co
UseQualifiedNames::UseQualifiedNames()
- : UseMinimalNames(0)
+ : UseMinimalNames(nullptr)
{
}
diff --git a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
index db39d0b20d..d3653137b3 100644
--- a/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
+++ b/src/libs/cplusplus/DeprecatedGenTemplateInstance.cpp
@@ -136,7 +136,7 @@ private:
fun->setReturnType(q->apply(funTy->returnType()));
- for (unsigned i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
+ for (int i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
Argument *originalArgument = funTy->argumentAt(i)->asArgument();
Argument *arg = control()->newArgument(/*sourceLocation*/ 0,
originalArgument->name());
@@ -243,7 +243,7 @@ private:
void visit(const TemplateNameId *name) override
{
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
- for (unsigned i = 0; i < name->templateArgumentCount(); ++i) {
+ for (int i = 0; i < name->templateArgumentCount(); ++i) {
FullySpecifiedType argTy = name->templateArgumentAt(i);
arguments[i] = q->apply(argTy);
}
@@ -266,7 +266,7 @@ private:
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
- for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
+ for (int templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
++templateArgIndex) {
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
arguments[templateArgIndex] = q->apply(argTy);
@@ -291,7 +291,7 @@ private:
}
- return 0;
+ return nullptr;
}
void visit(const QualifiedNameId *name) override
@@ -362,7 +362,7 @@ FullySpecifiedType ApplySubstitution::apply(const FullySpecifiedType &type)
int ApplySubstitution::findSubstitution(const Identifier *id) const
{
- Q_ASSERT(id != 0);
+ Q_ASSERT(id != nullptr);
for (int index = 0; index < substitution.size(); ++index) {
QPair<const Identifier *, FullySpecifiedType> s = substitution.at(index);
@@ -403,7 +403,7 @@ FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *classN
if (Template *templ = candidate->enclosingTemplate()) {
DeprecatedGenTemplateInstance::Substitution subst;
- for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
+ for (int i = 0; i < templId->templateArgumentCount(); ++i) {
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
if (i < templ->templateParameterCount()) {
diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp
index 78a25826cc..be63dea9a2 100644
--- a/src/libs/cplusplus/FastPreprocessor.cpp
+++ b/src/libs/cplusplus/FastPreprocessor.cpp
@@ -70,7 +70,7 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
return preprocessed;
}
-void FastPreprocessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
+void FastPreprocessor::sourceNeeded(int line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes)
{
Q_UNUSED(initialIncludes)
@@ -115,8 +115,8 @@ static const Macro revision(const Snapshot &s, const Macro &m)
return m;
}
-void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro)
+void FastPreprocessor::passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro)
{
Q_ASSERT(_currentDoc);
@@ -126,7 +126,7 @@ void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned
line, QVector<MacroArgumentReference>());
}
-void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
+void FastPreprocessor::failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
const ByteArrayRef &name)
{
Q_ASSERT(_currentDoc);
@@ -135,8 +135,8 @@ void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned
bytesOffset, utf16charsOffset);
}
-void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro)
+void FastPreprocessor::notifyMacroReference(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro)
{
Q_ASSERT(_currentDoc);
@@ -146,8 +146,8 @@ void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16
line, QVector<MacroArgumentReference>());
}
-void FastPreprocessor::startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro,
+void FastPreprocessor::startExpandingMacro(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro,
const QVector<MacroArgumentReference> &actuals)
{
Q_ASSERT(_currentDoc);
diff --git a/src/libs/cplusplus/FastPreprocessor.h b/src/libs/cplusplus/FastPreprocessor.h
index da63bdd59b..bebe3da4d2 100644
--- a/src/libs/cplusplus/FastPreprocessor.h
+++ b/src/libs/cplusplus/FastPreprocessor.h
@@ -55,26 +55,26 @@ public:
bool mergeDefinedMacrosOfDocument = false);
// CPlusPlus::Client
- virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
+ virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes = QStringList());
virtual void macroAdded(const Macro &);
- virtual void passedMacroDefinitionCheck(unsigned, unsigned, unsigned, const Macro &);
- virtual void failedMacroDefinitionCheck(unsigned, unsigned, const ByteArrayRef &);
+ virtual void passedMacroDefinitionCheck(int, int, int, const Macro &);
+ virtual void failedMacroDefinitionCheck(int, int, const ByteArrayRef &);
- virtual void notifyMacroReference(unsigned, unsigned, unsigned, const Macro &);
+ virtual void notifyMacroReference(int, int, int, const Macro &);
- virtual void startExpandingMacro(unsigned,
- unsigned,
- unsigned,
+ virtual void startExpandingMacro(int,
+ int,
+ int,
const Macro &,
const QVector<MacroArgumentReference> &);
- virtual void stopExpandingMacro(unsigned, const Macro &) {}
+ virtual void stopExpandingMacro(int, const Macro &) {}
virtual void markAsIncludeGuard(const QByteArray &macroName);
- virtual void startSkippingBlocks(unsigned) {}
- virtual void stopSkippingBlocks(unsigned) {}
+ virtual void startSkippingBlocks(int) {}
+ virtual void stopSkippingBlocks(int) {}
};
} // namespace CPlusPlus
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 638fba451b..addaac7134 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -98,7 +98,7 @@ void FindUsages::operator()(Symbol *symbol)
void FindUsages::reportResult(unsigned tokenIndex, const Name *name, Scope *scope)
{
- if (! (tokenIndex && name != 0))
+ if (! (tokenIndex && name != nullptr))
return;
if (name->identifier() != _id)
@@ -157,10 +157,10 @@ void FindUsages::reportResult(unsigned tokenIndex)
_processed.insert(tokenIndex);
- unsigned line, col;
+ int line, col;
getTokenStartPosition(tokenIndex, &line, &col);
QString lineText;
- if (line < _sourceLineEnds.size())
+ if (line < int(_sourceLineEnds.size()))
lineText = fetchLine(line);
else
lineText = matchingLine(tk);
@@ -298,7 +298,7 @@ const Name *FindUsages::name(NameAST *ast)
return ast->name;
}
- return 0;
+ return nullptr;
}
void FindUsages::specifier(SpecifierAST *ast)
@@ -1867,7 +1867,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
if (NameAST *class_or_namespace_name = nested_name_specifier->class_or_namespace_name) {
SimpleNameAST *simple_name = class_or_namespace_name->asSimpleName();
- TemplateIdAST *template_id = 0;
+ TemplateIdAST *template_id = nullptr;
if (! simple_name) {
template_id = class_or_namespace_name->asTemplateId();
@@ -1897,7 +1897,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
else if (DestructorNameAST *dtor = unqualified_name->asDestructorName())
identifier_token = dtor->unqualified_name->firstToken();
- TemplateIdAST *template_id = 0;
+ TemplateIdAST *template_id = nullptr;
if (! identifier_token) {
template_id = unqualified_name->asTemplateId();
diff --git a/src/libs/cplusplus/FindUsages.h b/src/libs/cplusplus/FindUsages.h
index 2b6880a55c..3fd13a30a2 100644
--- a/src/libs/cplusplus/FindUsages.h
+++ b/src/libs/cplusplus/FindUsages.h
@@ -69,13 +69,13 @@ protected:
QString matchingLine(const Token &tk) const;
- void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = 0);
- void reportResult(unsigned tokenIndex, const Identifier *id, Scope *scope = 0);
+ void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = nullptr);
+ void reportResult(unsigned tokenIndex, const Identifier *id, Scope *scope = nullptr);
void reportResult(unsigned tokenIndex, const QList<LookupItem> &candidates);
void reportResult(unsigned tokenIndex);
bool checkCandidates(const QList<LookupItem> &candidates) const;
- void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = 0);
+ void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = nullptr);
static bool isLocalScope(Scope *scope);
@@ -90,7 +90,7 @@ protected:
void objCSelectorArgument(ObjCSelectorArgumentAST *ast);
void attribute(GnuAttributeAST *ast);
- void declarator(DeclaratorAST *ast, Scope *symbol = 0);
+ void declarator(DeclaratorAST *ast, Scope *symbol = nullptr);
void qtPropertyDeclarationItem(QtPropertyDeclarationItemAST *ast);
void qtInterfaceName(QtInterfaceNameAST *ast);
void baseSpecifier(BaseSpecifierAST *ast);
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 5a187e4f1d..451e3d3a78 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -234,7 +234,7 @@ static bool symbolIdentical(Symbol *s1, Symbol *s2)
static const Name *toName(const QList<const Name *> &names, Control *control)
{
- const Name *n = 0;
+ const Name *n = nullptr;
for (int i = names.size() - 1; i >= 0; --i) {
if (! n)
n = names.at(i);
@@ -260,7 +260,7 @@ static bool isInlineNamespace(ClassOrNamespace *con, const Name *name)
const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control)
{
- const Name *n = 0;
+ const Name *n = nullptr;
QList<const Name *> names = LookupContext::fullyQualifiedName(symbol);
for (int i = names.size() - 1; i >= 0; --i) {
@@ -299,7 +299,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name,
if (name->isNameId() || name->isTemplateNameId()) {
foreach (Symbol *s, bindingScope->symbols()) {
if (Scope *scope = s->asScope()) {
- for (unsigned i = 0, count = scope->memberCount(); i < count; ++i) {
+ for (int i = 0, count = scope->memberCount(); i < count; ++i) {
if (UsingDeclaration *u = scope->memberAt(i)->asUsingDeclaration()) {
if (const Name *usingDeclarationName = u->name()) {
if (const QualifiedNameId *q
@@ -360,9 +360,9 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
QSet<const Declaration *> typedefsBeingResolved) const
{
if (! scope || ! name) {
- return 0;
+ return nullptr;
} else if (Block *block = scope->asBlock()) {
- for (unsigned i = 0; i < block->memberCount(); ++i) {
+ for (int i = 0; i < block->memberCount(); ++i) {
Symbol *m = block->memberAt(i);
if (UsingNamespaceDirective *u = m->asUsingNamespaceDirective()) {
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
@@ -379,8 +379,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
if (const NamedType *namedTy = d->type()->asNamedType()) {
// Stop on recursive typedef declarations
if (typedefsBeingResolved.contains(d))
- return 0;
- return lookupType(namedTy->name(), scope, 0,
+ return nullptr;
+ return lookupType(namedTy->name(), scope, nullptr,
QSet<const Declaration *>(typedefsBeingResolved)
<< d);
}
@@ -421,7 +421,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
}
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *LookupContext::lookupType(Symbol *symbol,
@@ -438,8 +438,8 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
return candidates;
for (; scope; scope = scope->enclosingScope()) {
- if (name->identifier() != 0 && scope->isBlock()) {
- bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ 0, /*binding=*/ 0);
+ if (name->identifier() != nullptr && scope->isBlock()) {
+ bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
if (! candidates.isEmpty()) {
// it's a local.
@@ -450,7 +450,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
break;
}
- for (unsigned i = 0; i < scope->memberCount(); ++i) {
+ for (int i = 0; i < scope->memberCount(); ++i) {
if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) {
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
candidates = uu->find(name);
@@ -475,7 +475,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
}
} else if (Function *fun = scope->asFunction()) {
- bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ 0, /*binding=*/ 0);
+ bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
if (! candidates.isEmpty()) {
// it's an argument or a template parameter.
@@ -507,13 +507,13 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
// continue, and look at the enclosing scope.
} else if (ObjCMethod *method = scope->asObjCMethod()) {
- bindings()->lookupInScope(name, method, &candidates, /*templateId = */ 0, /*binding=*/ 0);
+ bindings()->lookupInScope(name, method, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
if (! candidates.isEmpty())
break; // it's a formal argument.
} else if (Template *templ = scope->asTemplate()) {
- bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ 0, /*binding=*/ 0);
+ bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
if (! candidates.isEmpty()) {
// it's a template parameter.
@@ -569,7 +569,7 @@ ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const
foreach (const Name *name, fqName) {
binding = binding->findType(name);
if (!binding)
- return 0;
+ return nullptr;
}
return binding;
@@ -578,11 +578,11 @@ ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const
ClassOrNamespace::ClassOrNamespace(CreateBindings *factory, ClassOrNamespace *parent)
: _factory(factory)
, _parent(parent)
- , _scopeLookupCache(0)
- , _templateId(0)
- , _instantiationOrigin(0)
- , _rootClass(0)
- , _name(0)
+ , _scopeLookupCache(nullptr)
+ , _templateId(nullptr)
+ , _instantiationOrigin(nullptr)
+ , _rootClass(nullptr)
+ , _name(nullptr)
{
Q_ASSERT(factory);
}
@@ -667,7 +667,7 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
// It's also possible that there are matches in the parent binding through
// a qualified name. For instance, a nested class which is forward declared
// in the class but defined outside it - we should capture both.
- Symbol *match = 0;
+ Symbol *match = nullptr;
QSet<ClassOrNamespace *> processed;
for (ClassOrNamespace *parentBinding = binding->parent();
parentBinding && !match;
@@ -696,7 +696,7 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
if (processedOwnParents.contains(binding))
break;
processedOwnParents.insert(binding);
- lookup_helper(name, binding, &result, &processed, /*templateId = */ 0);
+ lookup_helper(name, binding, &result, &processed, /*templateId = */ nullptr);
binding = binding->_parent;
} while (searchInEnclosingScope && binding);
}
@@ -829,7 +829,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name)
{
if (! name)
- return 0;
+ return nullptr;
QSet<ClassOrNamespace *> processed;
return lookupType_helper(name, &processed, /*searchInEnclosingScope =*/ true, this);
@@ -857,7 +857,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name, Block *block)
return foundNestedBlock;
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *ClassOrNamespace::findType(const Name *name)
@@ -889,7 +889,7 @@ ClassOrNamespace *ClassOrNamespace::findBlock_helper(Block *block,
if (!searchInEnclosingScope)
break;
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
@@ -905,7 +905,7 @@ Symbol *ClassOrNamespace::lookupInScope(const QList<const Name *> &fullName)
for (int j = 0; j < symbols().size(); ++j) {
if (Scope *scope = symbols().at(j)->asScope()) {
- for (unsigned i = 0; i < scope->memberCount(); ++i) {
+ for (int i = 0; i < scope->memberCount(); ++i) {
Symbol *s = scope->memberAt(i);
_scopeLookupCache->insert(LookupContext::fullyQualifiedName(s), s);
}
@@ -935,7 +935,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
if (ClassOrNamespace *binding = lookupType_helper(q->base(), processed, true, origin))
return binding->lookupType_helper(q->name(), &innerProcessed, false, origin);
- return 0;
+ return nullptr;
} else if (! processed->contains(this)) {
processed->insert(this);
@@ -985,7 +985,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
return _parent->lookupType_helper(name, processed, searchInEnclosingScope, origin);
}
- return 0;
+ return nullptr;
}
static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Name *argumentName,
@@ -994,9 +994,9 @@ static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Na
foreach (Symbol *s, reference->symbols()) {
if (Class *clazz = s->asClass()) {
if (Template *templateSpecialization = clazz->enclosingTemplate()) {
- const unsigned argumentCountOfSpecialization
+ const int argumentCountOfSpecialization
= templateSpecialization->templateParameterCount();
- for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
+ for (int i = 0; i < argumentCountOfSpecialization; ++i) {
if (TypenameArgument *tParam
= templateSpecialization->templateParameterAt(i)->asTypenameArgument()) {
if (const Name *name = tParam->name()) {
@@ -1008,7 +1008,7 @@ static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Na
}
}
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *templId,
@@ -1018,14 +1018,14 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
for (TemplateNameIdTable::const_iterator cit = specializations.begin();
cit != specializations.end(); ++cit) {
const TemplateNameId *specializationNameId = cit->first;
- const unsigned specializationTemplateArgumentCount
+ const int specializationTemplateArgumentCount
= specializationNameId->templateArgumentCount();
- const unsigned initializationTemplateArgumentCount
+ const int initializationTemplateArgumentCount
= templId->templateArgumentCount();
// for now it works only when we have the same number of arguments in specialization
// and initialization(in future it should be more clever)
if (specializationTemplateArgumentCount == initializationTemplateArgumentCount) {
- for (unsigned i = 0; i < initializationTemplateArgumentCount; ++i) {
+ for (int i = 0; i < initializationTemplateArgumentCount; ++i) {
const FullySpecifiedType &specializationTemplateArgument
= specializationNameId->templateArgumentAt(i);
const FullySpecifiedType &initializationTemplateArgument
@@ -1057,7 +1057,7 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
}
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *ClassOrNamespace::findOrCreateNestedAnonymousType(
@@ -1080,7 +1080,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
QSet<ClassOrNamespace *> *processed,
ClassOrNamespace *origin)
{
- Q_ASSERT(name != 0);
+ Q_ASSERT(name != nullptr);
Q_ASSERT(name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId());
const_cast<ClassOrNamespace *>(this)->flush();
@@ -1090,7 +1090,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
Table::const_iterator it = _classOrNamespaces.find(name);
if (it == _classOrNamespaces.end())
- return 0;
+ return nullptr;
ClassOrNamespace *reference = it->second;
ClassOrNamespace *baseTemplateClassReference = reference;
@@ -1151,11 +1151,11 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
// are templates. We need to collect them now. First, we track the bases which are already
// part of the binding so we can identify the missings ones later.
- Class *referenceClass = 0;
+ Class *referenceClass = nullptr;
QList<const Name *> allBases;
foreach (Symbol *s, reference->symbols()) {
if (Class *clazz = s->asClass()) {
- for (unsigned i = 0; i < clazz->baseClassCount(); ++i) {
+ for (int i = 0; i < clazz->baseClassCount(); ++i) {
BaseClass *baseClass = clazz->baseClassAt(i);
if (baseClass->name())
allBases.append(baseClass->name());
@@ -1207,18 +1207,18 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
// It gets a bit complicated if the reference is actually a class template because we
// now must worry about dependent names in base classes.
if (Template *templateSpecialization = referenceClass->enclosingTemplate()) {
- const unsigned argumentCountOfInitialization = templId->templateArgumentCount();
- const unsigned argumentCountOfSpecialization
+ const int argumentCountOfInitialization = templId->templateArgumentCount();
+ const int argumentCountOfSpecialization
= templateSpecialization->templateParameterCount();
Subst subst(_control.data());
if (_factory->expandTemplates()) {
const TemplateNameId *templSpecId
= templateSpecialization->name()->asTemplateNameId();
- const unsigned templSpecArgumentCount = templSpecId ?
+ const int templSpecArgumentCount = templSpecId ?
templSpecId->templateArgumentCount() : 0;
Clone cloner(_control.data());
- for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
+ for (int i = 0; i < argumentCountOfSpecialization; ++i) {
const TypenameArgument *tParam
= templateSpecialization->templateParameterAt(i)->asTypenameArgument();
if (!tParam)
@@ -1251,8 +1251,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
oo.showTemplateParameters = true;
qDebug() << "cloned" << oo(clone->type());
if (Class *klass = clone->asClass()) {
- const unsigned klassMemberCount = klass->memberCount();
- for (unsigned i = 0; i < klassMemberCount; ++i){
+ const int klassMemberCount = klass->memberCount();
+ for (int i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i);
if (klassMemberAsSymbol->isTypedef()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
@@ -1267,18 +1267,18 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
instantiation->_symbols.append(reference->symbols());
}
- QHash<const Name*, unsigned> templParams;
- for (unsigned i = 0; i < argumentCountOfSpecialization; ++i)
+ QHash<const Name*, int> templParams;
+ for (int i = 0; i < argumentCountOfSpecialization; ++i)
templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i);
foreach (const Name *baseName, allBases) {
- ClassOrNamespace *baseBinding = 0;
+ ClassOrNamespace *baseBinding = nullptr;
if (const Identifier *nameId = baseName->asNameId()) {
// This is the simple case in which a template parameter is itself a base.
// Ex.: template <class T> class A : public T {};
if (templParams.contains(nameId)) {
- const unsigned parameterIndex = templParams.value(nameId);
+ const int parameterIndex = templParams.value(nameId);
if (parameterIndex < argumentCountOfInitialization) {
const FullySpecifiedType &fullType =
templId->templateArgumentAt(parameterIndex);
@@ -1297,7 +1297,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
}
} else {
SubstitutionMap map;
- for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
+ for (int i = 0; i < argumentCountOfSpecialization; ++i) {
const Name *name = templateSpecialization->templateParameterAt(i)->name();
FullySpecifiedType ty = (i < argumentCountOfInitialization) ?
templId->templateArgumentAt(i):
@@ -1354,7 +1354,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
if (const QualifiedNameId *qBaseName = baseName->asQualifiedNameId()) {
if (const Name *qualification = qBaseName->base())
binding = lookupType(qualification);
- else if (binding->parent() != 0)
+ else if (binding->parent() != nullptr)
//if this is global identifier we take global namespace
//Ex: class A{}; namespace NS { class A: public ::A{}; }
binding = binding->globalNamespace();
@@ -1471,7 +1471,7 @@ NamedType *ClassOrNamespace::NestedClassInstantiator::findNamedType(Type *member
else if (ReferenceType *referenceType = memberType->asReferenceType())
return findNamedType(referenceType->elementType().type());
- return 0;
+ return nullptr;
}
void ClassOrNamespace::flush()
@@ -1539,7 +1539,7 @@ ClassOrNamespace *ClassOrNamespace::findOrCreateType(const Name *name, ClassOrNa
return e;
}
- return 0;
+ return nullptr;
}
CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snapshot)
@@ -1547,7 +1547,7 @@ CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snaps
, _control(QSharedPointer<Control>(new Control))
, _expandTemplates(false)
{
- _globalNamespace = allocClassOrNamespace(/*parent = */ 0);
+ _globalNamespace = allocClassOrNamespace(/*parent = */ nullptr);
_currentClassOrNamespace = _globalNamespace;
process(thisDocument);
@@ -1636,7 +1636,7 @@ void CreateBindings::process(Document::Ptr doc)
ClassOrNamespace *CreateBindings::enterClassOrNamespaceBinding(Symbol *symbol)
{
- ClassOrNamespace *entity = _currentClassOrNamespace->findOrCreateType(symbol->name(), 0,
+ ClassOrNamespace *entity = _currentClassOrNamespace->findOrCreateType(symbol->name(), nullptr,
symbol->asClass());
entity->addSymbol(symbol);
@@ -1645,7 +1645,7 @@ ClassOrNamespace *CreateBindings::enterClassOrNamespaceBinding(Symbol *symbol)
ClassOrNamespace *CreateBindings::enterGlobalClassOrNamespace(Symbol *symbol)
{
- ClassOrNamespace *entity = _globalNamespace->findOrCreateType(symbol->name(), 0,
+ ClassOrNamespace *entity = _globalNamespace->findOrCreateType(symbol->name(), nullptr,
symbol->asClass());
entity->addSymbol(symbol);
@@ -1664,7 +1664,7 @@ bool CreateBindings::visit(Namespace *ns)
{
ClassOrNamespace *previous = enterClassOrNamespaceBinding(ns);
- for (unsigned i = 0; i < ns->memberCount(); ++i)
+ for (int i = 0; i < ns->memberCount(); ++i)
process(ns->memberAt(i));
if (ns->isInline() && previous)
@@ -1678,21 +1678,21 @@ bool CreateBindings::visit(Namespace *ns)
bool CreateBindings::visit(Class *klass)
{
ClassOrNamespace *previous = _currentClassOrNamespace;
- ClassOrNamespace *binding = 0;
+ ClassOrNamespace *binding = nullptr;
if (klass->name() && klass->name()->isQualifiedNameId())
binding = _currentClassOrNamespace->lookupType(klass->name());
if (! binding)
- binding = _currentClassOrNamespace->findOrCreateType(klass->name(), 0, klass);
+ binding = _currentClassOrNamespace->findOrCreateType(klass->name(), nullptr, klass);
_currentClassOrNamespace = binding;
_currentClassOrNamespace->addSymbol(klass);
- for (unsigned i = 0; i < klass->baseClassCount(); ++i)
+ for (int i = 0; i < klass->baseClassCount(); ++i)
process(klass->baseClassAt(i));
- for (unsigned i = 0; i < klass->memberCount(); ++i)
+ for (int i = 0; i < klass->memberCount(); ++i)
process(klass->memberAt(i));
_currentClassOrNamespace = previous;
@@ -1737,7 +1737,7 @@ bool CreateBindings::visit(Declaration *decl)
} else if (Class *klass = ty->asClassType()) {
if (const Identifier *nameId = decl->name()->asNameId()) {
ClassOrNamespace *binding
- = _currentClassOrNamespace->findOrCreateType(nameId, 0, klass);
+ = _currentClassOrNamespace->findOrCreateType(nameId, nullptr, klass);
binding->addSymbol(klass);
}
}
@@ -1759,7 +1759,7 @@ bool CreateBindings::visit(Function *function)
if (!binding)
return false;
_currentClassOrNamespace = binding;
- for (unsigned i = 0, count = function->memberCount(); i < count; ++i) {
+ for (int i = 0, count = function->memberCount(); i < count; ++i) {
Symbol *s = function->memberAt(i);
if (Block *b = s->asBlock())
visit(b);
@@ -1778,7 +1778,7 @@ bool CreateBindings::visit(Block *block)
_currentClassOrNamespace = binding;
_currentClassOrNamespace->addSymbol(block);
- for (unsigned i = 0; i < block->memberCount(); ++i)
+ for (int i = 0; i < block->memberCount(); ++i)
// we cannot use lazy processing here, because we have to know
// does this block contain any other blocks or classOrNamespaces
process(block->memberAt(i), _currentClassOrNamespace);
@@ -1794,7 +1794,7 @@ bool CreateBindings::visit(Block *block)
_entities.append(binding);
} else {
delete binding;
- binding = 0;
+ binding = nullptr;
}
_currentClassOrNamespace = previous;
@@ -1862,10 +1862,10 @@ bool CreateBindings::visit(ObjCClass *klass)
process(klass->baseClass());
- for (unsigned i = 0; i < klass->protocolCount(); ++i)
+ for (int i = 0; i < klass->protocolCount(); ++i)
process(klass->protocolAt(i));
- for (unsigned i = 0; i < klass->memberCount(); ++i)
+ for (int i = 0; i < klass->memberCount(); ++i)
process(klass->memberAt(i));
_currentClassOrNamespace = previous;
@@ -1894,10 +1894,10 @@ bool CreateBindings::visit(ObjCProtocol *proto)
{
ClassOrNamespace *previous = enterGlobalClassOrNamespace(proto);
- for (unsigned i = 0; i < proto->protocolCount(); ++i)
+ for (int i = 0; i < proto->protocolCount(); ++i)
process(proto->protocolAt(i));
- for (unsigned i = 0; i < proto->memberCount(); ++i)
+ for (int i = 0; i < proto->memberCount(); ++i)
process(proto->memberAt(i));
_currentClassOrNamespace = previous;
@@ -1930,12 +1930,12 @@ bool CreateBindings::visit(ObjCMethod *)
Symbol *CreateBindings::instantiateTemplateFunction(const TemplateNameId *instantiation,
Template *specialization) const
{
- const unsigned argumentCountOfInitialization = instantiation->templateArgumentCount();
- const unsigned argumentCountOfSpecialization = specialization->templateParameterCount();
+ const int argumentCountOfInitialization = instantiation->templateArgumentCount();
+ const int argumentCountOfSpecialization = specialization->templateParameterCount();
Clone cloner(_control.data());
Subst subst(_control.data());
- for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
+ for (int i = 0; i < argumentCountOfSpecialization; ++i) {
const TypenameArgument *tParam
= specialization->templateParameterAt(i)->asTypenameArgument();
if (!tParam)
diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h
index b13df5da29..22035362fd 100644
--- a/src/libs/cplusplus/LookupContext.h
+++ b/src/libs/cplusplus/LookupContext.h
@@ -97,8 +97,8 @@ private:
void flush();
/// \internal
- ClassOrNamespace *findOrCreateType(const Name *name, ClassOrNamespace *origin = 0,
- Class *clazz = 0);
+ ClassOrNamespace *findOrCreateType(const Name *name, ClassOrNamespace *origin = nullptr,
+ Class *clazz = nullptr);
ClassOrNamespace *findOrCreateNestedAnonymousType(const AnonymousNameId *anonymousNameId);
@@ -196,9 +196,9 @@ public:
ClassOrNamespace *globalNamespace() const;
/// Finds the binding associated to the given symbol.
- ClassOrNamespace *lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding = 0);
+ ClassOrNamespace *lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding = nullptr);
ClassOrNamespace *lookupType(const QList<const Name *> &path,
- ClassOrNamespace *enclosingBinding = 0);
+ ClassOrNamespace *enclosingBinding = nullptr);
/// Returns the Control that must be used to create temporary symbols.
/// \internal
@@ -303,11 +303,11 @@ public:
QList<LookupItem> lookup(const Name *name, Scope *scope) const;
ClassOrNamespace *lookupType(const Name *name, Scope *scope,
- ClassOrNamespace *enclosingBinding = 0,
+ ClassOrNamespace *enclosingBinding = nullptr,
QSet<const Declaration *> typedefsBeingResolved
= QSet<const Declaration *>()) const;
ClassOrNamespace *lookupType(Symbol *symbol,
- ClassOrNamespace *enclosingBinding = 0) const;
+ ClassOrNamespace *enclosingBinding = nullptr) const;
ClassOrNamespace *lookupParent(Symbol *symbol) const;
/// \internal
diff --git a/src/libs/cplusplus/LookupItem.cpp b/src/libs/cplusplus/LookupItem.cpp
index 5890664051..7fc73ba240 100644
--- a/src/libs/cplusplus/LookupItem.cpp
+++ b/src/libs/cplusplus/LookupItem.cpp
@@ -41,7 +41,7 @@ uint CPlusPlus::qHash(const LookupItem &key)
}
LookupItem::LookupItem()
- : _scope(0), _declaration(0), _binding(0)
+ : _scope(nullptr), _declaration(nullptr), _binding(nullptr)
{ }
FullySpecifiedType LookupItem::type() const
diff --git a/src/libs/cplusplus/Macro.cpp b/src/libs/cplusplus/Macro.cpp
index 6e1a46c8a0..d0c905edf1 100644
--- a/src/libs/cplusplus/Macro.cpp
+++ b/src/libs/cplusplus/Macro.cpp
@@ -48,7 +48,7 @@
using namespace CPlusPlus;
Macro::Macro()
- : _next(0),
+ : _next(nullptr),
_hashcode(0),
_fileRevision(0),
_line(0),
diff --git a/src/libs/cplusplus/Macro.h b/src/libs/cplusplus/Macro.h
index f54df57458..ba510109a8 100644
--- a/src/libs/cplusplus/Macro.h
+++ b/src/libs/cplusplus/Macro.h
@@ -100,10 +100,10 @@ public:
void setFileRevision(unsigned fileRevision)
{ _fileRevision = fileRevision; }
- unsigned line() const
+ int line() const
{ return _line; }
- void setLine(unsigned line)
+ void setLine(int line)
{ _line = line; }
unsigned bytesOffset() const
@@ -165,7 +165,7 @@ private:
QString _fileName;
unsigned _hashcode;
unsigned _fileRevision;
- unsigned _line;
+ int _line;
unsigned _bytesOffset;
unsigned _utf16charsOffset;
unsigned _length;
diff --git a/src/libs/cplusplus/MatchingText.cpp b/src/libs/cplusplus/MatchingText.cpp
index 59440813a7..9e1ffdecb8 100644
--- a/src/libs/cplusplus/MatchingText.cpp
+++ b/src/libs/cplusplus/MatchingText.cpp
@@ -128,7 +128,7 @@ static int countSkippedChars(const QString &blockText, const QString &textToProc
return skippedChars;
}
-static const Token tokenAtPosition(const Tokens &tokens, const unsigned pos)
+static const Token tokenAtPosition(const Tokens &tokens, const int pos)
{
for (int i = tokens.size() - 1; i >= 0; --i) {
const Token tk = tokens.at(i);
@@ -145,6 +145,7 @@ static LanguageFeatures languageFeatures()
features.qtKeywordsEnabled = false;
features.qtMocRunEnabled = false;
features.cxx11Enabled = true;
+ features.cxx14Enabled = true;
features.cxxEnabled = true;
features.c99Enabled = true;
features.objCEnabled = true;
@@ -449,7 +450,7 @@ bool MatchingText::contextAllowsElectricCharacters(const QTextCursor &cursor)
return false;
if (token.isStringLiteral() || token.isCharLiteral()) {
- const unsigned pos = cursor.selectionEnd() - cursor.block().position();
+ const int pos = cursor.selectionEnd() - cursor.block().position();
if (pos <= token.utf16charsEnd())
return false;
}
@@ -484,7 +485,7 @@ bool MatchingText::isInCommentHelper(const QTextCursor &cursor, Token *retToken)
int prevState = 0;
const Tokens tokens = getTokens(cursor, prevState);
- const unsigned pos = cursor.selectionEnd() - cursor.block().position();
+ const int pos = cursor.selectionEnd() - cursor.block().position();
if (tokens.isEmpty() || pos < tokens.first().utf16charsBegin())
return prevState > 0;
@@ -509,7 +510,7 @@ Kind MatchingText::stringKindAtCursor(const QTextCursor &cursor)
int prevState = 0;
const Tokens tokens = getTokens(cursor, prevState);
- const unsigned pos = cursor.selectionEnd() - cursor.block().position();
+ const int pos = cursor.selectionEnd() - cursor.block().position();
if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin())
return T_EOF_SYMBOL;
diff --git a/src/libs/cplusplus/MatchingText.h b/src/libs/cplusplus/MatchingText.h
index b394e342af..aab8365e15 100644
--- a/src/libs/cplusplus/MatchingText.h
+++ b/src/libs/cplusplus/MatchingText.h
@@ -53,7 +53,7 @@ public:
static bool shouldInsertMatchingText(const QTextCursor &tc);
static bool shouldInsertMatchingText(QChar lookAhead);
- static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = 0);
+ static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = nullptr);
static CPlusPlus::Kind stringKindAtCursor(const QTextCursor &cursor);
static QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
diff --git a/src/libs/cplusplus/NamePrettyPrinter.cpp b/src/libs/cplusplus/NamePrettyPrinter.cpp
index 3870763d0c..5d9c5770e0 100644
--- a/src/libs/cplusplus/NamePrettyPrinter.cpp
+++ b/src/libs/cplusplus/NamePrettyPrinter.cpp
@@ -76,7 +76,7 @@ void NamePrettyPrinter::visit(const TemplateNameId *name)
else
_name = QLatin1String("anonymous");
_name += QLatin1Char('<');
- for (unsigned index = 0; index < name->templateArgumentCount(); ++index) {
+ for (int index = 0; index < name->templateArgumentCount(); ++index) {
if (index != 0)
_name += QLatin1String(", ");
@@ -253,7 +253,7 @@ void NamePrettyPrinter::visit(const QualifiedNameId *name)
void NamePrettyPrinter::visit(const SelectorNameId *name)
{
- for (unsigned i = 0; i < name->nameCount(); ++i) {
+ for (int i = 0; i < name->nameCount(); ++i) {
const Name *n = name->nameAt(i);
if (!n)
continue;
diff --git a/src/libs/cplusplus/Overview.h b/src/libs/cplusplus/Overview.h
index eeef87212e..243390cd8a 100644
--- a/src/libs/cplusplus/Overview.h
+++ b/src/libs/cplusplus/Overview.h
@@ -43,12 +43,12 @@ public:
QString operator()(const QList<const Name *> &fullyQualifiedName) const
{ return prettyName(fullyQualifiedName); }
- QString operator()(const FullySpecifiedType &type, const Name *name = 0) const
+ QString operator()(const FullySpecifiedType &type, const Name *name = nullptr) const
{ return prettyType(type, name); }
QString prettyName(const Name *name) const;
QString prettyName(const QList<const Name *> &fullyQualifiedName) const;
- QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const;
+ QString prettyType(const FullySpecifiedType &type, const Name *name = nullptr) const;
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
public:
@@ -70,7 +70,7 @@ public:
bool showEnclosingTemplate: 1;
bool includeWhiteSpaceInOperatorName: 1; /// "operator =()" vs "operator=()"
- unsigned markedArgument;
+ int markedArgument;
int markedArgumentBegin;
int markedArgumentEnd;
};
diff --git a/src/libs/cplusplus/PreprocessorClient.cpp b/src/libs/cplusplus/PreprocessorClient.cpp
index 1b2595651c..68be342821 100644
--- a/src/libs/cplusplus/PreprocessorClient.cpp
+++ b/src/libs/cplusplus/PreprocessorClient.cpp
@@ -40,7 +40,7 @@ using namespace CPlusPlus;
*/
/*!
- \fn void Client::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro &macro)
+ \fn void Client::passedMacroDefinitionCheck(int offset, int line, const Macro &macro)
Called when the preprocessor checks whether a macro is defined or not and the
result is positive.
@@ -49,7 +49,7 @@ using namespace CPlusPlus;
*/
/*!
- \fn void Client::failedMacroDefinitionCheck(unsigned offset, const ByteArrayRef &name)
+ \fn void Client::failedMacroDefinitionCheck(int offset, const ByteArrayRef &name)
Called when the preprocessor checks whether a macro is defined or not and the
result is negative.
@@ -58,8 +58,8 @@ using namespace CPlusPlus;
*/
/*!
- \fn void Client::startExpandingMacro(unsigned offset,
- unsigned line,
+ \fn void Client::startExpandingMacro(int offset,
+ int line,
const Macro &macro,
const QVector<MacroArgumentReference> &actuals
= QVector<MacroArgumentReference>())
diff --git a/src/libs/cplusplus/PreprocessorClient.h b/src/libs/cplusplus/PreprocessorClient.h
index accccdab1f..97d3cc8efb 100644
--- a/src/libs/cplusplus/PreprocessorClient.h
+++ b/src/libs/cplusplus/PreprocessorClient.h
@@ -41,30 +41,30 @@ class Macro;
class CPLUSPLUS_EXPORT MacroArgumentReference
{
- unsigned _bytesOffset;
- unsigned _bytesLength;
- unsigned _utf16charsOffset;
- unsigned _utf16charsLength;
+ int _bytesOffset;
+ int _bytesLength;
+ int _utf16charsOffset;
+ int _utf16charsLength;
public:
- explicit MacroArgumentReference(unsigned bytesOffset = 0, unsigned bytesLength = 0,
- unsigned utf16charsOffset = 0, unsigned utf16charsLength = 0)
+ explicit MacroArgumentReference(int bytesOffset = 0, int bytesLength = 0,
+ int utf16charsOffset = 0, int utf16charsLength = 0)
: _bytesOffset(bytesOffset)
, _bytesLength(bytesLength)
, _utf16charsOffset(utf16charsOffset)
, _utf16charsLength(utf16charsLength)
{ }
- unsigned bytesOffset() const
+ int bytesOffset() const
{ return _bytesOffset; }
- unsigned bytesLength() const
+ int bytesLength() const
{ return _bytesLength; }
- unsigned utf16charsOffset() const
+ int utf16charsOffset() const
{ return _utf16charsOffset; }
- unsigned utf16charsLength() const
+ int utf16charsLength() const
{ return _utf16charsLength; }
};
@@ -86,28 +86,28 @@ public:
virtual void macroAdded(const Macro &macro) = 0;
- virtual void passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro) = 0;
- virtual void failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
+ virtual void passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro) = 0;
+ virtual void failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
const ByteArrayRef &name) = 0;
- virtual void notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro) = 0;
+ virtual void notifyMacroReference(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro) = 0;
- virtual void startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
- unsigned line, const Macro &macro,
+ virtual void startExpandingMacro(int bytesOffset, int utf16charsOffset,
+ int line, const Macro &macro,
const QVector<MacroArgumentReference> &actuals
= QVector<MacroArgumentReference>()) = 0;
- virtual void stopExpandingMacro(unsigned bytesOffset, const Macro &macro) = 0; // TODO: ?!
+ virtual void stopExpandingMacro(int bytesOffset, const Macro &macro) = 0; // TODO: ?!
/// Mark the given macro name as the include guard for the current file.
virtual void markAsIncludeGuard(const QByteArray &macroName) = 0;
/// Start skipping from the given utf16charsOffset.
- virtual void startSkippingBlocks(unsigned utf16charsOffset) = 0;
- virtual void stopSkippingBlocks(unsigned utf16charsOffset) = 0;
+ virtual void startSkippingBlocks(int utf16charsOffset) = 0;
+ virtual void stopSkippingBlocks(int utf16charsOffset) = 0;
- virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
+ virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
const QStringList &initialIncludes = QStringList()) = 0;
static inline bool isInjectedFile(const QString &fileName)
diff --git a/src/libs/cplusplus/PreprocessorEnvironment.cpp b/src/libs/cplusplus/PreprocessorEnvironment.cpp
index 6d7464d799..4ffc127a19 100644
--- a/src/libs/cplusplus/PreprocessorEnvironment.cpp
+++ b/src/libs/cplusplus/PreprocessorEnvironment.cpp
@@ -67,10 +67,10 @@ static unsigned hashCode(const char *str, int length)
Environment::Environment()
: currentLine(0),
hideNext(false),
- _macros(0),
+ _macros(nullptr),
_allocated_macros(0),
_macro_count(-1),
- _hash(0),
+ _hash(nullptr),
_hash_count(401)
{
}
@@ -153,10 +153,10 @@ void Environment::reset()
if (_hash)
free(_hash);
- _macros = 0;
+ _macros = nullptr;
_allocated_macros = 0;
_macro_count = -1;
- _hash = 0;
+ _hash = nullptr;
_hash_count = 401;
}
@@ -230,14 +230,14 @@ Environment::iterator Environment::lastMacro() const
Macro *Environment::resolve(const ByteArrayRef &name) const
{
if (! _macros)
- return 0;
+ return nullptr;
Macro *it = _hash[hashCode(name.start(), name.size()) % _hash_count];
for (; it; it = it->_next) {
if (it->name() != name)
continue;
else if (it->isHidden())
- return 0;
+ return nullptr;
else break;
}
return it;
diff --git a/src/libs/cplusplus/PreprocessorEnvironment.h b/src/libs/cplusplus/PreprocessorEnvironment.h
index a6db2d0c7f..6f085ed519 100644
--- a/src/libs/cplusplus/PreprocessorEnvironment.h
+++ b/src/libs/cplusplus/PreprocessorEnvironment.h
@@ -88,7 +88,7 @@ private:
public:
QString currentFile;
QByteArray currentFileUtf8;
- unsigned currentLine;
+ int currentLine;
bool hideNext;
private:
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 034ea6fcc1..2eca9b53f3 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -83,7 +83,7 @@ public:
// use an "alreadyResolved" container. FIXME: We might overcome this by resolving the
// template parameters.
unsigned maxDepth = 15;
- for (NamedType *namedTy = 0; maxDepth && (namedTy = getNamedType(*type)); --maxDepth) {
+ for (NamedType *namedTy = nullptr; maxDepth && (namedTy = getNamedType(*type)); --maxDepth) {
QList<LookupItem> namedTypeItems = getNamedTypeItems(namedTy->name(), *scope, _binding);
if (Q_UNLIKELY(debug))
@@ -125,9 +125,9 @@ private:
QList<LookupItem> results;
if (!scope)
return results;
- Scope *enclosingBlockScope = 0;
+ Scope *enclosingBlockScope = nullptr;
for (Block *block = scope->asBlock(); block;
- block = enclosingBlockScope ? enclosingBlockScope->asBlock() : 0) {
+ block = enclosingBlockScope ? enclosingBlockScope->asBlock() : nullptr) {
const unsigned memberCount = block->memberCount();
for (unsigned i = 0; i < memberCount; ++i) {
Symbol *symbol = block->memberAt(i);
@@ -233,7 +233,7 @@ static int evaluateFunctionArgument(const FullySpecifiedType &actualTy,
ResolveExpression::ResolveExpression(const LookupContext &context,
const QSet<const Declaration *> &autoDeclarationsBeingResolved)
: ASTVisitor(context.expressionDocument()->translationUnit()),
- _scope(0),
+ _scope(nullptr),
_context(context),
bind(context.expressionDocument()->translationUnit()),
_autoDeclarationsBeingResolved(autoDeclarationsBeingResolved),
@@ -314,9 +314,9 @@ bool ResolveExpression::visit(IdExpressionAST *ast)
bool ResolveExpression::visit(BinaryExpressionAST *ast)
{
- if (tokenKind(ast->binary_op_token) == T_COMMA && ast->right_expression && ast->right_expression->asQtMethod() != 0) {
+ if (tokenKind(ast->binary_op_token) == T_COMMA && ast->right_expression && ast->right_expression->asQtMethod() != nullptr) {
- if (ast->left_expression && ast->left_expression->asQtMethod() != 0)
+ if (ast->left_expression && ast->left_expression->asQtMethod() != nullptr)
thisObject();
else
accept(ast->left_expression);
@@ -404,7 +404,7 @@ bool ResolveExpression::visit(TypeidExpressionAST *)
{
const Name *stdName = control()->identifier("std");
const Name *tiName = control()->identifier("type_info");
- const Name *q = control()->qualifiedNameId(control()->qualifiedNameId(/* :: */ 0, stdName), tiName);
+ const Name *q = control()->qualifiedNameId(control()->qualifiedNameId(/* :: */ nullptr, stdName), tiName);
FullySpecifiedType ty(control()->namedType(q));
addResult(ty, _scope);
@@ -443,7 +443,7 @@ bool ResolveExpression::visit(NumericLiteralAST *ast)
{
const Token &tk = tokenAt(ast->literal_token);
- Type *type = 0;
+ Type *type = nullptr;
bool isUnsigned = false;
if (tk.is(T_CHAR_LITERAL)) {
@@ -581,21 +581,17 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
accept(ast->expression);
unsigned unaryOp = tokenKind(ast->unary_op_token);
if (unaryOp == T_AMPER) {
- QMutableListIterator<LookupItem > it(_results);
- while (it.hasNext()) {
- LookupItem p = it.next();
+ for (LookupItem &p : _results) {
FullySpecifiedType ty = p.type();
ty.setType(control()->pointerType(ty));
p.setType(ty);
- it.setValue(p);
}
} else if (unaryOp == T_STAR) {
- QMutableListIterator<LookupItem > it(_results);
- while (it.hasNext()) {
- LookupItem p = it.next();
+ for (int i = 0; i < _results.size(); ++i) {
+ LookupItem &p = _results[i];
FullySpecifiedType ty = p.type();
NamedType *namedTy = ty->asNamedType();
- if (namedTy != 0) {
+ if (namedTy != nullptr) {
const QList<LookupItem> types = _context.lookup(namedTy->name(), p.scope());
if (!types.empty())
ty = types.front().type();
@@ -603,9 +599,8 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
bool added = false;
if (PointerType *ptrTy = ty->asPointerType()) {
p.setType(ptrTy->elementType());
- it.setValue(p);
added = true;
- } else if (namedTy != 0) {
+ } else if (namedTy != nullptr) {
const Name *starOp = control()->operatorNameId(OperatorNameId::StarOp);
if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), p.scope(), p.binding())) {
foreach (const LookupItem &r, b->find(starOp)) {
@@ -616,7 +611,6 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
FullySpecifiedType retTy = proto->returnType().simplified();
p.setType(retTy);
p.setScope(proto->enclosingScope());
- it.setValue(p);
added = true;
break;
}
@@ -626,7 +620,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
}
}
if (!added)
- it.remove();
+ _results.removeAt(i--);
}
}
return false;
@@ -725,7 +719,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
if (!item.type()->isUndefinedType())
continue;
- if (item.declaration() == 0)
+ if (item.declaration() == nullptr)
continue;
if (item.type().isAuto()) {
@@ -738,7 +732,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
continue;
const StringLiteral *initializationString = decl->getInitializer();
- if (initializationString == 0)
+ if (initializationString == nullptr)
continue;
const QByteArray &initializer =
@@ -771,7 +765,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
Clone cloner(_context.bindings()->control().data());
for (int n = 0; n < typeItems.size(); ++ n) {
- FullySpecifiedType newType = cloner.type(typeItems[n].type(), 0);
+ FullySpecifiedType newType = cloner.type(typeItems[n].type(), nullptr);
if (n == 0) {
item.setType(newType);
item.setScope(typeItems[n].scope());
@@ -963,8 +957,8 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
QList<LookupItem> ResolveExpression::getMembers(ClassOrNamespace *binding, const Name *memberName) const
{
- Q_UNUSED(binding);
- Q_UNUSED(memberName);
+ Q_UNUSED(binding)
+ Q_UNUSED(memberName)
// ### port me
QList<LookupItem> members;
@@ -1023,7 +1017,7 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
// Evaluate the expression-id that follows the access operator.
- const Name *memberName = 0;
+ const Name *memberName = nullptr;
if (ast->member_name)
memberName = ast->member_name->name;
@@ -1040,7 +1034,7 @@ ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &origina
ClassOrNamespace *enclosingBinding) const
{
FullySpecifiedType ty = originalTy.simplified();
- ClassOrNamespace *binding = 0;
+ ClassOrNamespace *binding = nullptr;
if (Class *klass = ty->asClassType()) {
if (scope->isBlock())
@@ -1119,7 +1113,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
FullySpecifiedType overloadTy
= instantiate(binding->templateId(), overload);
Function *instantiatedFunction = overloadTy->asFunctionType();
- Q_ASSERT(instantiatedFunction != 0);
+ Q_ASSERT(instantiatedFunction != nullptr);
FullySpecifiedType retTy
= instantiatedFunction->returnType().simplified();
@@ -1168,7 +1162,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
return binding;
}
- ClassOrNamespace *enclosingBinding = 0;
+ ClassOrNamespace *enclosingBinding = nullptr;
if (ClassOrNamespace *binding = r.binding()) {
if (binding->instantiationOrigin())
enclosingBinding = binding;
@@ -1179,7 +1173,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
}
}
- return 0;
+ return nullptr;
}
ClassOrNamespace *ResolveExpression::findClassForTemplateParameterInExpressionScope(
@@ -1197,7 +1191,7 @@ ClassOrNamespace *ResolveExpression::findClassForTemplateParameterInExpressionSc
}
}
- return 0;
+ return nullptr;
}
FullySpecifiedType ResolveExpression::instantiate(const Name *className, Symbol *candidate) const
@@ -1219,7 +1213,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
foreach (const LookupItem &result, receiverResults) {
FullySpecifiedType ty = result.type().simplified();
- ClassOrNamespace *binding = 0;
+ ClassOrNamespace *binding = nullptr;
if (ObjCClass *clazz = ty->asObjCClassType()) {
// static access, e.g.:
diff --git a/src/libs/cplusplus/ResolveExpression.h b/src/libs/cplusplus/ResolveExpression.h
index f53caf26aa..41f91c049f 100644
--- a/src/libs/cplusplus/ResolveExpression.h
+++ b/src/libs/cplusplus/ResolveExpression.h
@@ -49,13 +49,13 @@ public:
ClassOrNamespace *baseExpression(const QList<LookupItem> &baseResults,
int accessOp,
- bool *replacedDotOperator = 0) const;
+ bool *replacedDotOperator = nullptr) const;
const LookupContext &context() const;
protected:
ClassOrNamespace *findClass(const FullySpecifiedType &ty, Scope *scope,
- ClassOrNamespace *enclosingBinding = 0) const;
+ ClassOrNamespace *enclosingBinding = nullptr) const;
QList<LookupItem> expression(ExpressionAST *ast);
@@ -66,7 +66,7 @@ protected:
void thisObject();
- void addResult(const FullySpecifiedType &ty, Scope *scope, ClassOrNamespace *binding = 0);
+ void addResult(const FullySpecifiedType &ty, Scope *scope, ClassOrNamespace *binding = nullptr);
void addResults(const QList<Symbol *> &symbols);
void addResults(const QList<LookupItem> &items);
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp
index a01a2b9b67..57bad400de 100644
--- a/src/libs/cplusplus/SimpleLexer.cpp
+++ b/src/libs/cplusplus/SimpleLexer.cpp
@@ -110,7 +110,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
return tokens;
}
-int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset)
+int SimpleLexer::tokenAt(const Tokens &tokens, int utf16charsOffset)
{
for (int index = tokens.size() - 1; index >= 0; --index) {
const Token &tk = tokens.at(index);
@@ -122,7 +122,7 @@ int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset)
}
Token SimpleLexer::tokenAt(const QString &text,
- unsigned utf16charsOffset,
+ int utf16charsOffset,
int state,
const LanguageFeatures &languageFeatures)
{
@@ -133,7 +133,7 @@ Token SimpleLexer::tokenAt(const QString &text,
return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
}
-int SimpleLexer::tokenBefore(const Tokens &tokens, unsigned utf16charsOffset)
+int SimpleLexer::tokenBefore(const Tokens &tokens, int utf16charsOffset)
{
for (int index = tokens.size() - 1; index >= 0; --index) {
const Token &tk = tokens.at(index);
diff --git a/src/libs/cplusplus/SimpleLexer.h b/src/libs/cplusplus/SimpleLexer.h
index 2bd794933d..75138e830a 100644
--- a/src/libs/cplusplus/SimpleLexer.h
+++ b/src/libs/cplusplus/SimpleLexer.h
@@ -59,13 +59,13 @@ public:
int state() const
{ return _lastState; }
- static int tokenAt(const Tokens &tokens, unsigned utf16charsOffset);
+ static int tokenAt(const Tokens &tokens, int utf16charsOffset);
static Token tokenAt(const QString &text,
- unsigned utf16charsOffset,
+ int utf16charsOffset,
int state,
const LanguageFeatures &languageFeatures);
- static int tokenBefore(const Tokens &tokens, unsigned utf16charsOffset);
+ static int tokenBefore(const Tokens &tokens, int utf16charsOffset);
private:
int _lastState;
diff --git a/src/libs/cplusplus/SymbolNameVisitor.cpp b/src/libs/cplusplus/SymbolNameVisitor.cpp
index fe2b36f3d8..b34bf2f42a 100644
--- a/src/libs/cplusplus/SymbolNameVisitor.cpp
+++ b/src/libs/cplusplus/SymbolNameVisitor.cpp
@@ -31,7 +31,7 @@
using namespace CPlusPlus;
SymbolNameVisitor::SymbolNameVisitor()
- : _symbol(0)
+ : _symbol(nullptr)
{
}
diff --git a/src/libs/cplusplus/TypeOfExpression.cpp b/src/libs/cplusplus/TypeOfExpression.cpp
index 1b3dda8b1c..02f838542c 100644
--- a/src/libs/cplusplus/TypeOfExpression.cpp
+++ b/src/libs/cplusplus/TypeOfExpression.cpp
@@ -38,8 +38,8 @@
using namespace CPlusPlus;
TypeOfExpression::TypeOfExpression():
- m_ast(0),
- m_scope(0),
+ m_ast(nullptr),
+ m_scope(nullptr),
m_expandTemplates(false)
{
}
@@ -50,8 +50,8 @@ void TypeOfExpression::init(Document::Ptr thisDocument, const Snapshot &snapshot
{
m_thisDocument = thisDocument;
m_snapshot = snapshot;
- m_ast = 0;
- m_scope = 0;
+ m_ast = nullptr;
+ m_scope = nullptr;
m_lookupContext = LookupContext();
Q_ASSERT(m_bindings.isNull());
@@ -178,7 +178,7 @@ QByteArray TypeOfExpression::preprocessedExpression(const QByteArray &utf8code)
m_environment = QSharedPointer<Environment>(env);
}
- Preprocessor preproc(0, m_environment.data());
+ Preprocessor preproc(nullptr, m_environment.data());
return preproc.run(QLatin1String("<expression>"), utf8code);
}
@@ -187,7 +187,7 @@ namespace CPlusPlus {
ExpressionAST *extractExpressionAST(Document::Ptr doc)
{
if (! doc->translationUnit()->ast())
- return 0;
+ return nullptr;
return doc->translationUnit()->ast()->asExpression();
}
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index dabbcf0063..c46117dde7 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -169,7 +169,7 @@ void TypePrettyPrinter::visit(Template *type)
const Overview &oo = *overview();
if (oo.showTemplateParameters && ! _name.isEmpty()) {
_name += QLatin1Char('<');
- for (unsigned index = 0; index < type->templateParameterCount(); ++index) {
+ for (int index = 0; index < type->templateParameterCount(); ++index) {
if (index)
_name += QLatin1String(", ");
QString arg = oo.prettyName(type->templateParameterAt(index)->name());
@@ -410,7 +410,7 @@ void TypePrettyPrinter::visit(Function *type)
if (_overview->showEnclosingTemplate) {
if (Template *templ = type->enclosingTemplate()) {
QString templateScope = "template<";
- for (unsigned i = 0, total = templ->templateParameterCount(); i < total; ++i) {
+ for (int i = 0, total = templ->templateParameterCount(); i < total; ++i) {
if (Symbol *param = templ->templateParameterAt(i)) {
if (i > 0)
templateScope.append(", ");
@@ -437,7 +437,7 @@ void TypePrettyPrinter::visit(Function *type)
_text += QLatin1Char('(');
- for (unsigned index = 0, argc = type->argumentCount(); index < argc; ++index) {
+ for (int index = 0, argc = type->argumentCount(); index < argc; ++index) {
if (index != 0)
_text += QLatin1String(", ");
@@ -445,7 +445,7 @@ void TypePrettyPrinter::visit(Function *type)
if (index + 1 == _overview->markedArgument)
const_cast<Overview*>(_overview)->markedArgumentBegin = _text.length();
- const Name *name = 0;
+ const Name *name = nullptr;
if (_overview->showArgumentNames)
name = arg->name();
diff --git a/src/libs/cplusplus/cppmodelmanagerbase.cpp b/src/libs/cplusplus/cppmodelmanagerbase.cpp
index 19703e4fd9..3d8d43d709 100644
--- a/src/libs/cplusplus/cppmodelmanagerbase.cpp
+++ b/src/libs/cplusplus/cppmodelmanagerbase.cpp
@@ -27,7 +27,7 @@
namespace CPlusPlus {
-static CppModelManagerBase *g_instance = 0;
+static CppModelManagerBase *g_instance = nullptr;
CppModelManagerBase::CppModelManagerBase(QObject *parent)
: QObject(parent)
@@ -39,7 +39,7 @@ CppModelManagerBase::CppModelManagerBase(QObject *parent)
CppModelManagerBase::~CppModelManagerBase()
{
Q_ASSERT(g_instance == this);
- g_instance = 0;
+ g_instance = nullptr;
}
CppModelManagerBase *CppModelManagerBase::instance()
@@ -58,9 +58,9 @@ bool CppModelManagerBase::trySetExtraDiagnostics(const QString &fileName, const
bool CppModelManagerBase::setExtraDiagnostics(const QString &fileName, const QString &kind,
const QList<CPlusPlus::Document::DiagnosticMessage> &diagnostics)
{
- Q_UNUSED(fileName);
- Q_UNUSED(kind);
- Q_UNUSED(diagnostics);
+ Q_UNUSED(fileName)
+ Q_UNUSED(kind)
+ Q_UNUSED(diagnostics)
return false;
}
diff --git a/src/libs/cplusplus/cppmodelmanagerbase.h b/src/libs/cplusplus/cppmodelmanagerbase.h
index 680e7e2d06..52d9c9ace2 100644
--- a/src/libs/cplusplus/cppmodelmanagerbase.h
+++ b/src/libs/cplusplus/cppmodelmanagerbase.h
@@ -40,7 +40,7 @@ class CPLUSPLUS_EXPORT CppModelManagerBase : public QObject
{
Q_OBJECT
public:
- CppModelManagerBase(QObject *parent = 0);
+ CppModelManagerBase(QObject *parent = nullptr);
~CppModelManagerBase();
static CppModelManagerBase *instance();
diff --git a/src/libs/cplusplus/findcdbbreakpoint.cpp b/src/libs/cplusplus/findcdbbreakpoint.cpp
index 8943ad0001..54f618a50e 100644
--- a/src/libs/cplusplus/findcdbbreakpoint.cpp
+++ b/src/libs/cplusplus/findcdbbreakpoint.cpp
@@ -39,7 +39,7 @@ FindCdbBreakpoint::FindCdbBreakpoint(TranslationUnit *unit)
{
}
-unsigned FindCdbBreakpoint::searchFrom(unsigned line)
+int FindCdbBreakpoint::searchFrom(int line)
{
m_initialLine = line;
m_breakpointLine = NO_LINE_FOUND;
@@ -51,18 +51,18 @@ unsigned FindCdbBreakpoint::searchFrom(unsigned line)
void FindCdbBreakpoint::foundLine(unsigned tokenIndex)
{
- unsigned dummy = 0;
+ int dummy = 0;
getTokenStartPosition(tokenIndex, &m_breakpointLine, &dummy);
}
-unsigned FindCdbBreakpoint::endLine(unsigned tokenIndex) const
+int FindCdbBreakpoint::endLine(unsigned tokenIndex) const
{
- unsigned line = 0, column = 0;
+ int line = 0, column = 0;
getTokenEndPosition(tokenIndex, &line, &column);
return line;
}
-unsigned FindCdbBreakpoint::endLine(AST *ast) const
+int FindCdbBreakpoint::endLine(AST *ast) const
{
if (ast)
return endLine(ast->lastToken() - 1);
diff --git a/src/libs/cplusplus/findcdbbreakpoint.h b/src/libs/cplusplus/findcdbbreakpoint.h
index 6fb61030e7..0be6ae048d 100644
--- a/src/libs/cplusplus/findcdbbreakpoint.h
+++ b/src/libs/cplusplus/findcdbbreakpoint.h
@@ -33,13 +33,12 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
{
public:
- static const unsigned NO_LINE_FOUND = 0;
+ static const int NO_LINE_FOUND = 0;
public:
FindCdbBreakpoint(TranslationUnit *unit);
- unsigned operator()(unsigned line)
- { return searchFrom(line); }
+ int operator()(int line) { return searchFrom(line); }
/**
* Search for the next breakable line of code.
@@ -49,12 +48,12 @@ public:
* \return the next breakable code line (1-based), or \c NO_LINE_FOUND if
* no line could be found.
*/
- unsigned searchFrom(unsigned line);
+ int searchFrom(int line);
protected:
void foundLine(unsigned tokenIndex);
- unsigned endLine(unsigned tokenIndex) const;
- unsigned endLine(AST *ast) const;
+ int endLine(unsigned tokenIndex) const;
+ int endLine(AST *ast) const;
protected:
using ASTVisitor::visit;
@@ -86,9 +85,9 @@ protected:
bool visit(ObjCSynchronizedStatementAST *ast);
private:
- unsigned m_initialLine;
+ int m_initialLine;
- unsigned m_breakpointLine;
+ int m_breakpointLine;
};
} // namespace CPlusPlus
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index f8874101fe..d1f2d3eaf5 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -343,7 +343,7 @@ class ExpressionEvaluator
public:
ExpressionEvaluator(Client *client, Environment *env)
- : client(client), env(env), _lex(0)
+ : client(client), env(env), _lex(nullptr)
{ }
Value operator()(const Token *firstToken, const Token *lastToken,
@@ -422,7 +422,7 @@ protected:
(*_lex)->byteOffset,
(*_lex)->utf16charOffset,
(*_lex)->lineno, env, client)
- != 0);
+ != nullptr);
++(*_lex);
} else if ((*_lex)->is(T_LPAREN)) {
++(*_lex);
@@ -432,7 +432,7 @@ protected:
(*_lex)->utf16charOffset,
(*_lex)->lineno,
env, client)
- != 0);
+ != nullptr);
++(*_lex);
if ((*_lex)->is(T_RPAREN))
++(*_lex);
@@ -600,21 +600,21 @@ private:
} // end of anonymous namespace
Preprocessor::State::State()
- : m_lexer(0)
+ : m_lexer(nullptr)
, m_skipping(MAX_LEVEL)
, m_trueTest(MAX_LEVEL)
, m_ifLevel(0)
, m_tokenBufferDepth(0)
- , m_tokenBuffer(0)
+ , m_tokenBuffer(nullptr)
, m_inPreprocessorDirective(false)
, m_markExpandedTokens(true)
, m_noLines(false)
, m_inCondition(false)
, m_bytesOffsetRef(0)
, m_utf16charsOffsetRef(0)
- , m_result(0)
+ , m_result(nullptr)
, m_lineRef(1)
- , m_currentExpansion(0)
+ , m_currentExpansion(nullptr)
, m_includeGuardState(IncludeGuardState_BeforeIfndef)
{
m_skipping[m_ifLevel] = false;
@@ -848,7 +848,7 @@ void Preprocessor::handleDefined(PPToken *tk)
void Preprocessor::pushToken(Preprocessor::PPToken *tk)
{
const PPToken currentTokenBuffer[] = {*tk};
- m_state.pushTokenBuffer(currentTokenBuffer, currentTokenBuffer + 1, 0);
+ m_state.pushTokenBuffer(currentTokenBuffer, currentTokenBuffer + 1, nullptr);
}
void Preprocessor::lex(PPToken *tk)
@@ -1321,7 +1321,7 @@ void Preprocessor::trackExpansionCycles(PPToken *tk)
}
}
-static void adjustForCommentOrStringNewlines(unsigned *currentLine, const PPToken &tk)
+static void adjustForCommentOrStringNewlines(int *currentLine, const PPToken &tk)
{
if (tk.isComment() || tk.isStringLiteral())
(*currentLine) += tk.asByteArrayRef().count('\n');
@@ -1343,7 +1343,7 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine)
generateOutputLineMarker(tk.lineno);
}
} else {
- for (unsigned i = m_env->currentLine; i < tk.lineno; ++i)
+ for (int i = m_env->currentLine; i < tk.lineno; ++i)
currentOutputBuffer().append('\n');
}
@@ -1419,7 +1419,7 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
ScopedSwap<QString> savedFileName(m_env->currentFile, fileName);
ScopedSwap<QByteArray> savedUtf8FileName(m_env->currentFileUtf8, fileName.toUtf8());
- ScopedSwap<unsigned> savedCurrentLine(m_env->currentLine, 1);
+ ScopedSwap<int> savedCurrentLine(m_env->currentLine, 1);
if (!m_state.m_noLines)
generateOutputLineMarker(1);
@@ -1774,7 +1774,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
unsigned previousBytesOffset = 0;
unsigned previousUtf16charsOffset = 0;
unsigned previousLine = 0;
- Macro *macroReference = 0;
+ Macro *macroReference = nullptr;
while (isContinuationToken(*tk)) {
// Macro tokens are always marked as expanded. However, only for object-like macros
// we mark them as generated too. For function-like macros we postpone it until the
@@ -1791,7 +1791,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
if (!macroReference->isFunctionLike()) {
m_client->notifyMacroReference(tk->byteOffset, tk->utf16charOffset,
tk->lineno, *macroReference);
- macroReference = 0;
+ macroReference = nullptr;
}
}
} else if (macroReference) {
@@ -1799,7 +1799,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
m_client->notifyMacroReference(previousBytesOffset, previousUtf16charsOffset,
previousLine, *macroReference);
}
- macroReference = 0;
+ macroReference = nullptr;
}
previousBytesOffset = tk->byteOffset;
@@ -1870,7 +1870,7 @@ QByteArray Preprocessor::expand(PPToken *tk, PPToken *lastConditionToken)
// qDebug("*** Condition before: [%s]", condition.constData());
QByteArray result;
result.reserve(256);
- preprocess(m_state.m_currentFileName, condition, &result, 0, true, false, true,
+ preprocess(m_state.m_currentFileName, condition, &result, nullptr, true, false, true,
bytesBegin, utf16charsBegin, line);
result.squeeze();
// qDebug("*** Condition after: [%s]", result.constData());
diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h
index fb9cdda2b2..8902cb7624 100644
--- a/src/libs/cplusplus/pp-engine.h
+++ b/src/libs/cplusplus/pp-engine.h
@@ -133,7 +133,7 @@ private:
unsigned m_bytesOffsetRef;
unsigned m_utf16charsOffsetRef;
QByteArray *m_result;
- unsigned m_lineRef;
+ int m_lineRef;
ExpansionStatus m_expansionStatus;
void setExpansionStatus(ExpansionStatus status)
@@ -181,7 +181,7 @@ private:
/// \param idToken the identifier token that ought to be in the input
/// after a #ifndef or a #define .
inline void updateIncludeGuardState(IncludeGuardStateHint hint,
- PPToken *idToken = 0)
+ PPToken *idToken = nullptr)
{
// some quick checks for the majority of the uninteresting cases:
if (m_includeGuardState == IncludeGuardState_NoGuard)
@@ -227,7 +227,7 @@ private:
void handlePreprocessorDirective(PPToken *tk);
void handleIncludeDirective(PPToken *tk, bool includeNext);
void handleDefineDirective(PPToken *tk);
- QByteArray expand(PPToken *tk, PPToken *lastConditionToken = 0);
+ QByteArray expand(PPToken *tk, PPToken *lastConditionToken = nullptr);
const Internal::PPToken evalExpression(PPToken *tk, Value &result);
void handleIfDirective(PPToken *tk);
void handleElifDirective(PPToken *tk, const PPToken &poundToken);
diff --git a/src/libs/extensionsystem/CMakeLists.txt b/src/libs/extensionsystem/CMakeLists.txt
index 864c57c1ae..53f928153c 100644
--- a/src/libs/extensionsystem/CMakeLists.txt
+++ b/src/libs/extensionsystem/CMakeLists.txt
@@ -1,6 +1,6 @@
add_qtc_library(ExtensionSystem
- DEPENDS Aggregation Utils Qt5::Core Qt5::Widgets
- PUBLIC_DEPENDS Qt5::Core
+ DEPENDS Aggregation Utils
+ PUBLIC_DEPENDS Qt5::Core Qt5::Widgets
SOURCES
extensionsystem_global.h
invoker.cpp invoker.h
diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp
index 2a020a384d..e5633e860b 100644
--- a/src/libs/extensionsystem/pluginmanager.cpp
+++ b/src/libs/extensionsystem/pluginmanager.cpp
@@ -48,6 +48,7 @@
#include <utils/algorithm.h>
#include <utils/benchmarker.h>
#include <utils/executeondestruction.h>
+#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
@@ -353,6 +354,15 @@ bool PluginManager::hasError()
});
}
+const QStringList PluginManager::allErrors()
+{
+ return Utils::transform<QStringList>(Utils::filtered(plugins(), [](const PluginSpec *spec) {
+ return spec->hasError() && spec->isEffectivelyEnabled();
+ }), [](const PluginSpec *spec) {
+ return spec->name().append(": ").append(spec->errorString());
+ });
+}
+
/*!
Returns all plugins that require \a spec to be loaded. Recurses into dependencies.
*/
@@ -380,9 +390,8 @@ QSet<PluginSpec *> PluginManager::pluginsRequiredByPlugin(PluginSpec *spec)
while (!queue.empty()) {
PluginSpec *checkSpec = queue.front();
queue.pop();
- QHashIterator<PluginDependency, PluginSpec *> depIt(checkSpec->dependencySpecs());
- while (depIt.hasNext()) {
- depIt.next();
+ const QHash<PluginDependency, PluginSpec *> deps = checkSpec->dependencySpecs();
+ for (auto depIt = deps.cbegin(), end = deps.cend(); depIt != end; ++depIt) {
if (depIt.key().type != PluginDependency::Required)
continue;
PluginSpec *depSpec = depIt.value();
@@ -412,10 +421,10 @@ static QString filled(const QString &s, int min)
QString PluginManager::systemInformation() const
{
QString result;
- const QString qtdiagBinary = HostOsInfo::withExecutableSuffix(
- QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag");
+ CommandLine qtDiag(HostOsInfo::withExecutableSuffix(
+ QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag"));
SynchronousProcess qtdiagProc;
- const SynchronousProcessResponse response = qtdiagProc.runBlocking(qtdiagBinary, QStringList());
+ const SynchronousProcessResponse response = qtdiagProc.runBlocking(qtDiag);
if (response.result == SynchronousProcessResponse::Finished)
result += response.allOutput() + "\n";
result += "Plugin information:\n\n";
@@ -923,7 +932,6 @@ void PluginManagerPrivate::deleteAll()
#ifdef WITH_TESTS
using TestPlan = QMap<QObject *, QStringList>; // Object -> selected test functions
-using TestPlanIterator = QMapIterator<QObject *, QStringList>;
static bool isTestFunction(const QMetaMethod &metaMethod)
{
@@ -1009,9 +1017,7 @@ static int executeTestPlan(const TestPlan &testPlan)
{
int failedTests = 0;
- TestPlanIterator it(testPlan);
- while (it.hasNext()) {
- it.next();
+ for (auto it = testPlan.cbegin(), end = testPlan.cend(); it != end; ++it) {
QObject *testObject = it.key();
QStringList functions = it.value();
@@ -1119,8 +1125,9 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin,
void PluginManagerPrivate::startTests()
{
if (PluginManager::hasError()) {
- qWarning("Errors occurred while loading plugins, skipping test run. "
- "For details, start without \"-test\" option.");
+ qWarning("Errors occurred while loading plugins, skipping test run.");
+ for (const QString &pluginError : PluginManager::allErrors())
+ qWarning("%s", qPrintable(pluginError));
QTimer::singleShot(1, QCoreApplication::instance(), &QCoreApplication::quit);
return;
}
@@ -1315,9 +1322,8 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec,
}
// add dependencies
- QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
- while (it.hasNext()) {
- it.next();
+ const QHash<PluginDependency, PluginSpec *> deps = spec->dependencySpecs();
+ for (auto it = deps.cbegin(), end = deps.cend(); it != end; ++it) {
// Skip test dependencies since they are not real dependencies but just force-loaded
// plugins when running tests
if (it.key().type == PluginDependency::Test)
@@ -1363,9 +1369,8 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt
break;
}
// check if dependencies have loaded without error
- QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
- while (it.hasNext()) {
- it.next();
+ const QHash<PluginDependency, PluginSpec *> deps = spec->dependencySpecs();
+ for (auto it = deps.cbegin(), end = deps.cend(); it != end; ++it) {
if (it.key().type != PluginDependency::Required)
continue;
PluginSpec *depSpec = it.value();
diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h
index c926d07f4a..d65571bfb7 100644
--- a/src/libs/extensionsystem/pluginmanager.h
+++ b/src/libs/extensionsystem/pluginmanager.h
@@ -93,6 +93,7 @@ public:
static const QVector<PluginSpec *> plugins();
static QHash<QString, QVector<PluginSpec *>> pluginCollections();
static bool hasError();
+ static const QStringList allErrors();
static QSet<PluginSpec *> pluginsRequiringPlugin(PluginSpec *spec);
static QSet<PluginSpec *> pluginsRequiredByPlugin(PluginSpec *spec);
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp
index b8d0643982..4f1c2683e9 100644
--- a/src/libs/extensionsystem/pluginspec.cpp
+++ b/src/libs/extensionsystem/pluginspec.cpp
@@ -929,9 +929,7 @@ QVector<PluginSpec *> PluginSpecPrivate::enableDependenciesIndirectly(bool enabl
if (!q->isEffectivelyEnabled()) // plugin not enabled, nothing to do
return {};
QVector<PluginSpec *> enabled;
- QHashIterator<PluginDependency, PluginSpec *> it(dependencySpecs);
- while (it.hasNext()) {
- it.next();
+ for (auto it = dependencySpecs.cbegin(), end = dependencySpecs.cend(); it != end; ++it) {
if (it.key().type != PluginDependency::Required
&& (!enableTestDependencies || it.key().type != PluginDependency::Test))
continue;
diff --git a/src/libs/glsl/glslast.cpp b/src/libs/glsl/glslast.cpp
index f85486a836..d3375bee43 100644
--- a/src/libs/glsl/glslast.cpp
+++ b/src/libs/glsl/glslast.cpp
@@ -325,7 +325,7 @@ void StructTypeAST::Field::setInnerType(TypeAST *innerType)
return;
TypeAST **parent = &type;
TypeAST *inner = type;
- while (inner != 0) {
+ while (inner != nullptr) {
ArrayTypeAST *array = inner->asArrayType();
if (!array)
break;
@@ -388,7 +388,7 @@ void VariableDeclarationAST::accept0(Visitor *visitor)
TypeAST *VariableDeclarationAST::declarationType(List<DeclarationAST *> *decls)
{
VariableDeclarationAST *var = decls->value->asVariableDeclaration();
- return var ? var->type : 0;
+ return var ? var->type : nullptr;
}
void TypeDeclarationAST::accept0(Visitor *visitor)
diff --git a/src/libs/glsl/glslastdump.cpp b/src/libs/glsl/glslastdump.cpp
index 9cd210dabe..9cc25c4f06 100644
--- a/src/libs/glsl/glslastdump.cpp
+++ b/src/libs/glsl/glslastdump.cpp
@@ -49,7 +49,7 @@ bool ASTDump::preVisit(AST *ast)
{
const char *id = typeid(*ast).name();
#ifdef Q_CC_GNU
- char *cppId = abi::__cxa_demangle(id, 0, 0, 0);
+ char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr);
id = cppId;
#endif
out << QByteArray(_depth, ' ') << id << endl;
diff --git a/src/libs/glsl/glslengine.h b/src/libs/glsl/glslengine.h
index 7cf6e2d164..0942d5ef57 100644
--- a/src/libs/glsl/glslengine.h
+++ b/src/libs/glsl/glslengine.h
@@ -112,9 +112,9 @@ public:
// symbols
Namespace *newNamespace();
- Struct *newStruct(Scope *scope = 0);
- Block *newBlock(Scope *scope = 0);
- Function *newFunction(Scope *scope = 0);
+ Struct *newStruct(Scope *scope = nullptr);
+ Block *newBlock(Scope *scope = nullptr);
+ Function *newFunction(Scope *scope = nullptr);
Argument *newArgument(Function *function, const QString &name, const Type *type);
Variable *newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers = 0);
diff --git a/src/libs/glsl/glsllexer.cpp b/src/libs/glsl/glsllexer.cpp
index 6042e3ddee..afaad6dc9d 100644
--- a/src/libs/glsl/glsllexer.cpp
+++ b/src/libs/glsl/glsllexer.cpp
@@ -60,9 +60,9 @@ void Lexer::yyinp()
int Lexer::yylex(Token *tk)
{
- const char *pos = 0;
+ const char *pos = nullptr;
int line = 0;
- _yyval.ptr = 0;
+ _yyval.ptr = nullptr;
const int kind = yylex_helper(&pos, &line);
tk->kind = kind;
tk->position = pos - _source;
diff --git a/src/libs/glsl/glsllexer.h b/src/libs/glsl/glsllexer.h
index 2b0ad83fed..3dcbe2168b 100644
--- a/src/libs/glsl/glsllexer.h
+++ b/src/libs/glsl/glsllexer.h
@@ -47,7 +47,7 @@ public:
};
Token()
- : kind(0), position(0), length(0), line(0), ptr(0) {}
+ : kind(0), position(0), length(0), line(0), ptr(nullptr) {}
bool is(int k) const { return k == kind; }
bool isNot(int k) const { return k != kind; }
diff --git a/src/libs/glsl/glslmemorypool.cpp b/src/libs/glsl/glslmemorypool.cpp
index dc681565df..7e4829a6e6 100644
--- a/src/libs/glsl/glslmemorypool.cpp
+++ b/src/libs/glsl/glslmemorypool.cpp
@@ -30,11 +30,11 @@
using namespace GLSL;
MemoryPool::MemoryPool()
- : _blocks(0),
+ : _blocks(nullptr),
_allocatedBlocks(0),
_blockCount(-1),
- _ptr(0),
- _end(0)
+ _ptr(nullptr),
+ _end(nullptr)
{ }
MemoryPool::~MemoryPool()
@@ -52,7 +52,7 @@ MemoryPool::~MemoryPool()
void MemoryPool::reset()
{
_blockCount = -1;
- _ptr = _end = 0;
+ _ptr = _end = nullptr;
}
void *MemoryPool::allocate_helper(size_t size)
@@ -68,7 +68,7 @@ void *MemoryPool::allocate_helper(size_t size)
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
- _blocks[index] = 0;
+ _blocks[index] = nullptr;
}
char *&block = _blocks[_blockCount];
diff --git a/src/libs/glsl/glslparser.cpp b/src/libs/glsl/glslparser.cpp
index f435032999..17dc26c61f 100644
--- a/src/libs/glsl/glslparser.cpp
+++ b/src/libs/glsl/glslparser.cpp
@@ -104,7 +104,7 @@ AST *Parser::parse(int startToken)
int action = 0;
yytoken = -1;
yyloc = -1;
- void *yyval = 0; // value of the current token.
+ void *yyval = nullptr; // value of the current token.
_recovered = false;
_tos = -1;
@@ -204,7 +204,7 @@ AST *Parser::parse(int startToken)
else if (*tptr == T_NUMBER || *tptr == T_TYPE_NAME)
yyval = (void *) _engine->identifier(QLatin1String("$0"));
else
- yyval = 0;
+ yyval = nullptr;
_symStack[_tos].ptr = yyval;
_locationStack[_tos] = yyloc;
@@ -224,7 +224,7 @@ AST *Parser::parse(int startToken)
} while (action);
- return 0;
+ return nullptr;
}
#line 643 "./glsl.g"
@@ -347,14 +347,14 @@ case 17: {
case 18: {
sym(1).function.id = sym(1).function_identifier;
- sym(1).function.arguments = 0;
+ sym(1).function.arguments = nullptr;
} break;
#line 788 "./glsl.g"
case 19: {
sym(1).function.id = sym(1).function_identifier;
- sym(1).function.arguments = 0;
+ sym(1).function.arguments = nullptr;
} break;
#line 796 "./glsl.g"
@@ -815,7 +815,7 @@ case 87: {
case 88: {
TypeAST *type = makeAstNode<QualifiedTypeAST>
- (sym(1).type_qualifier.qualifier, (TypeAST *)0,
+ (sym(1).type_qualifier.qualifier, (TypeAST *)nullptr,
sym(1).type_qualifier.layout_list);
ast(1) = makeAstNode<TypeDeclarationAST>(type);
} break;
@@ -878,7 +878,7 @@ case 97: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(makeAstNode<QualifiedTypeAST>
(sym(1).qualifier, sym(3).param_declarator.type,
- (List<LayoutQualifierAST *> *)0),
+ (List<LayoutQualifierAST *> *)nullptr),
ParameterDeclarationAST::Qualifier(sym(2).qualifier),
sym(3).param_declarator.name);
} break;
@@ -897,9 +897,9 @@ case 98: {
case 99: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(makeAstNode<QualifiedTypeAST>
- (sym(1).qualifier, type(3), (List<LayoutQualifierAST *> *)0),
+ (sym(1).qualifier, type(3), (List<LayoutQualifierAST *> *)nullptr),
ParameterDeclarationAST::Qualifier(sym(2).qualifier),
- (const QString *)0);
+ (const QString *)nullptr);
} break;
#line 1421 "./glsl.g"
@@ -907,7 +907,7 @@ case 99: {
case 100: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(type(2), ParameterDeclarationAST::Qualifier(sym(1).qualifier),
- (const QString *)0);
+ (const QString *)nullptr);
} break;
#line 1430 "./glsl.g"
@@ -1065,7 +1065,7 @@ case 120: {
#line 1602 "./glsl.g"
case 121: {
- ast(1) = makeAstNode<QualifiedTypeAST>(0, type(1), (List<LayoutQualifierAST *> *)0);
+ ast(1) = makeAstNode<QualifiedTypeAST>(0, type(1), (List<LayoutQualifierAST *> *)nullptr);
} break;
#line 1609 "./glsl.g"
@@ -1121,7 +1121,7 @@ case 129: {
#line 1667 "./glsl.g"
case 130: {
- sym(1).layout = makeAstNode<LayoutQualifierAST>(string(1), (const QString *)0);
+ sym(1).layout = makeAstNode<LayoutQualifierAST>(string(1), (const QString *)nullptr);
} break;
#line 1674 "./glsl.g"
@@ -1140,7 +1140,7 @@ case 132: {
case 133: {
sym(1).type_qualifier.qualifier = sym(1).qualifier;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1696 "./glsl.g"
@@ -1161,35 +1161,35 @@ case 135: {
case 136: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1720 "./glsl.g"
case 137: {
sym(1).type_qualifier.qualifier = sym(1).qualifier;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1728 "./glsl.g"
case 138: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1736 "./glsl.g"
case 139: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier | sym(3).qualifier;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1744 "./glsl.g"
case 140: {
sym(1).type_qualifier.qualifier = QualifiedTypeAST::Invariant;
- sym(1).type_qualifier.layout_list = 0;
+ sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1752 "./glsl.g"
@@ -1905,14 +1905,14 @@ case 257: {
case 258: {
sym(1).field = makeAstNode<StructTypeAST::Field>
- (string(1), makeAstNode<ArrayTypeAST>((TypeAST *)0));
+ (string(1), makeAstNode<ArrayTypeAST>((TypeAST *)nullptr));
} break;
#line 2586 "./glsl.g"
case 259: {
sym(1).field = makeAstNode<StructTypeAST::Field>
- (string(1), makeAstNode<ArrayTypeAST>((TypeAST *)0, expression(3)));
+ (string(1), makeAstNode<ArrayTypeAST>((TypeAST *)nullptr, expression(3)));
} break;
#line 2594 "./glsl.g"
@@ -2070,7 +2070,7 @@ case 282: {
case 283: {
sym(1).ifstmt.thenClause = statement(1);
- sym(1).ifstmt.elseClause = 0;
+ sym(1).ifstmt.elseClause = nullptr;
} break;
#line 2776 "./glsl.g"
@@ -2162,7 +2162,7 @@ case 297: {
case 298: {
sym(1).forstmt.condition = expression(1);
- sym(1).forstmt.increment = 0;
+ sym(1).forstmt.increment = nullptr;
} break;
#line 2883 "./glsl.g"
@@ -2215,7 +2215,7 @@ case 306: {
sym(1).declaration_list = makeAstNode< List<DeclarationAST *> >
(sym(1).declaration);
} else {
- sym(1).declaration_list = 0;
+ sym(1).declaration_list = nullptr;
}
} break;
@@ -2230,7 +2230,7 @@ case 307: {
sym(1).declaration_list = makeAstNode< List<DeclarationAST *> >
(sym(2).declaration);
} else {
- sym(1).declaration_list = 0;
+ sym(1).declaration_list = nullptr;
}
}
} break;
@@ -2250,7 +2250,7 @@ case 309: {
#line 2976 "./glsl.g"
case 310: {
- ast(1) = 0;
+ ast(1) = nullptr;
} break;
#line 2983 "./glsl.g"
@@ -2262,7 +2262,7 @@ case 311: {
#line 2990 "./glsl.g"
case 312: {
- ast(1) = 0;
+ ast(1) = nullptr;
} break;
#line 2998 "./glsl.g"
diff --git a/src/libs/glsl/glslparser.h b/src/libs/glsl/glslparser.h
index 5e148c298b..65003e6974 100644
--- a/src/libs/glsl/glslparser.h
+++ b/src/libs/glsl/glslparser.h
@@ -91,13 +91,13 @@ public:
TranslationUnitAST *parse() {
if (AST *u = parse(T_FEED_GLSL))
return u->asTranslationUnit();
- return 0;
+ return nullptr;
}
ExpressionAST *parseExpression() {
if (AST *u = parse(T_FEED_EXPRESSION))
return u->asExpression();
- return 0;
+ return nullptr;
}
AST *parse(int startToken);
diff --git a/src/libs/glsl/glslsemantic.cpp b/src/libs/glsl/glslsemantic.cpp
index ae03ca148a..4db1c0e32c 100644
--- a/src/libs/glsl/glslsemantic.cpp
+++ b/src/libs/glsl/glslsemantic.cpp
@@ -33,9 +33,9 @@
using namespace GLSL;
Semantic::Semantic()
- : _engine(0)
- , _scope(0)
- , _type(0)
+ : _engine(nullptr)
+ , _scope(nullptr)
+ , _type(nullptr)
{
}
@@ -118,7 +118,7 @@ Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast)
if (ast) {
if (ast->name) {
if (Symbol *s = _scope->lookup(*ast->name)) {
- if (s->asOverloadSet() != 0 || s->asFunction() != 0)
+ if (s->asOverloadSet() != nullptr || s->asFunction() != nullptr)
result.type = s->type();
else
_engine->error(ast->lineno, QString::fromLatin1("`%1' cannot be used as a function").arg(*ast->name));
@@ -156,21 +156,21 @@ void Semantic::parameterDeclaration(ParameterDeclarationAST *ast, Function *fun)
bool Semantic::visit(TranslationUnitAST *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
Q_ASSERT(!"unreachable");
return false;
}
bool Semantic::visit(FunctionIdentifierAST *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
Q_ASSERT(!"unreachable");
return false;
}
bool Semantic::visit(StructTypeAST::Field *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
Q_ASSERT(!"unreachable");
return false;
}
@@ -308,33 +308,33 @@ bool Semantic::implicitCast(const Type *type, const Type *target) const
return false;
} else if (type->isEqualTo(target)) {
return true;
- } else if (target->asUIntType() != 0) {
- return type->asIntType() != 0;
- } else if (target->asFloatType() != 0) {
- return type->asIntType() != 0 ||
- type->asUIntType() != 0;
- } else if (target->asDoubleType() != 0) {
- return type->asIntType() != 0 ||
- type->asUIntType() != 0 ||
- type->asFloatType() != 0;
+ } else if (target->asUIntType() != nullptr) {
+ return type->asIntType() != nullptr;
+ } else if (target->asFloatType() != nullptr) {
+ return type->asIntType() != nullptr ||
+ type->asUIntType() != nullptr;
+ } else if (target->asDoubleType() != nullptr) {
+ return type->asIntType() != nullptr ||
+ type->asUIntType() != nullptr ||
+ type->asFloatType() != nullptr;
} else if (const VectorType *targetVecTy = target->asVectorType()) {
if (const VectorType *vecTy = type->asVectorType()) {
if (targetVecTy->dimension() == vecTy->dimension()) {
const Type *targetElementType = targetVecTy->elementType();
const Type *elementType = vecTy->elementType();
- if (targetElementType->asUIntType() != 0) {
+ if (targetElementType->asUIntType() != nullptr) {
// uvec* -> ivec*
- return elementType->asIntType() != 0;
- } else if (targetElementType->asFloatType() != 0) {
+ return elementType->asIntType() != nullptr;
+ } else if (targetElementType->asFloatType() != nullptr) {
// vec* -> ivec* | uvec*
- return elementType->asIntType() != 0 ||
- elementType->asUIntType() != 0;
- } else if (targetElementType->asDoubleType() != 0) {
+ return elementType->asIntType() != nullptr ||
+ elementType->asUIntType() != nullptr;
+ } else if (targetElementType->asDoubleType() != nullptr) {
// dvec* -> ivec* | uvec* | fvec*
- return elementType->asIntType() != 0 ||
- elementType->asUIntType() != 0 ||
- elementType->asFloatType() != 0;
+ return elementType->asIntType() != nullptr ||
+ elementType->asUIntType() != nullptr ||
+ elementType->asFloatType() != nullptr;
}
}
}
@@ -345,9 +345,9 @@ bool Semantic::implicitCast(const Type *type, const Type *target) const
const Type *targetElementType = targetMatTy->elementType();
const Type *elementType = matTy->elementType();
- if (targetElementType->asDoubleType() != 0) {
+ if (targetElementType->asDoubleType() != nullptr) {
// dmat* -> mat*
- return elementType->asFloatType() != 0;
+ return elementType->asFloatType() != nullptr;
}
}
}
@@ -413,7 +413,7 @@ bool Semantic::visit(FunctionCallExpressionAST *ast)
bool Semantic::visit(DeclarationExpressionAST *ast)
{
const Type *ty = type(ast->type);
- Q_UNUSED(ty);
+ Q_UNUSED(ty)
// ast->name
ExprResult initializer = expression(ast->initializer);
return false;
@@ -473,7 +473,7 @@ bool Semantic::visit(ForStatementAST *ast)
bool Semantic::visit(JumpStatementAST *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
return false;
}
@@ -750,7 +750,7 @@ bool Semantic::visit(NamedTypeAST *ast)
bool Semantic::visit(ArrayTypeAST *ast)
{
const Type *elementType = type(ast->elementType);
- Q_UNUSED(elementType);
+ Q_UNUSED(elementType)
ExprResult size = expression(ast->size);
_type = _engine->arrayType(elementType); // ### ignore the size for now
return false;
@@ -780,7 +780,7 @@ bool Semantic::visit(QualifiedTypeAST *ast)
LayoutQualifierAST *q = it->value;
// q->name;
// q->number;
- Q_UNUSED(q);
+ Q_UNUSED(q)
}
return false;
}
@@ -790,13 +790,13 @@ bool Semantic::visit(QualifiedTypeAST *ast)
bool Semantic::visit(PrecisionDeclarationAST *ast)
{
const Type *ty = type(ast->type);
- Q_UNUSED(ty);
+ Q_UNUSED(ty)
return false;
}
bool Semantic::visit(ParameterDeclarationAST *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
Q_ASSERT(!"unreachable");
return false;
}
@@ -822,7 +822,7 @@ bool Semantic::visit(VariableDeclarationAST *ast)
bool Semantic::visit(TypeDeclarationAST *ast)
{
const Type *ty = type(ast->type);
- Q_UNUSED(ty);
+ Q_UNUSED(ty)
return false;
}
@@ -835,7 +835,7 @@ bool Semantic::visit(TypeAndVariableDeclarationAST *ast)
bool Semantic::visit(InvariantDeclarationAST *ast)
{
- Q_UNUSED(ast);
+ Q_UNUSED(ast)
return false;
}
diff --git a/src/libs/glsl/glslsemantic.h b/src/libs/glsl/glslsemantic.h
index 05d1c664a4..78eec83843 100644
--- a/src/libs/glsl/glslsemantic.h
+++ b/src/libs/glsl/glslsemantic.h
@@ -37,7 +37,7 @@ public:
~Semantic() override;
struct ExprResult {
- ExprResult(const Type *type = 0, bool isConstant = false)
+ ExprResult(const Type *type = nullptr, bool isConstant = false)
: type(type), isConstant(isConstant) {}
~ExprResult() { }
@@ -45,7 +45,7 @@ public:
bool isValid() const {
if (! type)
return false;
- else if (type->asUndefinedType() != 0)
+ else if (type->asUndefinedType() != nullptr)
return false;
return true;
}
diff --git a/src/libs/glsl/glslsymbol.cpp b/src/libs/glsl/glslsymbol.cpp
index 80f310ecad..30808f4e63 100644
--- a/src/libs/glsl/glslsymbol.cpp
+++ b/src/libs/glsl/glslsymbol.cpp
@@ -69,7 +69,7 @@ Symbol *Scope::lookup(const QString &name) const
else if (Scope *s = scope())
return s->lookup(name);
else
- return 0;
+ return nullptr;
}
QList<Symbol *> Scope::members() const
diff --git a/src/libs/glsl/glslsymbol.h b/src/libs/glsl/glslsymbol.h
index 51bb070e5a..4d965fce1e 100644
--- a/src/libs/glsl/glslsymbol.h
+++ b/src/libs/glsl/glslsymbol.h
@@ -36,7 +36,7 @@ class Scope;
class GLSL_EXPORT Symbol
{
public:
- Symbol(Scope *scope = 0);
+ Symbol(Scope *scope = nullptr);
virtual ~Symbol();
Scope *scope() const;
@@ -45,14 +45,14 @@ public:
QString name() const;
void setName(const QString &name);
- virtual Scope *asScope() { return 0; }
- virtual Struct *asStruct() { return 0; }
- virtual Function *asFunction() { return 0; }
- virtual Argument *asArgument() { return 0; }
- virtual Block *asBlock() { return 0; }
- virtual Variable *asVariable() { return 0; }
- virtual OverloadSet *asOverloadSet() { return 0; }
- virtual Namespace *asNamespace() { return 0; }
+ virtual Scope *asScope() { return nullptr; }
+ virtual Struct *asStruct() { return nullptr; }
+ virtual Function *asFunction() { return nullptr; }
+ virtual Argument *asArgument() { return nullptr; }
+ virtual Block *asBlock() { return nullptr; }
+ virtual Variable *asVariable() { return nullptr; }
+ virtual OverloadSet *asOverloadSet() { return nullptr; }
+ virtual Namespace *asNamespace() { return nullptr; }
virtual const Type *type() const = 0;
@@ -64,7 +64,7 @@ private:
class GLSL_EXPORT Scope: public Symbol
{
public:
- Scope(Scope *sscope = 0);
+ Scope(Scope *sscope = nullptr);
Symbol *lookup(const QString &name) const;
diff --git a/src/libs/glsl/glslsymbols.cpp b/src/libs/glsl/glslsymbols.cpp
index 20d7084c2d..6dc5ec60e2 100644
--- a/src/libs/glsl/glslsymbols.cpp
+++ b/src/libs/glsl/glslsymbols.cpp
@@ -31,7 +31,7 @@ using namespace GLSL;
Argument::Argument(Function *scope)
: Symbol(scope)
- , _type(0)
+ , _type(nullptr)
{
}
@@ -63,7 +63,7 @@ void Block::add(Symbol *symbol)
const Type *Block::type() const
{
// ### assert?
- return 0;
+ return nullptr;
}
Symbol *Block::find(const QString &name) const
@@ -73,7 +73,7 @@ Symbol *Block::find(const QString &name) const
Variable::Variable(Scope *scope)
: Symbol(scope)
- , _type(0)
+ , _type(nullptr)
, _qualifiers(0)
{
}
@@ -127,7 +127,7 @@ void Namespace::add(Symbol *symbol)
const Type *Namespace::type() const
{
- return 0;
+ return nullptr;
}
Symbol *Namespace::find(const QString &name) const
diff --git a/src/libs/glsl/glslsymbols.h b/src/libs/glsl/glslsymbols.h
index 60cce39db8..84983aba4e 100644
--- a/src/libs/glsl/glslsymbols.h
+++ b/src/libs/glsl/glslsymbols.h
@@ -68,7 +68,7 @@ private:
class GLSL_EXPORT Block: public Scope
{
public:
- Block(Scope *enclosingScope = 0);
+ Block(Scope *enclosingScope = nullptr);
QList<Symbol *> members() const override;
void add(Symbol *symbol) override;
diff --git a/src/libs/glsl/glsltype.h b/src/libs/glsl/glsltype.h
index 94aa422937..4035cc8cdb 100644
--- a/src/libs/glsl/glsltype.h
+++ b/src/libs/glsl/glsltype.h
@@ -36,23 +36,23 @@ public:
virtual QString toString() const = 0;
- virtual const UndefinedType *asUndefinedType() const { return 0; }
- virtual const VoidType *asVoidType() const { return 0; }
- virtual const BoolType *asBoolType() const { return 0; }
- virtual const IntType *asIntType() const { return 0; }
- virtual const UIntType *asUIntType() const { return 0; }
- virtual const FloatType *asFloatType() const { return 0; }
- virtual const DoubleType *asDoubleType() const { return 0; }
- virtual const ScalarType *asScalarType() const { return 0; }
- virtual const IndexType *asIndexType() const { return 0; }
- virtual const VectorType *asVectorType() const { return 0; }
- virtual const MatrixType *asMatrixType() const { return 0; }
- virtual const ArrayType *asArrayType() const { return 0; }
- virtual const SamplerType *asSamplerType() const { return 0; }
- virtual const OverloadSet *asOverloadSetType() const { return 0; }
-
- virtual const Struct *asStructType() const { return 0; }
- virtual const Function *asFunctionType() const { return 0; }
+ virtual const UndefinedType *asUndefinedType() const { return nullptr; }
+ virtual const VoidType *asVoidType() const { return nullptr; }
+ virtual const BoolType *asBoolType() const { return nullptr; }
+ virtual const IntType *asIntType() const { return nullptr; }
+ virtual const UIntType *asUIntType() const { return nullptr; }
+ virtual const FloatType *asFloatType() const { return nullptr; }
+ virtual const DoubleType *asDoubleType() const { return nullptr; }
+ virtual const ScalarType *asScalarType() const { return nullptr; }
+ virtual const IndexType *asIndexType() const { return nullptr; }
+ virtual const VectorType *asVectorType() const { return nullptr; }
+ virtual const MatrixType *asMatrixType() const { return nullptr; }
+ virtual const ArrayType *asArrayType() const { return nullptr; }
+ virtual const SamplerType *asSamplerType() const { return nullptr; }
+ virtual const OverloadSet *asOverloadSetType() const { return nullptr; }
+
+ virtual const Struct *asStructType() const { return nullptr; }
+ virtual const Function *asFunctionType() const { return nullptr; }
virtual bool isEqualTo(const Type *other) const = 0;
virtual bool isLessThan(const Type *other) const = 0;
diff --git a/src/libs/glsl/glsltypes.cpp b/src/libs/glsl/glsltypes.cpp
index 6bd4cd4552..f05bfb6784 100644
--- a/src/libs/glsl/glsltypes.cpp
+++ b/src/libs/glsl/glsltypes.cpp
@@ -32,119 +32,119 @@ using namespace GLSL;
bool UndefinedType::isEqualTo(const Type *other) const
{
- if (other && other->asUndefinedType() != 0)
+ if (other && other->asUndefinedType() != nullptr)
return true;
return false;
}
bool UndefinedType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asUndefinedType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asUndefinedType() != nullptr);
return false;
}
bool VoidType::isEqualTo(const Type *other) const
{
- if (other && other->asVoidType() != 0)
+ if (other && other->asVoidType() != nullptr)
return true;
return false;
}
bool VoidType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asVoidType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asVoidType() != nullptr);
return false;
}
bool BoolType::isEqualTo(const Type *other) const
{
- if (other && other->asBoolType() != 0)
+ if (other && other->asBoolType() != nullptr)
return true;
return false;
}
bool BoolType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asBoolType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asBoolType() != nullptr);
return false;
}
bool IntType::isEqualTo(const Type *other) const
{
- if (other && other->asIntType() != 0)
+ if (other && other->asIntType() != nullptr)
return true;
return false;
}
bool IntType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asIntType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asIntType() != nullptr);
return false;
}
bool UIntType::isEqualTo(const Type *other) const
{
- if (other && other->asUIntType() != 0)
+ if (other && other->asUIntType() != nullptr)
return true;
return false;
}
bool UIntType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asUIntType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asUIntType() != nullptr);
return false;
}
bool FloatType::isEqualTo(const Type *other) const
{
- if (other && other->asFloatType() != 0)
+ if (other && other->asFloatType() != nullptr)
return true;
return false;
}
bool FloatType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asFloatType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asFloatType() != nullptr);
return false;
}
bool DoubleType::isEqualTo(const Type *other) const
{
- if (other && other->asDoubleType() != 0)
+ if (other && other->asDoubleType() != nullptr)
return true;
return false;
}
bool DoubleType::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
- Q_ASSERT(other != 0);
- Q_ASSERT(other->asDoubleType() != 0);
+ Q_UNUSED(other)
+ Q_ASSERT(other != nullptr);
+ Q_ASSERT(other->asDoubleType() != nullptr);
return false;
}
QString VectorType::toString() const
{
const char *prefix = "";
- if (elementType()->asBoolType() != 0)
+ if (elementType()->asBoolType() != nullptr)
prefix = "b";
- else if (elementType()->asIntType() != 0)
+ else if (elementType()->asIntType() != nullptr)
prefix = "i'";
- else if (elementType()->asUIntType() != 0)
+ else if (elementType()->asUIntType() != nullptr)
prefix = "u";
- else if (elementType()->asDoubleType() != 0)
+ else if (elementType()->asDoubleType() != nullptr)
prefix = "d";
return QString::fromLatin1("%1vec%2").arg(QLatin1String(prefix)).arg(_dimension);
}
@@ -249,9 +249,9 @@ bool VectorType::isEqualTo(const Type *other) const
bool VectorType::isLessThan(const Type *other) const
{
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != nullptr);
const VectorType *vec = other->asVectorType();
- Q_ASSERT(vec != 0);
+ Q_ASSERT(vec != nullptr);
if (_dimension < vec->dimension())
return true;
else if (_dimension == vec->dimension() && elementType() < vec->elementType())
@@ -262,13 +262,13 @@ bool VectorType::isLessThan(const Type *other) const
QString MatrixType::toString() const
{
const char *prefix = "";
- if (elementType()->asBoolType() != 0)
+ if (elementType()->asBoolType() != nullptr)
prefix = "b";
- else if (elementType()->asIntType() != 0)
+ else if (elementType()->asIntType() != nullptr)
prefix = "i";
- else if (elementType()->asUIntType() != 0)
+ else if (elementType()->asUIntType() != nullptr)
prefix = "u";
- else if (elementType()->asDoubleType() != 0)
+ else if (elementType()->asDoubleType() != nullptr)
prefix = "d";
return QString::fromLatin1("%1mat%2x%3").arg(QLatin1String(prefix)).arg(_columns).arg(_rows);
}
@@ -291,9 +291,9 @@ bool MatrixType::isEqualTo(const Type *other) const
bool MatrixType::isLessThan(const Type *other) const
{
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != nullptr);
const MatrixType *mat = other->asMatrixType();
- Q_ASSERT(mat != 0);
+ Q_ASSERT(mat != nullptr);
if (_columns < mat->columns()) {
return true;
} else if (_columns == mat->columns()) {
@@ -321,9 +321,9 @@ bool ArrayType::isEqualTo(const Type *other) const
bool ArrayType::isLessThan(const Type *other) const
{
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != nullptr);
const ArrayType *array = other->asArrayType();
- Q_ASSERT(array != 0);
+ Q_ASSERT(array != nullptr);
return elementType() < array->elementType();
}
@@ -348,18 +348,18 @@ Symbol *Struct::find(const QString &name) const
if (s->name() == name)
return s;
}
- return 0;
+ return nullptr;
}
bool Struct::isEqualTo(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
bool Struct::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
@@ -420,13 +420,13 @@ Argument *Function::argumentAt(int index) const
bool Function::isEqualTo(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
bool Function::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
@@ -446,7 +446,7 @@ Symbol *Function::find(const QString &name) const
if (arg->name() == name)
return arg;
}
- return 0;
+ return nullptr;
}
QString SamplerType::toString() const
@@ -465,9 +465,9 @@ bool SamplerType::isEqualTo(const Type *other) const
bool SamplerType::isLessThan(const Type *other) const
{
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != nullptr);
const SamplerType *samp = other->asSamplerType();
- Q_ASSERT(samp != 0);
+ Q_ASSERT(samp != nullptr);
return _kind < samp->kind();
}
@@ -493,7 +493,7 @@ const Type *OverloadSet::type() const
Symbol *OverloadSet::find(const QString &) const
{
- return 0;
+ return nullptr;
}
void OverloadSet::add(Symbol *symbol)
@@ -506,12 +506,12 @@ void OverloadSet::add(Symbol *symbol)
bool OverloadSet::isEqualTo(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
bool OverloadSet::isLessThan(const Type *other) const
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
diff --git a/src/libs/glsl/glsltypes.h b/src/libs/glsl/glsltypes.h
index 93acb91e8e..d55d91fa16 100644
--- a/src/libs/glsl/glsltypes.h
+++ b/src/libs/glsl/glsltypes.h
@@ -186,7 +186,7 @@ public:
class GLSL_EXPORT Struct: public Type, public Scope
{
public:
- Struct(Scope *scope = 0)
+ Struct(Scope *scope = nullptr)
: Scope(scope) {}
QList<Symbol *> members() const override;
@@ -210,7 +210,7 @@ private:
class GLSL_EXPORT Function: public Type, public Scope
{
public:
- Function(Scope *scope = 0)
+ Function(Scope *scope = nullptr)
: Scope(scope) {}
const Type *returnType() const;
@@ -267,7 +267,7 @@ private:
class GLSL_EXPORT OverloadSet: public Type, public Scope
{
public:
- OverloadSet(Scope *enclosingScope = 0);
+ OverloadSet(Scope *enclosingScope = nullptr);
QVector<Function *> functions() const;
void addFunction(Function *function);
diff --git a/src/libs/languageserverprotocol/clientcapabilities.cpp b/src/libs/languageserverprotocol/clientcapabilities.cpp
index f73c4ee04c..1f79ffae0d 100644
--- a/src/libs/languageserverprotocol/clientcapabilities.cpp
+++ b/src/libs/languageserverprotocol/clientcapabilities.cpp
@@ -76,23 +76,24 @@ bool TextDocumentClientCapabilities::SynchronizationCapabilities::isValid(QStrin
bool TextDocumentClientCapabilities::isValid(QStringList *error) const
{
return checkOptional<SynchronizationCapabilities>(error, synchronizationKey)
- && checkOptional<CompletionCapabilities>(error, completionKey)
- && checkOptional<HoverCapabilities>(error, hoverKey)
- && checkOptional<SignatureHelpCapabilities>(error, signatureHelpKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, referencesKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, documentHighlightKey)
- && checkOptional<SymbolCapabilities>(error, documentSymbolKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, formattingKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, rangeFormattingKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, onTypeFormattingKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, definitionKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, typeDefinitionKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, implementationKey)
- && checkOptional<CodeActionCapabilities>(error, codeActionKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, codeLensKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, documentLinkKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, colorProviderKey)
- && checkOptional<DynamicRegistrationCapabilities>(error, renameKey);
+ && checkOptional<CompletionCapabilities>(error, completionKey)
+ && checkOptional<HoverCapabilities>(error, hoverKey)
+ && checkOptional<SignatureHelpCapabilities>(error, signatureHelpKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, referencesKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, documentHighlightKey)
+ && checkOptional<SymbolCapabilities>(error, documentSymbolKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, formattingKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, rangeFormattingKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, onTypeFormattingKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, definitionKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, typeDefinitionKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, implementationKey)
+ && checkOptional<CodeActionCapabilities>(error, codeActionKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, codeLensKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, documentLinkKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, colorProviderKey)
+ && checkOptional<DynamicRegistrationCapabilities>(error, renameKey)
+ && checkOptional<SemanticHighlightingCapabilities>(error, semanticHighlightingCapabilitiesKey);
}
bool SymbolCapabilities::isValid(QStringList *error) const
diff --git a/src/libs/languageserverprotocol/clientcapabilities.h b/src/libs/languageserverprotocol/clientcapabilities.h
index 3664007dd1..ec1bdd25b5 100644
--- a/src/libs/languageserverprotocol/clientcapabilities.h
+++ b/src/libs/languageserverprotocol/clientcapabilities.h
@@ -120,6 +120,26 @@ public:
{ insert(synchronizationKey, synchronization); }
void clearSynchronization() { remove(synchronizationKey); }
+ class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightingCapabilities : public JsonObject
+ {
+ public:
+ using JsonObject::JsonObject;
+
+ bool semanticHighlighting() const { return typedValue<bool>(semanticHighlightingKey); }
+ void setSemanticHighlighting(bool semanticHighlighting)
+ { insert(semanticHighlightingKey, semanticHighlighting); }
+
+ bool isValid(QStringList *error) const override
+ { return check<bool>(error, semanticHighlightingKey); }
+ };
+
+ Utils::optional<SemanticHighlightingCapabilities> semanticHighlightingCapabilities() const
+ { return optionalValue<SemanticHighlightingCapabilities>(semanticHighlightingCapabilitiesKey); }
+ void setSemanticHighlightingCapabilities(
+ const SemanticHighlightingCapabilities &semanticHighlightingCapabilities)
+ { insert(semanticHighlightingCapabilitiesKey, semanticHighlightingCapabilities); }
+ void clearSemanticHighlightingCapabilities() { remove(semanticHighlightingCapabilitiesKey); }
+
class LANGUAGESERVERPROTOCOL_EXPORT CompletionCapabilities : public DynamicRegistrationCapabilities
{
public:
diff --git a/src/libs/languageserverprotocol/jsonkeys.h b/src/libs/languageserverprotocol/jsonkeys.h
index 7e1ea3720b..cccf0789b9 100644
--- a/src/libs/languageserverprotocol/jsonkeys.h
+++ b/src/libs/languageserverprotocol/jsonkeys.h
@@ -130,6 +130,7 @@ constexpr char labelKey[] = "label";
constexpr char languageIdKey[] = "languageId";
constexpr char languageKey[] = "language";
constexpr char lineKey[] = "line";
+constexpr char linesKey[] = "lines";
constexpr char locationKey[] = "location";
constexpr char messageKey[] = "message";
constexpr char methodKey[] = "method";
@@ -167,8 +168,11 @@ constexpr char rootUriKey[] = "rootUri";
constexpr char saveKey[] = "save";
constexpr char schemeKey[] = "scheme";
constexpr char scopeUriKey[] = "scopeUri";
+constexpr char scopesKey[] = "scopes";
constexpr char sectionKey[] = "section";
constexpr char selectionRangeKey[] = "selectionRange";
+constexpr char semanticHighlightingKey[] = "semanticHighlighting";
+constexpr char semanticHighlightingCapabilitiesKey[] = "semanticHighlightingCapabilities";
constexpr char settingsKey[] = "settings";
constexpr char severityKey[] = "severity";
constexpr char signatureHelpKey[] = "signatureHelp";
@@ -191,6 +195,7 @@ constexpr char textDocumentSyncKey[] = "textDocumentSync";
constexpr char textEditKey[] = "textEdit";
constexpr char textKey[] = "text";
constexpr char titleKey[] = "title";
+constexpr char tokensKey[] = "tokens";
constexpr char traceKey[] = "trace";
constexpr char triggerCharacterKey[] = "triggerCharacter";
constexpr char triggerCharactersKey[] = "triggerCharacters";
diff --git a/src/libs/languageserverprotocol/languagefeatures.cpp b/src/libs/languageserverprotocol/languagefeatures.cpp
index cfb4cc6fab..f66b6b7e16 100644
--- a/src/libs/languageserverprotocol/languagefeatures.cpp
+++ b/src/libs/languageserverprotocol/languagefeatures.cpp
@@ -48,6 +48,7 @@ constexpr const char DocumentRangeFormattingRequest::methodName[];
constexpr const char DocumentOnTypeFormattingRequest::methodName[];
constexpr const char RenameRequest::methodName[];
constexpr const char SignatureHelpRequest::methodName[];
+constexpr const char SemanticHighlightNotification::methodName[];
HoverContent LanguageServerProtocol::Hover::content() const
{
@@ -441,4 +442,59 @@ bool CodeAction::isValid(QStringList *error) const
&& checkOptional<Command>(error, commandKey);
}
+Utils::optional<QList<SemanticHighlightToken>> SemanticHighlightingInformation::tokens() const
+{
+ QList<SemanticHighlightToken> resultTokens;
+
+ const QByteArray tokensByteArray = QByteArray::fromBase64(
+ typedValue<QString>(tokensKey).toLocal8Bit());
+ constexpr int tokensByteSize = 8;
+ int index = 0;
+ while (index + tokensByteSize <= tokensByteArray.size()) {
+ resultTokens << SemanticHighlightToken(tokensByteArray.mid(index, tokensByteSize));
+ index += tokensByteSize;
+ }
+ return Utils::make_optional(resultTokens);
+}
+
+void SemanticHighlightingInformation::setTokens(const QList<SemanticHighlightToken> &tokens)
+{
+ QByteArray byteArray;
+ byteArray.reserve(8 * tokens.size());
+ for (const SemanticHighlightToken &token : tokens)
+ token.appendToByteArray(byteArray);
+ insert(tokensKey, QString::fromLocal8Bit(byteArray.toBase64()));
+}
+
+SemanticHighlightToken::SemanticHighlightToken(const QByteArray &token)
+{
+ QTC_ASSERT(token.size() == 8, return );
+ character = ( quint32(token.at(0)) << 24
+ | quint32(token.at(1)) << 16
+ | quint32(token.at(2)) << 8
+ | quint32(token.at(3)));
+
+ length = quint16(token.at(4) << 8 | token.at(5));
+
+ scope = quint16(token.at(6) << 8 | token.at(7));
+}
+
+void SemanticHighlightToken::appendToByteArray(QByteArray &byteArray) const
+{
+ byteArray.append(char((character & 0xff000000) >> 24));
+ byteArray.append(char((character & 0x00ff0000) >> 16));
+ byteArray.append(char((character & 0x0000ff00) >> 8));
+ byteArray.append(char((character & 0x000000ff)));
+ byteArray.append(char((length & 0xff00) >> 8));
+ byteArray.append(char((length & 0x00ff)));
+ byteArray.append(char((scope & 0xff00) >> 8));
+ byteArray.append(char((scope & 0x00ff)));
+}
+
+bool SemanticHighlightingParams::isValid(QStringList *error) const
+{
+ return check<VersionedTextDocumentIdentifier>(error, textDocumentKey)
+ && checkArray<SemanticHighlightingInformation>(error, linesKey);
+}
+
} // namespace LanguageServerProtocol
diff --git a/src/libs/languageserverprotocol/languagefeatures.h b/src/libs/languageserverprotocol/languagefeatures.h
index ddd732718a..bb98d7f8bd 100644
--- a/src/libs/languageserverprotocol/languagefeatures.h
+++ b/src/libs/languageserverprotocol/languagefeatures.h
@@ -806,4 +806,60 @@ public:
constexpr static const char methodName[] = "textDocument/rename";
};
+class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightToken
+{
+public:
+ // Just accepts token with 8 bytes
+ SemanticHighlightToken(const QByteArray &token);
+ SemanticHighlightToken() = default;
+
+ void appendToByteArray(QByteArray &byteArray) const;
+
+ quint32 character = 0;
+ quint16 length = 0;
+ quint16 scope = 0;
+};
+
+class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightingInformation : public JsonObject
+{
+public:
+ using JsonObject::JsonObject;
+
+ int line() const { return typedValue<int>(lineKey); }
+ void setLine(int line) { insert(lineKey, line); }
+
+ Utils::optional<QList<SemanticHighlightToken>> tokens() const;
+ void setTokens(const QList<SemanticHighlightToken> &tokens);
+ void clearTokens() { remove(tokensKey); }
+
+ bool isValid(QStringList *error) const override
+ { return check<int>(error, lineKey) && checkOptional<QString>(error, tokensKey); }
+};
+
+class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightingParams : public JsonObject
+{
+public:
+ using JsonObject::JsonObject;
+
+ VersionedTextDocumentIdentifier textDocument() const
+ { return typedValue<VersionedTextDocumentIdentifier>(textDocumentKey); }
+ void setTextDocument(const VersionedTextDocumentIdentifier &textDocument)
+ { insert(textDocumentKey, textDocument); }
+
+ QList<SemanticHighlightingInformation> lines() const
+ { return array<SemanticHighlightingInformation>(linesKey); }
+ void setLines(const QList<SemanticHighlightingInformation> &lines)
+ { insertArray(linesKey, lines); }
+
+ bool isValid(QStringList *error) const override;
+};
+
+class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightNotification
+ : public Notification<SemanticHighlightingParams>
+{
+public:
+ using Notification::Notification;
+ constexpr static const char methodName[] = "textDocument/semanticHighlighting";
+};
+
} // namespace LanguageClient
diff --git a/src/libs/languageserverprotocol/lsptypes.cpp b/src/libs/languageserverprotocol/lsptypes.cpp
index 8aa1ecf81c..6b8bc0f749 100644
--- a/src/libs/languageserverprotocol/lsptypes.cpp
+++ b/src/libs/languageserverprotocol/lsptypes.cpp
@@ -96,7 +96,7 @@ void WorkspaceEdit::setChanges(const Changes &changes)
QJsonArray edits;
for (const TextEdit &edit : it.value())
edits.append(QJsonValue(edit));
- changesObject.insert(it.key().toFileName().toString(), edits);
+ changesObject.insert(it.key().toFilePath().toString(), edits);
}
insert(changesKey, changesObject);
}
@@ -410,7 +410,7 @@ DocumentUri::DocumentUri(const Utils::FilePath &other)
: QUrl(QUrl::fromLocalFile(other.toString()))
{ }
-Utils::FilePath DocumentUri::toFileName() const
+Utils::FilePath DocumentUri::toFilePath() const
{
return isLocalFile() ? Utils::FilePath::fromUserInput(QUrl(*this).toLocalFile())
: Utils::FilePath();
diff --git a/src/libs/languageserverprotocol/lsptypes.h b/src/libs/languageserverprotocol/lsptypes.h
index ade3ac7ccf..fca410636d 100644
--- a/src/libs/languageserverprotocol/lsptypes.h
+++ b/src/libs/languageserverprotocol/lsptypes.h
@@ -45,10 +45,10 @@ class LANGUAGESERVERPROTOCOL_EXPORT DocumentUri : public QUrl
{
public:
DocumentUri() = default;
- Utils::FilePath toFileName() const;
+ Utils::FilePath toFilePath() const;
static DocumentUri fromProtocol(const QString &uri) { return DocumentUri(uri); }
- static DocumentUri fromFileName(const Utils::FilePath &file) { return DocumentUri(file); }
+ static DocumentUri fromFilePath(const Utils::FilePath &file) { return DocumentUri(file); }
operator QJsonValue() const { return QJsonValue(toString()); }
diff --git a/src/libs/languageserverprotocol/servercapabilities.cpp b/src/libs/languageserverprotocol/servercapabilities.cpp
index 1b2c0bd9cc..a8e932ad50 100644
--- a/src/libs/languageserverprotocol/servercapabilities.cpp
+++ b/src/libs/languageserverprotocol/servercapabilities.cpp
@@ -170,7 +170,8 @@ bool ServerCapabilities::isValid(QStringList *error) const
&& checkOptional<DocumentLinkOptions>(error, documentLinkProviderKey)
&& checkOptional<bool, JsonObject>(error, colorProviderKey)
&& checkOptional<ExecuteCommandOptions>(error, executeCommandProviderKey)
- && checkOptional<WorkspaceServerCapabilities>(error, workspaceKey);
+ && checkOptional<WorkspaceServerCapabilities>(error, workspaceKey)
+ && checkOptional<SemanticHighlightingServerCapabilities>(error, semanticHighlightingKey);
}
Utils::optional<Utils::variant<QString, bool> >
@@ -219,4 +220,44 @@ bool TextDocumentSyncOptions::isValid(QStringList *error) const
&& checkOptional<SaveOptions>(error, saveKey);
}
+Utils::optional<QList<QList<QString>>> ServerCapabilities::SemanticHighlightingServerCapabilities::scopes() const
+{
+ QList<QList<QString>> scopes;
+ if (!contains(scopesKey))
+ return Utils::nullopt;
+ for (const QJsonValue jsonScopeValue : value(scopesKey).toArray()) {
+ if (!jsonScopeValue.isArray())
+ return {};
+ QList<QString> scope;
+ for (const QJsonValue value : jsonScopeValue.toArray()) {
+ if (!value.isString())
+ return {};
+ scope.append(value.toString());
+ }
+ scopes.append(scope);
+ }
+ return Utils::make_optional(scopes);
+}
+
+void ServerCapabilities::SemanticHighlightingServerCapabilities::setScopes(
+ const QList<QList<QString>> &scopes)
+{
+ QJsonArray jsonScopes;
+ for (const QList<QString> &scope : scopes) {
+ QJsonArray jsonScope;
+ for (const QString &value : scope)
+ jsonScope.append(value);
+ jsonScopes.append(jsonScope);
+ }
+ insert(scopesKey, jsonScopes);
+}
+
+bool ServerCapabilities::SemanticHighlightingServerCapabilities::isValid(QStringList *) const
+{
+ return contains(scopesKey) && value(scopesKey).isArray()
+ && Utils::allOf(value(scopesKey).toArray(), [](const QJsonValue &array) {
+ return array.isArray() && Utils::allOf(array.toArray(), &QJsonValue::isString);
+ });
+}
+
} // namespace LanguageServerProtocol
diff --git a/src/libs/languageserverprotocol/servercapabilities.h b/src/libs/languageserverprotocol/servercapabilities.h
index 4c8011378f..7365449b0f 100644
--- a/src/libs/languageserverprotocol/servercapabilities.h
+++ b/src/libs/languageserverprotocol/servercapabilities.h
@@ -223,6 +223,17 @@ public:
void clearId() { remove(idKey); }
};
+ class LANGUAGESERVERPROTOCOL_EXPORT SemanticHighlightingServerCapabilities : public JsonObject
+ {
+ public:
+ using JsonObject::JsonObject;
+
+ Utils::optional<QList<QList<QString>>> scopes() const;
+ void setScopes(const QList<QList<QString>> &scopes);
+
+ bool isValid(QStringList *) const override;
+ };
+
// Defines how text documents are synced. Is either a detailed structure defining each
// notification or for backwards compatibility the TextDocumentSyncKind number.
using TextDocumentSync = Utils::variant<TextDocumentSyncOptions, int>;
@@ -423,6 +434,12 @@ public:
void setExperimental(const JsonObject &experimental) { insert(experimentalKey, experimental); }
void clearExperimental() { remove(experimentalKey); }
+ Utils::optional<SemanticHighlightingServerCapabilities> semanticHighlighting() const
+ { return optionalValue<SemanticHighlightingServerCapabilities>(semanticHighlightingKey); }
+ void setSemanticHighlighting(const SemanticHighlightingServerCapabilities &semanticHighlighting)
+ { insert(semanticHighlightingKey, semanticHighlighting); }
+ void clearSemanticHighlighting() { remove(semanticHighlightingKey); }
+
bool isValid(QStringList *error) const override;
};
diff --git a/src/libs/libs.pro b/src/libs/libs.pro
index cbd788ced0..550a6b0b97 100644
--- a/src/libs/libs.pro
+++ b/src/libs/libs.pro
@@ -33,6 +33,9 @@ for(l, SUBDIRS) {
SUBDIRS += \
utils/process_stub.pro
+include(../shared/yaml-cpp/yaml-cpp_installation.pri)
+isEmpty(EXTERNAL_YAML_CPP_FOUND): SUBDIRS += 3rdparty/yaml-cpp
+
isEmpty(KSYNTAXHIGHLIGHTING_LIB_DIR): KSYNTAXHIGHLIGHTING_LIB_DIR=$$(KSYNTAXHIGHLIGHTING_LIB_DIR)
!isEmpty(KSYNTAXHIGHLIGHTING_LIB_DIR) {
# enable short information message
diff --git a/src/libs/libs.qbs b/src/libs/libs.qbs
index 1c4275f6f1..84fc626501 100644
--- a/src/libs/libs.qbs
+++ b/src/libs/libs.qbs
@@ -22,5 +22,6 @@ Project {
"utils/process_ctrlc_stub.qbs",
"utils/utils.qbs",
"3rdparty/syntax-highlighting/syntax-highlighting.qbs",
+ "3rdparty/yaml-cpp/yaml-cpp.qbs",
].concat(project.additionalLibs)
}
diff --git a/src/libs/modelinglib/qmt/config/textscanner.cpp b/src/libs/modelinglib/qmt/config/textscanner.cpp
index d9652e346c..23173789c5 100644
--- a/src/libs/modelinglib/qmt/config/textscanner.cpp
+++ b/src/libs/modelinglib/qmt/config/textscanner.cpp
@@ -296,7 +296,7 @@ Token TextScanner::scanOperator(const SourceChar &firstChar)
unreadChar(extraChars.pop());
}
QMT_CHECK(haveOperator);
- Q_UNUSED(haveOperator); // avoid warning in release mode
+ Q_UNUSED(haveOperator) // avoid warning in release mode
return Token(Token::TokenOperator, subtype, op, firstChar.pos);
}
text += sourceChar.ch;
diff --git a/src/libs/modelinglib/qmt/controller/undocommand.cpp b/src/libs/modelinglib/qmt/controller/undocommand.cpp
index 40348d3f86..130f201e03 100644
--- a/src/libs/modelinglib/qmt/controller/undocommand.cpp
+++ b/src/libs/modelinglib/qmt/controller/undocommand.cpp
@@ -58,7 +58,7 @@ bool UndoCommand::mergeWith(const QUndoCommand *other)
bool UndoCommand::mergeWith(const UndoCommand *other)
{
- Q_UNUSED(other);
+ Q_UNUSED(other)
return false;
}
diff --git a/src/libs/modelinglib/qmt/diagram_controller/dclonevisitor.cpp b/src/libs/modelinglib/qmt/diagram_controller/dclonevisitor.cpp
index d882c81eef..805e96eafd 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/dclonevisitor.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/dclonevisitor.cpp
@@ -50,7 +50,7 @@ DCloneVisitor::DCloneVisitor()
void DCloneVisitor::visitDElement(const DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_cloned);
}
@@ -158,7 +158,7 @@ DCloneDeepVisitor::DCloneDeepVisitor()
void DCloneDeepVisitor::visitDElement(const DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_cloned);
}
diff --git a/src/libs/modelinglib/qmt/diagram_controller/dfactory.cpp b/src/libs/modelinglib/qmt/diagram_controller/dfactory.cpp
index e87fb8ce5e..1d6a770b77 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/dfactory.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/dfactory.cpp
@@ -59,7 +59,7 @@ DFactory::DFactory()
void DFactory::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_product);
}
diff --git a/src/libs/modelinglib/qmt/diagram_controller/dflatassignmentvisitor.cpp b/src/libs/modelinglib/qmt/diagram_controller/dflatassignmentvisitor.cpp
index 20531bb85c..baf7adea65 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/dflatassignmentvisitor.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/dflatassignmentvisitor.cpp
@@ -54,7 +54,7 @@ DFlatAssignmentVisitor::DFlatAssignmentVisitor(DElement *target)
void DFlatAssignmentVisitor::visitDElement(const DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void DFlatAssignmentVisitor::visitDObject(const DObject *object)
diff --git a/src/libs/modelinglib/qmt/diagram_controller/diagramcontroller.cpp b/src/libs/modelinglib/qmt/diagram_controller/diagramcontroller.cpp
index aa8ad153b1..f7d7e702e5 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/diagramcontroller.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/diagramcontroller.cpp
@@ -576,8 +576,8 @@ void DiagramController::onEndResetModel()
void DiagramController::onBeginUpdateObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
// nothing to do
}
@@ -608,8 +608,8 @@ void DiagramController::onEndUpdateObject(int row, const MObject *parent)
void DiagramController::onBeginInsertObject(int row, const MObject *owner)
{
- Q_UNUSED(row);
- Q_UNUSED(owner);
+ Q_UNUSED(row)
+ Q_UNUSED(owner)
}
void DiagramController::onEndInsertObject(int row, const MObject *owner)
@@ -634,14 +634,14 @@ void DiagramController::onBeginRemoveObject(int row, const MObject *parent)
void DiagramController::onEndRemoveObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void DiagramController::onBeginMoveObject(int formerRow, const MObject *formerOwner)
{
- Q_UNUSED(formerRow);
- Q_UNUSED(formerOwner);
+ Q_UNUSED(formerRow)
+ Q_UNUSED(formerOwner)
}
void DiagramController::onEndMoveObject(int row, const MObject *owner)
@@ -663,8 +663,8 @@ void DiagramController::onEndMoveObject(int row, const MObject *owner)
void DiagramController::onBeginUpdateRelation(int row, const MObject *owner)
{
- Q_UNUSED(row);
- Q_UNUSED(owner);
+ Q_UNUSED(row)
+ Q_UNUSED(owner)
// nothing to do
}
@@ -691,14 +691,14 @@ void DiagramController::onBeginRemoveRelation(int row, const MObject *owner)
void DiagramController::onEndRemoveRelation(int row, const MObject *owner)
{
- Q_UNUSED(row);
- Q_UNUSED(owner);
+ Q_UNUSED(row)
+ Q_UNUSED(owner)
}
void DiagramController::onBeginMoveRelation(int formerRow, const MObject *formerOwner)
{
- Q_UNUSED(formerRow);
- Q_UNUSED(formerOwner);
+ Q_UNUSED(formerRow)
+ Q_UNUSED(formerOwner)
// nothing to do
}
diff --git a/src/libs/modelinglib/qmt/diagram_controller/dupdatevisitor.cpp b/src/libs/modelinglib/qmt/diagram_controller/dupdatevisitor.cpp
index 6b3695f1ba..cc1ffa681a 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/dupdatevisitor.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/dupdatevisitor.cpp
@@ -65,7 +65,7 @@ void DUpdateVisitor::setCheckNeedsUpdate(bool checkNeedsUpdate)
void DUpdateVisitor::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_target);
}
diff --git a/src/libs/modelinglib/qmt/diagram_controller/dvoidvisitor.cpp b/src/libs/modelinglib/qmt/diagram_controller/dvoidvisitor.cpp
index 56fdfe2cb4..f182eb993d 100644
--- a/src/libs/modelinglib/qmt/diagram_controller/dvoidvisitor.cpp
+++ b/src/libs/modelinglib/qmt/diagram_controller/dvoidvisitor.cpp
@@ -49,7 +49,7 @@ DVoidVisitor::DVoidVisitor()
void DVoidVisitor::visitDElement(DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void DVoidVisitor::visitDObject(DObject *object)
@@ -128,7 +128,7 @@ DConstVoidVisitor::DConstVoidVisitor()
void DConstVoidVisitor::visitDElement(const DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void DConstVoidVisitor::visitDObject(const DObject *object)
diff --git a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
index 36c8ae07d4..82fba740a1 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp
@@ -85,8 +85,8 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
QPen pen(QBrush(Qt::gray), 1.0, Qt::DotLine);
painter->setPen(pen);
@@ -539,7 +539,7 @@ void DiagramSceneModel::selectItem(QGraphicsItem *item, bool multiSelect)
void DiagramSceneModel::moveSelectedItems(QGraphicsItem *grabbedItem, const QPointF &delta)
{
- Q_UNUSED(grabbedItem);
+ Q_UNUSED(grabbedItem)
if (delta != QPointF(0.0, 0.0)) {
foreach (QGraphicsItem *item, m_selectedItems) {
@@ -754,8 +754,8 @@ void DiagramSceneModel::onEndResetDiagram(const MDiagram *diagram)
void DiagramSceneModel::onBeginUpdateElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = UpdateElement;
@@ -775,8 +775,8 @@ void DiagramSceneModel::onEndUpdateElement(int row, const MDiagram *diagram)
void DiagramSceneModel::onBeginInsertElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = InsertElement;
}
@@ -825,8 +825,8 @@ void DiagramSceneModel::onBeginRemoveElement(int row, const MDiagram *diagram)
void DiagramSceneModel::onEndRemoveElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
QMT_CHECK(m_busyState == RemoveElement);
// update elements from store (see above)
for (const Uid &end_uid : m_relationEndsUid) {
diff --git a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodelitemvisitors.cpp b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodelitemvisitors.cpp
index 2a0a557190..91633b18bb 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodelitemvisitors.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodelitemvisitors.cpp
@@ -63,13 +63,13 @@ DiagramSceneModel::CreationVisitor::CreationVisitor(DiagramSceneModel *diagramSc
void DiagramSceneModel::CreationVisitor::visitDElement(DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(false);
}
void DiagramSceneModel::CreationVisitor::visitDObject(DObject *object)
{
- Q_UNUSED(object);
+ Q_UNUSED(object)
QMT_CHECK(false);
}
@@ -159,7 +159,7 @@ DiagramSceneModel::UpdateVisitor::UpdateVisitor(QGraphicsItem *item, DiagramScen
void DiagramSceneModel::UpdateVisitor::visitDElement(DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(false);
}
@@ -284,7 +284,7 @@ void DiagramSceneModel::UpdateVisitor::visitDConnection(DConnection *connection)
void DiagramSceneModel::UpdateVisitor::visitDAnnotation(DAnnotation *annotation)
{
- Q_UNUSED(annotation); // avoid warning in release mode
+ Q_UNUSED(annotation) // avoid warning in release mode
QMT_ASSERT(m_graphicsItem, return);
AnnotationItem *annotationItem = qgraphicsitem_cast<AnnotationItem *>(m_graphicsItem);
@@ -295,7 +295,7 @@ void DiagramSceneModel::UpdateVisitor::visitDAnnotation(DAnnotation *annotation)
void DiagramSceneModel::UpdateVisitor::visitDBoundary(DBoundary *boundary)
{
- Q_UNUSED(boundary); // avoid warning in release mode
+ Q_UNUSED(boundary) // avoid warning in release mode
QMT_ASSERT(m_graphicsItem, return);
BoundaryItem *boundaryItem = qgraphicsitem_cast<BoundaryItem *>(m_graphicsItem);
@@ -306,7 +306,7 @@ void DiagramSceneModel::UpdateVisitor::visitDBoundary(DBoundary *boundary)
void DiagramSceneModel::UpdateVisitor::visitDSwimlane(DSwimlane *swimlane)
{
- Q_UNUSED(swimlane); // avoid warning in release mode
+ Q_UNUSED(swimlane) // avoid warning in release mode
QMT_ASSERT(m_graphicsItem, return);
SwimlaneItem *swimlaneItem = qgraphicsitem_cast<SwimlaneItem *>(m_graphicsItem);
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/annotationitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/annotationitem.cpp
index 6169f4cad8..6759378b3c 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/annotationitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/annotationitem.cpp
@@ -87,9 +87,9 @@ QRectF AnnotationItem::boundingRect() const
void AnnotationItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
void AnnotationItem::update()
@@ -161,10 +161,10 @@ void AnnotationItem::setPosAndRect(const QPointF &originalPos, const QRectF &ori
void AnnotationItem::alignItemSizeToRaster(Side adjustHorizontalSide, Side adjustVerticalSide,
double rasterWidth, double rasterHeight)
{
- Q_UNUSED(adjustHorizontalSide);
- Q_UNUSED(adjustVerticalSide);
- Q_UNUSED(rasterWidth);
- Q_UNUSED(rasterHeight);
+ Q_UNUSED(adjustHorizontalSide)
+ Q_UNUSED(adjustVerticalSide)
+ Q_UNUSED(rasterWidth)
+ Q_UNUSED(rasterHeight)
}
void AnnotationItem::moveDelta(const QPointF &delta)
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/associationitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/associationitem.cpp
index 1aee12d465..109819a569 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/associationitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/associationitem.cpp
@@ -75,7 +75,7 @@ void AssociationItem::updateEndLabels(const DAssociationEnd &end, const DAssocia
QGraphicsSimpleTextItem **endName, QGraphicsSimpleTextItem **endCardinality,
const Style *style)
{
- Q_UNUSED(end);
+ Q_UNUSED(end)
if (!otherEnd.name().isEmpty()) {
if (!*endName)
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/boundaryitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/boundaryitem.cpp
index e437f4c3ec..cb5aab1a6a 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/boundaryitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/boundaryitem.cpp
@@ -89,9 +89,9 @@ QRectF BoundaryItem::boundingRect() const
void BoundaryItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
void BoundaryItem::update()
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/connectionitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/connectionitem.cpp
index d8e3a37df5..e59865d1ba 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/connectionitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/connectionitem.cpp
@@ -75,7 +75,7 @@ void ConnectionItem::updateEndLabels(const DConnectionEnd &end, const DConnectio
QGraphicsSimpleTextItem **endName, QGraphicsSimpleTextItem **endCardinality,
const Style *style)
{
- Q_UNUSED(end);
+ Q_UNUSED(end)
if (!otherEnd.name().isEmpty()) {
if (!*endName)
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp
index a2e3a54df7..e3b50bab1b 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp
@@ -69,7 +69,7 @@ void ItemItem::update()
updateStereotypeIconDisplay();
auto diagramItem = dynamic_cast<DItem *>(object());
- Q_UNUSED(diagramItem); // avoid warning about unsed variable
+ Q_UNUSED(diagramItem) // avoid warning about unsed variable
QMT_ASSERT(diagramItem, return);
const Style *style = adaptedStyle(shapeIconId());
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp
index f00ed98b96..b68ed9a4f7 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/objectitem.cpp
@@ -83,9 +83,9 @@ QRectF ObjectItem::boundingRect() const
void ObjectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
QPointF ObjectItem::pos() const
@@ -273,7 +273,7 @@ ILatchable::Action ObjectItem::verticalLatchAction() const
QList<ILatchable::Latch> ObjectItem::horizontalLatches(ILatchable::Action action, bool grabbedItem) const
{
- Q_UNUSED(grabbedItem);
+ Q_UNUSED(grabbedItem)
QRectF rect = mapRectToScene(this->rect());
QList<ILatchable::Latch> result;
@@ -301,7 +301,7 @@ QList<ILatchable::Latch> ObjectItem::horizontalLatches(ILatchable::Action action
QList<ILatchable::Latch> ObjectItem::verticalLatches(ILatchable::Action action, bool grabbedItem) const
{
- Q_UNUSED(grabbedItem);
+ Q_UNUSED(grabbedItem)
QRectF rect = mapRectToScene(this->rect());
QList<ILatchable::Latch> result;
@@ -394,7 +394,7 @@ void ObjectItem::relationDrawn(const QString &id, ObjectItem *targetItem, const
void ObjectItem::align(IAlignable::AlignType alignType, const QString &identifier)
{
- Q_UNUSED(identifier); // avoid warning in release mode
+ Q_UNUSED(identifier) // avoid warning in release mode
// subclasses may support other identifiers than the standard ones.
// but this implementation does not. So assert the names.
@@ -541,7 +541,7 @@ void ObjectItem::updateStereotypes(const QString &stereotypeIconId, StereotypeIc
QSizeF ObjectItem::stereotypeIconMinimumSize(const StereotypeIcon &stereotypeIcon,
qreal minimumWidth, qreal minimumHeight) const
{
- Q_UNUSED(minimumWidth);
+ Q_UNUSED(minimumWidth)
qreal width = 0.0;
qreal height = 0.0;
@@ -946,14 +946,14 @@ bool ObjectItem::showContext() const
bool ObjectItem::extendContextMenu(QMenu *menu)
{
- Q_UNUSED(menu);
+ Q_UNUSED(menu)
return false;
}
bool ObjectItem::handleSelectedContextMenuAction(const QString &id)
{
- Q_UNUSED(id);
+ Q_UNUSED(id)
return false;
}
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/relationitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/relationitem.cpp
index c383a21a32..b778441a70 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/relationitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/relationitem.cpp
@@ -238,9 +238,9 @@ QRectF RelationItem::boundingRect() const
void RelationItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
#ifdef DEBUG_PAINT_SHAPE
painter->save();
@@ -518,12 +518,12 @@ void RelationItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
void RelationItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
void RelationItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
const Style *RelationItem::adaptedStyle()
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/swimlaneitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/swimlaneitem.cpp
index 6d38cc71ef..bdc68476b3 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/items/swimlaneitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/items/swimlaneitem.cpp
@@ -68,9 +68,9 @@ QRectF SwimlaneItem::boundingRect() const
void SwimlaneItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
void SwimlaneItem::update()
@@ -81,7 +81,7 @@ void SwimlaneItem::update()
prepareGeometryChange();
const Style *style = adaptedStyle();
- Q_UNUSED(style);
+ Q_UNUSED(style)
// swimline line
if (!m_lineItem)
@@ -137,7 +137,7 @@ bool SwimlaneItem::isFocusSelected() const
void SwimlaneItem::setFocusSelected(bool focusSelected)
{
- Q_UNUSED(focusSelected);
+ Q_UNUSED(focusSelected)
}
QRectF SwimlaneItem::getSecondarySelectionBoundary()
diff --git a/src/libs/modelinglib/qmt/diagram_scene/latchcontroller.cpp b/src/libs/modelinglib/qmt/diagram_scene/latchcontroller.cpp
index 0209fdf2a2..ff0da88abb 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/latchcontroller.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/latchcontroller.cpp
@@ -75,7 +75,7 @@ void LatchController::addToGraphicsScene(QGraphicsScene *graphicsScene)
void LatchController::removeFromGraphicsScene(QGraphicsScene *graphicsScene)
{
- Q_UNUSED(graphicsScene); // avoid warning in release mode
+ Q_UNUSED(graphicsScene) // avoid warning in release mode
if (m_verticalAlignLine->scene()) {
QMT_CHECK(graphicsScene == m_verticalAlignLine->scene());
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/alignbuttonsitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/alignbuttonsitem.cpp
index 6a68f5fdc7..d675db9ef6 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/alignbuttonsitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/alignbuttonsitem.cpp
@@ -54,8 +54,8 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
painter->save();
painter->setPen(pen());
@@ -66,7 +66,7 @@ public:
void mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
@@ -107,9 +107,9 @@ QRectF AlignButtonsItem::boundingRect() const
void AlignButtonsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
void AlignButtonsItem::clear()
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/alignlineitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/alignlineitem.cpp
index 998f23b079..835e959fa6 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/alignlineitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/alignlineitem.cpp
@@ -77,9 +77,9 @@ QRectF AlignLineItem::boundingRect() const
void AlignLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
} // namespace qmt
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/arrowitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/arrowitem.cpp
index 93a4a10f19..6782723ce4 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/arrowitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/arrowitem.cpp
@@ -79,9 +79,9 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
#ifdef DEBUG_PAINT_SHAPE
painter->setPen(QPen(Qt::blue));
@@ -323,9 +323,9 @@ QRectF ArrowItem::boundingRect() const
void ArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
#ifdef DEBUG_PAINT_SHAPE
painter->setPen(QPen(Qt::blue));
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/customiconitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/customiconitem.cpp
index 9f8c429cd5..374f1e786a 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/customiconitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/customiconitem.cpp
@@ -96,8 +96,8 @@ QRectF CustomIconItem::boundingRect() const
void CustomIconItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
painter->save();
painter->setBrush(m_brush);
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/pathselectionitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/pathselectionitem.cpp
index 78fa4fff80..4b613c0465 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/pathselectionitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/pathselectionitem.cpp
@@ -157,9 +157,9 @@ QRectF PathSelectionItem::boundingRect() const
void PathSelectionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
#ifdef DEBUG_PAINT_SHAPE
painter->save();
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/rectangularselectionitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/rectangularselectionitem.cpp
index 64936fb773..6478e41f1e 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/rectangularselectionitem.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/rectangularselectionitem.cpp
@@ -111,9 +111,9 @@ QRectF RectangularSelectionItem::boundingRect() const
void RectangularSelectionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(painter)
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
}
void RectangularSelectionItem::setRect(const QRectF &rectangle)
@@ -226,7 +226,7 @@ void RectangularSelectionItem::update()
void RectangularSelectionItem::moveHandle(Handle handle, const QPointF &deltaMove, HandleStatus handleStatus, HandleQualifier handleQualifier)
{
- Q_UNUSED(handleQualifier);
+ Q_UNUSED(handleQualifier)
switch (handleStatus) {
case Press:
diff --git a/src/libs/modelinglib/qmt/diagram_scene/parts/relationstarter.cpp b/src/libs/modelinglib/qmt/diagram_scene/parts/relationstarter.cpp
index 705f673ac5..ab07d7f2b3 100644
--- a/src/libs/modelinglib/qmt/diagram_scene/parts/relationstarter.cpp
+++ b/src/libs/modelinglib/qmt/diagram_scene/parts/relationstarter.cpp
@@ -59,8 +59,8 @@ QRectF RelationStarter::boundingRect() const
void RelationStarter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- Q_UNUSED(option);
- Q_UNUSED(widget);
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
painter->save();
painter->setPen(pen());
@@ -153,7 +153,7 @@ void RelationStarter::keyPressEvent(QKeyEvent *event)
void RelationStarter::focusOutEvent(QFocusEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
if (m_currentPreviewArrow) {
m_currentPreviewArrow->scene()->removeItem(m_currentPreviewArrow);
delete m_currentPreviewArrow;
diff --git a/src/libs/modelinglib/qmt/diagram_widgets_ui/stackeddiagramsview.cpp b/src/libs/modelinglib/qmt/diagram_widgets_ui/stackeddiagramsview.cpp
index 7592bc57db..62253e626c 100644
--- a/src/libs/modelinglib/qmt/diagram_widgets_ui/stackeddiagramsview.cpp
+++ b/src/libs/modelinglib/qmt/diagram_widgets_ui/stackeddiagramsview.cpp
@@ -102,7 +102,7 @@ void StackedDiagramsView::onCurrentChanged(int tabIndex)
void StackedDiagramsView::onDiagramRenamed(const MDiagram *diagram)
{
- Q_UNUSED(diagram);
+ Q_UNUSED(diagram)
// nothing to do!
}
diff --git a/src/libs/modelinglib/qmt/infrastructure/geometryutilities.cpp b/src/libs/modelinglib/qmt/infrastructure/geometryutilities.cpp
index 9968fbf0b8..5a42bf1f33 100644
--- a/src/libs/modelinglib/qmt/infrastructure/geometryutilities.cpp
+++ b/src/libs/modelinglib/qmt/infrastructure/geometryutilities.cpp
@@ -58,7 +58,11 @@ bool GeometryUtilities::intersect(const QPolygonF &polygon, const QLineF &line,
{
for (int i = 0; i <= polygon.size() - 2; ++i) {
QLineF polygonLine(polygon.at(i), polygon.at(i+1));
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QLineF::IntersectType intersectionType = polygonLine.intersect(line, intersectionPoint);
+#else
+ QLineF::IntersectType intersectionType = polygonLine.intersects(line, intersectionPoint);
+#endif
if (intersectionType == QLineF::BoundedIntersection) {
if (intersectionLine)
*intersectionLine = polygonLine;
diff --git a/src/libs/modelinglib/qmt/model/melement.cpp b/src/libs/modelinglib/qmt/model/melement.cpp
index f73a56ad94..8ffb57d4a5 100644
--- a/src/libs/modelinglib/qmt/model/melement.cpp
+++ b/src/libs/modelinglib/qmt/model/melement.cpp
@@ -39,7 +39,7 @@ void MExpansion::assign(MElement *lhs, const MElement &rhs)
void MExpansion::destroy(MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
delete this;
}
diff --git a/src/libs/modelinglib/qmt/model_controller/mchildrenvisitor.cpp b/src/libs/modelinglib/qmt/model_controller/mchildrenvisitor.cpp
index f8ed8800f0..4542a5a3af 100644
--- a/src/libs/modelinglib/qmt/model_controller/mchildrenvisitor.cpp
+++ b/src/libs/modelinglib/qmt/model_controller/mchildrenvisitor.cpp
@@ -40,7 +40,7 @@ namespace qmt {
void MChildrenVisitor::visitMElement(MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void MChildrenVisitor::visitMObject(MObject *object)
diff --git a/src/libs/modelinglib/qmt/model_controller/mclonevisitor.cpp b/src/libs/modelinglib/qmt/model_controller/mclonevisitor.cpp
index a8d431a87e..a2a6e3392f 100644
--- a/src/libs/modelinglib/qmt/model_controller/mclonevisitor.cpp
+++ b/src/libs/modelinglib/qmt/model_controller/mclonevisitor.cpp
@@ -50,7 +50,7 @@ MCloneVisitor::MCloneVisitor()
void MCloneVisitor::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_cloned);
}
@@ -149,7 +149,7 @@ MCloneDeepVisitor::MCloneDeepVisitor()
void MCloneDeepVisitor::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(m_cloned);
}
diff --git a/src/libs/modelinglib/qmt/model_controller/mvoidvisitor.cpp b/src/libs/modelinglib/qmt/model_controller/mvoidvisitor.cpp
index 4e475ce3dd..329f6ed0c7 100644
--- a/src/libs/modelinglib/qmt/model_controller/mvoidvisitor.cpp
+++ b/src/libs/modelinglib/qmt/model_controller/mvoidvisitor.cpp
@@ -45,7 +45,7 @@ namespace qmt {
void MVoidVisitor::visitMElement(MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void MVoidVisitor::visitMObject(MObject *object)
@@ -110,7 +110,7 @@ void MVoidVisitor::visitMConnection(MConnection *connection)
void MVoidConstVisitor::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
}
void MVoidConstVisitor::visitMObject(const MObject *object)
diff --git a/src/libs/modelinglib/qmt/model_ui/sortedtreemodel.cpp b/src/libs/modelinglib/qmt/model_ui/sortedtreemodel.cpp
index 56a7524b66..6f47b26938 100644
--- a/src/libs/modelinglib/qmt/model_ui/sortedtreemodel.cpp
+++ b/src/libs/modelinglib/qmt/model_ui/sortedtreemodel.cpp
@@ -79,9 +79,9 @@ bool SortedTreeModel::lessThan(const QModelIndex &left, const QModelIndex &right
void SortedTreeModel::onTreeModelRowsInserted(const QModelIndex &parent, int start, int end)
{
- Q_UNUSED(parent);
- Q_UNUSED(start);
- Q_UNUSED(end);
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
startDelayedSortTimer();
}
diff --git a/src/libs/modelinglib/qmt/model_ui/treemodel.cpp b/src/libs/modelinglib/qmt/model_ui/treemodel.cpp
index 18d1cb2c23..ce7bb0504e 100644
--- a/src/libs/modelinglib/qmt/model_ui/treemodel.cpp
+++ b/src/libs/modelinglib/qmt/model_ui/treemodel.cpp
@@ -80,13 +80,13 @@ public:
void visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(false);
}
void visitMObject(const MObject *object)
{
- Q_UNUSED(object);
+ Q_UNUSED(object)
QMT_ASSERT(m_item, return);
m_item->setEditable(false);
}
@@ -156,7 +156,7 @@ public:
void visitMRelation(const MRelation *relation)
{
- Q_UNUSED(relation);
+ Q_UNUSED(relation)
QMT_ASSERT(m_item, return);
m_item->setEditable(false);
m_item->setData(TreeModel::Relation, TreeModel::RoleItemType);
@@ -216,7 +216,7 @@ public:
void visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(false);
}
@@ -502,8 +502,8 @@ void TreeModel::onEndResetModel()
void TreeModel::onBeginUpdateObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = UpdateElement;
}
@@ -536,8 +536,8 @@ void TreeModel::onEndUpdateObject(int row, const MObject *parent)
void TreeModel::onBeginInsertObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = InsertElement;
}
@@ -569,8 +569,8 @@ void TreeModel::onBeginRemoveObject(int row, const MObject *parent)
void TreeModel::onEndRemoveObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == RemoveElement);
m_busyState = NotBusy;
}
@@ -602,8 +602,8 @@ void TreeModel::onEndMoveObject(int row, const MObject *owner)
void TreeModel::onBeginUpdateRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = UpdateRelation;
}
@@ -637,8 +637,8 @@ void TreeModel::onEndUpdateRelation(int row, const MObject *parent)
void TreeModel::onBeginInsertRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == NotBusy);
m_busyState = InsertRelation;
}
@@ -668,8 +668,8 @@ void TreeModel::onBeginRemoveRelation(int row, const MObject *parent)
void TreeModel::onEndRemoveRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
QMT_CHECK(m_busyState == RemoveRelation);
m_busyState = NotBusy;
}
@@ -699,7 +699,7 @@ void TreeModel::onEndMoveRelation(int row, const MObject *owner)
void TreeModel::onRelationEndChanged(MRelation *relation, MObject *endObject)
{
- Q_UNUSED(endObject);
+ Q_UNUSED(endObject)
QMT_CHECK(m_busyState == NotBusy);
MObject *parent = relation->owner();
@@ -725,8 +725,8 @@ void TreeModel::onRelationEndChanged(MRelation *relation, MObject *endObject)
void TreeModel::onModelDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright)
{
- Q_UNUSED(topleft);
- Q_UNUSED(bottomright);
+ Q_UNUSED(topleft)
+ Q_UNUSED(bottomright)
// TODO fix editing object name in model tree
// item->text() no longer returns a simple object name
// classes contains namespace label
diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp
index 3bcc0727fb..b3cfc13a0b 100644
--- a/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp
+++ b/src/libs/modelinglib/qmt/model_widgets_ui/modeltreeview.cpp
@@ -108,7 +108,7 @@ void ModelTreeView::selectFromSourceModelIndex(const QModelIndex &index)
void ModelTreeView::startDrag(Qt::DropActions supportedActions)
{
- Q_UNUSED(supportedActions);
+ Q_UNUSED(supportedActions)
TreeModel *treeModel = m_sortedTreeModel->treeModel();
QMT_ASSERT(treeModel, return);
@@ -231,7 +231,7 @@ void ModelTreeView::dropEvent(QDropEvent *event)
void ModelTreeView::focusInEvent(QFocusEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
emit treeViewActivated();
}
diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/palettebox.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/palettebox.cpp
index 2f5f8d8487..109427b7c2 100644
--- a/src/libs/modelinglib/qmt/model_widgets_ui/palettebox.cpp
+++ b/src/libs/modelinglib/qmt/model_widgets_ui/palettebox.cpp
@@ -92,7 +92,7 @@ void PaletteBox::setCurrentIndex(int index)
void PaletteBox::paintEvent(QPaintEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
QPainter painter(this);
qreal w = static_cast<qreal>(width()) / static_cast<qreal>(m_brushes.size());
diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/propertiesview.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/propertiesview.cpp
index 350803d168..a63a409494 100644
--- a/src/libs/modelinglib/qmt/model_widgets_ui/propertiesview.cpp
+++ b/src/libs/modelinglib/qmt/model_widgets_ui/propertiesview.cpp
@@ -209,8 +209,8 @@ void PropertiesView::onEndResetModel()
void PropertiesView::onBeginUpdateObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onEndUpdateObject(int row, const MObject *parent)
@@ -222,14 +222,14 @@ void PropertiesView::onEndUpdateObject(int row, const MObject *parent)
void PropertiesView::onBeginInsertObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onEndInsertObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onBeginRemoveObject(int row, const MObject *parent)
@@ -241,14 +241,14 @@ void PropertiesView::onBeginRemoveObject(int row, const MObject *parent)
void PropertiesView::onEndRemoveObject(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onBeginMoveObject(int formerRow, const MObject *formerOwner)
{
- Q_UNUSED(formerRow);
- Q_UNUSED(formerOwner);
+ Q_UNUSED(formerRow)
+ Q_UNUSED(formerOwner)
}
void PropertiesView::onEndMoveObject(int row, const MObject *owner)
@@ -260,8 +260,8 @@ void PropertiesView::onEndMoveObject(int row, const MObject *owner)
void PropertiesView::onBeginUpdateRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onEndUpdateRelation(int row, const MObject *parent)
@@ -273,14 +273,14 @@ void PropertiesView::onEndUpdateRelation(int row, const MObject *parent)
void PropertiesView::onBeginInsertRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onEndInsertRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onBeginRemoveRelation(int row, const MObject *parent)
@@ -292,14 +292,14 @@ void PropertiesView::onBeginRemoveRelation(int row, const MObject *parent)
void PropertiesView::onEndRemoveRelation(int row, const MObject *parent)
{
- Q_UNUSED(row);
- Q_UNUSED(parent);
+ Q_UNUSED(row)
+ Q_UNUSED(parent)
}
void PropertiesView::onBeginMoveRelation(int formerRow, const MObject *formerOwner)
{
- Q_UNUSED(formerRow);
- Q_UNUSED(formerOwner);
+ Q_UNUSED(formerRow)
+ Q_UNUSED(formerOwner)
}
void PropertiesView::onEndMoveRelation(int row, const MObject *owner)
@@ -311,7 +311,7 @@ void PropertiesView::onEndMoveRelation(int row, const MObject *owner)
void PropertiesView::onRelationEndChanged(MRelation *relation, MObject *endObject)
{
- Q_UNUSED(endObject);
+ Q_UNUSED(endObject)
if (relation && m_selectedModelElements.contains(relation))
m_mview->update(m_selectedModelElements);
}
@@ -327,7 +327,7 @@ void PropertiesView::onEndResetAllDiagrams()
void PropertiesView::onBeginResetDiagram(const MDiagram *diagram)
{
- Q_UNUSED(diagram);
+ Q_UNUSED(diagram)
}
void PropertiesView::onEndResetDiagram(const MDiagram *diagram)
@@ -338,8 +338,8 @@ void PropertiesView::onEndResetDiagram(const MDiagram *diagram)
void PropertiesView::onBeginUpdateElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
}
void PropertiesView::onEndUpdateElement(int row, const MDiagram *diagram)
@@ -353,14 +353,14 @@ void PropertiesView::onEndUpdateElement(int row, const MDiagram *diagram)
void PropertiesView::onBeginInsertElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
}
void PropertiesView::onEndInsertElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
}
void PropertiesView::onBeginRemoveElement(int row, const MDiagram *diagram)
@@ -374,8 +374,8 @@ void PropertiesView::onBeginRemoveElement(int row, const MDiagram *diagram)
void PropertiesView::onEndRemoveElement(int row, const MDiagram *diagram)
{
- Q_UNUSED(row);
- Q_UNUSED(diagram);
+ Q_UNUSED(row)
+ Q_UNUSED(diagram)
}
void PropertiesView::beginUpdate(MElement *modelElement)
diff --git a/src/libs/modelinglib/qmt/model_widgets_ui/propertiesviewmview.cpp b/src/libs/modelinglib/qmt/model_widgets_ui/propertiesviewmview.cpp
index c8b11d44e1..31c764c5ad 100644
--- a/src/libs/modelinglib/qmt/model_widgets_ui/propertiesviewmview.cpp
+++ b/src/libs/modelinglib/qmt/model_widgets_ui/propertiesviewmview.cpp
@@ -341,7 +341,7 @@ void PropertiesView::MView::edit()
void PropertiesView::MView::visitMElement(const MElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
prepare();
if (!m_stereotypeComboBox) {
@@ -352,8 +352,13 @@ void PropertiesView::MView::visitMElement(const MElement *element)
m_stereotypeComboBox->addItems(m_propertiesView->stereotypeController()->knownStereotypes(m_stereotypeElement));
connect(m_stereotypeComboBox->lineEdit(), &QLineEdit::textEdited,
this, &PropertiesView::MView::onStereotypesChanged);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
connect(m_stereotypeComboBox, QOverload<const QString &>::of(&QComboBox::activated),
this, &PropertiesView::MView::onStereotypesChanged);
+#else
+ connect(m_stereotypeComboBox, &QComboBox::textActivated,
+ this, &PropertiesView::MView::onStereotypesChanged);
+#endif
}
if (!m_stereotypeComboBox->hasFocus()) {
QList<QString> stereotypeList;
@@ -848,7 +853,7 @@ void PropertiesView::MView::visitMConnection(const MConnection *connection)
void PropertiesView::MView::visitDElement(const DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
if (m_modelElements.size() > 0 && m_modelElements.at(0)) {
m_propertiesTitle.clear();
diff --git a/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp b/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp
index 1f1eaab643..f2da9a9292 100644
--- a/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp
+++ b/src/libs/modelinglib/qmt/style/defaultstyleengine.cpp
@@ -144,15 +144,15 @@ class BoundaryStyleKey
uint qHash(const BoundaryStyleKey &styleKey)
{
- Q_UNUSED(styleKey);
+ Q_UNUSED(styleKey)
return 1;
}
bool operator==(const BoundaryStyleKey &lhs, const BoundaryStyleKey &rhs)
{
- Q_UNUSED(lhs);
- Q_UNUSED(rhs);
+ Q_UNUSED(lhs)
+ Q_UNUSED(rhs)
return true;
}
@@ -164,15 +164,15 @@ class SwimlaneStyleKey
uint qHash(const SwimlaneStyleKey &styleKey)
{
- Q_UNUSED(styleKey);
+ Q_UNUSED(styleKey)
return 1;
}
bool operator==(const SwimlaneStyleKey &lhs, const SwimlaneStyleKey &rhs)
{
- Q_UNUSED(lhs);
- Q_UNUSED(rhs);
+ Q_UNUSED(lhs)
+ Q_UNUSED(rhs)
return true;
}
@@ -344,7 +344,7 @@ const Style *DefaultStyleEngine::applyObjectStyle(const Style *baseStyle, const
const Style *DefaultStyleEngine::applyRelationStyle(const Style *baseStyle, const StyledRelation &styledRelation,
const Parameters *parameters)
{
- Q_UNUSED(parameters);
+ Q_UNUSED(parameters)
ElementType elementType = objectType(styledRelation.endA());
RelationStyleKey key(elementType, styledRelation.endA() ? styledRelation.endA()->visualPrimaryRole() : DObject::PrimaryRoleNormal);
@@ -391,14 +391,14 @@ const Style *DefaultStyleEngine::applyAnnotationStyle(const Style *baseStyle, co
const Style *DefaultStyleEngine::applyBoundaryStyle(const Style *baseStyle, const DBoundary *boundary,
const Parameters *parameters)
{
- Q_UNUSED(boundary);
+ Q_UNUSED(boundary)
return applyBoundaryStyle(baseStyle, parameters);
}
const Style *DefaultStyleEngine::applySwimlaneStyle(const Style *baseStyle, const DSwimlane *swimlane, const StyleEngine::Parameters *parameters)
{
- Q_UNUSED(swimlane);
+ Q_UNUSED(swimlane)
return applySwimlaneStyle(baseStyle, parameters);
}
@@ -406,7 +406,7 @@ const Style *DefaultStyleEngine::applySwimlaneStyle(const Style *baseStyle, cons
const Style *DefaultStyleEngine::applyAnnotationStyle(const Style *baseStyle, DAnnotation::VisualRole visualRole,
const StyleEngine::Parameters *parameters)
{
- Q_UNUSED(parameters);
+ Q_UNUSED(parameters)
AnnotationStyleKey key(visualRole);
const Style *derivedStyle = m_annotationStyleMap.value(key);
@@ -447,7 +447,7 @@ const Style *DefaultStyleEngine::applyAnnotationStyle(const Style *baseStyle, DA
const Style *DefaultStyleEngine::applyBoundaryStyle(const Style *baseStyle, const StyleEngine::Parameters *parameters)
{
- Q_UNUSED(parameters);
+ Q_UNUSED(parameters)
BoundaryStyleKey key;
const Style *derivedStyle = m_boundaryStyleMap.value(key);
@@ -463,7 +463,7 @@ const Style *DefaultStyleEngine::applyBoundaryStyle(const Style *baseStyle, cons
const Style *DefaultStyleEngine::applySwimlaneStyle(const Style *baseStyle, const StyleEngine::Parameters *parameters)
{
- Q_UNUSED(parameters);
+ Q_UNUSED(parameters)
SwimlaneStyleKey key;
const Style *derivedStyle = m_swimlaneStyleMap.value(key);
@@ -614,7 +614,7 @@ QColor DefaultStyleEngine::fillColor(ElementType elementType, const ObjectVisual
QColor DefaultStyleEngine::textColor(const DObject *object, int depth)
{
- Q_UNUSED(depth);
+ Q_UNUSED(depth)
QColor textColor;
DObject::VisualPrimaryRole visualRole = object ? object->visualPrimaryRole() : DObject::PrimaryRoleNormal;
@@ -627,7 +627,7 @@ QColor DefaultStyleEngine::textColor(const DObject *object, int depth)
QColor DefaultStyleEngine::textColor(ElementType elementType, const ObjectVisuals &objectVisuals)
{
- Q_UNUSED(elementType);
+ Q_UNUSED(elementType)
QColor textColor;
if (objectVisuals.visualSecondaryRole() == DObject::SecondaryRoleSoften)
diff --git a/src/libs/modelinglib/qmt/tasks/alignonrastervisitor.cpp b/src/libs/modelinglib/qmt/tasks/alignonrastervisitor.cpp
index e896f08462..f36060cbed 100644
--- a/src/libs/modelinglib/qmt/tasks/alignonrastervisitor.cpp
+++ b/src/libs/modelinglib/qmt/tasks/alignonrastervisitor.cpp
@@ -73,7 +73,7 @@ void AlignOnRasterVisitor::setDiagram(MDiagram *diagram)
void AlignOnRasterVisitor::visitDElement(DElement *element)
{
- Q_UNUSED(element);
+ Q_UNUSED(element)
QMT_CHECK(false);
}
@@ -116,7 +116,7 @@ void AlignOnRasterVisitor::visitDItem(DItem *item)
void AlignOnRasterVisitor::visitDRelation(DRelation *relation)
{
- Q_UNUSED(relation);
+ Q_UNUSED(relation)
}
void AlignOnRasterVisitor::visitDInheritance(DInheritance *inheritance)
diff --git a/src/libs/modelinglib/qmt/tasks/diagramscenecontroller.cpp b/src/libs/modelinglib/qmt/tasks/diagramscenecontroller.cpp
index 6cdc299472..ec15b0f7d8 100644
--- a/src/libs/modelinglib/qmt/tasks/diagramscenecontroller.cpp
+++ b/src/libs/modelinglib/qmt/tasks/diagramscenecontroller.cpp
@@ -90,7 +90,7 @@ public:
void visitMObject(const MObject *object) override
{
- Q_UNUSED(object);
+ Q_UNUSED(object)
if (auto connection = dynamic_cast<const MConnection *>(m_relation)) {
CustomRelation customRelation = m_stereotypeController->findCustomRelation(connection->customRelationId());
if (!customRelation.isNull()) {
@@ -594,7 +594,7 @@ QRectF alignObjectHeight(DObject *object, const QSizeF &size)
QRectF alignObjectSize(DObject *object, const QSizeF &size)
{
- Q_UNUSED(object);
+ Q_UNUSED(object)
QRectF rect;
rect.setX(-size.width() / 2.0);
diff --git a/src/libs/modelinglib/qtserialization/inc/qark/typeregistry.h b/src/libs/modelinglib/qtserialization/inc/qark/typeregistry.h
index e9b2f0699a..a706bbc66d 100644
--- a/src/libs/modelinglib/qtserialization/inc/qark/typeregistry.h
+++ b/src/libs/modelinglib/qtserialization/inc/qark/typeregistry.h
@@ -246,7 +246,7 @@ QString typeUid()
template<class T>
QString typeUid(const T &t)
{
- Q_UNUSED(t); // avoid warning in some compilers
+ Q_UNUSED(t) // avoid warning in some compilers
#if !defined(QT_NO_DEBUG) // avoid warning about unused function ::hasNameToUidMap in Qt >= 5.5
QMT_CHECK_X((registry::TypeNameRegistry<T>::hasNameToUidMap()),
"typeUid<T>()", "type maps are not correctly initialized");
@@ -260,7 +260,7 @@ QString typeUid(const T &t)
template<class Archive, class T>
typename registry::TypeRegistry<Archive, T>::TypeInfo typeInfo(const T &t)
{
- Q_UNUSED(t); // avoid warning in some compilers
+ Q_UNUSED(t) // avoid warning in some compilers
#if !defined(QT_NO_DEBUG) // avoid warning about unused function ::hasNameToUidMap in Qt >= 5.5
QMT_CHECK_X((registry::TypeRegistry<Archive,T>::hasMap()),
qPrintable(QString(QLatin1String("TypeRegistry<Archive, %1>::typeInfo(const T&)")).arg(typeUid<T>())),
diff --git a/src/libs/qmldebug/qmldebugcommandlinearguments.h b/src/libs/qmldebug/qmldebugcommandlinearguments.h
index 0c9979647a..f3a6017493 100644
--- a/src/libs/qmldebug/qmldebugcommandlinearguments.h
+++ b/src/libs/qmldebug/qmldebugcommandlinearguments.h
@@ -25,7 +25,9 @@
#pragma once
-#include <utils/port.h>
+#include <coreplugin/id.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
#include <QString>
#include <QUrl>
@@ -69,9 +71,10 @@ inline QString qmlDebugCommandLineArguments(QmlDebugServicesPreset services,
}
inline QString qmlDebugTcpArguments(QmlDebugServicesPreset services,
- Utils::Port port, bool block = true)
+ const QUrl &server, bool block = true)
{
- return qmlDebugCommandLineArguments(services, QString("port:%1").arg(port.number()), block);
+ // TODO: Also generate host:<host> if applicable.
+ return qmlDebugCommandLineArguments(services, QString("port:%1").arg(server.port()), block);
}
inline QString qmlDebugNativeArguments(QmlDebugServicesPreset services, bool block = true)
@@ -85,4 +88,24 @@ inline QString qmlDebugLocalArguments(QmlDebugServicesPreset services, const QSt
return qmlDebugCommandLineArguments(services, QLatin1String("file:") + socket, block);
}
+inline Core::Id runnerIdForRunMode(Core::Id runMode)
+{
+ if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
+ return ProjectExplorer::Constants::QML_PROFILER_RUNNER;
+ if (runMode == ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE)
+ return ProjectExplorer::Constants::QML_PREVIEW_RUNNER;
+ return {};
+}
+
+inline QmlDebugServicesPreset servicesForRunMode(Core::Id runMode)
+{
+ if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
+ return QmlDebug::QmlProfilerServices;
+ if (runMode == ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE)
+ return QmlDebug::QmlPreviewServices;
+ if (runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE)
+ return QmlDebug::QmlDebuggerServices;
+ return {};
+}
+
} // namespace QmlDebug
diff --git a/src/libs/qmldebug/qmldebugconnection.cpp b/src/libs/qmldebug/qmldebugconnection.cpp
index 629360a8bc..b06a88f947 100644
--- a/src/libs/qmldebug/qmldebugconnection.cpp
+++ b/src/libs/qmldebug/qmldebugconnection.cpp
@@ -250,7 +250,7 @@ QmlDebugConnection::QmlDebugConnection(QObject *parent)
qRegisterMetaType<QAbstractSocket::SocketError>(),
qRegisterMetaType<QLocalSocket::LocalSocketError>()
};
- Q_UNUSED(metaTypes);
+ Q_UNUSED(metaTypes)
}
QmlDebugConnection::~QmlDebugConnection()
diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.cpp b/src/libs/qmldebug/qmldebugconnectionmanager.cpp
index 217260d8d2..173bbb2d97 100644
--- a/src/libs/qmldebug/qmldebugconnectionmanager.cpp
+++ b/src/libs/qmldebug/qmldebugconnectionmanager.cpp
@@ -158,7 +158,7 @@ void QmlDebugConnectionManager::retryConnect()
void QmlDebugConnectionManager::logState(const QString &message)
{
- Q_UNUSED(message);
+ Q_UNUSED(message)
}
QmlDebugConnection *QmlDebugConnectionManager::connection() const
diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.h b/src/libs/qmldebug/qmldebugconnectionmanager.h
index ccda63f38f..82c4a8bbe4 100644
--- a/src/libs/qmldebug/qmldebugconnectionmanager.h
+++ b/src/libs/qmldebug/qmldebugconnectionmanager.h
@@ -38,7 +38,7 @@ class QMLDEBUG_EXPORT QmlDebugConnectionManager : public QObject
{
Q_OBJECT
public:
- explicit QmlDebugConnectionManager(QObject *parent = 0);
+ explicit QmlDebugConnectionManager(QObject *parent = nullptr);
~QmlDebugConnectionManager() override;
void connectToServer(const QUrl &server);
diff --git a/src/libs/qmldebug/qmloutputparser.h b/src/libs/qmldebug/qmloutputparser.h
index 60db2e4d52..cf07d9c798 100644
--- a/src/libs/qmldebug/qmloutputparser.h
+++ b/src/libs/qmldebug/qmloutputparser.h
@@ -36,7 +36,7 @@ class QMLDEBUG_EXPORT QmlOutputParser : public QObject
{
Q_OBJECT
public:
- QmlOutputParser(QObject *parent = 0);
+ QmlOutputParser(QObject *parent = nullptr);
void setNoOutputText(const QString &text);
void processOutput(const QString &output);
diff --git a/src/libs/qmldebug/qpacketprotocol.cpp b/src/libs/qmldebug/qpacketprotocol.cpp
index dbe4088ed2..3bbabc1cf7 100644
--- a/src/libs/qmldebug/qpacketprotocol.cpp
+++ b/src/libs/qmldebug/qpacketprotocol.cpp
@@ -164,7 +164,7 @@ public:
qint32 inProgressSizeLE;
const qint64 read = dev->read((char *)&inProgressSizeLE, sizeof(qint32));
Q_ASSERT(read == sizeof(qint32));
- Q_UNUSED(read);
+ Q_UNUSED(read)
inProgressSize = qFromLittleEndian(inProgressSizeLE);
// Check sizing constraints
diff --git a/src/libs/qmldebug/qpacketprotocol.h b/src/libs/qmldebug/qpacketprotocol.h
index 6931c05ec1..f77ef0e93d 100644
--- a/src/libs/qmldebug/qpacketprotocol.h
+++ b/src/libs/qmldebug/qpacketprotocol.h
@@ -43,7 +43,7 @@ class QMLDEBUG_EXPORT QPacketProtocol : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QPacketProtocol)
public:
- explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0);
+ explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr);
void send(const QByteArray &data);
qint64 packetsAvailable() const;
diff --git a/src/libs/qmleditorwidgets/colorbox.h b/src/libs/qmleditorwidgets/colorbox.h
index dd576f61f2..52dfdf6585 100644
--- a/src/libs/qmleditorwidgets/colorbox.h
+++ b/src/libs/qmleditorwidgets/colorbox.h
@@ -42,7 +42,7 @@ class QMLEDITORWIDGETS_EXPORT ColorBox : public QWidget
Q_PROPERTY(int alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
public:
- ColorBox(QWidget *parent = 0) : QWidget(parent), m_color(Qt::white), m_saturatedColor(Qt::white), m_mousePressed(false), m_lastHue(0)
+ ColorBox(QWidget *parent = nullptr) : QWidget(parent), m_color(Qt::white), m_saturatedColor(Qt::white), m_mousePressed(false), m_lastHue(0)
{
setFixedWidth(130);
setFixedHeight(130);
diff --git a/src/libs/qmleditorwidgets/colorbutton.h b/src/libs/qmleditorwidgets/colorbutton.h
index 8928f65da3..a7ad15cc7e 100644
--- a/src/libs/qmleditorwidgets/colorbutton.h
+++ b/src/libs/qmleditorwidgets/colorbutton.h
@@ -40,7 +40,7 @@ Q_PROPERTY(bool noColor READ noColor WRITE setNoColor)
Q_PROPERTY(bool showArrow READ showArrow WRITE setShowArrow)
public:
- ColorButton(QWidget *parent = 0) :
+ ColorButton(QWidget *parent = nullptr) :
QToolButton (parent),
m_colorString(QLatin1String("#ffffff")),
m_noColor(false),
diff --git a/src/libs/qmleditorwidgets/contextpanetextwidget.h b/src/libs/qmleditorwidgets/contextpanetextwidget.h
index 6249fe4e85..ab706dc0c3 100644
--- a/src/libs/qmleditorwidgets/contextpanetextwidget.h
+++ b/src/libs/qmleditorwidgets/contextpanetextwidget.h
@@ -44,7 +44,7 @@ class QMLEDITORWIDGETS_EXPORT ContextPaneTextWidget : public QWidget
Q_OBJECT
public:
- explicit ContextPaneTextWidget(QWidget *parent = 0);
+ explicit ContextPaneTextWidget(QWidget *parent = nullptr);
~ContextPaneTextWidget();
void setProperties(QmlJS::PropertyReader *propertyReader);
void setVerticalAlignmentVisible(bool);
diff --git a/src/libs/qmleditorwidgets/contextpanewidget.cpp b/src/libs/qmleditorwidgets/contextpanewidget.cpp
index d09902be1b..db8b69a47f 100644
--- a/src/libs/qmleditorwidgets/contextpanewidget.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidget.cpp
@@ -155,10 +155,9 @@ void DragWidget::enterEvent(QEvent *)
setCursor(Qt::ArrowCursor);
}
-ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
+ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(nullptr)
{
QGridLayout *layout = new QGridLayout(this);
- layout->setMargin(0);
layout->setContentsMargins(1, 1, 1, 1);
layout->setSpacing(0);
m_toolButton = new QToolButton(this);
@@ -207,7 +206,7 @@ ContextPaneWidget::~ContextPaneWidget()
//if the pane was never activated the widget is not in a widget tree
if (!m_bauhausColorDialog.isNull()) {
delete m_bauhausColorDialog.data();
- m_bauhausColorDialog = 0;
+ m_bauhausColorDialog = nullptr;
}
}
diff --git a/src/libs/qmleditorwidgets/contextpanewidget.h b/src/libs/qmleditorwidgets/contextpanewidget.h
index 84ebf85b24..deb5d45752 100644
--- a/src/libs/qmleditorwidgets/contextpanewidget.h
+++ b/src/libs/qmleditorwidgets/contextpanewidget.h
@@ -51,7 +51,7 @@ class QMLEDITORWIDGETS_EXPORT DragWidget : public QFrame
Q_OBJECT
public:
- explicit DragWidget(QWidget *parent = 0);
+ explicit DragWidget(QWidget *parent = nullptr);
void setSecondaryTarget(QWidget* w)
{ m_secondaryTarget = w; }
@@ -76,7 +76,7 @@ class QMLEDITORWIDGETS_EXPORT ContextPaneWidget : public DragWidget
Q_OBJECT
public:
- explicit ContextPaneWidget(QWidget *parent = 0);
+ explicit ContextPaneWidget(QWidget *parent = nullptr);
~ContextPaneWidget() override;
void activate(const QPoint &pos, const QPoint &alternative, const QPoint &alternative2, bool pinned);
void rePosition(const QPoint &pos, const QPoint &alternative , const QPoint &alternative3, bool pinned);
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
index dcc3e9ecc6..b2912ceb42 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.cpp
@@ -884,7 +884,6 @@ PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *horizontalLayout = new QHBoxLayout();
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
- layout->setMargin(0);
layout->setContentsMargins(2, 2, 2, 16);
layout->setSpacing(4);
QToolButton *toolButton = new QToolButton(this);
@@ -942,7 +941,7 @@ void PreviewDialog::setPixmap(const QPixmap &p, int zoom)
void PreviewDialog::wheelEvent(QWheelEvent* event)
{
- int delta = event->delta();
+ const auto delta = event->angleDelta().y();
event->accept();
if (delta > 0) {
if (m_zoom == 1)
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetimage.h b/src/libs/qmleditorwidgets/contextpanewidgetimage.h
index a031447eec..89c7413e77 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetimage.h
+++ b/src/libs/qmleditorwidgets/contextpanewidgetimage.h
@@ -52,7 +52,7 @@ class PreviewLabel : public QLabel
Q_OBJECT
public:
- PreviewLabel(QWidget *parent = 0);
+ PreviewLabel(QWidget *parent = nullptr);
void setZoom(int);
void setIsBorderImage(bool b);
void setMargins(int left, int top, int right, int bottom);
@@ -91,7 +91,7 @@ class PreviewDialog : public DragWidget
Q_OBJECT
public:
- PreviewDialog(QWidget *parent = 0);
+ PreviewDialog(QWidget *parent = nullptr);
void setPixmap(const QPixmap &p, int zoom = 1);
void setZoom(int z);
void setIsBorderImage(bool b);
@@ -118,7 +118,7 @@ class QMLEDITORWIDGETS_EXPORT ContextPaneWidgetImage : public QWidget
Q_OBJECT
public:
- explicit ContextPaneWidgetImage(QWidget *parent = 0, bool borderImage = false);
+ explicit ContextPaneWidgetImage(QWidget *parent = nullptr, bool borderImage = false);
~ContextPaneWidgetImage();
void setProperties(QmlJS::PropertyReader *propertyReader);
void setPath(const QString& path);
@@ -161,7 +161,7 @@ class LabelFilter: public QObject {
Q_OBJECT
public:
- LabelFilter(QObject* parent =0) : QObject(parent) {}
+ LabelFilter(QObject* parent =nullptr) : QObject(parent) {}
signals:
void doubleClicked();
protected:
@@ -172,7 +172,7 @@ class WheelFilter: public QObject {
Q_OBJECT
public:
- WheelFilter(QObject* parent =0) : QObject(parent) {}
+ WheelFilter(QObject* parent =nullptr) : QObject(parent) {}
void setTarget(QObject *target) { m_target = target; }
protected:
bool eventFilter(QObject *obj, QEvent *event);
diff --git a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
index b1f259ae04..1ae75cc982 100644
--- a/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
+++ b/src/libs/qmleditorwidgets/contextpanewidgetrectangle.h
@@ -41,7 +41,7 @@ class QMLEDITORWIDGETS_EXPORT ContextPaneWidgetRectangle : public QWidget
Q_OBJECT
public:
- explicit ContextPaneWidgetRectangle(QWidget *parent = 0);
+ explicit ContextPaneWidgetRectangle(QWidget *parent = nullptr);
~ContextPaneWidgetRectangle();
void setProperties(QmlJS::PropertyReader *propertyReader);
void enabableGradientEditing(bool);
diff --git a/src/libs/qmleditorwidgets/customcolordialog.cpp b/src/libs/qmleditorwidgets/customcolordialog.cpp
index de603e0ea9..3792785ad2 100644
--- a/src/libs/qmleditorwidgets/customcolordialog.cpp
+++ b/src/libs/qmleditorwidgets/customcolordialog.cpp
@@ -62,8 +62,7 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
QVBoxLayout* vBox = new QVBoxLayout(colorFrameWidget);
colorFrameWidget->setLayout(vBox);
vBox->setSpacing(0);
- vBox->setMargin(0);
- vBox->setContentsMargins(0,5,0,28);
+ vBox->setContentsMargins(0, 5, 0, 28);
m_beforeColorWidget = new QFrame(colorFrameWidget);
m_beforeColorWidget->setFixedSize(30, 18);
@@ -85,7 +84,7 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->setSpacing(4);
gridLayout->setVerticalSpacing(4);
- gridLayout->setMargin(4);
+ gridLayout->setContentsMargins(4, 4, 4, 4);
setLayout(gridLayout);
gridLayout->addWidget(m_colorBox, 0, 0, 4, 1);
@@ -141,7 +140,7 @@ CustomColorDialog::CustomColorDialog(QWidget *parent) : QFrame(parent )
void CustomColorDialog::setupColor(const QColor &color)
{
QPalette pal;
- pal.setColor(QPalette::Background, color);
+ pal.setColor(QPalette::Window, color);
m_beforeColorWidget->setPalette(pal);
setColor(color);
}
@@ -176,7 +175,7 @@ void CustomColorDialog::setupWidgets()
m_bSpinBox->setValue(m_color.blueF());
m_colorBox->setColor(m_color);
QPalette pal;
- pal.setColor(QPalette::Background, m_color);
+ pal.setColor(QPalette::Window, m_color);
m_currentColorWidget->setPalette(pal);
m_blockUpdate = false;
}
diff --git a/src/libs/qmleditorwidgets/customcolordialog.h b/src/libs/qmleditorwidgets/customcolordialog.h
index a6df6e692d..88564c8142 100644
--- a/src/libs/qmleditorwidgets/customcolordialog.h
+++ b/src/libs/qmleditorwidgets/customcolordialog.h
@@ -43,7 +43,7 @@ class QMLEDITORWIDGETS_EXPORT CustomColorDialog : public QFrame {
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
- CustomColorDialog(QWidget *parent = 0);
+ CustomColorDialog(QWidget *parent = nullptr);
QColor color() const { return m_color; }
void setupColor(const QColor &color);
void setColor(const QColor &color)
diff --git a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp
index d43b458881..a794b337a0 100644
--- a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp
+++ b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.cpp
@@ -48,12 +48,12 @@ class EasingSimulation : public QObject
Q_OBJECT
public:
QGraphicsView *m_g;
- EasingSimulation(QObject *parent=0, QGraphicsView *v=0):QObject(parent) {
+ EasingSimulation(QObject *parent=nullptr, QGraphicsView *v=nullptr):QObject(parent) {
m_qtLogo = new PixmapItem(QPixmap(":/qmleditorwidgets/qt_logo.png"));
m_scene.addItem(m_qtLogo);
m_scene.setSceneRect(0,0,v->viewport()->width(),m_qtLogo->boundingRect().height());
m_qtLogo->hide();
- m_sequential = 0;
+ m_sequential = nullptr;
m_g = v;
m_g->setScene(&m_scene);
}
diff --git a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h
index 480860f0c5..3cab9523b5 100644
--- a/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h
+++ b/src/libs/qmleditorwidgets/easingpane/easingcontextpane.h
@@ -45,7 +45,7 @@ class EasingContextPane : public QWidget
enum GraphDisplayMode { GraphMode, SimulationMode };
public:
- explicit EasingContextPane(QWidget *parent = 0);
+ explicit EasingContextPane(QWidget *parent = nullptr);
~EasingContextPane() override;
void setProperties(QmlJS::PropertyReader *propertyReader);
diff --git a/src/libs/qmleditorwidgets/easingpane/easinggraph.h b/src/libs/qmleditorwidgets/easingpane/easinggraph.h
index a4bfabf0db..517ee7dc1e 100644
--- a/src/libs/qmleditorwidgets/easingpane/easinggraph.h
+++ b/src/libs/qmleditorwidgets/easingpane/easinggraph.h
@@ -49,7 +49,7 @@ class EasingGraph: public QWidget
Q_PROPERTY (QColor zeroColor READ zeroColor WRITE setZeroColor NOTIFY zeroColorChanged)
public:
- EasingGraph(QWidget *parent=0);
+ EasingGraph(QWidget *parent=nullptr);
~EasingGraph() override;
QEasingCurve::Type easingType() const;
diff --git a/src/libs/qmleditorwidgets/filewidget.h b/src/libs/qmleditorwidgets/filewidget.h
index da5c3c305d..320002a635 100644
--- a/src/libs/qmleditorwidgets/filewidget.h
+++ b/src/libs/qmleditorwidgets/filewidget.h
@@ -52,7 +52,7 @@ class QMLEDITORWIDGETS_EXPORT FileWidget : public QWidget
public:
- FileWidget(QWidget *parent = 0);
+ FileWidget(QWidget *parent = nullptr);
~FileWidget() override;
QString fileName() const
diff --git a/src/libs/qmleditorwidgets/fontsizespinbox.cpp b/src/libs/qmleditorwidgets/fontsizespinbox.cpp
index 4a8ee48427..f127b5a677 100644
--- a/src/libs/qmleditorwidgets/fontsizespinbox.cpp
+++ b/src/libs/qmleditorwidgets/fontsizespinbox.cpp
@@ -92,7 +92,7 @@ void FontSizeSpinBox::onEditingFinished()
QValidator::State FontSizeSpinBox::validate (QString &input, int &p) const
{
QRegExp rx(QLatin1String("\\d+\\s*(px|pt)"));
- QRegExpValidator v(rx, 0);
+ QRegExpValidator v(rx, nullptr);
return v.validate(input, p);
}
diff --git a/src/libs/qmleditorwidgets/fontsizespinbox.h b/src/libs/qmleditorwidgets/fontsizespinbox.h
index d9ee85092c..c74e33b2fd 100644
--- a/src/libs/qmleditorwidgets/fontsizespinbox.h
+++ b/src/libs/qmleditorwidgets/fontsizespinbox.h
@@ -39,7 +39,7 @@ class QMLEDITORWIDGETS_EXPORT FontSizeSpinBox : public QAbstractSpinBox
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
public:
- explicit FontSizeSpinBox(QWidget *parent = 0);
+ explicit FontSizeSpinBox(QWidget *parent = nullptr);
bool isPixelSize() { return !m_isPointSize; }
bool isPointSize() { return m_isPointSize; }
diff --git a/src/libs/qmleditorwidgets/gradientline.h b/src/libs/qmleditorwidgets/gradientline.h
index 0d5cff8a7f..d6f5e132f7 100644
--- a/src/libs/qmleditorwidgets/gradientline.h
+++ b/src/libs/qmleditorwidgets/gradientline.h
@@ -39,7 +39,7 @@ class QMLEDITORWIDGETS_EXPORT GradientLine : public QWidget {
Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
public:
- GradientLine(QWidget *parent = 0);
+ GradientLine(QWidget *parent = nullptr);
QString gradientName() const { return m_gradientName; }
void setGradientName(const QString &newName);
diff --git a/src/libs/qmleditorwidgets/huecontrol.h b/src/libs/qmleditorwidgets/huecontrol.h
index f9db8790ed..902b3ceaa8 100644
--- a/src/libs/qmleditorwidgets/huecontrol.h
+++ b/src/libs/qmleditorwidgets/huecontrol.h
@@ -36,7 +36,7 @@ class QMLEDITORWIDGETS_EXPORT HueControl : public QWidget
Q_PROPERTY(qreal hue READ hue WRITE setHue NOTIFY hueChanged)
public:
- HueControl(QWidget *parent = 0) : QWidget(parent), m_color(Qt::white), m_mousePressed(false)
+ HueControl(QWidget *parent = nullptr) : QWidget(parent), m_color(Qt::white), m_mousePressed(false)
{
setFixedWidth(28);
setFixedHeight(130);
diff --git a/src/libs/qmljs/jsoncheck.cpp b/src/libs/qmljs/jsoncheck.cpp
index 3940f46099..15d0edb1a7 100644
--- a/src/libs/qmljs/jsoncheck.cpp
+++ b/src/libs/qmljs/jsoncheck.cpp
@@ -41,7 +41,7 @@ using namespace Utils;
JsonCheck::JsonCheck(Document::Ptr doc)
: m_doc(doc)
- , m_schema(0)
+ , m_schema(nullptr)
{
QTC_CHECK(m_doc->ast());
}
diff --git a/src/libs/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h
index 093f68bac5..2321c5aa8f 100644
--- a/src/libs/qmljs/parser/qmljsengine_p.h
+++ b/src/libs/qmljs/parser/qmljsengine_p.h
@@ -61,19 +61,19 @@ public:
virtual void importFile(const QString &jsfile, const QString &module, int line, int column)
{
- Q_UNUSED(jsfile);
- Q_UNUSED(module);
- Q_UNUSED(line);
- Q_UNUSED(column);
+ Q_UNUSED(jsfile)
+ Q_UNUSED(module)
+ Q_UNUSED(line)
+ Q_UNUSED(column)
}
virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column)
{
- Q_UNUSED(uri);
- Q_UNUSED(version);
- Q_UNUSED(module);
- Q_UNUSED(line);
- Q_UNUSED(column);
+ Q_UNUSED(uri)
+ Q_UNUSED(version)
+ Q_UNUSED(module)
+ Q_UNUSED(line)
+ Q_UNUSED(column)
}
};
diff --git a/src/libs/qmljs/persistenttrie.cpp b/src/libs/qmljs/persistenttrie.cpp
index 08c17dd164..1d6c9bf5ba 100644
--- a/src/libs/qmljs/persistenttrie.cpp
+++ b/src/libs/qmljs/persistenttrie.cpp
@@ -286,12 +286,9 @@ public:
ReplaceInTrie() { }
void operator()(QString s)
{
- QHashIterator<QString, QString> i(replacements);
QString res = s;
- while (i.hasNext()) {
- i.next();
+ for (auto i = replacements.cbegin(), end = replacements.cend(); i != end; ++i)
res.replace(i.key(), i.value());
- }
trie = TrieNode::insertF(trie,res);
}
};
@@ -312,7 +309,7 @@ std::pair<TrieNode::Ptr,int> TrieNode::intersectF(
typedef TrieNode::Ptr P;
typedef QMap<QString,int>::const_iterator MapIterator;
if (v1.isNull() || v2.isNull())
- return std::make_pair(P(0), ((v1.isNull()) ? 1 : 0) | ((v2.isNull()) ? 2 : 0));
+ return std::make_pair(P(nullptr), ((v1.isNull()) ? 1 : 0) | ((v2.isNull()) ? 2 : 0));
QString::const_iterator i = v1->prefix.constBegin()+index1, iEnd = v1->prefix.constEnd();
QString::const_iterator j = v2->prefix.constBegin(), jEnd = v2->prefix.constEnd();
while (i != iEnd && j != jEnd) {
@@ -348,7 +345,7 @@ std::pair<TrieNode::Ptr,int> TrieNode::intersectF(
foreach (P t2, v2->postfixes)
if (t2->prefix.isEmpty())
return std::make_pair(v1,1);
- return std::make_pair(P(0), 0);
+ return std::make_pair(P(nullptr), 0);
}
QMap<QString,int> p1, p2;
QList<P> p3;
@@ -430,7 +427,7 @@ std::pair<TrieNode::Ptr,int> TrieNode::intersectF(
switch (sameV1V2) {
case 0:
if (p3.isEmpty())
- return std::make_pair(P(0),0);
+ return std::make_pair(P(nullptr),0);
else
return std::make_pair(TrieNode::create(v1->prefix,p3),0);
case 2:
@@ -454,7 +451,7 @@ std::pair<TrieNode::Ptr,int> TrieNode::intersectF(
v1->prefix.left(index1).append(res.first->prefix),
res.first->postfixes), 0);
}
- return std::make_pair(P(0), 0);
+ return std::make_pair(P(nullptr), 0);
} else {
// i != iEnd && j == jEnd
foreach (P t2, v2->postfixes)
@@ -462,7 +459,7 @@ std::pair<TrieNode::Ptr,int> TrieNode::intersectF(
std::pair<P,int> res = intersectF(v1,t2,i-v1->prefix.constBegin());
return std::make_pair(res.first, (res.second & 1));
}
- return std::make_pair(P(0), 0);
+ return std::make_pair(P(nullptr), 0);
}
}
diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index 6b904da040..70912cdf21 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -53,9 +53,9 @@ using namespace QmlJS::AST;
Bind::Bind(Document *doc, QList<DiagnosticMessage> *messages, bool isJsLibrary, const QList<ImportInfo> &jsImports)
: _doc(doc),
- _currentObjectValue(0),
- _idEnvironment(0),
- _rootObjectValue(0),
+ _currentObjectValue(nullptr),
+ _idEnvironment(nullptr),
+ _rootObjectValue(nullptr),
_isJsLibrary(isJsLibrary),
_imports(jsImports),
_diagnosticMessages(messages)
@@ -134,7 +134,7 @@ ObjectValue *Bind::switchObjectValue(ObjectValue *newObjectValue)
ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer)
{
- ObjectValue *parentObjectValue = 0;
+ ObjectValue *parentObjectValue = nullptr;
// normal component instance
ASTObjectValue *objectValue = new ASTObjectValue(qualifiedTypeNameId, initializer, _doc, &_valueOwner);
@@ -169,13 +169,13 @@ void Bind::accept(Node *node)
bool Bind::visit(AST::UiProgram *)
{
- _idEnvironment = _valueOwner.newObject(/*prototype =*/ 0);
+ _idEnvironment = _valueOwner.newObject(/*prototype =*/ nullptr);
return true;
}
bool Bind::visit(AST::Program *)
{
- _currentObjectValue = _valueOwner.newObject(/*prototype =*/ 0);
+ _currentObjectValue = _valueOwner.newObject(/*prototype =*/ nullptr);
_rootObjectValue = _currentObjectValue;
return true;
}
@@ -236,7 +236,7 @@ bool Bind::visit(UiPublicMember *ast)
const Block *block = AST::cast<const Block*>(ast->statement);
if (block) {
// build block scope
- ObjectValue *blockScope = _valueOwner.newObject(/*prototype=*/0);
+ ObjectValue *blockScope = _valueOwner.newObject(/*prototype=*/nullptr);
_attachedJSScopes.insert(ast, blockScope); // associated with the UiPublicMember, not with the block
ObjectValue *parent = switchObjectValue(blockScope);
accept(ast->statement);
@@ -259,7 +259,7 @@ bool Bind::visit(UiObjectDefinition *ast)
_qmlObjects.insert(ast, value);
} else {
_groupedPropertyBindings.insert(ast);
- ObjectValue *oldObjectValue = switchObjectValue(0);
+ ObjectValue *oldObjectValue = switchObjectValue(nullptr);
accept(ast->initializer);
switchObjectValue(oldObjectValue);
}
@@ -289,7 +289,7 @@ bool Bind::visit(UiScriptBinding *ast)
const Block *block = AST::cast<const Block*>(ast->statement);
if (block) {
// build block scope
- ObjectValue *blockScope = _valueOwner.newObject(/*prototype=*/0);
+ ObjectValue *blockScope = _valueOwner.newObject(/*prototype=*/nullptr);
_attachedJSScopes.insert(ast, blockScope); // associated with the UiScriptBinding, not with the block
ObjectValue *parent = switchObjectValue(blockScope);
accept(ast->statement);
@@ -328,7 +328,7 @@ bool Bind::visit(FunctionExpression *ast)
_currentObjectValue->setMember(ast->name.toString(), function);
// build function scope
- ObjectValue *functionScope = _valueOwner.newObject(/*prototype=*/0);
+ ObjectValue *functionScope = _valueOwner.newObject(/*prototype=*/nullptr);
_attachedJSScopes.insert(ast, functionScope);
ObjectValue *parent = switchObjectValue(functionScope);
@@ -345,7 +345,7 @@ bool Bind::visit(FunctionExpression *ast)
// ### TODO, currently covered by the accept(body)
// 3. Arguments object
- ObjectValue *arguments = _valueOwner.newObject(/*prototype=*/0);
+ ObjectValue *arguments = _valueOwner.newObject(/*prototype=*/nullptr);
arguments->setMember(QLatin1String("callee"), function);
arguments->setMember(QLatin1String("length"), _valueOwner.numberValue());
functionScope->setMember(QLatin1String("arguments"), arguments);
diff --git a/src/libs/qmljs/qmljsbundle.cpp b/src/libs/qmljs/qmljsbundle.cpp
index 9789d37492..6c7ee6029b 100644
--- a/src/libs/qmljs/qmljsbundle.cpp
+++ b/src/libs/qmljs/qmljsbundle.cpp
@@ -219,11 +219,11 @@ QStringList QmlBundle::maybeReadTrie(Trie &trie, Utils::JsonObjectValue *config,
return res;
}
Utils::JsonValue *imp0 = config->member(propertyName);
- Utils::JsonArrayValue *imp = ((imp0 != 0) ? imp0->toArray() : 0);
- if (imp != 0) {
+ Utils::JsonArrayValue *imp = ((imp0 != nullptr) ? imp0->toArray() : nullptr);
+ if (imp != nullptr) {
foreach (Utils::JsonValue *v, imp->elements()) {
- Utils::JsonStringValue *impStr = ((v != 0) ? v->toString() : 0);
- if (impStr != 0) {
+ Utils::JsonStringValue *impStr = ((v != nullptr) ? v->toString() : nullptr);
+ if (impStr != nullptr) {
trie.insert(impStr->value());
} else {
res.append(QString::fromLatin1("Expected all elements of array in property \"%1\" "
@@ -251,7 +251,7 @@ bool QmlBundle::readFrom(QString path, QStringList *errors)
return false;
}
JsonObjectValue *config = JsonValue::create(QString::fromUtf8(f.readAll()), &pool)->toObject();
- if (config == 0) {
+ if (config == nullptr) {
if (errors)
(*errors) << QString::fromLatin1("Could not parse json object in file at %1 .").arg(path);
return false;
@@ -259,8 +259,8 @@ bool QmlBundle::readFrom(QString path, QStringList *errors)
QStringList errs;
if (config->hasMember(QLatin1String("name"))) {
JsonValue *n0 = config->member(QLatin1String("name"));
- JsonStringValue *n = ((n0 != 0) ? n0->toString() : 0);
- if (n != 0)
+ JsonStringValue *n = ((n0 != nullptr) ? n0->toString() : nullptr);
+ if (n != nullptr)
m_name = n->value();
else
errs.append(QString::fromLatin1("Property \"name\" in QmlBundle at %1 is expected "
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index 6b961df84a..e3fe353b95 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -388,7 +388,7 @@ protected:
QTC_ASSERT(_block == 0, _block = 0);
}
- void postVisit(Node *ast)
+ void postVisit(Node *ast) override
{
if (!_seenNonDeclarationStatement && ast->statementCast()
&& !cast<VariableStatement *>(ast)) {
@@ -396,7 +396,7 @@ protected:
}
}
- bool visit(IdentifierExpression *ast)
+ bool visit(IdentifierExpression *ast) override
{
if (ast->name.isEmpty())
return false;
@@ -409,14 +409,14 @@ protected:
return false;
}
- bool visit(VariableStatement *ast)
+ bool visit(VariableStatement *ast) override
{
if (_seenNonDeclarationStatement)
addMessage(HintDeclarationsShouldBeAtStartOfFunction, ast->declarationKindToken);
return true;
}
- bool visit(PatternElement *ast)
+ bool visit(PatternElement *ast) override
{
if (ast->bindingIdentifier.isEmpty() || !ast->isVariableDeclaration())
return true;
@@ -433,12 +433,13 @@ protected:
if (_declaredVariables.contains(name)) {
addMessage(WarnDuplicateDeclaration, ast->identifierToken, name);
} else {
- for (auto k : _declaredBlockVariables.keys()) {
- if (k.first == name) {
- addMessage(WarnDuplicateDeclaration, ast->identifierToken, name);
- break;
- }
- }
+ const auto found = std::find_if(_declaredBlockVariables.keyBegin(),
+ _declaredBlockVariables.keyEnd(),
+ [name](const auto &key) {
+ return key.first == name;
+ });
+ if (found != _declaredBlockVariables.keyEnd())
+ addMessage(WarnDuplicateDeclaration, ast->identifierToken, name);
}
}
@@ -456,7 +457,7 @@ protected:
return true;
}
- bool visit(FunctionDeclaration *ast)
+ bool visit(FunctionDeclaration *ast) override
{
if (_seenNonDeclarationStatement)
addMessage(HintDeclarationsShouldBeAtStartOfFunction, ast->functionToken);
@@ -464,7 +465,7 @@ protected:
return visit(static_cast<FunctionExpression *>(ast));
}
- bool visit(FunctionExpression *ast)
+ bool visit(FunctionExpression *ast) override
{
if (ast->name.isEmpty())
return false;
@@ -875,7 +876,7 @@ static bool checkTopLevelBindingForParentReference(ExpressionStatement *expStmt,
return false;
SourceLocation location = locationFromRange(expStmt->firstSourceLocation(), expStmt->lastSourceLocation());
- QString stmtSource = source.mid(location.begin(), location.length);
+ QString stmtSource = source.mid(int(location.begin()), int(location.length));
if (stmtSource.contains(QRegExp("(^|\\W)parent\\.")))
return true;
@@ -1241,8 +1242,8 @@ bool Check::visit(BinaryExpression *ast)
// check spacing
SourceLocation op = ast->operatorToken;
- if ((op.begin() > 0 && !source.at(op.begin() - 1).isSpace())
- || (int(op.end()) < source.size() && !source.at(op.end()).isSpace())) {
+ if ((op.begin() > 0 && !source.at(int(op.begin()) - 1).isSpace())
+ || (int(op.end()) < source.size() && !source.at(int(op.end())).isSpace())) {
addMessage(HintBinaryOperatorSpacing, op);
}
@@ -1277,15 +1278,13 @@ bool Check::visit(BinaryExpression *ast)
}
if (int(op.end()) + 1 < source.size()) {
- const QChar next = source.at(op.end());
- if (next.isSpace() && next != newline
- && source.at(op.end() + 1) == match)
- addMessage(msg, SourceLocation(op.begin(), 3, op.startLine, op.startColumn));
+ const QChar next = source.at(int(op.end()));
+ if (next.isSpace() && next != newline && source.at(int(op.end()) + 1) == match)
+ addMessage(msg, SourceLocation((op.begin()), 3, op.startLine, op.startColumn));
}
if (op.begin() >= 2) {
- const QChar prev = source.at(op.begin() - 1);
- if (prev.isSpace() && prev != newline
- && source.at(op.begin() - 2) == match)
+ const QChar prev = source.at(int(op.begin()) - 1);
+ if (prev.isSpace() && prev != newline && source.at(int(op.begin()) - 2) == match)
addMessage(msg, SourceLocation(op.begin() - 2, 3, op.startLine, op.startColumn - 2));
}
}
@@ -1375,6 +1374,7 @@ bool Check::visit(ExpressionStatement *ast)
case QSOperator::InplaceURightShift:
case QSOperator::InplaceXor:
ok = true;
+ break;
default: break;
}
}
@@ -1507,8 +1507,9 @@ static bool hasOnlySpaces(const QString &s)
void Check::addMessage(const Message &message)
{
if (message.isValid() && _enabledMessages.contains(message.type)) {
- if (m_disabledMessageTypesByLine.contains(message.location.startLine)) {
- QList<MessageTypeAndSuppression> &disabledMessages = m_disabledMessageTypesByLine[message.location.startLine];
+ if (m_disabledMessageTypesByLine.contains(int(message.location.startLine))) {
+ QList<MessageTypeAndSuppression> &disabledMessages
+ = m_disabledMessageTypesByLine[int(message.location.startLine)];
for (int i = 0; i < disabledMessages.size(); ++i) {
if (disabledMessages[i].type == message.type) {
disabledMessages[i].wasSuppressed = true;
@@ -1532,7 +1533,7 @@ void Check::scanCommentsForAnnotations()
QRegExp disableCommentPattern(Message::suppressionPattern());
foreach (const SourceLocation &commentLoc, _doc->engine()->comments()) {
- const QString &comment = _doc->source().mid(commentLoc.begin(), commentLoc.length);
+ const QString &comment = _doc->source().mid(int(commentLoc.begin()), int(commentLoc.length));
// enable all checks annotation
if (comment.contains("@enable-all-checks"))
@@ -1548,34 +1549,34 @@ void Check::scanCommentsForAnnotations()
MessageTypeAndSuppression entry;
entry.type = static_cast<StaticAnalysis::Type>(disableCommentPattern.cap(1).toInt());
entry.wasSuppressed = false;
- entry.suppressionSource = SourceLocation(commentLoc.offset + lastOffset,
- disableCommentPattern.matchedLength(),
+ entry.suppressionSource = SourceLocation(commentLoc.offset + quint32(lastOffset),
+ quint32(disableCommentPattern.matchedLength()),
commentLoc.startLine,
- commentLoc.startColumn + lastOffset);
+ commentLoc.startColumn + quint32(lastOffset));
disabledMessageTypes += entry;
}
if (!disabledMessageTypes.isEmpty()) {
- int appliesToLine = commentLoc.startLine;
+ quint32 appliesToLine = commentLoc.startLine;
// if the comment is preceded by spaces only, it applies to the next line
// note: startColumn is 1-based and *after* the starting // or /*
if (commentLoc.startColumn >= 3) {
- const QString &beforeComment = _doc->source().mid(commentLoc.begin() - commentLoc.startColumn + 1,
- commentLoc.startColumn - 3);
+ const QString &beforeComment = _doc->source().mid(int(commentLoc.begin()
+ - commentLoc.startColumn + 1),
+ int(commentLoc.startColumn) - 3);
if (hasOnlySpaces(beforeComment))
++appliesToLine;
}
- m_disabledMessageTypesByLine[appliesToLine] += disabledMessageTypes;
+ m_disabledMessageTypesByLine[int(appliesToLine)] += disabledMessageTypes;
}
}
}
void Check::warnAboutUnnecessarySuppressions()
{
- QHashIterator< int, QList<MessageTypeAndSuppression> > it(m_disabledMessageTypesByLine);
- while (it.hasNext()) {
- it.next();
+ for (auto it = m_disabledMessageTypesByLine.cbegin(), end = m_disabledMessageTypesByLine.cend();
+ it != end; ++it) {
foreach (const MessageTypeAndSuppression &entry, it.value()) {
if (!entry.wasSuppressed)
addMessage(WarnUnnecessaryMessageSuppression, entry.suppressionSource);
@@ -1856,7 +1857,8 @@ void Check::checkCaseFallthrough(StatementList *statements, SourceLocation error
|| comment.end() > nextLoc.begin())
continue;
- const QString &commentText = _doc->source().mid(comment.begin(), comment.length);
+ const QString &commentText = _doc->source().mid(int(comment.begin()),
+ int(comment.length));
if (commentText.contains("fall through")
|| commentText.contains("fall-through")
|| commentText.contains("fallthrough")) {
diff --git a/src/libs/qmljs/qmljscontext.cpp b/src/libs/qmljs/qmljscontext.cpp
index d8d0f31bbe..3e90a40db8 100644
--- a/src/libs/qmljs/qmljscontext.cpp
+++ b/src/libs/qmljs/qmljscontext.cpp
@@ -97,7 +97,7 @@ ViewerContext Context::viewerContext() const
const Imports *Context::imports(const QmlJS::Document *doc) const
{
if (!doc)
- return 0;
+ return nullptr;
return _imports.value(doc).data();
}
@@ -106,16 +106,16 @@ const ObjectValue *Context::lookupType(const QmlJS::Document *doc, UiQualifiedId
{
const Imports *importsObj = imports(doc);
if (!importsObj)
- return 0;
+ return nullptr;
const ObjectValue *objectValue = importsObj->typeScope();
if (!objectValue)
- return 0;
+ return nullptr;
for (UiQualifiedId *iter = qmlTypeName; objectValue && iter && iter != qmlTypeNameEnd;
iter = iter->next) {
- const Value *value = objectValue->lookupMember(iter->name.toString(), this, 0, false);
+ const Value *value = objectValue->lookupMember(iter->name.toString(), this, nullptr, false);
if (!value)
- return 0;
+ return nullptr;
objectValue = value->asObjectValue();
}
@@ -127,18 +127,18 @@ const ObjectValue *Context::lookupType(const QmlJS::Document *doc, const QString
{
const Imports *importsObj = imports(doc);
if (!importsObj)
- return 0;
+ return nullptr;
const ObjectValue *objectValue = importsObj->typeScope();
if (!objectValue)
- return 0;
+ return nullptr;
foreach (const QString &name, qmlTypeName) {
if (!objectValue)
- return 0;
+ return nullptr;
const Value *value = objectValue->lookupMember(name, this);
if (!value)
- return 0;
+ return nullptr;
objectValue = value->asObjectValue();
}
diff --git a/src/libs/qmljs/qmljscontext.h b/src/libs/qmljs/qmljscontext.h
index cafee3e970..0da21e8861 100644
--- a/src/libs/qmljs/qmljscontext.h
+++ b/src/libs/qmljs/qmljscontext.h
@@ -60,7 +60,7 @@ public:
const Imports *imports(const Document *doc) const;
const ObjectValue *lookupType(const Document *doc, AST::UiQualifiedId *qmlTypeName,
- AST::UiQualifiedId *qmlTypeNameEnd = 0) const;
+ AST::UiQualifiedId *qmlTypeNameEnd = nullptr) const;
const ObjectValue *lookupType(const Document *doc, const QStringList &qmlTypeName) const;
const Value *lookupReference(const Value *value) const;
diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp
index 6ebe5b0b2f..c848a78c53 100644
--- a/src/libs/qmljs/qmljsdocument.cpp
+++ b/src/libs/qmljs/qmljsdocument.cpp
@@ -39,6 +39,8 @@
#include <algorithm>
+static constexpr int sizeofQChar = int(sizeof(QChar));
+
using namespace QmlJS;
using namespace QmlJS::AST;
@@ -86,9 +88,9 @@ using namespace QmlJS::AST;
*/
Document::Document(const QString &fileName, Dialect language)
- : _engine(0)
- , _ast(0)
- , _bind(0)
+ : _engine(nullptr)
+ , _ast(nullptr)
+ , _bind(nullptr)
, _fileName(QDir::cleanPath(fileName))
, _editorRevision(0)
, _language(language)
@@ -170,7 +172,7 @@ AST::ExpressionNode *Document::expression() const
if (_ast)
return _ast->expressionCast();
- return 0;
+ return nullptr;
}
AST::Node *Document::ast() const
@@ -248,12 +250,6 @@ public:
{}
- void pragmaLibrary(int line, int column)
- {
- isLibrary = true;
- addLocation(line, column);
- }
-
void importFile(const QString &jsfile, const QString &module,
int line, int column) override
{
@@ -306,12 +302,13 @@ bool Document::parse_helper(int startToken)
_parsedCorrectly = parser.parse();
break;
case QmlJSGrammar::T_FEED_JS_SCRIPT:
- case QmlJSGrammar::T_FEED_JS_MODULE:
+ case QmlJSGrammar::T_FEED_JS_MODULE: {
_parsedCorrectly = parser.parseProgram();
- for (const auto &d: directives.locations()) {
+ const QList<SourceLocation> locations = directives.locations();
+ for (const auto &d : locations) {
_jsdirectives << d;
}
- break;
+ } break;
case QmlJSGrammar::T_FEED_JS_EXPRESSION:
_parsedCorrectly = parser.parseExpression();
@@ -383,10 +380,6 @@ LibraryInfo::LibraryInfo(const QmlDirParser &parser, const QByteArray &fingerpri
updateFingerprint();
}
-LibraryInfo::~LibraryInfo()
-{
-}
-
QByteArray LibraryInfo::calculateFingerprint() const
{
QCryptographicHash hash(QCryptographicHash::Sha1);
@@ -396,12 +389,14 @@ QByteArray LibraryInfo::calculateFingerprint() const
foreach (const QmlDirParser::Component &component, _components) {
len = component.fileName.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(component.fileName.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(component.fileName.constData()),
+ len * sizeofQChar);
hash.addData(reinterpret_cast<const char *>(&component.majorVersion), sizeof(component.majorVersion));
hash.addData(reinterpret_cast<const char *>(&component.minorVersion), sizeof(component.minorVersion));
len = component.typeName.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(component.typeName.constData()), component.typeName.size() * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(component.typeName.constData()),
+ component.typeName.size() * sizeofQChar);
int flags = (component.singleton ? (1 << 0) : 0) + (component.internal ? (1 << 1) : 0);
hash.addData(reinterpret_cast<const char *>(&flags), sizeof(flags));
}
@@ -410,17 +405,18 @@ QByteArray LibraryInfo::calculateFingerprint() const
foreach (const QmlDirParser::Plugin &plugin, _plugins) {
len = plugin.path.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(plugin.path.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(plugin.path.constData()), len * sizeofQChar);
len = plugin.name.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(plugin.name.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(plugin.name.constData()), len * sizeofQChar);
}
len = _typeinfos.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
foreach (const QmlDirParser::TypeInfo &typeinfo, _typeinfos) {
len = typeinfo.fileName.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(typeinfo.fileName.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(typeinfo.fileName.constData()),
+ len * sizeofQChar);
}
len = _metaObjects.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
@@ -433,7 +429,7 @@ QByteArray LibraryInfo::calculateFingerprint() const
hash.addData(reinterpret_cast<const char *>(&_dumpStatus), sizeof(_dumpStatus));
len = _dumpError.size(); // localization dependent (avoid?)
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(_dumpError.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(_dumpError.constData()), len * sizeofQChar);
len = _moduleApis.size();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
@@ -623,9 +619,9 @@ void ModuleApiInfo::addToHash(QCryptographicHash &hash) const
{
int len = uri.length();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(uri.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(uri.constData()), len * sizeofQChar);
version.addToHash(hash);
len = cppName.length();
hash.addData(reinterpret_cast<const char *>(&len), sizeof(len));
- hash.addData(reinterpret_cast<const char *>(cppName.constData()), len * sizeof(QChar));
+ hash.addData(reinterpret_cast<const char *>(cppName.constData()), len * sizeofQChar);
}
diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h
index 82df720776..5e80e7612b 100644
--- a/src/libs/qmljs/qmljsdocument.h
+++ b/src/libs/qmljs/qmljsdocument.h
@@ -167,7 +167,8 @@ public:
LibraryInfo();
explicit LibraryInfo(Status status);
explicit LibraryInfo(const QmlDirParser &parser, const QByteArray &fingerprint = QByteArray());
- ~LibraryInfo();
+ ~LibraryInfo() = default;
+ LibraryInfo(const LibraryInfo &other) = default;
QByteArray calculateFingerprint() const;
void updateFingerprint();
diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp
index 754113d199..4a408dac93 100644
--- a/src/libs/qmljs/qmljsevaluate.cpp
+++ b/src/libs/qmljs/qmljsevaluate.cpp
@@ -61,7 +61,7 @@ Evaluate::Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceCont
_context(scopeChain->context()),
_referenceContext(referenceContext),
_scopeChain(scopeChain),
- _result(0)
+ _result(nullptr)
{
}
@@ -95,7 +95,7 @@ const Value *Evaluate::value(AST::Node *ast)
const Value *Evaluate::reference(AST::Node *ast)
{
// save the result
- const Value *previousResult = switchResult(0);
+ const Value *previousResult = switchResult(nullptr);
// process the expression
accept(ast);
@@ -426,8 +426,8 @@ bool Evaluate::visit(AST::NotExpression *)
bool Evaluate::visit(AST::BinaryExpression *ast)
{
- const Value *lhs = 0;
- const Value *rhs = 0;
+ const Value *lhs = nullptr;
+ const Value *rhs = nullptr;
switch (ast->op) {
case QSOperator::Add:
case QSOperator::InplaceAdd:
diff --git a/src/libs/qmljs/qmljsevaluate.h b/src/libs/qmljs/qmljsevaluate.h
index 7e3a218415..45ffc2ece8 100644
--- a/src/libs/qmljs/qmljsevaluate.h
+++ b/src/libs/qmljs/qmljsevaluate.h
@@ -41,7 +41,7 @@ class FunctionValue;
class QMLJS_EXPORT Evaluate: protected AST::Visitor
{
public:
- Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceContext = 0);
+ Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceContext = nullptr);
~Evaluate();
// same as value()
diff --git a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
index 6bf17505d6..7ba890e17a 100644
--- a/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
+++ b/src/libs/qmljs/qmljsfindexportedcpptypes.cpp
@@ -57,7 +57,7 @@ class ContextProperty {
public:
QString name;
QString expression;
- unsigned line, column;
+ int line, column;
};
class FindExportsVisitor : protected ASTVisitor
@@ -87,13 +87,15 @@ public:
QmlRegisterSingletonTypeUrl,
// template<typename T> int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)
// or template<typename T, int metaObjectRevision> int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)
- QmlRegisterUncreatableType
+ QmlRegisterUncreatableType,
+ // int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
+ QmlRegisterUncreatableMetaObject
};
FindExportsVisitor(CPlusPlus::Document::Ptr doc)
: ASTVisitor(doc->translationUnit())
, _doc(doc)
- , _compound(0)
+ , _compound(nullptr)
{}
void operator()()
@@ -142,7 +144,7 @@ protected:
if (!idExp || !idExp->name)
return false;
RegistrationFunction registrationFunction = InvalidRegistrationFunction;
- TypeIdAST *typeId = 0;
+ TypeIdAST *typeId = nullptr;
if (TemplateIdAST *templateId = idExp->name->asTemplateId()) {
if (!templateId->identifier_token)
return false;
@@ -189,6 +191,8 @@ protected:
registrationFunction = QmlRegisterType5;
else if (fName == "qmlRegisterSingletonType")
registrationFunction = QmlRegisterSingletonTypeCallback2;
+ else if (fName == "qmlRegisterUncreatableMetaObject")
+ registrationFunction = QmlRegisterUncreatableMetaObject;
else
return false;
} else {
@@ -215,11 +219,17 @@ protected:
|| !ast->expression_list->next->next->next->next->value
|| ast->expression_list->next->next->next->next->next)
return false;
+ break;
+ case QmlRegisterUncreatableMetaObject:
+ if (!ast->expression_list->next->next->next->next->next
+ || !ast->expression_list->next->next->next->next->next->value
+ || ast->expression_list->next->next->next->next->next->next)
+ return false;
}
- ExpressionAST *uriExp = 0;
- ExpressionAST *majorVersionExp = 0;
- ExpressionAST *minorVersionExp = 0;
- ExpressionAST *nameExp = 0;
+ ExpressionAST *uriExp = nullptr;
+ ExpressionAST *majorVersionExp = nullptr;
+ ExpressionAST *minorVersionExp = nullptr;
+ ExpressionAST *nameExp = nullptr;
if (registrationFunction == QmlRegisterType5) {
uriExp = ast->expression_list->next->value;
majorVersionExp = ast->expression_list->next->next->value;
@@ -235,17 +245,22 @@ protected:
majorVersionExp = ast->expression_list->next->next->value;
minorVersionExp = ast->expression_list->next->next->next->value;
nameExp = ast->expression_list->next->next->next->next->value;
+ } else if (registrationFunction == QmlRegisterUncreatableMetaObject) {
+ uriExp = ast->expression_list->next->value;
+ majorVersionExp = ast->expression_list->next->next->value;
+ minorVersionExp = ast->expression_list->next->next->next->value;
+ nameExp = ast->expression_list->next->next->next->next->value;
} else {
uriExp = ast->expression_list->value;
majorVersionExp = ast->expression_list->next->value;
minorVersionExp = ast->expression_list->next->next->value;
nameExp = ast->expression_list->next->next->next->value;
}
- const StringLiteral *nameLit = 0;
+ const StringLiteral *nameLit = nullptr;
if (StringLiteralAST *nameAst = skipStringCall(nameExp)->asStringLiteral())
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
if (!nameLit) {
- unsigned line, column;
+ int line, column;
translationUnit()->getTokenStartPosition(nameExp->firstToken(), &line, &column);
_messages += Document::DiagnosticMessage(
Document::DiagnosticMessage::Warning,
@@ -290,7 +305,7 @@ protected:
const Token end = _doc->translationUnit()->tokenAt(ast->firstToken());
// go through comments backwards to find the annotation closest to the call
- for (unsigned i = _doc->translationUnit()->commentCount(); i-- > 0; ) {
+ for (int i = _doc->translationUnit()->commentCount(); i-- > 0; ) {
const Token commentToken = _doc->translationUnit()->commentAt(i);
if (commentToken.utf16charsBegin() >= end.utf16charsBegin()
|| commentToken.utf16charsEnd() <= begin.utf16charsBegin()) {
@@ -305,7 +320,7 @@ protected:
}
if (packageName.isEmpty()) {
packageName = QmlJS::CppQmlTypes::defaultPackage;
- unsigned line, column;
+ int line, column;
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
_messages += Document::DiagnosticMessage(
Document::DiagnosticMessage::Warning,
@@ -318,8 +333,8 @@ protected:
}
// version arguments must be integer literals
- const NumericLiteral *majorLit = 0;
- const NumericLiteral *minorLit = 0;
+ const NumericLiteral *majorLit = nullptr;
+ const NumericLiteral *minorLit = nullptr;
if (NumericLiteralAST *majorAst = majorVersionExp->asNumericLiteral())
majorLit = translationUnit()->numericLiteral(majorAst->literal_token);
if (NumericLiteralAST *minorAst = minorVersionExp->asNumericLiteral())
@@ -331,7 +346,8 @@ protected:
|| registrationFunction == QmlRegisterSingletonTypeCallback2
|| registrationFunction == QmlRegisterSingletonTypeUrl;
exportedType.isCreatable = !exportedType.isSingleton
- && registrationFunction != QmlRegisterUncreatableType;
+ && registrationFunction != QmlRegisterUncreatableType
+ && registrationFunction != QmlRegisterUncreatableMetaObject;
exportedType.typeName = QString::fromUtf8(nameLit->chars(), nameLit->size());
exportedType.packageName = packageName;
if (majorLit && minorLit && majorLit->isInt() && minorLit->isInt()) {
@@ -341,7 +357,7 @@ protected:
}
// we want to do lookup later, so also store the surrounding scope
- unsigned line, column;
+ int line, column;
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
exportedType.scope = _doc->scopeAt(line, column);
@@ -363,6 +379,8 @@ protected:
exportedType.url = QString::fromUtf8(urlLit->chars(), urlLit->size());
}
}
+ } else if (registrationFunction == QmlRegisterUncreatableMetaObject) {
+ // Anything to do here?
} else {
qCWarning(QmlJS::qmljsLog()) << "missing template type for registrationFunction " << registrationFunction;
}
@@ -377,7 +395,7 @@ protected:
return idExp->name;
if (MemberAccessAST *memberExp = exp->asMemberAccess())
return memberExp->member_name;
- return 0;
+ return nullptr;
}
static ExpressionAST *skipQVariant(ExpressionAST *ast, TranslationUnit *translationUnit)
@@ -479,11 +497,11 @@ protected:
return false;
// first argument must be a string literal
- const StringLiteral *nameLit = 0;
+ const StringLiteral *nameLit = nullptr;
if (StringLiteralAST *nameAst = skipStringCall(ast->expression_list->value)->asStringLiteral())
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
if (!nameLit) {
- unsigned line, column;
+ int line, column;
translationUnit()->getTokenStartPosition(ast->expression_list->value->firstToken(), &line, &column);
_messages += Document::DiagnosticMessage(
Document::DiagnosticMessage::Warning,
@@ -634,7 +652,7 @@ static QString toQmlType(const FullySpecifiedType &type)
static Class *lookupClass(const QString &expression, Scope *scope, TypeOfExpression &typeOf)
{
QList<LookupItem> results = typeOf(expression.toUtf8(), scope);
- Class *klass = 0;
+ Class *klass = nullptr;
foreach (const LookupItem &item, results) {
if (item.declaration()) {
klass = item.declaration()->asClass();
@@ -642,7 +660,7 @@ static Class *lookupClass(const QString &expression, Scope *scope, TypeOfExpress
return klass;
}
}
- return 0;
+ return nullptr;
}
static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
@@ -666,7 +684,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
// add the no-package export, so the cpp name can be used in properties
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
- for (unsigned i = 0; i < klass->memberCount(); ++i) {
+ for (int i = 0; i < klass->memberCount(); ++i) {
Symbol *member = klass->memberAt(i);
if (!member->name())
continue;
@@ -678,7 +696,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
method.setMethodType(FakeMetaMethod::Signal);
else
method.setMethodType(FakeMetaMethod::Slot);
- for (unsigned a = 0, argc = func->argumentCount(); a < argc; ++a) {
+ for (int a = 0, argc = func->argumentCount(); a < argc; ++a) {
Symbol *arg = func->argumentAt(a);
QString name;
if (arg->name())
@@ -702,7 +720,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
}
if (QtEnum *qtEnum = member->asQtEnum()) {
// find the matching enum
- Enum *e = 0;
+ Enum *e = nullptr;
QList<LookupItem> result = typeOf(namePrinter.prettyName(qtEnum->name()).toUtf8(), klass);
foreach (const LookupItem &item, result) {
if (item.declaration()) {
@@ -715,7 +733,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
continue;
FakeMetaEnum metaEnum(namePrinter.prettyName(e->name()));
- for (unsigned j = 0; j < e->memberCount(); ++j) {
+ for (int j = 0; j < e->memberCount(); ++j) {
Symbol *enumMember = e->memberAt(j);
if (!enumMember->name())
continue;
@@ -754,7 +772,7 @@ static void buildExportedQmlObjects(
return;
foreach (const ExportedQmlType &exportedType, cppExports) {
- Class *klass = 0;
+ Class *klass = nullptr;
if (!exportedType.typeExpression.isEmpty())
klass = lookupClass(exportedType.typeExpression, exportedType.scope, typeOf);
// TODO: something smarter with exportedType.url
@@ -900,6 +918,7 @@ bool FindExportedCppTypes::maybeExportsTypes(const CPlusPlus::Document::Ptr &doc
const QByteArray qmlRegisterSingletonTypeToken("qmlRegisterType");
const QByteArray qmlRegisterTypeToken("qmlRegisterSingletonType");
const QByteArray qmlRegisterUncreatableTypeToken("qmlRegisterUncreatableType");
+ const QByteArray qmlRegisterUncreatableMetaObjectToken("qmlRegisterUncreatableMetaObject");
const QByteArray setContextPropertyToken("setContextProperty");
if (document->control()->findIdentifier(
qmlRegisterTypeToken.constData(), qmlRegisterTypeToken.size())) {
@@ -917,6 +936,10 @@ bool FindExportedCppTypes::maybeExportsTypes(const CPlusPlus::Document::Ptr &doc
setContextPropertyToken.constData(), setContextPropertyToken.size())) {
return true;
}
+ if (document->control()->findIdentifier(
+ qmlRegisterUncreatableMetaObjectToken.constData(), qmlRegisterUncreatableMetaObjectToken.size())) {
+ return true;
+ }
return false;
}
diff --git a/src/libs/qmljs/qmljsicons.cpp b/src/libs/qmljs/qmljsicons.cpp
index 71ab381108..5f3c8ab43c 100644
--- a/src/libs/qmljs/qmljsicons.cpp
+++ b/src/libs/qmljs/qmljsicons.cpp
@@ -44,7 +44,7 @@ static Q_LOGGING_CATEGORY(iconsLog, "qtc.qmljs.icons", QtWarningMsg)
namespace QmlJS {
-Icons *Icons::m_instance = 0;
+Icons *Icons::m_instance = nullptr;
class IconsPrivate
{
@@ -62,7 +62,7 @@ Icons::Icons()
Icons::~Icons()
{
- m_instance = 0;
+ m_instance = nullptr;
delete d;
}
diff --git a/src/libs/qmljs/qmljsicontextpane.h b/src/libs/qmljs/qmljsicontextpane.h
index 3a36a104ef..cc2a981040 100644
--- a/src/libs/qmljs/qmljsicontextpane.h
+++ b/src/libs/qmljs/qmljsicontextpane.h
@@ -43,7 +43,7 @@ class QMLJS_EXPORT IContextPane : public QObject
Q_OBJECT
public:
- IContextPane(QObject *parent = 0) : QObject(parent) {}
+ IContextPane(QObject *parent = nullptr) : QObject(parent) {}
virtual ~IContextPane() {}
virtual void apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0;
virtual void setEnabled(bool) = 0;
diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp
index 3f17846dab..e5d0161665 100644
--- a/src/libs/qmljs/qmljsimportdependencies.cpp
+++ b/src/libs/qmljs/qmljsimportdependencies.cpp
@@ -584,10 +584,8 @@ void ImportDependencies::filter(const ViewerContext &vContext)
{
QMap<QString, CoreImport> newCoreImports;
QMap<ImportKey, QStringList> newImportCache;
- QMapIterator<QString, CoreImport> j(m_coreImports);
bool hasChanges = false;
- while (j.hasNext()) {
- j.next();
+ for (auto j = m_coreImports.cbegin(), end = m_coreImports.cend(); j != end; ++j) {
const CoreImport &cImport = j.value();
if (vContext.languageIsCompatible(cImport.language)) {
QList<Export> newExports;
@@ -717,8 +715,8 @@ ImportDependencies::ImportElements ImportDependencies::candidateImports(
QList<DependencyInfo::ConstPtr> ImportDependencies::createDependencyInfos(
const ImportKey &mainDoc, const ViewerContext &vContext) const
{
- Q_UNUSED(mainDoc);
- Q_UNUSED(vContext);
+ Q_UNUSED(mainDoc)
+ Q_UNUSED(vContext)
QList<DependencyInfo::ConstPtr> res;
QTC_CHECK(false);
return res;
@@ -897,8 +895,8 @@ public:
const Export &e,
const CoreImport &cI) const
{
- Q_UNUSED(m);
- Q_UNUSED(cI);
+ Q_UNUSED(m)
+ Q_UNUSED(cI)
imports.insert(e.exportName.flatKey());
return true;
}
@@ -923,30 +921,24 @@ QSet<ImportKey> ImportDependencies::subdirImports(
void ImportDependencies::checkConsistency() const
{
- QMapIterator<ImportKey, QStringList> j(m_importCache);
- while (j.hasNext()) {
- j.next();
- foreach (const QString &s, j.value()) {
+ for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j) {
+ for (const QString &s : j.value()) {
bool found = false;
foreach (const Export &e, m_coreImports.value(s).possibleExports)
if (e.exportName == j.key())
found = true;
- Q_ASSERT(found); Q_UNUSED(found);
+ Q_ASSERT(found); Q_UNUSED(found)
}
}
- QMapIterator<QString,CoreImport> i(m_coreImports);
- while (i.hasNext()) {
- i.next();
+ for (auto i = m_coreImports.cbegin(), end = m_coreImports.cend(); i != end; ++i) {
foreach (const Export &e, i.value().possibleExports) {
if (!m_importCache.value(e.exportName).contains(i.key())) {
qCWarning(importsLog) << e.exportName.toString();
qCWarning(importsLog) << i.key();
- QMapIterator<ImportKey, QStringList> j(m_importCache);
- while (j.hasNext()) {
- j.next();
+ for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j)
qCWarning(importsLog) << j.key().toString() << j.value();
- }
+
qCWarning(importsLog) << m_importCache.contains(e.exportName);
qCWarning(importsLog) << m_importCache.value(e.exportName);
}
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 91f195f8fc..825ead9109 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -99,7 +99,7 @@ class LookupMember: public MemberProcessor
public:
LookupMember(const QString &name)
- : m_name(name), m_value(0) {}
+ : m_name(name), m_value(nullptr) {}
const Value *value() const { return m_value; }
@@ -290,7 +290,7 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const
signatures->reserve(m_metaObject->methodCount());
for (int index = 0; index < m_metaObject->methodCount(); ++index)
signatures->append(new MetaFunction(m_metaObject->method(index), valueOwner()));
- if (!m_metaSignatures.testAndSetOrdered(0, signatures)) {
+ if (!m_metaSignatures.testAndSetOrdered(nullptr, signatures)) {
delete signatures;
signatures = m_metaSignatures.load();
}
@@ -500,7 +500,7 @@ FakeMetaEnum CppComponentValue::getEnum(const QString &typeName, const CppCompon
}
}
if (foundInScope)
- *foundInScope = 0;
+ *foundInScope = nullptr;
return FakeMetaEnum();
}
@@ -514,8 +514,8 @@ const QmlEnumValue *CppComponentValue::getEnumValue(const QString &typeName, con
}
}
if (foundInScope)
- *foundInScope = 0;
- return 0;
+ *foundInScope = nullptr;
+ return nullptr;
}
const ObjectValue *CppComponentValue::signalScope(const QString &signalName) const
@@ -534,7 +534,7 @@ const ObjectValue *CppComponentValue::signalScope(const QString &signalName) con
const QStringList &parameterTypes = method.parameterTypes();
QTC_ASSERT(parameterNames.size() == parameterTypes.size(), continue);
- ObjectValue *scope = valueOwner()->newObject(/*prototype=*/0);
+ ObjectValue *scope = valueOwner()->newObject(/*prototype=*/nullptr);
for (int i = 0; i < parameterNames.size(); ++i) {
const QString &name = parameterNames.at(i);
const QString &type = parameterTypes.at(i);
@@ -544,7 +544,7 @@ const ObjectValue *CppComponentValue::signalScope(const QString &signalName) con
}
scopes->insert(generatedSlotName(method.methodName()), scope);
}
- if (!m_signalScopes.testAndSetOrdered(0, scopes)) {
+ if (!m_signalScopes.testAndSetOrdered(nullptr, scopes)) {
delete scopes;
scopes = m_signalScopes.load();
}
@@ -708,137 +708,137 @@ bool Value::getSourceLocation(QString *, int *, int *) const
const NullValue *Value::asNullValue() const
{
- return 0;
+ return nullptr;
}
const UndefinedValue *Value::asUndefinedValue() const
{
- return 0;
+ return nullptr;
}
const UnknownValue *Value::asUnknownValue() const
{
- return 0;
+ return nullptr;
}
const NumberValue *Value::asNumberValue() const
{
- return 0;
+ return nullptr;
}
const IntValue *Value::asIntValue() const
{
- return 0;
+ return nullptr;
}
const RealValue *Value::asRealValue() const
{
- return 0;
+ return nullptr;
}
const BooleanValue *Value::asBooleanValue() const
{
- return 0;
+ return nullptr;
}
const StringValue *Value::asStringValue() const
{
- return 0;
+ return nullptr;
}
const UrlValue *Value::asUrlValue() const
{
- return 0;
+ return nullptr;
}
const ObjectValue *Value::asObjectValue() const
{
- return 0;
+ return nullptr;
}
const FunctionValue *Value::asFunctionValue() const
{
- return 0;
+ return nullptr;
}
const Reference *Value::asReference() const
{
- return 0;
+ return nullptr;
}
const ColorValue *Value::asColorValue() const
{
- return 0;
+ return nullptr;
}
const AnchorLineValue *Value::asAnchorLineValue() const
{
- return 0;
+ return nullptr;
}
const CppComponentValue *Value::asCppComponentValue() const
{
- return 0;
+ return nullptr;
}
const ASTObjectValue *Value::asAstObjectValue() const
{
- return 0;
+ return nullptr;
}
const QmlEnumValue *Value::asQmlEnumValue() const
{
- return 0;
+ return nullptr;
}
const QmlPrototypeReference *Value::asQmlPrototypeReference() const
{
- return 0;
+ return nullptr;
}
const ASTPropertyReference *Value::asAstPropertyReference() const
{
- return 0;
+ return nullptr;
}
const ASTVariableReference *Value::asAstVariableReference() const
{
- return 0;
+ return nullptr;
}
const Internal::QtObjectPrototypeReference *Value::asQtObjectPrototypeReference() const
{
- return 0;
+ return nullptr;
}
const ASTSignal *Value::asAstSignal() const
{
- return 0;
+ return nullptr;
}
const ASTFunctionValue *Value::asAstFunctionValue() const
{
- return 0;
+ return nullptr;
}
const Function *Value::asFunction() const
{
- return 0;
+ return nullptr;
}
const MetaFunction *Value::asMetaFunction() const
{
- return 0;
+ return nullptr;
}
const JSImportScope *Value::asJSImportScope() const
{
- return 0;
+ return nullptr;
}
const TypeScope *Value::asTypeScope() const
{
- return 0;
+ return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1003,7 +1003,7 @@ bool MemberProcessor::processGeneratedSlot(const QString &, const Value *)
ObjectValue::ObjectValue(ValueOwner *valueOwner, const QString &originId)
: m_valueOwner(valueOwner), m_originId(originId),
- _prototype(0)
+ _prototype(nullptr)
{
valueOwner->registerValue(this);
}
@@ -1098,11 +1098,7 @@ bool ObjectValue::checkPrototype(const ObjectValue *, QSet<const ObjectValue *>
void ObjectValue::processMembers(MemberProcessor *processor) const
{
- QHashIterator<QString, PropertyData> it(m_members);
-
- while (it.hasNext()) {
- it.next();
-
+ for (auto it = m_members.cbegin(), end = m_members.cend(); it != end; ++it) {
if (! processor->processProperty(it.key(), it.value().value, it.value().propertyInfo))
break;
}
@@ -1126,7 +1122,7 @@ const Value *ObjectValue::lookupMember(const QString &name, const Context *conte
}
}
- const ObjectValue *prototypeObject = 0;
+ const ObjectValue *prototypeObject = nullptr;
if (examinePrototypes && context) {
PrototypeIterator iter(this, context);
@@ -1139,13 +1135,13 @@ const Value *ObjectValue::lookupMember(const QString &name, const Context *conte
}
if (foundInObject)
- *foundInObject = 0;
+ *foundInObject = nullptr;
- return 0;
+ return nullptr;
}
PrototypeIterator::PrototypeIterator(const ObjectValue *start, const Context *context)
- : m_current(0)
+ : m_current(nullptr)
, m_next(start)
, m_context(context)
, m_error(NoError)
@@ -1155,7 +1151,7 @@ PrototypeIterator::PrototypeIterator(const ObjectValue *start, const Context *co
}
PrototypeIterator::PrototypeIterator(const ObjectValue *start, const ContextPtr &context)
- : m_current(0)
+ : m_current(nullptr)
, m_next(start)
, m_context(context.data())
, m_error(NoError)
@@ -1183,7 +1179,7 @@ bool PrototypeIterator::hasNext()
}
if (m_prototypes.contains(m_next)) {
m_error = CycleError;
- m_next = 0;
+ m_next = nullptr;
return false;
}
return true;
@@ -1194,17 +1190,17 @@ const ObjectValue *PrototypeIterator::next()
if (hasNext()) {
m_current = m_next;
m_prototypes += m_next;
- m_next = 0;
+ m_next = nullptr;
return m_current;
}
- return 0;
+ return nullptr;
}
const ObjectValue *PrototypeIterator::peekNext()
{
if (hasNext())
return m_next;
- return 0;
+ return nullptr;
}
PrototypeIterator::Error PrototypeIterator::error() const
@@ -1273,7 +1269,7 @@ void FunctionValue::accept(ValueVisitor *visitor) const
Function::Function(ValueOwner *valueOwner)
: FunctionValue(valueOwner)
- , m_returnValue(0)
+ , m_returnValue(nullptr)
, m_optionalNamedArgumentCount(0)
, m_isVariadic(false)
{
@@ -1368,7 +1364,7 @@ CppQmlTypesLoader::BuiltinObjects CppQmlTypesLoader::loadQmlTypes(const QFileInf
file.close();
- parseQmlTypeDescriptions(contents, &newObjects, 0, &newDependencies, &error, &warning,
+ parseQmlTypeDescriptions(contents, &newObjects, nullptr, &newDependencies, &error, &warning,
qmlTypeFile.absoluteFilePath());
} else {
error = file.errorString();
@@ -1421,7 +1417,7 @@ void CppQmlTypesLoader::parseQmlTypeDescriptions(const QByteArray &contents,
}
CppQmlTypes::CppQmlTypes(ValueOwner *valueOwner)
- : m_cppContextProperties(0)
+ : m_cppContextProperties(nullptr)
, m_valueOwner(valueOwner)
{
@@ -1607,13 +1603,13 @@ const ObjectValue *CppQmlTypes::cppContextProperties() const
ConvertToNumber::ConvertToNumber(ValueOwner *valueOwner)
- : m_valueOwner(valueOwner), m_result(0)
+ : m_valueOwner(valueOwner), m_result(nullptr)
{
}
const Value *ConvertToNumber::operator()(const Value *value)
{
- const Value *previousValue = switchResult(0);
+ const Value *previousValue = switchResult(nullptr);
if (value)
value->accept(this);
@@ -1670,13 +1666,13 @@ void ConvertToNumber::visit(const FunctionValue *object)
}
ConvertToString::ConvertToString(ValueOwner *valueOwner)
- : m_valueOwner(valueOwner), m_result(0)
+ : m_valueOwner(valueOwner), m_result(nullptr)
{
}
const Value *ConvertToString::operator()(const Value *value)
{
- const Value *previousValue = switchResult(0);
+ const Value *previousValue = switchResult(nullptr);
if (value)
value->accept(this);
@@ -1733,13 +1729,13 @@ void ConvertToString::visit(const FunctionValue *object)
}
ConvertToObject::ConvertToObject(ValueOwner *valueOwner)
- : m_valueOwner(valueOwner), m_result(0)
+ : m_valueOwner(valueOwner), m_result(nullptr)
{
}
const Value *ConvertToObject::operator()(const Value *value)
{
- const Value *previousValue = switchResult(0);
+ const Value *previousValue = switchResult(nullptr);
if (value)
value->accept(this);
@@ -1855,7 +1851,7 @@ ASTObjectValue::ASTObjectValue(UiQualifiedId *typeName,
const Document *doc,
ValueOwner *valueOwner)
: ObjectValue(valueOwner, doc->importId()),
- m_typeName(typeName), m_initializer(initializer), m_doc(doc), m_defaultPropertyRef(0)
+ m_typeName(typeName), m_initializer(initializer), m_doc(doc), m_defaultPropertyRef(nullptr)
{
if (m_initializer) {
for (UiObjectMemberList *it = m_initializer->members; it; it = it->next) {
@@ -2166,7 +2162,7 @@ ASTSignal::ASTSignal(UiPublicMember *ast, const Document *doc, ValueOwner *value
const QString &signalName = ast->name.toString();
m_slotName = generatedSlotName(signalName);
- ObjectValue *v = valueOwner->newObject(/*prototype=*/0);
+ ObjectValue *v = valueOwner->newObject(/*prototype=*/nullptr);
for (UiParameterList *it = ast->parameters; it; it = it->next) {
if (!it->name.isEmpty())
v->setMember(it->name.toString(), valueOwner->defaultValueForBuiltinType(it->type->name.toString()));
@@ -2222,7 +2218,7 @@ bool ASTSignal::getSourceLocation(QString *fileName, int *line, int *column) con
ImportInfo::ImportInfo()
: m_type(ImportType::Invalid)
- , m_ast(0)
+ , m_ast(nullptr)
{
}
@@ -2332,7 +2328,7 @@ UiImport *ImportInfo::ast() const
}
Import::Import()
- : object(0), valid(false), used(false)
+ : object(nullptr), valid(false), used(false)
{}
Import::Import(const Import &other)
@@ -2359,10 +2355,9 @@ TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
const Value *TypeScope::lookupMember(const QString &name, const Context *context,
const ObjectValue **foundInObject, bool) const
{
- QListIterator<Import> it(m_imports->all());
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ const QList<Import> &imports = m_imports->all();
+ for (int pos = imports.size(); --pos >= 0; ) {
+ const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2374,7 +2369,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
if (info.as() == name) {
if (foundInObject)
*foundInObject = this;
- i.used = true;
+ i.used = true; // FIXME: This evilly modifies a 'const' object
return import;
}
continue;
@@ -2386,16 +2381,15 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
}
}
if (foundInObject)
- *foundInObject = 0;
- return 0;
+ *foundInObject = nullptr;
+ return nullptr;
}
void TypeScope::processMembers(MemberProcessor *processor) const
{
- QListIterator<Import> it(m_imports->all());
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ const QList<Import> &imports = m_imports->all();
+ for (int pos = imports.size(); --pos >= 0; ) {
+ const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2424,10 +2418,9 @@ JSImportScope::JSImportScope(const Imports *imports, ValueOwner *valueOwner)
const Value *JSImportScope::lookupMember(const QString &name, const Context *,
const ObjectValue **foundInObject, bool) const
{
- QListIterator<Import> it(m_imports->all());
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ const QList<Import> &imports = m_imports->all();
+ for (int pos = imports.size(); --pos >= 0; ) {
+ const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2443,16 +2436,15 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *,
}
}
if (foundInObject)
- *foundInObject = 0;
- return 0;
+ *foundInObject = nullptr;
+ return nullptr;
}
void JSImportScope::processMembers(MemberProcessor *processor) const
{
- QListIterator<Import> it(m_imports->all());
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ const QList<Import> &imports = m_imports->all();
+ for (int pos = imports.size(); --pos >= 0; ) {
+ const Import &i = imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2505,10 +2497,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
if (dotIdx != -1)
firstId = firstId.left(dotIdx);
- QListIterator<Import> it(m_imports);
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ for (int pos = m_imports.size(); --pos >= 0; ) {
+ const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2531,10 +2521,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
QString Imports::nameForImportedObject(const ObjectValue *value, const Context *context) const
{
- QListIterator<Import> it(m_imports);
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ for (int pos = m_imports.size(); --pos >= 0; ) {
+ const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
@@ -2617,10 +2605,8 @@ public:
void Imports::dump() const
{
qCDebug(qmljsLog) << "Imports contents, in search order:";
- QListIterator<Import> it(m_imports);
- it.toBack();
- while (it.hasPrevious()) {
- const Import &i = it.previous();
+ for (int pos = m_imports.size(); --pos >= 0; ) {
+ const Import &i = m_imports.at(pos);
const ObjectValue *import = i.object;
const ImportInfo &info = i.info;
diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h
index f2e953180c..a726b3bff1 100644
--- a/src/libs/qmljs/qmljsinterpreter.h
+++ b/src/libs/qmljs/qmljsinterpreter.h
@@ -163,163 +163,163 @@ template <typename RetTy> const RetTy *value_cast(const Value *)
template <> Q_INLINE_TEMPLATE const NullValue *value_cast(const Value *v)
{
if (v) return v->asNullValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const UndefinedValue *value_cast(const Value *v)
{
if (v) return v->asUndefinedValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const UnknownValue *value_cast(const Value *v)
{
if (v) return v->asUnknownValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const NumberValue *value_cast(const Value *v)
{
if (v) return v->asNumberValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const IntValue *value_cast(const Value *v)
{
if (v) return v->asIntValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const RealValue *value_cast(const Value *v)
{
if (v) return v->asRealValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const BooleanValue *value_cast(const Value *v)
{
if (v) return v->asBooleanValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const StringValue *value_cast(const Value *v)
{
if (v) return v->asStringValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const UrlValue *value_cast(const Value *v)
{
if (v) return v->asUrlValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ObjectValue *value_cast(const Value *v)
{
if (v) return v->asObjectValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ASTFunctionValue *value_cast(const Value *v)
{
if (v) return v->asAstFunctionValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const FunctionValue *value_cast(const Value *v)
{
if (v) return v->asFunctionValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const Reference *value_cast(const Value *v)
{
if (v) return v->asReference();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ColorValue *value_cast(const Value *v)
{
if (v) return v->asColorValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const AnchorLineValue *value_cast(const Value *v)
{
if (v) return v->asAnchorLineValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const CppComponentValue *value_cast(const Value *v)
{
if (v) return v->asCppComponentValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ASTObjectValue *value_cast(const Value *v)
{
if (v) return v->asAstObjectValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const QmlEnumValue *value_cast(const Value *v)
{
if (v) return v->asQmlEnumValue();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const QmlPrototypeReference *value_cast(const Value *v)
{
if (v) return v->asQmlPrototypeReference();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ASTPropertyReference *value_cast(const Value *v)
{
if (v) return v->asAstPropertyReference();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const Internal::QtObjectPrototypeReference *value_cast(const Value *v)
{
if (v) return v->asQtObjectPrototypeReference();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ASTVariableReference *value_cast(const Value *v)
{
if (v) return v->asAstVariableReference();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const Function *value_cast(const Value *v)
{
if (v) return v->asFunction();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const MetaFunction *value_cast(const Value *v)
{
if (v) return v->asMetaFunction();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const JSImportScope *value_cast(const Value *v)
{
if (v) return v->asJSImportScope();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const TypeScope *value_cast(const Value *v)
{
if (v) return v->asTypeScope();
- else return 0;
+ else return nullptr;
}
template <> Q_INLINE_TEMPLATE const ASTSignal *value_cast(const Value *v)
{
if (v) return v->asAstSignal();
- else return 0;
+ else return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@@ -480,7 +480,7 @@ class QMLJS_EXPORT PropertyData {
public:
const Value *value;
PropertyInfo propertyInfo;
- PropertyData(const Value *value = 0,
+ PropertyData(const Value *value = nullptr,
PropertyInfo propertyInfo = PropertyInfo(PropertyInfo::Default))
: value(value), propertyInfo(propertyInfo)
{ }
@@ -513,10 +513,10 @@ public:
virtual void removeMember(const QString &name);
virtual const Value *lookupMember(const QString &name, const Context *context,
- const ObjectValue **foundInObject = 0,
+ const ObjectValue **foundInObject = nullptr,
bool examinePrototypes = true) const;
virtual const Value *lookupMember(const QString &name, const ContextPtr &context,
- const ObjectValue **foundInObject = 0,
+ const ObjectValue **foundInObject = nullptr,
bool examinePrototypes = true) const
{ return lookupMember(name, context.data(), foundInObject, examinePrototypes); }
@@ -620,8 +620,8 @@ public:
bool hasLocalProperty(const QString &typeName) const;
bool hasProperty(const QString &typeName) const;
- LanguageUtils::FakeMetaEnum getEnum(const QString &typeName, const CppComponentValue **foundInScope = 0) const;
- const QmlEnumValue *getEnumValue(const QString &typeName, const CppComponentValue **foundInScope = 0) const;
+ LanguageUtils::FakeMetaEnum getEnum(const QString &typeName, const CppComponentValue **foundInScope = nullptr) const;
+ const QmlEnumValue *getEnumValue(const QString &typeName, const CppComponentValue **foundInScope = nullptr) const;
const ObjectValue *signalScope(const QString &signalName) const;
protected:
@@ -1000,11 +1000,11 @@ public:
ImportInfo();
static ImportInfo moduleImport(QString uri, LanguageUtils::ComponentVersion version,
- const QString &as, AST::UiImport *ast = 0);
+ const QString &as, AST::UiImport *ast = nullptr);
static ImportInfo pathImport(const QString &docPath, const QString &path,
LanguageUtils::ComponentVersion version,
- const QString &as, AST::UiImport *ast = 0);
- static ImportInfo invalidImport(AST::UiImport *ast = 0);
+ const QString &as, AST::UiImport *ast = nullptr);
+ static ImportInfo invalidImport(AST::UiImport *ast = nullptr);
static ImportInfo implicitDirectoryImport(const QString &directory);
static ImportInfo qrcDirectoryImport(const QString &directory);
@@ -1059,7 +1059,7 @@ public:
TypeScope(const Imports *imports, ValueOwner *valueOwner);
virtual const Value *lookupMember(const QString &name, const Context *context,
- const ObjectValue **foundInObject = 0,
+ const ObjectValue **foundInObject = nullptr,
bool examinePrototypes = true) const override;
void processMembers(MemberProcessor *processor) const override;
const TypeScope *asTypeScope() const override;
@@ -1073,7 +1073,7 @@ public:
JSImportScope(const Imports *imports, ValueOwner *valueOwner);
virtual const Value *lookupMember(const QString &name, const Context *context,
- const ObjectValue **foundInObject = 0,
+ const ObjectValue **foundInObject = nullptr,
bool examinePrototypes = true) const override;
void processMembers(MemberProcessor *processor) const override;
const JSImportScope *asJSImportScope() const override;
diff --git a/src/libs/qmljs/qmljslineinfo.cpp b/src/libs/qmljs/qmljslineinfo.cpp
index e3a83e1244..9a7ab32e25 100644
--- a/src/libs/qmljs/qmljslineinfo.cpp
+++ b/src/libs/qmljs/qmljslineinfo.cpp
@@ -89,9 +89,9 @@ LineInfo::LineInfo()
*/
// shorthands
- yyLine = 0;
- yyBraceDepth = 0;
- yyLeftBraceFollows = 0;
+ yyLine = nullptr;
+ yyBraceDepth = nullptr;
+ yyLeftBraceFollows = nullptr;
}
LineInfo::~LineInfo()
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 1acdb68ed9..396e69b8e5 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -138,29 +138,24 @@ Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const Librar
d->builtins = builtins;
d->vContext = vContext;
- d->diagnosticMessages = 0;
- d->allDiagnosticMessages = 0;
+ d->diagnosticMessages = nullptr;
+ d->allDiagnosticMessages = nullptr;
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
if (modelManager) {
- ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
+ const ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
{
// populate engine with types from C++
- ModelManagerInterface::CppDataHashIterator cppDataHashIterator(cppDataHash);
- while (cppDataHashIterator.hasNext()) {
- cppDataHashIterator.next();
- d->valueOwner->cppQmlTypes().load(cppDataHashIterator.key(),
- cppDataHashIterator.value().exportedTypes);
- }
+ for (auto it = cppDataHash.cbegin(), end = cppDataHash.cend(); it != end; ++it)
+ d->valueOwner->cppQmlTypes().load(it.key(), it.value().exportedTypes);
}
// build an object with the context properties from C++
- ObjectValue *cppContextProperties = d->valueOwner->newObject(/* prototype = */ 0);
- foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
- QHashIterator<QString, QString> it(cppData.contextProperties);
- while (it.hasNext()) {
- it.next();
- const Value *value = 0;
+ ObjectValue *cppContextProperties = d->valueOwner->newObject(/* prototype = */ nullptr);
+ for (const ModelManagerInterface::CppData &cppData : cppDataHash) {
+ for (auto it = cppData.contextProperties.cbegin(), end = cppData.contextProperties.cend();
+ it != end; ++it) {
+ const Value *value = nullptr;
const QString cppTypeName = it.value();
if (!cppTypeName.isEmpty())
value = d->valueOwner->cppQmlTypes().objectByCppName(cppTypeName);
@@ -294,7 +289,7 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
{
Import import;
import.info = importInfo;
- import.object = 0;
+ import.object = nullptr;
import.valid = true;
QString path = importInfo.path();
@@ -319,7 +314,7 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
} else if (importInfo.type() == ImportType::QrcFile) {
QLocale locale;
QStringList filePaths = ModelManagerInterface::instance()
- ->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
+ ->filesAtQrcPath(path, &locale, nullptr, ModelManagerInterface::ActiveQrcResources);
if (filePaths.isEmpty())
filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path);
if (!filePaths.isEmpty()) {
@@ -332,10 +327,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
importLibrary(doc, path, &import);
- QMapIterator<QString,QStringList> iter(ModelManagerInterface::instance()
- ->filesInQrcPath(path));
- while (iter.hasNext()) {
- iter.next();
+ const QMap<QString, QStringList> paths = ModelManagerInterface::instance()->filesInQrcPath(path);
+ for (auto iter = paths.cbegin(), end = paths.cend(); iter != end; ++iter) {
if (ModelManagerInterface::guessLanguageOfFile(iter.key()).isQmlLikeLanguage()) {
Document::Ptr importedDoc = snapshot.document(iter.value().at(0));
if (importedDoc && importedDoc->bind()->rootObjectValue()) {
diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h
index 59e5e3f85a..e4357061b3 100644
--- a/src/libs/qmljs/qmljslink.h
+++ b/src/libs/qmljs/qmljslink.h
@@ -46,7 +46,7 @@ public:
Link(const Snapshot &snapshot, const ViewerContext &vContext, const LibraryInfo &builtins);
// Link all documents in snapshot, collecting all diagnostic messages (if messages != 0)
- ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = 0);
+ ContextPtr operator()(QHash<QString, QList<DiagnosticMessage> > *messages = nullptr);
// Link all documents in snapshot, appending the diagnostic messages
// for 'doc' in 'messages'
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index 6bb1bc8ff9..4453172e8a 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -175,15 +175,10 @@ Dialect ModelManagerInterface::guessLanguageOfFile(const QString &fileName)
QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Dialect> languages)
{
- QHash<QString, Dialect> lMapping;
- if (instance())
- lMapping = instance()->languageForSuffix();
- else
- lMapping = defaultLanguageMapping();
QStringList patterns;
- QHashIterator<QString,Dialect> i(lMapping);
- while (i.hasNext()) {
- i.next();
+ const QHash<QString, Dialect> lMapping =
+ instance() ? instance()->languageForSuffix() : defaultLanguageMapping();
+ for (auto i = lMapping.cbegin(), end = lMapping.cend(); i != end; ++i) {
if (languages.contains(i.value()))
patterns << QLatin1String("*.") + i.key();
}
@@ -237,7 +232,7 @@ ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopyInternal()
void ModelManagerInterface::addTaskInternal(QFuture<void> result, const QString &msg,
const char *taskId) const
{
- Q_UNUSED(result);
+ Q_UNUSED(result)
qCDebug(qmljsLog) << "started " << taskId << " " << msg;
}
@@ -725,9 +720,8 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho
*importedFiles += importPath;
}
} else if (import.type() == ImportType::QrcDirectory) {
- QMapIterator<QString,QStringList> dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName));
- while (dirContents.hasNext()) {
- dirContents.next();
+ const QMap<QString, QStringList> files = ModelManagerInterface::instance()->filesInQrcPath(importName);
+ for (auto dirContents = files.cbegin(), end = files.cend(); dirContents != end; ++dirContents) {
if (ModelManagerInterface::guessLanguageOfFile(dirContents.key()).isQmlLikeOrJsLanguage()) {
foreach (const QString &filePath, dirContents.value()) {
if (! snapshot.document(filePath))
@@ -1091,10 +1085,7 @@ void ModelManagerInterface::updateImportPaths()
PathsAndLanguages allImportPaths;
QmlLanguageBundles activeBundles;
QmlLanguageBundles extendedBundles;
- QMapIterator<ProjectExplorer::Project *, ProjectInfo> pInfoIter(m_projects);
- QHashIterator<Dialect, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
- while (pInfoIter.hasNext()) {
- pInfoIter.next();
+ for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
const PathsAndLanguages &iPaths = pInfoIter.value().importPaths;
for (int i = 0; i < iPaths.size(); ++i) {
PathAndLanguage pAndL = iPaths.at(i);
@@ -1104,14 +1095,12 @@ void ModelManagerInterface::updateImportPaths()
pAndL.language());
}
}
- while (vCtxsIter.hasNext()) {
- vCtxsIter.next();
+ for (auto vCtxsIter = m_defaultVContexts.cbegin(), end = m_defaultVContexts.cend();
+ vCtxsIter != end; ++ vCtxsIter) {
foreach (const QString &path, vCtxsIter.value().paths)
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), vCtxsIter.value().language);
}
- pInfoIter.toFront();
- while (pInfoIter.hasNext()) {
- pInfoIter.next();
+ for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
activeBundles.mergeLanguageBundles(pInfoIter.value().activeBundle);
foreach (Dialect l, pInfoIter.value().activeBundle.languages()) {
foreach (const QString &path, pInfoIter.value().activeBundle.bundleForLanguage(l)
@@ -1122,9 +1111,7 @@ void ModelManagerInterface::updateImportPaths()
}
}
}
- pInfoIter.toFront();
- while (pInfoIter.hasNext()) {
- pInfoIter.next();
+ for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
QString pathAtt = pInfoIter.value().qtQmlPath;
if (!pathAtt.isEmpty())
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index cd36cbca2f..b9bfe67db4 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -132,7 +132,6 @@ public:
};
typedef QHash<QString, CppData> CppDataHash;
- typedef QHashIterator<QString, CppData> CppDataHashIterator;
public:
ModelManagerInterface(QObject *parent = nullptr);
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index 2c6afb61c0..e4f51e64c2 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -44,7 +44,7 @@ using namespace QmlJS;
PluginDumper::PluginDumper(ModelManagerInterface *modelManager)
: QObject(modelManager)
, m_modelManager(modelManager)
- , m_pluginWatcher(0)
+ , m_pluginWatcher(nullptr)
{
qRegisterMetaType<QmlJS::ModelManagerInterface::ProjectInfo>("QmlJS::ModelManagerInterface::ProjectInfo");
}
@@ -436,7 +436,7 @@ void PluginDumper::loadDependencies(const QStringList &dependencies,
visitedPtr->insert(name);
}
QStringList newDependencies;
- loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, 0, &newDependencies);
+ loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, nullptr, &newDependencies);
newDependencies = Utils::toList(Utils::toSet(newDependencies) - *visitedPtr);
if (!newDependencies.isEmpty())
loadDependencies(newDependencies, errors, warnings, objects, visitedPtr.take());
diff --git a/src/libs/qmljs/qmljsrewriter.cpp b/src/libs/qmljs/qmljsrewriter.cpp
index b672f8df86..25cad3d2db 100644
--- a/src/libs/qmljs/qmljsrewriter.cpp
+++ b/src/libs/qmljs/qmljsrewriter.cpp
@@ -67,7 +67,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast,
SourceLocation endOfPreviousMember;
SourceLocation startOfNextMember;
- if (insertAfter == 0 || insertAfter->member == 0) {
+ if (insertAfter == nullptr || insertAfter->member == nullptr) {
// insert as first member
endOfPreviousMember = ast->lbraceToken;
@@ -88,7 +88,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast,
bool needsTrailingSemicolon = false;
if (isOneLiner) {
- if (insertAfter == 0) { // we're inserting after an lbrace
+ if (insertAfter == nullptr) { // we're inserting after an lbrace
if (ast->members) { // we're inserting before a member (and not the rbrace)
needsTrailingSemicolon = bindingType == ScriptBinding;
}
@@ -142,8 +142,8 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
{
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString());
- UiObjectMemberList *lastObjectDef = 0;
- UiObjectMemberList *lastNonObjectDef = 0;
+ UiObjectMemberList *lastObjectDef = nullptr;
+ UiObjectMemberList *lastNonObjectDef = nullptr;
for (UiObjectMemberList *iter = members; iter; iter = iter->next) {
UiObjectMember *member = iter->member;
@@ -175,8 +175,8 @@ UiArrayMemberList *Rewriter::searchMemberToInsertAfter(UiArrayMemberList *member
{
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString());
- UiArrayMemberList *lastObjectDef = 0;
- UiArrayMemberList *lastNonObjectDef = 0;
+ UiArrayMemberList *lastObjectDef = nullptr;
+ UiArrayMemberList *lastNonObjectDef = nullptr;
for (UiArrayMemberList *iter = members; iter; iter = iter->next) {
UiObjectMember *member = iter->member;
@@ -208,7 +208,7 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
const QStringList &propertyOrder)
{
if (!members)
- return 0; // empty members
+ return nullptr; // empty members
QHash<QString, UiObjectMemberList *> orderedMembers;
@@ -236,11 +236,11 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb
for (; idx > 0; --idx) {
const QString prop = propertyOrder.at(idx - 1);
UiObjectMemberList *candidate = orderedMembers.value(prop, 0);
- if (candidate != 0)
+ if (candidate != nullptr)
return candidate;
}
- return 0;
+ return nullptr;
}
void Rewriter::changeBinding(UiObjectInitializer *ast,
@@ -356,7 +356,7 @@ void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue)
if (!ast)
return;
- UiObjectMember *lastMember = 0;
+ UiObjectMember *lastMember = nullptr;
for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) {
lastMember = iter->member;
}
@@ -400,7 +400,7 @@ void Rewriter::removeGroupedProperty(UiObjectDefinition *ast,
const QString propName = propertyName.mid(dotIdx + 1);
- UiObjectMember *wanted = 0;
+ UiObjectMember *wanted = nullptr;
unsigned memberCount = 0;
for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
++memberCount;
@@ -590,7 +590,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m
void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding,
const QString &content)
{
- UiObjectMember *lastMember = 0;
+ UiObjectMember *lastMember = nullptr;
for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next)
if (iter->member)
lastMember = iter->member;
@@ -671,7 +671,7 @@ void Rewriter::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray,
int &start,
int &end) const
{
- UiArrayMemberList *currentMember = 0;
+ UiArrayMemberList *currentMember = nullptr;
for (UiArrayMemberList *it = parentArray->members; it; it = it->next) {
if (it->member == member) {
currentMember = it;
diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp
index 7b071662b9..ca59e74dca 100644
--- a/src/libs/qmljs/qmljsscopebuilder.cpp
+++ b/src/libs/qmljs/qmljsscopebuilder.cpp
@@ -67,8 +67,8 @@ void ScopeBuilder::push(AST::Node *node)
if (!_scopeChain->qmlScopeObjects().isEmpty()
&& name.startsWith(QLatin1String("on"))
&& !script->qualifiedId->next) {
- const ObjectValue *owner = 0;
- const Value *value = 0;
+ const ObjectValue *owner = nullptr;
+ const Value *value = nullptr;
// try to find the name on the scope objects
foreach (const ObjectValue *scope, _scopeChain->qmlScopeObjects()) {
value = scope->lookupMember(name, _scopeChain->context(), &owner);
@@ -217,19 +217,19 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id)
{
// do a name lookup on the scope objects
- const Value *result = 0;
+ const Value *result = nullptr;
foreach (const ObjectValue *scopeObject, _scopeChain->qmlScopeObjects()) {
const ObjectValue *object = scopeObject;
for (UiQualifiedId *it = id; it; it = it->next) {
if (it->name.isEmpty())
- return 0;
+ return nullptr;
result = object->lookupMember(it->name.toString(), _scopeChain->context());
if (!result)
break;
if (it->next) {
object = result->asObjectValue();
if (!object) {
- result = 0;
+ result = nullptr;
break;
}
}
@@ -255,5 +255,5 @@ const ObjectValue *ScopeBuilder::isPropertyChangesObject(const ContextPtr &conte
return prototype;
}
}
- return 0;
+ return nullptr;
}
diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp
index cda0b0c656..c9fadb91e9 100644
--- a/src/libs/qmljs/qmljsscopechain.cpp
+++ b/src/libs/qmljs/qmljsscopechain.cpp
@@ -77,14 +77,14 @@ QList<const QmlComponentChain *> QmlComponentChain::instantiatingComponents() co
const ObjectValue *QmlComponentChain::idScope() const
{
if (!m_document)
- return 0;
+ return nullptr;
return m_document->bind()->idEnvironment();
}
const ObjectValue *QmlComponentChain::rootObjectScope() const
{
if (!m_document)
- return 0;
+ return nullptr;
return m_document->bind()->rootObjectValue();
}
@@ -97,10 +97,10 @@ void QmlComponentChain::addInstantiatingComponent(const QmlComponentChain *compo
ScopeChain::ScopeChain(const Document::Ptr &document, const ContextPtr &context)
: m_document(document)
, m_context(context)
- , m_globalScope(0)
- , m_cppContextProperties(0)
- , m_qmlTypes(0)
- , m_jsImports(0)
+ , m_globalScope(nullptr)
+ , m_cppContextProperties(nullptr)
+ , m_qmlTypes(nullptr)
+ , m_jsImports(nullptr)
, m_modified(false)
{
initializeRootScope();
@@ -130,7 +130,7 @@ const Value * ScopeChain::lookup(const QString &name, const ObjectValue **foundI
}
if (foundInScope)
- *foundInScope = 0;
+ *foundInScope = nullptr;
// we're confident to implement global lookup correctly, so return 'undefined'
return m_context->valueOwner()->undefinedValue();
@@ -264,8 +264,8 @@ void ScopeChain::update() const
}
}
- ObjectValue *root = 0;
- ObjectValue *ids = 0;
+ ObjectValue *root = nullptr;
+ ObjectValue *ids = nullptr;
if (m_qmlComponentScope && m_qmlComponentScope->document()) {
const Bind *bind = m_qmlComponentScope->document()->bind();
root = bind->rootObjectValue();
diff --git a/src/libs/qmljs/qmljsscopechain.h b/src/libs/qmljs/qmljsscopechain.h
index a08d686248..829ff1230f 100644
--- a/src/libs/qmljs/qmljsscopechain.h
+++ b/src/libs/qmljs/qmljsscopechain.h
@@ -72,7 +72,7 @@ public:
Document::Ptr document() const;
const ContextPtr &context() const;
- const Value *lookup(const QString &name, const ObjectValue **foundInScope = 0) const;
+ const Value *lookup(const QString &name, const ObjectValue **foundInScope = nullptr) const;
const Value *evaluate(AST::Node *node) const;
const ObjectValue *globalScope() const;
diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp
index 80ec498d8f..895922a1eb 100644
--- a/src/libs/qmljs/qmljstypedescriptionreader.cpp
+++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp
@@ -42,7 +42,7 @@ using namespace QmlJS::AST;
using namespace LanguageUtils;
TypeDescriptionReader::TypeDescriptionReader(const QString &fileName, const QString &data)
- : _fileName (fileName), _source(data), _objects(0)
+ : _fileName (fileName), _source(data), _objects(nullptr)
{
}
diff --git a/src/libs/qmljs/qmljsutils.cpp b/src/libs/qmljs/qmljsutils.cpp
index d212e8fdcd..4872a0bae7 100644
--- a/src/libs/qmljs/qmljsutils.cpp
+++ b/src/libs/qmljs/qmljsutils.cpp
@@ -140,7 +140,7 @@ SourceLocation QmlJS::fullLocationForQualifiedId(AST::UiQualifiedId *qualifiedId
QString QmlJS::idOfObject(Node *object, UiScriptBinding **idBinding)
{
if (idBinding)
- *idBinding = 0;
+ *idBinding = nullptr;
UiObjectInitializer *initializer = initializerOfObject(object);
if (!initializer) {
@@ -179,7 +179,7 @@ UiObjectInitializer *QmlJS::initializerOfObject(Node *object)
return definition->initializer;
if (UiObjectBinding *binding = cast<UiObjectBinding *>(object))
return binding->initializer;
- return 0;
+ return nullptr;
}
UiQualifiedId *QmlJS::qualifiedTypeNameId(Node *node)
@@ -188,7 +188,7 @@ UiQualifiedId *QmlJS::qualifiedTypeNameId(Node *node)
return binding->qualifiedTypeNameId;
else if (UiObjectDefinition *binding = AST::cast<UiObjectDefinition *>(node))
return binding->qualifiedTypeNameId;
- return 0;
+ return nullptr;
}
DiagnosticMessage QmlJS::errorMessage(const AST::SourceLocation &loc, const QString &message)
diff --git a/src/libs/qmljs/qmljsutils.h b/src/libs/qmljs/qmljsutils.h
index a9da56ed2d..103548ade3 100644
--- a/src/libs/qmljs/qmljsutils.h
+++ b/src/libs/qmljs/qmljsutils.h
@@ -43,7 +43,7 @@ QMLJS_EXPORT AST::SourceLocation locationFromRange(const AST::SourceLocation &st
QMLJS_EXPORT AST::SourceLocation fullLocationForQualifiedId(AST::UiQualifiedId *);
-QMLJS_EXPORT QString idOfObject(AST::Node *object, AST::UiScriptBinding **idBinding = 0);
+QMLJS_EXPORT QString idOfObject(AST::Node *object, AST::UiScriptBinding **idBinding = nullptr);
QMLJS_EXPORT AST::UiObjectInitializer *initializerOfObject(AST::Node *object);
diff --git a/src/libs/qmljs/qmljsvalueowner.cpp b/src/libs/qmljs/qmljsvalueowner.cpp
index bc58f61490..573ccb2aa1 100644
--- a/src/libs/qmljs/qmljsvalueowner.cpp
+++ b/src/libs/qmljs/qmljsvalueowner.cpp
@@ -130,7 +130,7 @@ SharedValueOwner *ValueOwner::sharedValueOwner(QString kind)
SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
: ValueOwner(this) // need to avoid recursing in ValueOwner ctor
{
- _objectPrototype = newObject(/*prototype = */ 0);
+ _objectPrototype = newObject(/*prototype = */ nullptr);
_functionPrototype = newObject(_objectPrototype);
_numberPrototype = newObject(_objectPrototype);
_booleanPrototype = newObject(_objectPrototype);
@@ -409,7 +409,7 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
_globalObject->setMember(QLatin1String("Date"), dateCtor());
_globalObject->setMember(QLatin1String("RegExp"), regexpCtor());
- Function *f = 0;
+ Function *f = nullptr;
// XMLHttpRequest
ObjectValue *xmlHttpRequest = newObject();
@@ -477,7 +477,7 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
_globalObject->setMember(QLatin1String("JSON"), json);
// QML objects
- _qmlFontObject = newObject(/*prototype =*/ 0);
+ _qmlFontObject = newObject(/*prototype =*/ nullptr);
_qmlFontObject->setClassName(QLatin1String("font"));
_qmlFontObject->setMember(QLatin1String("family"), stringValue());
_qmlFontObject->setMember(QLatin1String("styleName"), stringValue());
@@ -496,24 +496,24 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
_qmlFontObject->setMember(QLatin1String("kerning"), booleanValue());
_qmlFontObject->setMember(QLatin1String("preferShaping"), booleanValue());
- _qmlPointObject = newObject(/*prototype =*/ 0);
+ _qmlPointObject = newObject(/*prototype =*/ nullptr);
_qmlPointObject->setClassName(QLatin1String("Point"));
_qmlPointObject->setMember(QLatin1String("x"), numberValue());
_qmlPointObject->setMember(QLatin1String("y"), numberValue());
- _qmlSizeObject = newObject(/*prototype =*/ 0);
+ _qmlSizeObject = newObject(/*prototype =*/ nullptr);
_qmlSizeObject->setClassName(QLatin1String("Size"));
_qmlSizeObject->setMember(QLatin1String("width"), numberValue());
_qmlSizeObject->setMember(QLatin1String("height"), numberValue());
- _qmlRectObject = newObject(/*prototype =*/ 0);
+ _qmlRectObject = newObject(/*prototype =*/ nullptr);
_qmlRectObject->setClassName(QLatin1String("Rect"));
_qmlRectObject->setMember(QLatin1String("x"), numberValue());
_qmlRectObject->setMember(QLatin1String("y"), numberValue());
_qmlRectObject->setMember(QLatin1String("width"), numberValue());
_qmlRectObject->setMember(QLatin1String("height"), numberValue());
- _qmlVector2DObject = newObject(/*prototype =*/ 0);
+ _qmlVector2DObject = newObject(/*prototype =*/ nullptr);
_qmlVector2DObject->setClassName(QLatin1String("Vector2D"));
_qmlVector2DObject->setMember(QLatin1String("x"), realValue());
_qmlVector2DObject->setMember(QLatin1String("y"), realValue());
@@ -527,7 +527,7 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
addFunction(_qmlVector2DObject, QLatin1String("toVector4d"), _qmlVector4DObject, 0);
addFunction(_qmlVector2DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
- _qmlVector3DObject = newObject(/*prototype =*/ 0);
+ _qmlVector3DObject = newObject(/*prototype =*/ nullptr);
_qmlVector3DObject->setClassName(QLatin1String("Vector3D"));
_qmlVector3DObject->setMember(QLatin1String("x"), realValue());
_qmlVector3DObject->setMember(QLatin1String("y"), realValue());
@@ -542,7 +542,7 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
addFunction(_qmlVector3DObject, QLatin1String("toVector4d"), _qmlVector4DObject, 0);
addFunction(_qmlVector3DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
- _qmlVector4DObject = newObject(/*prototype =*/ 0);
+ _qmlVector4DObject = newObject(/*prototype =*/ nullptr);
_qmlVector4DObject->setClassName(QLatin1String("Vector4D"));
_qmlVector4DObject->setMember(QLatin1String("x"), realValue());
_qmlVector4DObject->setMember(QLatin1String("y"), realValue());
@@ -558,14 +558,14 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
addFunction(_qmlVector4DObject, QLatin1String("toVector3d"), _qmlVector3DObject, 0);
addFunction(_qmlVector4DObject, QLatin1String("fuzzyEquals"), booleanValue(), 1, 1);
- _qmlQuaternionObject = newObject(/*prototype =*/ 0);
+ _qmlQuaternionObject = newObject(/*prototype =*/ nullptr);
_qmlQuaternionObject->setClassName(QLatin1String("Quaternion"));
_qmlQuaternionObject->setMember(QLatin1String("scalar"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("x"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("y"), realValue());
_qmlQuaternionObject->setMember(QLatin1String("z"), realValue());
- _qmlMatrix4x4Object = newObject(/*prototype =*/ 0);
+ _qmlMatrix4x4Object = newObject(/*prototype =*/ nullptr);
_qmlMatrix4x4Object->setClassName(QLatin1String("Matrix4x4"));
for (int i = 1; i < 5; ++i)
for (int j = 1; j < 5; ++j)
@@ -634,7 +634,7 @@ SharedValueOwner::SharedValueOwner(SharedValueOwnerKind kind)
_globalObject->setMember(QLatin1String("Qt"), _qtObject);
// firebug/webkit compat
- ObjectValue *consoleObject = newObject(/*prototype */ 0);
+ ObjectValue *consoleObject = newObject(/*prototype */ nullptr);
addFunction(consoleObject, QLatin1String("log"), 1, 0, true);
addFunction(consoleObject, QLatin1String("debug"), 1, 0, true);
if (kind == Qt5Kind) {
diff --git a/src/libs/qmljs/qmljsvalueowner.h b/src/libs/qmljs/qmljsvalueowner.h
index 90c3f923e2..9c5adfe53d 100644
--- a/src/libs/qmljs/qmljsvalueowner.h
+++ b/src/libs/qmljs/qmljsvalueowner.h
@@ -62,7 +62,7 @@ class QMLJS_EXPORT ValueOwner
public:
static SharedValueOwner *sharedValueOwner(QString kind = QString());
- ValueOwner(const SharedValueOwner *shared = 0);
+ ValueOwner(const SharedValueOwner *shared = nullptr);
virtual ~ValueOwner();
const NullValue *nullValue() const;
diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt
index 48eda5cf92..62c8609a7a 100644
--- a/src/libs/sqlite/CMakeLists.txt
+++ b/src/libs/sqlite/CMakeLists.txt
@@ -3,7 +3,7 @@ add_qtc_library(Sqlite
SQLITE_THREADSAFE=2 SQLITE_ENABLE_FTS4 SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_UNLOCK_NOTIFY SQLITE_ENABLE_COLUMN_METADATA
BUILD_SQLITE_LIBRARY
- DEPENDS Qt5::Core
+ DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS}
PUBLIC_INCLUDES ../3rdparty/sqlite
SOURCES
../3rdparty/sqlite/sqlite3.c
diff --git a/src/libs/sqlite/sqlitedatabasebackend.cpp b/src/libs/sqlite/sqlitedatabasebackend.cpp
index 2f60677e59..4d5b350801 100644
--- a/src/libs/sqlite/sqlitedatabasebackend.cpp
+++ b/src/libs/sqlite/sqlitedatabasebackend.cpp
@@ -99,7 +99,7 @@ void DatabaseBackend::open(Utils::SmallStringView databaseFilePath, OpenMode mod
int resultCode = sqlite3_open_v2(databaseFilePath.data(),
&m_databaseHandle,
openMode(mode),
- NULL);
+ nullptr);
checkDatabaseCouldBeOpened(resultCode);
diff --git a/src/libs/ssh/sftpfilesystemmodel.cpp b/src/libs/ssh/sftpfilesystemmodel.cpp
index 0e9eb48e5e..73860bacae 100644
--- a/src/libs/ssh/sftpfilesystemmodel.cpp
+++ b/src/libs/ssh/sftpfilesystemmodel.cpp
@@ -46,7 +46,7 @@ class SftpDirNode;
class SftpFileNode
{
public:
- SftpFileNode() : parent(0) { }
+ SftpFileNode() : parent(nullptr) { }
virtual ~SftpFileNode() { }
QString path;
@@ -98,9 +98,9 @@ using namespace Internal;
SftpFileSystemModel::SftpFileSystemModel(QObject *parent)
: QAbstractItemModel(parent), d(new SftpFileSystemModelPrivate)
{
- d->sshConnection = 0;
+ d->sshConnection = nullptr;
d->rootDirectory = QLatin1Char('/');
- d->rootNode = 0;
+ d->rootNode = nullptr;
d->statJobId = SftpInvalidJob;
}
@@ -131,7 +131,7 @@ void SftpFileSystemModel::setRootDirectory(const QString &path)
beginResetModel();
d->rootDirectory = path;
delete d->rootNode;
- d->rootNode = 0;
+ d->rootNode = nullptr;
d->lsOps.clear();
d->statJobId = SftpInvalidJob;
endResetModel();
@@ -157,7 +157,7 @@ SftpJobId SftpFileSystemModel::downloadFile(const QModelIndex &index, const QStr
int SftpFileSystemModel::columnCount(const QModelIndex &parent) const
{
- Q_UNUSED(parent);
+ Q_UNUSED(parent)
return 2; // type + name
}
@@ -262,17 +262,17 @@ void SftpFileSystemModel::statRootDirectory()
void SftpFileSystemModel::shutDown()
{
if (d->sftpSession) {
- disconnect(d->sftpSession.get(), 0, this, 0);
+ disconnect(d->sftpSession.get(), nullptr, this, nullptr);
d->sftpSession->quit();
d->sftpSession.release()->deleteLater();
}
if (d->sshConnection) {
- disconnect(d->sshConnection, 0, this, 0);
+ disconnect(d->sshConnection, nullptr, this, nullptr);
QSsh::releaseConnection(d->sshConnection);
- d->sshConnection = 0;
+ d->sshConnection = nullptr;
}
delete d->rootNode;
- d->rootNode = 0;
+ d->rootNode = nullptr;
}
void SftpFileSystemModel::handleSshConnectionFailure()
diff --git a/src/libs/ssh/sftpfilesystemmodel.h b/src/libs/ssh/sftpfilesystemmodel.h
index 091dfabb4c..96ba2a2a54 100644
--- a/src/libs/ssh/sftpfilesystemmodel.h
+++ b/src/libs/ssh/sftpfilesystemmodel.h
@@ -41,7 +41,7 @@ class QSSH_EXPORT SftpFileSystemModel : public QAbstractItemModel
{
Q_OBJECT
public:
- explicit SftpFileSystemModel(QObject *parent = 0);
+ explicit SftpFileSystemModel(QObject *parent = nullptr);
~SftpFileSystemModel();
/*
diff --git a/src/libs/ssh/sshconnection.h b/src/libs/ssh/sshconnection.h
index 89af4d71d9..9f6ece99fd 100644
--- a/src/libs/ssh/sshconnection.h
+++ b/src/libs/ssh/sshconnection.h
@@ -99,7 +99,7 @@ class QSSH_EXPORT SshConnection : public QObject
public:
enum State { Unconnected, Connecting, Connected, Disconnecting };
- explicit SshConnection(const SshConnectionParameters &serverInfo, QObject *parent = 0);
+ explicit SshConnection(const SshConnectionParameters &serverInfo, QObject *parent = nullptr);
void connectToHost();
void disconnectFromHost();
diff --git a/src/libs/ssh/sshconnectionmanager.cpp b/src/libs/ssh/sshconnectionmanager.cpp
index c3bb1821ee..68533728f2 100644
--- a/src/libs/ssh/sshconnectionmanager.cpp
+++ b/src/libs/ssh/sshconnectionmanager.cpp
@@ -70,7 +70,7 @@ public:
~SshConnectionManager()
{
foreach (const UnaquiredConnection &connection, m_unacquiredConnections) {
- disconnect(connection.connection, 0, this, 0);
+ disconnect(connection.connection, nullptr, this, nullptr);
delete connection.connection;
}
@@ -162,7 +162,7 @@ public:
}
if (doDelete) {
- disconnect(connection, 0, this, 0);
+ disconnect(connection, nullptr, this, nullptr);
m_deprecatedConnections.removeAll(connection);
connection->deleteLater();
}
@@ -175,7 +175,7 @@ public:
for (int i = 0; i < m_unacquiredConnections.count(); ++i) {
SshConnection * const connection = m_unacquiredConnections.at(i).connection;
if (connection->connectionParameters() == sshParams) {
- disconnect(connection, 0, this, 0);
+ disconnect(connection, nullptr, this, nullptr);
delete connection;
m_unacquiredConnections.removeAt(i);
break;
@@ -205,7 +205,7 @@ private:
return;
if (m_unacquiredConnections.removeOne(UnaquiredConnection(currentConnection))) {
- disconnect(currentConnection, 0, this, 0);
+ disconnect(currentConnection, nullptr, this, nullptr);
currentConnection->deleteLater();
}
}
@@ -216,7 +216,7 @@ private:
for (int i = m_unacquiredConnections.count() - 1; i >= 0; --i) {
UnaquiredConnection &c = m_unacquiredConnections[i];
if (c.scheduledForRemoval) {
- disconnect(c.connection, 0, this, 0);
+ disconnect(c.connection, nullptr, this, nullptr);
c.connection->deleteLater();
m_unacquiredConnections.removeAt(i);
} else {
diff --git a/src/libs/ssh/sshkeycreationdialog.h b/src/libs/ssh/sshkeycreationdialog.h
index a73fb3b3c2..dca0bdef82 100644
--- a/src/libs/ssh/sshkeycreationdialog.h
+++ b/src/libs/ssh/sshkeycreationdialog.h
@@ -37,7 +37,7 @@ class QSSH_EXPORT SshKeyCreationDialog : public QDialog
{
Q_OBJECT
public:
- SshKeyCreationDialog(QWidget *parent = 0);
+ SshKeyCreationDialog(QWidget *parent = nullptr);
~SshKeyCreationDialog();
QString privateKeyFilePath() const;
diff --git a/src/libs/ssh/sshremoteprocess.cpp b/src/libs/ssh/sshremoteprocess.cpp
index 635f23e150..3d1ef6a81e 100644
--- a/src/libs/ssh/sshremoteprocess.cpp
+++ b/src/libs/ssh/sshremoteprocess.cpp
@@ -83,15 +83,14 @@ SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &co
void SshRemoteProcess::doStart()
{
QTC_ASSERT(!isRunning(), return);
- const QStringList args = fullLocalCommandLine();
+ const Utils::CommandLine cmd = fullLocalCommandLine();
if (!d->displayName.isEmpty()) {
QProcessEnvironment env = processEnvironment();
env.insert("DISPLAY", d->displayName);
setProcessEnvironment(env);
}
- qCDebug(sshLog) << "starting remote process:" << QDir::toNativeSeparators(args.first())
- << args;
- QProcess::start(args.first(), args.mid(1));
+ qCDebug(sshLog) << "starting remote process:" << cmd.toUserOutput();
+ QProcess::start(cmd.executable().toString(), cmd.splitArguments());
}
SshRemoteProcess::~SshRemoteProcess()
@@ -119,17 +118,22 @@ bool SshRemoteProcess::isRunning() const
return state() == QProcess::Running;
}
-QStringList SshRemoteProcess::fullLocalCommandLine() const
+Utils::CommandLine SshRemoteProcess::fullLocalCommandLine() const
{
- QStringList args = QStringList("-q") << d->connectionArgs;
- if (d->useTerminal)
- args.prepend("-tt");
+ Utils::CommandLine cmd{SshSettings::sshFilePath()};
+
if (!d->displayName.isEmpty())
- args.prepend("-X");
+ cmd.addArg("-X");
+ if (d->useTerminal)
+ cmd.addArg("-tt");
+
+ cmd.addArg("-q");
+ cmd.addArgs(d->connectionArgs);
+
if (!d->remoteCommand.isEmpty())
- args << d->remoteCommand;
- args.prepend(SshSettings::sshFilePath().toString());
- return args;
+ cmd.addArg(d->remoteCommand);
+
+ return cmd;
}
} // namespace QSsh
diff --git a/src/libs/ssh/sshremoteprocess.h b/src/libs/ssh/sshremoteprocess.h
index 02ab3546fd..d1d62d76fa 100644
--- a/src/libs/ssh/sshremoteprocess.h
+++ b/src/libs/ssh/sshremoteprocess.h
@@ -28,7 +28,7 @@
#include "ssh_global.h"
#include "sshprocess.h"
-#include <QStringList>
+#include <utils/fileutils.h>
namespace QSsh {
class SshConnection;
@@ -46,7 +46,7 @@ public:
void start();
bool isRunning() const;
- QStringList fullLocalCommandLine() const;
+ Utils::CommandLine fullLocalCommandLine() const;
signals:
void done(const QString &error);
diff --git a/src/libs/ssh/sshremoteprocessrunner.cpp b/src/libs/ssh/sshremoteprocessrunner.cpp
index 7a062e6ab8..0a4419a0d6 100644
--- a/src/libs/ssh/sshremoteprocessrunner.cpp
+++ b/src/libs/ssh/sshremoteprocessrunner.cpp
@@ -189,9 +189,9 @@ void SshRemoteProcessRunner::setState(int newState)
d->m_process.release()->deleteLater();
}
if (d->m_connection) {
- disconnect(d->m_connection, 0, this, 0);
+ disconnect(d->m_connection, nullptr, this, nullptr);
QSsh::releaseConnection(d->m_connection);
- d->m_connection = 0;
+ d->m_connection = nullptr;
}
}
}
diff --git a/src/libs/ssh/sshremoteprocessrunner.h b/src/libs/ssh/sshremoteprocessrunner.h
index 082f30ed57..5b3f1b05b4 100644
--- a/src/libs/ssh/sshremoteprocessrunner.h
+++ b/src/libs/ssh/sshremoteprocessrunner.h
@@ -36,7 +36,7 @@ class QSSH_EXPORT SshRemoteProcessRunner : public QObject
Q_OBJECT
public:
- SshRemoteProcessRunner(QObject *parent = 0);
+ SshRemoteProcessRunner(QObject *parent = nullptr);
~SshRemoteProcessRunner();
void run(const QString &command, const SshConnectionParameters &sshParams);
diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt
index 41a42bbac5..9cc68ec149 100644
--- a/src/libs/tracing/CMakeLists.txt
+++ b/src/libs/tracing/CMakeLists.txt
@@ -6,6 +6,7 @@ endif()
add_qtc_library(Tracing
DEPENDS Utils Qt5::Qml Qt5::Quick
+ PUBLIC_DEPENDS Qt5::Widgets
SOURCES ${TEST_SOURCES}
flamegraph.cpp flamegraph.h
flamegraphattached.h
diff --git a/src/libs/tracing/flamegraph.cpp b/src/libs/tracing/flamegraph.cpp
index 67329209ac..b7afef4551 100644
--- a/src/libs/tracing/flamegraph.cpp
+++ b/src/libs/tracing/flamegraph.cpp
@@ -198,18 +198,18 @@ void FlameGraph::rebuild()
void FlameGraph::mousePressEvent(QMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
void FlameGraph::mouseReleaseEvent(QMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
setSelectedTypeId(-1);
}
void FlameGraph::mouseDoubleClickEvent(QMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
setSelectedTypeId(-1);
resetRoot();
}
diff --git a/src/libs/tracing/qml/ButtonsBar.qml b/src/libs/tracing/qml/ButtonsBar.qml
index a151eb9f91..32111daa57 100644
--- a/src/libs/tracing/qml/ButtonsBar.qml
+++ b/src/libs/tracing/qml/ButtonsBar.qml
@@ -24,9 +24,8 @@
****************************************************************************/
import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Layouts 1.0
-import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
import TimelineTheme 1.0
@@ -55,19 +54,12 @@ ToolBar {
return rangeButton.checked
}
- style: ToolBarStyle {
- padding {
- left: 0
- right: 0
- top: 0
- bottom: 0
- }
- background: Rectangle {
- anchors.fill: parent
- color: Theme.color(Theme.PanelStatusBarBackgroundColor)
- }
+ background: Rectangle {
+ anchors.fill: parent
+ color: Theme.color(Theme.PanelStatusBarBackgroundColor)
}
+
RowLayout {
spacing: 0
anchors.fill: parent
@@ -77,7 +69,7 @@ ToolBar {
Layout.fillHeight: true
imageSource: "image://icons/prev"
- tooltip: qsTr("Jump to previous event.")
+ ToolTip.text: qsTr("Jump to previous event.")
onClicked: buttons.jumpToPrev()
}
@@ -86,7 +78,7 @@ ToolBar {
Layout.fillHeight: true
imageSource: "image://icons/next"
- tooltip: qsTr("Jump to next event.")
+ ToolTip.text: qsTr("Jump to next event.")
onClicked: buttons.jumpToNext()
}
@@ -95,7 +87,7 @@ ToolBar {
Layout.fillHeight: true
imageSource: "image://icons/zoom"
- tooltip: qsTr("Show zoom slider.")
+ ToolTip.text: qsTr("Show zoom slider.")
checkable: true
checked: false
onCheckedChanged: buttons.zoomControlChanged()
@@ -106,7 +98,7 @@ ToolBar {
Layout.fillHeight: true
imageSource: "image://icons/" + (checked ? "rangeselected" : "rangeselection");
- tooltip: qsTr("Select range.")
+ ToolTip.text: qsTr("Select range.")
checkable: true
checked: false
onCheckedChanged: buttons.rangeSelectChanged()
@@ -117,7 +109,7 @@ ToolBar {
Layout.fillHeight: true
imageSource: "image://icons/selectionmode"
- tooltip: qsTr("View event information on mouseover.")
+ ToolTip.text: qsTr("View event information on mouseover.")
checkable: true
checked: false
onCheckedChanged: buttons.lockChanged()
diff --git a/src/libs/tracing/qml/CategoryLabel.qml b/src/libs/tracing/qml/CategoryLabel.qml
index 5945b0f6df..171c92400e 100644
--- a/src/libs/tracing/qml/CategoryLabel.qml
+++ b/src/libs/tracing/qml/CategoryLabel.qml
@@ -24,8 +24,7 @@
****************************************************************************/
import QtQuick 2.1
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls 2.2
import TimelineTheme 1.0
@@ -62,6 +61,12 @@ Item {
drag.minimumY: dragging ? 0 : -dragOffset // Account for parent change below
drag.maximumY: draggerParent.height - (dragging ? 0 : dragOffset)
drag.axis: Drag.YAxis
+ hoverEnabled: true
+ ToolTip {
+ text: model.tooltip || labelContainer.text
+ visible: enabled && parent.containsMouse
+ delay: 1000
+ }
}
DropArea {
@@ -116,6 +121,8 @@ Item {
sourceComponent: RowLabel {
label: labels[index];
onSelectBySelectionId: {
+ if (labelContainer.model.hasMixedTypesInExpandedState)
+ return;
if (labelContainer.reverseSelect) {
labelContainer.selectPrevBySelectionId(label.id);
} else {
@@ -161,7 +168,7 @@ Item {
visible: eventIds.length > 0
imageSource: "image://icons/note"
- tooltip: texts.join("\n");
+ ToolTip.text: texts.join("\n");
onClicked: {
if (++currentNote >= eventIds.length)
currentNote = 0;
@@ -176,7 +183,7 @@ Item {
implicitHeight: txt.height - 1
enabled: expanded || (model && !model.empty)
imageSource: expanded ? "image://icons/close_split" : "image://icons/split"
- tooltip: expanded ? qsTr("Collapse category") : qsTr("Expand category")
+ ToolTip.text: expanded ? qsTr("Collapse category") : qsTr("Expand category")
onClicked: model.expanded = !expanded
}
diff --git a/src/libs/tracing/qml/FlameGraphView.qml b/src/libs/tracing/qml/FlameGraphView.qml
index 9712b91cd5..f98bcb3134 100644
--- a/src/libs/tracing/qml/FlameGraphView.qml
+++ b/src/libs/tracing/qml/FlameGraphView.qml
@@ -28,7 +28,7 @@ import TimelineTheme 1.0
import QtQml 2.2
import QtQuick 2.9
-import QtQuick.Controls 1.3
+import QtQuick.Controls 2.3
ScrollView {
id: root
@@ -45,7 +45,7 @@ ScrollView {
function resetRoot() { flamegraph.resetRoot(); }
property bool zoomed: flamegraph.zoomed
- property int sizeRole: -1
+ property var sizeRole: modes[Math.max(0, modesMenu.currentIndex)]
property var model: null
property int typeIdRole: -1
@@ -56,7 +56,7 @@ ScrollView {
property int summaryRole: -1
property int noteRole: -1
- property var trRoleNames: []
+ property var trRoleNames: ({})
property var modes: []
@@ -314,27 +314,11 @@ ScrollView {
}
}
- Button {
+ ComboBox {
+ id: modesMenu
x: flickable.width - width
y: flickable.contentY
-
- // It won't listen to anchors.margins and by default it doesn't add any margin. Great.
- width: implicitWidth + 20
-
- text: qsTr("Visualize %1").arg(trRoleNames[root.sizeRole])
-
- menu: Menu {
- id: modesMenu
- Instantiator {
- model: root.modes
- MenuItem {
- text: root.trRoleNames[modelData]
- onTriggered: root.sizeRole = modelData
- }
- onObjectAdded: modesMenu.insertItem(index, object)
- onObjectRemoved: modesMenu.removeItem(object)
- }
- }
+ model: root.modes.map(function(role) { return root.trRoleNames[role] });
}
}
}
diff --git a/src/libs/tracing/qml/ImageToolButton.qml b/src/libs/tracing/qml/ImageToolButton.qml
index 353e38f122..686fd2db88 100644
--- a/src/libs/tracing/qml/ImageToolButton.qml
+++ b/src/libs/tracing/qml/ImageToolButton.qml
@@ -24,8 +24,7 @@
****************************************************************************/
import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls 2.0
import TimelineTheme 1.0
@@ -34,6 +33,9 @@ ToolButton {
property string imageSource
+ ToolTip.visible: enabled && hovered
+ ToolTip.delay: 1000
+
Image {
source: parent.enabled ? parent.imageSource : parent.imageSource + "/disabled"
width: 16
@@ -42,13 +44,11 @@ ToolButton {
smooth: false
}
- style: ButtonStyle {
- background: Rectangle {
- color: (control.checked || control.pressed)
- ? Theme.color(Theme.FancyToolButtonSelectedColor)
- : control.hovered
- ? Theme.color(Theme.FancyToolButtonHoverColor)
- : "#00000000"
- }
+ background: Rectangle {
+ color: (parent.checked || parent.pressed)
+ ? Theme.color(Theme.FancyToolButtonSelectedColor)
+ : parent.hovered
+ ? Theme.color(Theme.FancyToolButtonHoverColor)
+ : "#00000000"
}
}
diff --git a/src/libs/tracing/qml/MainView.qml b/src/libs/tracing/qml/MainView.qml
index 2e1f97a3ba..f544721f9a 100644
--- a/src/libs/tracing/qml/MainView.qml
+++ b/src/libs/tracing/qml/MainView.qml
@@ -24,8 +24,7 @@
****************************************************************************/
import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Styles 1.0
+import QtQuick.Controls 2.0
import TimelineTheme 1.0
@@ -73,7 +72,7 @@ Rectangle {
rangeDetails.hide();
selectionRangeMode = false;
zoomSlider.externalUpdate = true;
- zoomSlider.value = zoomSlider.minimumValue;
+ zoomSlider.value = zoomSlider.from;
}
// This is called from outside to synchronize the timeline to other views
@@ -192,6 +191,7 @@ Rectangle {
TimelineContent {
id: content
+
anchors.left: buttonsBar.right
anchors.top: buttonsBar.bottom
anchors.bottom: overview.top
@@ -255,13 +255,13 @@ Rectangle {
onReleased: {
if (selectionRange.creationState === selectionRange.creationSecondLimit) {
- content.stayInteractive = true;
+ content.interactive = true;
selectionRange.creationState = selectionRange.creationFinished;
}
}
onPressed: {
if (selectionRange.creationState === selectionRange.creationFirstLimit) {
- content.stayInteractive = false;
+ content.interactive = false;
selectionRange.setPos(selectionRangeControl.mouseX + content.contentX);
selectionRange.creationState = selectionRange.creationSecondLimit;
}
@@ -281,12 +281,12 @@ Rectangle {
flickableDirection: Flickable.HorizontalFlick
clip: true
interactive: false
- x: content.x + content.flickableItem.x
- y: content.y + content.flickableItem.y
+ x: content.x
+ y: content.y
height: (selectionRangeMode &&
selectionRange.creationState !== selectionRange.creationInactive) ?
- content.flickableItem.height : 0
- width: content.flickableItem.width
+ content.height : 0
+ width: content.width
contentX: content.contentX
contentWidth: content.contentWidth
@@ -320,11 +320,11 @@ Rectangle {
}
TimelineRulers {
- contentX: buttonsBar.width - content.x - content.flickableItem.x + content.contentX
+ contentX: buttonsBar.width + content.contentX
anchors.left: buttonsBar.right
anchors.right: parent.right
anchors.top: parent.top
- height: content.flickableItem.height + buttonsBar.height
+ height: content.height + buttonsBar.height
windowStart: zoomControl.windowStart
viewTimePerPixel: selectionRange.viewTimePerPixel
scaleHeight: buttonsBar.height
@@ -404,17 +404,9 @@ Rectangle {
function showInfo() {
var timelineModel = timelineModelAggregator.models[selectedModel];
- var eventData = timelineModel.details(selectedItem)
- var content = [];
- for (var k in eventData) {
- if (k === "displayName") {
- dialogTitle = eventData[k];
- } else {
- content.push(k);
- content.push(eventData[k]);
- }
- }
- rangeDetails.model = content;
+ var eventData = timelineModel.orderedDetails(selectedItem)
+ dialogTitle = eventData["title"] || "";
+ rangeDetails.model = eventData["content"] || [];
var location = timelineModel.location(selectedItem)
if (location.hasOwnProperty("file")) { // not empty
@@ -458,8 +450,8 @@ Rectangle {
Slider {
id: zoomSlider
anchors.fill: parent
- minimumValue: 1
- maximumValue: 10000
+ from: 1
+ to: 10000
stepSize: 100
property int exponent: 3
@@ -478,7 +470,7 @@ Rectangle {
}
var windowLength = Math.max(
- Math.pow(value / maximumValue, exponent) * zoomControl.windowDuration,
+ Math.pow(value / to, exponent) * zoomControl.windowDuration,
minWindowLength);
var startTime = Math.max(zoomControl.windowStart, fixedPoint - windowLength / 2)
diff --git a/src/libs/tracing/qml/RangeDetails.qml b/src/libs/tracing/qml/RangeDetails.qml
index ccb86a5c3c..cb99479ca4 100644
--- a/src/libs/tracing/qml/RangeDetails.qml
+++ b/src/libs/tracing/qml/RangeDetails.qml
@@ -24,6 +24,8 @@
****************************************************************************/
import QtQuick 2.9
+import QtQuick.Controls 2.0
+
import TimelineTheme 1.0
Item {
@@ -108,6 +110,7 @@ Item {
implicitHeight: typeTitle.height
visible: !rangeDetails.noteReadonly
onClicked: noteEdit.focus = true
+ ToolTip.text: qsTr("Edit note")
}
ImageToolButton {
@@ -117,6 +120,7 @@ Item {
anchors.right: closeIcon.left
implicitHeight: typeTitle.height
onClicked: locked = !locked
+ ToolTip.text: qsTr("View event information on mouseover.")
}
ImageToolButton {
@@ -126,6 +130,7 @@ Item {
implicitHeight: typeTitle.height
imageSource: "image://icons/close_window"
onClicked: rangeDetails.clearSelection()
+ ToolTip.text: qsTr("Close")
}
}
diff --git a/src/libs/tracing/qml/RowLabel.qml b/src/libs/tracing/qml/RowLabel.qml
index be394b5e7e..e73d51b291 100644
--- a/src/libs/tracing/qml/RowLabel.qml
+++ b/src/libs/tracing/qml/RowLabel.qml
@@ -24,8 +24,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
+import QtQuick.Controls 2.2
import TimelineTheme 1.0
Button {
@@ -38,25 +37,26 @@ Button {
signal setRowHeight(int newHeight)
property string labelText: label.description ? label.description : qsTr("[unknown]")
- action: Action {
- onTriggered: button.selectBySelectionId();
- tooltip: button.labelText + (label.displayName ? (" (" + label.displayName + ")") : "")
+
+ onPressed: selectBySelectionId();
+ ToolTip.text: labelText + (label.displayName ? (" (" + label.displayName + ")") : "")
+ ToolTip.visible: hovered
+ ToolTip.delay: 1000
+
+ background: Rectangle {
+ border.width: 1
+ border.color: Theme.color(Theme.Timeline_DividerColor)
+ color: Theme.color(Theme.PanelStatusBarBackgroundColor)
}
- style: ButtonStyle {
- background: Rectangle {
- border.width: 1
- border.color: Theme.color(Theme.Timeline_DividerColor)
- color: Theme.color(Theme.PanelStatusBarBackgroundColor)
- }
- label: TimelineText {
- text: button.labelText
- verticalAlignment: Text.AlignVCenter
- horizontalAlignment: Text.AlignLeft
- elide: Text.ElideRight
- color: Theme.color(Theme.PanelTextColorLight)
- }
+ contentItem: TimelineText {
+ text: button.labelText
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ elide: Text.ElideRight
+ color: Theme.color(Theme.PanelTextColorLight)
}
+
MouseArea {
hoverEnabled: true
property bool resizing: false
diff --git a/src/libs/tracing/qml/SelectionRangeDetails.qml b/src/libs/tracing/qml/SelectionRangeDetails.qml
index 458e5cf7ad..288ac7693c 100644
--- a/src/libs/tracing/qml/SelectionRangeDetails.qml
+++ b/src/libs/tracing/qml/SelectionRangeDetails.qml
@@ -24,6 +24,8 @@
****************************************************************************/
import QtQuick 2.1
+import QtQuick.Controls 2.0
+
import TimelineTheme 1.0
import TimelineTimeFormatter 1.0
@@ -133,5 +135,6 @@ Item {
anchors.top: selectionRangeDetails.top
implicitHeight: typeTitle.height
onClicked: selectionRangeDetails.close()
+ ToolTip.text: qsTr("Close")
}
}
diff --git a/src/libs/tracing/qml/TimelineContent.qml b/src/libs/tracing/qml/TimelineContent.qml
index 636d707356..5eb667822f 100644
--- a/src/libs/tracing/qml/TimelineContent.qml
+++ b/src/libs/tracing/qml/TimelineContent.qml
@@ -24,20 +24,26 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 1.2
+import QtQuick.Controls 2.2
import TimelineRenderer 1.0
import QtQml.Models 2.1
-ScrollView {
- id: scroller
+Flickable {
+ id: flick
+ clip: true
+ contentHeight: timelineView.height + height
+ flickableDirection: Flickable.HorizontalAndVerticalFlick
+ boundsBehavior: Flickable.StopAtBounds
+ pixelAligned: true
+
+ ScrollBar.horizontal: ScrollBar {}
+ ScrollBar.vertical: ScrollBar {}
+
+ property bool recursionGuard: false
property QtObject zoomer
property QtObject modelProxy
- property int contentX: flick.contentX
- property int contentY: flick.contentY
- property int contentWidth: flick.contentWidth
- property int contentHeight: flick.contentHeight
property bool selectionLocked
property int typeId
@@ -58,146 +64,122 @@ ScrollView {
timelineModel.items.move(sourceIndex, targetIndex)
}
- function scroll()
- {
- flick.scroll();
+
+ function guarded(operation) {
+ if (recursionGuard)
+ return;
+ recursionGuard = true;
+ operation();
+ recursionGuard = false;
}
- // ScrollView will try to deinteractivate it. We don't want that
- // as the horizontal flickable is interactive, too. We do occasionally
- // switch to non-interactive ourselves, though.
- property bool stayInteractive: true
- onStayInteractiveChanged: flick.interactive = stayInteractive
-
- Flickable {
- id: flick
- contentHeight: timelineView.height + height
- flickableDirection: Flickable.HorizontalAndVerticalFlick
- boundsBehavior: Flickable.StopAtBounds
- pixelAligned: true
-
- onInteractiveChanged: interactive = stayInteractive
-
- property bool recursionGuard: false
-
- function guarded(operation) {
- if (recursionGuard)
- return;
- recursionGuard = true;
- operation();
- recursionGuard = false;
+ // Logically we should bind to flick.width above as we use flick.width in scroll().
+ // However, this width changes before flick.width when the window is resized and if we
+ // don't explicitly set contentX here, for some reason an automatic change in contentX is
+ // triggered after this width has changed, but before flick.width changes. This would be
+ // indistinguishabe from a manual flick by the user and thus changes the range position. We
+ // don't want to change the range position on resizing the window. Therefore we bind to this
+ // width.
+ onWidthChanged: scroll()
+
+ // Update the zoom control on scrolling.
+ onContentXChanged: guarded(function() {
+ var newStartTime = contentX * zoomer.rangeDuration / width + zoomer.windowStart;
+ if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) {
+ var newEndTime = (contentX + width) * zoomer.rangeDuration / width + zoomer.windowStart;
+ if (isFinite(newEndTime))
+ zoomer.setRange(newStartTime, newEndTime);
}
-
- // Logically we should bind to scroller.width above as we use scroller.width in scroll().
- // However, this width changes before scroller.width when the window is resized and if we
- // don't explicitly set contentX here, for some reason an automatic change in contentX is
- // triggered after this width has changed, but before scroller.width changes. This would be
- // indistinguishabe from a manual flick by the user and thus changes the range position. We
- // don't want to change the range position on resizing the window. Therefore we bind to this
- // width.
- onWidthChanged: scroll()
-
- // Update the zoom control on scrolling.
- onContentXChanged: guarded(function() {
- var newStartTime = contentX * zoomer.rangeDuration / scroller.width
- + zoomer.windowStart;
- if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) {
- var newEndTime = (contentX + scroller.width) * zoomer.rangeDuration / scroller.width
- + zoomer.windowStart;
- if (isFinite(newEndTime))
- zoomer.setRange(newStartTime, newEndTime);
+ });
+
+ // Scroll when the zoom control is updated
+ function scroll() {
+ guarded(function() {
+ if (zoomer.rangeDuration <= 0) {
+ contentWidth = 0;
+ contentX = 0;
+ } else {
+ var newWidth = zoomer.windowDuration * width / zoomer.rangeDuration;
+ if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
+ contentWidth = newWidth;
+ var newStartX = (zoomer.rangeStart - zoomer.windowStart) * width /
+ zoomer.rangeDuration;
+ if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
+ contentX = newStartX;
}
});
+ }
- // Scroll when the zoom control is updated
- function scroll() {
- guarded(function() {
- if (zoomer.rangeDuration <= 0) {
- contentWidth = 0;
- contentX = 0;
- } else {
- var newWidth = zoomer.windowDuration * scroller.width / zoomer.rangeDuration;
- if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1)
- contentWidth = newWidth;
- var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.width /
- zoomer.rangeDuration;
- if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1)
- contentX = newStartX;
- }
- });
- }
-
- Column {
- id: timelineView
-
- signal clearChildren
- signal select(int modelIndex, int eventIndex)
-
- DelegateModel {
- id: timelineModel
- model: modelProxy.models
- delegate: TimelineRenderer {
- id: renderer
- model: modelData
- notes: modelProxy.notes
- zoomer: scroller.zoomer
- selectionLocked: scroller.selectionLocked
- x: 0
- height: modelData.height
- property int visualIndex: DelegateModel.itemsIndex
-
- // paint "under" the vertical scrollbar, so that it always matches with the
- // timemarks
- width: flick.contentWidth
-
- Connections {
- target: timelineView
- onClearChildren: renderer.clearData()
- onSelect: {
- if (modelIndex === index || modelIndex === -1) {
- renderer.selectedItem = eventIndex;
- if (eventIndex !== -1)
- renderer.recenter();
- }
+ Column {
+ id: timelineView
+
+ signal clearChildren
+ signal select(int modelIndex, int eventIndex)
+
+ DelegateModel {
+ id: timelineModel
+ model: modelProxy.models
+ delegate: TimelineRenderer {
+ id: renderer
+ model: modelData
+ notes: modelProxy.notes
+ zoomer: flick.zoomer
+ selectionLocked: flick.selectionLocked
+ x: 0
+ height: modelData.height
+ property int visualIndex: DelegateModel.itemsIndex
+
+ // paint "under" the vertical scrollbar, so that it always matches with the
+ // timemarks
+ width: flick.contentWidth
+
+ Connections {
+ target: timelineView
+ onClearChildren: renderer.clearData()
+ onSelect: {
+ if (modelIndex === index || modelIndex === -1) {
+ renderer.selectedItem = eventIndex;
+ if (eventIndex !== -1)
+ renderer.recenter();
}
}
+ }
- function recenter() {
- if (modelData.endTime(selectedItem) < zoomer.rangeStart ||
- modelData.startTime(selectedItem) > zoomer.rangeEnd) {
-
- var newStart = Math.max((modelData.startTime(selectedItem) +
- modelData.endTime(selectedItem) -
- zoomer.rangeDuration) / 2, zoomer.traceStart);
- zoomer.setRange(newStart,
- Math.min(newStart + zoomer.rangeDuration, zoomer.traceEnd));
- }
+ function recenter() {
+ if (modelData.endTime(selectedItem) < zoomer.rangeStart ||
+ modelData.startTime(selectedItem) > zoomer.rangeEnd) {
- var row = modelData.row(selectedItem);
- var rowStart = modelData.rowOffset(row) + y;
- var rowEnd = rowStart + modelData.rowHeight(row);
- if (rowStart < flick.contentY || rowEnd - scroller.height > flick.contentY)
- flick.contentY = (rowStart + rowEnd - scroller.height) / 2;
+ var newStart = Math.max((modelData.startTime(selectedItem) +
+ modelData.endTime(selectedItem) -
+ zoomer.rangeDuration) / 2, zoomer.traceStart);
+ zoomer.setRange(newStart,
+ Math.min(newStart + zoomer.rangeDuration, zoomer.traceEnd));
}
- onSelectedItemChanged: scroller.propagateSelection(index, selectedItem);
+ var row = modelData.row(selectedItem);
+ var rowStart = modelData.rowOffset(row) + y;
+ var rowEnd = rowStart + modelData.rowHeight(row);
+ if (rowStart < flick.contentY || rowEnd - flick.height > flick.contentY)
+ flick.contentY = (rowStart + rowEnd - flick.height) / 2;
+ }
+
+ onSelectedItemChanged: flick.propagateSelection(index, selectedItem);
- Connections {
- target: model
- onDetailsChanged: {
- if (selectedItem != -1) {
- scroller.propagateSelection(-1, -1);
- scroller.propagateSelection(index, selectedItem);
- }
+ Connections {
+ target: model
+ onDetailsChanged: {
+ if (selectedItem != -1) {
+ flick.propagateSelection(-1, -1);
+ flick.propagateSelection(index, selectedItem);
}
}
}
}
+ }
- Repeater {
- id: repeater
- model: timelineModel
- }
+ Repeater {
+ id: repeater
+ model: timelineModel
}
}
}
diff --git a/src/libs/tracing/qml/TimelineLabels.qml b/src/libs/tracing/qml/TimelineLabels.qml
index 71434822f4..ac5fd2123d 100644
--- a/src/libs/tracing/qml/TimelineLabels.qml
+++ b/src/libs/tracing/qml/TimelineLabels.qml
@@ -86,6 +86,12 @@ Flickable {
height: loader.height
width: loader.width
+ Rectangle {
+ height: loader.height
+ width: 3
+ color: modelData.categoryColor
+ }
+
CategoryLabel {
id: label
model: modelData
diff --git a/src/libs/tracing/timelineabstractrenderer.cpp b/src/libs/tracing/timelineabstractrenderer.cpp
index c2e8886ee1..8242b70aad 100644
--- a/src/libs/tracing/timelineabstractrenderer.cpp
+++ b/src/libs/tracing/timelineabstractrenderer.cpp
@@ -28,7 +28,7 @@
namespace Timeline {
TimelineAbstractRenderer::TimelineAbstractRendererPrivate::TimelineAbstractRendererPrivate() :
- selectedItem(-1), selectionLocked(true), model(0), notes(0), zoomer(0), modelDirty(false),
+ selectedItem(-1), selectionLocked(true), model(nullptr), notes(nullptr), zoomer(nullptr), modelDirty(false),
rowHeightsDirty(false), notesDirty(false)
{
}
diff --git a/src/libs/tracing/timelineformattime.cpp b/src/libs/tracing/timelineformattime.cpp
index 54f12d90dd..314a68f236 100644
--- a/src/libs/tracing/timelineformattime.cpp
+++ b/src/libs/tracing/timelineformattime.cpp
@@ -30,7 +30,7 @@ namespace Timeline {
QString formatTime(qint64 timestamp, qint64 reference)
{
- static const char *decimalUnits[] = {"ns", "\xb5s", "ms", "s"};
+ static const char *decimalUnits[] = {" ns", " \xb5s", " ms", " s"};
static const double second = 1e9;
static const double minute = 60;
static const double hour = 60;
@@ -63,7 +63,7 @@ QString formatTime(qint64 timestamp, qint64 reference)
double seconds = timestamp / second;
if (seconds < minute) {
- return QString::number(seconds, 'g', qMax(round, 3)) + "s";
+ return QString::number(seconds, 'g', qMax(round, 3)) + " s";
} else {
int minutes = seconds / minute;
seconds -= minutes * minute;
@@ -88,8 +88,8 @@ QString formatTime(qint64 timestamp, qint64 reference)
static QObject *createFormatter(QQmlEngine *engine, QJSEngine *scriptEngine)
{
- Q_UNUSED(engine);
- Q_UNUSED(scriptEngine);
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
return new TimeFormatter;
}
@@ -97,7 +97,7 @@ void TimeFormatter::setupTimeFormatter()
{
static const int typeIndex = qmlRegisterSingletonType<TimeFormatter>(
"TimelineTimeFormatter", 1, 0, "TimeFormatter", createFormatter);
- Q_UNUSED(typeIndex);
+ Q_UNUSED(typeIndex)
}
}
diff --git a/src/libs/tracing/timelineitemsrenderpass.cpp b/src/libs/tracing/timelineitemsrenderpass.cpp
index a4f89dc64d..2a4727f056 100644
--- a/src/libs/tracing/timelineitemsrenderpass.cpp
+++ b/src/libs/tracing/timelineitemsrenderpass.cpp
@@ -269,11 +269,11 @@ OpaqueColoredPoint2DWithSize *OpaqueColoredPoint2DWithSize::fromVertexData(QSGGe
Q_ASSERT(attributes[3].position == 3);
Q_ASSERT(attributes[3].tupleSize == 4);
Q_ASSERT(attributes[3].type == GL_UNSIGNED_BYTE);
- Q_UNUSED(attributes);
+ Q_UNUSED(attributes)
return static_cast<OpaqueColoredPoint2DWithSize *>(geometry->vertexData());
}
-TimelineItemsGeometry::TimelineItemsGeometry() : usedVertices(0), node(0)
+TimelineItemsGeometry::TimelineItemsGeometry() : usedVertices(0), node(nullptr)
{
initNodes();
}
@@ -383,7 +383,7 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac
int indexTo, bool stateChanged,
float spacing) const
{
- Q_UNUSED(stateChanged);
+ Q_UNUSED(stateChanged)
const TimelineModel *model = renderer->model();
if (!model || indexFrom < 0 || indexTo > model->count() || indexFrom >= indexTo)
return oldState;
@@ -392,7 +392,7 @@ TimelineRenderPass::State *TimelineItemsRenderPass::update(const TimelineAbstrac
QColor(Qt::blue)).lighter(130);
TimelineItemsRenderPassState *state;
- if (oldState == 0)
+ if (oldState == nullptr)
state = new TimelineItemsRenderPassState(model);
else
state = static_cast<TimelineItemsRenderPassState *>(oldState);
@@ -472,7 +472,7 @@ void TimelineItemsMaterialShader::updateState(const RenderState &state, QSGMater
char const *const *TimelineItemsMaterialShader::attributeNames() const
{
- static const char *const attr[] = {"vertexCoord", "rectSize", "selectionId", "vertexColor", 0};
+ static const char *const attr[] = {"vertexCoord", "rectSize", "selectionId", "vertexColor", nullptr};
return attr;
}
diff --git a/src/libs/tracing/timelinemodel.cpp b/src/libs/tracing/timelinemodel.cpp
index c7b7c98904..b045c15817 100644
--- a/src/libs/tracing/timelinemodel.cpp
+++ b/src/libs/tracing/timelinemodel.cpp
@@ -135,8 +135,8 @@ int TimelineModel::row(int index) const
}
TimelineModel::TimelineModelPrivate::TimelineModelPrivate(int modelId) :
- modelId(modelId), expanded(false), hidden(false),
- expandedRowCount(1), collapsedRowCount(1)
+ modelId(modelId), categoryColor(Qt::transparent), hasMixedTypesInExpandedState(false),
+ expanded(false), hidden(false), expandedRowCount(1), collapsedRowCount(1)
{
}
@@ -170,7 +170,7 @@ int TimelineModel::modelId() const
int TimelineModel::collapsedRowHeight(int rowNumber) const
{
- Q_UNUSED(rowNumber);
+ Q_UNUSED(rowNumber)
return TimelineModelPrivate::DefaultRowHeight;
}
@@ -367,7 +367,7 @@ int TimelineModel::parentIndex(int index) const
QVariantMap TimelineModel::location(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
QVariantMap map;
return map;
}
@@ -379,25 +379,25 @@ QVariantMap TimelineModel::location(int index) const
*/
bool TimelineModel::handlesTypeId(int typeIndex) const
{
- Q_UNUSED(typeIndex);
+ Q_UNUSED(typeIndex)
return false;
}
float TimelineModel::relativeHeight(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
return 1.0f;
}
qint64 TimelineModel::rowMinValue(int rowNumber) const
{
- Q_UNUSED(rowNumber);
+ Q_UNUSED(rowNumber)
return 0;
}
qint64 TimelineModel::rowMaxValue(int rowNumber) const
{
- Q_UNUSED(rowNumber);
+ Q_UNUSED(rowNumber)
return 0;
}
@@ -514,9 +514,42 @@ int TimelineModel::rowCount() const
return d->expanded ? d->expandedRowCount : d->collapsedRowCount;
}
+QString TimelineModel::tooltip() const
+{
+ return d->tooltip;
+}
+
+void TimelineModel::setTooltip(const QString &text)
+{
+ d->tooltip = text;
+ emit tooltipChanged();
+}
+
+QColor TimelineModel::categoryColor() const
+{
+ return d->categoryColor;
+}
+
+void TimelineModel::setCategoryColor(const QColor &color)
+{
+ d->categoryColor = color;
+ emit categoryColorChanged();
+}
+
+bool TimelineModel::hasMixedTypesInExpandedState() const
+{
+ return d->hasMixedTypesInExpandedState;
+}
+
+void TimelineModel::setHasMixedTypesInExpandedState(bool value)
+{
+ d->hasMixedTypesInExpandedState = value;
+ emit hasMixedTypesInExpandedStateChanged();
+}
+
QRgb TimelineModel::color(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
return QRgb();
}
@@ -527,19 +560,45 @@ QVariantList TimelineModel::labels() const
QVariantMap TimelineModel::details(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
return QVariantMap();
}
+/**
+ * @brief TimelineModel::orderedDetails returns the title and content for the details popup
+ * @param index of the selected item
+ * @return QVariantMap containing the fields 'title' (QString) and 'content' (QVariantList
+ * with alternating keys and values as QStrings)
+ */
+QVariantMap TimelineModel::orderedDetails(int index) const
+{
+ QVariantMap info = details(index);
+ QVariantMap data;
+ QVariantList content;
+ auto it = info.constBegin();
+ auto end = info.constEnd();
+ while (it != end) {
+ if (it.key() == "displayName") {
+ data.insert("title", it.value());
+ } else {
+ content.append(it.key());
+ content.append(it.value());
+ }
+ ++it;
+ }
+ data.insert("content", content);
+ return data;
+}
+
int TimelineModel::expandedRow(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
return 0;
}
int TimelineModel::collapsedRow(int index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
return 0;
}
diff --git a/src/libs/tracing/timelinemodel.h b/src/libs/tracing/timelinemodel.h
index 65d4784e07..53b8835017 100644
--- a/src/libs/tracing/timelinemodel.h
+++ b/src/libs/tracing/timelinemodel.h
@@ -40,6 +40,9 @@ class TRACING_EXPORT TimelineModel : public QObject
Q_OBJECT
Q_PROPERTY(int modelId READ modelId CONSTANT)
Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
+ Q_PROPERTY(QString tooltip READ tooltip NOTIFY tooltipChanged)
+ Q_PROPERTY(QColor categoryColor READ categoryColor NOTIFY categoryColorChanged)
+ Q_PROPERTY(bool hasMixedTypesInExpandedState READ hasMixedTypesInExpandedState NOTIFY hasMixedTypesInExpandedStateChanged)
Q_PROPERTY(bool empty READ isEmpty NOTIFY contentChanged)
Q_PROPERTY(bool hidden READ hidden WRITE setHidden NOTIFY hiddenChanged)
Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged)
@@ -92,10 +95,21 @@ public:
int collapsedRowCount() const;
int rowCount() const;
+ QString tooltip() const;
+ void setTooltip(const QString &text);
+
+ QColor categoryColor() const;
+ void setCategoryColor(const QColor &color);
+
+ // if this is disabled, a click on the row label will select the single type it contains
+ bool hasMixedTypesInExpandedState() const;
+ void setHasMixedTypesInExpandedState(bool value);
+
// Methods which can optionally be implemented by child models.
Q_INVOKABLE virtual QRgb color(int index) const;
virtual QVariantList labels() const;
Q_INVOKABLE virtual QVariantMap details(int index) const;
+ Q_INVOKABLE virtual QVariantMap orderedDetails(int index) const;
Q_INVOKABLE virtual int expandedRow(int index) const;
Q_INVOKABLE virtual int collapsedRow(int index) const;
Q_INVOKABLE int row(int index) const;
@@ -124,6 +138,9 @@ signals:
void heightChanged();
void rowCountChanged();
void displayNameChanged();
+ void tooltipChanged();
+ void categoryColorChanged();
+ void hasMixedTypesInExpandedStateChanged();
void labelsChanged();
void detailsChanged();
diff --git a/src/libs/tracing/timelinemodel_p.h b/src/libs/tracing/timelinemodel_p.h
index bc2ac76850..98e7af20fe 100644
--- a/src/libs/tracing/timelinemodel_p.h
+++ b/src/libs/tracing/timelinemodel_p.h
@@ -138,6 +138,9 @@ public:
QVector<int> rowOffsets;
const int modelId;
QString displayName;
+ QString tooltip;
+ QColor categoryColor;
+ bool hasMixedTypesInExpandedState;
bool expanded;
bool hidden;
diff --git a/src/libs/tracing/timelinenotesrenderpass.cpp b/src/libs/tracing/timelinenotesrenderpass.cpp
index 0aa36a1762..bfc3273eed 100644
--- a/src/libs/tracing/timelinenotesrenderpass.cpp
+++ b/src/libs/tracing/timelinenotesrenderpass.cpp
@@ -106,9 +106,9 @@ TimelineRenderPass::State *TimelineNotesRenderPass::update(const TimelineAbstrac
int lastIndex, bool stateChanged,
float spacing) const
{
- Q_UNUSED(firstIndex);
- Q_UNUSED(lastIndex);
- Q_UNUSED(spacing);
+ Q_UNUSED(firstIndex)
+ Q_UNUSED(lastIndex)
+ Q_UNUSED(spacing)
const TimelineNotesModel *notes = renderer->notes();
const TimelineModel *model = renderer->model();
@@ -117,7 +117,7 @@ TimelineRenderPass::State *TimelineNotesRenderPass::update(const TimelineAbstrac
return oldState;
TimelineNotesRenderPassState *state;
- if (oldState == 0) {
+ if (oldState == nullptr) {
state = new TimelineNotesRenderPassState(model->expandedRowCount());
} else {
if (!stateChanged && !renderer->notesDirty())
@@ -253,7 +253,7 @@ void NotesMaterialShader::updateState(const RenderState &state, QSGMaterial *, Q
char const *const *NotesMaterialShader::attributeNames() const
{
- static const char *const attr[] = {"vertexCoord", "distanceFromTop", 0};
+ static const char *const attr[] = {"vertexCoord", "distanceFromTop", nullptr};
return attr;
}
diff --git a/src/libs/tracing/timelineoverviewrenderer.cpp b/src/libs/tracing/timelineoverviewrenderer.cpp
index 8b78c54a1f..9cd824186e 100644
--- a/src/libs/tracing/timelineoverviewrenderer.cpp
+++ b/src/libs/tracing/timelineoverviewrenderer.cpp
@@ -34,7 +34,7 @@ TimelineOverviewRenderer::TimelineOverviewRenderer(QQuickItem *parent) :
}
TimelineOverviewRenderer::TimelineOverviewRendererPrivate::TimelineOverviewRendererPrivate() :
- renderState(0)
+ renderState(nullptr)
{
}
@@ -50,15 +50,15 @@ QSGNode *TimelineOverviewRenderer::updatePaintNode(QSGNode *oldNode,
if (!d->model || d->model->isEmpty() || !d->zoomer || d->zoomer->traceDuration() <= 0) {
delete oldNode;
- return 0;
+ return nullptr;
}
if (d->modelDirty) {
delete d->renderState;
- d->renderState = 0;
+ d->renderState = nullptr;
}
- if (d->renderState == 0) {
+ if (d->renderState == nullptr) {
d->renderState = new TimelineRenderState(d->zoomer->traceStart(), d->zoomer->traceEnd(),
1.0, d->renderPasses.size());
}
@@ -77,7 +77,7 @@ QSGNode *TimelineOverviewRenderer::updatePaintNode(QSGNode *oldNode,
if (d->renderState->isEmpty())
d->renderState->assembleNodeTree(d->model, d->model->height(), 0);
- TimelineAbstractRenderer::updatePaintNode(0, updatePaintNodeData);
+ TimelineAbstractRenderer::updatePaintNode(nullptr, updatePaintNodeData);
QMatrix4x4 matrix;
matrix.scale(xSpacing, ySpacing, 1);
diff --git a/src/libs/tracing/timelinerenderer.cpp b/src/libs/tracing/timelinerenderer.cpp
index 182a7aadd6..2abd234e01 100644
--- a/src/libs/tracing/timelinerenderer.cpp
+++ b/src/libs/tracing/timelinerenderer.cpp
@@ -43,7 +43,7 @@
namespace Timeline {
-TimelineRenderer::TimelineRendererPrivate::TimelineRendererPrivate() : lastState(0)
+TimelineRenderer::TimelineRendererPrivate::TimelineRendererPrivate() : lastState(nullptr)
{
resetCurrentSelection();
}
@@ -58,7 +58,7 @@ void TimelineRenderer::TimelineRendererPrivate::clear()
for (auto i = renderStates.begin(); i != renderStates.end(); ++i)
qDeleteAll(*i);
renderStates.clear();
- lastState = 0;
+ lastState = nullptr;
}
TimelineRenderer::TimelineRenderer(QQuickItem *parent) :
@@ -102,7 +102,7 @@ TimelineRenderState *TimelineRenderer::TimelineRendererPrivate::findRenderState(
if (renderStates.length() <= level)
renderStates.resize(level + 1);
TimelineRenderState *state = renderStates[level][offset];
- if (state == 0) {
+ if (state == nullptr) {
state = new TimelineRenderState(start, end, 1.0 / static_cast<qreal>(SafeFloatMax),
renderPasses.size());
renderStates[level][offset] = state;
@@ -117,7 +117,7 @@ QSGNode *TimelineRenderer::updatePaintNode(QSGNode *node, UpdatePaintNodeData *u
if (!d->model || d->model->hidden() || d->model->isEmpty() || !d->zoomer ||
d->zoomer->windowDuration() <= 0) {
delete node;
- return 0;
+ return nullptr;
}
float spacing = static_cast<float>(width() / d->zoomer->windowDuration());
@@ -146,7 +146,7 @@ QSGNode *TimelineRenderer::updatePaintNode(QSGNode *node, UpdatePaintNodeData *u
TimelineModel::defaultRowHeight());
}
- TimelineAbstractRenderer::updatePaintNode(0, updatePaintNodeData);
+ TimelineAbstractRenderer::updatePaintNode(nullptr, updatePaintNodeData);
d->lastState = state;
QMatrix4x4 matrix;
@@ -158,7 +158,7 @@ QSGNode *TimelineRenderer::updatePaintNode(QSGNode *node, UpdatePaintNodeData *u
void TimelineRenderer::mousePressEvent(QMouseEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
int TimelineRenderer::TimelineRendererPrivate::rowFromPosition(int y) const
@@ -209,8 +209,13 @@ void TimelineRenderer::wheelEvent(QWheelEvent *event)
int degrees = (event->angleDelta().x() + event->angleDelta().y()) / 8;
const qint64 circle = 360;
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
qint64 mouseTime = event->pos().x() * zoom->windowDuration() / width() +
zoom->windowStart();
+#else
+ qint64 mouseTime = event->position().toPoint().x() * zoom->windowDuration() / width() +
+ zoom->windowStart();
+#endif
qint64 beforeMouse = (mouseTime - zoom->rangeStart()) * (circle - degrees) / circle;
qint64 afterMouse = (zoom->rangeEnd() - mouseTime) * (circle - degrees) / circle;
diff --git a/src/libs/tracing/timelinerenderpass.cpp b/src/libs/tracing/timelinerenderpass.cpp
index 7c87f239c6..f4644cd502 100644
--- a/src/libs/tracing/timelinerenderpass.cpp
+++ b/src/libs/tracing/timelinerenderpass.cpp
@@ -41,12 +41,12 @@ const QVector<QSGNode *> &TimelineRenderPass::State::collapsedRows() const
QSGNode *TimelineRenderPass::State::expandedOverlay() const
{
- return 0;
+ return nullptr;
}
QSGNode *TimelineRenderPass::State::collapsedOverlay() const
{
- return 0;
+ return nullptr;
}
TimelineRenderPass::State::~State()
diff --git a/src/libs/tracing/timelinerenderstate.cpp b/src/libs/tracing/timelinerenderstate.cpp
index f897496c56..d8eeb0527f 100644
--- a/src/libs/tracing/timelinerenderstate.cpp
+++ b/src/libs/tracing/timelinerenderstate.cpp
@@ -195,7 +195,7 @@ void TimelineRenderState::updateExpandedRowHeights(const TimelineModel *model, i
Q_D(TimelineRenderState);
int row = 0;
qreal offset = 0;
- for (QSGNode *rowNode = d->expandedRowRoot->firstChild(); rowNode != 0;
+ for (QSGNode *rowNode = d->expandedRowRoot->firstChild(); rowNode != nullptr;
rowNode = rowNode->nextSibling()) {
qreal rowHeight = model->expandedRowHeight(row++);
QMatrix4x4 matrix;
diff --git a/src/libs/tracing/timelineselectionrenderpass.cpp b/src/libs/tracing/timelineselectionrenderpass.cpp
index b8d6c2991a..52be3eda58 100644
--- a/src/libs/tracing/timelineselectionrenderpass.cpp
+++ b/src/libs/tracing/timelineselectionrenderpass.cpp
@@ -66,7 +66,7 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update(
const TimelineAbstractRenderer *renderer, const TimelineRenderState *parentState,
State *oldState, int firstIndex, int lastIndex, bool stateChanged, float spacing) const
{
- Q_UNUSED(stateChanged);
+ Q_UNUSED(stateChanged)
const TimelineModel *model = renderer->model();
if (!model || model->isEmpty())
@@ -74,7 +74,7 @@ TimelineRenderPass::State *TimelineSelectionRenderPass::update(
TimelineSelectionRenderPassState *state;
- if (oldState == 0)
+ if (oldState == nullptr)
state = new TimelineSelectionRenderPassState;
else
state = static_cast<TimelineSelectionRenderPassState *>(oldState);
@@ -153,7 +153,7 @@ TimelineSelectionRenderPass::TimelineSelectionRenderPass()
}
TimelineSelectionRenderPassState::TimelineSelectionRenderPassState() :
- m_expandedOverlay(0), m_collapsedOverlay(0)
+ m_expandedOverlay(nullptr), m_collapsedOverlay(nullptr)
{
m_expandedOverlay = createSelectionNode(&m_material);
m_collapsedOverlay = createSelectionNode(&m_material);
diff --git a/src/libs/tracing/timelinetheme.cpp b/src/libs/tracing/timelinetheme.cpp
index 22d8697b78..a8a7c874e1 100644
--- a/src/libs/tracing/timelinetheme.cpp
+++ b/src/libs/tracing/timelinetheme.cpp
@@ -105,8 +105,8 @@ public:
static QObject *singletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
- Q_UNUSED(engine);
- Q_UNUSED(scriptEngine);
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
return Utils::proxyTheme();
}
@@ -114,7 +114,7 @@ void TimelineTheme::setupTheme(QQmlEngine *engine)
{
static const int typeIndex = qmlRegisterSingletonType<Utils::Theme>("TimelineTheme", 1, 0,
"Theme", singletonProvider);
- Q_UNUSED(typeIndex);
+ Q_UNUSED(typeIndex)
engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider);
}
diff --git a/src/libs/utils/CMakeLists.txt b/src/libs/utils/CMakeLists.txt
index 5863c35d1f..6d2cdce97a 100644
--- a/src/libs/utils/CMakeLists.txt
+++ b/src/libs/utils/CMakeLists.txt
@@ -1,6 +1,9 @@
if (IDE_LIBEXEC_PATH AND IDE_BIN_PATH)
- file(RELATIVE_PATH RELATIVE_TOOLS_PATH
- "${CMAKE_INSTALL_PREFIX}/${IDE_BIN_PATH}" "${CMAKE_INSTALL_PREFIX}/${IDE_LIBEXEC_PATH}")
+ get_filename_component(bin_path
+ "${CMAKE_INSTALL_PREFIX}/${IDE_BIN_PATH}" ABSOLUTE "${CMAKE_BINARY_DIR}")
+ get_filename_component(libexec_path
+ "${CMAKE_INSTALL_PREFIX}/${IDE_LIBEXEC_PATH}" ABSOLUTE "${CMAKE_BINARY_DIR}")
+ file(RELATIVE_PATH RELATIVE_TOOLS_PATH "${bin_path}" "${libexec_path}")
else()
message(WARNING "IDE_LIBEXEC_PATH or IDE_BIN_PATH undefined when calculating tools path")
set(RELATIVE_TOOLS_PATH "")
@@ -21,6 +24,7 @@ add_qtc_library(Utils
basetreeview.cpp basetreeview.h
benchmarker.cpp benchmarker.h
buildablehelperlibrary.cpp buildablehelperlibrary.h
+ camelcasecursor.cpp camelcasecursor.h
categorysortfiltermodel.cpp categorysortfiltermodel.h
changeset.cpp changeset.h
checkablemessagebox.cpp checkablemessagebox.h
@@ -28,7 +32,7 @@ add_qtc_library(Utils
codegeneration.cpp codegeneration.h
completinglineedit.cpp completinglineedit.h
completingtextedit.cpp completingtextedit.h
- consoleprocess.cpp consoleprocess.h consoleprocess_p.h
+ consoleprocess.cpp consoleprocess.h
cpplanguage_details.h
crumblepath.cpp crumblepath.h
delegates.cpp delegates.h
@@ -36,12 +40,19 @@ add_qtc_library(Utils
detailsbutton.cpp detailsbutton.h
detailswidget.cpp detailswidget.h
differ.cpp differ.h
+ displayname.cpp displayname.h
dropsupport.cpp dropsupport.h
elfreader.cpp elfreader.h
elidinglabel.cpp elidinglabel.h
environment.cpp environment.h
+ environmentfwd.h
environmentdialog.cpp environmentdialog.h
environmentmodel.cpp environmentmodel.h
+ namevaluedictionary.cpp namevaluedictionary.h
+ namevalueitem.cpp namevalueitem.h
+ namevaluemodel.cpp namevaluemodel.h
+ namevaluesdialog.cpp namevaluesdialog.h
+ namevaluevalidator.cpp namevaluevalidator.h
execmenu.cpp execmenu.h
executeondestruction.h
fadingindicator.cpp fadingindicator.h
@@ -84,6 +95,11 @@ add_qtc_library(Utils
mimetypes/mimeprovider.cpp mimetypes/mimeprovider_p.h
mimetypes/mimetype.cpp mimetypes/mimetype.h mimetypes/mimetype_p.h
mimetypes/mimetypeparser.cpp mimetypes/mimetypeparser_p.h
+ namevaluedictionary.cpp namevaluedictionary.h
+ namevalueitem.cpp namevalueitem.h
+ namevaluemodel.cpp namevaluemodel.h
+ namevaluesdialog.cpp namevaluesdialog.h
+ namevaluevalidator.cpp namevaluevalidator.h
navigationtreeview.cpp navigationtreeview.h
networkaccessmanager.cpp networkaccessmanager.h
newclasswidget.cpp newclasswidget.h newclasswidget.ui
@@ -163,7 +179,6 @@ add_qtc_library(Utils
extend_qtc_target(Utils CONDITION WIN32
SOURCES
- consoleprocess_win.cpp
process_ctrlc_stub.cpp
touchbar/touchbar.cpp
DEPENDS
@@ -176,7 +191,6 @@ extend_qtc_target(Utils CONDITION WIN32
extend_qtc_target(Utils CONDITION APPLE
SOURCES
- consoleprocess_unix.cpp
fileutils_mac.mm fileutils_mac.h
processhandle_mac.mm
theme/theme_mac.mm theme/theme_mac.h
@@ -188,7 +202,6 @@ extend_qtc_target(Utils CONDITION APPLE
extend_qtc_target(Utils CONDITION UNIX AND NOT APPLE
SOURCES
- consoleprocess_unix.cpp
touchbar/touchbar.cpp
)
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h
index 237863c573..c337d93bb9 100644
--- a/src/libs/utils/algorithm.h
+++ b/src/libs/utils/algorithm.h
@@ -407,6 +407,20 @@ bool allOf(const T &container, F predicate)
return std::all_of(std::begin(container), std::end(container), predicate);
}
+// allOf taking a member function pointer
+template<typename T, typename R, typename S>
+bool allOf(const T &container, R (S::*predicate)() const)
+{
+ return std::all_of(std::begin(container), std::end(container), std::mem_fn(predicate));
+}
+
+// allOf taking a member pointer
+template<typename T, typename R, typename S>
+bool allOf(const T &container, R S::*member)
+{
+ return std::all_of(std::begin(container), std::end(container), std::mem_fn(member));
+}
+
//////////////////
// erase
/////////////////
@@ -885,6 +899,8 @@ std::tuple<C, C> partition(const C &container, F predicate)
{
C hit;
C miss;
+ reserve(hit, container.size());
+ reserve(miss, container.size());
auto hitIns = inserter(hit);
auto missIns = inserter(miss);
for (auto i : container) {
@@ -1256,7 +1272,21 @@ QSet<T> toSet(const QList<T> &list)
#endif
}
-template <class T>
+template<class T>
+QSet<T> toSet(const QVector<T> &vec)
+{
+#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
+ QSet<T> result;
+ for (const T &p : vec) {
+ result.insert(p);
+ }
+ return result;
+#else
+ return QSet<T>(vec.begin(), vec.end());
+#endif
+}
+
+template<class T>
QList<T> toList(const QSet<T> &set)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp
index 352b17bb4b..00b73002f8 100644
--- a/src/libs/utils/basetreeview.cpp
+++ b/src/libs/utils/basetreeview.cpp
@@ -345,7 +345,7 @@ public:
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const override
{
- Q_UNUSED(option);
+ Q_UNUSED(option)
QLabel *label = new QLabel(parent);
label->setAutoFillBackground(true);
label->setTextInteractionFlags(Qt::TextSelectableByMouse
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp
index 33ba624dc4..80ddeafa1a 100644
--- a/src/libs/utils/buildablehelperlibrary.cpp
+++ b/src/libs/utils/buildablehelperlibrary.cpp
@@ -46,7 +46,7 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path)
const QString toolDir = QLatin1String("QTTOOLDIR=\"");
SynchronousProcess proc;
proc.setTimeoutS(1);
- SynchronousProcessResponse response = proc.runBlocking(path, QStringList(QLatin1String("-print-env")));
+ SynchronousProcessResponse response = proc.runBlocking({path, {"-print-env"}});
if (response.result != SynchronousProcessResponse::Finished)
return QString();
const QString output = response.stdOut();
@@ -130,7 +130,7 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
SynchronousProcess qmake;
qmake.setTimeoutS(5);
- SynchronousProcessResponse response = qmake.runBlocking(qmakePath, QStringList(QLatin1String("--version")));
+ SynchronousProcessResponse response = qmake.runBlocking({qmakePath, {"--version"}});
if (response.result != SynchronousProcessResponse::Finished) {
qWarning() << response.exitMessage(qmakePath, 5);
return QString();
diff --git a/src/libs/utils/camelcasecursor.cpp b/src/libs/utils/camelcasecursor.cpp
new file mode 100644
index 0000000000..65e69bd70b
--- /dev/null
+++ b/src/libs/utils/camelcasecursor.cpp
@@ -0,0 +1,341 @@
+/**************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2019 Andre Hartmann <aha_1980@gmx.de>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "camelcasecursor.h"
+
+#include <QLineEdit>
+#include <QPlainTextEdit>
+
+template<typename C, typename E>
+bool moveCursor(C *cursor, E *edit, QTextCursor::MoveOperation direction, QTextCursor::MoveMode mode);
+
+template<>
+bool moveCursor(QTextCursor *cursor, QPlainTextEdit *, QTextCursor::MoveOperation direction,
+ QTextCursor::MoveMode mode)
+{
+ return cursor->movePosition(direction, mode);
+}
+
+template<typename C>
+bool moveCursor(C *, QLineEdit *edit, QTextCursor::MoveOperation direction, QTextCursor::MoveMode mode)
+{
+ bool mark = (mode == QTextCursor::KeepAnchor);
+ switch (direction) {
+ case QTextCursor::Left:
+ edit->cursorBackward(mark);
+ break;
+ case QTextCursor::WordLeft:
+ edit->cursorWordBackward(mark);
+ break;
+ case QTextCursor::Right:
+ edit->cursorForward(mark);
+ break;
+ case QTextCursor::WordRight:
+ edit->cursorWordForward(mark);
+ break;
+ default:
+ return false;
+ }
+ return edit->cursorPosition() > 0 && edit->cursorPosition() < edit->text().size();
+}
+
+template<typename C, typename E>
+QChar charUnderCursor(C *cursor, E *edit);
+
+template<>
+QChar charUnderCursor(QTextCursor *cursor, QPlainTextEdit *edit)
+{
+ return edit->document()->characterAt(cursor->position());
+}
+
+template<typename C>
+QChar charUnderCursor(C *, QLineEdit *edit)
+{
+ const int pos = edit->cursorPosition();
+ if (pos < 0 || pos >= edit->text().length())
+ return QChar::Null;
+
+ return edit->text().at(pos);
+};
+
+template<typename C, typename E>
+int position(C *cursor, E *edit);
+
+template<>
+int position(QTextCursor *cursor, QPlainTextEdit *)
+{
+ return cursor->position();
+}
+
+template<typename C>
+int position(C *, QLineEdit *edit)
+{
+ return edit->cursorPosition();
+}
+
+enum class Input {
+ Upper,
+ Lower,
+ Underscore,
+ Space,
+ Other
+};
+
+template<typename C, typename E>
+bool camelCaseLeft(C *cursor, E *edit, QTextCursor::MoveMode mode)
+{
+ int state = 0;
+
+ if (!moveCursor(cursor, edit, QTextCursor::Left, mode))
+ return false;
+
+ for (;;) {
+ QChar c = charUnderCursor(cursor, edit);
+ Input input = Input::Other;
+ if (c.isUpper())
+ input = Input::Upper;
+ else if (c.isLower() || c.isDigit())
+ input = Input::Lower;
+ else if (c == '_')
+ input = Input::Underscore;
+ else if (c.isSpace() && c != QChar::ParagraphSeparator)
+ input = Input::Space;
+ else
+ input = Input::Other;
+
+ switch (state) {
+ case 0:
+ switch (input) {
+ case Input::Upper:
+ state = 1;
+ break;
+ case Input::Lower:
+ state = 2;
+ break;
+ case Input::Underscore:
+ state = 3;
+ break;
+ case Input::Space:
+ state = 4;
+ break;
+ default:
+ moveCursor(cursor, edit, QTextCursor::Right, mode);
+ return moveCursor(cursor, edit, QTextCursor::WordLeft, mode);
+ }
+ break;
+ case 1:
+ switch (input) {
+ case Input::Upper:
+ break;
+ default:
+ return moveCursor(cursor, edit, QTextCursor::Right, mode);
+ return true;
+ }
+ break;
+ case 2:
+ switch (input) {
+ case Input::Upper:
+ return true;
+ case Input::Lower:
+ break;
+ default:
+ return moveCursor(cursor, edit, QTextCursor::Right, mode);
+ return true;
+ }
+ break;
+ case 3:
+ switch (input) {
+ case Input::Underscore:
+ break;
+ case Input::Upper:
+ state = 1;
+ break;
+ case Input::Lower:
+ state = 2;
+ break;
+ default:
+ moveCursor(cursor, edit, QTextCursor::Right, mode);
+ return true;
+ }
+ break;
+ case 4:
+ switch (input) {
+ case Input::Space:
+ break;
+ case Input::Upper:
+ state = 1;
+ break;
+ case Input::Lower:
+ state = 2;
+ break;
+ case Input::Underscore:
+ state = 3;
+ break;
+ default:
+ return moveCursor(cursor, edit, QTextCursor::Right, mode);
+ if (position(cursor, edit) == 0)
+ return true;
+ return moveCursor(cursor, edit, QTextCursor::WordLeft, mode);
+ }
+ }
+
+ if (!moveCursor(cursor, edit, QTextCursor::Left, mode))
+ return true;
+ }
+}
+
+template<typename C, typename E>
+bool camelCaseRight(C *cursor, E *edit, QTextCursor::MoveMode mark)
+{
+ int state = 0;
+
+ for (;;) {
+ QChar c = charUnderCursor(cursor, edit);
+ Input input = Input::Other;
+ if (c.isUpper())
+ input = Input::Upper;
+ else if (c.isLower() || c.isDigit())
+ input = Input::Lower;
+ else if (c == '_')
+ input = Input::Underscore;
+ else if (c.isSpace() && c != QChar::ParagraphSeparator)
+ input = Input::Space;
+ else
+ input = Input::Other;
+
+ switch (state) {
+ case 0:
+ switch (input) {
+ case Input::Upper:
+ state = 4;
+ break;
+ case Input::Lower:
+ state = 1;
+ break;
+ case Input::Underscore:
+ state = 6;
+ break;
+ default:
+ return moveCursor(cursor, edit, QTextCursor::WordRight, mark);
+ }
+ break;
+ case 1:
+ switch (input) {
+ case Input::Upper:
+ return true;
+ case Input::Lower:
+ break;
+ case Input::Underscore:
+ state = 6;
+ break;
+ case Input::Space:
+ state = 7;
+ break;
+ default:
+ return true;
+ }
+ break;
+ case 2:
+ switch (input) {
+ case Input::Upper:
+ break;
+ case Input::Lower:
+ moveCursor(cursor, edit, QTextCursor::Left, mark);
+ return true;
+ case Input::Underscore:
+ state = 6;
+ break;
+ case Input::Space:
+ state = 7;
+ break;
+ default:
+ return true;
+ }
+ break;
+ case 4:
+ switch (input) {
+ case Input::Upper:
+ state = 2;
+ break;
+ case Input::Lower:
+ state = 1;
+ break;
+ case Input::Underscore:
+ state = 6;
+ break;
+ case Input::Space:
+ state = 7;
+ break;
+ default:
+ return true;
+ }
+ break;
+ case 6:
+ switch (input) {
+ case Input::Underscore:
+ break;
+ case Input::Space:
+ state = 7;
+ break;
+ default:
+ return true;
+ }
+ break;
+ case 7:
+ switch (input) {
+ case Input::Space:
+ break;
+ default:
+ return true;
+ }
+ break;
+ }
+ if (!moveCursor(cursor, edit, QTextCursor::Right, mark))
+ return false;
+ }
+}
+
+bool CamelCaseCursor::left(QTextCursor *cursor, QPlainTextEdit *edit, QTextCursor::MoveMode mode)
+{
+ return camelCaseLeft(cursor, edit, mode);
+}
+
+bool CamelCaseCursor::left(QLineEdit *edit, QTextCursor::MoveMode mode)
+{
+ QTextCursor temp;
+ return camelCaseLeft(&temp, edit, mode);
+}
+
+bool CamelCaseCursor::right(QTextCursor *cursor, QPlainTextEdit *edit, QTextCursor::MoveMode mode)
+{
+ return camelCaseRight(cursor, edit, mode);
+}
+
+bool CamelCaseCursor::right(QLineEdit *edit, QTextCursor::MoveMode mode)
+{
+ QTextCursor temp;
+ return camelCaseRight(&temp, edit, mode);
+}
diff --git a/src/libs/utils/camelcasecursor.h b/src/libs/utils/camelcasecursor.h
new file mode 100644
index 0000000000..5967545737
--- /dev/null
+++ b/src/libs/utils/camelcasecursor.h
@@ -0,0 +1,45 @@
+/**************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2019 Andre Hartmann <aha_1980@gmx.de>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "utils_global.h"
+
+#include <QTextCursor>
+
+QT_BEGIN_NAMESPACE
+class QLineEdit;
+class QPlainTextEdit;
+QT_END_NAMESPACE
+
+class QTCREATOR_UTILS_EXPORT CamelCaseCursor
+{
+public:
+ static bool left(QTextCursor *cursor, QPlainTextEdit *edit, QTextCursor::MoveMode mode);
+ static bool left(QLineEdit *edit, QTextCursor::MoveMode mode);
+ static bool right(QTextCursor *cursor, QPlainTextEdit *edit, QTextCursor::MoveMode mode);
+ static bool right(QLineEdit *edit, QTextCursor::MoveMode mode);
+};
diff --git a/src/libs/utils/changeset.cpp b/src/libs/utils/changeset.cpp
index 7ee4339182..a7b27dcacd 100644
--- a/src/libs/utils/changeset.cpp
+++ b/src/libs/utils/changeset.cpp
@@ -53,11 +53,9 @@ static bool overlaps(int posA, int lengthA, int posB, int lengthB) {
}
}
-bool ChangeSet::hasOverlap(int pos, int length)
+bool ChangeSet::hasOverlap(int pos, int length) const
{
- QListIterator<EditOp> i(m_operationList);
- while (i.hasNext()) {
- const EditOp &cmd = i.next();
+ for (const EditOp &cmd : m_operationList) {
switch (cmd.type) {
case EditOp::Replace:
@@ -251,9 +249,7 @@ void ChangeSet::doReplace(const EditOp &op, QList<EditOp> *replaceList)
Q_ASSERT(op.type == EditOp::Replace);
{
- QMutableListIterator<EditOp> i(*replaceList);
- while (i.hasNext()) {
- EditOp &c = i.next();
+ for (EditOp &c : *replaceList) {
if (op.pos1 <= c.pos1)
c.pos1 += op.text.size();
if (op.pos1 < c.pos1)
diff --git a/src/libs/utils/changeset.h b/src/libs/utils/changeset.h
index 4b63cfb727..5cb484c9b6 100644
--- a/src/libs/utils/changeset.h
+++ b/src/libs/utils/changeset.h
@@ -105,7 +105,7 @@ private:
bool flip_helper(int pos1, int length1, int pos2, int length2);
bool copy_helper(int pos, int length, int to);
- bool hasOverlap(int pos, int length);
+ bool hasOverlap(int pos, int length) const;
QString textAt(int pos, int length);
void doReplace(const EditOp &replace, QList<EditOp> *replaceList);
diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp
index 335f9084c7..1e51550def 100644
--- a/src/libs/utils/consoleprocess.cpp
+++ b/src/libs/utils/consoleprocess.cpp
@@ -23,10 +23,47 @@
**
****************************************************************************/
-#include "consoleprocess_p.h"
+#include "consoleprocess.h"
+
+#include <utils/algorithm.h>
+#include <utils/environment.h>
+#include <utils/hostosinfo.h>
+#include <utils/qtcassert.h>
+#include <utils/qtcprocess.h>
+#include <utils/winutils.h>
+
+#include <QAbstractEventDispatcher>
+#include <QCoreApplication>
+#include <QCoreApplication>
+#include <QDir>
+#include <QFileInfo>
+#include <QLocalServer>
+#include <QLocalSocket>
+#include <QSettings>
+#include <QTemporaryFile>
+#include <QTimer>
+#include <QWinEventNotifier>
+
+#ifdef Q_OS_WIN
+
+# include <windows.h>
+# include <stdlib.h>
+# include <cstring>
+
+#else
+
+# include <sys/stat.h>
+# include <sys/types.h>
+# include <errno.h>
+# include <string.h>
+# include <unistd.h>
+
+#endif
namespace Utils {
+// TerminalCommand
+
TerminalCommand::TerminalCommand(const QString &command, const QString &openArgs, const QString &executeArgs)
: command(command)
, openArgs(openArgs)
@@ -34,12 +71,811 @@ TerminalCommand::TerminalCommand(const QString &command, const QString &openArgs
{
}
+// ConsoleProcessPrivate
+
+class ConsoleProcessPrivate
+{
+public:
+ ConsoleProcessPrivate() = default;
+
+ static QString m_defaultConsoleProcess;
+ ConsoleProcess::Mode m_mode = ConsoleProcess::Run;
+ QString m_workingDir;
+ Environment m_environment;
+ qint64 m_appPid = 0;
+ int m_appCode;
+ CommandLine m_commandLine;
+ QProcess::ExitStatus m_appStatus;
+ QLocalServer m_stubServer;
+ QLocalSocket *m_stubSocket = nullptr;
+ QTemporaryFile *m_tempFile = nullptr;
+ QProcess::ProcessError m_error = QProcess::UnknownError;
+ QString m_errorString;
+ bool m_abortOnMetaChars = true;
+ QSettings *m_settings = nullptr;
+
+ // Used on Unix only
+ QProcess m_process;
+ bool m_stubConnected = false;
+ QTimer *m_stubConnectTimer = nullptr;
+ QByteArray m_stubServerDir;
+ qint64 m_stubPid = 0;
+
+ // Used on Windows only
+ qint64 m_appMainThreadId = 0;
+
+#ifdef Q_OS_WIN
+ PROCESS_INFORMATION *m_pid = nullptr;
+ HANDLE m_hInferior = NULL;
+ QWinEventNotifier *inferiorFinishedNotifier = nullptr;
+ QWinEventNotifier *processFinishedNotifier = nullptr;
+#endif
+};
+
+
+// ConsoleProcess
+
+ConsoleProcess::ConsoleProcess(QObject *parent) :
+ QObject(parent), d(new ConsoleProcessPrivate)
+{
+ connect(&d->m_stubServer, &QLocalServer::newConnection,
+ this, &ConsoleProcess::stubConnectionAvailable);
+
+ d->m_process.setProcessChannelMode(QProcess::ForwardedChannels);
+}
+
ConsoleProcess::~ConsoleProcess()
{
stop();
delete d;
}
+void ConsoleProcess::setCommand(const CommandLine &command)
+{
+ d->m_commandLine = command;
+}
+
+void ConsoleProcess::setSettings(QSettings *settings)
+{
+ d->m_settings = settings;
+}
+
+Q_GLOBAL_STATIC_WITH_ARGS(const QVector<TerminalCommand>, knownTerminals, (
+{
+ {"x-terminal-emulator", "", "-e"},
+ {"xterm", "", "-e"},
+ {"aterm", "", "-e"},
+ {"Eterm", "", "-e"},
+ {"rxvt", "", "-e"},
+ {"urxvt", "", "-e"},
+ {"xfce4-terminal", "", "-x"},
+ {"konsole", "--separate", "-e"},
+ {"gnome-terminal", "", "--"}
+}));
+
+TerminalCommand ConsoleProcess::defaultTerminalEmulator()
+{
+ static TerminalCommand defaultTerm;
+
+ if (defaultTerm.command.isEmpty()) {
+
+ if (HostOsInfo::isMacHost()) {
+ const QString termCmd = QCoreApplication::applicationDirPath()
+ + "/../Resources/scripts/openTerminal.py";
+ if (QFileInfo::exists(termCmd))
+ defaultTerm = {termCmd, "", ""};
+ else
+ defaultTerm = {"/usr/X11/bin/xterm", "", "-e"};
+
+ } else if (HostOsInfo::isAnyUnixHost()) {
+ defaultTerm = {"xterm", "", "-e"};
+ const Environment env = Environment::systemEnvironment();
+ for (const TerminalCommand &term : *knownTerminals) {
+ const QString result = env.searchInPath(term.command).toString();
+ if (!result.isEmpty()) {
+ defaultTerm = {result, term.openArgs, term.executeArgs};
+ break;
+ }
+ }
+ }
+ }
+
+ return defaultTerm;
+}
+
+QVector<TerminalCommand> ConsoleProcess::availableTerminalEmulators()
+{
+ QVector<TerminalCommand> result;
+
+ if (HostOsInfo::isAnyUnixHost()) {
+ const Environment env = Environment::systemEnvironment();
+ for (const TerminalCommand &term : *knownTerminals) {
+ const QString command = env.searchInPath(term.command).toString();
+ if (!command.isEmpty())
+ result.push_back({command, term.openArgs, term.executeArgs});
+ }
+ // sort and put default terminal on top
+ const TerminalCommand defaultTerm = defaultTerminalEmulator();
+ result.removeAll(defaultTerm);
+ sort(result);
+ result.prepend(defaultTerm);
+ }
+
+ return result;
+}
+
+const char kTerminalVersion[] = "4.8";
+const char kTerminalVersionKey[] = "General/Terminal/SettingsVersion";
+const char kTerminalCommandKey[] = "General/Terminal/Command";
+const char kTerminalOpenOptionsKey[] = "General/Terminal/OpenOptions";
+const char kTerminalExecuteOptionsKey[] = "General/Terminal/ExecuteOptions";
+
+TerminalCommand ConsoleProcess::terminalEmulator(const QSettings *settings)
+{
+ if (settings && HostOsInfo::isAnyUnixHost()) {
+ if (settings->value(kTerminalVersionKey).toString() == kTerminalVersion) {
+ if (settings->contains(kTerminalCommandKey))
+ return {settings->value(kTerminalCommandKey).toString(),
+ settings->value(kTerminalOpenOptionsKey).toString(),
+ settings->value(kTerminalExecuteOptionsKey).toString()};
+ } else {
+ // TODO remove reading of old settings some time after 4.8
+ const QString value = settings->value("General/TerminalEmulator").toString().trimmed();
+ if (!value.isEmpty()) {
+ // split off command and options
+ const QStringList splitCommand = QtcProcess::splitArgs(value);
+ if (QTC_GUARD(!splitCommand.isEmpty())) {
+ const QString command = splitCommand.first();
+ const QStringList quotedArgs = Utils::transform(splitCommand.mid(1),
+ &QtcProcess::quoteArgUnix);
+ const QString options = quotedArgs.join(' ');
+ return {command, "", options};
+ }
+ }
+ }
+ }
+
+ return defaultTerminalEmulator();
+}
+
+void ConsoleProcess::setTerminalEmulator(QSettings *settings, const TerminalCommand &term)
+{
+ if (HostOsInfo::isAnyUnixHost()) {
+ settings->setValue(kTerminalVersionKey, kTerminalVersion);
+ if (term == defaultTerminalEmulator()) {
+ settings->remove(kTerminalCommandKey);
+ settings->remove(kTerminalOpenOptionsKey);
+ settings->remove(kTerminalExecuteOptionsKey);
+ } else {
+ settings->setValue(kTerminalCommandKey, term.command);
+ settings->setValue(kTerminalOpenOptionsKey, term.openArgs);
+ settings->setValue(kTerminalExecuteOptionsKey, term.executeArgs);
+ }
+ }
+}
+
+static QString quoteWinCommand(const QString &program)
+{
+ const QChar doubleQuote = QLatin1Char('"');
+
+ // add the program as the first arg ... it works better
+ QString programName = program;
+ programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
+ if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
+ && programName.contains(QLatin1Char(' '))) {
+ programName.prepend(doubleQuote);
+ programName.append(doubleQuote);
+ }
+ return programName;
+}
+
+static QString quoteWinArgument(const QString &arg)
+{
+ if (!arg.length())
+ return QString::fromLatin1("\"\"");
+
+ QString ret(arg);
+ // Quotes are escaped and their preceding backslashes are doubled.
+ ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
+ if (ret.contains(QRegExp(QLatin1String("\\s")))) {
+ // The argument must not end with a \ since this would be interpreted
+ // as escaping the quote -- rather put the \ behind the quote: e.g.
+ // rather use "foo"\ than "foo\"
+ int i = ret.length();
+ while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
+ --i;
+ ret.insert(i, QLatin1Char('"'));
+ ret.prepend(QLatin1Char('"'));
+ }
+ return ret;
+}
+
+// Quote a Windows command line correctly for the "CreateProcess" API
+QString createWinCommandline(const QString &program, const QStringList &args)
+{
+ QString programName = quoteWinCommand(program);
+ foreach (const QString &arg, args) {
+ programName += QLatin1Char(' ');
+ programName += quoteWinArgument(arg);
+ }
+ return programName;
+}
+
+QString createWinCommandline(const QString &program, const QString &args)
+{
+ QString programName = quoteWinCommand(program);
+ if (!args.isEmpty()) {
+ programName += QLatin1Char(' ');
+ programName += args;
+ }
+ return programName;
+}
+
+
+bool ConsoleProcess::startTerminalEmulator(QSettings *settings, const QString &workingDir,
+ const Environment &env)
+{
+#ifdef Q_OS_WIN
+ Q_UNUSED(settings)
+
+ STARTUPINFO si;
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+
+ PROCESS_INFORMATION pinfo;
+ ZeroMemory(&pinfo, sizeof(pinfo));
+
+ QString cmdLine = createWinCommandline(
+ QString::fromLocal8Bit(qgetenv("COMSPEC")), QString());
+ // cmdLine is assumed to be detached -
+ // https://blogs.msdn.microsoft.com/oldnewthing/20090601-00/?p=18083
+
+ QString totalEnvironment = env.toStringList().join(QChar(QChar::Null)) + QChar(QChar::Null);
+ LPVOID envPtr = (env != Environment::systemEnvironment())
+ ? (WCHAR *)(totalEnvironment.utf16()) : nullptr;
+
+ bool success = CreateProcessW(0, (WCHAR *)cmdLine.utf16(),
+ 0, 0, FALSE, CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT,
+ envPtr, workingDir.isEmpty() ? 0 : (WCHAR *)workingDir.utf16(),
+ &si, &pinfo);
+
+ if (success) {
+ CloseHandle(pinfo.hThread);
+ CloseHandle(pinfo.hProcess);
+ }
+
+ return success;
+#else
+ const TerminalCommand term = terminalEmulator(settings);
+ QProcess process;
+ process.setProgram(term.command);
+ process.setArguments(QtcProcess::splitArgs(term.openArgs));
+ process.setProcessEnvironment(env.toProcessEnvironment());
+ process.setWorkingDirectory(workingDir);
+
+ return process.startDetached();
+#endif
+}
+
+void ConsoleProcess::setAbortOnMetaChars(bool abort)
+{
+ d->m_abortOnMetaChars = abort;
+}
+
+qint64 ConsoleProcess::applicationMainThreadID() const
+{
+ if (HostOsInfo::isWindowsHost())
+ return d->m_appMainThreadId;
+ return -1;
+}
+
+bool ConsoleProcess::start()
+{
+ if (isRunning())
+ return false;
+
+ d->m_errorString.clear();
+ d->m_error = QProcess::UnknownError;
+
+#ifdef Q_OS_WIN
+
+ QString pcmd;
+ QString pargs;
+ if (d->m_mode != Run) { // The debugger engines already pre-process the arguments.
+ pcmd = d->m_commandLine.executable().toString();
+ pargs = d->m_commandLine.arguments();
+ } else {
+ QtcProcess::Arguments outArgs;
+ QtcProcess::prepareCommand(d->m_commandLine.executable().toString(),
+ d->m_commandLine.arguments(),
+ &pcmd, &outArgs, OsTypeWindows,
+ &d->m_environment, &d->m_workingDir);
+ pargs = outArgs.toWindowsArgs();
+ }
+
+ const QString err = stubServerListen();
+ if (!err.isEmpty()) {
+ emitError(QProcess::FailedToStart, msgCommChannelFailed(err));
+ return false;
+ }
+
+ QStringList env = d->m_environment.toStringList();
+ if (!env.isEmpty()) {
+ d->m_tempFile = new QTemporaryFile();
+ if (!d->m_tempFile->open()) {
+ stubServerShutdown();
+ emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ return false;
+ }
+ QTextStream out(d->m_tempFile);
+ out.setCodec("UTF-16LE");
+ out.setGenerateByteOrderMark(false);
+
+ // Add PATH and SystemRoot environment variables in case they are missing
+ const QStringList fixedEnvironment = [env] {
+ QStringList envStrings = env;
+ // add PATH if necessary (for DLL loading)
+ if (envStrings.filter(QRegExp(QLatin1String("^PATH="),Qt::CaseInsensitive)).isEmpty()) {
+ QByteArray path = qgetenv("PATH");
+ if (!path.isEmpty())
+ envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
+ }
+ // add systemroot if needed
+ if (envStrings.filter(QRegExp(QLatin1String("^SystemRoot="),Qt::CaseInsensitive)).isEmpty()) {
+ QByteArray systemRoot = qgetenv("SystemRoot");
+ if (!systemRoot.isEmpty())
+ envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));
+ }
+ return envStrings;
+ }();
+
+ for (const QString &var : fixedEnvironment)
+ out << var << QChar(0);
+ out << QChar(0);
+ out.flush();
+ if (out.status() != QTextStream::Ok) {
+ stubServerShutdown();
+ emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ return false;
+ }
+ }
+
+ STARTUPINFO si;
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+
+ d->m_pid = new PROCESS_INFORMATION;
+ ZeroMemory(d->m_pid, sizeof(PROCESS_INFORMATION));
+
+ QString workDir = QDir::toNativeSeparators(workingDirectory());
+ if (!workDir.isEmpty() && !workDir.endsWith(QLatin1Char('\\')))
+ workDir.append(QLatin1Char('\\'));
+
+ QStringList stubArgs;
+ stubArgs << modeOption(d->m_mode)
+ << d->m_stubServer.fullServerName()
+ << workDir
+ << (d->m_tempFile ? d->m_tempFile->fileName() : QString())
+ << createWinCommandline(pcmd, pargs)
+ << msgPromptToClose();
+
+ const QString cmdLine = createWinCommandline(
+ QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub.exe"), stubArgs);
+
+ bool success = CreateProcessW(0, (WCHAR*)cmdLine.utf16(),
+ 0, 0, FALSE, CREATE_NEW_CONSOLE,
+ 0, 0,
+ &si, d->m_pid);
+
+ if (!success) {
+ delete d->m_pid;
+ d->m_pid = nullptr;
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ stubServerShutdown();
+ emitError(QProcess::FailedToStart, tr("The process \"%1\" could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError())));
+ return false;
+ }
+
+ d->processFinishedNotifier = new QWinEventNotifier(d->m_pid->hProcess, this);
+ connect(d->processFinishedNotifier, &QWinEventNotifier::activated,
+ this, &ConsoleProcess::stubExited);
+
+#else
+
+ QtcProcess::SplitError perr;
+ QtcProcess::Arguments pargs = QtcProcess::prepareArgs(d->m_commandLine.arguments(),
+ &perr,
+ HostOsInfo::hostOs(),
+ &d->m_environment,
+ &d->m_workingDir,
+ d->m_abortOnMetaChars);
+
+ QString pcmd;
+ if (perr == QtcProcess::SplitOk) {
+ pcmd = d->m_commandLine.executable().toString();
+ } else {
+ if (perr != QtcProcess::FoundMeta) {
+ emitError(QProcess::FailedToStart, tr("Quoting error in command."));
+ return false;
+ }
+ if (d->m_mode == Debug) {
+ // FIXME: QTCREATORBUG-2809
+ emitError(QProcess::FailedToStart, tr("Debugging complex shell commands in a terminal"
+ " is currently not supported."));
+ return false;
+ }
+ pcmd = QLatin1String("/bin/sh");
+ pargs = QtcProcess::Arguments::createUnixArgs(
+ {"-c", (QtcProcess::quoteArg(d->m_commandLine.executable().toString())
+ + ' ' + d->m_commandLine.arguments())});
+ }
+
+ QtcProcess::SplitError qerr;
+ const TerminalCommand terminal = terminalEmulator(d->m_settings);
+ const QtcProcess::Arguments terminalArgs = QtcProcess::prepareArgs(terminal.executeArgs,
+ &qerr,
+ HostOsInfo::hostOs(),
+ &d->m_environment,
+ &d->m_workingDir);
+ if (qerr != QtcProcess::SplitOk) {
+ emitError(QProcess::FailedToStart, qerr == QtcProcess::BadQuoting
+ ? tr("Quoting error in terminal command.")
+ : tr("Terminal command may not be a shell command."));
+ return false;
+ }
+
+ const QString err = stubServerListen();
+ if (!err.isEmpty()) {
+ emitError(QProcess::FailedToStart, msgCommChannelFailed(err));
+ return false;
+ }
+
+ d->m_environment.unset(QLatin1String("TERM"));
+ const QStringList env = d->m_environment.toStringList();
+ if (!env.isEmpty()) {
+ d->m_tempFile = new QTemporaryFile();
+ if (!d->m_tempFile->open()) {
+ stubServerShutdown();
+ emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ return false;
+ }
+ QByteArray contents;
+ for (const QString &var : env) {
+ QByteArray l8b = var.toLocal8Bit();
+ contents.append(l8b.constData(), l8b.size() + 1);
+ }
+ if (d->m_tempFile->write(contents) != contents.size() || !d->m_tempFile->flush()) {
+ stubServerShutdown();
+ emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ return false;
+ }
+ }
+
+ const QString stubPath = QCoreApplication::applicationDirPath()
+ + QLatin1String("/" QTC_REL_TOOLS_PATH "/qtcreator_process_stub");
+ const QStringList allArgs = terminalArgs.toUnixArgs()
+ << stubPath
+ << modeOption(d->m_mode)
+ << d->m_stubServer.fullServerName()
+ << msgPromptToClose()
+ << workingDirectory()
+ << (d->m_tempFile ? d->m_tempFile->fileName() : QString())
+ << QString::number(getpid())
+ << pcmd
+ << pargs.toUnixArgs();
+
+ d->m_process.start(terminal.command, allArgs);
+ if (!d->m_process.waitForStarted()) {
+ stubServerShutdown();
+ emitError(QProcess::UnknownError, tr("Cannot start the terminal emulator \"%1\", change the setting in the "
+ "Environment options.").arg(terminal.command));
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ return false;
+ }
+ d->m_stubConnectTimer = new QTimer(this);
+ connect(d->m_stubConnectTimer, &QTimer::timeout, this, &ConsoleProcess::stop);
+ d->m_stubConnectTimer->setSingleShot(true);
+ d->m_stubConnectTimer->start(10000);
+
+#endif
+
+ return true;
+}
+
+void ConsoleProcess::killProcess()
+{
+#ifdef Q_OS_WIN
+ if (d->m_hInferior != NULL) {
+ TerminateProcess(d->m_hInferior, (unsigned)-1);
+ cleanupInferior();
+ }
+#else
+ if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
+ d->m_stubSocket->write("k", 1);
+ d->m_stubSocket->flush();
+ }
+ d->m_appPid = 0;
+#endif
+}
+
+void ConsoleProcess::killStub()
+{
+#ifdef Q_OS_WIN
+ if (d->m_pid) {
+ TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
+ WaitForSingleObject(d->m_pid->hProcess, INFINITE);
+ cleanupStub();
+ }
+#else
+ if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
+ d->m_stubSocket->write("s", 1);
+ d->m_stubSocket->flush();
+ }
+ stubServerShutdown();
+ d->m_stubPid = 0;
+#endif
+}
+
+void ConsoleProcess::stop()
+{
+ killProcess();
+ killStub();
+ if (isRunning() && HostOsInfo::isAnyUnixHost()) {
+ d->m_process.terminate();
+ if (!d->m_process.waitForFinished(1000) && d->m_process.state() == QProcess::Running) {
+ d->m_process.kill();
+ d->m_process.waitForFinished();
+ }
+ }
+}
+
+bool ConsoleProcess::isRunning() const
+{
+#ifdef Q_OS_WIN
+ return d->m_pid != nullptr;
+#else
+ return d->m_process.state() != QProcess::NotRunning
+ || (d->m_stubSocket && d->m_stubSocket->isOpen());
+#endif
+}
+
+QString ConsoleProcess::stubServerListen()
+{
+#ifdef Q_OS_WIN
+ if (d->m_stubServer.listen(QString::fromLatin1("creator-%1-%2")
+ .arg(QCoreApplication::applicationPid())
+ .arg(rand())))
+ return QString();
+ return d->m_stubServer.errorString();
+#else
+ // We need to put the socket in a private directory, as some systems simply do not
+ // check the file permissions of sockets.
+ QString stubFifoDir;
+ while (true) {
+ {
+ QTemporaryFile tf;
+ if (!tf.open())
+ return msgCannotCreateTempFile(tf.errorString());
+ stubFifoDir = tf.fileName();
+ }
+ // By now the temp file was deleted again
+ d->m_stubServerDir = QFile::encodeName(stubFifoDir);
+ if (!::mkdir(d->m_stubServerDir.constData(), 0700))
+ break;
+ if (errno != EEXIST)
+ return msgCannotCreateTempDir(stubFifoDir, QString::fromLocal8Bit(strerror(errno)));
+ }
+ const QString stubServer = stubFifoDir + QLatin1String("/stub-socket");
+ if (!d->m_stubServer.listen(stubServer)) {
+ ::rmdir(d->m_stubServerDir.constData());
+ return tr("Cannot create socket \"%1\": %2").arg(stubServer, d->m_stubServer.errorString());
+ }
+ return QString();
+#endif
+}
+
+void ConsoleProcess::stubServerShutdown()
+{
+#ifdef Q_OS_WIN
+ delete d->m_stubSocket;
+ d->m_stubSocket = nullptr;
+ if (d->m_stubServer.isListening())
+ d->m_stubServer.close();
+#else
+ if (d->m_stubSocket) {
+ readStubOutput(); // we could get the shutdown signal before emptying the buffer
+ d->m_stubSocket->disconnect(); // avoid getting queued readyRead signals
+ d->m_stubSocket->deleteLater(); // we might be called from the disconnected signal of m_stubSocket
+ }
+ d->m_stubSocket = nullptr;
+ if (d->m_stubServer.isListening()) {
+ d->m_stubServer.close();
+ ::rmdir(d->m_stubServerDir.constData());
+ }
+#endif
+}
+
+void ConsoleProcess::stubConnectionAvailable()
+{
+ d->m_stubConnected = true;
+ emit stubStarted();
+
+ if (d->m_stubConnectTimer) {
+ delete d->m_stubConnectTimer;
+ d->m_stubConnectTimer = nullptr;
+ }
+
+ d->m_stubSocket = d->m_stubServer.nextPendingConnection();
+ connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput);
+
+ if (HostOsInfo::isAnyUnixHost())
+ connect(d->m_stubSocket, &QLocalSocket::disconnected, this, &ConsoleProcess::stubExited);
+}
+
+static QString errorMsg(int code)
+{
+ return QString::fromLocal8Bit(strerror(code));
+}
+
+void ConsoleProcess::readStubOutput()
+{
+ while (d->m_stubSocket->canReadLine()) {
+ QByteArray out = d->m_stubSocket->readLine();
+#ifdef Q_OS_WIN
+ out.chop(2); // \r\n
+ if (out.startsWith("err:chdir ")) {
+ emitError(QProcess::FailedToStart, msgCannotChangeToWorkDir(workingDirectory(), winErrorMessage(out.mid(10).toInt())));
+ } else if (out.startsWith("err:exec ")) {
+ emitError(QProcess::FailedToStart, msgCannotExecute(d->m_commandLine.executable().toUserOutput(), winErrorMessage(out.mid(9).toInt())));
+ } else if (out.startsWith("thread ")) { // Windows only
+ d->m_appMainThreadId = out.mid(7).toLongLong();
+ } else if (out.startsWith("pid ")) {
+ // Will not need it any more
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ d->m_appPid = out.mid(4).toLongLong();
+
+ d->m_hInferior = OpenProcess(
+ SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
+ FALSE, d->m_appPid);
+ if (d->m_hInferior == NULL) {
+ emitError(QProcess::FailedToStart, tr("Cannot obtain a handle to the inferior: %1")
+ .arg(winErrorMessage(GetLastError())));
+ // Uhm, and now what?
+ continue;
+ }
+ d->inferiorFinishedNotifier = new QWinEventNotifier(d->m_hInferior, this);
+ connect(d->inferiorFinishedNotifier, &QWinEventNotifier::activated, this, [this] {
+ DWORD chldStatus;
+
+ if (!GetExitCodeProcess(d->m_hInferior, &chldStatus))
+ emitError(QProcess::UnknownError, tr("Cannot obtain exit status from inferior: %1")
+ .arg(winErrorMessage(GetLastError())));
+ cleanupInferior();
+ d->m_appStatus = QProcess::NormalExit;
+ d->m_appCode = chldStatus;
+ emit processStopped(d->m_appCode, d->m_appStatus);
+ });
+
+ emit processStarted();
+ } else {
+ emitError(QProcess::UnknownError, msgUnexpectedOutput(out));
+ TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
+ break;
+ }
+#else
+ out.chop(1); // \n
+ if (out.startsWith("err:chdir ")) {
+ emitError(QProcess::FailedToStart, msgCannotChangeToWorkDir(workingDirectory(), errorMsg(out.mid(10).toInt())));
+ } else if (out.startsWith("err:exec ")) {
+ emitError(QProcess::FailedToStart, msgCannotExecute(d->m_commandLine.executable().toString(), errorMsg(out.mid(9).toInt())));
+ } else if (out.startsWith("spid ")) {
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+
+ d->m_stubPid = out.mid(4).toInt();
+ } else if (out.startsWith("pid ")) {
+ d->m_appPid = out.mid(4).toInt();
+ emit processStarted();
+ } else if (out.startsWith("exit ")) {
+ d->m_appStatus = QProcess::NormalExit;
+ d->m_appCode = out.mid(5).toInt();
+ d->m_appPid = 0;
+ emit processStopped(d->m_appCode, d->m_appStatus);
+ } else if (out.startsWith("crash ")) {
+ d->m_appStatus = QProcess::CrashExit;
+ d->m_appCode = out.mid(6).toInt();
+ d->m_appPid = 0;
+ emit processStopped(d->m_appCode, d->m_appStatus);
+ } else {
+ emitError(QProcess::UnknownError, msgUnexpectedOutput(out));
+ d->m_stubPid = 0;
+ d->m_process.terminate();
+ break;
+ }
+#endif
+ } // while
+}
+
+void ConsoleProcess::stubExited()
+{
+ // The stub exit might get noticed before we read the pid for the kill on Windows
+ // or the error status elsewhere.
+ if (d->m_stubSocket && d->m_stubSocket->state() == QLocalSocket::ConnectedState)
+ d->m_stubSocket->waitForDisconnected();
+
+#ifdef Q_OS_WIN
+ cleanupStub();
+ if (d->m_hInferior != NULL) {
+ TerminateProcess(d->m_hInferior, (unsigned)-1);
+ cleanupInferior();
+ d->m_appStatus = QProcess::CrashExit;
+ d->m_appCode = -1;
+ emit processStopped(d->m_appCode, d->m_appStatus);
+ }
+#else
+ stubServerShutdown();
+ d->m_stubPid = 0;
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+ if (d->m_appPid) {
+ d->m_appStatus = QProcess::CrashExit;
+ d->m_appCode = -1;
+ d->m_appPid = 0;
+ emit processStopped(d->m_appCode, d->m_appStatus); // Maybe it actually did not, but keep state consistent
+ }
+#endif
+ emit stubStopped();
+}
+
+void ConsoleProcess::detachStub()
+{
+ if (HostOsInfo::isAnyUnixHost()) {
+ if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
+ d->m_stubSocket->write("d", 1);
+ d->m_stubSocket->flush();
+ }
+ stubServerShutdown();
+ d->m_stubPid = 0;
+ }
+}
+
+void ConsoleProcess::cleanupInferior()
+{
+#ifdef Q_OS_WIN
+ delete d->inferiorFinishedNotifier;
+ d->inferiorFinishedNotifier = nullptr;
+ CloseHandle(d->m_hInferior);
+ d->m_hInferior = NULL;
+ d->m_appPid = 0;
+#endif
+}
+
+void ConsoleProcess::cleanupStub()
+{
+#ifdef Q_OS_WIN
+ stubServerShutdown();
+ delete d->processFinishedNotifier;
+ d->processFinishedNotifier = nullptr;
+ CloseHandle(d->m_pid->hThread);
+ CloseHandle(d->m_pid->hProcess);
+ delete d->m_pid;
+ d->m_pid = nullptr;
+ delete d->m_tempFile;
+ d->m_tempFile = nullptr;
+#endif
+}
+
void ConsoleProcess::setMode(Mode m)
{
d->m_mode = m;
@@ -174,4 +1010,4 @@ bool TerminalCommand::operator<(const TerminalCommand &other) const
return command < other.command;
}
-}
+} // Utils
diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h
index 3dec9838c3..4e6e4f12b6 100644
--- a/src/libs/utils/consoleprocess.h
+++ b/src/libs/utils/consoleprocess.h
@@ -35,8 +35,9 @@ class QSettings;
QT_END_NAMESPACE
namespace Utils {
+
class Environment;
-struct ConsoleProcessPrivate;
+class CommandLine;
class QTCREATOR_UTILS_EXPORT TerminalCommand
{
@@ -58,9 +59,13 @@ class QTCREATOR_UTILS_EXPORT ConsoleProcess : public QObject
public:
enum Mode { Run, Debug, Suspend };
- ConsoleProcess(QObject *parent = nullptr);
+
+ explicit ConsoleProcess(QObject *parent = nullptr);
~ConsoleProcess() override;
+ void setCommand(const Utils::CommandLine &command);
+ void setAbortOnMetaChars(bool abort);
+
void setWorkingDirectory(const QString &dir);
QString workingDirectory() const;
@@ -70,10 +75,7 @@ public:
QProcess::ProcessError error() const;
QString errorString() const;
- enum class MetaCharMode { Abort, Ignore };
- bool start(const QString &program, const QString &args,
- MetaCharMode metaCharMode = MetaCharMode::Abort);
-public slots:
+ bool start();
void stop();
public:
@@ -87,36 +89,17 @@ public:
void killStub();
qint64 applicationMainThreadID() const;
-#ifndef Q_OS_WIN
void detachStub();
-#endif
int exitCode() const;
QProcess::ExitStatus exitStatus() const;
-#ifdef Q_OS_WIN
- // Add PATH and SystemRoot environment variables in case they are missing
- static QStringList fixWinEnvironment(const QStringList &env);
- // Quote a Windows command line correctly for the "CreateProcess" API
- static QString createWinCommandline(const QString &program, const QStringList &args);
- static QString createWinCommandline(const QString &program, const QString &args);
-#endif
-
-#ifndef Q_OS_WIN
- void setSettings(QSettings *settings);
+ void setSettings(QSettings *);
static TerminalCommand defaultTerminalEmulator();
static QVector<TerminalCommand> availableTerminalEmulators();
static TerminalCommand terminalEmulator(const QSettings *settings);
static void setTerminalEmulator(QSettings *settings, const TerminalCommand &term);
-#else
- void setSettings(QSettings *) {}
-
- static TerminalCommand defaultTerminalEmulator() { return TerminalCommand(); }
- static QVector<TerminalCommand> availableTerminalEmulators() { return {}; }
- static TerminalCommand terminalEmulator(const QSettings *) { return TerminalCommand(); }
- static void setTerminalEmulator(QSettings *, const TerminalCommand &) {}
-#endif
static bool startTerminalEmulator(QSettings *settings, const QString &workingDir,
const Utils::Environment &env);
@@ -124,6 +107,7 @@ public:
signals:
void error(QProcess::ProcessError error);
void processError(const QString &errorString);
+
// These reflect the state of the actual client process
void processStarted();
void processStopped(int, QProcess::ExitStatus);
@@ -136,9 +120,6 @@ private:
void stubConnectionAvailable();
void readStubOutput();
void stubExited();
-#ifdef Q_OS_WIN
- void inferiorExited();
-#endif
static QString modeOption(Mode m);
static QString msgCommChannelFailed(const QString &error);
@@ -153,14 +134,12 @@ private:
void emitError(QProcess::ProcessError err, const QString &errorString);
QString stubServerListen();
void stubServerShutdown();
-#ifdef Q_OS_WIN
void cleanupStub();
void cleanupInferior();
-#endif
- ConsoleProcessPrivate *d;
+ class ConsoleProcessPrivate *d;
};
-} //namespace Utils
+} // Utils
Q_DECLARE_METATYPE(Utils::TerminalCommand)
diff --git a/src/libs/utils/consoleprocess_p.h b/src/libs/utils/consoleprocess_p.h
deleted file mode 100644
index 5d8d193493..0000000000
--- a/src/libs/utils/consoleprocess_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "consoleprocess.h"
-#include "environment.h"
-
-#include <QTemporaryFile>
-
-#include <QLocalSocket>
-#include <QLocalServer>
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-QT_END_NAMESPACE
-
-#ifdef Q_OS_WIN
-# include <QWinEventNotifier>
-# include <windows.h>
-#endif
-
-namespace Utils {
-
-struct ConsoleProcessPrivate {
- ConsoleProcessPrivate();
-
- static QString m_defaultConsoleProcess;
- ConsoleProcess::Mode m_mode = ConsoleProcess::Run;
- QString m_workingDir;
- Environment m_environment;
- qint64 m_appPid = 0;
- int m_appCode;
- QString m_executable;
- QProcess::ExitStatus m_appStatus;
- QLocalServer m_stubServer;
- QLocalSocket *m_stubSocket = nullptr;
- QTemporaryFile *m_tempFile = nullptr;
- QProcess::ProcessError m_error = QProcess::UnknownError;
- QString m_errorString;
-
-#ifdef Q_OS_UNIX
- QProcess m_process;
- QByteArray m_stubServerDir;
- QSettings *m_settings = nullptr;
- bool m_stubConnected = false;
- qint64 m_stubPid = 0;
- QTimer *m_stubConnectTimer = nullptr;
-#else
- qint64 m_appMainThreadId = 0;
- PROCESS_INFORMATION *m_pid = nullptr;
- HANDLE m_hInferior = NULL;
- QWinEventNotifier *inferiorFinishedNotifier = nullptr;
- QWinEventNotifier *processFinishedNotifier = nullptr;
-#endif
-};
-
-} //namespace Utils
diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp
deleted file mode 100644
index 43afffa0a2..0000000000
--- a/src/libs/utils/consoleprocess_unix.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "consoleprocess_p.h"
-
-#include "qtcprocess.h"
-
-#include <utils/algorithm.h>
-#include <utils/hostosinfo.h>
-#include <utils/qtcassert.h>
-
-#include <QCoreApplication>
-#include <QFileInfo>
-#include <QSettings>
-#include <QTimer>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-namespace Utils {
-
-ConsoleProcessPrivate::ConsoleProcessPrivate() = default;
-
-ConsoleProcess::ConsoleProcess(QObject *parent) :
- QObject(parent), d(new ConsoleProcessPrivate)
-{
- connect(&d->m_stubServer, &QLocalServer::newConnection,
- this, &ConsoleProcess::stubConnectionAvailable);
-
- d->m_process.setProcessChannelMode(QProcess::ForwardedChannels);
-}
-
-qint64 ConsoleProcess::applicationMainThreadID() const
-{
- return -1;
-}
-
-void ConsoleProcess::setSettings(QSettings *settings)
-{
- d->m_settings = settings;
-}
-
-bool ConsoleProcess::start(const QString &program, const QString &args, MetaCharMode metaCharMode)
-{
- if (isRunning())
- return false;
-
- d->m_errorString.clear();
- d->m_error = QProcess::UnknownError;
-
- QtcProcess::SplitError perr;
- QtcProcess::Arguments pargs = QtcProcess::prepareArgs(args, &perr, HostOsInfo::hostOs(),
- &d->m_environment, &d->m_workingDir,
- metaCharMode == MetaCharMode::Abort);
- QString pcmd;
- if (perr == QtcProcess::SplitOk) {
- pcmd = program;
- } else {
- if (perr != QtcProcess::FoundMeta) {
- emitError(QProcess::FailedToStart, tr("Quoting error in command."));
- return false;
- }
- if (d->m_mode == Debug) {
- // FIXME: QTCREATORBUG-2809
- emitError(QProcess::FailedToStart, tr("Debugging complex shell commands in a terminal"
- " is currently not supported."));
- return false;
- }
- pcmd = QLatin1String("/bin/sh");
- pargs = QtcProcess::Arguments::createUnixArgs(
- QStringList({"-c", (QtcProcess::quoteArg(program) + ' ' + args)}));
- }
-
- QtcProcess::SplitError qerr;
- const TerminalCommand terminal = terminalEmulator(d->m_settings);
- const QtcProcess::Arguments terminalArgs = QtcProcess::prepareArgs(terminal.executeArgs,
- &qerr,
- HostOsInfo::hostOs(),
- &d->m_environment,
- &d->m_workingDir);
- if (qerr != QtcProcess::SplitOk) {
- emitError(QProcess::FailedToStart, qerr == QtcProcess::BadQuoting
- ? tr("Quoting error in terminal command.")
- : tr("Terminal command may not be a shell command."));
- return false;
- }
-
- const QString err = stubServerListen();
- if (!err.isEmpty()) {
- emitError(QProcess::FailedToStart, msgCommChannelFailed(err));
- return false;
- }
-
- d->m_environment.unset(QLatin1String("TERM"));
- QStringList env = d->m_environment.toStringList();
- if (!env.isEmpty()) {
- d->m_tempFile = new QTemporaryFile();
- if (!d->m_tempFile->open()) {
- stubServerShutdown();
- emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- return false;
- }
- QByteArray contents;
- foreach (const QString &var, env) {
- QByteArray l8b = var.toLocal8Bit();
- contents.append(l8b.constData(), l8b.size() + 1);
- }
- if (d->m_tempFile->write(contents) != contents.size() || !d->m_tempFile->flush()) {
- stubServerShutdown();
- emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- return false;
- }
- }
-
- const QString stubPath = QCoreApplication::applicationDirPath()
- + QLatin1String("/" QTC_REL_TOOLS_PATH "/qtcreator_process_stub");
- const QStringList allArgs = terminalArgs.toUnixArgs()
- << stubPath
- << modeOption(d->m_mode)
- << d->m_stubServer.fullServerName()
- << msgPromptToClose()
- << workingDirectory()
- << (d->m_tempFile ? d->m_tempFile->fileName() : QString())
- << QString::number(getpid())
- << pcmd
- << pargs.toUnixArgs();
-
- d->m_process.start(terminal.command, allArgs);
- if (!d->m_process.waitForStarted()) {
- stubServerShutdown();
- emitError(QProcess::UnknownError, tr("Cannot start the terminal emulator \"%1\", change the setting in the "
- "Environment options.").arg(terminal.command));
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- return false;
- }
- d->m_stubConnectTimer = new QTimer(this);
- connect(d->m_stubConnectTimer, &QTimer::timeout, this, &ConsoleProcess::stop);
- d->m_stubConnectTimer->setSingleShot(true);
- d->m_stubConnectTimer->start(10000);
- d->m_executable = program;
- return true;
-}
-
-void ConsoleProcess::killProcess()
-{
- if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
- d->m_stubSocket->write("k", 1);
- d->m_stubSocket->flush();
- }
- d->m_appPid = 0;
-}
-
-void ConsoleProcess::killStub()
-{
- if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
- d->m_stubSocket->write("s", 1);
- d->m_stubSocket->flush();
- }
- stubServerShutdown();
- d->m_stubPid = 0;
-}
-
-void ConsoleProcess::detachStub()
-{
- if (d->m_stubSocket && d->m_stubSocket->isWritable()) {
- d->m_stubSocket->write("d", 1);
- d->m_stubSocket->flush();
- }
- stubServerShutdown();
- d->m_stubPid = 0;
-}
-
-void ConsoleProcess::stop()
-{
- killProcess();
- killStub();
- if (isRunning()) {
- d->m_process.terminate();
- if (!d->m_process.waitForFinished(1000) && d->m_process.state() == QProcess::Running) {
- d->m_process.kill();
- d->m_process.waitForFinished();
- }
- }
-}
-
-bool ConsoleProcess::isRunning() const
-{
- return d->m_process.state() != QProcess::NotRunning
- || (d->m_stubSocket && d->m_stubSocket->isOpen());
-}
-
-QString ConsoleProcess::stubServerListen()
-{
- // We need to put the socket in a private directory, as some systems simply do not
- // check the file permissions of sockets.
- QString stubFifoDir;
- forever {
- {
- QTemporaryFile tf;
- if (!tf.open())
- return msgCannotCreateTempFile(tf.errorString());
- stubFifoDir = tf.fileName();
- }
- // By now the temp file was deleted again
- d->m_stubServerDir = QFile::encodeName(stubFifoDir);
- if (!::mkdir(d->m_stubServerDir.constData(), 0700))
- break;
- if (errno != EEXIST)
- return msgCannotCreateTempDir(stubFifoDir, QString::fromLocal8Bit(strerror(errno)));
- }
- const QString stubServer = stubFifoDir + QLatin1String("/stub-socket");
- if (!d->m_stubServer.listen(stubServer)) {
- ::rmdir(d->m_stubServerDir.constData());
- return tr("Cannot create socket \"%1\": %2").arg(stubServer, d->m_stubServer.errorString());
- }
- return QString();
-}
-
-void ConsoleProcess::stubServerShutdown()
-{
- if (d->m_stubSocket) {
- readStubOutput(); // we could get the shutdown signal before emptying the buffer
- d->m_stubSocket->disconnect(); // avoid getting queued readyRead signals
- d->m_stubSocket->deleteLater(); // we might be called from the disconnected signal of m_stubSocket
- }
- d->m_stubSocket = nullptr;
- if (d->m_stubServer.isListening()) {
- d->m_stubServer.close();
- ::rmdir(d->m_stubServerDir.constData());
- }
-}
-
-void ConsoleProcess::stubConnectionAvailable()
-{
- if (d->m_stubConnectTimer) {
- delete d->m_stubConnectTimer;
- d->m_stubConnectTimer = nullptr;
- }
- d->m_stubConnected = true;
- emit stubStarted();
- d->m_stubSocket = d->m_stubServer.nextPendingConnection();
- connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput);
- connect(d->m_stubSocket, &QLocalSocket::disconnected, this, &ConsoleProcess::stubExited);
-}
-
-static QString errorMsg(int code)
-{
- return QString::fromLocal8Bit(strerror(code));
-}
-
-void ConsoleProcess::readStubOutput()
-{
- while (d->m_stubSocket->canReadLine()) {
- QByteArray out = d->m_stubSocket->readLine();
- out.chop(1); // \n
- if (out.startsWith("err:chdir ")) {
- emitError(QProcess::FailedToStart, msgCannotChangeToWorkDir(workingDirectory(), errorMsg(out.mid(10).toInt())));
- } else if (out.startsWith("err:exec ")) {
- emitError(QProcess::FailedToStart, msgCannotExecute(d->m_executable, errorMsg(out.mid(9).toInt())));
- } else if (out.startsWith("spid ")) {
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
-
- d->m_stubPid = out.mid(4).toInt();
- } else if (out.startsWith("pid ")) {
- d->m_appPid = out.mid(4).toInt();
- emit processStarted();
- } else if (out.startsWith("exit ")) {
- d->m_appStatus = QProcess::NormalExit;
- d->m_appCode = out.mid(5).toInt();
- d->m_appPid = 0;
- emit processStopped(d->m_appCode, d->m_appStatus);
- } else if (out.startsWith("crash ")) {
- d->m_appStatus = QProcess::CrashExit;
- d->m_appCode = out.mid(6).toInt();
- d->m_appPid = 0;
- emit processStopped(d->m_appCode, d->m_appStatus);
- } else {
- emitError(QProcess::UnknownError, msgUnexpectedOutput(out));
- d->m_stubPid = 0;
- d->m_process.terminate();
- break;
- }
- }
-}
-
-void ConsoleProcess::stubExited()
-{
- // The stub exit might get noticed before we read the error status.
- if (d->m_stubSocket && d->m_stubSocket->state() == QLocalSocket::ConnectedState)
- d->m_stubSocket->waitForDisconnected();
- stubServerShutdown();
- d->m_stubPid = 0;
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- if (d->m_appPid) {
- d->m_appStatus = QProcess::CrashExit;
- d->m_appCode = -1;
- d->m_appPid = 0;
- emit processStopped(d->m_appCode, d->m_appStatus); // Maybe it actually did not, but keep state consistent
- }
- emit stubStopped();
-}
-
-Q_GLOBAL_STATIC_WITH_ARGS(const QVector<TerminalCommand>, knownTerminals, (
-{
- {"x-terminal-emulator", "", "-e"},
- {"xterm", "", "-e"},
- {"aterm", "", "-e"},
- {"Eterm", "", "-e"},
- {"rxvt", "", "-e"},
- {"urxvt", "", "-e"},
- {"xfce4-terminal", "", "-x"},
- {"konsole", "--separate", "-e"},
- {"gnome-terminal", "", "--"}
-}));
-
-TerminalCommand ConsoleProcess::defaultTerminalEmulator()
-{
- static TerminalCommand defaultTerm;
- if (defaultTerm.command.isEmpty()) {
- defaultTerm = []() -> TerminalCommand {
- if (HostOsInfo::isMacHost()) {
- const QString termCmd = QCoreApplication::applicationDirPath()
- + "/../Resources/scripts/openTerminal.py";
- if (QFileInfo::exists(termCmd))
- return {termCmd, "", ""};
- return {"/usr/X11/bin/xterm", "", "-e"};
- }
- const Environment env = Environment::systemEnvironment();
- for (const TerminalCommand &term : *knownTerminals) {
- const QString result = env.searchInPath(term.command).toString();
- if (!result.isEmpty())
- return {result, term.openArgs, term.executeArgs};
- }
- return {"xterm", "", "-e"};
- }();
- }
- return defaultTerm;
-}
-
-QVector<TerminalCommand> ConsoleProcess::availableTerminalEmulators()
-{
- QVector<TerminalCommand> result;
- const Environment env = Environment::systemEnvironment();
- for (const TerminalCommand &term : *knownTerminals) {
- const QString command = env.searchInPath(term.command).toString();
- if (!command.isEmpty())
- result.push_back({command, term.openArgs, term.executeArgs});
- }
- // sort and put default terminal on top
- const TerminalCommand defaultTerm = defaultTerminalEmulator();
- result.removeAll(defaultTerm);
- sort(result);
- result.prepend(defaultTerm);
- return result;
-}
-
-const char kTerminalVersion[] = "4.8";
-const char kTerminalVersionKey[] = "General/Terminal/SettingsVersion";
-const char kTerminalCommandKey[] = "General/Terminal/Command";
-const char kTerminalOpenOptionsKey[] = "General/Terminal/OpenOptions";
-const char kTerminalExecuteOptionsKey[] = "General/Terminal/ExecuteOptions";
-
-TerminalCommand ConsoleProcess::terminalEmulator(const QSettings *settings)
-{
- if (settings) {
- if (settings->value(kTerminalVersionKey).toString() == kTerminalVersion) {
- if (settings->contains(kTerminalCommandKey))
- return {settings->value(kTerminalCommandKey).toString(),
- settings->value(kTerminalOpenOptionsKey).toString(),
- settings->value(kTerminalExecuteOptionsKey).toString()};
- } else {
- // TODO remove reading of old settings some time after 4.8
- const QString value = settings->value("General/TerminalEmulator").toString().trimmed();
- if (!value.isEmpty()) {
- // split off command and options
- const QStringList splitCommand = QtcProcess::splitArgs(value);
- if (QTC_GUARD(!splitCommand.isEmpty())) {
- const QString command = splitCommand.first();
- const QStringList quotedArgs = Utils::transform(splitCommand.mid(1),
- &QtcProcess::quoteArgUnix);
- const QString options = quotedArgs.join(' ');
- return {command, "", options};
- }
- }
- }
- }
- return defaultTerminalEmulator();
-}
-
-void ConsoleProcess::setTerminalEmulator(QSettings *settings, const TerminalCommand &term)
-{
- settings->setValue(kTerminalVersionKey, kTerminalVersion);
- if (term == defaultTerminalEmulator()) {
- settings->remove(kTerminalCommandKey);
- settings->remove(kTerminalOpenOptionsKey);
- settings->remove(kTerminalExecuteOptionsKey);
- } else {
- settings->setValue(kTerminalCommandKey, term.command);
- settings->setValue(kTerminalOpenOptionsKey, term.openArgs);
- settings->setValue(kTerminalExecuteOptionsKey, term.executeArgs);
- }
-}
-
-bool ConsoleProcess::startTerminalEmulator(QSettings *settings, const QString &workingDir,
- const Utils::Environment &env)
-{
- const TerminalCommand term = terminalEmulator(settings);
- QProcess process;
- process.setProgram(term.command);
- process.setArguments(QtcProcess::splitArgs(term.openArgs));
- process.setProcessEnvironment(env.toProcessEnvironment());
- process.setWorkingDirectory(workingDir);
-
- return process.startDetached();
-}
-
-} // namespace Utils
diff --git a/src/libs/utils/consoleprocess_win.cpp b/src/libs/utils/consoleprocess_win.cpp
deleted file mode 100644
index a4008dfd2e..0000000000
--- a/src/libs/utils/consoleprocess_win.cpp
+++ /dev/null
@@ -1,400 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "consoleprocess_p.h"
-#include "environment.h"
-#include "qtcprocess.h"
-#include "winutils.h"
-
-#include <QCoreApplication>
-#include <QDir>
-#include <QAbstractEventDispatcher>
-
-#include <stdlib.h>
-#include <cstring>
-
-namespace Utils {
-
-ConsoleProcessPrivate::ConsoleProcessPrivate() = default;
-
-ConsoleProcess::ConsoleProcess(QObject *parent) :
- QObject(parent), d(new ConsoleProcessPrivate)
-{
- connect(&d->m_stubServer, &QLocalServer::newConnection,
- this, &ConsoleProcess::stubConnectionAvailable);
-}
-
-qint64 ConsoleProcess::applicationMainThreadID() const
-{
- return d->m_appMainThreadId;
-}
-
-bool ConsoleProcess::start(const QString &program, const QString &args, MetaCharMode metaCharMode)
-{
- Q_UNUSED(metaCharMode);
-
- if (isRunning())
- return false;
-
- d->m_errorString.clear();
- d->m_error = QProcess::UnknownError;
-
- QString pcmd;
- QString pargs;
- if (d->m_mode != Run) { // The debugger engines already pre-process the arguments.
- pcmd = program;
- pargs = args;
- } else {
- QtcProcess::Arguments outArgs;
- QtcProcess::prepareCommand(program, args, &pcmd, &outArgs, OsTypeWindows,
- &d->m_environment, &d->m_workingDir);
- pargs = outArgs.toWindowsArgs();
- }
-
- const QString err = stubServerListen();
- if (!err.isEmpty()) {
- emitError(QProcess::FailedToStart, msgCommChannelFailed(err));
- return false;
- }
-
- QStringList env = d->m_environment.toStringList();
- if (!env.isEmpty()) {
- d->m_tempFile = new QTemporaryFile();
- if (!d->m_tempFile->open()) {
- stubServerShutdown();
- emitError(QProcess::FailedToStart, msgCannotCreateTempFile(d->m_tempFile->errorString()));
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- return false;
- }
- QTextStream out(d->m_tempFile);
- out.setCodec("UTF-16LE");
- out.setGenerateByteOrderMark(false);
- foreach (const QString &var, fixWinEnvironment(env))
- out << var << QChar(0);
- out << QChar(0);
- out.flush();
- if (out.status() != QTextStream::Ok) {
- stubServerShutdown();
- emitError(QProcess::FailedToStart, msgCannotWriteTempFile());
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- return false;
- }
- }
-
- STARTUPINFO si;
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
-
- d->m_pid = new PROCESS_INFORMATION;
- ZeroMemory(d->m_pid, sizeof(PROCESS_INFORMATION));
-
- QString workDir = QDir::toNativeSeparators(workingDirectory());
- if (!workDir.isEmpty() && !workDir.endsWith(QLatin1Char('\\')))
- workDir.append(QLatin1Char('\\'));
-
- QStringList stubArgs;
- stubArgs << modeOption(d->m_mode)
- << d->m_stubServer.fullServerName()
- << workDir
- << (d->m_tempFile ? d->m_tempFile->fileName() : QString())
- << createWinCommandline(pcmd, pargs)
- << msgPromptToClose();
-
- const QString cmdLine = createWinCommandline(
- QCoreApplication::applicationDirPath() + QLatin1String("/qtcreator_process_stub.exe"), stubArgs);
-
- bool success = CreateProcessW(0, (WCHAR*)cmdLine.utf16(),
- 0, 0, FALSE, CREATE_NEW_CONSOLE,
- 0, 0,
- &si, d->m_pid);
-
- if (!success) {
- delete d->m_pid;
- d->m_pid = nullptr;
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- stubServerShutdown();
- emitError(QProcess::FailedToStart, tr("The process \"%1\" could not be started: %2").arg(cmdLine, winErrorMessage(GetLastError())));
- return false;
- }
-
- d->processFinishedNotifier = new QWinEventNotifier(d->m_pid->hProcess, this);
- connect(d->processFinishedNotifier, &QWinEventNotifier::activated,
- this, &ConsoleProcess::stubExited);
- return true;
-}
-
-
-void ConsoleProcess::killProcess()
-{
- if (d->m_hInferior != NULL) {
- TerminateProcess(d->m_hInferior, (unsigned)-1);
- cleanupInferior();
- }
-}
-
-void ConsoleProcess::killStub()
-{
- if (d->m_pid) {
- TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
- WaitForSingleObject(d->m_pid->hProcess, INFINITE);
- cleanupStub();
- }
-}
-
-void ConsoleProcess::stop()
-{
- killProcess();
- killStub();
-}
-
-bool ConsoleProcess::isRunning() const
-{
- return d->m_pid != nullptr;
-}
-
-QString ConsoleProcess::stubServerListen()
-{
- if (d->m_stubServer.listen(QString::fromLatin1("creator-%1-%2")
- .arg(QCoreApplication::applicationPid())
- .arg(rand())))
- return QString();
- return d->m_stubServer.errorString();
-}
-
-void ConsoleProcess::stubServerShutdown()
-{
- delete d->m_stubSocket;
- d->m_stubSocket = nullptr;
- if (d->m_stubServer.isListening())
- d->m_stubServer.close();
-}
-
-void ConsoleProcess::stubConnectionAvailable()
-{
- emit stubStarted();
- d->m_stubSocket = d->m_stubServer.nextPendingConnection();
- connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput);
-}
-
-void ConsoleProcess::readStubOutput()
-{
- while (d->m_stubSocket->canReadLine()) {
- QByteArray out = d->m_stubSocket->readLine();
- out.chop(2); // \r\n
- if (out.startsWith("err:chdir ")) {
- emitError(QProcess::FailedToStart, msgCannotChangeToWorkDir(workingDirectory(), winErrorMessage(out.mid(10).toInt())));
- } else if (out.startsWith("err:exec ")) {
- emitError(QProcess::FailedToStart, msgCannotExecute(d->m_executable, winErrorMessage(out.mid(9).toInt())));
- } else if (out.startsWith("thread ")) { // Windows only
- d->m_appMainThreadId = out.mid(7).toLongLong();
- } else if (out.startsWith("pid ")) {
- // Will not need it any more
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
- d->m_appPid = out.mid(4).toLongLong();
-
- d->m_hInferior = OpenProcess(
- SYNCHRONIZE | PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE,
- FALSE, d->m_appPid);
- if (d->m_hInferior == NULL) {
- emitError(QProcess::FailedToStart, tr("Cannot obtain a handle to the inferior: %1")
- .arg(winErrorMessage(GetLastError())));
- // Uhm, and now what?
- continue;
- }
- d->inferiorFinishedNotifier = new QWinEventNotifier(d->m_hInferior, this);
- connect(d->inferiorFinishedNotifier, &QWinEventNotifier::activated,
- this, &ConsoleProcess::inferiorExited);
- emit processStarted();
- } else {
- emitError(QProcess::UnknownError, msgUnexpectedOutput(out));
- TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
- break;
- }
- }
-}
-
-void ConsoleProcess::cleanupInferior()
-{
- delete d->inferiorFinishedNotifier;
- d->inferiorFinishedNotifier = nullptr;
- CloseHandle(d->m_hInferior);
- d->m_hInferior = NULL;
- d->m_appPid = 0;
-}
-
-void ConsoleProcess::inferiorExited()
-{
- DWORD chldStatus;
-
- if (!GetExitCodeProcess(d->m_hInferior, &chldStatus))
- emitError(QProcess::UnknownError, tr("Cannot obtain exit status from inferior: %1")
- .arg(winErrorMessage(GetLastError())));
- cleanupInferior();
- d->m_appStatus = QProcess::NormalExit;
- d->m_appCode = chldStatus;
- emit processStopped(d->m_appCode, d->m_appStatus);
-}
-
-void ConsoleProcess::cleanupStub()
-{
- stubServerShutdown();
- delete d->processFinishedNotifier;
- d->processFinishedNotifier = nullptr;
- CloseHandle(d->m_pid->hThread);
- CloseHandle(d->m_pid->hProcess);
- delete d->m_pid;
- d->m_pid = nullptr;
- delete d->m_tempFile;
- d->m_tempFile = nullptr;
-}
-
-void ConsoleProcess::stubExited()
-{
- // The stub exit might get noticed before we read the pid for the kill.
- if (d->m_stubSocket && d->m_stubSocket->state() == QLocalSocket::ConnectedState)
- d->m_stubSocket->waitForDisconnected();
- cleanupStub();
- if (d->m_hInferior != NULL) {
- TerminateProcess(d->m_hInferior, (unsigned)-1);
- cleanupInferior();
- d->m_appStatus = QProcess::CrashExit;
- d->m_appCode = -1;
- emit processStopped(d->m_appCode, d->m_appStatus);
- }
- emit stubStopped();
-}
-
-QStringList ConsoleProcess::fixWinEnvironment(const QStringList &env)
-{
- QStringList envStrings = env;
- // add PATH if necessary (for DLL loading)
- if (envStrings.filter(QRegExp(QLatin1String("^PATH="),Qt::CaseInsensitive)).isEmpty()) {
- QByteArray path = qgetenv("PATH");
- if (!path.isEmpty())
- envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
- }
- // add systemroot if needed
- if (envStrings.filter(QRegExp(QLatin1String("^SystemRoot="),Qt::CaseInsensitive)).isEmpty()) {
- QByteArray systemRoot = qgetenv("SystemRoot");
- if (!systemRoot.isEmpty())
- envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));
- }
- return envStrings;
-}
-
-static QString quoteWinCommand(const QString &program)
-{
- const QChar doubleQuote = QLatin1Char('"');
-
- // add the program as the first arg ... it works better
- QString programName = program;
- programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
- if (!programName.startsWith(doubleQuote) && !programName.endsWith(doubleQuote)
- && programName.contains(QLatin1Char(' '))) {
- programName.prepend(doubleQuote);
- programName.append(doubleQuote);
- }
- return programName;
-}
-
-static QString quoteWinArgument(const QString &arg)
-{
- if (!arg.length())
- return QString::fromLatin1("\"\"");
-
- QString ret(arg);
- // Quotes are escaped and their preceding backslashes are doubled.
- ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
- if (ret.contains(QRegExp(QLatin1String("\\s")))) {
- // The argument must not end with a \ since this would be interpreted
- // as escaping the quote -- rather put the \ behind the quote: e.g.
- // rather use "foo"\ than "foo\"
- int i = ret.length();
- while (i > 0 && ret.at(i - 1) == QLatin1Char('\\'))
- --i;
- ret.insert(i, QLatin1Char('"'));
- ret.prepend(QLatin1Char('"'));
- }
- return ret;
-}
-
-QString ConsoleProcess::createWinCommandline(const QString &program, const QStringList &args)
-{
- QString programName = quoteWinCommand(program);
- foreach (const QString &arg, args) {
- programName += QLatin1Char(' ');
- programName += quoteWinArgument(arg);
- }
- return programName;
-}
-
-QString ConsoleProcess::createWinCommandline(const QString &program, const QString &args)
-{
- QString programName = quoteWinCommand(program);
- if (!args.isEmpty()) {
- programName += QLatin1Char(' ');
- programName += args;
- }
- return programName;
-}
-
-bool ConsoleProcess::startTerminalEmulator(QSettings *, const QString &workingDir,
- const Utils::Environment &env)
-{
- STARTUPINFO si;
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
-
- PROCESS_INFORMATION pinfo;
- ZeroMemory(&pinfo, sizeof(pinfo));
-
- QString cmdLine = createWinCommandline(
- QString::fromLocal8Bit(qgetenv("COMSPEC")), QString());
- // cmdLine is assumed to be detached -
- // https://blogs.msdn.microsoft.com/oldnewthing/20090601-00/?p=18083
-
-
- QString totalEnvironment = env.toStringList().join(QChar(QChar::Null)) + QChar(QChar::Null);
- LPVOID envPtr = (env != Utils::Environment::systemEnvironment())
- ? (WCHAR *)(totalEnvironment.utf16()) : nullptr;
-
- bool success = CreateProcessW(0, (WCHAR *)cmdLine.utf16(),
- 0, 0, FALSE, CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT,
- envPtr, workingDir.isEmpty() ? 0 : (WCHAR *)workingDir.utf16(),
- &si, &pinfo);
-
- if (success) {
- CloseHandle(pinfo.hThread);
- CloseHandle(pinfo.hProcess);
- }
-
- return success;
-}
-
-} // namespace Utils
diff --git a/src/libs/utils/cpplanguage_details.h b/src/libs/utils/cpplanguage_details.h
index e9c9a5aa40..06cb050126 100644
--- a/src/libs/utils/cpplanguage_details.h
+++ b/src/libs/utils/cpplanguage_details.h
@@ -72,4 +72,6 @@ constexpr bool operator&&(LanguageExtension first, LanguageExtension second)
return static_cast<unsigned char>(first) & static_cast<unsigned char>(second);
}
+enum class QtVersion { Unknown = -1, None, Qt4, Qt5 };
+
} // namespace Utils
diff --git a/src/libs/utils/delegates.cpp b/src/libs/utils/delegates.cpp
index 2240e8a6a4..1eb281e3af 100644
--- a/src/libs/utils/delegates.cpp
+++ b/src/libs/utils/delegates.cpp
@@ -131,8 +131,8 @@ void PathChooserDelegate::setPromptDialogFilter(const QString &filter)
QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- Q_UNUSED(option);
- Q_UNUSED(index);
+ Q_UNUSED(option)
+ Q_UNUSED(index)
auto editor = new Utils::PathChooser(parent);
@@ -167,7 +167,7 @@ void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel *mode
void PathChooserDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
editor->setGeometry(option.rect);
}
@@ -200,8 +200,8 @@ QWidget *CompleterDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- Q_UNUSED(option);
- Q_UNUSED(index);
+ Q_UNUSED(option)
+ Q_UNUSED(index)
auto edit = new CompletingLineEdit(parent);
@@ -229,7 +229,7 @@ void CompleterDelegate::updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- Q_UNUSED(index);
+ Q_UNUSED(index)
editor->setGeometry(option.rect);
}
diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp
index 329975afdb..abceff7b2d 100644
--- a/src/libs/utils/detailsbutton.cpp
+++ b/src/libs/utils/detailsbutton.cpp
@@ -200,3 +200,61 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked)
style()->drawPrimitive(checked ? QStyle::PE_IndicatorArrowUp : QStyle::PE_IndicatorArrowDown, &arrowOpt, &p, this);
return pixmap;
}
+
+ExpandButton::ExpandButton(QWidget *parent) : QAbstractButton(parent)
+{
+ setCheckable(true);
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
+}
+
+QSize ExpandButton::sizeHint() const
+{
+ return {fontMetrics().horizontalAdvance(text()) + 26, HostOsInfo::isMacHost() ? 34 : 22};
+}
+
+void ExpandButton::paintEvent(QPaintEvent *e)
+{
+ QWidget::paintEvent(e);
+ QPainter p(this);
+
+ QPixmap &pixmap = isChecked() ? m_checkedPixmap : m_uncheckedPixmap;
+ if (pixmap.isNull() || pixmap.size() / pixmap.devicePixelRatio() != contentsRect().size())
+ pixmap = cacheRendering();
+ p.drawPixmap(contentsRect(), pixmap);
+
+ if (isDown()) {
+ p.setPen(Qt::NoPen);
+ p.setBrush(QColor(0, 0, 0, 20));
+ p.drawRoundedRect(rect().adjusted(1, 1, -1, -1), 1, 1);
+ }
+ if (hasFocus()) {
+ QStyleOptionFocusRect option;
+ option.initFrom(this);
+ style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &p, this);
+ }
+}
+
+QPixmap ExpandButton::cacheRendering()
+{
+ const QSize size = contentsRect().size();
+ const qreal pixelRatio = devicePixelRatio();
+ QPixmap pixmap(size * pixelRatio);
+ pixmap.setDevicePixelRatio(pixelRatio);
+ pixmap.fill(Qt::transparent);
+ QPainter p(&pixmap);
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.translate(0.5, 0.5);
+ p.setPen(Qt::NoPen);
+ p.drawRoundedRect(0, 0, size.width(), size.height(), 1, 1);
+ int arrowsize = 15;
+ QStyleOption arrowOpt;
+ arrowOpt.initFrom(this);
+ QPalette pal = arrowOpt.palette;
+ pal.setBrush(QPalette::All, QPalette::Text, QColor(0, 0, 0));
+ arrowOpt.rect = QRect(size.width() - arrowsize - 6, height() / 2 - arrowsize / 2,
+ arrowsize, arrowsize);
+ arrowOpt.palette = pal;
+ style()->drawPrimitive(isChecked() ? QStyle::PE_IndicatorArrowUp
+ : QStyle::PE_IndicatorArrowDown, &arrowOpt, &p, this);
+ return pixmap;
+}
diff --git a/src/libs/utils/detailsbutton.h b/src/libs/utils/detailsbutton.h
index f66fa2ad4b..dabbe75918 100644
--- a/src/libs/utils/detailsbutton.h
+++ b/src/libs/utils/detailsbutton.h
@@ -78,4 +78,22 @@ private:
QPixmap m_uncheckedPixmap;
float m_fader;
};
+
+class QTCREATOR_UTILS_EXPORT ExpandButton : public QAbstractButton
+{
+ Q_OBJECT
+
+public:
+ ExpandButton(QWidget *parent = nullptr);
+
+private:
+ void paintEvent(QPaintEvent *e) override;
+ QSize sizeHint() const override;
+
+ QPixmap cacheRendering();
+
+ QPixmap m_checkedPixmap;
+ QPixmap m_uncheckedPixmap;
+};
+
} // namespace Utils
diff --git a/src/libs/utils/displayname.cpp b/src/libs/utils/displayname.cpp
new file mode 100644
index 0000000000..819baae495
--- /dev/null
+++ b/src/libs/utils/displayname.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "displayname.h"
+
+namespace Utils {
+
+bool DisplayName::setValue(const QString &name)
+{
+ if (value() == name)
+ return false;
+ if (name == m_defaultValue)
+ m_value.clear();
+ else
+ m_value = name;
+ return true;
+}
+
+bool DisplayName::setDefaultValue(const QString &name)
+{
+ if (m_defaultValue == name)
+ return false;
+ const QString originalName = value();
+ m_defaultValue = name;
+ return originalName != value();
+}
+
+QString DisplayName::value() const
+{
+ return m_value.isEmpty() ? m_defaultValue : m_value;
+}
+
+bool DisplayName::usesDefaultValue() const
+{
+ return m_value.isEmpty();
+}
+
+void DisplayName::toMap(QVariantMap &map, const QString &key) const
+{
+ if (!usesDefaultValue())
+ map.insert(key, m_value);
+}
+
+void DisplayName::fromMap(const QVariantMap &map, const QString &key)
+{
+ m_value = map.value(key).toString();
+}
+
+bool operator==(const DisplayName &dn1, const DisplayName &dn2)
+{
+ return dn1.value() == dn2.value() && dn1.defaultValue() == dn2.defaultValue();
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/displayname.h b/src/libs/utils/displayname.h
new file mode 100644
index 0000000000..efbd25a2b8
--- /dev/null
+++ b/src/libs/utils/displayname.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "utils_global.h"
+
+#include <QString>
+#include <QVariantMap>
+
+namespace Utils {
+
+// Can be used for anything with a translatable, user-settable name with a fixed default value
+// that gets set by a constructor or factory.
+class QTCREATOR_UTILS_EXPORT DisplayName
+{
+public:
+ // These return true if and only if the value of displayName() has changed.
+ bool setValue(const QString &name);
+ bool setDefaultValue(const QString &name);
+
+ QString value() const;
+ QString defaultValue() const { return m_defaultValue; }
+ bool usesDefaultValue() const;
+
+ void toMap(QVariantMap &map, const QString &key) const;
+ void fromMap(const QVariantMap &map, const QString &key);
+
+private:
+ QString m_value;
+ QString m_defaultValue;
+};
+
+bool QTCREATOR_UTILS_EXPORT operator==(const DisplayName &dn1, const DisplayName &dn2);
+inline bool operator!=(const DisplayName &dn1, const DisplayName &dn2)
+{
+ return !(dn1 == dn2);
+}
+
+} // namespace Utils
+
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp
index d61a75ebf7..b4d3144a42 100644
--- a/src/libs/utils/environment.cpp
+++ b/src/libs/utils/environment.cpp
@@ -39,289 +39,58 @@ Q_GLOBAL_STATIC_WITH_ARGS(Utils::Environment, staticSystemEnvironment,
Q_GLOBAL_STATIC(QVector<Utils::EnvironmentProvider>, environmentProviders)
-static QMap<QString, QString>::iterator findKey(QMap<QString, QString> &input, Utils::OsType osType,
- const QString &key)
-{
- const Qt::CaseSensitivity casing
- = (osType == Utils::OsTypeWindows) ? Qt::CaseInsensitive : Qt::CaseSensitive;
- for (auto it = input.begin(); it != input.end(); ++it) {
- if (key.compare(it.key(), casing) == 0)
- return it;
- }
- return input.end();
-}
-
-static QMap<QString, QString>::const_iterator findKey(const QMap<QString, QString> &input,
- Utils::OsType osType,
- const QString &key)
-{
- const Qt::CaseSensitivity casing
- = (osType == Utils::OsTypeWindows) ? Qt::CaseInsensitive : Qt::CaseSensitive;
- for (auto it = input.constBegin(); it != input.constEnd(); ++it) {
- if (key.compare(it.key(), casing) == 0)
- return it;
- }
- return input.constEnd();
-}
-
namespace Utils {
-enum : char
-{
-#ifdef Q_OS_WIN
- pathSepC = ';'
-#else
- pathSepC = ':'
-#endif
-};
-
-void EnvironmentItem::sort(QList<EnvironmentItem> *list)
-{
- Utils::sort(*list, &EnvironmentItem::name);
-}
-
-QList<EnvironmentItem> EnvironmentItem::fromStringList(const QStringList &list)
-{
- QList<EnvironmentItem> result;
- for (const QString &string : list) {
- int pos = string.indexOf('=', 1);
- if (pos == -1)
- result.append(EnvironmentItem(string, QString(), EnvironmentItem::Unset));
- else
- result.append(EnvironmentItem(string.left(pos), string.mid(pos + 1)));
- }
- return result;
-}
-
-QStringList EnvironmentItem::toStringList(const QList<EnvironmentItem> &list)
-{
- return Utils::transform(list, [](const EnvironmentItem &item) {
- if (item.operation == EnvironmentItem::Unset)
- return QString(item.name);
- return QString(item.name + '=' + item.value);
- });
-}
-
-QList<EnvironmentItem> EnvironmentItem::itemsFromVariantList(const QVariantList &list)
-{
- return Utils::transform(list, [](const QVariant &item) {
- return itemFromVariantList(item.toList());
- });
-}
-
-QVariantList EnvironmentItem::toVariantList(const QList<EnvironmentItem> &list)
-{
- return Utils::transform(list, [](const EnvironmentItem &item) {
- return QVariant(toVariantList(item));
- });
-}
-
-EnvironmentItem EnvironmentItem::itemFromVariantList(const QVariantList &list)
-{
- QTC_ASSERT(list.size() == 3, return EnvironmentItem("", ""));
- QString name = list.value(0).toString();
- Operation operation = Operation(list.value(1).toInt());
- QString value = list.value(2).toString();
- return EnvironmentItem(name, value, operation);
-}
-
-QVariantList EnvironmentItem::toVariantList(const EnvironmentItem &item)
-{
- return QVariantList() << item.name << item.operation << item.value;
-}
-
-static QString expand(const Environment *e, QString value)
-{
- int replaceCount = 0;
- for (int i = 0; i < value.size(); ++i) {
- if (value.at(i) == '$') {
- if ((i + 1) < value.size()) {
- const QChar &c = value.at(i+1);
- int end = -1;
- if (c == '(')
- end = value.indexOf(')', i);
- else if (c == '{')
- end = value.indexOf('}', i);
- if (end != -1) {
- const QString &name = value.mid(i + 2, end - i - 2);
- Environment::const_iterator it = e->constFind(name);
- if (it != e->constEnd())
- value.replace(i, end - i + 1, it.value());
- ++replaceCount;
- QTC_ASSERT(replaceCount < 100, break);
- }
- }
- }
- }
- return value;
-}
-
-QDebug operator<<(QDebug debug, const EnvironmentItem &i)
-{
- QDebugStateSaver saver(debug);
- debug.noquote();
- debug.nospace();
- debug << "EnvironmentItem(";
- switch (i.operation) {
- case EnvironmentItem::Set:
- debug << "set \"" << i.name << "\" to \"" << i.value << '"';
- break;
- case EnvironmentItem::Unset:
- debug << "unset \"" << i.name << '"';
- break;
- case EnvironmentItem::Prepend:
- debug << "prepend to \"" << i.name << "\":\"" << i.value << '"';
- break;
- case EnvironmentItem::Append:
- debug << "append to \"" << i.name << "\":\"" << i.value << '"';
- break;
- }
- debug << ')';
- return debug;
-}
-
-void EnvironmentItem::apply(Environment *e, Operation op) const
-{
- switch (op) {
- case Set:
- e->set(name, expand(e, value));
- break;
- case Unset:
- e->unset(name);
- break;
- case Prepend: {
- const Environment::const_iterator it = e->constFind(name);
- if (it != e->constEnd()) {
- QString v = it.value();
- const QChar pathSep{QLatin1Char(pathSepC)};
- int sepCount = 0;
- if (v.startsWith(pathSep))
- ++sepCount;
- if (value.endsWith(pathSep))
- ++sepCount;
- if (sepCount == 2)
- v.remove(0, 1);
- else if (sepCount == 0)
- v.prepend(pathSep);
- v.prepend(expand(e, value));
- e->set(name, v);
- } else {
- apply(e, Set);
- }
- }
- break;
- case Append: {
- const Environment::const_iterator it = e->constFind(name);
- if (it != e->constEnd()) {
- QString v = it.value();
- const QChar pathSep{QLatin1Char(pathSepC)};
- int sepCount = 0;
- if (v.endsWith(pathSep))
- ++sepCount;
- if (value.startsWith(pathSep))
- ++sepCount;
- if (sepCount == 2)
- v.chop(1);
- else if (sepCount == 0)
- v.append(pathSep);
- v.append(expand(e, value));
- e->set(name, v);
- } else {
- apply(e, Set);
- }
- }
- break;
- }
-}
-
-Environment::Environment(const QStringList &env, OsType osType) : m_osType(osType)
-{
- for (const QString &s : env) {
- int i = s.indexOf('=', 1);
- if (i >= 0) {
- const QString key = s.left(i);
- if (!key.contains('=')) {
- const QString value = s.mid(i + 1);
- set(key, value);
- }
- }
- }
-}
-
-QStringList Environment::toStringList() const
-{
- QStringList result;
- for (auto it = m_values.constBegin(); it != m_values.constEnd(); ++it)
- result.append(it.key() + '=' + it.value());
- return result;
-}
-
QProcessEnvironment Environment::toProcessEnvironment() const
{
QProcessEnvironment result;
- for (auto it = m_values.constBegin(); it != m_values.constEnd(); ++it)
- result.insert(it.key(), it.value());
+ for (auto it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ if (it.value().second)
+ result.insert(it.key().name, expandedValueForKey(key(it)));
+ }
return result;
}
-void Environment::set(const QString &key, const QString &value)
+void Environment::appendOrSetPath(const QString &value)
{
- QTC_ASSERT(!key.contains('='), return);
- auto it = findKey(m_values, m_osType, key);
- if (it == m_values.end())
- m_values.insert(key, value);
- else
- it.value() = value;
+ appendOrSet("PATH", QDir::toNativeSeparators(value),
+ QString(OsSpecificAspects::pathListSeparator(m_osType)));
}
-void Environment::unset(const QString &key)
+void Environment::prependOrSetPath(const QString &value)
{
- QTC_ASSERT(!key.contains('='), return);
- auto it = findKey(m_values, m_osType, key);
- if (it != m_values.end())
- m_values.erase(it);
+ prependOrSet("PATH", QDir::toNativeSeparators(value),
+ QString(OsSpecificAspects::pathListSeparator(m_osType)));
}
void Environment::appendOrSet(const QString &key, const QString &value, const QString &sep)
{
- QTC_ASSERT(!key.contains('='), return);
- auto it = findKey(m_values, m_osType, key);
+ QTC_ASSERT(!key.contains('='), return );
+ const auto it = findKey(key);
if (it == m_values.end()) {
- m_values.insert(key, value);
+ m_values.insert(DictKey(key, nameCaseSensitivity()), qMakePair(value, true));
} else {
// Append unless it is already there
const QString toAppend = sep + value;
- if (!it.value().endsWith(toAppend))
- it.value().append(toAppend);
+ if (!it.value().first.endsWith(toAppend))
+ it.value().first.append(toAppend);
}
}
-void Environment::prependOrSet(const QString&key, const QString &value, const QString &sep)
+void Environment::prependOrSet(const QString &key, const QString &value, const QString &sep)
{
- QTC_ASSERT(!key.contains('='), return);
- auto it = findKey(m_values, m_osType, key);
+ QTC_ASSERT(!key.contains('='), return );
+ const auto it = findKey(key);
if (it == m_values.end()) {
- m_values.insert(key, value);
+ m_values.insert(DictKey(key, nameCaseSensitivity()), qMakePair(value, true));
} else {
// Prepend unless it is already there
const QString toPrepend = value + sep;
- if (!it.value().startsWith(toPrepend))
- it.value().prepend(toPrepend);
+ if (!it.value().first.startsWith(toPrepend))
+ it.value().first.prepend(toPrepend);
}
}
-void Environment::appendOrSetPath(const QString &value)
-{
- appendOrSet("PATH", QDir::toNativeSeparators(value),
- QString(OsSpecificAspects::pathListSeparator(m_osType)));
-}
-
-void Environment::prependOrSetPath(const QString &value)
-{
- prependOrSet("PATH", QDir::toNativeSeparators(value),
- QString(OsSpecificAspects::pathListSeparator(m_osType)));
-}
-
void Environment::prependOrSetLibrarySearchPath(const QString &value)
{
switch (m_osType) {
@@ -387,11 +156,6 @@ void Environment::setupEnglishOutput(QStringList *environment)
*environment = env.toStringList();
}
-void Environment::clear()
-{
- m_values.clear();
-}
-
FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory,
QSet<FilePath> &alreadyChecked) const
{
@@ -420,7 +184,7 @@ QStringList Environment::appendExeExtensions(const QString &executable) const
// Check all the executable extensions on windows:
// PATHEXT is only used if the executable has no extension
if (fi.suffix().isEmpty()) {
- const QStringList extensions = value("PATHEXT").split(';');
+ const QStringList extensions = expandedValueForKey("PATHEXT").split(';');
for (const QString &ext : extensions)
execs << executable + ext.toLower();
@@ -448,6 +212,11 @@ bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) con
return false;
}
+QString Environment::expandedValueForKey(const QString &key) const
+{
+ return expandVariables(value(key));
+}
+
FilePath Environment::searchInPath(const QString &executable,
const FilePathList &additionalDirs,
const PathFilter &func) const
@@ -487,129 +256,58 @@ FilePath Environment::searchInPath(const QString &executable,
return FilePath();
}
-FilePathList Environment::path() const
-{
- const QStringList pathComponents = value("PATH")
- .split(OsSpecificAspects::pathListSeparator(m_osType), QString::SkipEmptyParts);
- return Utils::transform(pathComponents, &FilePath::fromUserInput);
-}
-
-QString Environment::value(const QString &key) const
-{
- const auto it = findKey(m_values, m_osType, key);
- return it != m_values.end() ? it.value() : QString();
-}
-
-QString Environment::key(Environment::const_iterator it) const
-{
- return it.key();
-}
-
-QString Environment::value(Environment::const_iterator it) const
-{
- return it.value();
-}
-
-Environment::const_iterator Environment::constBegin() const
-{
- return m_values.constBegin();
-}
-
-Environment::const_iterator Environment::constEnd() const
+FilePathList Environment::findAllInPath(const QString &executable,
+ const FilePathList &additionalDirs,
+ const Environment::PathFilter &func) const
{
- return m_values.constEnd();
-}
-
-Environment::const_iterator Environment::constFind(const QString &name) const
-{
- return findKey(m_values, m_osType, name);
-}
+ if (executable.isEmpty())
+ return {};
-int Environment::size() const
-{
- return m_values.size();
-}
+ const QString exec = QDir::cleanPath(expandVariables(executable));
+ const QFileInfo fi(exec);
-void Environment::modify(const QList<EnvironmentItem> & list)
-{
- Environment resultEnvironment = *this;
- for (const EnvironmentItem &item : list)
- item.apply(&resultEnvironment);
- *this = resultEnvironment;
-}
+ const QStringList execs = appendExeExtensions(exec);
-QList<EnvironmentItem> Environment::diff(const Environment &other, bool checkAppendPrepend) const
-{
- QMap<QString, QString>::const_iterator thisIt = constBegin();
- QMap<QString, QString>::const_iterator otherIt = other.constBegin();
-
- QList<EnvironmentItem> result;
- while (thisIt != constEnd() || otherIt != other.constEnd()) {
- if (thisIt == constEnd()) {
- result.append(EnvironmentItem(otherIt.key(), otherIt.value()));
- ++otherIt;
- } else if (otherIt == other.constEnd()) {
- result.append(EnvironmentItem(thisIt.key(), QString(), EnvironmentItem::Unset));
- ++thisIt;
- } else if (thisIt.key() < otherIt.key()) {
- result.append(EnvironmentItem(thisIt.key(), QString(), EnvironmentItem::Unset));
- ++thisIt;
- } else if (thisIt.key() > otherIt.key()) {
- result.append(EnvironmentItem(otherIt.key(), otherIt.value()));
- ++otherIt;
- } else {
- const QString &oldValue = thisIt.value();
- const QString &newValue = otherIt.value();
- if (oldValue != newValue) {
- if (checkAppendPrepend && newValue.startsWith(oldValue)) {
- QString appended = newValue.right(newValue.size() - oldValue.size());
- if (appended.startsWith(QLatin1Char(pathSepC)))
- appended.remove(0, 1);
- result.append(EnvironmentItem(otherIt.key(), appended,
- EnvironmentItem::Append));
- } else if (checkAppendPrepend && newValue.endsWith(oldValue)) {
- QString prepended = newValue.left(newValue.size() - oldValue.size());
- if (prepended.endsWith(QLatin1Char(pathSepC)))
- prepended.chop(1);
- result.append(EnvironmentItem(otherIt.key(), prepended,
- EnvironmentItem::Prepend));
- } else {
- result.append(EnvironmentItem(otherIt.key(), newValue));
- }
- }
- ++otherIt;
- ++thisIt;
+ if (fi.isAbsolute()) {
+ for (const QString &path : execs) {
+ QFileInfo pfi = QFileInfo(path);
+ if (pfi.isFile() && pfi.isExecutable())
+ return {FilePath::fromString(path)};
}
+ return {FilePath::fromString(exec)};
}
- return result;
-}
-bool Environment::hasKey(const QString &key) const
-{
- return m_values.contains(key);
-}
-
-OsType Environment::osType() const
-{
- return m_osType;
-}
+ QSet<FilePath> result;
+ QSet<FilePath> alreadyChecked;
+ for (const FilePath &dir : additionalDirs) {
+ FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
+ if (!tmp.isEmpty() && (!func || func(tmp)))
+ result << tmp;
+ }
-QString Environment::userName() const
-{
- return value(QString::fromLatin1(m_osType == OsTypeWindows ? "USERNAME" : "USER"));
+ if (!executable.contains('/')) {
+ for (const FilePath &p : path()) {
+ FilePath tmp = searchInDirectory(execs, p, alreadyChecked);
+ if (!tmp.isEmpty() && (!func || func(tmp)))
+ result << tmp;
+ }
+ }
+ return result.values();
}
-bool Environment::operator!=(const Environment &other) const
+FilePathList Environment::path() const
{
- return !(*this == other);
+ return pathListValue("PATH");
}
-bool Environment::operator==(const Environment &other) const
+FilePathList Environment::pathListValue(const QString &varName) const
{
- return m_osType == other.m_osType && m_values == other.m_values;
+ const QStringList pathComponents = expandedValueForKey(varName)
+ .split(OsSpecificAspects::pathListSeparator(m_osType), QString::SkipEmptyParts);
+ return transform(pathComponents, &FilePath::fromUserInput);
}
-void Environment::modifySystemEnvironment(const QList<EnvironmentItem> &list)
+void Environment::modifySystemEnvironment(const EnvironmentItems &list)
{
staticSystemEnvironment->modify(list);
}
@@ -629,10 +327,10 @@ QString Environment::expandVariables(const QString &input) const
for (int vStart = -1, i = 0; i < result.length(); ) {
if (result.at(i++) == '%') {
if (vStart > 0) {
- const_iterator it = findKey(m_values, m_osType, result.mid(vStart, i - vStart - 1));
+ const auto it = findKey(result.mid(vStart, i - vStart - 1));
if (it != m_values.constEnd()) {
- result.replace(vStart - 1, i - vStart + 1, *it);
- i = vStart - 1 + it->length();
+ result.replace(vStart - 1, i - vStart + 1, it->first);
+ i = vStart - 1 + it->first.length();
vStart = -1;
} else {
vStart = i;
@@ -663,28 +361,28 @@ QString Environment::expandVariables(const QString &input) const
}
} else if (state == BRACEDVARIABLE) {
if (c == '}') {
- const_iterator it = m_values.constFind(result.mid(vStart, i - 1 - vStart));
+ const_iterator it = constFind(result.mid(vStart, i - 1 - vStart));
if (it != constEnd()) {
- result.replace(vStart - 2, i - vStart + 2, *it);
- i = vStart - 2 + it->length();
+ result.replace(vStart - 2, i - vStart + 2, it->first);
+ i = vStart - 2 + it->first.length();
}
state = BASE;
}
} else if (state == VARIABLE) {
if (!c.isLetterOrNumber() && c != '_') {
- const_iterator it = m_values.constFind(result.mid(vStart, i - vStart - 1));
+ const_iterator it = constFind(result.mid(vStart, i - vStart - 1));
if (it != constEnd()) {
- result.replace(vStart - 1, i - vStart, *it);
- i = vStart - 1 + it->length();
+ result.replace(vStart - 1, i - vStart, it->first);
+ i = vStart - 1 + it->first.length();
}
state = BASE;
}
}
}
if (state == VARIABLE) {
- const_iterator it = m_values.constFind(result.mid(vStart));
+ const_iterator it = constFind(result.mid(vStart));
if (it != constEnd())
- result.replace(vStart - 1, result.length() - vStart + 1, *it);
+ result.replace(vStart - 1, result.length() - vStart + 1, it->first);
}
}
return result;
diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h
index f1e957ab6d..0f97c2c3a8 100644
--- a/src/libs/utils/environment.h
+++ b/src/libs/utils/environment.h
@@ -27,8 +27,9 @@
#include "fileutils.h"
#include "hostosinfo.h"
+#include "namevaluedictionary.h"
+#include "namevalueitem.h"
#include "optional.h"
-#include "utils_global.h"
#include <QMap>
#include <QStringList>
@@ -39,71 +40,18 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
QT_FORWARD_DECLARE_CLASS(QProcessEnvironment)
namespace Utils {
-class Environment;
-class QTCREATOR_UTILS_EXPORT EnvironmentItem
+class QTCREATOR_UTILS_EXPORT Environment final : public NameValueDictionary
{
public:
- enum Operation { Set, Unset, Prepend, Append };
+ using NameValueDictionary::NameValueDictionary;
- EnvironmentItem(const QString &n, const QString &v, Operation op = Set)
- : name(n), value(v), operation(op)
- {}
-
- void apply(Environment *e) const { apply(e, operation); }
-
- QString name;
- QString value;
- Operation operation;
-
- bool operator==(const EnvironmentItem &other) const
- {
- return operation == other.operation && name == other.name && value == other.value;
- }
-
- bool operator!=(const EnvironmentItem &other) const
- {
- return !(*this == other);
- }
-
- static void sort(QList<EnvironmentItem> *list);
- static QList<EnvironmentItem> fromStringList(const QStringList &list);
- static QStringList toStringList(const QList<EnvironmentItem> &list);
- static QList<EnvironmentItem> itemsFromVariantList(const QVariantList &list);
- static QVariantList toVariantList(const QList<EnvironmentItem> &list);
- static EnvironmentItem itemFromVariantList(const QVariantList &list);
- static QVariantList toVariantList(const EnvironmentItem &item);
-
-private:
- void apply(Environment *e, Operation op) const;
-};
-
-QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const EnvironmentItem &i);
-
-class QTCREATOR_UTILS_EXPORT Environment
-{
-public:
- using const_iterator = QMap<QString, QString>::const_iterator;
-
- explicit Environment(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {}
- explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs());
static Environment systemEnvironment();
static void setupEnglishOutput(Environment *environment);
static void setupEnglishOutput(QProcessEnvironment *environment);
static void setupEnglishOutput(QStringList *environment);
- QStringList toStringList() const;
QProcessEnvironment toProcessEnvironment() const;
- QString value(const QString &key) const;
- void set(const QString &key, const QString &value);
- void unset(const QString &key);
- void modify(const QList<EnvironmentItem> &list);
- /// Return the Environment changes necessary to modify this into the other environment.
- QList<EnvironmentItem> diff(const Environment &other, bool checkAppendPrepend = false) const;
- bool hasKey(const QString &key) const;
- OsType osType() const;
-
- QString userName() const;
void appendOrSet(const QString &key, const QString &value, const QString &sep = QString());
void prependOrSet(const QString &key, const QString &value, const QString &sep = QString());
@@ -114,40 +62,30 @@ public:
void prependOrSetLibrarySearchPath(const QString &value);
void prependOrSetLibrarySearchPaths(const QStringList &values);
- void clear();
- int size() const;
-
- QString key(Environment::const_iterator it) const;
- QString value(Environment::const_iterator it) const;
-
- Environment::const_iterator constBegin() const;
- Environment::const_iterator constEnd() const;
- Environment::const_iterator constFind(const QString &name) const;
-
using PathFilter = std::function<bool(const FilePath &)>;
FilePath searchInPath(const QString &executable,
const FilePathList &additionalDirs = FilePathList(),
const PathFilter &func = PathFilter()) const;
+ FilePathList findAllInPath(const QString &executable,
+ const FilePathList &additionalDirs = FilePathList(),
+ const PathFilter &func = PathFilter()) const;
FilePathList path() const;
+ FilePathList pathListValue(const QString &varName) const;
QStringList appendExeExtensions(const QString &executable) const;
bool isSameExecutable(const QString &exe1, const QString &exe2) const;
+ QString expandedValueForKey(const QString &key) const;
QString expandVariables(const QString &input) const;
FilePath expandVariables(const FilePath &input) const;
QStringList expandVariables(const QStringList &input) const;
- bool operator!=(const Environment &other) const;
- bool operator==(const Environment &other) const;
-
- static void modifySystemEnvironment(const QList<EnvironmentItem> &list); // use with care!!!
+ static void modifySystemEnvironment(const EnvironmentItems &list); // use with care!!!
private:
FilePath searchInDirectory(const QStringList &execs, const FilePath &directory,
QSet<FilePath> &alreadyChecked) const;
- QMap<QString, QString> m_values;
- OsType m_osType;
};
class QTCREATOR_UTILS_EXPORT EnvironmentProvider
diff --git a/src/libs/utils/environmentdialog.cpp b/src/libs/utils/environmentdialog.cpp
index 07e6155c7d..88311854ec 100644
--- a/src/libs/utils/environmentdialog.cpp
+++ b/src/libs/utils/environmentdialog.cpp
@@ -35,144 +35,20 @@
namespace Utils {
-namespace Internal {
-
-static QList<EnvironmentItem> cleanUp(
- const QList<EnvironmentItem> &items)
-{
- QList<EnvironmentItem> uniqueItems;
- QSet<QString> uniqueSet;
- for (int i = items.count() - 1; i >= 0; i--) {
- EnvironmentItem item = items.at(i);
- if (HostOsInfo::isWindowsHost())
- item.name = item.name.toUpper();
- const QString &itemName = item.name;
- QString emptyName = itemName;
- emptyName.remove(QLatin1Char(' '));
- if (!emptyName.isEmpty() && !uniqueSet.contains(itemName)) {
- uniqueItems.prepend(item);
- uniqueSet.insert(itemName);
- }
- }
- return uniqueItems;
-}
-
-class EnvironmentItemsWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit EnvironmentItemsWidget(QWidget *parent = nullptr);
-
- void setEnvironmentItems(const QList<EnvironmentItem> &items);
- QList<EnvironmentItem> environmentItems() const;
-
- void setPlaceholderText(const QString &text);
-
-private:
- QPlainTextEdit *m_editor;
-};
-
-EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) :
- QWidget(parent)
-{
- m_editor = new QPlainTextEdit(this);
- auto layout = new QVBoxLayout(this);
- layout->setMargin(0);
- layout->addWidget(m_editor);
-}
-
-void EnvironmentItemsWidget::setEnvironmentItems(const QList<EnvironmentItem> &items)
-{
- QList<EnvironmentItem> sortedItems = items;
- EnvironmentItem::sort(&sortedItems);
- const QStringList list = EnvironmentItem::toStringList(sortedItems);
- m_editor->document()->setPlainText(list.join(QLatin1Char('\n')));
-}
-
-QList<EnvironmentItem> EnvironmentItemsWidget::environmentItems() const
-{
- const QStringList list = m_editor->document()->toPlainText().split(QLatin1String("\n"));
- QList<EnvironmentItem> items = EnvironmentItem::fromStringList(list);
- return cleanUp(items);
-}
-
-void EnvironmentItemsWidget::setPlaceholderText(const QString &text)
-{
- m_editor->setPlaceholderText(text);
-}
-
-class EnvironmentDialogPrivate
-{
-public:
- EnvironmentItemsWidget *m_editor;
-};
-
-} // namespace Internal
-
-EnvironmentDialog::EnvironmentDialog(QWidget *parent) :
- QDialog(parent), d(new Internal::EnvironmentDialogPrivate)
-{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- resize(640, 480);
- d->m_editor = new Internal::EnvironmentItemsWidget(this);
- auto box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
- connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept);
- connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject);
-
- auto helpLabel = new QLabel(this);
- helpLabel->setText(tr("Enter one environment variable per line.\n"
- "To set or change a variable, use VARIABLE=VALUE.\n"
- "Existing variables can be referenced in a VALUE with ${OTHER}.\n"
- "To clear a variable, put its name on a line with nothing else on it."));
-
- auto layout = new QVBoxLayout(this);
- layout->addWidget(d->m_editor);
- layout->addWidget(helpLabel);
-
- layout->addWidget(box);
-
- setWindowTitle(tr("Edit Environment"));
-}
-
-EnvironmentDialog::~EnvironmentDialog()
-{
- delete d;
-}
-
-void EnvironmentDialog::setEnvironmentItems(const QList<EnvironmentItem> &items)
-{
- d->m_editor->setEnvironmentItems(items);
-}
-
-QList<EnvironmentItem> EnvironmentDialog::environmentItems() const
-{
- return d->m_editor->environmentItems();
-}
-
-void EnvironmentDialog::setPlaceholderText(const QString &text)
-{
- d->m_editor->setPlaceholderText(text);
-}
-
-QList<EnvironmentItem> EnvironmentDialog::getEnvironmentItems(bool *ok,
- QWidget *parent,
- const QList<EnvironmentItem> &initial,
- const QString &placeholderText,
- Polisher polisher)
-{
- EnvironmentDialog dlg(parent);
- if (polisher)
- polisher(&dlg);
- dlg.setEnvironmentItems(initial);
- dlg.setPlaceholderText(placeholderText);
- bool result = dlg.exec() == QDialog::Accepted;
- if (ok)
- *ok = result;
- if (result)
- return dlg.environmentItems();
- return QList<EnvironmentItem>();
+Utils::optional<EnvironmentItems> EnvironmentDialog::getEnvironmentItems(
+ QWidget *parent, const EnvironmentItems &initial, const QString &placeholderText, Polisher polisher)
+{
+ return getNameValueItems(
+ parent,
+ initial,
+ placeholderText,
+ polisher,
+ tr("Edit Environment"),
+ tr("Enter one environment variable per line.\n"
+ "To set or change a variable, use VARIABLE=VALUE.\n"
+ "Existing variables can be referenced in a VALUE with ${OTHER}.\n"
+ "To clear a variable, put its name on a line with nothing else on it.\n"
+ "To disable a variable, prefix the line with \"#\""));
}
} // namespace Utils
-
-#include "environmentdialog.moc"
diff --git a/src/libs/utils/environmentdialog.h b/src/libs/utils/environmentdialog.h
index be8218508b..6dbb38e191 100644
--- a/src/libs/utils/environmentdialog.h
+++ b/src/libs/utils/environmentdialog.h
@@ -25,36 +25,20 @@
#pragma once
-#include "utils_global.h"
#include "environment.h"
-
-#include <QDialog>
+#include "namevaluesdialog.h"
+#include <thread>
namespace Utils {
-namespace Internal { class EnvironmentDialogPrivate; }
-
-class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public QDialog
+class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public NameValuesDialog
{
Q_OBJECT
public:
- explicit EnvironmentDialog(QWidget *parent = nullptr);
- ~EnvironmentDialog() override;
-
- void setEnvironmentItems(const QList<EnvironmentItem> &items);
- QList<EnvironmentItem> environmentItems() const;
-
- void setPlaceholderText(const QString &text);
-
- using Polisher = std::function<void(QWidget*)>;
- static QList<EnvironmentItem> getEnvironmentItems(bool *ok,
- QWidget *parent = nullptr,
- const QList<EnvironmentItem> &initial = QList<EnvironmentItem>(),
- const QString &placeholderText = QString(),
- Polisher polish = Polisher());
-
-private:
- Internal::EnvironmentDialogPrivate *d;
+ static Utils::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
+ const EnvironmentItems &initial = {},
+ const QString &placeholderText = {},
+ Polisher polish = {});
};
} // namespace Utils
diff --git a/src/libs/utils/environmentfwd.h b/src/libs/utils/environmentfwd.h
new file mode 100644
index 0000000000..04a57418b5
--- /dev/null
+++ b/src/libs/utils/environmentfwd.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+template<typename Type>
+class QList;
+class QTreeView;
+QT_END_NAMESPACE
+
+namespace Utils {
+class NameValueDictionary;
+class NameValueItem;
+using NameValueItems = QVector<NameValueItem>;
+
+class Environment;
+using EnvironmentItem = NameValueItem;
+using EnvironmentItems = NameValueItems;
+
+class PreprocessorMacroDictionary;
+using PreprocessorMacroItem = NameValueItem;
+using PreprocessorMacroItems = NameValueItems;
+
+class NameValueModel;
+class EnvironmentModel;
+} // namespace Utils
diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp
index 045a6d2b65..c7efcce930 100644
--- a/src/libs/utils/environmentmodel.cpp
+++ b/src/libs/utils/environmentmodel.cpp
@@ -33,360 +33,12 @@
#include <QFont>
namespace Utils {
-namespace Internal {
-
-class EnvironmentModelPrivate
-{
-public:
- void updateResultEnvironment()
- {
- m_resultEnvironment = m_baseEnvironment;
- m_resultEnvironment.modify(m_items);
- // Add removed variables again and mark them as "<UNSET>" so
- // that the user can actually see those removals:
- foreach (const EnvironmentItem &item, m_items) {
- if (item.operation == EnvironmentItem::Unset)
- m_resultEnvironment.set(item.name, EnvironmentModel::tr("<UNSET>"));
- }
- }
-
- int findInChanges(const QString &name) const
- {
- for (int i=0; i<m_items.size(); ++i)
- if (m_items.at(i).name == name)
- return i;
- return -1;
- }
-
- int findInResultInsertPosition(const QString &name) const
- {
- Environment::const_iterator it;
- int i = 0;
- for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
- if (m_resultEnvironment.key(it) > name)
- return i;
- return m_resultEnvironment.size();
- }
-
- int findInResult(const QString &name) const
- {
- Environment::const_iterator it;
- int i = 0;
- for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
- if (m_resultEnvironment.key(it) == name)
- return i;
- return -1;
- }
-
- Environment m_baseEnvironment;
- Environment m_resultEnvironment;
- QList<EnvironmentItem> m_items;
-};
-
-} // namespace Internal
-
-EnvironmentModel::EnvironmentModel(QObject *parent) :
- QAbstractTableModel(parent),
- d(new Internal::EnvironmentModelPrivate)
-{ }
-
-EnvironmentModel::~EnvironmentModel()
-{
- delete d;
-}
-
-QString EnvironmentModel::indexToVariable(const QModelIndex &index) const
+const Environment &EnvironmentModel::baseEnvironment() const
{
- return d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row());
+ return static_cast<const Environment &>(baseNameValueDictionary());
}
-
void EnvironmentModel::setBaseEnvironment(const Environment &env)
{
- if (d->m_baseEnvironment == env)
- return;
- beginResetModel();
- d->m_baseEnvironment = env;
- d->updateResultEnvironment();
- endResetModel();
-}
-
-int EnvironmentModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return 0;
-
- return d->m_resultEnvironment.size();
-}
-int EnvironmentModel::columnCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return 0;
-
- return 2;
-}
-
-bool EnvironmentModel::changes(const QString &name) const
-{
- return d->findInChanges(name) >= 0;
-}
-
-Environment EnvironmentModel::baseEnvironment() const
-{
- return d->m_baseEnvironment;
-}
-
-QVariant EnvironmentModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole) {
- if (index.column() == 0) {
- return d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row());
- } else if (index.column() == 1) {
- // Do not return "<UNSET>" when editing a previously unset variable:
- if (role == Qt::EditRole) {
- int pos = d->findInChanges(indexToVariable(index));
- if (pos >= 0)
- return d->m_items.at(pos).value;
- }
- QString value = d->m_resultEnvironment.value(d->m_resultEnvironment.constBegin() + index.row());
- if (role == Qt::ToolTipRole && value.length() > 80) {
- // Use html to enable text wrapping
- value = value.toHtmlEscaped();
- value.prepend(QLatin1String("<html><body>"));
- value.append(QLatin1String("</body></html>"));
- }
- return value;
- }
- }
- if (role == Qt::FontRole) {
- // check whether this environment variable exists in d->m_items
- if (changes(d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row()))) {
- QFont f;
- f.setBold(true);
- return QVariant(f);
- }
- return QFont();
- }
- return QVariant();
-}
-
-Qt::ItemFlags EnvironmentModel::flags(const QModelIndex &index) const
-{
- Q_UNUSED(index)
- return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
-}
-
-QVariant EnvironmentModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Vertical || role != Qt::DisplayRole)
- return QVariant();
- return section == 0 ? tr("Variable") : tr("Value");
+ setBaseNameValueDictionary(env);
}
-
-/// *****************
-/// Utility functions
-/// *****************
-QModelIndex EnvironmentModel::variableToIndex(const QString &name) const
-{
- int row = d->findInResult(name);
- if (row == -1)
- return QModelIndex();
- return index(row, 0);
-}
-
-bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- if (!index.isValid() || role != Qt::EditRole)
- return false;
-
- // ignore changes to already set values:
- if (data(index, role) == value)
- return true;
-
- const QString oldName = data(this->index(index.row(), 0, QModelIndex())).toString();
- const QString oldValue = data(this->index(index.row(), 1, QModelIndex()), Qt::EditRole).toString();
- int changesPos = d->findInChanges(oldName);
-
- if (index.column() == 0) {
- //fail if a variable with the same name already exists
- const QString &newName = HostOsInfo::isWindowsHost()
- ? value.toString().toUpper() : value.toString();
- if (newName.isEmpty() || newName.contains('='))
- return false;
- // Does the new name exist already?
- if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty())
- return false;
-
- EnvironmentItem newVariable(newName, oldValue);
-
- if (changesPos != -1)
- resetVariable(oldName); // restore the original base variable again
-
- QModelIndex newIndex = addVariable(newVariable); // add the new variable
- emit focusIndex(newIndex.sibling(newIndex.row(), 1)); // hint to focus on the value
- return true;
- } else if (index.column() == 1) {
- // We are changing an existing value:
- const QString stringValue = value.toString();
- if (changesPos != -1) {
- // We have already changed this value
- if (d->m_baseEnvironment.hasKey(oldName) && stringValue == d->m_baseEnvironment.value(oldName)) {
- // ... and now went back to the base value
- d->m_items.removeAt(changesPos);
- } else {
- // ... and changed it again
- d->m_items[changesPos].value = stringValue;
- d->m_items[changesPos].operation = EnvironmentItem::Set;
- }
- } else {
- // Add a new change item:
- d->m_items.append(EnvironmentItem(oldName, stringValue));
- }
- d->updateResultEnvironment();
- emit dataChanged(index, index);
- emit userChangesChanged();
- return true;
- }
- return false;
-}
-
-QModelIndex EnvironmentModel::addVariable()
-{
- //: Name when inserting a new variable
- return addVariable(EnvironmentItem(tr("<VARIABLE>"),
- //: Value when inserting a new variable
- tr("<VALUE>")));
-}
-
-QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item)
-{
-
- // Return existing index if the name is already in the result set:
- int pos = d->findInResult(item.name);
- if (pos >= 0 && pos < d->m_resultEnvironment.size())
- return index(pos, 0, QModelIndex());
-
- int insertPos = d->findInResultInsertPosition(item.name);
- int changePos = d->findInChanges(item.name);
- if (d->m_baseEnvironment.hasKey(item.name)) {
- // We previously unset this!
- Q_ASSERT(changePos >= 0);
- // Do not insert a line here as we listed the variable as <UNSET> before!
- Q_ASSERT(d->m_items.at(changePos).name == item.name);
- Q_ASSERT(d->m_items.at(changePos).operation == EnvironmentItem::Unset);
- Q_ASSERT(d->m_items.at(changePos).value.isEmpty());
- d->m_items[changePos] = item;
- emit dataChanged(index(insertPos, 0, QModelIndex()), index(insertPos, 1, QModelIndex()));
- } else {
- // We add something that is not in the base environment
- // Insert a new line!
- beginInsertRows(QModelIndex(), insertPos, insertPos);
- Q_ASSERT(changePos < 0);
- d->m_items.append(item);
- d->updateResultEnvironment();
- endInsertRows();
- }
- emit userChangesChanged();
- return index(insertPos, 0, QModelIndex());
-}
-
-void EnvironmentModel::resetVariable(const QString &name)
-{
- int rowInChanges = d->findInChanges(name);
- if (rowInChanges < 0)
- return;
-
- int rowInResult = d->findInResult(name);
- if (rowInResult < 0)
- return;
-
- if (d->m_baseEnvironment.hasKey(name)) {
- d->m_items.removeAt(rowInChanges);
- d->updateResultEnvironment();
- emit dataChanged(index(rowInResult, 0, QModelIndex()), index(rowInResult, 1, QModelIndex()));
- emit userChangesChanged();
- } else {
- // Remove the line completely!
- beginRemoveRows(QModelIndex(), rowInResult, rowInResult);
- d->m_items.removeAt(rowInChanges);
- d->updateResultEnvironment();
- endRemoveRows();
- emit userChangesChanged();
- }
-}
-
-void EnvironmentModel::unsetVariable(const QString &name)
-{
- // This does not change the number of rows as we will display a <UNSET>
- // in place of the original variable!
- int row = d->findInResult(name);
- if (row < 0)
- return;
-
- // look in d->m_items for the variable
- int pos = d->findInChanges(name);
- if (pos != -1) {
- d->m_items[pos].operation = EnvironmentItem::Unset;
- d->m_items[pos].value.clear();
- d->updateResultEnvironment();
- emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
- emit userChangesChanged();
- return;
- }
- d->m_items.append(EnvironmentItem(name, QString(), EnvironmentItem::Unset));
- d->updateResultEnvironment();
- emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
- emit userChangesChanged();
-}
-
-bool EnvironmentModel::canUnset(const QString &name)
-{
- int pos = d->findInChanges(name);
- if (pos != -1)
- return d->m_items.at(pos).operation == EnvironmentItem::Unset;
- else
- return false;
-}
-
-bool EnvironmentModel::canReset(const QString &name)
-{
- return d->m_baseEnvironment.hasKey(name);
-}
-
-QList<EnvironmentItem> EnvironmentModel::userChanges() const
-{
- return d->m_items;
-}
-
-void EnvironmentModel::setUserChanges(const QList<EnvironmentItem> &list)
-{
- QList<EnvironmentItem> filtered = Utils::filtered(list, [](const EnvironmentItem &i) {
- return i.name != "export " && !i.name.contains('=');
- });
- // We assume nobody is reordering the items here.
- if (filtered == d->m_items)
- return;
- beginResetModel();
- d->m_items = filtered;
- for (EnvironmentItem &item : d->m_items) {
- QString &name = item.name;
- name = name.trimmed();
- if (name.startsWith("export "))
- name = name.mid(7).trimmed();
- if (d->m_baseEnvironment.osType() == OsTypeWindows) {
- // Environment variable names are case-insensitive under windows, but we still
- // want to preserve the case of pre-existing variables.
- auto it = d->m_baseEnvironment.constFind(name);
- if (it != d->m_baseEnvironment.constEnd())
- name = d->m_baseEnvironment.key(it);
- }
- }
-
- d->updateResultEnvironment();
- endResetModel();
- emit userChangesChanged();
-}
-
} // namespace Utils
diff --git a/src/libs/utils/environmentmodel.h b/src/libs/utils/environmentmodel.h
index db20224651..ac5f017448 100644
--- a/src/libs/utils/environmentmodel.h
+++ b/src/libs/utils/environmentmodel.h
@@ -25,55 +25,17 @@
#pragma once
-#include "utils_global.h"
-
-#include <QAbstractTableModel>
+#include "namevaluemodel.h"
namespace Utils {
-class Environment;
-class EnvironmentItem;
-
-namespace Internal { class EnvironmentModelPrivate; }
-class QTCREATOR_UTILS_EXPORT EnvironmentModel : public QAbstractTableModel
+class QTCREATOR_UTILS_EXPORT EnvironmentModel : public NameValueModel
{
Q_OBJECT
public:
- explicit EnvironmentModel(QObject *parent = nullptr);
- ~EnvironmentModel() override;
-
- int rowCount(const QModelIndex &parent) const override;
- int columnCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const override;
-
- QModelIndex addVariable();
- QModelIndex addVariable(const EnvironmentItem &item);
- void resetVariable(const QString &name);
- void unsetVariable(const QString &name);
- bool canUnset(const QString &name);
- bool canReset(const QString &name);
- QString indexToVariable(const QModelIndex &index) const;
- QModelIndex variableToIndex(const QString &name) const;
- bool changes(const QString &key) const;
- Environment baseEnvironment() const;
+ const Environment &baseEnvironment() const;
void setBaseEnvironment(const Environment &env);
- QList<EnvironmentItem> userChanges() const;
- void setUserChanges(const QList<EnvironmentItem> &list);
-
-signals:
- void userChangesChanged();
- /// Hint to the view where it should make sense to focus on next
- // This is a hack since there is no way for a model to suggest
- // the next interesting place to focus on to the view.
- void focusIndex(const QModelIndex &index);
-
-private:
- Internal::EnvironmentModelPrivate *d;
};
} // namespace Utils
diff --git a/src/libs/utils/fadingindicator.cpp b/src/libs/utils/fadingindicator.cpp
index 4e9b5067be..31ebbb7916 100644
--- a/src/libs/utils/fadingindicator.cpp
+++ b/src/libs/utils/fadingindicator.cpp
@@ -56,7 +56,7 @@ public:
font.setPixelSize(size == FadingIndicator::LargeText ? 45 : 22);
m_label->setFont(font);
QPalette pal = palette();
- pal.setColor(QPalette::Foreground, pal.color(QPalette::Background));
+ pal.setColor(QPalette::WindowText, pal.color(QPalette::Window));
m_label->setPalette(pal);
auto layout = new QHBoxLayout;
setLayout(layout);
@@ -107,7 +107,7 @@ protected:
if (!m_pixmap.isNull()) {
p.drawPixmap(rect(), m_pixmap);
} else {
- p.setBrush(palette().color(QPalette::Foreground));
+ p.setBrush(palette().color(QPalette::WindowText));
p.setPen(Qt::NoPen);
p.drawRoundedRect(rect(), 15, 15);
}
diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp
index 6b5b11995c..d67c336544 100644
--- a/src/libs/utils/fancylineedit.cpp
+++ b/src/libs/utils/fancylineedit.cpp
@@ -23,6 +23,7 @@
**
****************************************************************************/
+#include "camelcasecursor.h"
#include "execmenu.h"
#include "fancylineedit.h"
#include "historycompleter.h"
@@ -35,7 +36,9 @@
#include <QAbstractItemView>
#include <QDebug>
#include <QKeyEvent>
+#include <QKeySequence>
#include <QMenu>
+#include <QShortcut>
#include <QStylePainter>
#include <QPropertyAnimation>
#include <QStyle>
@@ -80,6 +83,31 @@ enum { margin = 6 };
namespace Utils {
+static bool camelCaseNavigation = false;
+
+class CompletionShortcut : public QObject
+{
+ Q_OBJECT
+
+public:
+ void setKeySequence(const QKeySequence &key)
+ {
+ if (m_key != key) {
+ m_key = key;
+ emit keyChanged(key);
+ }
+ }
+ QKeySequence key() const { return m_key; }
+
+signals:
+ void keyChanged(const QKeySequence &key);
+
+private:
+ QKeySequence m_key = Qt::Key_Space + HostOsInfo::controlModifier();
+};
+Q_GLOBAL_STATIC(CompletionShortcut, completionShortcut)
+
+
// --------- FancyLineEditPrivate
class FancyLineEditPrivate : public QObject
{
@@ -91,6 +119,7 @@ public:
FancyLineEdit *m_lineEdit;
IconButton *m_iconbutton[2];
HistoryCompleter *m_historyCompleter = nullptr;
+ QShortcut m_completionShortcut;
FancyLineEdit::ValidationFunction m_validationFunction = &FancyLineEdit::validateWithValidator;
QString m_oldText;
QMenu *m_menu[2];
@@ -110,10 +139,15 @@ public:
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
QObject(parent),
- m_lineEdit(parent)
+ m_lineEdit(parent),
+ m_completionShortcut(completionShortcut()->key(), parent)
{
m_okTextColor = parent->palette().color(QPalette::Active, QPalette::Text);
+ m_completionShortcut.setContext(Qt::WidgetShortcut);
+ connect(completionShortcut(), &CompletionShortcut::keyChanged,
+ &m_completionShortcut, &QShortcut::setKey);
+
for (int i = 0; i < 2; ++i) {
m_iconbutton[i] = new IconButton(parent);
m_iconbutton[i]->installEventFilter(this);
@@ -163,6 +197,12 @@ FancyLineEdit::FancyLineEdit(QWidget *parent) :
connect(d->m_iconbutton[Left], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(d->m_iconbutton[Right], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::validate);
+ connect(&d->m_completionShortcut, &QShortcut::activated, this, [this] {
+ if (!completer())
+ return;
+ completer()->setCompletionPrefix(text().left(cursorPosition()));
+ completer()->complete();
+ });
}
FancyLineEdit::~FancyLineEdit()
@@ -328,6 +368,29 @@ void FancyLineEdit::onEditingFinished()
d->m_historyCompleter->addEntry(text());
}
+void FancyLineEdit::keyPressEvent(QKeyEvent *event)
+{
+ const QTextCursor::MoveMode mode = (event->modifiers() & Qt::ShiftModifier)
+ ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor;
+
+ if (camelCaseNavigation && event == QKeySequence::MoveToPreviousWord)
+ CamelCaseCursor::left(this, mode);
+ else if (camelCaseNavigation && event == QKeySequence::MoveToNextWord)
+ CamelCaseCursor::right(this, mode);
+ else
+ QLineEdit::keyPressEvent(event);
+}
+
+void FancyLineEdit::setCamelCaseNavigationEnabled(bool enabled)
+{
+ camelCaseNavigation = enabled;
+}
+
+void FancyLineEdit::setCompletionShortcut(const QKeySequence &shortcut)
+{
+ completionShortcut()->setKeySequence(shortcut);
+}
+
void FancyLineEdit::setSpecialCompleter(QCompleter *completer)
{
QTC_ASSERT(!d->m_historyCompleter, return);
@@ -416,7 +479,7 @@ FancyLineEdit::ValidationFunction FancyLineEdit::defaultValidationFunction()
bool FancyLineEdit::validateWithValidator(FancyLineEdit *edit, QString *errorMessage)
{
- Q_UNUSED(errorMessage);
+ Q_UNUSED(errorMessage)
if (const QValidator *v = edit->validator()) {
QString tmp = edit->text();
int pos = edit->cursorPosition();
@@ -565,3 +628,5 @@ void IconButton::keyReleaseEvent(QKeyEvent *ke)
}
} // namespace Utils
+
+#include <fancylineedit.moc>
diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h
index fd0b121d88..9f738fb618 100644
--- a/src/libs/utils/fancylineedit.h
+++ b/src/libs/utils/fancylineedit.h
@@ -34,6 +34,7 @@
QT_BEGIN_NAMESPACE
class QEvent;
+class QKeySequence;
QT_END_NAMESPACE
namespace Utils {
@@ -141,9 +142,13 @@ public:
void validate();
void onEditingFinished();
+ static void setCamelCaseNavigationEnabled(bool enabled);
+ static void setCompletionShortcut(const QKeySequence &shortcut);
+
protected:
// Custom behaviour can be added here.
virtual void handleChanged(const QString &) {}
+ void keyPressEvent(QKeyEvent *event) override;
signals:
void buttonClicked(Utils::FancyLineEdit::Side side);
@@ -170,6 +175,8 @@ private:
void updateMargins();
void updateButtonPositions();
+ bool camelCaseBackward(bool mark);
+ bool camelCaseForward(bool mark);
friend class FancyLineEditPrivate;
FancyLineEditPrivate *d;
diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp
index 9a5c84894c..d49473beb7 100644
--- a/src/libs/utils/fancymainwindow.cpp
+++ b/src/libs/utils/fancymainwindow.cpp
@@ -182,7 +182,7 @@ public:
m_maximumActiveSize = QSize(maxWidth, activeHeight);
auto layout = new QHBoxLayout(this);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->setContentsMargins(4, 0, 0, 0);
layout->addWidget(m_titleLabel);
@@ -468,12 +468,9 @@ void FancyMainWindow::handleVisibilityChanged(bool visible)
void FancyMainWindow::saveSettings(QSettings *settings) const
{
- QHash<QString, QVariant> hash = saveSettings();
- QHashIterator<QString, QVariant> it(hash);
- while (it.hasNext()) {
- it.next();
+ const QHash<QString, QVariant> hash = saveSettings();
+ for (auto it = hash.cbegin(), end = hash.cend(); it != end; ++it)
settings->setValue(it.key(), it.value());
- }
}
void FancyMainWindow::restoreSettings(const QSettings *settings)
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index acf9c6190d..8608756627 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -74,6 +74,32 @@ namespace Utils {
*/
+CommandLine::CommandLine() = default;
+
+CommandLine::CommandLine(const QString &executable)
+ : m_executable(FilePath::fromString(executable))
+{}
+
+CommandLine::CommandLine(const FilePath &executable)
+ : m_executable(executable)
+{}
+
+CommandLine::CommandLine(const QString &exe, const QStringList &args)
+ : CommandLine(FilePath::fromString(exe), args)
+{}
+
+CommandLine::CommandLine(const FilePath &exe, const QStringList &args)
+ : m_executable(exe)
+{
+ addArgs(args);
+}
+
+CommandLine::CommandLine(const FilePath &exe, const QString &args, RawType)
+ : m_executable(exe)
+{
+ addArgs(args, Raw);
+}
+
void CommandLine::addArg(const QString &arg, OsType osType)
{
QtcProcess::addArg(&m_arguments, arg, osType);
@@ -85,7 +111,7 @@ void CommandLine::addArgs(const QStringList &inArgs, OsType osType)
addArg(arg, osType);
}
-void CommandLine::addArgs(const QString &inArgs)
+void CommandLine::addArgs(const QString &inArgs, RawType)
{
QtcProcess::addArgs(&m_arguments, inArgs);
}
@@ -95,6 +121,11 @@ QString CommandLine::toUserOutput() const
return m_executable.toUserOutput() + ' ' + m_arguments;
}
+QStringList CommandLine::splitArguments(OsType osType) const
+{
+ return QtcProcess::splitArgs(m_arguments, osType);
+}
+
/*! \class Utils::FileUtils
\brief The FileUtils class contains file and directory related convenience
@@ -705,7 +736,13 @@ QString FilePath::toUserOutput() const
return m_url.toString();
}
-QString FilePath::fileName(int pathComponents) const
+QString FilePath::fileName() const
+{
+ const QChar slash = QLatin1Char('/');
+ return m_data.mid(m_data.lastIndexOf(slash) + 1);
+}
+
+QString FilePath::fileNameWithPathComponents(int pathComponents) const
{
if (pathComponents < 0)
return m_data;
@@ -737,6 +774,13 @@ bool FilePath::exists() const
return !isEmpty() && QFileInfo::exists(m_data);
}
+/// \returns a bool indicating whether a path is writable.
+bool FilePath::isWritablePath() const
+{
+ const QFileInfo fi{m_data};
+ return exists() && fi.isDir() && fi.isWritable();
+}
+
/// Find the parent directory of a given directory.
/// Returns an empty FilePath if the current directory is already
@@ -892,6 +936,12 @@ bool FilePath::isLocal() const
return m_url.isEmpty() || m_url.isLocalFile();
}
+bool FilePath::isDir() const
+{
+ QTC_CHECK(m_url.isEmpty()); // FIXME: Not implemented yet.
+ return QFileInfo(m_data).isDir();
+}
+
/// \returns the relativeChildPath of FilePath to parent if FilePath is a child of parent
/// \note returns a empty FilePath if FilePath is not a child of parent
/// That is, this never returns a path starting with "../"
diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h
index ec018b9c3b..2026ad1068 100644
--- a/src/libs/utils/fileutils.h
+++ b/src/libs/utils/fileutils.h
@@ -80,8 +80,10 @@ public:
QString toUserOutput() const;
QString shortNativePath() const;
- QString fileName(int pathComponents = 0) const;
+ QString fileName() const;
+ QString fileNameWithPathComponents(int pathComponents) const;
bool exists() const;
+ bool isWritablePath() const;
FilePath parentDir() const;
@@ -96,8 +98,9 @@ public:
bool isChildOf(const FilePath &s) const;
bool isChildOf(const QDir &dir) const;
bool endsWith(const QString &s) const;
- bool isLocal() const;
+ bool isLocal() const;
+ bool isDir() const;
bool isNewerThan(const QDateTime &timeStamp) const;
FilePath relativeChildPath(const FilePath &parent) const;
@@ -111,7 +114,7 @@ public:
uint hash(uint seed) const;
- // NOTE: FileName operations on FilePath created from URL currenly
+ // NOTE: FilePath operations on FilePath created from URL currenly
// do not work except for .toVariant() and .toUrl().
static FilePath fromUrl(const QUrl &url);
QUrl toUrl() const;
@@ -125,26 +128,28 @@ QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FilePath &f
using FilePathList = QList<FilePath>;
-using FileName = FilePath;
-using FileNameList = FilePathList;
-
class QTCREATOR_UTILS_EXPORT CommandLine
{
public:
- CommandLine() {}
+ enum RawType { Raw };
- CommandLine(const FilePath &executable, const QString &arguments)
- : m_executable(executable), m_arguments(arguments)
- {}
+ CommandLine();
+ explicit CommandLine(const QString &executable);
+ explicit CommandLine(const FilePath &executable);
+ CommandLine(const QString &exe, const QStringList &args);
+ CommandLine(const FilePath &exe, const QStringList &args);
+ CommandLine(const FilePath &exe, const QString &unparsedArgs, RawType);
void addArg(const QString &arg, OsType osType = HostOsInfo::hostOs());
void addArgs(const QStringList &inArgs, OsType osType = HostOsInfo::hostOs());
- void addArgs(const QString &inArgs);
+
+ void addArgs(const QString &inArgs, RawType);
QString toUserOutput() const;
FilePath executable() const { return m_executable; }
QString arguments() const { return m_arguments; }
+ QStringList splitArguments(OsType osType = HostOsInfo::hostOs()) const;
private:
FilePath m_executable;
@@ -298,3 +303,4 @@ template<> struct hash<Utils::FilePath>
} // namespace std
Q_DECLARE_METATYPE(Utils::FilePath)
+Q_DECLARE_METATYPE(Utils::CommandLine)
diff --git a/src/libs/utils/flowlayout.cpp b/src/libs/utils/flowlayout.cpp
index d138a15149..fe8c7900cd 100644
--- a/src/libs/utils/flowlayout.cpp
+++ b/src/libs/utils/flowlayout.cpp
@@ -121,7 +121,9 @@ QSize FlowLayout::minimumSize() const
foreach (item, itemList)
size = size.expandedTo(item->minimumSize());
- size += QSize(2*margin(), 2*margin());
+ int left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ size += QSize(left + right, top + bottom);
return size;
}
diff --git a/src/libs/utils/fuzzymatcher.cpp b/src/libs/utils/fuzzymatcher.cpp
index 60b5d3aaa2..6a3e0e5015 100644
--- a/src/libs/utils/fuzzymatcher.cpp
+++ b/src/libs/utils/fuzzymatcher.cpp
@@ -72,10 +72,10 @@ QRegularExpression FuzzyMatcher::createRegExp(
const QLatin1String lowercaseWordFirst("(?<=\\b|[A-Z0-9_])");
const QLatin1String uppercaseWordContinuation("[a-z0-9_]*");
const QLatin1String lowercaseWordContinuation("(?:[a-zA-Z0-9]*_)?");
- const QLatin1String upperSnakeWordContinuation("[A-Z0-9]*_");
+ const QLatin1String upperSnakeWordContinuation("[A-Z0-9]*_?");
keyRegExp += "(?:";
for (const QChar &c : pattern) {
- if (!c.isLetter()) {
+ if (!c.isLetterOrNumber()) {
if (c == question) {
keyRegExp += '.';
plainRegExp += ").(";
@@ -122,6 +122,21 @@ QRegularExpression FuzzyMatcher::createRegExp(
return QRegularExpression('(' + plainRegExp + ")|" + keyRegExp);
}
+/**
+ \overload
+ This overload eases the construction of a fuzzy regexp from a given
+ Qt::CaseSensitivity.
+ */
+QRegularExpression FuzzyMatcher::createRegExp(const QString &pattern,
+ Qt::CaseSensitivity caseSensitivity)
+{
+ const CaseSensitivity sensitivity = (caseSensitivity == Qt::CaseSensitive)
+ ? CaseSensitivity::CaseSensitive
+ : CaseSensitivity::CaseInsensitive;
+
+ return createRegExp(pattern, sensitivity);
+}
+
/*!
* \brief Returns a list of matched character positions and their matched lengths for the
* given regular expression \a match.
diff --git a/src/libs/utils/fuzzymatcher.h b/src/libs/utils/fuzzymatcher.h
index 753742ac22..8e90ebe796 100644
--- a/src/libs/utils/fuzzymatcher.h
+++ b/src/libs/utils/fuzzymatcher.h
@@ -54,5 +54,7 @@ public:
static QRegularExpression createRegExp(const QString &pattern,
CaseSensitivity caseSensitivity = CaseSensitivity::CaseInsensitive);
+ static QRegularExpression createRegExp(const QString &pattern,
+ Qt::CaseSensitivity caseSensitivity);
static HighlightingPositions highlightingPositions(const QRegularExpressionMatch &match);
};
diff --git a/src/libs/utils/images/download_arrow.png b/src/libs/utils/images/download_arrow.png
new file mode 100644
index 0000000000..c73bf628f4
--- /dev/null
+++ b/src/libs/utils/images/download_arrow.png
Binary files differ
diff --git a/src/libs/utils/images/download_arrow@2x.png b/src/libs/utils/images/download_arrow@2x.png
new file mode 100644
index 0000000000..aabf6fce78
--- /dev/null
+++ b/src/libs/utils/images/download_arrow@2x.png
Binary files differ
diff --git a/src/libs/utils/images/download_base.png b/src/libs/utils/images/download_base.png
new file mode 100644
index 0000000000..25163bef64
--- /dev/null
+++ b/src/libs/utils/images/download_base.png
Binary files differ
diff --git a/src/libs/utils/images/download_base@2x.png b/src/libs/utils/images/download_base@2x.png
new file mode 100644
index 0000000000..a5e7405ac3
--- /dev/null
+++ b/src/libs/utils/images/download_base@2x.png
Binary files differ
diff --git a/src/libs/utils/images/online.png b/src/libs/utils/images/online.png
new file mode 100644
index 0000000000..2e053b8792
--- /dev/null
+++ b/src/libs/utils/images/online.png
Binary files differ
diff --git a/src/libs/utils/images/online@2x.png b/src/libs/utils/images/online@2x.png
new file mode 100644
index 0000000000..149a4a0dd6
--- /dev/null
+++ b/src/libs/utils/images/online@2x.png
Binary files differ
diff --git a/src/libs/utils/images/run_file.png b/src/libs/utils/images/run_file.png
new file mode 100644
index 0000000000..6a3bfc766f
--- /dev/null
+++ b/src/libs/utils/images/run_file.png
Binary files differ
diff --git a/src/libs/utils/images/run_file@2x.png b/src/libs/utils/images/run_file@2x.png
new file mode 100644
index 0000000000..4b386818c9
--- /dev/null
+++ b/src/libs/utils/images/run_file@2x.png
Binary files differ
diff --git a/src/libs/utils/images/runselected_boxes.png b/src/libs/utils/images/runselected_boxes.png
new file mode 100644
index 0000000000..6e39f2ee0b
--- /dev/null
+++ b/src/libs/utils/images/runselected_boxes.png
Binary files differ
diff --git a/src/libs/utils/images/runselected_boxes@2x.png b/src/libs/utils/images/runselected_boxes@2x.png
new file mode 100644
index 0000000000..55e5863a52
--- /dev/null
+++ b/src/libs/utils/images/runselected_boxes@2x.png
Binary files differ
diff --git a/src/libs/utils/images/runselected_tickmarks.png b/src/libs/utils/images/runselected_tickmarks.png
new file mode 100644
index 0000000000..6296f8748d
--- /dev/null
+++ b/src/libs/utils/images/runselected_tickmarks.png
Binary files differ
diff --git a/src/libs/utils/images/runselected_tickmarks@2x.png b/src/libs/utils/images/runselected_tickmarks@2x.png
new file mode 100644
index 0000000000..75252f173c
--- /dev/null
+++ b/src/libs/utils/images/runselected_tickmarks@2x.png
Binary files differ
diff --git a/src/libs/utils/listmodel.h b/src/libs/utils/listmodel.h
index 5f4de811e6..4a28041b66 100644
--- a/src/libs/utils/listmodel.h
+++ b/src/libs/utils/listmodel.h
@@ -67,9 +67,9 @@ public:
void clear() { rootItem()->removeChildren(); }
- using const_iterator = typename QVector<TreeItem *>::const_iterator;
- const_iterator begin() const { return rootItem()->begin(); }
- const_iterator end() const { return rootItem()->end(); }
+ using const_iterator = typename QVector<ChildType *>::const_iterator;
+ const_iterator begin() const { return const_iterator(rootItem()->begin()); }
+ const_iterator end() const { return const_iterator(rootItem()->end()); }
};
diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp
index a41fbde31d..6a64398e5b 100644
--- a/src/libs/utils/macroexpander.cpp
+++ b/src/libs/utils/macroexpander.cpp
@@ -313,11 +313,8 @@ QVariant MacroExpander::expandVariant(const QVariant &v) const
} else if (type == QMetaType::QVariantMap) {
const auto map = v.toMap();
QVariantMap result;
- QMapIterator<QString, QVariant> it(map);
- while (it.hasNext()) {
- it.next();
+ for (auto it = map.cbegin(), end = map.cend(); it != end; ++it)
result.insert(it.key(), expandVariant(it.value()));
- }
return result;
}
return v;
diff --git a/src/libs/utils/mimetypes/mimeglobpattern.cpp b/src/libs/utils/mimetypes/mimeglobpattern.cpp
index cdcd77c6b1..097fca365b 100644
--- a/src/libs/utils/mimetypes/mimeglobpattern.cpp
+++ b/src/libs/utils/mimetypes/mimeglobpattern.cpp
@@ -181,10 +181,9 @@ void MimeAllGlobPatterns::addGlob(const MimeGlobPattern &glob)
void MimeAllGlobPatterns::removeMimeType(const QString &mimeType)
{
- QMutableHashIterator<QString, QStringList> it(m_fastPatterns);
- while (it.hasNext()) {
- it.next().value().removeAll(mimeType);
- }
+ for (QStringList &x : m_fastPatterns)
+ x.removeAll(mimeType);
+
m_highWeightGlobs.removeMimeType(mimeType);
m_lowWeightGlobs.removeMimeType(mimeType);
}
diff --git a/src/libs/utils/mimetypes/mimeglobpattern_p.h b/src/libs/utils/mimetypes/mimeglobpattern_p.h
index accbab0646..ecbfb02ce9 100644
--- a/src/libs/utils/mimetypes/mimeglobpattern_p.h
+++ b/src/libs/utils/mimetypes/mimeglobpattern_p.h
@@ -114,11 +114,10 @@ public:
*/
void removeMimeType(const QString &mimeType)
{
- QMutableListIterator<MimeGlobPattern> it(*this);
- while (it.hasNext()) {
- if (it.next().mimeType() == mimeType)
- it.remove();
- }
+ auto isMimeTypeEqual = [&mimeType](const MimeGlobPattern &pattern) {
+ return pattern.mimeType() == mimeType;
+ };
+ erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
}
void match(MimeGlobMatchResult &result, const QString &fileName) const;
diff --git a/src/libs/utils/mimetypes/mimeprovider.cpp b/src/libs/utils/mimetypes/mimeprovider.cpp
index e9ed226063..11f5a17303 100644
--- a/src/libs/utils/mimetypes/mimeprovider.cpp
+++ b/src/libs/utils/mimetypes/mimeprovider.cpp
@@ -767,13 +767,12 @@ void MimeXMLProvider::setGlobPatternsForMimeType(const MimeType &mimeType, const
void MimeXMLProvider::setMagicRulesForMimeType(const MimeType &mimeType, const QMap<int, QList<MimeMagicRule> > &rules)
{
// remove all previous rules
- QMutableListIterator<MimeMagicRuleMatcher> matcherIt(m_magicMatchers);
- while (matcherIt.hasNext()) {
- if (matcherIt.next().mimetype() == mimeType.name())
- matcherIt.remove();
+ for (int i = 0; i < m_magicMatchers.size(); ++i) {
+ if (m_magicMatchers.at(i).mimetype() == mimeType.name())
+ m_magicMatchers.removeAt(i--);
}
// add new rules
- for (auto it = rules.constBegin(); it != rules.constEnd(); ++it) {
+ for (auto it = rules.cbegin(); it != rules.cend(); ++it) {
MimeMagicRuleMatcher matcher(mimeType.name(), it.key()/*priority*/);
matcher.addRules(it.value());
addMagicMatcher(matcher);
@@ -804,15 +803,14 @@ void MimeXMLProvider::ensureLoaded()
// add custom mime types first, which override any default from freedesktop.org.xml
MimeTypeParser parser(*this);
- QHashIterator<QString, QByteArray> it(m_additionalData);
- while (it.hasNext()) {
- it.next();
+ for (auto it = m_additionalData.constBegin(), end = m_additionalData.constEnd(); it != end; ++it) {
QString errorMessage;
if (!parser.parse(it.value(), it.key(), &errorMessage)) {
qWarning("MimeDatabase: Error loading %s\n%s", qPrintable(it.key()),
qPrintable(errorMessage));
}
}
+
foreach (const QString &file, allFiles)
load(file);
}
diff --git a/src/libs/utils/namevaluedictionary.cpp b/src/libs/utils/namevaluedictionary.cpp
new file mode 100644
index 0000000000..b6218d9592
--- /dev/null
+++ b/src/libs/utils/namevaluedictionary.cpp
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "algorithm.h"
+#include "namevaluedictionary.h"
+#include "qtcassert.h"
+
+#include <QDir>
+
+namespace Utils {
+
+NameValueDictionary::NameValueDictionary(const QStringList &env, OsType osType)
+ : m_osType(osType)
+{
+ for (const QString &s : env) {
+ int i = s.indexOf('=', 1);
+ if (i >= 0) {
+ const QString key = s.left(i);
+ if (!key.contains('=')) {
+ const QString value = s.mid(i + 1);
+ set(key, value);
+ }
+ }
+ }
+}
+
+NameValueDictionary::NameValueDictionary(const NameValuePairs &nameValues)
+{
+ for (const auto &nameValue : nameValues)
+ set(nameValue.first, nameValue.second);
+}
+
+NameValueMap::iterator NameValueDictionary::findKey(const QString &key)
+{
+ for (auto it = m_values.begin(); it != m_values.end(); ++it) {
+ if (key.compare(it.key().name, nameCaseSensitivity()) == 0)
+ return it;
+ }
+ return m_values.end();
+}
+
+NameValueMap::const_iterator NameValueDictionary::findKey(const QString &key) const
+{
+ for (auto it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ if (key.compare(it.key().name, nameCaseSensitivity()) == 0)
+ return it;
+ }
+ return m_values.constEnd();
+}
+
+QStringList NameValueDictionary::toStringList() const
+{
+ QStringList result;
+ for (auto it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
+ if (it.value().second)
+ result.append(it.key().name + '=' + it.value().first);
+ }
+ return result;
+}
+
+void NameValueDictionary::set(const QString &key, const QString &value, bool enabled)
+{
+ QTC_ASSERT(!key.contains('='), return );
+ const auto it = findKey(key);
+ const auto valuePair = qMakePair(value, enabled);
+ if (it == m_values.end())
+ m_values.insert(DictKey(key, nameCaseSensitivity()), valuePair);
+ else
+ it.value() = valuePair;
+}
+
+void NameValueDictionary::unset(const QString &key)
+{
+ QTC_ASSERT(!key.contains('='), return );
+ const auto it = findKey(key);
+ if (it != m_values.end())
+ m_values.erase(it);
+}
+
+void NameValueDictionary::clear()
+{
+ m_values.clear();
+}
+
+QString NameValueDictionary::value(const QString &key) const
+{
+ const auto it = findKey(key);
+ return it != m_values.end() && it.value().second ? it.value().first : QString();
+}
+
+NameValueDictionary::const_iterator NameValueDictionary::constFind(const QString &name) const
+{
+ return findKey(name);
+}
+
+int NameValueDictionary::size() const
+{
+ return m_values.size();
+}
+
+void NameValueDictionary::modify(const NameValueItems &items)
+{
+ NameValueDictionary resultKeyValueDictionary = *this;
+ for (const NameValueItem &item : items)
+ item.apply(&resultKeyValueDictionary);
+ *this = resultKeyValueDictionary;
+}
+
+NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool checkAppendPrepend) const
+{
+ NameValueMap::const_iterator thisIt = constBegin();
+ NameValueMap::const_iterator otherIt = other.constBegin();
+
+ NameValueItems result;
+ while (thisIt != constEnd() || otherIt != other.constEnd()) {
+ if (thisIt == constEnd()) {
+ result.append({other.key(otherIt), other.value(otherIt),
+ otherIt.value().second ? NameValueItem::SetEnabled : NameValueItem::SetDisabled});
+ ++otherIt;
+ } else if (otherIt == other.constEnd()) {
+ result.append(NameValueItem(key(thisIt), QString(), NameValueItem::Unset));
+ ++thisIt;
+ } else if (thisIt.key() < otherIt.key()) {
+ result.append(NameValueItem(key(thisIt), QString(), NameValueItem::Unset));
+ ++thisIt;
+ } else if (thisIt.key() > otherIt.key()) {
+ result.append({other.key(otherIt), otherIt.value().first,
+ otherIt.value().second ? NameValueItem::SetEnabled : NameValueItem::SetDisabled});
+ ++otherIt;
+ } else {
+ const QString &oldValue = thisIt.value().first;
+ const QString &newValue = otherIt.value().first;
+ const bool oldEnabled = thisIt.value().second;
+ const bool newEnabled = otherIt.value().second;
+ if (oldValue != newValue) {
+ if (checkAppendPrepend && newValue.startsWith(oldValue)
+ && oldEnabled == newEnabled) {
+ QString appended = newValue.right(newValue.size() - oldValue.size());
+ if (appended.startsWith(OsSpecificAspects::pathListSeparator(osType())))
+ appended.remove(0, 1);
+ result.append(NameValueItem(other.key(otherIt), appended, NameValueItem::Append));
+ } else if (checkAppendPrepend && newValue.endsWith(oldValue)
+ && oldEnabled == newEnabled) {
+ QString prepended = newValue.left(newValue.size() - oldValue.size());
+ if (prepended.endsWith(OsSpecificAspects::pathListSeparator(osType())))
+ prepended.chop(1);
+ result.append(NameValueItem(other.key(otherIt), prepended, NameValueItem::Prepend));
+ } else {
+ result.append({other.key(otherIt), newValue, newEnabled
+ ? NameValueItem::SetEnabled : NameValueItem::SetDisabled});
+ }
+ }
+ ++otherIt;
+ ++thisIt;
+ }
+ }
+ return result;
+}
+
+bool NameValueDictionary::hasKey(const QString &key) const
+{
+ return findKey(key) != constEnd();
+}
+
+OsType NameValueDictionary::osType() const
+{
+ return m_osType;
+}
+
+Qt::CaseSensitivity NameValueDictionary::nameCaseSensitivity() const
+{
+ return OsSpecificAspects::envVarCaseSensitivity(osType());
+}
+
+QString NameValueDictionary::userName() const
+{
+ return value(QString::fromLatin1(m_osType == OsTypeWindows ? "USERNAME" : "USER"));
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluedictionary.h b/src/libs/utils/namevaluedictionary.h
new file mode 100644
index 0000000000..bbd80b1f99
--- /dev/null
+++ b/src/libs/utils/namevaluedictionary.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "fileutils.h"
+#include "hostosinfo.h"
+#include "namevalueitem.h"
+
+namespace Utils {
+
+class QTCREATOR_UTILS_EXPORT DictKey
+{
+public:
+ DictKey(const QString &name, Qt::CaseSensitivity cs) : name(name), caseSensitivity(cs) {}
+
+ QString name;
+ Qt::CaseSensitivity caseSensitivity;
+};
+inline bool operator<(const DictKey &k1, const DictKey &k2)
+{
+ return k1.name.compare(k2.name, k1.caseSensitivity) < 0;
+}
+inline bool operator>(const DictKey &k1, const DictKey &k2) { return k2 < k1; }
+
+using NameValuePair = std::pair<QString, QString>;
+using NameValuePairs = QVector<NameValuePair>;
+using NameValueMap = QMap<DictKey, QPair<QString, bool>>;
+
+class QTCREATOR_UTILS_EXPORT NameValueDictionary
+{
+public:
+ using const_iterator = NameValueMap::const_iterator;
+
+ explicit NameValueDictionary(OsType osType = HostOsInfo::hostOs())
+ : m_osType(osType)
+ {}
+ explicit NameValueDictionary(const QStringList &env, OsType osType = HostOsInfo::hostOs());
+ explicit NameValueDictionary(const NameValuePairs &nameValues);
+
+ QStringList toStringList() const;
+ QString value(const QString &key) const;
+ void set(const QString &key, const QString &value, bool enabled = true);
+ void unset(const QString &key);
+ void modify(const NameValueItems &items);
+ /// Return the KeyValueDictionary changes necessary to modify this into the other environment.
+ NameValueItems diff(const NameValueDictionary &other, bool checkAppendPrepend = false) const;
+ bool hasKey(const QString &key) const;
+ OsType osType() const;
+ Qt::CaseSensitivity nameCaseSensitivity() const;
+
+ QString userName() const;
+
+ void clear();
+ int size() const;
+
+ QString key(const_iterator it) const { return it.key().name; }
+ QString value(const_iterator it) const { return it.value().first; }
+ bool isEnabled(const_iterator it) const { return it.value().second; }
+
+ const_iterator constBegin() const { return m_values.constBegin(); }
+ const_iterator constEnd() const { return m_values.constEnd(); }
+ const_iterator constFind(const QString &name) const;
+
+ friend bool operator!=(const NameValueDictionary &first, const NameValueDictionary &second)
+ {
+ return !(first == second);
+ }
+
+ friend bool operator==(const NameValueDictionary &first, const NameValueDictionary &second)
+ {
+ return first.m_osType == second.m_osType && first.m_values == second.m_values;
+ }
+
+protected:
+ NameValueMap::iterator findKey(const QString &key);
+ const_iterator findKey(const QString &key) const;
+
+ NameValueMap m_values;
+ OsType m_osType;
+};
+
+} // namespace Utils
diff --git a/src/libs/utils/namevalueitem.cpp b/src/libs/utils/namevalueitem.cpp
new file mode 100644
index 0000000000..0ca80f8083
--- /dev/null
+++ b/src/libs/utils/namevalueitem.cpp
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "namevalueitem.h"
+#include "algorithm.h"
+#include "namevaluedictionary.h"
+#include "qtcassert.h"
+
+#include <QDebug>
+
+namespace Utils {
+
+void NameValueItem::sort(NameValueItems *list)
+{
+ Utils::sort(*list, &NameValueItem::name);
+}
+
+NameValueItems NameValueItem::fromStringList(const QStringList &list)
+{
+ NameValueItems result;
+ for (const QString &string : list) {
+ int pos = string.indexOf('=', 1);
+ if (pos == -1) {
+ result.append(NameValueItem(string, QString(), NameValueItem::Unset));
+ continue;
+ }
+ const int hashPos = string.indexOf('#');
+ if (hashPos != -1 && hashPos < pos) {
+ result.append({string.mid(hashPos + 1, pos - hashPos - 1), string.mid(pos + 1),
+ NameValueItem::SetDisabled});
+ } else {
+ result.append({string.left(pos), string.mid(pos + 1)});
+ }
+ }
+ return result;
+}
+
+QStringList NameValueItem::toStringList(const NameValueItems &list)
+{
+ return Utils::transform<QStringList>(list, [](const NameValueItem &item) {
+ if (item.operation == NameValueItem::Unset)
+ return QString(item.name);
+ return QString((item.operation == NameValueItem::SetDisabled ? "#" : "")
+ + item.name + '=' + item.value);
+ });
+}
+
+NameValueItems NameValueItem::itemsFromVariantList(const QVariantList &list)
+{
+ return Utils::transform<NameValueItems>(list, [](const QVariant &item) {
+ return itemFromVariantList(item.toList());
+ });
+}
+
+QVariantList NameValueItem::toVariantList(const NameValueItems &list)
+{
+ return Utils::transform<QVariantList>(list, [](const NameValueItem &item) {
+ return QVariant(toVariantList(item));
+ });
+}
+
+NameValueItem NameValueItem::itemFromVariantList(const QVariantList &list)
+{
+ QTC_ASSERT(list.size() == 3, return NameValueItem("", ""));
+ QString key = list.value(0).toString();
+ Operation operation = Operation(list.value(1).toInt());
+ QString value = list.value(2).toString();
+ return NameValueItem(key, value, operation);
+}
+
+QVariantList NameValueItem::toVariantList(const NameValueItem &item)
+{
+ return QVariantList() << item.name << item.operation << item.value;
+}
+
+static QString expand(const NameValueDictionary *dictionary, QString value)
+{
+ int replaceCount = 0;
+ for (int i = 0; i < value.size(); ++i) {
+ if (value.at(i) == '$') {
+ if ((i + 1) < value.size()) {
+ const QChar &c = value.at(i + 1);
+ int end = -1;
+ if (c == '(')
+ end = value.indexOf(')', i);
+ else if (c == '{')
+ end = value.indexOf('}', i);
+ if (end != -1) {
+ const QString &key = value.mid(i + 2, end - i - 2);
+ NameValueDictionary::const_iterator it = dictionary->constFind(key);
+ if (it != dictionary->constEnd())
+ value.replace(i, end - i + 1, it.value().first);
+ ++replaceCount;
+ QTC_ASSERT(replaceCount < 100, break);
+ }
+ }
+ }
+ }
+ return value;
+}
+
+enum : char {
+#ifdef Q_OS_WIN
+ pathSepC = ';'
+#else
+ pathSepC = ':'
+#endif
+};
+
+void NameValueItem::apply(NameValueDictionary *dictionary, Operation op) const
+{
+ switch (op) {
+ case SetEnabled:
+ dictionary->set(name, expand(dictionary, value));
+ break;
+ case SetDisabled:
+ dictionary->set(name, expand(dictionary, value), false);
+ break;
+ case Unset:
+ dictionary->unset(name);
+ break;
+ case Prepend: {
+ const NameValueDictionary::const_iterator it = dictionary->constFind(name);
+ if (it != dictionary->constEnd()) {
+ QString v = dictionary->value(it);
+ const QChar pathSep{QLatin1Char(pathSepC)};
+ int sepCount = 0;
+ if (v.startsWith(pathSep))
+ ++sepCount;
+ if (value.endsWith(pathSep))
+ ++sepCount;
+ if (sepCount == 2)
+ v.remove(0, 1);
+ else if (sepCount == 0)
+ v.prepend(pathSep);
+ v.prepend(expand(dictionary, value));
+ dictionary->set(name, v);
+ } else {
+ apply(dictionary, SetEnabled);
+ }
+ } break;
+ case Append: {
+ const NameValueDictionary::const_iterator it = dictionary->constFind(name);
+ if (it != dictionary->constEnd()) {
+ QString v = dictionary->value(it);
+ const QChar pathSep{QLatin1Char(pathSepC)};
+ int sepCount = 0;
+ if (v.endsWith(pathSep))
+ ++sepCount;
+ if (value.startsWith(pathSep))
+ ++sepCount;
+ if (sepCount == 2)
+ v.chop(1);
+ else if (sepCount == 0)
+ v.append(pathSep);
+ v.append(expand(dictionary, value));
+ dictionary->set(name, v);
+ } else {
+ apply(dictionary, SetEnabled);
+ }
+ } break;
+ }
+}
+
+QDebug operator<<(QDebug debug, const NameValueItem &i)
+{
+ QDebugStateSaver saver(debug);
+ debug.noquote();
+ debug.nospace();
+ debug << "KeyValueItem(";
+ switch (i.operation) {
+ case NameValueItem::SetEnabled:
+ debug << "set \"" << i.name << "\" to \"" << i.value << '"';
+ break;
+ case NameValueItem::SetDisabled:
+ debug << "set \"" << i.name << "\" to \"" << i.value << '"' << "[disabled]";
+ break;
+ case NameValueItem::Unset:
+ debug << "unset \"" << i.name << '"';
+ break;
+ case NameValueItem::Prepend:
+ debug << "prepend to \"" << i.name << "\":\"" << i.value << '"';
+ break;
+ case NameValueItem::Append:
+ debug << "append to \"" << i.name << "\":\"" << i.value << '"';
+ break;
+ }
+ debug << ')';
+ return debug;
+}
+} // namespace Utils
diff --git a/src/libs/utils/namevalueitem.h b/src/libs/utils/namevalueitem.h
new file mode 100644
index 0000000000..1ec203115a
--- /dev/null
+++ b/src/libs/utils/namevalueitem.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "environmentfwd.h"
+#include "utils_global.h"
+
+#include <QStringList>
+#include <QVariantList>
+#include <QVector>
+
+namespace Utils {
+
+class QTCREATOR_UTILS_EXPORT NameValueItem
+{
+public:
+ enum Operation : char { SetEnabled, Unset, Prepend, Append, SetDisabled };
+ NameValueItem() = default;
+ NameValueItem(const QString &key, const QString &value, Operation operation = SetEnabled)
+ : name(key)
+ , value(value)
+ , operation(operation)
+ {}
+
+ void apply(NameValueDictionary *dictionary) const { apply(dictionary, operation); }
+
+ static void sort(NameValueItems *list);
+ static NameValueItems fromStringList(const QStringList &list);
+ static QStringList toStringList(const NameValueItems &list);
+ static NameValueItems itemsFromVariantList(const QVariantList &list);
+ static QVariantList toVariantList(const NameValueItems &list);
+ static NameValueItem itemFromVariantList(const QVariantList &list);
+ static QVariantList toVariantList(const NameValueItem &item);
+
+ friend bool operator==(const NameValueItem &first, const NameValueItem &second)
+ {
+ return first.operation == second.operation && first.name == second.name
+ && first.value == second.value;
+ }
+
+ friend bool operator!=(const NameValueItem &first, const NameValueItem &second)
+ {
+ return !(first == second);
+ }
+
+public:
+ QString name;
+ QString value;
+ Operation operation = Unset;
+
+private:
+ void apply(NameValueDictionary *dictionary, Operation op) const;
+};
+
+QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const NameValueItem &i);
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluemodel.cpp b/src/libs/utils/namevaluemodel.cpp
new file mode 100644
index 0000000000..0093df0190
--- /dev/null
+++ b/src/libs/utils/namevaluemodel.cpp
@@ -0,0 +1,437 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "namevaluemodel.h"
+
+#include <utils/algorithm.h>
+#include <utils/hostosinfo.h>
+#include <utils/namevaluedictionary.h>
+#include <utils/qtcassert.h>
+
+#include <QBrush>
+#include <QColor>
+#include <QFont>
+#include <QString>
+
+namespace Utils {
+
+namespace Internal {
+
+class NameValueModelPrivate
+{
+public:
+ void updateResultNameValueDictionary()
+ {
+ m_resultNameValueDictionary = m_baseNameValueDictionary;
+ m_resultNameValueDictionary.modify(m_items);
+ // Add removed variables again and mark them as "<UNSET>" so
+ // that the user can actually see those removals:
+ foreach (const NameValueItem &item, m_items) {
+ if (item.operation == NameValueItem::Unset)
+ m_resultNameValueDictionary.set(item.name, NameValueModel::tr("<UNSET>"));
+ }
+ }
+
+ int findInChanges(const QString &name) const
+ {
+ for (int i = 0; i < m_items.size(); ++i)
+ if (m_items.at(i).name.compare(name,
+ m_baseNameValueDictionary.nameCaseSensitivity()) == 0) {
+ return i;
+ }
+ return -1;
+ }
+
+ int findInResultInsertPosition(const QString &name) const
+ {
+ NameValueDictionary::const_iterator it;
+ int i = 0;
+ for (it = m_resultNameValueDictionary.constBegin();
+ it != m_resultNameValueDictionary.constEnd();
+ ++it, ++i)
+ if (it.key() > DictKey(name, m_resultNameValueDictionary.nameCaseSensitivity()))
+ return i;
+ return m_resultNameValueDictionary.size();
+ }
+
+ int findInResult(const QString &name) const
+ {
+ NameValueDictionary::const_iterator it;
+ int i = 0;
+ for (it = m_resultNameValueDictionary.constBegin();
+ it != m_resultNameValueDictionary.constEnd();
+ ++it, ++i)
+ if (m_resultNameValueDictionary.key(it)
+ .compare(name, m_resultNameValueDictionary.nameCaseSensitivity()) == 0) {
+ return i;
+ }
+ return -1;
+ }
+
+ NameValueDictionary m_baseNameValueDictionary;
+ NameValueDictionary m_resultNameValueDictionary;
+ NameValueItems m_items;
+};
+
+} // namespace Internal
+
+NameValueModel::NameValueModel(QObject *parent)
+ : QAbstractTableModel(parent)
+ , d(std::make_unique<Internal::NameValueModelPrivate>())
+{}
+
+NameValueModel::~NameValueModel() = default;
+
+QString NameValueModel::indexToVariable(const QModelIndex &index) const
+{
+ return d->m_resultNameValueDictionary.key(d->m_resultNameValueDictionary.constBegin()
+ + index.row());
+}
+
+void NameValueModel::setBaseNameValueDictionary(const NameValueDictionary &dictionary)
+{
+ if (d->m_baseNameValueDictionary == dictionary)
+ return;
+ beginResetModel();
+ d->m_baseNameValueDictionary = dictionary;
+ d->updateResultNameValueDictionary();
+ endResetModel();
+}
+
+int NameValueModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return d->m_resultNameValueDictionary.size();
+}
+int NameValueModel::columnCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return 2;
+}
+
+bool NameValueModel::changes(const QString &name) const
+{
+ return d->findInChanges(name) >= 0;
+}
+
+const NameValueDictionary &NameValueModel::baseNameValueDictionary() const
+{
+ return d->m_baseNameValueDictionary;
+}
+
+QVariant NameValueModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ const auto resultIterator = d->m_resultNameValueDictionary.constBegin() + index.row();
+ switch (role) {
+ case Qt::DisplayRole:
+ case Qt::EditRole:
+ case Qt::ToolTipRole:
+ if (index.column() == 0)
+ return d->m_resultNameValueDictionary.key(resultIterator);
+ if (index.column() == 1) {
+ // Do not return "<UNSET>" when editing a previously unset variable:
+ if (role == Qt::EditRole) {
+ int pos = d->findInChanges(indexToVariable(index));
+ if (pos != -1)
+ return d->m_items.at(pos).value;
+ }
+ QString value = d->m_resultNameValueDictionary.value(resultIterator);
+ if (role == Qt::ToolTipRole && value.length() > 80) {
+ // Use html to enable text wrapping
+ value = value.toHtmlEscaped();
+ value.prepend(QLatin1String("<html><body>"));
+ value.append(QLatin1String("</body></html>"));
+ }
+ return value;
+ }
+ break;
+ case Qt::FontRole: {
+ QFont f;
+ f.setStrikeOut(!d->m_resultNameValueDictionary.isEnabled(resultIterator));
+ return f;
+ }
+ case Qt::ForegroundRole:
+ return changes(d->m_resultNameValueDictionary.key(resultIterator))
+ ? QBrush(Qt::blue) : QBrush();
+ }
+ return QVariant();
+}
+
+Qt::ItemFlags NameValueModel::flags(const QModelIndex &index) const
+{
+ Q_UNUSED(index)
+ return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
+}
+
+QVariant NameValueModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Vertical || role != Qt::DisplayRole)
+ return QVariant();
+ return section == 0 ? tr("Variable") : tr("Value");
+}
+
+/// *****************
+/// Utility functions
+/// *****************
+QModelIndex NameValueModel::variableToIndex(const QString &name) const
+{
+ int row = d->findInResult(name);
+ if (row == -1)
+ return QModelIndex();
+ return index(row, 0);
+}
+
+bool NameValueModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (!index.isValid() || role != Qt::EditRole)
+ return false;
+
+ // ignore changes to already set values:
+ if (data(index, role) == value)
+ return true;
+
+ const QString oldName = data(this->index(index.row(), 0, QModelIndex())).toString();
+ const QString oldValue = data(this->index(index.row(), 1, QModelIndex()), Qt::EditRole).toString();
+ int changesPos = d->findInChanges(oldName);
+
+ if (index.column() == 0) {
+ //fail if a variable with the same name already exists
+ const QString &newName = HostOsInfo::isWindowsHost() ? value.toString().toUpper()
+ : value.toString();
+ if (newName.isEmpty() || newName.contains('='))
+ return false;
+ // Does the new name exist already?
+ if (d->m_resultNameValueDictionary.hasKey(newName) || newName.isEmpty())
+ return false;
+
+ NameValueItem newVariable(newName, oldValue);
+
+ if (changesPos != -1)
+ resetVariable(oldName); // restore the original base variable again
+
+ QModelIndex newIndex = addVariable(newVariable); // add the new variable
+ emit focusIndex(newIndex.sibling(newIndex.row(), 1)); // hint to focus on the value
+ return true;
+ } else if (index.column() == 1) {
+ // We are changing an existing value:
+ const QString stringValue = value.toString();
+ if (changesPos != -1) {
+ const auto oldIt = d->m_baseNameValueDictionary.constFind(oldName);
+ const auto newIt = d->m_resultNameValueDictionary.constFind(oldName);
+ // We have already changed this value
+ if (oldIt != d->m_baseNameValueDictionary.constEnd()
+ && stringValue == d->m_baseNameValueDictionary.value(oldIt)
+ && d->m_baseNameValueDictionary.isEnabled(oldIt)
+ == d->m_resultNameValueDictionary.isEnabled(newIt)) {
+ // ... and now went back to the base value
+ d->m_items.removeAt(changesPos);
+ } else {
+ // ... and changed it again
+ d->m_items[changesPos].value = stringValue;
+ if (d->m_items[changesPos].operation == NameValueItem::Unset)
+ d->m_items[changesPos].operation = NameValueItem::SetEnabled;
+ }
+ } else {
+ // Add a new change item:
+ d->m_items.append(NameValueItem(oldName, stringValue));
+ }
+ d->updateResultNameValueDictionary();
+ emit dataChanged(index, index);
+ emit userChangesChanged();
+ return true;
+ }
+ return false;
+}
+
+QModelIndex NameValueModel::addVariable()
+{
+ //: Name when inserting a new variable
+ return addVariable(NameValueItem(tr("<VARIABLE>"),
+ //: Value when inserting a new variable
+ tr("<VALUE>")));
+}
+
+QModelIndex NameValueModel::addVariable(const NameValueItem &item)
+{
+ // Return existing index if the name is already in the result set:
+ int pos = d->findInResult(item.name);
+ if (pos >= 0 && pos < d->m_resultNameValueDictionary.size())
+ return index(pos, 0, QModelIndex());
+
+ int insertPos = d->findInResultInsertPosition(item.name);
+ int changePos = d->findInChanges(item.name);
+ if (d->m_baseNameValueDictionary.hasKey(item.name)) {
+ // We previously unset this!
+ Q_ASSERT(changePos >= 0);
+ // Do not insert a line here as we listed the variable as <UNSET> before!
+ Q_ASSERT(d->m_items.at(changePos).name == item.name);
+ Q_ASSERT(d->m_items.at(changePos).operation == NameValueItem::Unset);
+ Q_ASSERT(d->m_items.at(changePos).value.isEmpty());
+ d->m_items[changePos] = item;
+ emit dataChanged(index(insertPos, 0, QModelIndex()), index(insertPos, 1, QModelIndex()));
+ } else {
+ // We add something that is not in the base dictionary
+ // Insert a new line!
+ beginInsertRows(QModelIndex(), insertPos, insertPos);
+ Q_ASSERT(changePos < 0);
+ d->m_items.append(item);
+ d->updateResultNameValueDictionary();
+ endInsertRows();
+ }
+ emit userChangesChanged();
+ return index(insertPos, 0, QModelIndex());
+}
+
+void NameValueModel::resetVariable(const QString &name)
+{
+ int rowInChanges = d->findInChanges(name);
+ if (rowInChanges < 0)
+ return;
+
+ int rowInResult = d->findInResult(name);
+ if (rowInResult < 0)
+ return;
+
+ if (d->m_baseNameValueDictionary.hasKey(name)) {
+ d->m_items.removeAt(rowInChanges);
+ d->updateResultNameValueDictionary();
+ emit dataChanged(index(rowInResult, 0, QModelIndex()), index(rowInResult, 1, QModelIndex()));
+ emit userChangesChanged();
+ } else {
+ // Remove the line completely!
+ beginRemoveRows(QModelIndex(), rowInResult, rowInResult);
+ d->m_items.removeAt(rowInChanges);
+ d->updateResultNameValueDictionary();
+ endRemoveRows();
+ emit userChangesChanged();
+ }
+}
+
+void NameValueModel::unsetVariable(const QString &name)
+{
+ // This does not change the number of rows as we will display a <UNSET>
+ // in place of the original variable!
+ int row = d->findInResult(name);
+ if (row < 0)
+ return;
+
+ // look in d->m_items for the variable
+ int pos = d->findInChanges(name);
+ if (pos != -1) {
+ d->m_items[pos].operation = NameValueItem::Unset;
+ d->m_items[pos].value.clear();
+ d->updateResultNameValueDictionary();
+ emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
+ emit userChangesChanged();
+ return;
+ }
+ d->m_items.append(NameValueItem(name, QString(), NameValueItem::Unset));
+ d->updateResultNameValueDictionary();
+ emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
+ emit userChangesChanged();
+}
+
+void NameValueModel::toggleVariable(const QModelIndex &idx)
+{
+ const QString name = indexToVariable(idx);
+ const auto newIt = d->m_resultNameValueDictionary.constFind(name);
+ QTC_ASSERT(newIt != d->m_resultNameValueDictionary.constEnd(), return);
+ const auto op = d->m_resultNameValueDictionary.isEnabled(newIt)
+ ? NameValueItem::SetDisabled : NameValueItem::SetEnabled;
+ const int changesPos = d->findInChanges(name);
+ if (changesPos != -1) {
+ const auto oldIt = d->m_baseNameValueDictionary.constFind(name);
+ if (oldIt == d->m_baseNameValueDictionary.constEnd()
+ || oldIt.value().first != newIt.value().first) {
+ d->m_items[changesPos].operation = op;
+ } else {
+ d->m_items.removeAt(changesPos);
+ }
+ } else {
+ d->m_items.append({name, d->m_resultNameValueDictionary.value(newIt), op});
+ }
+ d->updateResultNameValueDictionary();
+ emit dataChanged(index(idx.row(), 0), index(idx.row(), 1));
+ emit userChangesChanged();
+}
+
+bool NameValueModel::isUnset(const QString &name)
+{
+ const int pos = d->findInChanges(name);
+ return pos == -1 ? false : d->m_items.at(pos).operation == NameValueItem::Unset;
+}
+
+bool NameValueModel::isEnabled(const QString &name) const
+{
+ return d->m_resultNameValueDictionary.isEnabled(d->m_resultNameValueDictionary.constFind(name));
+}
+
+bool NameValueModel::canReset(const QString &name)
+{
+ return d->m_baseNameValueDictionary.hasKey(name);
+}
+
+NameValueItems NameValueModel::userChanges() const
+{
+ return d->m_items;
+}
+
+void NameValueModel::setUserChanges(const NameValueItems &items)
+{
+ NameValueItems filtered = Utils::filtered(items, [](const NameValueItem &i) {
+ return i.name != "export " && !i.name.contains('=');
+ });
+ // We assume nobody is reordering the items here.
+ if (filtered == d->m_items)
+ return;
+ beginResetModel();
+ d->m_items = filtered;
+ for (NameValueItem &item : d->m_items) {
+ QString &name = item.name;
+ name = name.trimmed();
+ if (name.startsWith("export "))
+ name = name.mid(7).trimmed();
+ if (d->m_baseNameValueDictionary.osType() == OsTypeWindows) {
+ // NameValueDictionary variable names are case-insensitive under windows, but we still
+ // want to preserve the case of pre-existing variables.
+ auto it = d->m_baseNameValueDictionary.constFind(name);
+ if (it != d->m_baseNameValueDictionary.constEnd())
+ name = d->m_baseNameValueDictionary.key(it);
+ }
+ }
+
+ d->updateResultNameValueDictionary();
+ endResetModel();
+ emit userChangesChanged();
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluemodel.h b/src/libs/utils/namevaluemodel.h
new file mode 100644
index 0000000000..ede319a013
--- /dev/null
+++ b/src/libs/utils/namevaluemodel.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "environmentfwd.h"
+#include "utils_global.h"
+
+#include <QAbstractTableModel>
+
+#include <memory>
+
+namespace Utils {
+
+namespace Internal {
+class NameValueModelPrivate;
+}
+
+class QTCREATOR_UTILS_EXPORT NameValueModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ explicit NameValueModel(QObject *parent = nullptr);
+ ~NameValueModel() override;
+
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QVariant headerData(int section,
+ Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const override;
+
+ QModelIndex addVariable();
+ QModelIndex addVariable(const NameValueItem &item);
+ void resetVariable(const QString &name);
+ void unsetVariable(const QString &name);
+ void toggleVariable(const QModelIndex &index);
+ bool isUnset(const QString &name);
+ bool isEnabled(const QString &name) const;
+ bool canReset(const QString &name);
+ QString indexToVariable(const QModelIndex &index) const;
+ QModelIndex variableToIndex(const QString &name) const;
+ bool changes(const QString &key) const;
+ const NameValueDictionary &baseNameValueDictionary() const;
+ void setBaseNameValueDictionary(const NameValueDictionary &dictionary);
+ NameValueItems userChanges() const;
+ void setUserChanges(const NameValueItems &items);
+
+signals:
+ void userChangesChanged();
+ /// Hint to the view where it should make sense to focus on next
+ // This is a hack since there is no way for a model to suggest
+ // the next interesting place to focus on to the view.
+ void focusIndex(const QModelIndex &index);
+
+private:
+ std::unique_ptr<Internal::NameValueModelPrivate> d;
+};
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluesdialog.cpp b/src/libs/utils/namevaluesdialog.cpp
new file mode 100644
index 0000000000..4f92a79680
--- /dev/null
+++ b/src/libs/utils/namevaluesdialog.cpp
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "namevaluesdialog.h"
+
+#include <utils/environment.h>
+#include <utils/hostosinfo.h>
+
+#include <QDialogButtonBox>
+#include <QLabel>
+#include <QPlainTextEdit>
+#include <QVBoxLayout>
+
+namespace Utils {
+
+namespace Internal {
+
+static EnvironmentItems cleanUp(const EnvironmentItems &items)
+{
+ EnvironmentItems uniqueItems;
+ QSet<QString> uniqueSet;
+ for (int i = items.count() - 1; i >= 0; i--) {
+ EnvironmentItem item = items.at(i);
+ if (HostOsInfo::isWindowsHost())
+ item.name = item.name.toUpper();
+ const QString &itemName = item.name;
+ QString emptyName = itemName;
+ emptyName.remove(QLatin1Char(' '));
+ if (!emptyName.isEmpty() && !uniqueSet.contains(itemName)) {
+ uniqueItems.prepend(item);
+ uniqueSet.insert(itemName);
+ }
+ }
+ return uniqueItems;
+}
+
+NameValueItemsWidget::NameValueItemsWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ m_editor = new QPlainTextEdit(this);
+ auto layout = new QVBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_editor);
+}
+
+void NameValueItemsWidget::setEnvironmentItems(const EnvironmentItems &items)
+{
+ EnvironmentItems sortedItems = items;
+ EnvironmentItem::sort(&sortedItems);
+ const QStringList list = EnvironmentItem::toStringList(sortedItems);
+ m_editor->document()->setPlainText(list.join(QLatin1Char('\n')));
+}
+
+EnvironmentItems NameValueItemsWidget::environmentItems() const
+{
+ const QStringList list = m_editor->document()->toPlainText().split(QLatin1String("\n"));
+ EnvironmentItems items = EnvironmentItem::fromStringList(list);
+ return cleanUp(items);
+}
+
+void NameValueItemsWidget::setPlaceholderText(const QString &text)
+{
+ m_editor->setPlaceholderText(text);
+}
+} // namespace Internal
+
+NameValuesDialog::NameValuesDialog(const QString &windowTitle, const QString &helpText, QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ resize(640, 480);
+ m_editor = new Internal::NameValueItemsWidget(this);
+ auto box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+ Qt::Horizontal,
+ this);
+ connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject);
+
+ auto helpLabel = new QLabel(this);
+ helpLabel->setText(helpText);
+
+ auto layout = new QVBoxLayout(this);
+ layout->addWidget(m_editor);
+ layout->addWidget(helpLabel);
+
+ layout->addWidget(box);
+
+ setWindowTitle(windowTitle);
+}
+
+void NameValuesDialog::setNameValueItems(const EnvironmentItems &items)
+{
+ m_editor->setEnvironmentItems(items);
+}
+
+EnvironmentItems NameValuesDialog::nameValueItems() const
+{
+ return m_editor->environmentItems();
+}
+
+void NameValuesDialog::setPlaceholderText(const QString &text)
+{
+ m_editor->setPlaceholderText(text);
+}
+
+Utils::optional<NameValueItems> NameValuesDialog::getNameValueItems(QWidget *parent,
+ const NameValueItems &initial,
+ const QString &placeholderText,
+ Polisher polisher,
+ const QString &windowTitle,
+ const QString &helpText)
+{
+ NameValuesDialog dialog(windowTitle, helpText, parent);
+ if (polisher)
+ polisher(&dialog);
+ dialog.setNameValueItems(initial);
+ dialog.setPlaceholderText(placeholderText);
+ bool result = dialog.exec() == QDialog::Accepted;
+ if (result)
+ return dialog.nameValueItems();
+
+ return {};
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluesdialog.h b/src/libs/utils/namevaluesdialog.h
new file mode 100644
index 0000000000..8170a99a1d
--- /dev/null
+++ b/src/libs/utils/namevaluesdialog.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "environmentfwd.h"
+#include "optional.h"
+#include "utils_global.h"
+
+#include <QDialog>
+
+#include <functional>
+#include <memory>
+
+QT_BEGIN_NAMESPACE
+class QPlainTextEdit;
+QT_END_NAMESPACE
+
+namespace Utils {
+
+namespace Internal {
+class NameValueItemsWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit NameValueItemsWidget(QWidget *parent = nullptr);
+
+ void setEnvironmentItems(const EnvironmentItems &items);
+ EnvironmentItems environmentItems() const;
+
+ void setPlaceholderText(const QString &text);
+
+private:
+ QPlainTextEdit *m_editor;
+};
+} // namespace Internal
+
+class QTCREATOR_UTILS_EXPORT NameValuesDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ void setNameValueItems(const NameValueItems &items);
+ NameValueItems nameValueItems() const;
+
+ void setPlaceholderText(const QString &text);
+
+ using Polisher = std::function<void(QWidget *)>;
+ static Utils::optional<NameValueItems> getNameValueItems(QWidget *parent = nullptr,
+ const NameValueItems &initial = {},
+ const QString &placeholderText = {},
+ Polisher polish = {},
+ const QString &windowTitle = {},
+ const QString &helpText = {});
+
+protected:
+ explicit NameValuesDialog(const QString &windowTitle,
+ const QString &helpText,
+ QWidget *parent = {});
+
+private:
+ Internal::NameValueItemsWidget *m_editor;
+};
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluevalidator.cpp b/src/libs/utils/namevaluevalidator.cpp
new file mode 100644
index 0000000000..580a476e01
--- /dev/null
+++ b/src/libs/utils/namevaluevalidator.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "namevaluevalidator.h"
+#include "namevaluemodel.h"
+#include "tooltip/tooltip.h"
+
+#include <QTreeView>
+
+namespace Utils {
+
+NameValueValidator::NameValueValidator(QWidget *parent,
+ Utils::NameValueModel *model,
+ QTreeView *view,
+ const QModelIndex &index,
+ const QString &toolTipText)
+ : QValidator(parent)
+ , m_toolTipText(toolTipText)
+ , m_model(model)
+ , m_view(view)
+ , m_index(index)
+{
+ m_hideTipTimer.setInterval(2000);
+ m_hideTipTimer.setSingleShot(true);
+ connect(&m_hideTipTimer, &QTimer::timeout, this, []() { Utils::ToolTip::hide(); });
+}
+
+QValidator::State NameValueValidator::validate(QString &in, int &pos) const
+{
+ Q_UNUSED(pos)
+ QModelIndex idx = m_model->variableToIndex(in);
+ if (idx.isValid() && idx != m_index)
+ return QValidator::Intermediate;
+ Utils::ToolTip::hide();
+ m_hideTipTimer.stop();
+ return QValidator::Acceptable;
+}
+
+void NameValueValidator::fixup(QString &input) const
+{
+ Q_UNUSED(input)
+
+ QPoint pos = m_view->mapToGlobal(m_view->visualRect(m_index).topLeft());
+ pos -= Utils::ToolTip::offsetFromPosition();
+ Utils::ToolTip::show(pos, m_toolTipText);
+ m_hideTipTimer.start();
+ // do nothing
+}
+
+} // namespace Utils
diff --git a/src/libs/utils/namevaluevalidator.h b/src/libs/utils/namevaluevalidator.h
new file mode 100644
index 0000000000..508fc78e54
--- /dev/null
+++ b/src/libs/utils/namevaluevalidator.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include "environmentfwd.h"
+#include "utils_global.h"
+
+#include <QModelIndex>
+#include <QTimer>
+#include <QValidator>
+
+namespace Utils {
+
+class QTCREATOR_UTILS_EXPORT NameValueValidator : public QValidator
+{
+ Q_OBJECT
+public:
+ NameValueValidator(QWidget *parent,
+ Utils::NameValueModel *model,
+ QTreeView *view,
+ const QModelIndex &index,
+ const QString &toolTipText);
+
+ QValidator::State validate(QString &in, int &pos) const override;
+
+ void fixup(QString &input) const override;
+
+private:
+ const QString m_toolTipText;
+ Utils::NameValueModel *m_model;
+ QTreeView *m_view;
+ QModelIndex m_index;
+ mutable QTimer m_hideTipTimer;
+};
+} // namespace Utils
diff --git a/src/libs/utils/osspecificaspects.h b/src/libs/utils/osspecificaspects.h
index 45541a3bf2..1a5bec02bb 100644
--- a/src/libs/utils/osspecificaspects.h
+++ b/src/libs/utils/osspecificaspects.h
@@ -51,6 +51,11 @@ inline Qt::CaseSensitivity fileNameCaseSensitivity(OsType osType)
return osType == OsTypeWindows || osType == OsTypeMac ? Qt::CaseInsensitive : Qt::CaseSensitive;
}
+inline Qt::CaseSensitivity envVarCaseSensitivity(OsType osType)
+{
+ return fileNameCaseSensitivity(osType);
+}
+
inline QChar pathListSeparator(OsType osType)
{
return QLatin1Char(osType == OsTypeWindows ? ';' : ':');
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp
index 7926422da6..475d8596e6 100644
--- a/src/libs/utils/outputformatter.cpp
+++ b/src/libs/utils/outputformatter.cpp
@@ -151,7 +151,7 @@ void OutputFormatter::initFormats()
void OutputFormatter::handleLink(const QString &href)
{
- Q_UNUSED(href);
+ Q_UNUSED(href)
}
void OutputFormatter::setBoldFontEnabled(bool enabled)
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index 746805bb12..a4cc97407a 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -84,7 +84,7 @@ public:
QStringList arguments() const { return m_arguments; }
void setArguments(const QStringList &arguments) { m_arguments = arguments; }
- static QString toolVersion(const QString &binary, const QStringList &arguments);
+ static QString toolVersion(const CommandLine &cmd);
private:
// Extension point for concatenating existing tooltips.
@@ -108,7 +108,8 @@ bool BinaryVersionToolTipEventFilter::eventFilter(QObject *o, QEvent *e)
const QString binary = le->text();
if (!binary.isEmpty()) {
- const QString version = BinaryVersionToolTipEventFilter::toolVersion(QDir::cleanPath(binary), m_arguments);
+ const QString version = BinaryVersionToolTipEventFilter::toolVersion(
+ CommandLine(QDir::cleanPath(binary), m_arguments));
if (!version.isEmpty()) {
// Concatenate tooltips.
QString tooltip = "<html><head/><body>";
@@ -127,13 +128,13 @@ bool BinaryVersionToolTipEventFilter::eventFilter(QObject *o, QEvent *e)
return false;
}
-QString BinaryVersionToolTipEventFilter::toolVersion(const QString &binary, const QStringList &arguments)
+QString BinaryVersionToolTipEventFilter::toolVersion(const CommandLine &cmd)
{
- if (binary.isEmpty())
+ if (cmd.executable().isEmpty())
return QString();
SynchronousProcess proc;
proc.setTimeoutS(1);
- SynchronousProcessResponse response = proc.runBlocking(binary, arguments);
+ SynchronousProcessResponse response = proc.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished)
return QString();
return response.allOutput();
@@ -681,7 +682,7 @@ FancyLineEdit *PathChooser::lineEdit() const
QString PathChooser::toolVersion(const QString &binary, const QStringList &arguments)
{
- return BinaryVersionToolTipEventFilter::toolVersion(binary, arguments);
+ return BinaryVersionToolTipEventFilter::toolVersion({binary, arguments});
}
void PathChooser::installLineEditVersionToolTip(QLineEdit *le, const QStringList &arguments)
diff --git a/src/libs/utils/pathlisteditor.cpp b/src/libs/utils/pathlisteditor.cpp
index 70ec975db7..522ea76bc5 100644
--- a/src/libs/utils/pathlisteditor.cpp
+++ b/src/libs/utils/pathlisteditor.cpp
@@ -110,7 +110,7 @@ PathListEditorPrivate::PathListEditorPrivate() :
buttonLayout(new QVBoxLayout),
edit(new PathListPlainTextEdit)
{
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(edit);
layout->addLayout(buttonLayout);
buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored,
diff --git a/src/libs/utils/process_ctrlc_stub.cpp b/src/libs/utils/process_ctrlc_stub.cpp
index 396ed3c153..e5469e208d 100644
--- a/src/libs/utils/process_ctrlc_stub.cpp
+++ b/src/libs/utils/process_ctrlc_stub.cpp
@@ -45,6 +45,7 @@
const wchar_t szTitle[] = L"qtcctrlcstub";
const wchar_t szWindowClass[] = L"wcqtcctrlcstub";
+const wchar_t szNice[] = L"-nice ";
UINT uiShutDownWindowMessage;
UINT uiInterruptMessage;
HWND hwndMain = nullptr;
@@ -53,7 +54,7 @@ LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
BOOL WINAPI shutdownHandler(DWORD dwCtrlType);
BOOL WINAPI interruptHandler(DWORD dwCtrlType);
bool isSpaceOrTab(const wchar_t c);
-bool startProcess(wchar_t pCommandLine[]);
+bool startProcess(wchar_t pCommandLine[], bool lowerPriority);
int main(int argc, char **)
{
@@ -93,7 +94,14 @@ int main(int argc, char **)
++pos;
}
- bool bSuccess = startProcess(strCommandLine + pos);
+ const size_t niceLen = wcslen(szNice);
+ bool lowerPriority = !wcsncmp(strCommandLine + pos, szNice, niceLen);
+ if (lowerPriority) {
+ pos += niceLen - 1; // reach the space, then the following line skips all spaces.
+ while (isSpaceOrTab(strCommandLine[++pos]))
+ ;
+ }
+ bool bSuccess = startProcess(strCommandLine + pos, lowerPriority);
free(strCommandLine);
if (!bSuccess)
@@ -166,7 +174,7 @@ DWORD WINAPI processWatcherThread(LPVOID lpParameter)
return 0;
}
-bool startProcess(wchar_t *pCommandLine)
+bool startProcess(wchar_t *pCommandLine, bool lowerPriority)
{
SECURITY_ATTRIBUTES sa = {0};
sa.nLength = sizeof(sa);
@@ -176,7 +184,7 @@ bool startProcess(wchar_t *pCommandLine)
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
- DWORD dwCreationFlags = 0;
+ DWORD dwCreationFlags = lowerPriority ? BELOW_NORMAL_PRIORITY_CLASS : 0;
BOOL bSuccess = CreateProcess(NULL, pCommandLine, &sa, &sa, TRUE, dwCreationFlags, NULL, NULL, &si, &pi);
if (!bSuccess) {
fwprintf(stderr, L"qtcreator_ctrlc_stub: Command line failed: %s\n", pCommandLine);
diff --git a/src/libs/utils/qrcparser.cpp b/src/libs/utils/qrcparser.cpp
index 21904d3716..dcb704abc4 100644
--- a/src/libs/utils/qrcparser.cpp
+++ b/src/libs/utils/qrcparser.cpp
@@ -74,12 +74,12 @@ public:
QrcParserPrivate(QrcParser *q);
bool parseFile(const QString &path, const QString &contents);
QString firstFileAtPath(const QString &path, const QLocale &locale) const;
- void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const;
- bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const;
+ void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = nullptr) const;
+ bool hasDirAtPath(const QString &path, const QLocale *locale = nullptr) const;
void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false,
- const QLocale *locale = 0) const;
+ const QLocale *locale = nullptr) const;
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *res,
- const QLocale *locale = 0) const;
+ const QLocale *locale = nullptr) const;
QStringList errorMessages() const;
QStringList languages() const;
@@ -487,7 +487,7 @@ QrcParser::Ptr QrcCachePrivate::addPath(const QString &path, const QString &cont
QPair<QrcParser::Ptr,int> currentValue;
{
QMutexLocker l(&m_mutex);
- currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
+ currentValue = m_cache.value(path, {QrcParser::Ptr(nullptr), 0});
currentValue.second += 1;
if (currentValue.second > 1) {
m_cache.insert(path, currentValue);
@@ -499,7 +499,7 @@ QrcParser::Ptr QrcCachePrivate::addPath(const QString &path, const QString &cont
qCWarning(qrcParserLog) << "adding invalid qrc " << path << " to the cache:" << newParser->errorMessages();
{
QMutexLocker l(&m_mutex);
- QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
+ QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(nullptr), 0});
if (currentValue.first.isNull())
currentValue.first = newParser;
currentValue.second += 1;
@@ -513,7 +513,7 @@ void QrcCachePrivate::removePath(const QString &path)
QPair<QrcParser::Ptr,int> currentValue;
{
QMutexLocker l(&m_mutex);
- currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
+ currentValue = m_cache.value(path, {QrcParser::Ptr(nullptr), 0});
if (currentValue.second == 1) {
m_cache.remove(path);
} else if (currentValue.second > 1) {
@@ -530,7 +530,7 @@ QrcParser::Ptr QrcCachePrivate::updatePath(const QString &path, const QString &c
QrcParser::Ptr newParser = QrcParser::parseQrcFile(path, contents);
{
QMutexLocker l(&m_mutex);
- QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
+ QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(nullptr), 0});
currentValue.first = newParser;
if (currentValue.second == 0)
currentValue.second = 1; // add qrc files that are not in the resources of a project
@@ -542,7 +542,7 @@ QrcParser::Ptr QrcCachePrivate::updatePath(const QString &path, const QString &c
QrcParser::Ptr QrcCachePrivate::parsedPath(const QString &path)
{
QMutexLocker l(&m_mutex);
- QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
+ QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(nullptr), 0});
return currentValue.first;
}
diff --git a/src/libs/utils/qrcparser.h b/src/libs/utils/qrcparser.h
index b5a7be761b..49e1f9e924 100644
--- a/src/libs/utils/qrcparser.h
+++ b/src/libs/utils/qrcparser.h
@@ -48,12 +48,12 @@ public:
~QrcParser();
bool parseFile(const QString &path, const QString &contents);
QString firstFileAtPath(const QString &path, const QLocale &locale) const;
- void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const;
- bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const;
+ void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = nullptr) const;
+ bool hasDirAtPath(const QString &path, const QLocale *locale = nullptr) const;
void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false,
- const QLocale *locale = 0) const;
+ const QLocale *locale = nullptr) const;
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *results,
- const QLocale *locale = 0) const;
+ const QLocale *locale = nullptr) const;
QStringList errorMessages() const;
QStringList languages() const;
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 992e1817c0..6d608a441b 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -37,6 +37,9 @@
#ifdef Q_OS_WIN
#include <qt_windows.h>
+#else
+#include <errno.h>
+#include <unistd.h>
#endif
@@ -94,7 +97,7 @@ static void envExpandWin(QString &args, const Environment *env, const QString *p
if (prev >= 0) {
const QString var = args.mid(prev + 1, that - prev - 1).toUpper();
const QString val = (var == cdName && pwd && !pwd->isEmpty())
- ? QDir::toNativeSeparators(*pwd) : env->value(var);
+ ? QDir::toNativeSeparators(*pwd) : env->expandedValueForKey(var);
if (!val.isEmpty()) { // Empty values are impossible, so this is an existence check
args.replace(prev, that - prev + 1, val);
off = prev + val.length();
@@ -394,7 +397,7 @@ static QStringList splitArgsUnix(const QString &args, bool abortOnMeta,
if (abortOnMeta)
goto metaerr; // Assume this is a shell builtin
} else {
- cret += env->value(vit);
+ cret += env->expandedValueForKey(env->key(vit));
}
}
if (!braced)
@@ -444,7 +447,7 @@ static QStringList splitArgsUnix(const QString &args, bool abortOnMeta,
if (abortOnMeta)
goto metaerr; // Assume this is a shell builtin
} else {
- val = env->value(vit);
+ val = env->expandedValueForKey(env->key(vit));
}
}
for (int i = 0; i < val.length(); i++) {
@@ -672,8 +675,8 @@ QtcProcess::QtcProcess(QObject *parent)
{
static int qProcessExitStatusMeta = qRegisterMetaType<QProcess::ExitStatus>();
static int qProcessProcessErrorMeta = qRegisterMetaType<QProcess::ProcessError>();
- Q_UNUSED(qProcessExitStatusMeta);
- Q_UNUSED(qProcessProcessErrorMeta);
+ Q_UNUSED(qProcessExitStatusMeta)
+ Q_UNUSED(qProcessProcessErrorMeta)
}
void QtcProcess::setUseCtrlCStub(bool enabled)
@@ -698,7 +701,7 @@ void QtcProcess::start()
qPrintable(m_commandLine.executable().toString()));
env = m_environment;
- QProcess::setEnvironment(env.toStringList());
+ QProcess::setProcessEnvironment(env.toProcessEnvironment());
} else {
env = Environment::systemEnvironment();
}
@@ -712,9 +715,17 @@ void QtcProcess::start()
if (osType == OsTypeWindows) {
QString args;
if (m_useCtrlCStub) {
- args = QtcProcess::quoteArg(QDir::toNativeSeparators(command));
+ if (m_lowPriority)
+ addArg(&args, "-nice");
+ addArg(&args, QDir::toNativeSeparators(command));
command = QCoreApplication::applicationDirPath()
+ QLatin1String("/qtcreator_ctrlc_stub.exe");
+ } else if (m_lowPriority) {
+#ifdef Q_OS_WIN
+ setCreateProcessArgumentsModifier([](CreateProcessArguments *args) {
+ args->flags |= BELOW_NORMAL_PRIORITY_CLASS;
+ });
+#endif
}
QtcProcess::addArgs(&args, arguments.toWindowsArgs());
#ifdef Q_OS_WIN
@@ -1208,6 +1219,19 @@ QString QtcProcess::expandMacros(const QString &str, AbstractMacroExpander *mx,
return ret;
}
+void QtcProcess::setupChildProcess()
+{
+#if defined Q_OS_UNIX
+ // nice value range is -20 to +19 where -20 is highest, 0 default and +19 is lowest
+ if (m_lowPriority) {
+ errno = 0;
+ if (::nice(5) == -1 && errno != 0)
+ qWarning("Failed to set nice value. Error: %d", errno);
+ }
+#endif
+ QProcess::setupChildProcess();
+}
+
bool QtcProcess::ArgIterator::next()
{
// We delay the setting of m_prev so we can still delete the last argument
diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h
index 5eeacf666e..ca3f9a5a86 100644
--- a/src/libs/utils/qtcprocess.h
+++ b/src/libs/utils/qtcprocess.h
@@ -45,6 +45,7 @@ public:
void start();
void terminate();
void interrupt();
+ void setLowPriority() { m_lowPriority = true; }
class QTCREATOR_UTILS_EXPORT Arguments
{
@@ -141,10 +142,13 @@ public:
};
private:
+ void setupChildProcess() override;
+
CommandLine m_commandLine;
Environment m_environment;
bool m_haveEnv = false;
bool m_useCtrlCStub = false;
+ bool m_lowPriority = false;
};
} // namespace Utils
diff --git a/src/libs/utils/savefile.cpp b/src/libs/utils/savefile.cpp
index b25432a280..8d07603ad8 100644
--- a/src/libs/utils/savefile.cpp
+++ b/src/libs/utils/savefile.cpp
@@ -207,15 +207,15 @@ void SaveFile::initializeUmask()
mode_t mask = umask(0); // get current umask
umask(mask); // set it back
- m_umask = ((mask & S_IRUSR) ? QFile::ReadOwner : QFlags<QFile::Permission>(0))
- | ((mask & S_IWUSR) ? QFile::WriteOwner : QFlags<QFile::Permission>(0))
- | ((mask & S_IXUSR) ? QFile::ExeOwner : QFlags<QFile::Permission>(0))
- | ((mask & S_IRGRP) ? QFile::ReadGroup : QFlags<QFile::Permission>(0))
- | ((mask & S_IWGRP) ? QFile::WriteGroup : QFlags<QFile::Permission>(0))
- | ((mask & S_IXGRP) ? QFile::ExeGroup : QFlags<QFile::Permission>(0))
- | ((mask & S_IROTH) ? QFile::ReadOther : QFlags<QFile::Permission>(0))
- | ((mask & S_IWOTH) ? QFile::WriteOther : QFlags<QFile::Permission>(0))
- | ((mask & S_IXOTH) ? QFile::ExeOther : QFlags<QFile::Permission>(0));
+ m_umask = ((mask & S_IRUSR) ? QFile::ReadOwner : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IWUSR) ? QFile::WriteOwner : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IXUSR) ? QFile::ExeOwner : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IRGRP) ? QFile::ReadGroup : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IWGRP) ? QFile::WriteGroup : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IXGRP) ? QFile::ExeGroup : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IROTH) ? QFile::ReadOther : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IWOTH) ? QFile::WriteOther : QFlags<QFile::Permission>(nullptr))
+ | ((mask & S_IXOTH) ? QFile::ExeOther : QFlags<QFile::Permission>(nullptr));
#endif
}
diff --git a/src/libs/utils/settingsaccessor.cpp b/src/libs/utils/settingsaccessor.cpp
index f6d90df7e0..bc34ec7f93 100644
--- a/src/libs/utils/settingsaccessor.cpp
+++ b/src/libs/utils/settingsaccessor.cpp
@@ -100,7 +100,7 @@ bool SettingsAccessor::saveSettings(const QVariantMap &data, QWidget *parent) co
*/
SettingsAccessor::RestoreData SettingsAccessor::readData(const FilePath &path, QWidget *parent) const
{
- Q_UNUSED(parent);
+ Q_UNUSED(parent)
RestoreData result = readFile(path);
if (!result.data.isEmpty())
result.data = preprocessReadSettings(result.data);
@@ -113,7 +113,7 @@ SettingsAccessor::RestoreData SettingsAccessor::readData(const FilePath &path, Q
optional<SettingsAccessor::Issue>
SettingsAccessor::writeData(const FilePath &path, const QVariantMap &data, QWidget *parent) const
{
- Q_UNUSED(parent);
+ Q_UNUSED(parent)
return writeFile(path, prepareToWriteSettings(data));
}
@@ -277,7 +277,10 @@ BackingUpSettingsAccessor::readData(const FilePath &path, QWidget *parent) const
QApplication::translate("Utils::SettingsAccessor",
"<p>No valid settings file could be found.</p>"
"<p>All settings files found in directory \"%1\" "
- "were unsuitable for the current version of %2.</p>")
+ "were unsuitable for the current version of %2, "
+ "for instance because they were written by an incompatible "
+ "version of %2, or because a different settings path "
+ "was used.</p>")
.arg(path.toUserOutput()).arg(applicationDisplayName), Issue::Type::ERROR);
i.buttons.insert(QMessageBox::Ok, DiscardAndContinue);
result.issue = i;
@@ -362,7 +365,7 @@ int VersionedBackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
optional<FilePath>
VersionedBackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const
{
- Q_UNUSED(data);
+ Q_UNUSED(data)
FilePath backupName = path;
const QByteArray oldEnvironmentId = settingsIdFromMap(oldData);
const int oldVersion = versionFromMap(oldData);
@@ -704,8 +707,8 @@ QVariantMap MergingSettingsAccessor::postprocessMerge(const QVariantMap &main,
const QVariantMap &secondary,
const QVariantMap &result) const
{
- Q_UNUSED(main);
- Q_UNUSED(secondary);
+ Q_UNUSED(main)
+ Q_UNUSED(secondary)
return result;
}
diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp
index 5a84c92f15..060c4003fa 100644
--- a/src/libs/utils/shellcommand.cpp
+++ b/src/libs/utils/shellcommand.cpp
@@ -68,12 +68,11 @@ class ShellCommandPrivate
{
public:
struct Job {
- explicit Job(const QString &wd, const FilePath &b, const QStringList &a, int t,
+ explicit Job(const QString &wd, const CommandLine &command, int t,
const ExitCodeInterpreter &interpreter);
QString workingDirectory;
- FilePath binary;
- QStringList arguments;
+ CommandLine command;
ExitCodeInterpreter exitCodeInterpreter;
int timeoutS;
};
@@ -113,11 +112,10 @@ ShellCommandPrivate::~ShellCommandPrivate()
delete m_progressParser;
}
-ShellCommandPrivate::Job::Job(const QString &wd, const FilePath &b, const QStringList &a,
+ShellCommandPrivate::Job::Job(const QString &wd, const CommandLine &command,
int t, const ExitCodeInterpreter &interpreter) :
workingDirectory(wd),
- binary(b),
- arguments(a),
+ command(command),
exitCodeInterpreter(interpreter),
timeoutS(t)
{
@@ -146,14 +144,14 @@ QString ShellCommand::displayName() const
return d->m_displayName;
if (!d->m_jobs.isEmpty()) {
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(0);
- QString result = job.binary.toFileInfo().baseName();
+ QString result = job.command.executable().toFileInfo().baseName();
if (!result.isEmpty())
result[0] = result.at(0).toTitleCase();
else
result = tr("UNKNOWN");
- if (!job.arguments.isEmpty())
- result += QLatin1Char(' ') + job.arguments.at(0);
+ if (!job.command.arguments().isEmpty())
+ result += ' ' + job.command.arguments().at(0);
return result;
}
@@ -195,17 +193,17 @@ void ShellCommand::addFlags(unsigned f)
d->m_flags |= f;
}
-void ShellCommand::addJob(const FilePath &binary, const QStringList &arguments,
+void ShellCommand::addJob(const CommandLine &command,
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
{
- addJob(binary, arguments, defaultTimeoutS(), workingDirectory, interpreter);
+ addJob(command, defaultTimeoutS(), workingDirectory, interpreter);
}
-void ShellCommand::addJob(const FilePath &binary, const QStringList &arguments, int timeoutS,
+void ShellCommand::addJob(const CommandLine &command, int timeoutS,
const QString &workingDirectory, const ExitCodeInterpreter &interpreter)
{
- d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), binary,
- arguments, timeoutS, interpreter));
+ d->m_jobs.push_back(Internal::ShellCommandPrivate::Job(workDirectory(workingDirectory), command,
+ timeoutS, interpreter));
}
void ShellCommand::execute()
@@ -240,7 +238,7 @@ unsigned ShellCommand::processFlags() const
void ShellCommand::addTask(QFuture<void> &future)
{
- Q_UNUSED(future);
+ Q_UNUSED(future)
}
int ShellCommand::timeoutS() const
@@ -287,7 +285,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
for (int j = 0; j < count; j++) {
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j);
SynchronousProcessResponse resp
- = runCommand(job.binary, job.arguments, job.timeoutS, job.workingDirectory,
+ = runCommand(job.command, job.timeoutS, job.workingDirectory,
job.exitCodeInterpreter);
stdOut += resp.stdOut();
stdErr += resp.stdErr();
@@ -319,8 +317,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
this->deleteLater();
}
-SynchronousProcessResponse ShellCommand::runCommand(const FilePath &binary,
- const QStringList &arguments, int timeoutS,
+SynchronousProcessResponse ShellCommand::runCommand(const CommandLine &command, int timeoutS,
const QString &workingDirectory,
const ExitCodeInterpreter &interpreter)
{
@@ -328,7 +325,7 @@ SynchronousProcessResponse ShellCommand::runCommand(const FilePath &binary,
const QString dir = workDirectory(workingDirectory);
- if (binary.isEmpty()) {
+ if (command.executable().isEmpty()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
}
@@ -336,31 +333,30 @@ SynchronousProcessResponse ShellCommand::runCommand(const FilePath &binary,
QSharedPointer<OutputProxy> proxy(d->m_proxyFactory());
if (!(d->m_flags & SuppressCommandLogging))
- emit proxy->appendCommand(dir, binary, arguments);
+ emit proxy->appendCommand(dir, command);
if ((d->m_flags & FullySynchronously)
|| (!(d->m_flags & NoFullySync)
&& QThread::currentThread() == QCoreApplication::instance()->thread())) {
- response = runFullySynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
+ response = runFullySynchronous(command, proxy, timeoutS, dir, interpreter);
} else {
- response = runSynchronous(binary, arguments, proxy, timeoutS, dir, interpreter);
+ response = runSynchronous(command, proxy, timeoutS, dir, interpreter);
}
if (!d->m_aborted) {
// Success/Fail message in appropriate window?
if (response.result == SynchronousProcessResponse::Finished) {
if (d->m_flags & ShowSuccessMessage)
- emit proxy->appendMessage(response.exitMessage(binary.toUserOutput(), timeoutS));
+ emit proxy->appendMessage(response.exitMessage(command.toUserOutput(), timeoutS));
} else if (!(d->m_flags & SuppressFailMessage)) {
- emit proxy->appendError(response.exitMessage(binary.toUserOutput(), timeoutS));
+ emit proxy->appendError(response.exitMessage(command.toUserOutput(), timeoutS));
}
}
return response;
}
-SynchronousProcessResponse ShellCommand::runFullySynchronous(const FilePath &binary,
- const QStringList &arguments,
+SynchronousProcessResponse ShellCommand::runFullySynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS,
const QString &workingDirectory,
@@ -380,7 +376,7 @@ SynchronousProcessResponse ShellCommand::runFullySynchronous(const FilePath &bin
process.setTimeoutS(timeoutS);
process.setExitCodeInterpreter(interpreter);
- SynchronousProcessResponse resp = process.runBlocking(binary.toString(), arguments);
+ SynchronousProcessResponse resp = process.runBlocking(cmd);
if (!d->m_aborted) {
const QString stdErr = resp.stdErr();
@@ -399,8 +395,7 @@ SynchronousProcessResponse ShellCommand::runFullySynchronous(const FilePath &bin
return resp;
}
-SynchronousProcessResponse ShellCommand::runSynchronous(const FilePath &binary,
- const QStringList &arguments,
+SynchronousProcessResponse ShellCommand::runSynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS,
const QString &workingDirectory,
@@ -460,7 +455,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const FilePath &binary,
process.setTimeoutS(timeoutS);
process.setExitCodeInterpreter(interpreter);
- return process.run(binary.toString(), arguments);
+ return process.run(cmd);
}
const QVariant &ShellCommand::cookie() const
diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h
index f0c427ef53..a54e8fb401 100644
--- a/src/libs/utils/shellcommand.h
+++ b/src/libs/utils/shellcommand.h
@@ -46,7 +46,7 @@ QT_END_NAMESPACE
namespace Utils {
-class FilePath;
+class CommandLine;
namespace Internal { class ShellCommandPrivate; }
class QTCREATOR_UTILS_EXPORT ProgressParser
@@ -79,8 +79,7 @@ signals:
void append(const QString &text);
void appendSilently(const QString &text);
void appendError(const QString &text);
- void appendCommand(const QString &workingDirectory, const Utils::FilePath &binary,
- const QStringList &args);
+ void appendCommand(const QString &workingDirectory, const Utils::CommandLine &command);
void appendMessage(const QString &text);
};
@@ -112,10 +111,12 @@ public:
QString displayName() const;
void setDisplayName(const QString &name);
- void addJob(const FilePath &binary, const QStringList &arguments,
- const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
- void addJob(const FilePath &binary, const QStringList &arguments, int timeoutS,
- const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
+ void addJob(const CommandLine &command,
+ const QString &workingDirectory = QString(),
+ const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
+ void addJob(const CommandLine &command, int timeoutS,
+ const QString &workingDirectory = QString(),
+ const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
void execute(); // Execute tasks asynchronously!
void abort();
bool lastExecutionSuccess() const;
@@ -145,7 +146,7 @@ public:
// This is called once per job in a thread.
// When called from the UI thread it will execute fully synchronously, so no signals will
// be triggered!
- virtual SynchronousProcessResponse runCommand(const FilePath &binary, const QStringList &arguments,
+ virtual SynchronousProcessResponse runCommand(const CommandLine &command,
int timeoutS,
const QString &workingDirectory = QString(),
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
@@ -171,12 +172,12 @@ private:
void run(QFutureInterface<void> &future);
// Run without a event loop in fully blocking mode. No signals will be delivered.
- SynchronousProcessResponse runFullySynchronous(const FilePath &binary, const QStringList &arguments,
+ SynchronousProcessResponse runFullySynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
// Run with an event loop. Signals will be delivered.
- SynchronousProcessResponse runSynchronous(const FilePath &binary, const QStringList &arguments,
+ SynchronousProcessResponse runSynchronous(const CommandLine &cmd,
QSharedPointer<OutputProxy> proxy,
int timeoutS, const QString &workingDirectory,
const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter);
diff --git a/src/libs/utils/smallstring.h b/src/libs/utils/smallstring.h
index d3fa44aa78..6708560ac8 100644
--- a/src/libs/utils/smallstring.h
+++ b/src/libs/utils/smallstring.h
@@ -181,7 +181,7 @@ public:
}
BasicSmallString(BasicSmallString &&other) noexcept
- : m_data(other.m_data)
+ : m_data(std::move(other.m_data))
{
other.m_data.reset();
}
@@ -193,8 +193,8 @@ public:
this->~BasicSmallString();
- m_data = other.m_data;
- other.m_data = Internal::StringDataLayout<Size>();
+ m_data = std::move(other.m_data);
+ other.m_data.reset();
return *this;
}
@@ -945,8 +945,8 @@ clone(const std::unordered_map<Key, Value, Hash, KeyEqual, Allocator> &map)
return clonedMap;
}
-template <typename Type>
-std::vector<Type> clone(const std::vector<Type> &vector)
+template<typename Type>
+Type clone(const Type &vector)
{
return vector;
}
diff --git a/src/libs/utils/smallstringio.h b/src/libs/utils/smallstringio.h
index 6e9e2a7bc2..5a0dd71c8a 100644
--- a/src/libs/utils/smallstringio.h
+++ b/src/libs/utils/smallstringio.h
@@ -91,7 +91,9 @@ std::ostream &operator<<(std::ostream &out, const BasicSmallString<Size> &string
inline
std::ostream &operator<<(std::ostream &out, SmallStringView string)
{
- return out << PathString(string);
+ out.write(string.data(), std::streamsize(string.size()));
+
+ return out;
}
template <typename String>
diff --git a/src/libs/utils/smallstringvector.h b/src/libs/utils/smallstringvector.h
index ed1acc2e7b..724cf7e717 100644
--- a/src/libs/utils/smallstringvector.h
+++ b/src/libs/utils/smallstringvector.h
@@ -117,16 +117,7 @@ public:
push_back(std::move(string));
}
- BasicSmallStringVector clone() const
- {
- BasicSmallStringVector clonedVector;
- clonedVector.reserve(Base::size());
-
- for (auto &&entry : *this)
- clonedVector.push_back(entry.clone());
-
- return clonedVector;
- }
+ BasicSmallStringVector clone() const { return *this; }
operator std::vector<std::string>() const
{
diff --git a/src/libs/utils/stringutils.cpp b/src/libs/utils/stringutils.cpp
index 161cf44e74..f73e9d8144 100644
--- a/src/libs/utils/stringutils.cpp
+++ b/src/libs/utils/stringutils.cpp
@@ -136,6 +136,7 @@ bool AbstractMacroExpander::expandNestedMacros(const QString &str, int *pos, QSt
QString *currArg = &varName;
QChar prev;
QChar c;
+ QChar replacementChar;
bool replaceAll = false;
int i = *pos;
@@ -192,13 +193,14 @@ bool AbstractMacroExpander::expandNestedMacros(const QString &str, int *pos, QSt
} else if (currArg == &varName && c == '-' && prev == ':' && validateVarName(varName)) {
varName.chop(1);
currArg = &defaultValue;
- } else if (currArg == &varName && c == '/' && validateVarName(varName)) {
+ } else if (currArg == &varName && (c == '/' || c == '#') && validateVarName(varName)) {
+ replacementChar = c;
currArg = &pattern;
- if (i < strLen && str.at(i) == '/') {
+ if (i < strLen && str.at(i) == replacementChar) {
++i;
replaceAll = true;
}
- } else if (currArg == &pattern && c == '/') {
+ } else if (currArg == &pattern && c == replacementChar) {
currArg = &replace;
} else {
*currArg += c;
diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp
index 70e65fc8c9..f197494b4c 100644
--- a/src/libs/utils/synchronousprocess.cpp
+++ b/src/libs/utils/synchronousprocess.cpp
@@ -271,7 +271,7 @@ public:
QTimer m_timer;
QEventLoop m_eventLoop;
SynchronousProcessResponse m_result;
- QString m_binary;
+ FilePath m_binary;
ChannelBuffer m_stdOut;
ChannelBuffer m_stdErr;
ExitCodeInterpreter m_exitCodeInterpreter = defaultExitCodeInterpreter;
@@ -293,7 +293,7 @@ void SynchronousProcessPrivate::clearForRun()
m_result.clear();
m_result.codec = m_codec;
m_startFailure = false;
- m_binary.clear();
+ m_binary = {};
}
// ----------- SynchronousProcess
@@ -446,12 +446,10 @@ static bool isGuiThread()
return QThread::currentThread() == QCoreApplication::instance()->thread();
}
-SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
- const QStringList &args,
+SynchronousProcessResponse SynchronousProcess::run(const CommandLine &cmd,
const QByteArray &writeData)
{
- qCDebug(processLog).noquote() << "Starting:"
- << QtcProcess::joinArgs(QStringList(binary) + args);
+ qCDebug(processLog).noquote() << "Starting:" << cmd.toUserOutput();
ExecuteOnDestruction logResult([this] {
qCDebug(processLog) << d->m_result;
});
@@ -461,12 +459,12 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
// On Windows, start failure is triggered immediately if the
// executable cannot be found in the path. Do not start the
// event loop in that case.
- d->m_binary = binary;
+ d->m_binary = cmd.executable();
// using QProcess::start() and passing program, args and OpenMode results in a different
// quoting of arguments than using QProcess::setArguments() beforehand and calling start()
// only with the OpenMode
- d->m_process.setProgram(binary);
- d->m_process.setArguments(args);
+ d->m_process.setProgram(cmd.executable().toString());
+ d->m_process.setArguments(cmd.splitArguments());
connect(&d->m_process, &QProcess::started, this, [this, writeData] {
if (!writeData.isEmpty()) {
int pos = 0;
@@ -503,10 +501,9 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
return d->m_result;
}
-SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary, const QStringList &args)
+SynchronousProcessResponse SynchronousProcess::runBlocking(const CommandLine &cmd)
{
- qCDebug(processLog).noquote() << "Starting blocking:"
- << QtcProcess::joinArgs(QStringList(binary) + args);
+ qCDebug(processLog).noquote() << "Starting blocking:" << cmd.toUserOutput();
ExecuteOnDestruction logResult([this] {
qCDebug(processLog) << d->m_result;
});
@@ -516,8 +513,8 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary
// On Windows, start failure is triggered immediately if the
// executable cannot be found in the path. Do not start the
// event loop in that case.
- d->m_binary = binary;
- d->m_process.start(binary, args, QIODevice::ReadOnly);
+ d->m_binary = cmd.executable();
+ d->m_process.start(cmd.executable().toString(), cmd.splitArguments(), QIODevice::ReadOnly);
if (!d->m_process.waitForStarted(d->m_maxHangTimerCount * 1000)
&& d->m_process.state() == QProcess::NotRunning) {
d->m_result.result = SynchronousProcessResponse::StartFailed;
@@ -585,7 +582,7 @@ void SynchronousProcess::slotTimeout()
if (debug)
qDebug() << Q_FUNC_INFO << "HANG detected, killing";
d->m_waitingForUser = true;
- const bool terminate = !d->m_timeOutMessageBoxEnabled || askToKill(d->m_binary);
+ const bool terminate = !d->m_timeOutMessageBoxEnabled || askToKill(d->m_binary.toString());
d->m_waitingForUser = false;
if (terminate) {
SynchronousProcess::stopProcess(d->m_process);
diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h
index d8e3275030..071e20e007 100644
--- a/src/libs/utils/synchronousprocess.h
+++ b/src/libs/utils/synchronousprocess.h
@@ -38,6 +38,7 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
namespace Utils {
class SynchronousProcessPrivate;
+class CommandLine;
/* Result of SynchronousProcess execution */
class QTCREATOR_UTILS_EXPORT SynchronousProcessResponse
@@ -126,10 +127,10 @@ public:
void setExitCodeInterpreter(const ExitCodeInterpreter &interpreter);
ExitCodeInterpreter exitCodeInterpreter() const;
- // Starts an nested event loop and runs the binary with the arguments
- SynchronousProcessResponse run(const QString &binary, const QStringList &args, const QByteArray &writeData = {});
- // Starts the binary with the arguments blocking the UI fully
- SynchronousProcessResponse runBlocking(const QString &binary, const QStringList &args);
+ // Starts a nested event loop and runs the command
+ SynchronousProcessResponse run(const CommandLine &cmd, const QByteArray &writeData = {});
+ // Starts the command blocking the UI fully
+ SynchronousProcessResponse runBlocking(const CommandLine &cmd);
// Create a (derived) processes with flags applied.
static QSharedPointer<QProcess> createProcess(unsigned flags);
diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp
index ba10ca56ae..ad6aa2242a 100644
--- a/src/libs/utils/textutils.cpp
+++ b/src/libs/utils/textutils.cpp
@@ -80,7 +80,7 @@ QString textAt(QTextCursor tc, int pos, int length)
return tc.selectedText().replace(QChar::ParagraphSeparator, QLatin1Char('\n'));
}
-QTextCursor selectAt(QTextCursor textCursor, uint line, uint column, uint length)
+QTextCursor selectAt(QTextCursor textCursor, int line, int column, uint length)
{
if (line < 1)
line = 1;
@@ -190,5 +190,30 @@ QString utf16LineTextInUtf8Buffer(const QByteArray &utf8Buffer, int currentUtf8O
utf8Buffer.mid(lineStartUtf8Offset, lineEndUtf8Offset - lineStartUtf8Offset));
}
+static bool isByteOfMultiByteCodePoint(unsigned char byte)
+{
+ return byte & 0x80; // Check if most significant bit is set
+}
+
+bool utf8AdvanceCodePoint(const char *&current)
+{
+ if (Q_UNLIKELY(*current == '\0'))
+ return false;
+
+ // Process multi-byte UTF-8 code point (non-latin1)
+ if (Q_UNLIKELY(isByteOfMultiByteCodePoint(*current))) {
+ unsigned trailingBytesCurrentCodePoint = 1;
+ for (unsigned char c = (*current) << 2; isByteOfMultiByteCodePoint(c); c <<= 1)
+ ++trailingBytesCurrentCodePoint;
+ current += trailingBytesCurrentCodePoint + 1;
+
+ // Process single-byte UTF-8 code point (latin1)
+ } else {
+ ++current;
+ }
+
+ return true;
+}
+
} // Text
} // Utils
diff --git a/src/libs/utils/textutils.h b/src/libs/utils/textutils.h
index fb0efe3f15..ae088a54ca 100644
--- a/src/libs/utils/textutils.h
+++ b/src/libs/utils/textutils.h
@@ -48,13 +48,14 @@ QTCREATOR_UTILS_EXPORT int positionInText(const QTextDocument *textDocument, int
QTCREATOR_UTILS_EXPORT QString textAt(QTextCursor tc, int pos, int length);
-QTCREATOR_UTILS_EXPORT QTextCursor selectAt(QTextCursor textCursor, uint line, uint column, uint length);
+QTCREATOR_UTILS_EXPORT QTextCursor selectAt(QTextCursor textCursor, int line, int column, uint length);
QTCREATOR_UTILS_EXPORT QTextCursor flippedCursor(const QTextCursor &cursor);
QTCREATOR_UTILS_EXPORT QTextCursor wordStartCursor(const QTextCursor &cursor);
QTCREATOR_UTILS_EXPORT QString wordUnderCursor(const QTextCursor &cursor);
+QTCREATOR_UTILS_EXPORT bool utf8AdvanceCodePoint(const char *&current);
QTCREATOR_UTILS_EXPORT int utf8NthLineOffset(const QTextDocument *textDocument,
const QByteArray &buffer,
int line);
diff --git a/src/libs/utils/tooltip/tips.cpp b/src/libs/utils/tooltip/tips.cpp
index f6927efef5..116b0832ad 100644
--- a/src/libs/utils/tooltip/tips.cpp
+++ b/src/libs/utils/tooltip/tips.cpp
@@ -283,7 +283,7 @@ void WidgetTip::pinToolTipWidget(QWidget *parent)
bool WidgetTip::canHandleContentReplacement(int typeId) const
{
// Always create a new widget.
- Q_UNUSED(typeId);
+ Q_UNUSED(typeId)
return false;
}
diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp
index 1f8fbd5756..89c8d5aa4c 100644
--- a/src/libs/utils/treemodel.cpp
+++ b/src/libs/utils/treemodel.cpp
@@ -521,7 +521,7 @@ void ModelTest::data()
*/
void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
{
- Q_UNUSED(end);
+ Q_UNUSED(end)
Changing c;
c.parent = parent;
c.oldSize = model->rowCount(parent);
@@ -628,22 +628,22 @@ int TreeItem::indexOf(const TreeItem *item) const
QVariant TreeItem::data(int column, int role) const
{
- Q_UNUSED(column);
- Q_UNUSED(role);
+ Q_UNUSED(column)
+ Q_UNUSED(role)
return QVariant();
}
bool TreeItem::setData(int column, const QVariant &data, int role)
{
- Q_UNUSED(column);
- Q_UNUSED(data);
- Q_UNUSED(role);
+ Q_UNUSED(column)
+ Q_UNUSED(data)
+ Q_UNUSED(role)
return false;
}
Qt::ItemFlags TreeItem::flags(int column) const
{
- Q_UNUSED(column);
+ Q_UNUSED(column)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
@@ -1195,7 +1195,7 @@ QVariant StaticTreeItem::data(int column, int role) const
Qt::ItemFlags StaticTreeItem::flags(int column) const
{
- Q_UNUSED(column);
+ Q_UNUSED(column)
return Qt::ItemIsEnabled;
}
diff --git a/src/libs/utils/treeviewcombobox.cpp b/src/libs/utils/treeviewcombobox.cpp
index 36a62d3694..b02bd32410 100644
--- a/src/libs/utils/treeviewcombobox.cpp
+++ b/src/libs/utils/treeviewcombobox.cpp
@@ -83,9 +83,9 @@ QModelIndex TreeViewComboBox::lastIndex(const QModelIndex &index)
void TreeViewComboBox::wheelEvent(QWheelEvent *e)
{
QModelIndex index = m_view->currentIndex();
- if (e->delta() > 0)
+ if (e->angleDelta().y() > 0)
index = indexAbove(index);
- else if (e->delta() < 0)
+ else if (e->angleDelta().y() < 0)
index = indexBelow(index);
e->accept();
diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri
index a4697e0622..e2a3306081 100644
--- a/src/libs/utils/utils-lib.pri
+++ b/src/libs/utils/utils-lib.pri
@@ -24,9 +24,14 @@ win32: LIBS += -liphlpapi -lws2_32
SOURCES += \
$$PWD/globalfilechangeblocker.cpp \
$$PWD/benchmarker.cpp \
+ $$PWD/displayname.cpp \
$$PWD/environment.cpp \
$$PWD/environmentmodel.cpp \
$$PWD/environmentdialog.cpp \
+ $$PWD/namevaluedictionary.cpp \
+ $$PWD/namevalueitem.cpp \
+ $$PWD/namevaluemodel.cpp \
+ $$PWD/namevaluesdialog.cpp \
$$PWD/qrcparser.cpp \
$$PWD/qtcprocess.cpp \
$$PWD/reloadpromptutils.cpp \
@@ -125,19 +130,23 @@ SOURCES += \
$$PWD/fixedsizeclicklabel.cpp \
$$PWD/removefiledialog.cpp \
$$PWD/differ.cpp \
- $$PWD/jsontreeitem.cpp
-
-
-win32:SOURCES += $$PWD/consoleprocess_win.cpp
-else:SOURCES += $$PWD/consoleprocess_unix.cpp
+ $$PWD/jsontreeitem.cpp \
+ $$PWD/namevaluevalidator.cpp \
+ $$PWD/camelcasecursor.cpp
HEADERS += \
+ $$PWD/environmentfwd.h \
$$PWD/genericconstants.h \
$$PWD/globalfilechangeblocker.h \
$$PWD/benchmarker.h \
+ $$PWD/displayname.h \
$$PWD/environment.h \
$$PWD/environmentmodel.h \
$$PWD/environmentdialog.h \
+ $$PWD/namevaluedictionary.h \
+ $$PWD/namevalueitem.h \
+ $$PWD/namevaluemodel.h \
+ $$PWD/namevaluesdialog.h \
$$PWD/pointeralgorithm.h \
$$PWD/qrcparser.h \
$$PWD/qtcprocess.h \
@@ -170,7 +179,6 @@ HEADERS += \
$$PWD/qtcolorbutton.h \
$$PWD/savedaction.h \
$$PWD/consoleprocess.h \
- $$PWD/consoleprocess_p.h \
$$PWD/synchronousprocess.h \
$$PWD/savefile.h \
$$PWD/fileutils.h \
@@ -269,7 +277,9 @@ HEADERS += \
$$PWD/differ.h \
$$PWD/cpplanguage_details.h \
$$PWD/jsontreeitem.h \
- $$PWD/listmodel.h
+ $$PWD/listmodel.h \
+ $$PWD/namevaluevalidator.h \
+ $$PWD/camelcasecursor.h
FORMS += $$PWD/filewizardpage.ui \
$$PWD/newclasswidget.ui \
diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs
index 10368cd539..10ddfe1d07 100644
--- a/src/libs/utils/utils.qbs
+++ b/src/libs/utils/utils.qbs
@@ -50,6 +50,8 @@ Project {
"benchmarker.h",
"buildablehelperlibrary.cpp",
"buildablehelperlibrary.h",
+ "camelcasecursor.cpp",
+ "camelcasecursor.h",
"categorysortfiltermodel.cpp",
"categorysortfiltermodel.h",
"changeset.cpp",
@@ -66,7 +68,6 @@ Project {
"completingtextedit.h",
"consoleprocess.cpp",
"consoleprocess.h",
- "consoleprocess_p.h",
"cpplanguage_details.h",
"crumblepath.cpp",
"crumblepath.h",
@@ -79,6 +80,8 @@ Project {
"detailswidget.h",
"differ.cpp",
"differ.h",
+ "displayname.cpp",
+ "displayname.h",
"dropsupport.cpp",
"dropsupport.h",
"elfreader.cpp",
@@ -151,6 +154,16 @@ Project {
"macroexpander.cpp",
"macroexpander.h",
"mapreduce.h",
+ "namevaluedictionary.cpp",
+ "namevaluedictionary.h",
+ "namevalueitem.cpp",
+ "namevalueitem.h",
+ "namevaluemodel.cpp",
+ "namevaluemodel.h",
+ "namevaluesdialog.cpp",
+ "namevaluesdialog.h",
+ "namevaluevalidator.cpp",
+ "namevaluevalidator.h",
"navigationtreeview.cpp",
"navigationtreeview.h",
"networkaccessmanager.cpp",
@@ -202,7 +215,9 @@ Project {
"qtcprocess.h",
"reloadpromptutils.cpp",
"reloadpromptutils.h",
- "removefiledialog.cpp", "removefiledialog.h", "removefiledialog.ui",
+ "removefiledialog.cpp",
+ "removefiledialog.h",
+ "removefiledialog.ui",
"runextensions.cpp",
"runextensions.h",
"savedaction.cpp",
@@ -301,22 +316,6 @@ Project {
}
Group {
- name: "WindowsUtils"
- condition: qbs.targetOS.contains("windows")
- files: [
- "consoleprocess_win.cpp",
- ]
- }
-
- Group {
- name: "ConsoleProcess_unix"
- condition: qbs.targetOS.contains("unix")
- files: [
- "consoleprocess_unix.cpp",
- ]
- }
-
- Group {
name: "FileUtils_macos"
condition: qbs.targetOS.contains("macos")
files: [
diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc
index 1de3861d65..180c5e5b43 100644
--- a/src/libs/utils/utils.qrc
+++ b/src/libs/utils/utils.qrc
@@ -142,8 +142,14 @@
<file>images/Desktop.png</file>
<file>images/interrupt_small.png</file>
<file>images/interrupt_small@2x.png</file>
+ <file>images/run_file.png</file>
+ <file>images/run_file@2x.png</file>
<file>images/run_small.png</file>
<file>images/run_small@2x.png</file>
+ <file>images/runselected_boxes.png</file>
+ <file>images/runselected_boxes@2x.png</file>
+ <file>images/runselected_tickmarks.png</file>
+ <file>images/runselected_tickmarks@2x.png</file>
<file>images/stop_small.png</file>
<file>images/stop_small@2x.png</file>
<file>images/boundingrect.png</file>
@@ -223,6 +229,12 @@
<file>images/toggleprogressdetails@2x.png</file>
<file>images/unknownfile.png</file>
<file>images/dir.png</file>
+ <file>images/online.png</file>
+ <file>images/online@2x.png</file>
+ <file>images/download_arrow.png</file>
+ <file>images/download_arrow@2x.png</file>
+ <file>images/download_base.png</file>
+ <file>images/download_base@2x.png</file>
<file alias="mimetypes/freedesktop.org.xml" compression-algorithm="best">../3rdparty/xdg/freedesktop.org.xml</file>
</qresource>
<qresource prefix="/codemodel">
diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp
index 2227f530c6..c83f74a5ce 100644
--- a/src/libs/utils/utilsicons.cpp
+++ b/src/libs/utils/utilsicons.cpp
@@ -194,6 +194,11 @@ const Icon SORT_ALPHABETICALLY_TOOLBAR({
{QLatin1String(":/utils/images/sort_alphabetically.png"), Theme::IconsBaseColor}});
const Icon TOGGLE_PROGRESSDETAILS_TOOLBAR({
{QLatin1String(":/utils/images/toggleprogressdetails.png"), Theme::IconsBaseColor}});
+const Icon ONLINE_TOOLBAR({
+ {QLatin1String(":/utils/images/online.png"), Theme::IconsBaseColor}});
+const Icon DOWNLOAD({
+ {QLatin1String(":/utils/images/download_arrow.png"), Theme::IconsRunColor},
+ {QLatin1String(":/utils/images/download_base.png"), Theme::PanelTextColorDark}}, Icon::Tint);
const Icon WARNING({
{QLatin1String(":/utils/images/warningfill.png"), Theme::BackgroundColorNormal},
diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h
index ae6cd4d1dc..8505aed941 100644
--- a/src/libs/utils/utilsicons.h
+++ b/src/libs/utils/utilsicons.h
@@ -113,6 +113,8 @@ QTCREATOR_UTILS_EXPORT extern const Icon LINK;
QTCREATOR_UTILS_EXPORT extern const Icon LINK_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon SORT_ALPHABETICALLY_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon TOGGLE_PROGRESSDETAILS_TOOLBAR;
+QTCREATOR_UTILS_EXPORT extern const Icon ONLINE_TOOLBAR;
+QTCREATOR_UTILS_EXPORT extern const Icon DOWNLOAD;
QTCREATOR_UTILS_EXPORT extern const Icon INFO;
QTCREATOR_UTILS_EXPORT extern const Icon INFO_TOOLBAR;
diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp
index 5190e11fca..69eb0d11e8 100644
--- a/src/libs/utils/winutils.cpp
+++ b/src/libs/utils/winutils.cpp
@@ -131,9 +131,9 @@ QTCREATOR_UTILS_EXPORT QString winGetDLLVersion(WinDLLVersionType t,
}
return rc;
#endif
- Q_UNUSED(t);
- Q_UNUSED(name);
- Q_UNUSED(errorMessage);
+ Q_UNUSED(t)
+ Q_UNUSED(name)
+ Q_UNUSED(errorMessage)
return QString();
}
@@ -182,7 +182,7 @@ QTCREATOR_UTILS_EXPORT QString imageName(quint32 processId)
result = QString::fromUtf16(reinterpret_cast<const ushort*>(path));
CloseHandle(handle);
#else
- Q_UNUSED(processId);
+ Q_UNUSED(processId)
#endif
return result;
}
diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp
index 2680f41c2d..4efd1495b7 100644
--- a/src/libs/utils/wizard.cpp
+++ b/src/libs/utils/wizard.cpp
@@ -66,7 +66,7 @@ public:
m_indicatorLabel->setFixedSize(m_indicatorPixmap.size());
m_titleLabel = new QLabel(title, this);
auto l = new QHBoxLayout(this);
- l->setMargin(0);
+ l->setContentsMargins(0, 0, 0, 0);
l->addWidget(m_indicatorLabel);
l->addWidget(m_titleLabel);
}