/////////////////////////////////////////////////////////////////////////////// // 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 __NW_SEARCH_H__ #define __NW_SEARCH_H__ #include "NwObject.h" #include "NwSelectionSetsTypes.h" class OdNwSearch; class OdNwFindConditionItem; class OdNwFindSelection; class OdNwObjectIterator; class OdNwVariant; class OdNwPropertyTree; /** \details This template class is a specialization of the OdSmartPtr class for OdNwFindConditionItem object pointers. */ typedef OdSmartPtr OdNwFindConditionItemPtr; /** \details This template class is a specialization of the OdArray class for OdNwFindConditionItemPtr objects. */ typedef OdArray OdNwFindConditionList; /** \details This template class is a specialization of the OdSmartPtr class for OdNwFindSelection object pointers. */ typedef OdSmartPtr OdNwFindSelectionPtr; /** \details This template class is a specialization of the OdSmartPtr class for OdNwObjectIterator object pointers. */ typedef OdSmartPtr OdNwObjectIteratorPtr; /** \details This template class is a specialization of the OdSmartPtr class for OdNwSearch object pointers. */ typedef OdSmartPtr OdNwSearchPtr; /** \details This template class is a specialization of the OdSmartPtr class for OdNwPropertyTree object pointers. */ typedef OdSmartPtr OdNwPropertyTreePtr; /** \details This class represents a model items searching by find conditions. */ class NWDBEXPORT OdNwSearch : public OdNwObject { //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdNwSearch); //DOM-IGNORE-END public: /** \details Default constructor. */ OdNwSearch(); /** \details Virtual destructor. Frees allocated resources. */ virtual ~OdNwSearch(); /** \details Finds all model items in the selection set according to find conditions. \param resCode [out] Error code of search complete status; eOk if the operation is successful or an appropriate error code otherwise. \returns OdNwObjectIdArray object with the found model item's object IDs. */ virtual OdNwObjectIdArray findAll(OdResult& resCode) = 0; /** \details Finds the first model item in the selection set according to find conditions. \param resCode [out] Error code of search complete status; eOk if the operation is successful or an appropriate error code otherwise. \returns OdNwObjectId object of the found model item. */ virtual OdNwObjectId findFirst(OdResult& resCode) = 0; /** \details Finds all model items in the selection set of an iterable view according to find conditions. \param resCode [out] Error code of search complete status; eOk if the operation is successful or an appropriate error code otherwise. \returns Smart pointer to an OdNwObjectIterator object with the find all iterable result. \remarks The returned iterator is a right direction iterator. Find iterator support methods: Name Description OdNwObjectIterator::start Resets searching and sets the iterable position to the first element. OdNwObjectIterator::done Returns true if there are no more search elements. OdNwObjectIterator::item Returns OdNwObjectId of the current searched model item. OdNwObjectIterator::element Returns OdNwObjectPtr with the opened searched model item. OdNwObjectIterator::step Iterates to the next searched model item.
*/ virtual OdNwObjectIteratorPtr findIterable(OdResult& resCode) = 0; /** \details Returns the find selection area object that will be searched. \returns Pointer to the find selection object. */ virtual OdNwFindSelectionPtr getFindSelection() const = 0; /** \details Gets a list of find conditions. \param findCondList [out] Receives an OdArray of OdNwFindConditionItemPtr objects. \returns The eOk value if the operation is successful, or an appropriate error code otherwise. */ virtual OdResult getFindConditionList(OdNwFindConditionList & findCondList) const = 0; /** \details Returns the search mode. \returns One of the enumerated items from the NwSelectionFindConditionMode::Enum enumerated type. \remarks Search mode can be one of the following: Name Value Description NwSelectionFindConditionMode::Enum::NONE 0 No items NwSelectionFindConditionMode::Enum::SELECTED 1 Direct contents of the selection. NwSelectionFindConditionMode::Enum::BELOW 2 Descendants of the items in the selection. NwSelectionFindConditionMode::Enum::ALL 3 Direct contents of the selection and their descendants.
*/ virtual NwSelectionFindConditionMode::Enum getMode() const = 0; /** \details Returns the flag for pruning below the result. \returns The true value if the flag is set, or false otherwise. */ virtual bool isPruneBelow() const = 0; public: /** \details Sets an explicit selection for the search's find selection. \param aExplicitSelection [in] Explicit selection as an array with object IDs. \returns The eOk value if the selection is set successfully, or an appropriate error code otherwise. */ virtual OdResult setFindSelection(const OdNwObjectIdArray& aExplicitSelection) = 0; /** \details Sets a search mode for a search object. \param searchMode [in] Mode for searching by find selection. \returns The eOk value if the mode is set successfully, or an appropriate error code otherwise. \remarks Search mode can be one of the following: Name Value Description NwSelectionFindConditionMode::Enum::NONE 0 No items. NwSelectionFindConditionMode::Enum::SELECTED 1 Direct contents of the selection. NwSelectionFindConditionMode::Enum::BELOW 2 Descendants of the items in the selection. NwSelectionFindConditionMode::Enum::ALL 3 Direct contents of the selection and their descendants.
*/ virtual OdResult setMode(NwSelectionFindConditionMode::Enum searchMode) = 0; /** \details Sets a Boolean flag that determines whether to search below the first search result. \param isPruneBelow [in] Boolean flag for pruning below the search result. \returns The eOk value if prune below is set successfully, or an appropriate error code otherwise. */ virtual OdResult setPruneBelow(bool isPruneBelow) = 0; /** \details Removes a find condition item by the specified index. \param findCndIdx [in] Find condition index of the find item to be removed. \returns The eOk value if the find condition is remove successfully, or an appropriate error code otherwise. */ virtual OdResult removeFindCondition(OdUInt32 findCndIdx) = 0; /** \details Removes all find condition items from the search. \returns The eOk value if find conditions are removed successfully, or an appropriate error code otherwise. */ virtual OdResult removeAllFindConditions() = 0; /** \details Changes the find condition item's flag state. \param findCndIdx [in] Find condition index of the find item to be changed. \param flag [in] Find condition flag to be changed. \param isSet [in] Boolean value of the find condition's new flag value. \returns The eOk value if the find condition's flag is changed successfully, or an appropriate error code otherwise. \remarks Flag type can be one of the following: Name Value Description NwSelectionFindConditionFlags::NONE 0 No additional options. NwSelectionFindConditionFlags::IGNORE_CATEGORY_USER_NAME 1 Ignore DisplayName when matching category. NwSelectionFindConditionFlags::IGNORE_CATEGORY_INTERNAL_NAME 2 Ignore internal name when matching category. NwSelectionFindConditionFlags::IGNORE_PROPERTY_USER_NAME 4 Ignore DisplayName when matching property. NwSelectionFindConditionFlags::IGNORE_PROPERTY_INTERNAL_NAME 8 Ignore internal name when matching property. NwSelectionFindConditionFlags::IGNORE_STRING_VALUE_CASE 16 Ignore DisplayName when matching category or property. NwSelectionFindConditionFlags::NEGATE_CONDITIONS 32 Negate the sense of the condition. NwSelectionFindConditionFlags::START_GROUP 64 When used with collection of conditions, marks the start of a group of conditions. Collection will match when any group of conditions matches. NwSelectionFindConditionFlags::IGNORE_STRING_VALUE_DIACRITICS 128 Ignore diacritic signs when matching DisplayString values. NwSelectionFindConditionFlags::IGNORE_STRING_VALUE_CHARACTER_WIDTH 256 Ignore character width when matching DisplayString values.
*/ virtual OdResult setFindConditionFlag(OdUInt32 findCndIdx, NwSelectionFindConditionFlags::Enum flag, bool isSet) = 0; /** \details Adds a new find condition item to the search. \param pPropTree [in] Property tree for the sheet in which this search object is created. \param sCategory [in] String value with display name of the specified category. \param sProperty [in] String value with display name of the specified property. \param condition [in] Condition type for the new find condition item. \param value [in] Variant value for the new find condition item. \returns The eOk value if the find condition is added successfully, or an appropriate error code otherwise. \remarks Condition type can be one of the following: Name Value Description NwSelectionFindConditionType::NEVER 0 Never used. NwSelectionFindConditionType::ATTRIB 1 With attributes. NwSelectionFindConditionType::NO_ATTRIB 2 No attributes. NwSelectionFindConditionType::PROP 3 Defined; to match the search criteria, a property must have a value defined. NwSelectionFindConditionType::NO_PROP 4 Undefined; to match the search criteria, a property must not have a defined value. NwSelectionFindConditionType::SAME_TYPE 5 The same type NwSelectionFindConditionType::EQUALS 6 Equals; a property must match the value exactly. NwSelectionFindConditionType::NOT_EQUALS 7 Not equal; use with any type of property. NwSelectionFindConditionType::LESS_THAN 8 Less than; use with numerical property types only. NwSelectionFindConditionType::LESS_EQUAL 9 Less than or equal; use with numerical property types only. NwSelectionFindConditionType::GREATER_EQUAL 10 Greater than or equal; use with numerical property types only. NwSelectionFindConditionType::GREATER_THAN 11 Greater than; use with numerical property types only. NwSelectionFindConditionType::CONTAINS 12 A property must contain the specified value. NwSelectionFindConditionType::WILDCARD 13 Using wildcards allows matching any one character (?) or an arbitrary sequence of characters (*). NwSelectionFindConditionType::WITHIN_DAY 14 To match the search criteria, a property must be within the specified day. NwSelectionFindConditionType::WITHIN_WEEK 15 To match the search criteria, a property must be within the specified week.
*/ virtual OdResult addFindCondition(OdNwPropertyTreePtr pPropTree, const OdString& sCategory, const OdString& sProperty, NwSelectionFindConditionType::Enum condition, const OdNwVariant& value) = 0; /** \details Changes the new find condition item of the search. \param findCondIdx [in] Find condition index of the find item to be changed. \param pPropTree [in] Property tree for the sheet in which this search object is created. \param sCategory [in] String value with the display name of the specified category. \param sProperty [in] String value with the display name of the specified property. \param condition [in] Condition type for the changed find condition item. \param value [in] Variant value for the changed find condition item. \returns The eOk value if the find condition is changed successfully, or an appropriate error code otherwise. \remarks Condition type can be one of the following: Name Value Description NwSelectionFindConditionType::NEVER 0 Never used. NwSelectionFindConditionType::ATTRIB 1 With attributes. NwSelectionFindConditionType::NO_ATTRIB 2 No attributes. NwSelectionFindConditionType::PROP 3 Defined; to match the search criteria, a property must have a value defined. NwSelectionFindConditionType::NO_PROP 4 Undefined; to match the search criteria, a property must not have a defined value. NwSelectionFindConditionType::SAME_TYPE 5 The same type NwSelectionFindConditionType::EQUALS 6 Equals; a property must match the value exactly. NwSelectionFindConditionType::NOT_EQUALS 7 Not equal; use with any type of property. NwSelectionFindConditionType::LESS_THAN 8 Less than; use with numerical property types only. NwSelectionFindConditionType::LESS_EQUAL 9 Less than or equal; use with numerical property types only. NwSelectionFindConditionType::GREATER_EQUAL 10 Greater than or equal; use with numerical property types only. NwSelectionFindConditionType::GREATER_THAN 11 Greater than; use with numerical property types only. NwSelectionFindConditionType::CONTAINS 12 A property must contain the specified value. NwSelectionFindConditionType::WILDCARD 13 Using wildcards allows matching any one character (?) or an arbitrary sequence of characters (*). NwSelectionFindConditionType::WITHIN_DAY 14 To match the search criteria, a property must be within the specified day. NwSelectionFindConditionType::WITHIN_WEEK 15 To match the search criteria, a property must be within the specified week.
*/ virtual OdResult changeFindConditionByIdx(OdUInt32 findCondIdx, OdNwPropertyTreePtr pPropTree, const OdString& sCategory, const OdString& sProperty, NwSelectionFindConditionType::Enum condition, const OdNwVariant& value) = 0; public: /** \details Creates a search object for the corresponding database. \param pDb [in] Raw pointer to the specified database. \returns Smart pointer to an OdNwSearch object. \remarks New search object is created for the active database's sheet; if you need to create a search for another sheet, select the database to another sheet state and create a new search. */ static OdNwSearchPtr createObject(OdNwDatabase* pDb); }; #endif /* __NW_SEARCH_H__ */