0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / IFSelect / IFSelect_Act.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
42cf5bc1 14
15#include <IFSelect_Act.hxx>
16#include <IFSelect_SessionPilot.hxx>
17#include <Standard_DomainError.hxx>
18#include <Standard_Type.hxx>
7fd59977 19#include <TCollection_AsciiString.hxx>
20
92efcf78 21IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
22
7fd59977 23static TCollection_AsciiString thedefgr, thedefil;
24
25
26
27 IFSelect_Act::IFSelect_Act
28 (const Standard_CString name, const Standard_CString help,
29 const IFSelect_ActFunc func)
30 : thename (name) , thehelp (help) , thefunc (func) { }
31
32 IFSelect_ReturnStatus IFSelect_Act::Do
33 (const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot)
34{
35 if (!thefunc) return IFSelect_RetVoid;
36 return thefunc (pilot);
37}
38
39 Standard_CString IFSelect_Act::Help (const Standard_Integer) const
40 { return thehelp.ToCString(); }
41
42
43 void IFSelect_Act::SetGroup
44 (const Standard_CString group, const Standard_CString file)
45{ thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group);
46 thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file); }
47
48 void IFSelect_Act::AddFunc
49 (const Standard_CString name, const Standard_CString help,
50 const IFSelect_ActFunc func)
51{
52 Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
53 if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString());
54 act->Add (1,name);
55}
56
57 void IFSelect_Act::AddFSet
58 (const Standard_CString name, const Standard_CString help,
59 const IFSelect_ActFunc func)
60{
61 Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
62 if (thedefgr.Length() > 0)
63 act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString());
64 act->AddSet (1,name);
65}