mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#14411 Enforce name uniqueness for surfaces, polygons and folders
* #14411 Enforce name uniqueness for surfaces, polygons and folders Names must be unique among siblings sharing the same parent folder. Items in different folders may keep identical names, and comparison is case sensitive. Siblings are the objects held by the same caf::PdmChildArrayField. Items and folders live in two distinct child arrays in caf::PdmNestedCollection, so a folder and an item may share a name under the same parent. The Python API gets an OnNameConflict flag on AddFolder, CreatePolygon, ImportSurface and NewRegularSurface, supporting FAIL (default), AUTO_RENAME and OVERWRITE. NewSurface is left out, as grid case surfaces derive their tree label from the case and K index and carry no name of their own.
This commit is contained in:
1 parent
5e791353b2
commit
ebf75c09a1
28 files changed
+889
-26
No files matched your search
@@ -72,9 +72,10 @@ public:
|
||||
std::vector<SelfT*> subCollections() const;
|
||||
|
||||
// Subcollection CRUD
|
||||
void addSubCollection( SelfT* sub );
|
||||
PdmObject* addNewSubCollection() override;
|
||||
SelfT* findSubCollectionByName( const QString& name ) const;
|
||||
void addSubCollection( SelfT* sub );
|
||||
PdmObject* addNewSubCollection() override;
|
||||
PdmChildArrayFieldHandle* subCollectionsField() override;
|
||||
SelfT* findSubCollectionByName( const QString& name ) const;
|
||||
|
||||
// Returns items held by this collection and recursively by all subcollections.
|
||||
// For items at this level only, use items().
|
||||
|
||||
@@ -197,6 +197,15 @@ PdmObject* PdmNestedCollection<SelfT, ItemT>::addNewSubCollection()
|
||||
return sub;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename SelfT, typename ItemT>
|
||||
PdmChildArrayFieldHandle* PdmNestedCollection<SelfT, ItemT>::subCollectionsField()
|
||||
{
|
||||
return &m_subCollections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmChildArrayFieldHandle;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -59,6 +60,11 @@ public:
|
||||
// nullptr; concrete derivations (typically PdmNestedCollection<>) override.
|
||||
virtual PdmObject* addNewSubCollection() { return nullptr; }
|
||||
|
||||
// Type-erased access to the field holding the sub-collections, for generic code that must
|
||||
// inspect the folders without knowing the concrete collection type. Default returns nullptr;
|
||||
// PdmNestedCollection<> overrides.
|
||||
virtual PdmChildArrayFieldHandle* subCollectionsField() { return nullptr; }
|
||||
|
||||
// Marks this instance as the topmost folder: hides and disables IO on the collection name,
|
||||
// makes the object non-deletable.
|
||||
void setAsTopmostFolder();
|
||||
|
||||
Reference in new issue
Block a user