Files
o3de/Code/Editor/Util/XmlTemplate.h
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

59 lines
1.8 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
*
*/
// Description : CXmlTemplate declaration.
#ifndef CRYINCLUDE_EDITOR_UTIL_XMLTEMPLATE_H
#define CRYINCLUDE_EDITOR_UTIL_XMLTEMPLATE_H
#pragma once
/*!
* CXmlTemplate is XML base template of parameters.
*
*/
class CXmlTemplate
{
public:
//! Scans properties of XML template,
//! for each property try to find corresponding attribute in specified XML node, and copy
//! value to Value attribute of template.
static void GetValues(XmlNodeRef& templateNode, const XmlNodeRef& fromNode);
//! Scans properties of XML template, fetch Value attribute of each and put as Attribute in
//! specified XML node.
static void SetValues(const XmlNodeRef& templateNode, XmlNodeRef& toNode);
static bool SetValues(const XmlNodeRef& templateNode, XmlNodeRef& toNode, const XmlNodeRef& modifiedNode);
//! Add parameter to template.
static void AddParam(XmlNodeRef& templ, const char* paramName, bool value);
static void AddParam(XmlNodeRef& templ, const char* paramName, int value, int min = 0, int max = 10000);
static void AddParam(XmlNodeRef& templ, const char* paramName, float value, float min = -10000, float max = 10000);
static void AddParam(XmlNodeRef& templ, const char* paramName, const char* sValue);
};
/*!
* CXmlTemplateRegistry is a collection of all registred templates.
*/
class CXmlTemplateRegistry
{
public:
CXmlTemplateRegistry();
void LoadTemplates(const QString& path);
void AddTemplate(const QString& name, XmlNodeRef& tmpl);
XmlNodeRef FindTemplate(const QString& name);
private:
StdMap<QString, XmlNodeRef> m_templates;
};
#endif // CRYINCLUDE_EDITOR_UTIL_XMLTEMPLATE_H