6aa187d3e69b235702ba88edf68b236c930d2c0f
[occt.git] / src / Standard / Standard_ExtCharacter.cxx
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 under
7 // the terms of the GNU Lesser General Public License 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_ExtCharacter.cxx
17 //==== Role : the methodes which raise the exceptions are implemented in 
18 //====        this file.
19 //============================================================================
20 #include <stdlib.h>
21 #include <Standard_ExtCharacter.hxx>
22 #include <Standard_Integer.hxx>
23 #include <Standard_RangeError.hxx>
24
25 #include <Standard_Type.hxx>
26 #ifndef _Standard_Stream_HeaderFile
27 #include <Standard_Stream.hxx>
28 #endif
29 #ifndef _Standard_OStream_HeaderFile
30 #include <Standard_OStream.hxx>
31 #endif
32
33 const Handle_Standard_Type& Standard_ExtCharacter_Type_() 
34 {
35   static Handle_Standard_Type _aType = 
36     new Standard_Type("Standard_ExtCharacter",sizeof(Standard_ExtCharacter),
37                       0,NULL);
38   
39   return _aType;
40 }
41
42
43 // ------------------------------------------------------------------
44 // Hascode : Computes a hascoding value for a given ExtCharacter
45 // ------------------------------------------------------------------
46 Standard_Integer HashCode(const Standard_ExtCharacter me, 
47                           const Standard_Integer Upper)
48 {
49   if (Upper < 1){
50     Standard_RangeError::
51       Raise("Try to apply HashCode method with negative or null argument.");
52   }
53   Standard_Integer aCode = me; 
54   return ( aCode % Upper) + 1;
55 }
56
57 // ------------------------------------------------------------------
58 // ShallowDump : Writes a character
59 // ------------------------------------------------------------------
60 Standard_EXPORT void ShallowDump (const Standard_ExtCharacter Value 
61                                   ,Standard_OStream& s)
62 {   
63   s << hex << Value << " Standard_ExtCharacter" << endl;
64 }