/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _DAI_ITEM_SECTION_H #define _DAI_ITEM_SECTION_H #include "OdaCommon.h" #include "daiBuildOptions.h" #include "daiSimpleSectionBase.h" #include "TD_PackPush.h" namespace OdDAI { /** \details The class that implements a base class for simple section item object such as Anchor or Reference. */ template class DAI_EXPORT SectionItem { public: /** \details Assignment operator for the SectionItem data type. \param applyFrom [in] A SectionItem data type value to be assigned (a right-hand operand of the assignment operation). \returns The reference to the SectionItem object modified by the assignment operation. */ SectionItem& operator=(const SectionItem& applyFrom); /** \details An equality operator for the SectionItem data type. \param compareTo [in] Another SectionItem object to be compared with (the right-hand operand of the comparison operation). \returns true if SectionItem objects are equal; otherwise, the method returns false. */ bool operator==(const SectionItem& compareTo) const; /** \details Retrieves the name of SectionItem. \returns returns the name of ItemsSection. */ const OdAnsiString& getName() const; /** \details Sets new value for the SectionItem instance. \param newValue [in] settled value. */ void setValue(const OdAnsiString& newValue); /** \details Retrieves the value of SectionItem. \returns returns an OdAnsiString that contains SectionItem value */ const OdAnsiString& getValue() const; /** \details Retrieves is this SectionItem is deleted from Section. \returns true if SectionItem was deleted from Section, otherwise returns false. */ bool isDetached() const; /** \details Retrieves if this SectionItem has valid and actual value. \returns true if SectionItem has valid value, otherwise returns false. */ bool exists() const; /** \details Retrieves the section which contains this ITemSection. \returns the Section if it does not deleted, otherwise returns nullptr. */ TSection* parentSection(); //DOM-IGNORE-BEGIN protected: SectionItem(const OdAnsiString& name, const OdAnsiString& value, TSection* section); private: OdAnsiString m_name; OdAnsiString m_value; TSection* m_parentSection; }; } namespace OdDAI { template inline SectionItem::SectionItem(const OdAnsiString& name, const OdAnsiString& value, TSection* section) : m_name(name) , m_value(value) , m_parentSection(section) { } template inline SectionItem& SectionItem::operator=(const SectionItem& other) { if (&other == this) { return *this; } m_name = other.m_name; m_value = other.m_value; m_parentSection = other.m_parentSection; return *this; } template inline bool SectionItem::operator==(const SectionItem& other) const { if (&other == this) { return true; } return m_name == other.m_name && m_value == other.m_value && m_parentSection == other.m_parentSection; } template inline const OdAnsiString& SectionItem::getName() const { return m_name; } template void SectionItem::setValue(const OdAnsiString& newValue) { m_value = newValue; } template const OdAnsiString& SectionItem::getValue() const { return m_value; } template bool SectionItem::isDetached() const { return m_parentSection == nullptr; } template bool SectionItem::exists() const { return !isDetached(); } template TSection* SectionItem::parentSection() { return m_parentSection; } } //DOM-IGNORE-END #include "TD_PackPop.h" #endif // _DAI_ITEM_SECTION_H