1 // Created on: 1993-10-08
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1993-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.
17 #include <Units_UnitsLexicon.ixx>
19 #include <Units_UnitsDictionary.hxx>
20 #include <Units_Token.hxx>
21 #include <TCollection_AsciiString.hxx>
23 #include <sys/types.h>
26 //=======================================================================
27 //function : Units_UnitsLexicon
29 //=======================================================================
31 Units_UnitsLexicon::Units_UnitsLexicon() : Units_Lexicon()
34 //=======================================================================
37 //=======================================================================
39 void Units_UnitsLexicon::Creates(const Standard_CString afilename1,
40 const Standard_CString afilename2,
41 const Standard_Boolean amode)
43 Handle(Units_UnitsDictionary) unitsdictionary;
46 thefilename = new TCollection_HAsciiString(afilename2);
48 if(!stat(afilename2,&buf)) thetime = buf.st_ctime;
50 Units_Lexicon::Creates(afilename1);
52 if(amode)unitsdictionary = Units::DictionaryOfUnits(amode);
56 //=======================================================================
59 //=======================================================================
61 Standard_Boolean Units_UnitsLexicon::UpToDate() const
64 TCollection_AsciiString string = FileName2();
66 if(Units_Lexicon::UpToDate())
68 if(!stat(string.ToCString(),&buf))
70 if(thetime >= buf.st_ctime) return Standard_True;
74 return Standard_False;
77 //=======================================================================
78 //function : FileName2
80 //=======================================================================
82 TCollection_AsciiString Units_UnitsLexicon::FileName2() const
84 return thefilename->String();