1 // Created on: 1991-04-11
2 // Created by: Arnaud BOUZY
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Expr_GeneralExpression.hxx>
19 #include <Expr_NamedExpression.hxx>
20 #include <Standard_Type.hxx>
21 #include <TCollection_AsciiString.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(Expr_NamedExpression,Expr_GeneralExpression)
25 //=======================================================================
28 //=======================================================================
29 const TCollection_AsciiString& Expr_NamedExpression::GetName() const
34 //=======================================================================
37 //=======================================================================
39 void Expr_NamedExpression::SetName(const TCollection_AsciiString& name)
44 //=======================================================================
45 //function : IsShareable
47 //=======================================================================
49 Standard_Boolean Expr_NamedExpression::IsShareable () const
54 //=======================================================================
55 //function : IsIdentical
57 //=======================================================================
59 Standard_Boolean Expr_NamedExpression::IsIdentical
60 (const Handle(Expr_GeneralExpression)& theOther) const
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);
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;
77 TCollection_AsciiString Expr_NamedExpression::String() const