hydrogen 1.2.3
Future.cpp
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see https://www.gnu.org/licenses
19 *
20 */
21
22#include <core/Helpers/Future.h>
23
24#include <core/Helpers/Xml.h>
25#include <core/Basics/Drumkit.h>
27
28namespace H2Core {
29
30std::vector<std::shared_ptr<DrumkitComponent>> Future::loadDrumkitComponentsFromKit( XMLNode* pNode ) {
31 std::vector<std::shared_ptr<DrumkitComponent>> pComponents;
32 XMLNode componentListNode = pNode->firstChildElement( "componentList" );
33 if ( ! componentListNode.isNull() ) {
34 XMLNode componentNode = componentListNode.firstChildElement( "drumkitComponent" );
35 while ( ! componentNode.isNull() ) {
36 auto pDrumkitComponent = DrumkitComponent::load_from( &componentNode );
37 if ( pDrumkitComponent != nullptr ) {
38 pComponents.push_back(pDrumkitComponent);
39 }
40
41 componentNode = componentNode.nextSiblingElement( "drumkitComponent" );
42 }
43 } else {
44 WARNINGLOG( "componentList node not found" );
45 auto pDrumkitComponent = std::make_shared<DrumkitComponent>( 0, "Main" );
46 pComponents.push_back(pDrumkitComponent);
47 }
48
49 return std::move( pComponents );
50}
51};
#define WARNINGLOG(x)
Definition Object.h:238
static std::shared_ptr< DrumkitComponent > load_from(XMLNode *node)
static std::vector< std::shared_ptr< DrumkitComponent > > loadDrumkitComponentsFromKit(XMLNode *pNode)
Definition Future.cpp:30
XMLNode is a subclass of QDomNode with read and write values methods.
Definition Xml.h:39