Files
o3de/Gems/AudioSystem/Code/Source/Editor/AudioControlsLoader.h
T
amzn-phist 5b148b1f40 Convert legacy XML handling to rapidxml
Updates the Audio Controls Editor code to use rapidxml instead of legacy
xml apis.  Further makes improvements to path manipulations away from
strings towards PathView apis and similar.

Fixes some issues encountered with memory management when handling xml
data that did not occur previously.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
2021-07-22 17:37:44 -05:00

63 lines
2.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/std/containers/set.h>
#include <AzCore/XML/rapidxml.h>
#include <ACETypes.h>
#include <AudioControl.h>
#include <QString>
class QStandardItemModel;
class QStandardItem;
namespace AudioControls
{
class CATLControlsModel;
class IAudioSystemEditor;
//-------------------------------------------------------------------------------------------//
class CAudioControlsLoader
{
public:
CAudioControlsLoader(CATLControlsModel* atlControlsModel, QStandardItemModel* layoutModel, IAudioSystemEditor* audioSystemImpl);
const FilepathSet& GetLoadedFilenamesList();
void LoadAll();
void LoadControls();
void LoadScopes();
private:
void LoadAllLibrariesInFolder(const AZStd::string_view folderPath, const AZStd::string_view level);
void LoadControlsLibrary(const AZ::rapidxml::xml_node<char>* rootNode, const AZStd::string_view filePath, const AZStd::string_view level, const AZStd::string_view fileName);
CATLControl* LoadControl(AZ::rapidxml::xml_node<char>* node, QStandardItem* folderItem, const AZStd::string_view scope);
void LoadPreloadConnections(AZ::rapidxml::xml_node<char>* node, CATLControl* control);
void LoadConnections(AZ::rapidxml::xml_node<char>* rootNode, CATLControl* control);
void CreateDefaultControls();
QStandardItem* AddControl(CATLControl* control, QStandardItem* folderItem);
void LoadScopesImpl(const AZStd::string_view levelsFolder);
QStandardItem* AddUniqueFolderPath(QStandardItem* parentItem, const QString& path);
QStandardItem* AddFolder(QStandardItem* parentItem, const QString& name);
CATLControl* CreateInternalSwitchState(CATLControl* parentControl, const AZStd::string& switchName, const AZStd::string& stateName);
CATLControlsModel* m_atlControlsModel;
QStandardItemModel* m_layoutModel;
IAudioSystemEditor* m_audioSystemImpl;
FilepathSet m_loadedFilenames;
};
} // namespace AudioControls