b311480e |
1 | // Created on: 1991-04-11 |
2 | // Created by: Arnaud BOUZY |
3 | // Copyright (c) 1991-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <Expr_GeneralExpression.hxx> |
19 | #include <Expr_NamedExpression.hxx> |
20 | #include <Standard_Type.hxx> |
21 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
22 | |
92efcf78 |
23 | IMPLEMENT_STANDARD_RTTIEXT(Expr_NamedExpression,Expr_GeneralExpression) |
24 | |
a2ca2a30 |
25 | //======================================================================= |
26 | //function : GetName |
27 | //purpose : |
28 | //======================================================================= |
7fd59977 |
29 | const TCollection_AsciiString& Expr_NamedExpression::GetName() const |
30 | { |
31 | return myName; |
32 | } |
33 | |
a2ca2a30 |
34 | //======================================================================= |
35 | //function : SetName |
36 | //purpose : |
37 | //======================================================================= |
38 | |
7fd59977 |
39 | void Expr_NamedExpression::SetName(const TCollection_AsciiString& name) |
40 | { |
41 | myName = name; |
42 | } |
43 | |
a2ca2a30 |
44 | //======================================================================= |
45 | //function : IsShareable |
46 | //purpose : |
47 | //======================================================================= |
48 | |
7fd59977 |
49 | Standard_Boolean Expr_NamedExpression::IsShareable () const |
50 | { |
51 | return Standard_True; |
52 | } |
53 | |
a2ca2a30 |
54 | //======================================================================= |
55 | //function : IsIdentical |
56 | //purpose : |
57 | //======================================================================= |
58 | |
59 | Standard_Boolean Expr_NamedExpression::IsIdentical |
60 | (const Handle(Expr_GeneralExpression)& theOther) const |
7fd59977 |
61 | { |
a2ca2a30 |
62 | Standard_Boolean aResult(Standard_False); |
63 | if (theOther->IsKind(STANDARD_TYPE(Expr_NamedExpression))) { |
64 | // Handle(Expr_NamedExpression) me = this; |
65 | // Handle(Expr_NamedExpression) NEOther = Handle(Expr_NamedExpression)::DownCast(Other); |
66 | // return (me == NEOther); |
67 | |
68 | //AGV 22.03.12: Comparison should be based on names rather than Handles |
69 | const Expr_NamedExpression* pOther = |
70 | static_cast<const Expr_NamedExpression*>(theOther.operator->()); |
71 | if (pOther == this || pOther->GetName().IsEqual(myName)) |
72 | aResult = Standard_True; |
7fd59977 |
73 | } |
a2ca2a30 |
74 | return aResult; |
7fd59977 |
75 | } |
76 | |
77 | TCollection_AsciiString Expr_NamedExpression::String() const |
78 | { |
79 | return GetName(); |
80 | } |