1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00
occt/src/PColStd/PColStd_HashExtendedString.cxx
2012-03-05 19:23:40 +04:00

56 lines
1.6 KiB
C++
Executable File

//-Copyright: Matra Datavision 1992,1993
//-Version:
//-History:
// Version Date Purpose
// 01/04/93 Creation
//-Language C++
//-Declarations
#include <Standard_Integer.hxx>
#include <PColStd_HashExtendedString.ixx>
#include <Standard_RangeError.hxx>
#include <PCollection_HExtendedString.hxx>
//=======================================================================
// Function : Create
//=======================================================================
PColStd_HashExtendedString::PColStd_HashExtendedString()
{}
//=======================================================================
// Function : HashCode
//=======================================================================
Standard_Integer PColStd_HashExtendedString::HashCode
(const Handle(PCollection_HExtendedString) &MyKey,
const Standard_Integer Upper) const
{
Standard_Integer total=0;
if ( Upper < 1 ){
Standard_RangeError::
Raise("Try to apply HasCode method with negative or null argument.");
}
for (Standard_Integer I = 1 ; I <= MyKey->Length() ; I++ ) {
total = total + (Standard_Integer) (MyKey->Value(I));
}
total = ::HashCode( total , Upper ) ;
return total;
}
//=======================================================================
// Function : Compare
//=======================================================================
Standard_Boolean PColStd_HashExtendedString::Compare
(const Handle(PCollection_HExtendedString) &One,
const Handle(PCollection_HExtendedString) &Two) const
{
return (One->IsSameString(Two));
}