1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0022744: Global HashCode function for TCollection_ExtendedString

This commit is contained in:
SSV 2011-11-18 08:37:15 +00:00 committed by bugmaster
parent 997cf5f22c
commit 7fa0a5984d
4 changed files with 54 additions and 21 deletions

View File

@ -5174,6 +5174,28 @@ Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const ch
}
#include <NCollection_DataMap.hxx>
Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if (argc != 1) {
di << "Usage : " << argv[0] << "\n";
return 1;
}
TCollection_ExtendedString anExtString;
Standard_ExtCharacter aNonAsciiChar = 0xff00;
anExtString.Insert(1, aNonAsciiChar);
di << "Is ASCII: " << ( anExtString.IsAscii() ? "true" : "false" ) << "\n";
NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
aMap.Bind(anExtString, 0);
return 0;
}
Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
@ -5232,7 +5254,6 @@ Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const ch
di << "Status = " << aStatus << "\n";
return 0;
}
void QAOCC::Commands(Draw_Interpretor& theCommands) {
@ -5341,5 +5362,6 @@ void QAOCC::Commands(Draw_Interpretor& theCommands) {
theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
return;
}

View File

@ -324,11 +324,13 @@ is
HashCode(myclass ; astring : ExtendedString from TCollection; Upper : Integer)
returns Integer;
---Level: Internal
---Purpose: Returns a hashed value for the extended string
-- astring within the range 1..Upper.
-- Note: if astring is ASCII, the computed value is
-- the same as the value computed with the HashCode function on a
-- TCollection_AsciiString string composed with equivalent ASCII characters
---C++: inline
IsEqual(myclass ; string1 : ExtendedString from TCollection;
string2 : ExtendedString from TCollection)
@ -336,6 +338,7 @@ is
---Purpose: Returns true if the characters in this extended
-- string are identical to the characters in the other extended string.
-- Note that this method is an alias of operator ==.
---C++: inline
ToUTF8CString(me; theCString : out PCharacter from Standard)
returns Integer from Standard;

View File

@ -991,26 +991,6 @@ Standard_ExtCharacter TCollection_ExtendedString::Value
}
//------------------------------------------------------------------------
// HashCode
//------------------------------------------------------------------------
Standard_Integer TCollection_ExtendedString::HashCode
(const TCollection_ExtendedString& astring,
const Standard_Integer Upper)
{
return ::HashCode(astring.ToExtString(),Upper);
}
//------------------------------------------------------------------------
// IsEqual
//------------------------------------------------------------------------
Standard_Boolean TCollection_ExtendedString::IsEqual
(const TCollection_ExtendedString& string1,
const TCollection_ExtendedString& string2)
{
return string1.IsEqual(string2);
}
//----------------------------------------------------------------------------
// Convert CString (including multibyte case) to UniCode representation
//----------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
//------------------------------------------------------------------------
// HashCode
//------------------------------------------------------------------------
inline Standard_Integer HashCode(const TCollection_ExtendedString& theString,
const Standard_Integer theUpper)
{
return TCollection_ExtendedString::HashCode(theString, theUpper);
}
//------------------------------------------------------------------------
// HashCode
//------------------------------------------------------------------------
inline Standard_Integer
TCollection_ExtendedString::HashCode (const TCollection_ExtendedString& theString,
const Standard_Integer theUpper)
{
return ::HashCode(theString.ToExtString(), theUpper);
}
//------------------------------------------------------------------------
// IsEqual
//------------------------------------------------------------------------
inline Standard_Boolean
TCollection_ExtendedString::IsEqual (const TCollection_ExtendedString& theString1,
const TCollection_ExtendedString& theString2)
{
return theString1.IsEqual(theString2);
}