0022898: IGES import fails in german environment
[occt.git] / src / Units / Units_UnitsLexicon.cxx
1 // Created on: 1993-10-08
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <Units_UnitsLexicon.ixx>
24 #include <Units.hxx>
25 #include <Units_UnitsDictionary.hxx>
26 #include <Units_Token.hxx>
27 #include <TCollection_AsciiString.hxx>
28
29 #include <sys/types.h>
30 #include <sys/stat.h>
31
32 //=======================================================================
33 //function : Units_UnitsLexicon
34 //purpose  : 
35 //=======================================================================
36
37 Units_UnitsLexicon::Units_UnitsLexicon() : Units_Lexicon()
38 {}
39
40 //=======================================================================
41 //function : Creates
42 //purpose  : 
43 //=======================================================================
44
45 void Units_UnitsLexicon::Creates(const Standard_CString afilename1,
46                                  const Standard_CString afilename2,
47                                  const Standard_Boolean amode)
48 {
49   Handle(Units_UnitsDictionary) unitsdictionary;
50   struct stat buf;
51
52   thefilename = new TCollection_HAsciiString(afilename2);
53
54   if(!stat(afilename2,&buf)) thetime = buf.st_ctime;
55
56   Units_Lexicon::Creates(afilename1);
57
58   if(amode)unitsdictionary = Units::DictionaryOfUnits(amode);
59
60 }
61
62 //=======================================================================
63 //function : UpToDate
64 //purpose  : 
65 //=======================================================================
66
67 Standard_Boolean Units_UnitsLexicon::UpToDate() const
68 {
69   struct stat buf;
70   TCollection_AsciiString string = FileName2();
71
72   if(Units_Lexicon::UpToDate())
73     {
74       if(!stat(string.ToCString(),&buf))
75         {
76           if(thetime >= buf.st_ctime) return Standard_True;
77         }
78     }
79
80   return Standard_False;
81 }
82
83 //=======================================================================
84 //function : FileName2
85 //purpose  : 
86 //=======================================================================
87
88 TCollection_AsciiString Units_UnitsLexicon::FileName2() const
89 {
90   return thefilename->String();
91 }