1 // Created on: 1994-08-26 2 // Created by: Christian CAILLET 3 // Copyright (c) 1994-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 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. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 18 #include <IFSelect_ContextWrite.hxx> 19 #include <IGESData_IGESWriter.hxx> 20 #include <IGESSelect_AddFileComment.hxx> 21 #include <Standard_Type.hxx> 22 #include <TCollection_AsciiString.hxx> 23 #include <TCollection_HAsciiString.hxx> 24 25 #include <stdio.h> IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_AddFileComment,IGESSelect_FileModifier)26IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_AddFileComment,IGESSelect_FileModifier) 27 28 IGESSelect_AddFileComment::IGESSelect_AddFileComment () 29 { thelist = new TColStd_HSequenceOfHAsciiString(); } 30 Clear()31 void IGESSelect_AddFileComment::Clear () 32 { thelist->Clear(); } 33 34 AddLine(const Standard_CString line)35 void IGESSelect_AddFileComment::AddLine (const Standard_CString line) 36 { thelist->Append (new TCollection_HAsciiString(line)); } 37 AddLines(const Handle (TColStd_HSequenceOfHAsciiString)& lines)38 void IGESSelect_AddFileComment::AddLines 39 (const Handle(TColStd_HSequenceOfHAsciiString)& lines) 40 { thelist->Append (lines); } 41 NbLines() const42 Standard_Integer IGESSelect_AddFileComment::NbLines () const 43 { return thelist->Length(); } 44 Line(const Standard_Integer num) const45 Standard_CString IGESSelect_AddFileComment::Line 46 (const Standard_Integer num) const 47 { return thelist->Value(num)->ToCString(); } 48 Handle(TColStd_HSequenceOfHAsciiString)49 Handle(TColStd_HSequenceOfHAsciiString) IGESSelect_AddFileComment::Lines 50 () const 51 { return thelist; } 52 Perform(IFSelect_ContextWrite &,IGESData_IGESWriter & writer) const53 void IGESSelect_AddFileComment::Perform 54 (IFSelect_ContextWrite& , 55 IGESData_IGESWriter& writer) const 56 { 57 Standard_Integer i, nb = NbLines(); 58 for (i = 1; i <= nb; i ++) { 59 writer.SendStartLine (Line(i)); 60 } 61 } 62 Label() const63 TCollection_AsciiString IGESSelect_AddFileComment::Label () const 64 { 65 Standard_Integer nb = NbLines(); 66 char labl[80]; 67 sprintf (labl, "Add %d Comment Lines (Start Section)",nb); 68 return TCollection_AsciiString (labl); 69 } 70