Allow other root XML than entity.

Implements a `GetOnlyChild()`, following discussion at
https://irclogs.wildfiregames.com/%230ad-dev/2022-05-06-QuakeNet-%230ad-dev.log.

Differential revision: https://code.wildfiregames.com/D4738
Comments by: @phosit, @Stan, @vladislavbelov, @wraitii
This was SVN commit r27323.
This commit is contained in:
Freagarach
2022-12-30 07:34:23 +00:00
parent 5044850f93
commit ded41eab31
9 changed files with 26 additions and 9 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -50,6 +50,7 @@ public:
TS_ASSERT_EQUALS(node.GetChild("test").GetChild("Bar").GetChild("Baz").ToInt(), 3);
TS_ASSERT(node.GetChild("test").GetChild("Qux").IsOk());
TS_ASSERT(!node.GetChild("test").GetChild("Qux").GetChild("Baz").IsOk());
TS_ASSERT_STR_EQUALS(node.GetChild("test").ToXMLString(), node.GetOnlyChild().ToXMLString());
CParamNode nullOne(false);
CParamNode nullTwo = nullOne;