Test for 0022778: Bug in BRepMesh
[occt.git] / src / PColStd / PColStd_HashExtendedString.cxx
CommitLineData
b311480e 1// Copyright (c) 1992-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19
7fd59977 20//-Version:
21
7fd59977 22// Version Date Purpose
23// 01/04/93 Creation
24
25//-Language C++
26
27//-Declarations
28#include <Standard_Integer.hxx>
29#include <PColStd_HashExtendedString.ixx>
30#include <Standard_RangeError.hxx>
31#include <PCollection_HExtendedString.hxx>
32
33//=======================================================================
34// Function : Create
35//=======================================================================
36
37PColStd_HashExtendedString::PColStd_HashExtendedString()
38{}
39
40//=======================================================================
41// Function : HashCode
42//=======================================================================
43
44Standard_Integer PColStd_HashExtendedString::HashCode
45 (const Handle(PCollection_HExtendedString) &MyKey,
46 const Standard_Integer Upper) const
47{
48 Standard_Integer total=0;
49
50 if ( Upper < 1 ){
51 Standard_RangeError::
52 Raise("Try to apply HasCode method with negative or null argument.");
53 }
54 for (Standard_Integer I = 1 ; I <= MyKey->Length() ; I++ ) {
55 total = total + (Standard_Integer) (MyKey->Value(I));
56 }
57 total = ::HashCode( total , Upper ) ;
58
59 return total;
60}
61
62//=======================================================================
63// Function : Compare
64//=======================================================================
65
66Standard_Boolean PColStd_HashExtendedString::Compare
67 (const Handle(PCollection_HExtendedString) &One,
68 const Handle(PCollection_HExtendedString) &Two) const
69{
70 return (One->IsSameString(Two));
71}