]> OCCT Git - occt-copy.git/commitdiff
0022744: Global HashCode function for TCollection_ExtendedString
authorSSV <>
Fri, 18 Nov 2011 08:37:15 +0000 (08:37 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:31:06 +0000 (19:31 +0400)
src/QAOCC/QAOCC.cxx
src/TCollection/TCollection_ExtendedString.cdl
src/TCollection/TCollection_ExtendedString.cxx
src/TCollection/TCollection_ExtendedString.lxx [new file with mode: 0644]

index 2efc2dd4d80f76ac3286cf86ca37ed43e6d094b9..2ba6acc302b2fc99f3266ac4dfff6704af008293 100755 (executable)
@@ -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;
 }
index 60f8a97e2d45d3eaed0227d2559832e08597d005..6749774119e3074638d258f8adb3b70609d1f3a8 100755 (executable)
@@ -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; 
index c755a25f84dfb560c9403a50c0a393c47d1443bb..4df4d5c63caafa47bf5c0c1ea6eaa82226d3106c 100755 (executable)
@@ -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
 //----------------------------------------------------------------------------
diff --git a/src/TCollection/TCollection_ExtendedString.lxx b/src/TCollection/TCollection_ExtendedString.lxx
new file mode 100644 (file)
index 0000000..42d1c33
--- /dev/null
@@ -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);
+}