1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00
occt/tools/DFBrowser/DFBrowser_ItemDocument.hxx
dpasukhi a5a7b3185b Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
2025-01-26 00:43:57 +00:00

97 lines
3.5 KiB
C++

// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef DFBrowser_ItemDocument_H
#define DFBrowser_ItemDocument_H
#include <inspector/DFBrowser_ItemBase.hxx>
#include <Standard.hxx>
#include <TDocStd_Document.hxx>
class DFBrowser_ItemDocument;
typedef QExplicitlySharedDataPointer<DFBrowser_ItemDocument> DFBrowser_ItemDocumentPtr;
//! \class DFBrowser_ItemDocument
//! \brief Declaration of the tree model document item.
//! This item is connected to the OCAF document. Parent item is application, children are either
//! labels or attributes
class DFBrowser_ItemDocument : public DFBrowser_ItemBase
{
public:
//! Creates an item wrapped by a shared pointer
//! \param theRow the item row position in the parent item
//! \param theColumn the item column position in the parent item
//! \return the pointer to the created item
static DFBrowser_ItemDocumentPtr CreateItem(TreeModel_ItemBasePtr theParent,
const int theRow,
const int theColumn)
{
return DFBrowser_ItemDocumentPtr(new DFBrowser_ItemDocument(theParent, theRow, theColumn));
}
//! Destructor
virtual ~DFBrowser_ItemDocument() {}
//! Returns the current label
//! \return a label
Standard_EXPORT virtual TDF_Label GetLabel() const Standard_OVERRIDE;
//! Sets the item document
//! \param theLabel an object where the child items structure is found
void setDocument(const Handle(TDocStd_Document)& theDocument) { myDocument = theDocument; }
//! Returns true if the current document is not null
//! \return a boolean value
bool hasDocument() const { return !getDocument().IsNull(); }
//! Returns the current document
//! \return a label
Standard_EXPORT const Handle(TDocStd_Document)& getDocument() const;
//! Inits the item, fills internal containers
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Resets the cached item values
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
protected:
//! Initializes the current item. It is empty because Reset() is also empty.
virtual void initItem() const Standard_OVERRIDE;
//! Initializes the current item. It creates a backup of the specific item information
virtual QVariant initValue(const int theItemRole) const Standard_OVERRIDE;
protected:
//! Creates a child item in the given position.
//! \param theRow the child row position
//! \param theColumn the child column position
//! \return the created item
virtual TreeModel_ItemBasePtr createChild(int theRow, int theColumn) Standard_OVERRIDE;
private:
//! Constructor
//! \param theParent a parent item
DFBrowser_ItemDocument(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
: DFBrowser_ItemBase(theParent, theRow, theColumn)
{
}
private:
Handle(TDocStd_Document) myDocument; //!< cached application document by the row index of the item
};
#endif