0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / Standard / Standard_CString.hxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and / or modify it
7 // under the terms of the GNU Lesser General Public version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 //============================================================================
16 //==== Titre: Standard_CString.hxx
17 //==== Role : The headr file of primitve type "CString" from package "Standard"
18 //====
19 //==== Implementation:  This is a primitive type implementadef with typedef
20 //====        typedef char* Standard_CString;
21 //============================================================================
22
23 #ifndef _Standard_CString_HeaderFile
24 # define _Standard_CString_HeaderFile
25
26 # ifndef _Standard_TypeDef_HeaderFile
27 #  include <Standard_TypeDef.hxx>
28 # endif
29
30 # ifdef _MSC_VER
31 #  define strcasecmp _stricmp
32 # endif
33
34 # include <string.h>
35 # include <stdio.h>
36
37 # ifndef _Standard_Integer_HeaderFile
38 #  include <Standard_Integer.hxx>
39 # endif
40
41
42 class Handle_Standard_Type;
43
44
45 __Standard_API const Handle_Standard_Type& Standard_CString_Type_();
46
47 inline  Standard_Integer Abs (const Standard_Integer);
48 inline Standard_CString ShallowCopy (const Standard_CString Value);
49 inline Standard_Boolean IsSimilar(const Standard_CString One
50                                  ,const Standard_CString Two);
51 __Standard_API Standard_Integer HashCode (const Standard_CString,
52                            const Standard_Integer);
53 inline Standard_Integer HashCode (const Standard_CString,
54                                   const Standard_Integer,
55                                   const Standard_Integer);
56 inline Standard_Integer HashCode (const Standard_CString,
57                                   const Standard_Integer ,
58                                   const Standard_Integer ,
59                                   Standard_Integer& );
60 Standard_Integer HashCodes (const Standard_CString ,
61                             const Standard_Integer  );
62
63 //! Equivalents of functions from standard C library that use always C locale
64 __Standard_API double Atof    (const char* theStr);
65 __Standard_API double Strtod  (const char* theStr, char** theNextPtr);
66 __Standard_API int    Printf  (const char* theFormat, ...);
67 __Standard_API int    Fprintf (FILE* theFile, const char* theFormat, ...);
68 __Standard_API int    Sprintf (char* theBuffer, const char* theFormat, ...);
69
70 //============================================================================
71 //==== ShallowCopy: Returns a CString
72 //============================================================================
73 inline Standard_CString ShallowCopy (const Standard_CString Value)
74 {
75   return Value;
76 }
77
78 //============================================================================
79 //==== IsSimilar : Returns Standard_True if two booleans have the same value
80 //============================================================================
81 inline Standard_Boolean IsSimilar(const Standard_CString One
82                                  ,const Standard_CString Two)
83 {
84   return (strcmp(One,Two) == 0);
85 }
86
87 //============================================================================
88 //==== HashCode of CString. Returns the HashCode itself and
89 //====                              the HashCode % Upper
90 //============================================================================
91 inline Standard_Integer HashCode (const Standard_CString Value,
92                                   const Standard_Integer Len ,
93                                   const Standard_Integer Upper ,
94                                   Standard_Integer& aHashCode )
95 {
96   aHashCode = HashCodes( Value , Len );
97 //  return (Abs( aHashCode ) % Upper ) + 1 ;
98   return HashCode( (Standard_Integer)aHashCode , Upper ) ;
99 }
100
101 //============================================================================
102 //==== HashCode of CString. Returns the HashCode itself and
103 //====                              the HashCode % Upper
104 //============================================================================
105 inline Standard_Integer HashCode (const Standard_CString Value,
106                                   const Standard_Integer Len ,
107                                   const Standard_Integer Upper )
108 {
109 //  return (Abs( HashCodes( Value , Len ) ) % Upper ) + 1 ;
110   return HashCode( (Standard_Integer) HashCodes( Value , Len ) , Upper ) ;
111 }
112
113 #endif