0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / DDF / DDF.hxx
CommitLineData
42cf5bc1 1// Created by: DAUTRY Philippe
2// Copyright (c) 1997-1999 Matra Datavision
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _DDF_HeaderFile
17#define _DDF_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <Standard_CString.hxx>
25#include <Draw_Interpretor.hxx>
26class TDF_Data;
27class TDF_Label;
28class Standard_GUID;
29class TDF_Attribute;
30class DDF_Data;
31class DDF_Browser;
32class DDF_Transaction;
33
34
35//! Provides facilities to manipulate data framework
36//! in a Draw-Commands environment.
37class DDF
38{
39public:
40
41 DEFINE_STANDARD_ALLOC
42
43
44 //! Search in draw directory the framewok identified
45 //! by its name <Name>. returns True if found. In that
46 //! case <DF> is setted.
47 Standard_EXPORT static Standard_Boolean GetDF (Standard_CString& Name, Handle(TDF_Data)& DF, const Standard_Boolean Complain = Standard_True);
48
49 //! Search in <DF> the label identified by its entry
50 //! <Entry>. returns <True> if found. In that case
51 //! <Label> is setted.
52 Standard_EXPORT static Standard_Boolean FindLabel (const Handle(TDF_Data)& DF, const Standard_CString Entry, TDF_Label& Label, const Standard_Boolean Complain = Standard_True);
53
54 //! Search in <DF> the label identified by its entry
55 //! <Entry>. if label doesn't exist, create and add
56 //! the Label in <DF>. In that case return True.
57 Standard_EXPORT static Standard_Boolean AddLabel (const Handle(TDF_Data)& DF, const Standard_CString Entry, TDF_Label& Label);
58
59 //! Search in <DF> the attribute identified by its
60 //! <ID> and its <entry>. returns <True> if found. In
61 //! that case A is setted.
62 Standard_EXPORT static Standard_Boolean Find (const Handle(TDF_Data)& DF, const Standard_CString Entry, const Standard_GUID& ID, Handle(TDF_Attribute)& A, const Standard_Boolean Complain = Standard_True);
63
aa00364d 64 //! Safe variant for arbitrary type of argument
65 template <class T>
66 static Standard_Boolean Find (const Handle(TDF_Data)& DF, const Standard_CString Entry, const Standard_GUID& ID, Handle(T)& A, const Standard_Boolean Complain = Standard_True)
67 {
68 Handle(TDF_Attribute) anAttr = A;
69 return Find (DF, Entry, ID, anAttr, Complain) && ! (A = Handle(T)::DownCast(anAttr)).IsNull();
70 }
71
42cf5bc1 72 Standard_EXPORT static Draw_Interpretor& ReturnLabel (Draw_Interpretor& theCommands, const TDF_Label& L);
73
74 Standard_EXPORT static void AllCommands (Draw_Interpretor& theCommands);
75
76 //! Basic commands.
77 Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands);
78
79 //! Data framework commands
80 //! create, clear & copy.
81 Standard_EXPORT static void DataCommands (Draw_Interpretor& theCommands);
82
83 //! open commit abort a transaction
84 //! undo facilities.
85 Standard_EXPORT static void TransactionCommands (Draw_Interpretor& theCommands);
86
87 //! Browser commands .
88 Standard_EXPORT static void BrowserCommands (Draw_Interpretor& theCommands);
89
90
91
92
93protected:
94
95
96
97
98
99private:
100
101
102
103
104friend class DDF_Data;
105friend class DDF_Browser;
106friend class DDF_Transaction;
107
108};
109
110
111
112
113
114
115
116#endif // _DDF_HeaderFile