Refactor all element name pairs into clearer struct names - definitions

This commit is contained in:
bgbsww
2024-07-19 16:22:49 -04:00
parent 608cb182e5
commit 3db680c7de
3 changed files with 35 additions and 1 deletions

View File

@@ -2,8 +2,39 @@
#define ELEMENT_NAMING_UTILS_H
#include <string>
#include <utility>
#include "FCGlobal.h"
namespace App
{
/** Return type for lookups of new and old style sub-element names
*
*/
struct ElementNamePair
{
std::string newName;
std::string oldName;
ElementNamePair() = default;
ElementNamePair(std::string newNameStr, std::string oldNameStr) :
newName(std::move(newNameStr)), oldName(std::move(oldNameStr))
{
}
bool operator==(const ElementNamePair& other) const
{
return this->newName == other.newName && this->oldName == other.oldName;
};
void swap(ElementNamePair& other) noexcept
{
std::swap(*this, other);
}
};
}
// clang-format off
namespace Data

View File

@@ -32,6 +32,8 @@
#include <boost/any.hpp>
#include <FCConfig.h>
#include "ElementNamingUtils.h"
namespace Py {
class Object;
}
@@ -486,7 +488,7 @@ protected:
String documentName;
String documentObjectName;
String subObjectName;
std::pair<std::string,std::string> shadowSub;
ElementNamePair shadowSub;
std::vector<Component> components;
bool documentNameSet;
bool documentObjectNameSet;

View File

@@ -32,6 +32,7 @@
#include <string>
#include <FCGlobal.h>
#include "ElementNamingUtils.h"
namespace Py {
class Object;
}